13 usage: $0 [-s] [-k sdk]
16 -k <sdk version> Specify which sdk to use ('xcodebuild -showsdks', current: ${SDK_VERSION})
17 -s Build for simulator
18 -a <arch> Specify which arch to use (current: ${ARCH})
24 pushd "$1" 2>&1> /dev/null
34 local blue="\033[1;34m"
35 local normal="\033[0m"
36 echo "[${blue}info${normal}] $1"
39 while getopts "hvsk:a:" OPTION
64 shift $(($OPTIND - 1))
66 if [ "x$1" != "x" ]; then
72 if [ "$VERBOSE" = "yes" ]; then
76 info "Building libvlc for iOS"
78 if [ "$PLATFORM" = "Simulator" ]; then
79 TARGET="${ARCH}-apple-darwin11"
82 TARGET="arm-apple-darwin11"
86 info "Using ${ARCH} with SDK version ${SDK_VERSION}"
88 THIS_SCRIPT_PATH=`pwd`/$0
90 spushd `dirname ${THIS_SCRIPT_PATH}`/../../..
91 VLCROOT=`pwd` # Let's make sure VLCROOT is an absolute path
96 SDKROOT=`xcode-select -print-path`/Platforms/iPhone${PLATFORM}.platform/Developer/SDKs/iPhone${PLATFORM}${SDK_VERSION}.sdk
97 echo "SDKROOT not specified, assuming $SDKROOT"
100 if [ ! -d "${SDKROOT}" ]
102 echo "*** ${SDKROOT} does not exist, please install required SDK, or set SDKROOT manually. ***"
106 BUILDDIR="${VLCROOT}/build-ios-${PLATFORM}/${ARCH}"
108 PREFIX="${VLCROOT}/install-ios-${PLATFORM}/${ARCH}"
110 export PATH="${VLCROOT}/extras/tools/build/bin:${VLCROOT}/contrib/${TARGET}/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"
112 info "Building tools"
113 spushd "${VLCROOT}/extras/tools"
118 info "Building contrib for iOS in '${VLCROOT}/contrib/iPhone${PLATFORM}-${ARCH}'"
120 # The contrib will read the following
123 export RANLIB="xcrun ranlib"
124 export CC="xcrun clang"
125 export OBJC="xcrun clang"
126 export CXX="xcrun clang++"
128 export STRIP="xcrun strip"
130 export PLATFORM=$PLATFORM
131 export SDK_VERSION=$SDK_VERSION
133 if [ "$PLATFORM" = "OS" ]; then
134 export CFLAGS="-isysroot ${SDKROOT} -arch ${ARCH} -miphoneos-version-min=${SDK_MIN} ${OPTIM}"
135 if [ "$ARCH" != "arm64" ]; then
136 export CFLAGS="${CFLAGS} -mcpu=cortex-a8"
139 export CFLAGS="-isysroot ${SDKROOT} -arch ${ARCH} -miphoneos-version-min=${SDK_MIN} ${OPTIM}"
142 export CPPFLAGS="${CFLAGS}"
144 export CPP="xcrun cc -E"
145 export CXXCPP="xcrun c++ -E"
147 export BUILDFORIOS="yes"
149 if [ "$PLATFORM" = "Simulator" ]; then
150 # Use the new ABI on simulator, else we can't build
151 export OBJCFLAGS="-fobjc-abi-version=2 -fobjc-legacy-dispatch ${OBJCFLAGS}"
154 export LDFLAGS="-L${SDKROOT}/usr/lib -arch ${ARCH} -isysroot ${SDKROOT} -miphoneos-version-min=${SDK_MIN}"
156 if [ "$PLATFORM" = "OS" ]; then
157 EXTRA_CFLAGS="-arch ${ARCH}"
158 if [ "$ARCH" != "arm64" ]; then
159 EXTRA_CFLAGS+=" -mcpu=cortex-a8"
161 EXTRA_LDFLAGS="-arch ${ARCH}"
163 EXTRA_CFLAGS="-arch ${ARCH}"
164 EXTRA_LDFLAGS="-arch ${ARCH}"
167 EXTRA_CFLAGS+=" -miphoneos-version-min=${SDK_MIN}"
168 EXTRA_LDFLAGS+=" -miphoneos-version-min=${SDK_MIN}"
170 info "LD FLAGS SELECTED = '${LDFLAGS}'"
172 spushd ${VLCROOT}/contrib
175 mkdir -p "${VLCROOT}/contrib/iPhone${PLATFORM}-${ARCH}"
176 cd "${VLCROOT}/contrib/iPhone${PLATFORM}-${ARCH}"
178 if [ "$PLATFORM" = "OS" ]; then
179 export AS="gas-preprocessor.pl ${CC}"
180 export ASCPP="gas-preprocessor.pl ${CC}"
181 export CCAS="gas-preprocessor.pl ${CC}"
182 if [ "$ARCH" = "arm64" ]; then
183 export GASPP_FIX_XCODE5=1
186 export ASCPP="xcrun as"
189 ../bootstrap --build=x86_64-apple-darwin11 --host=${TARGET} --prefix=${VLCROOT}/contrib/${TARGET}-${ARCH} --disable-gpl \
190 --disable-disc --disable-sout \
192 --disable-SDL_image \
204 --disable-samplerate \
206 --disable-vncserver \
208 --disable-schroedinger \
210 --disable-chromaprint \
216 --disable-fontconfig \
217 --disable-gpg-error \
219 --enable-taglib > ${out}
221 echo "EXTRA_CFLAGS += ${EXTRA_CFLAGS}" >> config.mak
222 echo "EXTRA_LDFLAGS += ${EXTRA_LDFLAGS}" >> config.mak
227 info "Bootstraping vlc"
229 info "VLCROOT = ${VLCROOT}"
230 if ! [ -e ${VLCROOT}/configure ]; then
231 ${VLCROOT}/bootstrap > ${out}
234 info "Bootstraping vlc finished"
236 if [ ".$PLATFORM" != ".Simulator" ]; then
237 # FIXME - Do we still need this?
238 export AVCODEC_CFLAGS="-I${PREFIX}/include "
239 export AVCODEC_LIBS="-L${PREFIX}/lib -lavcodec -lavutil -lz"
240 export AVFORMAT_CFLAGS="-I${PREFIX}/include"
241 export AVFORMAT_LIBS="-L${PREFIX}/lib -lavcodec -lz -lavutil -lavformat"
247 info ">> --prefix=${PREFIX} --host=${TARGET}"
249 # Run configure only upon changes.
250 if [ "${VLCROOT}/configure" -nt config.log -o \
251 "${THIS_SCRIPT_PATH}" -nt config.log ]; then
252 ${VLCROOT}/configure \
253 --prefix="${PREFIX}" \
255 --with-contrib="${VLCROOT}/contrib/${TARGET}-${ARCH}" \
259 --disable-macosx-dialog-provider \
260 --disable-macosx-qtkit \
261 --disable-macosx-eyetv \
262 --disable-macosx-vlc-app \
263 --disable-macosx-avfoundation \
264 --disable-audioqueue \
266 --enable-macosx-quartztext \
275 --disable-qt --disable-skins2 \
301 --disable-fluidsynth \
313 --disable-addonmanagermodules \
314 --disable-mad > ${out} # MMX and SSE support requires llvm which is broken on Simulator
317 CORE_COUNT=`sysctl -n machdep.cpu.core_count`
318 let MAKE_JOBS=$CORE_COUNT+1
320 info "Building libvlc"
321 make -j$MAKE_JOBS > ${out}
323 info "Installing libvlc"
324 make install > ${out}
326 find ${PREFIX}/lib/vlc/plugins -name *.a -type f -exec cp '{}' ${PREFIX}/lib/vlc/plugins \;
327 rm -rf "${PREFIX}/contribs"
328 cp -R "${VLCROOT}/contrib/${TARGET}-${ARCH}" "${PREFIX}/contribs"
330 info "Removing unneeded modules"
388 headphone_channel_mixer
398 for i in ${blacklist}
400 find ${PREFIX}/lib/vlc/plugins -name *$i* -type f -exec rm '{}' \;