compileVLCforiOS.sh 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  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=2ce09e72
  13. TESTEDMEDIALIBRARYKITHASH=2ce64152
  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/gdrive-base.diff
  128. cd ..
  129. cd GDrive/HTTPFetcher && patch -p0 < ../../../patches/gdrive/gdrive-session-fetcher.diff
  130. cd ../..
  131. cd GDrive/OAuth2 && patch -p0 < ../../../patches/gdrive/gdrive-oauth.diff
  132. cd ../..
  133. else
  134. cd GDrive
  135. svn up
  136. cd ..
  137. fi
  138. if ! [ -e LXReorderableCollectionViewFlowLayout ]; then
  139. git clone git://github.com/fkuehne/LXReorderableCollectionViewFlowLayout.git
  140. else
  141. cd LXReorderableCollectionViewFlowLayout && git pull --rebase && cd ..
  142. fi
  143. if ! [ -e WhiteRaccoon ]; then
  144. git clone git://github.com/fkuehne/WhiteRaccoon.git
  145. else
  146. cd WhiteRaccoon && 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. cd Dropbox
  154. patch -p1 < ../../patches/dropbox/DropboxTV.patch
  155. cd ..
  156. rm dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  157. rm -rf __MACOSX
  158. fi
  159. if ! [ -e HockeySDK-tvOS ]; then
  160. curl -L -O https://www.dropbox.com/s/pie0xxmf6xmj6wl/HockeySDK-tvOS.zip?dl=0
  161. unzip -q HockeySDK-tvOS.zip?dl=0
  162. cd HockeySDK-tvOS
  163. patch -p1 < ../../patches/hockey/hockey.patch
  164. cd ..
  165. rm HockeySDK-tvOS.zip?dl=0
  166. rm -rf __MACOSX
  167. fi
  168. if ! [ -e OneDrive ]; then
  169. git clone git://github.com/liveservices/LiveSDK-for-iOS.git OneDrive
  170. cd OneDrive && git am ../../patches/onedrive/*.patch && cd ..
  171. else
  172. cd OneDrive && git pull --rebase && cd ..
  173. fi
  174. fi
  175. spopd #ImportedSources
  176. #
  177. # Build time
  178. #
  179. info "Building"
  180. spushd ImportedSources
  181. spushd VLCKit
  182. echo `pwd`
  183. args=""
  184. if [ "$VERBOSE" = "yes" ]; then
  185. args="${args} -v"
  186. fi
  187. if [ "$NONETWORK" = "yes" ]; then
  188. args="${args} -n"
  189. fi
  190. if [ "$SKIPLIBVLCCOMPILATION" = "yes" ]; then
  191. args="${args} -l"
  192. fi
  193. if [ "$TVOS" = "yes" ]; then
  194. args="${args} -t"
  195. fi
  196. ./buildMobileVLCKit.sh ${args} -k "${SDK}"
  197. spopd
  198. spopd # ImportedSources
  199. #install pods
  200. info "installing pods"
  201. pod install
  202. # Build the VLC for iOS workspace now
  203. if [ "$TVOS" = "no" ]; then
  204. buildxcworkspace "VLC for iOS" "VLC for iOS"
  205. fi
  206. info "Build completed"