compileVLCforiOS.sh 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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=b3e60332
  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 checkout -B iOS-2.7 ${TESTEDVLCKITHASH}
  117. git branch --set-upstream-to=origin/iOS-2.7 iOS-2.7
  118. cd ..
  119. else
  120. cd VLCKit
  121. git pull --rebase
  122. git reset --hard ${TESTEDVLCKITHASH}
  123. cd ..
  124. fi
  125. if ! [ -e GDrive ]; then
  126. svn checkout http://google-api-objectivec-client.googlecode.com/svn/trunk/Source GDrive
  127. cd GDrive
  128. patch -p0 < ../../patches/gdrive/fix-target.patch
  129. patch -p0 < ../../patches/gdrive/session-fetcher-top.diff
  130. cd ..
  131. cd GDrive/HTTPFetcher && patch -p0 < ../../../patches/gdrive/httpfetcher-compilation-fix.diff && 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 Dropbox ]; then
  147. DROPBOXSDKVERSION=1.3.13
  148. curl -L -O https://www.dropbox.com/static/developers/dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  149. unzip -q dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  150. mv dropbox-ios-sdk-${DROPBOXSDKVERSION} Dropbox
  151. cd Dropbox
  152. patch -p1 < ../../patches/dropbox/DropboxTV.patch
  153. cd ..
  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/*.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. if [ "$TVOS" = "yes" ]; then
  183. args="${args} -t"
  184. fi
  185. ./buildMobileVLCKit.sh ${args} -k "${SDK}"
  186. spopd
  187. spopd # ImportedSources
  188. #install pods
  189. info "installing pods"
  190. pod install
  191. # Build the VLC for iOS workspace now
  192. if [ "$TVOS" = "no" ]; then
  193. buildxcworkspace "VLC for iOS" "VLC for iOS"
  194. fi
  195. info "Build completed"