compileVLCforiOS.sh 4.6 KB

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