]> git.tdb.fi Git - builder.git/blob - bootstrap.sh
Make bootstrap.sh create the staging include directory in temp
[builder.git] / bootstrap.sh
1 #!/bin/sh
2 # $Id$
3
4 set -e
5
6 INCLUDEDIR=temp/bootstrap/include
7 REQUIRED="core datafile"
8 CFLAGS="-I$INCLUDEDIR `pkg-config --cflags sigc++-2.0`"
9 LIBS="`pkg-config --libs sigc++-2.0` -lpthread"
10 MACHINE="`uname -m`"
11 if [ "$MACHINE" = "x86_64" ]; then
12         MULTIARCH="x86_64-linux-gnu"
13 else
14         MULTIARCH="i386-linux-gnu"
15 fi
16 if [ -e /usr/lib/libdl.so -o -e /usr/lib/$MULTIARCH/libdl.so ]; then
17         LIBS="$LIBS -ldl"
18 fi
19 if [ -z "$LIBPATH" -o "${LIBPATH%%/*}" ]; then
20         LIBPATH=`pwd`/${LIBPATH:-..}
21 fi
22
23 rm -rf "$INCLUDEDIR"
24 mkdir -p "$INCLUDEDIR/msp"
25
26 sources=source/*.cpp
27
28 missing=""
29 for i in $REQUIRED; do
30         path=`ls -1d $LIBPATH/*$i* 2>/dev/null | head -n1`
31         if [ -z "$path"  -o ! -d "$path/source" ]; then
32                 missing="$missing msp$i"
33         else
34                 if [ $i = "core" ]; then
35                         ln -sf $path/source/* "$INCLUDEDIR/msp/"
36                 else
37                         ln -sf $path/source "$INCLUDEDIR/msp/$i"
38                 fi
39                 sources="$sources `find $path/source -name '*.cpp'`"
40         fi
41 done
42
43 if [ ! -z "$missing" ]; then
44         echo "The following libraries were not found:$missing"
45         echo "I looked for them in $LIBPATH"
46         echo "If they are somewhere else, please adjust the LIBPATH environment variable."
47         exit 1
48 fi
49
50 echo "Compiling builder-stage1.  This may take several minutes."
51 g++ $sources -o builder-stage1 $CFLAGS $LIBS
52 echo "Using builder-stage1 to compile builder."
53 ./builder-stage1