From f5b80b7128461f209b901d1ae286970b763cd70e Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 11 Mar 2016 17:12:44 +0200 Subject: Detect host triplet (with help of config.{guess,sub}) in bootstrap --- .gitmodules | 3 +++ bootstrap | 33 ++++++++++++++++++++++++++++----- buildfile | 6 +++++- config | 1 + config.guess | 1 + config.sub | 1 + 6 files changed, 39 insertions(+), 6 deletions(-) create mode 160000 config create mode 120000 config.guess create mode 120000 config.sub diff --git a/.gitmodules b/.gitmodules index 144e9f5..262e382 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "doc/style"] path = doc/style url = ../etc/style.git +[submodule "config"] + path = config + url = git://git.sv.gnu.org/config.git diff --git a/bootstrap b/bootstrap index 6ddb872..6ac5499 100755 --- a/bootstrap +++ b/bootstrap @@ -1,13 +1,16 @@ #!/bin/sh +usage="Usage: $0 [--help] [--cxx ] [--cxxflags ] []" + cxx=g++ cxxflags= libbutl= +host= while test $# -ne 0; do case $1 in --help) - echo "Usage: $0 [--help] [--cxx ] [--cxxflags ]" 1>&2 + echo "$usage" 1>&2 echo "See the INSTALL file for details." 1>&2 exit 0 ;; @@ -15,6 +18,7 @@ while test $# -ne 0; do shift if test $# -eq 0; then echo "error: c++ compiler executable expected after --cxx" 1>&2 + echo "$usage" 1>&2 exit 1 fi cxx=$1 @@ -24,6 +28,7 @@ while test $# -ne 0; do shift if test $# -eq 0; then echo "error: c++ compiler flags expected after --cxxflags" 1>&2 + echo "$usage" 1>&2 exit 1 fi cxxflags=$1 @@ -33,6 +38,7 @@ while test $# -ne 0; do shift if test $# -eq 0; then echo "error: libbutl path expected after --libbutl" 1>&2 + echo "$usage" 1>&2 exit 1 fi if test ! -d "$1"; then @@ -43,12 +49,27 @@ while test $# -ne 0; do shift ;; *) - echo "error: unknown option $1" 1>&2 - exit 1 + host=$1 + shift ;; esac done +if test -z "$host"; then + if ! host=`./config.guess`; then + echo "error: unable to guess host triplet" 1>&2 + exit 1 + fi +else + if ! chost=`./config.sub $host`; then + echo "error: unable to canonicalize host triplet '$host'" 1>&2 + exit 1 + fi + host=$chost +fi + +echo "using $host as build2 host" 1>&2 + # See if there is libbutl or libbutl-* in the current directory and # one directory up. # @@ -79,6 +100,8 @@ if test -z "$libbutl"; then exit 1 fi +cppflags='-DBUILD2_HOST_TRIPLET="'$host'"' + src="build2/*.cxx" src="$src build2/config/*.cxx" src="$src build2/dist/*.cxx" @@ -89,5 +112,5 @@ src="$src build2/test/*.cxx" src="$src build2/install/*.cxx" src="$src $libbutl/butl/*.cxx" -echo $cxx -std=c++1y $cxxflags -I$libbutl -I. -o build2/b-boot $src 1>&2 -exec $cxx -std=c++1y $cxxflags -I$libbutl -I. -o build2/b-boot $src +echo $cxx -std=c++1y -I$libbutl -I. $cppflags $cxxflags -o build2/b-boot $src 1>&2 +exec $cxx -std=c++1y -I$libbutl -I. $cppflags $cxxflags -o build2/b-boot $src diff --git a/buildfile b/buildfile index 9c928bc..4cca56d 100644 --- a/buildfile +++ b/buildfile @@ -3,7 +3,11 @@ # license : MIT; see accompanying LICENSE file d = build2/ tests/ doc/ -./: $d doc{INSTALL LICENSE version} file{INSTALL.cli bootstrap manifest} + +./: $d \ +doc{INSTALL LICENSE version} \ +file{INSTALL.cli config.guess config.sub bootstrap manifest} + include $d doc{INSTALL*}: install = false diff --git a/config b/config new file mode 160000 index 0000000..bb8fb40 --- /dev/null +++ b/config @@ -0,0 +1 @@ +Subproject commit bb8fb4029563dcd564ece143ce558ea44c720a15 diff --git a/config.guess b/config.guess new file mode 120000 index 0000000..e262c70 --- /dev/null +++ b/config.guess @@ -0,0 +1 @@ +config/config.guess \ No newline at end of file diff --git a/config.sub b/config.sub new file mode 120000 index 0000000..c5e70f7 --- /dev/null +++ b/config.sub @@ -0,0 +1 @@ +config/config.sub \ No newline at end of file -- cgit v1.1