buildVLCKit.sh 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. #!/bin/sh
  2. # Copyright (C) Pierre d'Herbemont, 2010
  3. # Copyright (C) Felix Paul Kühne, 2012-2016
  4. set -e
  5. SDK=`xcrun --sdk macosx --show-sdk-version`
  6. SDK_MIN=10.7
  7. VERBOSE=no
  8. CONFIGURATION="Release"
  9. NONETWORK=no
  10. SKIPLIBVLCCOMPILATION=no
  11. SCARY=yes
  12. TESTEDHASH=c79bc234
  13. usage()
  14. {
  15. cat << EOF
  16. usage: $0 [-s] [-v] [-k sdk]
  17. OPTIONS
  18. -k Specify which sdk to use (see 'xcodebuild -showsdks', current: ${SDK})
  19. -v Be more verbose
  20. -d Enable Debug
  21. -n Skip script steps requiring network interaction
  22. -l Skip libvlc compilation
  23. -w Build a limited stack of non-scary libraries only
  24. EOF
  25. }
  26. spushd()
  27. {
  28. pushd "$1" 2>&1> /dev/null
  29. }
  30. spopd()
  31. {
  32. popd 2>&1> /dev/null
  33. }
  34. info()
  35. {
  36. local green="\033[1;32m"
  37. local normal="\033[0m"
  38. echo "[${green}info${normal}] $1"
  39. }
  40. buildxcodeproj()
  41. {
  42. local target="$2"
  43. local PLATFORM="$3"
  44. info "Building $1 ($target, ${CONFIGURATION}, $PLATFORM)"
  45. local architectures="x86_64"
  46. local defs="$GCC_PREPROCESSOR_DEFINITIONS"
  47. if [ "$SCARY" = "no" ]; then
  48. defs="$defs NOSCARYCODECS"
  49. fi
  50. xcodebuild -project "$1.xcodeproj" \
  51. -target "$target" \
  52. -sdk $PLATFORM$SDK \
  53. -configuration ${CONFIGURATION} \
  54. ARCHS="${architectures}" \
  55. MACOSX_DEPLOYMENT_TARGET=${SDK_MIN} \
  56. GCC_PREPROCESSOR_DEFINITIONS="$defs" \
  57. > ${out}
  58. }
  59. while getopts "hvwsfbdntlk:" OPTION
  60. do
  61. case $OPTION in
  62. h)
  63. usage
  64. exit 1
  65. ;;
  66. v)
  67. VERBOSE=yes
  68. ;;
  69. d) CONFIGURATION="Debug"
  70. ;;
  71. w) SCARY="no"
  72. ;;
  73. n)
  74. NONETWORK=yes
  75. ;;
  76. l)
  77. SKIPLIBVLCCOMPILATION=yes
  78. ;;
  79. k)
  80. SDK=$OPTARG
  81. ;;
  82. ?)
  83. usage
  84. exit 1
  85. ;;
  86. esac
  87. done
  88. shift $(($OPTIND - 1))
  89. out="/dev/null"
  90. if [ "$VERBOSE" = "yes" ]; then
  91. out="/dev/stdout"
  92. fi
  93. if [ "x$1" != "x" ]; then
  94. usage
  95. exit 1
  96. fi
  97. # Get root dir
  98. spushd .
  99. aspen_root_dir=`pwd`
  100. spopd
  101. info "Preparing build dirs"
  102. mkdir -p libvlc
  103. spushd libvlc
  104. if [ "$NONETWORK" != "yes" ]; then
  105. if ! [ -e vlc ]; then
  106. git clone git://git.videolan.org/vlc.git vlc
  107. else
  108. cd vlc
  109. git pull --rebase
  110. git reset --hard ${TESTEDHASH}
  111. cd ..
  112. fi
  113. fi
  114. spopd
  115. #
  116. # Build time
  117. #
  118. buildLibVLC() {
  119. args=""
  120. if [ "$VERBOSE" = "yes" ]; then
  121. args="${args} V=1"
  122. fi
  123. spushd libvlc
  124. spushd vlc
  125. VLCROOT=`pwd` # Let's make sure VLCROOT is an absolute path
  126. PREFIX="${VLCROOT}/install-macos"
  127. if [ "$SKIPLIBVLCCOMPILATION" != "yes" ]; then
  128. export PATH="${VLCROOT}/extras/tools/build/bin:${VLCROOT}/contrib/x86_64-apple-darwin15/bin:$PATH"
  129. info "Building tools"
  130. spushd extras/tools
  131. ./bootstrap
  132. make ${args}
  133. spopd # extras/tools
  134. info "Building contrib"
  135. spushd contrib
  136. mkdir -p vlckitbuild
  137. spushd vlckitbuild
  138. ../bootstrap --build=x86_64-apple-darwin15 --disable-bluray --disable-growl --disable-sparkle --disable-SDL --disable-SDL_image --disable-microdns --disable-fontconfig --disable-bghudappkit
  139. make fetch ${args}
  140. make .gettext ${args}
  141. make ${args}
  142. spopd # vlckitbuild
  143. spopd # contrib
  144. info "Bootstraping vlc"
  145. info "VLCROOT = ${VLCROOT}"
  146. if ! [ -e ${VLCROOT}/configure ]; then
  147. ${VLCROOT}/bootstrap
  148. fi
  149. mkdir -p vlckitbuild
  150. spushd vlckitbuild
  151. ../extras/package/macosx/configure.sh --build=x86_64-apple-darwin15 --prefix="${PREFIX}" --disable-macosx-vlc-app --disable-macosx --enable-merge-ffmpeg --disable-sparkle
  152. make -j2 ${args}
  153. make install $(args)
  154. spopd #vlckitbuild
  155. fi
  156. spopd #vlc
  157. spopd #libvlc
  158. }
  159. buildLibVLC
  160. info "libvlc compilation done"
  161. info "Building VLCKit.framework"
  162. buildxcodeproj VLCKit "VLCKit" macosx
  163. info "Build of VLCKit.framework completed"