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"
140 CFLAGS="-isysroot ${SDKROOT} -arch ${ARCH} -miphoneos-version-min=${SDK_MIN} ${OPTIM}"
141 if [ "$ARCH" = "armv7" -o "$ARCH" = "armv7s" ]; then
142 CFLAGS+=" -mcpu=cortex-a8"
145 export CPPFLAGS="${CFLAGS}"
146 export CXXFLAGS="${CFLAGS}"
147 export OBJCFLAGS="${CFLAGS}"
149 export CPP="xcrun cc -E"
150 export CXXCPP="xcrun c++ -E"
152 export BUILDFORIOS="yes"
154 if [ "$PLATFORM" = "Simulator" ]; then
155 # Use the new ABI on simulator, else we can't build
156 export OBJCFLAGS="-fobjc-abi-version=2 -fobjc-legacy-dispatch ${OBJCFLAGS}"
159 export LDFLAGS="-L${SDKROOT}/usr/lib -arch ${ARCH} -isysroot ${SDKROOT} -miphoneos-version-min=${SDK_MIN}"
161 if [ "$PLATFORM" = "OS" ]; then
162 EXTRA_CFLAGS="-arch ${ARCH} ${CFLAGS}"
163 EXTRA_LDFLAGS="-arch ${ARCH} ${LDFLAGS}"
165 EXTRA_CFLAGS="-arch ${ARCH}"
166 EXTRA_LDFLAGS="-arch ${ARCH}"
169 EXTRA_CFLAGS+=" -miphoneos-version-min=${SDK_MIN}"
170 EXTRA_LDFLAGS+=" -miphoneos-version-min=${SDK_MIN}"
172 info "LD FLAGS SELECTED = '${LDFLAGS}'"
174 spushd ${VLCROOT}/contrib
177 mkdir -p "${VLCROOT}/contrib/iPhone${PLATFORM}-${ARCH}"
178 cd "${VLCROOT}/contrib/iPhone${PLATFORM}-${ARCH}"
180 if [ "$PLATFORM" = "OS" ]; then
181 export AS="gas-preprocessor.pl ${CC}"
182 export ASCPP="gas-preprocessor.pl ${CC}"
183 export CCAS="gas-preprocessor.pl ${CC}"
186 export ASCPP="xcrun as"
189 ../bootstrap --host=${TARGET} --build="i686-apple-darwin10" --prefix=${VLCROOT}/contrib/${TARGET}-${ARCH} --disable-gpl \
190 --disable-disc --disable-sout \
192 --disable-SDL_image \
204 --disable-samplerate \
206 --disable-vncserver \
209 --disable-schroedinger \
211 --disable-chromaprint \
217 --disable-fontconfig \
218 --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 \
306 --disable-fluidsynth \
318 --disable-mad > ${out} # MMX and SSE support requires llvm which is broken on Simulator
321 CORE_COUNT=`sysctl -n machdep.cpu.core_count`
322 let MAKE_JOBS=$CORE_COUNT+1
324 info "Building libvlc"
325 make -j$MAKE_JOBS > ${out}
327 info "Installing libvlc"
328 make install > ${out}
330 find ${PREFIX}/lib/vlc/plugins -name *.a -type f -exec cp '{}' ${PREFIX}/lib/vlc/plugins \;
331 rm -rf "${PREFIX}/contribs"
332 cp -R "${VLCROOT}/contrib/${TARGET}-${ARCH}" "${PREFIX}/contribs"
334 info "Removing unneeded modules"
392 headphone_channel_mixer
402 for i in ${blacklist}
404 find ${PREFIX}/lib/vlc/plugins -name *$i* -type f -exec rm '{}' \;