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 IOS_GAS_PREPROCESSOR="${VLCROOT}/extras/tools/gas/gas-preprocessor.pl"
114 export PATH="${VLCROOT}/extras/tools/build/bin:${VLCROOT}/contrib/${TARGET}/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"
116 # contains gas-processor.pl
117 export PATH=$PATH:${VLCROOT}/extras/package/ios/resources
119 info "Building tools"
120 spushd "${VLCROOT}/extras/tools"
125 info "Building contrib for iOS in '${VLCROOT}/contrib/iPhone${PLATFORM}-${ARCH}'"
127 # The contrib will read the following
130 export RANLIB="xcrun ranlib"
131 export CC="xcrun clang"
132 export OBJC="xcrun clang"
133 export CXX="xcrun clang++"
135 export STRIP="xcrun strip"
139 if [ "$PLATFORM" = "OS" ]; then
140 export CFLAGS="-isysroot ${SDKROOT} -arch ${ARCH} -mcpu=cortex-a8 -miphoneos-version-min=${SDK_MIN} ${OPTIM}"
142 export CFLAGS="-isysroot ${SDKROOT} -arch ${ARCH} -miphoneos-version-min=${SDK_MIN} ${OPTIM}"
144 export CPPFLAGS="${CFLAGS}"
145 export CXXFLAGS="${CFLAGS}"
146 export OBJCFLAGS="${CFLAGS}"
148 export CPP="xcrun cc -E"
149 export CXXCPP="xcrun c++ -E"
151 export BUILDFORIOS="yes"
153 if [ "$PLATFORM" = "Simulator" ]; then
154 # Use the new ABI on simulator, else we can't build
155 export OBJCFLAGS="-fobjc-abi-version=2 -fobjc-legacy-dispatch ${OBJCFLAGS}"
158 if [ "$PLATFORM" = "OS" ]; then
159 export LDFLAGS="-L${SDKROOT}/usr/lib -arch ${ARCH} -isysroot ${SDKROOT} -miphoneos-version-min=${SDK_MIN}"
161 export LDFLAGS="-syslibroot=${SDKROOT}/ -arch ${ARCH} -miphoneos-version-min=${SDK_MIN}"
164 if [ "$PLATFORM" = "OS" ]; then
165 EXTRA_CFLAGS="-arch ${ARCH} -mcpu=cortex-a8"
166 EXTRA_LDFLAGS="-arch ${ARCH}"
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="${IOS_GAS_PREPROCESSOR} ${CC}"
182 export ASCPP="${IOS_GAS_PREPROCESSOR} ${CC}"
183 export CCAS="${IOS_GAS_PREPROCESSOR} ${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 \
193 --disable-SDL_image \
194 --disable-fontconfig \
196 --disable-freetype2 \
209 --disable-samplerate \
214 --disable-schroedinger \
216 --disable-chromaprint \
218 --disable-taglib > ${out}
220 echo "EXTRA_CFLAGS += ${EXTRA_CFLAGS}" >> config.mak
221 echo "EXTRA_LDFLAGS += ${EXTRA_LDFLAGS}" >> config.mak
225 info "Bootstraping vlc"
227 info "VLCROOT = ${VLCROOT}"
228 if ! [ -e ${VLCROOT}/configure ]; then
229 ${VLCROOT}/bootstrap > ${out}
232 info "Bootstraping vlc finished"
234 if [ ".$PLATFORM" != ".Simulator" ]; then
235 # FIXME - Do we still need this?
236 export AVCODEC_CFLAGS="-I${PREFIX}/include "
237 export AVCODEC_LIBS="-L${PREFIX}/lib -lavcodec -lavutil -lz"
238 export AVFORMAT_CFLAGS="-I${PREFIX}/include"
239 export AVFORMAT_LIBS="-L${PREFIX}/lib -lavcodec -lz -lavutil -lavformat"
245 info ">> --prefix=${PREFIX} --host=${TARGET}"
247 # Run configure only upon changes.
248 if [ "${VLCROOT}/configure" -nt config.log -o \
249 "${THIS_SCRIPT_PATH}" -nt config.log ]; then
250 ${VLCROOT}/configure \
251 --prefix="${PREFIX}" \
253 --with-contrib="${VLCROOT}/contrib/${TARGET}-${ARCH}" \
257 --disable-macosx-vout \
258 --disable-macosx-dialog-provider \
259 --disable-macosx-qtkit \
260 --disable-macosx-eyetv \
261 --disable-macosx-vlc-app \
262 --disable-macosx-avfoundation \
263 --enable-audioqueue \
268 --disable-macosx-quartztext \
277 --disable-macosx-audio \
278 --disable-qt --disable-skins2 \
279 --disable-libgcrypt \
305 --disable-fluidsynth \
317 --disable-mad > ${out} # MMX and SSE support requires llvm which is broken on Simulator
320 CORE_COUNT=`sysctl -n machdep.cpu.core_count`
321 let MAKE_JOBS=$CORE_COUNT+1
323 info "Building libvlc"
324 make -j$MAKE_JOBS > ${out}
326 info "Installing libvlc"
327 make install > ${out}
329 find ${PREFIX}/lib/vlc/plugins -name *.a -type f -exec cp '{}' ${PREFIX}/lib/vlc/plugins \;
330 cp -R "${VLCROOT}/contrib/${TARGET}-${ARCH}" "${PREFIX}/contribs"
332 info "Removing unneeded modules"
391 headphone_channel_mixer
401 for i in ${blacklist}
403 find ${PREFIX}/lib/vlc/plugins -name *$i* -type f -exec rm '{}' \;