buildAspenProject.sh 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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. spushd ImportedSources
  93. if ! [ -e vlc ]; then
  94. git clone git://git.videolan.org/vlc.git
  95. info "Applying patches to vlc.git"
  96. cd vlc
  97. git am ../../patches/*.patch
  98. if [ $? -ne 0 ]; then
  99. git am --abort
  100. info "Applying the patches failed, aborting git-am"
  101. exit 1
  102. fi
  103. cd ..
  104. fi
  105. if ! [ -e MediaLibraryKit ]; then
  106. git clone -b Aspen --single-branch git://git.videolan.org/MediaLibraryKit.git
  107. fi
  108. if ! [ -e VLCKit ]; then
  109. git clone git://git.videolan.org/vlc-bindings/VLCKit.git
  110. info "Applying patches to VLCKit.git"
  111. cd VLCKit
  112. git am ../../patches/vlckit/*.patch
  113. if [ $? -ne 0 ]; then
  114. git am --abort
  115. info "Applying the patches failed, aborting git-am"
  116. exit 1
  117. fi
  118. cd ..
  119. fi
  120. if ! [ -e OBSlider ]; then
  121. git clone git://github.com/sylverb/OBSlider.git
  122. info "Applying patches to OBSlider.git"
  123. cd OBSlider
  124. git am ../../patches/obslider/*.patch
  125. if [ $? -ne 0 ]; then
  126. git am --abort
  127. info "Applying the patches failed, aborting git-am"
  128. exit 1
  129. fi
  130. cd ..
  131. fi
  132. if ! [ -e AQGridView ]; then
  133. git clone git://github.com/AlanQuatermain/AQGridView.git
  134. cd AQGridView
  135. git am ../../patches/aqgridview/*.patch
  136. if [ $? -ne 0 ]; then
  137. git am --abort
  138. info "Applying the patches failed, aborting git-am"
  139. exit 1
  140. fi
  141. cd ..
  142. fi
  143. info "Setup 'External' folders"
  144. if [ "$PLATFORM" = "Simulator" ]; then
  145. xcbuilddir="build/Release-iphonesimulator"
  146. else
  147. xcbuilddir="build/Release-iphoneos"
  148. fi
  149. framework_build="${aspen_root_dir}/ImportedSources/VLCKit/${xcbuilddir}"
  150. mlkit_build="${aspen_root_dir}/ImportedSources/MediaLibraryKit/${xcbuilddir}"
  151. spushd MediaLibraryKit
  152. rm -f External/MobileVLCKit
  153. ln -sf ${framework_build} External/MobileVLCKit
  154. spopd
  155. spopd #ImportedSources
  156. rm -f External/MobileVLCKit
  157. rm -f External/MediaLibraryKit
  158. ln -sf ${framework_build} External/MobileVLCKit
  159. ln -sf ${mlkit_build} External/MediaLibraryKit
  160. #
  161. # Build time
  162. #
  163. info "Building"
  164. spushd ImportedSources
  165. spushd vlc/extras/package/ios
  166. info "Building vlc"
  167. args=""
  168. if [ "$VERBOSE" = "yes" ]; then
  169. args="${args} -v"
  170. fi
  171. if [ "$PLATFORM" = "Simulator" ]; then
  172. args="${args} -s"
  173. ./build.sh ${args} -k "${SDK}"
  174. else
  175. ./build.sh -a armv7 ${args} -k "${SDK}" && ./build.sh -a armv7s ${args} -k "${SDK}"
  176. fi
  177. spopd
  178. spushd VLCKit
  179. buildxcodeproj MobileVLCKit "Aggregate static plugins"
  180. buildxcodeproj MobileVLCKit "MobileVLCKit"
  181. spopd
  182. spushd MediaLibraryKit
  183. buildxcodeproj MediaLibraryKit
  184. spopd
  185. spopd # ImportedSources
  186. # Build the Aspen Project now
  187. buildxcodeproj AspenProject
  188. info "Build completed"