compileVLCforiOS.sh 5.8 KB

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