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