build-scripts/nacl-buildbot.sh
author Sam Lantinga <slouken@libsdl.org>
Sat, 21 Jun 2014 11:16:26 -0700
changeset 8882 4fc9e98413c3
parent 8881 eb48568ecabb
child 10592 a5667285680d
permissions -rwxr-xr-x
Removed references to Raspberry Pi
icculus@8881
     1
#!/bin/bash
icculus@8881
     2
icculus@8881
     3
# This is the script buildbot.libsdl.org uses to cross-compile SDL2 from
icculus@8881
     4
#  amd64 Linux to NaCl.
icculus@8881
     5
icculus@8881
     6
export NACL_SDK_ROOT="/nacl_sdk/pepper_35"
icculus@8881
     7
icculus@8881
     8
TARBALL="$1"
icculus@8881
     9
if [ -z $1 ]; then
icculus@8881
    10
    TARBALL=sdl-nacl.tar.xz
icculus@8881
    11
fi
icculus@8881
    12
icculus@8881
    13
OSTYPE=`uname -s`
icculus@8881
    14
if [ "$OSTYPE" != "Linux" ]; then
icculus@8881
    15
    # !!! FIXME
icculus@8881
    16
    echo "This only works on x86 or x64-64 Linux at the moment." 1>&2
icculus@8881
    17
    exit 1
icculus@8881
    18
fi
icculus@8881
    19
icculus@8881
    20
if [ "x$MAKE" == "x" ]; then
icculus@8881
    21
    NCPU=`cat /proc/cpuinfo |grep vendor_id |wc -l`
icculus@8881
    22
    let NCPU=$NCPU+1
icculus@8881
    23
    MAKE="make -j$NCPU"
icculus@8881
    24
fi
icculus@8881
    25
icculus@8881
    26
BUILDBOTDIR="nacl-buildbot"
icculus@8881
    27
PARENTDIR="$PWD"
icculus@8881
    28
icculus@8881
    29
set -e
icculus@8881
    30
set -x
icculus@8881
    31
rm -f $TARBALL
icculus@8881
    32
rm -rf $BUILDBOTDIR
icculus@8881
    33
mkdir -p $BUILDBOTDIR
icculus@8881
    34
pushd $BUILDBOTDIR
icculus@8881
    35
icculus@8881
    36
# !!! FIXME: ccache?
icculus@8881
    37
export CC="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-clang"
icculus@8881
    38
export CFLAGS="$CFLAGS -I$NACL_SDK_ROOT/include -I$NACL_SDK_ROOT/include/pnacl"
icculus@8881
    39
export AR="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-ar"
icculus@8881
    40
export LD="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-ar"
icculus@8881
    41
export RANLIB="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-ranlib"
icculus@8881
    42
icculus@8881
    43
../configure --host=pnacl --prefix=$PWD/nacl-sdl2-installed
icculus@8881
    44
$MAKE
icculus@8881
    45
$MAKE install
slouken@8882
    46
# Fix up a few things to a real install path
icculus@8881
    47
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
icculus@8881
    48
mkdir -p ./usr
icculus@8881
    49
mv ./nacl-sdl2-installed ./usr/local
icculus@8881
    50
icculus@8881
    51
popd
icculus@8881
    52
tar -cJvvf $TARBALL -C $BUILDBOTDIR usr
icculus@8881
    53
rm -rf $BUILDBOTDIR
icculus@8881
    54
icculus@8881
    55
set +x
icculus@8881
    56
echo "All done. Final installable is in $TARBALL ...";
icculus@8881
    57