diff --git a/GNUmakefile b/GNUmakefile index 26cdaf21..4b3ebe7a 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -21,7 +21,7 @@ GUILE_FLAGS:=--no-auto-compile -L . -L guile -C . -C guile include .config.make .config.make: - ./configure --prefix=$(PREFIX) + ./configure --prefix=$(prefix) PHONY_TARGETS:= all all-go build check clean clean-go default doc help install install-info man\ cc mes mes-gcc mes-tcc @@ -140,8 +140,8 @@ Targets: clean run git clean -dfx clean-go clean .go files info update info documentation - install install in $(PREFIX) - install-info install info docs in $(PREFIX)/share/info + install install in $(prefix) + install-info install info docs in $(prefix)/share/info seed update mes-seed in $(MES_SEED) endef export HELP_TOP diff --git a/HACKING b/HACKING index b7dbb848..abf86451 100644 --- a/HACKING +++ b/HACKING @@ -25,7 +25,7 @@ To help development we assume ./configure sets these variables for make HEX2 -- hex2 MES -- unset M1 -- M1 - PREFIX -- "" + prefix -- "" Mes is supposed to serve as a full equivalent for Guile, however Mes ~30 times slower than Guile. That's why we usually don't use Mes diff --git a/INSTALL b/INSTALL index b11e1d95..c8fa2247 100644 --- a/INSTALL +++ b/INSTALL @@ -51,7 +51,7 @@ https://gitlab.com/janneke/guix/blob/wip-bootstrap/gnu/packages/mes.scm - [[https://github.com/oriansj/mescc-tools][mes-seed]], 0.15 is known to work. ** Build it - + ./build.sh diff --git a/build-aux/build-cc.sh b/build-aux/build-cc.sh index f3e54150..2cf6e292 100755 --- a/build-aux/build-cc.sh +++ b/build-aux/build-cc.sh @@ -35,8 +35,8 @@ CFLAGS=${CFLAGS-" CPPFLAGS=${CPPFLAGS-" -D VERSION=\"$VERSION\" --D MODULEDIR=\"$MODULEDIR\" --D PREFIX=\"$PREFIX\" +-D MODULEDIR=\"$moduledir\" +-D PREFIX=\"$prefix\" -I src -I lib -I include diff --git a/build-aux/build-cc32.sh b/build-aux/build-cc32.sh index 11084f30..24eedfa0 100755 --- a/build-aux/build-cc32.sh +++ b/build-aux/build-cc32.sh @@ -24,7 +24,7 @@ if [ -n "$BUILD_DEBUG" ]; then set -x fi -MODULEDIR=${MODULEDIR-${DATADIR}${DATADIR:+/}module} +moduledir=${moduledir-${datadir}${datadir:+/}module} export CC32 TCC CPPFLAGS C32FLAGS CC32=${CC32-$(command -v i686-unknown-linux-gnu-gcc)} @@ -46,8 +46,8 @@ build-aux/mes-snarf.scm src/vector.c CPPFLAGS=${CPPFLAGS-" -D VERSION=\"$VERSION\" --D MODULEDIR=\"$MODULEDIR\" --D PREFIX=\"$PREFIX\" +-D MODULEDIR=\"$moduledir\" +-D PREFIX=\"$prefix\" -I src -I lib -I include diff --git a/build-aux/build-mes.sh b/build-aux/build-mes.sh index 1ef36c68..d7395fa6 100755 --- a/build-aux/build-mes.sh +++ b/build-aux/build-mes.sh @@ -106,7 +106,6 @@ fi ARCHDIR=1 NOLINK=1 bash build-aux/cc-mes.sh lib/crt0 ARCHDIR=1 NOLINK=1 bash build-aux/cc-mes.sh lib/crt1 -ARCHDIR=1 NOLINK=1 bash build-aux/cc-mes.sh lib/crt1 ARCHDIR=1 NOLINK=1 bash build-aux/cc-mes.sh lib/crti ARCHDIR=1 NOLINK=1 bash build-aux/cc-mes.sh lib/crtn ARCHDIR=1 NOLINK=1 bash build-aux/cc-mes.sh lib/libc-mini diff --git a/build-aux/cc-mes.sh b/build-aux/cc-mes.sh index 7a2ed41a..57e75f6f 100755 --- a/build-aux/cc-mes.sh +++ b/build-aux/cc-mes.sh @@ -35,8 +35,8 @@ MES=${MES-$(command -v mes)} CPPFLAGS=${CPPFLAGS-" -D VERSION=\"$VERSION\" --D MODULEDIR=\"$MODULEDIR\" --D PREFIX=\"$PREFIX\" +-D MODULEDIR=\"$moduledir\" +-D PREFIX=\"$prefix\" -I src -I lib -I include diff --git a/build-aux/cc.sh b/build-aux/cc.sh index 19381623..3d7a2855 100755 --- a/build-aux/cc.sh +++ b/build-aux/cc.sh @@ -26,8 +26,8 @@ fi CPPFLAGS=${CPPFLAGS-" -D VERSION=\"$VERSION\" --D MODULEDIR=\"$MODULEDIR\" --D PREFIX=\"$PREFIX\" +-D MODULEDIR=\"$moduledir\" +-D PREFIX=\"$prefix\" -I src -I lib -I include diff --git a/build-aux/cc32-mes.sh b/build-aux/cc32-mes.sh index d994f452..159406dc 100755 --- a/build-aux/cc32-mes.sh +++ b/build-aux/cc32-mes.sh @@ -26,8 +26,8 @@ fi CPPFLAGS=${CPPFLAGS-" -D VERSION=\"$VERSION\" --D MODULEDIR=\"$MODULEDIR\" --D PREFIX=\"$PREFIX\" +-D MODULEDIR=\"$moduledir\" +-D PREFIX=\"$prefix\" -I src -I lib -I include diff --git a/build-aux/export.make b/build-aux/export.make index 05c0a2f8..b1c5eaaa 100644 --- a/build-aux/export.make +++ b/build-aux/export.make @@ -1,9 +1,21 @@ +ifdef BUILD_DEBUG +export BUILD_DEBUG +endif + ifdef DESTDIR export DESTDIR endif -ifdef PREFIX -export PREFIX +ifdef prefix +export prefix +endif + +ifdef infodir +export infodir +endif + +ifdef mandir +export mandir endif ifdef VERSION diff --git a/build-aux/setup-mes.sh b/build-aux/setup-mes.sh index 54dc75bd..2915029d 100644 --- a/build-aux/setup-mes.sh +++ b/build-aux/setup-mes.sh @@ -10,10 +10,10 @@ mkdir -p src cd src GUILE_EFFECTIVE_VERSION=2.2 -GUILE_SITE_DIR=/usr/local/share/guile/site/$GUILE_EFFECTIVE_VERSION -GUILE_SITE_CCACHE_DIR=/usr/local/lib/guile/$GUILE_EFFECTIVE_VERSION/site-ccache -GUILE_LOAD_PATH=$GUILE_SITE_DIR -GUILE_LOAD_COMPILED_PATH=$GUILE_SITE_CCACHE_DIR +guile_site_dir=/usr/local/share/guile/site/$GUILE_EFFECTIVE_VERSION +guile_site_ccache_dir=/usr/local/lib/guile/$GUILE_EFFECTIVE_VERSION/site-ccache +GUILE_LOAD_PATH=$guile_site_dir +GUILE_LOAD_COMPILED_PATH=$guile_site_ccache_dir export GUILE_LOAD_PATH export GUILE_LOAD_COMPILED_PATH diff --git a/build.sh b/build.sh index 4a334074..c273d62f 100755 --- a/build.sh +++ b/build.sh @@ -23,9 +23,9 @@ if [ -n "$BUILD_DEBUG" ]; then fi # dash does not export foo=${foo-bar} for some values +export prefix datadir moduledir export CC CC32 TCC GUILE MESCC MES_SEED export MES_ARENA MES_DEBUG -export PREFIX DATADIR MODULEDIR export CPPFLAGS CFLAGS C32FLAGS MESCCFLAGS export BUILD_DEBUG @@ -37,15 +37,15 @@ GUILE=${GUILE-$(command -v guile)} MES_ARENA=${MES_ARENA-100000000} MES_DEBUG=${MES_DEBUG-1} -PREFIX=${PREFIX-/usr/local} -DATADIR=${DATADIR-$PREFIX/share/mes} -MODULEDIR=${MODULEDIR-${DATADIR}${DATADIR:+/}module} +prefix=${prefix-/usr/local} +datadir=${datadir-$prefix/share/mes} +moduledir=${moduledir-${datadir}${datadir:+/}module} set -e CPPFLAGS=${CPPFLAGS-" -D VERSION=\"$VERSION\" --D MODULEDIR=\"$MODULEDIR\" --D PREFIX=\"$PREFIX\" +-D MODULEDIR=\"$moduledir\" +-D PREFIX=\"$prefix\" -I src -I lib -I include diff --git a/check.sh b/check.sh index 34ec6a8a..8407dd51 100755 --- a/check.sh +++ b/check.sh @@ -28,7 +28,7 @@ CC32=${CC32-$(command -v i686-unknown-linux-gnu-gcc)} GUILE=${GUILE-guile} MES=${MES-src/mes} MES_ARENA=${MES_ARENA-100000000} -PREFIX= +prefix= if ! command -v $GUILE > /dev/null; then GUILE=true diff --git a/configure b/configure index 89b7f627..9df25c28 100755 --- a/configure +++ b/configure @@ -59,10 +59,13 @@ exec ${GUILE-guile} -L . --no-auto-compile -e '(configure)' -s "$0" ${1+"$@"} (define *shell* "sh") (define PACKAGE "mes") (define VERSION "0.16") -(define PREFIX "/usr/local") -(define GUILE_EFFECTIVE_VERSION (effective-version)) (define GUILE (or (getenv "guile") "guile")) -(define SYSCONFDIR "$(PREFIX)/etc") +(define GUILE_EFFECTIVE_VERSION (effective-version)) + +(define prefix "/usr/local") +(define infodir "${prefix}/share/info") +(define mandir "${prefix}/share/man") +(define sysconfdir "${prefix}/etc") ;;; Utility (define (logf port string . rest) @@ -189,8 +192,21 @@ exec ${GUILE-guile} -L . --no-auto-compile -e '(configure)' -s "$0" ${1+"$@"} (sysconfdir (value #t)) (verbose (single-char #\v)) (with-courage) - ;;ignore - (enable-fast-install)))) + (infodir (value #t)) + (mandir (value #t)) + (disable-silent-rules) + + (enable-fast-install) ; Ignored for Guix + (includedir (value #t)) ; Ignored for Debian + (mandir (value #t)) ; Ignored for Debian + (localstatedir (value #t)) ; Ignored for Debian + (libdir (value #t)) ; Ignored for Debian + (libexecdir (value #t)) ; Ignored for Debian + (runstatedir (value #t)) ; Ignored for Debian + (disable-maintainer-mode) ; Ignored for Debian + (disable-dependency-tracking) ; Ignored for Debian + ))) + (getopt-long args option-spec))) (define* (print-help #:optional (port (current-output-port))) @@ -207,13 +223,29 @@ Defaults for the options are specified in brackets. Options: -h, --help display this help --build=BUILD configure for building on BUILD [guessed] + --disable-silent-rules + verbose build output [BUILD_DEBUG=1] --host=HOST cross-compile to build programs to run on HOST [BUILD] -v, --verbose be verbose --with-courage assert being courageous to configure for unsupported platform Installation directories: - --prefix=DIR install in PREFIX [~a] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --prefix=DIR install in prefix DIR [~a] + --infodir=DIR info documentation [PREFIX/share/info] + --mandir=DIR man pages [PREFIX/share/man] + +Ignored for Guix: + --enable-fast-install + +Ignored for Debian: + --disable-dependency-tracking + --disable-maintainer-mode + --includedir=DIR + --libdir=DIR + --libexecdir=DIR + --localstatedir=DIR + --mandir=DIR + --runstatedir=DIR Some influential environment variables: CC C compiler command @@ -226,7 +258,7 @@ Some influential environment variables: MESCC_TOOLS_SEED location of mescc-tools-seed TCC tcc C compiler command TINYCC_SEED location of tinycc-seed -" PACKAGE VERSION (getenv "PREFIX"))) +" PACKAGE VERSION (getenv "prefix"))) (define (main args) (let* ((CC (or (getenv "CC") "gcc")) @@ -235,10 +267,12 @@ Some influential environment variables: (options (parse-opts args)) (build-triplet (option-ref options 'build BUILD_TRIPLET)) (host-triplet (option-ref options 'host BUILD_TRIPLET)) - (prefix (option-ref options 'prefix PREFIX)) - (sysconfdir (option-ref options 'sysconfdir SYSCONFDIR)) + (prefix (option-ref options 'prefix prefix)) + (infodir (option-ref options 'infodir infodir)) + (sysconfdir (option-ref options 'sysconfdir sysconfdir)) (verbose? (option-ref options 'verbose #f)) (with-courage? (option-ref options 'with-courage #f)) + (disable-silent-rules? (option-ref options 'disable-silent-rules #f)) (make? #f) (vars (filter (cut string-index <> #\=) (option-ref options '() '()))) (help? (option-ref options 'help #f))) @@ -305,6 +339,11 @@ Some influential environment variables: (stdout "build:=~a\n" build-triplet) (stdout "host:=~a\n" host-triplet) (stdout "srcdir:=.\n") + (stdout "prefix:=~a\n" (gulp-pipe (string-append "echo " prefix))) + (stdout "infodir:=~a\n" infodir) + (stdout "mandir:=~a\n" mandir) + (stdout "sysconfdir:=~a\n" sysconfdir) + (stdout "ARCH:=~a\n" ARCH) (stdout "CC:=~a\n" (or CC "")) (stdout "CC32:=~a\n" (or CC32 "")) @@ -324,8 +363,8 @@ Some influential environment variables: (stdout "HEX2:=~a\n" (or HEX2 "")) (stdout "PACKAGE:=~a\n" PACKAGE) (stdout "VERSION:=~a\n" VERSION) - (stdout "PREFIX:=~a\n" (gulp-pipe (string-append "echo " prefix))) - (stdout "SYSCONFDIR:=~a\n" sysconfdir) + (when disable-silent-rules? + (stdout "BUILD_DEBUG:=1\n")) (when CFLAGS (stdout "CFLAGS:=~a\n" CFLAGS)) (when C32FLAGS (stdout "C32FLAGS:=~a\n" C32FLAGS)) (when HEX2FLAGS (stdout "HEX2FLAGS:=~a\n" HEX2FLAGS)) diff --git a/doc/mes.texi b/doc/mes.texi index 413e39f1..d25a040f 100644 --- a/doc/mes.texi +++ b/doc/mes.texi @@ -340,7 +340,7 @@ package. The bootstrap build procedure for Mes is similar to building GNU software and goes like this @example -export PREFIX=/usr/local # for example +export prefix=/usr/local # for example export MES_SEED=../mes # for example # optionally set some other environment variables sh build.sh diff --git a/install.sh b/install.sh index b3eadc64..3a68e561 100755 --- a/install.sh +++ b/install.sh @@ -9,71 +9,73 @@ fi [ -n "$BASH" ] && set -o pipefail SHELL=${SHELL-$(command -v sh)} -PREFIX=${PREFIX-/usr/local} -MES_PREFIX=${MES_PREFIX-$PREFIX/share/mes} -MES_SEED=${MES_SEED-../mes-seed} -TINYCC_SEED=${TINYCC_SEED-../tinycc-seed} +prefix=${prefix-/usr/local} -mkdir -p $DESTDIR$PREFIX/bin -cp src/mes $DESTDIR$PREFIX/bin/mes +MES_PREFIX=${MES_PREFIX-$prefix/share/mes} +MES_SEED=${MES_SEED-../MES-SEED} +TINYCC_SEED=${TINYCC_SEED-../TINYCC-SEED} -mkdir -p $DESTDIR$PREFIX/lib +mkdir -p $DESTDIR$prefix/bin +cp src/mes $DESTDIR$prefix/bin/mes + +mkdir -p $DESTDIR$prefix/lib mkdir -p $DESTDIR$MES_PREFIX/lib -cp scripts/mescc $DESTDIR$PREFIX/bin/mescc +cp scripts/mescc $DESTDIR$prefix/bin/mescc mkdir -p $DESTDIR$MES_PREFIX tar -cf- doc guile include lib module scaffold | tar -xf- -C $DESTDIR$MES_PREFIX GUILE_EFFECTIVE_VERSION=${GUILE_EFFECTIVE_VERSION-2.2} -DATADIR=${MODULEDIR-$PREFIX/share/mes} -DOCDIR=${MODULEDIR-$PREFIX/share/doc/mes} -MODULEDIR=${MODULEDIR-$DATADIR/module} -GUILEDIR=${MODULEDIR-$PREFIX/share/guile/site/$GUILE_EFFECTIVE_VERSION} -GODIR=${GODIR-$PREFIX/lib/guile/$GUILE_EFFECTIVE_VERSION/site-ccache} -DOCDIR=${MODULEDIR-$PREFIX/share/doc/mes} +datadir=${moduledir-$prefix/share/mes} +docdir=${moduledir-$prefix/share/doc/mes} +mandir=${mandir-$prefix/share/man} +moduledir=${moduledir-$datadir/module} +guile_site_dir=${moduledir-$prefix/share/guile/site/$GUILE_EFFECTIVE_VERSION} +guile_site_ccache_dir=${guile_site_ccache_dir-$prefix/lib/guile/$GUILE_EFFECTIVE_VERSION/site-ccache} +docdir=${moduledir-$prefix/share/doc/mes} -chmod +w $DESTDIR$PREFIX/bin/mescc +chmod +w $DESTDIR$prefix/bin/mescc sed \ -e "s,^#! /bin/sh,#! $SHELL," \ - -e "s,module/,$MODULEDIR/," \ - -e "s,@DATADIR@,$DATADIR,g" \ - -e "s,@DOCDIR@,$DOCDIR,g" \ - -e "s,@GODIR@,$GODIR,g" \ - -e "s,@GUILEDIR@,$GUILEDIR,g" \ - -e "s,@MODULEDIR@,$MODULEDIR,g" \ - -e "s,@PREFIX@,$PREFIX,g" \ + -e "s,module/,$moduledir/," \ + -e "s,@datadir@,$datadir,g" \ + -e "s,@docdir@,$docdir,g" \ + -e "s,@guile_site_ccache_dir@,$guile_site_ccache_dir,g" \ + -e "s,@guile_site_dir@,$guile_site_dir,g" \ + -e "s,@moduledir@,$moduledir,g" \ + -e "s,@prefix@,$prefix,g" \ -e "s,@VERSION@,$VERSION,g" \ - scripts/mescc > $DESTDIR$PREFIX/bin/mescc -chmod +w $DESTDIR$MODULEDIR/mes/boot-0.scm + scripts/mescc > $DESTDIR$prefix/bin/mescc +chmod +w $DESTDIR$moduledir/mes/boot-0.scm sed \ -e "s,^#! /bin/sh,#! $SHELL," \ - -e "s,module/,$MODULEDIR/," \ - -e "s,@DATADIR@,$DATADIR,g" \ - -e "s,@DOCDIR@,$DOCDIR,g" \ - -e "s,@GODIR@,$GODIR,g" \ - -e "s,@GUILEDIR@,$GUILEDIR,g" \ - -e "s,@MODULEDIR@,$MODULEDIR,g" \ - -e "s,@PREFIX@,$PREFIX,g" \ + -e "s,module/,$moduledir/," \ + -e "s,@datadir@,$datadir,g" \ + -e "s,@docdir@,$docdir,g" \ + -e "s,@guile_site_ccache_dir@,$guile_site_ccache_dir,g" \ + -e "s,@guile_site_dir@,$guile_site_dir,g" \ + -e "s,@moduledir@,$moduledir,g" \ + -e "s,@prefix@,$prefix,g" \ -e "s,@VERSION@,$VERSION,g" \ - module/mes/boot-0.scm > $DESTDIR$MODULEDIR/mes/boot-0.scm + module/mes/boot-0.scm > $DESTDIR$moduledir/mes/boot-0.scm sed \ -e "s,^#! /bin/sh,#! $SHELL," \ - scripts/diff.scm > $DESTDIR$PREFIX/bin/diff.scm -chmod -w+x $DESTDIR$PREFIX/bin/diff.scm + scripts/diff.scm > $DESTDIR$prefix/bin/diff.scm +chmod -w+x $DESTDIR$prefix/bin/diff.scm if [ -f doc/mes.info ]; then - mkdir -p $DESTDIR$PREFIX/share/info - install-info --info-dir=$DESTDIR$PREFIX/share/info doc/mes.info - tar -cf- doc/mes.info* | tar -xf- --strip-components=1 -C $DESTDIR$PREFIX/share/info + mkdir -p $DESTDIR$prefix/share/info + install-info --info-dir=$DESTDIR$prefix/share/info doc/mes.info + tar -cf- doc/mes.info* | tar -xf- --strip-components=1 -C $DESTDIR$prefix/share/info fi if [ -f doc/mes.1 ]; then - mkdir -p $DESTDIR$PREFIX/man/man1 - cp doc/mes.1 $DESTDIR$PREFIX/man/man1/ + mkdir -p $DESTDIR$mandir/man1 + cp doc/mes.1 $DESTDIR$mandir/man1/ fi if [ -f doc/mescc.1 ]; then - mkdir -p $DESTDIR$PREFIX/man/man1 - cp doc/mescc.1 $DESTDIR$PREFIX/man/man1/ + mkdir -p $DESTDIR$mandir/man1 + cp doc/mescc.1 $DESTDIR$mandir/man1/ fi diff --git a/scripts/mescc b/scripts/mescc index 60ff6b17..eece8746 100755 --- a/scripts/mescc +++ b/scripts/mescc @@ -3,23 +3,24 @@ if [ -n "$BUILD_DEBUG" ]; then set -x fi -PREFIX=${PREFIX-@PREFIX@} -if [ "@PREFIX@" = @PREFIX""@ -o ! -d "$PREFIX/share/mes/module" ] +prefix=${prefix-@prefix@} +if [ "@prefix@" = @prefix""@ -o ! -d "$prefix/share/mes/module" ] then MES_PREFIX=${MES_PREFIX-$(cd $(dirname $0)/.. && pwd)} else - MES_PREFIX=${MES_PREFIX-$PREFIX/share/mes} + MES_PREFIX=${MES_PREFIX-$prefix/share/mes} fi export MES_PREFIX mes_p=$(command -v mes) if [ '(' -z "$mes_p" -a -z "$MES" ')' -o "$MES" = "guile" -o "$MES" = "mes.guile" ]; then - GODIR=${GODIR-@GODIR@} - GUILEDIR=${GUILEDIR-@GUILEDIR@} - [ "$GODIR" = @"GODIR"@ ] && GODIR=$(dirname $0)/../guile - [ "$GUILEDIR" = @"GUILEDIR"@ ] && GUILEDIR=$(dirname $0)/../guile - export GUILE_AUTO_COMPILE=${GUILE_AUTO_COMPILE-0} - GUILE_LOAD_COMPILED_PATH=$GODIR:$GUILE_LOAD_COMPILED_PATH - exec ${GUILE-guile} -L $GUILEDIR -e '(mescc)' -s "$0" "$@" + guile_site_ccache_dir=${guile_site_ccache_dir-@guile_site_ccache_dir@} + guile_site_dir=${guile_site_dir-@guile_site_dir@} + [ "$guile_site_ccache_dir" = @"guile_site_ccache_dir"@ ] && guile_site_ccache_dir=$(dirname $0)/../guile + [ "$guile_site_dir" = @"guile_site_dir"@ ] && guile_site_dir=$(dirname $0)/../guile + GUILE_AUTO_COMPILE=${GUILE_AUTO_COMPILE-0} + export GUILE_AUTO_COMPILE + GUILE_LOAD_COMPILED_PATH=$guile_site_ccache_dir:$GUILE_LOAD_COMPILED_PATH + exec ${GUILE-guile} -L $guile_site_dir -e '(mescc)' -s "$0" "$@" else MES=${MES-$(dirname $0)/mes} exec ${MES-mes} -e '(mescc)' -s $0 "$@" @@ -51,9 +52,9 @@ fi #:export (main)) (define %prefix (or (getenv "MES_PREFIX") - (if (string-prefix? "@PREFIX" "@PREFIX@") + (if (string-prefix? "@prefix" "@prefix@") "" - "@PREFIX@/share/mes"))) + "@prefix@/share/mes"))) (define %version (if (string-prefix? "@VERSION" "@VERSION@") "git" "@VERSION@"))