Guest User

Untitled

a guest
Jan 11th, 2015
162
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz"
  44. ../fetchurl "http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.gz"
  45. ../fetchurl "http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.4.tar.gz"
  46. ../fetchurl "http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2"
  47. ../fetchurl "https://webm.googlecode.com/files/libvpx-v1.3.0.tar.bz2"
  48. ../fetchurl "http://downloads.sourceforge.net/project/faac/faac-src/faac-1.28/faac-1.28.tar.bz2"
  49. ../fetchurl "ftp://ftp.videolan.org/pub/x264/snapshots/last_x264.tar.bz2"
  50. ../fetchurl "http://downloads.xvid.org/downloads/xvidcore-1.3.3.tar.gz"
  51. ../fetchurl "http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz"
  52. ../fetchurl "http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz"
  53. ../fetchurl "http://sourceforge.net/projects/libpng/files/libpng16/1.6.13/libpng-1.6.13.tar.gz"
  54. ../fetchurl "http://zlib.net/zlib-1.2.8.tar.gz"
  55. ../fetchurl "https://www.openssl.org/source/openssl-1.0.1i.tar.gz"
  56. ../fetchurl "https://github.com/kergoth/tslib/archive/1.1.tar.gz"
  57. ../fetchurl "http://www.directfb.org/downloads/Core/DirectFB-1.4/DirectFB-1.4.17.tar.gz"
  58. ../fetchurl "http://www.libsdl.org/release/SDL-1.2.15.tar.gz"
  59. ../fetchurl "http://ffmpeg.org/releases/ffmpeg-2.4.tar.gz"
  60.  
  61. export PKG_CONFIG_PATH="$TARGET_DIR/lib/pkgconfig"
  62.  
  63. echo "*** Building yasm ***"
  64. cd $BUILD_DIR/yasm*
  65. ./configure --prefix=$TARGET_DIR
  66. make -j $jval
  67. make install
  68.  
  69. #sleep 5
  70.  
  71. echo "*** Building bzip2 ***"
  72. cd $BUILD_DIR/bzip2*
  73. make
  74. make install PREFIX=$TARGET_DIR
  75.  
  76. #sleep 5
  77.  
  78. # Ogg before vorbis
  79. echo "*** Building libogg ***"
  80. cd $BUILD_DIR/libogg*
  81. ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
  82. make -j $jval
  83. make install
  84.  
  85. #sleep 5
  86.  
  87. # Vorbis before theora
  88. echo "*** Building libvorbis ***"
  89. cd $BUILD_DIR/libvorbis*
  90. ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
  91. make -j $jval
  92. make install
  93.  
  94. #sleep 5
  95.  
  96. echo "*** Building libtheora ***"
  97. cd $BUILD_DIR/libtheora*
  98. ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
  99. make -j $jval
  100. make install
  101.  
  102. #sleep 5
  103.  
  104. echo "*** Building livpx ***"
  105. cd $BUILD_DIR/libvpx*
  106. ./configure --prefix=$TARGET_DIR --disable-shared
  107. make -j $jval
  108. make install
  109.  
  110. #sleep 5
  111.  
  112. echo "*** Building faac ***"
  113. cd $BUILD_DIR/faac*
  114. ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
  115. # FIXME: gcc incompatibility, does not work with log()
  116. sed -i -e "s|^char \*strcasestr.*|//\0|" common/mp4v2/mpeg4ip.h
  117. make -j $jval
  118. make install
  119.  
  120. #sleep 5
  121.  
  122. echo "*** Building x264 ***"
  123. cd $BUILD_DIR/x264*
  124. ./configure --prefix=$TARGET_DIR --enable-static --disable-shared --disable-opencl
  125. make -j $jval
  126. make install
  127.  
  128. #sleep 5
  129.  
  130. echo "*** Building xvidcore ***"
  131. cd "$BUILD_DIR/xvidcore/build/generic"
  132. ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
  133. make -j $jval
  134. make install
  135. rm -f "$TARGET_DIR"/lib/libxvidcore.so*
  136.  
  137. #sleep 5
  138.  
  139. echo "*** Building lame ***"
  140. cd $BUILD_DIR/lame*
  141. ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
  142. make -j $jval
  143. make install
  144.  
  145. #sleep 5
  146.  
  147. echo "*** Building opus ***"
  148. cd $BUILD_DIR/opus*
  149. ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
  150. make -j $jval
  151. make install
  152.  
  153. #sleep 5
  154.  
  155. echo "*** Building fdk-aac ***"
  156. cd $BUILD_DIR
  157. git clone https://github.com/mstorsjo/fdk-aac.git
  158. cd $BUILD_DIR/fdk-aac*
  159. if [ ! -f "configure" ]; then
  160.   autoreconf -fiv
  161. fi
  162. ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
  163. make -j $jval
  164. make install
  165.  
  166. #sleep 5
  167.  
  168. echo "*** Building libpng ***"
  169. cd $BUILD_DIR/libpng*
  170. ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
  171. make -j $jval
  172. make install
  173.  
  174. #sleep 5
  175.  
  176. echo "*** Building zlib ***"
  177. cd $BUILD_DIR/zlib*
  178. ./configure --prefix=$TARGET_DIR --static
  179. make -j $jval
  180. make install
  181.  
  182. #sleep 5
  183.  
  184. echo "*** Building openssl ***"
  185. cd $BUILD_DIR/openssl*
  186. ./config --prefix=$TARGET_DIR no-shared
  187. make
  188. make install
  189.  
  190. #sleep 5
  191.  
  192. echo "*** Building rtmpdump ***"
  193. cd $BUILD_DIR
  194. git clone git://git.ffmpeg.org/rtmpdump
  195. cd $BUILD_DIR/rtmpdump*
  196. make SYS=posix CRYPTO=OPENSSL SHARED= prefix=$TARGET_DIR LIBZ="-lz -ldl" XLDFLAGS="-L$TARGET_DIR/lib" XCFLAGS="-I$TARGET_DIR/include"
  197. make install SHARED= prefix=$TARGET_DIR
  198.  
  199. #sleep 5
  200.  
  201. echo "*** Building tslib ***"
  202. cd $BUILD_DIR/tslib*
  203. ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
  204. make -j $jval
  205. make install
  206.  
  207. #sleep 5
  208.  
  209. echo "*** Building directfb ***"
  210. cd $BUILD_DIR/DirectFB*
  211. ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
  212. make -j $jval
  213. make install
  214.  
  215. #sleep 5
  216.  
  217. echo "*** Building SDL ***"
  218. cd $BUILD_DIR/SDL*
  219. ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
  220. make -j $jval
  221. make install
  222.  
  223. #sleep 5
  224.  
  225. # FIXME: only OS-specific
  226. #rm -f "$TARGET_DIR"/lib/*.dylib
  227. rm -f "$TARGET_DIR"/lib/*.so
  228.  
  229. ## Patch ffmpeg mov.c to prevent stuttering
  230. ## https://trac.ffmpeg.org/ticket/2513
  231. echo "*** Patching FFmpeg mov.c ***"
  232. cd "$ENV_ROOT"
  233. patch -p1 < mov.c.patch
  234.  
  235. # FFMpeg
  236. echo "*** Building FFmpeg ***"
  237. cd $BUILD_DIR/ffmpeg*
  238. 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
  239. make -j $jval && make install
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×