buildAspenProject.sh 4.8 KB

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