Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | pmbaty | 1 | #!/bin/bash |
2 | |||
3 | # This is the script physfs-buildbot.icculus.org uses to cross-compile |
||
4 | # PhysicsFS from x86 Linux to Raspberry Pi. This script was originally from |
||
5 | # Simple Directmedia Layer ( https://www.libsdl.org/ ). |
||
6 | |||
7 | # The final tarball can be unpacked in the root directory of a RPi, |
||
8 | # so the PhysicsFS install lands in /usr/local. Run ldconfig, and then |
||
9 | # you should be able to build and run PhysicsFS-based software on your |
||
10 | # Pi. Standard configure scripts should be able to find PhysicsFS and |
||
11 | # build against it. |
||
12 | |||
13 | TARBALL="$1" |
||
14 | if [ -z $1 ]; then |
||
15 | TARBALL=physfs-raspberrypi.tar.xz |
||
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 | echo "\$MAKE is '$MAKE'" |
||
32 | MAKECMD="$MAKE" |
||
33 | unset MAKE # prevent warnings about jobserver mode. |
||
34 | |||
35 | BUILDBOTDIR="raspberrypi-buildbot" |
||
36 | PARENTDIR="$PWD" |
||
37 | |||
38 | set -e |
||
39 | set -x |
||
40 | rm -f $TARBALL |
||
41 | rm -rf $BUILDBOTDIR |
||
42 | mkdir -p $BUILDBOTDIR |
||
43 | pushd $BUILDBOTDIR |
||
44 | |||
45 | SYSROOT="/opt/rpi-sysroot" |
||
46 | cmake -G "Unix Makefiles" \ |
||
47 | -DCMAKE_C_COMPILER="/opt/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc" \ |
||
48 | -DCMAKE_BUILD_TYPE=MinSizeRel \ |
||
49 | -DCMAKE_SYSROOT="$SYSROOT" \ |
||
50 | -DCMAKE_FIND_ROOT_PATH="$SYSROOT" \ |
||
51 | -DCMAKE_SYSTEM_NAME="Linux" \ |
||
52 | -DCMAKE_SYSTEM_VERSION=1 \ |
||
53 | -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \ |
||
54 | -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \ |
||
55 | -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \ |
||
56 | .. |
||
57 | |||
58 | $MAKECMD |
||
59 | |||
60 | rm -rf "$TARBALL" physfs-raspberrypi |
||
61 | mkdir -p physfs-raspberrypi |
||
62 | echo "Archiving to '$TARBALL' ..." |
||
63 | cp -a ../src/physfs.h libphysfs.a libphysfs.so* physfs-raspberrypi |
||
64 | chmod -R a+r physfs-raspberrypi |
||
65 | chmod a+x physfs-raspberrypi physfs-raspberrypi/*.so* |
||
66 | chmod -R go-w physfs-raspberrypi |
||
67 | tar -cJvvf "$TARBALL" physfs-raspberrypi |
||
68 | |||
69 | set +x |
||
70 | echo "Done." |
||
71 | |||
72 |