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