From 59b756781d398c16a26eb2a603b8ec48cecf8e71 Mon Sep 17 00:00:00 2001 From: Philip McGrath Date: Sun, 25 Feb 2024 14:43:32 -0500 Subject: [PATCH 1/3] configure: fix zlib and lz4 submodule checks Conditionals to skip the submodule checks were using the wrong variable names, so the checks were always skipped. The correct behavior is to perform the check unless given `ZLIB=` or `LZ4=`, as applicable. --- configure | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 2b4b594ed..7e0247b51 100755 --- a/configure +++ b/configure @@ -897,13 +897,13 @@ if [ ! -f "$srcdir"/nanopass/nanopass.ss ] ; then submod_instructions 'Source in "nanopass" is missing' fi -if [ "${zlibDep}" != "" ] ; then +if [ "${zlibLib}" = "" ] ; then if [ ! -f "$srcdir"/zlib/configure ] ; then submod_instructions 'Source in "zlib" is missing' fi fi -if [ "${LZ4Dep}" != "" ] ; then +if [ "${LZ4Lib}" = "" ] ; then if [ ! -f "$srcdir"/lz4/lib/Makefile ] ; then submod_instructions 'Source in "lz4" is missing' fi @@ -1083,7 +1083,7 @@ cp "$srcdir"/makefiles/buildmain.zuo main.zuo # Some idea, but in the workarea, so it refers to "workarea.zuo" here: cp "$srcdir"/makefiles/workmain.zuo $w/main.zuo -# The content of "$w/Makefile" records configuration decisions, +# The content of "$w/Mf-config" records configuration decisions, # and the Zuo build script takes it from there cat > $w/Mf-config << END srcdir=$srcdir From e3e4098b6ef692dd67a73e0d80e6b916eeb838c8 Mon Sep 17 00:00:00 2001 From: Philip McGrath Date: Sun, 25 Feb 2024 15:36:41 -0500 Subject: [PATCH 2/3] configure: support `ZUO=` Supplying `ZUO=` skips the submodule check in `configure` and configures the generated makefile not to build or remove Zuo. --- BUILDING | 5 +++-- configure | 22 ++++++++++++++++++++-- makefiles/Makefile.in | 6 ++---- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/BUILDING b/BUILDING index 7b3dc9c88..9e9a268be 100644 --- a/BUILDING +++ b/BUILDING @@ -149,7 +149,8 @@ information on the supported options. The generated makefile mostly just ensures that a `zuo` executable is built in a `bin` directory, and then it defers the actual build work to `zuo`, which uses the "main.zuo" file. If you have `zuo` installed, -you can use `zuo` directly instead of `make`. In general, instead of +you can use `zuo` directly instead of `make`: in that case, you may +wish to use `./configure ZUO=`. In general, instead of the command `make X` to build target `X` as described below, you can use `zuo . X` (or `bin/zuo . X` after `bin/zuo` is built). @@ -333,7 +334,7 @@ The makefile supports several targets: * `make clean` Removes all built elements from the workarea, and then removes - `bin/zuo`. + `bin/zuo` (unless configured with `ZUO=`). WINDOWS VIA COMMAND PROMPT diff --git a/configure b/configure index 7e0247b51..9c08fa19d 100755 --- a/configure +++ b/configure @@ -103,6 +103,7 @@ moreBootFiles= preloadBootFiles= alwaysUseBootFile= skipSubmoduleUpdate= +zuoExternal= CONFIG_UNAME=`uname` @@ -446,6 +447,9 @@ while [ $# != 0 ] ; do LZ4=*) LZ4Lib=`echo $1 | sed -e 's/^LZ4=//'` ;; + ZUO=*) + zuoExternal=`echo $1 | sed -e 's/^ZUO=//'` + ;; *) echo "option '$1' unrecognized or missing an argument; try $0 --help" exit 1 @@ -672,6 +676,7 @@ if [ "$help" = "yes" ]; then echo " STRIP= executable stripper" echo " ZLIB= link to instead of own zlib" echo " LZ4= link to instead of own LZ4" + echo " ZUO= build with instead of own Zuo" echo "" echo "Available machine types: $machs" echo "" @@ -889,8 +894,17 @@ submod_instructions () { exit 1 } -if [ ! -f "$srcdir"/zuo/configure ] ; then - submod_instructions 'Source in "zuo" is missing' +if [ "${zuoExternal}" = "" ] ; then + if [ ! -f "$srcdir"/zuo/configure ] ; then + submod_instructions 'Source in "zuo" is missing' + fi + ZUO="bin/zuo" + RM_ZUO="rm -f bin/zuo" + ZUO_TARGET="bin/zuo" +else + ZUO="${zuoExternal}" + RM_ZUO="@echo 'Not cleaning external ${zuoExternal}'" + ZUO_TARGET="DoNotBuildZuo" fi if [ ! -f "$srcdir"/nanopass/nanopass.ss ] ; then @@ -1130,6 +1144,10 @@ preloadBootFiles=$preloadBootFiles alwaysUseBootFile=$alwaysUseBootFile relativeBootFiles=$relativeBootFiles +ZUO=$ZUO +RM_ZUO=$RM_ZUO +ZUO_TARGET=$ZUO_TARGET + InstallBin=$installbin InstallLib=$installlib InstallMan=$installman/man1 diff --git a/makefiles/Makefile.in b/makefiles/Makefile.in index 3b95f0656..0e3d307d3 100644 --- a/makefiles/Makefile.in +++ b/makefiles/Makefile.in @@ -3,8 +3,6 @@ workarea=$(w) include $(workarea)/Mf-config -ZUO=bin/zuo - .PHONY: build build: $(ZUO) + $(ZUO) $(workarea) MAKE="$(MAKE)" @@ -144,9 +142,9 @@ pkg: $(ZUO) .PHONY: clean clean: $(ZUO) + $(ZUO) $(workarea) clean MAKE="$(MAKE)" - rm -f bin/zuo + $(RM_ZUO) # Using `+` here means that $(ZUO) gets built even if `-n`/`--dry-run` is provided to `make` -$(ZUO): $(srcdir)/zuo/zuo.c +$(ZUO_TARGET): $(srcdir)/zuo/zuo.c + mkdir -p bin + $(CC_FOR_BUILD) -DZUO_LIB_PATH='"'"../zuo/lib"'"' -o $(ZUO) $(srcdir)/zuo/zuo.c From 38640e763e8a6b35f2343a88e9561139a3bd7237 Mon Sep 17 00:00:00 2001 From: Philip McGrath Date: Sun, 25 Feb 2024 18:16:10 -0500 Subject: [PATCH 3/3] configure: support `STEXLIB=` For compatibility with older scripts, when not explicitly configured, continue to honor the `STEXLIB` environment variable at build time. --- build.zuo | 13 +++++++++---- configure | 12 ++++++++++-- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/build.zuo b/build.zuo index c21d2caa9..c5896396f 100644 --- a/build.zuo +++ b/build.zuo @@ -224,10 +224,15 @@ token)) (define stexlib - (let ((found (assoc "STEXLIB" (hash-ref (runtime-env) 'env)))) - (if found - (cdr found) - (at-source "stex")))) + (let ([configured (hash-ref config 'STEXLIB "")] + [env (assoc "STEXLIB" (hash-ref (runtime-env) 'env))]) + (cond + [(not (equal? "" configured)) + configured] + [env + (cdr env)] + [else + (at-source "stex")]))) (define stex-sources (source-tree stexlib)) diff --git a/configure b/configure index 9c08fa19d..782dd09b7 100755 --- a/configure +++ b/configure @@ -93,6 +93,7 @@ default_warning_flags="-Wpointer-arith -Wall -Wextra -Wno-implicit-fallthrough" CFLAGS_ADD= zlibLib= LZ4Lib= +STEXLIB= Kernel=KernelLib buildKernelOnly=no enableFrompb=yes @@ -447,6 +448,9 @@ while [ $# != 0 ] ; do LZ4=*) LZ4Lib=`echo $1 | sed -e 's/^LZ4=//'` ;; + STEXLIB=*) + STEXLIB=`echo $1 | sed -e 's/^STEXLIB=//'` + ;; ZUO=*) zuoExternal=`echo $1 | sed -e 's/^ZUO=//'` ;; @@ -676,6 +680,7 @@ if [ "$help" = "yes" ]; then echo " STRIP= executable stripper" echo " ZLIB= link to instead of own zlib" echo " LZ4= link to instead of own LZ4" + echo " STEXLIB= build docs with instead of own stex" echo " ZUO= build with instead of own Zuo" echo "" echo "Available machine types: $machs" @@ -923,8 +928,10 @@ if [ "${LZ4Lib}" = "" ] ; then fi fi -if [ ! -f "$srcdir"/stex/Mf-stex ] ; then - submod_instructions 'Source in "stex" is missing' +if [ "${STEXLIB}" = "" ] ; then + if [ ! -f "$srcdir"/stex/Mf-stex ] ; then + submod_instructions 'Source in "stex" is missing' + fi fi # more compile and link flags for c/Mf-unix and mats/Mf-unix @@ -1133,6 +1140,7 @@ cursesLib=$cursesLib ncursesLib=$ncursesLib zlibLib=$zlibLib LZ4Lib=$LZ4Lib +STEXLIB=$STEXLIB warningFlags=$warningFlags Kernel=$Kernel installscriptname=$installscriptname