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"
9 if pkg-config --exists "sigc++-2.0 >= 2.5.1"; then
10 CFLAGS="$CFLAGS -std=c++11"
14 if [ "$MACHINE" = "x86_64" ]; then
15 MULTIARCH="x86_64-linux-gnu"
17 MULTIARCH="i386-linux-gnu"
19 if [ "$SYSTEM" = "Darwin" -o "$SYSTEM" = "FreeBSD" ]; then
20 if which clang++ >/dev/null; then
28 if [ -e /usr/lib/libdl.so -o -e /usr/lib/$MULTIARCH/libdl.so ]; then
39 LIBPATH="${1#--libpath=}"
46 PREFIX="${1#--prefix=}"
57 COMPILER="${1#--compiler=}"
64 echo "Unknown option $1"
71 if [ -z "$LIBPATH" -o "${LIBPATH%%/*}" ]; then
72 LIBPATH=`pwd`/${LIBPATH:-..}
76 mkdir -p "$INCLUDEDIR/msp"
80 use_overlays="unix generic"
82 for i in $REQUIRED; do
83 path=`ls -1d $LIBPATH/*$i* 2>/dev/null | head -n1`
84 if [ -z "$path" -o ! -d "$path/source" ]; then
85 missing="$missing msp$i"
87 if [ "`echo $path/source/*.cpp`" = "$path/source/*.cpp" ]; then
88 subdirs=`find "$path/source" -mindepth 1 -maxdepth 1 -type d`
90 subdirs="$path/source"
94 for j in $use_overlays; do
95 [ -z "$check_overlay" ] || check_overlay="$check_overlay -o "
96 check_overlay="${check_overlay}-name $j"
99 if [ "$check_overlay" ]; then
100 findargs="$findargs -mindepth 1 ( -type d ! ( $check_overlay ) -prune -false ) -o "
103 headers=`find $findargs -name '*.h'`
104 for j in $headers; do
105 rel=${j#$path/source/}
107 if [ "$comp" = "$rel" ]; then
110 mkdir -p "$INCLUDEDIR/msp/$comp"
111 ln -sf $j "$INCLUDEDIR/msp/$comp/"
113 sources="$sources `find $findargs -name '*.cpp'`"
117 if [ ! -z "$missing" ]; then
118 echo "The following libraries were not found:$missing"
119 echo "I looked for them in $LIBPATH"
120 echo "If they are somewhere else, please add --libpath=PATH to the command line."
124 echo "Compiling builder-stage1. This may take several minutes."
126 for i in $sources; do
127 obj=`mktemp temp/bootstrap/XXXXXX`
132 for j in $use_overlays; do
134 if [ -d "$dir/$j" ]; then
135 flags="$flags -iquote $dir -iquote $dir/$j"
139 $COMPILER -c $DEBUG $i -o $obj $flags
140 objects="$objects $obj"
142 $COMPILER $objects -o builder-stage1 $LIBS
144 if [ "$KEEP_TEMP" != "yes" ]; then
149 echo "Using builder-stage1 to compile builder."
151 if [ "$PREFIX" ]; then
152 ARGS="$ARGS --prefix='$PREFIX'"
154 if [ "$CUSTOM_COMPILER" = "yes" ]; then
155 ARGS="$ARGS CXX=$COMPILER"
157 eval "./builder-stage1 $ARGS"