compileVLCforiOS.sh 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  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=d0e7b32b4
  13. TESTEDMEDIALIBRARYKITHASH=b2af11024
  14. usage()
  15. {
  16. cat << EOF
  17. usage: $0 [-s] [-v] [-k sdk]
  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 extra=""
  49. if [ "$PLATFORM" = "Simulator" ]; then
  50. extra="ARCHS=i386"
  51. fi
  52. xcodebuild -project "$1.xcodeproj" \
  53. -target "$target" \
  54. -sdk $PLATFORM$SDK \
  55. -configuration ${CONFIGURATION} ${extra} \
  56. IPHONEOS_DEPLOYMENT_TARGET=${SDK_MIN} > ${out}
  57. }
  58. while getopts "hvsdnlk:" OPTION
  59. do
  60. case $OPTION in
  61. h)
  62. usage
  63. exit 1
  64. ;;
  65. v)
  66. VERBOSE=yes
  67. ;;
  68. s)
  69. PLATFORM=iphonesimulator
  70. ;;
  71. d) CONFIGURATION="Debug"
  72. ;;
  73. n)
  74. NONETWORK=yes
  75. ;;
  76. l)
  77. SKIPLIBVLCCOMPILATION=yes
  78. ;;
  79. k)
  80. SDK=$OPTARG
  81. ;;
  82. ?)
  83. usage
  84. exit 1
  85. ;;
  86. esac
  87. done
  88. shift $(($OPTIND - 1))
  89. out="/dev/null"
  90. if [ "$VERBOSE" = "yes" ]; then
  91. out="/dev/stdout"
  92. fi
  93. if [ "x$1" != "x" ]; then
  94. usage
  95. exit 1
  96. fi
  97. # Get root dir
  98. spushd .
  99. aspen_root_dir=`pwd`
  100. spopd
  101. info "Preparing build dirs"
  102. mkdir -p ImportedSources
  103. rm -rf External
  104. mkdir -p External
  105. spushd ImportedSources
  106. if [ "$NONETWORK" != "yes" ]; then
  107. if ! [ -e MediaLibraryKit ]; then
  108. git clone git://git.videolan.org/MediaLibraryKit.git
  109. cd MediaLibraryKit
  110. git checkout -B localAspenBranch ${TESTEDMEDIALIBRARYKITHASH}
  111. git branch --set-upstream-to=origin/master localAspenBranch
  112. cd ..
  113. else
  114. cd MediaLibraryKit
  115. git pull --rebase
  116. git reset --hard ${TESTEDMEDIALIBRARYKITHASH}
  117. cd ..
  118. fi
  119. if ! [ -e VLCKit ]; then
  120. git clone git://git.videolan.org/vlc-bindings/VLCKit.git
  121. cd VLCKit
  122. git checkout -B localAspenBranch ${TESTEDVLCKITHASH}
  123. git branch --set-upstream-to=origin/master localAspenBranch
  124. cd ..
  125. else
  126. cd VLCKit
  127. git pull --rebase
  128. git reset --hard ${TESTEDVLCKITHASH}
  129. cd ..
  130. fi
  131. if ! [ -e OBSlider ]; then
  132. git clone git://github.com/ole/OBSlider.git
  133. else
  134. cd OBSlider && git pull --rebase && cd ..
  135. fi
  136. if ! [ -e DAVKit ]; then
  137. git clone git://github.com/mattrajca/DAVKit.git
  138. else
  139. cd DAVKit && git pull --rebase && cd ..
  140. fi
  141. if ! [ -e PLCrashReporter ]; then
  142. git clone https://opensource.plausible.coop/stash/scm/plcr/plcrashreporter.git PLCrashReporter
  143. cd PLCrashReporter
  144. git am ../../patches/plcrashreporter/*.patch
  145. if [ $? -ne 0 ]; then
  146. git am --abort
  147. info "Applying the patches failed, aborting git-am"
  148. exit 1
  149. fi
  150. cd ..
  151. fi
  152. if ! [ -e QuincyKit ]; then
  153. git clone git://github.com/TheRealKerni/QuincyKit.git
  154. cd QuincyKit
  155. git am ../../patches/quincykit/*.patch
  156. if [ $? -ne 0 ]; then
  157. git am --abort
  158. info "Applying the patches failed, aborting git-am"
  159. exit 1
  160. fi
  161. cd ..
  162. fi
  163. if ! [ -e GDrive ]; then
  164. svn checkout http://google-api-objectivec-client.googlecode.com/svn/trunk/Source GDrive
  165. else
  166. cd GDrive && svn up && cd ..
  167. fi
  168. if ! [ -e GHSidebarNav ]; then
  169. git clone git://github.com/gresrun/GHSidebarNav.git
  170. else
  171. cd GHSidebarNav && git pull --rebase && cd ..
  172. fi
  173. if ! [ -e upnpx ]; then
  174. git clone git://github.com/fkuehne/upnpx.git
  175. else
  176. cd upnpx && git pull --rebase && cd ..
  177. fi
  178. if ! [ -e WhiteRaccoon ]; then
  179. git clone git://github.com/fkuehne/WhiteRaccoon.git
  180. else
  181. cd WhiteRaccoon && git pull --rebase && cd ..
  182. fi
  183. if ! [ -e CocoaHTTPServer ]; then
  184. git clone git://github.com/robbiehanson/CocoaHTTPServer.git
  185. cd CocoaHTTPServer
  186. git am ../../patches/cocoahttpserver/*.patch
  187. if [ $? -ne 0 ]; then
  188. git am --abort
  189. info "Applying the patches failed, aborting git-am"
  190. exit 1
  191. fi
  192. cd ..
  193. else
  194. cd CocoaHTTPServer && git pull --rebase && cd ..
  195. fi
  196. if ! [ -e Dropbox ]; then
  197. DROPBOXSDKVERSION=1.3.9
  198. curl -O https://www.dropbox.com/static/developers/dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  199. unzip -q dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  200. mv dropbox-ios-sdk-${DROPBOXSDKVERSION} Dropbox
  201. rm dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  202. rm -rf __MACOSX
  203. fi
  204. if ! [ -e InAppSettingsKit ]; then
  205. git clone git://github.com/futuretap/InAppSettingsKit.git
  206. else
  207. cd InAppSettingsKit && git pull --rebase && cd ..
  208. fi
  209. fi
  210. info "Setup 'External' folders"
  211. if [ "$PLATFORM" = "iphonesimulator" ]; then
  212. xcbuilddir="build/${CONFIGURATION}-iphonesimulator"
  213. else
  214. xcbuilddir="build/${CONFIGURATION}-iphoneos"
  215. fi
  216. framework_build="${aspen_root_dir}/ImportedSources/VLCKit/${xcbuilddir}"
  217. mlkit_build="${aspen_root_dir}/ImportedSources/MediaLibraryKit/${xcbuilddir}"
  218. upnpx_build="${aspen_root_dir}/ImportedSources/upnpx/projects/xcode4/upnpx/${xcbuilddir}"
  219. gtl_build="${aspen_root_dir}/ImportedSources/GDrive/${xcbuilddir}"
  220. plcrashreporter_build="${aspen_root_dir}/ImportedSources/PLCrashReporter/${xcbuilddir}"
  221. quincykit_build="${aspen_root_dir}/ImportedSources/QuincyKit/client/iOS/QuincyLib/${xcbuilddir}"
  222. spopd #ImportedSources
  223. ln -sf ${framework_build} External/MobileVLCKit
  224. ln -sf ${mlkit_build} External/MediaLibraryKit
  225. ln -sf ${upnpx_build} External/upnpx
  226. ln -sf ${gtl_build} External/gtl
  227. ln -sf ${plcrashreporter_build} External/PLCrashReporter
  228. ln -sf ${quincykit_build} External/QuincyKit
  229. #
  230. # Build time
  231. #
  232. info "Building"
  233. spushd ImportedSources
  234. spushd VLCKit
  235. echo `pwd`
  236. args=""
  237. if [ "$VERBOSE" = "yes" ]; then
  238. args="${args} -v"
  239. fi
  240. if [ "$PLATFORM" = "iphonesimulator" ]; then
  241. args="${args} -s"
  242. fi
  243. if [ "$NONETWORK" = "yes" ]; then
  244. args="${args} -n"
  245. fi
  246. if [ "$SKIPLIBVLCCOMPILATION" = "yes" ]; then
  247. args="${args} -l"
  248. fi
  249. ./buildMobileVLCKit.sh ${args} -k "${SDK}"
  250. buildxcodeproj MobileVLCKit "Aggregate static plugins"
  251. buildxcodeproj MobileVLCKit "MobileVLCKit"
  252. spopd
  253. spushd MediaLibraryKit
  254. rm -f External/MobileVLCKit
  255. ln -sf ${framework_build} External/MobileVLCKit
  256. buildxcodeproj MediaLibraryKit
  257. spopd
  258. spushd upnpx/projects/xcode4/upnpx
  259. buildxcodeproj upnpx
  260. spopd
  261. spushd GDrive
  262. buildxcodeproj GTL "GTLTouchStaticLib"
  263. spopd
  264. spushd PLCrashReporter
  265. if [ "$PLATFORM" = "iphonesimulator" ]; then
  266. buildxcodeproj CrashReporter "CrashReporter-iOS-Simulator"
  267. else
  268. buildxcodeproj CrashReporter "CrashReporter-iOS-Device"
  269. fi
  270. spopd
  271. spushd QuincyKit/client/iOS/QuincyLib
  272. buildxcodeproj QuincyLib
  273. spopd
  274. exit
  275. spopd # ImportedSources
  276. # Build the Aspen Project now
  277. buildxcodeproj "VLC for iOS" "vlc-ios"
  278. info "Build completed"