compileVLCforiOS.sh 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  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=7.0
  7. SDK_MIN=6.1
  8. VERBOSE=no
  9. CONFIGURATION="Release"
  10. NONETWORK=no
  11. SKIPLIBVLCCOMPILATION=no
  12. TESTEDVLCKITHASH=31f90ceb2
  13. TESTEDMEDIALIBRARYKITHASH=973a5eb38
  14. usage()
  15. {
  16. cat << EOF
  17. usage: $0 [-s] [-v] [-k sdk]
  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. while getopts "hvsdnlk:" OPTION
  59. do
  60. case $OPTION in
  61. h)
  62. usage
  63. exit 1
  64. ;;
  65. v)
  66. VERBOSE=yes
  67. ;;
  68. s)
  69. PLATFORM=iphonesimulator
  70. ;;
  71. d) CONFIGURATION="Debug"
  72. ;;
  73. n)
  74. NONETWORK=yes
  75. ;;
  76. l)
  77. SKIPLIBVLCCOMPILATION=yes
  78. ;;
  79. k)
  80. SDK=$OPTARG
  81. ;;
  82. ?)
  83. usage
  84. exit 1
  85. ;;
  86. esac
  87. done
  88. shift $(($OPTIND - 1))
  89. out="/dev/null"
  90. if [ "$VERBOSE" = "yes" ]; then
  91. out="/dev/stdout"
  92. fi
  93. if [ "x$1" != "x" ]; then
  94. usage
  95. exit 1
  96. fi
  97. # Get root dir
  98. spushd .
  99. aspen_root_dir=`pwd`
  100. spopd
  101. info "Preparing build dirs"
  102. mkdir -p ImportedSources
  103. rm -rf External
  104. mkdir -p External
  105. spushd ImportedSources
  106. if [ "$NONETWORK" != "yes" ]; then
  107. if ! [ -e MediaLibraryKit ]; then
  108. git clone git://git.videolan.org/MediaLibraryKit.git
  109. cd MediaLibraryKit
  110. git checkout -B localAspenBranch ${TESTEDMEDIALIBRARYKITHASH}
  111. git branch --set-upstream-to=origin/master localAspenBranch
  112. cd ..
  113. else
  114. cd MediaLibraryKit
  115. git pull --rebase
  116. git reset --hard ${TESTEDMEDIALIBRARYKITHASH}
  117. cd ..
  118. fi
  119. if ! [ -e VLCKit ]; then
  120. git clone git://git.videolan.org/vlc-bindings/VLCKit.git
  121. cd VLCKit
  122. git checkout -B localAspenBranch ${TESTEDVLCKITHASH}
  123. git branch --set-upstream-to=origin/master localAspenBranch
  124. cd ..
  125. else
  126. cd VLCKit
  127. git pull --rebase
  128. git reset --hard ${TESTEDVLCKITHASH}
  129. cd ..
  130. fi
  131. if ! [ -e OBSlider ]; then
  132. git clone git://github.com/ole/OBSlider.git
  133. else
  134. cd OBSlider && git pull --rebase && cd ..
  135. fi
  136. if ! [ -e DAVKit ]; then
  137. git clone git://github.com/mattrajca/DAVKit.git
  138. else
  139. cd DAVKit && git pull --rebase && cd ..
  140. fi
  141. if ! [ -e GDrive ]; then
  142. svn checkout http://google-api-objectivec-client.googlecode.com/svn/trunk/Source GDrive
  143. else
  144. cd GDrive && svn up && cd ..
  145. fi
  146. if ! [ -e GHSidebarNav ]; then
  147. git clone git://github.com/gresrun/GHSidebarNav.git
  148. else
  149. cd GHSidebarNav && git pull --rebase && cd ..
  150. fi
  151. if ! [ -e upnpx ]; then
  152. rm -f tar xf upnpx-*
  153. UPNPXVERSION=1.2.4
  154. curl -O http://upnpx.googlecode.com/files/upnpx-${UPNPXVERSION}.tar.gz
  155. tar xf upnpx-${UPNPXVERSION}.tar.gz
  156. mv upnpx-${UPNPXVERSION} upnpx
  157. cd upnpx
  158. for file in ../../patches/upnpx/*; do
  159. patch -p1 < ../../patches/upnpx/"$file"
  160. done
  161. cd ..
  162. fi
  163. if ! [ -e WhiteRaccoon ]; then
  164. git clone git://github.com/fkuehne/WhiteRaccoon.git
  165. else
  166. cd WhiteRaccoon && git pull --rebase && cd ..
  167. fi
  168. if ! [ -e CocoaHTTPServer ]; then
  169. git clone git://github.com/robbiehanson/CocoaHTTPServer.git
  170. cd CocoaHTTPServer
  171. git am ../../patches/cocoahttpserver/*.patch
  172. if [ $? -ne 0 ]; then
  173. git am --abort
  174. info "Applying the patches failed, aborting git-am"
  175. exit 1
  176. fi
  177. cd ..
  178. else
  179. cd CocoaHTTPServer && git pull --rebase && cd ..
  180. fi
  181. if ! [ -e Dropbox ]; then
  182. DROPBOXSDKVERSION=1.3.9
  183. curl -O https://www.dropbox.com/static/developers/dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  184. unzip -q dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  185. mv dropbox-ios-sdk-${DROPBOXSDKVERSION} Dropbox
  186. rm dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  187. rm -rf __MACOSX
  188. fi
  189. if ! [ -e InAppSettingsKit ]; then
  190. git clone git://github.com/futuretap/InAppSettingsKit.git
  191. cd InAppSettingsKit
  192. git am ../../patches/inappsettingskit/*.patch
  193. if [ $? -ne 0 ]; then
  194. git am --abort
  195. info "Applying the patches failed, aborting git-am"
  196. exit 1
  197. fi
  198. cd ..
  199. else
  200. cd InAppSettingsKit && git pull --rebase && cd ..
  201. fi
  202. fi
  203. info "Setup 'External' folders"
  204. if [ "$PLATFORM" = "iphonesimulator" ]; then
  205. xcbuilddir="build/${CONFIGURATION}-iphonesimulator"
  206. else
  207. xcbuilddir="build/${CONFIGURATION}-iphoneos"
  208. fi
  209. framework_build="${aspen_root_dir}/ImportedSources/VLCKit/${xcbuilddir}"
  210. mlkit_build="${aspen_root_dir}/ImportedSources/MediaLibraryKit/${xcbuilddir}"
  211. upnpx_build="${aspen_root_dir}/ImportedSources/upnpx/projects/xcode4/upnpx/${xcbuilddir}"
  212. gtl_build="${aspen_root_dir}/ImportedSources/GDrive/${xcbuilddir}"
  213. spushd MediaLibraryKit
  214. rm -f External/MobileVLCKit
  215. ln -sf ${framework_build} External/MobileVLCKit
  216. spopd
  217. spopd #ImportedSources
  218. ln -sf ${framework_build} External/MobileVLCKit
  219. ln -sf ${mlkit_build} External/MediaLibraryKit
  220. ln -sf ${upnpx_build} External/upnpx
  221. ln -sf ${gtl_build} External/gtl
  222. #
  223. # Build time
  224. #
  225. info "Building"
  226. spushd ImportedSources
  227. spushd VLCKit
  228. echo `pwd`
  229. args=""
  230. if [ "$VERBOSE" = "yes" ]; then
  231. args="${args} -v"
  232. fi
  233. if [ "$PLATFORM" = "iphonesimulator" ]; then
  234. args="${args} -s"
  235. fi
  236. if [ "$NONETWORK" = "yes" ]; then
  237. args="${args} -n"
  238. fi
  239. if [ "$SKIPLIBVLCCOMPILATION" = "yes" ]; then
  240. args="${args} -l"
  241. fi
  242. ./buildMobileVLCKit.sh ${args} -k "${SDK}"
  243. buildxcodeproj MobileVLCKit "Aggregate static plugins"
  244. buildxcodeproj MobileVLCKit "MobileVLCKit"
  245. spopd
  246. spushd MediaLibraryKit
  247. buildxcodeproj MediaLibraryKit
  248. spopd
  249. spushd upnpx/projects/xcode4/upnpx
  250. buildxcodeproj upnpx
  251. spopd
  252. spushd GDrive
  253. buildxcodeproj GTL "GTLTouchStaticLib"
  254. spopd
  255. spopd # ImportedSources
  256. # Build the Aspen Project now
  257. buildxcodeproj "VLC for iOS" "vlc-ios"
  258. info "Build completed"