compileVLCforiOS.sh 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  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=60c71ff30
  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 reset --hard ${TESTEDMEDIALIBRARYKITHASH}
  122. cd ..
  123. fi
  124. if [ "$UNSTABLEVLCKIT" = "no" ]; then
  125. if ! [ -e VLCKit ]; then
  126. git clone git://git.videolan.org/vlc-bindings/VLCKit.git
  127. cd VLCKit
  128. git checkout 2.1-stable
  129. git reset --hard ${TESTEDVLCKITHASH}
  130. cd ..
  131. else
  132. cd VLCKit
  133. git reset --hard ${TESTEDVLCKITHASH}
  134. cd ..
  135. fi
  136. else
  137. if ! [ -e VLCKit ]; then
  138. git clone git://git.videolan.org/vlc-bindings/VLCKit.git
  139. else
  140. git pull --rebase
  141. fi
  142. fi
  143. if ! [ -e OBSlider ]; then
  144. git clone git://github.com/ole/OBSlider.git
  145. else
  146. cd OBSlider && git pull --rebase && cd ..
  147. fi
  148. if ! [ -e DAVKit ]; then
  149. git clone git://github.com/mattrajca/DAVKit.git
  150. else
  151. cd DAVKit && git pull --rebase && cd ..
  152. fi
  153. if ! [ -e PLCrashReporter ]; then
  154. git clone https://opensource.plausible.coop/stash/scm/plcr/plcrashreporter.git PLCrashReporter
  155. cd PLCrashReporter
  156. git am ../../patches/plcrashreporter/*.patch
  157. if [ $? -ne 0 ]; then
  158. git am --abort
  159. info "Applying the patches failed, aborting git-am"
  160. exit 1
  161. fi
  162. cd ..
  163. fi
  164. if ! [ -e QuincyKit ]; then
  165. git clone git://github.com/TheRealKerni/QuincyKit.git
  166. cd QuincyKit
  167. git checkout -B localAspenBranch ${TESTEDQUINCYKITHASH}
  168. git branch --set-upstream-to=origin/master localAspenBranch
  169. git am ../../patches/quincykit/*.patch
  170. if [ $? -ne 0 ]; then
  171. git am --abort
  172. info "Applying the patches failed, aborting git-am"
  173. exit 1
  174. fi
  175. cd ..
  176. fi
  177. if ! [ -e GDrive ]; then
  178. svn checkout http://google-api-objectivec-client.googlecode.com/svn/trunk/Source GDrive
  179. cd GDrive && patch -p0 < ../../patches/gdrive/upgrade-default-target.patch && cd ..
  180. else
  181. cd GDrive && svn up && cd ..
  182. fi
  183. if ! [ -e GHSidebarNav ]; then
  184. git clone git://github.com/gresrun/GHSidebarNav.git
  185. else
  186. cd GHSidebarNav && git pull --rebase && cd ..
  187. fi
  188. if ! [ -e LXReorderableCollectionViewFlowLayout ]; then
  189. git clone git://github.com/lxcid/LXReorderableCollectionViewFlowLayout.git
  190. cd LXReorderableCollectionViewFlowLayout
  191. git am ../../patches/lxreorderablecollectionviewflowlayout/*.patch
  192. if [ $? -ne 0 ]; then
  193. git am --abort
  194. info "Applying the patches failed, aborting git-am"
  195. exit 1
  196. fi
  197. cd ..
  198. else
  199. cd LXReorderableCollectionViewFlowLayout && git pull --rebase && cd ..
  200. fi
  201. if ! [ -e upnpx ]; then
  202. git clone git://github.com/fkuehne/upnpx.git
  203. else
  204. cd upnpx && git pull --rebase && cd ..
  205. fi
  206. if ! [ -e WhiteRaccoon ]; then
  207. git clone git://github.com/fkuehne/WhiteRaccoon.git
  208. else
  209. cd WhiteRaccoon && git pull --rebase && cd ..
  210. fi
  211. if ! [ -e CocoaHTTPServer ]; then
  212. git clone git://github.com/robbiehanson/CocoaHTTPServer.git
  213. cd CocoaHTTPServer
  214. git am ../../patches/cocoahttpserver/*.patch
  215. if [ $? -ne 0 ]; then
  216. git am --abort
  217. info "Applying the patches failed, aborting git-am"
  218. exit 1
  219. fi
  220. cd ..
  221. else
  222. cd CocoaHTTPServer && git pull --rebase && cd ..
  223. fi
  224. if ! [ -e Dropbox ]; then
  225. DROPBOXSDKVERSION=1.3.9
  226. curl -O https://www.dropbox.com/static/developers/dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  227. unzip -q dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  228. mv dropbox-ios-sdk-${DROPBOXSDKVERSION} Dropbox
  229. rm dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  230. rm -rf __MACOSX
  231. fi
  232. if ! [ -e InAppSettingsKit ]; then
  233. git clone git://github.com/futuretap/InAppSettingsKit.git
  234. cd InAppSettingsKit
  235. git am ../../patches/inappsettingskit/*.patch
  236. if [ $? -ne 0 ]; then
  237. git am --abort
  238. info "Applying the patches failed, aborting git-am"
  239. exit 1
  240. fi
  241. cd ..
  242. fi
  243. fi
  244. info "Setup 'External' folders"
  245. if [ "$PLATFORM" = "iphonesimulator" ]; then
  246. xcbuilddir="build/${CONFIGURATION}-iphonesimulator"
  247. else
  248. xcbuilddir="build/${CONFIGURATION}-iphoneos"
  249. fi
  250. framework_build="${aspen_root_dir}/ImportedSources/VLCKit/${xcbuilddir}"
  251. mlkit_build="${aspen_root_dir}/ImportedSources/MediaLibraryKit/${xcbuilddir}"
  252. upnpx_build="${aspen_root_dir}/ImportedSources/upnpx/projects/xcode4/upnpx/${xcbuilddir}"
  253. gtl_build="${aspen_root_dir}/ImportedSources/GDrive/${xcbuilddir}"
  254. plcrashreporter_build="${aspen_root_dir}/ImportedSources/PLCrashReporter/${xcbuilddir}"
  255. quincykit_build="${aspen_root_dir}/ImportedSources/QuincyKit/client/iOS/QuincyLib/${xcbuilddir}"
  256. spopd #ImportedSources
  257. ln -sf ${framework_build} External/MobileVLCKit
  258. ln -sf ${mlkit_build} External/MediaLibraryKit
  259. ln -sf ${upnpx_build} External/upnpx
  260. ln -sf ${gtl_build} External/gtl
  261. ln -sf ${plcrashreporter_build} External/PLCrashReporter
  262. ln -sf ${quincykit_build} External/QuincyKit
  263. #
  264. # Build time
  265. #
  266. info "Building"
  267. spushd ImportedSources
  268. spushd VLCKit
  269. echo `pwd`
  270. args=""
  271. if [ "$VERBOSE" = "yes" ]; then
  272. args="${args} -v"
  273. fi
  274. if [ "$PLATFORM" = "iphonesimulator" ]; then
  275. args="${args} -s"
  276. fi
  277. if [ "$NONETWORK" = "yes" ]; then
  278. args="${args} -n"
  279. fi
  280. if [ "$SKIPLIBVLCCOMPILATION" = "yes" ]; then
  281. args="${args} -l"
  282. fi
  283. ./buildMobileVLCKit.sh ${args} -k "${SDK}"
  284. buildxcodeproj MobileVLCKit "Aggregate static plugins"
  285. buildxcodeproj MobileVLCKit "MobileVLCKit"
  286. spopd
  287. spushd MediaLibraryKit
  288. rm -f External/MobileVLCKit
  289. ln -sf ${framework_build} External/MobileVLCKit
  290. buildxcodeproj MediaLibraryKit
  291. spopd
  292. spushd upnpx/projects/xcode4/upnpx
  293. buildxcodeproj upnpx
  294. spopd
  295. spushd GDrive
  296. buildxcodeproj GTL "GTLTouchStaticLib"
  297. spopd
  298. spushd PLCrashReporter
  299. if [ "$PLATFORM" = "iphonesimulator" ]; then
  300. buildxcodeproj CrashReporter "CrashReporter-iOS-Simulator"
  301. else
  302. buildxcodeproj CrashReporter "CrashReporter-iOS-Device"
  303. fi
  304. spopd
  305. spushd QuincyKit/client/iOS/QuincyLib
  306. buildxcodeproj QuincyLib
  307. spopd
  308. spopd # ImportedSources
  309. # Build the Aspen Project now
  310. buildxcodeproj "VLC for iOS" "vlc-ios"
  311. info "Build completed"