[PATCH 0/7] gnu: Update Racket to 8.5 and Chez Scheme to 9.5.8.

  • Done
  • quality assurance status badge
Details
5 participants
  • Liliana Marie Prikler
  • Liliana Marie Prikler
  • Ludovic Courtès
  • Maxime Devos
  • Philip McGrath
Owner
unassigned
Submitted by
Philip McGrath
Severity
normal
P
P
Philip McGrath wrote on 3 May 2022 20:31
(address . guix-patches@gnu.org)
cover.1651594312.git.philip@philipmcgrath.com
Hi,

This patch series contains Racket 8.5 and upstream Chez Scheme 9.5.8:
both were re released since last week.

For upstream Chez Scheme, armhf-linux has been deleted from
`supported-systems` with a comment saying it's broken since before I
started contributing to Guix. I haven't changed that, since I don't have
access to an ARM system at the moment, and it doesn't have thread
support upstream anyway, but I think it should be fixed by this point,
if it hadn't been already. Could someone check?

Two recent developments in the Racket world are notable from a packaging
perspective:

1. After branching for this release, on HEAD Racket has adopted Zuo[1],
a tiny Raket-like language for build scripting. The Zuo interpreter
is a single C file that can be compiled as simply as `cc zuo.c`, and
libraries written in Zuo implement a DSL like `make` or (more so)
Shake[2] for build steps and tracking dependencies. Autoconf is
still there, and `make` can still be used in all of the ways it
could before (modulo bugs), but the makefiles actually just delegate
to Zuo.[3]

In theory, this shouldn't require any changes, but Guix is enough of
a stress test that it's exposed some rough edges: many have already
been fixed upstream, but a few will require changes to the Guix
packaging---but I think all the changes make things nicer, anyway. I
have a branch up at [4] based on Racket HEAD if anyone's interested:
the only remaining Zuo-related issue is with the Chez Scheme test
suite.

