compileVLCforiOS.sh 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  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=7.0
  8. VERBOSE=no
  9. CONFIGURATION="Release"
  10. NONETWORK=no
  11. SKIPLIBVLCCOMPILATION=no
  12. TESTEDVLCKITHASH=6c6d6863
  13. TESTEDMEDIALIBRARYKITHASH=e5ca039f
  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. spushd ImportedSources
  127. if [ "$NONETWORK" != "yes" ]; then
  128. if ! [ -e MediaLibraryKit ]; then
  129. git clone http://code.videolan.org/videolan/MediaLibraryKit.git
  130. cd MediaLibraryKit
  131. git checkout -B localAspenBranch ${TESTEDMEDIALIBRARYKITHASH}
  132. git branch --set-upstream-to=origin/master localAspenBranch
  133. cd ..
  134. else
  135. cd MediaLibraryKit
  136. git pull --rebase
  137. git reset --hard ${TESTEDMEDIALIBRARYKITHASH}
  138. cd ..
  139. fi
  140. if ! [ -e VLCKit ]; then
  141. git clone http://code.videolan.org/videolan/VLCKit.git
  142. cd VLCKit
  143. git reset --hard ${TESTEDVLCKITHASH}
  144. cd ..
  145. else
  146. cd VLCKit
  147. git pull --rebase
  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. cd GDrive/HTTPFetcher && patch -p0 < ../../../patches/gdrive/httpfetcher-compilation-fix.diff && cd ../..
  155. else
  156. cd GDrive && svn up && cd ..
  157. fi
  158. if ! [ -e LXReorderableCollectionViewFlowLayout ]; then
  159. git clone git://github.com/fkuehne/LXReorderableCollectionViewFlowLayout.git
  160. else
  161. cd LXReorderableCollectionViewFlowLayout && git pull --rebase && 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/fkuehne/CocoaHTTPServer.git
  170. else
  171. cd CocoaHTTPServer && git pull --rebase && cd ..
  172. fi
  173. if ! [ -e Dropbox ]; then
  174. DROPBOXSDKVERSION=1.3.13
  175. curl -L -O https://www.dropbox.com/static/developers/dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  176. unzip -q dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  177. mv dropbox-ios-sdk-${DROPBOXSDKVERSION} Dropbox
  178. rm dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
  179. rm -rf __MACOSX
  180. fi
  181. if ! [ -e OneDrive ]; then
  182. git clone git://github.com/liveservices/LiveSDK-for-iOS.git OneDrive
  183. cd OneDrive && git am ../../patches/onedrive/0001-Compile-ARMv7s-slice.patch && cd ..
  184. else
  185. cd OneDrive && git pull --rebase && cd ..
  186. fi
  187. fi
  188. spopd #ImportedSources
  189. #
  190. # Build time
  191. #
  192. info "Building"
  193. spushd ImportedSources
  194. spushd VLCKit
  195. echo `pwd`
  196. args=""
  197. if [ "$VERBOSE" = "yes" ]; then
  198. args="${args} -v"
  199. fi
  200. if [ "$PLATFORM" = "iphonesimulator" ]; then
  201. args="${args} -s"
  202. fi
  203. if [ "$NONETWORK" = "yes" ]; then
  204. args="${args} -n"
  205. fi
  206. if [ "$SKIPLIBVLCCOMPILATION" = "yes" ]; then
  207. args="${args} -l"
  208. fi
  209. ./buildMobileVLCKit.sh ${args} -k "${SDK}"
  210. spopd
  211. spopd # ImportedSources
  212. #install pods
  213. info "installing pods"
  214. pod install
  215. # Build the Aspen Project now
  216. buildxcworkspace "VLC for iOS" "VLC for iOS"
  217. info "Build completed"