compileVLCforiOS.sh 5.8 KB

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