5 INCLUDEDIR=temp/bootstrap/include
6 REQUIRED="core datafile"
7 CFLAGS="-I$INCLUDEDIR `pkg-config --cflags sigc++-2.0`"
8 LIBS="`pkg-config --libs sigc++-2.0` -lpthread"
11 if [ "$MACHINE" = "x86_64" ]; then
12 MULTIARCH="x86_64-linux-gnu"
14 MULTIARCH="i386-linux-gnu"
16 if [ "$SYSTEM" = "Darwin" -o "$SYSTEM" = "FreeBSD" ]; then
17 if which clang++ >/dev/null; then
25 if [ -e /usr/lib/libdl.so -o -e /usr/lib/$MULTIARCH/libdl.so ]; then
36 LIBPATH="${1#--libpath=}"
43 PREFIX="${1#--prefix=}"
54 COMPILER="${1#--compiler=}"
61 echo "Unknown option $1"
68 if [ -z "$LIBPATH" -o "${LIBPATH%%/*}" ]; then
69 LIBPATH=`pwd`/${LIBPATH:-..}
73 mkdir -p "$INCLUDEDIR/msp"
77 use_overlays="unix generic"
79 for i in $REQUIRED; do
80 path=`ls -1d $LIBPATH/*$i* 2>/dev/null | head -n1`
81 if [ -z "$path" -o ! -d "$path/source" ]; then
82 missing="$missing msp$i"
84 if [ "`echo $path/source/*.cpp`" = "$path/source/*.cpp" ]; then
85 subdirs=`find "$path/source" -mindepth 1 -maxdepth 1 -type d`
87 subdirs="$path/source"
91 for j in $use_overlays; do
92 [ -z "$check_overlay" ] || check_overlay="$check_overlay -o "
93 check_overlay="${check_overlay}-name $j"
96 if [ "$check_overlay" ]; then
97 findargs="$findargs -mindepth 1 ( -type d ! ( $check_overlay ) -prune ) ,"
100 headers=`find $findargs -name '*.h'`
101 for j in $headers; do
102 rel=${j#$path/source/}
104 if [ "$comp" = "$rel" ]; then
107 mkdir -p "$INCLUDEDIR/msp/$comp"
108 ln -sf $j "$INCLUDEDIR/msp/$comp/"
110 sources="$sources `find $findargs -name '*.cpp'`"
114 if [ ! -z "$missing" ]; then
115 echo "The following libraries were not found:$missing"
116 echo "I looked for them in $LIBPATH"
117 echo "If they are somewhere else, please add --libpath=PATH to the command line."
121 echo "Compiling builder-stage1. This may take several minutes."
123 for i in $sources; do
124 obj=`mktemp temp/bootstrap/XXXXXX`
129 for j in $use_overlays; do
131 if [ -d "$dir/$j" ]; then
132 flags="$flags -iquote $dir -iquote $dir/$j"
136 $COMPILER -c $DEBUG $i -o $obj $flags
137 objects="$objects $obj"
139 $COMPILER $objects -o builder-stage1 $LIBS
141 if [ "$KEEP_TEMP" != "yes" ]; then
146 echo "Using builder-stage1 to compile builder."
148 if [ "$PREFIX" ]; then
149 ARGS="$ARGS --prefix='$PREFIX'"
151 if [ "$CUSTOM_COMPILER" = "yes" ]; then
152 ARGS="$ARGS CXX=$COMPILER"
154 eval "./builder-stage1 $ARGS"