Overall, I for one already find the Zuo build scripts much more
comprehensible and hackable than the old makefiles. To pick just one
example of the former complexity, there was a build script
implementing a makefile-to-makefile compiler to support variable
propagation for non-GNU `make`s. Zuo (and Racket's use of it) is
also much more robust in dependency tracking. Formerly, you were
often better off throwing away your build directory and starting
again. I think this is an exciting step for anyone who builds Racket
from source regularly, and Zuo might be interesting for other
projects, too.

2. Racket's version of Chez Scheme has long had a “portable bytecode”
backend as an alternative to native-code compilation. Up to this
point it has primarily been a bootstrapping shortcut that didn't
require distributing binaries for every platform. With this release,
though, the implementation has improved: it now works even on
platforms for which there isn't a native-code backend available ---
for Guix, that includes powerpc64le-linux, riscv64-linux,
mips64el-linux, and i586-gnu --- and it performs well enough on
those platforms to make Racket CS viable instead of Racket BC (which
didn't have JIT support for those platforms, anyway). For Guix, this
also means that `(chez-scheme-for-system)` should be able to return
a working Chez Scheme package for every system.

Unfortunately, there are some issues with (at least) the `configure`
scripts in the release such that building Racket for those systems
doesn't quite work yet: see discussion at [5]. I'll be following up
on that, and I might backport the fixes if they end up being small
enough, but certainly it should work by Racket 8.6, scheduled for
July.

In the mean time, just knowing that this functionality is on its way
helped with figuring out how much could be thrown out to simplify
the follow-up to https://issues.guix.gnu.org/54292 at the end of
this patch series.

-Philip


Philip McGrath (7):
gnu: racket: Update to 8.5.
gnu: racket: Fix out-of-source build.
gnu: chez-scheme: Update to 9.5.8.
gnu: chez-scheme: Refactor documentation phases.
gnu: chez-scheme: Refactor configure phase and fix '--threads'.
gnu: stex: Get machine type dynamically.
gnu: chez-scheme-for-system: Adjust support logic.

gnu/local.mk | 2 -
gnu/packages/chez.scm | 416 +++++++++-------
.../racket-enable-scheme-backport.patch | 465 ------------------
...acket-gui-tethered-launcher-backport.patch | 26 -
gnu/packages/racket.scm | 106 ++--
5 files changed, 292 insertions(+), 723 deletions(-)
delete mode 100644 gnu/packages/patches/racket-enable-scheme-backport.patch
delete mode 100644 gnu/packages/patches/racket-gui-tethered-launcher-backport.patch


base-commit: 654f878f0b9d2136affa3e3d32da1639e6942a54
--
2.32.0
P
P
Philip McGrath wrote on 3 May 2022 20:33
[PATCH 1/7] gnu: racket: Update to 8.5.
(address . 55248@debbugs.gnu.org)(name . Philip McGrath)(address . philip@philipmcgrath.com)
2290ebb81a8acaa959eff9f60694330e495e3a19.1651594312.git.philip@philipmcgrath.com
* gnu/packages/patches/racket-gui-tethered-launcher-backport.patch,
gnu/packages/patches/racket-enable-scheme-backport.patch: Delete files.
* gnu/local.mk (dist_patch_DATA): Remove them.
* gnu/packages/chez.scm (chez-scheme-for-racket): Update to 9.5.7.6.
* gnu/packages/racket.scm (%racket-version): Update to 8.4.900.
(%racket-origin)[sha256]: Update accordingly.
[patches]: Remove obsolete patches.
(racket-vm-common-configure-flags): Remove incorrect comment.
(simple-racket-origin): Accept optional #:commit argument.
(racket)[inputs]<2d, datalog, deinprogramm, draw, drracket, expeditor, htdp,
pict, plot, quickscript, racklog, rackunit, redex, scribble, typed-racket,
string-constants, syntax-color, web-server, xrepl>: Update checksums.
<gui, srfi>: Likewise, and remove obsolete backports.
---
gnu/local.mk | 2 -
gnu/packages/chez.scm | 4 +-
.../racket-enable-scheme-backport.patch | 465 ------------------
...acket-gui-tethered-launcher-backport.patch | 26 -
gnu/packages/racket.scm | 85 ++--
5 files changed, 32 insertions(+), 550 deletions(-)
delete mode 100644 gnu/packages/patches/racket-enable-scheme-backport.patch
delete mode 100644 gnu/packages/patches/racket-gui-tethered-launcher-backport.patch

Toggle diff (195 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index ad7b0a1480..c812881809 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1757,8 +1757,6 @@ dist_patch_DATA = \
%D%/packages/patches/ripperx-missing-file.patch \
%D%/packages/patches/rpcbind-CVE-2017-8779.patch \
%D%/packages/patches/rtags-separate-rct.patch \
- %D%/packages/patches/racket-enable-scheme-backport.patch \
- %D%/packages/patches/racket-gui-tethered-launcher-backport.patch \
%D%/packages/patches/racket-minimal-sh-via-rktio.patch \
%D%/packages/patches/remake-impure-dirs.patch \
%D%/packages/patches/restic-0.9.6-fix-tests-for-go1.15.patch \
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index d47225dbe5..a7f75a731a 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -4,7 +4,7 @@
;;; Copyright © 2017, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2019 Brett Gilio <brettg@gnu.org>
;;; Copyright © 2020 Brendan Tildesley <mail@brendan.scot>
-;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
+;;; Copyright © 2021, 2022 Philip McGrath <philip@philipmcgrath.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -361,7 +361,7 @@ (define-public chez-scheme-for-racket
(package
(inherit chez-scheme)
(name "chez-scheme-for-racket")
- (version "9.5.7.3")
+ (version "9.5.7.6")
;; The version should match `(scheme-fork-version-number)`.
;; See racket/src/ChezScheme/s/cmacros.ss c. line 360.
;; It will always be different than the upstream version!
diff --git a/gnu/packages/patches/racket-enable-scheme-backport.patch b/gnu/packages/patches/racket-enable-scheme-backport.patch
deleted file mode 100644
index 3a5a4a3d82..0000000000
--- a/gnu/packages/patches/racket-enable-scheme-backport.patch
+++ /dev/null
@@ -1,465 +0,0 @@
-From 8d7687842f099e3e7e60d3a83fed58b2c6a92863 Mon Sep 17 00:00:00 2001
-From: Matthew Flatt <mflatt@racket-lang.org>
-Date: Sun, 6 Feb 2022 10:36:09 -0700
-Subject: [PATCH 1/2] Chez Scheme: adapt bootfile build for supplied `Scheme=`
-
-(cherry picked from commit fca1e02349664060e10278ca2ce6577a949bebf5)
-
-(Fixed conflicts by dropping pbchunks and pbarch changes.)
----
- racket/src/ChezScheme/configure | 15 ++++++++++++++-
- racket/src/ChezScheme/s/Mf-base | 4 ++--
- racket/src/ChezScheme/s/Mf-cross | 4 +++-
- 3 files changed, 19 insertions(+), 4 deletions(-)
-
-diff --git a/racket/src/ChezScheme/configure b/racket/src/ChezScheme/configure
-index 4515ffc105..0098829091 100755
---- a/racket/src/ChezScheme/configure
-+++ b/racket/src/ChezScheme/configure
-@@ -45,6 +45,7 @@ threads=yes
- nothreads=no
- temproot=""
- help=no
-+forceworkarea=no
- gzipmanpages=yes
- installowner=""
- installgroup=""
-@@ -205,6 +206,9 @@ while [ $# != 0 ] ; do
- --pb)
- pb=yes
- ;;
-+ --force)
-+ forceworkarea=yes
-+ ;;
- --installprefix=*)
- installprefix=`echo $1 | sed -e 's/^--installprefix=//'`
- ;;
-@@ -439,6 +443,7 @@ if [ "$help" = "yes" ]; then
- echo " --toolprefix=<prefix> prefix tool (compiler, linker, ...) names"
- echo " --[no]gzip-man-pages compress manual pages ($gzipmanpages)"
- echo " --workarea=<pathname> build directory ($w)"
-+ echo " --force configure even without boot files"
- echo " CC=<C compiler> C compiler"
- echo " CPPFLAGS=<C preprocessor flags> C preprocessor flags"
- echo " CFLAGS=<C compiler flags> C compiler flags"
-@@ -721,8 +726,16 @@ case "${flagsmuni}" in
- ;;
- esac
-
-+if [ "$w" = "$m" ] ; then
-+ configuringin=""
-+else
-+ configuringin=" in $w"
-+fi
-+
- if [ -f boot/$m/scheme.boot -o -f "$srcdir"/boot/$m/scheme.boot ] ; then
-- echo "Configuring for $m"
-+ echo "Configuring for $m$configuringin"
-+elif [ "$forceworkarea" = yes ] ; then
-+ echo "Configuring for $m$configuringin despite missing boot files"
- else
- if [ "$m" = "" ] ; then
- maybem="<machine type>"
-diff --git a/racket/src/ChezScheme/s/Mf-base b/racket/src/ChezScheme/s/Mf-base
-index cc6178c973..1f4a967998 100644
---- a/racket/src/ChezScheme/s/Mf-base
-+++ b/racket/src/ChezScheme/s/Mf-base
-@@ -94,7 +94,7 @@ endif
- # that Scheme and SCHEMEHEAPDIRS are set by Mf-cross to point to the host Scheme
- # implementation
- Scheme = ../bin/$m/scheme${ExeSuffix}
--export SCHEMEHEAPDIRS=../boot/%m
-+export SCHEMEHEAPDIRS=../boot/$m
- export CHEZSCHEMELIBDIRS=.
-
- # Define the libdirs separator character
-@@ -691,4 +691,4 @@ reset-one:
-
- .PHONY: run
- run:
-- env SCHEMEHEAPDIRS=../boot/$m/ ../bin/$m/scheme $(ARGS)
-+ env SCHEMEHEAPDIRS=${SCHEMEHEAPDIRS} ${Scheme} $(ARGS)
-diff --git a/racket/src/ChezScheme/s/Mf-cross b/racket/src/ChezScheme/s/Mf-cross
-index d796cbb459..397af59a28 100644
---- a/racket/src/ChezScheme/s/Mf-cross
-+++ b/racket/src/ChezScheme/s/Mf-cross
-@@ -43,5 +43,7 @@ x$(xm).$(m):
- $(MAKE) -f Mf-cross m=$(m) xm=$(xm) i=f o=3 d=0 xpatch
- mv xpatch x$(xm).$(m)
-
-+ifneq ($(SCHEMEHEAPDIRS),:)
- # Ensure that cross-compiling "nanopass.so" is rebuilt if the host compiler changed
--nanopass.so: ${SCHEME} ${SCHEMEHEAPDIRS}/petite.boot ${SCHEMEHEAPDIRS}/scheme.boot
-+nanopass.so: ${Scheme} ${SCHEMEHEAPDIRS}/petite.boot ${SCHEMEHEAPDIRS}/scheme.boot
-+endif
---
-2.32.0
-
-
-From 26c8e2c1d9b02ad85acef8bda40d92154cf0b699 Mon Sep 17 00:00:00 2001
-From: Matthew Flatt <mflatt@racket-lang.org>
-Date: Sun, 6 Feb 2022 11:03:30 -0700
-Subject: [PATCH 2/2] configure: make `--enable-scheme` work with an executable
-
-When the same Chez Scheme version as used by Racket is already
-available, then `--enable-scheme=...` can supply an executable. For
-cross builds, `--enable-scheme=...` can still supply a build
-directory, instead, as before.
-
-(cherry picked from commit 4f0e76855ce7e86107de495292a553469daf0b3f)
----
- racket/src/ChezScheme/makefiles/Makefile.in | 3 ++
- racket/src/README.txt | 30 +++++++++++---
- racket/src/configure | 8 +++-
- racket/src/cs/README.txt | 6 ++-
- racket/src/cs/c/Makefile.in | 44 ++++++++++++++++-----
- racket/src/cs/c/configure | 24 +++++++++--
- racket/src/cs/c/configure.ac | 21 ++++++++--
- 7 files changed, 112 insertions(+), 24 deletions(-)
-
-diff --git a/racket/src/ChezScheme/makefiles/Makefile.in b/racket/src/ChezScheme/makefiles/Makefile.in
-index c396efc851..3998ef9ccd 100644
---- a/racket/src/ChezScheme/makefiles/Makefile.in
-+++ b/racket/src/ChezScheme/makefiles/Makefile.in
-@@ -59,6 +59,9 @@ reset:
- %.boot:
- (cd $(workarea) && $(MAKE) $*.boot)
-
-+auto.boot:
-+ (cd $(workarea) && $(MAKE) $(defaultm).boot)
-+
- # <machine>.bootquick to build boot files for <machine>
- # with o=3 d=0 for the cross compiler, and only after
- # building the kernel for the configured machine
-diff --git a/racket/src/README.txt b/racket/src/README.txt
-index 98647aebce..d77310b4a4 100644
---- a/racket/src/README.txt
-+++ b/racket/src/README.txt
-@@ -354,6 +354,10 @@ variant of MinGW without "libdelayimp.a", get the implementation of
- ========================================================================
-
- Cross-compilation requires at least two flags to `configure`:
-+`--host=OS` and either `--enable-racket=RACKET` or (for Racket CS)
-+`--enable-scheme-SCHEME`.
-+
-+More information:
-
- * `--host=OS`, where OS is something like `i386-gnu-linux` to
- indicate the target platform.
-@@ -374,11 +378,27 @@ Cross-compilation requires at least two flags to `configure`:
- run `configure` again (with no arguments) in a "local" subdirectory
- to create a build for the current platform.
-
--An additional flag is needed for building Racket CS, unless the flag
--`--enable-racket=auto` is used:
--
-- * `--enable-scheme=DIR`, where DIR is a path that has a "ChezScheme"
-- directory where Chez Scheme is built for the host system.
-+ * `--enable-scheme=SCHEME`, where SCHEME is a Chez Scheme executable
-+ executable that runs on the build platform; the executable must be
-+ the same version as used in Racket built for the target platform.
-+
-+ Supplying `--enable-scheme=DIR` is also supported in cross-build
-+ mode, where DIR is a path that has a "ChezScheme" directory where
-+ Chez Scheme is built for the host system.
-+
-+The `--enable-racket=RACKET` and `--enable-scheme=SCHEME` flags are
-+allowed for non-cross builds, too:
-+
-+ * For Racket CS, supplying either selects a Racket or Chez Scheme
-+ implementation used to create boot files to the build platform.
-+ Suppling Chez Scheme is a much more direct path, but when Racket is
-+ supplied, its version does not have to match the version being
-+ built.
-+
-+ * For Racket BC, `--enable-racket=RACKET` selects a Racket for
-+ prepare C sources to cooperate with garbage collection. Its version
-+ needs to be close to the one being built, and potentially exactly
-+ the same version.
-
- Some less commonly needed `configure` flags are for Racket BC:
-
-diff --git a/racket/src/configure b/racket/src/configure
-index c9f3ba4419..1b53ec7ce2 100755
---- a/racket/src/configure
-+++ b/racket/src/configure
-@@ -9,6 +9,7 @@ pb_dir="$dir/ChezScheme/boot/pb"
- use_cs=maybe
- use_bc=maybe
- supplied_racket=no
-+supplied_scheme=no
- enable_boothelp=
-
- # We don't have to detect conflicts like `--enable-csdefault --enable-bcdefault`,
-@@ -34,6 +35,9 @@ for arg in $*; do
- --enable-racket=*)
- supplied_racket=yes
- ;;
-+ --enable-scheme=*)
-+ supplied_scheme=yes
-+ ;;
- --help | -h)
- echo $0:
- echo see --help-bc or --help-cs, since the Racket CS build and the
-@@ -70,8 +74,8 @@ elif test "$use_cs" = "maybe" ; then
- fi
-
- if test "$use_cs" = "yes" ; then
-- if test $use_bc = no -a $supplied_racket = no -a ! -d "$pb_dir" ; then
-- echo $0: must have $pb_dir or --enable-racket=... for --enable-csonly
-+ if test $use_bc = no -a $supplied_racket = no -a $supplied_scheme = no -a ! -d "$pb_dir" ; then
-+ echo $0: must have $pb_dir, --enable-racket=... or --enable-scheme=... for --enable-csonly
- exit 1
- fi
-
-diff --git a/racket/src/cs/README.txt b/racket/src/cs/README.txt
-index 2ece417b78..8e6fc57b74 100644
---- a/racket/src/cs/README.txt
-+++ b/racket/src/cs/README.txt
-@@ -39,6 +39,11 @@ build:
- installed in the "../ChezScheme/boot/pb" directory as described by
- "../ChezScheme/BUILDING".
-
-+ Supplying `--enable-scheme=...` is also an option if you alerady
-+ have the same version of Chez Scheme built on the current platform.
-+ Another build will be created, anyway, but more quickly than
-+ without Chez Scheme.
-+
- * Racket is needed to generate the files in the "schemified"
- directory from the sources in sibling directories like "../io". The
- Racket version must be practically the same as the current Racket
-@@ -48,7 +53,6 @@ build:
- Unlike Chez Scheme boot files, the files generated in "schemified"
- are human-readable and -editable Scheme code. That provides a way
- out of bootstrapping black holes, even without BC.
--
-
-
- ========================================================================
-diff --git a/racket/src/cs/c/Makefile.in b/racket/src/cs/c/Makefile.in
-index 54a644a1d9..d73993f0fc 100644
---- a/racket/src/cs/c/Makefile.in
-+++ b/racket/src/cs/c/Makefile.in
-@@ -12,7 +12,9 @@ CS_HOST_WORKAREA_PREFIX = @CS_HOST_WORKAREA_PREFIX@
- SCHEME_HOST_WORKAREA = $(CS_HOST_WORKAREA_PREFIX)$(SCHEME_WORKAREA)
- SCHEME_BIN = $(SCHEME_HOST_WORKAREA)/$(MACH)/bin/$(MACH)/scheme
- SCHEME_INC = $(SCHEME_HOST_WORKAREA)/$(MACH)/boot/$(MACH)
--SCHEME = $(SCHEME_BIN) -B $(SCHEME_INC)/petite.boot -B $(SCHEME_INC)/scheme.boot
-+SCHEME_built = $(SCHEME_BIN) -B $(SCHEME_INC)/petite.boot -B $(SCHEME_INC)/scheme.boot
-+SCHEME_existing = @MAKE_SCHEME_SCHEME@
-+SCHEME = $(SCHEME@USE_SCHEME_MODE@)
-
- TARGET_MACH = @TARGET_MACH@
- SCHEME_TARGET_INC = $(SCHEME_WORKAREA)/$(TARGET_MACH)/boot/$(TARGET_MACH)
-@@ -88,7 +90,7 @@ mainsrcdir = @srcdir@/../..
- @INCLUDEDEP@ @srcdir@/../../version/version.mak
-
- cs:
-- $(MAKE) scheme@T_CROSS_MODE@
-+ $(MAKE) scheme@MAKE_SCHEME_MODE@
- $(MAKE) racket-so
- cd rktio; $(MAKE)
- $(MAKE) racketcs
-@@ -121,9 +123,13 @@ racket-so:
-
- RACKET_SO_ENV = @CONFIGURE_RACKET_SO_COMPILE@
-
-+TARGET_MACH_built = $(TARGET_MACH)
-+TARGET_MACH_existing = xc-$(TARGET_MACH)
-+XPATCH_FILE = $(SCHEME_WORKAREA)/$(TARGET_MACH@USE_SCHEME_MODE@)/s/xpatch
-+
- CS_PROGS = SCHEME="$(SCHEME)"
- CS_OPTS = COMPRESS_COMP=@COMPRESS_COMP@ @ENABLE_OR_DISABLE_WPO@
--CS_OPTScross = $(CS_OPTS) CSO=$(MACH) CROSS_COMP="--xpatch $(SCHEME_WORKAREA)/$(TARGET_MACH)/s/xpatch"
-+CS_OPTScross = $(CS_OPTS) CSO=$(MACH) CROSS_COMP="--xpatch $(XPATCH_FILE)"
- PASS_COMPILE_DEPS = EXTRA_COMPILE_DEPS="$(SCHEME_INC)/petite.boot $(SCHEME_INC)/scheme.boot"
-
- build-racket-so:
-@@ -163,6 +169,15 @@ pb-bootquick:
- cd $(SCHEME_WORKAREA) && $(MAKE) reset
- $(SHELL) $(srcdir)/ready_boot.sh $(MACH) $(SCHEME_WORKAREA)
-
-+scheme-via-scheme:
-+ $(MAKE) $(SCHEME_WORKAREA)/boot/$(MACH)/scheme.boot
-+ $(MAKE) mach-make
-+
-+$(SCHEME_WORKAREA)/boot/$(MACH)/scheme.boot:
-+ mkdir -p $(SCHEME_WORKAREA)
-+ $(MAKE) config-scheme CONFIG_SCHEME_MODE="$(CONFIG_SCHEME_MODE) --force"
-+ cd $(SCHEME_WORKAREA) && $(MAKE) $(MACH).boot Scheme="$(SCHEME)" SCHEMEHEAPDIRS=: o=3 d=0 what=all
-+
- mach-make:
- $(MAKE) config-scheme
- cd $(SCHEME_WORKAREA) && $(MAKE)
-@@ -182,24 +197,33 @@ config-scheme:
-
- scheme-cross:
- env MAKE_BOOT_FOR_CROSS=yes SCHEME_SRC="$(SCHEME_DIR)" SCHEME_WORKAREA=$(SCHEME_WORKAREA) MACH="$(TARGET_MACH)" $(BOOTSTRAP_RACKET) "$(SCHEME_DIR)"/rktboot/make-boot.rkt
-+ $(MAKE) finish-scheme-cross
-+
-+finish-scheme-cross:
- $(SHELL) $(srcdir)/reset_boot.sh $(TARGET_MACH) $(SCHEME_WORKAREA)
- cd $(SCHEME_WORKAREA) && "$(UP_SCHEME_DIR)"/configure @SCHEME_CROSS_CONFIG_ARGS@ $(SCHEME_CONFIG_VARS)
- cd $(SCHEME_WORKAREA)/$(TARGET_MACH)/c && $(CHOST_HACK@T_CROSS_MODE@) $(MAKE) o=o cross=t
-- $(MAKE) $(SCHEME_WORKAREA)/$(TARGET_MACH)/s/xpatch
-+ $(MAKE) $(XPATCH_FILE)
-+
-+scheme-cross-via-scheme:
-+ $(MAKE) $(SCHEME_WORKAREA)/boot/$(TARGET_MACH)/scheme.boot MACH=$(TARGET_MACH)
-+ $(MAKE) finish-scheme-cross
-
- # Rebuild patch file and cross "petite.boot" and "scheme.boot" when older
--# than the build-host "scheme.boot" or when "make-boot.rkt" touchs dummy boot files
--XPATCH_DEPS = $(SCHEME_HOST_WORKAREA)/$(MACH)/boot/$(MACH)/scheme.boot \
-- $(SCHEME_WORKAREA)/boot/$(TARGET_MACH)/scheme.boot
-+# than the build-<host "scheme.boot" or when "make-boot.rkt" touchs dummy boot files
-+XPATCH_DEPS_built = $(SCHEME_HOST_WORKAREA)/$(MACH)/boot/$(MACH)/scheme.boot \
-+ $(SCHEME_WORKAREA)/boot/$(TARGET_MACH)/scheme.boot
-+XPATCH_DEPS_existing =
-+XPATCH_DEPS = $(XPATCH_DEPS@USE_SCHEME_MODE@)
-
--$(SCHEME_WORKAREA)/$(TARGET_MACH)/s/xpatch: $(XPATCH_DEPS)
-+$(XPATCH_FILE): $(XPATCH_DEPS)
- $(MAKE) bounce TARGET=build-xpatch-using-host
-
- build-xpatch-using-host:
- cd $(SCHEME_WORKAREA)/$(TARGET_MACH)/s && $(MAKE) -f Mf-cross m=$(MACH) xm=$(TARGET_MACH) Scheme="$(SCHEME_BIN)" SCHEMEHEAPDIRS="$(SCHEME_INC)"
-
- XPATCH =
--XPATCHcross = --xpatch $(SCHEME_WORKAREA)/$(TARGET_MACH)/s/xpatch
-+XPATCHcross = --xpatch $(XPATCH_FILE)
-
- racket.boot: racket.so
- $(SCHEME) --script $(srcdir)/convert-to-boot.ss @BOOT_COMPRESS_COMP@ $(XPATCH@CROSS_MODE@) racket.so racket.boot $(TARGET_MACH)
-@@ -410,7 +434,7 @@ install-cross:
- $(MAKE) compile-xpatch.$(TARGET_MACH)
- $(MAKE) library-xpatch.$(TARGET_MACH)
-
--SCHEME_XPATCH = $(SCHEME_WORKAREA)/$(TARGET_MACH)/s/xpatch
-+SCHEME_XPATCH = $(XPATCH_FILE)
-
- CROSS_SERVE_DEPS = $(srcdir)/mk-cross-serve.ss $(srcdir)/cross-serve.ss \
- $(srcdir)/../expander/env.ss $(srcdir)/../linklet/config.ss
-diff --git a/racket/src/cs/c/configure b/racket/src/cs/c/configure
-index 21695a431a..1eeef57753 100755
---- a/racket/src/cs/c/configure
-+++ b/racket/src/cs/c/configure
-@@ -654,6 +654,9 @@ MINGW
- NOT_OSX
- OSX
- SETUP_BOOT_MODE
-+USE_SCHEME_MODE
-+MAKE_SCHEME_SCHEME
-+MAKE_SCHEME_MODE
- TT_CROSS_MODE
- T_CROSS_MODE
- CROSS_MODE
-@@ -1448,7 +1451,7 @@ Optional Features:
- --enable-docs build docs on install (enabled by default)
- --enable-usersetup setup user-specific files on install
- --enable-racket=<path> use <path> as Racket for build; or "auto" to create
-- --enable-scheme=<path> use <path> as host's build directory for cross
-+ --enable-scheme=<path> use <path> as host build for cross
- --enable-mach=<mach> use Chez Scheme machine type <mach>
- --enable-target=<mach> cross-build for Chez Scheme machine type <mach>
- --enable-portable prefer portable to host-specific
-@@ -2867,7 +2870,7 @@ show_explicitly_enabled "${enable_xonx}" "Unix style"
- show_explicitly_enabled "${enable_libzo}" 'Compiled ".zo" files moved to lib'
-
- show_explicitly_set "${enable_racket}" "Racket"
--show_explicitly_set "${enable_scheme}" "Chez Scheme build directory"
-+show_explicitly_set "${enable_scheme}" "Chez Scheme for build"
- show_explicitly_set "${enable_mach}" "machine type"
- show_explicitly_set "${enable_target}" "cross-build machine type"
- show_explicitly_enabled "${enable_portable}" "portable"
-@@ -4745,9 +4748,21 @@ esac
-
- SCHEME_DIR=${srcdir}/../../ChezScheme
- MAKE_BUILD_SCHEME=checkout
-+USE_SCHEME_MODE="_built"
-+MAKE_SCHEME_MODE="${T_CROSS_MODE}"
-
- if test "${enable_scheme}" != "" ; then
-- CS_HOST_WORKAREA_PREFIX="${enable_scheme}/"
-+ if test -d "${enable_scheme}" ; then
-+ # Directory exists, so use it as a build directory
-+ echo "Using supplied Scheme path as a build directory"
-+ CS_HOST_WORKAREA_PREFIX="${enable_scheme}/"
-+ else
-+ # Directory does not exist, so assume it's an executable
-+ echo "Using supplied Scheme path as an executable"
-+ MAKE_SCHEME_MODE="${T_CROSS_MODE}-via-scheme"
-+ MAKE_SCHEME_SCHEME="${enable_scheme}"
-+ USE_SCHEME_MODE="_existing"
-+ fi
- fi
-
- if test "${enable_racket}" != "" ; then
-@@ -6012,6 +6027,9 @@ SCHEME_CROSS_CONFIG_ARGS="--machine=${TARGET_MACH} --disable-x11 ${cs_auto_flags
-
-
-
-+
-+
-+
-
-
-
-diff --git a/racket/src/cs/c/configure.ac b/racket/src/cs/c/configure.ac
-index 464ebe1760..aaee88156d 100644
---- a/racket/src/cs/c/configure.ac
-+++ b/racket/src/cs/c/configure.ac
-@@ -23,7 +23,7 @@ AC_ARG_ENABLE(compressmore, [ --enable-compressmore compress compiled code ev
- AC_ARG_ENABLE(compressboot, [ --enable-com
This message was truncated. Download the full message here.
P
P
Philip McGrath wrote on 3 May 2022 20:33
[PATCH 2/7] gnu: racket: Fix out-of-source build.
(address . 55248@debbugs.gnu.org)(name . Philip McGrath)(address . philip@philipmcgrath.com)
f19329dc2f36a10f3fdc9985887cb2cf66dce094.1651594312.git.philip@philipmcgrath.com
* gnu/packages/racket.scm (racket-vm-cgc)[arguments]: Add a 'symlink-src'
phase to put license files where 'install-license-files' expects to find
them. Supply '#:out-of-source? #t'.
---
gnu/packages/racket.scm | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)

Toggle diff (34 lines)
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index adf3ccfd74..2f4f7cebd8 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -272,8 +272,8 @@ (define-public racket-vm-cgc
;; main-distribution-test that aren't part of the main
;; distribution.
#:tests? #f
- ;; Upstream recommends #:out-of-source?, and it does
- ;; help with debugging, but it confuses `install-license-files`.
+ ;; Upstream recommends #:out-of-source?, and helps a lot with debugging
+ #:out-of-source? #t
#:modules '((ice-9 match)
(ice-9 regex)
(guix build gnu-build-system)
@@ -310,7 +310,15 @@ (define-public racket-vm-cgc
#f)))))))
(add-before 'configure 'chdir
(lambda _
- (chdir "racket/src"))))))
+ (chdir "racket/src")))
+ (add-after 'chdir 'symlink-src
+ ;; workaround for install-license-files
+ (lambda* (#:key out-of-source? #:allow-other-keys)
+ (when out-of-source?
+ (with-directory-excursion ".."
+ (symlink "src"
+ (package-name->name+version
+ (strip-store-file-name #$output))))))))))
(home-page "https://racket-lang.org")
(synopsis "Old Racket implementation used for bootstrapping")
(description "This variant of the Racket BC (``before Chez'' or
--
2.32.0
P
P
Philip McGrath wrote on 3 May 2022 20:33
[PATCH 3/7] gnu: chez-scheme: Update to 9.5.8.
(address . 55248@debbugs.gnu.org)(name . Philip McGrath)(address . philip@philipmcgrath.com)
dd25db93b75a0ea727de31f55459727e717280a2.1651594312.git.philip@philipmcgrath.com
* gnu/packages/chez.scm (chez-scheme): Update to 9.5.8.
---
gnu/packages/chez.scm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Toggle diff (24 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index a7f75a731a..34545b1f58 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -210,7 +210,7 @@ (define-public chez-scheme
(name "chez-scheme")
;; The version should match `(scheme-version-number)`.
;; See s/cmacros.ss c. line 360.
- (version "9.5.6")
+ (version "9.5.8")
(source (origin
(method git-fetch)
(uri (git-reference
@@ -218,7 +218,7 @@ (define-public chez-scheme
(commit (string-append "v" version))))
(sha256
(base32
- "07s433hn1z2slfc026sidrpzxv3a8narcd40qqr1xrpb9012xdky"))
+ "0xchqq8cm0ka5wgpn18sjs0hh15rc3nb7xrjqbbc9al3asq0d7gc"))
(file-name (git-file-name name version))
(snippet #~(begin
(use-modules (guix build utils))
--
2.32.0
P
P
Philip McGrath wrote on 3 May 2022 20:33
[PATCH 4/7] gnu: chez-scheme: Refactor documentation phases.
(address . 55248@debbugs.gnu.org)(name . Philip McGrath)(address . philip@philipmcgrath.com)
a62cddb68f3a0e02def85684bbdacfb04e86ad61.1651594312.git.philip@philipmcgrath.com
Patches merged in Racket's variant of Chez Scheme and submitted to the
upstream variant will soon let us replace the 'install-docs' phase with
just 'make install-docs'. Separating the 'link-doc-pdfs' phase (which
won't change) leaves us well-prepared for the transition, regardless of
whether Chez Scheme 9.5.10 or Racket 8.6 is released first.

* gnu/packages/chez.scm (chez-scheme)[arguments]: Split 'install-doc'
phase into 'install-docs' (matching the future 'make' target) and
'link-doc-pdfs'.
---
gnu/packages/chez.scm | 64 ++++++++++++++++++++++++-------------------
1 file changed, 36 insertions(+), 28 deletions(-)

Toggle diff (78 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 34545b1f58..49051abd17 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -309,35 +309,43 @@ (define-public chez-scheme
(string-append (dirname scheme.boot)
"/chez-scheme.boot")))))))
;; Building the documentation requires stex and a running scheme.
- ;; FIXME: this is probably wrong for cross-compilation
- (add-after 'install-symlink 'install-doc
+ (add-after 'install-symlink 'install-docs
(lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
- (match (assoc-ref outputs "doc")
- (#f
- (format #t "not installing docs~%"))
- (doc-prefix
- (let* ((chez+version (strip-store-file-name #$output))
- (scheme (search-input-file outputs "/bin/scheme"))
- (stexlib (search-input-directory (or native-inputs
- inputs)
- "/lib/stex"))
- (doc-dir (string-append doc-prefix
- "/share/doc/"
- chez+version)))
- (define* (stex-make #:optional (suffix ""))
- (invoke "make" "install"
- (string-append "Scheme=" scheme)
- (string-append "STEXLIB=" stexlib)
- (string-append "installdir=" doc-dir suffix)))
- (with-directory-excursion "csug"
- (stex-make "/csug"))
- (with-directory-excursion "release_notes"
- (stex-make "/release_notes"))
- (with-directory-excursion doc-dir
- (symlink "release_notes/release_notes.pdf"
- "release_notes.pdf")
- (symlink "csug/csug9_5.pdf"
- "csug.pdf"))))))))))
+ (let* ((doc-prefix (or (assoc-ref outputs "doc")
+ (assoc-ref outputs "out")))
+ (chez+version (strip-store-file-name #$output))
+ (scheme (search-input-file outputs "/bin/scheme"))
+ (stexlib (search-input-directory (or native-inputs
+ inputs)
+ "/lib/stex"))
+ (doc-dir (string-append doc-prefix
+ "/share/doc/"
+ chez+version)))
+ (define* (stex-make #:optional (suffix ""))
+ (invoke "make" "install"
+ (string-append "Scheme=" scheme)
+ (string-append "STEXLIB=" stexlib)
+ (string-append "installdir=" doc-dir suffix)))
+ (with-directory-excursion "csug"
+ (stex-make "/csug"))
+ (with-directory-excursion "release_notes"
+ (stex-make "/release_notes")))))
+ (add-after 'install-docs 'link-doc-pdfs
+ ;; otherwise, it's hard to notice them in a forest of HTML files
+ (lambda* (#:key outputs #:allow-other-keys)
+ (with-directory-excursion
+ (string-append (or (assoc-ref outputs "doc")
+ (assoc-ref outputs "out"))
+ "/share/doc/"
+ (strip-store-file-name #$output))
+ (symlink "release_notes/release_notes.pdf"
+ "release_notes.pdf")
+ (match (find-files "csug"
+ "csug.*\\.pdf$" ;; embeded version number
+ #:fail-on-error? #t)
+ ((pth)
+ (symlink pth
+ "csug.pdf")))))))))
;; Chez Scheme does not have a MIPS backend.
;; FIXME: Debian backports patches to get armhf working.
;; We should too. It is the Chez machine type arm32le
--
2.32.0
P
P
Philip McGrath wrote on 3 May 2022 20:33
[PATCH 5/7] gnu: chez-scheme: Refactor configure phase and fix '--threads'.
(address . 55248@debbugs.gnu.org)(name . Philip McGrath)(address . philip@philipmcgrath.com)
9e681352e108ec1464b3f35beb04f6d338450009.1651594312.git.philip@philipmcgrath.com
Move Chez-specific logic into '#:configure-flags' and a new
'configure-environment-variables' phase, leaving the 'configure' phase
as just a variant of the one from 'gnu-build-system' (including support
for '#:out-of-source?') that doesn't add implicit Autoconf-style flags.

In the process, do the right thing for "--threads", rather than assuming
the only nonthreaded platform is broken.

* gnu/packages/chez.scm (chez-scheme)[arguments]: Set configure flags in
'#:configure-flags' and separate 'configure-environment-variables' from
the residual 'configure' phase. More closely follow 'gnu-build-system'.
Use 'chez-upstream-features-for-system' for "--threads".
(chez-scheme-for-racket)[arguments]<#:configure-flags>: Add "--threads"
unconditionally.
---
gnu/packages/chez.scm | 63 ++++++++++++++++++++++++++++---------------
1 file changed, 42 insertions(+), 21 deletions(-)

Toggle diff (92 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 49051abd17..785b6837c1 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -258,8 +258,18 @@ (define-public chez-scheme
(ice-9 ftw)
(ice-9 match))
#:test-target "test"
- ;; TODO when we fix armhf, it may not support --threads
- #:configure-flags #~'("--threads")
+ #:configure-flags
+ #~`(,(string-append "--installprefix=" #$output)
+ #$@(if (and=> (chez-upstream-features-for-system)
+ (cut memq 'threads <>))
+ #~("--threads")
+ #~())
+ "ZLIB=-lz"
+ "LZ4=-llz4"
+ "--libkernel"
+ ;; Guix will do 'compress-man-pages',
+ ;; and letting Chez try causes an error
+ "--nogzip-man-pages")
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'unpack-nanopass+stex
@@ -273,26 +283,35 @@ (define-public chez-scheme
(search-input-directory (or native-inputs inputs)
"lib/chez-scheme-bootfiles")
"boot")))
- ;; NOTE: the custom Chez 'configure' script doesn't allow
+ ;; NOTE: The custom Chez 'configure' script doesn't allow
;; unrecognized flags, such as those automatically added
- ;; by `gnu-build-system`.
+ ;; by `gnu-build-system`. This replacement phase uses only
+ ;; the explicitly provided `#:configure-flags`.
(replace 'configure
- (lambda* (#:key inputs (configure-flags '()) #:allow-other-keys)
- ;; add flags which are always required:
- (let ((flags (cons* (string-append "--installprefix=" #$output)
- "ZLIB=-lz"
- "LZ4=-llz4"
- "--libkernel"
- ;; Guix will do compress-man-pages,
- ;; and letting Chez try causes an error
- "--nogzip-man-pages"
- configure-flags)))
- (format #t "configure flags: ~s~%" flags)
- ;; Some makefiles (for tests) don't seem to propagate CC
- ;; properly, so we take it out of their hands:
- (setenv "CC" #$(cc-for-target))
- (setenv "HOME" "/tmp")
- (apply invoke "./configure" flags))))
+ (lambda* (#:key inputs (configure-flags '()) out-of-source?
+ #:allow-other-keys)
+ (let* ((abs-srcdir (getcwd))
+ (srcdir (if out-of-source?
+ (string-append "../" (basename abs-srcdir))
+ ".")))
+ (format #t "source directory: ~s (relative from build: ~s)~%"
+ abs-srcdir srcdir)
+ (if out-of-source?
+ (begin
+ (mkdir "../build")
+ (chdir "../build")))
+ (format #t "build directory: ~s~%" (getcwd))
+ (format #t "configure flags: ~s~%" configure-flags)
+ (apply invoke
+ (string-append srcdir "/configure")
+ configure-flags))))
+ (add-after 'configure 'configure-environment-variables
+ (lambda args
+ ;; Some makefiles (for tests) don't seem to propagate CC
+ ;; properly, so we take it out of their hands:
+ (setenv "CC" #$(cc-for-target))
+ ;; Likewise, some tests have needed HOME to be set:
+ (setenv "HOME" "/tmp")))
;; The binary file name is called "scheme" as is the one from
;; MIT/GNU Scheme. We add a symlink to use in case both are
;; installed.
@@ -385,7 +404,9 @@ (define-public chez-scheme-for-racket
(arguments
(substitute-keyword-arguments (package-arguments chez-scheme)
((#:configure-flags cfg-flags #~'())
- #~(cons "--disable-x11" #$cfg-flags))
+ #~(cons* "--disable-x11"
+ "--threads" ;; ok to potentially duplicate
+ #$cfg-flags))
((#:phases those-phases #~%standard-phases)
#~(let* ((those-phases #$those-phases)
(unpack (assoc-ref those-phases 'unpack)))
--
2.32.0
P
P
Philip McGrath wrote on 3 May 2022 20:33
[PATCH 6/7] gnu: stex: Get machine type dynamically.
(address . 55248@debbugs.gnu.org)(name . Philip McGrath)(address . philip@philipmcgrath.com)
5375de56eda0ee7c218ddf48da61ea600c0d2589.1651594312.git.philip@philipmcgrath.com
* gnu/packages/chez.scm (stex)[arguments]: Run 'scheme' to determine
the machine type.
---
gnu/packages/chez.scm | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

Toggle diff (32 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 785b6837c1..ea53cf5774 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -602,6 +602,10 @@ (define-public stex-bootstrap
("src" "lib/stex/")
("Mf-stex" "lib/stex/")
("Makefile.template" "lib/stex/"))
+ #:modules
+ '((guix build copy-build-system)
+ (guix build utils)
+ (ice-9 popen))
#:phases
#~(modify-phases %standard-phases
(add-before 'install 'patch-sources
@@ -633,8 +637,12 @@ (define-public stex-bootstrap
(define makefile
(string-append (getcwd) "/Makefile"))
(define machine
- #$(and=> (nix-system->chez-machine)
- chez-machine->threaded))
+ (let ((pipe (open-pipe* OPEN_BOTH scheme "-q")))
+ (write '(machine-type) pipe)
+ (force-output pipe)
+ (let ((sym (read pipe)))
+ (close-pipe pipe)
+ (symbol->string sym))))
(with-directory-excursion
(search-input-directory outputs "/lib/stex")
(invoke "make"
--
2.32.0
P
P
Philip McGrath wrote on 3 May 2022 20:33
[PATCH 7/7] gnu: chez-scheme-for-system: Adjust support logic.
(address . 55248@debbugs.gnu.org)(name . Philip McGrath)(address . philip@philipmcgrath.com)
9ba89b23f86a163679047f113e3524b4352df55d.1651594312.git.philip@philipmcgrath.com
This is a follow-up to commit b8fc9169515ef1a6d6037c84e30ad308e5418b6f:
see https://issues.guix.gnu.org/54292. Thanks to Liliana Marie
Prikler for pointing out various issues, e.g. that being able to
represent a Nix system as a Chez Scheme machine type does not
necessarily mean the system is supported!

Racket's variant of Chez Scheme does or will soon run even on systems
for which native code generation is not supported: see discussion at
https://racket.discourse.group/t/950. This helps us to eliminate
unused functions (that may not have been quite right, anyway).

* gnu/packages/chez.scm (chez-machine->nonthreaded,
chez-machine->threaded, %nix-arch-to-chez-alist, %nix-os-to-chez-alist,
chez-machine->nix-system, nix-system->chez-machine): Replace with ...
(%chez-features-table, target-chez-arch, target-chez-os): ... these new
variables.
(chez-upstream-features-for-system): Adapt accordingly.
(chez-scheme-bootstrap-bootfiles)[supported-systems]: Use enhanced
'chez-upstream-features-for-system'.
(chez-scheme-for-system): Likewise, and use 'chez-scheme-for-racket' on
systems without native code generation.
(racket-cs-native-supported-system?): New variable.
(chez-scheme-for-racket)[supported-systems]: Use it.
* gnu/packages/racket.scm (racket-vm-for-system): Likewise.
---
gnu/packages/chez.scm | 269 +++++++++++++++++++++++-----------------
gnu/packages/racket.scm | 7 +-
2 files changed, 159 insertions(+), 117 deletions(-)

Toggle diff (346 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index ea53cf5774..a61146eb02 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -48,9 +48,7 @@ (define-module (gnu packages chez)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:export (chez-scheme-for-system
- nix-system->chez-machine
- chez-machine->nonthreaded
- chez-machine->threaded
+ racket-cs-native-supported-system?
unpack-nanopass+stex))
;; Commentary:
@@ -73,96 +71,17 @@ (define* (chez-scheme-for-system #:optional
(%current-system))))
"Return 'chez-scheme' unless only 'chez-scheme-for-racket' supports SYSTEM,
including support for native threads."
- (if (or
- ;; full support upstream
- (and=> (chez-upstream-features-for-system system)
- (cut memq 'threads <>))
- ;; no support anywhere
- (not (nix-system->chez-machine system)))
+ (if (and=> (chez-upstream-features-for-system system)
+ (lambda (features)
+ (every (cut memq <> features)
+ '(threads
+ ;; We can cross-compile for platforms without
+ ;; bootstrap bootfiles, but we can't self-host
+ ;; on them short of adding more binary seeds.
+ bootstrap-bootfiles))))
chez-scheme
chez-scheme-for-racket))
-(define (chez-machine->nonthreaded machine)
- "Given a string MACHINE naming a Chez Scheme machine type, returns a string
-naming the nonthreaded machine type for the same architecture and OS as
-MACHINE. The returned string may share storage with MACHINE."
- ;; Chez Scheme documentation consistently uses "nonthreaded" rather than
- ;; e.g. "unthreaded"
- (if (eqv? #\t (string-ref machine 0))
- (substring machine 1)
- machine))
-(define (chez-machine->threaded machine)
- "Like @code{chez-machine->nonthreaded}, but returns the threaded machine
-type."
- (if (eqv? #\t (string-ref machine 0))
- machine
- (string-append "t" machine)))
-
-;; Based on the implementation from raco-cross-lib/private/cross/platform.rkt
-;; in https://github.com/racket/raco-cross.
-;; For supported platforms, refer to release_notes/release_notes.stex in the
-;; upstream Chez Scheme repository or to racket/src/ChezScheme/README.md
-;; in https://github.com/racket/racket.
-(define %nix-arch-to-chez-alist
- `(("x86_64" . "a6")
- ("i386" . "i3")
- ("aarch64" . "arm64")
- ("armhf" . "arm32") ;; Chez supports ARM v6+
- ("ppc" . "ppc32")))
-(define %nix-os-to-chez-alist
- `(("w64-mingw32" . "nt")
- ("darwin" . "osx")
- ("linux" . "le")
- ("freebsd" . "fb")
- ("openbsd" . "ob")
- ("netbsd" . "nb")
- ("solaris" . "s2")))
-
-(define (chez-machine->nix-system machine)
- "Return the Nix system type corresponding to the Chez Scheme machine type
-MACHINE. If MACHINE is not a string representing a known machine type, an
-exception is raised. This function does not distinguish between threaded and
-nonthreaded variants of MACHINE.
-
-Note that this function only handles Chez Scheme machine types in the
-strictest sense, not other kinds of descriptors sometimes used in place of a
-Chez Scheme machine type by Racket, such as @code{\"pb\"}, @code{#f}, or
-@code{\"racket\"}. (When using such extensions, the Chez Scheme machine type
-for the host system is often still relevant.)"
- (let ((machine (chez-machine->nonthreaded machine)))
- (let find-arch ((alist %nix-arch-to-chez-alist))
- (match alist
- (((nix . chez) . alist)
- (if (string-prefix? chez machine)
- (string-append
- nix "-" (let ((machine-os
- (substring machine (string-length chez))))
- (let find-os ((alist %nix-os-to-chez-alist))
- (match alist
- (((nix . chez) . alist)
- (if (equal? chez machine-os)
- nix
- (find-os alist)))))))
- (find-arch alist)))))))
-
-(define* (nix-system->chez-machine #:optional
- (system (or (%current-target-system)
- (%current-system))))
- "Return the Chez Scheme machine type corresponding to the Nix system
-identifier SYSTEM, or @code{#f} if the translation of SYSTEM to a Chez Scheme
-machine type is undefined.
-
-It is unspecified whether the resulting string will name a threaded or a
-nonthreaded machine type: when the distinction is relevant, use
-@code{chez-machine->nonthreaded} or @code{chez-machine->threaded} to adjust
-the result."
- (let* ((hyphen (string-index system #\-))
- (nix-arch (substring system 0 hyphen))
- (nix-os (substring system (+ 1 hyphen)))
- (chez-arch (assoc-ref %nix-arch-to-chez-alist nix-arch))
- (chez-os (assoc-ref %nix-os-to-chez-alist nix-os)))
- (and chez-arch chez-os (string-append chez-arch chez-os))))
-
(define* (chez-upstream-features-for-system #:optional
(system
(or (%current-target-system)
@@ -172,20 +91,150 @@ (define* (chez-upstream-features-for-system #:optional
does not support SYSTEM at all.
If native threads are supported, the returned list will include
-@code{'threads}. Other feature symbols may be added in the future."
+@code{'threads}. If bootstrap bootfiles for SYSTEM are distributed in the
+upstream Chez Scheme repository, the returned list will include
+@code{'bootstrap-bootfiles}. Other feature symbols may be added in the
+future."
+ (let ((chez-arch (target-chez-arch system))
+ (chez-os (target-chez-os system)))
+ (and=> (assoc-ref %chez-features-table chez-os)
+ (cut assoc-ref <> chez-arch))))
+
+(define* (racket-cs-native-supported-system? #:optional
+ (system
+ (or (%current-target-system)
+ (%current-system))))
+ "Can Racket's variant of Chez Scheme generate native code for SYSTEM?
+Otherwise, SYSTEM can use only the ``portable bytecode'' backends."
+ (let ((chez-arch (target-chez-arch system))
+ (chez-os (target-chez-os system)))
+ (and (and=> (assoc-ref %chez-features-table chez-os)
+ ;; NOT assoc-ref: supported even if cdr is #f
+ (cut assoc chez-arch <>))
+ #t)))
+
+(define %chez-features-table
+ ;; An alist of alists mapping:
+ ;; os -> arch -> (or/c #f (listof symbol?))
+ ;; where:
+ ;; - `os` is a string for the OS part of a Chez Scheme machine type; and
+ ;; - `arch` is a string for the architecture part of a Chez machine type.
+ ;;
+ ;; The absence of an entry for a given arch--os pair means that neither
+ ;; upstream Chez Scheme nor the Racket variant can generate native code for
+ ;; that system. (The Racket variant can still provide support via its
+ ;; ``portable bytecode'' backends and optional compilation to C.) A value
+ ;; of `#f` means that upstream Chez Scheme does not support the arch--os
+ ;; pair at all, but the Racket variant does. A list has the same meaning as
+ ;; a result from `chez-upstream-features-for-system`.
+ ;;
+ ;; The arch--os pairs marked "commented out" have been commented out in the
+ ;; STeX source for the upstream release notes since the initial release as
+ ;; free software, but they are reported to work and/or have been described
+ ;; as supported by upstream maintainers.
+ ;;
+ ;; For this overall approach to make sense, we assume that Racket's variant
+ ;; of Chez Scheme can generate native code for a superset of the platforms
+ ;; supported upstream, supports threads on all platforms it supports at all
+ ;; (because they are needed for Racket), and doesn't need bootstrap
+ ;; bootfiles. Those assumptions have held for several years.
+ '(;; Linux
+ ("le"
+ ("i3" threads bootstrap-bootfiles)
+ ("a6" threads bootstrap-bootfiles)
+ ("arm32" bootstrap-bootfiles)
+ ("arm64" . #f)
+ ("ppc32" threads))
+ ;; FreeBSD
+ ("fb"
+ ("i3" threads) ;; commented out
+ ("a6" threads) ;; commented out
+ ("arm32" . #f)
+ ("arm64" . #f)
+ ("ppc32" . #f))
+ ;; OpenBSD
+ ("ob"
+ ("i3" threads) ;; commented out
+ ("a6" threads) ;; commented out
+ ("arm32" . #f)
+ ("arm64" . #f)
+ ("ppc32" . #f))
+ ;; NetBSD
+ ("nb"
+ ("i3" threads) ;; commented out
+ ("a6" threads) ;; commented out
+ ("arm32" . #f)
+ ("arm64" . #f)
+ ("ppc32" . #f))
+ ;; OpenSolaris / OpenIndiana / Illumos
+ ("s2"
+ ("i3" threads) ;; commented out
+ ("a6" threads)) ;; commented out
+ ;; Windows
+ ("nt"
+ ("i3" threads bootstrap-bootfiles)
+ ("a6" threads bootstrap-bootfiles)
+ ;; ^ threads "experiemental", but reportedly fine
+ ("arm64" . #f))
+ ;; Darwin
+ ("osx"
+ ("i3" threads bootstrap-bootfiles)
+ ("a6" threads bootstrap-bootfiles)
+ ("arm64" . #f)
+ ("ppc32" . #f))))
+
+(define* (target-chez-arch #:optional (system
+ (or (%current-target-system)
+ (%current-system))))
+ "Return a string representing the architecture of SYSTEM as used in Chez
+Scheme machine types, or '#f' if none is defined."
(cond
- ((not (nix-system->chez-machine system))
- #f)
+ ((target-x86-64? system)
+ "a6")
+ ((target-x86-32? system)
+ "i3")
((target-aarch64? system)
- #f)
+ "arm64")
((target-arm32? system)
- (and (target-linux? system)
- '()))
+ "arm32")
+ ((target-ppc64le? system)
+ #f)
((target-ppc32? system)
- (and (target-linux? system)
- '(threads)))
+ "ppc32")
+ ((target-riscv64? system)
+ #f)
(else
- '(threads))))
+ #f)))
+
+(define* (target-chez-os #:optional (system (or (%current-target-system)
+ (%current-system))))
+ "Return a string representing the operating system kernel of SYSTEM as used
+in Chez Scheme machine types, or '#f' if none is defined."
+ ;; e.g. "le" includes both GNU/Linux and Android
+ (cond
+ ((target-linux? system)
+ "le")
+ ((target-hurd? system)
+ #f)
+ ((target-mingw? system)
+ "nt")
+ ;; missing (guix utils) predicates
+ ;; cf. https://github.com/NixOS/nixpkgs/blob/master/lib/systems/doubles.nix
+ ((string-suffix? "-darwin" system)
+ "osx")
+ ((string-suffix? "-freebsd" system)
+ "fb")
+ ((string-suffix? "-openbsd" system)
+ "ob")
+ ((string-suffix? "-netbsd" system)
+ "nb")
+ ;; Nix says "x86_64-solaris", but accommodate "-solaris2"
+ ((string-contains system "solaris")
+ "s2")
+ ;; unknown
+ (else
+ #f)))
+
;;
;; Chez Scheme:
@@ -365,14 +414,9 @@ (define-public chez-scheme
((pth)
(symlink pth
"csug.pdf")))))))))
- ;; Chez Scheme does not have a MIPS backend.
- ;; FIXME: Debian backports patches to get armhf working.
- ;; We should too. It is the Chez machine type arm32le
- ;; (no threaded version upstream yet, though there is in
- ;; Racket's fork), more specifically (per the release notes) ARMv6.
(supported-systems
(delete
- "armhf-linux" ;; <-- should work, but reportedly broken
+ "armhf-linux" ;; XXX is this still broken?
(filter chez-upstream-features-for-system
%supported-systems)))
(home-page "https://cisco.github.io/ChezScheme/")
@@ -418,7 +462,9 @@ (define-public chez-scheme-for-racket
(add-after 'unpack 'chdir
(lambda args
(chdir "racket/src/ChezScheme"))))))))
- (supported-systems (filter nix-system->chez-machine
+ ;; TODO: How to build pbarch/pbchunks for other systems?
+ ;; See https://racket.discourse.group/t/950
+ (supported-systems (filter racket-cs-native-supported-system?
%supported-systems))
(home-page "https://github.com/racket/ChezScheme")
;; ^ This is downstream of https://github.com/racket/racket,
@@ -471,16 +517,9 @@ (define-public chez-scheme-bootstrap-bootfiles
(list #:install-plan
#~`(("boot/" "lib/chez-scheme-bootfiles"))))
(supported-systems
- ;; Upstream only distributes pre-built bootfiles for
- ;; arm32le and t?(i3|a6)(le|nt|osx)
(filter (lambda (system)
- (let ((machine (and=> (nix-system->chez-machine system)
- chez-machine->nonthreaded)))
- (or (equal? "arm32le" machine)
- (and machine
- (member (substring machine 0 2) '("i3" "a6"))
- (or-map (cut string-suffix? <> machine)
- '("le" "nt" "osx"))))))
+ (and=> (chez-upstream-features-for-system system)
+ (cut memq 'bootstrap-bootfiles <>)))
%supported-systems))
(synopsis "Chez Scheme bootfiles (binary seed)")
(description
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index 2f4f7cebd8..41f45f4215 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -190,8 +190,11 @@ (define-module (gnu packages racket)
(define* (racket-vm-for-system #:optional
(system (or (%current-target-system)
(%current-system))))
- "Return 'racket-vm-cs' if it supports SYSTEM; 'racket-vm-bc' otherwise."
- (if (nix-system->chez-machine system)
+ "Return 'racket-vm-cs' we are able to build it for SYSTEM; 'racket-vm-bc'
+otherwise."
+ ;; Once we figure out the issues in https://racket.discourse.group/t/950,
+ ;; we can use 'racket-vm-cs' everywhere.
+ (if (racket-cs-native-supported-system? system)
racket-vm-cs
racket-vm-bc))
--
2.32.0
L
L
Liliana Marie Prikler wrote on 4 May 2022 08:53
Re: [PATCH 1/7] gnu: racket: Update to 8.5.
7b3da393016daa21c35dd27fc086b03339435e9d.camel@ist.tugraz.at
Am Dienstag, dem 03.05.2022 um 14:33 -0400 schrieb Philip McGrath:
Toggle quote (4 lines)
> * gnu/packages/patches/racket-gui-tethered-launcher-backport.patch,
> gnu/packages/patches/racket-enable-scheme-backport.patch: Delete
> files.
> * gnu/local.mk (dist_patch_DATA): Remove them.
LGTM.
Toggle quote (1 lines)
> * gnu/packages/chez.scm (chez-scheme-for-racket): Update to 9.5.7.6.
This...
Toggle quote (1 lines)
> * gnu/packages/racket.scm (%racket-version): Update to 8.4.900.
... and this might be done in different commits. Also, you typo'd in
the ChangeLog, the version ought to be 8.5
Toggle quote (1 lines)
> (%racket-origin)[sha256]: Update accordingly.
You don't normally need to mention hash updates, but (*).
Toggle quote (1 lines)
> [patches]: Remove obsolete patches.
LGTM.
Toggle quote (1 lines)
> (racket-vm-common-configure-flags): Remove incorrect comment.
No. Unless you address the issue at hand (which I don't want to be a
blocker for this series, mind you), it persists. If you don't like how
the comment is written currently, you might suggest an alternative
formulation, but people deserve to know that the origtree layout is a
hack.
Toggle quote (1 lines)
> (simple-racket-origin): Accept optional #:commit argument.
Is this used anywhere? If not, I suggest leaving it be for now.
Toggle quote (4 lines)
> (racket)[inputs]<2d, datalog, deinprogramm, draw, drracket,
> expeditor, htdp, pict, plot, quickscript, racklog, rackunit, redex,
> scribble, typed-racket, string-constants, syntax-color, web-server,
> xrepl>: Update checksums.
(*) here it makes sense to document the checksum updates, because
they'd otherwise be invisible.
Toggle quote (2 lines)
> <gui, srfi>: Likewise, and remove obsolete backports.

Cheers
L
L
Liliana Marie Prikler wrote on 4 May 2022 08:58
Re: [PATCH 6/7] gnu: stex: Get machine type dynamically.
95374cf5b8dc2f7e2406506f00df274e29122077.camel@ist.tugraz.at
Am Dienstag, dem 03.05.2022 um 14:33 -0400 schrieb Philip McGrath:
Toggle quote (2 lines)
> * gnu/packages/chez.scm (stex)[arguments]: Run 'scheme' to determine
> the machine type.
How is this beneficial? What about cross-compilation?
L
L
Liliana Marie Prikler wrote on 4 May 2022 09:21
Re: [PATCH 7/7] gnu: chez-scheme-for-system: Adjust support logic.
1dc114e6acd0320c553837e1d9f5d94e4e8c800d.camel@ist.tugraz.at
Am Dienstag, dem 03.05.2022 um 14:33 -0400 schrieb Philip McGrath:
Toggle quote (6 lines)
> This is a follow-up to commit
> b8fc9169515ef1a6d6037c84e30ad308e5418b6f:
> see <https://issues.guix.gnu.org/54292>. Thanks to Liliana Marie
> Prikler for pointing out various issues, e.g. that being able to
> represent a Nix system as a Chez Scheme machine type does not
> necessarily mean the system is supported!
The issue in that commit is a different one: nix-system->chez-machine
can fail if there's no conversion. Anyway...

Toggle quote (26 lines)
> [...]
> ;; Commentary:
> @@ -73,96 +71,17 @@ (define* (chez-scheme-for-system #:optional
>                                               (%current-system))))
>    "Return 'chez-scheme' unless only 'chez-scheme-for-racket'
> supports SYSTEM,
>  including support for native threads."
> -  (if (or
> -       ;; full support upstream
> -       (and=> (chez-upstream-features-for-system system)
> -              (cut memq 'threads <>))
> -       ;; no support anywhere
> -       (not (nix-system->chez-machine system)))
> +  (if (and=> (chez-upstream-features-for-system system)
> +             (lambda (features)
> +               (every (cut memq <> features)
> +                      '(threads
> +                        ;; We can cross-compile for platforms
> without
> +                        ;; bootstrap bootfiles, but we can't self-
> host
> +                        ;; on them short of adding more binary
> seeds.
> +                        bootstrap-bootfiles))))
>        chez-scheme
>        chez-scheme-for-racket))
Does it make sense to require 'threads always?

Toggle quote (102 lines)
>  
> -(define (chez-machine->nonthreaded machine)
> -  "Given a string MACHINE naming a Chez Scheme machine type, returns
> a string
> -naming the nonthreaded machine type for the same architecture and OS
> as
> -MACHINE.  The returned string may share storage with MACHINE."
> -  ;; Chez Scheme documentation consistently uses "nonthreaded"
> rather than
> -  ;; e.g. "unthreaded"
> -  (if (eqv? #\t (string-ref machine 0))
> -      (substring machine 1)
> -      machine))
> -(define (chez-machine->threaded machine)
> -  "Like @code{chez-machine->nonthreaded}, but returns the threaded
> machine
> -type."
> -  (if (eqv? #\t (string-ref machine 0))
> -      machine
> -      (string-append "t" machine)))
> -
> -;; Based on the implementation from raco-cross-
> lib/private/cross/platform.rkt
> -;; in https://github.com/racket/raco-cross.
> -;; For supported platforms, refer to
> release_notes/release_notes.stex in the
> -;; upstream Chez Scheme repository or to
> racket/src/ChezScheme/README.md
> -;; in https://github.com/racket/racket.
> -(define %nix-arch-to-chez-alist
> -  `(("x86_64" . "a6")
> -    ("i386" . "i3")
> -    ("aarch64" . "arm64")
> -    ("armhf" . "arm32") ;; Chez supports ARM v6+
> -    ("ppc" . "ppc32")))
> -(define %nix-os-to-chez-alist
> -  `(("w64-mingw32" . "nt")
> -    ("darwin" . "osx")
> -    ("linux" . "le")
> -    ("freebsd" . "fb")
> -    ("openbsd" . "ob")
> -    ("netbsd" . "nb")
> -    ("solaris" . "s2")))
> -
> -(define (chez-machine->nix-system machine)
> -  "Return the Nix system type corresponding to the Chez Scheme
> machine type
> -MACHINE.  If MACHINE is not a string representing a known machine
> type, an
> -exception is raised.  This function does not distinguish between
> threaded and
> -nonthreaded variants of MACHINE.
> -
> -Note that this function only handles Chez Scheme machine types in
> the
> -strictest sense, not other kinds of descriptors sometimes used in
> place of a
> -Chez Scheme machine type by Racket, such as @code{\"pb\"},
> @code{#f}, or
> -@code{\"racket\"}.  (When using such extensions, the Chez Scheme
> machine type
> -for the host system is often still relevant.)"
> -  (let ((machine (chez-machine->nonthreaded machine)))
> -    (let find-arch ((alist %nix-arch-to-chez-alist))
> -      (match alist
> -        (((nix . chez) . alist)
> -         (if (string-prefix? chez machine)
> -             (string-append
> -              nix "-" (let ((machine-os
> -                             (substring machine (string-length
> chez))))
> -                        (let find-os ((alist %nix-os-to-chez-alist))
> -                          (match alist
> -                            (((nix . chez) . alist)
> -                             (if (equal? chez machine-os)
> -                                 nix
> -                                 (find-os alist)))))))
> -             (find-arch alist)))))))
> -
> -(define* (nix-system->chez-machine #:optional
> -                                   (system (or (%current-target-
> system)
> -                                               (%current-system))))
> -  "Return the Chez Scheme machine type corresponding to the Nix
> system
> -identifier SYSTEM, or @code{#f} if the translation of SYSTEM to a
> Chez Scheme
> -machine type is undefined.
> -
> -It is unspecified whether the resulting string will name a threaded
> or a
> -nonthreaded machine type: when the distinction is relevant, use
> -@code{chez-machine->nonthreaded} or @code{chez-machine->threaded} to
> adjust
> -the result."
> -  (let* ((hyphen (string-index system #\-))
> -         (nix-arch (substring system 0 hyphen))
> -         (nix-os (substring system (+ 1 hyphen)))
> -         (chez-arch (assoc-ref %nix-arch-to-chez-alist nix-arch))
> -         (chez-os (assoc-ref %nix-os-to-chez-alist nix-os)))
> -    (and chez-arch chez-os (string-append chez-arch chez-os))))
> -
The replacement code should go here for readability imho. At the very
least I was confused why this was first above and now below.

Toggle quote (186 lines)
>  (define* (chez-upstream-features-for-system #:optional
>                                              (system
>                                               (or (%current-target-
> system)
> @@ -172,20 +91,150 @@ (define* (chez-upstream-features-for-system
> #:optional
>  does not support SYSTEM at all.
>  
>  If native threads are supported, the returned list will include
> -@code{'threads}.  Other feature symbols may be added in the future."
> +@code{'threads}.  If bootstrap bootfiles for SYSTEM are distributed
> in the
> +upstream Chez Scheme repository, the returned list will include
> +@code{'bootstrap-bootfiles}.  Other feature symbols may be added in
> the
> +future."
> +  (let ((chez-arch (target-chez-arch system))
> +        (chez-os (target-chez-os system)))
> +    (and=> (assoc-ref %chez-features-table chez-os)
> +           (cut assoc-ref <> chez-arch))))
> +
> +(define* (racket-cs-native-supported-system? #:optional
> +                                             (system
> +                                              (or (%current-target-
> system)
> +                                                  (%current-
> system))))
> +  "Can Racket's variant of Chez Scheme generate native code for
> SYSTEM?
> +Otherwise, SYSTEM can use only the ``portable bytecode'' backends."
> +  (let ((chez-arch (target-chez-arch system))
> +        (chez-os (target-chez-os system)))
> +    (and (and=> (assoc-ref %chez-features-table chez-os)
> +                ;; NOT assoc-ref: supported even if cdr is #f
> +                (cut assoc chez-arch <>))
> +         #t)))
> +
> +(define %chez-features-table
> +  ;; An alist of alists mapping:
> +  ;;   os -> arch -> (or/c #f (listof symbol?))
> +  ;; where:
> +  ;;  - `os` is a string for the OS part of a Chez Scheme machine
> type; and
> +  ;;  - `arch` is a string for the architecture part of a Chez
> machine type.
> +  ;;
> +  ;; The absence of an entry for a given arch--os pair means that
> neither
> +  ;; upstream Chez Scheme nor the Racket variant can generate native
> code for
> +  ;; that system.  (The Racket variant can still provide support via
> its
> +  ;; ``portable bytecode'' backends and optional compilation to C.) 
> A value
> +  ;; of `#f` means that upstream Chez Scheme does not support the
> arch--os
> +  ;; pair at all, but the Racket variant does.  A list has the same
> meaning as
> +  ;; a result from `chez-upstream-features-for-system`.
> +  ;;
> +  ;; The arch--os pairs marked "commented out" have been commented
> out in the
> +  ;; STeX source for the upstream release notes since the initial
> release as
> +  ;; free software, but they are reported to work and/or have been
> described
> +  ;; as supported by upstream maintainers.
> +  ;;
> +  ;; For this overall approach to make sense, we assume that
> Racket's variant
> +  ;; of Chez Scheme can generate native code for a superset of the
> platforms
> +  ;; supported upstream, supports threads on all platforms it
> supports at all
> +  ;; (because they are needed for Racket), and doesn't need
> bootstrap
> +  ;; bootfiles.  Those assumptions have held for several years.
> +  '(;; Linux
> +    ("le"
> +     ("i3" threads bootstrap-bootfiles)
> +     ("a6" threads bootstrap-bootfiles)
> +     ("arm32" bootstrap-bootfiles)
> +     ("arm64" . #f)
> +     ("ppc32" threads))
> +    ;; FreeBSD
> +    ("fb"
> +     ("i3" threads) ;; commented out
> +     ("a6" threads) ;; commented out
> +     ("arm32" . #f)
> +     ("arm64" . #f)
> +     ("ppc32" . #f))
> +    ;; OpenBSD
> +    ("ob"
> +     ("i3" threads) ;; commented out
> +     ("a6" threads) ;; commented out
> +     ("arm32" . #f)
> +     ("arm64" . #f)
> +     ("ppc32" . #f))
> +    ;; NetBSD
> +    ("nb"
> +     ("i3" threads) ;; commented out
> +     ("a6" threads) ;; commented out
> +     ("arm32" . #f)
> +     ("arm64" . #f)
> +     ("ppc32" . #f))
> +    ;; OpenSolaris / OpenIndiana / Illumos
> +    ("s2"
> +     ("i3" threads) ;; commented out
> +     ("a6" threads)) ;; commented out
> +    ;; Windows
> +    ("nt"
> +     ("i3" threads bootstrap-bootfiles)
> +     ("a6" threads bootstrap-bootfiles)
> +     ;; ^ threads "experiemental", but reportedly fine
> +     ("arm64" . #f))
> +    ;; Darwin
> +    ("osx"
> +     ("i3" threads bootstrap-bootfiles)
> +     ("a6" threads bootstrap-bootfiles)
> +     ("arm64" . #f)
> +     ("ppc32" . #f))))
> +
> +(define* (target-chez-arch #:optional (system
> +                                       (or (%current-target-system)
> +                                           (%current-system))))
> +  "Return a string representing the architecture of SYSTEM as used
> in Chez
> +Scheme machine types, or '#f' if none is defined."
>    (cond
> -   ((not (nix-system->chez-machine system))
> -    #f)
> +   ((target-x86-64? system)
> +    "a6")
> +   ((target-x86-32? system)
> +    "i3")
>     ((target-aarch64? system)
> -    #f)
> +    "arm64")
>     ((target-arm32? system)
> -    (and (target-linux? system)
> -         '()))
> +    "arm32")
> +   ((target-ppc64le? system)
> +    #f)
>     ((target-ppc32? system)
> -    (and (target-linux? system)
> -         '(threads)))
> +    "ppc32")
> +   ((target-riscv64? system)
> +    #f)
>     (else
> -    '(threads))))
> +    #f)))
> +
> +(define* (target-chez-os #:optional (system (or (%current-target-
> system)
> +                                                (%current-system))))
> +  "Return a string representing the operating system kernel of
> SYSTEM as used
> +in Chez Scheme machine types, or '#f' if none is defined."
> +  ;; e.g. "le" includes both GNU/Linux and Android
> +  (cond
> +   ((target-linux? system)
> +    "le")
> +   ((target-hurd? system)
> +    #f)
> +   ((target-mingw? system)
> +    "nt")
> +   ;; missing (guix utils) predicates
> +   ;; cf.
> https://github.com/NixOS/nixpkgs/blob/master/lib/systems/doubles.nix
> +   ((string-suffix? "-darwin" system)
> +    "osx")
> +   ((string-suffix? "-freebsd" system)
> +    "fb")
> +   ((string-suffix? "-openbsd" system)
> +    "ob")
> +   ((string-suffix? "-netbsd" system)
> +    "nb")
> +   ;; Nix says "x86_64-solaris", but accommodate "-solaris2"
> +   ((string-contains system "solaris")
> +    "s2")
> +   ;; unknown
> +   (else
> +    #f)))
> +
For the sake of completeness, we might want to still have nix-system-
Toggle quote (1 lines)
>chez-machine (with a threaded? argument) defined in terms of target-
chez-arch and target-chez-os. See 6/7 for motivation.

Toggle quote (17 lines)
>  
>  ;;
>  ;; Chez Scheme:
> @@ -365,14 +414,9 @@ (define-public chez-scheme
>                    ((pth)
>                     (symlink pth
>                              "csug.pdf")))))))))
> -    ;; Chez Scheme does not have a  MIPS backend.
> -    ;; FIXME: Debian backports patches to get armhf working.
> -    ;; We should too. It is the Chez machine type arm32le
> -    ;; (no threaded version upstream yet, though there is in
> -    ;; Racket's fork), more specifically (per the release notes)
> ARMv6.
>      (supported-systems
>       (delete
> -      "armhf-linux" ;; <-- should work, but reportedly broken
> +      "armhf-linux" ;; XXX is this still broken?
I'd say "XXX: reportedly broken, needs checking"
Toggle quote (32 lines)
>        (filter chez-upstream-features-for-system
>                %supported-systems)))
>      (home-page "https://cisco.github.io/ChezScheme/")
> @@ -418,7 +462,9 @@ (define-public chez-scheme-for-racket
>                (add-after 'unpack 'chdir
>                  (lambda args
>                    (chdir "racket/src/ChezScheme"))))))))
> -    (supported-systems (filter nix-system->chez-machine
> +    ;; TODO: How to build pbarch/pbchunks for other systems?
> +    ;; See https://racket.discourse.group/t/950
> +    (supported-systems (filter racket-cs-native-supported-system?
>                                 %supported-systems))
>      (home-page "https://github.com/racket/ChezScheme")
>      ;; ^ This is downstream of https://github.com/racket/racket,
> @@ -471,16 +517,9 @@ (define-public chez-scheme-bootstrap-bootfiles
>       (list #:install-plan
>             #~`(("boot/" "lib/chez-scheme-bootfiles"))))
>      (supported-systems
> -     ;; Upstream only distributes pre-built bootfiles for
> -     ;; arm32le and t?(i3|a6)(le|nt|osx)
>       (filter (lambda (system)
> -               (let ((machine (and=> (nix-system->chez-machine
> system)
> -                                     chez-machine->nonthreaded)))
> -                 (or (equal? "arm32le" machine)
> -                     (and machine
> -                          (member (substring machine 0 2) '("i3"
> "a6"))
> -                          (or-map (cut string-suffix? <> machine)
> -                                  '("le" "nt" "osx"))))))
> +               (and=> (chez-upstream-features-for-system system)
> +                      (cut memq 'bootstrap-bootfiles <>)))
Yup, that's simpler.
Toggle quote (23 lines)
>               %supported-systems))
>      (synopsis "Chez Scheme bootfiles (binary seed)")
>      (description
> diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
> index 2f4f7cebd8..41f45f4215 100644
> --- a/gnu/packages/racket.scm
> +++ b/gnu/packages/racket.scm
> @@ -190,8 +190,11 @@ (define-module (gnu packages racket)
>  (define* (racket-vm-for-system #:optional
>                                 (system (or (%current-target-system)
>                                             (%current-system))))
> -  "Return 'racket-vm-cs' if it supports SYSTEM; 'racket-vm-bc'
> otherwise."
> -  (if (nix-system->chez-machine system)
> +  "Return 'racket-vm-cs' we are able to build it for SYSTEM;
> 'racket-vm-bc'
> +otherwise."
> +  ;; Once we figure out the issues in
> https://racket.discourse.group/t/950,
> +  ;; we can use 'racket-vm-cs' everywhere.
> +  (if (racket-cs-native-supported-system? system)
>        racket-vm-cs
>        racket-vm-bc))
All in all, the individual logic of this patch seems fine, but overall
it appears as though it's doing three separate things (chez-scheme-for-
system, chez features, racket-cs stuff). IMO it would make sense to
split this patch according to those lines. WDYT?

Patches 2-5 mostly LGTM, at least I don't see any glaring issues in
this iteration.

Cheers
M
M
Maxime Devos wrote on 4 May 2022 11:29
Re: [bug#55248] [PATCH 2/7] gnu: racket: Fix out-of-source build.
f09ba5dd970d219686b76fd00bdcbb12331a1a6e.camel@telenet.be
Philip McGrath schreef op di 03-05-2022 om 14:33 [-0400]:
Toggle quote (1 lines)
> -       ;; help with debugging, but it confuses `install-license-files`.
[...]
Toggle quote (8 lines)
> +             ;; workaround for install-license-files
> +             (lambda* (#:key out-of-source? #:allow-other-keys)
> +               (when out-of-source?
> +                 (with-directory-excursion ".."
> +                   (symlink "src"
> +                            (package-name->name+version
> +                             (strip-store-file-name #$output))))))))))

Surely we could fix this bug/limitation of install-license-files
upstream (in this case, upstream=Guix)?

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYnJHdBccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7n4SAP0ZMkcX04ipHwEpDPDblwqqAZ7L
O9D/L5CRBFWAQqXUAgEAk4njTrtqBOEglLllYTjnP+u+5wnAdDmvOKzKNpxasQk=
=9ihk
-----END PGP SIGNATURE-----


P
P
Philip McGrath wrote on 5 May 2022 20:53
fdc4193a-9f81-50d1-2656-e9781ca43991@philipmcgrath.com
Hi,

On 5/4/22 05:29, Maxime Devos wrote:
Toggle quote (15 lines)
> Philip McGrath schreef op di 03-05-2022 om 14:33 [-0400]:
>> -       ;; help with debugging, but it confuses `install-license-files`.
> [...]
>> +             ;; workaround for install-license-files
>> +             (lambda* (#:key out-of-source? #:allow-other-keys)
>> +               (when out-of-source?
>> +                 (with-directory-excursion ".."
>> +                   (symlink "src"
>> +                            (package-name->name+version
>> +                             (strip-store-file-name #$output))))))))))
>
> Surely we could fix this bug/limitation of install-license-files
> upstream (in this case, upstream=Guix)?
>

I'd certainly be in favor of that! I've never edited '(guix build
gnu-build-system)' but I assume that would be a 'core-updates' change.
I'm also not sure what the best solution would be in general.

In Racket's specific case, the source directory for the Racket VM is
(relative to the repository root), "racket/src/", where other notable
directories present include "racket/collects/" and "pkgs/". An
out-of-source build ends up happening in "racket/build/". The license
files are in the source directory, which is what install-license-files
expects, but the find-source-directory helper function fails to guess
the location of the source directory:

Toggle quote (20 lines)
> (define (find-source-directory package)
> ;; For an out-of-source build, guess the source directory location
> ;; relative to the current directory. Return #f on failure.
> (match (scandir ".."
> (lambda (file)
> (and (not (member file '("." ".." "build")))
> (file-is-directory?
> (string-append "../" file)))))
> (() ;hmm, no source
> #f)
> ((source) ;only one other file
> (string-append "../" source))
> ((directories ...) ;pick the most likely one
> ;; This happens for example with libstdc++, which lives within the GCC
> ;; source tree.
> (any (lambda (directory)
> (and (string-prefix? package directory)
> (string-append "../" directory)))
> directories))))

Some possibilities I can imagine:

* We could add a case to find-source-directory specifically for "src".

* We could change configure to communicate the location of the source
directory, e.g. via an environment variable, rather than trying to
guess.

* We could change install-license-files to do more searching in
general, e.g. trying multiple directories or preferring a directory
that contains at least one match for #:license-file-regexp. We'd
have to consider the potential for false positives, too (e.g.
sibling directories with projects under different licenses.)

* We could add an argument to install-license-files to specify the
directory explicitly, as a complement to #:license-file-regexp.

Another scenario that might be worth considering is projects that follow
the REUSE specification[1], which I don't think would be handled by the
current install-license-files.

But actually, for Racket, I forgot that a patch I'd sent upstream to
handle this in `make install` should be in 8.5, so we may not need this
patch at all: I'll confirm before I send v2.

-Philip

P
P
Philip McGrath wrote on 5 May 2022 21:39
Re: [PATCH 6/7] gnu: stex: Get machine type dynamically.
7dbcbd6e-4038-79f1-ec83-f93434f61985@philipmcgrath.com
Hi,

On 5/4/22 02:58, Liliana Marie Prikler wrote:
Toggle quote (5 lines)
> Am Dienstag, dem 03.05.2022 um 14:33 -0400 schrieb Philip McGrath:
>> * gnu/packages/chez.scm (stex)[arguments]: Run 'scheme' to determine
>> the machine type.
> How is this beneficial?

At some high level of generality, there are two ways we could determine
the machine type:*

1. We could predict ahead of time what it will be; or
2. We can ask the `scheme` executable we actually have.

Trying to predict is easy to get wrong, because there's more than one
possible machine type for a given system: currently that's true due to
"--threads", and it will be even more true with "portable bytecode"
back-ends.

The `scheme` executable we're compiling with knows the definitive answer.

This lets us remove the only use of 'nix-system->chez-machine'.

Toggle quote (2 lines)
> What about cross-compilation?

I remembered this backwards; it should be `(#%$target-machine)` rather
than `(machine-type)`. I'll fix that. But note that upstream stex does
not support cross-compilation (though I hope to fix that one day). For
example, both `Makefile` and `Mf-stex` contain:

m := $(shell echo '(machine-type)' | $(Scheme) -q)

(* To some extent there's an XY problem here: we don't care about the
machine type per se, we care about the extension of intermediate object
files we don't want to have installed, analogous to ".o" files. I think
[1] upstream may have incidentally fixed the issues that made us build
in that odd way, but it hasn't been part of a release yet. I plan to
reevaluate before Racket 8.6, when we'll need [2] anyway to fix a bug
exposed by Zuo.)

-Philip

L
L
Liliana Marie Prikler wrote on 5 May 2022 21:52
Re: [bug#55248] [PATCH 2/7] gnu: racket: Fix out-of-source build.
72f621841c62c3663ee23371a91927e975617b80.camel@gmail.com
Am Donnerstag, dem 05.05.2022 um 14:53 -0400 schrieb Philip McGrath:
Toggle quote (23 lines)
> Hi,
>
> On 5/4/22 05:29, Maxime Devos wrote:
> > Philip McGrath schreef op di 03-05-2022 om 14:33 [-0400]:
> > > -       ;; help with debugging, but it confuses `install-license-
> > > files`.
> > [...]
> > > +             ;; workaround for install-license-files
> > > +             (lambda* (#:key out-of-source? #:allow-other-keys)
> > > +               (when out-of-source?
> > > +                 (with-directory-excursion ".."
> > > +                   (symlink "src"
> > > +                            (package-name->name+version
> > > +                             (strip-store-file-name
> > > #$output))))))))))
> >
> > Surely we could fix this bug/limitation of install-license-files
> > upstream (in this case, upstream=Guix)?
> >
>
> I'd certainly be in favor of that! I've never edited '(guix build
> gnu-build-system)' but I assume that would be a 'core-updates' change.
>  
It would.

Toggle quote (9 lines)
> I'm also not sure what the best solution would be in general.
>
> In Racket's specific case, the source directory for the Racket VM is
> (relative to the repository root), "racket/src/", where other notable
> directories present include "racket/collects/" and "pkgs/". An
> out-of-source build ends up happening in "racket/build/". The license
> files are in the source directory, which is what install-license-files
> expects, but the find-source-directory helper function fails to guess
> the location of the source directory:
I think the issue here is that we're in a chdir into the source, where
the typical assumption that there's only a single directory besides it
fails.

Toggle quote (23 lines)
> >   (define (find-source-directory package)
> >     ;; For an out-of-source build, guess the source directory
> > location
> >     ;; relative to the current directory.  Return #f on failure.
> >     (match (scandir ".."
> >                     (lambda (file)
> >                       (and (not (member file '("." ".." "build")))
> >                            (file-is-directory?
> >                             (string-append "../" file)))))
> >       (()                                         ;hmm, no source
> >        #f)
> >       ((source)                                   ;only one other
> > file
> >        (string-append "../" source))
> >       ((directories ...)                          ;pick the most
> > likely one
> >        ;; This happens for example with libstdc++, which lives
> > within the GCC
> >        ;; source tree.
> >        (any (lambda (directory)
> >               (and (string-prefix? package directory)
> >                    (string-append "../" directory)))
> >             directories))))
I don't think
(lambda (directory)
(and (string-prefix? package directory)
(string-append "../" directory)))
does what we think it does. Even so, it's debatable whether that works
for Racket.

Toggle quote (4 lines)
> Some possibilities I can imagine:
>
>    * We could add a case to find-source-directory specifically for
> "src".
Not a fan personally.

Toggle quote (3 lines)
>    * We could change configure to communicate the location of the
> source directory, e.g. via an environment variable, rather than
> trying to guess.
That would work, but gratuitous environment variables could have
unexpected consequences. However, note that the build systems
themselves already need to capture the information of where the source
directory lives! For gnu-build-system, you could check for abs_srcdir
in the Makefile for instance.

If this ever becomes necessary (reading ahead it doesn't seem to be,
but let that if be an if), I'd suggest splitting install-license-files
into a helper procedure that assumes we're in the correct directory and
a top level procedure, that performs the guess. This top level
procedure would need to be implemented once per build system, while the
helper could be inherited.

Toggle quote (9 lines)
>    * We could change install-license-files to do more searching in
>      general, e.g. trying multiple directories or preferring a
> directory that contains at least one match for
> #:license-file-regexp. We'd have to consider the potential for
> false positives, too (e.g. sibling directories with projects
> under different licenses.)

>    * We could add an argument to install-license-files to specify the
>      directory explicitly, as a complement to #:license-file-regexp.
I would not do either. An alternative to adding another phase is
wrapping install-license-files in a directory excursion within this
package. That'd be less code which achieves the same thing.

Toggle quote (3 lines)
> Another scenario that might be worth considering is projects that
> follow the REUSE specification[1], which I don't think would be
> handled by the current install-license-files.
I don't think we can rely on projects consistently following them,
sadly.

Toggle quote (3 lines)
> But actually, for Racket, I forgot that a patch I'd sent upstream to
> handle this in `make install` should be in 8.5, so we may not need
> this patch at all: I'll confirm before I send v2.
That is of course the best solution :)
M
M
Maxime Devos wrote on 5 May 2022 22:33
c3490737af6d62678a1895ee295bae4e1dbfc645.camel@telenet.be
Philip McGrath schreef op do 05-05-2022 om 14:53 [-0400]:
Toggle quote (4 lines)
> Another scenario that might be worth considering is projects that follow
> the REUSE specification[1], which I don't think would be handled by the
> current install-license-files.

It doesn't copy .reuse/dep5 and LICENSES yet, though that can be
implemented: https://issues.guix.gnu.org/54234#4. I don't think that
helps for this particular package though, given that Racket doesn't
ship those files.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYnQ0lhccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7ppDAQD5ax71GdJathjQnelRDEKf4r6m
ezSczC07qZiHgs6ZvwEAxhiKupvqXzK+uzQXTOHmw/Da2UsipQjdFgp4xaGzGQg=
=Ui+w
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 5 May 2022 22:36
bf9f0aa0761e3d1bc3d1394df8ce75b01cd37f74.camel@telenet.be
Liliana Marie Prikler schreef op do 05-05-2022 om 21:52 [+0200]:
Toggle quote (6 lines)
> > Another scenario that might be worth considering is projects that
> > follow the REUSE specification[1], which I don't think would be
> > handled by the current install-license-files.
> I don't think we can rely on projects consistently following them,
> sadly.

There's plenty of projects that don't follow REUSE (e.g., Guix itself),
and there might be some that have the .reuse/dep5 and LICENSES but
aren't doing things 100% according to the spec, but I don't think it
matters much to Guix if SPDX-License-Identifier is present in every
file and such, given that all Guix has to do here is copy license
files, so Guix could be taught to copy .reuse/dep5 and LICENSES (in
addition to LICENSE, COPYING, ...).

Greetings,
Maxime
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYnQ1VRccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7vTiAP43FSeSKjdoVaivR4DKNV77ZGom
kGu1aHUEZjDr1s4+lAD/TfpyXoVm3/WwhS3/jfkDK2rvfscmwECKLASJdqPv2Qc=
=Y8Ce
-----END PGP SIGNATURE-----


P
P
Philip McGrath wrote on 5 May 2022 22:42
Re: [PATCH 7/7] gnu: chez-scheme-for-system: Adjust support logic.
770e2e49-e27c-dbfb-ee03-e2886df94f42@philipmcgrath.com
Hi,

On 5/4/22 03:21, Liliana Marie Prikler wrote:
Toggle quote (11 lines)
> Am Dienstag, dem 03.05.2022 um 14:33 -0400 schrieb Philip McGrath:
>> This is a follow-up to commit
>> b8fc9169515ef1a6d6037c84e30ad308e5418b6f:
>> see <https://issues.guix.gnu.org/54292>. Thanks to Liliana Marie
>> Prikler for pointing out various issues, e.g. that being able to
>> represent a Nix system as a Chez Scheme machine type does not
>> necessarily mean the system is supported!
> The issue in that commit is a different one: nix-system->chez-machine
> can fail if there's no conversion. Anyway...
>

The issue fixed in the commit is different, but this issue hadn't
occurred to me until you wrote in https://issues.guix.gnu.org/54292#6:

Toggle quote (36 lines)
> I pushed that definition upstream, but a rewrite is still needed. I
> also think this logic should be a little decoupled from the question of
> whether or not a given nix-system is supported. While surely this
> function returning #f means it's not, there are still other questions
> to consider.


>> [...]
>> ;; Commentary:
>> @@ -73,96 +71,17 @@ (define* (chez-scheme-for-system #:optional
>>                                               (%current-system))))
>>    "Return 'chez-scheme' unless only 'chez-scheme-for-racket'
>> supports SYSTEM,
>>  including support for native threads."
>> -  (if (or
>> -       ;; full support upstream
>> -       (and=> (chez-upstream-features-for-system system)
>> -              (cut memq 'threads <>))
>> -       ;; no support anywhere
>> -       (not (nix-system->chez-machine system)))
>> +  (if (and=> (chez-upstream-features-for-system system)
>> +             (lambda (features)
>> +               (every (cut memq <> features)
>> +                      '(threads
>> +                        ;; We can cross-compile for platforms
>> without
>> +                        ;; bootstrap bootfiles, but we can't self-
>> host
>> +                        ;; on them short of adding more binary
>> seeds.
>> +                        bootstrap-bootfiles))))
>>        chez-scheme
>>        chez-scheme-for-racket))
> Does it make sense to require 'threads always?
>

I guess there are a few notions of "always".

In 'chez-scheme-for-racket', yes, because Racket CS needs thread support
for "futures" and "places". (Racket BC had a notion of platforms where
those features were not available, but AFAIK there isn't support for a
non-threaded configuration of Racket CS.)

For 'chez-scheme', every distribution I'm aware of packages the threaded
version (only) on platforms where thread support is available. The only
reason to use the nonthreaded version is if you know for sure that your
application doesn't use threads---IIRC, that may even include any FFI
libraries not using threads internally---AND the small performance gain
from not implementing thread safety internally makes a difference.

For 'chez-scheme-for-system', I don't have a strong view, but the fact
that I think the benefits of thread support are significant makes me
lean that way. Concretely, the answer to this question only affects
armhf-linux, so I think we should not change this at least until we
re-enable it in upstream Chez's 'supported-system'.

Toggle quote (27 lines)
>> -(define* (nix-system->chez-machine #:optional
>> -                                   (system (or (%current-target-
>> system)
>> -                                               (%current-system))))
>> -  "Return the Chez Scheme machine type corresponding to the Nix
>> system
>> -identifier SYSTEM, or @code{#f} if the translation of SYSTEM to a
>> Chez Scheme
>> -machine type is undefined.
>> -
>> -It is unspecified whether the resulting string will name a threaded
>> or a
>> -nonthreaded machine type: when the distinction is relevant, use
>> -@code{chez-machine->nonthreaded} or @code{chez-machine->threaded} to
>> adjust
>> -the result."
>> -  (let* ((hyphen (string-index system #\-))
>> -         (nix-arch (substring system 0 hyphen))
>> -         (nix-os (substring system (+ 1 hyphen)))
>> -         (chez-arch (assoc-ref %nix-arch-to-chez-alist nix-arch))
>> -         (chez-os (assoc-ref %nix-os-to-chez-alist nix-os)))
>> -    (and chez-arch chez-os (string-append chez-arch chez-os))))
>> -
> The replacement code should go here for readability imho. At the very
> least I was confused why this was first above and now below.
>

Happy to move things. Specifically, do you want 'target-chez-arch' and
'target-chez-os' (and '%chez-features-table'?) before
'chez-upstream-features-for-system' and
'racket-cs-native-supported-system?'?


Toggle quote (6 lines)
>> +
> For the sake of completeness, we might want to still have nix-system-
>> chez-machine (with a threaded? argument) defined in terms of target-
> chez-arch and target-chez-os. See 6/7 for motivation.
>

Eventually, I imagine we will want to have a function like
'nix-system->chez-machine', but I think it would be better to wait until
we have a concrete use-case. In particular, what I'd written here:

>> -Note that this function only handles Chez Scheme machine types in
>> the
>> -strictest sense, not other kinds of descriptors sometimes used in
>> place of a
>> -Chez Scheme machine type by Racket, such as @code{\"pb\"},
>> @code{#f}, or
>> -@code{\"racket\"}. (When using such extensions, the Chez Scheme
>> machine type
>> -for the host system is often still relevant.)"

is no longer necessarily true, thanks to the improvements in the
"portable bytecode" backends.

Toggle quote (19 lines)
>>
>>  ;;
>>  ;; Chez Scheme:
>> @@ -365,14 +414,9 @@ (define-public chez-scheme
>>                    ((pth)
>>                     (symlink pth
>>                              "csug.pdf")))))))))
>> -    ;; Chez Scheme does not have a  MIPS backend.
>> -    ;; FIXME: Debian backports patches to get armhf working.
>> -    ;; We should too. It is the Chez machine type arm32le
>> -    ;; (no threaded version upstream yet, though there is in
>> -    ;; Racket's fork), more specifically (per the release notes)
>> ARMv6.
>>      (supported-systems
>>       (delete
>> -      "armhf-linux" ;; <-- should work, but reportedly broken
>> +      "armhf-linux" ;; XXX is this still broken?
> I'd say "XXX: reportedly broken, needs checking"

That seems better, particularly given e.g.


> > it is likely musl-related since I assume that arm32le is well tested
> in conjunction with glibc
>
> That's probably not the best assumption... arm32le is not tested in
> GitHub automation, and the last work that I know for sure was done on
> it was for a project that is now defunct. I'm sure it was working and
> tested at some point, but bit rot may have set in.
>


Toggle quote (6 lines)
> All in all, the individual logic of this patch seems fine, but overall
> it appears as though it's doing three separate things (chez-scheme-for-
> system, chez features, racket-cs stuff). IMO it would make sense to
> split this patch according to those lines. WDYT?
>

I don't think I'm picturing what you have in mind.

The way I've been thinking of this patch is replacing the Chez features
and machine type functions based on '%chez-features-table', then
updating other things accordingly.

I guess there is a distinguishable change to the behavior of
'chez-scheme-for-system' for systems with no native-code backed. I could
separate that, if you want. On the other hand, it continues to return a
package that can't actually be built for the specified system, so the
change seems mostly theoretical.

In terms of "racket-cs stuff", 'racket-cs-native-supported-system?'
seemed better than any name I could come up with based on
'chez-scheme-for-racket', but the answer is based only on Racket's
variant of Chez scheme. The old version based on
'nix-system->chez-machine' was just wrong (it would falsely claim to
support e.g. "powerpc-w64-mingw32"), and we didn't have a way to
implement a correct function until adding the information in
'%chez-features-table'.

-Philip
P
P
Philip McGrath wrote on 5 May 2022 23:49
Re: [PATCH 1/7] gnu: racket: Update to 8.5.
9d2423b2-aacb-4869-b3a7-e4ac885cc36c@philipmcgrath.com
Hi,

On 5/4/22 02:53, Liliana Marie Prikler wrote:
Toggle quote (11 lines)
> Am Dienstag, dem 03.05.2022 um 14:33 -0400 schrieb Philip McGrath:
>> * gnu/packages/patches/racket-gui-tethered-launcher-backport.patch,
>> gnu/packages/patches/racket-enable-scheme-backport.patch: Delete
>> files.
>> * gnu/local.mk (dist_patch_DATA): Remove them.
> LGTM.
>> * gnu/packages/chez.scm (chez-scheme-for-racket): Update to 9.5.7.6.
> This...
>> * gnu/packages/racket.scm (%racket-version): Update to 8.4.900.
> ... and this might be done in different commits.

Since 'chez-scheme-for-racket' uses the same origin as the Racket VM
packages, I think the versions have to be updated at the same time,
short of having a commit where one of them is incorrect or doing
something needlessly complicated.

Toggle quote (3 lines)
> Also, you typo'd in
> the ChangeLog, the version ought to be 8.5

Thanks! (8.4.900 was the release candidate, from which I `git commit
--amend`ed this patch.)

Toggle quote (3 lines)
>> (%racket-origin)[sha256]: Update accordingly.
> You don't normally need to mention hash updates, but (*).

Ok, will drop this but keep below.

Toggle quote (9 lines)
>> [patches]: Remove obsolete patches.
> LGTM.
>> (racket-vm-common-configure-flags): Remove incorrect comment.
> No. Unless you address the issue at hand (which I don't want to be a
> blocker for this series, mind you), it persists. If you don't like how
> the comment is written currently, you might suggest an alternative
> formulation, but people deserve to know that the origtree layout is a
> hack.

I understand that this is your opinion. I disagree. I don't want to make
a big deal out of it, but I'm uncomfortable with the fact that `git
blame` currently attributes to me a statement of opinion which I did not
write and do not believe.

I could write a lot of prose arguing in favor of --enable-origtree as a
matter of opinion, but I'd rather spend my time trying to write a
racket-build-system, which I expect will make its usefulness more
obvious. For now, I'll limit myself to noting that, while Racket
supports --enable-unix-style for those who insist on it (a group which
formerly included me!), if you run the Racket installer script [1] with
default options, it will install the files that 'racket-vm-cs' and
similar place in "/opt/racket-vm/" in "/usr/racket". Optionally, the
installer will then create symlinks is "/usr/bin" etc. pointing to a
subset of the files that Guix's 'racket-minimal' installs into '#$output'.

To the extent that there is an assertion of fact embedded in:

Toggle quote (3 lines)
> > - ;; XXX: origtree layout is required by some other packages down the
> > - ;; bootstrap chain. Remove these flags as soon as we can do without them.

it is not true. The packages which operate on a Racket installation with
this layout (e.g. 'distro-build' and 'raco-cross') are not part of "the
bootstrap chain", and the packages which are part of the bootstrap chain
do not require --enable-origtree, except to the extent that e.g. it is a
convenient way of telling apart multiple executables named "racket".

Toggle quote (3 lines)
>> (simple-racket-origin): Accept optional #:commit argument.
> Is this used anywhere? If not, I suggest leaving it be for now.

It isn't, but it was extremely useful for building the release
candidate. That said, I'm ok with not changing it in Guix.

Toggle quote (8 lines)
>> (racket)[inputs]<2d, datalog, deinprogramm, draw, drracket,
>> expeditor, htdp, pict, plot, quickscript, racklog, rackunit, redex,
>> scribble, typed-racket, string-constants, syntax-color, web-server,
>> xrepl>: Update checksums.
> (*) here it makes sense to document the checksum updates, because
> they'd otherwise be invisible.
>> <gui, srfi>: Likewise, and remove obsolete backports.

P
P
Philip McGrath wrote on 5 May 2022 23:55
Re: [bug#55248] [PATCH 2/7] gnu: racket: Fix out-of-source build.
2ede14d3-75e2-c427-e651-ef0bd66ded8a@philipmcgrath.com
On 5/5/22 16:33, Maxime Devos wrote:
Toggle quote (11 lines)
> Philip McGrath schreef op do 05-05-2022 om 14:53 [-0400]:
>> Another scenario that might be worth considering is projects that follow
>> the REUSE specification[1], which I don't think would be handled by the
>> current install-license-files.
>
> It doesn't copy .reuse/dep5 and LICENSES yet, though that can be
> implemented: <https://issues.guix.gnu.org/54234#4>. I don't think that
> helps for this particular package though, given that Racket doesn't
> ship those files.
>

Right, it wouldn't help Racket, it was just another example of a case
not handled by the current implementation. (Though I think it would be
much more justifiable to add a special case for REUSE than for Racket.)
Glad people are already thinking about it!

-Philip
L
L
Liliana Marie Prikler wrote on 6 May 2022 08:37
Re: [PATCH 1/7] gnu: racket: Update to 8.5.
03612de279ff26c801eb02a2d0aaa03fecfe59f9.camel@ist.tugraz.at
Hi,

Am Donnerstag, dem 05.05.2022 um 17:49 -0400 schrieb Philip McGrath:
Toggle quote (20 lines)
> Hi,
>
> On 5/4/22 02:53, Liliana Marie Prikler wrote:
> > Am Dienstag, dem 03.05.2022 um 14:33 -0400 schrieb Philip McGrath:
> > > * gnu/packages/patches/racket-gui-tethered-launcher-
> > > backport.patch,
> > > gnu/packages/patches/racket-enable-scheme-backport.patch: Delete
> > > files.
> > > * gnu/local.mk (dist_patch_DATA): Remove them.
> > LGTM.
> > > * gnu/packages/chez.scm (chez-scheme-for-racket): Update to
> > > 9.5.7.6.
> > This...
> > > * gnu/packages/racket.scm (%racket-version): Update to 8.4.900.
> > ... and this might be done in different commits.
>
> Since 'chez-scheme-for-racket' uses the same origin as the Racket VM
> packages, I think the versions have to be updated at the same time,
> short of having a commit where one of them is incorrect or doing
> something needlessly complicated.
Fair enough, go ahead.

Toggle quote (16 lines)
>
> [...]
> > > [patches]: Remove obsolete patches.
> > LGTM.
> >
> > > (racket-vm-common-configure-flags): Remove incorrect comment.
> > No.  Unless you address the issue at hand (which I don't want to be
> > a blocker for this series, mind you), it persists.  If you don't
> > like how the comment is written currently, you might suggest an
> > alternative formulation, but people deserve to know that the
> > origtree layout is a hack.
>
> I understand that this is your opinion. I disagree. I don't want to
> make a big deal out of it, but I'm uncomfortable with the fact that
> `git blame` currently attributes to me a statement of opinion which I
> did not write and do not believe.
Well, I'm uncomfortable with the fact that git assigns blame to people.
The wording of the command name is (as many things in git) poorly
chosen, but that's somewhat besides the point. I'm leaving open the
option of writing a comment that you're more comfortable with, but I'm
not leaving the option of silently removing it.

Toggle quote (4 lines)
> I could write a lot of prose arguing in favor of --enable-origtree as
> a matter of opinion, but I'd rather spend my time trying to write a
> racket-build-system, which I expect will make its usefulness more
> obvious. 
You can argue in favour of it, but that doesn't change the fact that
this layout breaks assumptions that are held elsewhere. "Dump
everything into a single directory" has never been a good deployment
strategy, and those who use it tend to regret their decision later.

Toggle quote (8 lines)
> For now, I'll limit myself to noting that, while Racket
> supports --enable-unix-style for those who insist on it (a group
> which formerly included me!), if you run the Racket installer script
> [1] with default options, it will install the files that 'racket-vm-
> cs' and similar place in "/opt/racket-vm/" in "/usr/racket".
> Optionally, the installer will then create symlinks is "/usr/bin"
> etc. pointing to a subset of the files that Guix's 'racket-minimal'
> installs into'#$output'.
This paragraph does not make as much sense to another person as you
believe it does. If I'm counting correctly, we're talking about three
different configurations right now. --enable-origtree, --enable-unix-
style, and a default that uses neither of the two. I don't think we
can easily draw inferences from either to the others.

Toggle quote (13 lines)
> To the extent that there is an assertion of fact embedded in:
>
> > > -      ;; XXX: origtree layout is required by some other packages
> > > down the
> > > -      ;; bootstrap chain.  Remove these flags as soon as we can
> > > do without them.
>
> it is not true. The packages which operate on a Racket installation
> with this layout (e.g. 'distro-build' and 'raco-cross') are not part
> of "the bootstrap chain", and the packages which are part of the
> bootstrap chain do not require --enable-origtree, except to the
> extent that e.g. it is a convenient way of telling apart multiple
> executables named "racket".
From my POV "the bootstrap chain" consists of everything from the first
VM to the final racket package. In that sense, I am sure you
communicated elsewhere that it is very important to get layers going,
and I'm also fairly certain that we can't currently build the VM chain
without origtree either -- at least it would require nontrivial
modification of said packages.

Again, if you have a formulation that is more factual, but doesn't span
several pages like other comments in racket.scm do, you are free to
replace it. However, for the sake of a racket-build-system even, I
suggest that it would be better if racket's own layout was meaningful.
In other words, why can't racket be more like guile and support
RACKET_LOAD_PATH and RACKET_LOAD_COMPILED_PATH?

Toggle quote (1 lines)
> >
Cheers
L
L
Liliana Marie Prikler wrote on 6 May 2022 09:08
Re: [PATCH 7/7] gnu: chez-scheme-for-system: Adjust support logic.
5919abe72ececaa4464a52869ecee7397e93b372.camel@ist.tugraz.at
Am Donnerstag, dem 05.05.2022 um 16:42 -0400 schrieb Philip McGrath:
Toggle quote (24 lines)
> Hi,
>
> On 5/4/22 03:21, Liliana Marie Prikler wrote:
> > Am Dienstag, dem 03.05.2022 um 14:33 -0400 schrieb Philip McGrath:
> >
> > > This is a follow-up to commit
> > > b8fc9169515ef1a6d6037c84e30ad308e5418b6f:
> > > see <https://issues.guix.gnu.org/54292>. Thanks to Liliana Marie
> > > Prikler for pointing out various issues, e.g. that being able to
> > > represent a Nix system as a Chez Scheme machine type does not
> > > necessarily mean the system is supported!
> > The issue in that commit is a different one: nix-system->chez-machine
> > can fail if there's no conversion.  Anyway...
> >
>
> The issue fixed in the commit is different, but this issue hadn't
> occurred to me until you wrote in
> <https://issues.guix.gnu.org/54292#6>:
>
> > I pushed that definition upstream, but a rewrite is still needed.  I
> > also think this logic should be a little decoupled from the
> > question of whether or not a given nix-system is supported.  While
> > surely this function returning #f means it's not, there are still
> > other questions to consider.
Ahh, in that case the commit message is pointing people to the wrong
location. I think this needs to be communicated more clearly, e.g.

"This commit is a follow-up to
b8fc9169515ef1a6d6037c84e30ad308e5418b6f. While that commit did fix a
breaking build, this one addresses the assumptions that lead to the

Thereafter go on to describe what's actually done.


Toggle quote (51 lines)
> > > [...]
> > > ;; Commentary:
> > > @@ -73,96 +71,17 @@ (define* (chez-scheme-for-system #:optional
> > >                                                (%current-
> > > system))))
> > >     "Return 'chez-scheme' unless only 'chez-scheme-for-racket'
> > > supports SYSTEM,
> > >   including support for native threads."
> > > -  (if (or
> > > -       ;; full support upstream
> > > -       (and=> (chez-upstream-features-for-system system)
> > > -              (cut memq 'threads <>))
> > > -       ;; no support anywhere
> > > -       (not (nix-system->chez-machine system)))
> > > +  (if (and=> (chez-upstream-features-for-system system)
> > > +             (lambda (features)
> > > +               (every (cut memq <> features)
> > > +                      '(threads
> > > +                        ;; We can cross-compile for platforms
> > > without
> > > +                        ;; bootstrap bootfiles, but we can't
> > > self-
> > > host
> > > +                        ;; on them short of adding more binary
> > > seeds.
> > > +                        bootstrap-bootfiles))))
> > >         chez-scheme
> > >         chez-scheme-for-racket))
> > Does it make sense to require 'threads always?
> >
>
> I guess there are a few notions of "always".
>
> In 'chez-scheme-for-racket', yes, because Racket CS needs thread
> support for "futures" and "places". (Racket BC had a notion of
> platforms where those features were not available, but AFAIK there
> isn't support for a non-threaded configuration of Racket CS.)
>
> For 'chez-scheme', every distribution I'm aware of packages the
> threaded version (only) on platforms where thread support is
> available. The only reason to use the nonthreaded version is if you
> know for sure that your application doesn't use threads---IIRC, that
> may even include any FFI libraries not using threads internally---AND
> the small performance gain from not implementing thread safety
> internally makes a difference.
>
> For 'chez-scheme-for-system', I don't have a strong view, but the
> fact that I think the benefits of thread support are significant
> makes me lean that way. Concretely, the answer to this question only
> affects armhf-linux, so I think we should not change this at least
> until we re-enable it in upstream Chez's 'supported-system'.
In other words, there aren't that many uses of Chez scheme in embedded
spaces, so we might as well always require threads?

Toggle quote (36 lines)
> > > -(define* (nix-system->chez-machine #:optional
> > > -                                   (system (or (%current-target-
> > > system)
> > > -                                               (%current-
> > > system))))
> > > -  "Return the Chez Scheme machine type corresponding to the Nix
> > > system
> > > -identifier SYSTEM, or @code{#f} if the translation of SYSTEM to
> > > a
> > > Chez Scheme
> > > -machine type is undefined.
> > > -
> > > -It is unspecified whether the resulting string will name a
> > > threaded
> > > or a
> > > -nonthreaded machine type: when the distinction is relevant, use
> > > -@code{chez-machine->nonthreaded} or @code{chez-machine-
> > > >threaded} to
> > > adjust
> > > -the result."
> > > -  (let* ((hyphen (string-index system #\-))
> > > -         (nix-arch (substring system 0 hyphen))
> > > -         (nix-os (substring system (+ 1 hyphen)))
> > > -         (chez-arch (assoc-ref %nix-arch-to-chez-alist nix-
> > > arch))
> > > -         (chez-os (assoc-ref %nix-os-to-chez-alist nix-os)))
> > > -    (and chez-arch chez-os (string-append chez-arch chez-os))))
> > > -
> > The replacement code should go here for readability imho.  At the
> > very least I was confused why this was first above and now below.
> >
>
> Happy to move things. Specifically, do you want 'target-chez-arch'
> and 'target-chez-os' (and '%chez-features-table'?) before
> 'chez-upstream-features-for-system' and
> 'racket-cs-native-supported-system?'?
This is my personal bias coming from a C background, but I read source
files top to bottom with helper procedures at the top and the main
thing at the bottom. If you look closely, much of Guix also follows
that pattern. For instance, build systems have their phases declared
at the bottom, "guix build" expects the last line to evaluate to a
package, and so on.

Toggle quote (27 lines)
> > > +
> > For the sake of completeness, we might want to still have nix-
> > system-
> > > chez-machine (with a threaded? argument) defined in terms of
> > > target-
> > chez-arch and target-chez-os.  See 6/7 for motivation.
> >
>
> Eventually, I imagine we will want to have a function like
> 'nix-system->chez-machine', but I think it would be better to wait
> until we have a concrete use-case. In particular, what I'd written
> here:
>
>  >> -Note that this function only handles Chez Scheme machine types
> in
>  >> the
>  >> -strictest sense, not other kinds of descriptors sometimes used
> in
>  >> place of a
>  >> -Chez Scheme machine type by Racket, such as @code{\"pb\"},
>  >> @code{#f}, or
>  >> -@code{\"racket\"}.  (When using such extensions, the Chez Scheme
>  >> machine type
>  >> -for the host system is often still relevant.)"
>
> is no longer necessarily true, thanks to the improvements in the
> "portable bytecode" backends.
In other words, nix-system->chez-scheme would get an extra #:features
argument, which would be a sequence of 'threads and 'portable-bytecode,
no? This question also has relevance w.r.t. 6/7 and potentially a
chez-build-system, where this machine-type could actually be a
discriminating factor.

Toggle quote (14 lines)
> >
> [...]
> > All in all, the individual logic of this patch seems fine, but
> > overall it appears as though it's doing three separate things
> > (chez-scheme-for-system, chez features, racket-cs stuff).  IMO it
> > would make sense to split this patch according to those lines. 
> > WDYT?
> >
>
> I don't think I'm picturing what you have in mind.
>
> The way I've been thinking of this patch is replacing the Chez
> features and machine type functions based on '%chez-features-table',
> then updating other things accordingly.
Sure, but if we retain nix-system->chez-machine as a function, I think
we can make a cut here and proceed with the second patch thereafter.

Toggle quote (5 lines)
> I guess there is a distinguishable change to the behavior of
> 'chez-scheme-for-system' for systems with no native-code backed. I
> could separate that, if you want. On the other hand, it continues to
> return a package that can't actually be built for the specified
> system, so the change seems mostly theoretical.
This should be the second patch imo. Regardless of theoreticness in
value, I think the change itself is one that deserves its own commit
message. It would also be easier to review and reason about later that
way.

Toggle quote (8 lines)
> In terms of "racket-cs stuff", 'racket-cs-native-supported-system?'
> seemed better than any name I could come up with based on
> 'chez-scheme-for-racket', but the answer is based only on Racket's
> variant of Chez scheme. The old version based on
> 'nix-system->chez-machine' was just wrong (it would falsely claim to
> support e.g. "powerpc-w64-mingw32"), and we didn't have a way to
> implement a correct function until adding the information in
> '%chez-features-table'.
This would be the third patch according to my initial suggestion. That
way, racket-cs-native-supported-system? would remain wrong for patch
7/9, but be corrected in patch 9/9, which imo would more clearly
communicate that it was previously wrong.

WDYT?
P
P
Philip McGrath wrote on 7 May 2022 20:39
Re: [PATCH 1/7] gnu: racket: Update to 8.5.
dda474a2-63f4-237f-0ff2-29ca10a97486@philipmcgrath.com
Hi,

On 5/6/22 02:37, Liliana Marie Prikler wrote:
Toggle quote (48 lines)
> Hi,
>
> Am Donnerstag, dem 05.05.2022 um 17:49 -0400 schrieb Philip McGrath:
>> Hi,
>>
>> On 5/4/22 02:53, Liliana Marie Prikler wrote:
>>> Am Dienstag, dem 03.05.2022 um 14:33 -0400 schrieb Philip McGrath:
>>>> (racket-vm-common-configure-flags): Remove incorrect comment.
>>> No.  Unless you address the issue at hand (which I don't want to be
>>> a blocker for this series, mind you), it persists.  If you don't
>>> like how the comment is written currently, you might suggest an
>>> alternative formulation, but people deserve to know that the
>>> origtree layout is a hack.
>>
>> I understand that this is your opinion. I disagree. I don't want to
>> make a big deal out of it, but I'm uncomfortable with the fact that
>> `git blame` currently attributes to me a statement of opinion which I
>> did not write and do not believe.
> Well, I'm uncomfortable with the fact that git assigns blame to people.
> The wording of the command name is (as many things in git) poorly
> chosen, but that's somewhat besides the point. I'm leaving open the
> option of writing a comment that you're more comfortable with, but I'm
> not leaving the option of silently removing it.
>
>> I could write a lot of prose arguing in favor of --enable-origtree as
>> a matter of opinion, but I'd rather spend my time trying to write a
>> racket-build-system, which I expect will make its usefulness more
>> obvious.
> You can argue in favour of it, but that doesn't change the fact that
> this layout breaks assumptions that are held elsewhere. "Dump
> everything into a single directory" has never been a good deployment
> strategy, and those who use it tend to regret their decision later.
>
>> For now, I'll limit myself to noting that, while Racket
>> supports --enable-unix-style for those who insist on it (a group
>> which formerly included me!), if you run the Racket installer script
>> [1] with default options, it will install the files that 'racket-vm-
>> cs' and similar place in "/opt/racket-vm/" in "/usr/racket".
>> Optionally, the installer will then create symlinks is "/usr/bin"
>> etc. pointing to a subset of the files that Guix's 'racket-minimal'
>> installs into'#$output'.
> This paragraph does not make as much sense to another person as you
> believe it does. If I'm counting correctly, we're talking about three
> different configurations right now. --enable-origtree, --enable-unix-
> style, and a default that uses neither of the two. I don't think we
> can easily draw inferences from either to the others.
>

Given the vehemence of your opinion, I was assuming some familiarity
with building Racket. There are various ways of ending up with a
"Unix-style" installation as implemented by the
'setup/unixstyle-install' module, including `make unix-style` in the
top-level directory, `./configure --enable-origtree=no` in the vm source
directory, and the default answers to the installer script (which embeds
an archive of the built files). There are some platform-specific
details, but none that currently affect Guix. (E.g. when building for
Mac, you can fine-tune the installation style and the use of GTK vs.
Cocoa for `racket/gui`).

An in-place installation (as produced by --enable-origtree) is
self-contained and can be freely relocated. A Unix-style installation
moves parts of an in-place build to better suit a shared FHS prefix
(e.g. "etc/config.rktd" -> "etc/racket/config.rktd"; "collects" ->
"share/racket/collects"), injects absolute paths to find parts of
itself, and generates an uninstall script. But those things are not
useful in this context: the `racket` executable from the VM packages
should only be run to build the rest of Racket, and we want to build a
Racket installation additive, not by mutating it.

Toggle quote (21 lines)
>> To the extent that there is an assertion of fact embedded in:
>>
>>>> -      ;; XXX: origtree layout is required by some other packages
>>>> down the
>>>> -      ;; bootstrap chain.  Remove these flags as soon as we can
>>>> do without them.
>>
>> it is not true. The packages which operate on a Racket installation
>> with this layout (e.g. 'distro-build' and 'raco-cross') are not part
>> of "the bootstrap chain", and the packages which are part of the
>> bootstrap chain do not require --enable-origtree, except to the
>> extent that e.g. it is a convenient way of telling apart multiple
>> executables named "racket".
> From my POV "the bootstrap chain" consists of everything from the first
> VM to the final racket package. In that sense, I am sure you
> communicated elsewhere that it is very important to get layers going,
> and I'm also fairly certain that we can't currently build the VM chain
> without origtree either -- at least it would require nontrivial
> modification of said packages.
>

It is true that removing `--enable-origtree` would require nontrivial
changes, primarily to `configure-layer.rkt`.

Toggle quote (4 lines)
> Again, if you have a formulation that is more factual, but doesn't span
> several pages like other comments in racket.scm do, you are free to
> replace it.

I will try to write a strictly factual comment.

Toggle quote (6 lines)
> However, for the sake of a racket-build-system even, I
> suggest that it would be better if racket's own layout was meaningful.
> In other words, why can't racket be more like guile and support
> RACKET_LOAD_PATH and RACKET_LOAD_COMPILED_PATH?
>

I mean, you are certainly free to dislike Racket's model of linking and
compilation! And, in fact, Racket has enough configuration options and
compatibility hooks that you could try to use it with e.g. PLTCOLLECTS,
though it would not be recommended, well-tested, or useful for most
Racketeers.

With the caveat that all analogies are imprecise, why does Guix prefer
to avoid relying on LD_LIBRARY_PATH for C libraries? From my
perspective, Racket avoids at least several (maybe not all, but we shall
see) of the weaknesses/restrictions described in [1]:

Toggle quote (7 lines)
> This is not the end of stat storms, though. Interpreters and language
> run-time systems rely on search paths—GUILE_LOAD_PATH for Guile,
> PYTHONPATH for Python, OCAMLPATH for OCaml, etc.—and are equally prone
> to stormy application startups. Unlike ELF, they do not have a mechanism
> akin to RUNPATH, let alone a run-time search path cache. We have yet to
> find ways to address these.

P
P
Philip McGrath wrote on 7 May 2022 21:18
Re: [PATCH 7/7] gnu: chez-scheme-for-system: Adjust support logic.
5db08b29-a064-76ed-20a6-d55836071d4c@philipmcgrath.com
Hi,

On 5/6/22 03:08, Liliana Marie Prikler wrote:
Toggle quote (36 lines)
> Am Donnerstag, dem 05.05.2022 um 16:42 -0400 schrieb Philip McGrath:
>> Hi,
>>
>> On 5/4/22 03:21, Liliana Marie Prikler wrote:
>>> Am Dienstag, dem 03.05.2022 um 14:33 -0400 schrieb Philip McGrath:
>>>
>>>> This is a follow-up to commit
>>>> b8fc9169515ef1a6d6037c84e30ad308e5418b6f:
>>>> see <https://issues.guix.gnu.org/54292>. Thanks to Liliana Marie
>>>> Prikler for pointing out various issues, e.g. that being able to
>>>> represent a Nix system as a Chez Scheme machine type does not
>>>> necessarily mean the system is supported!
>>> The issue in that commit is a different one: nix-system->chez-machine
>>> can fail if there's no conversion.  Anyway...
>>>
>>
>> The issue fixed in the commit is different, but this issue hadn't
>> occurred to me until you wrote in
>> <https://issues.guix.gnu.org/54292#6>:
>>
>>> I pushed that definition upstream, but a rewrite is still needed.  I
>>> also think this logic should be a little decoupled from the
>>> question of whether or not a given nix-system is supported.  While
>>> surely this function returning #f means it's not, there are still
>>> other questions to consider.
> Ahh, in that case the commit message is pointing people to the wrong
> location. I think this needs to be communicated more clearly, e.g.
>
> "This commit is a follow-up to
> b8fc9169515ef1a6d6037c84e30ad308e5418b6f. While that commit did fix a
> breaking build, this one addresses the assumptions that lead to the
> failure, see also <https://issues.guix.gnu.org/54292#6>."
>
> Thereafter go on to describe what's actually done.
>

Yes, that seems better. (I was trying to focus the summary on
user-facing functions, rather than replaced internals, but I think it
can be better.)

Toggle quote (56 lines)
>
>>>> [...]
>>>> ;; Commentary:
>>>> @@ -73,96 +71,17 @@ (define* (chez-scheme-for-system #:optional
>>>>                                                (%current-
>>>> system))))
>>>>     "Return 'chez-scheme' unless only 'chez-scheme-for-racket'
>>>> supports SYSTEM,
>>>>   including support for native threads."
>>>> -  (if (or
>>>> -       ;; full support upstream
>>>> -       (and=> (chez-upstream-features-for-system system)
>>>> -              (cut memq 'threads <>))
>>>> -       ;; no support anywhere
>>>> -       (not (nix-system->chez-machine system)))
>>>> +  (if (and=> (chez-upstream-features-for-system system)
>>>> +             (lambda (features)
>>>> +               (every (cut memq <> features)
>>>> +                      '(threads
>>>> +                        ;; We can cross-compile for platforms
>>>> without
>>>> +                        ;; bootstrap bootfiles, but we can't
>>>> self-
>>>> host
>>>> +                        ;; on them short of adding more binary
>>>> seeds.
>>>> +                        bootstrap-bootfiles))))
>>>>         chez-scheme
>>>>         chez-scheme-for-racket))
>>> Does it make sense to require 'threads always?
>>>
>>
>> I guess there are a few notions of "always".
>>
>> In 'chez-scheme-for-racket', yes, because Racket CS needs thread
>> support for "futures" and "places". (Racket BC had a notion of
>> platforms where those features were not available, but AFAIK there
>> isn't support for a non-threaded configuration of Racket CS.)
>>
>> For 'chez-scheme', every distribution I'm aware of packages the
>> threaded version (only) on platforms where thread support is
>> available. The only reason to use the nonthreaded version is if you
>> know for sure that your application doesn't use threads---IIRC, that
>> may even include any FFI libraries not using threads internally---AND
>> the small performance gain from not implementing thread safety
>> internally makes a difference.
>>
>> For 'chez-scheme-for-system', I don't have a strong view, but the
>> fact that I think the benefits of thread support are significant
>> makes me lean that way. Concretely, the answer to this question only
>> affects armhf-linux, so I think we should not change this at least
>> until we re-enable it in upstream Chez's 'supported-system'.
> In other words, there aren't that many uses of Chez scheme in embedded
> spaces, so we might as well always require threads?
>

At least, I think it's a sufficiently niche use-case that its reasonable
for those users to use a package transformation (and check that it works
for all of the libraries they use) while allowing general Chez code to
assume threads are available, since they are well supported overall.

(I have heard stories about embedded Chez, e.g. to control a Disney
World virtual reality ride.[1] But I'm not aware of any free software
Chez projects that don't work with threads.)

Toggle quote (44 lines)
>>>> -(define* (nix-system->chez-machine #:optional
>>>> -                                   (system (or (%current-target-
>>>> system)
>>>> -                                               (%current-
>>>> system))))
>>>> -  "Return the Chez Scheme machine type corresponding to the Nix
>>>> system
>>>> -identifier SYSTEM, or @code{#f} if the translation of SYSTEM to
>>>> a
>>>> Chez Scheme
>>>> -machine type is undefined.
>>>> -
>>>> -It is unspecified whether the resulting string will name a
>>>> threaded
>>>> or a
>>>> -nonthreaded machine type: when the distinction is relevant, use
>>>> -@code{chez-machine->nonthreaded} or @code{chez-machine-
>>>>> threaded} to
>>>> adjust
>>>> -the result."
>>>> -  (let* ((hyphen (string-index system #\-))
>>>> -         (nix-arch (substring system 0 hyphen))
>>>> -         (nix-os (substring system (+ 1 hyphen)))
>>>> -         (chez-arch (assoc-ref %nix-arch-to-chez-alist nix-
>>>> arch))
>>>> -         (chez-os (assoc-ref %nix-os-to-chez-alist nix-os)))
>>>> -    (and chez-arch chez-os (string-append chez-arch chez-os))))
>>>> -
>>> The replacement code should go here for readability imho.  At the
>>> very least I was confused why this was first above and now below.
>>>
>>
>> Happy to move things. Specifically, do you want 'target-chez-arch'
>> and 'target-chez-os' (and '%chez-features-table'?) before
>> 'chez-upstream-features-for-system' and
>> 'racket-cs-native-supported-system?'?
> This is my personal bias coming from a C background, but I read source
> files top to bottom with helper procedures at the top and the main
> thing at the bottom. If you look closely, much of Guix also follows
> that pattern. For instance, build systems have their phases declared
> at the bottom, "guix build" expects the last line to evaluate to a
> package, and so on.
>

My personal preference vacillates between defining helpers before using
them and putting high-level or public definitions above internal utilities.

Toggle quote (34 lines)
>>>> +
>>> For the sake of completeness, we might want to still have nix-
>>> system-
>>>> chez-machine (with a threaded? argument) defined in terms of
>>>> target-
>>> chez-arch and target-chez-os.  See 6/7 for motivation.
>>>
>>
>> Eventually, I imagine we will want to have a function like
>> 'nix-system->chez-machine', but I think it would be better to wait
>> until we have a concrete use-case. In particular, what I'd written
>> here:
>>
>>  >> -Note that this function only handles Chez Scheme machine types
>> in
>>  >> the
>>  >> -strictest sense, not other kinds of descriptors sometimes used
>> in
>>  >> place of a
>>  >> -Chez Scheme machine type by Racket, such as @code{\"pb\"},
>>  >> @code{#f}, or
>>  >> -@code{\"racket\"}.  (When using such extensions, the Chez Scheme
>>  >> machine type
>>  >> -for the host system is often still relevant.)"
>>
>> is no longer necessarily true, thanks to the improvements in the
>> "portable bytecode" backends.
> In other words, nix-system->chez-scheme would get an extra #:features
> argument, which would be a sequence of 'threads and 'portable-bytecode,
> no? This question also has relevance w.r.t. 6/7 and potentially a
> chez-build-system, where this machine-type could actually be a
> discriminating factor.
>

It may end up being more complex than that, depending on how many of the
underlying options we want to expose via Guix. For example, there is
"pb" for a fully machine-independent bytecode, but e.g. "tpb64l" for a
specialized bytecode for 64-bit little-endian machines with threads. I
also don't yet understand when, if ever, we might want to supply a
native machine type (if one is defined) in addition to a pb-based
machine types.

The uncertainty is why I'd rather avoid nix-system->chez-machine until
we actually need it.

Toggle quote (18 lines)
>>>
>> [...]
>>> All in all, the individual logic of this patch seems fine, but
>>> overall it appears as though it's doing three separate things
>>> (chez-scheme-for-system, chez features, racket-cs stuff).  IMO it
>>> would make sense to split this patch according to those lines.
>>> WDYT?
>>>
>>
>> I don't think I'm picturing what you have in mind.
>>
>> The way I've been thinking of this patch is replacing the Chez
>> features and machine type functions based on '%chez-features-table',
>> then updating other things accordingly.
> Sure, but if we retain nix-system->chez-machine as a function, I think
> we can make a cut here and proceed with the second patch thereafter.
>

I don't think we should retain nix-system->chez-machine beyond this
series, but I guess we can delay removing it to split here.

Toggle quote (11 lines)
>> I guess there is a distinguishable change to the behavior of
>> 'chez-scheme-for-system' for systems with no native-code backed. I
>> could separate that, if you want. On the other hand, it continues to
>> return a package that can't actually be built for the specified
>> system, so the change seems mostly theoretical.
> This should be the second patch imo. Regardless of theoreticness in
> value, I think the change itself is one that deserves its own commit
> message. It would also be easier to review and reason about later that
> way.
>

This is the part that makes the most sense to me to put in its own commit.

Toggle quote (15 lines)
>> In terms of "racket-cs stuff", 'racket-cs-native-supported-system?'
>> seemed better than any name I could come up with based on
>> 'chez-scheme-for-racket', but the answer is based only on Racket's
>> variant of Chez scheme. The old version based on
>> 'nix-system->chez-machine' was just wrong (it would falsely claim to
>> support e.g. "powerpc-w64-mingw32"), and we didn't have a way to
>> implement a correct function until adding the information in
>> '%chez-features-table'.
> This would be the third patch according to my initial suggestion. That
> way, racket-cs-native-supported-system? would remain wrong for patch
> 7/9, but be corrected in patch 9/9, which imo would more clearly
> communicate that it was previously wrong.
>
> WDYT?

I will try to come up with a v2 more or less along these lines.

-Philip

[1]:
M
M
Maxime Devos wrote on 7 May 2022 22:01
Re: [PATCH 1/7] gnu: racket: Update to 8.5.
63e0a11d577741fc1a57e0d1ea9e0cc4d793ddb0.camel@telenet.be
Philip McGrath schreef op za 07-05-2022 om 14:39 [-0400]:
Toggle quote (3 lines)
> With the caveat that all analogies are imprecise, why does Guix prefer
> to avoid relying on LD_LIBRARY_PATH for C libraries?

Because when using LD_LIBRARY_PATH, you not only need to install the
binary in a profile, but also it library dependencies. Now, suppose
that Guix didn't use RUNPATH or RPATH and instead relied on
LD_LIBRARY_PATH.

Now suppose you have a binary 'vlc' in /usr/bin (on a foreign distro)
and 'openssl.so' in ~/.guix-profile/lib/... . Note that 'vlc' has
'openssl' as a dependency (for streaming over the Internet).

Then suppose you run 'vlc'. The dynamic linker will see ‘we have a
$LD_LIBRARY_PATH, let's use the openssl.so from ~/.guix-profile/lib
instead of /usr/lib!’. However, it (could) turn out that the openssls
from the two different locations have an incompatible ABI, causing a
crash or such.

Also, if you depend of LD_LIBRARY_PATH (without wrap-program), then you
can't run things directly from /gnu/store.

In the same manner, GUILE_LOAD_COMPILED_PATH (= Guile's mix of
LD_LIBRARY_PATH (for 'guile') and LIBRARY_PATH (for Guile's compiler,
e.g. the cross-module inlining) is a bit suboptimal, Guile binaries
need to be wrapped (wrap-program / wrap-script). Would be nice to have
a RUNPATH/RPATH equivalent ...

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYnbQCxccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7r3YAQDo2gUdpZDmM6rLKCP/R2GHM73q
HHHzywJNQIDnFLvOwgD+LEI1/Bul2wZ8x2OjlF28FpZBhcfLeAY5b9UEfp5YYwc=
=k2jT
-----END PGP SIGNATURE-----


P
P
Philip McGrath wrote on 8 May 2022 22:07
[PATCH v2 0/9] gnu: Update Racket to 8.5 and Chez Scheme to 9.5.8.
(address . 55248@debbugs.gnu.org)
cover.1652039837.git.philip@philipmcgrath.com
Hi,

Here is v2!

The workaround for install-license-files with an out-of-source build did turn
out to still be needed: I've added a comment explaining.

As requested, I split the final patch into three parts. I hope the
organization makes sense.

-Philip

Philip McGrath (9):
gnu: racket: Update to 8.5.
gnu: racket: Fix out-of-source build.
gnu: chez-scheme: Update to 9.5.8.
gnu: chez-scheme: Refactor documentation phases.
gnu: chez-scheme: Refactor configure phase and fix '--threads'.
gnu: stex: Get machine type dynamically.
gnu: chez-upstream-features-for-system: Improve implementation.
gnu: chez-scheme-for-racket: Fix supported systems.
gnu: chez-scheme-for-system: Adjust for bytecode backend.

gnu/local.mk | 2 -
gnu/packages/chez.scm | 426 +++++++++-------
.../racket-enable-scheme-backport.patch | 465 ------------------
...acket-gui-tethered-launcher-backport.patch | 26 -
gnu/packages/racket.scm | 107 ++--
5 files changed, 302 insertions(+), 724 deletions(-)
delete mode 100644 gnu/packages/patches/racket-enable-scheme-backport.patch
delete mode 100644 gnu/packages/patches/racket-gui-tethered-launcher-backport.patch


base-commit: 668313e07fa2518fe02704b047237c173f63c6d4
--
2.32.0
P
P
Philip McGrath wrote on 8 May 2022 22:07
[PATCH v2 2/9] gnu: racket: Fix out-of-source build.
(address . 55248@debbugs.gnu.org)
63d9ad60e39d8315f493b0ca49517f21fb320575.1652039837.git.philip@philipmcgrath.com
* gnu/packages/racket.scm (racket-vm-cgc)[arguments]: Add phase
'symlink-license-src' to work around limitation in
'install-license-files'. Supply '#:out-of-source? #t'.
---
gnu/packages/racket.scm | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)

Toggle diff (38 lines)
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index 7d51707156..904dfe9bef 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -276,8 +276,9 @@ (define-public racket-vm-cgc
;; main-distribution-test that aren't part of the main
;; distribution.
#:tests? #f
- ;; Upstream recommends #:out-of-source?, and it does
- ;; help with debugging, but it confuses `install-license-files`.
+ ;; Upstream recommends #:out-of-source?, and it
+ ;; helps a lot with debugging.
+ #:out-of-source? #t
#:modules '((ice-9 match)
(ice-9 regex)
(guix build gnu-build-system)
@@ -314,7 +315,18 @@ (define-public racket-vm-cgc
#f)))))))
(add-before 'configure 'chdir
(lambda _
- (chdir "racket/src"))))))
+ (chdir "racket/src")))
+ (add-after 'chdir 'symlink-license-src
+ ;; Work around limitation of install-license-files by symlinking
+ ;; srcdir where it expects. (It doesn't handle this variant of
+ ;; #:out-of-source? and a subdirectory for srcdir.) Just running
+ ;; `make install` only puts them in Racket's 'share-dir'.
+ (lambda* (#:key out-of-source? #:allow-other-keys)
+ (when out-of-source?
+ (with-directory-excursion ".."
+ (symlink "src"
+ (package-name->name+version
+ (strip-store-file-name #$output))))))))))
(home-page "https://racket-lang.org")
(synopsis "Old Racket implementation used for bootstrapping")
(description "This variant of the Racket BC (``before Chez'' or
--
2.32.0
P
P
Philip McGrath wrote on 8 May 2022 22:07
[PATCH v2 1/9] gnu: racket: Update to 8.5.
(address . 55248@debbugs.gnu.org)
0274097e2e661519d5a5bf2b0ae2a8c3735af3c7.1652039837.git.philip@philipmcgrath.com
* gnu/packages/patches/racket-gui-tethered-launcher-backport.patch,
gnu/packages/patches/racket-enable-scheme-backport.patch: Delete files.
* gnu/local.mk (dist_patch_DATA): Remove them.
* gnu/packages/chez.scm (chez-scheme-for-racket): Update to 9.5.7.6.
* gnu/packages/racket.scm (%racket-version): Update to 8.5.
(%racket-origin)[patches]: Remove obsolete patches.
(racket-vm-common-configure-flags): Correct comment.
(racket)[inputs]<2d, datalog, deinprogramm, draw, drracket, expeditor, htdp,
pict, plot, quickscript, racklog, rackunit, redex, scribble, typed-racket,
string-constants, syntax-color, web-server, xrepl>: Update checksums.
<gui, srfi>: Likewise, and remove obsolete backports.
---
gnu/local.mk | 2 -
gnu/packages/chez.scm | 4 +-
.../racket-enable-scheme-backport.patch | 465 ------------------
...acket-gui-tethered-launcher-backport.patch | 26 -
gnu/packages/racket.scm | 82 ++-
5 files changed, 32 insertions(+), 547 deletions(-)
delete mode 100644 gnu/packages/patches/racket-enable-scheme-backport.patch
delete mode 100644 gnu/packages/patches/racket-gui-tethered-launcher-backport.patch

Toggle diff (195 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index bc9f976a39..d593aecfc2 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1757,8 +1757,6 @@ dist_patch_DATA = \
%D%/packages/patches/ripperx-missing-file.patch \
%D%/packages/patches/rpcbind-CVE-2017-8779.patch \
%D%/packages/patches/rtags-separate-rct.patch \
- %D%/packages/patches/racket-enable-scheme-backport.patch \
- %D%/packages/patches/racket-gui-tethered-launcher-backport.patch \
%D%/packages/patches/racket-minimal-sh-via-rktio.patch \
%D%/packages/patches/remake-impure-dirs.patch \
%D%/packages/patches/restic-0.9.6-fix-tests-for-go1.15.patch \
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index d47225dbe5..a7f75a731a 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -4,7 +4,7 @@
;;; Copyright © 2017, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2019 Brett Gilio <brettg@gnu.org>
;;; Copyright © 2020 Brendan Tildesley <mail@brendan.scot>
-;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
+;;; Copyright © 2021, 2022 Philip McGrath <philip@philipmcgrath.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -361,7 +361,7 @@ (define-public chez-scheme-for-racket
(package
(inherit chez-scheme)
(name "chez-scheme-for-racket")
- (version "9.5.7.3")
+ (version "9.5.7.6")
;; The version should match `(scheme-fork-version-number)`.
;; See racket/src/ChezScheme/s/cmacros.ss c. line 360.
;; It will always be different than the upstream version!
diff --git a/gnu/packages/patches/racket-enable-scheme-backport.patch b/gnu/packages/patches/racket-enable-scheme-backport.patch
deleted file mode 100644
index 3a5a4a3d82..0000000000
--- a/gnu/packages/patches/racket-enable-scheme-backport.patch
+++ /dev/null
@@ -1,465 +0,0 @@
-From 8d7687842f099e3e7e60d3a83fed58b2c6a92863 Mon Sep 17 00:00:00 2001
-From: Matthew Flatt <mflatt@racket-lang.org>
-Date: Sun, 6 Feb 2022 10:36:09 -0700
-Subject: [PATCH 1/2] Chez Scheme: adapt bootfile build for supplied `Scheme=`
-
-(cherry picked from commit fca1e02349664060e10278ca2ce6577a949bebf5)
-
-(Fixed conflicts by dropping pbchunks and pbarch changes.)
----
- racket/src/ChezScheme/configure | 15 ++++++++++++++-
- racket/src/ChezScheme/s/Mf-base | 4 ++--
- racket/src/ChezScheme/s/Mf-cross | 4 +++-
- 3 files changed, 19 insertions(+), 4 deletions(-)
-
-diff --git a/racket/src/ChezScheme/configure b/racket/src/ChezScheme/configure
-index 4515ffc105..0098829091 100755
---- a/racket/src/ChezScheme/configure
-+++ b/racket/src/ChezScheme/configure
-@@ -45,6 +45,7 @@ threads=yes
- nothreads=no
- temproot=""
- help=no
-+forceworkarea=no
- gzipmanpages=yes
- installowner=""
- installgroup=""
-@@ -205,6 +206,9 @@ while [ $# != 0 ] ; do
- --pb)
- pb=yes
- ;;
-+ --force)
-+ forceworkarea=yes
-+ ;;
- --installprefix=*)
- installprefix=`echo $1 | sed -e 's/^--installprefix=//'`
- ;;
-@@ -439,6 +443,7 @@ if [ "$help" = "yes" ]; then
- echo " --toolprefix=<prefix> prefix tool (compiler, linker, ...) names"
- echo " --[no]gzip-man-pages compress manual pages ($gzipmanpages)"
- echo " --workarea=<pathname> build directory ($w)"
-+ echo " --force configure even without boot files"
- echo " CC=<C compiler> C compiler"
- echo " CPPFLAGS=<C preprocessor flags> C preprocessor flags"
- echo " CFLAGS=<C compiler flags> C compiler flags"
-@@ -721,8 +726,16 @@ case "${flagsmuni}" in
- ;;
- esac
-
-+if [ "$w" = "$m" ] ; then
-+ configuringin=""
-+else
-+ configuringin=" in $w"
-+fi
-+
- if [ -f boot/$m/scheme.boot -o -f "$srcdir"/boot/$m/scheme.boot ] ; then
-- echo "Configuring for $m"
-+ echo "Configuring for $m$configuringin"
-+elif [ "$forceworkarea" = yes ] ; then
-+ echo "Configuring for $m$configuringin despite missing boot files"
- else
- if [ "$m" = "" ] ; then
- maybem="<machine type>"
-diff --git a/racket/src/ChezScheme/s/Mf-base b/racket/src/ChezScheme/s/Mf-base
-index cc6178c973..1f4a967998 100644
---- a/racket/src/ChezScheme/s/Mf-base
-+++ b/racket/src/ChezScheme/s/Mf-base
-@@ -94,7 +94,7 @@ endif
- # that Scheme and SCHEMEHEAPDIRS are set by Mf-cross to point to the host Scheme
- # implementation
- Scheme = ../bin/$m/scheme${ExeSuffix}
--export SCHEMEHEAPDIRS=../boot/%m
-+export SCHEMEHEAPDIRS=../boot/$m
- export CHEZSCHEMELIBDIRS=.
-
- # Define the libdirs separator character
-@@ -691,4 +691,4 @@ reset-one:
-
- .PHONY: run
- run:
-- env SCHEMEHEAPDIRS=../boot/$m/ ../bin/$m/scheme $(ARGS)
-+ env SCHEMEHEAPDIRS=${SCHEMEHEAPDIRS} ${Scheme} $(ARGS)
-diff --git a/racket/src/ChezScheme/s/Mf-cross b/racket/src/ChezScheme/s/Mf-cross
-index d796cbb459..397af59a28 100644
---- a/racket/src/ChezScheme/s/Mf-cross
-+++ b/racket/src/ChezScheme/s/Mf-cross
-@@ -43,5 +43,7 @@ x$(xm).$(m):
- $(MAKE) -f Mf-cross m=$(m) xm=$(xm) i=f o=3 d=0 xpatch
- mv xpatch x$(xm).$(m)
-
-+ifneq ($(SCHEMEHEAPDIRS),:)
- # Ensure that cross-compiling "nanopass.so" is rebuilt if the host compiler changed
--nanopass.so: ${SCHEME} ${SCHEMEHEAPDIRS}/petite.boot ${SCHEMEHEAPDIRS}/scheme.boot
-+nanopass.so: ${Scheme} ${SCHEMEHEAPDIRS}/petite.boot ${SCHEMEHEAPDIRS}/scheme.boot
-+endif
---
-2.32.0
-
-
-From 26c8e2c1d9b02ad85acef8bda40d92154cf0b699 Mon Sep 17 00:00:00 2001
-From: Matthew Flatt <mflatt@racket-lang.org>
-Date: Sun, 6 Feb 2022 11:03:30 -0700
-Subject: [PATCH 2/2] configure: make `--enable-scheme` work with an executable
-
-When the same Chez Scheme version as used by Racket is already
-available, then `--enable-scheme=...` can supply an executable. For
-cross builds, `--enable-scheme=...` can still supply a build
-directory, instead, as before.
-
-(cherry picked from commit 4f0e76855ce7e86107de495292a553469daf0b3f)
----
- racket/src/ChezScheme/makefiles/Makefile.in | 3 ++
- racket/src/README.txt | 30 +++++++++++---
- racket/src/configure | 8 +++-
- racket/src/cs/README.txt | 6 ++-
- racket/src/cs/c/Makefile.in | 44 ++++++++++++++++-----
- racket/src/cs/c/configure | 24 +++++++++--
- racket/src/cs/c/configure.ac | 21 ++++++++--
- 7 files changed, 112 insertions(+), 24 deletions(-)
-
-diff --git a/racket/src/ChezScheme/makefiles/Makefile.in b/racket/src/ChezScheme/makefiles/Makefile.in
-index c396efc851..3998ef9ccd 100644
---- a/racket/src/ChezScheme/makefiles/Makefile.in
-+++ b/racket/src/ChezScheme/makefiles/Makefile.in
-@@ -59,6 +59,9 @@ reset:
- %.boot:
- (cd $(workarea) && $(MAKE) $*.boot)
-
-+auto.boot:
-+ (cd $(workarea) && $(MAKE) $(defaultm).boot)
-+
- # <machine>.bootquick to build boot files for <machine>
- # with o=3 d=0 for the cross compiler, and only after
- # building the kernel for the configured machine
-diff --git a/racket/src/README.txt b/racket/src/README.txt
-index 98647aebce..d77310b4a4 100644
---- a/racket/src/README.txt
-+++ b/racket/src/README.txt
-@@ -354,6 +354,10 @@ variant of MinGW without "libdelayimp.a", get the implementation of
- ========================================================================
-
- Cross-compilation requires at least two flags to `configure`:
-+`--host=OS` and either `--enable-racket=RACKET` or (for Racket CS)
-+`--enable-scheme-SCHEME`.
-+
-+More information:
-
- * `--host=OS`, where OS is something like `i386-gnu-linux` to
- indicate the target platform.
-@@ -374,11 +378,27 @@ Cross-compilation requires at least two flags to `configure`:
- run `configure` again (with no arguments) in a "local" subdirectory
- to create a build for the current platform.
-
--An additional flag is needed for building Racket CS, unless the flag
--`--enable-racket=auto` is used:
--
-- * `--enable-scheme=DIR`, where DIR is a path that has a "ChezScheme"
-- directory where Chez Scheme is built for the host system.
-+ * `--enable-scheme=SCHEME`, where SCHEME is a Chez Scheme executable
-+ executable that runs on the build platform; the executable must be
-+ the same version as used in Racket built for the target platform.
-+
-+ Supplying `--enable-scheme=DIR` is also supported in cross-build
-+ mode, where DIR is a path that has a "ChezScheme" directory where
-+ Chez Scheme is built for the host system.
-+
-+The `--enable-racket=RACKET` and `--enable-scheme=SCHEME` flags are
-+allowed for non-cross builds, too:
-+
-+ * For Racket CS, supplying either selects a Racket or Chez Scheme
-+ implementation used to create boot files to the build platform.
-+ Suppling Chez Scheme is a much more direct path, but when Racket is
-+ supplied, its version does not have to match the version being
-+ built.
-+
-+ * For Racket BC, `--enable-racket=RACKET` selects a Racket for
-+ prepare C sources to cooperate with garbage collection. Its version
-+ needs to be close to the one being built, and potentially exactly
-+ the same version.
-
- Some less commonly needed `configure` flags are for Racket BC:
-
-diff --git a/racket/src/configure b/racket/src/configure
-index c9f3ba4419..1b53ec7ce2 100755
---- a/racket/src/configure
-+++ b/racket/src/configure
-@@ -9,6 +9,7 @@ pb_dir="$dir/ChezScheme/boot/pb"
- use_cs=maybe
- use_bc=maybe
- supplied_racket=no
-+supplied_scheme=no
- enable_boothelp=
-
- # We don't have to detect conflicts like `--enable-csdefault --enable-bcdefault`,
-@@ -34,6 +35,9 @@ for arg in $*; do
- --enable-racket=*)
- supplied_racket=yes
- ;;
-+ --enable-scheme=*)
-+ supplied_scheme=yes
-+ ;;
- --help | -h)
- echo $0:
- echo see --help-bc or --help-cs, since the Racket CS build and the
-@@ -70,8 +74,8 @@ elif test "$use_cs" = "maybe" ; then
- fi
-
- if test "$use_cs" = "yes" ; then
-- if test $use_bc = no -a $supplied_racket = no -a ! -d "$pb_dir" ; then
-- echo $0: must have $pb_dir or --enable-racket=... for --enable-csonly
-+ if test $use_bc = no -a $supplied_racket = no -a $supplied_scheme = no -a ! -d "$pb_dir" ; then
-+ echo $0: must have $pb_dir, --enable-racket=... or --enable-scheme=... for --enable-csonly
- exit 1
- fi
-
-diff --git a/racket/src/cs/README.txt b/racket/src/cs/README.txt
-index 2ece417b78..8e6fc57b74 100644
---- a/racket/src/cs/README.txt
-+++ b/racket/src/cs/README.txt
-@@ -39,6 +39,11 @@ build:
- installed in the "../ChezScheme/boot/pb" directory as described by
- "../ChezScheme/BUILDING".
-
-+ Supplying `--enable-scheme=...` is also an option if you alerady
-+ have the same version of Chez Scheme built on the current platform.
-+ Another build will be created, anyway, but more quickly than
-+ without Chez Scheme.
-+
- * Racket is needed to generate the files in the "schemified"
- directory from the sources in sibling directories like "../io". The
- Racket version must be practically the same as the current Racket
-@@ -48,7 +53,6 @@ build:
- Unlike Chez Scheme boot files, the files generated in "schemified"
- are human-readable and -editable Scheme code. That provides a way
- out of bootstrapping black holes, even without BC.
--
-
-
- ========================================================================
-diff --git a/racket/src/cs/c/Makefile.in b/racket/src/cs/c/Makefile.in
-index 54a644a1d9..d73993f0fc 100644
---- a/racket/src/cs/c/Makefile.in
-+++ b/racket/src/cs/c/Makefile.in
-@@ -12,7 +12,9 @@ CS_HOST_WORKAREA_PREFIX = @CS_HOST_WORKAREA_PREFIX@
- SCHEME_HOST_WORKAREA = $(CS_HOST_WORKAREA_PREFIX)$(SCHEME_WORKAREA)
- SCHEME_BIN = $(SCHEME_HOST_WORKAREA)/$(MACH)/bin/$(MACH)/scheme
- SCHEME_INC = $(SCHEME_HOST_WORKAREA)/$(MACH)/boot/$(MACH)
--SCHEME = $(SCHEME_BIN) -B $(SCHEME_INC)/petite.boot -B $(SCHEME_INC)/scheme.boot
-+SCHEME_built = $(SCHEME_BIN) -B $(SCHEME_INC)/petite.boot -B $(SCHEME_INC)/scheme.boot
-+SCHEME_existing = @MAKE_SCHEME_SCHEME@
-+SCHEME = $(SCHEME@USE_SCHEME_MODE@)
-
- TARGET_MACH = @TARGET_MACH@
- SCHEME_TARGET_INC = $(SCHEME_WORKAREA)/$(TARGET_MACH)/boot/$(TARGET_MACH)
-@@ -88,7 +90,7 @@ mainsrcdir = @srcdir@/../..
- @INCLUDEDEP@ @srcdir@/../../version/version.mak
-
- cs:
-- $(MAKE) scheme@T_CROSS_MODE@
-+ $(MAKE) scheme@MAKE_SCHEME_MODE@
- $(MAKE) racket-so
- cd rktio; $(MAKE)
- $(MAKE) racketcs
-@@ -121,9 +123,13 @@ racket-so:
-
- RACKET_SO_ENV = @CONFIGURE_RACKET_SO_COMPILE@
-
-+TARGET_MACH_built = $(TARGET_MACH)
-+TARGET_MACH_existing = xc-$(TARGET_MACH)
-+XPATCH_FILE = $(SCHEME_WORKAREA)/$(TARGET_MACH@USE_SCHEME_MODE@)/s/xpatch
-+
- CS_PROGS = SCHEME="$(SCHEME)"
- CS_OPTS = COMPRESS_COMP=@COMPRESS_COMP@ @ENABLE_OR_DISABLE_WPO@
--CS_OPTScross = $(CS_OPTS) CSO=$(MACH) CROSS_COMP="--xpatch $(SCHEME_WORKAREA)/$(TARGET_MACH)/s/xpatch"
-+CS_OPTScross = $(CS_OPTS) CSO=$(MACH) CROSS_COMP="--xpatch $(XPATCH_FILE)"
- PASS_COMPILE_DEPS = EXTRA_COMPILE_DEPS="$(SCHEME_INC)/petite.boot $(SCHEME_INC)/scheme.boot"
-
- build-racket-so:
-@@ -163,6 +169,15 @@ pb-bootquick:
- cd $(SCHEME_WORKAREA) && $(MAKE) reset
- $(SHELL) $(srcdir)/ready_boot.sh $(MACH) $(SCHEME_WORKAREA)
-
-+scheme-via-scheme:
-+ $(MAKE) $(SCHEME_WORKAREA)/boot/$(MACH)/scheme.boot
-+ $(MAKE) mach-make
-+
-+$(SCHEME_WORKAREA)/boot/$(MACH)/scheme.boot:
-+ mkdir -p $(SCHEME_WORKAREA)
-+ $(MAKE) config-scheme CONFIG_SCHEME_MODE="$(CONFIG_SCHEME_MODE) --force"
-+ cd $(SCHEME_WORKAREA) && $(MAKE) $(MACH).boot Scheme="$(SCHEME)" SCHEMEHEAPDIRS=: o=3 d=0 what=all
-+
- mach-make:
- $(MAKE) config-scheme
- cd $(SCHEME_WORKAREA) && $(MAKE)
-@@ -182,24 +197,33 @@ config-scheme:
-
- scheme-cross:
- env MAKE_BOOT_FOR_CROSS=yes SCHEME_SRC="$(SCHEME_DIR)" SCHEME_WORKAREA=$(SCHEME_WORKAREA) MACH="$(TARGET_MACH)" $(BOOTSTRAP_RACKET) "$(SCHEME_DIR)"/rktboot/make-boot.rkt
-+ $(MAKE) finish-scheme-cross
-+
-+finish-scheme-cross:
- $(SHELL) $(srcdir)/reset_boot.sh $(TARGET_MACH) $(SCHEME_WORKAREA)
- cd $(SCHEME_WORKAREA) && "$(UP_SCHEME_DIR)"/configure @SCHEME_CROSS_CONFIG_ARGS@ $(SCHEME_CONFIG_VARS)
- cd $(SCHEME_WORKAREA)/$(TARGET_MACH)/c && $(CHOST_HACK@T_CROSS_MODE@) $(MAKE) o=o cross=t
-- $(MAKE) $(SCHEME_WORKAREA)/$(TARGET_MACH)/s/xpatch
-+ $(MAKE) $(XPATCH_FILE)
-+
-+scheme-cross-via-scheme:
-+ $(MAKE) $(SCHEME_WORKAREA)/boot/$(TARGET_MACH)/scheme.boot MACH=$(TARGET_MACH)
-+ $(MAKE) finish-scheme-cross
-
- # Rebuild patch file and cross "petite.boot" and "scheme.boot" when older
--# than the build-host "scheme.boot" or when "make-boot.rkt" touchs dummy boot files
--XPATCH_DEPS = $(SCHEME_HOST_WORKAREA)/$(MACH)/boot/$(MACH)/scheme.boot \
-- $(SCHEME_WORKAREA)/boot/$(TARGET_MACH)/scheme.boot
-+# than the build-<host "scheme.boot" or when "make-boot.rkt" touchs dummy boot files
-+XPATCH_DEPS_built = $(SCHEME_HOST_WORKAREA)/$(MACH)/boot/$(MACH)/scheme.boot \
-+ $(SCHEME_WORKAREA)/boot/$(TARGET_MACH)/scheme.boot
-+XPATCH_DEPS_existing =
-+XPATCH_DEPS = $(XPATCH_DEPS@USE_SCHEME_MODE@)
-
--$(SCHEME_WORKAREA)/$(TARGET_MACH)/s/xpatch: $(XPATCH_DEPS)
-+$(XPATCH_FILE): $(XPATCH_DEPS)
- $(MAKE) bounce TARGET=build-xpatch-using-host
-
- build-xpatch-using-host:
- cd $(SCHEME_WORKAREA)/$(TARGET_MACH)/s && $(MAKE) -f Mf-cross m=$(MACH) xm=$(TARGET_MACH) Scheme="$(SCHEME_BIN)" SCHEMEHEAPDIRS="$(SCHEME_INC)"
-
- XPATCH =
--XPATCHcross = --xpatch $(SCHEME_WORKAREA)/$(TARGET_MACH)/s/xpatch
-+XPATCHcross = --xpatch $(XPATCH_FILE)
-
- racket.boot: racket.so
- $(SCHEME) --script $(srcdir)/convert-to-boot.ss @BOOT_COMPRESS_COMP@ $(XPATCH@CROSS_MODE@) racket.so racket.boot $(TARGET_MACH)
-@@ -410,7 +434,7 @@ install-cross:
- $(MAKE) compile-xpatch.$(TARGET_MACH)
- $(MAKE) library-xpatch.$(TARGET_MACH)
-
--SCHEME_XPATCH = $(SCHEME_WORKAREA)/$(TARGET_MACH)/s/xpatch
-+SCHEME_XPATCH = $(XPATCH_FILE)
-
- CROSS_SERVE_DEPS = $(srcdir)/mk-cross-serve.ss $(srcdir)/cross-serve.ss \
- $(srcdir)/../expander/env.ss $(srcdir)/../linklet/config.ss
-diff --git a/racket/src/cs/c/configure b/racket/src/cs/c/configure
-index 21695a431a..1eeef57753 100755
---- a/racket/src/cs/c/configure
-+++ b/racket/src/cs/c/configure
-@@ -654,6 +654,9 @@ MINGW
- NOT_OSX
- OSX
- SETUP_BOOT_MODE
-+USE_SCHEME_MODE
-+MAKE_SCHEME_SCHEME
-+MAKE_SCHEME_MODE
- TT_CROSS_MODE
- T_CROSS_MODE
- CROSS_MODE
-@@ -1448,7 +1451,7 @@ Optional Features:
- --enable-docs build docs on install (enabled by default)
- --enable-usersetup setup user-specific files on install
- --enable-racket=<path> use <path> as Racket for build; or "auto" to create
-- --enable-scheme=<path> use <path> as host's build directory for cross
-+ --enable-scheme=<path> use <path> as host build for cross
- --enable-mach=<mach> use Chez Scheme machine type <mach>
- --enable-target=<mach> cross-build for Chez Scheme machine type <mach>
- --enable-portable prefer portable to host-specific
-@@ -2867,7 +2870,7 @@ show_explicitly_enabled "${enable_xonx}" "Unix style"
- show_explicitly_enabled "${enable_libzo}" 'Compiled ".zo" files moved to lib'
-
- show_explicitly_set "${enable_racket}" "Racket"
--show_explicitly_set "${enable_scheme}" "Chez Scheme build directory"
-+show_explicitly_set "${enable_scheme}" "Chez Scheme for build"
- show_explicitly_set "${enable_mach}" "machine type"
- show_explicitly_set "${enable_target}" "cross-build machine type"
- show_explicitly_enabled "${enable_portable}" "portable"
-@@ -4745,9 +4748,21 @@ esac
-
- SCHEME_DIR=${srcdir}/../../ChezScheme
- MAKE_BUILD_SCHEME=checkout
-+USE_SCHEME_MODE="_built"
-+MAKE_SCHEME_MODE="${T_CROSS_MODE}"
-
- if test "${enable_scheme}" != "" ; then
-- CS_HOST_WORKAREA_PREFIX="${enable_scheme}/"
-+ if test -d "${enable_scheme}" ; then
-+ # Directory exists, so use it as a build directory
-+ echo "Using supplied Scheme path as a build directory"
-+ CS_HOST_WORKAREA_PREFIX="${enable_scheme}/"
-+ else
-+ # Directory does not exist, so assume it's an executable
-+ echo "Using supplied Scheme path as an executable"
-+ MAKE_SCHEME_MODE="${T_CROSS_MODE}-via-scheme"
-+ MAKE_SCHEME_SCHEME="${enable_scheme}"
-+ USE_SCHEME_MODE="_existing"
-+ fi
- fi
-
- if test "${enable_racket}" != "" ; then
-@@ -6012,6 +6027,9 @@ SCHEME_CROSS_CONFIG_ARGS="--machine=${TARGET_MACH} --disable-x11 ${cs_auto_flags
-
-
-
-+
-+
-+
-
-
-
-diff --git a/racket/src/cs/c/configure.ac b/racket/src/cs/c/configure.ac
-index 464ebe1760..aaee88156d 100644
---- a/racket/src/cs/c/configure.ac
-+++ b/racket/src/cs/c/configure.ac
-@@ -23,7 +23,7 @@ AC_ARG_ENABLE(compressmore, [ --enable-compressmore compress compiled code ev
- AC_ARG_ENABLE(compressboot, [ --enable-compressboot compress boot files])
- m4_include(../ac/path_arg.m4)
- AC_ARG_ENABLE(racket, [ --enab
This message was truncated. Download the full message here.
P
P
Philip McGrath wrote on 8 May 2022 22:07
[PATCH v2 3/9] gnu: chez-scheme: Update to 9.5.8.
(address . 55248@debbugs.gnu.org)
73175f996c4683dda7288b5cf605a1ff4b7fdf62.1652039837.git.philip@philipmcgrath.com
* gnu/packages/chez.scm (chez-scheme): Update to 9.5.8.
---
gnu/packages/chez.scm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Toggle diff (24 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index a7f75a731a..34545b1f58 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -210,7 +210,7 @@ (define-public chez-scheme
(name "chez-scheme")
;; The version should match `(scheme-version-number)`.
;; See s/cmacros.ss c. line 360.
- (version "9.5.6")
+ (version "9.5.8")
(source (origin
(method git-fetch)
(uri (git-reference
@@ -218,7 +218,7 @@ (define-public chez-scheme
(commit (string-append "v" version))))
(sha256
(base32
- "07s433hn1z2slfc026sidrpzxv3a8narcd40qqr1xrpb9012xdky"))
+ "0xchqq8cm0ka5wgpn18sjs0hh15rc3nb7xrjqbbc9al3asq0d7gc"))
(file-name (git-file-name name version))
(snippet #~(begin
(use-modules (guix build utils))
--
2.32.0
P
P
Philip McGrath wrote on 8 May 2022 22:07
[PATCH v2 4/9] gnu: chez-scheme: Refactor documentation phases.
(address . 55248@debbugs.gnu.org)
55dfaa9f70c0842d05424ed394c232e5454262d1.1652039837.git.philip@philipmcgrath.com
Patches merged in both upstream Chez Scheme and Racket's variant will
soon let us replace the 'install-docs' phase with just
'make install-docs'. Separating the 'link-doc-pdfs' phase (which won't
change) leaves us well-prepared for the transition, regardless of
whether Chez Scheme 9.5.10 or Racket 8.6 is released first.

* gnu/packages/chez.scm (chez-scheme)[arguments]: Split 'install-doc'
phase into 'install-docs' (matching the future 'make' target) and
'link-doc-pdfs'.
---
gnu/packages/chez.scm | 64 ++++++++++++++++++++++++-------------------
1 file changed, 36 insertions(+), 28 deletions(-)

Toggle diff (78 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 34545b1f58..49051abd17 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -309,35 +309,43 @@ (define-public chez-scheme
(string-append (dirname scheme.boot)
"/chez-scheme.boot")))))))
;; Building the documentation requires stex and a running scheme.
- ;; FIXME: this is probably wrong for cross-compilation
- (add-after 'install-symlink 'install-doc
+ (add-after 'install-symlink 'install-docs
(lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
- (match (assoc-ref outputs "doc")
- (#f
- (format #t "not installing docs~%"))
- (doc-prefix
- (let* ((chez+version (strip-store-file-name #$output))
- (scheme (search-input-file outputs "/bin/scheme"))
- (stexlib (search-input-directory (or native-inputs
- inputs)
- "/lib/stex"))
- (doc-dir (string-append doc-prefix
- "/share/doc/"
- chez+version)))
- (define* (stex-make #:optional (suffix ""))
- (invoke "make" "install"
- (string-append "Scheme=" scheme)
- (string-append "STEXLIB=" stexlib)
- (string-append "installdir=" doc-dir suffix)))
- (with-directory-excursion "csug"
- (stex-make "/csug"))
- (with-directory-excursion "release_notes"
- (stex-make "/release_notes"))
- (with-directory-excursion doc-dir
- (symlink "release_notes/release_notes.pdf"
- "release_notes.pdf")
- (symlink "csug/csug9_5.pdf"
- "csug.pdf"))))))))))
+ (let* ((doc-prefix (or (assoc-ref outputs "doc")
+ (assoc-ref outputs "out")))
+ (chez+version (strip-store-file-name #$output))
+ (scheme (search-input-file outputs "/bin/scheme"))
+ (stexlib (search-input-directory (or native-inputs
+ inputs)
+ "/lib/stex"))
+ (doc-dir (string-append doc-prefix
+ "/share/doc/"
+ chez+version)))
+ (define* (stex-make #:optional (suffix ""))
+ (invoke "make" "install"
+ (string-append "Scheme=" scheme)
+ (string-append "STEXLIB=" stexlib)
+ (string-append "installdir=" doc-dir suffix)))
+ (with-directory-excursion "csug"
+ (stex-make "/csug"))
+ (with-directory-excursion "release_notes"
+ (stex-make "/release_notes")))))
+ (add-after 'install-docs 'link-doc-pdfs
+ ;; otherwise, it's hard to notice them in a forest of HTML files
+ (lambda* (#:key outputs #:allow-other-keys)
+ (with-directory-excursion
+ (string-append (or (assoc-ref outputs "doc")
+ (assoc-ref outputs "out"))
+ "/share/doc/"
+ (strip-store-file-name #$output))
+ (symlink "release_notes/release_notes.pdf"
+ "release_notes.pdf")
+ (match (find-files "csug"
+ "csug.*\\.pdf$" ;; embeded version number
+ #:fail-on-error? #t)
+ ((pth)
+ (symlink pth
+ "csug.pdf")))))))))
;; Chez Scheme does not have a MIPS backend.
;; FIXME: Debian backports patches to get armhf working.
;; We should too. It is the Chez machine type arm32le
--
2.32.0
P
P
Philip McGrath wrote on 8 May 2022 22:07
[PATCH v2 5/9] gnu: chez-scheme: Refactor configure phase and fix '--threads'.
(address . 55248@debbugs.gnu.org)
a1c54704d4b4ffddd5af5868af8aae453455c82a.1652039837.git.philip@philipmcgrath.com
Move Chez-specific logic into '#:configure-flags' and a new
'configure-environment-variables' phase, leaving the 'configure' phase
as just a variant of the one from 'gnu-build-system' (including support
for '#:out-of-source?') that doesn't add implicit Autoconf-style flags.

In the process, do the right thing for "--threads", rather than assuming
the only nonthreaded platform is broken.

* gnu/packages/chez.scm (chez-scheme)[arguments]: Set configure flags in
'#:configure-flags' and separate 'configure-environment-variables' from
the residual 'configure' phase. More closely follow 'gnu-build-system'.
Use 'chez-upstream-features-for-system' for "--threads".
(chez-scheme-for-racket)[arguments]<#:configure-flags>: Add "--threads"
unconditionally.
---
gnu/packages/chez.scm | 63 ++++++++++++++++++++++++++++---------------
1 file changed, 42 insertions(+), 21 deletions(-)

Toggle diff (92 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 49051abd17..785b6837c1 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -258,8 +258,18 @@ (define-public chez-scheme
(ice-9 ftw)
(ice-9 match))
#:test-target "test"
- ;; TODO when we fix armhf, it may not support --threads
- #:configure-flags #~'("--threads")
+ #:configure-flags
+ #~`(,(string-append "--installprefix=" #$output)
+ #$@(if (and=> (chez-upstream-features-for-system)
+ (cut memq 'threads <>))
+ #~("--threads")
+ #~())
+ "ZLIB=-lz"
+ "LZ4=-llz4"
+ "--libkernel"
+ ;; Guix will do 'compress-man-pages',
+ ;; and letting Chez try causes an error
+ "--nogzip-man-pages")
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'unpack-nanopass+stex
@@ -273,26 +283,35 @@ (define-public chez-scheme
(search-input-directory (or native-inputs inputs)
"lib/chez-scheme-bootfiles")
"boot")))
- ;; NOTE: the custom Chez 'configure' script doesn't allow
+ ;; NOTE: The custom Chez 'configure' script doesn't allow
;; unrecognized flags, such as those automatically added
- ;; by `gnu-build-system`.
+ ;; by `gnu-build-system`. This replacement phase uses only
+ ;; the explicitly provided `#:configure-flags`.
(replace 'configure
- (lambda* (#:key inputs (configure-flags '()) #:allow-other-keys)
- ;; add flags which are always required:
- (let ((flags (cons* (string-append "--installprefix=" #$output)
- "ZLIB=-lz"
- "LZ4=-llz4"
- "--libkernel"
- ;; Guix will do compress-man-pages,
- ;; and letting Chez try causes an error
- "--nogzip-man-pages"
- configure-flags)))
- (format #t "configure flags: ~s~%" flags)
- ;; Some makefiles (for tests) don't seem to propagate CC
- ;; properly, so we take it out of their hands:
- (setenv "CC" #$(cc-for-target))
- (setenv "HOME" "/tmp")
- (apply invoke "./configure" flags))))
+ (lambda* (#:key inputs (configure-flags '()) out-of-source?
+ #:allow-other-keys)
+ (let* ((abs-srcdir (getcwd))
+ (srcdir (if out-of-source?
+ (string-append "../" (basename abs-srcdir))
+ ".")))
+ (format #t "source directory: ~s (relative from build: ~s)~%"
+ abs-srcdir srcdir)
+ (if out-of-source?
+ (begin
+ (mkdir "../build")
+ (chdir "../build")))
+ (format #t "build directory: ~s~%" (getcwd))
+ (format #t "configure flags: ~s~%" configure-flags)
+ (apply invoke
+ (string-append srcdir "/configure")
+ configure-flags))))
+ (add-after 'configure 'configure-environment-variables
+ (lambda args
+ ;; Some makefiles (for tests) don't seem to propagate CC
+ ;; properly, so we take it out of their hands:
+ (setenv "CC" #$(cc-for-target))
+ ;; Likewise, some tests have needed HOME to be set:
+ (setenv "HOME" "/tmp")))
;; The binary file name is called "scheme" as is the one from
;; MIT/GNU Scheme. We add a symlink to use in case both are
;; installed.
@@ -385,7 +404,9 @@ (define-public chez-scheme-for-racket
(arguments
(substitute-keyword-arguments (package-arguments chez-scheme)
((#:configure-flags cfg-flags #~'())
- #~(cons "--disable-x11" #$cfg-flags))
+ #~(cons* "--disable-x11"
+ "--threads" ;; ok to potentially duplicate
+ #$cfg-flags))
((#:phases those-phases #~%standard-phases)
#~(let* ((those-phases #$those-phases)
(unpack (assoc-ref those-phases 'unpack)))
--
2.32.0
P
P
Philip McGrath wrote on 8 May 2022 22:07
[PATCH v2 6/9] gnu: stex: Get machine type dynamically.
(address . 55248@debbugs.gnu.org)
bdbee4e3ce2894450627350a741f2121068ada4f.1652039837.git.philip@philipmcgrath.com
* gnu/packages/chez.scm (stex)[arguments]: Run 'scheme' to determine
the machine type.
---
gnu/packages/chez.scm | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)

Toggle diff (34 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 785b6837c1..dd485d37e1 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -602,6 +602,10 @@ (define-public stex-bootstrap
("src" "lib/stex/")
("Mf-stex" "lib/stex/")
("Makefile.template" "lib/stex/"))
+ #:modules
+ '((guix build copy-build-system)
+ (guix build utils)
+ (ice-9 popen))
#:phases
#~(modify-phases %standard-phases
(add-before 'install 'patch-sources
@@ -633,8 +637,14 @@ (define-public stex-bootstrap
(define makefile
(string-append (getcwd) "/Makefile"))
(define machine
- #$(and=> (nix-system->chez-machine)
- chez-machine->threaded))
+ (let ((pipe (open-pipe* OPEN_BOTH scheme "-q")))
+ ;; try to not be wrong for cross-compilation
+ ;; (avoid #% reader abbreviation for Guile)
+ (write '(($primitive $target-machine)) pipe)
+ (force-output pipe)
+ (let ((sym (read pipe)))
+ (close-pipe pipe)
+ (symbol->string sym))))
(with-directory-excursion
(search-input-directory outputs "/lib/stex")
(invoke "make"
--
2.32.0
P
P
Philip McGrath wrote on 8 May 2022 22:07
[PATCH v2 7/9] gnu: chez-upstream-features-for-system: Improve implementation.
(address . 55248@debbugs.gnu.org)
3deb541efd59acd25410f7019670071368291ad4.1652039837.git.philip@philipmcgrath.com
This commit is a follow-up to b8fc9169515ef1a6d6037c84e30ad308e5418b6f.
While that commit fixed a breaking build, this one begins to address the
faulty assumptions that lead to the failure: see also

In this commit, we reimplement 'chez-upstream-features-for-system' using
the new '%chez-features-table', which explicitly specifies platform
support for both 'chez-scheme' and 'chez-scheme-for-racket', rather than
assuming a non-false result from 'nix-system->chez-machine' means that
the system is supported.

The remaining uses of 'nix-system->chez-machine' still make that
incorrect assumption and must be repaired in a future commit.

* gnu/packages/chez.scm (%nix-arch-to-chez-alist,
%nix-os-to-chez-alist): Replace with ...
(target-chez-arch, target-chez-os): ... these new variables.
(nix-system->chez-machine): Rewrite using them.
(%chez-features-table): New variable.
(chez-upstream-features-for-system): Rewrite using it.
(chez-scheme)[supported-systems]: Update armhf-linux comment.
(chez-scheme-bootstrap-bootfiles)[supported-systems]: Use
'chez-upstream-features-for-system'.
(chez-machine->nonthreaded, chez-machine->threaded,
chez-machine->nix-system): Remove unused functions.
---
gnu/packages/chez.scm | 234 ++++++++++++++++++++++++------------------
1 file changed, 134 insertions(+), 100 deletions(-)

Toggle diff (288 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index dd485d37e1..41f083e0ac 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -49,8 +49,6 @@ (define-module (gnu packages chez)
#:use-module (srfi srfi-26)
#:export (chez-scheme-for-system
nix-system->chez-machine
- chez-machine->nonthreaded
- chez-machine->threaded
unpack-nanopass+stex))
;; Commentary:
@@ -82,68 +80,57 @@ (define* (chez-scheme-for-system #:optional
chez-scheme
chez-scheme-for-racket))
-(define (chez-machine->nonthreaded machine)
- "Given a string MACHINE naming a Chez Scheme machine type, returns a string
-naming the nonthreaded machine type for the same architecture and OS as
-MACHINE. The returned string may share storage with MACHINE."
- ;; Chez Scheme documentation consistently uses "nonthreaded" rather than
- ;; e.g. "unthreaded"
- (if (eqv? #\t (string-ref machine 0))
- (substring machine 1)
- machine))
-(define (chez-machine->threaded machine)
- "Like @code{chez-machine->nonthreaded}, but returns the threaded machine
-type."
- (if (eqv? #\t (string-ref machine 0))
- machine
- (string-append "t" machine)))
-
-;; Based on the implementation from raco-cross-lib/private/cross/platform.rkt
-;; in https://github.com/racket/raco-cross.
-;; For supported platforms, refer to release_notes/release_notes.stex in the
-;; upstream Chez Scheme repository or to racket/src/ChezScheme/README.md
-;; in https://github.com/racket/racket.
-(define %nix-arch-to-chez-alist
- `(("x86_64" . "a6")
- ("i386" . "i3")
- ("aarch64" . "arm64")
- ("armhf" . "arm32") ;; Chez supports ARM v6+
- ("ppc" . "ppc32")))
-(define %nix-os-to-chez-alist
- `(("w64-mingw32" . "nt")
- ("darwin" . "osx")
- ("linux" . "le")
- ("freebsd" . "fb")
- ("openbsd" . "ob")
- ("netbsd" . "nb")
- ("solaris" . "s2")))
-
-(define (chez-machine->nix-system machine)
- "Return the Nix system type corresponding to the Chez Scheme machine type
-MACHINE. If MACHINE is not a string representing a known machine type, an
-exception is raised. This function does not distinguish between threaded and
-nonthreaded variants of MACHINE.
+(define* (target-chez-arch #:optional (system
+ (or (%current-target-system)
+ (%current-system))))
+ "Return a string representing the architecture of SYSTEM as used in Chez
+Scheme machine types, or '#f' if none is defined."
+ (cond
+ ((target-x86-64? system)
+ "a6")
+ ((target-x86-32? system)
+ "i3")
+ ((target-aarch64? system)
+ "arm64")
+ ((target-arm32? system)
+ "arm32")
+ ((target-ppc64le? system)
+ #f)
+ ((target-ppc32? system)
+ "ppc32")
+ ((target-riscv64? system)
+ #f)
+ (else
+ #f)))
-Note that this function only handles Chez Scheme machine types in the
-strictest sense, not other kinds of descriptors sometimes used in place of a
-Chez Scheme machine type by Racket, such as @code{\"pb\"}, @code{#f}, or
-@code{\"racket\"}. (When using such extensions, the Chez Scheme machine type
-for the host system is often still relevant.)"
- (let ((machine (chez-machine->nonthreaded machine)))
- (let find-arch ((alist %nix-arch-to-chez-alist))
- (match alist
- (((nix . chez) . alist)
- (if (string-prefix? chez machine)
- (string-append
- nix "-" (let ((machine-os
- (substring machine (string-length chez))))
- (let find-os ((alist %nix-os-to-chez-alist))
- (match alist
- (((nix . chez) . alist)
- (if (equal? chez machine-os)
- nix
- (find-os alist)))))))
- (find-arch alist)))))))
+(define* (target-chez-os #:optional (system (or (%current-target-system)
+ (%current-system))))
+ "Return a string representing the operating system kernel of SYSTEM as used
+in Chez Scheme machine types, or '#f' if none is defined."
+ ;; e.g. "le" includes both GNU/Linux and Android
+ (cond
+ ((target-linux? system)
+ "le")
+ ((target-hurd? system)
+ #f)
+ ((target-mingw? system)
+ "nt")
+ ;; missing (guix utils) predicates
+ ;; cf. https://github.com/NixOS/nixpkgs/blob/master/lib/systems/doubles.nix
+ ((string-suffix? "-darwin" system)
+ "osx")
+ ((string-suffix? "-freebsd" system)
+ "fb")
+ ((string-suffix? "-openbsd" system)
+ "ob")
+ ((string-suffix? "-netbsd" system)
+ "nb")
+ ;; Nix says "x86_64-solaris", but accommodate "-solaris2"
+ ((string-contains system "solaris")
+ "s2")
+ ;; unknown
+ (else
+ #f)))
(define* (nix-system->chez-machine #:optional
(system (or (%current-target-system)
@@ -153,16 +140,81 @@ (define* (nix-system->chez-machine #:optional
machine type is undefined.
It is unspecified whether the resulting string will name a threaded or a
-nonthreaded machine type: when the distinction is relevant, use
-@code{chez-machine->nonthreaded} or @code{chez-machine->threaded} to adjust
-the result."
- (let* ((hyphen (string-index system #\-))
- (nix-arch (substring system 0 hyphen))
- (nix-os (substring system (+ 1 hyphen)))
- (chez-arch (assoc-ref %nix-arch-to-chez-alist nix-arch))
- (chez-os (assoc-ref %nix-os-to-chez-alist nix-os)))
+nonthreaded machine type."
+ (let* ((chez-arch (target-chez-arch system))
+ (chez-os (target-chez-os system)))
(and chez-arch chez-os (string-append chez-arch chez-os))))
+(define %chez-features-table
+ ;; An alist of alists mapping:
+ ;; os -> arch -> (or/c #f (listof symbol?))
+ ;; where:
+ ;; - `os` is a string for the OS part of a Chez Scheme machine type; and
+ ;; - `arch` is a string for the architecture part of a Chez machine type.
+ ;;
+ ;; The absence of an entry for a given arch--os pair means that neither
+ ;; upstream Chez Scheme nor the Racket variant can generate native code for
+ ;; that system. (The Racket variant can still provide support via its
+ ;; ``portable bytecode'' backends and optional compilation to C.) A value
+ ;; of `#f` means that upstream Chez Scheme does not support the arch--os
+ ;; pair at all, but the Racket variant does. A list has the same meaning as
+ ;; a result from `chez-upstream-features-for-system`.
+ ;;
+ ;; The arch--os pairs marked "commented out" have been commented out in the
+ ;; STeX source for the upstream release notes since the initial release as
+ ;; free software, but they are reported to work and/or have been described
+ ;; as supported by upstream maintainers.
+ ;;
+ ;; For this overall approach to make sense, we assume that Racket's variant
+ ;; of Chez Scheme can generate native code for a superset of the platforms
+ ;; supported upstream, supports threads on all platforms it supports at all
+ ;; (because they are needed for Racket), and doesn't need bootstrap
+ ;; bootfiles. Those assumptions have held for several years.
+ '(;; Linux
+ ("le"
+ ("i3" threads bootstrap-bootfiles)
+ ("a6" threads bootstrap-bootfiles)
+ ("arm32" bootstrap-bootfiles)
+ ("arm64" . #f)
+ ("ppc32" threads))
+ ;; FreeBSD
+ ("fb"
+ ("i3" threads) ;; commented out
+ ("a6" threads) ;; commented out
+ ("arm32" . #f)
+ ("arm64" . #f)
+ ("ppc32" . #f))
+ ;; OpenBSD
+ ("ob"
+ ("i3" threads) ;; commented out
+ ("a6" threads) ;; commented out
+ ("arm32" . #f)
+ ("arm64" . #f)
+ ("ppc32" . #f))
+ ;; NetBSD
+ ("nb"
+ ("i3" threads) ;; commented out
+ ("a6" threads) ;; commented out
+ ("arm32" . #f)
+ ("arm64" . #f)
+ ("ppc32" . #f))
+ ;; OpenSolaris / OpenIndiana / Illumos
+ ("s2"
+ ("i3" threads) ;; commented out
+ ("a6" threads)) ;; commented out
+ ;; Windows
+ ("nt"
+ ("i3" threads bootstrap-bootfiles)
+ ("a6" threads bootstrap-bootfiles)
+ ;; ^ threads "experiemental", but reportedly fine
+ ("arm64" . #f))
+ ;; Darwin
+ ("osx"
+ ("i3" threads bootstrap-bootfiles)
+ ("a6" threads bootstrap-bootfiles)
+ ("arm64" . #f)
+ ("ppc32" . #f))))
+
(define* (chez-upstream-features-for-system #:optional
(system
(or (%current-target-system)
@@ -172,20 +224,14 @@ (define* (chez-upstream-features-for-system #:optional
does not support SYSTEM at all.
If native threads are supported, the returned list will include
-@code{'threads}. Other feature symbols may be added in the future."
- (cond
- ((not (nix-system->chez-machine system))
- #f)
- ((target-aarch64? system)
- #f)
- ((target-arm32? system)
- (and (target-linux? system)
- '()))
- ((target-ppc32? system)
- (and (target-linux? system)
- '(threads)))
- (else
- '(threads))))
+@code{'threads}. If bootstrap bootfiles for SYSTEM are distributed in the
+upstream Chez Scheme repository, the returned list will include
+@code{'bootstrap-bootfiles}. Other feature symbols may be added in the
+future."
+ (let ((chez-arch (target-chez-arch system))
+ (chez-os (target-chez-os system)))
+ (and=> (assoc-ref %chez-features-table chez-os)
+ (cut assoc-ref <> chez-arch))))
;;
;; Chez Scheme:
@@ -365,14 +411,9 @@ (define-public chez-scheme
((pth)
(symlink pth
"csug.pdf")))))))))
- ;; Chez Scheme does not have a MIPS backend.
- ;; FIXME: Debian backports patches to get armhf working.
- ;; We should too. It is the Chez machine type arm32le
- ;; (no threaded version upstream yet, though there is in
- ;; Racket's fork), more specifically (per the release notes) ARMv6.
(supported-systems
(delete
- "armhf-linux" ;; <-- should work, but reportedly broken
+ "armhf-linux" ;; XXX reportedly broken, needs checking
(filter chez-upstream-features-for-system
%supported-systems)))
(home-page "https://cisco.github.io/ChezScheme/")
@@ -471,16 +512,9 @@ (define-public chez-scheme-bootstrap-bootfiles
(list #:install-plan
#~`(("boot/" "lib/chez-scheme-bootfiles"))))
(supported-systems
- ;; Upstream only distributes pre-built bootfiles for
- ;; arm32le and t?(i3|a6)(le|nt|osx)
(filter (lambda (system)
- (let ((machine (and=> (nix-system->chez-machine system)
- chez-machine->nonthreaded)))
- (or (equal? "arm32le" machine)
- (and machine
- (member (substring machine 0 2) '("i3" "a6"))
- (or-map (cut string-suffix? <> machine)
- '("le" "nt" "osx"))))))
+ (and=> (chez-upstream-features-for-system system)
+ (cut memq 'bootstrap-bootfiles <>)))
%supported-systems))
(synopsis "Chez Scheme bootfiles (binary seed)")
(description
--
2.32.0
P
P
Philip McGrath wrote on 8 May 2022 22:07
[PATCH v2 8/9] gnu: chez-scheme-for-racket: Fix supported systems.
(address . 55248@debbugs.gnu.org)
c869dd8744e5810771cd01f0fa73960fb20d0d5c.1652039837.git.philip@philipmcgrath.com
This commit fixes the treatment of systems like "powerpc-w64-mingw32",
where the combination of architecture and kernel is not supported, even
though both are supported in other combinations. The build failure fixed
in b8fc9169515ef1a6d6037c84e30ad308e5418b6f highlighted this problem:
see also https://issues.guix.gnu.org/54292#6. The correct support
status is specified by '%chez-features-table', which was added to
improve 'chez-upstream-features-for-system': this commit uses it to fix
the repair.

Once the issues in https://racket.discourse.group/t/950 are resolved,
'chez-scheme-for-racket' and 'racket-vm-cs' will be able to run even on
systems for which native code generation is not supported. It's not
clear what behavior would be useful from 'nix-system->chez-machine':
since the current implementation is flawed and easy to misuse, we remove
it for now, replacing the remaining uses with
'racket-cs-native-supported-system?'.

* gnu/packages/chez.scm (nix-system->chez-machine): Remove it.
(racket-cs-native-supported-system?): New variable.
(chez-scheme-for-racket)[supported-systems]: Use it.
* gnu/packages/racket.scm (racket-vm-for-system): Likewise.
---
gnu/packages/chez.scm | 32 +++++++++++++++++---------------
gnu/packages/racket.scm | 7 +++++--
2 files changed, 22 insertions(+), 17 deletions(-)

Toggle diff (84 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 41f083e0ac..cae17580f8 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -48,7 +48,7 @@ (define-module (gnu packages chez)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:export (chez-scheme-for-system
- nix-system->chez-machine
+ racket-cs-native-supported-system?
unpack-nanopass+stex))
;; Commentary:
@@ -132,19 +132,6 @@ (define* (target-chez-os #:optional (system (or (%current-target-system)
(else
#f)))
-(define* (nix-system->chez-machine #:optional
- (system (or (%current-target-system)
- (%current-system))))
- "Return the Chez Scheme machine type corresponding to the Nix system
-identifier SYSTEM, or @code{#f} if the translation of SYSTEM to a Chez Scheme
-machine type is undefined.
-
-It is unspecified whether the resulting string will name a threaded or a
-nonthreaded machine type."
- (let* ((chez-arch (target-chez-arch system))
- (chez-os (target-chez-os system)))
- (and chez-arch chez-os (string-append chez-arch chez-os))))
-
(define %chez-features-table
;; An alist of alists mapping:
;; os -> arch -> (or/c #f (listof symbol?))
@@ -233,6 +220,19 @@ (define* (chez-upstream-features-for-system #:optional
(and=> (assoc-ref %chez-features-table chez-os)
(cut assoc-ref <> chez-arch))))
+(define* (racket-cs-native-supported-system? #:optional
+ (system
+ (or (%current-target-system)
+ (%current-system))))
+ "Can Racket's variant of Chez Scheme generate native code for SYSTEM?
+Otherwise, SYSTEM can use only the ``portable bytecode'' backends."
+ (let ((chez-arch (target-chez-arch system))
+ (chez-os (target-chez-os system)))
+ (and (and=> (assoc-ref %chez-features-table chez-os)
+ ;; NOT assoc-ref: supported even if cdr is #f
+ (cut assoc chez-arch <>))
+ #t)))
+
;;
;; Chez Scheme:
;;
@@ -459,7 +459,9 @@ (define-public chez-scheme-for-racket
(add-after 'unpack 'chdir
(lambda args
(chdir "racket/src/ChezScheme"))))))))
- (supported-systems (filter nix-system->chez-machine
+ ;; TODO: How to build pbarch/pbchunks for other systems?
+ ;; See https://racket.discourse.group/t/950
+ (supported-systems (filter racket-cs-native-supported-system?
%supported-systems))
(home-page "https://github.com/racket/ChezScheme")
;; ^ This is downstream of https://github.com/racket/racket,
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index 904dfe9bef..1f020f1276 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -190,8 +190,11 @@ (define-module (gnu packages racket)
(define* (racket-vm-for-system #:optional
(system (or (%current-target-system)
(%current-system))))
- "Return 'racket-vm-cs' if it supports SYSTEM; 'racket-vm-bc' otherwise."
- (if (nix-system->chez-machine system)
+ "Return 'racket-vm-cs' if we are able to build it for SYSTEM; 'racket-vm-bc'
+otherwise."
+ ;; Once we figure out the issues in https://racket.discourse.group/t/950,
+ ;; we can use 'racket-vm-cs' everywhere.
+ (if (racket-cs-native-supported-system? system)
racket-vm-cs
racket-vm-bc))
--
2.32.0
P
P
Philip McGrath wrote on 8 May 2022 22:07
[PATCH v2 9/9] gnu: chez-scheme-for-system: Adjust for bytecode backend.
(address . 55248@debbugs.gnu.org)
930d660fe1deaef1210ec6a04cec9e9aa66a150d.1652039837.git.philip@philipmcgrath.com
Change 'chez-scheme-for-system' to return 'chez-scheme-for-racket' in
two cases when it previously returned 'chez-scheme':

1. When 'chez-scheme' is not distributed with bootstrap bootfiles,
since we can only cross-compile 'chez-scheme' for those systems; and

2. When neither 'chez-scheme' nor 'chez-scheme-for-racket' supports
native code generation, since we will be able to use the ``portable
bytecode'' backends of 'chez-scheme-for-racket' as soon as the
issues in https://racket.discourse.group/t/950 are resolved.

* gnu/packages/chez.scm (chez-scheme-for-racket): Change condition.
---
gnu/packages/chez.scm | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)

Toggle diff (32 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index cae17580f8..7e6273f26a 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -69,14 +69,17 @@ (define-module (gnu packages chez)
(define* (chez-scheme-for-system #:optional
(system (or (%current-target-system)
(%current-system))))
- "Return 'chez-scheme' unless only 'chez-scheme-for-racket' supports SYSTEM,
-including support for native threads."
- (if (or
- ;; full support upstream
- (and=> (chez-upstream-features-for-system system)
- (cut memq 'threads <>))
- ;; no support anywhere
- (not (nix-system->chez-machine system)))
+ "Return 'chez-scheme' if it fully supports SYSTEM, including support for
+bootstrapping and native threads. Otherwise, return
+'chez-scheme-for-racket'."
+ (if (and=> (chez-upstream-features-for-system system)
+ (lambda (features)
+ (every (cut memq <> features)
+ '(threads
+ ;; We can cross-compile for platforms without
+ ;; bootstrap bootfiles, but we can't self-host
+ ;; on them short of adding more binary seeds.
+ bootstrap-bootfiles))))
chez-scheme
chez-scheme-for-racket))
--
2.32.0
L
L
Liliana Marie Prikler wrote on 9 May 2022 05:54
Re: [PATCH v2 2/9] gnu: racket: Fix out-of-source build.
(name . Maxime Devos)(address . maximedevos@telenet.be)
e0215d489ceec0cf38f8b602a19c2b9e6a264f72.camel@gmail.com
Hi Philip,

Correct me if I'm wrong, but I think you didn't quite get the point I
raised w.r.t. install-license-files. Instead of

Am Sonntag, dem 08.05.2022 um 16:07 -0400 schrieb Philip McGrath:
Toggle quote (16 lines)
> +           (add-after 'chdir 'symlink-license-src
> +             ;; Work around limitation of install-license-files by
> symlinking
> +             ;; srcdir where it expects.  (It doesn't handle this
> variant of
> +             ;; #:out-of-source? and a subdirectory for srcdir.) 
> Just running
> +             ;; `make install` only puts them in Racket's 'share-
> dir'.
> +             (lambda* (#:key out-of-source? #:allow-other-keys)
> +               (when out-of-source?
> +                 (with-directory-excursion ".."
> +                   (symlink "src"
> +                            (package-name->name+version
> +                             (strip-store-file-name
> #$output))))))))))
you could

(replace 'install-license-files
(lambda args
(with-directory-excursion ".." ; perhaps "../src" if needed
(apply (assoc-ref %standard-phases 'install-license-files)
args))))

If that doesn't work, you could fake an "in-source" build by appending
"#:out-of-source? #f" to args.

Cheers
P
P
Philip McGrath wrote on 9 May 2022 08:02
[PATCH v3 0/9] gnu: Update Racket to 8.5 and Chez Scheme to 9.5.8.
(address . 55248@debbugs.gnu.org)
cover.1652075689.git.philip@philipmcgrath.com
Hi,

On 5/8/22 23:54, Liliana Marie Prikler wrote:
Toggle quote (34 lines)
> Hi Philip,
>
> Correct me if I'm wrong, but I think you didn't quite get the point I
> raised w.r.t. install-license-files. Instead of
>
> Am Sonntag, dem 08.05.2022 um 16:07 -0400 schrieb Philip McGrath:
>> + (add-after 'chdir 'symlink-license-src
>> + ;; Work around limitation of install-license-files by
>> symlinking
>> + ;; srcdir where it expects. (It doesn't handle this
>> variant of
>> + ;; #:out-of-source? and a subdirectory for srcdir.)
>> Just running
>> + ;; `make install` only puts them in Racket's 'share-
>> dir'.
>> + (lambda* (#:key out-of-source? #:allow-other-keys)
>> + (when out-of-source?
>> + (with-directory-excursion ".."
>> + (symlink "src"
>> + (package-name->name+version
>> + (strip-store-file-name
>> #$output))))))))))
> you could
>
> (replace 'install-license-files
> (lambda args
> (with-directory-excursion ".." ; perhaps "../src" if needed
> (apply (assoc-ref %standard-phases 'install-license-files)
> args))))
>
> If that doesn't work, you could fake an "in-source" build by appending
> "#:out-of-source? #f" to args.
>

Yes, a variant of that works. I can't say I see the benefit, personally,
but here's a v3 if you prefer it.

-Philip

Philip McGrath (9):
gnu: racket: Update to 8.5.
gnu: racket: Fix out-of-source build.
gnu: chez-scheme: Update to 9.5.8.
gnu: chez-scheme: Refactor documentation phases.
gnu: chez-scheme: Refactor configure phase and fix '--threads'.
gnu: stex: Get machine type dynamically.
gnu: chez-upstream-features-for-system: Improve implementation.
gnu: chez-scheme-for-racket: Fix supported systems.
gnu: chez-scheme-for-system: Adjust for bytecode backend.

gnu/local.mk | 2 -
gnu/packages/chez.scm | 426 +++++++++-------
.../racket-enable-scheme-backport.patch | 465 ------------------
...acket-gui-tethered-launcher-backport.patch | 26 -
gnu/packages/racket.scm | 107 ++--
5 files changed, 302 insertions(+), 724 deletions(-)
delete mode 100644 gnu/packages/patches/racket-enable-scheme-backport.patch
delete mode 100644 gnu/packages/patches/racket-gui-tethered-launcher-backport.patch


base-commit: 668313e07fa2518fe02704b047237c173f63c6d4
--
2.32.0
P
P
Philip McGrath wrote on 9 May 2022 08:02
[PATCH v3 1/9] gnu: racket: Update to 8.5.
(address . 55248@debbugs.gnu.org)
0274097e2e661519d5a5bf2b0ae2a8c3735af3c7.1652075689.git.philip@philipmcgrath.com
* gnu/packages/patches/racket-gui-tethered-launcher-backport.patch,
gnu/packages/patches/racket-enable-scheme-backport.patch: Delete files.
* gnu/local.mk (dist_patch_DATA): Remove them.
* gnu/packages/chez.scm (chez-scheme-for-racket): Update to 9.5.7.6.
* gnu/packages/racket.scm (%racket-version): Update to 8.5.
(%racket-origin)[patches]: Remove obsolete patches.
(racket-vm-common-configure-flags): Correct comment.
(racket)[inputs]<2d, datalog, deinprogramm, draw, drracket, expeditor, htdp,
pict, plot, quickscript, racklog, rackunit, redex, scribble, typed-racket,
string-constants, syntax-color, web-server, xrepl>: Update checksums.
<gui, srfi>: Likewise, and remove obsolete backports.
---
gnu/local.mk | 2 -
gnu/packages/chez.scm | 4 +-
.../racket-enable-scheme-backport.patch | 465 ------------------
...acket-gui-tethered-launcher-backport.patch | 26 -
gnu/packages/racket.scm | 82 ++-
5 files changed, 32 insertions(+), 547 deletions(-)
delete mode 100644 gnu/packages/patches/racket-enable-scheme-backport.patch
delete mode 100644 gnu/packages/patches/racket-gui-tethered-launcher-backport.patch

Toggle diff (195 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index bc9f976a39..d593aecfc2 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1757,8 +1757,6 @@ dist_patch_DATA = \
%D%/packages/patches/ripperx-missing-file.patch \
%D%/packages/patches/rpcbind-CVE-2017-8779.patch \
%D%/packages/patches/rtags-separate-rct.patch \
- %D%/packages/patches/racket-enable-scheme-backport.patch \
- %D%/packages/patches/racket-gui-tethered-launcher-backport.patch \
%D%/packages/patches/racket-minimal-sh-via-rktio.patch \
%D%/packages/patches/remake-impure-dirs.patch \
%D%/packages/patches/restic-0.9.6-fix-tests-for-go1.15.patch \
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index d47225dbe5..a7f75a731a 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -4,7 +4,7 @@
;;; Copyright © 2017, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2019 Brett Gilio <brettg@gnu.org>
;;; Copyright © 2020 Brendan Tildesley <mail@brendan.scot>
-;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
+;;; Copyright © 2021, 2022 Philip McGrath <philip@philipmcgrath.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -361,7 +361,7 @@ (define-public chez-scheme-for-racket
(package
(inherit chez-scheme)
(name "chez-scheme-for-racket")
- (version "9.5.7.3")
+ (version "9.5.7.6")
;; The version should match `(scheme-fork-version-number)`.
;; See racket/src/ChezScheme/s/cmacros.ss c. line 360.
;; It will always be different than the upstream version!
diff --git a/gnu/packages/patches/racket-enable-scheme-backport.patch b/gnu/packages/patches/racket-enable-scheme-backport.patch
deleted file mode 100644
index 3a5a4a3d82..0000000000
--- a/gnu/packages/patches/racket-enable-scheme-backport.patch
+++ /dev/null
@@ -1,465 +0,0 @@
-From 8d7687842f099e3e7e60d3a83fed58b2c6a92863 Mon Sep 17 00:00:00 2001
-From: Matthew Flatt <mflatt@racket-lang.org>
-Date: Sun, 6 Feb 2022 10:36:09 -0700
-Subject: [PATCH 1/2] Chez Scheme: adapt bootfile build for supplied `Scheme=`
-
-(cherry picked from commit fca1e02349664060e10278ca2ce6577a949bebf5)
-
-(Fixed conflicts by dropping pbchunks and pbarch changes.)
----
- racket/src/ChezScheme/configure | 15 ++++++++++++++-
- racket/src/ChezScheme/s/Mf-base | 4 ++--
- racket/src/ChezScheme/s/Mf-cross | 4 +++-
- 3 files changed, 19 insertions(+), 4 deletions(-)
-
-diff --git a/racket/src/ChezScheme/configure b/racket/src/ChezScheme/configure
-index 4515ffc105..0098829091 100755
---- a/racket/src/ChezScheme/configure
-+++ b/racket/src/ChezScheme/configure
-@@ -45,6 +45,7 @@ threads=yes
- nothreads=no
- temproot=""
- help=no
-+forceworkarea=no
- gzipmanpages=yes
- installowner=""
- installgroup=""
-@@ -205,6 +206,9 @@ while [ $# != 0 ] ; do
- --pb)
- pb=yes
- ;;
-+ --force)
-+ forceworkarea=yes
-+ ;;
- --installprefix=*)
- installprefix=`echo $1 | sed -e 's/^--installprefix=//'`
- ;;
-@@ -439,6 +443,7 @@ if [ "$help" = "yes" ]; then
- echo " --toolprefix=<prefix> prefix tool (compiler, linker, ...) names"
- echo " --[no]gzip-man-pages compress manual pages ($gzipmanpages)"
- echo " --workarea=<pathname> build directory ($w)"
-+ echo " --force configure even without boot files"
- echo " CC=<C compiler> C compiler"
- echo " CPPFLAGS=<C preprocessor flags> C preprocessor flags"
- echo " CFLAGS=<C compiler flags> C compiler flags"
-@@ -721,8 +726,16 @@ case "${flagsmuni}" in
- ;;
- esac
-
-+if [ "$w" = "$m" ] ; then
-+ configuringin=""
-+else
-+ configuringin=" in $w"
-+fi
-+
- if [ -f boot/$m/scheme.boot -o -f "$srcdir"/boot/$m/scheme.boot ] ; then
-- echo "Configuring for $m"
-+ echo "Configuring for $m$configuringin"
-+elif [ "$forceworkarea" = yes ] ; then
-+ echo "Configuring for $m$configuringin despite missing boot files"
- else
- if [ "$m" = "" ] ; then
- maybem="<machine type>"
-diff --git a/racket/src/ChezScheme/s/Mf-base b/racket/src/ChezScheme/s/Mf-base
-index cc6178c973..1f4a967998 100644
---- a/racket/src/ChezScheme/s/Mf-base
-+++ b/racket/src/ChezScheme/s/Mf-base
-@@ -94,7 +94,7 @@ endif
- # that Scheme and SCHEMEHEAPDIRS are set by Mf-cross to point to the host Scheme
- # implementation
- Scheme = ../bin/$m/scheme${ExeSuffix}
--export SCHEMEHEAPDIRS=../boot/%m
-+export SCHEMEHEAPDIRS=../boot/$m
- export CHEZSCHEMELIBDIRS=.
-
- # Define the libdirs separator character
-@@ -691,4 +691,4 @@ reset-one:
-
- .PHONY: run
- run:
-- env SCHEMEHEAPDIRS=../boot/$m/ ../bin/$m/scheme $(ARGS)
-+ env SCHEMEHEAPDIRS=${SCHEMEHEAPDIRS} ${Scheme} $(ARGS)
-diff --git a/racket/src/ChezScheme/s/Mf-cross b/racket/src/ChezScheme/s/Mf-cross
-index d796cbb459..397af59a28 100644
---- a/racket/src/ChezScheme/s/Mf-cross
-+++ b/racket/src/ChezScheme/s/Mf-cross
-@@ -43,5 +43,7 @@ x$(xm).$(m):
- $(MAKE) -f Mf-cross m=$(m) xm=$(xm) i=f o=3 d=0 xpatch
- mv xpatch x$(xm).$(m)
-
-+ifneq ($(SCHEMEHEAPDIRS),:)
- # Ensure that cross-compiling "nanopass.so" is rebuilt if the host compiler changed
--nanopass.so: ${SCHEME} ${SCHEMEHEAPDIRS}/petite.boot ${SCHEMEHEAPDIRS}/scheme.boot
-+nanopass.so: ${Scheme} ${SCHEMEHEAPDIRS}/petite.boot ${SCHEMEHEAPDIRS}/scheme.boot
-+endif
---
-2.32.0
-
-
-From 26c8e2c1d9b02ad85acef8bda40d92154cf0b699 Mon Sep 17 00:00:00 2001
-From: Matthew Flatt <mflatt@racket-lang.org>
-Date: Sun, 6 Feb 2022 11:03:30 -0700
-Subject: [PATCH 2/2] configure: make `--enable-scheme` work with an executable
-
-When the same Chez Scheme version as used by Racket is already
-available, then `--enable-scheme=...` can supply an executable. For
-cross builds, `--enable-scheme=...` can still supply a build
-directory, instead, as before.
-
-(cherry picked from commit 4f0e76855ce7e86107de495292a553469daf0b3f)
----
- racket/src/ChezScheme/makefiles/Makefile.in | 3 ++
- racket/src/README.txt | 30 +++++++++++---
- racket/src/configure | 8 +++-
- racket/src/cs/README.txt | 6 ++-
- racket/src/cs/c/Makefile.in | 44 ++++++++++++++++-----
- racket/src/cs/c/configure | 24 +++++++++--
- racket/src/cs/c/configure.ac | 21 ++++++++--
- 7 files changed, 112 insertions(+), 24 deletions(-)
-
-diff --git a/racket/src/ChezScheme/makefiles/Makefile.in b/racket/src/ChezScheme/makefiles/Makefile.in
-index c396efc851..3998ef9ccd 100644
---- a/racket/src/ChezScheme/makefiles/Makefile.in
-+++ b/racket/src/ChezScheme/makefiles/Makefile.in
-@@ -59,6 +59,9 @@ reset:
- %.boot:
- (cd $(workarea) && $(MAKE) $*.boot)
-
-+auto.boot:
-+ (cd $(workarea) && $(MAKE) $(defaultm).boot)
-+
- # <machine>.bootquick to build boot files for <machine>
- # with o=3 d=0 for the cross compiler, and only after
- # building the kernel for the configured machine
-diff --git a/racket/src/README.txt b/racket/src/README.txt
-index 98647aebce..d77310b4a4 100644
---- a/racket/src/README.txt
-+++ b/racket/src/README.txt
-@@ -354,6 +354,10 @@ variant of MinGW without "libdelayimp.a", get the implementation of
- ========================================================================
-
- Cross-compilation requires at least two flags to `configure`:
-+`--host=OS` and either `--enable-racket=RACKET` or (for Racket CS)
-+`--enable-scheme-SCHEME`.
-+
-+More information:
-
- * `--host=OS`, where OS is something like `i386-gnu-linux` to
- indicate the target platform.
-@@ -374,11 +378,27 @@ Cross-compilation requires at least two flags to `configure`:
- run `configure` again (with no arguments) in a "local" subdirectory
- to create a build for the current platform.
-
--An additional flag is needed for building Racket CS, unless the flag
--`--enable-racket=auto` is used:
--
-- * `--enable-scheme=DIR`, where DIR is a path that has a "ChezScheme"
-- directory where Chez Scheme is built for the host system.
-+ * `--enable-scheme=SCHEME`, where SCHEME is a Chez Scheme executable
-+ executable that runs on the build platform; the executable must be
-+ the same version as used in Racket built for the target platform.
-+
-+ Supplying `--enable-scheme=DIR` is also supported in cross-build
-+ mode, where DIR is a path that has a "ChezScheme" directory where
-+ Chez Scheme is built for the host system.
-+
-+The `--enable-racket=RACKET` and `--enable-scheme=SCHEME` flags are
-+allowed for non-cross builds, too:
-+
-+ * For Racket CS, supplying either selects a Racket or Chez Scheme
-+ implementation used to create boot files to the build platform.
-+ Suppling Chez Scheme is a much more direct path, but when Racket is
-+ supplied, its version does not have to match the version being
-+ built.
-+
-+ * For Racket BC, `--enable-racket=RACKET` selects a Racket for
-+ prepare C sources to cooperate with garbage collection. Its version
-+ needs to be close to the one being built, and potentially exactly
-+ the same version.
-
- Some less commonly needed `configure` flags are for Racket BC:
-
-diff --git a/racket/src/configure b/racket/src/configure
-index c9f3ba4419..1b53ec7ce2 100755
---- a/racket/src/configure
-+++ b/racket/src/configure
-@@ -9,6 +9,7 @@ pb_dir="$dir/ChezScheme/boot/pb"
- use_cs=maybe
- use_bc=maybe
- supplied_racket=no
-+supplied_scheme=no
- enable_boothelp=
-
- # We don't have to detect conflicts like `--enable-csdefault --enable-bcdefault`,
-@@ -34,6 +35,9 @@ for arg in $*; do
- --enable-racket=*)
- supplied_racket=yes
- ;;
-+ --enable-scheme=*)
-+ supplied_scheme=yes
-+ ;;
- --help | -h)
- echo $0:
- echo see --help-bc or --help-cs, since the Racket CS build and the
-@@ -70,8 +74,8 @@ elif test "$use_cs" = "maybe" ; then
- fi
-
- if test "$use_cs" = "yes" ; then
-- if test $use_bc = no -a $supplied_racket = no -a ! -d "$pb_dir" ; then
-- echo $0: must have $pb_dir or --enable-racket=... for --enable-csonly
-+ if test $use_bc = no -a $supplied_racket = no -a $supplied_scheme = no -a ! -d "$pb_dir" ; then
-+ echo $0: must have $pb_dir, --enable-racket=... or --enable-scheme=... for --enable-csonly
- exit 1
- fi
-
-diff --git a/racket/src/cs/README.txt b/racket/src/cs/README.txt
-index 2ece417b78..8e6fc57b74 100644
---- a/racket/src/cs/README.txt
-+++ b/racket/src/cs/README.txt
-@@ -39,6 +39,11 @@ build:
- installed in the "../ChezScheme/boot/pb" directory as described by
- "../ChezScheme/BUILDING".
-
-+ Supplying `--enable-scheme=...` is also an option if you alerady
-+ have the same version of Chez Scheme built on the current platform.
-+ Another build will be created, anyway, but more quickly than
-+ without Chez Scheme.
-+
- * Racket is needed to generate the files in the "schemified"
- directory from the sources in sibling directories like "../io". The
- Racket version must be practically the same as the current Racket
-@@ -48,7 +53,6 @@ build:
- Unlike Chez Scheme boot files, the files generated in "schemified"
- are human-readable and -editable Scheme code. That provides a way
- out of bootstrapping black holes, even without BC.
--
-
-
- ========================================================================
-diff --git a/racket/src/cs/c/Makefile.in b/racket/src/cs/c/Makefile.in
-index 54a644a1d9..d73993f0fc 100644
---- a/racket/src/cs/c/Makefile.in
-+++ b/racket/src/cs/c/Makefile.in
-@@ -12,7 +12,9 @@ CS_HOST_WORKAREA_PREFIX = @CS_HOST_WORKAREA_PREFIX@
- SCHEME_HOST_WORKAREA = $(CS_HOST_WORKAREA_PREFIX)$(SCHEME_WORKAREA)
- SCHEME_BIN = $(SCHEME_HOST_WORKAREA)/$(MACH)/bin/$(MACH)/scheme
- SCHEME_INC = $(SCHEME_HOST_WORKAREA)/$(MACH)/boot/$(MACH)
--SCHEME = $(SCHEME_BIN) -B $(SCHEME_INC)/petite.boot -B $(SCHEME_INC)/scheme.boot
-+SCHEME_built = $(SCHEME_BIN) -B $(SCHEME_INC)/petite.boot -B $(SCHEME_INC)/scheme.boot
-+SCHEME_existing = @MAKE_SCHEME_SCHEME@
-+SCHEME = $(SCHEME@USE_SCHEME_MODE@)
-
- TARGET_MACH = @TARGET_MACH@
- SCHEME_TARGET_INC = $(SCHEME_WORKAREA)/$(TARGET_MACH)/boot/$(TARGET_MACH)
-@@ -88,7 +90,7 @@ mainsrcdir = @srcdir@/../..
- @INCLUDEDEP@ @srcdir@/../../version/version.mak
-
- cs:
-- $(MAKE) scheme@T_CROSS_MODE@
-+ $(MAKE) scheme@MAKE_SCHEME_MODE@
- $(MAKE) racket-so
- cd rktio; $(MAKE)
- $(MAKE) racketcs
-@@ -121,9 +123,13 @@ racket-so:
-
- RACKET_SO_ENV = @CONFIGURE_RACKET_SO_COMPILE@
-
-+TARGET_MACH_built = $(TARGET_MACH)
-+TARGET_MACH_existing = xc-$(TARGET_MACH)
-+XPATCH_FILE = $(SCHEME_WORKAREA)/$(TARGET_MACH@USE_SCHEME_MODE@)/s/xpatch
-+
- CS_PROGS = SCHEME="$(SCHEME)"
- CS_OPTS = COMPRESS_COMP=@COMPRESS_COMP@ @ENABLE_OR_DISABLE_WPO@
--CS_OPTScross = $(CS_OPTS) CSO=$(MACH) CROSS_COMP="--xpatch $(SCHEME_WORKAREA)/$(TARGET_MACH)/s/xpatch"
-+CS_OPTScross = $(CS_OPTS) CSO=$(MACH) CROSS_COMP="--xpatch $(XPATCH_FILE)"
- PASS_COMPILE_DEPS = EXTRA_COMPILE_DEPS="$(SCHEME_INC)/petite.boot $(SCHEME_INC)/scheme.boot"
-
- build-racket-so:
-@@ -163,6 +169,15 @@ pb-bootquick:
- cd $(SCHEME_WORKAREA) && $(MAKE) reset
- $(SHELL) $(srcdir)/ready_boot.sh $(MACH) $(SCHEME_WORKAREA)
-
-+scheme-via-scheme:
-+ $(MAKE) $(SCHEME_WORKAREA)/boot/$(MACH)/scheme.boot
-+ $(MAKE) mach-make
-+
-+$(SCHEME_WORKAREA)/boot/$(MACH)/scheme.boot:
-+ mkdir -p $(SCHEME_WORKAREA)
-+ $(MAKE) config-scheme CONFIG_SCHEME_MODE="$(CONFIG_SCHEME_MODE) --force"
-+ cd $(SCHEME_WORKAREA) && $(MAKE) $(MACH).boot Scheme="$(SCHEME)" SCHEMEHEAPDIRS=: o=3 d=0 what=all
-+
- mach-make:
- $(MAKE) config-scheme
- cd $(SCHEME_WORKAREA) && $(MAKE)
-@@ -182,24 +197,33 @@ config-scheme:
-
- scheme-cross:
- env MAKE_BOOT_FOR_CROSS=yes SCHEME_SRC="$(SCHEME_DIR)" SCHEME_WORKAREA=$(SCHEME_WORKAREA) MACH="$(TARGET_MACH)" $(BOOTSTRAP_RACKET) "$(SCHEME_DIR)"/rktboot/make-boot.rkt
-+ $(MAKE) finish-scheme-cross
-+
-+finish-scheme-cross:
- $(SHELL) $(srcdir)/reset_boot.sh $(TARGET_MACH) $(SCHEME_WORKAREA)
- cd $(SCHEME_WORKAREA) && "$(UP_SCHEME_DIR)"/configure @SCHEME_CROSS_CONFIG_ARGS@ $(SCHEME_CONFIG_VARS)
- cd $(SCHEME_WORKAREA)/$(TARGET_MACH)/c && $(CHOST_HACK@T_CROSS_MODE@) $(MAKE) o=o cross=t
-- $(MAKE) $(SCHEME_WORKAREA)/$(TARGET_MACH)/s/xpatch
-+ $(MAKE) $(XPATCH_FILE)
-+
-+scheme-cross-via-scheme:
-+ $(MAKE) $(SCHEME_WORKAREA)/boot/$(TARGET_MACH)/scheme.boot MACH=$(TARGET_MACH)
-+ $(MAKE) finish-scheme-cross
-
- # Rebuild patch file and cross "petite.boot" and "scheme.boot" when older
--# than the build-host "scheme.boot" or when "make-boot.rkt" touchs dummy boot files
--XPATCH_DEPS = $(SCHEME_HOST_WORKAREA)/$(MACH)/boot/$(MACH)/scheme.boot \
-- $(SCHEME_WORKAREA)/boot/$(TARGET_MACH)/scheme.boot
-+# than the build-<host "scheme.boot" or when "make-boot.rkt" touchs dummy boot files
-+XPATCH_DEPS_built = $(SCHEME_HOST_WORKAREA)/$(MACH)/boot/$(MACH)/scheme.boot \
-+ $(SCHEME_WORKAREA)/boot/$(TARGET_MACH)/scheme.boot
-+XPATCH_DEPS_existing =
-+XPATCH_DEPS = $(XPATCH_DEPS@USE_SCHEME_MODE@)
-
--$(SCHEME_WORKAREA)/$(TARGET_MACH)/s/xpatch: $(XPATCH_DEPS)
-+$(XPATCH_FILE): $(XPATCH_DEPS)
- $(MAKE) bounce TARGET=build-xpatch-using-host
-
- build-xpatch-using-host:
- cd $(SCHEME_WORKAREA)/$(TARGET_MACH)/s && $(MAKE) -f Mf-cross m=$(MACH) xm=$(TARGET_MACH) Scheme="$(SCHEME_BIN)" SCHEMEHEAPDIRS="$(SCHEME_INC)"
-
- XPATCH =
--XPATCHcross = --xpatch $(SCHEME_WORKAREA)/$(TARGET_MACH)/s/xpatch
-+XPATCHcross = --xpatch $(XPATCH_FILE)
-
- racket.boot: racket.so
- $(SCHEME) --script $(srcdir)/convert-to-boot.ss @BOOT_COMPRESS_COMP@ $(XPATCH@CROSS_MODE@) racket.so racket.boot $(TARGET_MACH)
-@@ -410,7 +434,7 @@ install-cross:
- $(MAKE) compile-xpatch.$(TARGET_MACH)
- $(MAKE) library-xpatch.$(TARGET_MACH)
-
--SCHEME_XPATCH = $(SCHEME_WORKAREA)/$(TARGET_MACH)/s/xpatch
-+SCHEME_XPATCH = $(XPATCH_FILE)
-
- CROSS_SERVE_DEPS = $(srcdir)/mk-cross-serve.ss $(srcdir)/cross-serve.ss \
- $(srcdir)/../expander/env.ss $(srcdir)/../linklet/config.ss
-diff --git a/racket/src/cs/c/configure b/racket/src/cs/c/configure
-index 21695a431a..1eeef57753 100755
---- a/racket/src/cs/c/configure
-+++ b/racket/src/cs/c/configure
-@@ -654,6 +654,9 @@ MINGW
- NOT_OSX
- OSX
- SETUP_BOOT_MODE
-+USE_SCHEME_MODE
-+MAKE_SCHEME_SCHEME
-+MAKE_SCHEME_MODE
- TT_CROSS_MODE
- T_CROSS_MODE
- CROSS_MODE
-@@ -1448,7 +1451,7 @@ Optional Features:
- --enable-docs build docs on install (enabled by default)
- --enable-usersetup setup user-specific files on install
- --enable-racket=<path> use <path> as Racket for build; or "auto" to create
-- --enable-scheme=<path> use <path> as host's build directory for cross
-+ --enable-scheme=<path> use <path> as host build for cross
- --enable-mach=<mach> use Chez Scheme machine type <mach>
- --enable-target=<mach> cross-build for Chez Scheme machine type <mach>
- --enable-portable prefer portable to host-specific
-@@ -2867,7 +2870,7 @@ show_explicitly_enabled "${enable_xonx}" "Unix style"
- show_explicitly_enabled "${enable_libzo}" 'Compiled ".zo" files moved to lib'
-
- show_explicitly_set "${enable_racket}" "Racket"
--show_explicitly_set "${enable_scheme}" "Chez Scheme build directory"
-+show_explicitly_set "${enable_scheme}" "Chez Scheme for build"
- show_explicitly_set "${enable_mach}" "machine type"
- show_explicitly_set "${enable_target}" "cross-build machine type"
- show_explicitly_enabled "${enable_portable}" "portable"
-@@ -4745,9 +4748,21 @@ esac
-
- SCHEME_DIR=${srcdir}/../../ChezScheme
- MAKE_BUILD_SCHEME=checkout
-+USE_SCHEME_MODE="_built"
-+MAKE_SCHEME_MODE="${T_CROSS_MODE}"
-
- if test "${enable_scheme}" != "" ; then
-- CS_HOST_WORKAREA_PREFIX="${enable_scheme}/"
-+ if test -d "${enable_scheme}" ; then
-+ # Directory exists, so use it as a build directory
-+ echo "Using supplied Scheme path as a build directory"
-+ CS_HOST_WORKAREA_PREFIX="${enable_scheme}/"
-+ else
-+ # Directory does not exist, so assume it's an executable
-+ echo "Using supplied Scheme path as an executable"
-+ MAKE_SCHEME_MODE="${T_CROSS_MODE}-via-scheme"
-+ MAKE_SCHEME_SCHEME="${enable_scheme}"
-+ USE_SCHEME_MODE="_existing"
-+ fi
- fi
-
- if test "${enable_racket}" != "" ; then
-@@ -6012,6 +6027,9 @@ SCHEME_CROSS_CONFIG_ARGS="--machine=${TARGET_MACH} --disable-x11 ${cs_auto_flags
-
-
-
-+
-+
-+
-
-
-
-diff --git a/racket/src/cs/c/configure.ac b/racket/src/cs/c/configure.ac
-index 464ebe1760..aaee88156d 100644
---- a/racket/src/cs/c/configure.ac
-+++ b/racket/src/cs/c/configure.ac
-@@ -23,7 +23,7 @@ AC_ARG_ENABLE(compressmore, [ --enable-compressmore compress compiled code ev
- AC_ARG_ENABLE(compressboot, [ --enable-compressboot compress boot files])
- m4_include(../ac/path_arg.m4)
- AC_ARG_ENABLE(racket, [ --enab
This message was truncated. Download the full message here.
P
P
Philip McGrath wrote on 9 May 2022 08:02
[PATCH v3 2/9] gnu: racket: Fix out-of-source build.
(address . 55248@debbugs.gnu.org)
a527742b7e3478147f9d3b27e7b815acad4dda91.1652075689.git.philip@philipmcgrath.com
* gnu/packages/racket.scm (racket-vm-cgc)[arguments]: Supply
'#:out-of-source? #t'. Wrap 'install-license-files' to work around
limitation.
---
gnu/packages/racket.scm | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)

Toggle diff (38 lines)
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index 7d51707156..8438945ba0 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -276,8 +276,9 @@ (define-public racket-vm-cgc
;; main-distribution-test that aren't part of the main
;; distribution.
#:tests? #f
- ;; Upstream recommends #:out-of-source?, and it does
- ;; help with debugging, but it confuses `install-license-files`.
+ ;; Upstream recommends #:out-of-source?, and it
+ ;; helps a lot with debugging.
+ #:out-of-source? #t
#:modules '((ice-9 match)
(ice-9 regex)
(guix build gnu-build-system)
@@ -314,7 +315,18 @@ (define-public racket-vm-cgc
#f)))))))
(add-before 'configure 'chdir
(lambda _
- (chdir "racket/src"))))))
+ (chdir "racket/src")))
+ (replace 'install-license-files
+ ;; The #:out-of-source? mode for install-license-files fails
+ ;; to find the srcdir: as a workaround, navigate there ourselves.
+ (let ((install-license-files
+ (assoc-ref %standard-phases 'install-license-files)))
+ (lambda args
+ (with-directory-excursion "../src"
+ (apply install-license-files
+ `(,@args
+ ;; if there are duplicate keywords, last is used
+ #:out-of-source? #f)))))))))
(home-page "https://racket-lang.org")
(synopsis "Old Racket implementation used for bootstrapping")
(description "This variant of the Racket BC (``before Chez'' or
--
2.32.0
P
P
Philip McGrath wrote on 9 May 2022 08:02
[PATCH v3 3/9] gnu: chez-scheme: Update to 9.5.8.
(address . 55248@debbugs.gnu.org)
7ad44a355df0dbfb80ba30d74f16cb1ad48d19e8.1652075689.git.philip@philipmcgrath.com
* gnu/packages/chez.scm (chez-scheme): Update to 9.5.8.
---
gnu/packages/chez.scm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Toggle diff (24 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index a7f75a731a..34545b1f58 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -210,7 +210,7 @@ (define-public chez-scheme
(name "chez-scheme")
;; The version should match `(scheme-version-number)`.
;; See s/cmacros.ss c. line 360.
- (version "9.5.6")
+ (version "9.5.8")
(source (origin
(method git-fetch)
(uri (git-reference
@@ -218,7 +218,7 @@ (define-public chez-scheme
(commit (string-append "v" version))))
(sha256
(base32
- "07s433hn1z2slfc026sidrpzxv3a8narcd40qqr1xrpb9012xdky"))
+ "0xchqq8cm0ka5wgpn18sjs0hh15rc3nb7xrjqbbc9al3asq0d7gc"))
(file-name (git-file-name name version))
(snippet #~(begin
(use-modules (guix build utils))
--
2.32.0
P
P
Philip McGrath wrote on 9 May 2022 08:02
[PATCH v3 4/9] gnu: chez-scheme: Refactor documentation phases.
(address . 55248@debbugs.gnu.org)
5fff69c601fd95ba51b3d6635dfa5865fdc714a4.1652075689.git.philip@philipmcgrath.com
Patches merged in both upstream Chez Scheme and Racket's variant will
soon let us replace the 'install-docs' phase with just
'make install-docs'. Separating the 'link-doc-pdfs' phase (which won't
change) leaves us well-prepared for the transition, regardless of
whether Chez Scheme 9.5.10 or Racket 8.6 is released first.

* gnu/packages/chez.scm (chez-scheme)[arguments]: Split 'install-doc'
phase into 'install-docs' (matching the future 'make' target) and
'link-doc-pdfs'.
---
gnu/packages/chez.scm | 64 ++++++++++++++++++++++++-------------------
1 file changed, 36 insertions(+), 28 deletions(-)

Toggle diff (78 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 34545b1f58..49051abd17 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -309,35 +309,43 @@ (define-public chez-scheme
(string-append (dirname scheme.boot)
"/chez-scheme.boot")))))))
;; Building the documentation requires stex and a running scheme.
- ;; FIXME: this is probably wrong for cross-compilation
- (add-after 'install-symlink 'install-doc
+ (add-after 'install-symlink 'install-docs
(lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
- (match (assoc-ref outputs "doc")
- (#f
- (format #t "not installing docs~%"))
- (doc-prefix
- (let* ((chez+version (strip-store-file-name #$output))
- (scheme (search-input-file outputs "/bin/scheme"))
- (stexlib (search-input-directory (or native-inputs
- inputs)
- "/lib/stex"))
- (doc-dir (string-append doc-prefix
- "/share/doc/"
- chez+version)))
- (define* (stex-make #:optional (suffix ""))
- (invoke "make" "install"
- (string-append "Scheme=" scheme)
- (string-append "STEXLIB=" stexlib)
- (string-append "installdir=" doc-dir suffix)))
- (with-directory-excursion "csug"
- (stex-make "/csug"))
- (with-directory-excursion "release_notes"
- (stex-make "/release_notes"))
- (with-directory-excursion doc-dir
- (symlink "release_notes/release_notes.pdf"
- "release_notes.pdf")
- (symlink "csug/csug9_5.pdf"
- "csug.pdf"))))))))))
+ (let* ((doc-prefix (or (assoc-ref outputs "doc")
+ (assoc-ref outputs "out")))
+ (chez+version (strip-store-file-name #$output))
+ (scheme (search-input-file outputs "/bin/scheme"))
+ (stexlib (search-input-directory (or native-inputs
+ inputs)
+ "/lib/stex"))
+ (doc-dir (string-append doc-prefix
+ "/share/doc/"
+ chez+version)))
+ (define* (stex-make #:optional (suffix ""))
+ (invoke "make" "install"
+ (string-append "Scheme=" scheme)
+ (string-append "STEXLIB=" stexlib)
+ (string-append "installdir=" doc-dir suffix)))
+ (with-directory-excursion "csug"
+ (stex-make "/csug"))
+ (with-directory-excursion "release_notes"
+ (stex-make "/release_notes")))))
+ (add-after 'install-docs 'link-doc-pdfs
+ ;; otherwise, it's hard to notice them in a forest of HTML files
+ (lambda* (#:key outputs #:allow-other-keys)
+ (with-directory-excursion
+ (string-append (or (assoc-ref outputs "doc")
+ (assoc-ref outputs "out"))
+ "/share/doc/"
+ (strip-store-file-name #$output))
+ (symlink "release_notes/release_notes.pdf"
+ "release_notes.pdf")
+ (match (find-files "csug"
+ "csug.*\\.pdf$" ;; embeded version number
+ #:fail-on-error? #t)
+ ((pth)
+ (symlink pth
+ "csug.pdf")))))))))
;; Chez Scheme does not have a MIPS backend.
;; FIXME: Debian backports patches to get armhf working.
;; We should too. It is the Chez machine type arm32le
--
2.32.0
P
P
Philip McGrath wrote on 9 May 2022 08:02
[PATCH v3 5/9] gnu: chez-scheme: Refactor configure phase and fix '--threads'.
(address . 55248@debbugs.gnu.org)
b10691b24d75f29ed583353cdc9b38cc0c8432c4.1652075689.git.philip@philipmcgrath.com
Move Chez-specific logic into '#:configure-flags' and a new
'configure-environment-variables' phase, leaving the 'configure' phase
as just a variant of the one from 'gnu-build-system' (including support
for '#:out-of-source?') that doesn't add implicit Autoconf-style flags.

In the process, do the right thing for "--threads", rather than assuming
the only nonthreaded platform is broken.

* gnu/packages/chez.scm (chez-scheme)[arguments]: Set configure flags in
'#:configure-flags' and separate 'configure-environment-variables' from
the residual 'configure' phase. More closely follow 'gnu-build-system'.
Use 'chez-upstream-features-for-system' for "--threads".
(chez-scheme-for-racket)[arguments]<#:configure-flags>: Add "--threads"
unconditionally.
---
gnu/packages/chez.scm | 63 ++++++++++++++++++++++++++++---------------
1 file changed, 42 insertions(+), 21 deletions(-)

Toggle diff (92 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 49051abd17..785b6837c1 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -258,8 +258,18 @@ (define-public chez-scheme
(ice-9 ftw)
(ice-9 match))
#:test-target "test"
- ;; TODO when we fix armhf, it may not support --threads
- #:configure-flags #~'("--threads")
+ #:configure-flags
+ #~`(,(string-append "--installprefix=" #$output)
+ #$@(if (and=> (chez-upstream-features-for-system)
+ (cut memq 'threads <>))
+ #~("--threads")
+ #~())
+ "ZLIB=-lz"
+ "LZ4=-llz4"
+ "--libkernel"
+ ;; Guix will do 'compress-man-pages',
+ ;; and letting Chez try causes an error
+ "--nogzip-man-pages")
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'unpack-nanopass+stex
@@ -273,26 +283,35 @@ (define-public chez-scheme
(search-input-directory (or native-inputs inputs)
"lib/chez-scheme-bootfiles")
"boot")))
- ;; NOTE: the custom Chez 'configure' script doesn't allow
+ ;; NOTE: The custom Chez 'configure' script doesn't allow
;; unrecognized flags, such as those automatically added
- ;; by `gnu-build-system`.
+ ;; by `gnu-build-system`. This replacement phase uses only
+ ;; the explicitly provided `#:configure-flags`.
(replace 'configure
- (lambda* (#:key inputs (configure-flags '()) #:allow-other-keys)
- ;; add flags which are always required:
- (let ((flags (cons* (string-append "--installprefix=" #$output)
- "ZLIB=-lz"
- "LZ4=-llz4"
- "--libkernel"
- ;; Guix will do compress-man-pages,
- ;; and letting Chez try causes an error
- "--nogzip-man-pages"
- configure-flags)))
- (format #t "configure flags: ~s~%" flags)
- ;; Some makefiles (for tests) don't seem to propagate CC
- ;; properly, so we take it out of their hands:
- (setenv "CC" #$(cc-for-target))
- (setenv "HOME" "/tmp")
- (apply invoke "./configure" flags))))
+ (lambda* (#:key inputs (configure-flags '()) out-of-source?
+ #:allow-other-keys)
+ (let* ((abs-srcdir (getcwd))
+ (srcdir (if out-of-source?
+ (string-append "../" (basename abs-srcdir))
+ ".")))
+ (format #t "source directory: ~s (relative from build: ~s)~%"
+ abs-srcdir srcdir)
+ (if out-of-source?
+ (begin
+ (mkdir "../build")
+ (chdir "../build")))
+ (format #t "build directory: ~s~%" (getcwd))
+ (format #t "configure flags: ~s~%" configure-flags)
+ (apply invoke
+ (string-append srcdir "/configure")
+ configure-flags))))
+ (add-after 'configure 'configure-environment-variables
+ (lambda args
+ ;; Some makefiles (for tests) don't seem to propagate CC
+ ;; properly, so we take it out of their hands:
+ (setenv "CC" #$(cc-for-target))
+ ;; Likewise, some tests have needed HOME to be set:
+ (setenv "HOME" "/tmp")))
;; The binary file name is called "scheme" as is the one from
;; MIT/GNU Scheme. We add a symlink to use in case both are
;; installed.
@@ -385,7 +404,9 @@ (define-public chez-scheme-for-racket
(arguments
(substitute-keyword-arguments (package-arguments chez-scheme)
((#:configure-flags cfg-flags #~'())
- #~(cons "--disable-x11" #$cfg-flags))
+ #~(cons* "--disable-x11"
+ "--threads" ;; ok to potentially duplicate
+ #$cfg-flags))
((#:phases those-phases #~%standard-phases)
#~(let* ((those-phases #$those-phases)
(unpack (assoc-ref those-phases 'unpack)))
--
2.32.0
P
P
Philip McGrath wrote on 9 May 2022 08:02
[PATCH v3 6/9] gnu: stex: Get machine type dynamically.
(address . 55248@debbugs.gnu.org)
6521decd69c70fe38b056c2dbec10d1a1af0e570.1652075689.git.philip@philipmcgrath.com
* gnu/packages/chez.scm (stex)[arguments]: Run 'scheme' to determine
the machine type.
---
gnu/packages/chez.scm | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)

Toggle diff (34 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 785b6837c1..dd485d37e1 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -602,6 +602,10 @@ (define-public stex-bootstrap
("src" "lib/stex/")
("Mf-stex" "lib/stex/")
("Makefile.template" "lib/stex/"))
+ #:modules
+ '((guix build copy-build-system)
+ (guix build utils)
+ (ice-9 popen))
#:phases
#~(modify-phases %standard-phases
(add-before 'install 'patch-sources
@@ -633,8 +637,14 @@ (define-public stex-bootstrap
(define makefile
(string-append (getcwd) "/Makefile"))
(define machine
- #$(and=> (nix-system->chez-machine)
- chez-machine->threaded))
+ (let ((pipe (open-pipe* OPEN_BOTH scheme "-q")))
+ ;; try to not be wrong for cross-compilation
+ ;; (avoid #% reader abbreviation for Guile)
+ (write '(($primitive $target-machine)) pipe)
+ (force-output pipe)
+ (let ((sym (read pipe)))
+ (close-pipe pipe)
+ (symbol->string sym))))
(with-directory-excursion
(search-input-directory outputs "/lib/stex")
(invoke "make"
--
2.32.0
P
P
Philip McGrath wrote on 9 May 2022 08:02
[PATCH v3 8/9] gnu: chez-scheme-for-racket: Fix supported systems.
(address . 55248@debbugs.gnu.org)
1328772b3ccb2d3909f8bca6fe14659e04434e3e.1652075689.git.philip@philipmcgrath.com
This commit fixes the treatment of systems like "powerpc-w64-mingw32",
where the combination of architecture and kernel is not supported, even
though both are supported in other combinations. The build failure fixed
in b8fc9169515ef1a6d6037c84e30ad308e5418b6f highlighted this problem:
see also https://issues.guix.gnu.org/54292#6. The correct support
status is specified by '%chez-features-table', which was added to
improve 'chez-upstream-features-for-system': this commit uses it to fix
the repair.

Once the issues in https://racket.discourse.group/t/950 are resolved,
'chez-scheme-for-racket' and 'racket-vm-cs' will be able to run even on
systems for which native code generation is not supported. It's not
clear what behavior would be useful from 'nix-system->chez-machine':
since the current implementation is flawed and easy to misuse, we remove
it for now, replacing the remaining uses with
'racket-cs-native-supported-system?'.

* gnu/packages/chez.scm (nix-system->chez-machine): Remove it.
(racket-cs-native-supported-system?): New variable.
(chez-scheme-for-racket)[supported-systems]: Use it.
* gnu/packages/racket.scm (racket-vm-for-system): Likewise.
---
gnu/packages/chez.scm | 32 +++++++++++++++++---------------
gnu/packages/racket.scm | 7 +++++--
2 files changed, 22 insertions(+), 17 deletions(-)

Toggle diff (84 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 41f083e0ac..cae17580f8 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -48,7 +48,7 @@ (define-module (gnu packages chez)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:export (chez-scheme-for-system
- nix-system->chez-machine
+ racket-cs-native-supported-system?
unpack-nanopass+stex))
;; Commentary:
@@ -132,19 +132,6 @@ (define* (target-chez-os #:optional (system (or (%current-target-system)
(else
#f)))
-(define* (nix-system->chez-machine #:optional
- (system (or (%current-target-system)
- (%current-system))))
- "Return the Chez Scheme machine type corresponding to the Nix system
-identifier SYSTEM, or @code{#f} if the translation of SYSTEM to a Chez Scheme
-machine type is undefined.
-
-It is unspecified whether the resulting string will name a threaded or a
-nonthreaded machine type."
- (let* ((chez-arch (target-chez-arch system))
- (chez-os (target-chez-os system)))
- (and chez-arch chez-os (string-append chez-arch chez-os))))
-
(define %chez-features-table
;; An alist of alists mapping:
;; os -> arch -> (or/c #f (listof symbol?))
@@ -233,6 +220,19 @@ (define* (chez-upstream-features-for-system #:optional
(and=> (assoc-ref %chez-features-table chez-os)
(cut assoc-ref <> chez-arch))))
+(define* (racket-cs-native-supported-system? #:optional
+ (system
+ (or (%current-target-system)
+ (%current-system))))
+ "Can Racket's variant of Chez Scheme generate native code for SYSTEM?
+Otherwise, SYSTEM can use only the ``portable bytecode'' backends."
+ (let ((chez-arch (target-chez-arch system))
+ (chez-os (target-chez-os system)))
+ (and (and=> (assoc-ref %chez-features-table chez-os)
+ ;; NOT assoc-ref: supported even if cdr is #f
+ (cut assoc chez-arch <>))
+ #t)))
+
;;
;; Chez Scheme:
;;
@@ -459,7 +459,9 @@ (define-public chez-scheme-for-racket
(add-after 'unpack 'chdir
(lambda args
(chdir "racket/src/ChezScheme"))))))))
- (supported-systems (filter nix-system->chez-machine
+ ;; TODO: How to build pbarch/pbchunks for other systems?
+ ;; See https://racket.discourse.group/t/950
+ (supported-systems (filter racket-cs-native-supported-system?
%supported-systems))
(home-page "https://github.com/racket/ChezScheme")
;; ^ This is downstream of https://github.com/racket/racket,
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index 8438945ba0..f010cf3aa4 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -190,8 +190,11 @@ (define-module (gnu packages racket)
(define* (racket-vm-for-system #:optional
(system (or (%current-target-system)
(%current-system))))
- "Return 'racket-vm-cs' if it supports SYSTEM; 'racket-vm-bc' otherwise."
- (if (nix-system->chez-machine system)
+ "Return 'racket-vm-cs' if we are able to build it for SYSTEM; 'racket-vm-bc'
+otherwise."
+ ;; Once we figure out the issues in https://racket.discourse.group/t/950,
+ ;; we can use 'racket-vm-cs' everywhere.
+ (if (racket-cs-native-supported-system? system)
racket-vm-cs
racket-vm-bc))
--
2.32.0
P
P
Philip McGrath wrote on 9 May 2022 08:02
[PATCH v3 7/9] gnu: chez-upstream-features-for-system: Improve implementation.
(address . 55248@debbugs.gnu.org)
cb5713cda5897307a5b526fdc31b07ba4aef5fe8.1652075689.git.philip@philipmcgrath.com
This commit is a follow-up to b8fc9169515ef1a6d6037c84e30ad308e5418b6f.
While that commit fixed a breaking build, this one begins to address the
faulty assumptions that lead to the failure: see also

In this commit, we reimplement 'chez-upstream-features-for-system' using
the new '%chez-features-table', which explicitly specifies platform
support for both 'chez-scheme' and 'chez-scheme-for-racket', rather than
assuming a non-false result from 'nix-system->chez-machine' means that
the system is supported.

The remaining uses of 'nix-system->chez-machine' still make that
incorrect assumption and must be repaired in a future commit.

* gnu/packages/chez.scm (%nix-arch-to-chez-alist,
%nix-os-to-chez-alist): Replace with ...
(target-chez-arch, target-chez-os): ... these new variables.
(nix-system->chez-machine): Rewrite using them.
(%chez-features-table): New variable.
(chez-upstream-features-for-system): Rewrite using it.
(chez-scheme)[supported-systems]: Update armhf-linux comment.
(chez-scheme-bootstrap-bootfiles)[supported-systems]: Use
'chez-upstream-features-for-system'.
(chez-machine->nonthreaded, chez-machine->threaded,
chez-machine->nix-system): Remove unused functions.
---
gnu/packages/chez.scm | 234 ++++++++++++++++++++++++------------------
1 file changed, 134 insertions(+), 100 deletions(-)

Toggle diff (288 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index dd485d37e1..41f083e0ac 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -49,8 +49,6 @@ (define-module (gnu packages chez)
#:use-module (srfi srfi-26)
#:export (chez-scheme-for-system
nix-system->chez-machine
- chez-machine->nonthreaded
- chez-machine->threaded
unpack-nanopass+stex))
;; Commentary:
@@ -82,68 +80,57 @@ (define* (chez-scheme-for-system #:optional
chez-scheme
chez-scheme-for-racket))
-(define (chez-machine->nonthreaded machine)
- "Given a string MACHINE naming a Chez Scheme machine type, returns a string
-naming the nonthreaded machine type for the same architecture and OS as
-MACHINE. The returned string may share storage with MACHINE."
- ;; Chez Scheme documentation consistently uses "nonthreaded" rather than
- ;; e.g. "unthreaded"
- (if (eqv? #\t (string-ref machine 0))
- (substring machine 1)
- machine))
-(define (chez-machine->threaded machine)
- "Like @code{chez-machine->nonthreaded}, but returns the threaded machine
-type."
- (if (eqv? #\t (string-ref machine 0))
- machine
- (string-append "t" machine)))
-
-;; Based on the implementation from raco-cross-lib/private/cross/platform.rkt
-;; in https://github.com/racket/raco-cross.
-;; For supported platforms, refer to release_notes/release_notes.stex in the
-;; upstream Chez Scheme repository or to racket/src/ChezScheme/README.md
-;; in https://github.com/racket/racket.
-(define %nix-arch-to-chez-alist
- `(("x86_64" . "a6")
- ("i386" . "i3")
- ("aarch64" . "arm64")
- ("armhf" . "arm32") ;; Chez supports ARM v6+
- ("ppc" . "ppc32")))
-(define %nix-os-to-chez-alist
- `(("w64-mingw32" . "nt")
- ("darwin" . "osx")
- ("linux" . "le")
- ("freebsd" . "fb")
- ("openbsd" . "ob")
- ("netbsd" . "nb")
- ("solaris" . "s2")))
-
-(define (chez-machine->nix-system machine)
- "Return the Nix system type corresponding to the Chez Scheme machine type
-MACHINE. If MACHINE is not a string representing a known machine type, an
-exception is raised. This function does not distinguish between threaded and
-nonthreaded variants of MACHINE.
+(define* (target-chez-arch #:optional (system
+ (or (%current-target-system)
+ (%current-system))))
+ "Return a string representing the architecture of SYSTEM as used in Chez
+Scheme machine types, or '#f' if none is defined."
+ (cond
+ ((target-x86-64? system)
+ "a6")
+ ((target-x86-32? system)
+ "i3")
+ ((target-aarch64? system)
+ "arm64")
+ ((target-arm32? system)
+ "arm32")
+ ((target-ppc64le? system)
+ #f)
+ ((target-ppc32? system)
+ "ppc32")
+ ((target-riscv64? system)
+ #f)
+ (else
+ #f)))
-Note that this function only handles Chez Scheme machine types in the
-strictest sense, not other kinds of descriptors sometimes used in place of a
-Chez Scheme machine type by Racket, such as @code{\"pb\"}, @code{#f}, or
-@code{\"racket\"}. (When using such extensions, the Chez Scheme machine type
-for the host system is often still relevant.)"
- (let ((machine (chez-machine->nonthreaded machine)))
- (let find-arch ((alist %nix-arch-to-chez-alist))
- (match alist
- (((nix . chez) . alist)
- (if (string-prefix? chez machine)
- (string-append
- nix "-" (let ((machine-os
- (substring machine (string-length chez))))
- (let find-os ((alist %nix-os-to-chez-alist))
- (match alist
- (((nix . chez) . alist)
- (if (equal? chez machine-os)
- nix
- (find-os alist)))))))
- (find-arch alist)))))))
+(define* (target-chez-os #:optional (system (or (%current-target-system)
+ (%current-system))))
+ "Return a string representing the operating system kernel of SYSTEM as used
+in Chez Scheme machine types, or '#f' if none is defined."
+ ;; e.g. "le" includes both GNU/Linux and Android
+ (cond
+ ((target-linux? system)
+ "le")
+ ((target-hurd? system)
+ #f)
+ ((target-mingw? system)
+ "nt")
+ ;; missing (guix utils) predicates
+ ;; cf. https://github.com/NixOS/nixpkgs/blob/master/lib/systems/doubles.nix
+ ((string-suffix? "-darwin" system)
+ "osx")
+ ((string-suffix? "-freebsd" system)
+ "fb")
+ ((string-suffix? "-openbsd" system)
+ "ob")
+ ((string-suffix? "-netbsd" system)
+ "nb")
+ ;; Nix says "x86_64-solaris", but accommodate "-solaris2"
+ ((string-contains system "solaris")
+ "s2")
+ ;; unknown
+ (else
+ #f)))
(define* (nix-system->chez-machine #:optional
(system (or (%current-target-system)
@@ -153,16 +140,81 @@ (define* (nix-system->chez-machine #:optional
machine type is undefined.
It is unspecified whether the resulting string will name a threaded or a
-nonthreaded machine type: when the distinction is relevant, use
-@code{chez-machine->nonthreaded} or @code{chez-machine->threaded} to adjust
-the result."
- (let* ((hyphen (string-index system #\-))
- (nix-arch (substring system 0 hyphen))
- (nix-os (substring system (+ 1 hyphen)))
- (chez-arch (assoc-ref %nix-arch-to-chez-alist nix-arch))
- (chez-os (assoc-ref %nix-os-to-chez-alist nix-os)))
+nonthreaded machine type."
+ (let* ((chez-arch (target-chez-arch system))
+ (chez-os (target-chez-os system)))
(and chez-arch chez-os (string-append chez-arch chez-os))))
+(define %chez-features-table
+ ;; An alist of alists mapping:
+ ;; os -> arch -> (or/c #f (listof symbol?))
+ ;; where:
+ ;; - `os` is a string for the OS part of a Chez Scheme machine type; and
+ ;; - `arch` is a string for the architecture part of a Chez machine type.
+ ;;
+ ;; The absence of an entry for a given arch--os pair means that neither
+ ;; upstream Chez Scheme nor the Racket variant can generate native code for
+ ;; that system. (The Racket variant can still provide support via its
+ ;; ``portable bytecode'' backends and optional compilation to C.) A value
+ ;; of `#f` means that upstream Chez Scheme does not support the arch--os
+ ;; pair at all, but the Racket variant does. A list has the same meaning as
+ ;; a result from `chez-upstream-features-for-system`.
+ ;;
+ ;; The arch--os pairs marked "commented out" have been commented out in the
+ ;; STeX source for the upstream release notes since the initial release as
+ ;; free software, but they are reported to work and/or have been described
+ ;; as supported by upstream maintainers.
+ ;;
+ ;; For this overall approach to make sense, we assume that Racket's variant
+ ;; of Chez Scheme can generate native code for a superset of the platforms
+ ;; supported upstream, supports threads on all platforms it supports at all
+ ;; (because they are needed for Racket), and doesn't need bootstrap
+ ;; bootfiles. Those assumptions have held for several years.
+ '(;; Linux
+ ("le"
+ ("i3" threads bootstrap-bootfiles)
+ ("a6" threads bootstrap-bootfiles)
+ ("arm32" bootstrap-bootfiles)
+ ("arm64" . #f)
+ ("ppc32" threads))
+ ;; FreeBSD
+ ("fb"
+ ("i3" threads) ;; commented out
+ ("a6" threads) ;; commented out
+ ("arm32" . #f)
+ ("arm64" . #f)
+ ("ppc32" . #f))
+ ;; OpenBSD
+ ("ob"
+ ("i3" threads) ;; commented out
+ ("a6" threads) ;; commented out
+ ("arm32" . #f)
+ ("arm64" . #f)
+ ("ppc32" . #f))
+ ;; NetBSD
+ ("nb"
+ ("i3" threads) ;; commented out
+ ("a6" threads) ;; commented out
+ ("arm32" . #f)
+ ("arm64" . #f)
+ ("ppc32" . #f))
+ ;; OpenSolaris / OpenIndiana / Illumos
+ ("s2"
+ ("i3" threads) ;; commented out
+ ("a6" threads)) ;; commented out
+ ;; Windows
+ ("nt"
+ ("i3" threads bootstrap-bootfiles)
+ ("a6" threads bootstrap-bootfiles)
+ ;; ^ threads "experiemental", but reportedly fine
+ ("arm64" . #f))
+ ;; Darwin
+ ("osx"
+ ("i3" threads bootstrap-bootfiles)
+ ("a6" threads bootstrap-bootfiles)
+ ("arm64" . #f)
+ ("ppc32" . #f))))
+
(define* (chez-upstream-features-for-system #:optional
(system
(or (%current-target-system)
@@ -172,20 +224,14 @@ (define* (chez-upstream-features-for-system #:optional
does not support SYSTEM at all.
If native threads are supported, the returned list will include
-@code{'threads}. Other feature symbols may be added in the future."
- (cond
- ((not (nix-system->chez-machine system))
- #f)
- ((target-aarch64? system)
- #f)
- ((target-arm32? system)
- (and (target-linux? system)
- '()))
- ((target-ppc32? system)
- (and (target-linux? system)
- '(threads)))
- (else
- '(threads))))
+@code{'threads}. If bootstrap bootfiles for SYSTEM are distributed in the
+upstream Chez Scheme repository, the returned list will include
+@code{'bootstrap-bootfiles}. Other feature symbols may be added in the
+future."
+ (let ((chez-arch (target-chez-arch system))
+ (chez-os (target-chez-os system)))
+ (and=> (assoc-ref %chez-features-table chez-os)
+ (cut assoc-ref <> chez-arch))))
;;
;; Chez Scheme:
@@ -365,14 +411,9 @@ (define-public chez-scheme
((pth)
(symlink pth
"csug.pdf")))))))))
- ;; Chez Scheme does not have a MIPS backend.
- ;; FIXME: Debian backports patches to get armhf working.
- ;; We should too. It is the Chez machine type arm32le
- ;; (no threaded version upstream yet, though there is in
- ;; Racket's fork), more specifically (per the release notes) ARMv6.
(supported-systems
(delete
- "armhf-linux" ;; <-- should work, but reportedly broken
+ "armhf-linux" ;; XXX reportedly broken, needs checking
(filter chez-upstream-features-for-system
%supported-systems)))
(home-page "https://cisco.github.io/ChezScheme/")
@@ -471,16 +512,9 @@ (define-public chez-scheme-bootstrap-bootfiles
(list #:install-plan
#~`(("boot/" "lib/chez-scheme-bootfiles"))))
(supported-systems
- ;; Upstream only distributes pre-built bootfiles for
- ;; arm32le and t?(i3|a6)(le|nt|osx)
(filter (lambda (system)
- (let ((machine (and=> (nix-system->chez-machine system)
- chez-machine->nonthreaded)))
- (or (equal? "arm32le" machine)
- (and machine
- (member (substring machine 0 2) '("i3" "a6"))
- (or-map (cut string-suffix? <> machine)
- '("le" "nt" "osx"))))))
+ (and=> (chez-upstream-features-for-system system)
+ (cut memq 'bootstrap-bootfiles <>)))
%supported-systems))
(synopsis "Chez Scheme bootfiles (binary seed)")
(description
--
2.32.0
P
P
Philip McGrath wrote on 9 May 2022 08:02
[PATCH v3 9/9] gnu: chez-scheme-for-system: Adjust for bytecode backend.
(address . 55248@debbugs.gnu.org)
fb4003afba005086c1db419e6641cf1f50e38fb2.1652075689.git.philip@philipmcgrath.com
Change 'chez-scheme-for-system' to return 'chez-scheme-for-racket' in
two cases when it previously returned 'chez-scheme':

1. When 'chez-scheme' is not distributed with bootstrap bootfiles,
since we can only cross-compile 'chez-scheme' for those systems; and

2. When neither 'chez-scheme' nor 'chez-scheme-for-racket' supports
native code generation, since we will be able to use the ``portable
bytecode'' backends of 'chez-scheme-for-racket' as soon as the
issues in https://racket.discourse.group/t/950 are resolved.

* gnu/packages/chez.scm (chez-scheme-for-racket): Change condition.
---
gnu/packages/chez.scm | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)

Toggle diff (32 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index cae17580f8..7e6273f26a 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -69,14 +69,17 @@ (define-module (gnu packages chez)
(define* (chez-scheme-for-system #:optional
(system (or (%current-target-system)
(%current-system))))
- "Return 'chez-scheme' unless only 'chez-scheme-for-racket' supports SYSTEM,
-including support for native threads."
- (if (or
- ;; full support upstream
- (and=> (chez-upstream-features-for-system system)
- (cut memq 'threads <>))
- ;; no support anywhere
- (not (nix-system->chez-machine system)))
+ "Return 'chez-scheme' if it fully supports SYSTEM, including support for
+bootstrapping and native threads. Otherwise, return
+'chez-scheme-for-racket'."
+ (if (and=> (chez-upstream-features-for-system system)
+ (lambda (features)
+ (every (cut memq <> features)
+ '(threads
+ ;; We can cross-compile for platforms without
+ ;; bootstrap bootfiles, but we can't self-host
+ ;; on them short of adding more binary seeds.
+ bootstrap-bootfiles))))
chez-scheme
chez-scheme-for-racket))
--
2.32.0
L
L
Liliana Marie Prikler wrote on 9 May 2022 08:21
Re: [PATCH v3 7/9] gnu: chez-upstream-features-for-system: Improve implementation.
b715b758f23b1e7944bd50cc454ffd25085d3c4a.camel@ist.tugraz.at
Am Montag, dem 09.05.2022 um 02:02 -0400 schrieb Philip McGrath:
Toggle quote (8 lines)
> In this commit, we reimplement 'chez-upstream-features-for-system'
> using the new '%chez-features-table', which explicitly specifies
> platform support for both 'chez-scheme' and 'chez-scheme-for-racket',
> rather than assuming a non-false result from 'nix-system->chez-machine'
> means that the system is supported.
>
> The remaining uses of 'nix-system->chez-machine' still make that
> incorrect assumption and must be repaired in a future commit.
Do they really? As far as I can see, we have a bijection between
supported nix systems and chez-machines, with the behaviour when
looking up unsupported systems being undefined. This means that nix-
system->chez-machine is well-formed in contexts outside of supported-
system, e.g. also for the 6/9 patch.


Cheers
L
L
Liliana Marie Prikler wrote on 9 May 2022 08:34
Re: [PATCH v3 8/9] gnu: chez-scheme-for-racket: Fix supported systems.
1e7cf69aa12c81effaf2eb1ceff0997faca1cab2.camel@ist.tugraz.at
Am Montag, dem 09.05.2022 um 02:02 -0400 schrieb Philip McGrath:
Toggle quote (7 lines)
> Once the issues in https://racket.discourse.group/t/950 are
> resolved, 'chez-scheme-for-racket' and 'racket-vm-cs' will be able to
> run even on systems for which native code generation is not
> supported. It's not clear what behavior would be useful from 'nix-
> system->chez-machine': since the current implementation is flawed and
> easy to misuse, we remove it for now, replacing the remaining uses
> with 'racket-cs-native-supported-system?'.
I think you're again making a wrong assumption here. nix-system->chez-
scheme has purposes outside of solving supported-system.

Toggle quote (15 lines)
> +(define* (racket-cs-native-supported-system? #:optional
> +                                             (system
> +                                              (or (%current-target-
> system)
> +                                                  (%current-
> system))))
> +  "Can Racket's variant of Chez Scheme generate native code for
> SYSTEM?
> +Otherwise, SYSTEM can use only the ``portable bytecode'' backends."
> +  (let ((chez-arch (target-chez-arch system))
> +        (chez-os (target-chez-os system)))
> +    (and (and=> (assoc-ref %chez-features-table chez-os)
> +                ;; NOT assoc-ref: supported even if cdr is #f
> +                (cut assoc chez-arch <>))
> +         #t)))
I think this should rather be explicit in %chez-features-table. You
can prefix features that only work inside racket with 'racket-. Then,
this can be solved with memq just as with chez-scheme's supported-
systems in 7/9.


Cheers
P
P
Philip McGrath wrote on 9 May 2022 09:20
Re: [PATCH v3 7/9] gnu: chez-upstream-features-for-system: Improve implementation.
2c0151f9-f8b3-bd0e-7023-b6d29b9f6df1@philipmcgrath.com
Hi,

On 5/9/22 02:21, Liliana Marie Prikler wrote:
Toggle quote (16 lines)
> Am Montag, dem 09.05.2022 um 02:02 -0400 schrieb Philip McGrath:
>> In this commit, we reimplement 'chez-upstream-features-for-system'
>> using the new '%chez-features-table', which explicitly specifies
>> platform support for both 'chez-scheme' and 'chez-scheme-for-racket',
>> rather than assuming a non-false result from 'nix-system->chez-machine'
>> means that the system is supported.
>>
>> The remaining uses of 'nix-system->chez-machine' still make that
>> incorrect assumption and must be repaired in a future commit.
> Do they really? As far as I can see, we have a bijection between
> supported nix systems and chez-machines, with the behaviour when
> looking up unsupported systems being undefined. This means that nix-
> system->chez-machine is well-formed in contexts outside of supported-
> system, e.g. also for the 6/9 patch.
>

I think a bijection happens to exist at the moment, but only by
accident. For example, while it isn't packaged for Guix, apparently
aarch64-w64-mingw32 is a thing. Racket's Chez Scheme only added tarm64nt
support as of this release, but had previously supported aarch64 with
other kernels and the NT kernel with other architectures. If Guix had
added that system before Racket's Chez did, 'nix-system->chez-machine'
would have known how to write it as a Chez machine type, but nonetheless
it wouldn't have had a native code backend.

We explicitly list the systems for which Racket's Chez has a native code
backend in '%chez-features-table', so I really think we should just use
it, rather than try to be clever with 'nix-system->chez-machine'.

-Philip
L
L
Liliana Marie Prikler wrote on 9 May 2022 09:41
e51edf621aeb6879b4f87619c954207825113ab5.camel@ist.tugraz.at
Am Montag, dem 09.05.2022 um 03:20 -0400 schrieb Philip McGrath:

Toggle quote (6 lines)
> On 5/9/22 02:21, Liliana Marie Prikler wrote:
> > As far as I can see, we have a bijection between *supported nix
> > systems* and chez-machines, with the *behaviour when looking up
> > unsupported systems* being *undefined*.
> I think a bijection happens to exist at the moment, but only by
> accident. 
Emphasis mine. Look more closely, it's a bijection + undefined, where
undefined falls outside the realm of what should be reached outside of
supported-system queries. In short, the specification for nix-system-
Toggle quote (1 lines)
>chez-machine is that for every *supported system* it returns the chez
machine as a string. Otherwise, it may return a string or #f, we don't
care. Thus, nix-system->chez-machine can serve as an upper bound for
supported-system, but not as its implementation.

Toggle quote (8 lines)
> For example, while it isn't packaged for Guix, apparently
> aarch64-w64-mingw32 is a thing. Racket's Chez Scheme only added
> tarm64nt support as of this release, but had previously supported
> aarch64 with other kernels and the NT kernel with other
> architectures. If Guix had added that system before Racket's Chez
> did, 'nix-system->chez-machine' would have known how to write it as
> a Chez machine type, but nonetheless it wouldn't have had a native
> code backend.
That's irrelevant and not the purpose for having a conversion function.

Toggle quote (2 lines)
> We explicitly list the systems for which Racket's Chez has a native
> code backend in '%chez-features-table',
Do we really?

Toggle quote (2 lines)
> I think we should just use it, rather than try to be clever with
> 'nix-system->chez-machine'.
Well, that depends on what you're trying to use it for. Determining
features? Sure. Determining system support? Okay. But that doesn't
mean there's no valid use for nix-machine->chez-system – in particular
I think you over-eagerly removed a valid one earlier.

Cheers
P
P
Philip McGrath wrote on 9 May 2022 09:55
Re: [PATCH v3 8/9] gnu: chez-scheme-for-racket: Fix supported systems.
7e8f385e-d2b5-6f38-fe4b-030748519574@philipmcgrath.com
Hi,

On 5/9/22 02:34, Liliana Marie Prikler wrote:
Toggle quote (12 lines)
> Am Montag, dem 09.05.2022 um 02:02 -0400 schrieb Philip McGrath:
>> Once the issues in <https://racket.discourse.group/t/950> are
>> resolved, 'chez-scheme-for-racket' and 'racket-vm-cs' will be able to
>> run even on systems for which native code generation is not
>> supported. It's not clear what behavior would be useful from 'nix-
>> system->chez-machine': since the current implementation is flawed and
>> easy to misuse, we remove it for now, replacing the remaining uses
>> with 'racket-cs-native-supported-system?'.
> I think you're again making a wrong assumption here. nix-system->chez-
> scheme has purposes outside of solving supported-system.
>

Concretely, there are no other uses in Guix.

I do not know a robust, correct way to use
'nix-system->chez-machine'---certainly not without it growing many
additional features, like maybe computing endianness for pbarch backends
when we are able to build them. For example, if we continued using it as
we did in 'stex', you couldn't build a package graph for nonthreaded
Chez simply by applying a package transformation to remove '--threads'
from its '#:configure-flags', because that would change the machine type
without updating the uses of 'nix-system->chez-machine'.

Toggle quote (21 lines)
>> +(define* (racket-cs-native-supported-system? #:optional
>> +                                             (system
>> +                                              (or (%current-target-
>> system)
>> +                                                  (%current-
>> system))))
>> +  "Can Racket's variant of Chez Scheme generate native code for
>> SYSTEM?
>> +Otherwise, SYSTEM can use only the ``portable bytecode'' backends."
>> +  (let ((chez-arch (target-chez-arch system))
>> +        (chez-os (target-chez-os system)))
>> +    (and (and=> (assoc-ref %chez-features-table chez-os)
>> +                ;; NOT assoc-ref: supported even if cdr is #f
>> +                (cut assoc chez-arch <>))
>> +         #t)))
> I think this should rather be explicit in %chez-features-table. You
> can prefix features that only work inside racket with 'racket-. Then,
> this can be solved with memq just as with chez-scheme's supported-
> systems in 7/9.
>

I don't understand this.

The presence of an entry in '%chez-features-table' explicitly means that
'chez-scheme-for-racket' can generate native code.

The idea is that the "portable bytecode" backends should work, including
thread support, on any system with a reasonably capable C compiler.

There are no other "features" that vary among systems for
'chez-scheme-for-racket'. It doesn't rely on pre-built bootfiles for
bootstrapping. Since the initial fork at the beginning of 2017, when
support for new systems has been added, native threads have been
supported immediately. Racket regularly merges all changes from upstream
Chez (which has not added any supported systems during that time---not
even the systems added already in Racket's variant). These conditions
are documented in the comments on '%chez-features-table'. If they ever
ceased to hold, it would mean that the relationship between
'chez-scheme-for-racket' and upstream 'chez-scheme' had changed
significantly, and we would probably need to reevaluate more broadly
which variant to use where.

-Philip
L
L
Liliana Marie Prikler wrote on 9 May 2022 11:36
77ff7763a7c87424e7195e9f8624dbdd2a26193c.camel@ist.tugraz.at
Hi,

Am Montag, dem 09.05.2022 um 03:55 -0400 schrieb Philip McGrath:
Toggle quote (11 lines)
> Concretely, there are no other uses in Guix.
>
> I do not know a robust, correct way to use
> 'nix-system->chez-machine'---certainly not without it growing many
> additional features, like maybe computing endianness for pbarch
> backends when we are able to build them. For example, if we continued
> using it as we did in 'stex', you couldn't build a package graph for
> nonthreaded Chez simply by applying a package transformation to
> remove '--threads' from its '#:configure-flags', because that would
> change the machine type without updating the uses of 'nix-system-
> >chez-machine'.
True, you would have to change the machine type, but I think I already
noted that we might want to use this machine type as a distinguishing
factor in packages built on top of chez (and later chez-build-system
perhaps). You could do this the other way round by deriving flags from
the given machine-type, e.g. stex for threaded chez machine is given --
threads, otherwise it's not. Since we have named symbols for these
features, we could have a "package-with-chez-features" or similar
transformer. Being able to specify this machine is a strength, not a
weakness.

Toggle quote (2 lines)
> The presence of an entry in '%chez-features-table' explicitly means
> that 'chez-scheme-for-racket' can generate native code.
That is not explicit at all. There might be an explicit comment
stating so somewhere, but in terms of actual code, it's super implicit.

Toggle quote (3 lines)
> The idea is that the "portable bytecode" backends should work,
> including thread support, on any system with a reasonably capable C
> compiler.
The idea. In practice, what racket deems reasonably capable can change
over time and might result in them dropping some architectures
currently supported. What do you do then?

Toggle quote (7 lines)
> There are no other "features" that vary among systems for
> 'chez-scheme-for-racket'. It doesn't rely on pre-built bootfiles for
> bootstrapping. Since the initial fork at the beginning of 2017, when
> support for new systems has been added, native threads have been
> supported immediately. Racket regularly merges all changes from
> upstream Chez (which has not added any supported systems during that
> time---not even the systems added already in Racket's variant). 
I'd still make "supported-by-racket" or however else you decide to name
that feature an explicit part of that table rather than an implicit
one, or use a separate "table" for platforms supported by racket. Note
that none of the racket-vm packages appear to currently carry
supported-systems, which seems dubious.

Toggle quote (2 lines)
> These conditions are documented in the comments on '%chez-features-
> table'. 
See above.


Cheers
L
L
Ludovic Courtès wrote on 9 May 2022 11:44
Re: bug#55248: [PATCH 0/7] gnu: Update Racket to 8.5 and Chez Scheme to 9.5.8.
(name . Philip McGrath)(address . philip@philipmcgrath.com)
878rrbrqfx.fsf_-_@gnu.org
Hi Philip,

Philip McGrath <philip@philipmcgrath.com> skribis:

Toggle quote (10 lines)
> gnu: racket: Update to 8.5.
> gnu: racket: Fix out-of-source build.
> gnu: chez-scheme: Update to 9.5.8.
> gnu: chez-scheme: Refactor documentation phases.
> gnu: chez-scheme: Refactor configure phase and fix '--threads'.
> gnu: stex: Get machine type dynamically.
> gnu: chez-upstream-features-for-system: Improve implementation.
> gnu: chez-scheme-for-racket: Fix supported systems.
> gnu: chez-scheme-for-system: Adjust for bytecode backend.

I applied the whole series (great work!), but stumbled upon this:

Toggle snippet (7 lines)
r:sha256 hash mismatch for /gnu/store/mipblqr29m18gvcmqp5j5s3aj5jknchy-racket-gui-8.5-checkout:
expected hash: 0hqryw3md67j5z4d6bv5qx75w8z1vjxfixabf2xq9bj6k43yzzmi
actual hash: 0r3ck4gxdhnzr1a1fi0f1i7gwfip7akq10qgcxza66pp57hnl0wx
hash mismatch for store item '/gnu/store/mipblqr29m18gvcmqp5j5s3aj5jknchy-racket-gui-8.5-checkout'
build of /gnu/store/xsbp1m2bh5wn4h0pxc7rr5pz4w88jfns-racket-gui-8.5-checkout.drv failed

Could it be that the v8.5 tag on that repo was modified in place?

You can resent just this one patch if you want, if it’s just a matter of
changing the hash.

Thanks,
Ludo’.
P
P
Philip McGrath wrote on 12 May 2022 05:50
(name . Ludovic Courtès)(address . ludo@gnu.org)
dbf114ee-28ff-b43d-6f56-664f3eca125a@philipmcgrath.com
Hi,

On 5/9/22 05:44, Ludovic Courtès wrote:
Toggle quote (30 lines)
> Hi Philip,
>
> Philip McGrath <philip@philipmcgrath.com> skribis:
>
>> gnu: racket: Update to 8.5.
>> gnu: racket: Fix out-of-source build.
>> gnu: chez-scheme: Update to 9.5.8.
>> gnu: chez-scheme: Refactor documentation phases.
>> gnu: chez-scheme: Refactor configure phase and fix '--threads'.
>> gnu: stex: Get machine type dynamically.
>> gnu: chez-upstream-features-for-system: Improve implementation.
>> gnu: chez-scheme-for-racket: Fix supported systems.
>> gnu: chez-scheme-for-system: Adjust for bytecode backend.
>
> I applied the whole series (great work!), but stumbled upon this:
>
> --8<---------------cut here---------------start------------->8---
> r:sha256 hash mismatch for /gnu/store/mipblqr29m18gvcmqp5j5s3aj5jknchy-racket-gui-8.5-checkout:
> expected hash: 0hqryw3md67j5z4d6bv5qx75w8z1vjxfixabf2xq9bj6k43yzzmi
> actual hash: 0r3ck4gxdhnzr1a1fi0f1i7gwfip7akq10qgcxza66pp57hnl0wx
> hash mismatch for store item '/gnu/store/mipblqr29m18gvcmqp5j5s3aj5jknchy-racket-gui-8.5-checkout'
> build of /gnu/store/xsbp1m2bh5wn4h0pxc7rr5pz4w88jfns-racket-gui-8.5-checkout.drv failed
> --8<---------------cut here---------------end--------------->8---
>
> Could it be that the v8.5 tag on that repo was modified in place?
>
> You can resent just this one patch if you want, if it’s just a matter of
> changing the hash.
>

Thanks for finding this! I will send the single revised patch in a
separate email. The hashes for the "gui", "htdp", "redex",
"typed-racket", "string-constants", and "syntax-color" origins needed to
be updated.

The v8.5 tags were not modified, but it looks like the v8.5 tags for
those repositories included additional commits added after the first
release candidate, which I had built early on. (The tag is created only
when the release is actually released.) My best guess is that, somewhere
in the process of amending this patch series, I had done a build with
the commit and checksum for the first release candidate, but with the
origin file name as though it were the 8.5 release. When I then changed
these origins to point at the tag, I must not have changed the hashes,
and I guess Guix saw that it already had store items with the correct
name and hash and didn't try to download them again.

I confirmed that this works by building on a computer where I hadn't
built any of the earlier versions of this series (which took a little
bit to set up).

I'm not sure if there's a better way to prevent or check for this sort
of problem in general.

Just to be extra explicit, here's the diff between v3 and what I'm about
to send as v4 1/9:

Toggle quote (55 lines)
> diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
> index 1f020f1276..c4183be210 100644
> --- a/gnu/packages/racket.scm
> +++ b/gnu/packages/racket.scm
> @@ -686,13 +686,13 @@ (define-public racket
> "games" (base32 "0kpn3izlx1ccd0pj0dnvmnrhny51b85xy418a7psj70lz8j8415d")
> '(("games" ".")))
> (simple-racket-origin
> - "gui" (base32 "0hqryw3md67j5z4d6bv5qx75w8z1vjxfixabf2xq9bj6k43yzzmi")
> + "gui" (base32 "0r3ck4gxdhnzr1a1fi0f1i7gwfip7akq10qgcxza66pp57hnl0wx")
> '("gui" "gui-doc" "gui-lib" "tex-table"))
> (simple-racket-origin
> "gui-pkg-manager" (base32 "1ji9448d723nklqvycwdswj0ni28sabrncag14f9mx47did5myb5")
> '("gui-pkg-manager-lib"))
> (simple-racket-origin
> - "htdp" (base32 "199qchdq6db6m2n4j861hiy4nxd6hg1qva16lhhdbfj274qmcplg")
> + "htdp" (base32 "19xqixrqbwdxph17w9jga19008j88harb5wgml4hpqj3x0apx9g3")
> '("htdp" "htdp-doc" "htdp-lib"))
> (simple-racket-origin
> "html" (base32 "18n1jnjgzfknc8nv8dppi85nb8q08gqdwkg6hfjk08x0p00anx2x")
> @@ -830,7 +830,7 @@ (define-public racket
> "realm" (base32 "0hxcgla08iack54j8v40fj51811chpy66ym2zq76zb52c7kzn0hi")
> '(("realm" ".")))
> (simple-racket-origin
> - "redex" (base32 "0a1fl5s80k3j3xh3lri8886ql443m7pmgv18y7whzlmsd7x8rdpr")
> + "redex" (base32 "18rn8ddsqh1s7hdlb2cb9wxln63bz0wysjssaf9v92r712xnnv8i")
> '("redex"
> "redex-benchmark"
> "redex-doc"
> @@ -877,7 +877,7 @@ (define-public racket
> "snip" (base32 "01r9wc5xr3q3n4yyif6j0a37rgdzmpslxn05k13ksik73b3wj6hj")
> '("snip" "snip-lib"))
> (simple-racket-origin
> - "typed-racket" (base32 "05xlyjrx3m8xrrrw1xmfb1807qa5aqfl0zp9bdxwh2z7cfxaii09")
> + "typed-racket" (base32 "0z6bagp6qiw0i3slhvq035y5hqgq664xw3bdlvdayad0bgbg0mdc")
> '("source-syntax"
> "typed-racket"
> "typed-racket-compatibility"
> @@ -888,13 +888,13 @@ (define-public racket
> "srfi" (base32 "0aqbcdv2dfc2xnk0h6zfi56p7bpwqji8s88qds3d03hhh9k28gvn")
> '("srfi" "srfi-doc" "srfi-lib" "srfi-lite-lib"))
> (simple-racket-origin
> - "string-constants" (base32 "1rjs0gyw9hsiglwxnimz272v9xj1gwjxrnzh4qbsxkvdaphvi38m")
> + "string-constants" (base32 "0b1ji31pv6bjb0a2bh9sqp5abvf91gn2rai8r4c4nkar1fzfwfac")
> '("string-constants" "string-constants-doc" "string-constants-lib"))
> (simple-racket-origin
> "swindle" (base32 "164gdsphjzdl2vv7zxz7dfk9jwax8njpmim6sidm8qz8a8589y67")
> '(("swindle" ".")))
> (simple-racket-origin
> - "syntax-color" (base32 "1xf3rl8687c1nar4kkgkvyncwi0gl696rif0iqhffg730fk457gi")
> + "syntax-color" (base32 "17lb2403ymz6sflw4vs3gsh2y7kgsf0gn8sncsxjhi16rpj3a9vm")
> '("syntax-color" "syntax-color-doc" "syntax-color-lib"))
> (simple-racket-origin
> "trace" (base32 "070ihla5j796hdarn5wxdwn4xj0xnkm50shgh49jy994mribvhia")

-Philip
P
P
Philip McGrath wrote on 12 May 2022 05:59
[PATCH v4 1/9] gnu: racket: Update to 8.5.
(address . 55248@debbugs.gnu.org)
13ccbbe30492ac15d3c8859e935dbfb5f54708b6.1652327601.git.philip@philipmcgrath.com
* gnu/packages/patches/racket-gui-tethered-launcher-backport.patch,
gnu/packages/patches/racket-enable-scheme-backport.patch: Delete files.
* gnu/local.mk (dist_patch_DATA): Remove them.
* gnu/packages/chez.scm (chez-scheme-for-racket): Update to 9.5.7.6.
* gnu/packages/racket.scm (%racket-version): Update to 8.5.
(%racket-origin)[patches]: Remove obsolete patches.
(racket-vm-common-configure-flags): Correct comment.
(racket)[inputs]<2d, datalog, deinprogramm, draw, drracket, expeditor,
htdp, pict, plot, quickscript, racklog, rackunit, redex, scribble,
typed-racket, string-constants, syntax-color, web-server, xrepl>: Update
checksums.
<gui, srfi>: Likewise, and remove obsolete backports.
---
gnu/local.mk | 2 -
gnu/packages/chez.scm | 4 +-
.../racket-enable-scheme-backport.patch | 465 ------------------
...acket-gui-tethered-launcher-backport.patch | 26 -
gnu/packages/racket.scm | 82 ++-
5 files changed, 32 insertions(+), 547 deletions(-)
delete mode 100644 gnu/packages/patches/racket-enable-scheme-backport.patch
delete mode 100644 gnu/packages/patches/racket-gui-tethered-launcher-backport.patch

Toggle diff (195 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index ed901a5ba8..d7788796cc 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1757,8 +1757,6 @@ dist_patch_DATA = \
%D%/packages/patches/ripperx-missing-file.patch \
%D%/packages/patches/rpcbind-CVE-2017-8779.patch \
%D%/packages/patches/rtags-separate-rct.patch \
- %D%/packages/patches/racket-enable-scheme-backport.patch \
- %D%/packages/patches/racket-gui-tethered-launcher-backport.patch \
%D%/packages/patches/racket-minimal-sh-via-rktio.patch \
%D%/packages/patches/remake-impure-dirs.patch \
%D%/packages/patches/restic-0.9.6-fix-tests-for-go1.15.patch \
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index d47225dbe5..a7f75a731a 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -4,7 +4,7 @@
;;; Copyright © 2017, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2019 Brett Gilio <brettg@gnu.org>
;;; Copyright © 2020 Brendan Tildesley <mail@brendan.scot>
-;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
+;;; Copyright © 2021, 2022 Philip McGrath <philip@philipmcgrath.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -361,7 +361,7 @@ (define-public chez-scheme-for-racket
(package
(inherit chez-scheme)
(name "chez-scheme-for-racket")
- (version "9.5.7.3")
+ (version "9.5.7.6")
;; The version should match `(scheme-fork-version-number)`.
;; See racket/src/ChezScheme/s/cmacros.ss c. line 360.
;; It will always be different than the upstream version!
diff --git a/gnu/packages/patches/racket-enable-scheme-backport.patch b/gnu/packages/patches/racket-enable-scheme-backport.patch
deleted file mode 100644
index 3a5a4a3d82..0000000000
--- a/gnu/packages/patches/racket-enable-scheme-backport.patch
+++ /dev/null
@@ -1,465 +0,0 @@
-From 8d7687842f099e3e7e60d3a83fed58b2c6a92863 Mon Sep 17 00:00:00 2001
-From: Matthew Flatt <mflatt@racket-lang.org>
-Date: Sun, 6 Feb 2022 10:36:09 -0700
-Subject: [PATCH 1/2] Chez Scheme: adapt bootfile build for supplied `Scheme=`
-
-(cherry picked from commit fca1e02349664060e10278ca2ce6577a949bebf5)
-
-(Fixed conflicts by dropping pbchunks and pbarch changes.)
----
- racket/src/ChezScheme/configure | 15 ++++++++++++++-
- racket/src/ChezScheme/s/Mf-base | 4 ++--
- racket/src/ChezScheme/s/Mf-cross | 4 +++-
- 3 files changed, 19 insertions(+), 4 deletions(-)
-
-diff --git a/racket/src/ChezScheme/configure b/racket/src/ChezScheme/configure
-index 4515ffc105..0098829091 100755
---- a/racket/src/ChezScheme/configure
-+++ b/racket/src/ChezScheme/configure
-@@ -45,6 +45,7 @@ threads=yes
- nothreads=no
- temproot=""
- help=no
-+forceworkarea=no
- gzipmanpages=yes
- installowner=""
- installgroup=""
-@@ -205,6 +206,9 @@ while [ $# != 0 ] ; do
- --pb)
- pb=yes
- ;;
-+ --force)
-+ forceworkarea=yes
-+ ;;
- --installprefix=*)
- installprefix=`echo $1 | sed -e 's/^--installprefix=//'`
- ;;
-@@ -439,6 +443,7 @@ if [ "$help" = "yes" ]; then
- echo " --toolprefix=<prefix> prefix tool (compiler, linker, ...) names"
- echo " --[no]gzip-man-pages compress manual pages ($gzipmanpages)"
- echo " --workarea=<pathname> build directory ($w)"
-+ echo " --force configure even without boot files"
- echo " CC=<C compiler> C compiler"
- echo " CPPFLAGS=<C preprocessor flags> C preprocessor flags"
- echo " CFLAGS=<C compiler flags> C compiler flags"
-@@ -721,8 +726,16 @@ case "${flagsmuni}" in
- ;;
- esac
-
-+if [ "$w" = "$m" ] ; then
-+ configuringin=""
-+else
-+ configuringin=" in $w"
-+fi
-+
- if [ -f boot/$m/scheme.boot -o -f "$srcdir"/boot/$m/scheme.boot ] ; then
-- echo "Configuring for $m"
-+ echo "Configuring for $m$configuringin"
-+elif [ "$forceworkarea" = yes ] ; then
-+ echo "Configuring for $m$configuringin despite missing boot files"
- else
- if [ "$m" = "" ] ; then
- maybem="<machine type>"
-diff --git a/racket/src/ChezScheme/s/Mf-base b/racket/src/ChezScheme/s/Mf-base
-index cc6178c973..1f4a967998 100644
---- a/racket/src/ChezScheme/s/Mf-base
-+++ b/racket/src/ChezScheme/s/Mf-base
-@@ -94,7 +94,7 @@ endif
- # that Scheme and SCHEMEHEAPDIRS are set by Mf-cross to point to the host Scheme
- # implementation
- Scheme = ../bin/$m/scheme${ExeSuffix}
--export SCHEMEHEAPDIRS=../boot/%m
-+export SCHEMEHEAPDIRS=../boot/$m
- export CHEZSCHEMELIBDIRS=.
-
- # Define the libdirs separator character
-@@ -691,4 +691,4 @@ reset-one:
-
- .PHONY: run
- run:
-- env SCHEMEHEAPDIRS=../boot/$m/ ../bin/$m/scheme $(ARGS)
-+ env SCHEMEHEAPDIRS=${SCHEMEHEAPDIRS} ${Scheme} $(ARGS)
-diff --git a/racket/src/ChezScheme/s/Mf-cross b/racket/src/ChezScheme/s/Mf-cross
-index d796cbb459..397af59a28 100644
---- a/racket/src/ChezScheme/s/Mf-cross
-+++ b/racket/src/ChezScheme/s/Mf-cross
-@@ -43,5 +43,7 @@ x$(xm).$(m):
- $(MAKE) -f Mf-cross m=$(m) xm=$(xm) i=f o=3 d=0 xpatch
- mv xpatch x$(xm).$(m)
-
-+ifneq ($(SCHEMEHEAPDIRS),:)
- # Ensure that cross-compiling "nanopass.so" is rebuilt if the host compiler changed
--nanopass.so: ${SCHEME} ${SCHEMEHEAPDIRS}/petite.boot ${SCHEMEHEAPDIRS}/scheme.boot
-+nanopass.so: ${Scheme} ${SCHEMEHEAPDIRS}/petite.boot ${SCHEMEHEAPDIRS}/scheme.boot
-+endif
---
-2.32.0
-
-
-From 26c8e2c1d9b02ad85acef8bda40d92154cf0b699 Mon Sep 17 00:00:00 2001
-From: Matthew Flatt <mflatt@racket-lang.org>
-Date: Sun, 6 Feb 2022 11:03:30 -0700
-Subject: [PATCH 2/2] configure: make `--enable-scheme` work with an executable
-
-When the same Chez Scheme version as used by Racket is already
-available, then `--enable-scheme=...` can supply an executable. For
-cross builds, `--enable-scheme=...` can still supply a build
-directory, instead, as before.
-
-(cherry picked from commit 4f0e76855ce7e86107de495292a553469daf0b3f)
----
- racket/src/ChezScheme/makefiles/Makefile.in | 3 ++
- racket/src/README.txt | 30 +++++++++++---
- racket/src/configure | 8 +++-
- racket/src/cs/README.txt | 6 ++-
- racket/src/cs/c/Makefile.in | 44 ++++++++++++++++-----
- racket/src/cs/c/configure | 24 +++++++++--
- racket/src/cs/c/configure.ac | 21 ++++++++--
- 7 files changed, 112 insertions(+), 24 deletions(-)
-
-diff --git a/racket/src/ChezScheme/makefiles/Makefile.in b/racket/src/ChezScheme/makefiles/Makefile.in
-index c396efc851..3998ef9ccd 100644
---- a/racket/src/ChezScheme/makefiles/Makefile.in
-+++ b/racket/src/ChezScheme/makefiles/Makefile.in
-@@ -59,6 +59,9 @@ reset:
- %.boot:
- (cd $(workarea) && $(MAKE) $*.boot)
-
-+auto.boot:
-+ (cd $(workarea) && $(MAKE) $(defaultm).boot)
-+
- # <machine>.bootquick to build boot files for <machine>
- # with o=3 d=0 for the cross compiler, and only after
- # building the kernel for the configured machine
-diff --git a/racket/src/README.txt b/racket/src/README.txt
-index 98647aebce..d77310b4a4 100644
---- a/racket/src/README.txt
-+++ b/racket/src/README.txt
-@@ -354,6 +354,10 @@ variant of MinGW without "libdelayimp.a", get the implementation of
- ========================================================================
-
- Cross-compilation requires at least two flags to `configure`:
-+`--host=OS` and either `--enable-racket=RACKET` or (for Racket CS)
-+`--enable-scheme-SCHEME`.
-+
-+More information:
-
- * `--host=OS`, where OS is something like `i386-gnu-linux` to
- indicate the target platform.
-@@ -374,11 +378,27 @@ Cross-compilation requires at least two flags to `configure`:
- run `configure` again (with no arguments) in a "local" subdirectory
- to create a build for the current platform.
-
--An additional flag is needed for building Racket CS, unless the flag
--`--enable-racket=auto` is used:
--
-- * `--enable-scheme=DIR`, where DIR is a path that has a "ChezScheme"
-- directory where Chez Scheme is built for the host system.
-+ * `--enable-scheme=SCHEME`, where SCHEME is a Chez Scheme executable
-+ executable that runs on the build platform; the executable must be
-+ the same version as used in Racket built for the target platform.
-+
-+ Supplying `--enable-scheme=DIR` is also supported in cross-build
-+ mode, where DIR is a path that has a "ChezScheme" directory where
-+ Chez Scheme is built for the host system.
-+
-+The `--enable-racket=RACKET` and `--enable-scheme=SCHEME` flags are
-+allowed for non-cross builds, too:
-+
-+ * For Racket CS, supplying either selects a Racket or Chez Scheme
-+ implementation used to create boot files to the build platform.
-+ Suppling Chez Scheme is a much more direct path, but when Racket is
-+ supplied, its version does not have to match the version being
-+ built.
-+
-+ * For Racket BC, `--enable-racket=RACKET` selects a Racket for
-+ prepare C sources to cooperate with garbage collection. Its version
-+ needs to be close to the one being built, and potentially exactly
-+ the same version.
-
- Some less commonly needed `configure` flags are for Racket BC:
-
-diff --git a/racket/src/configure b/racket/src/configure
-index c9f3ba4419..1b53ec7ce2 100755
---- a/racket/src/configure
-+++ b/racket/src/configure
-@@ -9,6 +9,7 @@ pb_dir="$dir/ChezScheme/boot/pb"
- use_cs=maybe
- use_bc=maybe
- supplied_racket=no
-+supplied_scheme=no
- enable_boothelp=
-
- # We don't have to detect conflicts like `--enable-csdefault --enable-bcdefault`,
-@@ -34,6 +35,9 @@ for arg in $*; do
- --enable-racket=*)
- supplied_racket=yes
- ;;
-+ --enable-scheme=*)
-+ supplied_scheme=yes
-+ ;;
- --help | -h)
- echo $0:
- echo see --help-bc or --help-cs, since the Racket CS build and the
-@@ -70,8 +74,8 @@ elif test "$use_cs" = "maybe" ; then
- fi
-
- if test "$use_cs" = "yes" ; then
-- if test $use_bc = no -a $supplied_racket = no -a ! -d "$pb_dir" ; then
-- echo $0: must have $pb_dir or --enable-racket=... for --enable-csonly
-+ if test $use_bc = no -a $supplied_racket = no -a $supplied_scheme = no -a ! -d "$pb_dir" ; then
-+ echo $0: must have $pb_dir, --enable-racket=... or --enable-scheme=... for --enable-csonly
- exit 1
- fi
-
-diff --git a/racket/src/cs/README.txt b/racket/src/cs/README.txt
-index 2ece417b78..8e6fc57b74 100644
---- a/racket/src/cs/README.txt
-+++ b/racket/src/cs/README.txt
-@@ -39,6 +39,11 @@ build:
- installed in the "../ChezScheme/boot/pb" directory as described by
- "../ChezScheme/BUILDING".
-
-+ Supplying `--enable-scheme=...` is also an option if you alerady
-+ have the same version of Chez Scheme built on the current platform.
-+ Another build will be created, anyway, but more quickly than
-+ without Chez Scheme.
-+
- * Racket is needed to generate the files in the "schemified"
- directory from the sources in sibling directories like "../io". The
- Racket version must be practically the same as the current Racket
-@@ -48,7 +53,6 @@ build:
- Unlike Chez Scheme boot files, the files generated in "schemified"
- are human-readable and -editable Scheme code. That provides a way
- out of bootstrapping black holes, even without BC.
--
-
-
- ========================================================================
-diff --git a/racket/src/cs/c/Makefile.in b/racket/src/cs/c/Makefile.in
-index 54a644a1d9..d73993f0fc 100644
---- a/racket/src/cs/c/Makefile.in
-+++ b/racket/src/cs/c/Makefile.in
-@@ -12,7 +12,9 @@ CS_HOST_WORKAREA_PREFIX = @CS_HOST_WORKAREA_PREFIX@
- SCHEME_HOST_WORKAREA = $(CS_HOST_WORKAREA_PREFIX)$(SCHEME_WORKAREA)
- SCHEME_BIN = $(SCHEME_HOST_WORKAREA)/$(MACH)/bin/$(MACH)/scheme
- SCHEME_INC = $(SCHEME_HOST_WORKAREA)/$(MACH)/boot/$(MACH)
--SCHEME = $(SCHEME_BIN) -B $(SCHEME_INC)/petite.boot -B $(SCHEME_INC)/scheme.boot
-+SCHEME_built = $(SCHEME_BIN) -B $(SCHEME_INC)/petite.boot -B $(SCHEME_INC)/scheme.boot
-+SCHEME_existing = @MAKE_SCHEME_SCHEME@
-+SCHEME = $(SCHEME@USE_SCHEME_MODE@)
-
- TARGET_MACH = @TARGET_MACH@
- SCHEME_TARGET_INC = $(SCHEME_WORKAREA)/$(TARGET_MACH)/boot/$(TARGET_MACH)
-@@ -88,7 +90,7 @@ mainsrcdir = @srcdir@/../..
- @INCLUDEDEP@ @srcdir@/../../version/version.mak
-
- cs:
-- $(MAKE) scheme@T_CROSS_MODE@
-+ $(MAKE) scheme@MAKE_SCHEME_MODE@
- $(MAKE) racket-so
- cd rktio; $(MAKE)
- $(MAKE) racketcs
-@@ -121,9 +123,13 @@ racket-so:
-
- RACKET_SO_ENV = @CONFIGURE_RACKET_SO_COMPILE@
-
-+TARGET_MACH_built = $(TARGET_MACH)
-+TARGET_MACH_existing = xc-$(TARGET_MACH)
-+XPATCH_FILE = $(SCHEME_WORKAREA)/$(TARGET_MACH@USE_SCHEME_MODE@)/s/xpatch
-+
- CS_PROGS = SCHEME="$(SCHEME)"
- CS_OPTS = COMPRESS_COMP=@COMPRESS_COMP@ @ENABLE_OR_DISABLE_WPO@
--CS_OPTScross = $(CS_OPTS) CSO=$(MACH) CROSS_COMP="--xpatch $(SCHEME_WORKAREA)/$(TARGET_MACH)/s/xpatch"
-+CS_OPTScross = $(CS_OPTS) CSO=$(MACH) CROSS_COMP="--xpatch $(XPATCH_FILE)"
- PASS_COMPILE_DEPS = EXTRA_COMPILE_DEPS="$(SCHEME_INC)/petite.boot $(SCHEME_INC)/scheme.boot"
-
- build-racket-so:
-@@ -163,6 +169,15 @@ pb-bootquick:
- cd $(SCHEME_WORKAREA) && $(MAKE) reset
- $(SHELL) $(srcdir)/ready_boot.sh $(MACH) $(SCHEME_WORKAREA)
-
-+scheme-via-scheme:
-+ $(MAKE) $(SCHEME_WORKAREA)/boot/$(MACH)/scheme.boot
-+ $(MAKE) mach-make
-+
-+$(SCHEME_WORKAREA)/boot/$(MACH)/scheme.boot:
-+ mkdir -p $(SCHEME_WORKAREA)
-+ $(MAKE) config-scheme CONFIG_SCHEME_MODE="$(CONFIG_SCHEME_MODE) --force"
-+ cd $(SCHEME_WORKAREA) && $(MAKE) $(MACH).boot Scheme="$(SCHEME)" SCHEMEHEAPDIRS=: o=3 d=0 what=all
-+
- mach-make:
- $(MAKE) config-scheme
- cd $(SCHEME_WORKAREA) && $(MAKE)
-@@ -182,24 +197,33 @@ config-scheme:
-
- scheme-cross:
- env MAKE_BOOT_FOR_CROSS=yes SCHEME_SRC="$(SCHEME_DIR)" SCHEME_WORKAREA=$(SCHEME_WORKAREA) MACH="$(TARGET_MACH)" $(BOOTSTRAP_RACKET) "$(SCHEME_DIR)"/rktboot/make-boot.rkt
-+ $(MAKE) finish-scheme-cross
-+
-+finish-scheme-cross:
- $(SHELL) $(srcdir)/reset_boot.sh $(TARGET_MACH) $(SCHEME_WORKAREA)
- cd $(SCHEME_WORKAREA) && "$(UP_SCHEME_DIR)"/configure @SCHEME_CROSS_CONFIG_ARGS@ $(SCHEME_CONFIG_VARS)
- cd $(SCHEME_WORKAREA)/$(TARGET_MACH)/c && $(CHOST_HACK@T_CROSS_MODE@) $(MAKE) o=o cross=t
-- $(MAKE) $(SCHEME_WORKAREA)/$(TARGET_MACH)/s/xpatch
-+ $(MAKE) $(XPATCH_FILE)
-+
-+scheme-cross-via-scheme:
-+ $(MAKE) $(SCHEME_WORKAREA)/boot/$(TARGET_MACH)/scheme.boot MACH=$(TARGET_MACH)
-+ $(MAKE) finish-scheme-cross
-
- # Rebuild patch file and cross "petite.boot" and "scheme.boot" when older
--# than the build-host "scheme.boot" or when "make-boot.rkt" touchs dummy boot files
--XPATCH_DEPS = $(SCHEME_HOST_WORKAREA)/$(MACH)/boot/$(MACH)/scheme.boot \
-- $(SCHEME_WORKAREA)/boot/$(TARGET_MACH)/scheme.boot
-+# than the build-<host "scheme.boot" or when "make-boot.rkt" touchs dummy boot files
-+XPATCH_DEPS_built = $(SCHEME_HOST_WORKAREA)/$(MACH)/boot/$(MACH)/scheme.boot \
-+ $(SCHEME_WORKAREA)/boot/$(TARGET_MACH)/scheme.boot
-+XPATCH_DEPS_existing =
-+XPATCH_DEPS = $(XPATCH_DEPS@USE_SCHEME_MODE@)
-
--$(SCHEME_WORKAREA)/$(TARGET_MACH)/s/xpatch: $(XPATCH_DEPS)
-+$(XPATCH_FILE): $(XPATCH_DEPS)
- $(MAKE) bounce TARGET=build-xpatch-using-host
-
- build-xpatch-using-host:
- cd $(SCHEME_WORKAREA)/$(TARGET_MACH)/s && $(MAKE) -f Mf-cross m=$(MACH) xm=$(TARGET_MACH) Scheme="$(SCHEME_BIN)" SCHEMEHEAPDIRS="$(SCHEME_INC)"
-
- XPATCH =
--XPATCHcross = --xpatch $(SCHEME_WORKAREA)/$(TARGET_MACH)/s/xpatch
-+XPATCHcross = --xpatch $(XPATCH_FILE)
-
- racket.boot: racket.so
- $(SCHEME) --script $(srcdir)/convert-to-boot.ss @BOOT_COMPRESS_COMP@ $(XPATCH@CROSS_MODE@) racket.so racket.boot $(TARGET_MACH)
-@@ -410,7 +434,7 @@ install-cross:
- $(MAKE) compile-xpatch.$(TARGET_MACH)
- $(MAKE) library-xpatch.$(TARGET_MACH)
-
--SCHEME_XPATCH = $(SCHEME_WORKAREA)/$(TARGET_MACH)/s/xpatch
-+SCHEME_XPATCH = $(XPATCH_FILE)
-
- CROSS_SERVE_DEPS = $(srcdir)/mk-cross-serve.ss $(srcdir)/cross-serve.ss \
- $(srcdir)/../expander/env.ss $(srcdir)/../linklet/config.ss
-diff --git a/racket/src/cs/c/configure b/racket/src/cs/c/configure
-index 21695a431a..1eeef57753 100755
---- a/racket/src/cs/c/configure
-+++ b/racket/src/cs/c/configure
-@@ -654,6 +654,9 @@ MINGW
- NOT_OSX
- OSX
- SETUP_BOOT_MODE
-+USE_SCHEME_MODE
-+MAKE_SCHEME_SCHEME
-+MAKE_SCHEME_MODE
- TT_CROSS_MODE
- T_CROSS_MODE
- CROSS_MODE
-@@ -1448,7 +1451,7 @@ Optional Features:
- --enable-docs build docs on install (enabled by default)
- --enable-usersetup setup user-specific files on install
- --enable-racket=<path> use <path> as Racket for build; or "auto" to create
-- --enable-scheme=<path> use <path> as host's build directory for cross
-+ --enable-scheme=<path> use <path> as host build for cross
- --enable-mach=<mach> use Chez Scheme machine type <mach>
- --enable-target=<mach> cross-build for Chez Scheme machine type <mach>
- --enable-portable prefer portable to host-specific
-@@ -2867,7 +2870,7 @@ show_explicitly_enabled "${enable_xonx}" "Unix style"
- show_explicitly_enabled "${enable_libzo}" 'Compiled ".zo" files moved to lib'
-
- show_explicitly_set "${enable_racket}" "Racket"
--show_explicitly_set "${enable_scheme}" "Chez Scheme build directory"
-+show_explicitly_set "${enable_scheme}" "Chez Scheme for build"
- show_explicitly_set "${enable_mach}" "machine type"
- show_explicitly_set "${enable_target}" "cross-build machine type"
- show_explicitly_enabled "${enable_portable}" "portable"
-@@ -4745,9 +4748,21 @@ esac
-
- SCHEME_DIR=${srcdir}/../../ChezScheme
- MAKE_BUILD_SCHEME=checkout
-+USE_SCHEME_MODE="_built"
-+MAKE_SCHEME_MODE="${T_CROSS_MODE}"
-
- if test "${enable_scheme}" != "" ; then
-- CS_HOST_WORKAREA_PREFIX="${enable_scheme}/"
-+ if test -d "${enable_scheme}" ; then
-+ # Directory exists, so use it as a build directory
-+ echo "Using supplied Scheme path as a build directory"
-+ CS_HOST_WORKAREA_PREFIX="${enable_scheme}/"
-+ else
-+ # Directory does not exist, so assume it's an executable
-+ echo "Using supplied Scheme path as an executable"
-+ MAKE_SCHEME_MODE="${T_CROSS_MODE}-via-scheme"
-+ MAKE_SCHEME_SCHEME="${enable_scheme}"
-+ USE_SCHEME_MODE="_existing"
-+ fi
- fi
-
- if test "${enable_racket}" != "" ; then
-@@ -6012,6 +6027,9 @@ SCHEME_CROSS_CONFIG_ARGS="--machine=${TARGET_MACH} --disable-x11 ${cs_auto_flags
-
-
-
-+
-+
-+
-
-
-
-diff --git a/racket/src/cs/c/configure.ac b/racket/src/cs/c/configure.ac
-index 464ebe1760..aaee88156d 100644
---- a/racket/src/cs/c/configure.ac
-+++ b/racket/src/cs/c/configure.ac
-@@ -23,7 +23,7 @@ AC_ARG_ENABLE(compressmore, [ --enable-compressmore compress compiled code ev
- AC_ARG_ENABLE(compressboot, [ --enable-compressboot compress boot files])
- m4_include(../ac/path_arg.m4)
- AC_ARG_ENABLE(racket, [ --enab
This message was truncated. Download the full message here.
P
P
Philip McGrath wrote on 12 May 2022 07:26
Re: [PATCH v3 8/9] gnu: chez-scheme-for-racket: Fix supported systems.
885eb0ab-e5a5-fa20-3aeb-ade167775a28@philipmcgrath.com
Hi,

On 5/9/22 05:36, Liliana Marie Prikler wrote:
Toggle quote (25 lines)
> Hi,
>
> Am Montag, dem 09.05.2022 um 03:55 -0400 schrieb Philip McGrath:
>> Concretely, there are no other uses in Guix.
>>
>> I do not know a robust, correct way to use
>> 'nix-system->chez-machine'---certainly not without it growing many
>> additional features, like maybe computing endianness for pbarch
>> backends when we are able to build them. For example, if we continued
>> using it as we did in 'stex', you couldn't build a package graph for
>> nonthreaded Chez simply by applying a package transformation to
>> remove '--threads' from its '#:configure-flags', because that would
>> change the machine type without updating the uses of 'nix-system-
>>> chez-machine'.
> True, you would have to change the machine type, but I think I already
> noted that we might want to use this machine type as a distinguishing
> factor in packages built on top of chez (and later chez-build-system
> perhaps). You could do this the other way round by deriving flags from
> the given machine-type, e.g. stex for threaded chez machine is given --
> threads, otherwise it's not. Since we have named symbols for these
> features, we could have a "package-with-chez-features" or similar
> transformer. Being able to specify this machine is a strength, not a
> weakness.
>

I can imagine something like this might be useful eventually. My problem
is that, right now, 'nix-system->chez-machine' is an attractive
nuisance: it sounds useful, but I don't know any way of using it that
wouldn't be subtly wrong. I don't even feel certain even about what
cases 'nix-system->chez-machine' would need to cover to be correct and
useful: a fair amount seems to depend on what turns out to be necessary
for cross-compilation and the portable bytecode architectures (which I
hope to work out by July).


Toggle quote (8 lines)
>> The idea is that the "portable bytecode" backends should work,
>> including thread support, on any system with a reasonably capable C
>> compiler.
> The idea. In practice, what racket deems reasonably capable can change
> over time and might result in them dropping some architectures
> currently supported. What do you do then?
>

I mean, "over time", at the extreme, anything "might" happen, but I
don't think that's worth worrying about. Racket has an extremely strong
commitment to backwards compatibility. To pick one example, support
libraries for racket/draw and racket/gui are still maintained for
ppc-macosx, which the vendor hasn't released any software for in a
decade or more (depending on how you prefer to count). The C code
deliberately does not require C99 support.

>> The presence of an entry in '%chez-features-table' explicitly means
>> that 'chez-scheme-for-racket' can generate native code.
> That is not explicit at all. There might be an explicit comment
> stating so somewhere, but in terms of actual code, it's super
> implicit.
>

Toggle quote (11 lines)
>> There are no other "features" that vary among systems for
>> 'chez-scheme-for-racket'. It doesn't rely on pre-built bootfiles for
>> bootstrapping. Since the initial fork at the beginning of 2017, when
>> support for new systems has been added, native threads have been
>> supported immediately. Racket regularly merges all changes from
>> upstream Chez (which has not added any supported systems during that
>> time---not even the systems added already in Racket's variant).
> I'd still make "supported-by-racket" or however else you decide to name
> that feature an explicit part of that table rather than an implicit
> one, or use a separate "table" for platforms supported by racket.

I really don't understand how this would be helpful. I don't think it
would make sense for a list returned by
chez-upstream-features-for-system to include a symbol
supported-by-racket, which has nothing to do with *upstream* features.
Aside from that, we would be adding this symbol to every single entry in
%chez-features-table. That would imply turning all of the #f entries
into (supported-by-racket), and then we would need some other solution
for identifying platforms with no support upstream.

Toggle quote (5 lines)
> Note
> that none of the racket-vm packages appear to currently carry
> supported-systems, which seems dubious.
>

The only constraint on the systems supported by 'racket-vm-cs' is from
'chez-scheme-for-racket'---i.e., the trouble with `configure` for
systems without a native-code backend, which should be fixed by the next
release, if not before. I expect the fact that the
'chez-scheme-for-racket' input is not supported to work as an
alternative to duplicating the filtering in its supported-systems field
(which I think would create a cyclic dependency issue).

AFAIK, 'racket-vm-cgc' and 'racket-vm-bc' should work everywhere (though
possibly without the JIT, futures, and/or places) except that support
for aarch64-macosx is prohibitively poor (IIUC due to W^X issues), which
is fairly irrelevant for Guix.

-Philip
L
L
Liliana Marie Prikler wrote on 12 May 2022 10:04
d400458ead61020e9e354fcc52c8c81fe95ac084.camel@ist.tugraz.at
Hi,

Am Donnerstag, dem 12.05.2022 um 01:26 -0400 schrieb Philip McGrath:
Toggle quote (15 lines)
> > True, you would have to change the machine type, but I think I
> > already noted that we might want to use this machine type as a
> > distinguishing factor in packages built on top of chez (and later
> > chez-build-system perhaps).  You could do this the other way round by
> > deriving flags from the given machine-type, e.g. stex for threaded
> > chez machine is given -- threads, otherwise it's not.  Since we have
> > named symbols for these features, we could have a "package-with-chez-
> > features" or similar transformer.  Being able to specify this machine
> > is a strength, not a weakness.
> >
>
> I can imagine something like this might be useful eventually. My
> problem is that, right now, 'nix-system->chez-machine' is an attractive
> nuisance: it sounds useful, but I don't know any way of using it that
> wouldn't be subtly wrong. 
Your 6/9 patch imho erases a use that wouldn't have been wrong.
Certainly not if we add extra features to it or use inference at build
time.

For instance
(let* ((base-system #$(nix-system->chez-machine 
(or (%current-target-system) 
(%current-system))))
(threaded? (member "--threads" configure-flags))
(portable-bytecode? [however you would determine that])
(actual-machine (string-append ...)))
[code that uses actual-machine])
would be an alternative if you want actual-machine inferred by compile
options rather than earlier on.

Toggle quote (5 lines)
> I don't even feel certain even about what cases 'nix-system->chez-
> machine' would need to cover to be correct
> and useful: a fair amount seems to depend on what turns out to be
> necessary for cross-compilation and the portable bytecode
> architectures (which I hope to work out by July).
From my POV it is already enough if we can do the basic translation
with nix-system->chez-machine. Additional features like threads or
portable bytecode would be nice to have, but if you feel that it'd be
"subtly wrong" to add them (or not to add them), you can feel free to
add or omit them as you like.

Toggle quote (10 lines)
> > I'd still make "supported-by-racket" or however else you decide to
> > name that feature an explicit part of that table rather than an
> > implicit one, or use a separate "table" for platforms supported by
> > racket.
>
> I really don't understand how this would be helpful. I don't think it
> would make sense for a list returned by
> chez-upstream-features-for-system to include a symbol
> supported-by-racket, which has nothing to do with *upstream*
> features.
For one, that procedure would be free to filter features as it needs so
that it doesn't return racket-specific symbols, but more importantly if
you do feel that using this table to report racket support explicitly
is abuse, how is it not abuse if you report it implicitly?

Toggle quote (4 lines)
> Aside from that, we would be adding this symbol to every single entry
> in %chez-features-table. That would imply turning all of the #f
> entries into (supported-by-racket), and then we would need some other
> solution for identifying platforms with no support upstream.
If I read this table correctly, there is no entry, that does not have
either 'threads or 'bootstrap-bootfiles. So null? after filtering
racket features would work. If this is ever violated, e.g. we find an
arch that has neither bootstrap nor threads, but is still supported by
upstream, we could add an explicit 'basic-upstream-support feature to
the table.

Toggle quote (7 lines)
> > Note that none of the racket-vm packages appear to currently carry
> > supported-systems, which seems dubious.
>
> The only constraint on the systems supported by 'racket-vm-cs' is
> from 'chez-scheme-for-racket'---i.e., the trouble with `configure`
> for systems without a native-code backend, which should be fixed by
> the next release, if not before. 
Let's just assume that to be true. Even if so, why is "supported by
racket" the condition for which we check rather than "not supported by
upstream"? Seems kinda counterintuitive if racket supposedly supports
all arches while chez itself does not.

Toggle quote (4 lines)
> I expect the fact that the 'chez-scheme-for-racket' input is not
> supported to work as an alternative to duplicating the filtering in
> its supported-systems field (which I think would create a cyclic
> dependency issue).
You might want to rephrase that sentence. I have no idea what you're
trying to get across here.


Cheers
L
L
Ludovic Courtès wrote on 12 May 2022 12:32
Re: bug#55248: [PATCH 0/7] gnu: Update Racket to 8.5 and Chez Scheme to 9.5.8.
(name . Philip McGrath)(address . philip@philipmcgrath.com)
87v8ubkpni.fsf_-_@gnu.org
Hello,

Philip McGrath <philip@philipmcgrath.com> skribis:

Toggle quote (10 lines)
> gnu: racket: Update to 8.5.
> gnu: racket: Fix out-of-source build.
> gnu: chez-scheme: Update to 9.5.8.
> gnu: chez-scheme: Refactor documentation phases.
> gnu: chez-scheme: Refactor configure phase and fix '--threads'.
> gnu: stex: Get machine type dynamically.
> gnu: chez-upstream-features-for-system: Improve implementation.
> gnu: chez-scheme-for-racket: Fix supported systems.
> gnu: chez-scheme-for-system: Adjust for bytecode backend.

Pushed the whole series (including v4 for the first patch) as
3547bb6a66c32eb1deac46a98b40e2e051689ed3. It seems to work like a
charm. :-)

Thanks!

Ludo’.
Closed
?