raspberrypi-buildbot.sh 1.6 KB

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