Advertisement
Guest User

Untitled

a guest
Jan 11th, 2015
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.86 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. set -e
  4. set -u
  5.  
  6. jflag=
  7. jval=2
  8.  
  9. while getopts 'j:' OPTION
  10. do
  11.   case $OPTION in
  12.   j)    jflag=1
  13.             jval="$OPTARG"
  14.             ;;
  15.   ?)    printf "Usage: %s: [-j concurrency_level] (hint: your cores + 20%%)\n" $(basename $0) >&2
  16.         exit 2
  17.         ;;
  18.   esac
  19. done
  20. shift $(($OPTIND - 1))
  21.  
  22. if [ "$jflag" ]
  23. then
  24.   if [ "$jval" ]
  25.   then
  26.     printf "Option -j specified (%d)\n" $jval
  27.   fi
  28. fi
  29.  
  30. cd `dirname $0`
  31. ENV_ROOT=`pwd`
  32. . ./env.source
  33.  
  34. rm -rf "$BUILD_DIR" "$TARGET_DIR"
  35. mkdir -p "$BUILD_DIR" "$TARGET_DIR"
  36.  
  37. # NOTE: this is a fetchurl parameter, nothing to do with the current script
  38. #export TARGET_DIR_DIR="$BUILD_DIR"
  39.  
  40. echo "#### FFmpeg static build, by STVS SA ####"
  41. cd $BUILD_DIR
  42. ../fetchurl "http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz"
  43. ../fetchurl "http://zlib.net/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.4.tar.gz"
  48. ../fetchurl "http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2"
  49. ../fetchurl "http://webm.googlecode.com/files/libvpx-v1.3.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.ffmpeg.org/releases/ffmpeg-2.5.3.tar.bz2"
  56. ../fetchurl "http://www.libsdl.org/release/SDL-1.2.15.tar.gz"
  57.  
  58. echo "*** Building yasm ***"
  59. cd $BUILD_DIR/yasm*
  60. ./configure --prefix=$TARGET_DIR
  61. make -j $jval
  62. make install
  63.  
  64. echo "*** Building zlib ***"
  65. cd $BUILD_DIR/zlib*
  66. ./configure --prefix=$TARGET_DIR
  67. make -j $jval
  68. make install
  69.  
  70. echo "*** Building bzip2 ***"
  71. cd $BUILD_DIR/bzip2*
  72. make
  73. make install PREFIX=$TARGET_DIR
  74.  
  75. echo "*** Building libpng ***"
  76. cd $BUILD_DIR/libpng*
  77. ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
  78. make -j $jval
  79. make install
  80.  
  81. # Ogg before vorbis
  82. echo "*** Building libogg ***"
  83. cd $BUILD_DIR/libogg*
  84. ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
  85. make -j $jval
  86. make install
  87.  
  88. # Vorbis before theora
  89. echo "*** Building libvorbis ***"
  90. cd $BUILD_DIR/libvorbis*
  91. ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
  92. make -j $jval
  93. make install
  94.  
  95. echo "*** Building libtheora ***"
  96. cd $BUILD_DIR/libtheora*
  97. ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
  98. make -j $jval
  99. make install
  100.  
  101. echo "*** Building livpx ***"
  102. cd $BUILD_DIR/libvpx*
  103. ./configure --prefix=$TARGET_DIR --disable-shared
  104. make -j $jval
  105. make install
  106.  
  107. echo "*** Building faac ***"
  108. cd $BUILD_DIR/faac*
  109. ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
  110. # FIXME: gcc incompatibility, does not work with log()
  111.  
  112. sed -i -e "s|^char \*strcasestr.*|//\0|" common/mp4v2/mpeg4ip.h
  113. make -j $jval
  114. make install
  115.  
  116. echo "*** Building x264 ***"
  117. cd $BUILD_DIR/x264*
  118. ./configure --prefix=$TARGET_DIR --enable-static --disable-shared --disable-opencl
  119. make -j $jval
  120. make install
  121.  
  122. echo "*** Building xvidcore ***"
  123. cd "$BUILD_DIR/xvidcore/build/generic"
  124. ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
  125. make -j $jval
  126. make install
  127. #rm $TARGET_DIR/lib/libxvidcore.so.*
  128.  
  129. echo "*** Building lame ***"
  130. cd $BUILD_DIR/lame*
  131. ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
  132. make -j $jval
  133. make install
  134.  
  135. echo "*** Building opus ***"
  136. cd $BUILD_DIR/opus*
  137. ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
  138. make -j $jval
  139. make install
  140.  
  141. echo "*** Building SDL ***"
  142. cd $BUILD_DIR/SDL*
  143. ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
  144. make -j $jval
  145. make install
  146.  
  147. # FIXME: only OS-specific
  148. rm -f "$TARGET_DIR/lib/*.dylib"
  149. rm -f "$TARGET_DIR/lib/*.so"
  150.  
  151. # FFMpeg
  152. echo "*** Building FFmpeg ***"
  153. cd $BUILD_DIR/ffmpeg*
  154. CFLAGS="-I$TARGET_DIR/include" LDFLAGS="-L$TARGET_DIR/lib -lm -ldl" ./configure --prefix=${OUTPUT_DIR:-$TARGET_DIR} --extra-cflags="-I$TARGET_DIR/include -static" --extra-ldflags="-L$TARGET_DIR/lib -lm -static" --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-version3 --enable-libvpx --disable-devices
  155. make -j $jval && make install
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement