#!/bin/sh
set -e
-echo "Building libvlc for the iOS"
+PLATFORM=OS
+VERBOSE=no
+SDK_VERSION=7.0
+SDK_MIN=5.1
+ARCH=armv7
-if [ "$1" = "Simulator" ]; then
- PLATFORM="Simulator"
- TARGET="i686-apple-darwin10"
- ARCH="i386"
+usage()
+{
+cat << EOF
+usage: $0 [-s] [-k sdk]
+
+OPTIONS
+ -k <sdk version> Specify which sdk to use ('xcodebuild -showsdks', current: ${SDK_VERSION})
+ -s Build for simulator
+ -a <arch> Specify which arch to use (current: ${ARCH})
+EOF
+}
+
+spushd()
+{
+ pushd "$1" 2>&1> /dev/null
+}
+
+spopd()
+{
+ popd 2>&1> /dev/null
+}
+
+info()
+{
+ local blue="\033[1;34m"
+ local normal="\033[0m"
+ echo "[${blue}info${normal}] $1"
+}
+
+while getopts "hvsk:a:" OPTION
+do
+ case $OPTION in
+ h)
+ usage
+ exit 1
+ ;;
+ v)
+ VERBOSE=yes
+ ;;
+ s)
+ PLATFORM=Simulator
+ ;;
+ k)
+ SDK_VERSION=$OPTARG
+ ;;
+ a)
+ ARCH=$OPTARG
+ ;;
+ ?)
+ usage
+ exit 1
+ ;;
+ esac
+done
+shift $(($OPTIND - 1))
+
+if [ "x$1" != "x" ]; then
+ usage
+ exit 1
+fi
+
+out="/dev/null"
+if [ "$VERBOSE" = "yes" ]; then
+ out="/dev/stdout"
+fi
+
+info "Building libvlc for iOS"
+
+if [ "$PLATFORM" = "Simulator" ]; then
+ TARGET="${ARCH}-apple-darwin11"
+ OPTIM="-O3 -g"
else
- PLATFORM="OS"
- TARGET="arm-apple-darwin10"
- ARCH="armv7"
- OPTIM="-mno-thumb"
+ TARGET="arm-apple-darwin11"
+ OPTIM="-O3 -g"
fi
+info "Using ${ARCH} with SDK version ${SDK_VERSION}"
+
THIS_SCRIPT_PATH=`pwd`/$0
-pushd `dirname $0`/../../.. > /dev/null
+spushd `dirname ${THIS_SCRIPT_PATH}`/../../..
VLCROOT=`pwd` # Let's make sure VLCROOT is an absolute path
-popd > /dev/null
-DEVROOT="/Developer/Platforms/iPhone${PLATFORM}.platform/Developer"
-IOS_SDK_ROOT="${DEVROOT}/SDKs/iPhone${PLATFORM}4.2.sdk"
+spopd
-BUILDDIR="${VLCROOT}/build-ios-${PLATFORM}"
+if test -z "$SDKROOT"
+then
+ SDKROOT=`xcode-select -print-path`/Platforms/iPhone${PLATFORM}.platform/Developer/SDKs/iPhone${PLATFORM}${SDK_VERSION}.sdk
+ echo "SDKROOT not specified, assuming $SDKROOT"
+fi
-PREFIX="${VLCROOT}/install-ios-${PLATFORM}"
+if [ ! -d "${SDKROOT}" ]
+then
+ echo "*** ${SDKROOT} does not exist, please install required SDK, or set SDKROOT manually. ***"
+ exit 1
+fi
-IOS_GAS_PREPROCESSOR="${VLCROOT}/extras/package/ios/resources/gas-preprocessor.pl"
+BUILDDIR="${VLCROOT}/build-ios-${PLATFORM}/${ARCH}"
-export AR="${DEVROOT}/usr/bin/ar"
-export RANLIB="${DEVROOT}/usr/bin/ranlib"
-export CFLAGS="-isysroot ${IOS_SDK_ROOT} -arch ${ARCH} -miphoneos-version-min=3.2 ${OPTIM}"
+PREFIX="${VLCROOT}/install-ios-${PLATFORM}/${ARCH}"
+
+export PATH="${VLCROOT}/extras/tools/build/bin:${VLCROOT}/contrib/${TARGET}/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"
+
+info "Building tools"
+spushd "${VLCROOT}/extras/tools"
+./bootstrap
+make && make .gas
+spopd
+
+info "Building contrib for iOS in '${VLCROOT}/contrib/iPhone${PLATFORM}-${ARCH}'"
+
+# The contrib will read the following
+export AR="xcrun ar"
+
+export RANLIB="xcrun ranlib"
+export CC="xcrun clang"
+export OBJC="xcrun clang"
+export CXX="xcrun clang++"
+export LD="xcrun ld"
+export STRIP="xcrun strip"
+
+export PLATFORM=$PLATFORM
+export SDK_VERSION=$SDK_VERSION
+
+if [ "$PLATFORM" = "OS" ]; then
+export CFLAGS="-isysroot ${SDKROOT} -arch ${ARCH} -miphoneos-version-min=${SDK_MIN} ${OPTIM}"
+if [ "$ARCH" != "arm64" ]; then
+export CFLAGS="${CFLAGS} -mcpu=cortex-a8"
+fi
+else
+export CFLAGS="-isysroot ${SDKROOT} -arch ${ARCH} -miphoneos-version-min=${SDK_MIN} ${OPTIM}"
+fi
+export CFLAGS="${CFLAGS} -Wno-error=unused-command-line-argument-hard-error-in-future"
+export CPPFLAGS="${CFLAGS}"
+export CXXFLAGS="${CFLAGS}"
export OBJCFLAGS="${CFLAGS}"
+
+export CPP="xcrun cc -E"
+export CXXCPP="xcrun c++ -E"
+
+export BUILDFORIOS="yes"
+
if [ "$PLATFORM" = "Simulator" ]; then
# Use the new ABI on simulator, else we can't build
export OBJCFLAGS="-fobjc-abi-version=2 -fobjc-legacy-dispatch ${OBJCFLAGS}"
fi
-export CPPFLAGS="${CFLAGS}"
-export CXXFLAGS="${CFLAGS}"
-export CPP="${DEVROOT}/usr/bin/cpp-4.2"
-export CXXCPP="${DEVROOT}/usr/bin/cpp-4.2"
-export CC="${DEVROOT}/usr/bin/gcc-4.2"
-export OBJC="${DEVROOT}/usr/bin/gcc-4.2"
-export CXX="${DEVROOT}/usr/bin/g++-4.2"
-export LD="${DEVROOT}/usr/bin/ld"
-export STRIP="${DEVROOT}/usr/bin/strip"
+export LDFLAGS="-L${SDKROOT}/usr/lib -arch ${ARCH} -isysroot ${SDKROOT} -miphoneos-version-min=${SDK_MIN}"
if [ "$PLATFORM" = "OS" ]; then
- export LDFLAGS="-L${IOS_SDK_ROOT}/usr/lib -arch ${ARCH}"
+ EXTRA_CFLAGS="-arch ${ARCH}"
+if [ "$ARCH" != "arm64" ]; then
+ EXTRA_CFLAGS+=" -mcpu=cortex-a8"
+fi
+ EXTRA_LDFLAGS="-arch ${ARCH}"
else
- export LDFLAGS="-syslibroot=${IOS_SDK_ROOT}/ -arch ${ARCH}"
+ EXTRA_CFLAGS="-arch ${ARCH}"
+ EXTRA_LDFLAGS="-arch ${ARCH}"
fi
-export PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:${VLCROOT}/extras/contrib/build/bin:${VLCROOT}/extras/package/ios/resources"
+EXTRA_CFLAGS+=" -miphoneos-version-min=${SDK_MIN}"
+EXTRA_LDFLAGS+=" -miphoneos-version-min=${SDK_MIN}"
-echo "Boostraping contribs"
-pushd ${VLCROOT}/extras/contrib > /dev/null
+info "LD FLAGS SELECTED = '${LDFLAGS}'"
-# contains gas-processor.pl
-export PATH=$PATH:${VLCROOT}/extras/package/ios/resources
+spushd ${VLCROOT}/contrib
-# The contrib will read the following
-export IOS_SDK_ROOT
-
-echo "Building contrib for iOS"
-./bootstrap -t ${TARGET} -d ios \
- -b "${VLCROOT}/contrib-builddir-ios-${TARGET}" \
- -i "${VLCROOT}/contrib-ios-${TARGET}"
-pushd "${VLCROOT}/contrib-builddir-ios-${TARGET}" > /dev/null
-make src
-popd > /dev/null
-
-echo "Building contrib for current host"
-./bootstrap
-make
-
-popd
+echo ${VLCROOT}
+mkdir -p "${VLCROOT}/contrib/iPhone${PLATFORM}-${ARCH}"
+cd "${VLCROOT}/contrib/iPhone${PLATFORM}-${ARCH}"
if [ "$PLATFORM" = "OS" ]; then
- export AS="${IOS_GAS_PREPROCESSOR} ${CC}"
- export ASCPP="${IOS_GAS_PREPROCESSOR} ${CC}"
+ export AS="gas-preprocessor.pl ${CC}"
+ export ASCPP="gas-preprocessor.pl ${CC}"
+ export CCAS="gas-preprocessor.pl ${CC}"
+ if [ "$ARCH" = "arm64" ]; then
+ export GASPP_FIX_XCODE5=1
+ fi
else
- export AS="${DEVROOT}/usr/bin/as"
- export ASCPP="${DEVROOT}/usr/bin/as"
+ export ASCPP="xcrun as"
fi
+../bootstrap --build=x86_64-apple-darwin11 --host=${TARGET} --prefix=${VLCROOT}/contrib/${TARGET}-${ARCH} --disable-gpl \
+ --disable-disc --disable-sout \
+ --disable-sdl \
+ --disable-SDL_image \
+ --disable-iconv \
+ --enable-zvbi \
+ --disable-kate \
+ --disable-caca \
+ --disable-gettext \
+ --disable-mpcdec \
+ --disable-upnp \
+ --disable-gme \
+ --disable-tremor \
+ --enable-vorbis \
+ --disable-sidplay2 \
+ --disable-samplerate \
+ --disable-goom \
+ --disable-vncserver \
+ --disable-orc \
+ --disable-schroedinger \
+ --disable-libmpeg2 \
+ --disable-chromaprint \
+ --disable-mad \
+ --enable-fribidi \
+ --enable-libxml2 \
+ --enable-freetype2 \
+ --enable-ass \
+ --disable-fontconfig \
+ --disable-gpg-error \
+ --disable-lua \
+ --enable-taglib > ${out}
+
+echo "EXTRA_CFLAGS += ${EXTRA_CFLAGS}" >> config.mak
+echo "EXTRA_LDFLAGS += ${EXTRA_LDFLAGS}" >> config.mak
+make fetch
+make
+spopd
-echo "Bootstraping vlc"
+info "Bootstraping vlc"
+pwd
+info "VLCROOT = ${VLCROOT}"
if ! [ -e ${VLCROOT}/configure ]; then
- ${VLCROOT}/bootstrap
+ ${VLCROOT}/bootstrap > ${out}
fi
+info "Bootstraping vlc finished"
+
if [ ".$PLATFORM" != ".Simulator" ]; then
# FIXME - Do we still need this?
- export AVCODEC_CFLAGS="-I${PREFIX}/include"
+ export AVCODEC_CFLAGS="-I${PREFIX}/include "
export AVCODEC_LIBS="-L${PREFIX}/lib -lavcodec -lavutil -lz"
export AVFORMAT_CFLAGS="-I${PREFIX}/include"
export AVFORMAT_LIBS="-L${PREFIX}/lib -lavcodec -lz -lavutil -lavformat"
fi
mkdir -p ${BUILDDIR}
-pushd ${BUILDDIR}
+spushd ${BUILDDIR}
+
+info ">> --prefix=${PREFIX} --host=${TARGET}"
# Run configure only upon changes.
if [ "${VLCROOT}/configure" -nt config.log -o \
"${THIS_SCRIPT_PATH}" -nt config.log ]; then
-CONTRIB_DIR=${VLCROOT}/contrib-ios-${TARGET} \
${VLCROOT}/configure \
--prefix="${PREFIX}" \
--host="${TARGET}" \
- --enable-debug \
- --enable-static-modules \
+ --with-contrib="${VLCROOT}/contrib/${TARGET}-${ARCH}" \
+ --disable-debug \
+ --enable-static \
--disable-macosx \
- --disable-macosx-defaults \
- --disable-macosx-vout \
--disable-macosx-dialog-provider \
- --disable-macosx-qtcapture \
+ --disable-macosx-qtkit \
--disable-macosx-eyetv \
--disable-macosx-vlc-app \
- --with-macosx-sdk=${IO_SDK_ROOT} \
- --enable-audioqueue \
- --enable-ios-vout \
+ --disable-macosx-avfoundation \
+ --disable-audioqueue \
+ --disable-shared \
+ --enable-macosx-quartztext \
--enable-avcodec \
- --enable-avformat \
- --enable-swscale \
- --enable-faad \
- --disable-mad \
+ --enable-mkv \
+ --enable-opus \
+ --disable-sout \
+ --disable-faad \
+ --disable-lua \
--disable-a52 \
- --disable-fribidi \
- --disable-macosx-audio \
- --disable-qt4 --disable-skins2 \
- --disable-libgcrypt \
- --disable-remoteosd \
+ --enable-fribidi \
+ --disable-qt --disable-skins2 \
--disable-vcd \
- --disable-postproc \
--disable-vlc \
--disable-vlm \
--disable-httpd \
--disable-nls \
--disable-glx \
- --disable-visual \
- --disable-lua \
--disable-sse \
- --disable-neon \
- --disable-mmx # MMX and SSE support requires llvm which is broken on Simulator
+ --enable-neon \
+ --disable-notify \
+ --enable-live555 \
+ --enable-realrtsp \
+ --enable-dvbpsi \
+ --enable-swscale \
+ --disable-projectm \
+ --enable-libass \
+ --enable-libxml2 \
+ --disable-goom \
+ --disable-dvdread \
+ --disable-dvdnav \
+ --disable-bluray \
+ --disable-linsys \
+ --disable-libva \
+ --disable-gme \
+ --disable-tremor \
+ --enable-vorbis \
+ --disable-fluidsynth \
+ --disable-jack \
+ --disable-pulse \
+ --disable-mtp \
+ --enable-ogg \
+ --enable-speex \
+ --enable-theora \
+ --enable-flac \
+ --disable-screen \
+ --enable-freetype \
+ --enable-taglib \
+ --disable-mmx \
+ --disable-addonmanagermodules \
+ --disable-mad > ${out} # MMX and SSE support requires llvm which is broken on Simulator
fi
CORE_COUNT=`sysctl -n machdep.cpu.core_count`
let MAKE_JOBS=$CORE_COUNT+1
-echo "Running make -j$MAKE_JOBS"
+info "Building libvlc"
+make -j$MAKE_JOBS > ${out}
+
+info "Installing libvlc"
+make install > ${out}
+
+find ${PREFIX}/lib/vlc/plugins -name *.a -type f -exec cp '{}' ${PREFIX}/lib/vlc/plugins \;
+rm -rf "${PREFIX}/contribs"
+cp -R "${VLCROOT}/contrib/${TARGET}-${ARCH}" "${PREFIX}/contribs"
+
+info "Removing unneeded modules"
+blacklist="
+stats
+access_bd
+shm
+access_imem
+oldrc
+real
+hotkeys
+gestures
+dynamicoverlay
+rss
+ball
+marq
+magnify
+audiobargraph_
+clone
+mosaic
+osdmenu
+puzzle
+mediadirs
+t140
+ripple
+motion
+sharpen
+grain
+posterize
+mirror
+wall
+scene
+blendbench
+psychedelic
+alphamask
+netsync
+audioscrobbler
+motiondetect
+motionblur
+export
+smf
+podcast
+bluescreen
+erase
+stream_filter_record
+speex_resampler
+remoteosd
+magnify
+gradient
+tospdif
+dtstofloat32
+logger
+visual
+fb
+aout_file
+dummy
+invert
+sepia
+wave
+hqdn3d
+headphone_channel_mixer
+gaussianblur
+gradfun
+extract
+colorthres
+antiflicker
+anaglyph
+remap
+"
+
+for i in ${blacklist}
+do
+ find ${PREFIX}/lib/vlc/plugins -name *$i* -type f -exec rm '{}' \;
+done
-make -j$MAKE_JOBS
-make install
popd