From 7e8caba0553bd1d8ffc2e6f1424837049295017c Mon Sep 17 00:00:00 2001 From: Timothy Sample Date: Sat, 15 Dec 2018 21:38:48 -0500 Subject: [PATCH] Build Gash with Autotools. This commit allows most of Gash to be built with Autotools. It also removes some of the Gash build scripts. * configure.ac: Add checks for compress, gzip, bzip2, and xz; configure gash/config.scm. * Makefile.am: Add Gash modules and the 'gash' script. * scripts/gash.in: Rename 'guile_site_dir' to 'MODDIR' and 'guile_site_ccache_dir' to 'GODIR'. * configure: Delete file. * makefile: Delete file. * build-aux/build-guile.sh: Delete file. * build-aux/pre-inst-env.in: Delete file. * build-aux/trace.sh: Delete file. * .gitignore: Add configure; remove exceptions for the deleted build-aux files. --- .gitignore | 8 +-- Makefile.am | 54 +++++++++++++++ build-aux/build-guile.sh | 134 -------------------------------------- build-aux/pre-inst-env.in | 45 ------------- build-aux/trace.sh | 41 ------------ configure | 129 ------------------------------------ configure.ac | 18 +++++ makefile | 94 -------------------------- scripts/gash.in | 2 +- 9 files changed, 74 insertions(+), 451 deletions(-) delete mode 100755 build-aux/build-guile.sh delete mode 100644 build-aux/pre-inst-env.in delete mode 100644 build-aux/trace.sh delete mode 100755 configure delete mode 100644 makefile diff --git a/.gitignore b/.gitignore index 402de5d..220ec05 100644 --- a/.gitignore +++ b/.gitignore @@ -35,17 +35,11 @@ Makefile.in aclocal.m4 autom4te.cache/* build-aux/* -!build-aux/build-guile.sh !build-aux/git-version-gen !build-aux/gitlab-ci.yml -!build-aux/pre-inst-env.in -!build-aux/trace.sh config.log config.status - -# Preserve this Gash file for now. -# configure - +configure coverage/* lcov.info pre-inst-env diff --git a/Makefile.am b/Makefile.am index 1288d07..f9bdeda 100644 --- a/Makefile.am +++ b/Makefile.am @@ -44,10 +44,59 @@ check-spec: check-bootstrap: guix build -f tests/bootstrap/bash-without-bash.scm +.PHONY: check-gash +check-gash: + SHELL=gash $(top_builddir)/pre-inst-env $(top_builddir)/check.sh + dist-hook: echo $(VERSION) > $(distdir)/.tarball-version MODULES = \ + gash/bournish-commands.scm \ + gash/builtins.scm \ + gash/commands/basename.scm \ + gash/commands/cat.scm \ + gash/commands/chmod.scm \ + gash/commands/compress.scm \ + gash/commands/cp.scm \ + gash/commands/dirname.scm \ + gash/commands/find.scm \ + gash/commands/grep.scm \ + gash/commands/ls.scm \ + gash/commands/mkdir.scm \ + gash/commands/mv.scm \ + gash/commands/reboot.scm \ + gash/commands/rm.scm \ + gash/commands/rmdir.scm \ + gash/commands/sed.scm \ + gash/commands/sed/reader.scm \ + gash/commands/tar.scm \ + gash/commands/touch.scm \ + gash/commands/tr.scm \ + gash/commands/wc.scm \ + gash/commands/which.scm \ + gash/compress.scm \ + gash/config.scm \ + gash/environment.scm \ + gash/gash.scm \ + gash/geesh.scm \ + gash/grammar.scm \ + gash/guix-utils.scm \ + gash/io.scm \ + gash/job.scm \ + gash/lzw.scm \ + gash/peg.scm \ + gash/peg/cache.scm \ + gash/peg/codegen.scm \ + gash/peg/simplify-tree.scm \ + gash/peg/string-peg.scm \ + gash/peg/using-parsers.scm \ + gash/pipe.scm \ + gash/readline.scm \ + gash/script.scm \ + gash/shell-utils.scm \ + gash/ustar.scm \ + gash/util.scm \ geesh/built-ins/break.scm \ geesh/built-ins/cd.scm \ geesh/built-ins/colon.scm \ @@ -81,6 +130,7 @@ MODULES = \ geesh/word.scm bin_SCRIPTS = \ + scripts/gash \ scripts/geesh do_subst = sed \ @@ -88,6 +138,10 @@ do_subst = sed \ -e 's,[@]MODDIR[@],$(moddir),g' \ -e 's,[@]GODIR[@],$(godir),g' +scripts/gash: scripts/gash.in Makefile + $(do_subst) < $(srcdir)/scripts/gash.in > scripts/gash + chmod a+x scripts/gash + scripts/geesh: scripts/geesh.in Makefile $(do_subst) < $(srcdir)/scripts/geesh.in > scripts/geesh chmod a+x scripts/geesh diff --git a/build-aux/build-guile.sh b/build-aux/build-guile.sh deleted file mode 100755 index 57e6b49..0000000 --- a/build-aux/build-guile.sh +++ /dev/null @@ -1,134 +0,0 @@ -#! /bin/sh - -# Gash --- Guile As SHell -# Copyright © 2018 Jan (janneke) Nieuwenhuizen -# -# This file is part of Gash. -# -# Gash is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or (at -# your option) any later version. -# -# Gash is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License -# along with Gash. If not, see . - -srcdir=${srcdir-.} -. ${srcdest}build-aux/trace.sh - -export GUILE -export GUILE_AUTO_COMPILE -GUILE=${GUILE-$(command -v guile)} -GUILD=${GUILD-$(command -v guild || command -v guile-tools)} -GUILE_AUTO_COMPILE=0 - -set -e - -SCM_FILES=" -${srcdest}gash/bournish-commands.scm -${srcdest}gash/guix-utils.scm -${srcdest}gash/builtins.scm -${srcdest}gash/compress.scm -${srcdest}gash/config.scm -${srcdest}gash/environment.scm -${srcdest}gash/gash.scm -${srcdest}gash/geesh.scm -${srcdest}gash/grammar.scm -${srcdest}gash/io.scm -${srcdest}gash/job.scm -${srcdest}gash/lzw.scm -${srcdest}gash/pipe.scm -${srcdest}gash/readline.scm -${srcdest}gash/script.scm -${srcdest}gash/shell-utils.scm -${srcdest}gash/ustar.scm -${srcdest}gash/util.scm - -${srcdest}gash/peg.scm -${srcdest}gash/peg/cache.scm -${srcdest}gash/peg/codegen.scm -${srcdest}gash/peg/simplify-tree.scm -${srcdest}gash/peg/string-peg.scm -${srcdest}gash/peg/using-parsers.scm - -${srcdest}gash/commands/basename.scm -${srcdest}gash/commands/cat.scm -${srcdest}gash/commands/chmod.scm -${srcdest}gash/commands/compress.scm -${srcdest}gash/commands/cp.scm -${srcdest}gash/commands/dirname.scm -${srcdest}gash/commands/find.scm -${srcdest}gash/commands/grep.scm -${srcdest}gash/commands/ls.scm -${srcdest}gash/commands/mkdir.scm -${srcdest}gash/commands/mv.scm -${srcdest}gash/commands/reboot.scm -${srcdest}gash/commands/rm.scm -${srcdest}gash/commands/rmdir.scm -${srcdest}gash/commands/sed.scm -${srcdest}gash/commands/tar.scm -${srcdest}gash/commands/touch.scm -${srcdest}gash/commands/tr.scm -${srcdest}gash/commands/wc.scm -${srcdest}gash/commands/which.scm - -${srcdest}gash/commands/sed/reader.scm - -" - -SCRIPTS=" -${srcdest}bin/basename -${srcdest}bin/cat -${srcdest}bin/chmod -${srcdest}bin/compress -${srcdest}bin/cp -${srcdest}bin/dirname -${srcdest}bin/find -${srcdest}bin/grep -${srcdest}bin/ls -${srcdest}bin/mkdir -${srcdest}bin/mv -${srcdest}bin/reboot -${srcdest}bin/rm -${srcdest}bin/rmdir -${srcdest}bin/sed -${srcdest}bin/tar -${srcdest}bin/touch -${srcdest}bin/tr -${srcdest}bin/wc -${srcdest}bin/which -${srcdest}scripts/gash -" - -export host=$($GUILE -c "(display %host-type)") - -abs=$srcdest -if [ "$GUILE_EFFECTIVE_VERSION" = "2.0" ]; then - srcdest=$abs_top_srcdir/ -fi - -GUILE_AUTO_COMPILE=0 -WARNINGS=" ---warn=unsupported-warning ---warn=unused-variable ---warn=unused-toplevel ---warn=unbound-variable ---warn=macro-use-before-definition ---warn=arity-mismatch ---warn=duplicate-case-datum ---warn=bad-case-datum ---warn=format -" - -for i in $SCM_FILES $SCRIPTS; do - b=$(basename $i) - go=${i%%.scm}.go - if [ $i -nt $go ]; then - trace "GUILEC $b" $GUILD compile -L ${srcdir} $WARNINGS -o $go $i - fi -done diff --git a/build-aux/pre-inst-env.in b/build-aux/pre-inst-env.in deleted file mode 100644 index 2e47e54..0000000 --- a/build-aux/pre-inst-env.in +++ /dev/null @@ -1,45 +0,0 @@ -#! @BASH@ - -# Gash --- Guile As SHell -# Copyright © 2018 Jan (janneke) Nieuwenhuizen -# -# This file is part of Gash. -# -# Gash is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or (at -# your option) any later version. -# -# Gash is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License -# along with Gash. If not, see . - -srcdir="@srcdir@" -abs_top_srcdir="@abs_top_srcdir@" -abs_top_builddir="@abs_top_builddir@" -prefix=${prefix-@prefix@} - -MES_PREFIX=${MES_PREFIX-${srcdest}mes} -export MES_PREFIX - -GUILE_LOAD_COMPILED_PATH="$abs_top_builddir/bin:$abs_top_builddir${GUILE_LOAD_COMPILED_PATH:+:}$GUILE_LOAD_COMPILED_PATH" -GUILE_LOAD_PATH="$abs_top_srcdir${GUILE_LOAD_PATH:+:}$GUILE_LOAD_PATH" -if [ -n "$srcdest" ]; then - GUILE_LOAD_PATH="${srcdest}module:${srcdest}mes:$GUILE_LOAD_PATH" -fi -export GUILE_LOAD_COMPILED_PATH GUILE_LOAD_PATH - -PATH="$abs_top_builddir/bin:$PATH" -export PATH - -COMMANDS="$abs_top_builddir/gash/commands" -export COMMANDS - -LANG= -LC_ALL= - -exec "$@" diff --git a/build-aux/trace.sh b/build-aux/trace.sh deleted file mode 100644 index 6f5d0ef..0000000 --- a/build-aux/trace.sh +++ /dev/null @@ -1,41 +0,0 @@ -# Gash --- Guile As SHell -# Copyright © 2018 Jan (janneke) Nieuwenhuizen -# -# This file is part of Gash. -# -# Gash is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or (at -# your option) any later version. -# -# Gash is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License -# along with Gash. If not, see . - -if [ -z "$V" -o "$V0" = 0 ]; then - trace () { - echo " $1" - shift - eval "$@" $LOG - } - LOG=" >>build.log 2>&1" -fi -if [ "$V" = 1 ]; then - trace () { - shift - echo "$@" - eval "$@ $LOG" - } - LOG=" >>build.log 2>&1" -fi -if [ "$V" = 2 ]; then - set -x - trace () { - shift - eval "$@" - } -fi diff --git a/configure b/configure deleted file mode 100755 index f13da69..0000000 --- a/configure +++ /dev/null @@ -1,129 +0,0 @@ -#! /bin/sh - -VERSION=0.1 - -# parse --prefix=PREFIX, mainly for GuixSD/Debian -cmdline=$(echo "$@") -PREFIX=${cmdline##*--prefix=} -PREFIX=${PREFIX% *} -PREFIX=${PREFIX% -*} -if [ -z "$PREFIX" ]; then - PREFIX=/usr/local -fi - -BASH=$(command -v bash) -GUILE=${GUILE-$(command -v guile)} -GUILD=${GUILD-$(command -v guild || command -v guile-tools)} -guile_site_dir=$PREFIX/share/guile/site/$guile_effective_version -guile_site_ccache_dir=$PREFIX/lib/guile/$guile_effective_version/site-ccache -guile_effective_version=$(guile -c '(display (effective-version))') -MAKEINFO=$(command -v makeinfo) -GEESH_PREFIX=${GEESH_PREFIX-$HOME/src/geesh} -if [ -d $GEESH_PREFIX ]; then - GUILE_LOAD_PATH=$GEESH_PREFIX:$GUILE_LOAD_PATH - GUILE_LOAD_COMPILED_PATH=$GEESH_PREFIX:$GUILE_LOAD_COMPILED_PATH - if ! $GUILE -c '(use-modules (geesh parser)) (exit (defined? '"'"'read-sh-all))'; then - echo "warning: building without Geesh" - fi -fi - -if [ "$srcdir" = . ]; then - top_builddir=. -else - srcdest=${srcdest} - top_builddir=$PWD -fi -abs_top_srcdir=${abs_top_srcdir-$(cd ${srcdir} && pwd)} -abs_top_builddir=$PWD - -cat > .config.make < $2 -} - -SHELLS=" -bash -gash -sh -" - -for shell in $SHELLS; do - subst ${srcdest}scripts/gash.in scripts/$shell - chmod +x scripts/$shell -done - -BUILTINS=" -basename -cat -chmod -compress -cp -dirname -find -grep -ls -mkdir -mv -reboot -rm -rmdir -sed -tar -touch -tr -wc -which -" -for builtin in $BUILTINS; do - subst ${srcdest}bin/builtin.in bin/$builtin - chmod +x bin/$builtin -done - -subst ${srcdest}gash/config.scm.in gash/config.scm -subst ${srcdest}build-aux/pre-inst-env.in pre-inst-env -chmod +x pre-inst-env - -cat < $@ - -info: doc/gash.info - -doc/gash.info: doc/gash.texi doc/version.texi makefile - $(MAKEINFO) -o $@ -I doc $< - -define HELP_TOP -Usage: make [OPTION]... [TARGET]... - -Targets: - all update everything - all-go update .go files - check run ./test.sh - clean run git clean -dfx - clean-go clean .go files - install install in $(PREFIX) -endef -export HELP_TOP -help: - @echo "$$HELP_TOP" - -export BUILD_DEBUG -export GUILE -export GUILE_TOOLS -export guile_load_path -export guile_load_compiled_path - - diff --git a/scripts/gash.in b/scripts/gash.in index c7587d1..f851c1d 100644 --- a/scripts/gash.in +++ b/scripts/gash.in @@ -1,5 +1,5 @@ #! @GUILE@ \ ---no-auto-compile -e main -L @guile_site_dir@ -C @guile_site_ccache_dir@ -L . -C . -s +--no-auto-compile -e main -L @MODDIR@ -C @GODIR@ -L . -C . -s !# ;;; Gash --- Guile As SHell ;;; Copyright © 2016,2017,2018 R.E.W. van Beusekom