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 if [ "$PLATFORM" = "Simulator" ]; then
91 TARGET="${ARCH}-apple-darwin11"
93 TARGET="arm-apple-darwin11"
96 if [ "$DEBUG" = "yes" ]; then
102 info "Using ${ARCH} with SDK version ${SDK_VERSION}"
104 THIS_SCRIPT_PATH=`pwd`/$0
106 spushd `dirname ${THIS_SCRIPT_PATH}`/../../..
107 VLCROOT=`pwd` # Let's make sure VLCROOT is an absolute path
110 if test -z "$SDKROOT"
112 SDKROOT=`xcode-select -print-path`/Platforms/iPhone${PLATFORM}.platform/Developer/SDKs/iPhone${PLATFORM}${SDK_VERSION}.sdk
113 echo "SDKROOT not specified, assuming $SDKROOT"
116 if [ ! -d "${SDKROOT}" ]
118 echo "*** ${SDKROOT} does not exist, please install required SDK, or set SDKROOT manually. ***"
122 BUILDDIR="${VLCROOT}/build-ios-${PLATFORM}/${ARCH}"
124 PREFIX="${VLCROOT}/install-ios-${PLATFORM}/${ARCH}"
126 export PATH="${VLCROOT}/extras/tools/build/bin:${VLCROOT}/contrib/${TARGET}/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"
128 info "Building tools"
129 spushd "${VLCROOT}/extras/tools"
134 info "Building contrib for iOS in '${VLCROOT}/contrib/iPhone${PLATFORM}-${ARCH}'"
136 # The contrib will read the following
139 export RANLIB="xcrun ranlib"
140 export CC="xcrun clang"
141 export OBJC="xcrun clang"
142 export CXX="xcrun clang++"
144 export STRIP="xcrun strip"
146 export PLATFORM=$PLATFORM
147 export SDK_VERSION=$SDK_VERSION
149 export CFLAGS="-isysroot ${SDKROOT} -arch ${ARCH} ${OPTIM}"
151 if [ "$PLATFORM" = "OS" ]; then
152 if [ "$ARCH" != "arm64" ]; then
153 export CFLAGS="${CFLAGS} -mcpu=cortex-a8 -miphoneos-version-min=${SDK_MIN}"
155 export CFLAGS="${CFLAGS} -miphoneos-version-min=${SIXTYFOURBIT_SDK_MIN}"
158 export CFLAGS="${CFLAGS} -miphoneos-version-min=${SIXTYFOURBIT_SDK_MIN}"
161 export CXXFLAGS="${CFLAGS} -stdlib=libstdc++"
163 export CPPFLAGS="${CFLAGS}"
165 export CPP="xcrun cc -E"
166 export CXXCPP="xcrun c++ -E"
168 export BUILDFORIOS="yes"
170 if [ "$PLATFORM" = "Simulator" ]; then
171 # Use the new ABI on simulator, else we can't build
172 export OBJCFLAGS="-fobjc-abi-version=2 -fobjc-legacy-dispatch ${OBJCFLAGS}"
175 export LDFLAGS="-L${SDKROOT}/usr/lib -arch ${ARCH} -isysroot ${SDKROOT}"
177 if [ "$PLATFORM" = "OS" ]; then
178 EXTRA_CFLAGS="-arch ${ARCH}"
179 EXTRA_LDFLAGS="-arch ${ARCH}"
180 if [ "$ARCH" != "arm64" ]; then
181 EXTRA_CFLAGS+=" -mcpu=cortex-a8"
182 EXTRA_CFLAGS+=" -miphoneos-version-min=${SDK_MIN}"
183 EXTRA_LDFLAGS+=" -Wl,-ios_version_min,${SDK_MIN}"
184 export LDFLAGS="${LDFLAGS} -Wl,-ios_version_min,${SDK_MIN}"
186 EXTRA_CFLAGS+=" -miphoneos-version-min=${SIXTYFOURBIT_SDK_MIN}"
187 EXTRA_LDFLAGS+=" -Wl,-ios_version_min,${SIXTYFOURBIT_SDK_MIN}"
188 export LDFLAGS="${LDFLAGS} -Wl,-ios_version_min,${SIXTYFOURBIT_SDK_MIN}"
191 EXTRA_CFLAGS="-arch ${ARCH}"
192 EXTRA_CFLAGS+=" -miphoneos-version-min=${SIXTYFOURBIT_SDK_MIN}"
193 EXTRA_LDFLAGS=" -Wl,-ios_version_min,${SIXTYFOURBIT_SDK_MIN}"
194 export LDFLAGS="${LDFLAGS} -Wl-ios_version_min,${SIXTYFOURBIT_SDK_MIN}"
198 info "LD FLAGS SELECTED = '${LDFLAGS}'"
200 spushd ${VLCROOT}/contrib
203 mkdir -p "${VLCROOT}/contrib/iPhone${PLATFORM}-${ARCH}"
204 cd "${VLCROOT}/contrib/iPhone${PLATFORM}-${ARCH}"
206 if [ "$PLATFORM" = "OS" ]; then
207 export AS="gas-preprocessor.pl ${CC}"
208 export ASCPP="gas-preprocessor.pl ${CC}"
209 export CCAS="gas-preprocessor.pl ${CC}"
210 if [ "$ARCH" = "arm64" ]; then
211 export GASPP_FIX_XCODE5=1
214 export ASCPP="xcrun as"
217 ../bootstrap --build=x86_64-apple-darwin11 --host=${TARGET} --prefix=${VLCROOT}/contrib/${TARGET}-${ARCH} --arch=${ARCH} --disable-gpl \
218 --disable-disc --disable-sout \
220 --disable-SDL_image \
232 --disable-samplerate \
234 --disable-vncserver \
236 --disable-schroedinger \
238 --disable-chromaprint \
244 --disable-fontconfig \
245 --disable-gpg-error \
248 --enable-taglib > ${out}
250 echo "EXTRA_CFLAGS += ${EXTRA_CFLAGS}" >> config.mak
251 echo "EXTRA_LDFLAGS += ${EXTRA_LDFLAGS}" >> config.mak
256 info "Bootstraping vlc"
258 info "VLCROOT = ${VLCROOT}"
259 if ! [ -e ${VLCROOT}/configure ]; then
260 ${VLCROOT}/bootstrap > ${out}
263 info "Bootstraping vlc finished"
265 if [ ".$PLATFORM" != ".Simulator" ]; then
266 # FIXME - Do we still need this?
267 export AVCODEC_CFLAGS="-I${PREFIX}/include "
268 export AVCODEC_LIBS="-L${PREFIX}/lib -lavcodec -lavutil -lz"
269 export AVFORMAT_CFLAGS="-I${PREFIX}/include"
270 export AVFORMAT_LIBS="-L${PREFIX}/lib -lavcodec -lz -lavutil -lavformat"
276 info ">> --prefix=${PREFIX} --host=${TARGET}"
278 if [ "$DEBUG" = "yes" ]; then
279 DEBUGFLAG="--enable-debug"
281 DEBUGFLAG="--disable-debug"
284 if [ "$SCARY" = "yes" ]; then
285 SCARYFLAG="--enable-dvbpsi --enable-avcodec"
287 SCARYFLAG="--disable-dca --disable-dvbpsi --disable-avcodec --disable-avformat --disable-zvbi --enable-vpx"
290 # Run configure only upon changes.
291 if [ "${VLCROOT}/configure" -nt config.log -o \
292 "${THIS_SCRIPT_PATH}" -nt config.log ]; then
293 ${VLCROOT}/configure \
294 --prefix="${PREFIX}" \
296 --with-contrib="${VLCROOT}/contrib/${TARGET}-${ARCH}" \
301 --disable-macosx-dialog-provider \
302 --disable-macosx-qtkit \
303 --disable-macosx-eyetv \
304 --disable-macosx-vlc-app \
305 --disable-macosx-avfoundation \
306 --disable-audioqueue \
308 --enable-macosx-quartztext \
316 --disable-qt --disable-skins2 \
341 --disable-fluidsynth \
353 --disable-addonmanagermodules \
354 --disable-mad > ${out} # MMX and SSE support requires llvm which is broken on Simulator
357 CORE_COUNT=`sysctl -n machdep.cpu.core_count`
358 let MAKE_JOBS=$CORE_COUNT+1
360 info "Building libvlc"
361 make -j$MAKE_JOBS > ${out}
363 info "Installing libvlc"
364 make install > ${out}
366 find ${PREFIX}/lib/vlc/plugins -name *.a -type f -exec cp '{}' ${PREFIX}/lib/vlc/plugins \;
367 rm -rf "${PREFIX}/contribs"
368 cp -R "${VLCROOT}/contrib/${TARGET}-${ARCH}" "${PREFIX}/contribs"
370 info "Removing unneeded modules"
428 headphone_channel_mixer
442 if [ "$SCARY" = "no" ]; then
443 blacklist="${blacklist}
467 for i in ${blacklist}
469 find ${PREFIX}/lib/vlc/plugins -name *$i* -type f -exec rm '{}' \;