compileVLCforiOS.sh 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  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. while getopts "hvsdnluk:" OPTION
  62. do
  63. case $OPTION in
  64. h)
  65. usage
  66. exit 1
  67. ;;
  68. v)
  69. VERBOSE=yes
  70. ;;
  71. s)
  72. PLATFORM=iphonesimulator
  73. ;;
  74. d) CONFIGURATION="Debug"
  75. ;;
  76. n)
  77. NONETWORK=yes
  78. ;;
  79. l)
  80. SKIPLIBVLCCOMPILATION=yes
  81. ;;
  82. k)
  83. SDK=$OPTARG
  84. ;;
  85. p)
  86. UNSTABLEVLCKIT=no
  87. ;;
  88. ?)
  89. usage
  90. exit 1
  91. ;;
  92. esac
  93. done
  94. shift $(($OPTIND - 1))
  95. out="/dev/null"
  96. if [ "$VERBOSE" = "yes" ]; then
  97. out="/dev/stdout"
  98. fi
  99. if [ "x$1" != "x" ]; then
  100. usage
  101. exit 1
  102. fi
  103. # Get root dir
  104. spushd .
  105. aspen_root_dir=`pwd`
  106. spopd
  107. info "Preparing build dirs"
  108. mkdir -p ImportedSources
  109. rm -rf External
  110. mkdir -p External
  111. spushd ImportedSources
  112. if [ "$NONETWORK" != "yes" ]; then
  113. if ! [ -e MediaLibraryKit ]; then
  114. git clone git://git.videolan.org/MediaLibraryKit.git
  115. cd MediaLibraryKit
  116. git checkout -B localAspenBranch ${TESTEDMEDIALIBRARYKITHASH}
  117. git branch --set-upstream-to=origin/master localAspenBranch
  118. cd ..
  119. else
  120. cd MediaLibraryKit
  121. git reset --hard ${TESTEDMEDIALIBRARYKITHASH}
  122. cd ..
  123. fi
  124. if [ "$UNSTABLEVLCKIT" = "no" ]; then
  125. if ! [ -e VLCKit ]; then
  126. git clone git://git.videolan.org/vlc-bindings/VLCKit.git
  127. cd VLCKit
  128. git checkout 2.1-stable
  129. git reset --hard ${TESTEDVLCKITHASH}
  130. cd ..
  131. else
  132. cd VLCKit
  133. git reset --hard ${TESTEDVLCKITHASH}
  134. cd ..
  135. fi
  136. else
  137. if ! [ -e VLCKit ]; then
  138. git clone git://git.videolan.org/vlc-bindings/VLCKit.git
  139. cd VLCKit
  140. git reset --hard ${TESTEDUNSTABLEVLCKITHASH}
  141. cd ..
  142. else
  143. cd VLCKit
  144. git reset --hard ${TESTEDUNSTABLEVLCKITHASH}
  145. cd ..
  146. fi
  147. fi
  148. if ! [ -e DAVKit ]; then
  149. git clone git://github.com/mattrajca/DAVKit.git
  150. else
  151. cd DAVKit && git pull --rebase && cd ..
  152. fi
  153. if ! [ -e GDrive ]; then
  154. svn checkout http://google-api-objectivec-client.googlecode.com/svn/trunk/Source GDrive
  155. cd GDrive && patch -p0 < ../../patches/gdrive/upgrade-default-target.patch && cd ..
  156. else
  157. cd GDrive && svn up && cd ..
  158. fi
  159. if ! [ -e LXReorderableCollectionViewFlowLayout ]; then
  160. git clone git://github.com/fkuehne/LXReorderableCollectionViewFlowLayout.git
  161. else
  162. cd LXReorderableCollectionViewFlowLayout && git pull --rebase && cd ..
  163. fi
  164. if ! [ -e WhiteRaccoon ]; then
  165. git clone git://github.com/fkuehne/WhiteRaccoon.git
  166. else
  167. cd WhiteRaccoon && git pull --rebase && cd ..
  168. fi
  169. if ! [ -e CocoaHTTPServer ]; then
  170. git clone git://github.com/fkuehne/CocoaHTTPServer.git
  171. else
  172. cd CocoaHTTPServer && git pull --rebase && cd ..
  173. fi
  174. fi
  175. info "Setup 'External' folders"
  176. if [ "$PLATFORM" = "iphonesimulator" ]; then
  177. xcbuilddir="build/${CONFIGURATION}-iphonesimulator"
  178. else
  179. xcbuilddir="build/${CONFIGURATION}-iphoneos"
  180. fi
  181. framework_build="${aspen_root_dir}/ImportedSources/VLCKit/${xcbuilddir}"
  182. mlkit_build="${aspen_root_dir}/ImportedSources/MediaLibraryKit/${xcbuilddir}"
  183. gtl_build="${aspen_root_dir}/ImportedSources/GDrive/${xcbuilddir}"
  184. spopd #ImportedSources
  185. ln -sf ${framework_build} External/MobileVLCKit
  186. ln -sf ${mlkit_build} External/MediaLibraryKit
  187. ln -sf ${gtl_build} External/gtl
  188. #
  189. # Build time
  190. #
  191. info "Building"
  192. spushd ImportedSources
  193. spushd VLCKit
  194. echo `pwd`
  195. args=""
  196. if [ "$VERBOSE" = "yes" ]; then
  197. args="${args} -v"
  198. fi
  199. if [ "$PLATFORM" = "iphonesimulator" ]; then
  200. args="${args} -s"
  201. fi
  202. if [ "$NONETWORK" = "yes" ]; then
  203. args="${args} -n"
  204. fi
  205. if [ "$SKIPLIBVLCCOMPILATION" = "yes" ]; then
  206. args="${args} -l"
  207. fi
  208. ./buildMobileVLCKit.sh ${args} -k "${SDK}"
  209. buildxcodeproj MobileVLCKit "Aggregate static plugins"
  210. buildxcodeproj MobileVLCKit "MobileVLCKit"
  211. spopd
  212. spushd MediaLibraryKit
  213. rm -f External/MobileVLCKit
  214. ln -sf ${framework_build} External/MobileVLCKit
  215. buildxcodeproj MediaLibraryKit
  216. spopd
  217. spushd GDrive
  218. buildxcodeproj GTL "GTLTouchStaticLib"
  219. spopd
  220. spopd # ImportedSources
  221. #install pods
  222. info "installing pods"
  223. pod install
  224. # Build the Aspen Project now
  225. buildxcodeproj "VLC for iOS" "vlc-ios"
  226. info "Build completed"