forked from gabriel/ffmpeg-iphone-build
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build-ffmpeg
executable file
·115 lines (87 loc) · 2.83 KB
/
build-ffmpeg
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
#!/bin/sh
set -e
SCRIPT_DIR=$( (cd -P $(dirname $0) && pwd) )
. $SCRIPT_DIR/build-common
if [ -d ffmpeg ]
then
cd ffmpeg
echo "Updating trunk..."
svn update
cd -
else
echo "Pulling trunk..."
svn co svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
fi
for ARCH in $ARCHS
do
FFMPEG_DIR=ffmpeg-$ARCH
rm -rf $FFMPEG_DIR
cp -a ffmpeg $FFMPEG_DIR
cd $FFMPEG_DIR
for i in $SCRIPT_DIR/patches/ffmpeg/*
do
patch -p0 < $i
done
DIST_DIR=$DIST_DIR_BASE-$ARCH
mkdir -p $DIST_DIR
# Default configure options
CONFIGURE_OPTIONS="--enable-gpl --enable-postproc --enable-swscale --enable-avfilter"
# Use this to set your own configure-options
if [ -f $SCRIPT_DIR/ffmpeg-conf ]
then
. $SCRIPT_DIR/ffmpeg-conf
fi
# Add x264 if exists
if [ -f "$DIST_DIR/lib/libx264.a" ]; then
CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS --enable-libx264"
fi
# Add xvid if exists
if [ -f "$DIST_DIR/lib/libxvid.a" ]; then
CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS --enable-libxvid"
fi
# Add vorbis if exists
if [ -f "$DIST_DIR/lib/libvorbis.a" ]; then
CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS --enable-libvorbis"
fi
# Add vpx if exists
if [ -f "$DIST_DIR/lib/libvpx.a" ]; then
CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS --enable-libvpx"
fi
# Add lame if exists
if [ -f "$DIST_DIR/lib/libmp3lame.a" ]; then
CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS --enable-libmp3lame"
fi
# Add speex if exists
if [ -f "$DIST_DIR/lib/libspeex.a" ]; then
CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS --enable-libspeex"
fi
# Use this to set your own build paths
if [ -f $SCRIPT_DIR/build-local ]
then
. $SCRIPT_DIR/build-local
fi
CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS --extra-ldflags=-L$DIST_DIR/lib --extra-cflags=-I$DIST_DIR/include"
case $ARCH in
armv6)
EXTRA_FLAGS="--enable-cross-compile --target-os=darwin --arch=arm --cpu=arm1176jzf-s"
EXTRA_CFLAGS="-arch $ARCH"
EXTRA_LDFLAGS="-arch $ARCH"
;;
armv7)
EXTRA_FLAGS="--enable-cross-compile --target-os=darwin --arch=arm --cpu=cortex-a8 --enable-pic"
EXTRA_CFLAGS="-arch $ARCH"
EXTRA_LDFLAGS="-arch $ARCH"
;;
i386)
EXTRA_CC_FLAGS="-mdynamic-no-pic"
;;
esac
echo "Configure options: $CONFIGURE_OPTIONS"
echo "Configuring ffmpeg for $ARCH..."
./configure --cc="$CC" --as="$SCRIPT_DIR/gas-preprocessor.pl $AS" --nm="$NM" --sysroot=$SYSROOT $EXTRA_FLAGS --extra-ldflags="$EXTRA_LDFLAGS" --extra-cflags="$EXTRA_CFLAGS" --prefix=$DIST_DIR $CONFIGURE_OPTIONS
echo "Installing ffmpeg for $ARCH..."
make && make install
cd $SCRIPT_DIR
rm -rf $DIST_DIR/bin
rm -rf $DIST_DIR/share
done