build-package-deps-osx.sh 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. #!/usr/bin/env bash
  2. CURDIR=$(pwd)
  3. # the temp directory
  4. WORK_DIR=`mktemp -d`
  5. # deletes the temp directory
  6. function cleanup {
  7. #rm -rf "$WORK_DIR"
  8. echo "Deleted temp working directory $WORK_DIR"
  9. }
  10. # register the cleanup function to be called on the EXIT signal
  11. trap cleanup EXIT
  12. cd $WORK_DIR
  13. DEPS_DEST=$WORK_DIR/obsdeps
  14. # make dest dirs
  15. mkdir $DEPS_DEST
  16. mkdir $DEPS_DEST/bin
  17. mkdir $DEPS_DEST/include
  18. # OSX COMPAT
  19. export MACOSX_DEPLOYMENT_TARGET=10.9
  20. # If you need an olders SDK and Xcode won't give it to you
  21. # https://github.com/phracker/MacOSX-SDKs
  22. # libopus
  23. curl -L -O http://downloads.xiph.org/releases/opus/opus-1.1.3.tar.gz
  24. tar -xf opus-1.1.3.tar.gz
  25. cd ./opus-1.1.3
  26. mkdir build
  27. cd ./build
  28. ../configure --disable-shared --enable-static --prefix="/tmp/obsdeps"
  29. make -j 12
  30. make install
  31. cd $WORK_DIR
  32. # libogg
  33. curl -L -O http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.gz
  34. tar -xf libogg-1.3.2.tar.gz
  35. cd ./libogg-1.3.2
  36. mkdir build
  37. cd ./build
  38. ../configure --disable-shared --enable-static --prefix="/tmp/obsdeps"
  39. make -j 12
  40. make install
  41. cd $WORK_DIR
  42. # libvorbis
  43. curl -L -O http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.gz
  44. tar -xf libvorbis-1.3.5.tar.gz
  45. cd ./libvorbis-1.3.5
  46. mkdir build
  47. cd ./build
  48. ../configure --disable-shared --enable-static --prefix="/tmp/obsdeps"
  49. make -j 12
  50. make install
  51. cd $WORK_DIR
  52. # libvpx
  53. curl -L -O http://storage.googleapis.com/downloads.webmproject.org/releases/webm/libvpx-1.6.0.tar.bz2
  54. tar -xf libvpx-1.6.0.tar.bz2
  55. cd ./libvpx-1.6.0
  56. mkdir build
  57. cd ./build
  58. ../configure --disable-shared --libdir="/tmp/obsdeps/bin"
  59. make -j 12
  60. make install
  61. cd $WORK_DIR
  62. # x264
  63. git clone git://git.videolan.org/x264.git
  64. cd ./x264
  65. mkdir build
  66. cd ./build
  67. ../configure --extra-ldflags="-mmacosx-version-min=10.9" --enable-static --prefix="/tmp/obsdeps"
  68. make -j 12
  69. make install
  70. ../configure --extra-ldflags="-mmacosx-version-min=10.9" --enable-shared --libdir="/tmp/obsdeps/bin" --prefix="/tmp/obsdeps"
  71. make -j 12
  72. ln -f -s libx264.*.dylib libx264.dylib
  73. find . -name \*.dylib -exec cp \{\} $DEPS_DEST/bin/ \;
  74. rsync -avh --include="*/" --include="*.h" --exclude="*" ../* $DEPS_DEST/include/
  75. rsync -avh --include="*/" --include="*.h" --exclude="*" ./* $DEPS_DEST/include/
  76. cd $WORK_DIR
  77. # janson
  78. curl -L -O http://www.digip.org/jansson/releases/jansson-2.9.tar.gz
  79. tar -xf jansson-2.9.tar.gz
  80. cd jansson-2.9
  81. mkdir build
  82. cd ./build
  83. ../configure --libdir="/tmp/obsdeps/bin" --enable-shared --disable-static
  84. make -j 12
  85. find . -name \*.dylib -exec cp \{\} $DEPS_DEST/bin/ \;
  86. rsync -avh --include="*/" --include="*.h" --exclude="*" ../* $DEPS_DEST/include/
  87. rsync -avh --include="*/" --include="*.h" --exclude="*" ./* $DEPS_DEST/include/
  88. cd $WORK_DIR
  89. export LDFLAGS="-L/tmp/obsdeps/lib"
  90. export CFLAGS="-I/tmp/obsdeps/include"
  91. # FFMPEG
  92. curl -L -O https://github.com/FFmpeg/FFmpeg/archive/n3.2.2.zip
  93. unzip ./n3.2.2.zip
  94. cd ./FFmpeg-n3.2.2
  95. mkdir build
  96. cd ./build
  97. ../configure --extra-ldflags="-mmacosx-version-min=10.9" --enable-shared --disable-static --shlibdir="/tmp/obsdeps/bin" --enable-gpl --disable-doc --enable-libx264 --enable-libopus --enable-libvorbis --enable-libvpx
  98. make -j 12
  99. find . -name \*.dylib -exec cp \{\} $DEPS_DEST/bin/ \;
  100. rsync -avh --include="*/" --include="*.h" --exclude="*" ../* $DEPS_DEST/include/
  101. rsync -avh --include="*/" --include="*.h" --exclude="*" ./* $DEPS_DEST/include/
  102. cd $WORK_DIR
  103. tar -czf osx-deps.tar.gz obsdeps
  104. cp ./osx-deps.tar.gz $CURDIR