buildbot-raspberrypi.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #!/bin/bash
  2. # This is the script physfs-buildbot.icculus.org uses to cross-compile
  3. # PhysicsFS from x86 Linux to Raspberry Pi. This script was originally from
  4. # Simple Directmedia Layer ( https://www.libsdl.org/ ).
  5. # The final tarball can be unpacked in the root directory of a RPi,
  6. # so the PhysicsFS install lands in /usr/local. Run ldconfig, and then
  7. # you should be able to build and run PhysicsFS-based software on your
  8. # Pi. Standard configure scripts should be able to find PhysicsFS and
  9. # build against it.
  10. TARBALL="$1"
  11. if [ -z $1 ]; then
  12. TARBALL=physfs-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. cmake -G "Unix Makefiles" \
  35. -DCMAKE_C_COMPILER="/opt/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc" \
  36. -DCMAKE_BUILD_TYPE=MinSizeRel \
  37. -DCMAKE_SYSROOT="$SYSROOT" \
  38. -DCMAKE_FIND_ROOT_PATH="$SYSROOT" \
  39. -DCMAKE_SYSTEM_NAME="Linux" \
  40. -DCMAKE_SYSTEM_VERSION=1 \
  41. -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
  42. -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
  43. -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
  44. ..
  45. $MAKE
  46. rm -rf "$TARBALL" physfs-raspberrypi
  47. mkdir -p physfs-raspberrypi
  48. echo "Archiving to '$TARBALL' ..."
  49. cp -a ../src/physfs.h libphysfs.a libphysfs.so* physfs-raspberrypi
  50. chmod -R a+r physfs-raspberrypi
  51. chmod a+x physfs-raspberrypi physfs-raspberrypi/*.so*
  52. chmod -R go-w physfs-raspberrypi
  53. tar -cJvvf "$TARBALL" physfs-raspberrypi
  54. set +x
  55. echo "Done."