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