build-scripts/raspberrypi-buildbot.sh
author Ryan C. Gordon <icculus@icculus.org>
Thu, 10 Oct 2013 02:37:36 -0400
changeset 7800 76e4b6825efc
parent 7798 795fc221d417
child 7805 4f0f7b64afa5
permissions -rwxr-xr-x
Raspberry Pi build script: let caller specify final tarball name.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7797
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     1
#!/bin/bash
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     2
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     3
# This is the script buildbot.libsdl.org uses to cross-compile SDL2 from
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     4
#  x86 Linux to Raspberry Pi.
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     5
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     6
# The final tarball can be unpacked in the root directory of a RPi,
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     7
#  so the SDL2 install lands in /usr/local. Run ldconfig, and then
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     8
#  you should be able to build and run SDL2-based software on your
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     9
#  Pi. Standard configure scripts should be able to find SDL and
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    10
#  build against it, and sdl2-config should work correctly on the
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    11
#  actual device.
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    12
7800
76e4b6825efc Raspberry Pi build script: let caller specify final tarball name.
Ryan C. Gordon <icculus@icculus.org>
parents: 7798
diff changeset
    13
TARBALL="$1"
76e4b6825efc Raspberry Pi build script: let caller specify final tarball name.
Ryan C. Gordon <icculus@icculus.org>
parents: 7798
diff changeset
    14
if [ -z $1 ]; then
76e4b6825efc Raspberry Pi build script: let caller specify final tarball name.
Ryan C. Gordon <icculus@icculus.org>
parents: 7798
diff changeset
    15
    TARBALL=sdl-raspberrypi.tar.bz2
76e4b6825efc Raspberry Pi build script: let caller specify final tarball name.
Ryan C. Gordon <icculus@icculus.org>
parents: 7798
diff changeset
    16
fi
7797
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    17
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    18
OSTYPE=`uname -s`
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    19
if [ "$OSTYPE" != "Linux" ]; then
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    20
    # !!! FIXME
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    21
    echo "This only works on x86 or x64-64 Linux at the moment." 1>&2
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    22
    exit 1
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    23
fi
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    24
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    25
if [ "x$MAKE" == "x" ]; then
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    26
    NCPU=`cat /proc/cpuinfo |grep vendor_id |wc -l`
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    27
    let NCPU=$NCPU+1
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    28
    MAKE="make -j$NCPU"
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    29
fi
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    30
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    31
BUILDBOTDIR="raspberrypi-buildbot"
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    32
PARENTDIR="$PWD"
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    33
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    34
set -e
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    35
set -x
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    36
rm -f $TARBALL
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    37
rm -rf $BUILDBOTDIR
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    38
mkdir -p $BUILDBOTDIR
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    39
pushd $BUILDBOTDIR
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    40
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    41
export CC=/opt/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    42
# !!! FIXME: shouldn't have to --disable-* things here.
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    43
../configure --host=arm-raspberry-linux-gnueabihf --disable-pulseaudio --disable-esd --prefix="$PWD/rpi-sdl2-installed"
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    44
$MAKE
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    45
$MAKE install
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    46
# Fix up a few things to a real install path on a real Raspberry Pi...
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    47
perl -w -pi -e "s#$PWD/rpi-sdl2-installed#/usr/local#g;" ./rpi-sdl2-installed/lib/libSDL2.la ./rpi-sdl2-installed/lib/pkgconfig/sdl2.pc ./rpi-sdl2-installed/bin/sdl2-config
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    48
mkdir -p ./usr
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    49
mv ./rpi-sdl2-installed ./usr/local
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    50
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    51
popd
7800
76e4b6825efc Raspberry Pi build script: let caller specify final tarball name.
Ryan C. Gordon <icculus@icculus.org>
parents: 7798
diff changeset
    52
tar -cjvvf $TARBALL -C $BUILDBOTDIR usr
7797
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    53
rm -rf $BUILDBOTDIR
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    54
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    55
set +x
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    56
echo "All done. Final installable is in $TARBALL ...";
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    57
40543ce6e842 Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    58