compileVLCforiOS.sh 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. #!/bin/sh
  2. # Copyright (C) Pierre d'Herbemont, 2010
  3. # Copyright (C) Felix Paul Kühne, 2012-2014
  4. set -e
  5. PLATFORM=iphoneos
  6. SDK=`xcrun --sdk iphoneos --show-sdk-version`
  7. SDK_MIN=6.1
  8. VERBOSE=no
  9. CONFIGURATION="Release"
  10. NONETWORK=no
  11. SKIPLIBVLCCOMPILATION=no
  12. TESTEDVLCKITHASH=754265a32
  13. TESTEDMEDIALIBRARYKITHASH=a2aa36265
  14. usage()
  15. {
  16. cat << EOF
  17. usage: $0 [-s] [-v] [-k sdk] [-d] [-n] [-l] [-u]
  18. OPTIONS
  19. -k Specify which sdk to use (see 'xcodebuild -showsdks', current: ${SDK})
  20. -v Be more verbose
  21. -s Build for simulator
  22. -d Enable Debug
  23. -n Skip script steps requiring network interaction
  24. -l Skip libvlc compilation
  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. buildxcodeproj()
  42. {
  43. local target="$2"
  44. if [ "x$target" = "x" ]; then
  45. target="$1"
  46. fi
  47. info "Building $1 ($target, ${CONFIGURATION})"
  48. local architectures=""
  49. if [ "$PLATFORM" = "iphonesimulator" ]; then
  50. architectures="i386 x86_64"
  51. else
  52. architectures="armv7 armv7s arm64"
  53. fi
  54. xcodebuild -project "$1.xcodeproj" \
  55. -target "$target" \
  56. -sdk $PLATFORM$SDK \
  57. -configuration ${CONFIGURATION} \
  58. ARCHS="${architectures}" \
  59. IPHONEOS_DEPLOYMENT_TARGET=${SDK_MIN} > ${out}
  60. }
  61. buildxcworkspace()
  62. {
  63. local target="$2"
  64. if [ "x$target" = "x" ]; then
  65. target="$1"
  66. fi
  67. info "Building the workspace $1 ($target, ${CONFIGURATION})"
  68. local architectures=""
  69. if [ "$PLATFORM" = "iphonesimulator" ]; then
  70. architectures="i386 x86_64"
  71. else
  72. architectures="armv7 armv7s arm64"
  73. fi
  74. xcodebuild -workspace "$1.xcworkspace" \
  75. -scheme "Pods-vlc-ios" \
  76. -sdk $PLATFORM$SDK \
  77. -configuration ${CONFIGURATION} \
  78. ARCHS="${architectures}" \
  79. IPHONEOS_DEPLOYMENT_TARGET=${SDK_MIN} > ${out}
  80. }
  81. while getopts "hvsdnluk:" OPTION
  82. do
  83. case $OPTION in
  84. h)
  85. usage
  86. exit 1
  87. ;;
  88. v)
  89. VERBOSE=yes
  90. ;;
  91. s)
  92. PLATFORM=iphonesimulator
  93. ;;
  94. d) CONFIGURATION="Debug"
  95. ;;
  96. n)
  97. NONETWORK=yes
  98. ;;
  99. l)
  100. SKIPLIBVLCCOMPILATION=yes
  101. ;;
  102. k)
  103. SDK=$OPTARG
  104. ;;
  105. ?)
  106. usage
  107. exit 1
  108. ;;
  109. esac
  110. done
  111. shift $(($OPTIND - 1))
  112. out="/dev/null"
  113. if [ "$VERBOSE" = "yes" ]; then
  114. out="/dev/stdout"
  115. fi
  116. if [ "x$1" != "x" ]; then
  117. usage
  118. exit 1
  119. fi
  120. # Get root dir
  121. spushd .
  122. aspen_root_dir=`pwd`
  123. spopd
  124. info "Preparing build dirs"
  125. mkdir -p ImportedSources
  126. rm -rf External
  127. mkdir -p External
  128. spushd ImportedSources
  129. if [ "$NONETWORK" != "yes" ]; then
  130. if ! [ -e MediaLibraryKit ]; then
  131. git clone git://git.videolan.org/MediaLibraryKit.git
  132. cd MediaLibraryKit
  133. git checkout -B localAspenBranch ${TESTEDMEDIALIBRARYKITHASH}
  134. git branch --set-upstream-to=origin/master localAspenBranch
  135. cd ..
  136. else
  137. cd MediaLibraryKit
  138. git reset --hard ${TESTEDMEDIALIBRARYKITHASH}
  139. cd ..
  140. fi
  141. if ! [ -e VLCKit ]; then
  142. git clone git://git.videolan.org/vlc-bindings/VLCKit.git
  143. cd VLCKit
  144. git reset --hard ${TESTEDVLCKITHASH}
  145. cd ..
  146. else
  147. cd VLCKit
  148. git reset --hard ${TESTEDVLCKITHASH}
  149. cd ..
  150. fi
  151. if ! [ -e GDrive ]; then
  152. svn checkout http://google-api-objectivec-client.googlecode.com/svn/trunk/Source GDrive
  153. cd GDrive && patch -p0 < ../../patches/gdrive/upgrade-default-target.patch && cd ..
  154. else
  155. cd GDrive && svn up && cd ..
  156. fi
  157. if ! [ -e LXReorderableCollectionViewFlowLayout ]; then
  158. git clone git://github.com/fkuehne/LXReorderableCollectionViewFlowLayout.git
  159. else
  160. cd LXReorderableCollectionViewFlowLayout && git pull --rebase && cd ..
  161. fi
  162. if ! [ -e WhiteRaccoon ]; then
  163. git clone git://github.com/fkuehne/WhiteRaccoon.git
  164. else
  165. cd WhiteRaccoon && git pull --rebase && cd ..
  166. fi
  167. if ! [ -e CocoaHTTPServer ]; then
  168. git clone git://github.com/fkuehne/CocoaHTTPServer.git
  169. else
  170. cd CocoaHTTPServer && git pull --rebase && cd ..
  171. fi
  172. if ! [ -e Dropbox ]; then
  173. DROPBOXSDKVERSION=1.3.13
  174. curl -O https://www.dropbox.com/static/developers/dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  175. unzip -q dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  176. mv dropbox-ios-sdk-${DROPBOXSDKVERSION} Dropbox
  177. rm dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  178. rm -rf __MACOSX
  179. fi
  180. if ! [ -e OneDrive ]; then
  181. git clone git://github.com/liveservices/LiveSDK-for-iOS.git OneDrive
  182. cd OneDrive && git am ../../patches/onedrive/0001-Compile-ARMv7s-slice.patch && cd ..
  183. else
  184. cd OneDrive && git pull --rebase && cd ..
  185. fi
  186. fi
  187. info "Setup 'External' folders"
  188. if [ "$PLATFORM" = "iphonesimulator" ]; then
  189. xcbuilddir="build/${CONFIGURATION}-iphonesimulator"
  190. else
  191. xcbuilddir="build/${CONFIGURATION}-iphoneos"
  192. fi
  193. framework_build="${aspen_root_dir}/ImportedSources/VLCKit/${xcbuilddir}"
  194. mlkit_build="${aspen_root_dir}/ImportedSources/MediaLibraryKit/${xcbuilddir}"
  195. gtl_build="${aspen_root_dir}/ImportedSources/GDrive/${xcbuilddir}"
  196. onedrive_build="${aspen_root_dir}/ImportedSources/OneDrive/src/${xcbuilddir}"
  197. spopd #ImportedSources
  198. ln -sf ${framework_build} External/MobileVLCKit
  199. ln -sf ${mlkit_build} External/MediaLibraryKit
  200. ln -sf ${gtl_build} External/gtl
  201. ln -sf ${onedrive_build} External/OneDrive
  202. #
  203. # Build time
  204. #
  205. info "Building"
  206. spushd ImportedSources
  207. spushd VLCKit
  208. echo `pwd`
  209. args=""
  210. if [ "$VERBOSE" = "yes" ]; then
  211. args="${args} -v"
  212. fi
  213. if [ "$PLATFORM" = "iphonesimulator" ]; then
  214. args="${args} -s"
  215. fi
  216. if [ "$NONETWORK" = "yes" ]; then
  217. args="${args} -n"
  218. fi
  219. if [ "$SKIPLIBVLCCOMPILATION" = "yes" ]; then
  220. args="${args} -l"
  221. fi
  222. ./buildMobileVLCKit.sh ${args} -k "${SDK}"
  223. buildxcodeproj MobileVLCKit "Aggregate static plugins"
  224. buildxcodeproj MobileVLCKit "MobileVLCKit"
  225. spopd
  226. spushd MediaLibraryKit
  227. rm -f External/MobileVLCKit
  228. ln -sf ${framework_build} External/MobileVLCKit
  229. buildxcodeproj MediaLibraryKit
  230. spopd
  231. spushd GDrive
  232. buildxcodeproj GTL "GTLTouchStaticLib"
  233. spopd
  234. spushd OneDrive/src
  235. buildxcodeproj LiveSDK "LiveSDK"
  236. spopd
  237. spopd # ImportedSources
  238. #install pods
  239. info "installing pods"
  240. pod install
  241. # Build the Aspen Project now
  242. buildxcworkspace "VLC for iOS" "VLC for iOS"
  243. info "Build completed"