compileVLCforiOS.sh 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. #!/bin/sh
  2. # Copyright (C) Pierre d'Herbemont, 2010
  3. # Copyright (C) Felix Paul Kühne, 2012-2014
  4. set -e
  5. PLATFORM=iphoneos
  6. SDK=`xcrun --sdk iphoneos --show-sdk-version`
  7. SDK_MIN=6.1
  8. VERBOSE=no
  9. CONFIGURATION="Release"
  10. NONETWORK=no
  11. SKIPLIBVLCCOMPILATION=no
  12. TESTEDVLCKITHASH=0218063957
  13. TESTEDMEDIALIBRARYKITHASH=2d98d90aa
  14. usage()
  15. {
  16. cat << EOF
  17. usage: $0 [-s] [-v] [-k sdk] [-d] [-n] [-l] [-u]
  18. OPTIONS
  19. -k Specify which sdk to use (see 'xcodebuild -showsdks', current: ${SDK})
  20. -v Be more verbose
  21. -s Build for simulator
  22. -d Enable Debug
  23. -n Skip script steps requiring network interaction
  24. -l Skip libvlc compilation
  25. EOF
  26. }
  27. spushd()
  28. {
  29. pushd "$1" 2>&1> /dev/null
  30. }
  31. spopd()
  32. {
  33. popd 2>&1> /dev/null
  34. }
  35. info()
  36. {
  37. local green="\033[1;32m"
  38. local normal="\033[0m"
  39. echo "[${green}info${normal}] $1"
  40. }
  41. buildxcodeproj()
  42. {
  43. local target="$2"
  44. if [ "x$target" = "x" ]; then
  45. target="$1"
  46. fi
  47. info "Building $1 ($target, ${CONFIGURATION})"
  48. local extra=""
  49. if [ "$PLATFORM" = "Simulator" ]; then
  50. extra="ARCHS=i386"
  51. fi
  52. xcodebuild -project "$1.xcodeproj" \
  53. -target "$target" \
  54. -sdk $PLATFORM$SDK \
  55. -configuration ${CONFIGURATION} ${extra} \
  56. IPHONEOS_DEPLOYMENT_TARGET=${SDK_MIN} > ${out}
  57. }
  58. buildxcworkspace()
  59. {
  60. local target="$2"
  61. if [ "x$target" = "x" ]; then
  62. target="$1"
  63. fi
  64. info "Building the workspace $1 ($target, ${CONFIGURATION})"
  65. local extra=""
  66. if [ "$PLATFORM" = "Simulator" ]; then
  67. extra="ARCHS=i386"
  68. fi
  69. xcodebuild -workspace "$1.xcworkspace" \
  70. -scheme "Pods-vlc-ios" \
  71. -sdk $PLATFORM$SDK \
  72. -configuration ${CONFIGURATION} ${extra} \
  73. IPHONEOS_DEPLOYMENT_TARGET=${SDK_MIN} > ${out}
  74. }
  75. while getopts "hvsdnluk:" OPTION
  76. do
  77. case $OPTION in
  78. h)
  79. usage
  80. exit 1
  81. ;;
  82. v)
  83. VERBOSE=yes
  84. ;;
  85. s)
  86. PLATFORM=iphonesimulator
  87. ;;
  88. d) CONFIGURATION="Debug"
  89. ;;
  90. n)
  91. NONETWORK=yes
  92. ;;
  93. l)
  94. SKIPLIBVLCCOMPILATION=yes
  95. ;;
  96. k)
  97. SDK=$OPTARG
  98. ;;
  99. ?)
  100. usage
  101. exit 1
  102. ;;
  103. esac
  104. done
  105. shift $(($OPTIND - 1))
  106. out="/dev/null"
  107. if [ "$VERBOSE" = "yes" ]; then
  108. out="/dev/stdout"
  109. fi
  110. if [ "x$1" != "x" ]; then
  111. usage
  112. exit 1
  113. fi
  114. # Get root dir
  115. spushd .
  116. aspen_root_dir=`pwd`
  117. spopd
  118. info "Preparing build dirs"
  119. mkdir -p ImportedSources
  120. rm -rf External
  121. mkdir -p External
  122. spushd ImportedSources
  123. if [ "$NONETWORK" != "yes" ]; then
  124. if ! [ -e MediaLibraryKit ]; then
  125. git clone git://git.videolan.org/MediaLibraryKit.git
  126. cd MediaLibraryKit
  127. git checkout -B localAspenBranch ${TESTEDMEDIALIBRARYKITHASH}
  128. git branch --set-upstream-to=origin/master localAspenBranch
  129. cd ..
  130. else
  131. cd MediaLibraryKit
  132. git reset --hard ${TESTEDMEDIALIBRARYKITHASH}
  133. cd ..
  134. fi
  135. if ! [ -e VLCKit ]; then
  136. git clone git://git.videolan.org/vlc-bindings/VLCKit.git
  137. cd VLCKit
  138. git reset --hard ${TESTEDVLCKITHASH}
  139. cd ..
  140. else
  141. cd VLCKit
  142. git reset --hard ${TESTEDVLCKITHASH}
  143. cd ..
  144. fi
  145. if ! [ -e GDrive ]; then
  146. svn checkout http://google-api-objectivec-client.googlecode.com/svn/trunk/Source GDrive
  147. cd GDrive && patch -p0 < ../../patches/gdrive/upgrade-default-target.patch && cd ..
  148. else
  149. cd GDrive && svn up && cd ..
  150. fi
  151. if ! [ -e LXReorderableCollectionViewFlowLayout ]; then
  152. git clone git://github.com/fkuehne/LXReorderableCollectionViewFlowLayout.git
  153. else
  154. cd LXReorderableCollectionViewFlowLayout && git pull --rebase && cd ..
  155. fi
  156. if ! [ -e WhiteRaccoon ]; then
  157. git clone git://github.com/fkuehne/WhiteRaccoon.git
  158. else
  159. cd WhiteRaccoon && git pull --rebase && cd ..
  160. fi
  161. if ! [ -e CocoaHTTPServer ]; then
  162. git clone git://github.com/fkuehne/CocoaHTTPServer.git
  163. else
  164. cd CocoaHTTPServer && git pull --rebase && cd ..
  165. fi
  166. fi
  167. info "Setup 'External' folders"
  168. if [ "$PLATFORM" = "iphonesimulator" ]; then
  169. xcbuilddir="build/${CONFIGURATION}-iphonesimulator"
  170. else
  171. xcbuilddir="build/${CONFIGURATION}-iphoneos"
  172. fi
  173. framework_build="${aspen_root_dir}/ImportedSources/VLCKit/${xcbuilddir}"
  174. mlkit_build="${aspen_root_dir}/ImportedSources/MediaLibraryKit/${xcbuilddir}"
  175. gtl_build="${aspen_root_dir}/ImportedSources/GDrive/${xcbuilddir}"
  176. spopd #ImportedSources
  177. ln -sf ${framework_build} External/MobileVLCKit
  178. ln -sf ${mlkit_build} External/MediaLibraryKit
  179. ln -sf ${gtl_build} External/gtl
  180. #
  181. # Build time
  182. #
  183. info "Building"
  184. spushd ImportedSources
  185. spushd VLCKit
  186. echo `pwd`
  187. args=""
  188. if [ "$VERBOSE" = "yes" ]; then
  189. args="${args} -v"
  190. fi
  191. if [ "$PLATFORM" = "iphonesimulator" ]; then
  192. args="${args} -s"
  193. fi
  194. if [ "$NONETWORK" = "yes" ]; then
  195. args="${args} -n"
  196. fi
  197. if [ "$SKIPLIBVLCCOMPILATION" = "yes" ]; then
  198. args="${args} -l"
  199. fi
  200. ./buildMobileVLCKit.sh ${args} -k "${SDK}"
  201. buildxcodeproj MobileVLCKit "Aggregate static plugins"
  202. buildxcodeproj MobileVLCKit "MobileVLCKit"
  203. spopd
  204. spushd MediaLibraryKit
  205. rm -f External/MobileVLCKit
  206. ln -sf ${framework_build} External/MobileVLCKit
  207. buildxcodeproj MediaLibraryKit
  208. spopd
  209. spushd GDrive
  210. buildxcodeproj GTL "GTLTouchStaticLib"
  211. spopd
  212. spopd # ImportedSources
  213. #install pods
  214. info "installing pods"
  215. pod install
  216. # Build the Aspen Project now
  217. buildxcworkspace "VLC for iOS" "VLC for iOS"
  218. info "Build completed"