compileVLCforiOS.sh 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. #!/bin/sh
  2. # Copyright (C) Pierre d'Herbemont, 2010
  3. # Copyright (C) Felix Paul Kühne, 2012-2014
  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. TESTEDVLCKITHASH=d4704711ee5
  13. TESTEDMEDIALIBRARYKITHASH=2ded200f7
  14. usage()
  15. {
  16. cat << EOF
  17. usage: $0 [-s] [-v] [-k sdk] [-d] [-n] [-l] [-u]
  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 architectures=""
  49. if [ "$PLATFORM" = "iphonesimulator" ]; then
  50. architectures="i386 x86_64"
  51. else
  52. architectures="armv7 armv7s arm64"
  53. fi
  54. xcodebuild -project "$1.xcodeproj" \
  55. -target "$target" \
  56. -sdk $PLATFORM$SDK \
  57. -configuration ${CONFIGURATION} \
  58. ARCHS="${architectures}" \
  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 architectures=""
  69. if [ "$PLATFORM" = "iphonesimulator" ]; then
  70. architectures="i386 x86_64"
  71. else
  72. architectures="armv7 armv7s arm64"
  73. fi
  74. xcodebuild -workspace "$1.xcworkspace" \
  75. -scheme "Pods-vlc-ios" \
  76. -sdk $PLATFORM$SDK \
  77. -configuration ${CONFIGURATION} \
  78. ARCHS="${architectures}" \
  79. IPHONEOS_DEPLOYMENT_TARGET=${SDK_MIN} > ${out}
  80. }
  81. while getopts "hvsdnluk:" OPTION
  82. do
  83. case $OPTION in
  84. h)
  85. usage
  86. exit 1
  87. ;;
  88. v)
  89. VERBOSE=yes
  90. ;;
  91. s)
  92. PLATFORM=iphonesimulator
  93. ;;
  94. d) CONFIGURATION="Debug"
  95. ;;
  96. n)
  97. NONETWORK=yes
  98. ;;
  99. l)
  100. SKIPLIBVLCCOMPILATION=yes
  101. ;;
  102. k)
  103. SDK=$OPTARG
  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 ! [ -e VLCKit ]; then
  142. git clone git://git.videolan.org/vlc-bindings/VLCKit.git
  143. cd VLCKit
  144. git reset --hard ${TESTEDVLCKITHASH}
  145. cd ..
  146. else
  147. cd VLCKit
  148. git reset --hard ${TESTEDVLCKITHASH}
  149. cd ..
  150. fi
  151. if ! [ -e GDrive ]; then
  152. svn checkout http://google-api-objectivec-client.googlecode.com/svn/trunk/Source GDrive
  153. cd GDrive && patch -p0 < ../../patches/gdrive/upgrade-default-target.patch && cd ..
  154. else
  155. cd GDrive && svn up && cd ..
  156. fi
  157. if ! [ -e LXReorderableCollectionViewFlowLayout ]; then
  158. git clone git://github.com/fkuehne/LXReorderableCollectionViewFlowLayout.git
  159. else
  160. cd LXReorderableCollectionViewFlowLayout && git pull --rebase && 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/fkuehne/CocoaHTTPServer.git
  169. else
  170. cd CocoaHTTPServer && git pull --rebase && cd ..
  171. fi
  172. if ! [ -e Dropbox ]; then
  173. DROPBOXSDKVERSION=1.3.13
  174. curl -O https://www.dropbox.com/static/developers/dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  175. unzip -q dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  176. mv dropbox-ios-sdk-${DROPBOXSDKVERSION} Dropbox
  177. rm dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  178. rm -rf __MACOSX
  179. fi
  180. fi
  181. info "Setup 'External' folders"
  182. if [ "$PLATFORM" = "iphonesimulator" ]; then
  183. xcbuilddir="build/${CONFIGURATION}-iphonesimulator"
  184. else
  185. xcbuilddir="build/${CONFIGURATION}-iphoneos"
  186. fi
  187. framework_build="${aspen_root_dir}/ImportedSources/VLCKit/${xcbuilddir}"
  188. mlkit_build="${aspen_root_dir}/ImportedSources/MediaLibraryKit/${xcbuilddir}"
  189. gtl_build="${aspen_root_dir}/ImportedSources/GDrive/${xcbuilddir}"
  190. spopd #ImportedSources
  191. ln -sf ${framework_build} External/MobileVLCKit
  192. ln -sf ${mlkit_build} External/MediaLibraryKit
  193. ln -sf ${gtl_build} External/gtl
  194. #
  195. # Build time
  196. #
  197. info "Building"
  198. spushd ImportedSources
  199. spushd VLCKit
  200. echo `pwd`
  201. args=""
  202. if [ "$VERBOSE" = "yes" ]; then
  203. args="${args} -v"
  204. fi
  205. if [ "$PLATFORM" = "iphonesimulator" ]; then
  206. args="${args} -s"
  207. fi
  208. if [ "$NONETWORK" = "yes" ]; then
  209. args="${args} -n"
  210. fi
  211. if [ "$SKIPLIBVLCCOMPILATION" = "yes" ]; then
  212. args="${args} -l"
  213. fi
  214. ./buildMobileVLCKit.sh ${args} -k "${SDK}"
  215. buildxcodeproj MobileVLCKit "Aggregate static plugins"
  216. buildxcodeproj MobileVLCKit "MobileVLCKit"
  217. spopd
  218. spushd MediaLibraryKit
  219. rm -f External/MobileVLCKit
  220. ln -sf ${framework_build} External/MobileVLCKit
  221. buildxcodeproj MediaLibraryKit
  222. spopd
  223. spushd GDrive
  224. buildxcodeproj GTL "GTLTouchStaticLib"
  225. spopd
  226. spopd # ImportedSources
  227. #install pods
  228. info "installing pods"
  229. pod install
  230. # Build the Aspen Project now
  231. buildxcworkspace "VLC for iOS" "VLC for iOS"
  232. info "Build completed"