nacl-buildbot.sh (1484B)
1#!/bin/bash 2 3# This is the script buildbot.libsdl.org uses to cross-compile SDL2 from 4# amd64 Linux to NaCl. 5 6export NACL_SDK_ROOT="/nacl_sdk/pepper_35" 7 8TARBALL="$1" 9if [ -z $1 ]; then 10 TARBALL=sdl-nacl.tar.xz 11fi 12 13OSTYPE=`uname -s` 14if [ "$OSTYPE" != "Linux" ]; then 15 # !!! FIXME 16 echo "This only works on x86 or x64-64 Linux at the moment." 1>&2 17 exit 1 18fi 19 20if [ "x$MAKE" == "x" ]; then 21 NCPU=`cat /proc/cpuinfo |grep vendor_id |wc -l` 22 let NCPU=$NCPU+1 23 MAKE="make -j$NCPU" 24fi 25 26BUILDBOTDIR="nacl-buildbot" 27PARENTDIR="$PWD" 28 29set -e 30set -x 31rm -f $TARBALL 32rm -rf $BUILDBOTDIR 33mkdir -p $BUILDBOTDIR 34pushd $BUILDBOTDIR 35 36# !!! FIXME: ccache? 37export CC="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-clang" 38export CFLAGS="$CFLAGS -I$NACL_SDK_ROOT/include -I$NACL_SDK_ROOT/include/pnacl" 39export AR="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-ar" 40export LD="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-ar" 41export RANLIB="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-ranlib" 42 43../configure --host=pnacl --prefix=$PWD/nacl-sdl2-installed 44$MAKE 45$MAKE install 46# Fix up a few things to a real install path 47perl -w -pi -e "s#$PWD/nacl-sdl2-installed#/usr/local#g;" ./nacl-sdl2-installed/lib/libSDL2.la ./nacl-sdl2-installed/lib/pkgconfig/sdl2.pc ./nacl-sdl2-installed/bin/sdl2-config 48mkdir -p ./usr 49mv ./nacl-sdl2-installed ./usr/local 50 51popd 52tar -cJvvf $TARBALL -C $BUILDBOTDIR usr 53rm -rf $BUILDBOTDIR 54 55set +x 56echo "All done. Final installable is in $TARBALL ..."; 57