buildAspenProject.sh 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  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=6.1
  7. SDK_MIN=5.1
  8. VERBOSE=no
  9. CONFIGURATION="Release"
  10. TESTEDHASH=c891dc7d3
  11. TESTEDVLCKITHASH=9032a525e
  12. TESTEDMEDIALIBRARYKITHASH=1ac1e0728
  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 $PLATFORM$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=iphonesimulator
  67. ;;
  68. d) CONFIGURATION="Debug"
  69. ;;
  70. k)
  71. SDK=$OPTARG
  72. ;;
  73. ?)
  74. usage
  75. exit 1
  76. ;;
  77. esac
  78. done
  79. shift $(($OPTIND - 1))
  80. out="/dev/null"
  81. if [ "$VERBOSE" = "yes" ]; then
  82. out="/dev/stdout"
  83. fi
  84. if [ "x$1" != "x" ]; then
  85. usage
  86. exit 1
  87. fi
  88. # Get root dir
  89. spushd .
  90. aspen_root_dir=`pwd`
  91. spopd
  92. info "Preparing build dirs"
  93. mkdir -p ImportedSources
  94. rm -rf External
  95. mkdir -p External
  96. spushd ImportedSources
  97. if ! [ -e vlc ]; then
  98. git clone git://git.videolan.org/vlc/vlc-2.1.git vlc
  99. info "Applying patches to vlc.git"
  100. cd vlc
  101. git checkout -B localAspenBranch ${TESTEDHASH}
  102. git am ../../patches/*.patch
  103. if [ $? -ne 0 ]; then
  104. git am --abort
  105. info "Applying the patches failed, aborting git-am"
  106. exit 1
  107. fi
  108. cd ..
  109. fi
  110. if ! [ -e MediaLibraryKit ]; then
  111. git clone git://git.videolan.org/MediaLibraryKit.git
  112. cd MediaLibraryKit
  113. git checkout -B localAspenBranch ${TESTEDMEDIALIBRARYKITHASH}
  114. cd ..
  115. fi
  116. if ! [ -e VLCKit ]; then
  117. git clone git://git.videolan.org/vlc-bindings/VLCKit.git
  118. cd VLCKit
  119. git checkout -B localAspenBranch ${TESTEDVLCKITHASH}
  120. cd ..
  121. fi
  122. if ! [ -e OBSlider ]; then
  123. git clone git://github.com/ole/OBSlider.git
  124. fi
  125. if ! [ -e DAVKit ]; then
  126. git clone git://github.com/mattrajca/DAVKit.git
  127. fi
  128. if ! [ -e GHSidebarNav ]; then
  129. git clone git://github.com/gresrun/GHSidebarNav.git
  130. fi
  131. if ! [ -e upnpx ]; then
  132. UPNPXVERSION=1.2.4
  133. curl -O http://upnpx.googlecode.com/files/upnpx-${UPNPXVERSION}.tar.gz
  134. tar xf upnpx-${UPNPXVERSION}.tar.gz
  135. mv upnpx-${UPNPXVERSION} upnpx
  136. cd upnpx && patch -p1 < ${aspen_root_dir}/patches/upnpx/duration-selector-failure.patch
  137. cd ..
  138. fi
  139. if ! [ -e WhiteRaccoon ]; then
  140. git clone git://github.com/fkuehne/WhiteRaccoon.git
  141. fi
  142. if ! [ -e AQGridView ]; then
  143. git clone git://github.com/AlanQuatermain/AQGridView.git
  144. cd AQGridView
  145. git am ../../patches/aqgridview/*.patch
  146. if [ $? -ne 0 ]; then
  147. git am --abort
  148. info "Applying the patches failed, aborting git-am"
  149. exit 1
  150. fi
  151. cd ..
  152. fi
  153. if ! [ -e CocoaHTTPServer ]; then
  154. git clone git://github.com/robbiehanson/CocoaHTTPServer.git
  155. cd CocoaHTTPServer
  156. git am ../../patches/cocoahttpserver/*.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 Dropbox ]; then
  165. DROPBOXSDKVERSION=1.3.4
  166. curl -O https://www.dropbox.com/static/developers/dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  167. unzip -q dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  168. mv dropbox-ios-sdk-${DROPBOXSDKVERSION} Dropbox
  169. rm dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  170. rm -rf __MACOSX
  171. fi
  172. if ! [ -e InAppSettingsKit ]; then
  173. git clone git://github.com/futuretap/InAppSettingsKit.git
  174. fi
  175. info "Setup 'External' folders"
  176. if [ "$PLATFORM" = "iphonesimulator" ]; then
  177. xcbuilddir="build/${CONFIGURATION}-iphonesimulator"
  178. else
  179. xcbuilddir="build/${CONFIGURATION}-iphoneos"
  180. fi
  181. framework_build="${aspen_root_dir}/ImportedSources/VLCKit/${xcbuilddir}"
  182. mlkit_build="${aspen_root_dir}/ImportedSources/MediaLibraryKit/${xcbuilddir}"
  183. upnpx_build="${aspen_root_dir}/ImportedSources/upnpx/projects/xcode4/upnpx/${xcbuilddir}"
  184. spushd MediaLibraryKit
  185. rm -f External/MobileVLCKit
  186. ln -sf ${framework_build} External/MobileVLCKit
  187. spopd
  188. spopd #ImportedSources
  189. ln -sf ${framework_build} External/MobileVLCKit
  190. ln -sf ${mlkit_build} External/MediaLibraryKit
  191. ln -sf ${upnpx_build} External/upnpx
  192. #
  193. # Build time
  194. #
  195. info "Building"
  196. spushd ImportedSources
  197. spushd vlc/extras/package/ios
  198. info "Building vlc"
  199. args=""
  200. if [ "$VERBOSE" = "yes" ]; then
  201. args="${args} -v"
  202. fi
  203. if [ "$PLATFORM" = "iphonesimulator" ]; then
  204. args="${args} -s"
  205. ./build.sh ${args} -k "${SDK}"
  206. else
  207. ./build.sh -a armv7 ${args} -k "${SDK}" && ./build.sh -a armv7s ${args} -k "${SDK}"
  208. fi
  209. spopd
  210. spushd VLCKit
  211. buildxcodeproj MobileVLCKit "Aggregate static plugins"
  212. buildxcodeproj MobileVLCKit "MobileVLCKit"
  213. spopd
  214. spushd MediaLibraryKit
  215. buildxcodeproj MediaLibraryKit
  216. spopd
  217. spushd upnpx/projects/xcode4/upnpx
  218. buildxcodeproj upnpx
  219. spopd
  220. spopd # ImportedSources
  221. # Build the Aspen Project now
  222. buildxcodeproj "VLC for iOS" "vlc-ios"
  223. info "Build completed"