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.
     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="$1"
    14 if [ -z $1 ]; then
    15     TARBALL=sdl-raspberrypi.tar.bz2
    16 fi
    17 
    18 OSTYPE=`uname -s`
    19 if [ "$OSTYPE" != "Linux" ]; then
    20     # !!! FIXME
    21     echo "This only works on x86 or x64-64 Linux at the moment." 1>&2
    22     exit 1
    23 fi
    24 
    25 if [ "x$MAKE" == "x" ]; then
    26     NCPU=`cat /proc/cpuinfo |grep vendor_id |wc -l`
    27     let NCPU=$NCPU+1
    28     MAKE="make -j$NCPU"
    29 fi
    30 
    31 BUILDBOTDIR="raspberrypi-buildbot"
    32 PARENTDIR="$PWD"
    33 
    34 set -e
    35 set -x
    36 rm -f $TARBALL
    37 rm -rf $BUILDBOTDIR
    38 mkdir -p $BUILDBOTDIR
    39 pushd $BUILDBOTDIR
    40 
    41 export CC=/opt/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc
    42 # !!! FIXME: shouldn't have to --disable-* things here.
    43 ../configure --host=arm-raspberry-linux-gnueabihf --disable-pulseaudio --disable-esd --prefix="$PWD/rpi-sdl2-installed"
    44 $MAKE
    45 $MAKE install
    46 # Fix up a few things to a real install path on a real Raspberry Pi...
    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
    48 mkdir -p ./usr
    49 mv ./rpi-sdl2-installed ./usr/local
    50 
    51 popd
    52 tar -cjvvf $TARBALL -C $BUILDBOTDIR usr
    53 rm -rf $BUILDBOTDIR
    54 
    55 set +x
    56 echo "All done. Final installable is in $TARBALL ...";
    57 
    58