]> git.tdb.fi Git - builder.git/blob - bootstrap.sh
Make bootstrap.sh more POSIX compliant
[builder.git] / bootstrap.sh
1 #!/bin/sh
2 # $Id$
3
4 set -e
5
6 REQUIRED="core datafile fs strings io"
7 CFLAGS="-Iinclude `pkg-config --cflags sigc++-2.0`"
8 LIBS="`pkg-config --libs sigc++-2.0` -lpthread"
9 if [ -e /usr/lib/libdl.so ]; then
10         LIBS="$LIBS -ldl"
11 fi
12 if [ -z "$LIBPATH" -o "${LIBPATH%%/*}" ]; then
13         LIBPATH=`pwd`/${LIBPATH:-..}
14 fi
15
16 rm -rf include
17 mkdir -p include/msp
18
19 sources=source/*.cpp
20
21 for i in $REQUIRED; do
22         path=`ls -1d $LIBPATH/*$i* 2>/dev/null | head -n1`
23         if [ -z "$path" ]; then
24                 echo msp$i missing
25                 exit 1
26         fi
27         if [ $i = "core" ]; then
28                 ln -sf $path/source/* include/msp/
29         else
30                 ln -sf $path/source include/msp/$i
31         fi
32         sources="$sources `find $path/source -name '*.cpp'`"
33 done
34
35 echo "Compiling builder-stage1.  This may take several minutes."
36 g++ $sources -o builder-stage1 $CFLAGS $LIBS
37 echo "Done."