]> git.tdb.fi Git - builder.git/blobdiff - bootstrap.sh
Force shared linking on Android
[builder.git] / bootstrap.sh
index 48a4f206bb75b673280bc5fc331dc8ec2608b4e5..f198f6f6ad5526b5045c654e5319a4f05922ce8d 100755 (executable)
@@ -14,8 +14,12 @@ if [ "$MACHINE" = "x86_64" ]; then
 else
        MULTIARCH="i386-linux-gnu"
 fi
-if [ "$SYSTEM" = "Darwin" ]; then
-       COMPILER="clang++"
+if [ "$SYSTEM" = "Darwin" -o "$SYSTEM" = "FreeBSD" ]; then
+       if which clang++ >/dev/null; then
+               COMPILER="clang++"
+       else
+               COMPILER="g++"
+       fi
 else
        COMPILER="g++"
 fi
@@ -42,6 +46,18 @@ while [ "$1" ]; do
        --keep-temp)
                KEEP_TEMP=yes
                ;;
+       --compiler)
+               shift
+               COMPILER="$1"
+               CUSTOM_COMPILER=yes
+               ;;
+       --compiler=*)
+               COMPILER="${1#--compiler=}"
+               CUSTOM_COMPILER=yes
+               ;;
+       --debug)
+               DEBUG=-g
+               ;;
        *)
                echo "Unknown option $1"
                exit 1
@@ -98,7 +114,7 @@ for i in $sources; do
        if [ -d "$dir/unix" ]; then
                flags="$flags -iquote $dir -iquote $dir/unix"
        fi
-       $COMPILER -c $i -o $obj $flags
+       $COMPILER -c $DEBUG $i -o $obj $flags
        objects="$objects $obj"
 done
 $COMPILER $objects -o builder-stage1 $LIBS
@@ -113,4 +129,7 @@ ARGS=
 if [ "$PREFIX" ]; then
        ARGS="$ARGS --prefix='$PREFIX'"
 fi
+if [ "$CUSTOM_COMPILER" = "yes" ]; then
+       ARGS="$ARGS CXX=$COMPILER"
+fi
 eval "./builder-stage1 $ARGS"