|
| 1 | +#!/bin/sh |
| 2 | +set -e |
| 3 | + |
| 4 | +PLATFORM=OS |
| 5 | +VERBOSE=no |
| 6 | +SDK_VERSION=7.0 |
| 7 | +SDK_MIN=5.1 |
| 8 | +ARCH=armv7 |
| 9 | + |
| 10 | +usage() |
| 11 | +{ |
| 12 | +cat << EOF |
| 13 | +usage: $0 [-s] [-k sdk] |
| 14 | +
|
| 15 | +OPTIONS |
| 16 | + -k <sdk version> Specify which sdk to use ('xcodebuild -showsdks', current: ${SDK_VERSION}) |
| 17 | + -s Build for simulator |
| 18 | + -a <arch> Specify which arch to use (current: ${ARCH}) |
| 19 | +EOF |
| 20 | +} |
| 21 | + |
| 22 | +spushd() |
| 23 | +{ |
| 24 | + pushd "$1" 2>&1> /dev/null |
| 25 | +} |
| 26 | + |
| 27 | +spopd() |
| 28 | +{ |
| 29 | + popd 2>&1> /dev/null |
| 30 | +} |
| 31 | + |
| 32 | +info() |
| 33 | +{ |
| 34 | + local blue="\033[1;34m" |
| 35 | + local normal="\033[0m" |
| 36 | + echo "[${blue}info${normal}] $1" |
| 37 | +} |
| 38 | + |
| 39 | +info "Hello World" |
| 40 | + |
| 41 | +# while getopts "hvsk:a:" OPTION |
| 42 | +# do |
| 43 | +# case $OPTION in |
| 44 | +# h) |
| 45 | +# usage |
| 46 | +# exit 1 |
| 47 | +# ;; |
| 48 | +# v) |
| 49 | +# VERBOSE=yes |
| 50 | +# ;; |
| 51 | +# s) |
| 52 | +# PLATFORM=Simulator |
| 53 | +# ;; |
| 54 | +# k) |
| 55 | +# SDK_VERSION=$OPTARG |
| 56 | +# ;; |
| 57 | +# a) |
| 58 | +# ARCH=$OPTARG |
| 59 | +# ;; |
| 60 | +# ?) |
| 61 | +# usage |
| 62 | +# exit 1 |
| 63 | +# ;; |
| 64 | +# esac |
| 65 | +# done |
| 66 | +# shift $(($OPTIND - 1)) |
| 67 | + |
| 68 | +# if [ "x$1" != "x" ]; then |
| 69 | +# usage |
| 70 | +# exit 1 |
| 71 | +# fi |
| 72 | + |
| 73 | +# out="/dev/null" |
| 74 | +# if [ "$VERBOSE" = "yes" ]; then |
| 75 | +# out="/dev/stdout" |
| 76 | +# fi |
| 77 | + |
| 78 | +# info "Building libvlc for iOS" |
| 79 | + |
| 80 | +# if [ "$PLATFORM" = "Simulator" ]; then |
| 81 | +# TARGET="${ARCH}-apple-darwin11" |
| 82 | +# OPTIM="-O3 -g" |
| 83 | +# else |
| 84 | +# TARGET="arm-apple-darwin11" |
| 85 | +# OPTIM="-O3 -g" |
| 86 | +# fi |
| 87 | + |
| 88 | +# info "Using ${ARCH} with SDK version ${SDK_VERSION}" |
| 89 | + |
| 90 | +# THIS_SCRIPT_PATH=`pwd`/$0 |
| 91 | + |
| 92 | +# spushd `dirname ${THIS_SCRIPT_PATH}`/../../.. |
| 93 | +# VLCROOT=`pwd` # Let's make sure VLCROOT is an absolute path |
| 94 | +# spopd |
| 95 | + |
| 96 | +# if test -z "$SDKROOT" |
| 97 | +# then |
| 98 | +# SDKROOT=`xcode-select -print-path`/Platforms/iPhone${PLATFORM}.platform/Developer/SDKs/iPhone${PLATFORM}${SDK_VERSION}.sdk |
| 99 | +# echo "SDKROOT not specified, assuming $SDKROOT" |
| 100 | +# fi |
| 101 | + |
| 102 | +# if [ ! -d "${SDKROOT}" ] |
| 103 | +# then |
| 104 | +# echo "*** ${SDKROOT} does not exist, please install required SDK, or set SDKROOT manually. ***" |
| 105 | +# exit 1 |
| 106 | +# fi |
| 107 | + |
| 108 | +# BUILDDIR="${VLCROOT}/build-ios-${PLATFORM}/${ARCH}" |
| 109 | + |
| 110 | +# PREFIX="${VLCROOT}/install-ios-${PLATFORM}/${ARCH}" |
| 111 | + |
| 112 | +# export PATH="${VLCROOT}/extras/tools/build/bin:${VLCROOT}/contrib/${TARGET}/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin" |
| 113 | + |
| 114 | +# info "Building tools" |
| 115 | +# spushd "${VLCROOT}/extras/tools" |
| 116 | +# ./bootstrap |
| 117 | +# make && make .gas |
| 118 | +# spopd |
| 119 | + |
| 120 | +# info "Building contrib for iOS in '${VLCROOT}/contrib/iPhone${PLATFORM}-${ARCH}'" |
| 121 | + |
| 122 | +# # The contrib will read the following |
| 123 | +# export AR="xcrun ar" |
| 124 | + |
| 125 | +# export RANLIB="xcrun ranlib" |
| 126 | +# export CC="xcrun clang" |
| 127 | +# export OBJC="xcrun clang" |
| 128 | +# export CXX="xcrun clang++" |
| 129 | +# export LD="xcrun ld" |
| 130 | +# export STRIP="xcrun strip" |
| 131 | + |
| 132 | +# export PLATFORM=$PLATFORM |
| 133 | +# export SDK_VERSION=$SDK_VERSION |
| 134 | + |
| 135 | +# if [ "$PLATFORM" = "OS" ]; then |
| 136 | +# export CFLAGS="-isysroot ${SDKROOT} -arch ${ARCH} -miphoneos-version-min=${SDK_MIN} ${OPTIM}" |
| 137 | +# if [ "$ARCH" != "arm64" ]; then |
| 138 | +# export CFLAGS="${CFLAGS} -mcpu=cortex-a8" |
| 139 | +# fi |
| 140 | +# else |
| 141 | +# export CFLAGS="-isysroot ${SDKROOT} -arch ${ARCH} -miphoneos-version-min=${SDK_MIN} ${OPTIM}" |
| 142 | +# fi |
| 143 | + |
| 144 | +# export CPP="xcrun cc -E" |
| 145 | +# export CXXCPP="xcrun c++ -E" |
| 146 | + |
| 147 | +# export BUILDFORIOS="yes" |
| 148 | + |
| 149 | +# if [ "$PLATFORM" = "Simulator" ]; then |
| 150 | +# # Use the new ABI on simulator, else we can't build |
| 151 | +# export OBJCFLAGS="-fobjc-abi-version=2 -fobjc-legacy-dispatch ${OBJCFLAGS}" |
| 152 | +# fi |
| 153 | + |
| 154 | +# export LDFLAGS="-L${SDKROOT}/usr/lib -arch ${ARCH} -isysroot ${SDKROOT} -miphoneos-version-min=${SDK_MIN}" |
| 155 | + |
| 156 | +# if [ "$PLATFORM" = "OS" ]; then |
| 157 | +# EXTRA_CFLAGS="-arch ${ARCH}" |
| 158 | +# if [ "$ARCH" != "arm64" ]; then |
| 159 | +# EXTRA_CFLAGS+=" -mcpu=cortex-a8" |
| 160 | +# fi |
| 161 | +# EXTRA_LDFLAGS="-arch ${ARCH}" |
| 162 | +# else |
| 163 | +# EXTRA_CFLAGS="-arch ${ARCH}" |
| 164 | +# EXTRA_LDFLAGS="-arch ${ARCH}" |
| 165 | +# fi |
| 166 | + |
| 167 | +# EXTRA_CFLAGS+=" -miphoneos-version-min=${SDK_MIN}" |
| 168 | +# EXTRA_LDFLAGS+=" -miphoneos-version-min=${SDK_MIN}" |
| 169 | + |
| 170 | +# info "LD FLAGS SELECTED = '${LDFLAGS}'" |
| 171 | + |
| 172 | +# spushd ${VLCROOT}/contrib |
| 173 | + |
| 174 | +# echo ${VLCROOT} |
| 175 | +# mkdir -p "${VLCROOT}/contrib/iPhone${PLATFORM}-${ARCH}" |
| 176 | +# cd "${VLCROOT}/contrib/iPhone${PLATFORM}-${ARCH}" |
| 177 | + |
| 178 | +# if [ "$PLATFORM" = "OS" ]; then |
| 179 | +# export AS="gas-preprocessor.pl ${CC}" |
| 180 | +# export ASCPP="gas-preprocessor.pl ${CC}" |
| 181 | +# export CCAS="gas-preprocessor.pl ${CC}" |
| 182 | +# if [ "$ARCH" = "arm64" ]; then |
| 183 | +# export GASPP_FIX_XCODE5=1 |
| 184 | +# fi |
| 185 | +# else |
| 186 | +# export ASCPP="xcrun as" |
| 187 | +# fi |
| 188 | + |
| 189 | +# ../bootstrap --build=x86_64-apple-darwin11 --host=${TARGET} --prefix=${VLCROOT}/contrib/${TARGET}-${ARCH} --disable-gpl \ |
| 190 | +# --disable-disc --disable-sout \ |
| 191 | +# --disable-sdl \ |
| 192 | +# --disable-SDL_image \ |
| 193 | +# --disable-iconv \ |
| 194 | +# --enable-zvbi \ |
| 195 | +# --disable-kate \ |
| 196 | +# --disable-caca \ |
| 197 | +# --disable-gettext \ |
| 198 | +# --disable-mpcdec \ |
| 199 | +# --disable-upnp \ |
| 200 | +# --disable-gme \ |
| 201 | +# --disable-tremor \ |
| 202 | +# --enable-vorbis \ |
| 203 | +# --disable-sidplay2 \ |
| 204 | +# --disable-samplerate \ |
| 205 | +# --disable-goom \ |
| 206 | +# --disable-vncserver \ |
| 207 | +# --disable-orc \ |
| 208 | +# --disable-schroedinger \ |
| 209 | +# --disable-libmpeg2 \ |
| 210 | +# --disable-chromaprint \ |
| 211 | +# --disable-mad \ |
| 212 | +# --enable-fribidi \ |
| 213 | +# --enable-libxml2 \ |
| 214 | +# --enable-freetype2 \ |
| 215 | +# --enable-ass \ |
| 216 | +# --disable-fontconfig \ |
| 217 | +# --disable-gpg-error \ |
| 218 | +# --disable-lua \ |
| 219 | +# --enable-taglib > ${out} |
| 220 | + |
| 221 | +# echo "EXTRA_CFLAGS += ${EXTRA_CFLAGS}" >> config.mak |
| 222 | +# echo "EXTRA_LDFLAGS += ${EXTRA_LDFLAGS}" >> config.mak |
| 223 | +# make fetch |
| 224 | +# make |
| 225 | +# spopd |
| 226 | + |
| 227 | +# info "Bootstraping vlc" |
| 228 | +# pwd |
| 229 | +# info "VLCROOT = ${VLCROOT}" |
| 230 | +# if ! [ -e ${VLCROOT}/configure ]; then |
| 231 | +# ${VLCROOT}/bootstrap > ${out} |
| 232 | +# fi |
| 233 | + |
| 234 | +# info "Bootstraping vlc finished" |
| 235 | + |
| 236 | +# if [ ".$PLATFORM" != ".Simulator" ]; then |
| 237 | +# # FIXME - Do we still need this? |
| 238 | +# export AVCODEC_CFLAGS="-I${PREFIX}/include " |
| 239 | +# export AVCODEC_LIBS="-L${PREFIX}/lib -lavcodec -lavutil -lz" |
| 240 | +# export AVFORMAT_CFLAGS="-I${PREFIX}/include" |
| 241 | +# export AVFORMAT_LIBS="-L${PREFIX}/lib -lavcodec -lz -lavutil -lavformat" |
| 242 | +# fi |
| 243 | + |
| 244 | +# mkdir -p ${BUILDDIR} |
| 245 | +# spushd ${BUILDDIR} |
| 246 | + |
| 247 | +# info ">> --prefix=${PREFIX} --host=${TARGET}" |
| 248 | + |
| 249 | +# # Run configure only upon changes. |
| 250 | +# if [ "${VLCROOT}/configure" -nt config.log -o \ |
| 251 | +# "${THIS_SCRIPT_PATH}" -nt config.log ]; then |
| 252 | +# ${VLCROOT}/configure \ |
| 253 | +# --prefix="${PREFIX}" \ |
| 254 | +# --host="${TARGET}" \ |
| 255 | +# --with-contrib="${VLCROOT}/contrib/${TARGET}-${ARCH}" \ |
| 256 | +# --disable-debug \ |
| 257 | +# --enable-static \ |
| 258 | +# --disable-macosx \ |
| 259 | +# --disable-macosx-dialog-provider \ |
| 260 | +# --disable-macosx-qtkit \ |
| 261 | +# --disable-macosx-eyetv \ |
| 262 | +# --disable-macosx-vlc-app \ |
| 263 | +# --disable-macosx-avfoundation \ |
| 264 | +# --disable-audioqueue \ |
| 265 | +# --disable-shared \ |
| 266 | +# --enable-macosx-quartztext \ |
| 267 | +# --enable-avcodec \ |
| 268 | +# --enable-mkv \ |
| 269 | +# --enable-opus \ |
| 270 | +# --disable-sout \ |
| 271 | +# --disable-faad \ |
| 272 | +# --disable-lua \ |
| 273 | +# --disable-a52 \ |
| 274 | +# --enable-fribidi \ |
| 275 | +# --disable-qt --disable-skins2 \ |
| 276 | +# --disable-vcd \ |
| 277 | +# --disable-vlc \ |
| 278 | +# --disable-vlm \ |
| 279 | +# --disable-httpd \ |
| 280 | +# --disable-nls \ |
| 281 | +# --disable-glx \ |
| 282 | +# --disable-sse \ |
| 283 | +# --enable-neon \ |
| 284 | +# --disable-notify \ |
| 285 | +# --enable-live555 \ |
| 286 | +# --enable-realrtsp \ |
| 287 | +# --enable-dvbpsi \ |
| 288 | +# --enable-swscale \ |
| 289 | +# --disable-projectm \ |
| 290 | +# --enable-libass \ |
| 291 | +# --enable-libxml2 \ |
| 292 | +# --disable-goom \ |
| 293 | +# --disable-dvdread \ |
| 294 | +# --disable-dvdnav \ |
| 295 | +# --disable-bluray \ |
| 296 | +# --disable-linsys \ |
| 297 | +# --disable-libva \ |
| 298 | +# --disable-gme \ |
| 299 | +# --disable-tremor \ |
| 300 | +# --enable-vorbis \ |
| 301 | +# --disable-fluidsynth \ |
| 302 | +# --disable-jack \ |
| 303 | +# --disable-pulse \ |
| 304 | +# --disable-mtp \ |
| 305 | +# --enable-ogg \ |
| 306 | +# --enable-speex \ |
| 307 | +# --enable-theora \ |
| 308 | +# --enable-flac \ |
| 309 | +# --disable-screen \ |
| 310 | +# --enable-freetype \ |
| 311 | +# --enable-taglib \ |
| 312 | +# --disable-mmx \ |
| 313 | +# --disable-addonmanagermodules \ |
| 314 | +# --disable-mad > ${out} # MMX and SSE support requires llvm which is broken on Simulator |
| 315 | +# fi |
| 316 | + |
| 317 | +# CORE_COUNT=`sysctl -n machdep.cpu.core_count` |
| 318 | +# let MAKE_JOBS=$CORE_COUNT+1 |
| 319 | + |
| 320 | +# info "Building libvlc" |
| 321 | +# make -j$MAKE_JOBS > ${out} |
| 322 | + |
| 323 | +# info "Installing libvlc" |
| 324 | +# make install > ${out} |
| 325 | + |
| 326 | +# find ${PREFIX}/lib/vlc/plugins -name *.a -type f -exec cp '{}' ${PREFIX}/lib/vlc/plugins \; |
| 327 | +# rm -rf "${PREFIX}/contribs" |
| 328 | +# cp -R "${VLCROOT}/contrib/${TARGET}-${ARCH}" "${PREFIX}/contribs" |
| 329 | + |
| 330 | + |
| 331 | +# popd |
0 commit comments