compileVLCforiOS.sh 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. #!/bin/sh
  2. # Copyright (C) Pierre d'Herbemont, 2010
  3. # Copyright (C) Felix Paul Kühne, 2012-2013
  4. set -e
  5. PLATFORM=iphoneos
  6. SDK=7.0
  7. SDK_MIN=6.1
  8. VERBOSE=no
  9. CONFIGURATION="Release"
  10. NONETWORK=no
  11. SKIPLIBVLCCOMPILATION=no
  12. TESTEDVLCKITHASH=161ec265e
  13. TESTEDMEDIALIBRARYKITHASH=b4a835ee7
  14. TESTEDQUINCYKITHASH=f1d93b96b
  15. usage()
  16. {
  17. cat << EOF
  18. usage: $0 [-s] [-v] [-k sdk]
  19. OPTIONS
  20. -k Specify which sdk to use (see 'xcodebuild -showsdks', current: ${SDK})
  21. -v Be more verbose
  22. -s Build for simulator
  23. -d Enable Debug
  24. -n Skip script steps requiring network interaction
  25. -l Skip libvlc compilation
  26. EOF
  27. }
  28. spushd()
  29. {
  30. pushd "$1" 2>&1> /dev/null
  31. }
  32. spopd()
  33. {
  34. popd 2>&1> /dev/null
  35. }
  36. info()
  37. {
  38. local green="\033[1;32m"
  39. local normal="\033[0m"
  40. echo "[${green}info${normal}] $1"
  41. }
  42. buildxcodeproj()
  43. {
  44. local target="$2"
  45. if [ "x$target" = "x" ]; then
  46. target="$1"
  47. fi
  48. info "Building $1 ($target, ${CONFIGURATION})"
  49. local extra=""
  50. if [ "$PLATFORM" = "Simulator" ]; then
  51. extra="ARCHS=i386"
  52. fi
  53. xcodebuild -project "$1.xcodeproj" \
  54. -target "$target" \
  55. -sdk $PLATFORM$SDK \
  56. -configuration ${CONFIGURATION} ${extra} \
  57. IPHONEOS_DEPLOYMENT_TARGET=${SDK_MIN} > ${out}
  58. }
  59. while getopts "hvsdnlk:" OPTION
  60. do
  61. case $OPTION in
  62. h)
  63. usage
  64. exit 1
  65. ;;
  66. v)
  67. VERBOSE=yes
  68. ;;
  69. s)
  70. PLATFORM=iphonesimulator
  71. ;;
  72. d) CONFIGURATION="Debug"
  73. ;;
  74. n)
  75. NONETWORK=yes
  76. ;;
  77. l)
  78. SKIPLIBVLCCOMPILATION=yes
  79. ;;
  80. k)
  81. SDK=$OPTARG
  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. # Get root dir
  99. spushd .
  100. aspen_root_dir=`pwd`
  101. spopd
  102. info "Preparing build dirs"
  103. mkdir -p ImportedSources
  104. rm -rf External
  105. mkdir -p External
  106. spushd ImportedSources
  107. if [ "$NONETWORK" != "yes" ]; then
  108. if ! [ -e MediaLibraryKit ]; then
  109. git clone git://git.videolan.org/MediaLibraryKit.git
  110. cd MediaLibraryKit
  111. git checkout -B localAspenBranch ${TESTEDMEDIALIBRARYKITHASH}
  112. git branch --set-upstream-to=origin/master localAspenBranch
  113. cd ..
  114. else
  115. cd MediaLibraryKit
  116. git pull --rebase
  117. git reset --hard ${TESTEDMEDIALIBRARYKITHASH}
  118. cd ..
  119. fi
  120. if ! [ -e VLCKit ]; then
  121. git clone git://git.videolan.org/vlc-bindings/VLCKit.git
  122. cd VLCKit
  123. git checkout 2.1-stable
  124. git reset --hard ${TESTEDVLCKITHASH}
  125. cd ..
  126. else
  127. cd VLCKit
  128. git pull --rebase
  129. git reset --hard ${TESTEDVLCKITHASH}
  130. cd ..
  131. fi
  132. if ! [ -e OBSlider ]; then
  133. git clone git://github.com/ole/OBSlider.git
  134. else
  135. cd OBSlider && git pull --rebase && cd ..
  136. fi
  137. if ! [ -e DAVKit ]; then
  138. git clone git://github.com/mattrajca/DAVKit.git
  139. else
  140. cd DAVKit && git pull --rebase && cd ..
  141. fi
  142. if ! [ -e PLCrashReporter ]; then
  143. git clone https://opensource.plausible.coop/stash/scm/plcr/plcrashreporter.git PLCrashReporter
  144. cd PLCrashReporter
  145. git am ../../patches/plcrashreporter/*.patch
  146. if [ $? -ne 0 ]; then
  147. git am --abort
  148. info "Applying the patches failed, aborting git-am"
  149. exit 1
  150. fi
  151. cd ..
  152. fi
  153. if ! [ -e QuincyKit ]; then
  154. git clone git://github.com/TheRealKerni/QuincyKit.git
  155. cd QuincyKit
  156. git checkout -B localAspenBranch ${TESTEDQUINCYKITHASH}
  157. git branch --set-upstream-to=origin/master localAspenBranch
  158. git am ../../patches/quincykit/*.patch
  159. if [ $? -ne 0 ]; then
  160. git am --abort
  161. info "Applying the patches failed, aborting git-am"
  162. exit 1
  163. fi
  164. cd ..
  165. fi
  166. if ! [ -e GDrive ]; then
  167. svn checkout http://google-api-objectivec-client.googlecode.com/svn/trunk/Source GDrive
  168. cd GDrive && patch -p0 < ../../patches/gdrive/upgrade-default-target.patch && cd ..
  169. else
  170. cd GDrive && svn up && cd ..
  171. fi
  172. if ! [ -e GHSidebarNav ]; then
  173. git clone git://github.com/gresrun/GHSidebarNav.git
  174. else
  175. cd GHSidebarNav && git pull --rebase && cd ..
  176. fi
  177. if ! [ -e upnpx ]; then
  178. git clone git://github.com/fkuehne/upnpx.git
  179. else
  180. cd upnpx && git pull --rebase && cd ..
  181. fi
  182. if ! [ -e WhiteRaccoon ]; then
  183. git clone git://github.com/fkuehne/WhiteRaccoon.git
  184. else
  185. cd WhiteRaccoon && git pull --rebase && cd ..
  186. fi
  187. if ! [ -e CocoaHTTPServer ]; then
  188. git clone git://github.com/robbiehanson/CocoaHTTPServer.git
  189. cd CocoaHTTPServer
  190. git am ../../patches/cocoahttpserver/*.patch
  191. if [ $? -ne 0 ]; then
  192. git am --abort
  193. info "Applying the patches failed, aborting git-am"
  194. exit 1
  195. fi
  196. cd ..
  197. else
  198. cd CocoaHTTPServer && git pull --rebase && cd ..
  199. fi
  200. if ! [ -e Dropbox ]; then
  201. DROPBOXSDKVERSION=1.3.9
  202. curl -O https://www.dropbox.com/static/developers/dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  203. unzip -q dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  204. mv dropbox-ios-sdk-${DROPBOXSDKVERSION} Dropbox
  205. rm dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  206. rm -rf __MACOSX
  207. fi
  208. if ! [ -e InAppSettingsKit ]; then
  209. git clone git://github.com/futuretap/InAppSettingsKit.git
  210. cd InAppSettingsKit
  211. git am ../../patches/inappsettingskit/*.patch
  212. if [ $? -ne 0 ]; then
  213. git am --abort
  214. info "Applying the patches failed, aborting git-am"
  215. exit 1
  216. fi
  217. cd ..
  218. fi
  219. fi
  220. info "Setup 'External' folders"
  221. if [ "$PLATFORM" = "iphonesimulator" ]; then
  222. xcbuilddir="build/${CONFIGURATION}-iphonesimulator"
  223. else
  224. xcbuilddir="build/${CONFIGURATION}-iphoneos"
  225. fi
  226. framework_build="${aspen_root_dir}/ImportedSources/VLCKit/${xcbuilddir}"
  227. mlkit_build="${aspen_root_dir}/ImportedSources/MediaLibraryKit/${xcbuilddir}"
  228. upnpx_build="${aspen_root_dir}/ImportedSources/upnpx/projects/xcode4/upnpx/${xcbuilddir}"
  229. gtl_build="${aspen_root_dir}/ImportedSources/GDrive/${xcbuilddir}"
  230. plcrashreporter_build="${aspen_root_dir}/ImportedSources/PLCrashReporter/${xcbuilddir}"
  231. quincykit_build="${aspen_root_dir}/ImportedSources/QuincyKit/client/iOS/QuincyLib/${xcbuilddir}"
  232. spopd #ImportedSources
  233. ln -sf ${framework_build} External/MobileVLCKit
  234. ln -sf ${mlkit_build} External/MediaLibraryKit
  235. ln -sf ${upnpx_build} External/upnpx
  236. ln -sf ${gtl_build} External/gtl
  237. ln -sf ${plcrashreporter_build} External/PLCrashReporter
  238. ln -sf ${quincykit_build} External/QuincyKit
  239. #
  240. # Build time
  241. #
  242. info "Building"
  243. spushd ImportedSources
  244. spushd VLCKit
  245. echo `pwd`
  246. args=""
  247. if [ "$VERBOSE" = "yes" ]; then
  248. args="${args} -v"
  249. fi
  250. if [ "$PLATFORM" = "iphonesimulator" ]; then
  251. args="${args} -s"
  252. fi
  253. if [ "$NONETWORK" = "yes" ]; then
  254. args="${args} -n"
  255. fi
  256. if [ "$SKIPLIBVLCCOMPILATION" = "yes" ]; then
  257. args="${args} -l"
  258. fi
  259. ./buildMobileVLCKit.sh ${args} -k "${SDK}"
  260. buildxcodeproj MobileVLCKit "Aggregate static plugins"
  261. buildxcodeproj MobileVLCKit "MobileVLCKit"
  262. spopd
  263. spushd MediaLibraryKit
  264. rm -f External/MobileVLCKit
  265. ln -sf ${framework_build} External/MobileVLCKit
  266. buildxcodeproj MediaLibraryKit
  267. spopd
  268. spushd upnpx/projects/xcode4/upnpx
  269. buildxcodeproj upnpx
  270. spopd
  271. spushd GDrive
  272. buildxcodeproj GTL "GTLTouchStaticLib"
  273. spopd
  274. spushd PLCrashReporter
  275. if [ "$PLATFORM" = "iphonesimulator" ]; then
  276. buildxcodeproj CrashReporter "CrashReporter-iOS-Simulator"
  277. else
  278. buildxcodeproj CrashReporter "CrashReporter-iOS-Device"
  279. fi
  280. spopd
  281. spushd QuincyKit/client/iOS/QuincyLib
  282. buildxcodeproj QuincyLib
  283. spopd
  284. spopd # ImportedSources
  285. # Build the Aspen Project now
  286. buildxcodeproj "VLC for iOS" "vlc-ios"
  287. info "Build completed"