build-scripts/nacl-buildbot.sh
changeset 8881 eb48568ecabb
child 8882 4fc9e98413c3
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/build-scripts/nacl-buildbot.sh	Fri Jun 20 22:38:36 2014 -0400
     1.3 @@ -0,0 +1,64 @@
     1.4 +#!/bin/bash
     1.5 +
     1.6 +# This is the script buildbot.libsdl.org uses to cross-compile SDL2 from
     1.7 +#  amd64 Linux to NaCl.
     1.8 +
     1.9 +# The final tarball can be unpacked in the root directory of a RPi,
    1.10 +#  so the SDL2 install lands in /usr/local. Run ldconfig, and then
    1.11 +#  you should be able to build and run SDL2-based software on your
    1.12 +#  Pi. Standard configure scripts should be able to find SDL and
    1.13 +#  build against it, and sdl2-config should work correctly on the
    1.14 +#  actual device.
    1.15 +
    1.16 +export NACL_SDK_ROOT="/nacl_sdk/pepper_35"
    1.17 +
    1.18 +TARBALL="$1"
    1.19 +if [ -z $1 ]; then
    1.20 +    TARBALL=sdl-nacl.tar.xz
    1.21 +fi
    1.22 +
    1.23 +OSTYPE=`uname -s`
    1.24 +if [ "$OSTYPE" != "Linux" ]; then
    1.25 +    # !!! FIXME
    1.26 +    echo "This only works on x86 or x64-64 Linux at the moment." 1>&2
    1.27 +    exit 1
    1.28 +fi
    1.29 +
    1.30 +if [ "x$MAKE" == "x" ]; then
    1.31 +    NCPU=`cat /proc/cpuinfo |grep vendor_id |wc -l`
    1.32 +    let NCPU=$NCPU+1
    1.33 +    MAKE="make -j$NCPU"
    1.34 +fi
    1.35 +
    1.36 +BUILDBOTDIR="nacl-buildbot"
    1.37 +PARENTDIR="$PWD"
    1.38 +
    1.39 +set -e
    1.40 +set -x
    1.41 +rm -f $TARBALL
    1.42 +rm -rf $BUILDBOTDIR
    1.43 +mkdir -p $BUILDBOTDIR
    1.44 +pushd $BUILDBOTDIR
    1.45 +
    1.46 +# !!! FIXME: ccache?
    1.47 +export CC="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-clang"
    1.48 +export CFLAGS="$CFLAGS -I$NACL_SDK_ROOT/include -I$NACL_SDK_ROOT/include/pnacl"
    1.49 +export AR="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-ar"
    1.50 +export LD="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-ar"
    1.51 +export RANLIB="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-ranlib"
    1.52 +
    1.53 +../configure --host=pnacl --prefix=$PWD/nacl-sdl2-installed
    1.54 +$MAKE
    1.55 +$MAKE install
    1.56 +# Fix up a few things to a real install path on a real Raspberry Pi...
    1.57 +perl -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
    1.58 +mkdir -p ./usr
    1.59 +mv ./nacl-sdl2-installed ./usr/local
    1.60 +
    1.61 +popd
    1.62 +tar -cJvvf $TARBALL -C $BUILDBOTDIR usr
    1.63 +rm -rf $BUILDBOTDIR
    1.64 +
    1.65 +set +x
    1.66 +echo "All done. Final installable is in $TARBALL ...";
    1.67 +