🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
2.0 KiB

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