compileVLCforiOS.sh 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  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=eb9b82880
  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. UPNPXVERSION=1.2.4
  153. curl -O http://upnpx.googlecode.com/files/upnpx-${UPNPXVERSION}.tar.gz
  154. tar xf upnpx-${UPNPXVERSION}.tar.gz
  155. mv upnpx-${UPNPXVERSION} upnpx
  156. cd upnpx
  157. for file in ../../patches/upnpx/*; do
  158. patch -p1 < ../../patches/upnpx/"$file"
  159. done
  160. cd ..
  161. fi
  162. if ! [ -e WhiteRaccoon ]; then
  163. git clone git://github.com/fkuehne/WhiteRaccoon.git
  164. else
  165. cd WhiteRaccoon && git pull --rebase && cd ..
  166. fi
  167. if ! [ -e CocoaHTTPServer ]; then
  168. git clone git://github.com/robbiehanson/CocoaHTTPServer.git
  169. cd CocoaHTTPServer
  170. git am ../../patches/cocoahttpserver/*.patch
  171. if [ $? -ne 0 ]; then
  172. git am --abort
  173. info "Applying the patches failed, aborting git-am"
  174. exit 1
  175. fi
  176. cd ..
  177. else
  178. cd CocoaHTTPServer && git pull --rebase && cd ..
  179. fi
  180. if ! [ -e Dropbox ]; then
  181. DROPBOXSDKVERSION=1.3.9
  182. curl -O https://www.dropbox.com/static/developers/dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  183. unzip -q dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  184. mv dropbox-ios-sdk-${DROPBOXSDKVERSION} Dropbox
  185. rm dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  186. rm -rf __MACOSX
  187. fi
  188. if ! [ -e InAppSettingsKit ]; then
  189. git clone git://github.com/futuretap/InAppSettingsKit.git
  190. cd InAppSettingsKit
  191. git am ../../patches/inappsettingskit/*.patch
  192. if [ $? -ne 0 ]; then
  193. git am --abort
  194. info "Applying the patches failed, aborting git-am"
  195. exit 1
  196. fi
  197. cd ..
  198. else
  199. cd InAppSettingsKit && git pull --rebase && cd ..
  200. fi
  201. fi
  202. info "Setup 'External' folders"
  203. if [ "$PLATFORM" = "iphonesimulator" ]; then
  204. xcbuilddir="build/${CONFIGURATION}-iphonesimulator"
  205. else
  206. xcbuilddir="build/${CONFIGURATION}-iphoneos"
  207. fi
  208. framework_build="${aspen_root_dir}/ImportedSources/VLCKit/${xcbuilddir}"
  209. mlkit_build="${aspen_root_dir}/ImportedSources/MediaLibraryKit/${xcbuilddir}"
  210. upnpx_build="${aspen_root_dir}/ImportedSources/upnpx/projects/xcode4/upnpx/${xcbuilddir}"
  211. gtl_build="${aspen_root_dir}/ImportedSources/GDrive/${xcbuilddir}"
  212. spushd MediaLibraryKit
  213. rm -f External/MobileVLCKit
  214. ln -sf ${framework_build} External/MobileVLCKit
  215. spopd
  216. spopd #ImportedSources
  217. ln -sf ${framework_build} External/MobileVLCKit
  218. ln -sf ${mlkit_build} External/MediaLibraryKit
  219. ln -sf ${upnpx_build} External/upnpx
  220. ln -sf ${gtl_build} External/gtl
  221. #
  222. # Build time
  223. #
  224. info "Building"
  225. spushd ImportedSources
  226. spushd VLCKit
  227. echo `pwd`
  228. args=""
  229. if [ "$VERBOSE" = "yes" ]; then
  230. args="${args} -v"
  231. fi
  232. if [ "$PLATFORM" = "iphonesimulator" ]; then
  233. args="${args} -s"
  234. fi
  235. if [ "$NONETWORK" = "yes" ]; then
  236. args="${args} -n"
  237. fi
  238. if [ "$SKIPLIBVLCCOMPILATION" = "yes" ]; then
  239. args="${args} -l"
  240. fi
  241. ./buildMobileVLCKit.sh ${args} -k "${SDK}"
  242. buildxcodeproj MobileVLCKit "Aggregate static plugins"
  243. buildxcodeproj MobileVLCKit "MobileVLCKit"
  244. spopd
  245. spushd MediaLibraryKit
  246. buildxcodeproj MediaLibraryKit
  247. spopd
  248. spushd upnpx/projects/xcode4/upnpx
  249. buildxcodeproj upnpx
  250. spopd
  251. spushd GDrive
  252. buildxcodeproj GTL "GTLTouchStaticLib"
  253. spopd
  254. spopd # ImportedSources
  255. # Build the Aspen Project now
  256. buildxcodeproj "VLC for iOS" "vlc-ios"
  257. info "Build completed"