12 usage: $0 [-s] [-k sdk]
15 -k Specify which sdk to use ('xcodebuild -showsdks', current: ${SDK})
16 -s Build for simulator
22 pushd "$1" 2>&1> /dev/null
32 local blue="\033[1;34m"
33 local normal="\033[0m"
34 echo "[${blue}info${normal}] $1"
37 while getopts "hvsk:" OPTION
60 shift $(($OPTIND - 1))
62 if [ "x$1" != "x" ]; then
68 if [ "$VERBOSE" = "yes" ]; then
72 info "Building libvlc for iOS"
74 if [ "$PLATFORM" = "Simulator" ]; then
75 TARGET="i686-apple-darwin11"
79 TARGET="arm-apple-darwin11"
83 info "Using ${ARCH} with SDK version ${SDK_VERSION}"
85 THIS_SCRIPT_PATH=`pwd`/$0
87 spushd `dirname ${THIS_SCRIPT_PATH}`/../../..
88 VLCROOT=`pwd` # Let's make sure VLCROOT is an absolute path
93 SDKROOT=`xcode-select -print-path`/Platforms/iPhone${PLATFORM}.platform/Developer/SDKs/iPhone${PLATFORM}${SDK_VERSION}.sdk
94 echo "SDKROOT not specified, assuming $SDKROOT"
97 if [ ! -d "${SDKROOT}" ]
99 echo "*** ${SDKROOT} does not exist, please install required SDK, or set SDKROOT manually. ***"
103 BUILDDIR="${VLCROOT}/build-ios-${PLATFORM}"
105 PREFIX="${VLCROOT}/install-ios-${PLATFORM}"
107 IOS_GAS_PREPROCESSOR="${VLCROOT}/extras/tools/gas/gas-preprocessor.pl"
109 export PATH="${VLCROOT}/extras/tools/build/bin:${VLCROOT}/contrib/${TARGET}/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"
111 # contains gas-processor.pl
112 export PATH=$PATH:${VLCROOT}/extras/package/ios/resources
114 info "Building tools"
115 spushd "${VLCROOT}/extras/tools"
120 info "Building contrib for iOS in '${VLCROOT}/contrib/iPhone${PLATFORM}'"
122 # The contrib will read the following
125 export RANLIB="xcrun ranlib"
126 export CC="xcrun clang"
127 export OBJC="xcrun clang"
128 export CXX="xcrun clang++"
130 export STRIP="xcrun strip"
134 if [ "$PLATFORM" = "OS" ]; then
135 export CFLAGS="-isysroot ${SDKROOT} -arch ${ARCH} -mcpu=cortex-a8 -miphoneos-version-min=${SDK_MIN} ${OPTIM}"
137 export CFLAGS="-isysroot ${SDKROOT} -arch ${ARCH} -miphoneos-version-min=${SDK_MIN} ${OPTIM}"
139 export CPPFLAGS="${CFLAGS}"
140 export CXXFLAGS="${CFLAGS}"
141 export OBJCFLAGS="${CFLAGS}"
143 export CPP="xcrun cc -E"
144 export CXXCPP="xcrun c++ -E"
146 export BUILDFORIOS="yes"
148 if [ "$PLATFORM" = "Simulator" ]; then
149 # Use the new ABI on simulator, else we can't build
150 export OBJCFLAGS="-fobjc-abi-version=2 -fobjc-legacy-dispatch ${OBJCFLAGS}"
153 if [ "$PLATFORM" = "OS" ]; then
154 export LDFLAGS="-L${SDKROOT}/usr/lib -arch ${ARCH} -isysroot ${SDKROOT} -miphoneos-version-min=${SDK_MIN}"
156 export LDFLAGS="-syslibroot=${SDKROOT}/ -arch ${ARCH} -miphoneos-version-min=${SDK_MIN}"
159 info "LD FLAGS SELECTED = '${LDFLAGS}'"
161 spushd ${VLCROOT}/contrib
164 mkdir -p "${VLCROOT}/contrib/iPhone${PLATFORM}"
165 cd "${VLCROOT}/contrib/iPhone${PLATFORM}"
167 if [ "$PLATFORM" = "OS" ]; then
168 export AS="${IOS_GAS_PREPROCESSOR} ${CC}"
169 export ASCPP="${IOS_GAS_PREPROCESSOR} ${CC}"
170 export CCAS="${IOS_GAS_PREPROCESSOR} ${CC}"
173 export ASCPP="xcrun as"
176 ../bootstrap --host=${TARGET} --build="i686-apple-darwin10" --disable-disc --disable-sout \
179 --disable-SDL_image \
180 --disable-fontconfig \
182 --disable-freetype2 \
195 --disable-samplerate \
200 --disable-schroedinger \
202 --enable-mad > ${out}
206 info "Bootstraping vlc"
208 info "VLCROOT = ${VLCROOT}"
209 if ! [ -e ${VLCROOT}/configure ]; then
210 ${VLCROOT}/bootstrap > ${out}
213 info "Bootstraping vlc finished"
215 if [ ".$PLATFORM" != ".Simulator" ]; then
216 # FIXME - Do we still need this?
217 export AVCODEC_CFLAGS="-I${PREFIX}/include "
218 export AVCODEC_LIBS="-L${PREFIX}/lib -lavcodec -lavutil -lz"
219 export AVFORMAT_CFLAGS="-I${PREFIX}/include"
220 export AVFORMAT_LIBS="-L${PREFIX}/lib -lavcodec -lz -lavutil -lavformat"
223 export DVBPSI_CFLAGS="-I${VLCROOT}/contrib-ios-${TARGET}/include "
224 export DVBPSI_LIBS="-L${VLCROOT}/contrib-ios-${TARGET}/lib "
226 export SWSCALE_CFLAGS="-I${VLCROOT}/contrib-ios-${TARGET}/include "
227 export SWSCALE_LIBS="-L${VLCROOT}/contrib-ios-${TARGET}/lib "
232 info ">> --prefix=${PREFIX} --host=${TARGET}"
234 # Run configure only upon changes.
235 if [ "${VLCROOT}/configure" -nt config.log -o \
236 "${THIS_SCRIPT_PATH}" -nt config.log ]; then
237 CONTRIB_DIR=${VLCROOT}/contrib-ios-${TARGET} \
238 ${VLCROOT}/configure \
239 --prefix="${PREFIX}" \
244 --disable-macosx-vout \
245 --disable-macosx-dialog-provider \
246 --disable-macosx-qtkit \
247 --disable-macosx-eyetv \
248 --disable-macosx-vlc-app \
249 --enable-audioqueue \
252 --disable-macosx-quartztext \
265 --disable-macosx-audio \
266 --disable-qt --disable-skins2 \
267 --disable-libgcrypt \
295 --disable-fluidsynth \
308 --disable-mmx > ${out} # MMX and SSE support requires llvm which is broken on Simulator
311 CORE_COUNT=`sysctl -n machdep.cpu.core_count`
312 let MAKE_JOBS=$CORE_COUNT+1
314 info "Building libvlc"
315 make -j$MAKE_JOBS > ${out}
317 info "Installing libvlc"
318 make install > ${out}
319 find ${PREFIX}/lib/vlc/plugins -name *.a -type f -exec cp '{}' ${PREFIX}/lib/vlc/plugins \;
321 info "Removing unneeded modules"
381 headphone_channel_mixer
392 for i in ${blacklist}
394 find ${PREFIX}/lib/vlc/plugins -name *$i* -type f -exec rm '{}' \;