From 1a8a287a4f6cc441240dd2e58d243a03c341eea3 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 15 Aug 2016 08:14:22 +0200 Subject: Rename bootstrap to bootstrap.sh Since it is a POSIX shell script (as opposed to bash script) and since we are going to have bootstrap-*.bat. --- INSTALL.cli | 8 ++-- bootstrap | 118 ----------------------------------------------------------- bootstrap.sh | 118 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ buildfile | 2 +- 4 files changed, 123 insertions(+), 123 deletions(-) delete mode 100755 bootstrap create mode 100755 bootstrap.sh diff --git a/INSTALL.cli b/INSTALL.cli index 723237b..659b803 100644 --- a/INSTALL.cli +++ b/INSTALL.cli @@ -12,7 +12,7 @@ later and Clang 3.4 or later are known to work. \c{build2} is self-hosted, which means that unless you have obtained a pre-built binary from somewhere else, you will need to bootstrap it. To -accomplish this, use the '\c{bootstrap}' shell script found in the root +accomplish this, use the '\c{bootstrap.sh}' shell script found in the root directory of the \c{build2} distribution. The following is the recommended sequence of steps: @@ -31,13 +31,13 @@ build2/ (or build2-X.Y.Z/) \li|\n2. Bootstrapping\n -Change to the \c{build2/} directory and execute \c{bootstrap} specifying +Change to the \c{build2/} directory and execute \c{bootstrap.sh} specifying the C++ compiler to be used, if necessary (default is \c{g++}; run -\c{./bootstrap --help} for other options). For example: +\c{./bootstrap.sh --help} for other options). For example: \ $ cd build2/ -$ ./bootstrap --cxx clang++-3.5 +$ ./bootstrap.sh --cxx clang++-3.5 \ Once the script completes successfully (which may take some time), the diff --git a/bootstrap b/bootstrap deleted file mode 100755 index 24261b8..0000000 --- a/bootstrap +++ /dev/null @@ -1,118 +0,0 @@ -#!/bin/sh - -usage="Usage: $0 [--help] [--cxx ] [--cxxflags ] []" - -cxx=g++ -cxxflags= -libbutl= -host= - -while test $# -ne 0; do - case $1 in - --help) - echo "$usage" 1>&2 - echo "See the INSTALL file for details." 1>&2 - exit 0 - ;; - --cxx) - 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 - shift - ;; - --cxxflags) - 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 - shift - ;; - --libbutl) - 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 - echo "error: libbutl directory '$1' does not exist" 1>&2 - exit 1 - fi - libbutl=$1 - shift - ;; - *) - 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. -# -if test -z "$libbutl"; then - if test -d libbutl; then - libbutl=libbutl - else - libbutl=`echo libbutl-*/` - if test ! -d "$libbutl"; then - libbutl= - fi - fi -fi - -if test -z "$libbutl"; then - if test -d ../libbutl; then - libbutl=../libbutl - else - libbutl=`echo ../libbutl-*/` - if test ! -d "$libbutl"; then - libbutl= - fi - fi -fi - -if test -z "$libbutl"; then - echo "error: unable to find libbutl, use --libbutl to specify its location" 1>&2 - exit 1 -fi - -cppflags='-DBUILD2_HOST_TRIPLET="'$host'"' - -src="build2/*.cxx" -src="$src build2/config/*.cxx" -src="$src build2/dist/*.cxx" -src="$src build2/bin/*.cxx" -src="$src build2/c/*.cxx" -src="$src build2/cc/*.cxx" -src="$src build2/cxx/*.cxx" -src="$src build2/cli/*.cxx" -src="$src build2/test/*.cxx" -src="$src build2/install/*.cxx" -src="$src $libbutl/butl/*.cxx" - -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/bootstrap.sh b/bootstrap.sh new file mode 100755 index 0000000..24261b8 --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1,118 @@ +#!/bin/sh + +usage="Usage: $0 [--help] [--cxx ] [--cxxflags ] []" + +cxx=g++ +cxxflags= +libbutl= +host= + +while test $# -ne 0; do + case $1 in + --help) + echo "$usage" 1>&2 + echo "See the INSTALL file for details." 1>&2 + exit 0 + ;; + --cxx) + 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 + shift + ;; + --cxxflags) + 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 + shift + ;; + --libbutl) + 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 + echo "error: libbutl directory '$1' does not exist" 1>&2 + exit 1 + fi + libbutl=$1 + shift + ;; + *) + 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. +# +if test -z "$libbutl"; then + if test -d libbutl; then + libbutl=libbutl + else + libbutl=`echo libbutl-*/` + if test ! -d "$libbutl"; then + libbutl= + fi + fi +fi + +if test -z "$libbutl"; then + if test -d ../libbutl; then + libbutl=../libbutl + else + libbutl=`echo ../libbutl-*/` + if test ! -d "$libbutl"; then + libbutl= + fi + fi +fi + +if test -z "$libbutl"; then + echo "error: unable to find libbutl, use --libbutl to specify its location" 1>&2 + exit 1 +fi + +cppflags='-DBUILD2_HOST_TRIPLET="'$host'"' + +src="build2/*.cxx" +src="$src build2/config/*.cxx" +src="$src build2/dist/*.cxx" +src="$src build2/bin/*.cxx" +src="$src build2/c/*.cxx" +src="$src build2/cc/*.cxx" +src="$src build2/cxx/*.cxx" +src="$src build2/cli/*.cxx" +src="$src build2/test/*.cxx" +src="$src build2/install/*.cxx" +src="$src $libbutl/butl/*.cxx" + +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 cd8cf12..c60a1be 100644 --- a/buildfile +++ b/buildfile @@ -6,7 +6,7 @@ d = build2/ tests/ doc/ ./: $d \ doc{INSTALL LICENSE NEWS README version} \ -file{INSTALL.cli config.guess config.sub bootstrap manifest} +file{INSTALL.cli config.guess config.sub bootstrap.sh manifest} include $d -- cgit v1.1