12 usage: $0 [-s] [-k sdk]
15 -k <sdk version> Specify which sdk to use ('xcodebuild -showsdks', current: ${SDK_VERSION})
16 -s Build for simulator
17 -a <arch> Specify which arch to use (current: ${ARCH})
23 pushd "$1" 2>&1> /dev/null
33 local blue="\033[1;34m"
34 local normal="\033[0m"
35 echo "[${blue}info${normal}] $1"
38 while getopts "hvsk:a:" OPTION
63 shift $(($OPTIND - 1))
65 if [ "x$1" != "x" ]; then
71 if [ "$VERBOSE" = "yes" ]; then
75 if [ "$ARCH" = "armv7" ]; then
81 info "Building libvlc for iOS"
83 if [ "$PLATFORM" = "Simulator" ]; then
84 TARGET="i686-apple-darwin11"
88 TARGET="arm-apple-darwin11"
92 info "Using ${ARCH} with SDK version ${SDK_VERSION}"
94 THIS_SCRIPT_PATH=`pwd`/$0
96 spushd `dirname ${THIS_SCRIPT_PATH}`/../../..
97 VLCROOT=`pwd` # Let's make sure VLCROOT is an absolute path
100 if test -z "$SDKROOT"
102 SDKROOT=`xcode-select -print-path`/Platforms/iPhone${PLATFORM}.platform/Developer/SDKs/iPhone${PLATFORM}${SDK_VERSION}.sdk
103 echo "SDKROOT not specified, assuming $SDKROOT"
106 if [ ! -d "${SDKROOT}" ]
108 echo "*** ${SDKROOT} does not exist, please install required SDK, or set SDKROOT manually. ***"
112 BUILDDIR="${VLCROOT}/build-ios-${PLATFORM}/${ARCH}"
114 PREFIX="${VLCROOT}/install-ios-${PLATFORM}/${ARCH}"
116 export PATH="${VLCROOT}/extras/tools/build/bin:${VLCROOT}/contrib/${TARGET}/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"
118 # contains gas-processor.pl
119 export PATH=$PATH:${VLCROOT}/extras/package/ios/resources
121 info "Building tools"
122 spushd "${VLCROOT}/extras/tools"
127 info "Building contrib for iOS in '${VLCROOT}/contrib/iPhone${PLATFORM}-${ARCH}'"
129 # The contrib will read the following
132 export RANLIB="xcrun ranlib"
133 export CC="xcrun clang"
134 export OBJC="xcrun clang"
135 export CXX="xcrun clang++"
137 export STRIP="xcrun strip"
139 export PLATFORM=$PLATFORM
140 export SDK_VERSION=$SDK_VERSION
142 CFLAGS="-isysroot ${SDKROOT} -arch ${ARCH} -miphoneos-version-min=${SDK_MIN} ${OPTIM}"
143 if [ "$ARCH" = "armv7" -o "$ARCH" = "armv7s" ]; then
144 CFLAGS+=" -mcpu=cortex-a8"
147 export CPPFLAGS="${CFLAGS}"
148 export CXXFLAGS="${CFLAGS}"
149 export OBJCFLAGS="${CFLAGS}"
151 export CPP="xcrun cc -E"
152 export CXXCPP="xcrun c++ -E"
154 export BUILDFORIOS="yes"
156 if [ "$PLATFORM" = "Simulator" ]; then
157 # Use the new ABI on simulator, else we can't build
158 export OBJCFLAGS="-fobjc-abi-version=2 -fobjc-legacy-dispatch ${OBJCFLAGS}"
161 export LDFLAGS="-L${SDKROOT}/usr/lib -arch ${ARCH} -isysroot ${SDKROOT} -miphoneos-version-min=${SDK_MIN}"
163 if [ "$PLATFORM" = "OS" ]; then
164 EXTRA_CFLAGS="-arch ${ARCH} ${CFLAGS}"
165 EXTRA_LDFLAGS="-arch ${ARCH} ${LDFLAGS}"
167 EXTRA_CFLAGS="-arch ${ARCH}"
168 EXTRA_LDFLAGS="-arch ${ARCH}"
171 EXTRA_CFLAGS+=" -miphoneos-version-min=${SDK_MIN}"
172 EXTRA_LDFLAGS+=" -miphoneos-version-min=${SDK_MIN}"
174 info "LD FLAGS SELECTED = '${LDFLAGS}'"
176 spushd ${VLCROOT}/contrib
179 mkdir -p "${VLCROOT}/contrib/iPhone${PLATFORM}-${ARCH}"
180 cd "${VLCROOT}/contrib/iPhone${PLATFORM}-${ARCH}"
182 if [ "$PLATFORM" = "OS" ]; then
183 export AS="gas-preprocessor.pl ${CC}"
184 export ASCPP="gas-preprocessor.pl ${CC}"
185 export CCAS="gas-preprocessor.pl ${CC}"
188 export ASCPP="xcrun as"
191 ../bootstrap --host=${TARGET} --build="i686-apple-darwin10" --prefix=${VLCROOT}/contrib/${TARGET}-${ARCH} --disable-gpl \
192 --disable-disc --disable-sout \
194 --disable-SDL_image \
206 --disable-samplerate \
208 --disable-vncserver \
211 --disable-schroedinger \
213 --disable-chromaprint \
219 --disable-fontconfig \
220 --disable-gpg-error \
222 --enable-taglib > ${out}
224 echo "EXTRA_CFLAGS += ${EXTRA_CFLAGS}" >> config.mak
225 echo "EXTRA_LDFLAGS += ${EXTRA_LDFLAGS}" >> config.mak
230 info "Bootstraping vlc"
232 info "VLCROOT = ${VLCROOT}"
233 if ! [ -e ${VLCROOT}/configure ]; then
234 ${VLCROOT}/bootstrap > ${out}
237 info "Bootstraping vlc finished"
239 if [ ".$PLATFORM" != ".Simulator" ]; then
240 # FIXME - Do we still need this?
241 export AVCODEC_CFLAGS="-I${PREFIX}/include "
242 export AVCODEC_LIBS="-L${PREFIX}/lib -lavcodec -lavutil -lz"
243 export AVFORMAT_CFLAGS="-I${PREFIX}/include"
244 export AVFORMAT_LIBS="-L${PREFIX}/lib -lavcodec -lz -lavutil -lavformat"
250 info ">> --prefix=${PREFIX} --host=${TARGET}"
252 # Run configure only upon changes.
253 if [ "${VLCROOT}/configure" -nt config.log -o \
254 "${THIS_SCRIPT_PATH}" -nt config.log ]; then
255 ${VLCROOT}/configure \
256 --prefix="${PREFIX}" \
258 --with-contrib="${VLCROOT}/contrib/${TARGET}-${ARCH}" \
262 --disable-macosx-vout \
263 --disable-macosx-dialog-provider \
264 --disable-macosx-qtkit \
265 --disable-macosx-eyetv \
266 --disable-macosx-vlc-app \
267 --disable-macosx-avfoundation \
268 --enable-audioqueue \
273 --enable-macosx-quartztext \
282 --disable-macosx-audio \
283 --disable-qt --disable-skins2 \
309 --disable-fluidsynth \
321 --disable-mad > ${out} # MMX and SSE support requires llvm which is broken on Simulator
324 CORE_COUNT=`sysctl -n machdep.cpu.core_count`
325 let MAKE_JOBS=$CORE_COUNT+1
327 info "Building libvlc"
328 make -j$MAKE_JOBS > ${out}
330 info "Installing libvlc"
331 make install > ${out}
333 find ${PREFIX}/lib/vlc/plugins -name *.a -type f -exec cp '{}' ${PREFIX}/lib/vlc/plugins \;
334 rm -rf "${PREFIX}/contribs"
335 cp -R "${VLCROOT}/contrib/${TARGET}-${ARCH}" "${PREFIX}/contribs"
337 info "Removing unneeded modules"
395 headphone_channel_mixer
405 for i in ${blacklist}
407 find ${PREFIX}/lib/vlc/plugins -name *$i* -type f -exec rm '{}' \;