Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- set -e
- set -u
- jflag=
- jval=2
- while getopts 'j:' OPTION
- do
- case $OPTION in
- j) jflag=1
- jval="$OPTARG"
- ;;
- ?) printf "Usage: %s: [-j concurrency_level] (hint: your cores + 20%%)\n" $(basename $0) >&2
- exit 2
- ;;
- esac
- done
- shift $(($OPTIND - 1))
- if [ "$jflag" ]
- then
- if [ "$jval" ]
- then
- printf "Option -j specified (%d)\n" $jval
- fi
- fi
- cd `dirname $0`
- ENV_ROOT=`pwd`
- . ./env.source
- rm -rf "$BUILD_DIR" "$TARGET_DIR"
- mkdir -p "$BUILD_DIR" "$TARGET_DIR"
- # NOTE: this is a fetchurl parameter, nothing to do with the current script
- #export TARGET_DIR_DIR="$BUILD_DIR"
- echo "#### FFmpeg static build, by STVS SA ####"
- cd $BUILD_DIR
- ../fetchurl "http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz"
- ../fetchurl "http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz"
- ../fetchurl "http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.gz"
- ../fetchurl "http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.4.tar.gz"
- ../fetchurl "http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2"
- ../fetchurl "https://webm.googlecode.com/files/libvpx-v1.3.0.tar.bz2"
- ../fetchurl "http://downloads.sourceforge.net/project/faac/faac-src/faac-1.28/faac-1.28.tar.bz2"
- ../fetchurl "ftp://ftp.videolan.org/pub/x264/snapshots/last_x264.tar.bz2"
- ../fetchurl "http://downloads.xvid.org/downloads/xvidcore-1.3.3.tar.gz"
- ../fetchurl "http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz"
- ../fetchurl "http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz"
- ../fetchurl "http://sourceforge.net/projects/libpng/files/libpng16/1.6.13/libpng-1.6.13.tar.gz"
- ../fetchurl "http://zlib.net/zlib-1.2.8.tar.gz"
- ../fetchurl "https://www.openssl.org/source/openssl-1.0.1i.tar.gz"
- ../fetchurl "https://github.com/kergoth/tslib/archive/1.1.tar.gz"
- ../fetchurl "http://www.directfb.org/downloads/Core/DirectFB-1.4/DirectFB-1.4.17.tar.gz"
- ../fetchurl "http://www.libsdl.org/release/SDL-1.2.15.tar.gz"
- ../fetchurl "http://ffmpeg.org/releases/ffmpeg-2.4.tar.gz"
- export PKG_CONFIG_PATH="$TARGET_DIR/lib/pkgconfig"
- echo "*** Building yasm ***"
- cd $BUILD_DIR/yasm*
- ./configure --prefix=$TARGET_DIR
- make -j $jval
- make install
- #sleep 5
- echo "*** Building bzip2 ***"
- cd $BUILD_DIR/bzip2*
- make
- make install PREFIX=$TARGET_DIR
- #sleep 5
- # Ogg before vorbis
- echo "*** Building libogg ***"
- cd $BUILD_DIR/libogg*
- ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
- make -j $jval
- make install
- #sleep 5
- # Vorbis before theora
- echo "*** Building libvorbis ***"
- cd $BUILD_DIR/libvorbis*
- ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
- make -j $jval
- make install
- #sleep 5
- echo "*** Building libtheora ***"
- cd $BUILD_DIR/libtheora*
- ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
- make -j $jval
- make install
- #sleep 5
- echo "*** Building livpx ***"
- cd $BUILD_DIR/libvpx*
- ./configure --prefix=$TARGET_DIR --disable-shared
- make -j $jval
- make install
- #sleep 5
- echo "*** Building faac ***"
- cd $BUILD_DIR/faac*
- ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
- # FIXME: gcc incompatibility, does not work with log()
- sed -i -e "s|^char \*strcasestr.*|//\0|" common/mp4v2/mpeg4ip.h
- make -j $jval
- make install
- #sleep 5
- echo "*** Building x264 ***"
- cd $BUILD_DIR/x264*
- ./configure --prefix=$TARGET_DIR --enable-static --disable-shared --disable-opencl
- make -j $jval
- make install
- #sleep 5
- echo "*** Building xvidcore ***"
- cd "$BUILD_DIR/xvidcore/build/generic"
- ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
- make -j $jval
- make install
- rm -f "$TARGET_DIR"/lib/libxvidcore.so*
- #sleep 5
- echo "*** Building lame ***"
- cd $BUILD_DIR/lame*
- ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
- make -j $jval
- make install
- #sleep 5
- echo "*** Building opus ***"
- cd $BUILD_DIR/opus*
- ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
- make -j $jval
- make install
- #sleep 5
- echo "*** Building fdk-aac ***"
- cd $BUILD_DIR
- git clone https://github.com/mstorsjo/fdk-aac.git
- cd $BUILD_DIR/fdk-aac*
- if [ ! -f "configure" ]; then
- autoreconf -fiv
- fi
- ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
- make -j $jval
- make install
- #sleep 5
- echo "*** Building libpng ***"
- cd $BUILD_DIR/libpng*
- ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
- make -j $jval
- make install
- #sleep 5
- echo "*** Building zlib ***"
- cd $BUILD_DIR/zlib*
- ./configure --prefix=$TARGET_DIR --static
- make -j $jval
- make install
- #sleep 5
- echo "*** Building openssl ***"
- cd $BUILD_DIR/openssl*
- ./config --prefix=$TARGET_DIR no-shared
- make
- make install
- #sleep 5
- echo "*** Building rtmpdump ***"
- cd $BUILD_DIR
- git clone git://git.ffmpeg.org/rtmpdump
- cd $BUILD_DIR/rtmpdump*
- make SYS=posix CRYPTO=OPENSSL SHARED= prefix=$TARGET_DIR LIBZ="-lz -ldl" XLDFLAGS="-L$TARGET_DIR/lib" XCFLAGS="-I$TARGET_DIR/include"
- make install SHARED= prefix=$TARGET_DIR
- #sleep 5
- echo "*** Building tslib ***"
- cd $BUILD_DIR/tslib*
- ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
- make -j $jval
- make install
- #sleep 5
- echo "*** Building directfb ***"
- cd $BUILD_DIR/DirectFB*
- ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
- make -j $jval
- make install
- #sleep 5
- echo "*** Building SDL ***"
- cd $BUILD_DIR/SDL*
- ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
- make -j $jval
- make install
- #sleep 5
- # FIXME: only OS-specific
- #rm -f "$TARGET_DIR"/lib/*.dylib
- rm -f "$TARGET_DIR"/lib/*.so
- ## Patch ffmpeg mov.c to prevent stuttering
- ## https://trac.ffmpeg.org/ticket/2513
- echo "*** Patching FFmpeg mov.c ***"
- cd "$ENV_ROOT"
- patch -p1 < mov.c.patch
- # FFMpeg
- echo "*** Building FFmpeg ***"
- cd $BUILD_DIR/ffmpeg*
- CFLAGS="-I$TARGET_DIR/include" LDFLAGS="-L$TARGET_DIR/lib -lm -ldl" ./configure --prefix=${OUTPUT_DIR:-$TARGET_DIR} --extra-version=static --disable-debug --disable-shared --enable-static --extra-cflags=--static --enable-ffmpeg --disable-ffprobe --disable-ffserver --enable-ffplay --disable-doc --enable-gpl --enable-pthreads --enable-postproc --enable-gray --enable-runtime-cpudetect --enable-libfaac --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-bzlib --enable-zlib --enable-nonfree --enable-libfdk-aac --enable-version3 --enable-libvpx --disable-devices --enable-librtmp --enable-openssl
- make -j $jval && make install
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement