]> git.tdb.fi Git - builder.git/blobdiff - bootstrap.sh
Refactor transitive dependencies to work on all targets
[builder.git] / bootstrap.sh
index 9497096ac31fbafc899dc00fda2ef37c3a46f9e7..b647568cb0347aa3eb1ab77193ef7581af5fc01b 100755 (executable)
@@ -2,13 +2,11 @@
 
 set -e
 
+SOURCEDIRS="source/lib source/bootstrap plugins/base plugins/gnu"
 INCLUDEDIR=temp/bootstrap/include
 REQUIRED="core datafile"
-CFLAGS="-I$INCLUDEDIR `pkg-config --cflags sigc++-2.0`"
+CFLAGS="-std=c++11 -iquote . -I$INCLUDEDIR `pkg-config --cflags sigc++-2.0`"
 LIBS="`pkg-config --libs sigc++-2.0` -lpthread"
-if pkg-config --exists "sigc++-2.0 >= 2.5.1"; then
-       CFLAGS="$CFLAGS -std=c++11"
-fi
 MACHINE="`uname -m`"
 SYSTEM="`uname -s`"
 if [ "$MACHINE" = "x86_64" ]; then
@@ -69,13 +67,16 @@ while [ "$1" ]; do
 done
 
 if [ -z "$LIBPATH" -o "${LIBPATH%%/*}" ]; then
-       LIBPATH=`pwd`/${LIBPATH:-..}
+       LIBPATH="$PWD/${LIBPATH:-..}"
 fi
 
 rm -rf "$INCLUDEDIR"
 mkdir -p "$INCLUDEDIR/msp"
 
-sources=source/*.cpp
+sources=`find $SOURCEDIRS -name '*.cpp'`
+
+mkdir -p "$INCLUDEDIR/msp/builder"
+ln -sf "$PWD/source/lib"/*.h "$INCLUDEDIR/msp/builder/"
 
 use_overlays="unix generic"
 missing=""
@@ -97,11 +98,10 @@ for i in $REQUIRED; do
                done
                findargs="$subdirs"
                if [ "$check_overlay" ]; then
-                       findargs="$findargs -mindepth 1 ( -type d ! ( $check_overlay ) -prune ) ,"
+                       findargs="$findargs -mindepth 1 ( -type d ! ( $check_overlay ) -prune -false ) -o "
                fi
 
-               headers=`find $findargs -name '*.h'`
-               for j in $headers; do
+               for j in `find $findargs -name '*.h'`; do
                        rel=${j#$path/source/}
                        comp=${rel%%/*}
                        if [ "$comp" = "$rel" ]; then
@@ -136,9 +136,11 @@ for i in $sources; do
                        break
                fi
        done
+       echo "Compiling $i"
        $COMPILER -c $DEBUG $i -o $obj $flags
        objects="$objects $obj"
 done
+echo "Linking builder-stage1"
 $COMPILER $objects -o builder-stage1 $LIBS
 
 if [ "$KEEP_TEMP" != "yes" ]; then
@@ -152,6 +154,6 @@ if [ "$PREFIX" ]; then
        ARGS="$ARGS --prefix='$PREFIX'"
 fi
 if [ "$CUSTOM_COMPILER" = "yes" ]; then
-       ARGS="$ARGS CXX=$COMPILER"
+       ARGS="$ARGS --compiler=$COMPILER"
 fi
 eval "./builder-stage1 $ARGS"