buildAspenProject.sh 4.7 KB

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