11 usage: $0 [-s] [-k sdk]
14 -k Specify which sdk to use ('xcodebuild -showsdks', current: ${SDK})
15 -s Build for simulator
21 pushd "$1" 2>&1> /dev/null
31 local blue="\033[1;34m"
32 local normal="\033[0m"
33 echo "[${blue}info${normal}] $1"
36 while getopts "hvsk:" OPTION
48 SDK=iphonesimulator3.2
59 shift $(($OPTIND - 1))
61 if [ "x$1" != "x" ]; then
67 if [ "$VERBOSE" = "yes" ]; then
71 info "Building libvlc for the iOS"
73 if [ "$PLATFORM" = "Simulator" ]; then
74 TARGET="i686-apple-darwin10"
77 TARGET="arm-apple-darwin10"
83 xcodebuild -find gcc -sdk ${SDK} > ${out}
85 SDK_VERSION=`echo ${SDK} | sed -e 's/iphoneos//' -e 's/iphonesimulator//'`
87 info "Using ${ARCH} with SDK version ${SDK_VERSION}"
89 THIS_SCRIPT_PATH=`pwd`/$0
91 spushd `dirname ${THIS_SCRIPT_PATH}`/../../..
92 VLCROOT=`pwd` # Let's make sure VLCROOT is an absolute path
95 DEVROOT="/Developer/Platforms/iPhone${PLATFORM}.platform/Developer"
96 IOS_SDK_ROOT="${DEVROOT}/SDKs/iPhone${PLATFORM}${SDK_VERSION}.sdk"
98 BUILDDIR="${VLCROOT}/build-ios-${PLATFORM}"
100 PREFIX="${VLCROOT}/install-ios-${PLATFORM}"
102 IOS_GAS_PREPROCESSOR="${VLCROOT}/extras/package/ios/resources/gas-preprocessor.pl"
104 export AR="${DEVROOT}/usr/bin/ar"
105 export RANLIB="${DEVROOT}/usr/bin/ranlib"
106 export CFLAGS="-isysroot ${IOS_SDK_ROOT} -arch ${ARCH} -miphoneos-version-min=3.2 ${OPTIM}"
107 export OBJCFLAGS="${CFLAGS}"
108 if [ "$PLATFORM" = "Simulator" ]; then
109 # Use the new ABI on simulator, else we can't build
110 export OBJCFLAGS="-fobjc-abi-version=2 -fobjc-legacy-dispatch ${OBJCFLAGS}"
112 export CPPFLAGS="${CFLAGS}"
113 export CXXFLAGS="${CFLAGS}"
114 export CPP="${DEVROOT}/usr/bin/cpp-4.2"
115 export CXXCPP="${DEVROOT}/usr/bin/cpp-4.2"
117 export CC="${DEVROOT}/usr/bin/gcc-4.2"
118 export OBJC="${DEVROOT}/usr/bin/gcc-4.2"
119 export CXX="${DEVROOT}/usr/bin/g++-4.2"
120 export LD="${DEVROOT}/usr/bin/ld"
121 export STRIP="${DEVROOT}/usr/bin/strip"
123 if [ "$PLATFORM" = "OS" ]; then
124 export LDFLAGS="-L${IOS_SDK_ROOT}/usr/lib -arch ${ARCH}"
126 export LDFLAGS="-syslibroot=${IOS_SDK_ROOT}/ -arch ${ARCH}"
129 export PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:${VLCROOT}/extras/contrib/build/bin:${VLCROOT}/extras/package/ios/resources"
131 spushd ${VLCROOT}/extras/contrib
133 # contains gas-processor.pl
134 export PATH=$PATH:${VLCROOT}/extras/package/ios/resources
136 # The contrib will read the following
139 info "Building contrib for iOS in '${VLCROOT}/contrib-builddir-ios-${TARGET}'"
141 ./bootstrap -t ${TARGET} -d ios \
142 -b "${VLCROOT}/contrib-builddir-ios-${TARGET}" \
143 -i "${VLCROOT}/contrib-ios-${TARGET}" > ${out}
144 spushd "${VLCROOT}/contrib-builddir-ios-${TARGET}"
148 info "Building contrib for current host"
154 if [ "$PLATFORM" = "OS" ]; then
155 export AS="${IOS_GAS_PREPROCESSOR} ${CC}"
156 export ASCPP="${IOS_GAS_PREPROCESSOR} ${CC}"
158 export AS="${DEVROOT}/usr/bin/as"
159 export ASCPP="${DEVROOT}/usr/bin/as"
163 info "Bootstraping vlc"
165 if ! [ -e ${VLCROOT}/configure ]; then
166 ${VLCROOT}/bootstrap > ${out}
169 if [ ".$PLATFORM" != ".Simulator" ]; then
170 # FIXME - Do we still need this?
171 export AVCODEC_CFLAGS="-I${PREFIX}/include"
172 export AVCODEC_LIBS="-L${PREFIX}/lib -lavcodec -lavutil -lz"
173 export AVFORMAT_CFLAGS="-I${PREFIX}/include"
174 export AVFORMAT_LIBS="-L${PREFIX}/lib -lavcodec -lz -lavutil -lavformat"
180 # Run configure only upon changes.
181 if [ "${VLCROOT}/configure" -nt config.log -o \
182 "${THIS_SCRIPT_PATH}" -nt config.log ]; then
183 CONTRIB_DIR=${VLCROOT}/contrib-ios-${TARGET} \
184 ${VLCROOT}/configure \
185 --prefix="${PREFIX}" \
188 --enable-static-modules \
190 --disable-macosx-defaults \
191 --disable-macosx-vout \
192 --disable-macosx-dialog-provider \
193 --disable-macosx-qtcapture \
194 --disable-macosx-eyetv \
195 --disable-macosx-vlc-app \
196 --with-macosx-sdk=${IOS_SDK_ROOT} \
197 --enable-audioqueue \
206 --disable-macosx-audio \
207 --disable-qt4 --disable-skins2 \
208 --disable-libgcrypt \
209 --disable-remoteosd \
221 --disable-mmx > ${out} # MMX and SSE support requires llvm which is broken on Simulator
224 CORE_COUNT=`sysctl -n machdep.cpu.core_count`
225 let MAKE_JOBS=$CORE_COUNT+1
227 info "Building libvlc"
228 make -j$MAKE_JOBS > ${out}
230 info "Installing libvlc"
231 make install > ${out}