compileVLCforiOS.sh 7.5 KB

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