home · contact · privacy
Fix buggy healthy_addch().
[plomrogue] / build.sh
1 #!/bin/sh
2
3 # This file is part of PlomRogue. PlomRogue is licensed under the GPL version 3
4 # or any later version. For details on its copyright, license, and warranties,
5 # see the file NOTICE in the root directory of the PlomRogue source package.
6
7 set -e
8
9 OFLAG='-O3'
10 CFLAGS="-std=c11 -pedantic-errors -Wall -Werror -Wextra -Wformat-security $OFLAG"
11
12 # For non-GNU gcc masks, drop all gcc-specific debugging flags.
13 test=`stat --version 2>&1 | grep 'Free Software Foundation' | wc -l`
14 if [ 1 -gt $test ]
15 then
16     CFLAGS=$OFLAG
17 fi
18
19 # Some tests: for gcc, and certain necessary header files.
20 test=`command -v gcc | wc -l`
21 if [ 1 != $test ]
22 then
23     echo "FAILURE:"
24     echo "No gcc installed, but it's needed!"
25     exit 1
26 fi
27 test_header() {
28     code="#include <$1>"
29     test=`echo $code | cpp -H -o /dev/null 2>&1 | head -n1 | grep error | wc -l`
30     if [ 0 != $test ]
31     then
32         echo "FAILURE:"
33         echo "No $1 header file found, but it's needed!"
34         echo "Maybe install some $2 package?"
35         exit 1
36     fi
37 }
38 test_header stdlib.h libc6-dev      # Assume stdlib.h guarantees full libc6-dev.
39
40 # Compilation proper.
41 gcc -shared -fPIC $CFLAGS -o libplomrogue.so libplomrogue.c -lm