13 usage: $0 [-s] [-k sdk]
16 -k <sdk> Specify which sdk to use ('xcodebuild -showsdks', current: ${SDK})
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
65 shift $(($OPTIND - 1))
67 if [ "x$1" != "x" ]; then
73 if [ "$VERBOSE" = "yes" ]; then
77 info "Building libvlc for iOS"
79 if [ "$PLATFORM" = "Simulator" ]; then
80 TARGET="i686-apple-darwin11"
84 TARGET="arm-apple-darwin11"
88 info "Using ${ARCH} with SDK version ${SDK_VERSION}"
90 THIS_SCRIPT_PATH=`pwd`/$0
92 spushd `dirname ${THIS_SCRIPT_PATH}`/../../..
93 VLCROOT=`pwd` # Let's make sure VLCROOT is an absolute path
98 SDKROOT=`xcode-select -print-path`/Platforms/iPhone${PLATFORM}.platform/Developer/SDKs/iPhone${PLATFORM}${SDK_VERSION}.sdk
99 echo "SDKROOT not specified, assuming $SDKROOT"
102 if [ ! -d "${SDKROOT}" ]
104 echo "*** ${SDKROOT} does not exist, please install required SDK, or set SDKROOT manually. ***"
108 BUILDDIR="${VLCROOT}/build-ios-${PLATFORM}/${ARCH}"
110 PREFIX="${VLCROOT}/install-ios-${PLATFORM}/${ARCH}"
112 export PATH="${VLCROOT}/extras/tools/build/bin:${VLCROOT}/contrib/${TARGET}/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"
114 # contains gas-processor.pl
115 export PATH=$PATH:${VLCROOT}/extras/package/ios/resources
117 info "Building tools"
118 spushd "${VLCROOT}/extras/tools"
123 info "Building contrib for iOS in '${VLCROOT}/contrib/iPhone${PLATFORM}-${ARCH}'"
125 # The contrib will read the following
128 export RANLIB="xcrun ranlib"
129 export CC="xcrun clang"
130 export OBJC="xcrun clang"
131 export CXX="xcrun clang++"
133 export STRIP="xcrun strip"
137 if [ "$PLATFORM" = "OS" ]; then
138 export CFLAGS="-isysroot ${SDKROOT} -arch ${ARCH} -mcpu=cortex-a8 -miphoneos-version-min=${SDK_MIN} ${OPTIM}"
140 export CFLAGS="-isysroot ${SDKROOT} -arch ${ARCH} -miphoneos-version-min=${SDK_MIN} ${OPTIM}"
142 export CPPFLAGS="${CFLAGS}"
143 export CXXFLAGS="${CFLAGS}"
144 export OBJCFLAGS="${CFLAGS}"
146 export CPP="xcrun cc -E"
147 export CXXCPP="xcrun c++ -E"
149 export BUILDFORIOS="yes"
151 if [ "$PLATFORM" = "Simulator" ]; then
152 # Use the new ABI on simulator, else we can't build
153 export OBJCFLAGS="-fobjc-abi-version=2 -fobjc-legacy-dispatch ${OBJCFLAGS}"
156 if [ "$PLATFORM" = "OS" ]; then
157 export LDFLAGS="-L${SDKROOT}/usr/lib -arch ${ARCH} -isysroot ${SDKROOT} -miphoneos-version-min=${SDK_MIN}"
159 export LDFLAGS="-syslibroot=${SDKROOT}/ -arch ${ARCH} -miphoneos-version-min=${SDK_MIN}"
162 if [ "$PLATFORM" = "OS" ]; then
163 EXTRA_CFLAGS="-arch ${ARCH} -mcpu=cortex-a8"
164 EXTRA_LDFLAGS="-arch ${ARCH}"
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}"
184 export ASCPP="xcrun as"
187 ../bootstrap --host=${TARGET} --build="i686-apple-darwin10" --prefix=${VLCROOT}/contrib/${TARGET}-${ARCH} --disable-gpl \
188 --disable-disc --disable-sout \
190 --disable-SDL_image \
202 --disable-samplerate \
205 --disable-vncserver \
208 --disable-schroedinger \
210 --disable-chromaprint \
216 --disable-fontconfig \
217 --disable-gpg-error \
220 --disable-taglib > ${out}
222 echo "EXTRA_CFLAGS += ${EXTRA_CFLAGS}" >> config.mak
223 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-vout \
260 --disable-macosx-dialog-provider \
261 --disable-macosx-qtkit \
262 --disable-macosx-eyetv \
263 --disable-macosx-vlc-app \
264 --disable-macosx-avfoundation \
265 --enable-audioqueue \
270 --enable-macosx-quartztext \
279 --disable-macosx-audio \
280 --disable-qt --disable-skins2 \
281 --disable-libgcrypt \
307 --disable-fluidsynth \
319 --disable-mad > ${out} # MMX and SSE support requires llvm which is broken on Simulator
322 CORE_COUNT=`sysctl -n machdep.cpu.core_count`
323 let MAKE_JOBS=$CORE_COUNT+1
325 info "Building libvlc"
326 make -j$MAKE_JOBS > ${out}
328 info "Installing libvlc"
329 make install > ${out}
331 find ${PREFIX}/lib/vlc/plugins -name *.a -type f -exec cp '{}' ${PREFIX}/lib/vlc/plugins \;
332 rm -rf "${PREFIX}/contribs"
333 cp -R "${VLCROOT}/contrib/${TARGET}-${ARCH}" "${PREFIX}/contribs"
335 info "Removing unneeded modules"
394 headphone_channel_mixer
404 for i in ${blacklist}
406 find ${PREFIX}/lib/vlc/plugins -name *$i* -type f -exec rm '{}' \;