compileVLCforiOS.sh 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. #!/bin/sh
  2. # Copyright (C) Pierre d'Herbemont, 2010
  3. # Copyright (C) Felix Paul Kühne, 2012-2015
  4. set -e
  5. PLATFORM=iphoneos
  6. SDK=`xcrun --sdk iphoneos --show-sdk-version`
  7. SDK_MIN=7.0
  8. VERBOSE=no
  9. CONFIGURATION="Release"
  10. NONETWORK=no
  11. SKIPLIBVLCCOMPILATION=no
  12. TESTEDVLCKITHASH=6c6d6863
  13. TESTEDMEDIALIBRARYKITHASH=e5ca039f
  14. usage()
  15. {
  16. cat << EOF
  17. usage: $0 [-s] [-v] [-k sdk] [-d] [-n] [-l] [-u]
  18. OPTIONS
  19. -k Specify which sdk to use (see 'xcodebuild -showsdks', current: ${SDK})
  20. -v Be more verbose
  21. -s Build for simulator
  22. -d Enable Debug
  23. -n Skip script steps requiring network interaction
  24. -l Skip libvlc compilation
  25. EOF
  26. }
  27. spushd()
  28. {
  29. pushd "$1" 2>&1> /dev/null
  30. }
  31. spopd()
  32. {
  33. popd 2>&1> /dev/null
  34. }
  35. info()
  36. {
  37. local green="\033[1;32m"
  38. local normal="\033[0m"
  39. echo "[${green}info${normal}] $1"
  40. }
  41. buildxcworkspace()
  42. {
  43. local target="$2"
  44. if [ "x$target" = "x" ]; then
  45. target="$1"
  46. fi
  47. info "Building the workspace $1 ($target, ${CONFIGURATION})"
  48. local architectures=""
  49. if [ "$PLATFORM" = "iphonesimulator" ]; then
  50. architectures="i386 x86_64"
  51. else
  52. architectures="armv7 armv7s arm64"
  53. fi
  54. xcodebuild -workspace "$1.xcworkspace" \
  55. -scheme "Pods-vlc-ios" \
  56. -sdk $PLATFORM$SDK \
  57. -configuration ${CONFIGURATION} \
  58. ARCHS="${architectures}" \
  59. IPHONEOS_DEPLOYMENT_TARGET=${SDK_MIN} > ${out}
  60. }
  61. while getopts "hvsdnluk:" OPTION
  62. do
  63. case $OPTION in
  64. h)
  65. usage
  66. exit 1
  67. ;;
  68. v)
  69. VERBOSE=yes
  70. ;;
  71. s)
  72. PLATFORM=iphonesimulator
  73. ;;
  74. d) CONFIGURATION="Debug"
  75. ;;
  76. n)
  77. NONETWORK=yes
  78. ;;
  79. l)
  80. SKIPLIBVLCCOMPILATION=yes
  81. ;;
  82. k)
  83. SDK=$OPTARG
  84. ;;
  85. ?)
  86. usage
  87. exit 1
  88. ;;
  89. esac
  90. done
  91. shift $(($OPTIND - 1))
  92. out="/dev/null"
  93. if [ "$VERBOSE" = "yes" ]; then
  94. out="/dev/stdout"
  95. fi
  96. if [ "x$1" != "x" ]; then
  97. usage
  98. exit 1
  99. fi
  100. info "Preparing build dirs"
  101. mkdir -p ImportedSources
  102. spushd ImportedSources
  103. if [ "$NONETWORK" != "yes" ]; then
  104. if ! [ -e MediaLibraryKit ]; then
  105. git clone http://code.videolan.org/videolan/MediaLibraryKit.git
  106. cd MediaLibraryKit
  107. git checkout -B localAspenBranch ${TESTEDMEDIALIBRARYKITHASH}
  108. git branch --set-upstream-to=origin/master localAspenBranch
  109. cd ..
  110. else
  111. cd MediaLibraryKit
  112. git pull --rebase
  113. git reset --hard ${TESTEDMEDIALIBRARYKITHASH}
  114. cd ..
  115. fi
  116. if ! [ -e VLCKit ]; then
  117. git clone http://code.videolan.org/videolan/VLCKit.git
  118. cd VLCKit
  119. git reset --hard ${TESTEDVLCKITHASH}
  120. cd ..
  121. else
  122. cd VLCKit
  123. git pull --rebase
  124. git reset --hard ${TESTEDVLCKITHASH}
  125. cd ..
  126. fi
  127. if ! [ -e GDrive ]; then
  128. svn checkout http://google-api-objectivec-client.googlecode.com/svn/trunk/Source GDrive
  129. cd GDrive && patch -p0 < ../../patches/gdrive/upgrade-default-target.patch && cd ..
  130. cd GDrive/HTTPFetcher && patch -p0 < ../../../patches/gdrive/httpfetcher-compilation-fix.diff && cd ../..
  131. else
  132. cd GDrive && svn up && cd ..
  133. fi
  134. if ! [ -e LXReorderableCollectionViewFlowLayout ]; then
  135. git clone git://github.com/fkuehne/LXReorderableCollectionViewFlowLayout.git
  136. else
  137. cd LXReorderableCollectionViewFlowLayout && git pull --rebase && cd ..
  138. fi
  139. if ! [ -e WhiteRaccoon ]; then
  140. git clone git://github.com/fkuehne/WhiteRaccoon.git
  141. else
  142. cd WhiteRaccoon && git pull --rebase && cd ..
  143. fi
  144. if ! [ -e CocoaHTTPServer ]; then
  145. git clone git://github.com/fkuehne/CocoaHTTPServer.git
  146. else
  147. cd CocoaHTTPServer && git pull --rebase && cd ..
  148. fi
  149. if ! [ -e Dropbox ]; then
  150. DROPBOXSDKVERSION=1.3.13
  151. curl -L -O https://www.dropbox.com/static/developers/dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  152. unzip -q dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  153. mv dropbox-ios-sdk-${DROPBOXSDKVERSION} Dropbox
  154. rm dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  155. rm -rf __MACOSX
  156. fi
  157. if ! [ -e OneDrive ]; then
  158. git clone git://github.com/liveservices/LiveSDK-for-iOS.git OneDrive
  159. cd OneDrive && git am ../../patches/onedrive/0001-Compile-ARMv7s-slice.patch && cd ..
  160. else
  161. cd OneDrive && git pull --rebase && cd ..
  162. fi
  163. fi
  164. spopd #ImportedSources
  165. #
  166. # Build time
  167. #
  168. info "Building"
  169. spushd ImportedSources
  170. spushd VLCKit
  171. echo `pwd`
  172. args=""
  173. if [ "$VERBOSE" = "yes" ]; then
  174. args="${args} -v"
  175. fi
  176. if [ "$NONETWORK" = "yes" ]; then
  177. args="${args} -n"
  178. fi
  179. if [ "$SKIPLIBVLCCOMPILATION" = "yes" ]; then
  180. args="${args} -l"
  181. fi
  182. ./buildMobileVLCKit.sh ${args} -k "${SDK}"
  183. spopd
  184. spopd # ImportedSources
  185. #install pods
  186. info "installing pods"
  187. pod install
  188. # Build the VLC for iOS workspace now
  189. buildxcworkspace "VLC for iOS" "VLC for iOS"
  190. info "Build completed"