compileVLCforiOS.sh 4.7 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=dac090c1
  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. patch -p0 < ../../patches/gdrive/session-fetcher-top.diff
  129. cd ..
  130. cd GDrive/HTTPFetcher && patch -p0 < ../../../patches/gdrive/httpfetcher-compilation-fix.diff && cd ../..
  131. cd GDrive/Objects && patch -p0 < ../../../patches/gdrive/session-fetcher-objects.diff && cd ../..
  132. else
  133. cd GDrive && svn up && cd ..
  134. fi
  135. if ! [ -e LXReorderableCollectionViewFlowLayout ]; then
  136. git clone git://github.com/fkuehne/LXReorderableCollectionViewFlowLayout.git
  137. else
  138. cd LXReorderableCollectionViewFlowLayout && git pull --rebase && cd ..
  139. fi
  140. if ! [ -e WhiteRaccoon ]; then
  141. git clone git://github.com/fkuehne/WhiteRaccoon.git
  142. else
  143. cd WhiteRaccoon && git pull --rebase && cd ..
  144. fi
  145. if ! [ -e CocoaHTTPServer ]; then
  146. git clone git://github.com/fkuehne/CocoaHTTPServer.git
  147. else
  148. cd CocoaHTTPServer && git pull --rebase && cd ..
  149. fi
  150. if ! [ -e Dropbox ]; then
  151. DROPBOXSDKVERSION=1.3.13
  152. curl -L -O https://www.dropbox.com/static/developers/dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  153. unzip -q dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  154. mv dropbox-ios-sdk-${DROPBOXSDKVERSION} Dropbox
  155. rm dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  156. rm -rf __MACOSX
  157. fi
  158. if ! [ -e OneDrive ]; then
  159. git clone git://github.com/liveservices/LiveSDK-for-iOS.git OneDrive
  160. cd OneDrive && git am ../../patches/onedrive/*.patch && cd ..
  161. else
  162. cd OneDrive && git pull --rebase && cd ..
  163. fi
  164. fi
  165. spopd #ImportedSources
  166. #
  167. # Build time
  168. #
  169. info "Building"
  170. spushd ImportedSources
  171. spushd VLCKit
  172. echo `pwd`
  173. args=""
  174. if [ "$VERBOSE" = "yes" ]; then
  175. args="${args} -v"
  176. fi
  177. if [ "$NONETWORK" = "yes" ]; then
  178. args="${args} -n"
  179. fi
  180. if [ "$SKIPLIBVLCCOMPILATION" = "yes" ]; then
  181. args="${args} -l"
  182. fi
  183. if [ "$TVOS" = "yes" ]; then
  184. args="${args} -t"
  185. fi
  186. ./buildMobileVLCKit.sh ${args} -k "${SDK}"
  187. spopd
  188. spopd # ImportedSources
  189. #install pods
  190. info "installing pods"
  191. pod install
  192. # Build the VLC for iOS workspace now
  193. if [ "$TVOS" = "no" ]; then
  194. buildxcworkspace "VLC for iOS" "VLC for iOS"
  195. fi
  196. info "Build completed"