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