forked from miaopei/ffmpeg-webrtc
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild-ffmpeg.sh
executable file
·172 lines (157 loc) · 4.33 KB
/
build-ffmpeg.sh
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#########################################################################
# File Name: build-ffmpeg.sh
# Author: Mr.Miaow
# mail: [email protected]
# Created Time: 三 5/22 16:37:55 2019
#########################################################################
#!/bin/sh
# directories
PLATFORM="ffmpeg-sdk"
# FFmpeg脚本目录
SOURCE="ffmpeg-3.4.6"
#FAT="$PLATFORM/$SOURCE/FFmpeg-OSX"
BUILD="$PLATFORM/$SOURCE/build"
FFMPEG_SDK=`pwd`/"$PLATFORM/$SOURCE/sdk"
# CONFIGURE_FLAGS="--enable-cross-compile \
# --enable-nonfree \
# --enable-libfaac \
# --enable-libmp3lame \
# --enable-libtheora \
# --enable-libvorbis \
# --enable-libxvid \
# --enable-libass \
# --enable-libspeex \
# --enable-libx264 \
# --enable-libvpx \
# --enable-opencl \
# --disable-ffmpeg \
# --enable-gpl \
# --disable-outdev=sdl \
# --disable-ffplay \
# --disable-debug \
# --disable-ffserver \
# --enable-static \
# --enable-shared "
#CONFIGURE_FLAGS="--enable-cross-compile \
# --enable-nonfree \
# --enable-opencl \
# --disable-ffmpeg \
# --enable-gpl \
# --disable-outdev=sdl \
# --disable-ffplay \
# --disable-debug \
# --disable-ffserver \
# --enable-static \
# --enable-shared "
CONFIGURE_FLAGS="--enable-cross-compile \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-ffserver \
--disable-iconv \
--disable-bzlib \
--enable-avresample \
--enable-avresample \
--enable-pic \
--disable-doc \
--disable-decoders \
--enable-decoder=h264 \
--disable-encoders \
--disable-demuxers \
--enable-demuxer=avi \
--disable-muxers \
--enable-muxer=avi \
--disable-filters \
--enable-static \
--enable-shared "
CWD=`pwd`
ARCHS="x86_64 i386"
#ARCHS="i386"
# FAAC="/usr/local/Cellar/faac/1.28"
# LAMP="/usr/local/Cellar/lame/3.99.5"
# THEORA="/usr/local/Cellar/theora/1.1.1"
# VORBIS="/usr/local/Cellar/libvorbis/1.3.5"
# XVID="/usr/local/Cellar/libxvid/1.3.4"
# ASS="/usr/local/Cellar/libass/0.13.2"
# SPEEX="/usr/local/Cellar/speex/1.2rc1"
# VPX="/usr/local/Cellar/libvpx/1.6.0"
# X264="/usr/local/Cellar/x264/r2668"
for ARCH in $ARCHS
do
echo "building $ARCH..."
mkdir -p "$BUILD/$ARCH"
cd "$BUILD/$ARCH"
CFLAGS="-arch $ARCH"
SDK="macosx"
XCRUN_SDK=`echo $SDK | tr '[:upper:]' '[:lower:]'`
CC="xcrun -sdk $XCRUN_SDK clang"
CXXFLAGS="$CFLAGS"
LDFLAGS="$CFLAGS"
if [ "$FAAC" ]
then
CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-libfaac"
CXXFLAGS="$CXXFLAGS -I$FAAC/include"
LDFLAGS="$LDFLAGS -L$FAAC/lib"
fi
if [ "$LAMP" ]
then
CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-libmp3lame"
CXXFLAGS="$CXXFLAGS -I$LAMP/include"
LDFLAGS="$LDFLAGS -L$LAMP/lib"
fi
if [ "$THEORA" ]
then
CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-libtheora"
CXXFLAGS="$CXXFLAGS -I$THEORA/include"
LDFLAGS="$LDFLAGS -L$THEORA/lib"
fi
if [ "$VORBIS" ]
then
CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-libvorbis"
CXXFLAGS="$CXXFLAGS -I$VORBIS/include"
LDFLAGS="$LDFLAGS -L$VORBIS/lib"
fi
if [ "$XVID" ]
then
CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-libxvid"
CXXFLAGS="$CXXFLAGS -I$XVID/include"
LDFLAGS="$LDFLAGS -L$XVID/lib"
fi
if [ "$ASS" ]
then
CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-libass"
CXXFLAGS="$CXXFLAGS -I$ASS/include"
LDFLAGS="$LDFLAGS -L$ASS/lib"
fi
if [ "$SPEEX" ]
then
CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-libspeex"
CXXFLAGS="$CXXFLAGS -I$SPEEX/include"
LDFLAGS="$LDFLAGS -L$SPEEX/lib"
fi
if [ "$VPX" ]
then
CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-libvpx"
CXXFLAGS="$CXXFLAGS -I$VPX/include"
LDFLAGS="$LDFLAGS -L$VPX/lib"
fi
if [ "$X264" ]
then
CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-libx264"
CXXFLAGS="$CXXFLAGS -I$X264/include"
LDFLAGS="$LDFLAGS -L$X264/lib"
fi
TMPDIR=${TMPDIR/%\/} $CWD/$SOURCE/configure \
--target-os=darwin \
--arch=$ARCH \
$CONFIGURE_FLAGS \
--extra-cflags="$CXXFLAGS" \
--extra-ldflags="$LDFLAGS" \
--prefix="$FFMPEG_SDK/$ARCH" \
|| exit 1
# --cc="$CC" \
make -j4 && make install $EXPORT && make clean || exit 1
echo "Installed:$FFMPEG_SDK/$ARCH"
cd $CWD
done
echo Done