author | Ryan C. Gordon <icculus@icculus.org> |
Sun, 15 Dec 2013 00:21:42 -0500 | |
changeset 8063 | 405d84eedad8 |
parent 8007 | f4264c673a8d |
child 8587 | d913fb15b69a |
permissions | -rwxr-xr-x |
7797
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1 |
#!/bin/bash |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
2 |
|
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
3 |
# This is the script buildbot.libsdl.org uses to cross-compile SDL2 from |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
4 |
# x86 Linux to Raspberry Pi. |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
5 |
|
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
6 |
# The final tarball can be unpacked in the root directory of a RPi, |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
7 |
# so the SDL2 install lands in /usr/local. Run ldconfig, and then |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
8 |
# you should be able to build and run SDL2-based software on your |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
9 |
# Pi. Standard configure scripts should be able to find SDL and |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
10 |
# build against it, and sdl2-config should work correctly on the |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
11 |
# actual device. |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
12 |
|
7800
76e4b6825efc
Raspberry Pi build script: let caller specify final tarball name.
Ryan C. Gordon <icculus@icculus.org>
parents:
7798
diff
changeset
|
13 |
TARBALL="$1" |
76e4b6825efc
Raspberry Pi build script: let caller specify final tarball name.
Ryan C. Gordon <icculus@icculus.org>
parents:
7798
diff
changeset
|
14 |
if [ -z $1 ]; then |
76e4b6825efc
Raspberry Pi build script: let caller specify final tarball name.
Ryan C. Gordon <icculus@icculus.org>
parents:
7798
diff
changeset
|
15 |
TARBALL=sdl-raspberrypi.tar.bz2 |
76e4b6825efc
Raspberry Pi build script: let caller specify final tarball name.
Ryan C. Gordon <icculus@icculus.org>
parents:
7798
diff
changeset
|
16 |
fi |
7797
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
17 |
|
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
18 |
OSTYPE=`uname -s` |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
19 |
if [ "$OSTYPE" != "Linux" ]; then |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
20 |
# !!! FIXME |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
21 |
echo "This only works on x86 or x64-64 Linux at the moment." 1>&2 |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
22 |
exit 1 |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
23 |
fi |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
24 |
|
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
25 |
if [ "x$MAKE" == "x" ]; then |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
26 |
NCPU=`cat /proc/cpuinfo |grep vendor_id |wc -l` |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
27 |
let NCPU=$NCPU+1 |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
28 |
MAKE="make -j$NCPU" |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
29 |
fi |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
30 |
|
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
31 |
BUILDBOTDIR="raspberrypi-buildbot" |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
32 |
PARENTDIR="$PWD" |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
33 |
|
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
34 |
set -e |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
35 |
set -x |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
36 |
rm -f $TARBALL |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
37 |
rm -rf $BUILDBOTDIR |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
38 |
mkdir -p $BUILDBOTDIR |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
39 |
pushd $BUILDBOTDIR |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
40 |
|
7805
4f0f7b64afa5
Do a full sysroot for the Raspberry Pi buildbot.
Ryan C. Gordon <icculus@icculus.org>
parents:
7800
diff
changeset
|
41 |
SYSROOT="/opt/rpi-sysroot" |
8063
405d84eedad8
Enable ccache for Raspberry Pi buildbot script.
Ryan C. Gordon <icculus@icculus.org>
parents:
8007
diff
changeset
|
42 |
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" |
7805
4f0f7b64afa5
Do a full sysroot for the Raspberry Pi buildbot.
Ryan C. Gordon <icculus@icculus.org>
parents:
7800
diff
changeset
|
43 |
# -L$SYSROOT/usr/lib/arm-linux-gnueabihf" |
7797
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
44 |
# !!! FIXME: shouldn't have to --disable-* things here. |
7805
4f0f7b64afa5
Do a full sysroot for the Raspberry Pi buildbot.
Ryan C. Gordon <icculus@icculus.org>
parents:
7800
diff
changeset
|
45 |
../configure --with-sysroot=$SYSROOT --host=arm-raspberry-linux-gnueabihf --prefix=$PWD/rpi-sdl2-installed --disable-pulseaudio --disable-esd |
7797
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
46 |
$MAKE |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
47 |
$MAKE install |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
48 |
# Fix up a few things to a real install path on a real Raspberry Pi... |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
49 |
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 |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
50 |
mkdir -p ./usr |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
51 |
mv ./rpi-sdl2-installed ./usr/local |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
52 |
|
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
53 |
popd |
7800
76e4b6825efc
Raspberry Pi build script: let caller specify final tarball name.
Ryan C. Gordon <icculus@icculus.org>
parents:
7798
diff
changeset
|
54 |
tar -cjvvf $TARBALL -C $BUILDBOTDIR usr |
7797
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
55 |
rm -rf $BUILDBOTDIR |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
56 |
|
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
57 |
set +x |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
58 |
echo "All done. Final installable is in $TARBALL ..."; |
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
59 |
|
40543ce6e842
Added script that the buildbot will use for cross-compiling to Raspberry Pi.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
60 |