buildMobileVLCKit.sh 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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. TESTEDHASH=a69fb3d49
  13. usage()
  14. {
  15. cat << EOF
  16. usage: $0 [-s] [-v] [-k sdk]
  17. OPTIONS
  18. -k Specify which sdk to use (see 'xcodebuild -showsdks', current: ${SDK})
  19. -v Be more verbose
  20. -s Build for simulator
  21. -d Enable Debug
  22. -n Skip script steps requiring network interaction
  23. -l Skip libvlc compilation
  24. EOF
  25. }
  26. spushd()
  27. {
  28. pushd "$1" 2>&1> /dev/null
  29. }
  30. spopd()
  31. {
  32. popd 2>&1> /dev/null
  33. }
  34. info()
  35. {
  36. local green="\033[1;32m"
  37. local normal="\033[0m"
  38. echo "[${green}info${normal}] $1"
  39. }
  40. buildxcodeproj()
  41. {
  42. local target="$2"
  43. if [ "x$target" = "x" ]; then
  44. target="$1"
  45. fi
  46. info "Building $1 ($target, ${CONFIGURATION})"
  47. local extra=""
  48. if [ "$PLATFORM" = "Simulator" ]; then
  49. extra="ARCHS=i386"
  50. fi
  51. xcodebuild -project "$1.xcodeproj" \
  52. -target "$target" \
  53. -sdk $PLATFORM$SDK \
  54. -configuration ${CONFIGURATION} ${extra} \
  55. IPHONEOS_DEPLOYMENT_TARGET=${SDK_MIN} > ${out}
  56. }
  57. while getopts "hvsdnlk:" OPTION
  58. do
  59. case $OPTION in
  60. h)
  61. usage
  62. exit 1
  63. ;;
  64. v)
  65. VERBOSE=yes
  66. ;;
  67. s)
  68. PLATFORM=iphonesimulator
  69. ;;
  70. d) CONFIGURATION="Debug"
  71. ;;
  72. n)
  73. NONETWORK=yes
  74. ;;
  75. l)
  76. SKIPLIBVLCCOMPILATION=yes
  77. ;;
  78. k)
  79. SDK=$OPTARG
  80. ;;
  81. ?)
  82. usage
  83. exit 1
  84. ;;
  85. esac
  86. done
  87. shift $(($OPTIND - 1))
  88. out="/dev/null"
  89. if [ "$VERBOSE" = "yes" ]; then
  90. out="/dev/stdout"
  91. fi
  92. if [ "x$1" != "x" ]; then
  93. usage
  94. exit 1
  95. fi
  96. # Get root dir
  97. spushd .
  98. aspen_root_dir=`pwd`
  99. spopd
  100. info "Preparing build dirs"
  101. mkdir -p MobileVLCKit/ImportedSources
  102. spushd MobileVLCKit/ImportedSources
  103. if [ "$NONETWORK" != "yes" ]; then
  104. if ! [ -e vlc ]; then
  105. git clone git://git.videolan.org/vlc/vlc-2.1.git vlc
  106. info "Applying patches to vlc.git"
  107. cd vlc
  108. git checkout -B localAspenBranch ${TESTEDHASH}
  109. git branch --set-upstream-to=origin/master localAspenBranch
  110. git am ../../patches/*.patch
  111. if [ $? -ne 0 ]; then
  112. git am --abort
  113. info "Applying the patches failed, aborting git-am"
  114. exit 1
  115. fi
  116. cd ..
  117. else
  118. cd vlc
  119. git pull --rebase
  120. git reset --hard ${TESTEDHASH}
  121. git am ../../patches/*.patch
  122. cd ..
  123. fi
  124. fi
  125. spopd
  126. #
  127. # Build time
  128. #
  129. info "Building"
  130. spushd MobileVLCKit/ImportedSources
  131. if [ "$SKIPLIBVLCCOMPILATION" != "yes" ]; then
  132. spushd vlc/extras/package/ios
  133. info "Building vlc"
  134. args=""
  135. if [ "$VERBOSE" = "yes" ]; then
  136. args="${args} -v"
  137. fi
  138. if [ "$PLATFORM" = "iphonesimulator" ]; then
  139. args="${args} -s"
  140. ./build.sh ${args} -k "${SDK}"
  141. else
  142. ./build.sh -a armv7 ${args} -k "${SDK}" && ./build.sh -a armv7s ${args} -k "${SDK}"
  143. fi
  144. spopd
  145. fi
  146. spopd # MobileVLCKit/ImportedSources
  147. buildxcodeproj MobileVLCKit "Aggregate static plugins"
  148. buildxcodeproj MobileVLCKit "MobileVLCKit"
  149. info "Build completed"