buildAspenProject.sh 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  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. TESTEDHASH=2791a97f2
  13. TESTEDVLCKITHASH=b343a201d
  14. TESTEDMEDIALIBRARYKITHASH=973a5eb38
  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 vlc ]; then
  109. git clone git://git.videolan.org/vlc/vlc-2.1.git vlc
  110. info "Applying patches to vlc.git"
  111. cd vlc
  112. #git checkout -B localAspenBranch ${TESTEDHASH}
  113. git am ../../patches/*.patch
  114. if [ $? -ne 0 ]; then
  115. git am --abort
  116. info "Applying the patches failed, aborting git-am"
  117. exit 1
  118. fi
  119. cd ..
  120. else
  121. cd vlc
  122. git pull --rebase
  123. cd ..
  124. fi
  125. if ! [ -e MediaLibraryKit ]; then
  126. git clone git://git.videolan.org/MediaLibraryKit.git
  127. cd MediaLibraryKit
  128. git checkout -B localAspenBranch ${TESTEDMEDIALIBRARYKITHASH}
  129. git branch --set-upstream-to=origin/master localAspenBranch
  130. cd ..
  131. else
  132. cd MediaLibraryKit
  133. git pull --rebase
  134. git reset --hard ${TESTEDMEDIALIBRARYKITHASH}
  135. cd ..
  136. fi
  137. if ! [ -e VLCKit ]; then
  138. git clone git://git.videolan.org/vlc-bindings/VLCKit.git
  139. cd VLCKit
  140. git checkout -B localAspenBranch ${TESTEDVLCKITHASH}
  141. git branch --set-upstream-to=origin/master localAspenBranch
  142. cd ..
  143. else
  144. cd VLCKit
  145. git pull --rebase
  146. git reset --hard ${TESTEDVLCKITHASH}
  147. cd ..
  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 GDrive ]; then
  160. svn checkout http://google-api-objectivec-client.googlecode.com/svn/trunk/Source GDrive
  161. else
  162. cd GDrive && svn up && cd ..
  163. fi
  164. if ! [ -e GHSidebarNav ]; then
  165. git clone git://github.com/gresrun/GHSidebarNav.git
  166. else
  167. cd GHSidebarNav && git pull --rebase && cd ..
  168. fi
  169. if ! [ -e upnpx ]; then
  170. UPNPXVERSION=1.2.4
  171. curl -O http://upnpx.googlecode.com/files/upnpx-${UPNPXVERSION}.tar.gz
  172. tar xf upnpx-${UPNPXVERSION}.tar.gz
  173. mv upnpx-${UPNPXVERSION} upnpx
  174. cd upnpx
  175. for file in ../../patches/upnpx/*; do
  176. patch -p1 < ../../patches/upnpx/"$file"
  177. done
  178. cd ..
  179. fi
  180. if ! [ -e WhiteRaccoon ]; then
  181. git clone git://github.com/fkuehne/WhiteRaccoon.git
  182. else
  183. cd WhiteRaccoon && git pull --rebase && cd ..
  184. fi
  185. if ! [ -e CocoaHTTPServer ]; then
  186. git clone git://github.com/robbiehanson/CocoaHTTPServer.git
  187. cd CocoaHTTPServer
  188. git am ../../patches/cocoahttpserver/*.patch
  189. if [ $? -ne 0 ]; then
  190. git am --abort
  191. info "Applying the patches failed, aborting git-am"
  192. exit 1
  193. fi
  194. cd ..
  195. else
  196. cd CocoaHTTPServer && git pull --rebase && cd ..
  197. fi
  198. if ! [ -e Dropbox ]; then
  199. DROPBOXSDKVERSION=1.3.9
  200. curl -O https://www.dropbox.com/static/developers/dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  201. unzip -q dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  202. mv dropbox-ios-sdk-${DROPBOXSDKVERSION} Dropbox
  203. rm dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  204. rm -rf __MACOSX
  205. fi
  206. if ! [ -e InAppSettingsKit ]; then
  207. git clone git://github.com/futuretap/InAppSettingsKit.git
  208. cd InAppSettingsKit
  209. git am ../../patches/inappsettingskit/*.patch
  210. if [ $? -ne 0 ]; then
  211. git am --abort
  212. info "Applying the patches failed, aborting git-am"
  213. exit 1
  214. fi
  215. cd ..
  216. else
  217. cd InAppSettingsKit && git pull --rebase && 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. spushd MediaLibraryKit
  231. rm -f External/MobileVLCKit
  232. ln -sf ${framework_build} External/MobileVLCKit
  233. spopd
  234. spopd #ImportedSources
  235. ln -sf ${framework_build} External/MobileVLCKit
  236. ln -sf ${mlkit_build} External/MediaLibraryKit
  237. ln -sf ${upnpx_build} External/upnpx
  238. ln -sf ${gtl_build} External/gtl
  239. #
  240. # Build time
  241. #
  242. info "Building"
  243. spushd ImportedSources
  244. if [ "$SKIPLIBVLCCOMPILATION" != "yes" ]; then
  245. spushd vlc/extras/package/ios
  246. info "Building vlc"
  247. args=""
  248. if [ "$VERBOSE" = "yes" ]; then
  249. args="${args} -v"
  250. fi
  251. if [ "$PLATFORM" = "iphonesimulator" ]; then
  252. args="${args} -s"
  253. ./build.sh ${args} -k "${SDK}"
  254. else
  255. ./build.sh -a armv7 ${args} -k "${SDK}" && ./build.sh -a armv7s ${args} -k "${SDK}"
  256. fi
  257. spopd
  258. fi
  259. spushd VLCKit
  260. buildxcodeproj MobileVLCKit "Aggregate static plugins"
  261. buildxcodeproj MobileVLCKit "MobileVLCKit"
  262. spopd
  263. spushd MediaLibraryKit
  264. buildxcodeproj MediaLibraryKit
  265. spopd
  266. spushd upnpx/projects/xcode4/upnpx
  267. buildxcodeproj upnpx
  268. spopd
  269. spushd GDrive
  270. buildxcodeproj GTL "GTLTouchStaticLib"
  271. spopd
  272. spopd # ImportedSources
  273. # Build the Aspen Project now
  274. buildxcodeproj "VLC for iOS" "vlc-ios"
  275. info "Build completed"