7 SDK_VERSION=`xcrun --sdk iphoneos --show-sdk-version`
9 SIXTYFOURBIT_SDK_MIN=7.0
16 usage: $0 [-s] [-d] [-v] [-k sdk]
19 -k <sdk version> Specify which sdk to use ('xcodebuild -showsdks', current: ${SDK_VERSION})
20 -s Build for simulator
21 -a <arch> Specify which arch to use (current: ${ARCH})
23 -v Enable verbose command-line output
24 -w Build a limited stack of non-scary libraries only
30 pushd "$1" 2>&1> /dev/null
40 local blue="\033[1;34m"
41 local normal="\033[0m"
42 echo "[${blue}info${normal}] $1"
45 while getopts "hvwdsk:a:" OPTION
76 shift $(($OPTIND - 1))
78 if [ "x$1" != "x" ]; then
84 if [ "$VERBOSE" = "yes" ]; then
88 info "Building libvlc for iOS"
90 TARGET="${ARCH}-apple-darwin11"
92 # apple doesn't call AArch64 that way, but arm64 (a contrario to all libraries)
93 # so we need to translate it..
94 if [ "$ARCH" = "aarch64" ]; then
100 if [ "$DEBUG" = "yes" ]; then
106 info "Using ${ARCH} with SDK version ${SDK_VERSION}"
108 THIS_SCRIPT_PATH=`pwd`/$0
110 spushd `dirname ${THIS_SCRIPT_PATH}`/../../..
111 VLCROOT=`pwd` # Let's make sure VLCROOT is an absolute path
114 if test -z "$SDKROOT"
116 SDKROOT=`xcode-select -print-path`/Platforms/iPhone${PLATFORM}.platform/Developer/SDKs/iPhone${PLATFORM}${SDK_VERSION}.sdk
117 echo "SDKROOT not specified, assuming $SDKROOT"
120 if [ ! -d "${SDKROOT}" ]
122 echo "*** ${SDKROOT} does not exist, please install required SDK, or set SDKROOT manually. ***"
126 BUILDDIR="${VLCROOT}/build-ios-${PLATFORM}/${ACTUAL_ARCH}"
128 PREFIX="${VLCROOT}/install-ios-${PLATFORM}/${ACTUAL_ARCH}"
130 export PATH="${VLCROOT}/extras/tools/build/bin:${VLCROOT}/contrib/${TARGET}/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"
132 info "Building tools"
133 spushd "${VLCROOT}/extras/tools"
138 info "Building contrib for iOS in '${VLCROOT}/contrib/iPhone${PLATFORM}-${ARCH}'"
140 # The contrib will read the following
143 export RANLIB="xcrun ranlib"
144 export CC="xcrun clang"
145 export OBJC="xcrun clang"
146 export CXX="xcrun clang++"
148 export STRIP="xcrun strip"
150 export PLATFORM=$PLATFORM
151 export SDK_VERSION=$SDK_VERSION
153 export CFLAGS="-isysroot ${SDKROOT} -arch ${ACTUAL_ARCH} ${OPTIM}"
155 if [ "$PLATFORM" = "OS" ]; then
156 if [ "$ARCH" != "aarch64" ]; then
157 export CFLAGS="${CFLAGS} -mcpu=cortex-a8 -miphoneos-version-min=${SDK_MIN}"
159 export CFLAGS="${CFLAGS} -miphoneos-version-min=${SIXTYFOURBIT_SDK_MIN}"
162 export CFLAGS="${CFLAGS} -miphoneos-version-min=${SIXTYFOURBIT_SDK_MIN}"
165 export CXXFLAGS="${CFLAGS} -stdlib=libstdc++"
167 export CPPFLAGS="${CFLAGS}"
169 export CPP="xcrun cc -E"
170 export CXXCPP="xcrun c++ -E"
172 export BUILDFORIOS="yes"
174 if [ "$PLATFORM" = "Simulator" ]; then
175 # Use the new ABI on simulator, else we can't build
176 export OBJCFLAGS="-fobjc-abi-version=2 -fobjc-legacy-dispatch ${OBJCFLAGS}"
179 export LDFLAGS="-L${SDKROOT}/usr/lib -arch ${ACTUAL_ARCH} -isysroot ${SDKROOT}"
181 if [ "$PLATFORM" = "OS" ]; then
182 EXTRA_CFLAGS="-arch ${ACTUAL_ARCH}"
183 EXTRA_LDFLAGS="-arch ${ACTUAL_ARCH}"
184 if [ "$ARCH" != "aarch64" ]; then
185 EXTRA_CFLAGS+=" -mcpu=cortex-a8"
186 EXTRA_CFLAGS+=" -miphoneos-version-min=${SDK_MIN}"
187 EXTRA_LDFLAGS+=" -Wl,-ios_version_min,${SDK_MIN}"
188 export LDFLAGS="${LDFLAGS} -Wl,-ios_version_min,${SDK_MIN}"
190 EXTRA_CFLAGS+=" -miphoneos-version-min=${SIXTYFOURBIT_SDK_MIN}"
191 EXTRA_LDFLAGS+=" -Wl,-ios_version_min,${SIXTYFOURBIT_SDK_MIN}"
192 export LDFLAGS="${LDFLAGS} -Wl,-ios_version_min,${SIXTYFOURBIT_SDK_MIN}"
195 EXTRA_CFLAGS="-arch ${ARCH}"
196 EXTRA_CFLAGS+=" -miphoneos-version-min=${SIXTYFOURBIT_SDK_MIN}"
197 EXTRA_LDFLAGS=" -Wl,-ios_version_min,${SIXTYFOURBIT_SDK_MIN}"
198 export LDFLAGS="${LDFLAGS} -Wl-ios_version_min,${SIXTYFOURBIT_SDK_MIN}"
202 info "LD FLAGS SELECTED = '${LDFLAGS}'"
204 spushd ${VLCROOT}/contrib
207 mkdir -p "${VLCROOT}/contrib/iPhone${PLATFORM}-${ARCH}"
208 cd "${VLCROOT}/contrib/iPhone${PLATFORM}-${ARCH}"
210 if [ "$PLATFORM" = "OS" ]; then
211 export AS="gas-preprocessor.pl ${CC}"
212 export ASCPP="gas-preprocessor.pl ${CC}"
213 export CCAS="gas-preprocessor.pl ${CC}"
214 if [ "$ARCH" = "aarch64" ]; then
215 export GASPP_FIX_XCODE5=1
218 export ASCPP="xcrun as"
221 ../bootstrap --build=x86_64-apple-darwin11 --host=${TARGET} --prefix=${VLCROOT}/contrib/${TARGET}-${ARCH} --disable-gpl \
222 --disable-disc --disable-sout \
224 --disable-SDL_image \
236 --disable-samplerate \
238 --disable-vncserver \
240 --disable-schroedinger \
242 --disable-chromaprint \
248 --disable-fontconfig \
249 --disable-gpg-error \
255 --enable-taglib > ${out}
257 echo "EXTRA_CFLAGS += ${EXTRA_CFLAGS}" >> config.mak
258 echo "EXTRA_LDFLAGS += ${EXTRA_LDFLAGS}" >> config.mak
263 info "Bootstraping vlc"
265 info "VLCROOT = ${VLCROOT}"
266 if ! [ -e ${VLCROOT}/configure ]; then
267 ${VLCROOT}/bootstrap > ${out}
270 info "Bootstraping vlc finished"
272 if [ ".$PLATFORM" != ".Simulator" ]; then
273 # FIXME - Do we still need this?
274 export AVCODEC_CFLAGS="-I${PREFIX}/include "
275 export AVCODEC_LIBS="-L${PREFIX}/lib -lavcodec -lavutil -lz"
276 export AVFORMAT_CFLAGS="-I${PREFIX}/include"
277 export AVFORMAT_LIBS="-L${PREFIX}/lib -lavcodec -lz -lavutil -lavformat"
283 info ">> --prefix=${PREFIX} --host=${TARGET}"
285 if [ "$DEBUG" = "yes" ]; then
286 DEBUGFLAG="--enable-debug"
288 DEBUGFLAG="--disable-debug"
291 if [ "$SCARY" = "yes" ]; then
292 SCARYFLAG="--enable-dvbpsi --enable-avcodec"
294 SCARYFLAG="--disable-dca --disable-dvbpsi --disable-avcodec --disable-avformat --disable-zvbi --enable-vpx"
297 # Run configure only upon changes.
298 if [ "${VLCROOT}/configure" -nt config.log -o \
299 "${THIS_SCRIPT_PATH}" -nt config.log ]; then
300 ${VLCROOT}/configure \
301 --prefix="${PREFIX}" \
303 --with-contrib="${VLCROOT}/contrib/${TARGET}-${ARCH}" \
308 --disable-macosx-dialog-provider \
309 --disable-macosx-qtkit \
310 --disable-macosx-eyetv \
311 --disable-macosx-vlc-app \
312 --disable-macosx-avfoundation \
313 --disable-audioqueue \
315 --enable-macosx-quartztext \
323 --disable-qt --disable-skins2 \
348 --disable-fluidsynth \
360 --disable-addonmanagermodules \
361 --disable-mad > ${out} # MMX and SSE support requires llvm which is broken on Simulator
364 CORE_COUNT=`sysctl -n machdep.cpu.core_count`
365 let MAKE_JOBS=$CORE_COUNT+1
367 info "Building libvlc"
368 make -j$MAKE_JOBS > ${out}
370 info "Installing libvlc"
371 make install > ${out}
373 find ${PREFIX}/lib/vlc/plugins -name *.a -type f -exec cp '{}' ${PREFIX}/lib/vlc/plugins \;
374 rm -rf "${PREFIX}/contribs"
375 cp -R "${VLCROOT}/contrib/${TARGET}-${ARCH}" "${PREFIX}/contribs"
377 info "Removing unneeded modules"
435 headphone_channel_mixer
449 if [ "$SCARY" = "no" ]; then
450 blacklist="${blacklist}
474 for i in ${blacklist}
476 find ${PREFIX}/lib/vlc/plugins -name *$i* -type f -exec rm '{}' \;