9 while getopts 'j:' OPTION
15 ?) printf "Usage: %s: [-j concurrency_level] (hint: your cores + 20%%)\n" $(basename $0) >&2
20 shift $(($OPTIND - 1))
26 printf "Option -j specified (%d)\n" $jval
34 rm -rf "$BUILD_DIR" "$TARGET_DIR"
35 mkdir -p "$BUILD_DIR" "$TARGET_DIR"
37 # NOTE: this is a fetchurl parameter, nothing to do with the current script
38 #export TARGET_DIR_DIR="$BUILD_DIR"
40 echo "#### FFmpeg static build, by STVS SA ####"
42 ../fetchurl "http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz"
43 ../fetchurl "http://www.zlib.net/fossils/zlib-1.2.8.tar.gz"
44 ../fetchurl "http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz"
45 #../fetchurl "http://downloads.sf.net/project/libpng/libpng15/older-releases/1.5.14/libpng-1.5.14.tar.gz"
46 ../fetchurl "http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.gz"
47 ../fetchurl "http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.gz"
48 ../fetchurl "http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2"
49 ../fetchurl "http://storage.googleapis.com/downloads.webmproject.org/releases/webm/libvpx-1.4.0.tar.bz2"
50 #../fetchurl "http://downloads.sourceforge.net/project/faac/faac-src/faac-1.28/faac-1.28.tar.bz2"
51 ../fetchurl "ftp://ftp.videolan.org/pub/x264/snapshots/last_x264.tar.bz2"
52 ../fetchurl "http://downloads.xvid.org/downloads/xvidcore-1.3.3.tar.gz"
53 ../fetchurl "http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz"
54 ../fetchurl "http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz"
55 ../fetchurl "http://www.freedesktop.org/software/fontconfig/release/fontconfig-2.11.94.tar.bz2"
56 ../fetchurl "http://www.ffmpeg.org/releases/ffmpeg-2.7.tar.bz2"
57 ../fetchurl "http://downloads.sourceforge.net/project/expat/expat/2.1.0/expat-2.1.0.tar.gz"
58 ../fetchurl "ftp://ftp.gnutls.org/gcrypt/gnutls/v3.3/gnutls-3.3.15.tar.xz"
59 ../fetchurl "https://ftp.gnu.org/gnu/nettle/nettle-2.7.1.tar.gz"
60 ../fetchurl "https://gmplib.org/download/gmp/gmp-6.0.0a.tar.xz"
61 ../fetchurl "https://github.com/libass/libass/archive/0.12.2.tar.gz"
62 ../fetchurl "http://fribidi.org/download/fribidi-0.19.6.tar.bz2"
63 ../fetchurl "ftp://ftp.videolan.org/pub/videolan/libbluray/0.8.1/libbluray-0.8.1.tar.bz2"
64 ../fetchurl "http://tukaani.org/xz/xz-5.2.1.tar.xz"
65 ../fetchurl "http://pkgs.fedoraproject.org/lookaside/pkgs/libgme/game-music-emu-0.6.0.tar.bz2/b98fafb737bc889dc65e7a8b94bd1bf5/game-music-emu-0.6.0.tar.bz2"
66 ../fetchurl "http://ffmpeg.zeranoe.com/builds/source/external_libraries/libilbc-20141214-git-ef04ebe.tar.xz"
67 ../fetchurl "http://downloads.sourceforge.net/project/modplug-xmms/libmodplug/0.8.8.5/libmodplug-0.8.8.5.tar.gz?r=&ts=1440421934&use_mirror=vorboss"
68 ../fetchurl "http://downloads.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-0.1.3.tar.gz"
69 ../fetchurl "http://rtmpdump.mplayerhq.hu/download/rtmpdump-2.3.tgz"
70 ../fetchurl "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2a.tar.gz"
71 ../fetchurl "http://downloads.sourceforge.net/project/soxr/soxr-0.1.1-Source.tar.xz"
72 ../fetchurl "https://github.com/georgmartius/vid.stab/archive/release-0.98.tar.gz"
73 ../fetchurl "http://download.savannah.gnu.org/releases/freetype/freetype-2.5.5.tar.bz2"
74 ../fetchurl "http://ffmpeg.zeranoe.com/builds/source/external_libraries/libgsm-1.0.13-4.tar.xz"
75 ../fetchurl "http://ffmpeg.zeranoe.com/builds/source/external_libraries/openjpeg-1.5.2.tar.xz"
76 ../fetchurl "http://pkgs.fedoraproject.org/lookaside/pkgs/orc/orc-0.4.18.tar.gz/1a2552e8d127526c48d644fe6437b377/orc-0.4.18.tar.gz"
77 ../fetchurl "http://ftp.cs.stanford.edu/pub/exim/pcre/pcre-8.36.tar.bz2"
78 ../fetchurl "http://78.108.103.11/MIRROR/ftp/png/src/history/libpng12/libpng-1.2.53.tar.bz2"
79 ../fetchurl "http://ffmpeg.zeranoe.com/builds/source/external_libraries/schroedinger-1.0.11.tar.xz"
80 ../fetchurl "http://ffmpeg.zeranoe.com/builds/source/external_libraries/speex-1.2rc2.tar.xz"
81 ../fetchurl "http://ftp.gnu.org/gnu/libtasn1/libtasn1-4.5.tar.gz"
82 ../fetchurl "http://ffmpeg.zeranoe.com/builds/source/external_libraries/twolame-0.3.13.tar.xz"
83 ../fetchurl "http://www.freedesktop.org/software/vaapi/releases/libva/libva-1.5.1.tar.bz2"
84 ../fetchurl "http://ffmpeg.zeranoe.com/builds/source/external_libraries/vo-aacenc-0.1.3.tar.xz"
85 ../fetchurl "http://ffmpeg.zeranoe.com/builds/source/external_libraries/vo-amrwbenc-0.1.2.tar.xz"
86 ../fetchurl "http://ffmpeg.zeranoe.com/builds/source/external_libraries/wavpack-4.75.0.tar.xz"
87 ../fetchurl "http://ffmpeg.zeranoe.com/builds/source/external_libraries/libwebp-0.4.3.tar.xz"
88 ../fetchurl "http://ffmpeg.zeranoe.com/builds/source/external_libraries/x265-1.7.tar.xz"
89 ../fetchurl "ftp://xmlsoft.org/libxml2/libxml2-2.9.2.tar.gz"
91 echo "*** Building libxml2 ***"
92 cd $BUILD_DIR/libxml2*
93 ./configure --prefix=$TARGET_DIR --enable-shared
95 make install || echo "Make install failed, continuing"
97 echo "*** Building x265 ***"
98 cd $BUILD_DIR/x265*/source
101 make DESTDIR=$TARGET_DIR install
103 echo "*** Building libwebp ***"
104 cd $BUILD_DIR/libwebp*
105 ./configure --prefix=$TARGET_DIR --enable-shared --enable-mmx
109 echo "*** Building wavpack ***"
110 cd $BUILD_DIR/wavpack*
111 ./configure --prefix=$TARGET_DIR --enable-shared --enable-mmx
115 echo "*** Building vo-amrwbenc ***"
116 cd $BUILD_DIR/vo-amrwbenc*
117 ./configure --prefix=$TARGET_DIR --enable-shared
121 echo "*** Building vo-aacenc ***"
122 cd $BUILD_DIR/vo-aacenc*
123 ./configure --prefix=$TARGET_DIR --enable-shared
127 echo "*** Building libva ***"
129 ./configure --prefix=$TARGET_DIR --enable-shared --enable-drm=no --enable-glx=no --enable-egl=no --enable-wayland=no
133 echo "*** Building twolame ***"
134 cd $BUILD_DIR/twolame*
135 ./configure --prefix=$TARGET_DIR --enable-shared
139 echo "*** Building libtasn1 ***"
140 cd $BUILD_DIR/libtasn1*
141 ./configure --prefix=$TARGET_DIR --enable-shared
145 echo "*** Building speex ***"
147 ./configure --prefix=$TARGET_DIR --enable-shared
151 echo "*** Building orc ***"
153 ./configure --prefix=$TARGET_DIR --enable-shared
157 echo "*** Building schroedinger ***"
158 cd $BUILD_DIR/schroedinger*
159 ./configure --prefix=$TARGET_DIR --enable-shared
163 echo "*** Building libpng ***"
164 cd $BUILD_DIR/libpng*
165 ./configure --prefix=$TARGET_DIR --enable-shared
169 echo "*** Building pcre ***"
171 ./configure --prefix=$TARGET_DIR --enable-shared
175 echo "*** Building openjpeg ***"
176 cd $BUILD_DIR/openjpeg*
178 ./configure --prefix=$TARGET_DIR --enable-shared
182 echo "*** Building freetype ***"
183 cd $BUILD_DIR/freetype*
184 ./configure --prefix=$TARGET_DIR --enable-shared --with-harfbuzz=no
188 echo "*** Building libgsm ***"
189 cd $BUILD_DIR/libgsm*
190 sed -i "s#INSTALL_ROOT =#INSTALL_ROOT = $TARGET_DIR#g" $BUILD_DIR/libgsm*/Makefile
191 sed -i 's#NeedFunctionPrototypes=1#NeedFunctionPrototypes=1 -fPIC#g' $BUILD_DIR/libgsm*/Makefile
192 sed -i 's#(GSM_INSTALL_ROOT)/inc#(GSM_INSTALL_ROOT)/include#g' $BUILD_DIR/libgsm*/Makefile
194 make -j lib/libgsm.so
195 make install prefix=$TARGET_DIR
196 cp lib/libgsm.so* $TARGET_DIR/lib/
198 echo "*** Building xavs ***"
200 svn checkout http://svn.code.sf.net/p/xavs/code/trunk xavs-code
202 ./configure --prefix=$TARGET_DIR --enable-shared --disable-asm
206 echo "*** Building vid.stab ***"
207 cd $BUILD_DIR/vid.stab*
210 make DESTDIR=$TARGET_DIR install
212 echo "*** Building soxr ***"
214 cmake -DWITH_OPENMP=off .
216 make DESTDIR=$TARGET_DIR install
218 echo "*** Building openssl ***"
219 cd $BUILD_DIR/openssl*
220 ./config --prefix=$TARGET_DIR shared
224 echo "*** Building rtmpdump ***"
225 cd $BUILD_DIR/rtmpdump*
226 sed -i 's#LIB_OPENSSL=-lssl -lcrypto#LIB_OPENSSL=-lssl -lcrypto -ldl#g' $BUILD_DIR/rtmpdump*/Makefile
227 make INC=-I$TARGET_DIR/include LDFLAGS=-L$TARGET_DIR/lib -j $jval SYS=posix
228 make install prefix=$TARGET_DIR
230 echo "*** Building opencore-amr ***"
231 cd $BUILD_DIR/opencore-amr*
232 ./configure --prefix=$TARGET_DIR --enable-shared
236 echo "*** Building libmodplug ***"
237 cd $BUILD_DIR/libmodplug*
238 ./configure --prefix=$TARGET_DIR --enable-shared
242 echo "*** Building libilbc ***"
243 cd $BUILD_DIR/libilbc*
244 ./configure --prefix=$TARGET_DIR --enable-shared
248 echo "*** Building game-music-emu ***"
249 cd $BUILD_DIR/game-music-emu*
252 make DESTDIR=$TARGET_DIR install
254 echo "*** Building xz ***"
256 ./configure --prefix=$TARGET_DIR --enable-shared
260 echo "*** Building libbluray ***"
261 cd $BUILD_DIR/libbluray*
262 ./configure --prefix=$TARGET_DIR --enable-shared
265 sed -i 's#Libs.private: -ldl -lxml2 -lfreetype#Libs.private: -ldl -lxml2 -lfreetype -llzma#g' $TARGET_DIR/lib/pkgconfig/libbluray.pc
267 echo "*** Building fribidi ***"
268 cd $BUILD_DIR/fribidi*
269 ./configure --prefix=$TARGET_DIR --enable-shared
273 echo "*** Building libass ***"
274 cd $BUILD_DIR/libass*
276 ./configure --prefix=$TARGET_DIR --enable-shared --disable-harfbuzz --disable-enca
280 echo "*** Building expat ***"
282 ./configure --prefix=$TARGET_DIR --enable-shared
286 echo "*** Building fontconfig ***"
287 cd $BUILD_DIR/fontconfig*
288 ./configure --prefix=$TARGET_DIR --enable-shared
292 echo "*** Building gmp ***"
294 ./configure --prefix=$TARGET_DIR --enable-shared
298 echo "*** Building nettle ***"
299 cd $BUILD_DIR/nettle*
300 sed -i 's#testsuite##g' Makefile.in
301 sed -i 's#examples##g' Makefile.in
302 ./configure --prefix=$TARGET_DIR --enable-shared --enable-mini-gmp
306 echo "*** Building gnutls ***"
307 cd $BUILD_DIR/gnutls*
308 ./configure --prefix=$TARGET_DIR --enable-shared --disable-doc --without-p11-kit --disable-libdane --disable-cxx
312 echo "*** Building yasm ***"
314 ./configure --prefix=$TARGET_DIR
318 echo "*** Building zlib ***"
320 ./configure --prefix=$TARGET_DIR --enable-shared
324 echo "*** Building bzip2 ***"
326 make -f Makefile-libbz2_so
327 make install PREFIX=$TARGET_DIR
329 #echo "*** Building libpng ***"
330 #cd $BUILD_DIR/libpng*
331 #./configure --prefix=$TARGET_DIR --enable-static --disable-shared
336 echo "*** Building libogg ***"
337 cd $BUILD_DIR/libogg*
338 ./configure --prefix=$TARGET_DIR --enable-shared
342 # Vorbis before theora
343 echo "*** Building libvorbis ***"
344 cd $BUILD_DIR/libvorbis*
345 ./configure --prefix=$TARGET_DIR --enable-shared
349 echo "*** Building libtheora ***"
350 cd $BUILD_DIR/libtheora*
351 ./configure --prefix=$TARGET_DIR --enable-shared
355 echo "*** Building livpx ***"
356 cd $BUILD_DIR/libvpx*
357 ./configure --prefix=$TARGET_DIR --enable-shared
361 #echo "*** Building faac ***"
363 #./configure --prefix=$TARGET_DIR --enable-static --disable-shared
364 # FIXME: gcc incompatibility, does not work with log()
366 #sed -i -e "s|^char \*strcasestr.*|//\0|" common/mp4v2/mpeg4ip.h
370 echo "*** Building x264 ***"
372 ./configure --prefix=$TARGET_DIR --enable-shared --disable-opencl
376 echo "*** Building xvidcore ***"
377 cd "$BUILD_DIR/xvidcore/build/generic"
378 ./configure --prefix=$TARGET_DIR --enable-shared
381 #rm $TARGET_DIR/lib/libxvidcore.so.*
383 echo "*** Building lame ***"
385 ./configure --prefix=$TARGET_DIR --enable-shared
389 echo "*** Building opus ***"
391 ./configure --prefix=$TARGET_DIR --enable-shared
395 rm -f $TARGET_DIR/lib/*.a
396 rm -f $TARGET_DIR/usr/local/lib/*.a
399 echo "*** Building FFmpeg ***"
400 cd $BUILD_DIR/ffmpeg*
401 CFLAGS="-I$TARGET_DIR/include -I$TARGET_DIR/usr/local/include" LDFLAGS="-L$TARGET_DIR/lib -L$TARGET_DIR/usr/local/lib -lm" PKG_CONFIG_PATH=$TARGET_DIR/lib/pkgconfig:$TARGET_DIR/usr/local/lib/pkgconfig ./configure \
402 --prefix=${OUTPUT_DIR:-$TARGET_DIR} \
403 --extra-cflags="-I$TARGET_DIR/include -fexceptions -fnon-call-exceptions -fPIC" \
404 --extra-ldflags="-L$TARGET_DIR/lib -lm -llzma" \
408 --disable-stripping \
412 --enable-fontconfig \
419 --enable-libfreetype \
423 --enable-libmodplug \
424 --enable-libmp3lame \
425 --enable-libopencore-amrnb \
426 --enable-libopencore-amrwb \
427 --enable-libopenjpeg \
430 --enable-libschroedinger \
434 --enable-libtwolame \
435 --enable-libvidstab \
436 --enable-libvo-aacenc \
437 --enable-libvo-amrwbenc \
440 --enable-libwavpack \
450 make -j $jval && make install