1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
|
#!/bin/bash
#
# build.sh
# Copyright 2007 Alex Holkner
#
# This file is part of AVbin.
#
# AVbin is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 3 of
# the License, or (at your option) any later version.
#
# AVbin is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
AVBIN_VERSION=`cat VERSION`
FFMPEG_REVISION=`cat ffmpeg.revision`
# Directory holding ffmpeg checkout.
FFMPEG=ffmpeg
patch_ffmpeg() {
patch -d $FFMPEG -p0 < $1
}
build_ffmpeg() {
if [ ! -d $FFMPEG ]; then
echo "$FFMPEG does not exist, please symlink to your local checkout."
exit 1
fi
config=`pwd`/ffmpeg.configure.$PLATFORM
common=`pwd`/ffmpeg.configure.common
pushd $FFMPEG
if [ ! $REBUILD ]; then
make distclean
cat $config $common | egrep -v '^#' | xargs ./configure || exit 1
fi
make || exit 1
popd
}
build_avbin() {
export AVBIN_VERSION
export FFMPEG_REVISION
export PLATFORM
export FFMPEG
if [ ! $REBUILD ]; then
make clean
fi
make || exit 1
}
build_darwin_universal() {
if [ ! -e dist/darwin-x86-32/libavbin.$AVBIN_VERSION.dylib ]; then
PLATFORM=darwin-x86-32
build_ffmpeg
build_avbin
fi
if [ ! -e dist/darwin-ppc-32/libavbin.$AVBIN_VERSION.dylib ]; then
PLATFORM=darwin-ppc-32
build_ffmpeg
build_avbin
fi
mkdir -p dist/darwin-universal
lipo -create \
-output dist/darwin-universal/libavbin.$AVBIN_VERSION.dylib \
dist/darwin-x86-32/libavbin.$AVBIN_VERSION.dylib \
dist/darwin-ppc-32/libavbin.$AVBIN_VERSION.dylib
}
while [ "${1:0:2}" == "--" ]; do
case $1 in
"--rebuild") REBUILD=1;;
"--patch")
shift
if [ ! "$1" -o ! -f "$1" ]; then
echo "No patch file specified or file does not exist."
exit 1
fi
patch_ffmpeg $1
exit
;;
*) echo "Unrecognised option: $1" && exit 1;;
esac
shift
done;
platforms=$*
if [ ! "$platforms" ]; then
echo "Usage: ./build.sh [options] <platform> [<platform> [<platform> ...]]"
echo " or: ./build.sh --patch <patchfile>"
echo
echo "Options"
echo " --rebuild Don't reconfigure, just run make."
echo " --patch <file> Apply a patch to ffmpeg."
echo
echo "Supported platforms:"
echo " linux-x86-32"
echo " linux-x86-64"
echo " darwin-ppc-32"
echo " darwin-x86-32"
echo " darwin-universal"
echo " win32"
exit 1
fi
for PLATFORM in $platforms; do
if [ $PLATFORM == "darwin-universal" ]; then
build_darwin_universal
else
build_ffmpeg
build_avbin
fi
done
|