compileVLCforiOS.sh 4.7 KB

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