compileVLCforiOS.sh 7.7 KB

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