Skip to content

Commit 9d4ade5

Browse files
committed
Initial commit
0 parents  commit 9d4ade5

File tree

1 file changed

+97
-0
lines changed

1 file changed

+97
-0
lines changed

build-ffmpeg.sh

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
#!/bin/sh
2+
3+
CONFIGURE_FLAGS="--enable-cross-compile --disable-debug --disable-ffmpeg \
4+
--disable-ffplay --disable-ffprobe --disable-ffserver \
5+
--disable-doc --disable-encoders --disable-muxers \
6+
--disable-bsfs --disable-devices --disable-filters --enable-pic"
7+
8+
LIBS="libavcodec libavformat libavutil libswscale libavdevice libavfilter \
9+
libswresample"
10+
11+
ARCHS="armv7 armv7s i386"
12+
13+
# directories
14+
SOURCE="ffmpeg"
15+
FAT="fat"
16+
17+
SCRATCH="scratch"
18+
# must be an absolute path
19+
THIN=`pwd`/"thin"
20+
21+
COMPILE="y"
22+
LIPO="y"
23+
24+
if [ "$*" ]
25+
then
26+
if [ "$*" = "lipo" ]
27+
then
28+
# skip compile
29+
COMPILE=
30+
else
31+
ARCHS="$*"
32+
if [ $# -eq 1 ]
33+
then
34+
# skip lipo
35+
LIPO=
36+
fi
37+
fi
38+
fi
39+
40+
if [ "$COMPILE" ]
41+
then
42+
CWD=`pwd`
43+
for ARCH in $ARCHS
44+
do
45+
echo "building $ARCH..."
46+
mkdir -p "$SCRATCH/$ARCH"
47+
cd "$SCRATCH/$ARCH"
48+
49+
if [ "$ARCH" = "i386" ]
50+
then
51+
PLATFORM="iPhoneSimulator"
52+
else
53+
PLATFORM="iPhoneOS"
54+
if [ $ARCH = "armv7s" ]
55+
then
56+
CPU="--cpu=swift"
57+
fi
58+
fi
59+
60+
XCRUN_SDK=`echo $PLATFORM | tr '[:upper:]' '[:lower:]'`
61+
CC="xcrun -sdk $XCRUN_SDK clang"
62+
CFLAGS="-arch $ARCH"
63+
CXXFLAGS="-arch $ARCH"
64+
LDFLAGS="-arch $ARCH"
65+
66+
$CWD/$SOURCE/configure \
67+
--target-os=darwin \
68+
--arch=$ARCH \
69+
--cc="$CC" \
70+
$CONFIGURE_FLAGS \
71+
--extra-cflags="$CFLAGS" \
72+
--extra-cxxflags="$CXXFLAGS" \
73+
--extra-ldflags="$LDFLAGS" \
74+
$CPU \
75+
--prefix="$THIN/$ARCH"
76+
77+
make -j3 install
78+
cd $CWD
79+
done
80+
fi
81+
82+
if [ "$LIPO" ]
83+
then
84+
echo "building fat binaries..."
85+
mkdir -p $FAT/lib
86+
set - $ARCHS
87+
CWD=`pwd`
88+
cd $THIN/$1/lib
89+
for LIB in *.a
90+
do
91+
cd $CWD
92+
lipo -create `find $THIN -name $LIB` -output $FAT/lib/$LIB
93+
done
94+
95+
cd $CWD
96+
cp -rf $THIN/$1/include $FAT
97+
fi

0 commit comments

Comments
 (0)