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"
141 CFLAGS="-isysroot ${SDKROOT} -arch ${ARCH} -miphoneos-version-min=${SDK_MIN} ${OPTIM}"
142 if [ "$ARCH" = "armv7" -o "$ARCH" = "armv7s" ]; then
143 CFLAGS+=" -mcpu=cortex-a8"
146 export CPPFLAGS="${CFLAGS}"
147 export CXXFLAGS="${CFLAGS}"
148 export OBJCFLAGS="${CFLAGS}"
150 export CPP="xcrun cc -E"
151 export CXXCPP="xcrun c++ -E"
153 export BUILDFORIOS="yes"
155 if [ "$PLATFORM" = "Simulator" ]; then
156 # Use the new ABI on simulator, else we can't build
157 export OBJCFLAGS="-fobjc-abi-version=2 -fobjc-legacy-dispatch ${OBJCFLAGS}"
160 if [ "$PLATFORM" = "OS" ]; then
161 export LDFLAGS="-L${SDKROOT}/usr/lib -arch ${ARCH} -isysroot ${SDKROOT} -miphoneos-version-min=${SDK_MIN}"
163 export LDFLAGS="-syslibroot=${SDKROOT}/ -arch ${ARCH} -miphoneos-version-min=${SDK_MIN}"
166 if [ "$PLATFORM" = "OS" ]; then
167 EXTRA_CFLAGS="-arch ${ARCH} ${CFLAGS}"
168 EXTRA_LDFLAGS="-arch ${ARCH} ${LDFLAGS}"
170 EXTRA_CFLAGS="-arch ${ARCH}"
171 EXTRA_LDFLAGS="-arch ${ARCH}"
174 EXTRA_CFLAGS+=" -miphoneos-version-min=${SDK_MIN}"
175 EXTRA_LDFLAGS+=" -miphoneos-version-min=${SDK_MIN}"
177 info "LD FLAGS SELECTED = '${LDFLAGS}'"
179 spushd ${VLCROOT}/contrib
182 mkdir -p "${VLCROOT}/contrib/iPhone${PLATFORM}-${ARCH}"
183 cd "${VLCROOT}/contrib/iPhone${PLATFORM}-${ARCH}"
185 if [ "$PLATFORM" = "OS" ]; then
186 export AS="gas-preprocessor.pl ${CC}"
187 export ASCPP="gas-preprocessor.pl ${CC}"
188 export CCAS="gas-preprocessor.pl ${CC}"
191 export ASCPP="xcrun as"
194 ../bootstrap --host=${TARGET} --build="i686-apple-darwin10" --prefix=${VLCROOT}/contrib/${TARGET}-${ARCH} --disable-gpl \
195 --disable-disc --disable-sout \
197 --disable-SDL_image \
209 --disable-samplerate \
212 --disable-vncserver \
215 --disable-schroedinger \
217 --disable-chromaprint \
223 --disable-fontconfig \
224 --disable-gpg-error \
227 --disable-taglib > ${out}
229 echo "EXTRA_CFLAGS += ${EXTRA_CFLAGS}" >> config.mak
230 echo "EXTRA_LDFLAGS += ${EXTRA_LDFLAGS}" >> config.mak
234 info "Bootstraping vlc"
236 info "VLCROOT = ${VLCROOT}"
237 if ! [ -e ${VLCROOT}/configure ]; then
238 ${VLCROOT}/bootstrap > ${out}
241 info "Bootstraping vlc finished"
243 if [ ".$PLATFORM" != ".Simulator" ]; then
244 # FIXME - Do we still need this?
245 export AVCODEC_CFLAGS="-I${PREFIX}/include "
246 export AVCODEC_LIBS="-L${PREFIX}/lib -lavcodec -lavutil -lz"
247 export AVFORMAT_CFLAGS="-I${PREFIX}/include"
248 export AVFORMAT_LIBS="-L${PREFIX}/lib -lavcodec -lz -lavutil -lavformat"
254 info ">> --prefix=${PREFIX} --host=${TARGET}"
256 # Run configure only upon changes.
257 if [ "${VLCROOT}/configure" -nt config.log -o \
258 "${THIS_SCRIPT_PATH}" -nt config.log ]; then
259 ${VLCROOT}/configure \
260 --prefix="${PREFIX}" \
262 --with-contrib="${VLCROOT}/contrib/${TARGET}-${ARCH}" \
266 --disable-macosx-vout \
267 --disable-macosx-dialog-provider \
268 --disable-macosx-qtkit \
269 --disable-macosx-eyetv \
270 --disable-macosx-vlc-app \
271 --disable-macosx-avfoundation \
272 --enable-audioqueue \
277 --enable-macosx-quartztext \
286 --disable-macosx-audio \
287 --disable-qt --disable-skins2 \
288 --disable-libgcrypt \
314 --disable-fluidsynth \
326 --disable-mad > ${out} # MMX and SSE support requires llvm which is broken on Simulator
329 CORE_COUNT=`sysctl -n machdep.cpu.core_count`
330 let MAKE_JOBS=$CORE_COUNT+1
332 info "Building libvlc"
333 make -j$MAKE_JOBS > ${out}
335 info "Installing libvlc"
336 make install > ${out}
338 find ${PREFIX}/lib/vlc/plugins -name *.a -type f -exec cp '{}' ${PREFIX}/lib/vlc/plugins \;
339 rm -rf "${PREFIX}/contribs"
340 cp -R "${VLCROOT}/contrib/${TARGET}-${ARCH}" "${PREFIX}/contribs"
342 info "Removing unneeded modules"
401 headphone_channel_mixer
411 for i in ${blacklist}
413 find ${PREFIX}/lib/vlc/plugins -name *$i* -type f -exec rm '{}' \;