From d55ca711f134c6e4231c99e7d3968105aea59dc9 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sun, 3 Nov 2019 22:15:11 +0100 Subject: [PATCH] build: Cater for bootstrap build. * build-aux/build.sh.in: Build bin/mes. Update scripts and users. * build-aux/bootstrap.sh.in: Update. * build-aux/install.sh.in: Install all built bin/mes-* flavours. * configure: Drop SEED, support --bootstrap. * configure.sh: Likewise. --- .gitignore | 28 ---------------------------- build-aux/GNUmakefile.in | 3 ++- build-aux/bootstrap.sh.in | 6 ++++-- build-aux/build-mes.sh | 3 ++- build-aux/build.sh.in | 11 +++++++++-- build-aux/config.make.in | 3 +-- build-aux/config.sh.in | 1 - build-aux/export.make | 4 ---- build-aux/install.sh.in | 8 +++++++- build-aux/pre-inst-env.in | 4 ++-- configure | 34 +++++++++++++++------------------- configure.sh | 20 +++++++++----------- doc/mes.texi | 2 +- tests/catch.test | 2 +- tests/closure.test | 2 +- tests/cwv.test | 2 +- tests/display.test | 2 +- tests/fluids.test | 2 +- tests/getopt-long.test | 2 +- tests/guile.test | 2 +- tests/let-syntax.test | 2 +- tests/let.test | 2 +- tests/macro.test | 2 +- tests/match.test | 2 +- tests/math.test | 2 +- tests/module.test | 2 +- tests/optargs.test | 2 +- tests/peg.test | 2 +- tests/perform.test | 2 +- tests/pmatch.test | 2 +- tests/posix.test | 2 +- tests/psyntax.test | 2 +- tests/read.test | 2 +- tests/srfi-0.test | 2 +- tests/srfi-1.test | 2 +- tests/srfi-13.test | 2 +- tests/srfi-14.test | 2 +- tests/srfi-16.test | 2 +- tests/srfi-43.test | 2 +- tests/srfi-9.test | 2 +- tests/syntax.test | 2 +- tests/vector.test | 2 +- 42 files changed, 81 insertions(+), 104 deletions(-) diff --git a/.gitignore b/.gitignore index 8826fb66..c6dd5e9f 100644 --- a/.gitignore +++ b/.gitignore @@ -85,34 +85,6 @@ !/scaffold/tests/*.exit !/scaffold/tests/*.stdout -/src/mes.mes.symbols.h -/src/gc.mes.h -/src/hash.mes.h -/src/lib.mes.h -/src/math.mes.h -/src/mes.mes.h -/src/module.mes.h -/src/posix.mes.h -/src/reader.mes.h -/src/strings.mes.h -/src/struct.mes.h -/src/vector.mes.h -/src/gc.mes.i -/src/hash.mes.i -/src/lib.mes.i -/src/math.mes.i -/src/mes.mes.i -/src/module.mes.i -/src/posix.mes.i -/src/reader.mes.i -/src/strings.mes.i -/src/struct.mes.i -/src/vector.mes.i - -/src/mes -/src/x86-mes-mes -/src/x86_64-mes-mes - /.config.make /.store /.tarball-version diff --git a/build-aux/GNUmakefile.in b/build-aux/GNUmakefile.in index a4eb271e..4bc8a48a 100644 --- a/build-aux/GNUmakefile.in +++ b/build-aux/GNUmakefile.in @@ -97,7 +97,7 @@ build: src/${program_prefix}mes: build clean: - rm -f *.o *.s src/mes + rm -f *.o *.s bin/mes bin/mes-gcc bin/mes-mescc rm -f mes.{aux,cp,cps,fn,info,log,tmp,toc,vr,vrs} rm -f .log build.log rm -f 0exit-42 0hello-mes exit-42 body-exit-42 body-hello-mes hello-mes @@ -112,6 +112,7 @@ clean: rm -rf mescc-lib/*.o mescc-lib/*.s mescc-lib/*.a mescc-lib/*-mes rm -f mescc-lib/libc+gnu.c rm -f mescc-lib/.log mescc-lib/build.log + rm -rf mescc/bin rm -f scaffold/boot/*.log scaffold/boot/*.trs rm -f test-suite.log tests/*.log tests/*.trs rm -f scaffold/*.s scaffold/*.o diff --git a/build-aux/bootstrap.sh.in b/build-aux/bootstrap.sh.in index 108d577b..59de6585 100644 --- a/build-aux/bootstrap.sh.in +++ b/build-aux/bootstrap.sh.in @@ -96,8 +96,10 @@ for c in $mes_SOURCES; do fi objects="$objects $o" done -echo " CCLD src/mes" -$CC -nostdlib -o src/mes -L mescc-lib mescc-lib/crt1.o $objects -lc +echo " CCLD bin/mes-mescc" +mkdir -p bin +$CC -nostdlib -o bin/mes-mescc -L mescc-lib mescc-lib/crt1.o $objects -lc +cp bin/mes-mescc bin/mes ( mkdir -p gcc-lib diff --git a/build-aux/build-mes.sh b/build-aux/build-mes.sh index 6a6b84bd..4e388c4f 100755 --- a/build-aux/build-mes.sh +++ b/build-aux/build-mes.sh @@ -53,4 +53,5 @@ done if test $mes_libc = system; then LIBS=-lmes fi -link src/mes +link bin/mes-$compiler +cp bin/mes-$compiler bin/mes diff --git a/build-aux/build.sh.in b/build-aux/build.sh.in index 24b417ef..907e4bba 100644 --- a/build-aux/build.sh.in +++ b/build-aux/build.sh.in @@ -43,7 +43,9 @@ if $courageous; then set +e fi -${SHELL} ${srcdest}build-aux/build-scaffold.sh +if test "$compiler" != bootstrap; then + ${SHELL} ${srcdest}build-aux/build-scaffold.sh +fi if test -n "$GUILE" -a "$GUILE" != true; then ${SHELL} ${srcdest}build-aux/build-guile.sh @@ -73,6 +75,7 @@ fi compiler=gcc ${SHELL} ${srcdest}build-aux/build-source-lib.sh ) + ( if test $compiler = gcc; then AM_LDFLAGS="$AM_LDFLAGS @@ -86,7 +89,9 @@ fi -I ${srcdest}include -I ${srcdest}include/$mes_kernel/$mes_cpu " - ${SHELL} ${srcdest}build-aux/build-mes.sh + if test "$compiler" != bootstrap; then + ${SHELL} ${srcdest}build-aux/build-mes.sh + fi ) ( @@ -118,5 +123,7 @@ fi ${SHELL} ${srcdest}build-aux/build-source-lib.sh if $bootstrap; then ${SHELL} ${srcdest}build-aux/build-mes.sh + cp -f bin/mes-mescc ../bin + cp -f bin/mes ../bin fi ) diff --git a/build-aux/config.make.in b/build-aux/config.make.in index 1d8e4087..0bedf911 100644 --- a/build-aux/config.make.in +++ b/build-aux/config.make.in @@ -35,7 +35,6 @@ LDFLAGS:=@LDFLAGS@ MAKEINFO:=@MAKEINFO@ M1:=@M1@ MES_FOR_BUILD:=@MES_FOR_BUILD@ -MES_SEED:=@MES_SEED@ NYACC:=@NYACC@ PACKAGE:=@PACKAGE@ PACKAGE_NAME:=@PACKAGE_NAME@ @@ -53,7 +52,7 @@ arch:=@arch@ build:=@build@ host:=@host@ -bootstrap:= +bootstrap:=@bootstrap@ compiler:=@compiler@ courageous:=@courageous@ mes_system:=@mes_system@ diff --git a/build-aux/config.sh.in b/build-aux/config.sh.in index 0f3783f2..affc2d60 100644 --- a/build-aux/config.sh.in +++ b/build-aux/config.sh.in @@ -36,7 +36,6 @@ LDFLAGS=${LDFLAGS-"@LDFLAGS@"} MAKEINFO="@MAKEINFO@" M1="@M1@" MES_FOR_BUILD="@MES_FOR_BUILD@" -MES_SEED="@MES_SEED@" NYACC="@NYACC@" PACKAGE="@PACKAGE@" PACKAGE_NAME="@PACKAGE_NAME@" diff --git a/build-aux/export.make b/build-aux/export.make index 6876c8e4..d8ca89e0 100644 --- a/build-aux/export.make +++ b/build-aux/export.make @@ -83,10 +83,6 @@ ifdef MES_FOR_BUILD export MES_FOR_BUILD endif -ifdef MES_SEED -export MES_SEED -endif - ifdef MESCC export MESCC endif diff --git a/build-aux/install.sh.in b/build-aux/install.sh.in index c8ecb67e..36dbf1bf 100644 --- a/build-aux/install.sh.in +++ b/build-aux/install.sh.in @@ -43,7 +43,13 @@ fi DESTDIR=${DESTDIR-} mkdir -p ${DESTDIR}${bindir} -cp $_v src/mes ${DESTDIR}${bindir}/mes +cp $_v bin/mes ${DESTDIR}${bindir}/mes +if test -f bin/mes-gcc; then + cp $_v bin/mes-gcc ${DESTDIR}${bindir}/mes-gcc +fi +if test -f bin/mes-mescc; then + cp $_v bin/mes-mescc ${DESTDIR}${bindir}/mes-mescc +fi cp $_v scripts/mesar ${DESTDIR}${bindir}/mesar cp $_v scripts/mescc.scm ${DESTDIR}${bindir}/mescc.scm cp $_v scripts/mescc ${DESTDIR}${bindir}/mescc diff --git a/build-aux/pre-inst-env.in b/build-aux/pre-inst-env.in index 3f6201ac..b8ef1151 100644 --- a/build-aux/pre-inst-env.in +++ b/build-aux/pre-inst-env.in @@ -36,10 +36,10 @@ if [ -n "$srcdest" ]; then fi export GUILE_LOAD_COMPILED_PATH GUILE_LOAD_PATH -PATH="$abs_top_builddir/scripts:$abs_top_builddir/scripts:$abs_top_builddir/src:$abs_top_builddir/build-aux:$PATH" +PATH="$abs_top_builddir/scripts:$abs_top_builddir/scripts:$abs_top_builddir/bin:$abs_top_builddir/build-aux:$PATH" export PATH -MES=${MES-${abs_top_builddir}/src/${program_prefix}mes} +MES=${MES-${abs_top_builddir}/bin/${program_prefix}mes} export MES bindir=${abs_top_builddir}/scripts diff --git a/configure b/configure index e45734ab..1e52a57a 100755 --- a/configure +++ b/configure @@ -378,10 +378,11 @@ Ignored for Debian: Some influential environment variables: CC C compiler command CFLAGS C compiler flags + CPPFLAGS C preprocessor flags + LDFLAGS C linker flags GUILE guile command GUILD guild command MES_FOR_BUILD build system MES [can be mes or guile] - MES_SEED location of mes-seed " PACKAGE VERSION (getenv "prefix"))) (define (main args) @@ -435,12 +436,7 @@ Some influential environment variables: (when %verbose? (stderr "configure args=~s\n" args)) (for-each (lambda (v) (apply setenv (string-split v #\=))) vars) - (let* ((mes-seed (or (getenv "MES_SEED") - (string-append srcdest "../mes-seed"))) - (mes-seed (and mes-seed - (file-exists? (string-append mes-seed "/x86-mes/mes.S")) - mes-seed)) - (tinycc-prefix (or (getenv "TINYCC_PREFIX") + (let* ((tinycc-prefix (or (getenv "TINYCC_PREFIX") (string-append srcdest "../tinycc-prefix"))) (cross? (not (equal? host-type build-type))) (gcc (or (getenv "CC") (if cross? (string-append host-type "-" "gcc") "gcc"))) @@ -575,7 +571,7 @@ See \"Porting GNU Mes\" in the manual, or try --with-courage\n" mes-system) ("@build@" . ,build-type) ("@host@" . ,host-type) - ("@bootstrap@" . ,(if with-courage? "true" "false")) + ("@bootstrap@" . ,(if with-bootstrap? "true" "false")) ("@courageous@" . ,(if with-courage? "true" "false")) ("@compiler@" . ,compiler) ("@mes_bits@" . ,mes-bits) @@ -621,7 +617,6 @@ See \"Porting GNU Mes\" in the manual, or try --with-courage\n" mes-system) ("@MAKEINFO@" . ,(or (file-name "makeinfo" deps) "")) ("@MES_FOR_BUILD@" . ,(or (file-name "mes" deps) guile)) - ("@MES_SEED@" . ,(or mes-seed "")) ("@PERL@" . ,(or (file-name "perl" deps) "")) ("#SCHEME=\"@SCHEME@\"" . ,(if with-cheating? (string-append "\nSCHEME=\"" guile "\"") "")) ("@SCHEME@" . ,(if with-cheating? guile "")) @@ -639,9 +634,8 @@ See \"Porting GNU Mes\" in the manual, or try --with-courage\n" mes-system) (cons (string-append "@" (variable-name o) "@") (or (format #f "~a" (dependency-file-name o)) ""))) deps)))) - (when (and (not cc) - (not mes-seed)) - (format (current-error-port) "must supply C compiler or MES_SEED/x86-mes/mes.S\n") + (unless cc + (format (current-error-port) "must supply a C compiler") (exit 2)) (for-each (lambda (o) (let* ((src (string-append srcdest o)) @@ -689,13 +683,15 @@ See \"Porting GNU Mes\" in the manual, or try --with-courage\n" mes-system) (let ((make (and=> (file-name "make" deps) basename))) (display (string-append " GNU Mes is configured for - compiler: " compiler " - cpu: " mes-cpu " - bits: " mes-bits " - libc: " mes-libc " - kernel: " mes-kernel " - system: " mes-system " - tools: " (if numbered-arch? "numbered" "named") " arch + compiler: " compiler " + cpu: " mes-cpu " + bits: " mes-bits " + libc: " mes-libc " + kernel: " mes-kernel " + system: " mes-system " + tools: " (if numbered-arch? "numbered" "named") " arch + bootstrap: " (if with-bootstrap? "yes" "no") " + courageous: " (if with-courage? "yes" "no") " Run: " (or make "./build.sh") " to build mes diff --git a/configure.sh b/configure.sh index b0e15a5e..9b8885b7 100755 --- a/configure.sh +++ b/configure.sh @@ -82,8 +82,6 @@ GIT=${GIT-$(command -v git)} || true PERL=${PERL-$(command -v perl)} || true SHELL=${BASH-$SHELL} -MES_SEED=${MES_SEED-../mes-seed} - if test "$srcdir" = .; then top_builddir=. else @@ -169,8 +167,6 @@ subst () { -e s,"@M1@,$M1,"\ -e s,"@M1FLAGS@,$M1FLAGS,"\ -e s,"@MES_FOR_BUILD@,$MES_FOR_BUILD,"\ - -e s,"@MES_SEED@,$MES_SEED,"\ - -e s,"@MES_SEED@,$MES_SEED,"\ -e s,"@numbered_arch@,$numbered_arch,"\ -e s,"@SHELL@,$SHELL,"\ $1 > $2 @@ -264,13 +260,15 @@ EOF cat <. if [ "$MES" != guile ]; then - MES=${MES-$(dirname $0)/../src/mes} + MES=${MES-$(dirname $0)/../bin/mes} MES_BOOT=boot-02.scm exec $MES < $0 fi diff --git a/tests/srfi-0.test b/tests/srfi-0.test index 90c526aa..018aec34 100755 --- a/tests/srfi-0.test +++ b/tests/srfi-0.test @@ -2,7 +2,7 @@ # -*-scheme-*- if [ "$MES" != guile ]; then export MES_BOOT=boot-02.scm - MES=${MES-$(dirname $0)/../src/mes} + MES=${MES-$(dirname $0)/../bin/mes} $MES < $0 exit $? fi diff --git a/tests/srfi-1.test b/tests/srfi-1.test index 5580adf3..da90b71f 100755 --- a/tests/srfi-1.test +++ b/tests/srfi-1.test @@ -1,6 +1,6 @@ #! /bin/sh # -*-scheme-*- -exec ${MES-src/mes} --no-auto-compile -L ${0%/*} -L module -C module -e '(tests srfi-1)' -s "$0" "$@" +exec ${MES-bin/mes} --no-auto-compile -L ${0%/*} -L module -C module -e '(tests srfi-1)' -s "$0" "$@" !# ;;; -*-scheme-*- diff --git a/tests/srfi-13.test b/tests/srfi-13.test index 25bdc660..14280b62 100755 --- a/tests/srfi-13.test +++ b/tests/srfi-13.test @@ -1,6 +1,6 @@ #! /bin/sh # -*-scheme-*- -exec ${MES-src/mes} --no-auto-compile -L ${0%/*} -L module -C module -e '(tests srfi-13)' -s "$0" "$@" +exec ${MES-bin/mes} --no-auto-compile -L ${0%/*} -L module -C module -e '(tests srfi-13)' -s "$0" "$@" !# ;;; -*-scheme-*- diff --git a/tests/srfi-14.test b/tests/srfi-14.test index 4ef1493a..1cf24882 100755 --- a/tests/srfi-14.test +++ b/tests/srfi-14.test @@ -1,6 +1,6 @@ #! /bin/sh # -*-scheme-*- -exec ${MES-src/mes} --no-auto-compile -L ${0%/*} -L module -C module -e '(tests srfi-14)' -s "$0" "$@" +exec ${MES-bin/mes} --no-auto-compile -L ${0%/*} -L module -C module -e '(tests srfi-14)' -s "$0" "$@" !# ;;; -*-scheme-*- diff --git a/tests/srfi-16.test b/tests/srfi-16.test index 036ddbda..8da5ba15 100755 --- a/tests/srfi-16.test +++ b/tests/srfi-16.test @@ -1,6 +1,6 @@ #! /bin/sh # -*-scheme-*- -exec ${MES-src/mes} --no-auto-compile -L ${0%/*} -L module -C module -e '(tests srfi-16)' -s "$0" "$@" +exec ${MES-bin/mes} --no-auto-compile -L ${0%/*} -L module -C module -e '(tests srfi-16)' -s "$0" "$@" !# ;;; -*-scheme-*- diff --git a/tests/srfi-43.test b/tests/srfi-43.test index a9904e3d..8d89ead8 100755 --- a/tests/srfi-43.test +++ b/tests/srfi-43.test @@ -1,6 +1,6 @@ #! /bin/sh # -*-scheme-*- -exec ${MES-src/mes} --no-auto-compile -L ${0%/*} -L module -C module -e '(tests srfi-43)' -s "$0" "$@" +exec ${MES-bin/mes} --no-auto-compile -L ${0%/*} -L module -C module -e '(tests srfi-43)' -s "$0" "$@" !# ;;; -*-scheme-*- diff --git a/tests/srfi-9.test b/tests/srfi-9.test index 05e21883..04d50fe1 100755 --- a/tests/srfi-9.test +++ b/tests/srfi-9.test @@ -1,6 +1,6 @@ #! /bin/sh # -*-scheme-*- -exec ${MES-src/mes} --no-auto-compile -L ${0%/*} -L module -C module -e '(tests srfi-9)' -s "$0" "$@" +exec ${MES-bin/mes} --no-auto-compile -L ${0%/*} -L module -C module -e '(tests srfi-9)' -s "$0" "$@" !# ;;; -*-scheme-*- diff --git a/tests/syntax.test b/tests/syntax.test index f0770c87..8e5c4005 100755 --- a/tests/syntax.test +++ b/tests/syntax.test @@ -1,6 +1,6 @@ #! /bin/sh # -*-scheme-*- -exec ${MES-src/mes} --no-auto-compile -L ${0%/*} -L module -C module -e '(tests syntax)' -s "$0" "$@" +exec ${MES-bin/mes} --no-auto-compile -L ${0%/*} -L module -C module -e '(tests syntax)' -s "$0" "$@" !# ;;; -*-scheme-*- diff --git a/tests/vector.test b/tests/vector.test index 3341ac50..ca7d3e1f 100755 --- a/tests/vector.test +++ b/tests/vector.test @@ -1,6 +1,6 @@ #! /bin/sh # -*-scheme-*- -exec ${MES-src/mes} --no-auto-compile -L ${0%/*} -L module -C module -e '(tests vector)' -s "$0" "$@" +exec ${MES-bin/mes} --no-auto-compile -L ${0%/*} -L module -C module -e '(tests vector)' -s "$0" "$@" !# ;;; -*-scheme-*-