buildAspenProject.sh 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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. info "Setup 'External' folders"
  133. if [ "$PLATFORM" = "Simulator" ]; then
  134. xcbuilddir="build/Release-iphonesimulator"
  135. else
  136. xcbuilddir="build/Release-iphoneos"
  137. fi
  138. framework_build="${aspen_root_dir}/ImportedSources/VLCKit/${xcbuilddir}"
  139. mlkit_build="${aspen_root_dir}/ImportedSources/MediaLibraryKit/${xcbuilddir}"
  140. spopd #ImportedSources
  141. rm -f External/MobileVLCKit
  142. rm -f External/MediaLibraryKit
  143. ln -sf ${framework_build} External/MobileVLCKit
  144. ln -sf ${mlkit_build} External/MediaLibraryKit
  145. #
  146. # Build time
  147. #
  148. info "Building"
  149. spushd ImportedSources
  150. spushd vlc/extras/package/ios
  151. info "Building vlc"
  152. args=""
  153. if [ "$PLATFORM" = "Simulator" ]; then
  154. args="${args} -s"
  155. fi
  156. if [ "$VERBOSE" = "yes" ]; then
  157. args="${args} -v"
  158. fi
  159. ./build.sh ${args} -k "${SDK}"
  160. spopd
  161. spushd VLCKit
  162. buildxcodeproj MobileVLCKit "Aggregate static plugins"
  163. buildxcodeproj MobileVLCKit "MobileVLCKit"
  164. spopd
  165. spushd MediaLibraryKit
  166. buildxcodeproj MobileMediaLibraryKit
  167. spopd
  168. spopd # ImportedSources
  169. # Build the Aspen Project now
  170. buildxcodeproj AspenProject
  171. info "Build completed"