home · contact · privacy
7DRL: Some population balancing.
[plomrogue] / redo
1 #!/bin/sh
2
3 # The purpose of this script is to step in if no version of the "redo" build
4 # system is installed on your system to interpret the files that (Makefile-like)
5 # build the PlomRogue system: ./all.do, ./roguelike-client.do and
6 # ./roguelike-server.do.
7
8 # If a version of "redo" is installed on your system and in your $PATH, just run
9 # "redo roguelike-client", "redo roguelike-server" or plain "redo" (to build
10 # both via all.do). Otherwise, run this very script with the very same
11 # arguments. It uses parts of a basic "redo" implementation written by Nils
12 # Dagsson Moskopp a.k.a. erlehmann, snapshots of which are stored in
13 # build/redo_scripts/. For details on this version, see:
14 # - <http://news.dieweltistgarnichtso.net/bin/redo.html>
15 # - <http://news.dieweltistgarnichtso.net/bin/redo-ifchange.html>
16
17 # Some tests first: for gcc, and certain necessary header files. (This is not
18 # strictly the responsibility of a mere redo wrapper. But those using a
19 # pre-installed redo probably will be fine with the error messages thrown by it
20 # if these miss.)
21 test=`command -v gcc | wc -l`
22 if [ 1 != $test ]
23 then
24     echo "FAILURE:"
25     echo "No gcc installed, but it's needed!"
26     exit 1
27 fi
28 test_header() {
29     code="#include <$1>"
30     test=`echo $code | cpp -H -o /dev/null 2>&1 | head -n1 | grep error | wc -l`
31     if [ 0 != $test ]
32     then
33         echo "FAILURE:"
34         echo "No $1 header file found, but it's needed!"
35         echo "Maybe install some $2 package?"
36         exit 1
37     fi
38 }
39 test_header stdlib.h libc6-dev      # Assume stdlib.h guarantees full libc6-dev.
40 test_header ncurses.h libncurses5-dev
41
42 # The actual redo calling.
43 export PATH=$PATH:$PWD/build/redo_scripts
44 redo "$@"