buildMobileVLCKit.sh 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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=2791a97f2
  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 am ../../patches/*.patch
  110. if [ $? -ne 0 ]; then
  111. git am --abort
  112. info "Applying the patches failed, aborting git-am"
  113. exit 1
  114. fi
  115. cd ..
  116. else
  117. cd vlc
  118. git pull --rebase
  119. cd ..
  120. fi
  121. fi
  122. spopd
  123. #
  124. # Build time
  125. #
  126. info "Building"
  127. spushd MobileVLCKit/ImportedSources
  128. if [ "$SKIPLIBVLCCOMPILATION" != "yes" ]; then
  129. spushd vlc/extras/package/ios
  130. info "Building vlc"
  131. args=""
  132. if [ "$VERBOSE" = "yes" ]; then
  133. args="${args} -v"
  134. fi
  135. if [ "$PLATFORM" = "iphonesimulator" ]; then
  136. args="${args} -s"
  137. ./build.sh ${args} -k "${SDK}"
  138. else
  139. ./build.sh -a armv7 ${args} -k "${SDK}" && ./build.sh -a armv7s ${args} -k "${SDK}"
  140. fi
  141. spopd
  142. fi
  143. spopd # MobileVLCKit/ImportedSources
  144. buildxcodeproj MobileVLCKit "Aggregate static plugins"
  145. buildxcodeproj MobileVLCKit "MobileVLCKit"
  146. info "Build completed"