]> git.tdb.fi Git - builder.git/blob - bootstrap.sh
Adjust to library changes
[builder.git] / bootstrap.sh
1 #!/bin/sh
2 # $Id$
3
4 set -e
5
6 REQUIRED="core datafile"
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 missing=""
22 for i in $REQUIRED; do
23         path=`ls -1d $LIBPATH/*$i* 2>/dev/null | head -n1`
24         if [ -z "$path"  -o ! -d "$path/source" ]; then
25                 missing="$missing msp$i"
26         else
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         fi
34 done
35
36 if [ ! -z "$missing" ]; then
37         echo "The following libraries were not found:$missing"
38         echo "I looked for them in $LIBPATH"
39         echo "If they are somewhere else, please adjust the LIBPATH environment variable."
40         exit 1
41 fi
42
43 echo "Compiling builder-stage1.  This may take several minutes."
44 g++ $sources -o builder-stage1 $CFLAGS $LIBS
45 echo "Using builder-stage1 to compile builder."
46 ./builder-stage1