buildAspenProject.sh 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. #!/bin/sh
  2. # Copyright (C) Pierre d'Herbemont, 2010
  3. # Copyright (C) Felix Paul Kühne, 2012-2013
  4. set -e
  5. PLATFORM=OS
  6. SDK=iphoneos6.1
  7. SDK_MIN=5.1
  8. VERBOSE=no
  9. CONFIGURATION="Release"
  10. TESTEDHASH=9c5d4f719
  11. TESTEDVLCKITHASH=9032a525e
  12. TESTEDMEDIALIBRARYKITHASH=9eae8ee41
  13. usage()
  14. {
  15. cat << EOF
  16. usage: $0 [-s] [-v] [-k sdk]
  17. OPTIONS
  18. -k Specify which sdk to use (see 'xcodebuild -showsdks', current: ${SDK})
  19. -v Be more verbose
  20. -s Build for simulator
  21. -d Enable Debug
  22. EOF
  23. }
  24. spushd()
  25. {
  26. pushd "$1" 2>&1> /dev/null
  27. }
  28. spopd()
  29. {
  30. popd 2>&1> /dev/null
  31. }
  32. info()
  33. {
  34. local green="\033[1;32m"
  35. local normal="\033[0m"
  36. echo "[${green}info${normal}] $1"
  37. }
  38. buildxcodeproj()
  39. {
  40. local target="$2"
  41. if [ "x$target" = "x" ]; then
  42. target="$1"
  43. fi
  44. info "Building $1 ($target, ${CONFIGURATION})"
  45. local extra=""
  46. if [ "$PLATFORM" = "Simulator" ]; then
  47. extra="ARCHS=i386"
  48. fi
  49. xcodebuild -project "$1.xcodeproj" \
  50. -target "$target" \
  51. -sdk $SDK \
  52. -configuration ${CONFIGURATION} ${extra} \
  53. IPHONEOS_DEPLOYMENT_TARGET=${SDK_MIN} > ${out}
  54. }
  55. while getopts "hvsdk:" OPTION
  56. do
  57. case $OPTION in
  58. h)
  59. usage
  60. exit 1
  61. ;;
  62. v)
  63. VERBOSE=yes
  64. ;;
  65. s)
  66. PLATFORM=Simulator
  67. SDK=iphonesimulator6.1
  68. ;;
  69. d) CONFIGURATION="Debug"
  70. ;;
  71. k)
  72. SDK=$OPTARG
  73. ;;
  74. ?)
  75. usage
  76. exit 1
  77. ;;
  78. esac
  79. done
  80. shift $(($OPTIND - 1))
  81. out="/dev/null"
  82. if [ "$VERBOSE" = "yes" ]; then
  83. out="/dev/stdout"
  84. fi
  85. if [ "x$1" != "x" ]; then
  86. usage
  87. exit 1
  88. fi
  89. # Get root dir
  90. spushd .
  91. aspen_root_dir=`pwd`
  92. spopd
  93. info "Preparing build dirs"
  94. mkdir -p ImportedSources
  95. rm -rf External
  96. mkdir -p External
  97. spushd ImportedSources
  98. if ! [ -e vlc ]; then
  99. git clone git://git.videolan.org/vlc/vlc-2.1.git vlc
  100. info "Applying patches to vlc.git"
  101. cd vlc
  102. git checkout -B localAspenBranch ${TESTEDHASH}
  103. git am ../../patches/*.patch
  104. if [ $? -ne 0 ]; then
  105. git am --abort
  106. info "Applying the patches failed, aborting git-am"
  107. exit 1
  108. fi
  109. cd ..
  110. fi
  111. if ! [ -e MediaLibraryKit ]; then
  112. git clone git://git.videolan.org/MediaLibraryKit.git
  113. cd MediaLibraryKit
  114. git checkout -B localAspenBranch ${TESTEDMEDIALIBRARYKITHASH}
  115. cd ..
  116. fi
  117. if ! [ -e VLCKit ]; then
  118. git clone git://git.videolan.org/vlc-bindings/VLCKit.git
  119. cd VLCKit
  120. git checkout -B localAspenBranch ${TESTEDVLCKITHASH}
  121. cd ..
  122. fi
  123. if ! [ -e OBSlider ]; then
  124. git clone git://github.com/ole/OBSlider.git
  125. fi
  126. if ! [ -e DAVKit ]; then
  127. git clone git://github.com/mattrajca/DAVKit.git
  128. fi
  129. if ! [ -e GHSidebarNav ]; then
  130. git clone git://github.com/gresrun/GHSidebarNav.git
  131. cd GHSidebarNav
  132. git am ../../patches/ghsidebarnav/*.patch
  133. if [ $? -ne 0 ]; then
  134. git am --abort
  135. info "Applying the patches failed, aborting git-am"
  136. exit 1
  137. fi
  138. cd ..
  139. fi
  140. if ! [ -e upnpx ]; then
  141. UPNPXVERSION=1.2.4
  142. curl -O http://upnpx.googlecode.com/files/upnpx-${UPNPXVERSION}.tar.gz
  143. tar xf upnpx-${UPNPXVERSION}.tar.gz
  144. mv upnpx-${UPNPXVERSION} upnpx
  145. cd upnpx && patch -p1 < ${aspen_root_dir}/patches/upnpx/duration-selector-failure.patch
  146. cd ..
  147. fi
  148. if ! [ -e WhiteRaccoon ]; then
  149. git clone git://github.com/fkuehne/WhiteRaccoon.git
  150. fi
  151. if ! [ -e AQGridView ]; then
  152. git clone git://github.com/AlanQuatermain/AQGridView.git
  153. cd AQGridView
  154. git am ../../patches/aqgridview/*.patch
  155. if [ $? -ne 0 ]; then
  156. git am --abort
  157. info "Applying the patches failed, aborting git-am"
  158. exit 1
  159. fi
  160. cd ..
  161. fi
  162. if ! [ -e CocoaHTTPServer ]; then
  163. git clone git://github.com/robbiehanson/CocoaHTTPServer.git
  164. cd CocoaHTTPServer
  165. git am ../../patches/cocoahttpserver/*.patch
  166. if [ $? -ne 0 ]; then
  167. git am --abort
  168. info "Applying the patches failed, aborting git-am"
  169. exit 1
  170. fi
  171. cd ..
  172. fi
  173. if ! [ -e Dropbox ]; then
  174. DROPBOXSDKVERSION=1.3.4
  175. curl -O https://www.dropbox.com/static/developers/dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  176. unzip -q dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  177. mv dropbox-ios-sdk-${DROPBOXSDKVERSION} Dropbox
  178. rm dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  179. rm -rf __MACOSX
  180. fi
  181. if ! [ -e InAppSettingsKit ]; then
  182. git clone git://github.com/futuretap/InAppSettingsKit.git
  183. fi
  184. info "Setup 'External' folders"
  185. if [ "$PLATFORM" = "Simulator" ]; then
  186. xcbuilddir="build/${CONFIGURATION}-iphonesimulator"
  187. else
  188. xcbuilddir="build/${CONFIGURATION}-iphoneos"
  189. fi
  190. framework_build="${aspen_root_dir}/ImportedSources/VLCKit/${xcbuilddir}"
  191. mlkit_build="${aspen_root_dir}/ImportedSources/MediaLibraryKit/${xcbuilddir}"
  192. upnpx_build="${aspen_root_dir}/ImportedSources/upnpx/projects/xcode4/upnpx/${xcbuilddir}"
  193. spushd MediaLibraryKit
  194. rm -f External/MobileVLCKit
  195. ln -sf ${framework_build} External/MobileVLCKit
  196. spopd
  197. spopd #ImportedSources
  198. ln -sf ${framework_build} External/MobileVLCKit
  199. ln -sf ${mlkit_build} External/MediaLibraryKit
  200. ln -sf ${upnpx_build} External/upnpx
  201. #
  202. # Build time
  203. #
  204. info "Building"
  205. spushd ImportedSources
  206. spushd vlc/extras/package/ios
  207. info "Building vlc"
  208. args=""
  209. if [ "$VERBOSE" = "yes" ]; then
  210. args="${args} -v"
  211. fi
  212. if [ "$PLATFORM" = "Simulator" ]; then
  213. args="${args} -s"
  214. ./build.sh ${args} -k "${SDK}"
  215. else
  216. ./build.sh -a armv7 ${args} -k "${SDK}" && ./build.sh -a armv7s ${args} -k "${SDK}"
  217. fi
  218. spopd
  219. spushd VLCKit
  220. buildxcodeproj MobileVLCKit "Aggregate static plugins"
  221. buildxcodeproj MobileVLCKit "MobileVLCKit"
  222. spopd
  223. spushd MediaLibraryKit
  224. buildxcodeproj MediaLibraryKit
  225. spopd
  226. spushd upnpx/projects/xcode4/upnpx
  227. buildxcodeproj upnpx
  228. spopd
  229. spopd # ImportedSources
  230. # Build the Aspen Project now
  231. buildxcodeproj "VLC for iOS" "vlc-ios"
  232. info "Build completed"