| 1 |
#!/bin/sh -v |
|---|
| 2 |
PATH=$PATH:/usr/local/bin:/usr/bin:/sw/bin:/opt/local/bin |
|---|
| 3 |
buildid_ffmpeg="r`svn info ffmpeg | grep -F Revision | awk '{print $2}'`" |
|---|
| 4 |
|
|---|
| 5 |
if [ "$MACOSX_DEPLOYMENT_TARGET" = "" ]; then |
|---|
| 6 |
MACOSX_DEPLOYMENT_TARGET="10.4" |
|---|
| 7 |
fi |
|---|
| 8 |
|
|---|
| 9 |
generalConfigureOptions="--disable-muxers --disable-encoders --disable-stripping --enable-pthreads --disable-ffmpeg --disable-network --disable-ffplay --disable-vhook --disable-ffserver" |
|---|
| 10 |
sdkflags="-isysroot $SDKROOT -mmacosx-version-min=$MACOSX_DEPLOYMENT_TARGET -ggdb -Dattribute_deprecated=" |
|---|
| 11 |
|
|---|
| 12 |
if [ "$BUILD_STYLE" = "Development" ] ; then |
|---|
| 13 |
generalConfigureOptions="$generalConfigureOptions --disable-optimizations --disable-mmx" |
|---|
| 14 |
fi |
|---|
| 15 |
|
|---|
| 16 |
if what /usr/bin/ld | grep -q ld64-77; then |
|---|
| 17 |
no_pic=0 |
|---|
| 18 |
else |
|---|
| 19 |
no_pic=1 |
|---|
| 20 |
fi |
|---|
| 21 |
|
|---|
| 22 |
if [ $no_pic -gt 0 ]; then |
|---|
| 23 |
sdkflags="$sdkflags -mdynamic-no-pic" # ld can't handle -fno-pic on ppc |
|---|
| 24 |
else |
|---|
| 25 |
#no-pic only on pre-leopard |
|---|
| 26 |
echo "warning: Due to issues with Xcode 3.0, Perian will run very slowly! Please get the iPhone SDK or fix Patches/ffmpeg.diff!"; |
|---|
| 27 |
generalConfigureOptions="$generalConfigureOptions --disable-decoder=cavs --disable-decoder=vc1 --disable-decoder=wmv3 --disable-mmx --enable-shared" |
|---|
| 28 |
fi |
|---|
| 29 |
|
|---|
| 30 |
if [ "$CC" = "" ]; then |
|---|
| 31 |
CC="gcc" |
|---|
| 32 |
export CC |
|---|
| 33 |
fi |
|---|
| 34 |
|
|---|
| 35 |
export sdkflags |
|---|
| 36 |
|
|---|
| 37 |
OUTPUT_FILE="$BUILT_PRODUCTS_DIR/Universal/buildid" |
|---|
| 38 |
|
|---|
| 39 |
if [[ -e "$OUTPUT_FILE" ]] ; then |
|---|
| 40 |
oldbuildid_ffmpeg=`cat "$OUTPUT_FILE"` |
|---|
| 41 |
else |
|---|
| 42 |
oldbuildid_ffmpeg="buildme" |
|---|
| 43 |
fi |
|---|
| 44 |
|
|---|
| 45 |
QUICKBUILD="$BUILT_PRODUCTS_DIR/Universal/quickbuild" |
|---|
| 46 |
if [[ -e "$QUICKBUILD" ]] ; then |
|---|
| 47 |
oldbuildid_ffmpeg="quick" |
|---|
| 48 |
rm "$QUICKBUILD" |
|---|
| 49 |
fi |
|---|
| 50 |
|
|---|
| 51 |
if [[ $buildid == "r" ]] ; then |
|---|
| 52 |
echo "error: you're using svk. Please ask someone to add svk support to the build system. There's a script in Adium svn that can do this." |
|---|
| 53 |
exit 1; |
|---|
| 54 |
fi |
|---|
| 55 |
|
|---|
| 56 |
if [ `echo $ARCHS | grep -c i386` -gt 0 ] ; then |
|---|
| 57 |
buildi386=1 |
|---|
| 58 |
if [ `echo $ARCHS | grep -c ppc` -gt 0 ] ; then |
|---|
| 59 |
buildppc=1 |
|---|
| 60 |
else |
|---|
| 61 |
buildppc=0 |
|---|
| 62 |
fi |
|---|
| 63 |
elif [ `echo $ARCHS | grep -c ppc` -gt 0 ] ; then |
|---|
| 64 |
buildi386=0 |
|---|
| 65 |
buildppc=1 |
|---|
| 66 |
else |
|---|
| 67 |
echo "No architectures" |
|---|
| 68 |
exit 0 |
|---|
| 69 |
fi |
|---|
| 70 |
|
|---|
| 71 |
if [ -e ffmpeg/patched ] ; then |
|---|
| 72 |
(cd ffmpeg && svn revert -R . && rm patched) |
|---|
| 73 |
fi |
|---|
| 74 |
|
|---|
| 75 |
patch -p0 < Patches/ffmpeg-h264dsp-chroma-mc4.diff |
|---|
| 76 |
touch ffmpeg/patched |
|---|
| 77 |
|
|---|
| 78 |
# if [ $no_pic -eq 0 ] ; then |
|---|
| 79 |
# (cd ffmpeg; patch -p1 < ../Patches/ffmpeg-pic.diff) |
|---|
| 80 |
# fi |
|---|
| 81 |
|
|---|
| 82 |
touch patched |
|---|
| 83 |
|
|---|
| 84 |
if [ "$buildid_ffmpeg" = "$oldbuildid_ffmpeg" ] ; then |
|---|
| 85 |
echo "Static ffmpeg libs are up-to-date ; not rebuilding" |
|---|
| 86 |
else |
|---|
| 87 |
echo "Static ffmpeg libs are out-of-date ; rebuilding" |
|---|
| 88 |
|
|---|
| 89 |
echo -n "Building " |
|---|
| 90 |
if [ $buildi386 -eq $buildppc ] ; then |
|---|
| 91 |
echo "Universal" |
|---|
| 92 |
elif [ $buildi386 -gt 0 ] ; then |
|---|
| 93 |
echo "Intel-only" |
|---|
| 94 |
else |
|---|
| 95 |
echo "PPC-only" |
|---|
| 96 |
fi |
|---|
| 97 |
|
|---|
| 98 |
mkdir "$BUILT_PRODUCTS_DIR" |
|---|
| 99 |
####################### |
|---|
| 100 |
# Intel shlibs |
|---|
| 101 |
####################### |
|---|
| 102 |
if [ $buildi386 -gt 0 ] ; then |
|---|
| 103 |
BUILDDIR="$BUILT_PRODUCTS_DIR/intel" |
|---|
| 104 |
mkdir "$BUILDDIR" |
|---|
| 105 |
|
|---|
| 106 |
if [ "$BUILD_STYLE" != "Development" ] ; then |
|---|
| 107 |
export optCFlags="-mtune=nocona -fstrict-aliasing -frerun-cse-after-loop -fweb -falign-loops=16" |
|---|
| 108 |
fi |
|---|
| 109 |
|
|---|
| 110 |
cd "$BUILDDIR" |
|---|
| 111 |
if [ "$oldbuildid_ffmpeg" != "quick" ] ; then |
|---|
| 112 |
if [ `arch` = ppc ] ; then |
|---|
| 113 |
"$SRCROOT/ffmpeg/configure" --cc=$CC --enable-cross-compile --arch=i386 --extra-ldflags="$sdkflags -arch i386" --extra-cflags="-arch i386 $sdkflags $optCFlags" $extraConfigureOptions $generalConfigureOptions --cpu=pentium-m |
|---|
| 114 |
else |
|---|
| 115 |
"$SRCROOT/ffmpeg/configure" --cc=$CC --extra-cflags="$sdkflags $optCFlags" $extraConfigureOptions $generalConfigureOptions --cpu=pentium-m |
|---|
| 116 |
fi |
|---|
| 117 |
|
|---|
| 118 |
make depend > /dev/null 2>&1 || true |
|---|
| 119 |
fi |
|---|
| 120 |
if [ "$BUILD_STYLE" = "Development" ] ; then |
|---|
| 121 |
cd libavcodec |
|---|
| 122 |
export CFLAGS="-O1 -fomit-frame-pointer -funit-at-a-time"; make h264.o cabac.o h264_parser.o motion_est.o |
|---|
| 123 |
unset CFLAGS; |
|---|
| 124 |
cd .. |
|---|
| 125 |
fi |
|---|
| 126 |
make -j3 |
|---|
| 127 |
fi |
|---|
| 128 |
|
|---|
| 129 |
####################### |
|---|
| 130 |
# PPC shlibs |
|---|
| 131 |
####################### |
|---|
| 132 |
if [ $buildppc -gt 0 ] ; then |
|---|
| 133 |
BUILDDIR="$BUILT_PRODUCTS_DIR/ppc" |
|---|
| 134 |
mkdir "$BUILDDIR" |
|---|
| 135 |
|
|---|
| 136 |
if [ "$BUILD_STYLE" != "Development" ] ; then |
|---|
| 137 |
export optCFlags="-mcpu=G3 -mtune=G5 -fstrict-aliasing -funroll-loops -falign-loops=16 -mmultiple" |
|---|
| 138 |
fi |
|---|
| 139 |
|
|---|
| 140 |
cd "$BUILDDIR" |
|---|
| 141 |
if [ "$oldbuildid_ffmpeg" != "quick" ] ; then |
|---|
| 142 |
if [ `arch` = ppc ] ; then |
|---|
| 143 |
"$SRCROOT/ffmpeg/configure" --cc=$CC --extra-cflags="-faltivec $sdkflags $optCFlags" $extraConfigureOptions $generalConfigureOptions |
|---|
| 144 |
else |
|---|
| 145 |
"$SRCROOT/ffmpeg/configure" --cc=$CC --enable-cross-compile --arch=ppc --extra-ldflags="$sdkflags -arch ppc" --extra-cflags="-faltivec -arch ppc $sdkflags $optCFlags" $extraConfigureOptions $generalConfigureOptions |
|---|
| 146 |
fi |
|---|
| 147 |
|
|---|
| 148 |
make depend > /dev/null 2>&1 || true |
|---|
| 149 |
fi |
|---|
| 150 |
make -j3 |
|---|
| 151 |
fi |
|---|
| 152 |
fi |
|---|
| 153 |
|
|---|
| 154 |
####################### |
|---|
| 155 |
# lipo/copy shlibs |
|---|
| 156 |
####################### |
|---|
| 157 |
BUILDDIR="$BUILT_PRODUCTS_DIR/Universal" |
|---|
| 158 |
INTEL="$BUILT_PRODUCTS_DIR/intel" |
|---|
| 159 |
PPC="$BUILT_PRODUCTS_DIR/ppc" |
|---|
| 160 |
|
|---|
| 161 |
rm -rf "$BUILDDIR" |
|---|
| 162 |
mkdir "$BUILDDIR" |
|---|
| 163 |
echo $buildi386 $buildppc |
|---|
| 164 |
if [ $buildi386 -eq $buildppc ] ; then |
|---|
| 165 |
# lipo them |
|---|
| 166 |
for aa in "$INTEL"/*/*.a ; do |
|---|
| 167 |
echo lipo -create $aa `echo -n $aa | sed 's/intel/ppc/'` -output `echo -n $aa | sed 's/intel\/.*\//Universal\//'` |
|---|
| 168 |
lipo -create $aa `echo -n $aa | sed 's/intel/ppc/'` -output `echo -n $aa | sed 's/intel\/.*\//Universal\//'` |
|---|
| 169 |
done |
|---|
| 170 |
else |
|---|
| 171 |
if [ $buildppc -gt 0 ] ; then |
|---|
| 172 |
archDir="ppc" |
|---|
| 173 |
BUILDARCHDIR=$PPC |
|---|
| 174 |
else |
|---|
| 175 |
archDir="intel" |
|---|
| 176 |
BUILDARCHDIR=$INTEL |
|---|
| 177 |
fi |
|---|
| 178 |
# just copy them |
|---|
| 179 |
for aa in "$BUILDARCHDIR"/*/*.a ; do |
|---|
| 180 |
echo cp "$aa" `echo -n $aa | sed 's/'$archDir'\/.*\//Universal\//'` |
|---|
| 181 |
cp "$aa" `echo -n $aa | sed 's/'$archDir'\/.*\//Universal\//'` |
|---|
| 182 |
done |
|---|
| 183 |
fi |
|---|
| 184 |
echo -n "$buildid_ffmpeg" > $OUTPUT_FILE |
|---|
| 185 |
|
|---|
| 186 |
mkdir "$SYMROOT/Universal" || true |
|---|
| 187 |
cp "$BUILT_PRODUCTS_DIR/Universal"/* "$SYMROOT/Universal" |
|---|
| 188 |
if [ "$BUILD_STYLE" = "Deployment" ] ; then |
|---|
| 189 |
strip -S "$SYMROOT/Universal"/*.a |
|---|
| 190 |
fi |
|---|
| 191 |
ranlib "$SYMROOT/Universal"/*.a |
|---|