unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#70065] [PATCH 0/6] gnu: Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9.
@ 2024-03-29  5:15 Philip McGrath
  2024-03-29  5:18 ` [bug#70065] [PATCH 1/6] gnu: zuo: Update to 1.9 Philip McGrath
                   ` (6 more replies)
  0 siblings, 7 replies; 39+ messages in thread
From: Philip McGrath @ 2024-03-29  5:15 UTC (permalink / raw)
  To: 70065; +Cc: Philip McGrath, Philip McGrath

Hi,

This patch series updates packages to Racket 8.12, Chez Scheme 10.0.0,
and Zuo 1.9.

As announced in <https://groups.google.com/g/chez-scheme/c/D7g6mIcYLNU>,
all of the changes from Racket's branch have been merged into upstream
Chez Scheme, forming the basis for the 10.0.0 release.

Since Chez Scheme 10.0.0 also uses Zuo for build scripting, Zuo will now be
getting tagged releases in its own Git repository, independent of the Racket
release cycle.

These exciting developments mean that this series has a larger diff than a
typical Racket update, as I've tried to remove much of the complexity from
packagine two diverging forks of Chez Scheme. In particular, the last commit
in the series bootstraps Chez Scheme 10.0.0 from source.

 -Philip

Philip McGrath (6):
  gnu: zuo: Update to 1.9.
  gnu: racket: Update to 8.12.
  gnu: chez-scheme: Reorganize package definitions.
  gnu: chez-scheme: Update to 10.0.0.
  gnu: chez-scheme: Update and simplify machine-type handling.
  gnu: chez-scheme: Bootstrap from source.

 gnu/local.mk                                  |    9 +-
 gnu/packages/chez.scm                         | 1019 ++++++++---------
 gnu/packages/emacs-xyz.scm                    |    2 +-
 .../chez-scheme-backport-configure.patch      |  463 ++++++++
 gnu/packages/patches/chez-scheme-bin-sh.patch |   37 +-
 .../racket-backport-8.11-layered-docs.patch   |   36 -
 .../racket-backport-8.12-chez-configure.patch |  423 +++++++
 .../patches/racket-chez-scheme-bin-sh.patch   |   21 +-
 .../patches/racket-rktio-bin-sh.patch         |   17 +-
 ...cket-zuo-bin-sh.patch => zuo-bin-sh.patch} |   33 +-
 gnu/packages/racket.scm                       |  143 +--
 11 files changed, 1522 insertions(+), 681 deletions(-)
 create mode 100644 gnu/packages/patches/chez-scheme-backport-configure.patch
 delete mode 100644 gnu/packages/patches/racket-backport-8.11-layered-docs.patch
 create mode 100644 gnu/packages/patches/racket-backport-8.12-chez-configure.patch
 rename gnu/packages/patches/{racket-zuo-bin-sh.patch => zuo-bin-sh.patch} (72%)


base-commit: 0e8f7ee3a95011dd9ebdc99e0f3b754160524b5d
-- 
2.41.0





^ permalink raw reply	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH 1/6] gnu: zuo: Update to 1.9.
  2024-03-29  5:15 [bug#70065] [PATCH 0/6] gnu: Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9 Philip McGrath
@ 2024-03-29  5:18 ` Philip McGrath
  2024-03-30 14:31   ` Skyler Ferris via Guix-patches via
  2024-03-29  5:18 ` [bug#70065] [PATCH 2/6] gnu: racket: Update to 8.12 Philip McGrath
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 39+ messages in thread
From: Philip McGrath @ 2024-03-29  5:18 UTC (permalink / raw)
  To: 70065; +Cc: Philip McGrath

Zuo now has tagged releases independent of the Racket release cycle.

* gnu/packages/patches/racket-zuo-bin-sh.patch: Move to ...
* gnu/packages/patches/zuo-bin-sh.patch: ... this file, and refresh it.
* gnu/local.mk (dist_patch_DATA): Update accordingly.
* gnu/packages/racket/scm (%racket-origin)[patches]: Likewise.
* gnu/packages/patches/racket-chez-scheme-bin-sh.patch: Refresh patch.
* gnu/packages/patches/racket-rktio-bin-sh.patch: Likewise.
* gnu/packages/racket/scm (%zuo-version): Move to ...
(zuo)[version]: ... this field, and update to 1.9.
[source]: Change to the repository where Zuo releases are tagged.
[arguments]: Stop supplying '#:phases'.

Change-Id: Ia82c0f7a8e4696ae08e30965e3f4ec85673b86e5
---
 gnu/local.mk                                  |  4 +-
 .../patches/racket-chez-scheme-bin-sh.patch   | 21 +++++---
 .../patches/racket-rktio-bin-sh.patch         | 17 +++---
 ...cket-zuo-bin-sh.patch => zuo-bin-sh.patch} | 33 +++++++-----
 gnu/packages/racket.scm                       | 54 +++++++++----------
 5 files changed, 70 insertions(+), 59 deletions(-)
 rename gnu/packages/patches/{racket-zuo-bin-sh.patch => zuo-bin-sh.patch} (72%)

diff --git a/gnu/local.mk b/gnu/local.mk
index 5429dc498c..a025276390 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1984,7 +1984,6 @@ dist_patch_DATA =						\
   %D%/packages/patches/racket-chez-scheme-bin-sh.patch		\
   %D%/packages/patches/racket-backport-8.11-layered-docs.patch	\
   %D%/packages/patches/racket-rktio-bin-sh.patch		\
-  %D%/packages/patches/racket-zuo-bin-sh.patch			\
   %D%/packages/patches/remake-impure-dirs.patch			\
   %D%/packages/patches/restartd-update-robust.patch             \
   %D%/packages/patches/restic-0.9.6-fix-tests-for-go1.15.patch	\
@@ -2225,7 +2224,8 @@ dist_patch_DATA =						\
   %D%/packages/patches/zig-do-not-link-against-librt.patch	\
   %D%/packages/patches/zig-use-baseline-cpu-by-default.patch	\
   %D%/packages/patches/zig-use-system-paths.patch		\
-  %D%/packages/patches/zsh-egrep-failing-test.patch
+  %D%/packages/patches/zsh-egrep-failing-test.patch		\
+  %D%/packages/patches/zuo-bin-sh.patch
 
 MISC_DISTRO_FILES =				\
   %D%/packages/ld-wrapper.in
diff --git a/gnu/packages/patches/racket-chez-scheme-bin-sh.patch b/gnu/packages/patches/racket-chez-scheme-bin-sh.patch
index 331b4f244b..e77c26f303 100644
--- a/gnu/packages/patches/racket-chez-scheme-bin-sh.patch
+++ b/gnu/packages/patches/racket-chez-scheme-bin-sh.patch
@@ -1,4 +1,4 @@
-From f86370295c5bb14d4bb93d0ccfa37a2b79f19f25 Mon Sep 17 00:00:00 2001
+From 5398e6d3305def343a009aba7c5f8915851c4115 Mon Sep 17 00:00:00 2001
 From: Philip McGrath <philip@philipmcgrath.com>
 Date: Wed, 24 Aug 2022 19:55:14 -0400
 Subject: [PATCH] Chez Scheme: patch s_process for "/bin/sh" on Guix
@@ -14,17 +14,22 @@ then `s_process` will call `execl` with the file specified by
 `_PATH_BSHELL` instead of "/bin/sh".
 
 Checking that the path specified by `_PATH_BSHELL` exists safeguards
-against obscure errors if attempting to use stand-alone executables
-built by the patched Racket in non-Guix envoronments.
+against obscure errors if attempting to use the patched Chez Scheme
+or executables it builds in non-Guix envoronments.
 
 This patch does not change the behavior of `s_system`, which relies
 on `system` from the C library.
 ---
+
+Notes:
+    See also chez-scheme-bin-sh.patch, racket-rktio-bin-sh.patch,
+    and zuo-bin-sh.patch.
+
  racket/src/ChezScheme/c/prim5.c | 21 ++++++++++++++++++++-
  1 file changed, 20 insertions(+), 1 deletion(-)
 
 diff --git a/racket/src/ChezScheme/c/prim5.c b/racket/src/ChezScheme/c/prim5.c
-index 82bbf8d687..be8f603447 100644
+index 90b087f125..284f063f8b 100644
 --- a/racket/src/ChezScheme/c/prim5.c
 +++ b/racket/src/ChezScheme/c/prim5.c
 @@ -27,6 +27,12 @@
@@ -40,7 +45,7 @@ index 82bbf8d687..be8f603447 100644
  /* locally defined functions */
  static INT s_errno(void);
  static IBOOL s_addr_in_heap(uptr x);
-@@ -861,6 +867,17 @@ static ptr s_process(char *s, IBOOL stderrp) {
+@@ -875,6 +881,17 @@ static ptr s_process(char *s, IBOOL stderrp) {
  
      INT tofds[2], fromfds[2], errfds[2];
      struct sigaction act, oint_act;
@@ -58,7 +63,7 @@ index 82bbf8d687..be8f603447 100644
  
      if (pipe(tofds)) S_error("process","cannot open pipes");
      if (pipe(fromfds)) {
-@@ -897,7 +914,9 @@ static ptr s_process(char *s, IBOOL stderrp) {
+@@ -911,7 +928,9 @@ static ptr s_process(char *s, IBOOL stderrp) {
            }
          }
  #endif /* __GNU__ Hurd */
@@ -70,7 +75,7 @@ index 82bbf8d687..be8f603447 100644
          /*NOTREACHED*/
      } else {
 
-base-commit: 87eee6e2adb8c6bc11e60619c706fa6295096085
+base-commit: 78fef00d4d16a79fdf6ab31924b3a80cadf4b368
 -- 
-2.32.0
+2.41.0
 
diff --git a/gnu/packages/patches/racket-rktio-bin-sh.patch b/gnu/packages/patches/racket-rktio-bin-sh.patch
index ec6f0d9c56..d777c0979a 100644
--- a/gnu/packages/patches/racket-rktio-bin-sh.patch
+++ b/gnu/packages/patches/racket-rktio-bin-sh.patch
@@ -1,4 +1,4 @@
-From 6a553f24439fe64fd3a2f0b5902f00590ca4241f Mon Sep 17 00:00:00 2001
+From 5e546a30789e5c9b3c94674b94cb63e16ee2e951 Mon Sep 17 00:00:00 2001
 From: Philip McGrath <philip@philipmcgrath.com>
 Date: Thu, 4 Mar 2021 04:11:50 -0500
 Subject: [PATCH] rktio: patch rktio_process for "/bin/sh" on Guix
@@ -28,11 +28,16 @@ Checking that the path specified by `_PATH_BSHELL` exists safeguards
 against obscure errors if attempting to use stand-alone executables
 built by the patched Racket in non-Guix envoronments.
 ---
+
+Notes:
+    See also chez-scheme-bin-sh.patch, racket-chez-scheme-bin-sh.patch,
+    and zuo-bin-sh.patch.
+
  racket/src/rktio/rktio_process.c | 17 ++++++++++++++++-
  1 file changed, 16 insertions(+), 1 deletion(-)
 
 diff --git a/racket/src/rktio/rktio_process.c b/racket/src/rktio/rktio_process.c
-index fafaf728c1..796ebc59ce 100644
+index 862850d93a..87daafef76 100644
 --- a/racket/src/rktio/rktio_process.c
 +++ b/racket/src/rktio/rktio_process.c
 @@ -9,6 +9,7 @@
@@ -43,7 +48,7 @@ index fafaf728c1..796ebc59ce 100644
  # ifdef USE_ULIMIT
  #  include <ulimit.h>
  # endif
-@@ -1301,12 +1302,14 @@ int rktio_process_allowed_flags(rktio_t *rktio)
+@@ -1358,12 +1359,14 @@ int rktio_process_allowed_flags(rktio_t *rktio)
  /*========================================================================*/
  
  rktio_process_result_t *rktio_process(rktio_t *rktio,
@@ -59,7 +64,7 @@ index fafaf728c1..796ebc59ce 100644
    rktio_process_result_t *result;
    intptr_t to_subprocess[2], from_subprocess[2], err_subprocess[2];
    int pid;
-@@ -1333,6 +1336,18 @@ rktio_process_result_t *rktio_process(rktio_t *rktio,
+@@ -1390,6 +1393,18 @@ rktio_process_result_t *rktio_process(rktio_t *rktio,
    int i;
  #endif
  
@@ -79,7 +84,7 @@ index fafaf728c1..796ebc59ce 100644
    to_subprocess[0] = -1;
    to_subprocess[1] = -1;
 
-base-commit: 9d228d16fb99c274c964e5bef93e97333888769f
+base-commit: 78fef00d4d16a79fdf6ab31924b3a80cadf4b368
 -- 
-2.32.0
+2.41.0
 
diff --git a/gnu/packages/patches/racket-zuo-bin-sh.patch b/gnu/packages/patches/zuo-bin-sh.patch
similarity index 72%
rename from gnu/packages/patches/racket-zuo-bin-sh.patch
rename to gnu/packages/patches/zuo-bin-sh.patch
index bcdcb8e963..92e3774424 100644
--- a/gnu/packages/patches/racket-zuo-bin-sh.patch
+++ b/gnu/packages/patches/zuo-bin-sh.patch
@@ -1,7 +1,7 @@
-From 73d9b77a11b4516905caf579abb559736f715ea6 Mon Sep 17 00:00:00 2001
+From cd6bed5d22ea9cb7bae2be134d5d04433fc8e313 Mon Sep 17 00:00:00 2001
 From: Philip McGrath <philip@philipmcgrath.com>
 Date: Mon, 11 Apr 2022 20:43:18 -0400
-Subject: [PATCH] Zuo: patch zuo_process for "/bin/sh" on Guix
+Subject: [PATCH] patch zuo_process for "/bin/sh" on Guix
 
 If:
 
@@ -16,17 +16,22 @@ then `zuo_process` will execute the file specified by `_PATH_BSHELL`
 instead of "/bin/sh".
 
 Checking that the path specified by `_PATH_BSHELL` exists safeguards
-against obscure errors if attempting to use stand-alone executables
-built by the patched Racket in non-Guix envoronments.
+against obscure errors if attempting to use the patched Zuo
+or derived executables in non-Guix envoronments.
 ---
- racket/src/zuo/zuo.c | 20 ++++++++++++++++++--
+
+Notes:
+    See also chez-scheme-bin-sh.patch, racket-chez-scheme-bin-sh.patch,
+    racket-rktio-bin-sh.patch.
+
+ zuo.c | 20 ++++++++++++++++++--
  1 file changed, 18 insertions(+), 2 deletions(-)
 
-diff --git a/racket/src/zuo/zuo.c b/racket/src/zuo/zuo.c
-index 17f161826d..c4fb3929bb 100644
---- a/racket/src/zuo/zuo.c
-+++ b/racket/src/zuo/zuo.c
-@@ -15,6 +15,7 @@
+diff --git a/zuo.c b/zuo.c
+index d4163eb..bfc5484 100644
+--- a/zuo.c
++++ b/zuo.c
+@@ -16,6 +16,7 @@
  #include <string.h>
  #include <ctype.h>
  #ifdef ZUO_UNIX
@@ -34,7 +39,7 @@ index 17f161826d..c4fb3929bb 100644
  # include <fcntl.h>
  # include <unistd.h>
  # include <errno.h>
-@@ -5730,7 +5731,10 @@ static void zuo_pipe(zuo_raw_handle_t *_r, zuo_raw_handle_t *_w)
+@@ -5949,7 +5950,10 @@ static void zuo_pipe(zuo_raw_handle_t *_r, zuo_raw_handle_t *_w)
  zuo_t *zuo_process(zuo_t *command_and_args)
  {
    const char *who = "process";
@@ -46,7 +51,7 @@ index 17f161826d..c4fb3929bb 100644
    zuo_t *args = _zuo_cdr(command_and_args), *rev_args = z.o_null;
    zuo_t *options = z.o_empty_hash, *opt;
    zuo_t *dir, *l, *p_handle, *result;
-@@ -5741,7 +5745,19 @@ zuo_t *zuo_process(zuo_t *command_and_args)
+@@ -5960,7 +5964,19 @@ zuo_t *zuo_process(zuo_t *command_and_args)
    void *env;
    int as_child, exact_cmdline;
  
@@ -68,7 +73,7 @@ index 17f161826d..c4fb3929bb 100644
      zuo_t *a = _zuo_car(l);
      if (a == z.o_null) {
 
-base-commit: 87eee6e2adb8c6bc11e60619c706fa6295096085
+base-commit: a0faa82c8383d206aa38d21462ca4ae699851a0b
 -- 
-2.32.0
+2.41.0
 
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index 5c863f1afd..6e19be1da3 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -2,7 +2,7 @@
 ;;; Copyright © 2013-2016, 2018, 2020-2022 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2020 Pierre Neidhardt <mail@ambrevar.xyz>
-;;; Copyright © 2021, 2022, 2023 Philip McGrath <philip@philipmcgrath.com>
+;;; Copyright © 2021-2024 Philip McGrath <philip@philipmcgrath.com>
 ;;; Copyright © 2021 jgart <jgart@dismail.de>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -192,7 +192,6 @@ (define-module (gnu packages racket)
 ;; CODE:
 
 (define %racket-version "8.11.1") ; Remember to update chez-scheme-for-racket!
-(define %zuo-version "1.7") ; defined in racket/src/zuo/zuo.c
 (define %racket-commit
   (string-append "v" %racket-version))
 (define %racket-origin
@@ -206,8 +205,7 @@ (define %racket-origin
     (file-name (git-file-name "racket" %racket-version))
     (patches (search-patches "racket-chez-scheme-bin-sh.patch"
                              "racket-backport-8.11-layered-docs.patch"
-                             "racket-rktio-bin-sh.patch"
-                             "racket-zuo-bin-sh.patch"))
+                             "racket-rktio-bin-sh.patch"))
     (modules '((guix build utils)))
     (snippet
      #~(begin
@@ -229,30 +227,28 @@ (define %racket-origin
 
 
 (define-public zuo
-  (let ((revision #f))
-    (package
-      (name "zuo")
-      (version (string-append %zuo-version
-                              "-racket"
-                              %racket-version
-                              (if revision "-guix" "")
-                              (or revision "")))
-      (source %racket-origin)
-      (outputs '("out" "debug"))
-      (build-system gnu-build-system)
-      (arguments
-       (list
-        #:out-of-source? #t
-        #:phases
-        #~(modify-phases %standard-phases
-            (add-after 'unpack 'chdir
-              (lambda args
-                (chdir "racket/src/zuo"))))))
-      (home-page "https://github.com/racket/zuo")
-      ;; ^ This is downstream of https://github.com/racket/racket,
-      ;; but it's designed to be a friendly landing place
-      (synopsis "Tiny Racket for build scripts")
-      (description "Zuo is a tiny Racket with primitives for dealing
+  (package
+    (name "zuo")
+    (version "1.9") ; defined in racket/src/zuo/zuo.c or the following
+    #;(displayln (~a (hash-ref (runtime-env) 'version) "."
+                     (hash-ref (runtime-env) 'minor-version)))
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/racket/zuo")
+                    (commit (string-append "v" version))))
+              (sha256
+               (base32 "0zasir33nx1qi1ciz9dn6h8k39i443lr6apw5d1i6mjmhpzxmdhp"))
+              (file-name (git-file-name name version))
+              (patches (search-patches "zuo-bin-sh.patch"))))
+    (outputs '("out" "debug"))
+    (build-system gnu-build-system)
+    (arguments
+     (list
+      #:out-of-source? #t))
+    (home-page "https://github.com/racket/zuo")
+    (synopsis "Tiny Racket for build scripts")
+    (description "Zuo is a tiny Racket with primitives for dealing
 with files and running processes.  It comes with a @command{make}-like
 embedded DSL, which is used to build Racket itself.
 
@@ -261,7 +257,7 @@ (define-public zuo
 and expansion of the file content.  That's how the @command{make}-like DSL is
 defined, and even the base Zuo language is defined by layers of @code{#lang}s.
 One of the early layers implements macros.")
-      (license (list license:asl2.0 license:expat)))))
+    (license (list license:asl2.0 license:expat))))
 
 
 (define racket-vm-common-configure-flags
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH 2/6] gnu: racket: Update to 8.12.
  2024-03-29  5:15 [bug#70065] [PATCH 0/6] gnu: Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9 Philip McGrath
  2024-03-29  5:18 ` [bug#70065] [PATCH 1/6] gnu: zuo: Update to 1.9 Philip McGrath
@ 2024-03-29  5:18 ` Philip McGrath
  2024-03-30 14:35   ` Skyler Ferris via Guix-patches via
  2024-03-29  5:18 ` [bug#70065] [PATCH 3/6] gnu: chez-scheme: Reorganize package definitions Philip McGrath
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 39+ messages in thread
From: Philip McGrath @ 2024-03-29  5:18 UTC (permalink / raw)
  To: 70065; +Cc: Philip McGrath

All of Racket's changes to Chez Scheme have been merged upstream.  They
are the basis for the Chez Scheme 10.0.0 release.  For the forseeable
future, Racket will continue to depend on a specific pre-release
version of Chez Scheme as part of Racket's "ABI": see upstream
discussion at <https://racket.discourse.group/t/2739/3>.

* gnu/packages/chez.scm (chez-configure): Change to define a phase to
run the Chez Scheme configure script, renaming the old definition to ...
(configure-chezschemelibdirs): ... this new variable.
(chez-srfi, chez-matchable, chez-irregex, chez-fmt, chez-mit)
(chez-scmutils)[arguments]<#:phases>: Update accordingly.
(unpack-nanopass+stex): Replace with ...
(unpack-nanopass): ... this new variable.
(chez-scheme)[arguments]<#:phases>: Inline old definition of
'unpack-nanopass+stex' to facilitate transition.
(chez-scheme-for-racket): Stop inheriting from 'chez-scheme'.
[version]: Update to 9.9.9-pre-release.23.
[outputs]: Add "debug" output.
[native-inputs]: Add 'texlive-enumitem' for native builds. For cross
builds, omit TeX-related inputs and add this-package:doc.
[inputs, native-search-paths, home-page]: Rewrite without inheritance.
[arguments]: Likewise, and adjust for upstream changes.
[synopsis, description]: Rewrite to reflect upstreaming of
Racket's changes to Chez Scheme.
(chez-scheme-for-racket-bootstrap-bootfiles): Stop inheriting from
'chez-scheme-bootstrap-bootfiles'.
[arguments]: Rewrite without inheritance. Use `make cross.boot` instead
of broken experimental script for cross builds.
[home-page]: Use bootstrapping Racket package instead of archived Git
repository.
[description]: Rewrite to reflect upstreaming of Racket's changes to
Chez Scheme.
* gnu/packages/patches/racket-backport-8.11-layered-docs.patch: Delete
file.
* gnu/packages/patches/racket-backport-8.12-chez-configure.patch: New
file.
* gnu/local.mk (dist_patch_DATA): Update accordingly.
* gnu/packages/racket.scm (%racket-origin)[patches]: Likewise.
[snippet]: Also unbundle Zuo and potential pre-built boot files.
(%racket-version): Update to 8.12.
(racket-vm-cs)[arguments]<#:phases>: Use 'unpack-nanopass' instead of
'unpack-nanopass+stex'.
(racket)[inputs]<data, deinprogramm, drracket, gui, htdp, net-cookies>
<pict, plot, rackunit, redex, scribble, typed-racket, string-constants>
<web-server>: Update hashes.
<quickscript>: Likewise, and remove obsolete snippet.

Change-Id: I11e7f44be37c60c91b03d246a50e75e418bd0672
---
 gnu/local.mk                                  |   4 +-
 gnu/packages/chez.scm                         | 519 ++++++++++--------
 .../racket-backport-8.11-layered-docs.patch   |  36 --
 .../racket-backport-8.12-chez-configure.patch | 423 ++++++++++++++
 gnu/packages/racket.scm                       |  61 +-
 5 files changed, 758 insertions(+), 285 deletions(-)
 delete mode 100644 gnu/packages/patches/racket-backport-8.11-layered-docs.patch
 create mode 100644 gnu/packages/patches/racket-backport-8.12-chez-configure.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index a025276390..a10aa2cefd 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -41,7 +41,7 @@
 # Copyright © 2020, 2023 Vinicius Monego <monego@posteo.net>
 # Copyright © 2021 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
 # Copyright © 2021 Greg Hogan <code@greghogan.com>
-# Copyright © 2021, 2022, 2023 Philip McGrath <philip@philipmcgrath.com>
+# Copyright © 2021-2024 Philip McGrath <philip@philipmcgrath.com>
 # Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net>
 # Copyright © 2021 Sharlatan Hellseher <sharlatanus@gmail.com>
 # Copyright © 2021 Dmitry Polyakov <polyakov@liltechdude.xyz>
@@ -1982,7 +1982,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/rpcbind-CVE-2017-8779.patch		\
   %D%/packages/patches/rtags-separate-rct.patch			\
   %D%/packages/patches/racket-chez-scheme-bin-sh.patch		\
-  %D%/packages/patches/racket-backport-8.11-layered-docs.patch	\
+  %D%/packages/patches/racket-backport-8.12-chez-configure.patch	\
   %D%/packages/patches/racket-rktio-bin-sh.patch		\
   %D%/packages/patches/remake-impure-dirs.patch			\
   %D%/packages/patches/restartd-update-robust.patch             \
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 2811cf3e01..c71d6fafd5 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, 2022, 2023 Philip McGrath <philip@philipmcgrath.com>
+;;; Copyright © 2021-2024 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -51,7 +51,7 @@ (define-module (gnu packages chez)
   #:export (chez-scheme-for-system
             racket-cs-native-supported-system?
             nix-system->pbarch-machine-type
-            unpack-nanopass+stex))
+            unpack-nanopass))
 
 ;; Commentary:
 ;;
@@ -273,19 +273,14 @@ (define* (racket-cs-native-supported-system? #:optional
 ;; Chez Scheme:
 ;;
 
-
-(define unpack-nanopass+stex
-  #~(begin
-      (copy-recursively
-       (dirname (search-input-file %build-inputs
-                                   "lib/chez-scheme/nanopass.ss"))
-       "nanopass"
-       #:keep-mtime? #t)
-      (mkdir-p "stex")
-      (with-output-to-file "stex/Mf-stex"
-        (lambda ()
-          ;; otherwise, it will try to download submodules
-          (display "# to placate ../configure")))))
+(define unpack-nanopass
+  #~(lambda* (#:key inputs native-inputs #:allow-other-keys)
+      (with-directory-excursion (if (directory-exists? "racket/src/ChezScheme")
+                                    "racket/src/ChezScheme"
+                                    ".")
+        (symlink (dirname (search-input-file (or native-inputs inputs)
+                                             "lib/chez-scheme/nanopass.ss"))
+                 "nanopass"))))
 
 (define-public chez-scheme
   (package
@@ -357,7 +352,17 @@ (define-public chez-scheme
       #~(modify-phases %standard-phases
           (add-after 'unpack 'unpack-nanopass+stex
             (lambda args
-              #$unpack-nanopass+stex))
+              (begin
+                (copy-recursively
+                 (dirname (search-input-file %build-inputs
+                                             "lib/chez-scheme/nanopass.ss"))
+                 "nanopass"
+                 #:keep-mtime? #t)
+                (mkdir-p "stex")
+                (with-output-to-file "stex/Mf-stex"
+                  (lambda ()
+                    ;; otherwise, it will try to download submodules
+                    (display "# to placate ../configure"))))))
           (add-after 'unpack-nanopass+stex 'unpack-bootfiles
             (lambda* (#:key native-inputs inputs #:allow-other-keys)
               (when (directory-exists? "boot")
@@ -462,152 +467,223 @@ (define-public chez-scheme
 and 32-bit PowerPC architectures.")
     (license asl2.0)))
 
+(define chez-configure
+  ;; The custom Chez 'configure' script doesn't allow unrecognized flags, such
+  ;; as those automatically added by `gnu-build-system`. This replacement
+  ;; phase uses only the explicitly provided `#: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)
+        (when 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))))
+
 (define-public chez-scheme-for-racket
   (package
-    (inherit chez-scheme)
     (name "chez-scheme-for-racket")
-    (version "9.9.9-pre-release.18")
-    ;; The version should match `scheme-version`.
-    ;; See racket/src/ChezScheme/s/cmacros.ss c. line 360.
-    ;; It will always be different than the upstream version!
-    ;; When updating, remember to also update %racket-version in racket.scm.
-    (source #f) ; avoid problematic cycle with racket.scm
-    (inputs
-     (let ((inputs (modify-inputs (package-inputs chez-scheme)
-                     (replace "chez-scheme-bootstrap-bootfiles"
-                       chez-scheme-for-racket-bootstrap-bootfiles)
-                     (delete "libx11" "util-linux:lib"))))
-       (if (racket-cs-native-supported-system?)
-           inputs
-           (modify-inputs inputs
-             (prepend libffi)))))
-    (native-inputs
-     (let ((native-inputs (modify-inputs (package-native-inputs chez-scheme)
-                            (prepend zuo))))
-       (if (%current-target-system)
-           (modify-inputs native-inputs
-             (prepend this-package))
-           native-inputs)))
+    ;; The version should match `(scheme-version-number #t)`.
+    ;; See s/cmacros.ss c. line 360.
+    (version "9.9.9-pre-release.23")
+    (source #f)
+    (build-system gnu-build-system)
+    (inputs `(,@(if (racket-cs-native-supported-system?)
+                    '()
+                    (list libffi))
+              ,chez-scheme-for-racket-bootstrap-bootfiles
+              ,lz4
+              ,ncurses ;<-- for expeditor
+              ,zlib))
+    (native-inputs `(,@(if (%current-target-system)
+                           (list this-package
+                                 `(,this-package "doc"))
+                           (list stex-bootstrap
+                                 (texlive-updmap.cfg
+                                  (list texlive-enumitem))))
+                     ,chez-nanopass-bootstrap
+                     ,zuo))
+    (native-search-paths
+     (list (search-path-specification
+            (variable "CHEZSCHEMELIBDIRS")
+            (files '("lib/chez-scheme")))))
+    (outputs '("out" "debug" "doc"))
     (arguments
-     (substitute-keyword-arguments (package-arguments chez-scheme)
-       ((#:out-of-source? _ #f)
-        #t)
-       ((#:configure-flags cfg-flags #~'())
-        #~`("--disable-x11"
-            "--threads" ;; ok to potentially duplicate
-            #$(string-append "-m=" (or (racket-cs-native-supported-system?)
-                                       (nix-system->pbarch-machine-type)))
-            ;; ^ could skip -m= for non-cross non-pbarch builds
-            #$@(if (racket-cs-native-supported-system?)
-                   #~()
-                   ;; not inferred on non-native platforms: see
-                   ;; https://racket.discourse.group/t/950/9
-                   #~("--enable-libffi"
-                      "CFLAGS=-g -O2 -D_REENTRANT -pthread"
-                      "LIBS=-lm -ldl -lrt -lffi -lncurses"))
-            #$@(if (%current-target-system)
-                   (list (string-append "--toolprefix="
-                                        (%current-target-system)
-                                        "-"))
-                   '())
-            ,@(let* ((chez+version (strip-store-file-name #$output))
-                     (doc-prefix (assoc-ref %outputs "doc"))
-                     (doc-dir (string-append doc-prefix
-                                             "/share/doc/"
-                                             chez+version)))
-                (list (string-append "--installcsug="
-                                     doc-dir
-                                     "/csug")
-                      (string-append "--installreleasenotes="
-                                     doc-dir
-                                     "/release_notes")))
-            ,@#$cfg-flags))
-       ((#:make-flags mk-flags #~'())
-        #~(cons* (string-append "ZUO="
-                                #+(this-package-native-input "zuo")
-                                "/bin/zuo")
-                 (string-append "STEXLIB="
-                                #+(this-package-native-input "stex")
-                                "/lib/stex")
-                 #$mk-flags))
-       ((#:phases those-phases #~%standard-phases)
-        #~(let* ((those-phases #$those-phases)
-                 (gnu:unpack (assoc-ref those-phases 'unpack))
-                 (gnu:build (assoc-ref those-phases 'build)))
-            (modify-phases those-phases
-              (replace 'build
-                ;; need to override target for cross-compilation
-                ;; https://racket.discourse.group/t/950/19
-                (lambda* (#:key target (make-flags '()) (parallel-build? #t)
-                          #:allow-other-keys)
-                  (gnu:build #:make-flags (if target
-                                              (cons "kernel" make-flags)
-                                              make-flags)
-                             #:parallel-build? parallel-build?)))
-              (replace 'install-docs
-                (lambda* (#:key native-inputs (make-flags '())
-                          #:allow-other-keys)
-                  ;; The tests for 'native-inputs' are cross-compilation
-                  ;; workarounds that would be better to address upstream:
-                  ;; see <https://racket.discourse.group/t/950/20>.
-                  (when native-inputs
-                    (substitute* "Makefile"
-                      (("install-docs: build \\$[(]ZUO[)]")
-                       "install-docs: $(ZUO)")))
-                  (apply invoke
-                         "make"
-                         "install-docs"
-                         (if native-inputs
-                             (cons (string-append
-                                    "Scheme="
-                                    (search-input-file native-inputs
-                                                       "/bin/scheme"))
-                                   make-flags)
-                             make-flags))))
-              (replace 'unpack
-                (lambda args
-                  (gnu:unpack #:source #$(or (package-source this-package)
-                                             (package-source racket-vm-bc)))))
-              (add-after 'unpack 'chdir
-                (lambda args
-                  (chdir "racket/src/ChezScheme"))))))))
-    (supported-systems %supported-systems)
-    (home-page "https://github.com/racket/ChezScheme")
-    ;; ^ This is downstream of https://github.com/racket/racket,
-    ;; but it's designed to be a friendly landing place for people
-    ;; who want a ChezScheme-shaped repositroy.
-    (synopsis "Variant of Chez Scheme extended for Racket")
-    (description "This variant of Chez Scheme is extended to support the
-implementation of Racket.  It may be useful on platforms that are not yet
-supported by upstream Chez Scheme.
-
-Main additions to Chez Scheme in the Racket variant:
-@itemize @bullet
-@item
-AArch64 and RV64G (RISC-V) code generation
-@item
-Portable bytecode (@code{pb}) mode, which is mainly useful for bootstrapping a
-build on any platform, but can also be used on platforms without native-code
-generation, compiled via Emscripten, linked with @code{libffi}, or used with
-bytecode partially compiled to C
-@item
-Unboxed floating-point arithmetic and flvectors
-@item
-Faster multiplication and division for large exact numbers
-@item
-Type reconstruction during optimization (especially for safe code)
-@item
-Continuation marks
-@item
-Parallel garbage collection, in-place garbage collection for old-generation
-objects (instead of always copying), and reachability-based memory
-accounting
-@item
-Ordered finalization, immobile (but collectable) objects, weak/ephemeron
-generic hash tables, and reference bytevectors
-@item
-Easier bootstrapping via old versions of Chez Scheme
-@end itemize")
+     (list
+      #:modules
+      '((guix build gnu-build-system)
+        (guix build utils)
+        (ice-9 ftw)
+        (ice-9 match)
+        (srfi srfi-34))
+      #:out-of-source? #t
+      ;; Intermittent failures: https://github.com/cisco/ChezScheme/issues/809
+      #:tests? #f
+      #:test-target "test" ; test-one test-some-fast test-some test test-more
+      #:configure-flags
+      #~`(,@(let* ((chez+version (strip-store-file-name #$output))
+                   (doc-dir (string-append #$output:doc
+                                           "/share/doc/"
+                                           chez+version)))
+              (list (string-append "--installcsug="
+                                   doc-dir
+                                   "/csug")
+                    (string-append "--installreleasenotes="
+                                   doc-dir
+                                   "/release_notes")))
+          ,(string-append "--installprefix=" #$output)
+          #$@(if (%current-target-system)
+                 (list (string-append "--toolprefix="
+                                      (%current-target-system)
+                                      "-"))
+                 '())
+          ,@(if (false-if-exception
+                 (search-input-directory %build-inputs "/include/X11"))
+                '()
+                '("--disable-x11"))
+          #$(string-append "-m=" (or (racket-cs-native-supported-system?)
+                                     (nix-system->pbarch-machine-type)))
+          ;; ^ could skip -m= for non-cross non-pbarch builds
+          #$@(if (racket-cs-native-supported-system?)
+                 #~()
+                 ;; not inferred on non-native platforms: see
+                 ;; https://racket.discourse.group/t/950/9
+                 #~("--enable-libffi"
+                    "CFLAGS+=-g -D_REENTRANT -pthread"
+                    "LIBS+=-lm -ldl -lrt -lncurses"))
+          ,(string-append "STEXLIB="
+                          (or (false-if-exception
+                               (search-input-directory %build-inputs
+                                                       "/lib/stex"))
+                              "/GuixNotUsingStex"))
+          "ZUO=zuo"
+          "ZLIB=-lz"
+          "LZ4=-llz4"
+          ;; Guix will do 'compress-man-pages',
+          ;; and letting Chez try caused an error (at one point)
+          "--nogzip-man-pages")
+      #:phases
+      #~(modify-phases %standard-phases
+          (replace 'unpack
+            (let ((unpack (assoc-ref %standard-phases 'unpack)))
+              (lambda args
+                (unpack #:source #$(or (package-source this-package)
+                                       (package-source racket-vm-bc))))))
+          (add-after 'unpack 'unpack-nanopass
+            #$unpack-nanopass)
+          (add-after 'unpack-nanopass 'maybe-chdir
+            (lambda args
+              (when (directory-exists? "racket/src/ChezScheme")
+                (chdir "racket/src/ChezScheme"))))
+          (add-after 'maybe-chdir 'unpack-bootfiles
+            (lambda* (#:key native-inputs inputs #:allow-other-keys)
+              (when (directory-exists? "boot")
+                (delete-file-recursively "boot"))
+              (copy-recursively
+               (search-input-directory inputs "lib/chez-scheme-bootfiles")
+               "boot")))
+          (replace 'configure
+            #$chez-configure)
+          (add-after 'configure 'configure-environment-variables
+            (lambda args
+              ;; mats/6.ms needs HOME to be set:
+              (setenv "HOME" "/tmp")))
+          (replace 'build
+            ;; need to override target for cross-compilation
+            ;; https://racket.discourse.group/t/950/19
+            (let ((gnu:build (assoc-ref %standard-phases 'build)))
+              (lambda* (#:key target (make-flags '()) (parallel-build? #t)
+                        #:allow-other-keys)
+                (gnu:build #:make-flags (if target
+                                            (cons "kernel" make-flags)
+                                            make-flags)
+                           #:parallel-build? parallel-build?))))
+          (add-before 'check 'build-docs
+            ;; This comes BEFORE 'check because the test suite may take on the
+            ;; order of an hour (without parallelism), so we want to get any
+            ;; other errors first.
+            ;; TODO: improve cross support upstream.
+            (lambda* (#:key native-inputs (make-flags '()) #:allow-other-keys)
+              #$(if (%current-target-system)
+                    #~(format #t "not building docs for cross~%")
+                    #~(apply invoke "make" "docs" make-flags))))
+          ;; 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.
+          (add-after 'install 'install-symlink
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let* ((bin-dir
+                      (dirname (search-input-file outputs "/bin/scheme")))
+                     (boot-dir
+                      (match (find-files (string-append bin-dir "/../lib")
+                                         "scheme.boot")
+                        ((scheme.boot)
+                         (dirname scheme.boot)))))
+                (for-each (lambda (dir)
+                            (with-directory-excursion dir
+                              (symlink "./scheme" "chez-scheme")
+                              (when (file-exists? "scheme.boot")
+                                (symlink "./scheme.boot" "chez-scheme.boot"))))
+                          (list bin-dir boot-dir)))))
+          ;; Building the documentation requires stex and a running scheme.
+          ;; TODO: improve cross support upstream.
+          (add-after 'install-symlink 'install-docs
+            (lambda* (#:key native-inputs (make-flags '()) #:allow-other-keys)
+              #$(if (%current-target-system)
+                    #~(let* ((rel
+                              (string-append "share/doc/"
+                                             (strip-store-file-name #$output)))
+                             (found/csug
+                              (search-input-directory
+                               native-inputs (string-append rel "/csug")))
+                             (found (substring found/csug
+                                               0
+                                               (- (string-length found/csug)
+                                                  (string-length "/csug"))))
+                             (dest (string-append #$output:doc "/" rel)))
+                        (mkdir-p dest)
+                        (with-directory-excursion dest
+                          (for-each (lambda (f)
+                                      (symlink (string-append found "/" f)
+                                               f))
+                                    '("csug" "csug.pdf"
+                                      "release_notes" "release_notes.pdf"))))
+                    #~(apply invoke "make" "install-docs" make-flags))))
+          (add-after 'install-docs 'link-doc-pdfs
+            ;; otherwise, it's hard to notice them in a forest of HTML files
+            ;; TODO: improve cross support upstream.
+            (lambda* (#:key outputs #:allow-other-keys)
+              #$(if (%current-target-system)
+                    #~(format #t "nothing to be done for cross~%")
+                    #~(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"))))))))))
+    (home-page "https://cisco.github.io/ChezScheme/")
+    (synopsis "Bootstrapping version of Chez Scheme")
+    (description
+     "This is the precise pre-release version of Chez Scheme from a specific
+Racket release.  It is used to build Racket and to bootstrap the released
+version of Chez Scheme.")
     (license asl2.0)))
 
 ;;
@@ -646,58 +722,70 @@ (define-public chez-scheme-bootstrap-bootfiles
 
 (define-public chez-scheme-for-racket-bootstrap-bootfiles
   (package
-    (inherit chez-scheme-bootstrap-bootfiles)
     (name "chez-scheme-for-racket-bootstrap-bootfiles")
     (version (package-version chez-scheme-for-racket))
     (source #f) ; avoid problematic cycle with racket.scm
     (native-inputs
-     (cons* chez-nanopass-bootstrap
-            (if (%current-target-system)
-                (list zuo
-                      chez-scheme-for-racket)
-                (list racket-vm-bc))))
+     (cons chez-nanopass-bootstrap
+           (if (%current-target-system)
+               (list zuo
+                     chez-scheme-for-racket)
+               (list racket-vm-bc))))
+    (build-system copy-build-system)
     (arguments
-     (substitute-keyword-arguments
-         (package-arguments chez-scheme-bootstrap-bootfiles)
-       ((#:phases those-phases #~%standard-phases)
-        #~(let* ((those-phases #$those-phases)
-                 (unpack (assoc-ref those-phases 'unpack)))
-            (modify-phases those-phases
-              (replace 'unpack
-                (lambda args
-                  (unpack #:source #$(or (package-source this-package)
-                                         (package-source racket-vm-bc)))))
-              (add-after 'unpack 'chdir
-                (lambda args
-                  (chdir "racket/src/ChezScheme")))
-              (add-after 'chdir 'unpack-nanopass+stex
-                (lambda args
-                  #$unpack-nanopass+stex))
-              (add-before 'install 'build
-                (lambda* (#:key native-inputs inputs #:allow-other-keys)
-                  #$(cond
-                     ((%current-target-system)
-                      ;; cross-compiling
-                      #~(invoke
-                         (search-input-file (or native-inputs inputs)
-                                            "/bin/zuo")
-                         "makefiles/boot.zuo"
-                         (search-input-file (or native-inputs inputs)
-                                            "/bin/scheme")
-                         #$(or (racket-cs-native-supported-system?)
-                               (nix-system->pbarch-machine-type))))
-                     (else
-                      ;; bootstrapping
-                      #~(invoke
-                         (search-input-file (or native-inputs inputs)
-                                            "/opt/racket-vm/bin/racket")
-                         "../rktboot/main.rkt"))))))))))
-    (supported-systems
-     (package-supported-systems chez-scheme-for-racket))
-    (home-page "https://github.com/racket/ChezScheme")
-    ;; ^ This is downstream of https://github.com/racket/racket,
-    ;; but it's designed to be a friendly landing place for people
-    ;; who want a ChezScheme-shaped repositroy.
+     (list
+      #:install-plan
+      #~`(("boot/" "lib/chez-scheme-bootfiles"))
+      #:phases
+      #~(modify-phases %standard-phases
+          (replace 'unpack
+            (let ((unpack (assoc-ref %standard-phases 'unpack)))
+              (lambda args
+                (unpack #:source #$(or (package-source this-package)
+                                       (package-source racket-vm-bc))))))
+          (add-after 'unpack 'unpack-nanopass
+            #$unpack-nanopass)
+          (add-after 'unpack-nanopass 'chdir
+            (lambda args
+              (chdir "racket/src/ChezScheme")))
+          (add-before 'install 'build
+            #$(cond
+               ((%current-target-system)
+                ;; cross-compiling
+                ;; TODO: share more of this with upstream, once we figure out
+                ;; how best to manage running Chez as a cross-compiler and the
+                ;; unfortate cycle with %racket-origin.
+                #~(lambda* (#:key native-inputs inputs (parallel-build? #t)
+                            #:allow-other-keys)
+                    (invoke "./configure"
+                            "--force" ; don't complain about missing bootfiles
+                            #$(string-append
+                               "-m=" (or (racket-cs-native-supported-system?)
+                                         (nix-system->pbarch-machine-type)))
+                            "ZUO=zuo"
+                            ;; ignore submodules:
+                            "ZLIB=-lz"
+                            "LZ4=-llz4"
+                            "STEXLIB=/GuixNotUsingStex")
+                    (apply invoke
+                           "make"
+                           `(,@(if parallel-build?
+                                   `("-j" ,(number->string
+                                            (parallel-job-count)))
+                                   '())
+                             ,(string-append "SCHEME="
+                                             (search-input-file
+                                              (or native-inputs inputs)
+                                              "/bin/scheme"))
+                             "cross.boot"))))
+               (else
+                ;; bootstrapping
+                #~(lambda* (#:key native-inputs inputs #:allow-other-keys)
+                    (invoke
+                     (search-input-file (or native-inputs inputs)
+                                        "/opt/racket-vm/bin/racket")
+                     "../rktboot/main.rkt"))))))))
+    (home-page "https://pkgs.racket-lang.org/package/cs-bootstrap")
     (synopsis "Chez Scheme bootfiles bootstrapped by Racket")
     (description "Chez Scheme is a self-hosting compiler: building it
 requires ``bootfiles'' containing the Scheme-implemented portions compiled for
@@ -709,11 +797,8 @@ (define-public chez-scheme-for-racket-bootstrap-bootfiles
 Scheme compiler purely from source into Racket and apply the compiler to
 itself, thus bootstrapping Chez Scheme.  Bootstrapping takes about 10 times as
 long as using an existing Chez Scheme, but @code{cs-bootstrap} supports Racket
-7.1 and later, including the Racket BC variant.
-
-Note that the generated bootfiles are specific to Racket's fork of Chez
-Scheme, and @code{cs-bootstrap} does not currently support building upstream
-Chez Scheme.")))
+7.1 and later, including the Racket BC variant.")
+    (license asl2.0)))
 
 ;;
 ;; Chez's bootstrap dependencies:
@@ -935,7 +1020,7 @@ (define-public chez-nanopass
 
 ;; Help function for Chez Scheme to add the current path to
 ;; CHEZSCHEMELIBDIRS.
-(define chez-configure
+(define configure-chezschemelibdirs
   #~(lambda _
       (let ((chez-env (getenv "CHEZSCHEMELIBDIRS")))
         (setenv "CHEZSCHEMELIBDIRS"
@@ -975,7 +1060,7 @@ (define-public chez-srfi
            #:test-target "test"
            #:phases #~(modify-phases %standard-phases
                         (replace 'configure
-                          #$chez-configure))))
+                          #$configure-chezschemelibdirs))))
     (home-page "https://github.com/fedeinthemix/chez-srfi")
     (synopsis "SRFI libraries for Chez Scheme")
     (description
@@ -1159,7 +1244,7 @@ (define-public chez-matchable
            #:test-target "test"
            #:phases #~(modify-phases %standard-phases
                         (replace 'configure
-                          #$chez-configure))))
+                          #$configure-chezschemelibdirs))))
     (synopsis "Portable hygienic pattern matcher for Scheme")
     (description "This package provides a superset of the popular Scheme
 @code{match} package by Andrew Wright, written in fully portable
@@ -1191,7 +1276,7 @@ (define-public chez-irregex
            #:test-target "test"
            #:phases #~(modify-phases %standard-phases
                         (replace 'configure
-                          #$chez-configure))))
+                          #$configure-chezschemelibdirs))))
     (home-page "https://github.com/fedeinthemix/chez-irregex")
     (synopsis "Portable regular expression library for Scheme")
     (description "This package provides a portable and efficient
@@ -1223,7 +1308,7 @@ (define-public chez-fmt
            #:phases
            #~(modify-phases %standard-phases
                (replace 'configure
-                 #$chez-configure)
+                 #$configure-chezschemelibdirs)
                (replace 'build
                  (lambda* (#:key (make-flags '()) #:allow-other-keys)
                    (apply invoke "make" "chez-build" make-flags)))
@@ -1285,7 +1370,7 @@ (define-public chez-mit
            #:test-target "test"
            #:phases #~(modify-phases %standard-phases
                         (replace 'configure
-                          #$chez-configure))))
+                          #$configure-chezschemelibdirs))))
     (synopsis "MIT/GNU Scheme compatibility library for Chez Scheme")
     (description "This package provides a set of MIT/GNU Scheme compatibility
 libraries for Chez Scheme.  The main goal was to provide the functionality
@@ -1320,7 +1405,7 @@ (define-public chez-scmutils
       #:phases
       #~(modify-phases %standard-phases
           (replace 'configure
-            #$chez-configure)
+            #$configure-chezschemelibdirs)
           ;; Since the documentation is lacking, we install the source
           ;; code.  For things to work correctly we have to replace
           ;; relative paths by absolute ones in 'include' forms.  This
diff --git a/gnu/packages/patches/racket-backport-8.11-layered-docs.patch b/gnu/packages/patches/racket-backport-8.11-layered-docs.patch
deleted file mode 100644
index 07f105bb24..0000000000
--- a/gnu/packages/patches/racket-backport-8.11-layered-docs.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 1d8dbdf408db9e99f1382323477561d5148cd451 Mon Sep 17 00:00:00 2001
-From: Philip McGrath <philip@philipmcgrath.com>
-Date: Fri, 20 Oct 2023 17:19:50 -0400
-Subject: [PATCH] racket-index: fix release.scrbl for layered installations
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Configure the release notes page to be rendered separately at every
-installation layer. Otherwise, rendering documentation for packages
-installed in a new layer might try to write to `release/in.sxref`
-in the parent layer’s docs directory.
-
-Related to https://github.com/videolang/video/issues/67
-Related to https://issues.guix.gnu.org/56534
-
-(cherry picked from commit 85f21854c0a41564b755fbe180fe6b85de6c4730)
----
- pkgs/racket-index/scribblings/main/info.rkt | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/pkgs/racket-index/scribblings/main/info.rkt b/pkgs/racket-index/scribblings/main/info.rkt
-index 75c507848a..a6a3798f7c 100644
---- a/pkgs/racket-index/scribblings/main/info.rkt
-+++ b/pkgs/racket-index/scribblings/main/info.rkt
-@@ -6,4 +6,4 @@
-     ("local-redirect.scrbl" (depends-all-main no-depend-on every-main-layer) (omit) "local-redirect" 1 10)
-     ("license.scrbl" () (omit))
-     ("acks.scrbl"    () (omit))
--    ("release.scrbl" (depends-all-main no-depend-on) (omit))))
-+    ("release.scrbl" (depends-all-main no-depend-on every-main-layer) (omit))))
-
-base-commit: c3a502c0ae9f4d615bfd85fc7d88b781826bbb09
--- 
-2.41.0
-
diff --git a/gnu/packages/patches/racket-backport-8.12-chez-configure.patch b/gnu/packages/patches/racket-backport-8.12-chez-configure.patch
new file mode 100644
index 0000000000..483948fec9
--- /dev/null
+++ b/gnu/packages/patches/racket-backport-8.12-chez-configure.patch
@@ -0,0 +1,423 @@
+From 82157f5b3fb9f71ad7fc978c428d423d06a4a0df Mon Sep 17 00:00:00 2001
+From: Philip McGrath <philip@philipmcgrath.com>
+Date: Wed, 28 Feb 2024 19:41:22 -0500
+Subject: [PATCH 1/2] Chez Scheme: Repairs and improvements for building with
+ external dependencies
+
+* configure: support `ZUO=<zuo>`
+
+Supplying `ZUO=<zuo>` skips the submodule check in `configure`
+and configures the generated makefile not to build or remove Zuo.
+
+* configure: support `STEXLIB=<stex>`
+
+For compatibility with older scripts, when not explicitly configured,
+continue to honor the `STEXLIB` environment variable at build time.
+
+(cherry picked from commit 694fbd47a125c7fde10a328c6fda199dac19f802)
+---
+ racket/src/ChezScheme/BUILDING              |  5 ++--
+ racket/src/ChezScheme/build.zuo             | 13 +++++++---
+ racket/src/ChezScheme/configure             | 27 ++++++++++++++++++++-
+ racket/src/ChezScheme/makefiles/Makefile.in |  6 ++---
+ 4 files changed, 40 insertions(+), 11 deletions(-)
+
+diff --git a/racket/src/ChezScheme/BUILDING b/racket/src/ChezScheme/BUILDING
+index 50fde27771..2df29b5bd8 100644
+--- a/racket/src/ChezScheme/BUILDING
++++ b/racket/src/ChezScheme/BUILDING
+@@ -155,7 +155,8 @@ information on the supported options.
+ The generated makefile mostly just ensures that a `zuo` executable is
+ built in a `bin` directory, and then it defers the actual build work
+ to `zuo`, which uses the "main.zuo" file. If you have `zuo` installed,
+-you can use `zuo` directly instead of `make`. In general, instead of
++you can use `zuo` directly instead of `make`: in that case, you may
++wish to use `./configure ZUO=<zuo>`. In general, instead of
+ the command `make X` to build target `X` as described below, you can
+ use `zuo . X` (or `bin/zuo . X` after `bin/zuo` is built).
+ 
+@@ -339,7 +340,7 @@ The makefile supports several targets:
+  * `make clean`
+ 
+    Removes all built elements from the workarea, and then removes
+-   `bin/zuo`.
++   `bin/zuo` (unless configured with `ZUO=<zuo>`).
+ 
+ 
+ WINDOWS VIA COMMAND PROMPT
+diff --git a/racket/src/ChezScheme/build.zuo b/racket/src/ChezScheme/build.zuo
+index a211632a89..432cc6e5a1 100644
+--- a/racket/src/ChezScheme/build.zuo
++++ b/racket/src/ChezScheme/build.zuo
+@@ -218,10 +218,15 @@
+            token))
+ 
+   (define stexlib
+-    (let ((found (assoc "STEXLIB" (hash-ref (runtime-env) 'env))))
+-      (if found
+-          (cdr found)
+-          (at-source "stex"))))
++    (let ([configured (hash-ref config 'STEXLIB "")]
++          [env (assoc "STEXLIB" (hash-ref (runtime-env) 'env))])
++      (cond
++        [(not (equal? "" configured))
++         configured]
++        [env
++         (cdr env)]
++        [else
++         (at-source "stex")])))
+   (define stex-sources
+     (source-tree stexlib))
+ 
+diff --git a/racket/src/ChezScheme/configure b/racket/src/ChezScheme/configure
+index 721d1d1335..f88c6f7625 100755
+--- a/racket/src/ChezScheme/configure
++++ b/racket/src/ChezScheme/configure
+@@ -93,6 +93,7 @@ default_warning_flags="-Wpointer-arith -Wall -Wextra -Wno-implicit-fallthrough"
+ CFLAGS_ADD=
+ zlibLib=
+ LZ4Lib=
++STEXLIB=
+ Kernel=KernelLib
+ buildKernelOnly=no
+ enableFrompb=yes
+@@ -102,6 +103,7 @@ empetite=no
+ moreBootFiles=
+ preloadBootFiles=
+ alwaysUseBootFile=
++zuoExternal=
+ 
+ CONFIG_UNAME=`uname`
+ 
+@@ -442,6 +444,12 @@ while [ $# != 0 ] ; do
+     LZ4=*)
+       LZ4Lib=`echo $1 | sed -e 's/^LZ4=//'`
+       ;;
++    STEXLIB=*)
++      STEXLIB=`echo $1 | sed -e 's/^STEXLIB=//'`
++      ;;
++    ZUO=*)
++      zuoExternal=`echo $1 | sed -e 's/^ZUO=//'`
++      ;;
+     *)
+       echo "option '$1' unrecognized or missing an argument; try $0 --help"
+       exit 1
+@@ -667,6 +675,8 @@ if [ "$help" = "yes" ]; then
+   echo "  STRIP=<strip>                     executable stripper"
+   echo "  ZLIB=<lib>                        link to <lib> instead of own zlib"
+   echo "  LZ4=<lib>                         link to <lib> instead of own LZ4"
++  echo "  STEXLIB=<stex>                    build docs with <stex> instead of own stex"
++  echo "  ZUO=<zuo>                         build with <zuo> instead of own Zuo"
+   echo ""
+   echo "Available machine types: $machs"
+   echo ""
+@@ -869,6 +879,16 @@ if [ "$addflags" = "yes" ] ; then
+   fi
+ fi
+ 
++if [ "${zuoExternal}" = "" ] ; then
++    ZUO="bin/zuo"
++    RM_ZUO="rm -f bin/zuo"
++    ZUO_TARGET="bin/zuo"
++else
++    ZUO="${zuoExternal}"
++    RM_ZUO="@echo 'Not cleaning external ${zuoExternal}'"
++    ZUO_TARGET="DoNotBuildZuo"
++fi
++
+ # more compile and link flags for c/Mf-unix and mats/Mf-unix
+ mdinclude=
+ mdcppflags=
+@@ -1039,7 +1059,7 @@ cp "$srcdir"/makefiles/buildmain.zuo main.zuo
+ # Some idea, but in the workarea, so it refers to "workarea.zuo" here:
+ cp "$srcdir"/makefiles/workmain.zuo $w/main.zuo
+ 
+-# The content of "$w/Makefile" records configuration decisions,
++# The content of "$w/Mf-config" records configuration decisions,
+ # and the Zuo build script takes it from there
+ cat > $w/Mf-config << END
+ srcdir=$srcdir
+@@ -1075,6 +1095,7 @@ cursesLib=$cursesLib
+ ncursesLib=$ncursesLib
+ zlibLib=$zlibLib
+ LZ4Lib=$LZ4Lib
++STEXLIB=$STEXLIB
+ warningFlags=$warningFlags
+ Kernel=$Kernel
+ installscriptname=$installscriptname
+@@ -1086,6 +1107,10 @@ preloadBootFiles=$preloadBootFiles
+ alwaysUseBootFile=$alwaysUseBootFile
+ relativeBootFiles=$relativeBootFiles
+ 
++ZUO=$ZUO
++RM_ZUO=$RM_ZUO
++ZUO_TARGET=$ZUO_TARGET
++
+ InstallBin=$installbin
+ InstallLib=$installlib
+ InstallMan=$installman/man1
+diff --git a/racket/src/ChezScheme/makefiles/Makefile.in b/racket/src/ChezScheme/makefiles/Makefile.in
+index cfdd0230a3..4865bf2e2f 100644
+--- a/racket/src/ChezScheme/makefiles/Makefile.in
++++ b/racket/src/ChezScheme/makefiles/Makefile.in
+@@ -3,8 +3,6 @@ workarea=$(w)
+ 
+ include $(workarea)/Mf-config
+ 
+-ZUO=bin/zuo
+-
+ .PHONY: build
+ build: $(ZUO)
+ 	+ $(ZUO) $(workarea) MAKE="$(MAKE)"
+@@ -140,9 +138,9 @@ pkg: $(ZUO)
+ .PHONY: clean
+ clean: $(ZUO)
+ 	+ $(ZUO) $(workarea) clean MAKE="$(MAKE)"
+-	rm -f bin/zuo
++	$(RM_ZUO)
+ 
+ # Using `+` here means that $(ZUO) gets built even if `-n`/`--dry-run` is provided to `make`
+-$(ZUO): $(srcdir)/../zuo/zuo.c
++$(ZUO_TARGET): $(srcdir)/../zuo/zuo.c
+ 	+ mkdir -p bin
+ 	+ $(CC_FOR_BUILD) -DZUO_LIB_PATH='"'"$(upsrcdir)/../zuo/lib"'"' -o $(ZUO) $(srcdir)/../zuo/zuo.c
+
+base-commit: 78fef00d4d16a79fdf6ab31924b3a80cadf4b368
+-- 
+2.41.0
+
+
+From e2bc69c5ce7437dd9a1b30ac1b12b3a56872c491 Mon Sep 17 00:00:00 2001
+From: Matthew Flatt <mflatt@racket-lang.org>
+Date: Sun, 10 Mar 2024 09:13:40 -0600
+Subject: [PATCH 2/2] Chez Scheme: adjust `configure ZUO=<command>` support
+
+Continuing from 694fbd47a1, adjust the generated makefile so the
+supplied `<command>` is not a makefile dependency. That way, `ZUO=zuo`
+works if `zuo` is installed and the current build directory is not the
+source directory. (The `zuo` executable is a dependency in a real and
+relevant sense, but not in the sense of dependencies that we normally
+track in makefiles.)
+
+Also adapt the makefile for the case that `ZUO=...` is not supplied
+and the build directory is not the source directory, in which case
+`ZUO_LIB_PATH` needs to be relative to the source directory.
+
+Using `make ZUO=zuo` can also work, but in that case, `bin/zuo` is
+still built as a dependency. It's possible that some portable makefile
+magic could overcome that limitation, but it doesn't seem important.
+
+(cherry picked from commit 28157ba88d48fe645563f46f6c00d6626b3428fa)
+---
+ racket/src/ChezScheme/configure             |  3 +
+ racket/src/ChezScheme/makefiles/Makefile.in | 70 +++++++++++----------
+ 2 files changed, 40 insertions(+), 33 deletions(-)
+
+diff --git a/racket/src/ChezScheme/configure b/racket/src/ChezScheme/configure
+index f88c6f7625..201dbe580f 100755
+--- a/racket/src/ChezScheme/configure
++++ b/racket/src/ChezScheme/configure
+@@ -881,10 +881,12 @@ fi
+ 
+ if [ "${zuoExternal}" = "" ] ; then
+     ZUO="bin/zuo"
++    ZUO_DEP="${ZUO}"
+     RM_ZUO="rm -f bin/zuo"
+     ZUO_TARGET="bin/zuo"
+ else
+     ZUO="${zuoExternal}"
++    ZUO_DEP=""
+     RM_ZUO="@echo 'Not cleaning external ${zuoExternal}'"
+     ZUO_TARGET="DoNotBuildZuo"
+ fi
+@@ -1108,6 +1110,7 @@ alwaysUseBootFile=$alwaysUseBootFile
+ relativeBootFiles=$relativeBootFiles
+ 
+ ZUO=$ZUO
++ZUO_DEP=$ZUO_DEP
+ RM_ZUO=$RM_ZUO
+ ZUO_TARGET=$ZUO_TARGET
+ 
+diff --git a/racket/src/ChezScheme/makefiles/Makefile.in b/racket/src/ChezScheme/makefiles/Makefile.in
+index 4865bf2e2f..5ce237178e 100644
+--- a/racket/src/ChezScheme/makefiles/Makefile.in
++++ b/racket/src/ChezScheme/makefiles/Makefile.in
+@@ -4,51 +4,55 @@ workarea=$(w)
+ include $(workarea)/Mf-config
+ 
+ .PHONY: build
+-build: $(ZUO)
++build: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) MAKE="$(MAKE)"
+ 
+ .PHONY: run
+-run: $(ZUO)
++run: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) run
+ 
+ .PHONY: kernel
+-kernel: $(ZUO)
++kernel: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) kernel MAKE="$(MAKE)"
+ 
+ .PHONY: install
+-install: $(ZUO)
++install: $(ZUO_DEP)
+ 	$(ZUO) $(workarea) install MAKE="$(MAKE)"
+ 
+ .PHONY: uninstall
+-uninstall: $(ZUO)
++uninstall: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) uninstall MAKE="$(MAKE)"
+ 
+-.PHONY: test
+-test: $(ZUO)
+-	+ $(ZUO) $(workarea) test MAKE="$(MAKE)"
++.PHONY: test-one
++test-one: $(ZUO_DEP)
++	+ $(ZUO) $(workarea) test-one MAKE="$(MAKE)"
+ 
+ .PHONY: test-some-fast
+-test-some-fast: $(ZUO)
++test-some-fast: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) test-some-fast MAKE="$(MAKE)"
+ 
+ .PHONY: test-some
+-test-some: $(ZUO)
++test-some: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) test-some MAKE="$(MAKE)"
+ 
++.PHONY: test
++test: $(ZUO_DEP)
++	+ $(ZUO) $(workarea) test MAKE="$(MAKE)"
++
+ .PHONY: test-more
+-test-more: $(ZUO)
++test-more: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) test-more MAKE="$(MAKE)"
+ 
+ .PHONY: coverage
+-coverage: $(ZUO)
++coverage: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) coverage MAKE="$(MAKE)"
+ 
+ .PHONY: bootfiles
+-bootfiles: $(ZUO)
++bootfiles: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) bootfiles MAKE="$(MAKE)"
+ 
+ .PHONY: reset
+-reset: $(ZUO)
++reset: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) reset MAKE="$(MAKE)"
+ 
+ # Supply XM=<machine> to build boot files for <machine>
+@@ -57,86 +61,86 @@ boot:
+ 	+ $(ZUO) $(workarea) boot "$(XM)" MAKE="$(MAKE)"
+ 
+ # `<machine>.boot` as alias for `boot XM=<machine>`
+-%.boot: $(ZUO)
++%.boot: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) boot $* MAKE="$(MAKE)"
+ 
+ .PHONY: auto.boot
+-auto.boot: $(ZUO)
++auto.boot: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) boot MAKE="$(MAKE)"
+ 
+ SCHEME=scheme
+ 
+ .PHONY: cross.boot
+-cross.boot: $(ZUO)
++cross.boot: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) boot SCHEME="$(SCHEME)" MAKE="$(MAKE)"
+ 
+ .PHONY: re.boot
+-re.boot: $(ZUO)
++re.boot: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) reboot SCHEME="$(SCHEME)"
+ 
+ # Supply XM=<machine> 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
+ .PHONY: bootquick
+-bootquick: $(ZUO)
++bootquick: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) bootquick "$(XM)" MAKE="$(MAKE)"
+ 
+ # `<machine>.bootquick` as alias for `boot XM=<machine>`
+-%.bootquick: $(ZUO)
++%.bootquick: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) bootquick $* MAKE="$(MAKE)"
+ 
+-auto.bootquick: $(ZUO)
++auto.bootquick: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) bootquick MAKE="$(MAKE)"
+ 
+ # Supply XM=<machine>-<tag>.bootpbchunk to repackage boot files for
+ # <machine> with pbchunk sources, including additional
+ # boot files
+ .PHONY: bootpbchunk
+-bootpbchunk: $(ZUO)
++bootpbchunk: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) bootpbchunk "$(XM)" $(ARGS) MAKE="$(MAKE)"
+ 
+ # `<machine>.bootpbchunk` as alias for `pbchunk XM=<machine>`
+-%.bootpbchunk: $(ZUO)
++%.bootpbchunk: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) bootpbchunk $* $(ARGS) MAKE="$(MAKE)"
+ 
+ .PHONY: docs
+-docs: build $(ZUO)
++docs: build $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) docs MAKE="$(MAKE)"
+ 
+ .PHONY: csug
+-csug: build $(ZUO)
++csug: build $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) csug MAKE="$(MAKE)"
+ 
+ .PHONY: release_notes
+-release_notes: build $(ZUO)
++release_notes: build $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) release_notes MAKE="$(MAKE)"
+ 
+ .PHONY: install-docs
+-install-docs: build $(ZUO)
++install-docs: build $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) install-docs MAKE="$(MAKE)"
+ 
+ .PHONY: install-csug
+-install-csug: build $(ZUO)
++install-csug: build $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) install-csug MAKE="$(MAKE)"
+ 
+ .PHONY: install-release_notes
+-install-release_notes: build $(ZUO)
++install-release_notes: build $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) install-release_notes MAKE="$(MAKE)"
+ 
+ .PHONY: bintar
+-bintar: $(ZUO)
++bintar: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) bintar MAKE="$(MAKE)"
+ 
+ .PHONY: rpm
+-rpm: $(ZUO)
++rpm: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) rpm MAKE="$(MAKE)"
+ 
+ .PHONY: pkg
+-pkg: $(ZUO)
++pkg: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) pkg MAKE="$(MAKE)"
+ 
+ .PHONY: clean
+-clean: $(ZUO)
++clean: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) clean MAKE="$(MAKE)"
+ 	$(RM_ZUO)
+ 
+-- 
+2.41.0
+
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index 6e19be1da3..d366f89845 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -105,7 +105,9 @@ (define-module (gnu packages racket)
 ;; 'distro-build' package to assemble custom Racket distributions. (Again,
 ;; the makefile just delegates to Zuo.) It is not part of Racket source
 ;; distributions: the root of a source distribution is basically 'racket/src'
-;; with some extra package sources and configuration added.
+;; with some extra package sources and configuration added. In fact, the
+;; top-level 'Makefile' and the 'distro-build' package are what create Racket
+;; source distributions.
 ;;
 ;; A ''minimal Racket'' installation includes two packages: 'base', which is a
 ;; sort of bridge between the current ``built-in'' collections and the package
@@ -191,7 +193,7 @@ (define-module (gnu packages racket)
 ;;
 ;; CODE:
 
-(define %racket-version "8.11.1") ; Remember to update chez-scheme-for-racket!
+(define %racket-version "8.12") ; Remember to update chez-scheme-for-racket!
 (define %racket-commit
   (string-append "v" %racket-version))
 (define %racket-origin
@@ -201,16 +203,16 @@ (define %racket-origin
           (url "https://github.com/racket/racket")
           (commit %racket-commit)))
     (sha256
-     (base32 "1iny1mn1lw07lj6h704ch5g2q1nsf0h88dgwqrlxhf8pwj4i76gl"))
+     (base32 "1f52yadmrsd2ddry47s68kxig185a58n19j23458wkck19nawjz5"))
     (file-name (git-file-name "racket" %racket-version))
     (patches (search-patches "racket-chez-scheme-bin-sh.patch"
-                             "racket-backport-8.11-layered-docs.patch"
+                             "racket-backport-8.12-chez-configure.patch"
                              "racket-rktio-bin-sh.patch"))
     (modules '((guix build utils)))
     (snippet
      #~(begin
          (use-modules (guix build utils))
-         ;; Unbundle Chez submodules.
+         ;; Unbundle Chez submodules and boot files.
          (with-directory-excursion "racket/src/ChezScheme"
            ;; TODO: consider putting this in a (guix ...) or (guix build ...)
            ;; module so it can be shared with the upstream Chez Scheme origin
@@ -218,10 +220,14 @@ (define %racket-origin
            (for-each (lambda (dir)
                        (when (directory-exists? dir)
                          (delete-file-recursively dir)))
-                     '("stex"
-                       "nanopass"
+                     '("boot"
                        "lz4"
-                       "zlib")))
+                       "nanopass"
+                       "stex"
+                       "zlib"
+                       "zuo")))
+         ;; Unbundle Zuo.
+         (delete-file-recursively "racket/src/zuo")
          ;; Unbundle libffi.
          (delete-file-recursively "racket/src/bc/foreign/libffi")))))
 
@@ -445,10 +451,8 @@ (define-public racket-vm-cs
      (substitute-keyword-arguments (package-arguments racket-vm-cgc)
        ((#:phases those-phases #~%standard-phases)
         #~(modify-phases #$those-phases
-            (add-after 'unpack 'unpack-nanopass+stex
-              (lambda args
-                (with-directory-excursion "racket/src/ChezScheme"
-                  #$unpack-nanopass+stex)))))
+            (add-after 'unpack 'unpack-nanopass
+              #$unpack-nanopass)))
        ((#:configure-flags _ '())
         #~(cons* "--enable-csonly"
                  "--enable-libz"
@@ -697,7 +701,7 @@ (define-public racket
        "contract-profile" (base32 "1xm2z8g0dpv5d9h2sg680vx1a8ix9gbsdpxxb8qv1w7akp73paj3")
        '(("contract-profile" ".")))
       (simple-racket-origin
-       "data" (base32 "1pml8g3zgvnaiqb659psh99m70v96m6nh9zash2vfgir46j4rjnh")
+       "data" (base32 "01sinnsnjiazvkj83k84izdnp38pd2aglbrs14mrdkwajgmpampk")
        '("data" "data-doc" "data-enumerate-lib" "data-lib"))
       (simple-racket-origin
        "datalog" (base32 "0nf6cy4djpyhfvgpa6yn72apbz9s83gp0qg95pzjd0az4v6qwq1s")
@@ -706,7 +710,7 @@ (define-public racket
        "db" (base32 "0xx0k8yw2vb9b4vk2dwjfbpixnmriqsv7kpv3fvfxbwyg42y0db5")
        '("db" "db-doc" "db-lib"))
       (simple-racket-origin
-       "deinprogramm" (base32 "0ijngjyg2i528a4xv20db4adirvx5rj4m86fd70l33lgwv53w3s0")
+       "deinprogramm" (base32 "0f41sh90i4mml95x2gcmfvl2rc7m77vjbagmgjx270ng7xvz16lj")
        '("deinprogramm" "deinprogramm-signature"))
       (simple-racket-origin
        "distributed-places" (base32 "1dajpkj9balqcpv6cdk9hwjz592h1vq8rrx5vncariiac4vbdpa0")
@@ -715,7 +719,7 @@ (define-public racket
        "draw" (base32 "1h7mckay8yjcgmj3r0jkf1csn430gn43n8jl1l956q9gcprlmncl")
        '("draw" "draw-doc" "draw-lib"))
       (simple-racket-origin
-       "drracket" (base32 "00ay3pwl648wq8nnaap665c38clr39k0g1wslh2wclar32wjpgdc")
+       "drracket" (base32 "17bdbvsf5l8z96bwzg1q75gg70c6svbhw0g1k239fsjd3mivmki4")
        '("drracket"
          "drracket-plugin-lib"
          "drracket-tool"
@@ -749,13 +753,13 @@ (define-public racket
        "games" (base32 "13z7fnbr48s98lmfxc0nbfhbqkd4hphymy2r63hqm783xzn6ylzi")
        '(("games" ".")))
       (simple-racket-origin
-       "gui" (base32 "10mlajn5xqgdwi7gf9lgszfv609pjp8m24lm97b8xh6fmjlkqi4b")
+       "gui" (base32 "08kzyscqc8hgc1f8q0bhibl44fkq8iiyz12f8bqdhqkcz8nx44sw")
        '("gui" "gui-doc" "gui-lib" "tex-table"))
       (simple-racket-origin
        "gui-pkg-manager" (base32 "1ji9448d723nklqvycwdswj0ni28sabrncag14f9mx47did5myb5")
        '("gui-pkg-manager-lib"))
       (simple-racket-origin
-       "htdp" (base32 "04p2xp4hnnsnmrmvw05fg4fv18k3g2rz5gmgs89sc6g8y886m6zz")
+       "htdp" (base32 "13d8xsvs60d7797w93g14dbdm98bixgy65akayij256pyiwnqwdc")
        '("htdp" "htdp-doc" "htdp-lib"))
       (simple-racket-origin
        "html" (base32 "18n1jnjgzfknc8nv8dppi85nb8q08gqdwkg6hfjk08x0p00anx2x")
@@ -797,7 +801,7 @@ (define-public racket
                              (url "https://github.com/RenaissanceBug/racket-cookies")
                              (commit %racket-commit)))
                        (sha256 (base32
-                                "05lnml9nszcq72k8bi4iwdyplp2iv23ywb2gmrs2hr8837fqi65y"))
+                                "1zr31y1gqa3kkrwlf9bnw08nzij00x1l70qhfbpz0239bksn4mmb"))
                        (file-name
                         (git-file-name "RenaissanceBug-racket-cookies" %racket-version)))
        '("net-cookies" "net-cookies-doc" "net-cookies-lib"))
@@ -823,7 +827,7 @@ (define-public racket
        "pconvert" (base32 "00czi0p399mmyrvxyrs5kniizpkqfxyz2ncxqi2jy79a7wk79pb1")
        '("pconvert-lib"))
       (simple-racket-origin
-       "pict" (base32 "1vsn91r167wssaflzz080nsrcf0jfhl2a48zcj9hvdb77arbj8kc")
+       "pict" (base32 "1ghds5by8i0k2djbig82xqp2ssy3nvdwm45l8ibsr99y0ay6z7gv")
        '("pict" "pict-doc" "pict-lib"))
       (simple-racket-origin
        "pict-snip" (base32 "081nwiy4a0n4f7xws16hqbhf0j3kz5alizndi3nnyr3chm4kng6x")
@@ -838,7 +842,7 @@ (define-public racket
        "planet" (base32 "0r2yqrzrmdjjyr14k6hhlzc5kzrcx3583m1s02mhrcmpfw0s85w9")
        '("planet" "planet-doc" "planet-lib"))
       (simple-racket-origin
-       "plot" (base32 "17fhsymy884xr4jqk585rm5kwdgkgz0635916gh5y0fsnp5pir70")
+       "plot" (base32 "0jq9a366g7b2c9vp6yvpqikvklgyd6p4xj6v224g99yj8cgip40b")
        '("plot" "plot-compat" "plot-doc" "plot-gui-lib" "plot-lib"))
       (simple-racket-origin
        "preprocessor" (base32 "1p5aid58ifnjy4xl0ysh85cq39k25661v975jrpk182z3k5621mg")
@@ -852,11 +856,8 @@ (define-public racket
                        (uri (git-reference
                              (url "https://github.com/Metaxal/quickscript")
                              (commit %racket-commit)))
-                       (snippet
-                        ;; See https://github.com/Metaxal/quickscript/issues/73
-                        #~(delete-file "register.rkt"))
                        (sha256 (base32
-                                "0v27qknghfi0058vk8xwwlwqgqwdsxxmprrmag64cyygdz95sxym"))
+                                "1ahznb9rhgaixd3fqn0pxighw4zbflwqc84r2yvn5nsfbp0mrq9b"))
                        (file-name (git-file-name "Metaxal-quickscript" %racket-version)))
        '(("quickscript" ".")))
       (simple-racket-origin
@@ -880,7 +881,7 @@ (define-public racket
        "racklog" (base32 "0fr8xij0sssfnmwn6dfdi4jj3l62f2yj3jrjljv13kaycrfls032")
        '(("racklog" ".")))
       (simple-racket-origin
-       "rackunit" (base32 "0axcy8283qqmcrhwwn0q0sfjznc8gkwbx06j41anayi5v9xp4698")
+       "rackunit" (base32 "06kpl51alm7akgmmh110ya28zgmx3as0szykfv2gwqmf7xcms1b7")
        '("rackunit"
          "rackunit-doc"
          "rackunit-gui"
@@ -896,7 +897,7 @@ (define-public racket
        "realm" (base32 "0rlvwyd6rpyl0zda4a5p8dp346fvqzc8555dgfnrhliymkxb6x4g")
        '(("realm" ".")))
       (simple-racket-origin
-       "redex" (base32 "016m2fvfxjnx7l0ai6jlcmz4s8xipbq9k58fq7109akj9mvczgp9")
+       "redex" (base32 "1mwnxbfk2vbalndlq0996rzdi3a2z48m5xnb1ywzlsvnydrnkrk2")
        '("redex"
          "redex-benchmark"
          "redex-doc"
@@ -911,7 +912,7 @@ (define-public racket
        "scheme-lib" (base32 "0pcf0y8rp4qyjhaz5ww5sr5diq0wpcdfrrnask7zapyklzx1jx8x")
        '(("scheme-lib" ".")))
       (simple-racket-origin
-       "scribble" (base32 "0igcjgmpzbzzn1jfpa4jq18lqyhr6dsdwnbv6zv87x8cib9rwqrh")
+       "scribble" (base32 "0rk5q9r9fw826ag0npk5cwkzkapj2p243wwm9gn2l7j7cr6z1rvb")
        '("scribble"
          "scribble-doc"
          "scribble-html-lib"
@@ -943,7 +944,7 @@ (define-public racket
        "snip" (base32 "1b90ccqilnyszbphms3svm3c7dbk7870ifybjjipss5srb32mj2d")
        '("snip" "snip-lib"))
       (simple-racket-origin
-       "typed-racket" (base32 "17mz7zqrialxfzkynj7h3kfhawdd6cgs24ns437gz087g2pmwi1x")
+       "typed-racket" (base32 "0vdsyr0qhpvac6h8mfdy6vqrsqsfa7kpg39n3h637hccxyfxv63f")
        '("source-syntax"
          "typed-racket"
          "typed-racket-compatibility"
@@ -954,7 +955,7 @@ (define-public racket
        "srfi" (base32 "1l3nr3a8mlp505aaxlyp4i8jfijmpyl9h1wwv8hzm4kzzjv4sl8p")
        '("srfi" "srfi-doc" "srfi-lib" "srfi-lite-lib"))
       (simple-racket-origin
-       "string-constants" (base32 "1djbjhsimikk18dkrajrlgjhlqfyvna4nz64ha4wjcaj5cfgcvdx")
+       "string-constants" (base32 "0225f1wmq1n9f2x1pg50fssdnd4bpc11q1jgsykwf4ik4fnaa520")
        '("string-constants" "string-constants-doc" "string-constants-lib"))
       (simple-racket-origin
        "swindle" (base32 "1q8vdxpzczzwdw2mys2caab45yvadmqkixsr29k8pl03n8dsg8j9")
@@ -969,7 +970,7 @@ (define-public racket
        "unix-socket" (base32 "02dfwas5ynbpyz74w9kwb4wgb37y5wys7svrlmir8k0n9ph9vq0y")
        '("unix-socket" "unix-socket-doc" "unix-socket-lib"))
       (simple-racket-origin
-       "web-server" (base32 "0vhw1hwdcv1ham086dy0nkl4r0a5qvsimw8048zjakvax7q4shsg")
+       "web-server" (base32 "1i4sxmcgj00ml7czsbyx1433hgf091n1p54xyal2f1fsskx5fg0y")
        '("web-server" "web-server-doc" "web-server-lib"))
       (simple-racket-origin
        "wxme" (base32 "1qp5gr9gqsakiq3alw6m4yyv5vw4i3hp4y4nhq8vl2nkjmirvn0b")
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH 3/6] gnu: chez-scheme: Reorganize package definitions.
  2024-03-29  5:15 [bug#70065] [PATCH 0/6] gnu: Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9 Philip McGrath
  2024-03-29  5:18 ` [bug#70065] [PATCH 1/6] gnu: zuo: Update to 1.9 Philip McGrath
  2024-03-29  5:18 ` [bug#70065] [PATCH 2/6] gnu: racket: Update to 8.12 Philip McGrath
@ 2024-03-29  5:18 ` Philip McGrath
  2024-03-30 14:35   ` Skyler Ferris via Guix-patches via
  2024-03-29  5:18 ` [bug#70065] [PATCH 4/6] gnu: chez-scheme: Update to 10.0.0 Philip McGrath
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 39+ messages in thread
From: Philip McGrath @ 2024-03-29  5:18 UTC (permalink / raw)
  To: 70065; +Cc: Philip McGrath

A future commit will change 'chez-scheme' to inherit from
'chez-scheme-for-racket', so 'chez-scheme-for-racket' will need to be
defined before 'chez-scheme'.  In an attempt to produce better diffs,
this commit re-orders the definitions while keeping their contents
exactly the same.

* gnu/packages/chez.scm (chez-scheme): Move below
'chez-scheme-for-racket'.
(chez-scheme-bootstrap-bootfiles): Move below
'chez-scheme-for-racket-bootstrap-bootfiles'.

Change-Id: Ie088abea2b44329f9d8399fbfb95c51d8912b05e
---
 gnu/packages/chez.scm | 426 +++++++++++++++++++++---------------------
 1 file changed, 213 insertions(+), 213 deletions(-)

diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index c71d6fafd5..3b7e6a67b3 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -282,191 +282,6 @@ (define unpack-nanopass
                                              "lib/chez-scheme/nanopass.ss"))
                  "nanopass"))))
 
-(define-public chez-scheme
-  (package
-    (name "chez-scheme")
-    ;; The version should match `(scheme-version-number)`.
-    ;; See s/cmacros.ss c. line 360.
-    (version "9.5.8")
-    (source (origin
-              (method git-fetch)
-              (uri (git-reference
-                    (url "https://github.com/cisco/ChezScheme")
-                    (commit (string-append "v" version))))
-              (sha256
-               (base32
-                "0xchqq8cm0ka5wgpn18sjs0hh15rc3nb7xrjqbbc9al3asq0d7gc"))
-              (file-name (git-file-name name version))
-              (patches (search-patches "chez-scheme-bin-sh.patch"))
-              (snippet #~(begin
-                           (use-modules (guix build utils))
-                           ;; TODO: consider putting this in a (guix ...) or
-                           ;; (guix build ...)  module so it can be shared
-                           ;; with the Racket origin without cyclic issues.
-                           (for-each (lambda (dir)
-                                       (when (directory-exists? dir)
-                                         (delete-file-recursively dir)))
-                                     '("stex"
-                                       "nanopass"
-                                       "lz4"
-                                       "zlib"))))))
-    (build-system gnu-build-system)
-    (inputs
-     (list
-      chez-scheme-bootstrap-bootfiles
-      `(,util-linux "lib") ;<-- libuuid
-      zlib
-      lz4
-      ncurses ;<-- for expeditor
-      ;; for X11 clipboard support in expeditor:
-      ;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
-      libx11))
-    (native-inputs (list chez-nanopass-bootstrap
-                         stex-bootstrap))
-    (native-search-paths
-     (list (search-path-specification
-            (variable "CHEZSCHEMELIBDIRS")
-            (files '("lib/chez-scheme")))))
-    (outputs '("out" "doc"))
-    (arguments
-     (list
-      #:modules
-      '((guix build gnu-build-system)
-        (guix build utils)
-        (ice-9 ftw)
-        (ice-9 match))
-      #:test-target "test"
-      #: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
-            (lambda args
-              (begin
-                (copy-recursively
-                 (dirname (search-input-file %build-inputs
-                                             "lib/chez-scheme/nanopass.ss"))
-                 "nanopass"
-                 #:keep-mtime? #t)
-                (mkdir-p "stex")
-                (with-output-to-file "stex/Mf-stex"
-                  (lambda ()
-                    ;; otherwise, it will try to download submodules
-                    (display "# to placate ../configure"))))))
-          (add-after 'unpack-nanopass+stex 'unpack-bootfiles
-            (lambda* (#:key native-inputs inputs #:allow-other-keys)
-              (when (directory-exists? "boot")
-                (delete-file-recursively "boot"))
-              (copy-recursively
-               (search-input-directory inputs
-                                       "lib/chez-scheme-bootfiles")
-               "boot")))
-          ;; NOTE: The custom Chez 'configure' script doesn't allow
-          ;; unrecognized flags, such as those automatically added
-          ;; by `gnu-build-system`. This replacement phase uses only
-          ;; the explicitly provided `#:configure-flags`.
-          (replace 'configure
-            (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.
-          (add-after 'install 'install-symlink
-            (lambda* (#:key outputs #:allow-other-keys)
-              (let* ((scheme (search-input-file outputs "/bin/scheme"))
-                     (bin-dir (dirname scheme)))
-                (symlink scheme
-                         (string-append bin-dir "/chez-scheme"))
-                (match (find-files (string-append bin-dir "/../lib")
-                                   "scheme.boot")
-                  ((scheme.boot)
-                   (symlink scheme.boot
-                            (string-append (dirname scheme.boot)
-                                           "/chez-scheme.boot")))))))
-          ;; Building the documentation requires stex and a running scheme.
-          (add-after 'install-symlink 'install-docs
-            (lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
-              (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")))))))))
-    (supported-systems
-     (delete
-      "armhf-linux" ;; XXX reportedly broken, needs checking
-      (filter chez-upstream-features-for-system
-              %supported-systems)))
-    (home-page "https://cisco.github.io/ChezScheme/")
-    (synopsis "R6RS Scheme compiler and run-time")
-    (description
-     "Chez Scheme is a compiler and run-time system for the language of the
-Revised^6 Report on Scheme (R6RS), with numerous extensions.  The compiler
-generates native code for each target processor, with support for x86, x86_64,
-and 32-bit PowerPC architectures.")
-    (license asl2.0)))
-
 (define chez-configure
   ;; The custom Chez 'configure' script doesn't allow unrecognized flags, such
   ;; as those automatically added by `gnu-build-system`. This replacement
@@ -686,39 +501,194 @@ (define-public chez-scheme-for-racket
 version of Chez Scheme.")
     (license asl2.0)))
 
-;;
-;; Bootfiles:
-;;
-
-(define-public chez-scheme-bootstrap-bootfiles
+(define-public chez-scheme
   (package
-    (inherit chez-scheme)
-    (name "chez-scheme-bootstrap-bootfiles")
-    (inputs '())
-    (native-inputs '())
-    (outputs '("out"))
-    (build-system copy-build-system)
-    ;; TODO: cross compilation
+    (name "chez-scheme")
+    ;; The version should match `(scheme-version-number)`.
+    ;; See s/cmacros.ss c. line 360.
+    (version "9.5.8")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/cisco/ChezScheme")
+                    (commit (string-append "v" version))))
+              (sha256
+               (base32
+                "0xchqq8cm0ka5wgpn18sjs0hh15rc3nb7xrjqbbc9al3asq0d7gc"))
+              (file-name (git-file-name name version))
+              (patches (search-patches "chez-scheme-bin-sh.patch"))
+              (snippet #~(begin
+                           (use-modules (guix build utils))
+                           ;; TODO: consider putting this in a (guix ...) or
+                           ;; (guix build ...)  module so it can be shared
+                           ;; with the Racket origin without cyclic issues.
+                           (for-each (lambda (dir)
+                                       (when (directory-exists? dir)
+                                         (delete-file-recursively dir)))
+                                     '("stex"
+                                       "nanopass"
+                                       "lz4"
+                                       "zlib"))))))
+    (build-system gnu-build-system)
+    (inputs
+     (list
+      chez-scheme-bootstrap-bootfiles
+      `(,util-linux "lib") ;<-- libuuid
+      zlib
+      lz4
+      ncurses ;<-- for expeditor
+      ;; for X11 clipboard support in expeditor:
+      ;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
+      libx11))
+    (native-inputs (list chez-nanopass-bootstrap
+                         stex-bootstrap))
+    (native-search-paths
+     (list (search-path-specification
+            (variable "CHEZSCHEMELIBDIRS")
+            (files '("lib/chez-scheme")))))
+    (outputs '("out" "doc"))
     (arguments
-     (list #:install-plan
-           #~`(("boot/" "lib/chez-scheme-bootfiles"))))
+     (list
+      #:modules
+      '((guix build gnu-build-system)
+        (guix build utils)
+        (ice-9 ftw)
+        (ice-9 match))
+      #:test-target "test"
+      #: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
+            (lambda args
+              (begin
+                (copy-recursively
+                 (dirname (search-input-file %build-inputs
+                                             "lib/chez-scheme/nanopass.ss"))
+                 "nanopass"
+                 #:keep-mtime? #t)
+                (mkdir-p "stex")
+                (with-output-to-file "stex/Mf-stex"
+                  (lambda ()
+                    ;; otherwise, it will try to download submodules
+                    (display "# to placate ../configure"))))))
+          (add-after 'unpack-nanopass+stex 'unpack-bootfiles
+            (lambda* (#:key native-inputs inputs #:allow-other-keys)
+              (when (directory-exists? "boot")
+                (delete-file-recursively "boot"))
+              (copy-recursively
+               (search-input-directory inputs
+                                       "lib/chez-scheme-bootfiles")
+               "boot")))
+          ;; NOTE: The custom Chez 'configure' script doesn't allow
+          ;; unrecognized flags, such as those automatically added
+          ;; by `gnu-build-system`. This replacement phase uses only
+          ;; the explicitly provided `#:configure-flags`.
+          (replace 'configure
+            (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.
+          (add-after 'install 'install-symlink
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let* ((scheme (search-input-file outputs "/bin/scheme"))
+                     (bin-dir (dirname scheme)))
+                (symlink scheme
+                         (string-append bin-dir "/chez-scheme"))
+                (match (find-files (string-append bin-dir "/../lib")
+                                   "scheme.boot")
+                  ((scheme.boot)
+                   (symlink scheme.boot
+                            (string-append (dirname scheme.boot)
+                                           "/chez-scheme.boot")))))))
+          ;; Building the documentation requires stex and a running scheme.
+          (add-after 'install-symlink 'install-docs
+            (lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
+              (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")))))))))
     (supported-systems
-     (filter (lambda (system)
-               (and=> (chez-upstream-features-for-system system)
-                      (cut memq 'bootstrap-bootfiles <>)))
-             %supported-systems))
-    (synopsis "Chez Scheme bootfiles (binary seed)")
+     (delete
+      "armhf-linux" ;; XXX reportedly broken, needs checking
+      (filter chez-upstream-features-for-system
+              %supported-systems)))
+    (home-page "https://cisco.github.io/ChezScheme/")
+    (synopsis "R6RS Scheme compiler and run-time")
     (description
-     "Chez Scheme is a self-hosting compiler: building it requires
-``bootfiles'' containing the Scheme-implemented portions compiled for the
-current platform.  (Chez can then cross-compile bootfiles for all other
-supported platforms.)
+     "Chez Scheme is a compiler and run-time system for the language of the
+Revised^6 Report on Scheme (R6RS), with numerous extensions.  The compiler
+generates native code for each target processor, with support for x86, x86_64,
+and 32-bit PowerPC architectures.")
+    (license asl2.0)))
 
-This package provides bootstrap bootfiles for upstream Chez Scheme.
-Currently, it simply packages the binaries checked in to the upstream
-repository.  Hopefully we can eventually adapt Racket's @code{cs-bootstrap} to
-work with upstream Chez Scheme so that we can bootstrap these files from
-source.")))
+;;
+;; Bootfiles:
+;;
 
 (define-public chez-scheme-for-racket-bootstrap-bootfiles
   (package
@@ -800,6 +770,36 @@ (define-public chez-scheme-for-racket-bootstrap-bootfiles
 7.1 and later, including the Racket BC variant.")
     (license asl2.0)))
 
+(define-public chez-scheme-bootstrap-bootfiles
+  (package
+    (inherit chez-scheme)
+    (name "chez-scheme-bootstrap-bootfiles")
+    (inputs '())
+    (native-inputs '())
+    (outputs '("out"))
+    (build-system copy-build-system)
+    ;; TODO: cross compilation
+    (arguments
+     (list #:install-plan
+           #~`(("boot/" "lib/chez-scheme-bootfiles"))))
+    (supported-systems
+     (filter (lambda (system)
+               (and=> (chez-upstream-features-for-system system)
+                      (cut memq 'bootstrap-bootfiles <>)))
+             %supported-systems))
+    (synopsis "Chez Scheme bootfiles (binary seed)")
+    (description
+     "Chez Scheme is a self-hosting compiler: building it requires
+``bootfiles'' containing the Scheme-implemented portions compiled for the
+current platform.  (Chez can then cross-compile bootfiles for all other
+supported platforms.)
+
+This package provides bootstrap bootfiles for upstream Chez Scheme.
+Currently, it simply packages the binaries checked in to the upstream
+repository.  Hopefully we can eventually adapt Racket's @code{cs-bootstrap} to
+work with upstream Chez Scheme so that we can bootstrap these files from
+source.")))
+
 ;;
 ;; Chez's bootstrap dependencies:
 ;;
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH 4/6] gnu: chez-scheme: Update to 10.0.0.
  2024-03-29  5:15 [bug#70065] [PATCH 0/6] gnu: Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9 Philip McGrath
                   ` (2 preceding siblings ...)
  2024-03-29  5:18 ` [bug#70065] [PATCH 3/6] gnu: chez-scheme: Reorganize package definitions Philip McGrath
@ 2024-03-29  5:18 ` Philip McGrath
  2024-03-30  7:56   ` Liliana Marie Prikler
  2024-03-30 14:39   ` Skyler Ferris via Guix-patches via
  2024-03-29  5:18 ` [bug#70065] [PATCH 5/6] gnu: chez-scheme: Update and simplify machine-type handling Philip McGrath
                   ` (2 subsequent siblings)
  6 siblings, 2 replies; 39+ messages in thread
From: Philip McGrath @ 2024-03-29  5:18 UTC (permalink / raw)
  To: 70065
  Cc: Andrew Tropin, Katherine Cox-Buday, Liliana Marie Prikler,
	Philip McGrath

* gnu/packages/patches/chez-scheme-bin-sh.patch: Refresh patch.
* gnu/packages/patches/chez-scheme-backport-configure.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/chez.scm (chez-scheme): Update to 10.0.0.  Inherit from
'chez-scheme-for-racket'.
[source]<patches>: Use "chez-scheme-backport-configure.patch".
<snippet>: Also unbundle Zuo.
[native-inputs, native-search-paths, outputs, arguments]
[supported-systems]: Inherit from 'chez-scheme-for-racket'.
[inputs]: Likewise, replacing the bootfile package and adding libx11.
[description]: Update based on the User's Guide, release notes, man
page, and README file.
(chez-scheme-bootstrap-bootfiles)[supported-systems]: All systems are
now supported.
(chez-scheme-for-system): Deprecate it, since 'chez-scheme' now supports
all systems.
(chez-srfi, chez-web, chez-sockets, chez-matchable, chez-irregex)
(chez-fmt, chez-mit, chez-scmutils)[native-inputs]: Use 'chez-scheme'
instead of 'chez-scheme-for-system'.
* gnu/packages/emacs-xyz.scm (emacs-geiser-chez)[inputs]: Likewise.

Change-Id: I287ff66f385f20e69c1411abcc94f19dd45870c5
---
 gnu/local.mk                                  |   1 +
 gnu/packages/chez.scm                         | 222 ++-------
 gnu/packages/emacs-xyz.scm                    |   2 +-
 .../chez-scheme-backport-configure.patch      | 463 ++++++++++++++++++
 gnu/packages/patches/chez-scheme-bin-sh.patch |  37 +-
 5 files changed, 522 insertions(+), 203 deletions(-)
 create mode 100644 gnu/packages/patches/chez-scheme-backport-configure.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index a10aa2cefd..b5f922b538 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1017,6 +1017,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/ccextractor-add-missing-header.patch	\
   %D%/packages/patches/ccextractor-autoconf-tesseract.patch	\
   %D%/packages/patches/ccextractor-fix-ocr.patch		\
+  %D%/packages/patches/chez-scheme-backport-configure.patch	\
   %D%/packages/patches/chez-scheme-bin-sh.patch			\
   %D%/packages/patches/circos-remove-findbin.patch		\
   %D%/packages/patches/cdparanoia-fpic.patch			\
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 3b7e6a67b3..406180ce0f 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -27,6 +27,7 @@ (define-module (gnu packages chez)
                 #:select (gpl2+ gpl3+ lgpl2.0+ lgpl2.1+ asl2.0 bsd-3 expat
                           public-domain))
   #:use-module (guix packages)
+  #:use-module (guix deprecation)
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix utils)
@@ -68,22 +69,9 @@ (define-module (gnu packages chez)
 ;;
 ;; Code:
 
-(define* (chez-scheme-for-system #:optional
-                                 (system (or (%current-target-system)
-                                             (%current-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))
+(define-deprecated (chez-scheme-for-system #:optional system) chez-scheme
+  "Returns 'chez-scheme'."
+  chez-scheme)
 
 (define* (target-chez-arch #:optional (system
                                        (or (%current-target-system)
@@ -503,10 +491,11 @@ (define-public chez-scheme-for-racket
 
 (define-public chez-scheme
   (package
+    (inherit chez-scheme-for-racket)
     (name "chez-scheme")
-    ;; The version should match `(scheme-version-number)`.
+    ;; The version should match `(scheme-version-number #t)`.
     ;; See s/cmacros.ss c. line 360.
-    (version "9.5.8")
+    (version "10.0.0")
     (source (origin
               (method git-fetch)
               (uri (git-reference
@@ -514,9 +503,10 @@ (define-public chez-scheme
                     (commit (string-append "v" version))))
               (sha256
                (base32
-                "0xchqq8cm0ka5wgpn18sjs0hh15rc3nb7xrjqbbc9al3asq0d7gc"))
+                "1q66vafhiwk617z51qkm1v64r3bxqhhf5lzrmsa4l9d5yhvlyk09"))
               (file-name (git-file-name name version))
-              (patches (search-patches "chez-scheme-bin-sh.patch"))
+              (patches (search-patches "chez-scheme-backport-configure.patch"
+                                       "chez-scheme-bin-sh.patch"))
               (snippet #~(begin
                            (use-modules (guix build utils))
                            ;; TODO: consider putting this in a (guix ...) or
@@ -525,165 +515,30 @@ (define-public chez-scheme
                            (for-each (lambda (dir)
                                        (when (directory-exists? dir)
                                          (delete-file-recursively dir)))
-                                     '("stex"
+                                     '("lz4"
                                        "nanopass"
-                                       "lz4"
-                                       "zlib"))))))
+                                       "stex"
+                                       "zlib"
+                                       "zuo"))))))
     (build-system gnu-build-system)
     (inputs
-     (list
-      chez-scheme-bootstrap-bootfiles
-      `(,util-linux "lib") ;<-- libuuid
-      zlib
-      lz4
-      ncurses ;<-- for expeditor
-      ;; for X11 clipboard support in expeditor:
-      ;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
-      libx11))
-    (native-inputs (list chez-nanopass-bootstrap
-                         stex-bootstrap))
-    (native-search-paths
-     (list (search-path-specification
-            (variable "CHEZSCHEMELIBDIRS")
-            (files '("lib/chez-scheme")))))
-    (outputs '("out" "doc"))
-    (arguments
-     (list
-      #:modules
-      '((guix build gnu-build-system)
-        (guix build utils)
-        (ice-9 ftw)
-        (ice-9 match))
-      #:test-target "test"
-      #: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
-            (lambda args
-              (begin
-                (copy-recursively
-                 (dirname (search-input-file %build-inputs
-                                             "lib/chez-scheme/nanopass.ss"))
-                 "nanopass"
-                 #:keep-mtime? #t)
-                (mkdir-p "stex")
-                (with-output-to-file "stex/Mf-stex"
-                  (lambda ()
-                    ;; otherwise, it will try to download submodules
-                    (display "# to placate ../configure"))))))
-          (add-after 'unpack-nanopass+stex 'unpack-bootfiles
-            (lambda* (#:key native-inputs inputs #:allow-other-keys)
-              (when (directory-exists? "boot")
-                (delete-file-recursively "boot"))
-              (copy-recursively
-               (search-input-directory inputs
-                                       "lib/chez-scheme-bootfiles")
-               "boot")))
-          ;; NOTE: The custom Chez 'configure' script doesn't allow
-          ;; unrecognized flags, such as those automatically added
-          ;; by `gnu-build-system`. This replacement phase uses only
-          ;; the explicitly provided `#:configure-flags`.
-          (replace 'configure
-            (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.
-          (add-after 'install 'install-symlink
-            (lambda* (#:key outputs #:allow-other-keys)
-              (let* ((scheme (search-input-file outputs "/bin/scheme"))
-                     (bin-dir (dirname scheme)))
-                (symlink scheme
-                         (string-append bin-dir "/chez-scheme"))
-                (match (find-files (string-append bin-dir "/../lib")
-                                   "scheme.boot")
-                  ((scheme.boot)
-                   (symlink scheme.boot
-                            (string-append (dirname scheme.boot)
-                                           "/chez-scheme.boot")))))))
-          ;; Building the documentation requires stex and a running scheme.
-          (add-after 'install-symlink 'install-docs
-            (lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
-              (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")))))))))
-    (supported-systems
-     (delete
-      "armhf-linux" ;; XXX reportedly broken, needs checking
-      (filter chez-upstream-features-for-system
-              %supported-systems)))
+     (modify-inputs (package-inputs chez-scheme-for-racket)
+       (replace "chez-scheme-for-racket-bootstrap-bootfiles"
+         chez-scheme-bootstrap-bootfiles)
+       ;; for X11 clipboard support in expeditor:
+       ;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
+       (prepend libx11)))
+    ;; replace unpack phase?
     (home-page "https://cisco.github.io/ChezScheme/")
     (synopsis "R6RS Scheme compiler and run-time")
     (description
-     "Chez Scheme is a compiler and run-time system for the language of the
-Revised^6 Report on Scheme (R6RS), with numerous extensions.  The compiler
-generates native code for each target processor, with support for x86, x86_64,
-and 32-bit PowerPC architectures.")
+     "Chez Scheme is both a programming language and a high-performance
+implementation of that language. The language is a superset of R6RS Scheme
+with numerous extensions, including native threads, non-blocking I/O, local
+modules, and much more.  Chez Scheme compiles source expressions incrementally
+to machine code, providing the speed of compiled code in an interactive
+system.  The system is intended to be as reliable and efficient as possible,
+with reliability taking precedence over efficiency if necessary.")
     (license asl2.0)))
 
 ;;
@@ -782,11 +637,6 @@ (define-public chez-scheme-bootstrap-bootfiles
     (arguments
      (list #:install-plan
            #~`(("boot/" "lib/chez-scheme-bootfiles"))))
-    (supported-systems
-     (filter (lambda (system)
-               (and=> (chez-upstream-features-for-system system)
-                      (cut memq 'bootstrap-bootfiles <>)))
-             %supported-systems))
     (synopsis "Chez Scheme bootfiles (binary seed)")
     (description
      "Chez Scheme is a self-hosting compiler: building it requires
@@ -1054,7 +904,7 @@ (define-public chez-srfi
        (file-name (git-file-name name version))))
     (build-system gnu-build-system)
     (native-inputs
-     (list (chez-scheme-for-system)))
+     (list chez-scheme))
     (arguments
      (list #:make-flags (chez-make-flags name version)
            #:test-target "test"
@@ -1085,7 +935,7 @@ (define-public chez-web
           (base32 "1dq25qygyncbfq4kwwqqgyyakfqjwhp5q23vrf3bff1p66nyfl3b"))))
       (build-system gnu-build-system)
       (native-inputs
-       (list (chez-scheme-for-system)
+       (list chez-scheme
              ghostscript
              (texlive-updmap.cfg
               (list texlive-charter
@@ -1152,7 +1002,7 @@ (define-public chez-sockets
           (base32 "1n5fbwwz51fdzvjackgmnsgh363g9inyxv7kmzi0469cwavwcx5m"))))
       (build-system gnu-build-system)
       (native-inputs
-       (list (chez-scheme-for-system)
+       (list chez-scheme
              chez-web
              (texlive-updmap.cfg)))
       (arguments
@@ -1238,7 +1088,7 @@ (define-public chez-matchable
     (inputs
      (list chez-srfi)) ; for tests
     (native-inputs
-     (list (chez-scheme-for-system)))
+     (list chez-scheme))
     (arguments
      (list #:make-flags (chez-make-flags name version)
            #:test-target "test"
@@ -1270,7 +1120,7 @@ (define-public chez-irregex
     (propagated-inputs
      (list chez-srfi)) ; for irregex-utils
     (native-inputs
-     (list (chez-scheme-for-system)))
+     (list chez-scheme))
     (arguments
      (list #:make-flags (chez-make-flags name version)
            #:test-target "test"
@@ -1301,7 +1151,7 @@ (define-public chez-fmt
     (propagated-inputs
      (list chez-srfi)) ; for irregex-utils
     (native-inputs
-     (list (chez-scheme-for-system)))
+     (list chez-scheme))
     (arguments
      (list #:make-flags (chez-make-flags name version)
            #:test-target "chez-check"
@@ -1364,7 +1214,7 @@ (define-public chez-mit
     (inputs
      (list chez-srfi))       ; for tests
     (native-inputs
-     (list (chez-scheme-for-system)))
+     (list chez-scheme))
     (arguments
      (list #:make-flags (chez-make-flags name version)
            #:test-target "test"
@@ -1395,7 +1245,7 @@ (define-public chez-scmutils
     (inputs
      (list chez-srfi))       ; for tests
     (native-inputs
-     (list (chez-scheme-for-system)))
+     (list chez-scheme))
     (propagated-inputs
      (list chez-mit chez-srfi))
     (arguments
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index d4819c62ce..731f479560 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -767,7 +767,7 @@ (define-public emacs-geiser-chez
                 (string-append
                  "(eval-after-load 'geiser-impl '" all ")"))))))))
     (inputs
-     (list (chez-scheme-for-system)))
+     (list chez-scheme))
     (propagated-inputs
      (list emacs-geiser))
     (home-page "https://nongnu.org/geiser/")
diff --git a/gnu/packages/patches/chez-scheme-backport-configure.patch b/gnu/packages/patches/chez-scheme-backport-configure.patch
new file mode 100644
index 0000000000..584dcb3f0b
--- /dev/null
+++ b/gnu/packages/patches/chez-scheme-backport-configure.patch
@@ -0,0 +1,463 @@
+From 24ab36374f2e366b6c939fffe8c129c8b0ae3b9c Mon Sep 17 00:00:00 2001
+From: Philip McGrath <philip@philipmcgrath.com>
+Date: Wed, 28 Feb 2024 19:41:22 -0500
+Subject: [PATCH 1/2] Repairs and improvements for building with external
+ dependencies (#807)
+
+* configure: fix zlib and lz4 submodule checks
+
+Conditionals to skip the submodule checks were using the wrong
+variable names, so the checks were always skipped. The correct
+behavior is to perform the check unless given `ZLIB=<zlib>` or
+`LZ4=<lz4>`, as applicable.
+
+* configure: support `ZUO=<zuo>`
+
+Supplying `ZUO=<zuo>` skips the submodule check in `configure`
+and configures the generated makefile not to build or remove Zuo.
+
+* configure: support `STEXLIB=<stex>`
+
+For compatibility with older scripts, when not explicitly configured,
+continue to honor the `STEXLIB` environment variable at build time.
+
+(cherry picked from commit b8838c3280ef10e115236d2f7ac9ae857f83e268)
+---
+ BUILDING              |  5 +++--
+ build.zuo             | 13 +++++++++----
+ configure             | 40 +++++++++++++++++++++++++++++++++-------
+ makefiles/Makefile.in |  6 ++----
+ 4 files changed, 47 insertions(+), 17 deletions(-)
+
+diff --git a/BUILDING b/BUILDING
+index 7b3dc9c8..9e9a268b 100644
+--- a/BUILDING
++++ b/BUILDING
+@@ -149,7 +149,8 @@ information on the supported options.
+ The generated makefile mostly just ensures that a `zuo` executable is
+ built in a `bin` directory, and then it defers the actual build work
+ to `zuo`, which uses the "main.zuo" file. If you have `zuo` installed,
+-you can use `zuo` directly instead of `make`. In general, instead of
++you can use `zuo` directly instead of `make`: in that case, you may
++wish to use `./configure ZUO=<zuo>`. In general, instead of
+ the command `make X` to build target `X` as described below, you can
+ use `zuo . X` (or `bin/zuo . X` after `bin/zuo` is built).
+ 
+@@ -333,7 +334,7 @@ The makefile supports several targets:
+  * `make clean`
+ 
+    Removes all built elements from the workarea, and then removes
+-   `bin/zuo`.
++   `bin/zuo` (unless configured with `ZUO=<zuo>`).
+ 
+ 
+ WINDOWS VIA COMMAND PROMPT
+diff --git a/build.zuo b/build.zuo
+index c21d2caa..c5896396 100644
+--- a/build.zuo
++++ b/build.zuo
+@@ -224,10 +224,15 @@
+            token))
+ 
+   (define stexlib
+-    (let ((found (assoc "STEXLIB" (hash-ref (runtime-env) 'env))))
+-      (if found
+-          (cdr found)
+-          (at-source "stex"))))
++    (let ([configured (hash-ref config 'STEXLIB "")]
++          [env (assoc "STEXLIB" (hash-ref (runtime-env) 'env))])
++      (cond
++        [(not (equal? "" configured))
++         configured]
++        [env
++         (cdr env)]
++        [else
++         (at-source "stex")])))
+   (define stex-sources
+     (source-tree stexlib))
+ 
+diff --git a/configure b/configure
+index 2b4b594e..782dd09b 100755
+--- a/configure
++++ b/configure
+@@ -93,6 +93,7 @@ default_warning_flags="-Wpointer-arith -Wall -Wextra -Wno-implicit-fallthrough"
+ CFLAGS_ADD=
+ zlibLib=
+ LZ4Lib=
++STEXLIB=
+ Kernel=KernelLib
+ buildKernelOnly=no
+ enableFrompb=yes
+@@ -103,6 +104,7 @@ moreBootFiles=
+ preloadBootFiles=
+ alwaysUseBootFile=
+ skipSubmoduleUpdate=
++zuoExternal=
+ 
+ CONFIG_UNAME=`uname`
+ 
+@@ -446,6 +448,12 @@ while [ $# != 0 ] ; do
+     LZ4=*)
+       LZ4Lib=`echo $1 | sed -e 's/^LZ4=//'`
+       ;;
++    STEXLIB=*)
++      STEXLIB=`echo $1 | sed -e 's/^STEXLIB=//'`
++      ;;
++    ZUO=*)
++      zuoExternal=`echo $1 | sed -e 's/^ZUO=//'`
++      ;;
+     *)
+       echo "option '$1' unrecognized or missing an argument; try $0 --help"
+       exit 1
+@@ -672,6 +680,8 @@ if [ "$help" = "yes" ]; then
+   echo "  STRIP=<strip>                     executable stripper"
+   echo "  ZLIB=<lib>                        link to <lib> instead of own zlib"
+   echo "  LZ4=<lib>                         link to <lib> instead of own LZ4"
++  echo "  STEXLIB=<stex>                    build docs with <stex> instead of own stex"
++  echo "  ZUO=<zuo>                         build with <zuo> instead of own Zuo"
+   echo ""
+   echo "Available machine types: $machs"
+   echo ""
+@@ -889,28 +899,39 @@ submod_instructions () {
+     exit 1
+ }
+ 
+-if [ ! -f "$srcdir"/zuo/configure ] ; then
+-    submod_instructions 'Source in "zuo" is missing'
++if [ "${zuoExternal}" = "" ] ; then
++    if [ ! -f "$srcdir"/zuo/configure ] ; then
++        submod_instructions 'Source in "zuo" is missing'
++    fi
++    ZUO="bin/zuo"
++    RM_ZUO="rm -f bin/zuo"
++    ZUO_TARGET="bin/zuo"
++else
++    ZUO="${zuoExternal}"
++    RM_ZUO="@echo 'Not cleaning external ${zuoExternal}'"
++    ZUO_TARGET="DoNotBuildZuo"
+ fi
+ 
+ if [ ! -f "$srcdir"/nanopass/nanopass.ss ] ; then
+     submod_instructions 'Source in "nanopass" is missing'
+ fi
+ 
+-if [ "${zlibDep}" != "" ] ; then
++if [ "${zlibLib}" = "" ] ; then
+     if [ ! -f "$srcdir"/zlib/configure ] ; then
+         submod_instructions 'Source in "zlib" is missing'
+     fi
+ fi
+ 
+-if [ "${LZ4Dep}" != "" ] ; then
++if [ "${LZ4Lib}" = "" ] ; then
+     if [ ! -f "$srcdir"/lz4/lib/Makefile ] ; then
+         submod_instructions 'Source in "lz4" is missing'
+     fi
+ fi
+ 
+-if [ ! -f "$srcdir"/stex/Mf-stex ] ; then
+-    submod_instructions 'Source in "stex" is missing'
++if [ "${STEXLIB}" = "" ] ; then
++    if [ ! -f "$srcdir"/stex/Mf-stex ] ; then
++        submod_instructions 'Source in "stex" is missing'
++    fi
+ fi
+ 
+ # more compile and link flags for c/Mf-unix and mats/Mf-unix
+@@ -1083,7 +1104,7 @@ cp "$srcdir"/makefiles/buildmain.zuo main.zuo
+ # Some idea, but in the workarea, so it refers to "workarea.zuo" here:
+ cp "$srcdir"/makefiles/workmain.zuo $w/main.zuo
+ 
+-# The content of "$w/Makefile" records configuration decisions,
++# The content of "$w/Mf-config" records configuration decisions,
+ # and the Zuo build script takes it from there
+ cat > $w/Mf-config << END
+ srcdir=$srcdir
+@@ -1119,6 +1140,7 @@ cursesLib=$cursesLib
+ ncursesLib=$ncursesLib
+ zlibLib=$zlibLib
+ LZ4Lib=$LZ4Lib
++STEXLIB=$STEXLIB
+ warningFlags=$warningFlags
+ Kernel=$Kernel
+ installscriptname=$installscriptname
+@@ -1130,6 +1152,10 @@ preloadBootFiles=$preloadBootFiles
+ alwaysUseBootFile=$alwaysUseBootFile
+ relativeBootFiles=$relativeBootFiles
+ 
++ZUO=$ZUO
++RM_ZUO=$RM_ZUO
++ZUO_TARGET=$ZUO_TARGET
++
+ InstallBin=$installbin
+ InstallLib=$installlib
+ InstallMan=$installman/man1
+diff --git a/makefiles/Makefile.in b/makefiles/Makefile.in
+index 3b95f065..0e3d307d 100644
+--- a/makefiles/Makefile.in
++++ b/makefiles/Makefile.in
+@@ -3,8 +3,6 @@ workarea=$(w)
+ 
+ include $(workarea)/Mf-config
+ 
+-ZUO=bin/zuo
+-
+ .PHONY: build
+ build: $(ZUO)
+ 	+ $(ZUO) $(workarea) MAKE="$(MAKE)"
+@@ -144,9 +142,9 @@ pkg: $(ZUO)
+ .PHONY: clean
+ clean: $(ZUO)
+ 	+ $(ZUO) $(workarea) clean MAKE="$(MAKE)"
+-	rm -f bin/zuo
++	$(RM_ZUO)
+ 
+ # Using `+` here means that $(ZUO) gets built even if `-n`/`--dry-run` is provided to `make`
+-$(ZUO): $(srcdir)/zuo/zuo.c
++$(ZUO_TARGET): $(srcdir)/zuo/zuo.c
+ 	+ mkdir -p bin
+ 	+ $(CC_FOR_BUILD) -DZUO_LIB_PATH='"'"../zuo/lib"'"' -o $(ZUO) $(srcdir)/zuo/zuo.c
+
+base-commit: 253230f7dfbb4fe777277d6bbf93f39f9567f086
+-- 
+2.41.0
+
+
+From 665bccc1c074131e790879adc1436f8059801171 Mon Sep 17 00:00:00 2001
+From: Matthew Flatt <mflatt@racket-lang.org>
+Date: Sun, 17 Mar 2024 09:06:30 -0600
+Subject: [PATCH 2/2] adjust `configure ZUO=<command>` support (#816)
+
+Continuing from b8838c3280, adjust the generated makefile so the
+supplied `<command>` is not a makefile dependency. That way, `ZUO=zuo`
+works if `zuo` is installed and the current build directory is not the
+source directory. (The `zuo` executable is a dependency in a real and
+relevant sense, but not in the sense of dependencies that we normally
+track in makefiles.)
+
+Also adapt the makefile for the case that `ZUO=...` is not supplied
+and the build directory is not the source directory, in which case
+`ZUO_LIB_PATH` needs to be relative to the source directory.
+
+Using `make ZUO=zuo` can also work, but in that case, `bin/zuo` is
+still built as a dependency. It's possible that some portable makefile
+magic could overcome that limitation, but it doesn't seem important.
+
+(cherry picked from commit d327968f37cdf669d15a9ad6d356bbf92c502bb9)
+---
+ configure             |  3 ++
+ makefiles/Makefile.in | 66 +++++++++++++++++++++----------------------
+ 2 files changed, 36 insertions(+), 33 deletions(-)
+
+diff --git a/configure b/configure
+index 782dd09b..9adae37a 100755
+--- a/configure
++++ b/configure
+@@ -904,10 +904,12 @@ if [ "${zuoExternal}" = "" ] ; then
+         submod_instructions 'Source in "zuo" is missing'
+     fi
+     ZUO="bin/zuo"
++    ZUO_DEP="${ZUO}"
+     RM_ZUO="rm -f bin/zuo"
+     ZUO_TARGET="bin/zuo"
+ else
+     ZUO="${zuoExternal}"
++    ZUO_DEP=""
+     RM_ZUO="@echo 'Not cleaning external ${zuoExternal}'"
+     ZUO_TARGET="DoNotBuildZuo"
+ fi
+@@ -1153,6 +1155,7 @@ alwaysUseBootFile=$alwaysUseBootFile
+ relativeBootFiles=$relativeBootFiles
+ 
+ ZUO=$ZUO
++ZUO_DEP=$ZUO_DEP
+ RM_ZUO=$RM_ZUO
+ ZUO_TARGET=$ZUO_TARGET
+ 
+diff --git a/makefiles/Makefile.in b/makefiles/Makefile.in
+index 0e3d307d..fc8605a0 100644
+--- a/makefiles/Makefile.in
++++ b/makefiles/Makefile.in
+@@ -4,55 +4,55 @@ workarea=$(w)
+ include $(workarea)/Mf-config
+ 
+ .PHONY: build
+-build: $(ZUO)
++build: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) MAKE="$(MAKE)"
+ 
+ .PHONY: run
+-run: $(ZUO)
++run: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) run
+ 
+ .PHONY: kernel
+-kernel: $(ZUO)
++kernel: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) kernel MAKE="$(MAKE)"
+ 
+ .PHONY: install
+-install: $(ZUO)
++install: $(ZUO_DEP)
+ 	$(ZUO) $(workarea) install MAKE="$(MAKE)"
+ 
+ .PHONY: uninstall
+-uninstall: $(ZUO)
++uninstall: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) uninstall MAKE="$(MAKE)"
+ 
+ .PHONY: test-one
+-test-one: $(ZUO)
++test-one: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) test-one MAKE="$(MAKE)"
+ 
+ .PHONY: test-some-fast
+-test-some-fast: $(ZUO)
++test-some-fast: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) test-some-fast MAKE="$(MAKE)"
+ 
+ .PHONY: test-some
+-test-some: $(ZUO)
++test-some: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) test-some MAKE="$(MAKE)"
+ 
+ .PHONY: test
+-test: $(ZUO)
++test: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) test MAKE="$(MAKE)"
+ 
+ .PHONY: test-more
+-test-more: $(ZUO)
++test-more: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) test-more MAKE="$(MAKE)"
+ 
+ .PHONY: coverage
+-coverage: $(ZUO)
++coverage: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) coverage MAKE="$(MAKE)"
+ 
+ .PHONY: bootfiles
+-bootfiles: $(ZUO)
++bootfiles: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) bootfiles MAKE="$(MAKE)"
+ 
+ .PHONY: reset
+-reset: $(ZUO)
++reset: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) reset MAKE="$(MAKE)"
+ 
+ # Supply XM=<machine> to build boot files for <machine>
+@@ -61,90 +61,90 @@ boot:
+ 	+ $(ZUO) $(workarea) boot "$(XM)" MAKE="$(MAKE)"
+ 
+ # `<machine>.boot` as alias for `boot XM=<machine>`
+-%.boot: $(ZUO)
++%.boot: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) boot $* MAKE="$(MAKE)"
+ 
+ .PHONY: auto.boot
+-auto.boot: $(ZUO)
++auto.boot: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) boot MAKE="$(MAKE)"
+ 
+ SCHEME=scheme
+ 
+ .PHONY: cross.boot
+-cross.boot: $(ZUO)
++cross.boot: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) boot SCHEME="$(SCHEME)" MAKE="$(MAKE)"
+ 
+ .PHONY: re.boot
+-re.boot: $(ZUO)
++re.boot: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) reboot SCHEME="$(SCHEME)"
+ 
+ # Supply XM=<machine> 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
+ .PHONY: bootquick
+-bootquick: $(ZUO)
++bootquick: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) bootquick "$(XM)" MAKE="$(MAKE)"
+ 
+ # `<machine>.bootquick` as alias for `boot XM=<machine>`
+-%.bootquick: $(ZUO)
++%.bootquick: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) bootquick $* MAKE="$(MAKE)"
+ 
+-auto.bootquick: $(ZUO)
++auto.bootquick: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) bootquick MAKE="$(MAKE)"
+ 
+ # Supply XM=<machine>-<tag>.bootpbchunk to repackage boot files for
+ # <machine> with pbchunk sources, including additional
+ # boot files
+ .PHONY: bootpbchunk
+-bootpbchunk: $(ZUO)
++bootpbchunk: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) bootpbchunk "$(XM)" $(ARGS) MAKE="$(MAKE)"
+ 
+ # `<machine>.bootpbchunk` as alias for `pbchunk XM=<machine>`
+-%.bootpbchunk: $(ZUO)
++%.bootpbchunk: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) bootpbchunk $* $(ARGS) MAKE="$(MAKE)"
+ 
+ .PHONY: docs
+-docs: build $(ZUO)
++docs: build $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) docs MAKE="$(MAKE)"
+ 
+ .PHONY: csug
+-csug: build $(ZUO)
++csug: build $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) csug MAKE="$(MAKE)"
+ 
+ .PHONY: release_notes
+-release_notes: build $(ZUO)
++release_notes: build $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) release_notes MAKE="$(MAKE)"
+ 
+ .PHONY: install-docs
+-install-docs: build $(ZUO)
++install-docs: build $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) install-docs MAKE="$(MAKE)"
+ 
+ .PHONY: install-csug
+-install-csug: build $(ZUO)
++install-csug: build $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) install-csug MAKE="$(MAKE)"
+ 
+ .PHONY: install-release_notes
+-install-release_notes: build $(ZUO)
++install-release_notes: build $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) install-release_notes MAKE="$(MAKE)"
+ 
+ .PHONY: bintar
+-bintar: $(ZUO)
++bintar: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) bintar MAKE="$(MAKE)"
+ 
+ .PHONY: rpm
+-rpm: $(ZUO)
++rpm: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) rpm MAKE="$(MAKE)"
+ 
+ .PHONY: pkg
+-pkg: $(ZUO)
++pkg: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) pkg MAKE="$(MAKE)"
+ 
+ .PHONY: clean
+-clean: $(ZUO)
++clean: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) clean MAKE="$(MAKE)"
+ 	$(RM_ZUO)
+ 
+ # Using `+` here means that $(ZUO) gets built even if `-n`/`--dry-run` is provided to `make`
+ $(ZUO_TARGET): $(srcdir)/zuo/zuo.c
+ 	+ mkdir -p bin
+-	+ $(CC_FOR_BUILD) -DZUO_LIB_PATH='"'"../zuo/lib"'"' -o $(ZUO) $(srcdir)/zuo/zuo.c
++	+ $(CC_FOR_BUILD) -DZUO_LIB_PATH='"'"$(upsrcdir)/zuo/lib"'"' -o $(ZUO) $(srcdir)/zuo/zuo.c
+-- 
+2.41.0
+
diff --git a/gnu/packages/patches/chez-scheme-bin-sh.patch b/gnu/packages/patches/chez-scheme-bin-sh.patch
index 7650914f01..c2a4b292f7 100644
--- a/gnu/packages/patches/chez-scheme-bin-sh.patch
+++ b/gnu/packages/patches/chez-scheme-bin-sh.patch
@@ -1,6 +1,6 @@
-From 3c838e6a0c3214d95bf02048cddccfd1b69a679f Mon Sep 17 00:00:00 2001
+From b8428ad25b437acf4bd8210b14db207b71fe44c3 Mon Sep 17 00:00:00 2001
 From: Philip McGrath <philip@philipmcgrath.com>
-Date: Thu, 19 May 2022 13:41:56 -0400
+Date: Wed, 24 Aug 2022 19:55:14 -0400
 Subject: [PATCH] patch s_process for "/bin/sh" on Guix
 
 If:
@@ -14,22 +14,27 @@ then `s_process` will call `execl` with the file specified by
 `_PATH_BSHELL` instead of "/bin/sh".
 
 Checking that the path specified by `_PATH_BSHELL` exists safeguards
-against obscure errors if attempting to use stand-alone executables
-built by the patched Racket in non-Guix envoronments.
+against obscure errors if attempting to use the patched Chez Scheme
+or executables it builds in non-Guix envoronments.
 
 This patch does not change the behavior of `s_system`, which relies
 on `system` from the C library.
 ---
+
+Notes:
+    See also racket-chez-scheme-bin-sh.patch, racket-rktio-bin-sh.patch,
+    and zuo-bin-sh.patch.
+
  c/prim5.c | 21 ++++++++++++++++++++-
  1 file changed, 20 insertions(+), 1 deletion(-)
 
 diff --git a/c/prim5.c b/c/prim5.c
-index 5a07893..bc2736c 100644
+index 90b087f1..284f063f 100644
 --- a/c/prim5.c
 +++ b/c/prim5.c
-@@ -23,6 +23,12 @@
- #include <ctype.h>
- #include <math.h>
+@@ -27,6 +27,12 @@
+ #include <sys/resource.h>
+ #endif
  
 +/* BEGIN PATCH for Guix */
 +#ifndef WIN32
@@ -39,8 +44,8 @@ index 5a07893..bc2736c 100644
 +
  /* locally defined functions */
  static INT s_errno(void);
- static iptr s_addr_in_heap(uptr x);
-@@ -746,6 +752,17 @@ static ptr s_process(char *s, IBOOL stderrp) {
+ static IBOOL s_addr_in_heap(uptr x);
+@@ -875,6 +881,17 @@ static ptr s_process(char *s, IBOOL stderrp) {
  
      INT tofds[2], fromfds[2], errfds[2];
      struct sigaction act, oint_act;
@@ -58,10 +63,10 @@ index 5a07893..bc2736c 100644
  
      if (pipe(tofds)) S_error("process","cannot open pipes");
      if (pipe(fromfds)) {
-@@ -771,7 +788,9 @@ static ptr s_process(char *s, IBOOL stderrp) {
-         CLOSE(1); if (dup(fromfds[1]) != 1) _exit(1);
-         CLOSE(2); if (dup(stderrp ? errfds[1] : 1) != 2) _exit(1);
-         {INT i; for (i = 3; i < NOFILE; i++) (void)CLOSE(i);}
+@@ -911,7 +928,9 @@ static ptr s_process(char *s, IBOOL stderrp) {
+           }
+         }
+ #endif /* __GNU__ Hurd */
 -        execl("/bin/sh", "/bin/sh", "-c", s, NULL);
 +        /* BEGIN PATCH for Guix */
 +        execl(guix_sh, guix_sh, "-c", s, NULL);
@@ -70,7 +75,7 @@ index 5a07893..bc2736c 100644
          /*NOTREACHED*/
      } else {
 
-base-commit: 9df56e7b25bc523663eac3da24be33afc5f76c84
+base-commit: 253230f7dfbb4fe777277d6bbf93f39f9567f086
 -- 
-2.32.0
+2.41.0
 
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH 5/6] gnu: chez-scheme: Update and simplify machine-type handling.
  2024-03-29  5:15 [bug#70065] [PATCH 0/6] gnu: Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9 Philip McGrath
                   ` (3 preceding siblings ...)
  2024-03-29  5:18 ` [bug#70065] [PATCH 4/6] gnu: chez-scheme: Update to 10.0.0 Philip McGrath
@ 2024-03-29  5:18 ` Philip McGrath
  2024-03-30 14:40   ` Skyler Ferris via Guix-patches via
  2024-03-29  5:18 ` [bug#70065] [PATCH 6/6] gnu: chez-scheme: Bootstrap from source Philip McGrath
  2024-03-30 14:28 ` [bug#70065] [PATCH 0/6] gnu: Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9 Skyler Ferris via Guix-patches via
  6 siblings, 1 reply; 39+ messages in thread
From: Philip McGrath @ 2024-03-29  5:18 UTC (permalink / raw)
  To: 70065; +Cc: Philip McGrath

Since Chez Scheme 10.0.0 supports all of the backends added in Racket's
branch, the complexity of '%chez-features-table' is no longer needed.
Ideally, even more of this logic could be maintained upstream, but this
change will simplify maintenance in the mean time.

* gnu/packages/chez.scm (target-chez-arch): Recognize loongarch64.
(chez-upsteam-features-for-system): Remove function.
(%chez-features-table): Replace with ...
(define-machine-types, %machine-types): ... this new macro and variable,
using the list copied directly from the Chez Scheme source code.
(nix-system->pbarch-machine-type): Update docstring, since pbarch
machine types are supported upstream as of Chez Scheme 10.0.0.
(racket-cs-native-supported-system?): Replace with ...
(nix-system->native-chez-machine-type): ... this new function,
implemented using '%machine-types'.
(chez-scheme-for-racket): Update accordingly.
(chez-scheme-for-racket-bootstrap-bootfiles): Likewise.
* gnu/packages/racket.scm (racket-vm-cs): Likewise.

Change-Id: I46efebaf48cce388075ab4873c16a6f5f9692bb7
---
 gnu/packages/chez.scm   | 197 ++++++++++++++++------------------------
 gnu/packages/racket.scm |   4 +-
 2 files changed, 81 insertions(+), 120 deletions(-)

diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 406180ce0f..3f9bdbfbfc 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -50,7 +50,7 @@ (define-module (gnu packages chez)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26)
   #:export (chez-scheme-for-system
-            racket-cs-native-supported-system?
+            nix-system->native-chez-machine-type
             nix-system->pbarch-machine-type
             unpack-nanopass))
 
@@ -93,6 +93,8 @@ (define* (target-chez-arch #:optional (system
     "ppc32")
    ((target-riscv64? system)
     "rv64")
+   ((string-prefix? "loongarch64-" system)
+    "la64")
    (else
     #f)))
 
@@ -127,111 +129,67 @@ (define* (target-chez-os #:optional (system (or (%current-target-system)
    (else
     #f)))
 
-(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)
-     ("rv64" . #f)
-     ("ppc32" threads))
-    ;; Hurd
-    ("gnu"
-     ("i3" . #f))
-    ;; 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
-    ;; QNX
-    ("qnx"
-     ("i3" . #f))
-    ;; 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)
-                                                 (%current-system))))
-  "Return a list of symbols naming features supported by upstream Chez Scheme
-for the Nix system identifier SYSTEM, or @code{#f} if upstream Chez Scheme
-does not support SYSTEM at all.
-
-If native threads are supported, the returned list will include
-@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-syntax define-machine-types
+  (lambda (stx)
+    (syntax-case stx (any)
+      ((_ any id0 id ...)
+       #`(define #,(datum->syntax #'id0 '%machine-types)
+           '(id0 id ...))))))
+;; The following is copied from s/cmacros.ss, line 36, in the Chez source
+(define-machine-types
+  any
+  pb        tpb
+  pb32l     tpb32l
+  pb32b     tpb32b
+  pb64l     tpb64l
+  pb64b     tpb64b
+  i3nt      ti3nt
+  i3osx     ti3osx
+  i3le      ti3le
+  i3fb      ti3fb
+  i3ob      ti3ob
+  i3nb      ti3nb
+  i3s2      ti3s2
+  i3qnx     ti3qnx
+  i3gnu     ti3gnu
+  a6nt      ta6nt
+  a6osx     ta6osx
+  a6le      ta6le
+  a6fb      ta6fb
+  a6ob      ta6ob
+  a6nb      ta6nb
+  a6s2      ta6s2
+  ppc32osx  tppc32osx
+  ppc32le   tppc32le
+  ppc32fb   tppc32fb
+  ppc32ob   tppc32ob
+  ppc32nb   tppc32nb
+  arm32le   tarm32le
+  arm32fb   tarm32fb
+  arm32ob   tarm32ob
+  arm32nb   tarm32nb
+  arm64nt   tarm64nt
+  arm64osx  tarm64osx
+  arm64le   tarm64le
+  arm64fb   tarm64fb
+  arm64ob   tarm64ob
+  arm64nb   tarm64nb
+  rv64le    trv64le
+  rv64fb    trv64fb
+  rv64ob    trv64ob
+  rv64nb    trv64nb
+  la64le    tla64le
+)
 
 (define* (nix-system->pbarch-machine-type #:optional
                                           (system
                                            (or (%current-target-system)
                                                (%current-system)))
                                           #:key (threads? #t))
-  "Return a string naming the pseudo–machine type used by Racket's variant of
-Chez Scheme to represent the appropriate ``pbarch'' backend for SYSTEM: that
-is, the ``portable bytecode'' backend specialized for SYSTEM's word size and
-endianness.  The result will name the threaded machine type unless THREADS? is
-provided and is #f."
+  "Return a string naming the Chez Scheme machine type of the appropriate
+``pbarch'' backend for SYSTEM: that is, the ``portable bytecode'' backend
+specialized for SYSTEM's word size and endianness.  The result will name the
+threaded machine type unless THREADS? is provided as #f."
   (string-append (if threads?
                      "t"
                      "")
@@ -243,20 +201,23 @@ (define* (nix-system->pbarch-machine-type #:optional
                      "l"
                      "b")))
 
-(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?  If
-so, return the applicable machine type as a string.  Otherwise, when SYSTEM
-can use only the ``portable bytecode'' backends, return #f."
-  (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 <>))
-         (string-append "t" chez-arch chez-os))))
-
+(define* (nix-system->native-chez-machine-type #:optional
+                                               (system
+                                                (or (%current-target-system)
+                                                    (%current-system)))
+                                               #:key (threads? #t))
+  "Return a string naming the Chez Scheme machine type of the native-code
+backend for SYSTEM, if such a native-code backend exists.  Otherwise, when
+SYSTEM can use only the ``portable bytecode'' backends, return #f.  The result
+will name the threaded machine type unless THREADS? is provided as #f."
+  (let* ((chez-arch (target-chez-arch system))
+         (chez-os (target-chez-os system))
+         (machine
+          (and chez-arch chez-os
+               (string-append (if threads? "t" "") chez-arch chez-os))))
+    (and machine
+         (memq (string->symbol machine) %machine-types)
+         machine)))
 ;;
 ;; Chez Scheme:
 ;;
@@ -300,7 +261,7 @@ (define-public chez-scheme-for-racket
     (version "9.9.9-pre-release.23")
     (source #f)
     (build-system gnu-build-system)
-    (inputs `(,@(if (racket-cs-native-supported-system?)
+    (inputs `(,@(if (nix-system->native-chez-machine-type)
                     '()
                     (list libffi))
               ,chez-scheme-for-racket-bootstrap-bootfiles
@@ -353,10 +314,10 @@ (define-public chez-scheme-for-racket
                  (search-input-directory %build-inputs "/include/X11"))
                 '()
                 '("--disable-x11"))
-          #$(string-append "-m=" (or (racket-cs-native-supported-system?)
+          #$(string-append "-m=" (or (nix-system->native-chez-machine-type)
                                      (nix-system->pbarch-machine-type)))
           ;; ^ could skip -m= for non-cross non-pbarch builds
-          #$@(if (racket-cs-native-supported-system?)
+          #$@(if (nix-system->native-chez-machine-type)
                  #~()
                  ;; not inferred on non-native platforms: see
                  ;; https://racket.discourse.group/t/950/9
@@ -585,7 +546,7 @@ (define-public chez-scheme-for-racket-bootstrap-bootfiles
                     (invoke "./configure"
                             "--force" ; don't complain about missing bootfiles
                             #$(string-append
-                               "-m=" (or (racket-cs-native-supported-system?)
+                               "-m=" (or (nix-system->native-chez-machine-type)
                                          (nix-system->pbarch-machine-type)))
                             "ZUO=zuo"
                             ;; ignore submodules:
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index d366f89845..f50f6f3eab 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -433,7 +433,7 @@ (define-public racket-vm-cs
     (inputs
      (let ((inputs (modify-inputs (package-inputs racket-vm-cgc)
                      (prepend zlib lz4))))
-       (if (racket-cs-native-supported-system?)
+       (if (nix-system->native-chez-machine-type)
            (modify-inputs inputs
              (delete "libffi"))
            inputs)))
@@ -461,7 +461,7 @@ (define-public racket-vm-cs
                                 #+(this-package-native-input
                                    "chez-scheme-for-racket")
                                 "/bin/scheme")
-                 #$@(if (racket-cs-native-supported-system?)
+                 #$@(if (nix-system->native-chez-machine-type)
                         #~()
                         #~(#$(string-append "--enable-mach="
                                             (nix-system->pbarch-machine-type))
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH 6/6] gnu: chez-scheme: Bootstrap from source.
  2024-03-29  5:15 [bug#70065] [PATCH 0/6] gnu: Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9 Philip McGrath
                   ` (4 preceding siblings ...)
  2024-03-29  5:18 ` [bug#70065] [PATCH 5/6] gnu: chez-scheme: Update and simplify machine-type handling Philip McGrath
@ 2024-03-29  5:18 ` Philip McGrath
  2024-03-30 14:41   ` Skyler Ferris via Guix-patches via
  2024-03-30 14:28 ` [bug#70065] [PATCH 0/6] gnu: Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9 Skyler Ferris via Guix-patches via
  6 siblings, 1 reply; 39+ messages in thread
From: Philip McGrath @ 2024-03-29  5:18 UTC (permalink / raw)
  To: 70065; +Cc: Philip McGrath

* gnu/packages/chez.scm (chez-scheme)[source]<snippet>: Also unbundle
pre-built boot files.
(chez-scheme-bootstrap-bootfiles): Stop inheriting from 'chez-scheme'.
[native-inputs]: Add 'zuo', 'chez-nanopass-bootstrap', and either
'chez-scheme-for-racket' or, for cross builds, 'chez-scheme'.
[build-system]: Change to gnu-build-system.
[arguments]: Change to run 'configure' and then bootstrap via
`make re.boot` or, for cross builds, `make cross.boot`
[synopsis, description]: Update accordingly.
(chez-scheme-for-racket-bootstrap-bootfiles)[synopsis]: Write "boot
files" as two words in prose.
[description]: Likewise.
* gnu/packages/racket.scm: Update comments.

Change-Id: I55d9b57090ecaca0aa2ab19c2c3ebae2243a9173
---
 gnu/packages/chez.scm   | 123 +++++++++++++++++++++++++++++++---------
 gnu/packages/racket.scm |  24 +++++---
 2 files changed, 112 insertions(+), 35 deletions(-)

diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 3f9bdbfbfc..11de3b9523 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -57,15 +57,54 @@ (define-module (gnu packages chez)
 ;; Commentary:
 ;;
 ;; The bootstrapping paths for Chez Scheme and Racket are closely
-;; entwined. Racket CS (the default Racket implementation) is based on (a fork
-;; of) Chez Scheme. Racket's variant of Chez Scheme shares sources for
-;; nanopass and stex with upstream Chez Scheme.
+;; entwined. See "Bootstrapping Racket" in the commentary on "racket.scm" for
+;; details on the Racket portion of Chez Scheme's bootstrapping path.
 ;;
-;; Racket's variant of Chez Scheme can be bootstrapped by an older Racket
-;; implementation, Racket BC, which can be bootstrapped from C. Porting that
-;; code to work with upstream Chez Scheme (or finding an old version that
-;; does) is our best hope for some day bootstrapping upstream Chez Scheme from
-;; source.
+;; Chez Scheme is a self-hosting compiler. A small kernel implemented in C
+;; loads "boot files" (in a custom object file format) compiled from the parts
+;; of the system implemented in Chez Scheme. (While Chez Scheme generates
+;; native machine code, it implements its own linker and loader.)
+;;
+;; As of Chez Scheme 10.0.0 (and the pre-release versions that preceded it on
+;; the Racket branch), there are several ways to obtain boot files:
+;;
+;;  1. The Racket package "cs-bootstrap" (in the "racket/src/rktboot/"
+;;     directory of the main Racket Git repository) simulates enough of Chez
+;;     Scheme to load the Chez Scheme compiler purely from source into Racket
+;;     and apply the compiler to itself, producing the needed boot files
+;;     (albeit very slowly).
+;;     Any variant of Racket since version 7.1 can run the simulation. Using
+;;     the older Racket BC implementation, which does not depend on Chez
+;;     Scheme, breaks the dependency cycle.
+;;     However, the simulation relies on implementation details of Chez
+;;     Scheme, so a given version of Chez Scheme can only be bootstrapped by
+;;     the corresponding version of the "cs-bootstrap" package.
+;;
+;;  2. The Chez Scheme makefile provides a "re.boot" target for bootstrapping
+;;     via a different version of Chez Scheme (9.5.4 or later).
+;;     This path manages potential differences in implementation details
+;;     across Chez Scheme versions using a strategy similar to "cs-bootstrap",
+;;     but the compatibility shim is maintained with the Chez Scheme source
+;;     code (in "s/reboot.ss"). Also, it's faster, since less indirection is
+;;     needed.
+;;
+;;  3. For cross-compilation, or with an extremely similar Chez Scheme, the
+;;     makefile provides "cross.boot" and related targets.
+;;
+;;  4. The Chez Scheme Git repository includes pre-built "pb" (portable
+;;     bytecode) boot files, which can be used for bootstrapping on any
+;;     platform, but these binary files are removed from the source Guix uses.
+;;
+;; Concretely, we use racket-vm-bc to bootstrap chez-scheme-for-racket, which
+;; we then use to bootstrap both chez-scheme and racket-vm-cs.
+;;
+;; In principle, it would be possible instead to use chez-scheme to bootstrap
+;; chez-scheme-for-racket. However, since Racket is ultimately used for
+;; bootstrapping, chez-scheme would still need to be rebuilt when Racket
+;; changes, whereas treating chez-scheme as a leaf avoids having to rebuild
+;; Racket when upstream Chez Scheme changes. Furthermore, since "cs-bootstrap"
+;; is developed in the Racket source repository, we don't have to look for the
+;; version of "cs-bootstrap" compatible with the upstream Chez Scheme release.
 ;;
 ;; Code:
 
@@ -476,7 +515,8 @@ (define-public chez-scheme
                            (for-each (lambda (dir)
                                        (when (directory-exists? dir)
                                          (delete-file-recursively dir)))
-                                     '("lz4"
+                                     '("boot"
+                                       "lz4"
                                        "nanopass"
                                        "stex"
                                        "zlib"
@@ -572,10 +612,10 @@ (define-public chez-scheme-for-racket-bootstrap-bootfiles
                                         "/opt/racket-vm/bin/racket")
                      "../rktboot/main.rkt"))))))))
     (home-page "https://pkgs.racket-lang.org/package/cs-bootstrap")
-    (synopsis "Chez Scheme bootfiles bootstrapped by Racket")
-    (description "Chez Scheme is a self-hosting compiler: building it
-requires ``bootfiles'' containing the Scheme-implemented portions compiled for
-the current platform.  (Chez can then cross-compile bootfiles for all other
+    (synopsis "Chez Scheme boot files bootstrapped by Racket")
+    (description "Chez Scheme is a self-hosting compiler: building it requires
+``boot files'' containing the Scheme-implemented portions compiled for the
+current platform.  (Chez can then cross-compile boot files for all other
 supported platforms.)
 
 The Racket package @code{cs-bootstrap} (part of the main Racket Git
@@ -588,28 +628,57 @@ (define-public chez-scheme-for-racket-bootstrap-bootfiles
 
 (define-public chez-scheme-bootstrap-bootfiles
   (package
-    (inherit chez-scheme)
     (name "chez-scheme-bootstrap-bootfiles")
-    (inputs '())
-    (native-inputs '())
+    (version (package-version chez-scheme))
+    (source (package-source chez-scheme))
+    (native-inputs (list chez-nanopass-bootstrap
+                         (if (%current-target-system)
+                             chez-scheme
+                             chez-scheme-for-racket)
+                         zuo))
     (outputs '("out"))
-    (build-system copy-build-system)
-    ;; TODO: cross compilation
+    (build-system gnu-build-system)
     (arguments
-     (list #:install-plan
-           #~`(("boot/" "lib/chez-scheme-bootfiles"))))
-    (synopsis "Chez Scheme bootfiles (binary seed)")
+     (list
+      #:configure-flags
+      #~`("--force" ; don't complain about missing bootfiles
+          "ZLIB=-lz" "LZ4=-llz4" "STEXLIB=/GuixNotUsingStex" ; ignore submods
+          "ZUO=zuo"
+          ;; could skip -m= for non-cross non-pbarch builds
+          #$(string-append "-m=" (or (nix-system->native-chez-machine-type)
+                                     (nix-system->pbarch-machine-type))))
+      #:make-flags
+      #~(list (string-append "SCHEME="
+                             (search-input-file %build-inputs "/bin/scheme"))
+              #$(if (%current-target-system)
+                    "cross.boot"
+                    "re.boot"))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'unpack-nanopass
+            #$unpack-nanopass)
+          (replace 'configure
+            #$chez-configure)
+          (delete 'check)
+          (replace 'install
+            (lambda args
+              (mkdir-p (string-append #$output "/lib"))
+              (copy-recursively
+               "boot"
+               (string-append #$output "/lib/chez-scheme-bootfiles")))))))
+    (home-page "https://cisco.github.io/ChezScheme/")
+    (synopsis "Bootstrapped Chez Scheme boot files")
     (description
      "Chez Scheme is a self-hosting compiler: building it requires
-``bootfiles'' containing the Scheme-implemented portions compiled for the
+``boot files'' containing the Scheme-implemented portions compiled for the
 current platform.  (Chez can then cross-compile bootfiles for all other
 supported platforms.)
 
-This package provides bootstrap bootfiles for upstream Chez Scheme.
-Currently, it simply packages the binaries checked in to the upstream
-repository.  Hopefully we can eventually adapt Racket's @code{cs-bootstrap} to
-work with upstream Chez Scheme so that we can bootstrap these files from
-source.")))
+This package provides boot files for the released version of Chez Scheme
+bootstrapped by @code{chez-scheme-for-racket}. Chez Scheme 9.5.4 or any later
+version can be used for bootstrapping. Guix ultimately uses the Racket package
+@code{cs-bootstrap} to bootstrap its initial version of Chez Scheme.")
+    (license asl2.0)))
 
 ;;
 ;; Chez's bootstrap dependencies:
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index f50f6f3eab..2b20353159 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -72,6 +72,7 @@ (define-module (gnu packages racket)
 ;;             ├── bc/
 ;;             ├── cs/
 ;;             ├── ChezScheme/
+;;             ├── rktboot/
 ;;             ├── zuo/
 ;;             └── ...
 ;;
@@ -149,14 +150,12 @@ (define-module (gnu packages racket)
 ;;   - Racket BC [3M] needs an existing Racket to run "xform",
 ;;     which transforms its own C source code to add additional annotations
 ;;     for the precise garbage collector.
-;;   - Racket CS needs (bootfiles for) Racket's fork of Chez Scheme.
-;;     It also needs an existing Racket to compile Racket-implemented
+;;   - Racket CS needs (boot files for) the corresponding version of Chez
+;;     Scheme. It also needs an existing Racket to compile Racket-implemented
 ;;     parts of the runtime system to R6RS libraries.
-;;   - Chez Scheme also needs bootfiles for itself, but Racket can simulate
-;;     enough of Chez Scheme to load Racket's fork of the Chez Scheme compiler
-;;     purely from source into Racket and apply the compiler to itself,
-;;     producing the needed bootfiles (albeit very slowly).
-;;     Any variant of Racket since version 7.1 can run the simulation.
+;;   - Chez Scheme also needs boot files for itself, but Racket BC can
+;;     bootstrap these using the code in "racket/src/rktboot/".
+;;     See the commentary in "chez.scm" for further details
 ;;
 ;; So, we build CGC to build 3M to build bootfiles and CS.
 ;;
@@ -164,6 +163,14 @@ (define-module (gnu packages racket)
 ;; often use "BC" to mean "3M", consistent with `(banner)` and the
 ;; suffixes used on executables when more than one variant co-exists.)
 ;;
+;; Since the pre-releases for Chez Scheme 10.0.0, all of Racket's changes have
+;; been merged upstream, and development will be kept in sync going
+;; forward. However, there is no plan to align the Chez Scheme and Racket
+;; release cycles. For the near fulture, a given released version of Racket
+;; will continue to depend on a specific pre-release version of Chez Scheme as
+;; part of Racket CS's "ABI". See upstream discussion at
+;; <https://racket.discourse.group/t/2739/3>.
+;;
 ;; One remaining bootstrapping limitation is that Racket's reader, module
 ;; system, and macro expander are implemented in Racket. For Racket CS,
 ;; they are compiled to R6RS libraries as discussed above. This note from the
@@ -189,7 +196,8 @@ (define-module (gnu packages racket)
 ;; Zuo is notably *not* a problem for bootstrapping. The implementation is a
 ;; single hand-written C file designed to build with just `cc -o zuo zuo.c`,
 ;; even with very old or limited compilers. (We use the Autoconf support for
-;; convienience.)
+;; convienience.) As of Zuo 1.8, Zuo has tagged releases in its own repository
+;; independent of the Racket release cycle.
 ;;
 ;; CODE:
 
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH 4/6] gnu: chez-scheme: Update to 10.0.0.
  2024-03-29  5:18 ` [bug#70065] [PATCH 4/6] gnu: chez-scheme: Update to 10.0.0 Philip McGrath
@ 2024-03-30  7:56   ` Liliana Marie Prikler
  2024-03-30 14:39   ` Skyler Ferris via Guix-patches via
  1 sibling, 0 replies; 39+ messages in thread
From: Liliana Marie Prikler @ 2024-03-30  7:56 UTC (permalink / raw)
  To: Philip McGrath, 70065; +Cc: Katherine Cox-Buday, Andrew Tropin

Am Freitag, dem 29.03.2024 um 01:18 -0400 schrieb Philip McGrath:
> * gnu/packages/patches/chez-scheme-bin-sh.patch: Refresh patch.
> * gnu/packages/patches/chez-scheme-backport-configure.patch: New
> file.
> * gnu/local.mk (dist_patch_DATA): Add it.
> * gnu/packages/chez.scm (chez-scheme): Update to 10.0.0.  Inherit
> from
> 'chez-scheme-for-racket'.
Is there a good reason to do it this way?  Or could we build racket
with regular chez-scheme afterwards?

> [source]<patches>: Use "chez-scheme-backport-configure.patch".
> <snippet>: Also unbundle Zuo.
> [native-inputs, native-search-paths, outputs, arguments]
> [supported-systems]: Inherit from 'chez-scheme-for-racket'.
> [inputs]: Likewise, replacing the bootfile package and adding libx11.
> [description]: Update based on the User's Guide, release notes, man
> page, and README file.
> (chez-scheme-bootstrap-bootfiles)[supported-systems]: All systems are
> now supported.
> (chez-scheme-for-system): Deprecate it, since 'chez-scheme' now
> supports
> all systems.
> (chez-srfi, chez-web, chez-sockets, chez-matchable, chez-irregex)
> (chez-fmt, chez-mit, chez-scmutils)[native-inputs]: Use 'chez-scheme'
> instead of 'chez-scheme-for-system'.
> * gnu/packages/emacs-xyz.scm (emacs-geiser-chez)[inputs]: Likewise.
> 
> Change-Id: I287ff66f385f20e69c1411abcc94f19dd45870c5
I think I got pinged for this due to the emacs side, which as far as I
can see LGTM.  I haven't looked at all of the patch however, let alone
the series.

As usual for these large rackets (pun intended), I do wonder whether
it'd be possible to split the commits into more reviewable hunks.  For
instance, I don't think chez-scheme-for-system would need to be
adjusted yet – it could simply return chez-scheme and then in the next
commit be deprecated or dropped.

Cheers




^ permalink raw reply	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH 0/6] gnu: Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9.
  2024-03-29  5:15 [bug#70065] [PATCH 0/6] gnu: Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9 Philip McGrath
                   ` (5 preceding siblings ...)
  2024-03-29  5:18 ` [bug#70065] [PATCH 6/6] gnu: chez-scheme: Bootstrap from source Philip McGrath
@ 2024-03-30 14:28 ` Skyler Ferris via Guix-patches via
  6 siblings, 0 replies; 39+ messages in thread
From: Skyler Ferris via Guix-patches via @ 2024-03-30 14:28 UTC (permalink / raw)
  To: Philip McGrath, 70065, cox.katherine.e+guix

Hi all! I started reviewing these patches last night and just finished 
up.  I'll reply to each patch individually with notes, the big thing is 
loko-scheme running into an error due to the change to 
chez-scheme-for-system (I think the deprecation definition might need an 
update, because IIUC the syntax is supposed to be backwards-compatible 
until it is removed).

> Is there a good reason to do it this way?  Or could we build racket
> with regular chez-scheme afterwards?

I believe this is addressed by this comment from patch 6/6; we can't 
rely on chez-scheme being the correct version to use for racket. But 
please correct me if I misunderstood Philip!

> Since the pre-releases for Chez Scheme 10.0.0, all of Racket's changes have
> been merged upstream, and development will be kept in sync going
> forward. However, there is no plan to align the Chez Scheme and Racket
> release cycles. For the near fulture, a given released version of Racket
> will continue to depend on a specific pre-release version of Chez Scheme as
> part of Racket CS's "ABI". See upstream discussion at
> <https://racket.discourse.group/t/2739/3>.

In solidarity,
Skyler





^ permalink raw reply	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH 1/6] gnu: zuo: Update to 1.9.
  2024-03-29  5:18 ` [bug#70065] [PATCH 1/6] gnu: zuo: Update to 1.9 Philip McGrath
@ 2024-03-30 14:31   ` Skyler Ferris via Guix-patches via
  0 siblings, 0 replies; 39+ messages in thread
From: Skyler Ferris via Guix-patches via @ 2024-03-30 14:31 UTC (permalink / raw)
  To: Philip McGrath, 70065

No comments on this patch; looks fine.





^ permalink raw reply	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH 2/6] gnu: racket: Update to 8.12.
  2024-03-29  5:18 ` [bug#70065] [PATCH 2/6] gnu: racket: Update to 8.12 Philip McGrath
@ 2024-03-30 14:35   ` Skyler Ferris via Guix-patches via
  2024-03-30 22:10     ` Philip McGrath
  0 siblings, 1 reply; 39+ messages in thread
From: Skyler Ferris via Guix-patches via @ 2024-03-30 14:35 UTC (permalink / raw)
  To: Philip McGrath, 70065

On 3/28/24 22:18, Philip McGrath wrote:
> +(define chez-configure
> +  ;; The custom Chez 'configure' script doesn't allow unrecognized flags, such
> +  ;; as those automatically added by `gnu-build-system`. This replacement
> +  ;; phase uses only the explicitly provided `#: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)
> +        (when 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))))
> +
Are the format statements supposed to be here or are they left over from 
debugging?
> +          ;; Building the documentation requires stex and a running scheme.
> +          ;; TODO: improve cross support upstream.
I believe this comment should be associated with the build-docs phase, 
not the install-docs phase, correct?

Additionally, I am not too familiar with autotools, so while I did look 
over it and the changes seem reasonable my perspective on that aspect of 
this patch should be taken with a grain of salt.





^ permalink raw reply	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH 3/6] gnu: chez-scheme: Reorganize package definitions.
  2024-03-29  5:18 ` [bug#70065] [PATCH 3/6] gnu: chez-scheme: Reorganize package definitions Philip McGrath
@ 2024-03-30 14:35   ` Skyler Ferris via Guix-patches via
  0 siblings, 0 replies; 39+ messages in thread
From: Skyler Ferris via Guix-patches via @ 2024-03-30 14:35 UTC (permalink / raw)
  To: Philip McGrath, 70065

No comments on this patch, other than appreciation for making diffs 
readable. =)





^ permalink raw reply	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH 4/6] gnu: chez-scheme: Update to 10.0.0.
  2024-03-29  5:18 ` [bug#70065] [PATCH 4/6] gnu: chez-scheme: Update to 10.0.0 Philip McGrath
  2024-03-30  7:56   ` Liliana Marie Prikler
@ 2024-03-30 14:39   ` Skyler Ferris via Guix-patches via
  2024-03-30 22:49     ` Philip McGrath
  1 sibling, 1 reply; 39+ messages in thread
From: Skyler Ferris via Guix-patches via @ 2024-03-30 14:39 UTC (permalink / raw)
  To: Philip McGrath, 70065
  Cc: Katherine Cox-Buday, Liliana Marie Prikler, Andrew Tropin

On 3/28/24 22:18, Philip McGrath wrote:
> -(define* (chez-scheme-for-system #:optional
> -                                 (system (or (%current-target-system)
> -                                             (%current-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))
> +(define-deprecated (chez-scheme-for-system #:optional system) chez-scheme
> +  "Returns 'chez-scheme'."
> +  chez-scheme)
As mentioned in the reply to the cover letter, it looks like this broke 
loko-scheme from gnu/pcakages/loko.scm.

In particular, I get a "wrong type to apply" error in its use of 
"chez-scheme-for-system". I ran into this problem when running the 
following command:

```
./pre-inst-env guix refresh --list-depedent zuo -e '(@ (gnu packages 
racket) racket-vm-cs)' racket chez-scheme chez-scheme-for-racket
```

For this reason, I was also unable to verify that all dependents 
build... presumably, the CI will run into the same error when this 
patch's turn comes up. I did check the following packages based on the 
output of the refresh without this patch applied, and they all build 
with all patches in this series applied:

```
./pre-inst-env guix build chez-socket chez-nanopass chez-fmt 
chez-scmutils chez-irregex emacs-geiser-chez emacs-geiser-racket
```

So I think loko-scheme is the only impacted dependent. Pending 
cross-builds from the CI.

As before, my experience with autotools is limited so my review of the 
build changes should be taken with a grain of salt. It looks like some 
of the patched code is fixing bugs rather than adapting for guix so they 
should be upstreamed, but I assume Philip is already on top of that.





^ permalink raw reply	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH 5/6] gnu: chez-scheme: Update and simplify machine-type handling.
  2024-03-29  5:18 ` [bug#70065] [PATCH 5/6] gnu: chez-scheme: Update and simplify machine-type handling Philip McGrath
@ 2024-03-30 14:40   ` Skyler Ferris via Guix-patches via
  0 siblings, 0 replies; 39+ messages in thread
From: Skyler Ferris via Guix-patches via @ 2024-03-30 14:40 UTC (permalink / raw)
  To: Philip McGrath, 70065

No comments on this patch; looks good.





^ permalink raw reply	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH 6/6] gnu: chez-scheme: Bootstrap from source.
  2024-03-29  5:18 ` [bug#70065] [PATCH 6/6] gnu: chez-scheme: Bootstrap from source Philip McGrath
@ 2024-03-30 14:41   ` Skyler Ferris via Guix-patches via
  0 siblings, 0 replies; 39+ messages in thread
From: Skyler Ferris via Guix-patches via @ 2024-03-30 14:41 UTC (permalink / raw)
  To: Philip McGrath, 70065

No comments on this patch; looks good.





^ permalink raw reply	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH 2/6] gnu: racket: Update to 8.12.
  2024-03-30 14:35   ` Skyler Ferris via Guix-patches via
@ 2024-03-30 22:10     ` Philip McGrath
  0 siblings, 0 replies; 39+ messages in thread
From: Philip McGrath @ 2024-03-30 22:10 UTC (permalink / raw)
  To: Skyler Ferris, 70065

Hi Skyler,

On 3/30/24 10:35, Skyler Ferris wrote:
> On 3/28/24 22:18, Philip McGrath wrote:
>> +(define chez-configure
>> +  ;; The custom Chez 'configure' script doesn't allow unrecognized flags, such
>> +  ;; as those automatically added by `gnu-build-system`. This replacement
>> +  ;; phase uses only the explicitly provided `#: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)
>> +        (when 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))))
>> +
> Are the format statements supposed to be here or are they left over from
> debugging?

Yes, the format statements are supposed to be there: (@ (guix build 
gnu-build-system) configure) prints the same messages. The code is 
unchanged from the chez-scheme configure phase, just factored out 
because we will also need it for cross-compiling 
chez-scheme-for-racket-bootstrap-bootfiles (because there's now a 
supported way to do that, and the experimental script we'd been using 
had bit-rotted) and for chez-scheme-bootstrap-bootfiles (native and 
cross) once we start bootstrapping it.

>> +          ;; Building the documentation requires stex and a running scheme.
>> +          ;; TODO: improve cross support upstream.
> I believe this comment should be associated with the build-docs phase,
> not the install-docs phase, correct?
> 

I had intended to put it here, but your comment prompted me to rethink 
it. For context, the build-docs phase is new in this commit: previously, 
I relied on the fact that the install-docs target depends on build-docs. 
I now think I should move the first line of the comment to build-docs 
and add a comment to install-docs pointing that out, because its part of 
the issue with cross-compilation. (Currently, the build scripts try to 
use the cross-compiled scheme to build the docs, which obviously doesn't 
work. The Right Thing would be to build the docs using the native scheme 
while using the sources from the cross-built scheme.)

Thanks,
Philip




^ permalink raw reply	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH 4/6] gnu: chez-scheme: Update to 10.0.0.
  2024-03-30 14:39   ` Skyler Ferris via Guix-patches via
@ 2024-03-30 22:49     ` Philip McGrath
  2024-03-31 14:35       ` Skyler Ferris via Guix-patches via
  2024-03-31 15:28       ` Skyler Ferris via Guix-patches via
  0 siblings, 2 replies; 39+ messages in thread
From: Philip McGrath @ 2024-03-30 22:49 UTC (permalink / raw)
  To: Skyler Ferris, 70065
  Cc: Katherine Cox-Buday, Liliana Marie Prikler, Andrew Tropin

Hi Liliana and Skyler,

On 3/30/24 10:28, Skyler Ferris wrote:
 >
 >> Is there a good reason to do it this way?  Or could we build racket
 >> with regular chez-scheme afterwards?
 >
 > I believe this is addressed by this comment from patch 6/6; we can't
 > rely on chez-scheme being the correct version to use for racket. But
 > please correct me if I misunderstood Philip!
 >
 >> Since the pre-releases for Chez Scheme 10.0.0, all of Racket's 
changes have
 >> been merged upstream, and development will be kept in sync going
 >> forward. However, there is no plan to align the Chez Scheme and Racket
 >> release cycles. For the near fulture, a given released version of Racket
 >> will continue to depend on a specific pre-release version of Chez 
Scheme as
 >> part of Racket CS's "ABI". See upstream discussion at
 >> <https://racket.discourse.group/t/2739/3>.
 >

That's right. In the linked thread, Matthew Flatt specifically confirmed 
that we should not try to build Racket with our chez-scheme package.

On 3/30/24 10:39, Skyler Ferris wrote:
> On 3/28/24 22:18, Philip McGrath wrote:
>> -(define* (chez-scheme-for-system #:optional
>> -                                 (system (or (%current-target-system)
>> -                                             (%current-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))
>> +(define-deprecated (chez-scheme-for-system #:optional system) chez-scheme
>> +  "Returns 'chez-scheme'."
>> +  chez-scheme)
> As mentioned in the reply to the cover letter, it looks like this broke
> loko-scheme from gnu/pcakages/loko.scm.
> 
> In particular, I get a "wrong type to apply" error in its use of
> "chez-scheme-for-system". I ran into this problem when running the
> following command:
> 
> ```
> ./pre-inst-env guix refresh --list-depedent zuo -e '(@ (gnu packages
> racket) racket-vm-cs)' racket chez-scheme chez-scheme-for-racket
> ```
> 

Thanks, I had forgotten about loko-scheme!

On 3/30/24 10:28, Skyler Ferris wrote:
 > (I think the deprecation definition might need an
 > update, because IIUC the syntax is supposed to be backwards-compatible
 > until it is removed).
 >

I still don't understand why the deprecation definition isn't working. I 
expected the expansion at the repl, and (chez-scheme-for-system) 
expanded to (%chez-scheme-for-system/deprecated), which was defined by 
the expansion of define-deprecated as:

   (define %chez-scheme-for-system/deprecated
     (begin
       (lambda () chez-scheme)
       (lambda* (#:optional (system #f)) chez-scheme)))

I guess, unless I figure something out or someone has a better 
suggestion, I could just remove chez-scheme-for-system without 
deprecation, but that seemed less friendly.

> 
> As before, my experience with autotools is limited so my review of the
> build changes should be taken with a grain of salt. It looks like some
> of the patched code is fixing bugs rather than adapting for guix so they
> should be upstreamed, but I assume Philip is already on top of that.
> 

Chez Scheme actually doesn't use autotools. (Racket does use autoconf, 
only.) All of the patches for configure have already been accepted 
upstream: in fact, the second patch in the file is a follow-up from 
Matthew Flatt, one of the maintainers of Racket and, more recently, Chez 
Scheme.

On 3/30/24 03:56, Liliana Marie Prikler wrote:
 > As usual for these large rackets (pun intended), I do wonder whether
 > it'd be possible to split the commits into more reviewable hunks.  For
 > instance, I don't think chez-scheme-for-system would need to be
 > adjusted yet – it could simply return chez-scheme and then in the next
 > commit be deprecated or dropped.

Since there's a problem with the deprecation anyway, I will split this 
out. Overall, dividing up this series as much as I did has been 
especially arduous. If you noticed that the authored dates on the 
patches are a month ago, that's mostly the time it took me to reorganize 
these commits.

Thanks,
Philip




^ permalink raw reply	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH 4/6] gnu: chez-scheme: Update to 10.0.0.
  2024-03-30 22:49     ` Philip McGrath
@ 2024-03-31 14:35       ` Skyler Ferris via Guix-patches via
  2024-03-31 15:28       ` Skyler Ferris via Guix-patches via
  1 sibling, 0 replies; 39+ messages in thread
From: Skyler Ferris via Guix-patches via @ 2024-03-31 14:35 UTC (permalink / raw)
  To: Philip McGrath, 70065
  Cc: Katherine Cox-Buday, Liliana Marie Prikler, Andrew Tropin

On 3/30/24 15:49, Philip McGrath wrote:
> I still don't understand why the deprecation definition isn't working. I
> expected the expansion at the repl, and (chez-scheme-for-system)
> expanded to (%chez-scheme-for-system/deprecated), which was defined by
> the expansion of define-deprecated as:
>
>     (define %chez-scheme-for-system/deprecated
>       (begin
>         (lambda () chez-scheme)
>         (lambda* (#:optional (system #f)) chez-scheme)))
>
> I guess, unless I figure something out or someone has a better
> suggestion, I could just remove chez-scheme-for-system without
> deprecation, but that seemed less friendly.

So, I started poking at this and ran into something strange. I removed 
the surrounding parentheses from chez-scheme-for-system in loko.scm, and 
it gave me the expected error about an invalid package, where the value 
was a procedure rather than a package. Which sounds like what I would 
expect if it was working, except that it didn't work with the 
parentheses. Then, after adding the parentheses back it stopped giving 
me the error, even after running make again.

I haven't worked with define-deprecated before. It's a macro, and I know 
that the guile compiler misses recompiling macro dependencies sometimes, 
so maybe it was a problem on my end with having mismatching build 
artifacts. I'll try a clean build with these patches and a simulated 
guix pull within the next couple of days (hopefully today), and if those 
both work then the definition is probably correct.... but I'd be more 
comfortable if we could explain exactly why that error occurred. I'll 
also look more at the definitions, but I think it will be a little 
difficult to be confident in any explanation if I can't reproduce the 
error. Here's the full error output, in case it's helpful to anyone:

Backtrace:
In ice-9/boot-9.scm:
   1752:10 19 (with-exception-handler _ _ #:unwind? _ # _)
In guix/ui.scm:
     485:6 18 (_)
In guix/scripts/build.scm:
     711:5 17 (_)
In srfi/srfi-1.scm:
    673:15 16 (append-map #<procedure 7fef052ecdc0 at guix/scripts/b…> …)
    586:17 15 (map1 ("x86_64-linux"))
In guix/scripts/build.scm:
    713:21 14 (_ _)
In guix/store.scm:
   1382:11 13 (map/accumulate-builds #<store-connection 256.100 7fef…> …)
    1300:8 12 (call-with-build-handler #<procedure 7fef06f90990 at g…> …)
In guix/scripts/build.scm:
    667:16 11 (_ #<package loko-scheme@0.12.0 gnu/packages/loko.scm:3…>)
    656:24 10 (_ #<package loko-scheme@0.12.0 gnu/packages/loko.scm:…> …)
In guix/packages.scm:
   1378:17  9 (supported-package? #<package loko-scheme@0.12.0 gnu/p…> …)
In guix/memoization.scm:
     101:0  8 (_ #<hash-table 7fef036b2120 0/31> #<package loko-sche…> …)
In guix/packages.scm:
   1356:39  7 (_)
   1618:16  6 (package->bag _ _ _ #:graft? _)
   1722:47  5 (thunk)
In gnu/packages/loko.scm:
     77:11  4 (native-inputs #<package loko-scheme@0.12.0 gnu/package…>)
     77:11  3 (native-inputs _)
In ice-9/boot-9.scm:
   1685:16  2 (raise-exception _ #:continuable? _)
   1685:16  1 (raise-exception _ #:continuable? _)
   1685:16  0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
Wrong type to apply: #<syntax-transformer chez-scheme-for-system>






^ permalink raw reply	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH 4/6] gnu: chez-scheme: Update to 10.0.0.
  2024-03-30 22:49     ` Philip McGrath
  2024-03-31 14:35       ` Skyler Ferris via Guix-patches via
@ 2024-03-31 15:28       ` Skyler Ferris via Guix-patches via
  2024-03-31 20:17         ` Philip McGrath
  2024-04-01  6:51         ` [bug#70065] [PATCH v2 0/8] Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9 Philip McGrath
  1 sibling, 2 replies; 39+ messages in thread
From: Skyler Ferris via Guix-patches via @ 2024-03-31 15:28 UTC (permalink / raw)
  To: Philip McGrath, 70065
  Cc: Katherine Cox-Buday, Liliana Marie Prikler, Andrew Tropin

Hi again! I stepped away from my desk to do something else and as often 
happens the answer came to me. I'll include full steps to reproduce the 
issue below, in order to build confidence in my explanation, but the 
TLDR is that your definition is correct and it was a problem on my end. 
Additionally, I confirmed that loko-scheme still builds and runs. I'll 
keep this situation in mind for future reviews. Thank you for all your 
hard work!

Explanation:

The loko.scm file was not recompiled so it searched chez.scm for a 
variable named chez-scheme-for-system, which is now a syntax 
transformer. But compiled files have already completed the expansion 
phase, so this means that a syntax transformer is invalid. This will not 
cause a problem for `guix pull` because guix rebuilds itself from 
scratch when it gets updated.

Reproduction:

1. Build the tree without patch 4/6 applied
    `guix shell -D guix -CPW -- make`
2. Apply the patch
    `git apply /path/to/patch`
3. Build the tree again
    `guix shell -D guix -CPW -- make`
4. Try to build loko-scheme
    `./pre-inst-env guix build loko-scheme`
5. Delete the compiled loko file
    `rm gnu/packages/loko.go`
6. Build the tree again
    `guix shell -D guix -CPW -- make`
7. Build loko-scheme
    `./pre-inst-env guix build loko-scheme`

On 3/31/24 07:35, Skyler Ferris wrote:
> On 3/30/24 15:49, Philip McGrath wrote:
>> I still don't understand why the deprecation definition isn't working. I
>> expected the expansion at the repl, and (chez-scheme-for-system)
>> expanded to (%chez-scheme-for-system/deprecated), which was defined by
>> the expansion of define-deprecated as:
>>
>>     (define %chez-scheme-for-system/deprecated
>>       (begin
>>         (lambda () chez-scheme)
>>         (lambda* (#:optional (system #f)) chez-scheme)))
>>
>> I guess, unless I figure something out or someone has a better
>> suggestion, I could just remove chez-scheme-for-system without
>> deprecation, but that seemed less friendly.
>
> So, I started poking at this and ran into something strange. I removed 
> the surrounding parentheses from chez-scheme-for-system in loko.scm, 
> and it gave me the expected error about an invalid package, where the 
> value was a procedure rather than a package. Which sounds like what I 
> would expect if it was working, except that it didn't work with the 
> parentheses. Then, after adding the parentheses back it stopped giving 
> me the error, even after running make again.
>
> I haven't worked with define-deprecated before. It's a macro, and I 
> know that the guile compiler misses recompiling macro dependencies 
> sometimes, so maybe it was a problem on my end with having mismatching 
> build artifacts. I'll try a clean build with these patches and a 
> simulated guix pull within the next couple of days (hopefully today), 
> and if those both work then the definition is probably correct.... but 
> I'd be more comfortable if we could explain exactly why that error 
> occurred. I'll also look more at the definitions, but I think it will 
> be a little difficult to be confident in any explanation if I can't 
> reproduce the error. Here's the full error output, in case it's 
> helpful to anyone:
>
> Backtrace:
> In ice-9/boot-9.scm:
>   1752:10 19 (with-exception-handler _ _ #:unwind? _ # _)
> In guix/ui.scm:
>     485:6 18 (_)
> In guix/scripts/build.scm:
>     711:5 17 (_)
> In srfi/srfi-1.scm:
>    673:15 16 (append-map #<procedure 7fef052ecdc0 at guix/scripts/b…> …)
>    586:17 15 (map1 ("x86_64-linux"))
> In guix/scripts/build.scm:
>    713:21 14 (_ _)
> In guix/store.scm:
>   1382:11 13 (map/accumulate-builds #<store-connection 256.100 7fef…> …)
>    1300:8 12 (call-with-build-handler #<procedure 7fef06f90990 at g…> …)
> In guix/scripts/build.scm:
>    667:16 11 (_ #<package loko-scheme@0.12.0 gnu/packages/loko.scm:3…>)
>    656:24 10 (_ #<package loko-scheme@0.12.0 gnu/packages/loko.scm:…> …)
> In guix/packages.scm:
>   1378:17  9 (supported-package? #<package loko-scheme@0.12.0 gnu/p…> …)
> In guix/memoization.scm:
>     101:0  8 (_ #<hash-table 7fef036b2120 0/31> #<package loko-sche…> …)
> In guix/packages.scm:
>   1356:39  7 (_)
>   1618:16  6 (package->bag _ _ _ #:graft? _)
>   1722:47  5 (thunk)
> In gnu/packages/loko.scm:
>     77:11  4 (native-inputs #<package loko-scheme@0.12.0 gnu/package…>)
>     77:11  3 (native-inputs _)
> In ice-9/boot-9.scm:
>   1685:16  2 (raise-exception _ #:continuable? _)
>   1685:16  1 (raise-exception _ #:continuable? _)
>   1685:16  0 (raise-exception _ #:continuable? _)
>
> ice-9/boot-9.scm:1685:16: In procedure raise-exception:
> Wrong type to apply: #<syntax-transformer chez-scheme-for-system>
>






^ permalink raw reply	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH 4/6] gnu: chez-scheme: Update to 10.0.0.
  2024-03-31 15:28       ` Skyler Ferris via Guix-patches via
@ 2024-03-31 20:17         ` Philip McGrath
  2024-04-02 14:55           ` Skyler Ferris via Guix-patches via
  2024-04-01  6:51         ` [bug#70065] [PATCH v2 0/8] Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9 Philip McGrath
  1 sibling, 1 reply; 39+ messages in thread
From: Philip McGrath @ 2024-03-31 20:17 UTC (permalink / raw)
  To: Skyler Ferris, 70065
  Cc: Katherine Cox-Buday, Liliana Marie Prikler, Andrew Tropin

Hi Skyler,

On 3/31/24 11:28, Skyler Ferris wrote:
> Hi again! I stepped away from my desk to do something else and as often
> happens the answer came to me.

Thanks for this analysis!

> 
> The loko.scm file was not recompiled so it searched chez.scm for a
> variable named chez-scheme-for-system, which is now a syntax
> transformer. But compiled files have already completed the expansion
> phase, so this means that a syntax transformer is invalid. This will not
> cause a problem for `guix pull` because guix rebuilds itself from
> scratch when it gets updated.
> 


On 3/31/24 10:35, Skyler Ferris wrote:
 > I haven't worked with define-deprecated before. It's a macro, and I know
 > that the guile compiler misses recompiling macro dependencies sometimes,
 > so maybe it was a problem on my end with having mismatching build
 > artifacts.

Very interesting! I hadn't realized that problem with dependency 
tracking existed: it might explain some issues I've struggled to 
reproduce in the past. It's also given me several surprises about 
Guile's implementation of phases: for one thing, apparently 
(define-syntax x 42) expands to (define x (make-syntax-transformer 'x 
'macro 42)). I wouldn't have expected a macro to create a value that 
would exist at runtime.

Philip




^ permalink raw reply	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH v2 0/8] Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9.
  2024-03-31 15:28       ` Skyler Ferris via Guix-patches via
  2024-03-31 20:17         ` Philip McGrath
@ 2024-04-01  6:51         ` Philip McGrath
  2024-04-01  6:51           ` [bug#70065] [PATCH v2 1/8] gnu: zuo: Update to 1.9 Philip McGrath
                             ` (8 more replies)
  1 sibling, 9 replies; 39+ messages in thread
From: Philip McGrath @ 2024-04-01  6:51 UTC (permalink / raw)
  To: 70065
  Cc: Katherine Cox-Buday, Liliana Marie Prikler, Andrew Tropin,
	Philip McGrath, Skyler Ferris, Philip McGrath

Hi Skyler, Liliana, et al.,

Here is v2!

In the second patch, I tweaked the comments based on discussion with Skyler.

To be extra careful about the deprecation of chez-scheme-for-system, I split
the former [4/6] into:

  * [v2 4/8], which just changes the return value;
  * [v2 5/8], which changes to define-deprecated; and
  * [v2 6/8], which updates the uses.

I checked after that all the dependents built and that deprecation warnings
were shown after [v2 5/8] (and not anywhere else!).

Thanks!
Philip

Philip McGrath (8):
  gnu: zuo: Update to 1.9.
  gnu: racket: Update to 8.12.
  gnu: chez-scheme: Reorganize package definitions.
  gnu: chez-scheme: Update to 10.0.0.
  gnu: Deprecate chez-scheme-for-system.in favor of chez-scheme.
  gnu: Fix uses of deprecated chez-scheme-for-system.
  gnu: chez-scheme: Update and simplify machine-type handling.
  gnu: chez-scheme: Bootstrap from source.

 gnu/local.mk                                  |    9 +-
 gnu/packages/chez.scm                         | 1024 ++++++++---------
 gnu/packages/emacs-xyz.scm                    |    2 +-
 gnu/packages/loko.scm                         |    2 +-
 .../chez-scheme-backport-configure.patch      |  463 ++++++++
 gnu/packages/patches/chez-scheme-bin-sh.patch |   37 +-
 .../racket-backport-8.11-layered-docs.patch   |   36 -
 .../racket-backport-8.12-chez-configure.patch |  423 +++++++
 .../patches/racket-chez-scheme-bin-sh.patch   |   21 +-
 .../patches/racket-rktio-bin-sh.patch         |   17 +-
 ...cket-zuo-bin-sh.patch => zuo-bin-sh.patch} |   33 +-
 gnu/packages/racket.scm                       |  143 +--
 12 files changed, 1527 insertions(+), 683 deletions(-)
 create mode 100644 gnu/packages/patches/chez-scheme-backport-configure.patch
 delete mode 100644 gnu/packages/patches/racket-backport-8.11-layered-docs.patch
 create mode 100644 gnu/packages/patches/racket-backport-8.12-chez-configure.patch
 rename gnu/packages/patches/{racket-zuo-bin-sh.patch => zuo-bin-sh.patch} (72%)


base-commit: 0e8f7ee3a95011dd9ebdc99e0f3b754160524b5d
-- 
2.41.0





^ permalink raw reply	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH v2 1/8] gnu: zuo: Update to 1.9.
  2024-04-01  6:51         ` [bug#70065] [PATCH v2 0/8] Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9 Philip McGrath
@ 2024-04-01  6:51           ` Philip McGrath
  2024-04-01  6:51           ` [bug#70065] [PATCH v2 2/8] gnu: racket: Update to 8.12 Philip McGrath
                             ` (7 subsequent siblings)
  8 siblings, 0 replies; 39+ messages in thread
From: Philip McGrath @ 2024-04-01  6:51 UTC (permalink / raw)
  To: 70065
  Cc: Katherine Cox-Buday, Liliana Marie Prikler, Andrew Tropin,
	Philip McGrath, Skyler Ferris, Philip McGrath

Zuo now has tagged releases independent of the Racket release cycle.

* gnu/packages/patches/racket-zuo-bin-sh.patch: Move to ...
* gnu/packages/patches/zuo-bin-sh.patch: ... this file, and refresh it.
* gnu/local.mk (dist_patch_DATA): Update accordingly.
* gnu/packages/racket/scm (%racket-origin)[patches]: Likewise.
* gnu/packages/patches/racket-chez-scheme-bin-sh.patch: Refresh patch.
* gnu/packages/patches/racket-rktio-bin-sh.patch: Likewise.
* gnu/packages/racket/scm (%zuo-version): Move to ...
(zuo)[version]: ... this field, and update to 1.9.
[source]: Change to the repository where Zuo releases are tagged.
[arguments]: Stop supplying '#:phases'.

Change-Id: Ia82c0f7a8e4696ae08e30965e3f4ec85673b86e5
---
 gnu/local.mk                                  |  4 +-
 .../patches/racket-chez-scheme-bin-sh.patch   | 21 +++++---
 .../patches/racket-rktio-bin-sh.patch         | 17 +++---
 ...cket-zuo-bin-sh.patch => zuo-bin-sh.patch} | 33 +++++++-----
 gnu/packages/racket.scm                       | 54 +++++++++----------
 5 files changed, 70 insertions(+), 59 deletions(-)
 rename gnu/packages/patches/{racket-zuo-bin-sh.patch => zuo-bin-sh.patch} (72%)

diff --git a/gnu/local.mk b/gnu/local.mk
index 5429dc498c..a025276390 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1984,7 +1984,6 @@ dist_patch_DATA =						\
   %D%/packages/patches/racket-chez-scheme-bin-sh.patch		\
   %D%/packages/patches/racket-backport-8.11-layered-docs.patch	\
   %D%/packages/patches/racket-rktio-bin-sh.patch		\
-  %D%/packages/patches/racket-zuo-bin-sh.patch			\
   %D%/packages/patches/remake-impure-dirs.patch			\
   %D%/packages/patches/restartd-update-robust.patch             \
   %D%/packages/patches/restic-0.9.6-fix-tests-for-go1.15.patch	\
@@ -2225,7 +2224,8 @@ dist_patch_DATA =						\
   %D%/packages/patches/zig-do-not-link-against-librt.patch	\
   %D%/packages/patches/zig-use-baseline-cpu-by-default.patch	\
   %D%/packages/patches/zig-use-system-paths.patch		\
-  %D%/packages/patches/zsh-egrep-failing-test.patch
+  %D%/packages/patches/zsh-egrep-failing-test.patch		\
+  %D%/packages/patches/zuo-bin-sh.patch
 
 MISC_DISTRO_FILES =				\
   %D%/packages/ld-wrapper.in
diff --git a/gnu/packages/patches/racket-chez-scheme-bin-sh.patch b/gnu/packages/patches/racket-chez-scheme-bin-sh.patch
index 331b4f244b..e77c26f303 100644
--- a/gnu/packages/patches/racket-chez-scheme-bin-sh.patch
+++ b/gnu/packages/patches/racket-chez-scheme-bin-sh.patch
@@ -1,4 +1,4 @@
-From f86370295c5bb14d4bb93d0ccfa37a2b79f19f25 Mon Sep 17 00:00:00 2001
+From 5398e6d3305def343a009aba7c5f8915851c4115 Mon Sep 17 00:00:00 2001
 From: Philip McGrath <philip@philipmcgrath.com>
 Date: Wed, 24 Aug 2022 19:55:14 -0400
 Subject: [PATCH] Chez Scheme: patch s_process for "/bin/sh" on Guix
@@ -14,17 +14,22 @@ then `s_process` will call `execl` with the file specified by
 `_PATH_BSHELL` instead of "/bin/sh".
 
 Checking that the path specified by `_PATH_BSHELL` exists safeguards
-against obscure errors if attempting to use stand-alone executables
-built by the patched Racket in non-Guix envoronments.
+against obscure errors if attempting to use the patched Chez Scheme
+or executables it builds in non-Guix envoronments.
 
 This patch does not change the behavior of `s_system`, which relies
 on `system` from the C library.
 ---
+
+Notes:
+    See also chez-scheme-bin-sh.patch, racket-rktio-bin-sh.patch,
+    and zuo-bin-sh.patch.
+
  racket/src/ChezScheme/c/prim5.c | 21 ++++++++++++++++++++-
  1 file changed, 20 insertions(+), 1 deletion(-)
 
 diff --git a/racket/src/ChezScheme/c/prim5.c b/racket/src/ChezScheme/c/prim5.c
-index 82bbf8d687..be8f603447 100644
+index 90b087f125..284f063f8b 100644
 --- a/racket/src/ChezScheme/c/prim5.c
 +++ b/racket/src/ChezScheme/c/prim5.c
 @@ -27,6 +27,12 @@
@@ -40,7 +45,7 @@ index 82bbf8d687..be8f603447 100644
  /* locally defined functions */
  static INT s_errno(void);
  static IBOOL s_addr_in_heap(uptr x);
-@@ -861,6 +867,17 @@ static ptr s_process(char *s, IBOOL stderrp) {
+@@ -875,6 +881,17 @@ static ptr s_process(char *s, IBOOL stderrp) {
  
      INT tofds[2], fromfds[2], errfds[2];
      struct sigaction act, oint_act;
@@ -58,7 +63,7 @@ index 82bbf8d687..be8f603447 100644
  
      if (pipe(tofds)) S_error("process","cannot open pipes");
      if (pipe(fromfds)) {
-@@ -897,7 +914,9 @@ static ptr s_process(char *s, IBOOL stderrp) {
+@@ -911,7 +928,9 @@ static ptr s_process(char *s, IBOOL stderrp) {
            }
          }
  #endif /* __GNU__ Hurd */
@@ -70,7 +75,7 @@ index 82bbf8d687..be8f603447 100644
          /*NOTREACHED*/
      } else {
 
-base-commit: 87eee6e2adb8c6bc11e60619c706fa6295096085
+base-commit: 78fef00d4d16a79fdf6ab31924b3a80cadf4b368
 -- 
-2.32.0
+2.41.0
 
diff --git a/gnu/packages/patches/racket-rktio-bin-sh.patch b/gnu/packages/patches/racket-rktio-bin-sh.patch
index ec6f0d9c56..d777c0979a 100644
--- a/gnu/packages/patches/racket-rktio-bin-sh.patch
+++ b/gnu/packages/patches/racket-rktio-bin-sh.patch
@@ -1,4 +1,4 @@
-From 6a553f24439fe64fd3a2f0b5902f00590ca4241f Mon Sep 17 00:00:00 2001
+From 5e546a30789e5c9b3c94674b94cb63e16ee2e951 Mon Sep 17 00:00:00 2001
 From: Philip McGrath <philip@philipmcgrath.com>
 Date: Thu, 4 Mar 2021 04:11:50 -0500
 Subject: [PATCH] rktio: patch rktio_process for "/bin/sh" on Guix
@@ -28,11 +28,16 @@ Checking that the path specified by `_PATH_BSHELL` exists safeguards
 against obscure errors if attempting to use stand-alone executables
 built by the patched Racket in non-Guix envoronments.
 ---
+
+Notes:
+    See also chez-scheme-bin-sh.patch, racket-chez-scheme-bin-sh.patch,
+    and zuo-bin-sh.patch.
+
  racket/src/rktio/rktio_process.c | 17 ++++++++++++++++-
  1 file changed, 16 insertions(+), 1 deletion(-)
 
 diff --git a/racket/src/rktio/rktio_process.c b/racket/src/rktio/rktio_process.c
-index fafaf728c1..796ebc59ce 100644
+index 862850d93a..87daafef76 100644
 --- a/racket/src/rktio/rktio_process.c
 +++ b/racket/src/rktio/rktio_process.c
 @@ -9,6 +9,7 @@
@@ -43,7 +48,7 @@ index fafaf728c1..796ebc59ce 100644
  # ifdef USE_ULIMIT
  #  include <ulimit.h>
  # endif
-@@ -1301,12 +1302,14 @@ int rktio_process_allowed_flags(rktio_t *rktio)
+@@ -1358,12 +1359,14 @@ int rktio_process_allowed_flags(rktio_t *rktio)
  /*========================================================================*/
  
  rktio_process_result_t *rktio_process(rktio_t *rktio,
@@ -59,7 +64,7 @@ index fafaf728c1..796ebc59ce 100644
    rktio_process_result_t *result;
    intptr_t to_subprocess[2], from_subprocess[2], err_subprocess[2];
    int pid;
-@@ -1333,6 +1336,18 @@ rktio_process_result_t *rktio_process(rktio_t *rktio,
+@@ -1390,6 +1393,18 @@ rktio_process_result_t *rktio_process(rktio_t *rktio,
    int i;
  #endif
  
@@ -79,7 +84,7 @@ index fafaf728c1..796ebc59ce 100644
    to_subprocess[0] = -1;
    to_subprocess[1] = -1;
 
-base-commit: 9d228d16fb99c274c964e5bef93e97333888769f
+base-commit: 78fef00d4d16a79fdf6ab31924b3a80cadf4b368
 -- 
-2.32.0
+2.41.0
 
diff --git a/gnu/packages/patches/racket-zuo-bin-sh.patch b/gnu/packages/patches/zuo-bin-sh.patch
similarity index 72%
rename from gnu/packages/patches/racket-zuo-bin-sh.patch
rename to gnu/packages/patches/zuo-bin-sh.patch
index bcdcb8e963..92e3774424 100644
--- a/gnu/packages/patches/racket-zuo-bin-sh.patch
+++ b/gnu/packages/patches/zuo-bin-sh.patch
@@ -1,7 +1,7 @@
-From 73d9b77a11b4516905caf579abb559736f715ea6 Mon Sep 17 00:00:00 2001
+From cd6bed5d22ea9cb7bae2be134d5d04433fc8e313 Mon Sep 17 00:00:00 2001
 From: Philip McGrath <philip@philipmcgrath.com>
 Date: Mon, 11 Apr 2022 20:43:18 -0400
-Subject: [PATCH] Zuo: patch zuo_process for "/bin/sh" on Guix
+Subject: [PATCH] patch zuo_process for "/bin/sh" on Guix
 
 If:
 
@@ -16,17 +16,22 @@ then `zuo_process` will execute the file specified by `_PATH_BSHELL`
 instead of "/bin/sh".
 
 Checking that the path specified by `_PATH_BSHELL` exists safeguards
-against obscure errors if attempting to use stand-alone executables
-built by the patched Racket in non-Guix envoronments.
+against obscure errors if attempting to use the patched Zuo
+or derived executables in non-Guix envoronments.
 ---
- racket/src/zuo/zuo.c | 20 ++++++++++++++++++--
+
+Notes:
+    See also chez-scheme-bin-sh.patch, racket-chez-scheme-bin-sh.patch,
+    racket-rktio-bin-sh.patch.
+
+ zuo.c | 20 ++++++++++++++++++--
  1 file changed, 18 insertions(+), 2 deletions(-)
 
-diff --git a/racket/src/zuo/zuo.c b/racket/src/zuo/zuo.c
-index 17f161826d..c4fb3929bb 100644
---- a/racket/src/zuo/zuo.c
-+++ b/racket/src/zuo/zuo.c
-@@ -15,6 +15,7 @@
+diff --git a/zuo.c b/zuo.c
+index d4163eb..bfc5484 100644
+--- a/zuo.c
++++ b/zuo.c
+@@ -16,6 +16,7 @@
  #include <string.h>
  #include <ctype.h>
  #ifdef ZUO_UNIX
@@ -34,7 +39,7 @@ index 17f161826d..c4fb3929bb 100644
  # include <fcntl.h>
  # include <unistd.h>
  # include <errno.h>
-@@ -5730,7 +5731,10 @@ static void zuo_pipe(zuo_raw_handle_t *_r, zuo_raw_handle_t *_w)
+@@ -5949,7 +5950,10 @@ static void zuo_pipe(zuo_raw_handle_t *_r, zuo_raw_handle_t *_w)
  zuo_t *zuo_process(zuo_t *command_and_args)
  {
    const char *who = "process";
@@ -46,7 +51,7 @@ index 17f161826d..c4fb3929bb 100644
    zuo_t *args = _zuo_cdr(command_and_args), *rev_args = z.o_null;
    zuo_t *options = z.o_empty_hash, *opt;
    zuo_t *dir, *l, *p_handle, *result;
-@@ -5741,7 +5745,19 @@ zuo_t *zuo_process(zuo_t *command_and_args)
+@@ -5960,7 +5964,19 @@ zuo_t *zuo_process(zuo_t *command_and_args)
    void *env;
    int as_child, exact_cmdline;
  
@@ -68,7 +73,7 @@ index 17f161826d..c4fb3929bb 100644
      zuo_t *a = _zuo_car(l);
      if (a == z.o_null) {
 
-base-commit: 87eee6e2adb8c6bc11e60619c706fa6295096085
+base-commit: a0faa82c8383d206aa38d21462ca4ae699851a0b
 -- 
-2.32.0
+2.41.0
 
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index 5c863f1afd..6e19be1da3 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -2,7 +2,7 @@
 ;;; Copyright © 2013-2016, 2018, 2020-2022 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2020 Pierre Neidhardt <mail@ambrevar.xyz>
-;;; Copyright © 2021, 2022, 2023 Philip McGrath <philip@philipmcgrath.com>
+;;; Copyright © 2021-2024 Philip McGrath <philip@philipmcgrath.com>
 ;;; Copyright © 2021 jgart <jgart@dismail.de>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -192,7 +192,6 @@ (define-module (gnu packages racket)
 ;; CODE:
 
 (define %racket-version "8.11.1") ; Remember to update chez-scheme-for-racket!
-(define %zuo-version "1.7") ; defined in racket/src/zuo/zuo.c
 (define %racket-commit
   (string-append "v" %racket-version))
 (define %racket-origin
@@ -206,8 +205,7 @@ (define %racket-origin
     (file-name (git-file-name "racket" %racket-version))
     (patches (search-patches "racket-chez-scheme-bin-sh.patch"
                              "racket-backport-8.11-layered-docs.patch"
-                             "racket-rktio-bin-sh.patch"
-                             "racket-zuo-bin-sh.patch"))
+                             "racket-rktio-bin-sh.patch"))
     (modules '((guix build utils)))
     (snippet
      #~(begin
@@ -229,30 +227,28 @@ (define %racket-origin
 
 
 (define-public zuo
-  (let ((revision #f))
-    (package
-      (name "zuo")
-      (version (string-append %zuo-version
-                              "-racket"
-                              %racket-version
-                              (if revision "-guix" "")
-                              (or revision "")))
-      (source %racket-origin)
-      (outputs '("out" "debug"))
-      (build-system gnu-build-system)
-      (arguments
-       (list
-        #:out-of-source? #t
-        #:phases
-        #~(modify-phases %standard-phases
-            (add-after 'unpack 'chdir
-              (lambda args
-                (chdir "racket/src/zuo"))))))
-      (home-page "https://github.com/racket/zuo")
-      ;; ^ This is downstream of https://github.com/racket/racket,
-      ;; but it's designed to be a friendly landing place
-      (synopsis "Tiny Racket for build scripts")
-      (description "Zuo is a tiny Racket with primitives for dealing
+  (package
+    (name "zuo")
+    (version "1.9") ; defined in racket/src/zuo/zuo.c or the following
+    #;(displayln (~a (hash-ref (runtime-env) 'version) "."
+                     (hash-ref (runtime-env) 'minor-version)))
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/racket/zuo")
+                    (commit (string-append "v" version))))
+              (sha256
+               (base32 "0zasir33nx1qi1ciz9dn6h8k39i443lr6apw5d1i6mjmhpzxmdhp"))
+              (file-name (git-file-name name version))
+              (patches (search-patches "zuo-bin-sh.patch"))))
+    (outputs '("out" "debug"))
+    (build-system gnu-build-system)
+    (arguments
+     (list
+      #:out-of-source? #t))
+    (home-page "https://github.com/racket/zuo")
+    (synopsis "Tiny Racket for build scripts")
+    (description "Zuo is a tiny Racket with primitives for dealing
 with files and running processes.  It comes with a @command{make}-like
 embedded DSL, which is used to build Racket itself.
 
@@ -261,7 +257,7 @@ (define-public zuo
 and expansion of the file content.  That's how the @command{make}-like DSL is
 defined, and even the base Zuo language is defined by layers of @code{#lang}s.
 One of the early layers implements macros.")
-      (license (list license:asl2.0 license:expat)))))
+    (license (list license:asl2.0 license:expat))))
 
 
 (define racket-vm-common-configure-flags
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH v2 2/8] gnu: racket: Update to 8.12.
  2024-04-01  6:51         ` [bug#70065] [PATCH v2 0/8] Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9 Philip McGrath
  2024-04-01  6:51           ` [bug#70065] [PATCH v2 1/8] gnu: zuo: Update to 1.9 Philip McGrath
@ 2024-04-01  6:51           ` Philip McGrath
  2024-04-09  8:46             ` Efraim Flashner
  2024-04-01  6:51           ` [bug#70065] [PATCH v2 3/8] gnu: chez-scheme: Reorganize package definitions Philip McGrath
                             ` (6 subsequent siblings)
  8 siblings, 1 reply; 39+ messages in thread
From: Philip McGrath @ 2024-04-01  6:51 UTC (permalink / raw)
  To: 70065
  Cc: Katherine Cox-Buday, Liliana Marie Prikler, Andrew Tropin,
	Philip McGrath, Skyler Ferris, Philip McGrath

All of Racket's changes to Chez Scheme have been merged upstream.  They
are the basis for the Chez Scheme 10.0.0 release.  For the forseeable
future, Racket will continue to depend on a specific pre-release
version of Chez Scheme as part of Racket's "ABI": see upstream
discussion at <https://racket.discourse.group/t/2739/3>.

* gnu/packages/chez.scm (chez-configure): Change to define a phase to
run the Chez Scheme configure script, renaming the old definition to ...
(configure-chezschemelibdirs): ... this new variable.
(chez-srfi, chez-matchable, chez-irregex, chez-fmt, chez-mit)
(chez-scmutils)[arguments]<#:phases>: Update accordingly.
(unpack-nanopass+stex): Replace with ...
(unpack-nanopass): ... this new variable.
(chez-scheme)[arguments]<#:phases>: Inline old definition of
'unpack-nanopass+stex' to facilitate transition.
(chez-scheme-for-racket): Stop inheriting from 'chez-scheme'.
[version]: Update to 9.9.9-pre-release.23.
[outputs]: Add "debug" output.
[native-inputs]: Add 'texlive-enumitem' for native builds. For cross
builds, omit TeX-related inputs and add this-package:doc.
[inputs, native-search-paths, home-page]: Rewrite without inheritance.
[arguments]: Likewise, and adjust for upstream changes.
[synopsis, description]: Rewrite to reflect upstreaming of
Racket's changes to Chez Scheme.
(chez-scheme-for-racket-bootstrap-bootfiles): Stop inheriting from
'chez-scheme-bootstrap-bootfiles'.
[arguments]: Rewrite without inheritance. Use `make cross.boot` instead
of broken experimental script for cross builds.
[home-page]: Use bootstrapping Racket package instead of archived Git
repository.
[description]: Rewrite to reflect upstreaming of Racket's changes to
Chez Scheme.
* gnu/packages/patches/racket-backport-8.11-layered-docs.patch: Delete
file.
* gnu/packages/patches/racket-backport-8.12-chez-configure.patch: New
file.
* gnu/local.mk (dist_patch_DATA): Update accordingly.
* gnu/packages/racket.scm (%racket-origin)[patches]: Likewise.
[snippet]: Also unbundle Zuo and potential pre-built boot files.
(%racket-version): Update to 8.12.
(racket-vm-cs)[arguments]<#:phases>: Use 'unpack-nanopass' instead of
'unpack-nanopass+stex'.
(racket)[inputs]<data, deinprogramm, drracket, gui, htdp, net-cookies>
<pict, plot, rackunit, redex, scribble, typed-racket, string-constants>
<web-server>: Update hashes.
<quickscript>: Likewise, and remove obsolete snippet.

Change-Id: I11e7f44be37c60c91b03d246a50e75e418bd0672
---
 gnu/local.mk                                  |   4 +-
 gnu/packages/chez.scm                         | 522 ++++++++++--------
 .../racket-backport-8.11-layered-docs.patch   |  36 --
 .../racket-backport-8.12-chez-configure.patch | 423 ++++++++++++++
 gnu/packages/racket.scm                       |  61 +-
 5 files changed, 761 insertions(+), 285 deletions(-)
 delete mode 100644 gnu/packages/patches/racket-backport-8.11-layered-docs.patch
 create mode 100644 gnu/packages/patches/racket-backport-8.12-chez-configure.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index a025276390..a10aa2cefd 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -41,7 +41,7 @@
 # Copyright © 2020, 2023 Vinicius Monego <monego@posteo.net>
 # Copyright © 2021 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
 # Copyright © 2021 Greg Hogan <code@greghogan.com>
-# Copyright © 2021, 2022, 2023 Philip McGrath <philip@philipmcgrath.com>
+# Copyright © 2021-2024 Philip McGrath <philip@philipmcgrath.com>
 # Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net>
 # Copyright © 2021 Sharlatan Hellseher <sharlatanus@gmail.com>
 # Copyright © 2021 Dmitry Polyakov <polyakov@liltechdude.xyz>
@@ -1982,7 +1982,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/rpcbind-CVE-2017-8779.patch		\
   %D%/packages/patches/rtags-separate-rct.patch			\
   %D%/packages/patches/racket-chez-scheme-bin-sh.patch		\
-  %D%/packages/patches/racket-backport-8.11-layered-docs.patch	\
+  %D%/packages/patches/racket-backport-8.12-chez-configure.patch	\
   %D%/packages/patches/racket-rktio-bin-sh.patch		\
   %D%/packages/patches/remake-impure-dirs.patch			\
   %D%/packages/patches/restartd-update-robust.patch             \
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 2811cf3e01..f651cdce0c 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, 2022, 2023 Philip McGrath <philip@philipmcgrath.com>
+;;; Copyright © 2021-2024 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -51,7 +51,7 @@ (define-module (gnu packages chez)
   #:export (chez-scheme-for-system
             racket-cs-native-supported-system?
             nix-system->pbarch-machine-type
-            unpack-nanopass+stex))
+            unpack-nanopass))
 
 ;; Commentary:
 ;;
@@ -273,19 +273,14 @@ (define* (racket-cs-native-supported-system? #:optional
 ;; Chez Scheme:
 ;;
 
-
-(define unpack-nanopass+stex
-  #~(begin
-      (copy-recursively
-       (dirname (search-input-file %build-inputs
-                                   "lib/chez-scheme/nanopass.ss"))
-       "nanopass"
-       #:keep-mtime? #t)
-      (mkdir-p "stex")
-      (with-output-to-file "stex/Mf-stex"
-        (lambda ()
-          ;; otherwise, it will try to download submodules
-          (display "# to placate ../configure")))))
+(define unpack-nanopass
+  #~(lambda* (#:key inputs native-inputs #:allow-other-keys)
+      (with-directory-excursion (if (directory-exists? "racket/src/ChezScheme")
+                                    "racket/src/ChezScheme"
+                                    ".")
+        (symlink (dirname (search-input-file (or native-inputs inputs)
+                                             "lib/chez-scheme/nanopass.ss"))
+                 "nanopass"))))
 
 (define-public chez-scheme
   (package
@@ -357,7 +352,17 @@ (define-public chez-scheme
       #~(modify-phases %standard-phases
           (add-after 'unpack 'unpack-nanopass+stex
             (lambda args
-              #$unpack-nanopass+stex))
+              (begin
+                (copy-recursively
+                 (dirname (search-input-file %build-inputs
+                                             "lib/chez-scheme/nanopass.ss"))
+                 "nanopass"
+                 #:keep-mtime? #t)
+                (mkdir-p "stex")
+                (with-output-to-file "stex/Mf-stex"
+                  (lambda ()
+                    ;; otherwise, it will try to download submodules
+                    (display "# to placate ../configure"))))))
           (add-after 'unpack-nanopass+stex 'unpack-bootfiles
             (lambda* (#:key native-inputs inputs #:allow-other-keys)
               (when (directory-exists? "boot")
@@ -462,152 +467,226 @@ (define-public chez-scheme
 and 32-bit PowerPC architectures.")
     (license asl2.0)))
 
+(define chez-configure
+  ;; The custom Chez 'configure' script doesn't allow unrecognized flags, such
+  ;; as those automatically added by `gnu-build-system`. This replacement
+  ;; phase uses only the explicitly provided `#: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)
+        (when 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))))
+
 (define-public chez-scheme-for-racket
   (package
-    (inherit chez-scheme)
     (name "chez-scheme-for-racket")
-    (version "9.9.9-pre-release.18")
-    ;; The version should match `scheme-version`.
-    ;; See racket/src/ChezScheme/s/cmacros.ss c. line 360.
-    ;; It will always be different than the upstream version!
-    ;; When updating, remember to also update %racket-version in racket.scm.
-    (source #f) ; avoid problematic cycle with racket.scm
-    (inputs
-     (let ((inputs (modify-inputs (package-inputs chez-scheme)
-                     (replace "chez-scheme-bootstrap-bootfiles"
-                       chez-scheme-for-racket-bootstrap-bootfiles)
-                     (delete "libx11" "util-linux:lib"))))
-       (if (racket-cs-native-supported-system?)
-           inputs
-           (modify-inputs inputs
-             (prepend libffi)))))
-    (native-inputs
-     (let ((native-inputs (modify-inputs (package-native-inputs chez-scheme)
-                            (prepend zuo))))
-       (if (%current-target-system)
-           (modify-inputs native-inputs
-             (prepend this-package))
-           native-inputs)))
+    ;; The version should match `(scheme-version-number #t)`.
+    ;; See s/cmacros.ss c. line 360.
+    (version "9.9.9-pre-release.23")
+    (source #f)
+    (build-system gnu-build-system)
+    (inputs `(,@(if (racket-cs-native-supported-system?)
+                    '()
+                    (list libffi))
+              ,chez-scheme-for-racket-bootstrap-bootfiles
+              ,lz4
+              ,ncurses ;<-- for expeditor
+              ,zlib))
+    (native-inputs `(,@(if (%current-target-system)
+                           (list this-package
+                                 `(,this-package "doc"))
+                           (list stex-bootstrap
+                                 (texlive-updmap.cfg
+                                  (list texlive-enumitem))))
+                     ,chez-nanopass-bootstrap
+                     ,zuo))
+    (native-search-paths
+     (list (search-path-specification
+            (variable "CHEZSCHEMELIBDIRS")
+            (files '("lib/chez-scheme")))))
+    (outputs '("out" "debug" "doc"))
     (arguments
-     (substitute-keyword-arguments (package-arguments chez-scheme)
-       ((#:out-of-source? _ #f)
-        #t)
-       ((#:configure-flags cfg-flags #~'())
-        #~`("--disable-x11"
-            "--threads" ;; ok to potentially duplicate
-            #$(string-append "-m=" (or (racket-cs-native-supported-system?)
-                                       (nix-system->pbarch-machine-type)))
-            ;; ^ could skip -m= for non-cross non-pbarch builds
-            #$@(if (racket-cs-native-supported-system?)
-                   #~()
-                   ;; not inferred on non-native platforms: see
-                   ;; https://racket.discourse.group/t/950/9
-                   #~("--enable-libffi"
-                      "CFLAGS=-g -O2 -D_REENTRANT -pthread"
-                      "LIBS=-lm -ldl -lrt -lffi -lncurses"))
-            #$@(if (%current-target-system)
-                   (list (string-append "--toolprefix="
-                                        (%current-target-system)
-                                        "-"))
-                   '())
-            ,@(let* ((chez+version (strip-store-file-name #$output))
-                     (doc-prefix (assoc-ref %outputs "doc"))
-                     (doc-dir (string-append doc-prefix
-                                             "/share/doc/"
-                                             chez+version)))
-                (list (string-append "--installcsug="
-                                     doc-dir
-                                     "/csug")
-                      (string-append "--installreleasenotes="
-                                     doc-dir
-                                     "/release_notes")))
-            ,@#$cfg-flags))
-       ((#:make-flags mk-flags #~'())
-        #~(cons* (string-append "ZUO="
-                                #+(this-package-native-input "zuo")
-                                "/bin/zuo")
-                 (string-append "STEXLIB="
-                                #+(this-package-native-input "stex")
-                                "/lib/stex")
-                 #$mk-flags))
-       ((#:phases those-phases #~%standard-phases)
-        #~(let* ((those-phases #$those-phases)
-                 (gnu:unpack (assoc-ref those-phases 'unpack))
-                 (gnu:build (assoc-ref those-phases 'build)))
-            (modify-phases those-phases
-              (replace 'build
-                ;; need to override target for cross-compilation
-                ;; https://racket.discourse.group/t/950/19
-                (lambda* (#:key target (make-flags '()) (parallel-build? #t)
-                          #:allow-other-keys)
-                  (gnu:build #:make-flags (if target
-                                              (cons "kernel" make-flags)
-                                              make-flags)
-                             #:parallel-build? parallel-build?)))
-              (replace 'install-docs
-                (lambda* (#:key native-inputs (make-flags '())
-                          #:allow-other-keys)
-                  ;; The tests for 'native-inputs' are cross-compilation
-                  ;; workarounds that would be better to address upstream:
-                  ;; see <https://racket.discourse.group/t/950/20>.
-                  (when native-inputs
-                    (substitute* "Makefile"
-                      (("install-docs: build \\$[(]ZUO[)]")
-                       "install-docs: $(ZUO)")))
-                  (apply invoke
-                         "make"
-                         "install-docs"
-                         (if native-inputs
-                             (cons (string-append
-                                    "Scheme="
-                                    (search-input-file native-inputs
-                                                       "/bin/scheme"))
-                                   make-flags)
-                             make-flags))))
-              (replace 'unpack
-                (lambda args
-                  (gnu:unpack #:source #$(or (package-source this-package)
-                                             (package-source racket-vm-bc)))))
-              (add-after 'unpack 'chdir
-                (lambda args
-                  (chdir "racket/src/ChezScheme"))))))))
-    (supported-systems %supported-systems)
-    (home-page "https://github.com/racket/ChezScheme")
-    ;; ^ This is downstream of https://github.com/racket/racket,
-    ;; but it's designed to be a friendly landing place for people
-    ;; who want a ChezScheme-shaped repositroy.
-    (synopsis "Variant of Chez Scheme extended for Racket")
-    (description "This variant of Chez Scheme is extended to support the
-implementation of Racket.  It may be useful on platforms that are not yet
-supported by upstream Chez Scheme.
-
-Main additions to Chez Scheme in the Racket variant:
-@itemize @bullet
-@item
-AArch64 and RV64G (RISC-V) code generation
-@item
-Portable bytecode (@code{pb}) mode, which is mainly useful for bootstrapping a
-build on any platform, but can also be used on platforms without native-code
-generation, compiled via Emscripten, linked with @code{libffi}, or used with
-bytecode partially compiled to C
-@item
-Unboxed floating-point arithmetic and flvectors
-@item
-Faster multiplication and division for large exact numbers
-@item
-Type reconstruction during optimization (especially for safe code)
-@item
-Continuation marks
-@item
-Parallel garbage collection, in-place garbage collection for old-generation
-objects (instead of always copying), and reachability-based memory
-accounting
-@item
-Ordered finalization, immobile (but collectable) objects, weak/ephemeron
-generic hash tables, and reference bytevectors
-@item
-Easier bootstrapping via old versions of Chez Scheme
-@end itemize")
+     (list
+      #:modules
+      '((guix build gnu-build-system)
+        (guix build utils)
+        (ice-9 ftw)
+        (ice-9 match)
+        (srfi srfi-34))
+      #:out-of-source? #t
+      ;; Intermittent failures: https://github.com/cisco/ChezScheme/issues/809
+      #:tests? #f
+      #:test-target "test" ; test-one test-some-fast test-some test test-more
+      #:configure-flags
+      #~`(,@(let* ((chez+version (strip-store-file-name #$output))
+                   (doc-dir (string-append #$output:doc
+                                           "/share/doc/"
+                                           chez+version)))
+              (list (string-append "--installcsug="
+                                   doc-dir
+                                   "/csug")
+                    (string-append "--installreleasenotes="
+                                   doc-dir
+                                   "/release_notes")))
+          ,(string-append "--installprefix=" #$output)
+          #$@(if (%current-target-system)
+                 (list (string-append "--toolprefix="
+                                      (%current-target-system)
+                                      "-"))
+                 '())
+          ,@(if (false-if-exception
+                 (search-input-directory %build-inputs "/include/X11"))
+                '()
+                '("--disable-x11"))
+          #$(string-append "-m=" (or (racket-cs-native-supported-system?)
+                                     (nix-system->pbarch-machine-type)))
+          ;; ^ could skip -m= for non-cross non-pbarch builds
+          #$@(if (racket-cs-native-supported-system?)
+                 #~()
+                 ;; not inferred on non-native platforms: see
+                 ;; https://racket.discourse.group/t/950/9
+                 #~("--enable-libffi"
+                    "CFLAGS+=-g -D_REENTRANT -pthread"
+                    "LIBS+=-lm -ldl -lrt -lncurses"))
+          ,(string-append "STEXLIB="
+                          (or (false-if-exception
+                               (search-input-directory %build-inputs
+                                                       "/lib/stex"))
+                              "/GuixNotUsingStex"))
+          "ZUO=zuo"
+          "ZLIB=-lz"
+          "LZ4=-llz4"
+          ;; Guix will do 'compress-man-pages',
+          ;; and letting Chez try caused an error (at one point)
+          "--nogzip-man-pages")
+      #:phases
+      #~(modify-phases %standard-phases
+          (replace 'unpack
+            (let ((unpack (assoc-ref %standard-phases 'unpack)))
+              (lambda args
+                (unpack #:source #$(or (package-source this-package)
+                                       (package-source racket-vm-bc))))))
+          (add-after 'unpack 'unpack-nanopass
+            #$unpack-nanopass)
+          (add-after 'unpack-nanopass 'maybe-chdir
+            (lambda args
+              (when (directory-exists? "racket/src/ChezScheme")
+                (chdir "racket/src/ChezScheme"))))
+          (add-after 'maybe-chdir 'unpack-bootfiles
+            (lambda* (#:key native-inputs inputs #:allow-other-keys)
+              (when (directory-exists? "boot")
+                (delete-file-recursively "boot"))
+              (copy-recursively
+               (search-input-directory inputs "lib/chez-scheme-bootfiles")
+               "boot")))
+          (replace 'configure
+            #$chez-configure)
+          (add-after 'configure 'configure-environment-variables
+            (lambda args
+              ;; mats/6.ms needs HOME to be set:
+              (setenv "HOME" "/tmp")))
+          (replace 'build
+            ;; need to override target for cross-compilation
+            ;; https://racket.discourse.group/t/950/19
+            (let ((gnu:build (assoc-ref %standard-phases 'build)))
+              (lambda* (#:key target (make-flags '()) (parallel-build? #t)
+                        #:allow-other-keys)
+                (gnu:build #:make-flags (if target
+                                            (cons "kernel" make-flags)
+                                            make-flags)
+                           #:parallel-build? parallel-build?))))
+          (add-before 'check 'build-docs
+            ;; Building the documentation requires stex and a running scheme.
+            ;; This comes BEFORE 'check because the test suite may take on the
+            ;; order of an hour (without parallelism), so we want to get any
+            ;; other errors first.
+            ;; TODO: Improve cross support upstream: currently, it tries to
+            ;; run the cross-compiled scheme.
+            (lambda* (#:key native-inputs (make-flags '()) #:allow-other-keys)
+              #$(if (%current-target-system)
+                    #~(format #t "not building docs for cross~%")
+                    #~(apply invoke "make" "docs" make-flags))))
+          ;; 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.
+          (add-after 'install 'install-symlink
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let* ((bin-dir
+                      (dirname (search-input-file outputs "/bin/scheme")))
+                     (boot-dir
+                      (match (find-files (string-append bin-dir "/../lib")
+                                         "scheme.boot")
+                        ((scheme.boot)
+                         (dirname scheme.boot)))))
+                (for-each (lambda (dir)
+                            (with-directory-excursion dir
+                              (symlink "./scheme" "chez-scheme")
+                              (when (file-exists? "scheme.boot")
+                                (symlink "./scheme.boot" "chez-scheme.boot"))))
+                          (list bin-dir boot-dir)))))
+          (add-after 'install-symlink 'install-docs
+            ;; TODO: Improve cross support upstream.
+            ;; The `install-docs` target has a Zuo dependency on the `docs`
+            ;; target, so we have the same problem as the build-docs phase.
+            (lambda* (#:key native-inputs (make-flags '()) #:allow-other-keys)
+              #$(if (%current-target-system)
+                    #~(let* ((rel
+                              (string-append "share/doc/"
+                                             (strip-store-file-name #$output)))
+                             (found/csug
+                              (search-input-directory
+                               native-inputs (string-append rel "/csug")))
+                             (found (substring found/csug
+                                               0
+                                               (- (string-length found/csug)
+                                                  (string-length "/csug"))))
+                             (dest (string-append #$output:doc "/" rel)))
+                        (mkdir-p dest)
+                        (with-directory-excursion dest
+                          (for-each (lambda (f)
+                                      (symlink (string-append found "/" f)
+                                               f))
+                                    '("csug" "csug.pdf"
+                                      "release_notes" "release_notes.pdf"))))
+                    #~(apply invoke "make" "install-docs" make-flags))))
+          (add-after 'install-docs 'link-doc-pdfs
+            ;; otherwise, it's hard to notice them in a forest of HTML files
+            ;; TODO: improve cross support upstream.
+            (lambda* (#:key outputs #:allow-other-keys)
+              #$(if (%current-target-system)
+                    #~(format #t "nothing to be done for cross~%")
+                    #~(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"))))))))))
+    (home-page "https://cisco.github.io/ChezScheme/")
+    (synopsis "Bootstrapping version of Chez Scheme")
+    (description
+     "This is the precise pre-release version of Chez Scheme from a specific
+Racket release.  It is used to build Racket and to bootstrap the released
+version of Chez Scheme.")
     (license asl2.0)))
 
 ;;
@@ -646,58 +725,70 @@ (define-public chez-scheme-bootstrap-bootfiles
 
 (define-public chez-scheme-for-racket-bootstrap-bootfiles
   (package
-    (inherit chez-scheme-bootstrap-bootfiles)
     (name "chez-scheme-for-racket-bootstrap-bootfiles")
     (version (package-version chez-scheme-for-racket))
     (source #f) ; avoid problematic cycle with racket.scm
     (native-inputs
-     (cons* chez-nanopass-bootstrap
-            (if (%current-target-system)
-                (list zuo
-                      chez-scheme-for-racket)
-                (list racket-vm-bc))))
+     (cons chez-nanopass-bootstrap
+           (if (%current-target-system)
+               (list zuo
+                     chez-scheme-for-racket)
+               (list racket-vm-bc))))
+    (build-system copy-build-system)
     (arguments
-     (substitute-keyword-arguments
-         (package-arguments chez-scheme-bootstrap-bootfiles)
-       ((#:phases those-phases #~%standard-phases)
-        #~(let* ((those-phases #$those-phases)
-                 (unpack (assoc-ref those-phases 'unpack)))
-            (modify-phases those-phases
-              (replace 'unpack
-                (lambda args
-                  (unpack #:source #$(or (package-source this-package)
-                                         (package-source racket-vm-bc)))))
-              (add-after 'unpack 'chdir
-                (lambda args
-                  (chdir "racket/src/ChezScheme")))
-              (add-after 'chdir 'unpack-nanopass+stex
-                (lambda args
-                  #$unpack-nanopass+stex))
-              (add-before 'install 'build
-                (lambda* (#:key native-inputs inputs #:allow-other-keys)
-                  #$(cond
-                     ((%current-target-system)
-                      ;; cross-compiling
-                      #~(invoke
-                         (search-input-file (or native-inputs inputs)
-                                            "/bin/zuo")
-                         "makefiles/boot.zuo"
-                         (search-input-file (or native-inputs inputs)
-                                            "/bin/scheme")
-                         #$(or (racket-cs-native-supported-system?)
-                               (nix-system->pbarch-machine-type))))
-                     (else
-                      ;; bootstrapping
-                      #~(invoke
-                         (search-input-file (or native-inputs inputs)
-                                            "/opt/racket-vm/bin/racket")
-                         "../rktboot/main.rkt"))))))))))
-    (supported-systems
-     (package-supported-systems chez-scheme-for-racket))
-    (home-page "https://github.com/racket/ChezScheme")
-    ;; ^ This is downstream of https://github.com/racket/racket,
-    ;; but it's designed to be a friendly landing place for people
-    ;; who want a ChezScheme-shaped repositroy.
+     (list
+      #:install-plan
+      #~`(("boot/" "lib/chez-scheme-bootfiles"))
+      #:phases
+      #~(modify-phases %standard-phases
+          (replace 'unpack
+            (let ((unpack (assoc-ref %standard-phases 'unpack)))
+              (lambda args
+                (unpack #:source #$(or (package-source this-package)
+                                       (package-source racket-vm-bc))))))
+          (add-after 'unpack 'unpack-nanopass
+            #$unpack-nanopass)
+          (add-after 'unpack-nanopass 'chdir
+            (lambda args
+              (chdir "racket/src/ChezScheme")))
+          (add-before 'install 'build
+            #$(cond
+               ((%current-target-system)
+                ;; cross-compiling
+                ;; TODO: share more of this with upstream, once we figure out
+                ;; how best to manage running Chez as a cross-compiler and the
+                ;; unfortate cycle with %racket-origin.
+                #~(lambda* (#:key native-inputs inputs (parallel-build? #t)
+                            #:allow-other-keys)
+                    (invoke "./configure"
+                            "--force" ; don't complain about missing bootfiles
+                            #$(string-append
+                               "-m=" (or (racket-cs-native-supported-system?)
+                                         (nix-system->pbarch-machine-type)))
+                            "ZUO=zuo"
+                            ;; ignore submodules:
+                            "ZLIB=-lz"
+                            "LZ4=-llz4"
+                            "STEXLIB=/GuixNotUsingStex")
+                    (apply invoke
+                           "make"
+                           `(,@(if parallel-build?
+                                   `("-j" ,(number->string
+                                            (parallel-job-count)))
+                                   '())
+                             ,(string-append "SCHEME="
+                                             (search-input-file
+                                              (or native-inputs inputs)
+                                              "/bin/scheme"))
+                             "cross.boot"))))
+               (else
+                ;; bootstrapping
+                #~(lambda* (#:key native-inputs inputs #:allow-other-keys)
+                    (invoke
+                     (search-input-file (or native-inputs inputs)
+                                        "/opt/racket-vm/bin/racket")
+                     "../rktboot/main.rkt"))))))))
+    (home-page "https://pkgs.racket-lang.org/package/cs-bootstrap")
     (synopsis "Chez Scheme bootfiles bootstrapped by Racket")
     (description "Chez Scheme is a self-hosting compiler: building it
 requires ``bootfiles'' containing the Scheme-implemented portions compiled for
@@ -709,11 +800,8 @@ (define-public chez-scheme-for-racket-bootstrap-bootfiles
 Scheme compiler purely from source into Racket and apply the compiler to
 itself, thus bootstrapping Chez Scheme.  Bootstrapping takes about 10 times as
 long as using an existing Chez Scheme, but @code{cs-bootstrap} supports Racket
-7.1 and later, including the Racket BC variant.
-
-Note that the generated bootfiles are specific to Racket's fork of Chez
-Scheme, and @code{cs-bootstrap} does not currently support building upstream
-Chez Scheme.")))
+7.1 and later, including the Racket BC variant.")
+    (license asl2.0)))
 
 ;;
 ;; Chez's bootstrap dependencies:
@@ -935,7 +1023,7 @@ (define-public chez-nanopass
 
 ;; Help function for Chez Scheme to add the current path to
 ;; CHEZSCHEMELIBDIRS.
-(define chez-configure
+(define configure-chezschemelibdirs
   #~(lambda _
       (let ((chez-env (getenv "CHEZSCHEMELIBDIRS")))
         (setenv "CHEZSCHEMELIBDIRS"
@@ -975,7 +1063,7 @@ (define-public chez-srfi
            #:test-target "test"
            #:phases #~(modify-phases %standard-phases
                         (replace 'configure
-                          #$chez-configure))))
+                          #$configure-chezschemelibdirs))))
     (home-page "https://github.com/fedeinthemix/chez-srfi")
     (synopsis "SRFI libraries for Chez Scheme")
     (description
@@ -1159,7 +1247,7 @@ (define-public chez-matchable
            #:test-target "test"
            #:phases #~(modify-phases %standard-phases
                         (replace 'configure
-                          #$chez-configure))))
+                          #$configure-chezschemelibdirs))))
     (synopsis "Portable hygienic pattern matcher for Scheme")
     (description "This package provides a superset of the popular Scheme
 @code{match} package by Andrew Wright, written in fully portable
@@ -1191,7 +1279,7 @@ (define-public chez-irregex
            #:test-target "test"
            #:phases #~(modify-phases %standard-phases
                         (replace 'configure
-                          #$chez-configure))))
+                          #$configure-chezschemelibdirs))))
     (home-page "https://github.com/fedeinthemix/chez-irregex")
     (synopsis "Portable regular expression library for Scheme")
     (description "This package provides a portable and efficient
@@ -1223,7 +1311,7 @@ (define-public chez-fmt
            #:phases
            #~(modify-phases %standard-phases
                (replace 'configure
-                 #$chez-configure)
+                 #$configure-chezschemelibdirs)
                (replace 'build
                  (lambda* (#:key (make-flags '()) #:allow-other-keys)
                    (apply invoke "make" "chez-build" make-flags)))
@@ -1285,7 +1373,7 @@ (define-public chez-mit
            #:test-target "test"
            #:phases #~(modify-phases %standard-phases
                         (replace 'configure
-                          #$chez-configure))))
+                          #$configure-chezschemelibdirs))))
     (synopsis "MIT/GNU Scheme compatibility library for Chez Scheme")
     (description "This package provides a set of MIT/GNU Scheme compatibility
 libraries for Chez Scheme.  The main goal was to provide the functionality
@@ -1320,7 +1408,7 @@ (define-public chez-scmutils
       #:phases
       #~(modify-phases %standard-phases
           (replace 'configure
-            #$chez-configure)
+            #$configure-chezschemelibdirs)
           ;; Since the documentation is lacking, we install the source
           ;; code.  For things to work correctly we have to replace
           ;; relative paths by absolute ones in 'include' forms.  This
diff --git a/gnu/packages/patches/racket-backport-8.11-layered-docs.patch b/gnu/packages/patches/racket-backport-8.11-layered-docs.patch
deleted file mode 100644
index 07f105bb24..0000000000
--- a/gnu/packages/patches/racket-backport-8.11-layered-docs.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 1d8dbdf408db9e99f1382323477561d5148cd451 Mon Sep 17 00:00:00 2001
-From: Philip McGrath <philip@philipmcgrath.com>
-Date: Fri, 20 Oct 2023 17:19:50 -0400
-Subject: [PATCH] racket-index: fix release.scrbl for layered installations
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Configure the release notes page to be rendered separately at every
-installation layer. Otherwise, rendering documentation for packages
-installed in a new layer might try to write to `release/in.sxref`
-in the parent layer’s docs directory.
-
-Related to https://github.com/videolang/video/issues/67
-Related to https://issues.guix.gnu.org/56534
-
-(cherry picked from commit 85f21854c0a41564b755fbe180fe6b85de6c4730)
----
- pkgs/racket-index/scribblings/main/info.rkt | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/pkgs/racket-index/scribblings/main/info.rkt b/pkgs/racket-index/scribblings/main/info.rkt
-index 75c507848a..a6a3798f7c 100644
---- a/pkgs/racket-index/scribblings/main/info.rkt
-+++ b/pkgs/racket-index/scribblings/main/info.rkt
-@@ -6,4 +6,4 @@
-     ("local-redirect.scrbl" (depends-all-main no-depend-on every-main-layer) (omit) "local-redirect" 1 10)
-     ("license.scrbl" () (omit))
-     ("acks.scrbl"    () (omit))
--    ("release.scrbl" (depends-all-main no-depend-on) (omit))))
-+    ("release.scrbl" (depends-all-main no-depend-on every-main-layer) (omit))))
-
-base-commit: c3a502c0ae9f4d615bfd85fc7d88b781826bbb09
--- 
-2.41.0
-
diff --git a/gnu/packages/patches/racket-backport-8.12-chez-configure.patch b/gnu/packages/patches/racket-backport-8.12-chez-configure.patch
new file mode 100644
index 0000000000..483948fec9
--- /dev/null
+++ b/gnu/packages/patches/racket-backport-8.12-chez-configure.patch
@@ -0,0 +1,423 @@
+From 82157f5b3fb9f71ad7fc978c428d423d06a4a0df Mon Sep 17 00:00:00 2001
+From: Philip McGrath <philip@philipmcgrath.com>
+Date: Wed, 28 Feb 2024 19:41:22 -0500
+Subject: [PATCH 1/2] Chez Scheme: Repairs and improvements for building with
+ external dependencies
+
+* configure: support `ZUO=<zuo>`
+
+Supplying `ZUO=<zuo>` skips the submodule check in `configure`
+and configures the generated makefile not to build or remove Zuo.
+
+* configure: support `STEXLIB=<stex>`
+
+For compatibility with older scripts, when not explicitly configured,
+continue to honor the `STEXLIB` environment variable at build time.
+
+(cherry picked from commit 694fbd47a125c7fde10a328c6fda199dac19f802)
+---
+ racket/src/ChezScheme/BUILDING              |  5 ++--
+ racket/src/ChezScheme/build.zuo             | 13 +++++++---
+ racket/src/ChezScheme/configure             | 27 ++++++++++++++++++++-
+ racket/src/ChezScheme/makefiles/Makefile.in |  6 ++---
+ 4 files changed, 40 insertions(+), 11 deletions(-)
+
+diff --git a/racket/src/ChezScheme/BUILDING b/racket/src/ChezScheme/BUILDING
+index 50fde27771..2df29b5bd8 100644
+--- a/racket/src/ChezScheme/BUILDING
++++ b/racket/src/ChezScheme/BUILDING
+@@ -155,7 +155,8 @@ information on the supported options.
+ The generated makefile mostly just ensures that a `zuo` executable is
+ built in a `bin` directory, and then it defers the actual build work
+ to `zuo`, which uses the "main.zuo" file. If you have `zuo` installed,
+-you can use `zuo` directly instead of `make`. In general, instead of
++you can use `zuo` directly instead of `make`: in that case, you may
++wish to use `./configure ZUO=<zuo>`. In general, instead of
+ the command `make X` to build target `X` as described below, you can
+ use `zuo . X` (or `bin/zuo . X` after `bin/zuo` is built).
+ 
+@@ -339,7 +340,7 @@ The makefile supports several targets:
+  * `make clean`
+ 
+    Removes all built elements from the workarea, and then removes
+-   `bin/zuo`.
++   `bin/zuo` (unless configured with `ZUO=<zuo>`).
+ 
+ 
+ WINDOWS VIA COMMAND PROMPT
+diff --git a/racket/src/ChezScheme/build.zuo b/racket/src/ChezScheme/build.zuo
+index a211632a89..432cc6e5a1 100644
+--- a/racket/src/ChezScheme/build.zuo
++++ b/racket/src/ChezScheme/build.zuo
+@@ -218,10 +218,15 @@
+            token))
+ 
+   (define stexlib
+-    (let ((found (assoc "STEXLIB" (hash-ref (runtime-env) 'env))))
+-      (if found
+-          (cdr found)
+-          (at-source "stex"))))
++    (let ([configured (hash-ref config 'STEXLIB "")]
++          [env (assoc "STEXLIB" (hash-ref (runtime-env) 'env))])
++      (cond
++        [(not (equal? "" configured))
++         configured]
++        [env
++         (cdr env)]
++        [else
++         (at-source "stex")])))
+   (define stex-sources
+     (source-tree stexlib))
+ 
+diff --git a/racket/src/ChezScheme/configure b/racket/src/ChezScheme/configure
+index 721d1d1335..f88c6f7625 100755
+--- a/racket/src/ChezScheme/configure
++++ b/racket/src/ChezScheme/configure
+@@ -93,6 +93,7 @@ default_warning_flags="-Wpointer-arith -Wall -Wextra -Wno-implicit-fallthrough"
+ CFLAGS_ADD=
+ zlibLib=
+ LZ4Lib=
++STEXLIB=
+ Kernel=KernelLib
+ buildKernelOnly=no
+ enableFrompb=yes
+@@ -102,6 +103,7 @@ empetite=no
+ moreBootFiles=
+ preloadBootFiles=
+ alwaysUseBootFile=
++zuoExternal=
+ 
+ CONFIG_UNAME=`uname`
+ 
+@@ -442,6 +444,12 @@ while [ $# != 0 ] ; do
+     LZ4=*)
+       LZ4Lib=`echo $1 | sed -e 's/^LZ4=//'`
+       ;;
++    STEXLIB=*)
++      STEXLIB=`echo $1 | sed -e 's/^STEXLIB=//'`
++      ;;
++    ZUO=*)
++      zuoExternal=`echo $1 | sed -e 's/^ZUO=//'`
++      ;;
+     *)
+       echo "option '$1' unrecognized or missing an argument; try $0 --help"
+       exit 1
+@@ -667,6 +675,8 @@ if [ "$help" = "yes" ]; then
+   echo "  STRIP=<strip>                     executable stripper"
+   echo "  ZLIB=<lib>                        link to <lib> instead of own zlib"
+   echo "  LZ4=<lib>                         link to <lib> instead of own LZ4"
++  echo "  STEXLIB=<stex>                    build docs with <stex> instead of own stex"
++  echo "  ZUO=<zuo>                         build with <zuo> instead of own Zuo"
+   echo ""
+   echo "Available machine types: $machs"
+   echo ""
+@@ -869,6 +879,16 @@ if [ "$addflags" = "yes" ] ; then
+   fi
+ fi
+ 
++if [ "${zuoExternal}" = "" ] ; then
++    ZUO="bin/zuo"
++    RM_ZUO="rm -f bin/zuo"
++    ZUO_TARGET="bin/zuo"
++else
++    ZUO="${zuoExternal}"
++    RM_ZUO="@echo 'Not cleaning external ${zuoExternal}'"
++    ZUO_TARGET="DoNotBuildZuo"
++fi
++
+ # more compile and link flags for c/Mf-unix and mats/Mf-unix
+ mdinclude=
+ mdcppflags=
+@@ -1039,7 +1059,7 @@ cp "$srcdir"/makefiles/buildmain.zuo main.zuo
+ # Some idea, but in the workarea, so it refers to "workarea.zuo" here:
+ cp "$srcdir"/makefiles/workmain.zuo $w/main.zuo
+ 
+-# The content of "$w/Makefile" records configuration decisions,
++# The content of "$w/Mf-config" records configuration decisions,
+ # and the Zuo build script takes it from there
+ cat > $w/Mf-config << END
+ srcdir=$srcdir
+@@ -1075,6 +1095,7 @@ cursesLib=$cursesLib
+ ncursesLib=$ncursesLib
+ zlibLib=$zlibLib
+ LZ4Lib=$LZ4Lib
++STEXLIB=$STEXLIB
+ warningFlags=$warningFlags
+ Kernel=$Kernel
+ installscriptname=$installscriptname
+@@ -1086,6 +1107,10 @@ preloadBootFiles=$preloadBootFiles
+ alwaysUseBootFile=$alwaysUseBootFile
+ relativeBootFiles=$relativeBootFiles
+ 
++ZUO=$ZUO
++RM_ZUO=$RM_ZUO
++ZUO_TARGET=$ZUO_TARGET
++
+ InstallBin=$installbin
+ InstallLib=$installlib
+ InstallMan=$installman/man1
+diff --git a/racket/src/ChezScheme/makefiles/Makefile.in b/racket/src/ChezScheme/makefiles/Makefile.in
+index cfdd0230a3..4865bf2e2f 100644
+--- a/racket/src/ChezScheme/makefiles/Makefile.in
++++ b/racket/src/ChezScheme/makefiles/Makefile.in
+@@ -3,8 +3,6 @@ workarea=$(w)
+ 
+ include $(workarea)/Mf-config
+ 
+-ZUO=bin/zuo
+-
+ .PHONY: build
+ build: $(ZUO)
+ 	+ $(ZUO) $(workarea) MAKE="$(MAKE)"
+@@ -140,9 +138,9 @@ pkg: $(ZUO)
+ .PHONY: clean
+ clean: $(ZUO)
+ 	+ $(ZUO) $(workarea) clean MAKE="$(MAKE)"
+-	rm -f bin/zuo
++	$(RM_ZUO)
+ 
+ # Using `+` here means that $(ZUO) gets built even if `-n`/`--dry-run` is provided to `make`
+-$(ZUO): $(srcdir)/../zuo/zuo.c
++$(ZUO_TARGET): $(srcdir)/../zuo/zuo.c
+ 	+ mkdir -p bin
+ 	+ $(CC_FOR_BUILD) -DZUO_LIB_PATH='"'"$(upsrcdir)/../zuo/lib"'"' -o $(ZUO) $(srcdir)/../zuo/zuo.c
+
+base-commit: 78fef00d4d16a79fdf6ab31924b3a80cadf4b368
+-- 
+2.41.0
+
+
+From e2bc69c5ce7437dd9a1b30ac1b12b3a56872c491 Mon Sep 17 00:00:00 2001
+From: Matthew Flatt <mflatt@racket-lang.org>
+Date: Sun, 10 Mar 2024 09:13:40 -0600
+Subject: [PATCH 2/2] Chez Scheme: adjust `configure ZUO=<command>` support
+
+Continuing from 694fbd47a1, adjust the generated makefile so the
+supplied `<command>` is not a makefile dependency. That way, `ZUO=zuo`
+works if `zuo` is installed and the current build directory is not the
+source directory. (The `zuo` executable is a dependency in a real and
+relevant sense, but not in the sense of dependencies that we normally
+track in makefiles.)
+
+Also adapt the makefile for the case that `ZUO=...` is not supplied
+and the build directory is not the source directory, in which case
+`ZUO_LIB_PATH` needs to be relative to the source directory.
+
+Using `make ZUO=zuo` can also work, but in that case, `bin/zuo` is
+still built as a dependency. It's possible that some portable makefile
+magic could overcome that limitation, but it doesn't seem important.
+
+(cherry picked from commit 28157ba88d48fe645563f46f6c00d6626b3428fa)
+---
+ racket/src/ChezScheme/configure             |  3 +
+ racket/src/ChezScheme/makefiles/Makefile.in | 70 +++++++++++----------
+ 2 files changed, 40 insertions(+), 33 deletions(-)
+
+diff --git a/racket/src/ChezScheme/configure b/racket/src/ChezScheme/configure
+index f88c6f7625..201dbe580f 100755
+--- a/racket/src/ChezScheme/configure
++++ b/racket/src/ChezScheme/configure
+@@ -881,10 +881,12 @@ fi
+ 
+ if [ "${zuoExternal}" = "" ] ; then
+     ZUO="bin/zuo"
++    ZUO_DEP="${ZUO}"
+     RM_ZUO="rm -f bin/zuo"
+     ZUO_TARGET="bin/zuo"
+ else
+     ZUO="${zuoExternal}"
++    ZUO_DEP=""
+     RM_ZUO="@echo 'Not cleaning external ${zuoExternal}'"
+     ZUO_TARGET="DoNotBuildZuo"
+ fi
+@@ -1108,6 +1110,7 @@ alwaysUseBootFile=$alwaysUseBootFile
+ relativeBootFiles=$relativeBootFiles
+ 
+ ZUO=$ZUO
++ZUO_DEP=$ZUO_DEP
+ RM_ZUO=$RM_ZUO
+ ZUO_TARGET=$ZUO_TARGET
+ 
+diff --git a/racket/src/ChezScheme/makefiles/Makefile.in b/racket/src/ChezScheme/makefiles/Makefile.in
+index 4865bf2e2f..5ce237178e 100644
+--- a/racket/src/ChezScheme/makefiles/Makefile.in
++++ b/racket/src/ChezScheme/makefiles/Makefile.in
+@@ -4,51 +4,55 @@ workarea=$(w)
+ include $(workarea)/Mf-config
+ 
+ .PHONY: build
+-build: $(ZUO)
++build: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) MAKE="$(MAKE)"
+ 
+ .PHONY: run
+-run: $(ZUO)
++run: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) run
+ 
+ .PHONY: kernel
+-kernel: $(ZUO)
++kernel: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) kernel MAKE="$(MAKE)"
+ 
+ .PHONY: install
+-install: $(ZUO)
++install: $(ZUO_DEP)
+ 	$(ZUO) $(workarea) install MAKE="$(MAKE)"
+ 
+ .PHONY: uninstall
+-uninstall: $(ZUO)
++uninstall: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) uninstall MAKE="$(MAKE)"
+ 
+-.PHONY: test
+-test: $(ZUO)
+-	+ $(ZUO) $(workarea) test MAKE="$(MAKE)"
++.PHONY: test-one
++test-one: $(ZUO_DEP)
++	+ $(ZUO) $(workarea) test-one MAKE="$(MAKE)"
+ 
+ .PHONY: test-some-fast
+-test-some-fast: $(ZUO)
++test-some-fast: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) test-some-fast MAKE="$(MAKE)"
+ 
+ .PHONY: test-some
+-test-some: $(ZUO)
++test-some: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) test-some MAKE="$(MAKE)"
+ 
++.PHONY: test
++test: $(ZUO_DEP)
++	+ $(ZUO) $(workarea) test MAKE="$(MAKE)"
++
+ .PHONY: test-more
+-test-more: $(ZUO)
++test-more: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) test-more MAKE="$(MAKE)"
+ 
+ .PHONY: coverage
+-coverage: $(ZUO)
++coverage: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) coverage MAKE="$(MAKE)"
+ 
+ .PHONY: bootfiles
+-bootfiles: $(ZUO)
++bootfiles: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) bootfiles MAKE="$(MAKE)"
+ 
+ .PHONY: reset
+-reset: $(ZUO)
++reset: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) reset MAKE="$(MAKE)"
+ 
+ # Supply XM=<machine> to build boot files for <machine>
+@@ -57,86 +61,86 @@ boot:
+ 	+ $(ZUO) $(workarea) boot "$(XM)" MAKE="$(MAKE)"
+ 
+ # `<machine>.boot` as alias for `boot XM=<machine>`
+-%.boot: $(ZUO)
++%.boot: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) boot $* MAKE="$(MAKE)"
+ 
+ .PHONY: auto.boot
+-auto.boot: $(ZUO)
++auto.boot: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) boot MAKE="$(MAKE)"
+ 
+ SCHEME=scheme
+ 
+ .PHONY: cross.boot
+-cross.boot: $(ZUO)
++cross.boot: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) boot SCHEME="$(SCHEME)" MAKE="$(MAKE)"
+ 
+ .PHONY: re.boot
+-re.boot: $(ZUO)
++re.boot: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) reboot SCHEME="$(SCHEME)"
+ 
+ # Supply XM=<machine> 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
+ .PHONY: bootquick
+-bootquick: $(ZUO)
++bootquick: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) bootquick "$(XM)" MAKE="$(MAKE)"
+ 
+ # `<machine>.bootquick` as alias for `boot XM=<machine>`
+-%.bootquick: $(ZUO)
++%.bootquick: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) bootquick $* MAKE="$(MAKE)"
+ 
+-auto.bootquick: $(ZUO)
++auto.bootquick: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) bootquick MAKE="$(MAKE)"
+ 
+ # Supply XM=<machine>-<tag>.bootpbchunk to repackage boot files for
+ # <machine> with pbchunk sources, including additional
+ # boot files
+ .PHONY: bootpbchunk
+-bootpbchunk: $(ZUO)
++bootpbchunk: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) bootpbchunk "$(XM)" $(ARGS) MAKE="$(MAKE)"
+ 
+ # `<machine>.bootpbchunk` as alias for `pbchunk XM=<machine>`
+-%.bootpbchunk: $(ZUO)
++%.bootpbchunk: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) bootpbchunk $* $(ARGS) MAKE="$(MAKE)"
+ 
+ .PHONY: docs
+-docs: build $(ZUO)
++docs: build $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) docs MAKE="$(MAKE)"
+ 
+ .PHONY: csug
+-csug: build $(ZUO)
++csug: build $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) csug MAKE="$(MAKE)"
+ 
+ .PHONY: release_notes
+-release_notes: build $(ZUO)
++release_notes: build $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) release_notes MAKE="$(MAKE)"
+ 
+ .PHONY: install-docs
+-install-docs: build $(ZUO)
++install-docs: build $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) install-docs MAKE="$(MAKE)"
+ 
+ .PHONY: install-csug
+-install-csug: build $(ZUO)
++install-csug: build $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) install-csug MAKE="$(MAKE)"
+ 
+ .PHONY: install-release_notes
+-install-release_notes: build $(ZUO)
++install-release_notes: build $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) install-release_notes MAKE="$(MAKE)"
+ 
+ .PHONY: bintar
+-bintar: $(ZUO)
++bintar: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) bintar MAKE="$(MAKE)"
+ 
+ .PHONY: rpm
+-rpm: $(ZUO)
++rpm: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) rpm MAKE="$(MAKE)"
+ 
+ .PHONY: pkg
+-pkg: $(ZUO)
++pkg: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) pkg MAKE="$(MAKE)"
+ 
+ .PHONY: clean
+-clean: $(ZUO)
++clean: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) clean MAKE="$(MAKE)"
+ 	$(RM_ZUO)
+ 
+-- 
+2.41.0
+
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index 6e19be1da3..d366f89845 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -105,7 +105,9 @@ (define-module (gnu packages racket)
 ;; 'distro-build' package to assemble custom Racket distributions. (Again,
 ;; the makefile just delegates to Zuo.) It is not part of Racket source
 ;; distributions: the root of a source distribution is basically 'racket/src'
-;; with some extra package sources and configuration added.
+;; with some extra package sources and configuration added. In fact, the
+;; top-level 'Makefile' and the 'distro-build' package are what create Racket
+;; source distributions.
 ;;
 ;; A ''minimal Racket'' installation includes two packages: 'base', which is a
 ;; sort of bridge between the current ``built-in'' collections and the package
@@ -191,7 +193,7 @@ (define-module (gnu packages racket)
 ;;
 ;; CODE:
 
-(define %racket-version "8.11.1") ; Remember to update chez-scheme-for-racket!
+(define %racket-version "8.12") ; Remember to update chez-scheme-for-racket!
 (define %racket-commit
   (string-append "v" %racket-version))
 (define %racket-origin
@@ -201,16 +203,16 @@ (define %racket-origin
           (url "https://github.com/racket/racket")
           (commit %racket-commit)))
     (sha256
-     (base32 "1iny1mn1lw07lj6h704ch5g2q1nsf0h88dgwqrlxhf8pwj4i76gl"))
+     (base32 "1f52yadmrsd2ddry47s68kxig185a58n19j23458wkck19nawjz5"))
     (file-name (git-file-name "racket" %racket-version))
     (patches (search-patches "racket-chez-scheme-bin-sh.patch"
-                             "racket-backport-8.11-layered-docs.patch"
+                             "racket-backport-8.12-chez-configure.patch"
                              "racket-rktio-bin-sh.patch"))
     (modules '((guix build utils)))
     (snippet
      #~(begin
          (use-modules (guix build utils))
-         ;; Unbundle Chez submodules.
+         ;; Unbundle Chez submodules and boot files.
          (with-directory-excursion "racket/src/ChezScheme"
            ;; TODO: consider putting this in a (guix ...) or (guix build ...)
            ;; module so it can be shared with the upstream Chez Scheme origin
@@ -218,10 +220,14 @@ (define %racket-origin
            (for-each (lambda (dir)
                        (when (directory-exists? dir)
                          (delete-file-recursively dir)))
-                     '("stex"
-                       "nanopass"
+                     '("boot"
                        "lz4"
-                       "zlib")))
+                       "nanopass"
+                       "stex"
+                       "zlib"
+                       "zuo")))
+         ;; Unbundle Zuo.
+         (delete-file-recursively "racket/src/zuo")
          ;; Unbundle libffi.
          (delete-file-recursively "racket/src/bc/foreign/libffi")))))
 
@@ -445,10 +451,8 @@ (define-public racket-vm-cs
      (substitute-keyword-arguments (package-arguments racket-vm-cgc)
        ((#:phases those-phases #~%standard-phases)
         #~(modify-phases #$those-phases
-            (add-after 'unpack 'unpack-nanopass+stex
-              (lambda args
-                (with-directory-excursion "racket/src/ChezScheme"
-                  #$unpack-nanopass+stex)))))
+            (add-after 'unpack 'unpack-nanopass
+              #$unpack-nanopass)))
        ((#:configure-flags _ '())
         #~(cons* "--enable-csonly"
                  "--enable-libz"
@@ -697,7 +701,7 @@ (define-public racket
        "contract-profile" (base32 "1xm2z8g0dpv5d9h2sg680vx1a8ix9gbsdpxxb8qv1w7akp73paj3")
        '(("contract-profile" ".")))
       (simple-racket-origin
-       "data" (base32 "1pml8g3zgvnaiqb659psh99m70v96m6nh9zash2vfgir46j4rjnh")
+       "data" (base32 "01sinnsnjiazvkj83k84izdnp38pd2aglbrs14mrdkwajgmpampk")
        '("data" "data-doc" "data-enumerate-lib" "data-lib"))
       (simple-racket-origin
        "datalog" (base32 "0nf6cy4djpyhfvgpa6yn72apbz9s83gp0qg95pzjd0az4v6qwq1s")
@@ -706,7 +710,7 @@ (define-public racket
        "db" (base32 "0xx0k8yw2vb9b4vk2dwjfbpixnmriqsv7kpv3fvfxbwyg42y0db5")
        '("db" "db-doc" "db-lib"))
       (simple-racket-origin
-       "deinprogramm" (base32 "0ijngjyg2i528a4xv20db4adirvx5rj4m86fd70l33lgwv53w3s0")
+       "deinprogramm" (base32 "0f41sh90i4mml95x2gcmfvl2rc7m77vjbagmgjx270ng7xvz16lj")
        '("deinprogramm" "deinprogramm-signature"))
       (simple-racket-origin
        "distributed-places" (base32 "1dajpkj9balqcpv6cdk9hwjz592h1vq8rrx5vncariiac4vbdpa0")
@@ -715,7 +719,7 @@ (define-public racket
        "draw" (base32 "1h7mckay8yjcgmj3r0jkf1csn430gn43n8jl1l956q9gcprlmncl")
        '("draw" "draw-doc" "draw-lib"))
       (simple-racket-origin
-       "drracket" (base32 "00ay3pwl648wq8nnaap665c38clr39k0g1wslh2wclar32wjpgdc")
+       "drracket" (base32 "17bdbvsf5l8z96bwzg1q75gg70c6svbhw0g1k239fsjd3mivmki4")
        '("drracket"
          "drracket-plugin-lib"
          "drracket-tool"
@@ -749,13 +753,13 @@ (define-public racket
        "games" (base32 "13z7fnbr48s98lmfxc0nbfhbqkd4hphymy2r63hqm783xzn6ylzi")
        '(("games" ".")))
       (simple-racket-origin
-       "gui" (base32 "10mlajn5xqgdwi7gf9lgszfv609pjp8m24lm97b8xh6fmjlkqi4b")
+       "gui" (base32 "08kzyscqc8hgc1f8q0bhibl44fkq8iiyz12f8bqdhqkcz8nx44sw")
        '("gui" "gui-doc" "gui-lib" "tex-table"))
       (simple-racket-origin
        "gui-pkg-manager" (base32 "1ji9448d723nklqvycwdswj0ni28sabrncag14f9mx47did5myb5")
        '("gui-pkg-manager-lib"))
       (simple-racket-origin
-       "htdp" (base32 "04p2xp4hnnsnmrmvw05fg4fv18k3g2rz5gmgs89sc6g8y886m6zz")
+       "htdp" (base32 "13d8xsvs60d7797w93g14dbdm98bixgy65akayij256pyiwnqwdc")
        '("htdp" "htdp-doc" "htdp-lib"))
       (simple-racket-origin
        "html" (base32 "18n1jnjgzfknc8nv8dppi85nb8q08gqdwkg6hfjk08x0p00anx2x")
@@ -797,7 +801,7 @@ (define-public racket
                              (url "https://github.com/RenaissanceBug/racket-cookies")
                              (commit %racket-commit)))
                        (sha256 (base32
-                                "05lnml9nszcq72k8bi4iwdyplp2iv23ywb2gmrs2hr8837fqi65y"))
+                                "1zr31y1gqa3kkrwlf9bnw08nzij00x1l70qhfbpz0239bksn4mmb"))
                        (file-name
                         (git-file-name "RenaissanceBug-racket-cookies" %racket-version)))
        '("net-cookies" "net-cookies-doc" "net-cookies-lib"))
@@ -823,7 +827,7 @@ (define-public racket
        "pconvert" (base32 "00czi0p399mmyrvxyrs5kniizpkqfxyz2ncxqi2jy79a7wk79pb1")
        '("pconvert-lib"))
       (simple-racket-origin
-       "pict" (base32 "1vsn91r167wssaflzz080nsrcf0jfhl2a48zcj9hvdb77arbj8kc")
+       "pict" (base32 "1ghds5by8i0k2djbig82xqp2ssy3nvdwm45l8ibsr99y0ay6z7gv")
        '("pict" "pict-doc" "pict-lib"))
       (simple-racket-origin
        "pict-snip" (base32 "081nwiy4a0n4f7xws16hqbhf0j3kz5alizndi3nnyr3chm4kng6x")
@@ -838,7 +842,7 @@ (define-public racket
        "planet" (base32 "0r2yqrzrmdjjyr14k6hhlzc5kzrcx3583m1s02mhrcmpfw0s85w9")
        '("planet" "planet-doc" "planet-lib"))
       (simple-racket-origin
-       "plot" (base32 "17fhsymy884xr4jqk585rm5kwdgkgz0635916gh5y0fsnp5pir70")
+       "plot" (base32 "0jq9a366g7b2c9vp6yvpqikvklgyd6p4xj6v224g99yj8cgip40b")
        '("plot" "plot-compat" "plot-doc" "plot-gui-lib" "plot-lib"))
       (simple-racket-origin
        "preprocessor" (base32 "1p5aid58ifnjy4xl0ysh85cq39k25661v975jrpk182z3k5621mg")
@@ -852,11 +856,8 @@ (define-public racket
                        (uri (git-reference
                              (url "https://github.com/Metaxal/quickscript")
                              (commit %racket-commit)))
-                       (snippet
-                        ;; See https://github.com/Metaxal/quickscript/issues/73
-                        #~(delete-file "register.rkt"))
                        (sha256 (base32
-                                "0v27qknghfi0058vk8xwwlwqgqwdsxxmprrmag64cyygdz95sxym"))
+                                "1ahznb9rhgaixd3fqn0pxighw4zbflwqc84r2yvn5nsfbp0mrq9b"))
                        (file-name (git-file-name "Metaxal-quickscript" %racket-version)))
        '(("quickscript" ".")))
       (simple-racket-origin
@@ -880,7 +881,7 @@ (define-public racket
        "racklog" (base32 "0fr8xij0sssfnmwn6dfdi4jj3l62f2yj3jrjljv13kaycrfls032")
        '(("racklog" ".")))
       (simple-racket-origin
-       "rackunit" (base32 "0axcy8283qqmcrhwwn0q0sfjznc8gkwbx06j41anayi5v9xp4698")
+       "rackunit" (base32 "06kpl51alm7akgmmh110ya28zgmx3as0szykfv2gwqmf7xcms1b7")
        '("rackunit"
          "rackunit-doc"
          "rackunit-gui"
@@ -896,7 +897,7 @@ (define-public racket
        "realm" (base32 "0rlvwyd6rpyl0zda4a5p8dp346fvqzc8555dgfnrhliymkxb6x4g")
        '(("realm" ".")))
       (simple-racket-origin
-       "redex" (base32 "016m2fvfxjnx7l0ai6jlcmz4s8xipbq9k58fq7109akj9mvczgp9")
+       "redex" (base32 "1mwnxbfk2vbalndlq0996rzdi3a2z48m5xnb1ywzlsvnydrnkrk2")
        '("redex"
          "redex-benchmark"
          "redex-doc"
@@ -911,7 +912,7 @@ (define-public racket
        "scheme-lib" (base32 "0pcf0y8rp4qyjhaz5ww5sr5diq0wpcdfrrnask7zapyklzx1jx8x")
        '(("scheme-lib" ".")))
       (simple-racket-origin
-       "scribble" (base32 "0igcjgmpzbzzn1jfpa4jq18lqyhr6dsdwnbv6zv87x8cib9rwqrh")
+       "scribble" (base32 "0rk5q9r9fw826ag0npk5cwkzkapj2p243wwm9gn2l7j7cr6z1rvb")
        '("scribble"
          "scribble-doc"
          "scribble-html-lib"
@@ -943,7 +944,7 @@ (define-public racket
        "snip" (base32 "1b90ccqilnyszbphms3svm3c7dbk7870ifybjjipss5srb32mj2d")
        '("snip" "snip-lib"))
       (simple-racket-origin
-       "typed-racket" (base32 "17mz7zqrialxfzkynj7h3kfhawdd6cgs24ns437gz087g2pmwi1x")
+       "typed-racket" (base32 "0vdsyr0qhpvac6h8mfdy6vqrsqsfa7kpg39n3h637hccxyfxv63f")
        '("source-syntax"
          "typed-racket"
          "typed-racket-compatibility"
@@ -954,7 +955,7 @@ (define-public racket
        "srfi" (base32 "1l3nr3a8mlp505aaxlyp4i8jfijmpyl9h1wwv8hzm4kzzjv4sl8p")
        '("srfi" "srfi-doc" "srfi-lib" "srfi-lite-lib"))
       (simple-racket-origin
-       "string-constants" (base32 "1djbjhsimikk18dkrajrlgjhlqfyvna4nz64ha4wjcaj5cfgcvdx")
+       "string-constants" (base32 "0225f1wmq1n9f2x1pg50fssdnd4bpc11q1jgsykwf4ik4fnaa520")
        '("string-constants" "string-constants-doc" "string-constants-lib"))
       (simple-racket-origin
        "swindle" (base32 "1q8vdxpzczzwdw2mys2caab45yvadmqkixsr29k8pl03n8dsg8j9")
@@ -969,7 +970,7 @@ (define-public racket
        "unix-socket" (base32 "02dfwas5ynbpyz74w9kwb4wgb37y5wys7svrlmir8k0n9ph9vq0y")
        '("unix-socket" "unix-socket-doc" "unix-socket-lib"))
       (simple-racket-origin
-       "web-server" (base32 "0vhw1hwdcv1ham086dy0nkl4r0a5qvsimw8048zjakvax7q4shsg")
+       "web-server" (base32 "1i4sxmcgj00ml7czsbyx1433hgf091n1p54xyal2f1fsskx5fg0y")
        '("web-server" "web-server-doc" "web-server-lib"))
       (simple-racket-origin
        "wxme" (base32 "1qp5gr9gqsakiq3alw6m4yyv5vw4i3hp4y4nhq8vl2nkjmirvn0b")
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH v2 3/8] gnu: chez-scheme: Reorganize package definitions.
  2024-04-01  6:51         ` [bug#70065] [PATCH v2 0/8] Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9 Philip McGrath
  2024-04-01  6:51           ` [bug#70065] [PATCH v2 1/8] gnu: zuo: Update to 1.9 Philip McGrath
  2024-04-01  6:51           ` [bug#70065] [PATCH v2 2/8] gnu: racket: Update to 8.12 Philip McGrath
@ 2024-04-01  6:51           ` Philip McGrath
  2024-04-01 15:40             ` Liliana Marie Prikler
  2024-04-01  6:51           ` [bug#70065] [PATCH v2 4/8] gnu: chez-scheme: Update to 10.0.0 Philip McGrath
                             ` (5 subsequent siblings)
  8 siblings, 1 reply; 39+ messages in thread
From: Philip McGrath @ 2024-04-01  6:51 UTC (permalink / raw)
  To: 70065
  Cc: Katherine Cox-Buday, Liliana Marie Prikler, Andrew Tropin,
	Philip McGrath, Skyler Ferris, Philip McGrath

A future commit will change 'chez-scheme' to inherit from
'chez-scheme-for-racket', so 'chez-scheme-for-racket' will need to be
defined before 'chez-scheme'.  In an attempt to produce better diffs,
this commit re-orders the definitions while keeping their contents
exactly the same.

* gnu/packages/chez.scm (chez-scheme): Move below
'chez-scheme-for-racket'.
(chez-scheme-bootstrap-bootfiles): Move below
'chez-scheme-for-racket-bootstrap-bootfiles'.

Change-Id: Ie088abea2b44329f9d8399fbfb95c51d8912b05e
---
 gnu/packages/chez.scm | 426 +++++++++++++++++++++---------------------
 1 file changed, 213 insertions(+), 213 deletions(-)

diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index f651cdce0c..19520cdf4a 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -282,191 +282,6 @@ (define unpack-nanopass
                                              "lib/chez-scheme/nanopass.ss"))
                  "nanopass"))))
 
-(define-public chez-scheme
-  (package
-    (name "chez-scheme")
-    ;; The version should match `(scheme-version-number)`.
-    ;; See s/cmacros.ss c. line 360.
-    (version "9.5.8")
-    (source (origin
-              (method git-fetch)
-              (uri (git-reference
-                    (url "https://github.com/cisco/ChezScheme")
-                    (commit (string-append "v" version))))
-              (sha256
-               (base32
-                "0xchqq8cm0ka5wgpn18sjs0hh15rc3nb7xrjqbbc9al3asq0d7gc"))
-              (file-name (git-file-name name version))
-              (patches (search-patches "chez-scheme-bin-sh.patch"))
-              (snippet #~(begin
-                           (use-modules (guix build utils))
-                           ;; TODO: consider putting this in a (guix ...) or
-                           ;; (guix build ...)  module so it can be shared
-                           ;; with the Racket origin without cyclic issues.
-                           (for-each (lambda (dir)
-                                       (when (directory-exists? dir)
-                                         (delete-file-recursively dir)))
-                                     '("stex"
-                                       "nanopass"
-                                       "lz4"
-                                       "zlib"))))))
-    (build-system gnu-build-system)
-    (inputs
-     (list
-      chez-scheme-bootstrap-bootfiles
-      `(,util-linux "lib") ;<-- libuuid
-      zlib
-      lz4
-      ncurses ;<-- for expeditor
-      ;; for X11 clipboard support in expeditor:
-      ;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
-      libx11))
-    (native-inputs (list chez-nanopass-bootstrap
-                         stex-bootstrap))
-    (native-search-paths
-     (list (search-path-specification
-            (variable "CHEZSCHEMELIBDIRS")
-            (files '("lib/chez-scheme")))))
-    (outputs '("out" "doc"))
-    (arguments
-     (list
-      #:modules
-      '((guix build gnu-build-system)
-        (guix build utils)
-        (ice-9 ftw)
-        (ice-9 match))
-      #:test-target "test"
-      #: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
-            (lambda args
-              (begin
-                (copy-recursively
-                 (dirname (search-input-file %build-inputs
-                                             "lib/chez-scheme/nanopass.ss"))
-                 "nanopass"
-                 #:keep-mtime? #t)
-                (mkdir-p "stex")
-                (with-output-to-file "stex/Mf-stex"
-                  (lambda ()
-                    ;; otherwise, it will try to download submodules
-                    (display "# to placate ../configure"))))))
-          (add-after 'unpack-nanopass+stex 'unpack-bootfiles
-            (lambda* (#:key native-inputs inputs #:allow-other-keys)
-              (when (directory-exists? "boot")
-                (delete-file-recursively "boot"))
-              (copy-recursively
-               (search-input-directory inputs
-                                       "lib/chez-scheme-bootfiles")
-               "boot")))
-          ;; NOTE: The custom Chez 'configure' script doesn't allow
-          ;; unrecognized flags, such as those automatically added
-          ;; by `gnu-build-system`. This replacement phase uses only
-          ;; the explicitly provided `#:configure-flags`.
-          (replace 'configure
-            (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.
-          (add-after 'install 'install-symlink
-            (lambda* (#:key outputs #:allow-other-keys)
-              (let* ((scheme (search-input-file outputs "/bin/scheme"))
-                     (bin-dir (dirname scheme)))
-                (symlink scheme
-                         (string-append bin-dir "/chez-scheme"))
-                (match (find-files (string-append bin-dir "/../lib")
-                                   "scheme.boot")
-                  ((scheme.boot)
-                   (symlink scheme.boot
-                            (string-append (dirname scheme.boot)
-                                           "/chez-scheme.boot")))))))
-          ;; Building the documentation requires stex and a running scheme.
-          (add-after 'install-symlink 'install-docs
-            (lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
-              (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")))))))))
-    (supported-systems
-     (delete
-      "armhf-linux" ;; XXX reportedly broken, needs checking
-      (filter chez-upstream-features-for-system
-              %supported-systems)))
-    (home-page "https://cisco.github.io/ChezScheme/")
-    (synopsis "R6RS Scheme compiler and run-time")
-    (description
-     "Chez Scheme is a compiler and run-time system for the language of the
-Revised^6 Report on Scheme (R6RS), with numerous extensions.  The compiler
-generates native code for each target processor, with support for x86, x86_64,
-and 32-bit PowerPC architectures.")
-    (license asl2.0)))
-
 (define chez-configure
   ;; The custom Chez 'configure' script doesn't allow unrecognized flags, such
   ;; as those automatically added by `gnu-build-system`. This replacement
@@ -689,39 +504,194 @@ (define-public chez-scheme-for-racket
 version of Chez Scheme.")
     (license asl2.0)))
 
-;;
-;; Bootfiles:
-;;
-
-(define-public chez-scheme-bootstrap-bootfiles
+(define-public chez-scheme
   (package
-    (inherit chez-scheme)
-    (name "chez-scheme-bootstrap-bootfiles")
-    (inputs '())
-    (native-inputs '())
-    (outputs '("out"))
-    (build-system copy-build-system)
-    ;; TODO: cross compilation
+    (name "chez-scheme")
+    ;; The version should match `(scheme-version-number)`.
+    ;; See s/cmacros.ss c. line 360.
+    (version "9.5.8")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/cisco/ChezScheme")
+                    (commit (string-append "v" version))))
+              (sha256
+               (base32
+                "0xchqq8cm0ka5wgpn18sjs0hh15rc3nb7xrjqbbc9al3asq0d7gc"))
+              (file-name (git-file-name name version))
+              (patches (search-patches "chez-scheme-bin-sh.patch"))
+              (snippet #~(begin
+                           (use-modules (guix build utils))
+                           ;; TODO: consider putting this in a (guix ...) or
+                           ;; (guix build ...)  module so it can be shared
+                           ;; with the Racket origin without cyclic issues.
+                           (for-each (lambda (dir)
+                                       (when (directory-exists? dir)
+                                         (delete-file-recursively dir)))
+                                     '("stex"
+                                       "nanopass"
+                                       "lz4"
+                                       "zlib"))))))
+    (build-system gnu-build-system)
+    (inputs
+     (list
+      chez-scheme-bootstrap-bootfiles
+      `(,util-linux "lib") ;<-- libuuid
+      zlib
+      lz4
+      ncurses ;<-- for expeditor
+      ;; for X11 clipboard support in expeditor:
+      ;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
+      libx11))
+    (native-inputs (list chez-nanopass-bootstrap
+                         stex-bootstrap))
+    (native-search-paths
+     (list (search-path-specification
+            (variable "CHEZSCHEMELIBDIRS")
+            (files '("lib/chez-scheme")))))
+    (outputs '("out" "doc"))
     (arguments
-     (list #:install-plan
-           #~`(("boot/" "lib/chez-scheme-bootfiles"))))
+     (list
+      #:modules
+      '((guix build gnu-build-system)
+        (guix build utils)
+        (ice-9 ftw)
+        (ice-9 match))
+      #:test-target "test"
+      #: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
+            (lambda args
+              (begin
+                (copy-recursively
+                 (dirname (search-input-file %build-inputs
+                                             "lib/chez-scheme/nanopass.ss"))
+                 "nanopass"
+                 #:keep-mtime? #t)
+                (mkdir-p "stex")
+                (with-output-to-file "stex/Mf-stex"
+                  (lambda ()
+                    ;; otherwise, it will try to download submodules
+                    (display "# to placate ../configure"))))))
+          (add-after 'unpack-nanopass+stex 'unpack-bootfiles
+            (lambda* (#:key native-inputs inputs #:allow-other-keys)
+              (when (directory-exists? "boot")
+                (delete-file-recursively "boot"))
+              (copy-recursively
+               (search-input-directory inputs
+                                       "lib/chez-scheme-bootfiles")
+               "boot")))
+          ;; NOTE: The custom Chez 'configure' script doesn't allow
+          ;; unrecognized flags, such as those automatically added
+          ;; by `gnu-build-system`. This replacement phase uses only
+          ;; the explicitly provided `#:configure-flags`.
+          (replace 'configure
+            (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.
+          (add-after 'install 'install-symlink
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let* ((scheme (search-input-file outputs "/bin/scheme"))
+                     (bin-dir (dirname scheme)))
+                (symlink scheme
+                         (string-append bin-dir "/chez-scheme"))
+                (match (find-files (string-append bin-dir "/../lib")
+                                   "scheme.boot")
+                  ((scheme.boot)
+                   (symlink scheme.boot
+                            (string-append (dirname scheme.boot)
+                                           "/chez-scheme.boot")))))))
+          ;; Building the documentation requires stex and a running scheme.
+          (add-after 'install-symlink 'install-docs
+            (lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
+              (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")))))))))
     (supported-systems
-     (filter (lambda (system)
-               (and=> (chez-upstream-features-for-system system)
-                      (cut memq 'bootstrap-bootfiles <>)))
-             %supported-systems))
-    (synopsis "Chez Scheme bootfiles (binary seed)")
+     (delete
+      "armhf-linux" ;; XXX reportedly broken, needs checking
+      (filter chez-upstream-features-for-system
+              %supported-systems)))
+    (home-page "https://cisco.github.io/ChezScheme/")
+    (synopsis "R6RS Scheme compiler and run-time")
     (description
-     "Chez Scheme is a self-hosting compiler: building it requires
-``bootfiles'' containing the Scheme-implemented portions compiled for the
-current platform.  (Chez can then cross-compile bootfiles for all other
-supported platforms.)
+     "Chez Scheme is a compiler and run-time system for the language of the
+Revised^6 Report on Scheme (R6RS), with numerous extensions.  The compiler
+generates native code for each target processor, with support for x86, x86_64,
+and 32-bit PowerPC architectures.")
+    (license asl2.0)))
 
-This package provides bootstrap bootfiles for upstream Chez Scheme.
-Currently, it simply packages the binaries checked in to the upstream
-repository.  Hopefully we can eventually adapt Racket's @code{cs-bootstrap} to
-work with upstream Chez Scheme so that we can bootstrap these files from
-source.")))
+;;
+;; Bootfiles:
+;;
 
 (define-public chez-scheme-for-racket-bootstrap-bootfiles
   (package
@@ -803,6 +773,36 @@ (define-public chez-scheme-for-racket-bootstrap-bootfiles
 7.1 and later, including the Racket BC variant.")
     (license asl2.0)))
 
+(define-public chez-scheme-bootstrap-bootfiles
+  (package
+    (inherit chez-scheme)
+    (name "chez-scheme-bootstrap-bootfiles")
+    (inputs '())
+    (native-inputs '())
+    (outputs '("out"))
+    (build-system copy-build-system)
+    ;; TODO: cross compilation
+    (arguments
+     (list #:install-plan
+           #~`(("boot/" "lib/chez-scheme-bootfiles"))))
+    (supported-systems
+     (filter (lambda (system)
+               (and=> (chez-upstream-features-for-system system)
+                      (cut memq 'bootstrap-bootfiles <>)))
+             %supported-systems))
+    (synopsis "Chez Scheme bootfiles (binary seed)")
+    (description
+     "Chez Scheme is a self-hosting compiler: building it requires
+``bootfiles'' containing the Scheme-implemented portions compiled for the
+current platform.  (Chez can then cross-compile bootfiles for all other
+supported platforms.)
+
+This package provides bootstrap bootfiles for upstream Chez Scheme.
+Currently, it simply packages the binaries checked in to the upstream
+repository.  Hopefully we can eventually adapt Racket's @code{cs-bootstrap} to
+work with upstream Chez Scheme so that we can bootstrap these files from
+source.")))
+
 ;;
 ;; Chez's bootstrap dependencies:
 ;;
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH v2 4/8] gnu: chez-scheme: Update to 10.0.0.
  2024-04-01  6:51         ` [bug#70065] [PATCH v2 0/8] Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9 Philip McGrath
                             ` (2 preceding siblings ...)
  2024-04-01  6:51           ` [bug#70065] [PATCH v2 3/8] gnu: chez-scheme: Reorganize package definitions Philip McGrath
@ 2024-04-01  6:51           ` Philip McGrath
  2024-04-01  6:51           ` [bug#70065] [PATCH v2 5/8] gnu: Deprecate chez-scheme-for-system.in favor of chez-scheme Philip McGrath
                             ` (4 subsequent siblings)
  8 siblings, 0 replies; 39+ messages in thread
From: Philip McGrath @ 2024-04-01  6:51 UTC (permalink / raw)
  To: 70065
  Cc: Katherine Cox-Buday, Liliana Marie Prikler, Andrew Tropin,
	Philip McGrath, Skyler Ferris, Philip McGrath

* gnu/packages/patches/chez-scheme-bin-sh.patch: Refresh patch.
* gnu/packages/patches/chez-scheme-backport-configure.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/chez.scm (chez-scheme): Update to 10.0.0.  Inherit from
'chez-scheme-for-racket'.
[source]<patches>: Use "chez-scheme-backport-configure.patch".
<snippet>: Also unbundle Zuo.
[native-inputs, native-search-paths, outputs, arguments]
[supported-systems]: Inherit from 'chez-scheme-for-racket'.
[inputs]: Likewise, replacing the bootfile package and adding libx11.
[description]: Update based on the User's Guide, release notes, man
page, and README file.
(chez-scheme-bootstrap-bootfiles)[supported-systems]: All systems are
now supported.
(chez-scheme-for-system): Return 'chez-scheme', since it now supports
all systems.

Change-Id: I287ff66f385f20e69c1411abcc94f19dd45870c5
---
 gnu/local.mk                                  |   1 +
 gnu/packages/chez.scm                         | 204 +-------
 .../chez-scheme-backport-configure.patch      | 463 ++++++++++++++++++
 gnu/packages/patches/chez-scheme-bin-sh.patch |  37 +-
 4 files changed, 512 insertions(+), 193 deletions(-)
 create mode 100644 gnu/packages/patches/chez-scheme-backport-configure.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index a10aa2cefd..b5f922b538 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1017,6 +1017,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/ccextractor-add-missing-header.patch	\
   %D%/packages/patches/ccextractor-autoconf-tesseract.patch	\
   %D%/packages/patches/ccextractor-fix-ocr.patch		\
+  %D%/packages/patches/chez-scheme-backport-configure.patch	\
   %D%/packages/patches/chez-scheme-bin-sh.patch			\
   %D%/packages/patches/circos-remove-findbin.patch		\
   %D%/packages/patches/cdparanoia-fpic.patch			\
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 19520cdf4a..5b98b3ce1f 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -69,21 +69,9 @@ (define-module (gnu packages chez)
 ;; Code:
 
 (define* (chez-scheme-for-system #:optional
-                                 (system (or (%current-target-system)
-                                             (%current-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))
+                                 system)
+  "Returns 'chez-scheme'."
+  chez-scheme)
 
 (define* (target-chez-arch #:optional (system
                                        (or (%current-target-system)
@@ -506,10 +494,11 @@ (define-public chez-scheme-for-racket
 
 (define-public chez-scheme
   (package
+    (inherit chez-scheme-for-racket)
     (name "chez-scheme")
-    ;; The version should match `(scheme-version-number)`.
+    ;; The version should match `(scheme-version-number #t)`.
     ;; See s/cmacros.ss c. line 360.
-    (version "9.5.8")
+    (version "10.0.0")
     (source (origin
               (method git-fetch)
               (uri (git-reference
@@ -517,9 +506,10 @@ (define-public chez-scheme
                     (commit (string-append "v" version))))
               (sha256
                (base32
-                "0xchqq8cm0ka5wgpn18sjs0hh15rc3nb7xrjqbbc9al3asq0d7gc"))
+                "1q66vafhiwk617z51qkm1v64r3bxqhhf5lzrmsa4l9d5yhvlyk09"))
               (file-name (git-file-name name version))
-              (patches (search-patches "chez-scheme-bin-sh.patch"))
+              (patches (search-patches "chez-scheme-backport-configure.patch"
+                                       "chez-scheme-bin-sh.patch"))
               (snippet #~(begin
                            (use-modules (guix build utils))
                            ;; TODO: consider putting this in a (guix ...) or
@@ -528,165 +518,30 @@ (define-public chez-scheme
                            (for-each (lambda (dir)
                                        (when (directory-exists? dir)
                                          (delete-file-recursively dir)))
-                                     '("stex"
+                                     '("lz4"
                                        "nanopass"
-                                       "lz4"
-                                       "zlib"))))))
+                                       "stex"
+                                       "zlib"
+                                       "zuo"))))))
     (build-system gnu-build-system)
     (inputs
-     (list
-      chez-scheme-bootstrap-bootfiles
-      `(,util-linux "lib") ;<-- libuuid
-      zlib
-      lz4
-      ncurses ;<-- for expeditor
-      ;; for X11 clipboard support in expeditor:
-      ;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
-      libx11))
-    (native-inputs (list chez-nanopass-bootstrap
-                         stex-bootstrap))
-    (native-search-paths
-     (list (search-path-specification
-            (variable "CHEZSCHEMELIBDIRS")
-            (files '("lib/chez-scheme")))))
-    (outputs '("out" "doc"))
-    (arguments
-     (list
-      #:modules
-      '((guix build gnu-build-system)
-        (guix build utils)
-        (ice-9 ftw)
-        (ice-9 match))
-      #:test-target "test"
-      #: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
-            (lambda args
-              (begin
-                (copy-recursively
-                 (dirname (search-input-file %build-inputs
-                                             "lib/chez-scheme/nanopass.ss"))
-                 "nanopass"
-                 #:keep-mtime? #t)
-                (mkdir-p "stex")
-                (with-output-to-file "stex/Mf-stex"
-                  (lambda ()
-                    ;; otherwise, it will try to download submodules
-                    (display "# to placate ../configure"))))))
-          (add-after 'unpack-nanopass+stex 'unpack-bootfiles
-            (lambda* (#:key native-inputs inputs #:allow-other-keys)
-              (when (directory-exists? "boot")
-                (delete-file-recursively "boot"))
-              (copy-recursively
-               (search-input-directory inputs
-                                       "lib/chez-scheme-bootfiles")
-               "boot")))
-          ;; NOTE: The custom Chez 'configure' script doesn't allow
-          ;; unrecognized flags, such as those automatically added
-          ;; by `gnu-build-system`. This replacement phase uses only
-          ;; the explicitly provided `#:configure-flags`.
-          (replace 'configure
-            (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.
-          (add-after 'install 'install-symlink
-            (lambda* (#:key outputs #:allow-other-keys)
-              (let* ((scheme (search-input-file outputs "/bin/scheme"))
-                     (bin-dir (dirname scheme)))
-                (symlink scheme
-                         (string-append bin-dir "/chez-scheme"))
-                (match (find-files (string-append bin-dir "/../lib")
-                                   "scheme.boot")
-                  ((scheme.boot)
-                   (symlink scheme.boot
-                            (string-append (dirname scheme.boot)
-                                           "/chez-scheme.boot")))))))
-          ;; Building the documentation requires stex and a running scheme.
-          (add-after 'install-symlink 'install-docs
-            (lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
-              (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")))))))))
-    (supported-systems
-     (delete
-      "armhf-linux" ;; XXX reportedly broken, needs checking
-      (filter chez-upstream-features-for-system
-              %supported-systems)))
+     (modify-inputs (package-inputs chez-scheme-for-racket)
+       (replace "chez-scheme-for-racket-bootstrap-bootfiles"
+         chez-scheme-bootstrap-bootfiles)
+       ;; for X11 clipboard support in expeditor:
+       ;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
+       (prepend libx11)))
+    ;; replace unpack phase?
     (home-page "https://cisco.github.io/ChezScheme/")
     (synopsis "R6RS Scheme compiler and run-time")
     (description
-     "Chez Scheme is a compiler and run-time system for the language of the
-Revised^6 Report on Scheme (R6RS), with numerous extensions.  The compiler
-generates native code for each target processor, with support for x86, x86_64,
-and 32-bit PowerPC architectures.")
+     "Chez Scheme is both a programming language and a high-performance
+implementation of that language. The language is a superset of R6RS Scheme
+with numerous extensions, including native threads, non-blocking I/O, local
+modules, and much more.  Chez Scheme compiles source expressions incrementally
+to machine code, providing the speed of compiled code in an interactive
+system.  The system is intended to be as reliable and efficient as possible,
+with reliability taking precedence over efficiency if necessary.")
     (license asl2.0)))
 
 ;;
@@ -785,11 +640,6 @@ (define-public chez-scheme-bootstrap-bootfiles
     (arguments
      (list #:install-plan
            #~`(("boot/" "lib/chez-scheme-bootfiles"))))
-    (supported-systems
-     (filter (lambda (system)
-               (and=> (chez-upstream-features-for-system system)
-                      (cut memq 'bootstrap-bootfiles <>)))
-             %supported-systems))
     (synopsis "Chez Scheme bootfiles (binary seed)")
     (description
      "Chez Scheme is a self-hosting compiler: building it requires
diff --git a/gnu/packages/patches/chez-scheme-backport-configure.patch b/gnu/packages/patches/chez-scheme-backport-configure.patch
new file mode 100644
index 0000000000..584dcb3f0b
--- /dev/null
+++ b/gnu/packages/patches/chez-scheme-backport-configure.patch
@@ -0,0 +1,463 @@
+From 24ab36374f2e366b6c939fffe8c129c8b0ae3b9c Mon Sep 17 00:00:00 2001
+From: Philip McGrath <philip@philipmcgrath.com>
+Date: Wed, 28 Feb 2024 19:41:22 -0500
+Subject: [PATCH 1/2] Repairs and improvements for building with external
+ dependencies (#807)
+
+* configure: fix zlib and lz4 submodule checks
+
+Conditionals to skip the submodule checks were using the wrong
+variable names, so the checks were always skipped. The correct
+behavior is to perform the check unless given `ZLIB=<zlib>` or
+`LZ4=<lz4>`, as applicable.
+
+* configure: support `ZUO=<zuo>`
+
+Supplying `ZUO=<zuo>` skips the submodule check in `configure`
+and configures the generated makefile not to build or remove Zuo.
+
+* configure: support `STEXLIB=<stex>`
+
+For compatibility with older scripts, when not explicitly configured,
+continue to honor the `STEXLIB` environment variable at build time.
+
+(cherry picked from commit b8838c3280ef10e115236d2f7ac9ae857f83e268)
+---
+ BUILDING              |  5 +++--
+ build.zuo             | 13 +++++++++----
+ configure             | 40 +++++++++++++++++++++++++++++++++-------
+ makefiles/Makefile.in |  6 ++----
+ 4 files changed, 47 insertions(+), 17 deletions(-)
+
+diff --git a/BUILDING b/BUILDING
+index 7b3dc9c8..9e9a268b 100644
+--- a/BUILDING
++++ b/BUILDING
+@@ -149,7 +149,8 @@ information on the supported options.
+ The generated makefile mostly just ensures that a `zuo` executable is
+ built in a `bin` directory, and then it defers the actual build work
+ to `zuo`, which uses the "main.zuo" file. If you have `zuo` installed,
+-you can use `zuo` directly instead of `make`. In general, instead of
++you can use `zuo` directly instead of `make`: in that case, you may
++wish to use `./configure ZUO=<zuo>`. In general, instead of
+ the command `make X` to build target `X` as described below, you can
+ use `zuo . X` (or `bin/zuo . X` after `bin/zuo` is built).
+ 
+@@ -333,7 +334,7 @@ The makefile supports several targets:
+  * `make clean`
+ 
+    Removes all built elements from the workarea, and then removes
+-   `bin/zuo`.
++   `bin/zuo` (unless configured with `ZUO=<zuo>`).
+ 
+ 
+ WINDOWS VIA COMMAND PROMPT
+diff --git a/build.zuo b/build.zuo
+index c21d2caa..c5896396 100644
+--- a/build.zuo
++++ b/build.zuo
+@@ -224,10 +224,15 @@
+            token))
+ 
+   (define stexlib
+-    (let ((found (assoc "STEXLIB" (hash-ref (runtime-env) 'env))))
+-      (if found
+-          (cdr found)
+-          (at-source "stex"))))
++    (let ([configured (hash-ref config 'STEXLIB "")]
++          [env (assoc "STEXLIB" (hash-ref (runtime-env) 'env))])
++      (cond
++        [(not (equal? "" configured))
++         configured]
++        [env
++         (cdr env)]
++        [else
++         (at-source "stex")])))
+   (define stex-sources
+     (source-tree stexlib))
+ 
+diff --git a/configure b/configure
+index 2b4b594e..782dd09b 100755
+--- a/configure
++++ b/configure
+@@ -93,6 +93,7 @@ default_warning_flags="-Wpointer-arith -Wall -Wextra -Wno-implicit-fallthrough"
+ CFLAGS_ADD=
+ zlibLib=
+ LZ4Lib=
++STEXLIB=
+ Kernel=KernelLib
+ buildKernelOnly=no
+ enableFrompb=yes
+@@ -103,6 +104,7 @@ moreBootFiles=
+ preloadBootFiles=
+ alwaysUseBootFile=
+ skipSubmoduleUpdate=
++zuoExternal=
+ 
+ CONFIG_UNAME=`uname`
+ 
+@@ -446,6 +448,12 @@ while [ $# != 0 ] ; do
+     LZ4=*)
+       LZ4Lib=`echo $1 | sed -e 's/^LZ4=//'`
+       ;;
++    STEXLIB=*)
++      STEXLIB=`echo $1 | sed -e 's/^STEXLIB=//'`
++      ;;
++    ZUO=*)
++      zuoExternal=`echo $1 | sed -e 's/^ZUO=//'`
++      ;;
+     *)
+       echo "option '$1' unrecognized or missing an argument; try $0 --help"
+       exit 1
+@@ -672,6 +680,8 @@ if [ "$help" = "yes" ]; then
+   echo "  STRIP=<strip>                     executable stripper"
+   echo "  ZLIB=<lib>                        link to <lib> instead of own zlib"
+   echo "  LZ4=<lib>                         link to <lib> instead of own LZ4"
++  echo "  STEXLIB=<stex>                    build docs with <stex> instead of own stex"
++  echo "  ZUO=<zuo>                         build with <zuo> instead of own Zuo"
+   echo ""
+   echo "Available machine types: $machs"
+   echo ""
+@@ -889,28 +899,39 @@ submod_instructions () {
+     exit 1
+ }
+ 
+-if [ ! -f "$srcdir"/zuo/configure ] ; then
+-    submod_instructions 'Source in "zuo" is missing'
++if [ "${zuoExternal}" = "" ] ; then
++    if [ ! -f "$srcdir"/zuo/configure ] ; then
++        submod_instructions 'Source in "zuo" is missing'
++    fi
++    ZUO="bin/zuo"
++    RM_ZUO="rm -f bin/zuo"
++    ZUO_TARGET="bin/zuo"
++else
++    ZUO="${zuoExternal}"
++    RM_ZUO="@echo 'Not cleaning external ${zuoExternal}'"
++    ZUO_TARGET="DoNotBuildZuo"
+ fi
+ 
+ if [ ! -f "$srcdir"/nanopass/nanopass.ss ] ; then
+     submod_instructions 'Source in "nanopass" is missing'
+ fi
+ 
+-if [ "${zlibDep}" != "" ] ; then
++if [ "${zlibLib}" = "" ] ; then
+     if [ ! -f "$srcdir"/zlib/configure ] ; then
+         submod_instructions 'Source in "zlib" is missing'
+     fi
+ fi
+ 
+-if [ "${LZ4Dep}" != "" ] ; then
++if [ "${LZ4Lib}" = "" ] ; then
+     if [ ! -f "$srcdir"/lz4/lib/Makefile ] ; then
+         submod_instructions 'Source in "lz4" is missing'
+     fi
+ fi
+ 
+-if [ ! -f "$srcdir"/stex/Mf-stex ] ; then
+-    submod_instructions 'Source in "stex" is missing'
++if [ "${STEXLIB}" = "" ] ; then
++    if [ ! -f "$srcdir"/stex/Mf-stex ] ; then
++        submod_instructions 'Source in "stex" is missing'
++    fi
+ fi
+ 
+ # more compile and link flags for c/Mf-unix and mats/Mf-unix
+@@ -1083,7 +1104,7 @@ cp "$srcdir"/makefiles/buildmain.zuo main.zuo
+ # Some idea, but in the workarea, so it refers to "workarea.zuo" here:
+ cp "$srcdir"/makefiles/workmain.zuo $w/main.zuo
+ 
+-# The content of "$w/Makefile" records configuration decisions,
++# The content of "$w/Mf-config" records configuration decisions,
+ # and the Zuo build script takes it from there
+ cat > $w/Mf-config << END
+ srcdir=$srcdir
+@@ -1119,6 +1140,7 @@ cursesLib=$cursesLib
+ ncursesLib=$ncursesLib
+ zlibLib=$zlibLib
+ LZ4Lib=$LZ4Lib
++STEXLIB=$STEXLIB
+ warningFlags=$warningFlags
+ Kernel=$Kernel
+ installscriptname=$installscriptname
+@@ -1130,6 +1152,10 @@ preloadBootFiles=$preloadBootFiles
+ alwaysUseBootFile=$alwaysUseBootFile
+ relativeBootFiles=$relativeBootFiles
+ 
++ZUO=$ZUO
++RM_ZUO=$RM_ZUO
++ZUO_TARGET=$ZUO_TARGET
++
+ InstallBin=$installbin
+ InstallLib=$installlib
+ InstallMan=$installman/man1
+diff --git a/makefiles/Makefile.in b/makefiles/Makefile.in
+index 3b95f065..0e3d307d 100644
+--- a/makefiles/Makefile.in
++++ b/makefiles/Makefile.in
+@@ -3,8 +3,6 @@ workarea=$(w)
+ 
+ include $(workarea)/Mf-config
+ 
+-ZUO=bin/zuo
+-
+ .PHONY: build
+ build: $(ZUO)
+ 	+ $(ZUO) $(workarea) MAKE="$(MAKE)"
+@@ -144,9 +142,9 @@ pkg: $(ZUO)
+ .PHONY: clean
+ clean: $(ZUO)
+ 	+ $(ZUO) $(workarea) clean MAKE="$(MAKE)"
+-	rm -f bin/zuo
++	$(RM_ZUO)
+ 
+ # Using `+` here means that $(ZUO) gets built even if `-n`/`--dry-run` is provided to `make`
+-$(ZUO): $(srcdir)/zuo/zuo.c
++$(ZUO_TARGET): $(srcdir)/zuo/zuo.c
+ 	+ mkdir -p bin
+ 	+ $(CC_FOR_BUILD) -DZUO_LIB_PATH='"'"../zuo/lib"'"' -o $(ZUO) $(srcdir)/zuo/zuo.c
+
+base-commit: 253230f7dfbb4fe777277d6bbf93f39f9567f086
+-- 
+2.41.0
+
+
+From 665bccc1c074131e790879adc1436f8059801171 Mon Sep 17 00:00:00 2001
+From: Matthew Flatt <mflatt@racket-lang.org>
+Date: Sun, 17 Mar 2024 09:06:30 -0600
+Subject: [PATCH 2/2] adjust `configure ZUO=<command>` support (#816)
+
+Continuing from b8838c3280, adjust the generated makefile so the
+supplied `<command>` is not a makefile dependency. That way, `ZUO=zuo`
+works if `zuo` is installed and the current build directory is not the
+source directory. (The `zuo` executable is a dependency in a real and
+relevant sense, but not in the sense of dependencies that we normally
+track in makefiles.)
+
+Also adapt the makefile for the case that `ZUO=...` is not supplied
+and the build directory is not the source directory, in which case
+`ZUO_LIB_PATH` needs to be relative to the source directory.
+
+Using `make ZUO=zuo` can also work, but in that case, `bin/zuo` is
+still built as a dependency. It's possible that some portable makefile
+magic could overcome that limitation, but it doesn't seem important.
+
+(cherry picked from commit d327968f37cdf669d15a9ad6d356bbf92c502bb9)
+---
+ configure             |  3 ++
+ makefiles/Makefile.in | 66 +++++++++++++++++++++----------------------
+ 2 files changed, 36 insertions(+), 33 deletions(-)
+
+diff --git a/configure b/configure
+index 782dd09b..9adae37a 100755
+--- a/configure
++++ b/configure
+@@ -904,10 +904,12 @@ if [ "${zuoExternal}" = "" ] ; then
+         submod_instructions 'Source in "zuo" is missing'
+     fi
+     ZUO="bin/zuo"
++    ZUO_DEP="${ZUO}"
+     RM_ZUO="rm -f bin/zuo"
+     ZUO_TARGET="bin/zuo"
+ else
+     ZUO="${zuoExternal}"
++    ZUO_DEP=""
+     RM_ZUO="@echo 'Not cleaning external ${zuoExternal}'"
+     ZUO_TARGET="DoNotBuildZuo"
+ fi
+@@ -1153,6 +1155,7 @@ alwaysUseBootFile=$alwaysUseBootFile
+ relativeBootFiles=$relativeBootFiles
+ 
+ ZUO=$ZUO
++ZUO_DEP=$ZUO_DEP
+ RM_ZUO=$RM_ZUO
+ ZUO_TARGET=$ZUO_TARGET
+ 
+diff --git a/makefiles/Makefile.in b/makefiles/Makefile.in
+index 0e3d307d..fc8605a0 100644
+--- a/makefiles/Makefile.in
++++ b/makefiles/Makefile.in
+@@ -4,55 +4,55 @@ workarea=$(w)
+ include $(workarea)/Mf-config
+ 
+ .PHONY: build
+-build: $(ZUO)
++build: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) MAKE="$(MAKE)"
+ 
+ .PHONY: run
+-run: $(ZUO)
++run: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) run
+ 
+ .PHONY: kernel
+-kernel: $(ZUO)
++kernel: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) kernel MAKE="$(MAKE)"
+ 
+ .PHONY: install
+-install: $(ZUO)
++install: $(ZUO_DEP)
+ 	$(ZUO) $(workarea) install MAKE="$(MAKE)"
+ 
+ .PHONY: uninstall
+-uninstall: $(ZUO)
++uninstall: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) uninstall MAKE="$(MAKE)"
+ 
+ .PHONY: test-one
+-test-one: $(ZUO)
++test-one: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) test-one MAKE="$(MAKE)"
+ 
+ .PHONY: test-some-fast
+-test-some-fast: $(ZUO)
++test-some-fast: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) test-some-fast MAKE="$(MAKE)"
+ 
+ .PHONY: test-some
+-test-some: $(ZUO)
++test-some: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) test-some MAKE="$(MAKE)"
+ 
+ .PHONY: test
+-test: $(ZUO)
++test: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) test MAKE="$(MAKE)"
+ 
+ .PHONY: test-more
+-test-more: $(ZUO)
++test-more: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) test-more MAKE="$(MAKE)"
+ 
+ .PHONY: coverage
+-coverage: $(ZUO)
++coverage: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) coverage MAKE="$(MAKE)"
+ 
+ .PHONY: bootfiles
+-bootfiles: $(ZUO)
++bootfiles: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) bootfiles MAKE="$(MAKE)"
+ 
+ .PHONY: reset
+-reset: $(ZUO)
++reset: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) reset MAKE="$(MAKE)"
+ 
+ # Supply XM=<machine> to build boot files for <machine>
+@@ -61,90 +61,90 @@ boot:
+ 	+ $(ZUO) $(workarea) boot "$(XM)" MAKE="$(MAKE)"
+ 
+ # `<machine>.boot` as alias for `boot XM=<machine>`
+-%.boot: $(ZUO)
++%.boot: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) boot $* MAKE="$(MAKE)"
+ 
+ .PHONY: auto.boot
+-auto.boot: $(ZUO)
++auto.boot: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) boot MAKE="$(MAKE)"
+ 
+ SCHEME=scheme
+ 
+ .PHONY: cross.boot
+-cross.boot: $(ZUO)
++cross.boot: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) boot SCHEME="$(SCHEME)" MAKE="$(MAKE)"
+ 
+ .PHONY: re.boot
+-re.boot: $(ZUO)
++re.boot: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) reboot SCHEME="$(SCHEME)"
+ 
+ # Supply XM=<machine> 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
+ .PHONY: bootquick
+-bootquick: $(ZUO)
++bootquick: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) bootquick "$(XM)" MAKE="$(MAKE)"
+ 
+ # `<machine>.bootquick` as alias for `boot XM=<machine>`
+-%.bootquick: $(ZUO)
++%.bootquick: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) bootquick $* MAKE="$(MAKE)"
+ 
+-auto.bootquick: $(ZUO)
++auto.bootquick: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) bootquick MAKE="$(MAKE)"
+ 
+ # Supply XM=<machine>-<tag>.bootpbchunk to repackage boot files for
+ # <machine> with pbchunk sources, including additional
+ # boot files
+ .PHONY: bootpbchunk
+-bootpbchunk: $(ZUO)
++bootpbchunk: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) bootpbchunk "$(XM)" $(ARGS) MAKE="$(MAKE)"
+ 
+ # `<machine>.bootpbchunk` as alias for `pbchunk XM=<machine>`
+-%.bootpbchunk: $(ZUO)
++%.bootpbchunk: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) bootpbchunk $* $(ARGS) MAKE="$(MAKE)"
+ 
+ .PHONY: docs
+-docs: build $(ZUO)
++docs: build $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) docs MAKE="$(MAKE)"
+ 
+ .PHONY: csug
+-csug: build $(ZUO)
++csug: build $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) csug MAKE="$(MAKE)"
+ 
+ .PHONY: release_notes
+-release_notes: build $(ZUO)
++release_notes: build $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) release_notes MAKE="$(MAKE)"
+ 
+ .PHONY: install-docs
+-install-docs: build $(ZUO)
++install-docs: build $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) install-docs MAKE="$(MAKE)"
+ 
+ .PHONY: install-csug
+-install-csug: build $(ZUO)
++install-csug: build $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) install-csug MAKE="$(MAKE)"
+ 
+ .PHONY: install-release_notes
+-install-release_notes: build $(ZUO)
++install-release_notes: build $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) install-release_notes MAKE="$(MAKE)"
+ 
+ .PHONY: bintar
+-bintar: $(ZUO)
++bintar: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) bintar MAKE="$(MAKE)"
+ 
+ .PHONY: rpm
+-rpm: $(ZUO)
++rpm: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) rpm MAKE="$(MAKE)"
+ 
+ .PHONY: pkg
+-pkg: $(ZUO)
++pkg: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) pkg MAKE="$(MAKE)"
+ 
+ .PHONY: clean
+-clean: $(ZUO)
++clean: $(ZUO_DEP)
+ 	+ $(ZUO) $(workarea) clean MAKE="$(MAKE)"
+ 	$(RM_ZUO)
+ 
+ # Using `+` here means that $(ZUO) gets built even if `-n`/`--dry-run` is provided to `make`
+ $(ZUO_TARGET): $(srcdir)/zuo/zuo.c
+ 	+ mkdir -p bin
+-	+ $(CC_FOR_BUILD) -DZUO_LIB_PATH='"'"../zuo/lib"'"' -o $(ZUO) $(srcdir)/zuo/zuo.c
++	+ $(CC_FOR_BUILD) -DZUO_LIB_PATH='"'"$(upsrcdir)/zuo/lib"'"' -o $(ZUO) $(srcdir)/zuo/zuo.c
+-- 
+2.41.0
+
diff --git a/gnu/packages/patches/chez-scheme-bin-sh.patch b/gnu/packages/patches/chez-scheme-bin-sh.patch
index 7650914f01..c2a4b292f7 100644
--- a/gnu/packages/patches/chez-scheme-bin-sh.patch
+++ b/gnu/packages/patches/chez-scheme-bin-sh.patch
@@ -1,6 +1,6 @@
-From 3c838e6a0c3214d95bf02048cddccfd1b69a679f Mon Sep 17 00:00:00 2001
+From b8428ad25b437acf4bd8210b14db207b71fe44c3 Mon Sep 17 00:00:00 2001
 From: Philip McGrath <philip@philipmcgrath.com>
-Date: Thu, 19 May 2022 13:41:56 -0400
+Date: Wed, 24 Aug 2022 19:55:14 -0400
 Subject: [PATCH] patch s_process for "/bin/sh" on Guix
 
 If:
@@ -14,22 +14,27 @@ then `s_process` will call `execl` with the file specified by
 `_PATH_BSHELL` instead of "/bin/sh".
 
 Checking that the path specified by `_PATH_BSHELL` exists safeguards
-against obscure errors if attempting to use stand-alone executables
-built by the patched Racket in non-Guix envoronments.
+against obscure errors if attempting to use the patched Chez Scheme
+or executables it builds in non-Guix envoronments.
 
 This patch does not change the behavior of `s_system`, which relies
 on `system` from the C library.
 ---
+
+Notes:
+    See also racket-chez-scheme-bin-sh.patch, racket-rktio-bin-sh.patch,
+    and zuo-bin-sh.patch.
+
  c/prim5.c | 21 ++++++++++++++++++++-
  1 file changed, 20 insertions(+), 1 deletion(-)
 
 diff --git a/c/prim5.c b/c/prim5.c
-index 5a07893..bc2736c 100644
+index 90b087f1..284f063f 100644
 --- a/c/prim5.c
 +++ b/c/prim5.c
-@@ -23,6 +23,12 @@
- #include <ctype.h>
- #include <math.h>
+@@ -27,6 +27,12 @@
+ #include <sys/resource.h>
+ #endif
  
 +/* BEGIN PATCH for Guix */
 +#ifndef WIN32
@@ -39,8 +44,8 @@ index 5a07893..bc2736c 100644
 +
  /* locally defined functions */
  static INT s_errno(void);
- static iptr s_addr_in_heap(uptr x);
-@@ -746,6 +752,17 @@ static ptr s_process(char *s, IBOOL stderrp) {
+ static IBOOL s_addr_in_heap(uptr x);
+@@ -875,6 +881,17 @@ static ptr s_process(char *s, IBOOL stderrp) {
  
      INT tofds[2], fromfds[2], errfds[2];
      struct sigaction act, oint_act;
@@ -58,10 +63,10 @@ index 5a07893..bc2736c 100644
  
      if (pipe(tofds)) S_error("process","cannot open pipes");
      if (pipe(fromfds)) {
-@@ -771,7 +788,9 @@ static ptr s_process(char *s, IBOOL stderrp) {
-         CLOSE(1); if (dup(fromfds[1]) != 1) _exit(1);
-         CLOSE(2); if (dup(stderrp ? errfds[1] : 1) != 2) _exit(1);
-         {INT i; for (i = 3; i < NOFILE; i++) (void)CLOSE(i);}
+@@ -911,7 +928,9 @@ static ptr s_process(char *s, IBOOL stderrp) {
+           }
+         }
+ #endif /* __GNU__ Hurd */
 -        execl("/bin/sh", "/bin/sh", "-c", s, NULL);
 +        /* BEGIN PATCH for Guix */
 +        execl(guix_sh, guix_sh, "-c", s, NULL);
@@ -70,7 +75,7 @@ index 5a07893..bc2736c 100644
          /*NOTREACHED*/
      } else {
 
-base-commit: 9df56e7b25bc523663eac3da24be33afc5f76c84
+base-commit: 253230f7dfbb4fe777277d6bbf93f39f9567f086
 -- 
-2.32.0
+2.41.0
 
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH v2 5/8] gnu: Deprecate chez-scheme-for-system.in favor of chez-scheme.
  2024-04-01  6:51         ` [bug#70065] [PATCH v2 0/8] Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9 Philip McGrath
                             ` (3 preceding siblings ...)
  2024-04-01  6:51           ` [bug#70065] [PATCH v2 4/8] gnu: chez-scheme: Update to 10.0.0 Philip McGrath
@ 2024-04-01  6:51           ` Philip McGrath
  2024-04-01  6:51           ` [bug#70065] [PATCH v2 6/8] gnu: Fix uses of deprecated chez-scheme-for-system Philip McGrath
                             ` (3 subsequent siblings)
  8 siblings, 0 replies; 39+ messages in thread
From: Philip McGrath @ 2024-04-01  6:51 UTC (permalink / raw)
  To: 70065
  Cc: Katherine Cox-Buday, Liliana Marie Prikler, Andrew Tropin,
	Philip McGrath, Skyler Ferris, Philip McGrath

Chez Scheme 10.0.0 includes all of the additional platform support
developed on the Racket branch.

* gnu/packages/chez.scm (chez-scheme-for-system): Deprecate it.

Change-Id: I7e11c8c4d95f41ff63e5c52be664a537556393c1
---
 gnu/packages/chez.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 5b98b3ce1f..5a9a761282 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -27,6 +27,7 @@ (define-module (gnu packages chez)
                 #:select (gpl2+ gpl3+ lgpl2.0+ lgpl2.1+ asl2.0 bsd-3 expat
                           public-domain))
   #:use-module (guix packages)
+  #:use-module (guix deprecation)
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix utils)
@@ -68,8 +69,7 @@ (define-module (gnu packages chez)
 ;;
 ;; Code:
 
-(define* (chez-scheme-for-system #:optional
-                                 system)
+(define-deprecated (chez-scheme-for-system #:optional system) chez-scheme
   "Returns 'chez-scheme'."
   chez-scheme)
 
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH v2 6/8] gnu: Fix uses of deprecated chez-scheme-for-system.
  2024-04-01  6:51         ` [bug#70065] [PATCH v2 0/8] Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9 Philip McGrath
                             ` (4 preceding siblings ...)
  2024-04-01  6:51           ` [bug#70065] [PATCH v2 5/8] gnu: Deprecate chez-scheme-for-system.in favor of chez-scheme Philip McGrath
@ 2024-04-01  6:51           ` Philip McGrath
  2024-04-01 15:41             ` Liliana Marie Prikler
  2024-04-01  6:51           ` [bug#70065] [PATCH v2 7/8] gnu: chez-scheme: Update and simplify machine-type handling Philip McGrath
                             ` (2 subsequent siblings)
  8 siblings, 1 reply; 39+ messages in thread
From: Philip McGrath @ 2024-04-01  6:51 UTC (permalink / raw)
  To: 70065
  Cc: Katherine Cox-Buday, Liliana Marie Prikler, Andrew Tropin,
	Philip McGrath, Skyler Ferris, Andrew Tropin, Katherine Cox-Buday,
	Liliana Marie Prikler, Philip McGrath

(chez-srfi, chez-web, chez-sockets, chez-matchable, chez-irregex)
(chez-fmt, chez-mit, chez-scmutils)[native-inputs]: Use 'chez-scheme'
instead of 'chez-scheme-for-system'.
* gnu/packages/emacs-xyz.scm (emacs-geiser-chez)[inputs]: Likewise.
* gnu/packages/loko.scm (loko-scheme)[native-inputs]: Likewise.

Change-Id: Ib4d713fecbb41cbbe75f67980b9e22cc9bd673dd
---
 gnu/packages/chez.scm      | 16 ++++++++--------
 gnu/packages/emacs-xyz.scm |  2 +-
 gnu/packages/loko.scm      |  2 +-
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 5a9a761282..807a143f61 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -907,7 +907,7 @@ (define-public chez-srfi
        (file-name (git-file-name name version))))
     (build-system gnu-build-system)
     (native-inputs
-     (list (chez-scheme-for-system)))
+     (list chez-scheme))
     (arguments
      (list #:make-flags (chez-make-flags name version)
            #:test-target "test"
@@ -938,7 +938,7 @@ (define-public chez-web
           (base32 "1dq25qygyncbfq4kwwqqgyyakfqjwhp5q23vrf3bff1p66nyfl3b"))))
       (build-system gnu-build-system)
       (native-inputs
-       (list (chez-scheme-for-system)
+       (list chez-scheme
              ghostscript
              (texlive-updmap.cfg
               (list texlive-charter
@@ -1005,7 +1005,7 @@ (define-public chez-sockets
           (base32 "1n5fbwwz51fdzvjackgmnsgh363g9inyxv7kmzi0469cwavwcx5m"))))
       (build-system gnu-build-system)
       (native-inputs
-       (list (chez-scheme-for-system)
+       (list chez-scheme
              chez-web
              (texlive-updmap.cfg)))
       (arguments
@@ -1091,7 +1091,7 @@ (define-public chez-matchable
     (inputs
      (list chez-srfi)) ; for tests
     (native-inputs
-     (list (chez-scheme-for-system)))
+     (list chez-scheme))
     (arguments
      (list #:make-flags (chez-make-flags name version)
            #:test-target "test"
@@ -1123,7 +1123,7 @@ (define-public chez-irregex
     (propagated-inputs
      (list chez-srfi)) ; for irregex-utils
     (native-inputs
-     (list (chez-scheme-for-system)))
+     (list chez-scheme))
     (arguments
      (list #:make-flags (chez-make-flags name version)
            #:test-target "test"
@@ -1154,7 +1154,7 @@ (define-public chez-fmt
     (propagated-inputs
      (list chez-srfi)) ; for irregex-utils
     (native-inputs
-     (list (chez-scheme-for-system)))
+     (list chez-scheme))
     (arguments
      (list #:make-flags (chez-make-flags name version)
            #:test-target "chez-check"
@@ -1217,7 +1217,7 @@ (define-public chez-mit
     (inputs
      (list chez-srfi))       ; for tests
     (native-inputs
-     (list (chez-scheme-for-system)))
+     (list chez-scheme))
     (arguments
      (list #:make-flags (chez-make-flags name version)
            #:test-target "test"
@@ -1248,7 +1248,7 @@ (define-public chez-scmutils
     (inputs
      (list chez-srfi))       ; for tests
     (native-inputs
-     (list (chez-scheme-for-system)))
+     (list chez-scheme))
     (propagated-inputs
      (list chez-mit chez-srfi))
     (arguments
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index d4819c62ce..731f479560 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -767,7 +767,7 @@ (define-public emacs-geiser-chez
                 (string-append
                  "(eval-after-load 'geiser-impl '" all ")"))))))))
     (inputs
-     (list (chez-scheme-for-system)))
+     (list chez-scheme))
     (propagated-inputs
      (list emacs-geiser))
     (home-page "https://nongnu.org/geiser/")
diff --git a/gnu/packages/loko.scm b/gnu/packages/loko.scm
index 49dcc92d1e..003fbe416a 100644
--- a/gnu/packages/loko.scm
+++ b/gnu/packages/loko.scm
@@ -74,7 +74,7 @@ (define-public loko-scheme
               #t)))))
     (native-inputs
      (list akku
-           (chez-scheme-for-system)
+           chez-scheme
            guile-struct-pack
            guile-laesare
            guile-pfds
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH v2 7/8] gnu: chez-scheme: Update and simplify machine-type handling.
  2024-04-01  6:51         ` [bug#70065] [PATCH v2 0/8] Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9 Philip McGrath
                             ` (5 preceding siblings ...)
  2024-04-01  6:51           ` [bug#70065] [PATCH v2 6/8] gnu: Fix uses of deprecated chez-scheme-for-system Philip McGrath
@ 2024-04-01  6:51           ` Philip McGrath
  2024-04-01 15:45             ` Liliana Marie Prikler
  2024-04-01  6:51           ` [bug#70065] [PATCH v2 8/8] gnu: chez-scheme: Bootstrap from source Philip McGrath
  2024-04-11 10:55           ` bug#70065: [PATCH v2 0/8] Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9 Ludovic Courtès
  8 siblings, 1 reply; 39+ messages in thread
From: Philip McGrath @ 2024-04-01  6:51 UTC (permalink / raw)
  To: 70065
  Cc: Katherine Cox-Buday, Liliana Marie Prikler, Andrew Tropin,
	Philip McGrath, Skyler Ferris, Philip McGrath

Since Chez Scheme 10.0.0 supports all of the backends added in Racket's
branch, the complexity of '%chez-features-table' is no longer needed.
Ideally, even more of this logic could be maintained upstream, but this
change will simplify maintenance in the mean time.

* gnu/packages/chez.scm (target-chez-arch): Recognize loongarch64.
(chez-upsteam-features-for-system): Remove function.
(%chez-features-table): Replace with ...
(define-machine-types, %machine-types): ... this new macro and variable,
using the list copied directly from the Chez Scheme source code.
(nix-system->pbarch-machine-type): Update docstring, since pbarch
machine types are supported upstream as of Chez Scheme 10.0.0.
(racket-cs-native-supported-system?): Replace with ...
(nix-system->native-chez-machine-type): ... this new function,
implemented using '%machine-types'.
(chez-scheme-for-racket): Update accordingly.
(chez-scheme-for-racket-bootstrap-bootfiles): Likewise.
* gnu/packages/racket.scm (racket-vm-cs): Likewise.

Change-Id: I46efebaf48cce388075ab4873c16a6f5f9692bb7
---
 gnu/packages/chez.scm   | 197 ++++++++++++++++------------------------
 gnu/packages/racket.scm |   4 +-
 2 files changed, 81 insertions(+), 120 deletions(-)

diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 807a143f61..4d3f79d9a7 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -50,7 +50,7 @@ (define-module (gnu packages chez)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26)
   #:export (chez-scheme-for-system
-            racket-cs-native-supported-system?
+            nix-system->native-chez-machine-type
             nix-system->pbarch-machine-type
             unpack-nanopass))
 
@@ -93,6 +93,8 @@ (define* (target-chez-arch #:optional (system
     "ppc32")
    ((target-riscv64? system)
     "rv64")
+   ((string-prefix? "loongarch64-" system)
+    "la64")
    (else
     #f)))
 
@@ -127,111 +129,67 @@ (define* (target-chez-os #:optional (system (or (%current-target-system)
    (else
     #f)))
 
-(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)
-     ("rv64" . #f)
-     ("ppc32" threads))
-    ;; Hurd
-    ("gnu"
-     ("i3" . #f))
-    ;; 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
-    ;; QNX
-    ("qnx"
-     ("i3" . #f))
-    ;; 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)
-                                                 (%current-system))))
-  "Return a list of symbols naming features supported by upstream Chez Scheme
-for the Nix system identifier SYSTEM, or @code{#f} if upstream Chez Scheme
-does not support SYSTEM at all.
-
-If native threads are supported, the returned list will include
-@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-syntax define-machine-types
+  (lambda (stx)
+    (syntax-case stx (any)
+      ((_ any id0 id ...)
+       #`(define #,(datum->syntax #'id0 '%machine-types)
+           '(id0 id ...))))))
+;; The following is copied from s/cmacros.ss, line 36, in the Chez source
+(define-machine-types
+  any
+  pb        tpb
+  pb32l     tpb32l
+  pb32b     tpb32b
+  pb64l     tpb64l
+  pb64b     tpb64b
+  i3nt      ti3nt
+  i3osx     ti3osx
+  i3le      ti3le
+  i3fb      ti3fb
+  i3ob      ti3ob
+  i3nb      ti3nb
+  i3s2      ti3s2
+  i3qnx     ti3qnx
+  i3gnu     ti3gnu
+  a6nt      ta6nt
+  a6osx     ta6osx
+  a6le      ta6le
+  a6fb      ta6fb
+  a6ob      ta6ob
+  a6nb      ta6nb
+  a6s2      ta6s2
+  ppc32osx  tppc32osx
+  ppc32le   tppc32le
+  ppc32fb   tppc32fb
+  ppc32ob   tppc32ob
+  ppc32nb   tppc32nb
+  arm32le   tarm32le
+  arm32fb   tarm32fb
+  arm32ob   tarm32ob
+  arm32nb   tarm32nb
+  arm64nt   tarm64nt
+  arm64osx  tarm64osx
+  arm64le   tarm64le
+  arm64fb   tarm64fb
+  arm64ob   tarm64ob
+  arm64nb   tarm64nb
+  rv64le    trv64le
+  rv64fb    trv64fb
+  rv64ob    trv64ob
+  rv64nb    trv64nb
+  la64le    tla64le
+)
 
 (define* (nix-system->pbarch-machine-type #:optional
                                           (system
                                            (or (%current-target-system)
                                                (%current-system)))
                                           #:key (threads? #t))
-  "Return a string naming the pseudo–machine type used by Racket's variant of
-Chez Scheme to represent the appropriate ``pbarch'' backend for SYSTEM: that
-is, the ``portable bytecode'' backend specialized for SYSTEM's word size and
-endianness.  The result will name the threaded machine type unless THREADS? is
-provided and is #f."
+  "Return a string naming the Chez Scheme machine type of the appropriate
+``pbarch'' backend for SYSTEM: that is, the ``portable bytecode'' backend
+specialized for SYSTEM's word size and endianness.  The result will name the
+threaded machine type unless THREADS? is provided as #f."
   (string-append (if threads?
                      "t"
                      "")
@@ -243,20 +201,23 @@ (define* (nix-system->pbarch-machine-type #:optional
                      "l"
                      "b")))
 
-(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?  If
-so, return the applicable machine type as a string.  Otherwise, when SYSTEM
-can use only the ``portable bytecode'' backends, return #f."
-  (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 <>))
-         (string-append "t" chez-arch chez-os))))
-
+(define* (nix-system->native-chez-machine-type #:optional
+                                               (system
+                                                (or (%current-target-system)
+                                                    (%current-system)))
+                                               #:key (threads? #t))
+  "Return a string naming the Chez Scheme machine type of the native-code
+backend for SYSTEM, if such a native-code backend exists.  Otherwise, when
+SYSTEM can use only the ``portable bytecode'' backends, return #f.  The result
+will name the threaded machine type unless THREADS? is provided as #f."
+  (let* ((chez-arch (target-chez-arch system))
+         (chez-os (target-chez-os system))
+         (machine
+          (and chez-arch chez-os
+               (string-append (if threads? "t" "") chez-arch chez-os))))
+    (and machine
+         (memq (string->symbol machine) %machine-types)
+         machine)))
 ;;
 ;; Chez Scheme:
 ;;
@@ -300,7 +261,7 @@ (define-public chez-scheme-for-racket
     (version "9.9.9-pre-release.23")
     (source #f)
     (build-system gnu-build-system)
-    (inputs `(,@(if (racket-cs-native-supported-system?)
+    (inputs `(,@(if (nix-system->native-chez-machine-type)
                     '()
                     (list libffi))
               ,chez-scheme-for-racket-bootstrap-bootfiles
@@ -353,10 +314,10 @@ (define-public chez-scheme-for-racket
                  (search-input-directory %build-inputs "/include/X11"))
                 '()
                 '("--disable-x11"))
-          #$(string-append "-m=" (or (racket-cs-native-supported-system?)
+          #$(string-append "-m=" (or (nix-system->native-chez-machine-type)
                                      (nix-system->pbarch-machine-type)))
           ;; ^ could skip -m= for non-cross non-pbarch builds
-          #$@(if (racket-cs-native-supported-system?)
+          #$@(if (nix-system->native-chez-machine-type)
                  #~()
                  ;; not inferred on non-native platforms: see
                  ;; https://racket.discourse.group/t/950/9
@@ -588,7 +549,7 @@ (define-public chez-scheme-for-racket-bootstrap-bootfiles
                     (invoke "./configure"
                             "--force" ; don't complain about missing bootfiles
                             #$(string-append
-                               "-m=" (or (racket-cs-native-supported-system?)
+                               "-m=" (or (nix-system->native-chez-machine-type)
                                          (nix-system->pbarch-machine-type)))
                             "ZUO=zuo"
                             ;; ignore submodules:
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index d366f89845..f50f6f3eab 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -433,7 +433,7 @@ (define-public racket-vm-cs
     (inputs
      (let ((inputs (modify-inputs (package-inputs racket-vm-cgc)
                      (prepend zlib lz4))))
-       (if (racket-cs-native-supported-system?)
+       (if (nix-system->native-chez-machine-type)
            (modify-inputs inputs
              (delete "libffi"))
            inputs)))
@@ -461,7 +461,7 @@ (define-public racket-vm-cs
                                 #+(this-package-native-input
                                    "chez-scheme-for-racket")
                                 "/bin/scheme")
-                 #$@(if (racket-cs-native-supported-system?)
+                 #$@(if (nix-system->native-chez-machine-type)
                         #~()
                         #~(#$(string-append "--enable-mach="
                                             (nix-system->pbarch-machine-type))
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH v2 8/8] gnu: chez-scheme: Bootstrap from source.
  2024-04-01  6:51         ` [bug#70065] [PATCH v2 0/8] Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9 Philip McGrath
                             ` (6 preceding siblings ...)
  2024-04-01  6:51           ` [bug#70065] [PATCH v2 7/8] gnu: chez-scheme: Update and simplify machine-type handling Philip McGrath
@ 2024-04-01  6:51           ` Philip McGrath
  2024-04-11 10:55           ` bug#70065: [PATCH v2 0/8] Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9 Ludovic Courtès
  8 siblings, 0 replies; 39+ messages in thread
From: Philip McGrath @ 2024-04-01  6:51 UTC (permalink / raw)
  To: 70065
  Cc: Katherine Cox-Buday, Liliana Marie Prikler, Andrew Tropin,
	Philip McGrath, Skyler Ferris, Philip McGrath

* gnu/packages/chez.scm (chez-scheme)[source]<snippet>: Also unbundle
pre-built boot files.
(chez-scheme-bootstrap-bootfiles): Stop inheriting from 'chez-scheme'.
[native-inputs]: Add 'zuo', 'chez-nanopass-bootstrap', and either
'chez-scheme-for-racket' or, for cross builds, 'chez-scheme'.
[build-system]: Change to gnu-build-system.
[arguments]: Change to run 'configure' and then bootstrap via
`make re.boot` or, for cross builds, `make cross.boot`
[synopsis, description]: Update accordingly.
(chez-scheme-for-racket-bootstrap-bootfiles)[synopsis]: Write "boot
files" as two words in prose.
[description]: Likewise.
* gnu/packages/racket.scm: Update comments.

Change-Id: I55d9b57090ecaca0aa2ab19c2c3ebae2243a9173
---
 gnu/packages/chez.scm   | 123 +++++++++++++++++++++++++++++++---------
 gnu/packages/racket.scm |  24 +++++---
 2 files changed, 112 insertions(+), 35 deletions(-)

diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 4d3f79d9a7..db582fa821 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -57,15 +57,54 @@ (define-module (gnu packages chez)
 ;; Commentary:
 ;;
 ;; The bootstrapping paths for Chez Scheme and Racket are closely
-;; entwined. Racket CS (the default Racket implementation) is based on (a fork
-;; of) Chez Scheme. Racket's variant of Chez Scheme shares sources for
-;; nanopass and stex with upstream Chez Scheme.
+;; entwined. See "Bootstrapping Racket" in the commentary on "racket.scm" for
+;; details on the Racket portion of Chez Scheme's bootstrapping path.
 ;;
-;; Racket's variant of Chez Scheme can be bootstrapped by an older Racket
-;; implementation, Racket BC, which can be bootstrapped from C. Porting that
-;; code to work with upstream Chez Scheme (or finding an old version that
-;; does) is our best hope for some day bootstrapping upstream Chez Scheme from
-;; source.
+;; Chez Scheme is a self-hosting compiler. A small kernel implemented in C
+;; loads "boot files" (in a custom object file format) compiled from the parts
+;; of the system implemented in Chez Scheme. (While Chez Scheme generates
+;; native machine code, it implements its own linker and loader.)
+;;
+;; As of Chez Scheme 10.0.0 (and the pre-release versions that preceded it on
+;; the Racket branch), there are several ways to obtain boot files:
+;;
+;;  1. The Racket package "cs-bootstrap" (in the "racket/src/rktboot/"
+;;     directory of the main Racket Git repository) simulates enough of Chez
+;;     Scheme to load the Chez Scheme compiler purely from source into Racket
+;;     and apply the compiler to itself, producing the needed boot files
+;;     (albeit very slowly).
+;;     Any variant of Racket since version 7.1 can run the simulation. Using
+;;     the older Racket BC implementation, which does not depend on Chez
+;;     Scheme, breaks the dependency cycle.
+;;     However, the simulation relies on implementation details of Chez
+;;     Scheme, so a given version of Chez Scheme can only be bootstrapped by
+;;     the corresponding version of the "cs-bootstrap" package.
+;;
+;;  2. The Chez Scheme makefile provides a "re.boot" target for bootstrapping
+;;     via a different version of Chez Scheme (9.5.4 or later).
+;;     This path manages potential differences in implementation details
+;;     across Chez Scheme versions using a strategy similar to "cs-bootstrap",
+;;     but the compatibility shim is maintained with the Chez Scheme source
+;;     code (in "s/reboot.ss"). Also, it's faster, since less indirection is
+;;     needed.
+;;
+;;  3. For cross-compilation, or with an extremely similar Chez Scheme, the
+;;     makefile provides "cross.boot" and related targets.
+;;
+;;  4. The Chez Scheme Git repository includes pre-built "pb" (portable
+;;     bytecode) boot files, which can be used for bootstrapping on any
+;;     platform, but these binary files are removed from the source Guix uses.
+;;
+;; Concretely, we use racket-vm-bc to bootstrap chez-scheme-for-racket, which
+;; we then use to bootstrap both chez-scheme and racket-vm-cs.
+;;
+;; In principle, it would be possible instead to use chez-scheme to bootstrap
+;; chez-scheme-for-racket. However, since Racket is ultimately used for
+;; bootstrapping, chez-scheme would still need to be rebuilt when Racket
+;; changes, whereas treating chez-scheme as a leaf avoids having to rebuild
+;; Racket when upstream Chez Scheme changes. Furthermore, since "cs-bootstrap"
+;; is developed in the Racket source repository, we don't have to look for the
+;; version of "cs-bootstrap" compatible with the upstream Chez Scheme release.
 ;;
 ;; Code:
 
@@ -479,7 +518,8 @@ (define-public chez-scheme
                            (for-each (lambda (dir)
                                        (when (directory-exists? dir)
                                          (delete-file-recursively dir)))
-                                     '("lz4"
+                                     '("boot"
+                                       "lz4"
                                        "nanopass"
                                        "stex"
                                        "zlib"
@@ -575,10 +615,10 @@ (define-public chez-scheme-for-racket-bootstrap-bootfiles
                                         "/opt/racket-vm/bin/racket")
                      "../rktboot/main.rkt"))))))))
     (home-page "https://pkgs.racket-lang.org/package/cs-bootstrap")
-    (synopsis "Chez Scheme bootfiles bootstrapped by Racket")
-    (description "Chez Scheme is a self-hosting compiler: building it
-requires ``bootfiles'' containing the Scheme-implemented portions compiled for
-the current platform.  (Chez can then cross-compile bootfiles for all other
+    (synopsis "Chez Scheme boot files bootstrapped by Racket")
+    (description "Chez Scheme is a self-hosting compiler: building it requires
+``boot files'' containing the Scheme-implemented portions compiled for the
+current platform.  (Chez can then cross-compile boot files for all other
 supported platforms.)
 
 The Racket package @code{cs-bootstrap} (part of the main Racket Git
@@ -591,28 +631,57 @@ (define-public chez-scheme-for-racket-bootstrap-bootfiles
 
 (define-public chez-scheme-bootstrap-bootfiles
   (package
-    (inherit chez-scheme)
     (name "chez-scheme-bootstrap-bootfiles")
-    (inputs '())
-    (native-inputs '())
+    (version (package-version chez-scheme))
+    (source (package-source chez-scheme))
+    (native-inputs (list chez-nanopass-bootstrap
+                         (if (%current-target-system)
+                             chez-scheme
+                             chez-scheme-for-racket)
+                         zuo))
     (outputs '("out"))
-    (build-system copy-build-system)
-    ;; TODO: cross compilation
+    (build-system gnu-build-system)
     (arguments
-     (list #:install-plan
-           #~`(("boot/" "lib/chez-scheme-bootfiles"))))
-    (synopsis "Chez Scheme bootfiles (binary seed)")
+     (list
+      #:configure-flags
+      #~`("--force" ; don't complain about missing bootfiles
+          "ZLIB=-lz" "LZ4=-llz4" "STEXLIB=/GuixNotUsingStex" ; ignore submods
+          "ZUO=zuo"
+          ;; could skip -m= for non-cross non-pbarch builds
+          #$(string-append "-m=" (or (nix-system->native-chez-machine-type)
+                                     (nix-system->pbarch-machine-type))))
+      #:make-flags
+      #~(list (string-append "SCHEME="
+                             (search-input-file %build-inputs "/bin/scheme"))
+              #$(if (%current-target-system)
+                    "cross.boot"
+                    "re.boot"))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'unpack-nanopass
+            #$unpack-nanopass)
+          (replace 'configure
+            #$chez-configure)
+          (delete 'check)
+          (replace 'install
+            (lambda args
+              (mkdir-p (string-append #$output "/lib"))
+              (copy-recursively
+               "boot"
+               (string-append #$output "/lib/chez-scheme-bootfiles")))))))
+    (home-page "https://cisco.github.io/ChezScheme/")
+    (synopsis "Bootstrapped Chez Scheme boot files")
     (description
      "Chez Scheme is a self-hosting compiler: building it requires
-``bootfiles'' containing the Scheme-implemented portions compiled for the
+``boot files'' containing the Scheme-implemented portions compiled for the
 current platform.  (Chez can then cross-compile bootfiles for all other
 supported platforms.)
 
-This package provides bootstrap bootfiles for upstream Chez Scheme.
-Currently, it simply packages the binaries checked in to the upstream
-repository.  Hopefully we can eventually adapt Racket's @code{cs-bootstrap} to
-work with upstream Chez Scheme so that we can bootstrap these files from
-source.")))
+This package provides boot files for the released version of Chez Scheme
+bootstrapped by @code{chez-scheme-for-racket}. Chez Scheme 9.5.4 or any later
+version can be used for bootstrapping. Guix ultimately uses the Racket package
+@code{cs-bootstrap} to bootstrap its initial version of Chez Scheme.")
+    (license asl2.0)))
 
 ;;
 ;; Chez's bootstrap dependencies:
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index f50f6f3eab..2b20353159 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -72,6 +72,7 @@ (define-module (gnu packages racket)
 ;;             ├── bc/
 ;;             ├── cs/
 ;;             ├── ChezScheme/
+;;             ├── rktboot/
 ;;             ├── zuo/
 ;;             └── ...
 ;;
@@ -149,14 +150,12 @@ (define-module (gnu packages racket)
 ;;   - Racket BC [3M] needs an existing Racket to run "xform",
 ;;     which transforms its own C source code to add additional annotations
 ;;     for the precise garbage collector.
-;;   - Racket CS needs (bootfiles for) Racket's fork of Chez Scheme.
-;;     It also needs an existing Racket to compile Racket-implemented
+;;   - Racket CS needs (boot files for) the corresponding version of Chez
+;;     Scheme. It also needs an existing Racket to compile Racket-implemented
 ;;     parts of the runtime system to R6RS libraries.
-;;   - Chez Scheme also needs bootfiles for itself, but Racket can simulate
-;;     enough of Chez Scheme to load Racket's fork of the Chez Scheme compiler
-;;     purely from source into Racket and apply the compiler to itself,
-;;     producing the needed bootfiles (albeit very slowly).
-;;     Any variant of Racket since version 7.1 can run the simulation.
+;;   - Chez Scheme also needs boot files for itself, but Racket BC can
+;;     bootstrap these using the code in "racket/src/rktboot/".
+;;     See the commentary in "chez.scm" for further details
 ;;
 ;; So, we build CGC to build 3M to build bootfiles and CS.
 ;;
@@ -164,6 +163,14 @@ (define-module (gnu packages racket)
 ;; often use "BC" to mean "3M", consistent with `(banner)` and the
 ;; suffixes used on executables when more than one variant co-exists.)
 ;;
+;; Since the pre-releases for Chez Scheme 10.0.0, all of Racket's changes have
+;; been merged upstream, and development will be kept in sync going
+;; forward. However, there is no plan to align the Chez Scheme and Racket
+;; release cycles. For the near fulture, a given released version of Racket
+;; will continue to depend on a specific pre-release version of Chez Scheme as
+;; part of Racket CS's "ABI". See upstream discussion at
+;; <https://racket.discourse.group/t/2739/3>.
+;;
 ;; One remaining bootstrapping limitation is that Racket's reader, module
 ;; system, and macro expander are implemented in Racket. For Racket CS,
 ;; they are compiled to R6RS libraries as discussed above. This note from the
@@ -189,7 +196,8 @@ (define-module (gnu packages racket)
 ;; Zuo is notably *not* a problem for bootstrapping. The implementation is a
 ;; single hand-written C file designed to build with just `cc -o zuo zuo.c`,
 ;; even with very old or limited compilers. (We use the Autoconf support for
-;; convienience.)
+;; convienience.) As of Zuo 1.8, Zuo has tagged releases in its own repository
+;; independent of the Racket release cycle.
 ;;
 ;; CODE:
 
-- 
2.41.0





^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH v2 3/8] gnu: chez-scheme: Reorganize package definitions.
  2024-04-01  6:51           ` [bug#70065] [PATCH v2 3/8] gnu: chez-scheme: Reorganize package definitions Philip McGrath
@ 2024-04-01 15:40             ` Liliana Marie Prikler
  2024-04-02  3:59               ` Philip McGrath
  0 siblings, 1 reply; 39+ messages in thread
From: Liliana Marie Prikler @ 2024-04-01 15:40 UTC (permalink / raw)
  To: Philip McGrath, 70065; +Cc: Katherine Cox-Buday, Andrew Tropin, Skyler Ferris

Am Montag, dem 01.04.2024 um 02:51 -0400 schrieb Philip McGrath:
> A future commit will change 'chez-scheme' to inherit from
> 'chez-scheme-for-racket', so 'chez-scheme-for-racket' will need to be
> defined before 'chez-scheme'.  In an attempt to produce better diffs,
> this commit re-orders the definitions while keeping their contents
> exactly the same.
> 
> * gnu/packages/chez.scm (chez-scheme): Move below
> 'chez-scheme-for-racket'.
> (chez-scheme-bootstrap-bootfiles): Move below
> 'chez-scheme-for-racket-bootstrap-bootfiles'.
> 
> Change-Id: Ie088abea2b44329f9d8399fbfb95c51d8912b05e
> ---
I don't understand this direction.  Why have chez-scheme inherit from
chez-scheme-for-racket?  Even if Racket itself pins a particular
version instead of an upstream release (which, let's face it, would be
the wiser option here), or requires a special build (again, why?) I
think keeping the inheritance in the other direction makes ontological
sense moreso than whatever we're starting here.

Cheers




^ permalink raw reply	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH v2 6/8] gnu: Fix uses of deprecated chez-scheme-for-system.
  2024-04-01  6:51           ` [bug#70065] [PATCH v2 6/8] gnu: Fix uses of deprecated chez-scheme-for-system Philip McGrath
@ 2024-04-01 15:41             ` Liliana Marie Prikler
  0 siblings, 0 replies; 39+ messages in thread
From: Liliana Marie Prikler @ 2024-04-01 15:41 UTC (permalink / raw)
  To: Philip McGrath, 70065; +Cc: Katherine Cox-Buday, Andrew Tropin, Skyler Ferris

Am Montag, dem 01.04.2024 um 02:51 -0400 schrieb Philip McGrath:
> (chez-srfi, chez-web, chez-sockets, chez-matchable, chez-irregex)
> (chez-fmt, chez-mit, chez-scmutils)[native-inputs]: Use 'chez-scheme'
> instead of 'chez-scheme-for-system'.
> * gnu/packages/emacs-xyz.scm (emacs-geiser-chez)[inputs]: Likewise.
> * gnu/packages/loko.scm (loko-scheme)[native-inputs]: Likewise.
> 
> Change-Id: Ib4d713fecbb41cbbe75f67980b9e22cc9bd673dd
> ---
LGTM




^ permalink raw reply	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH v2 7/8] gnu: chez-scheme: Update and simplify machine-type handling.
  2024-04-01  6:51           ` [bug#70065] [PATCH v2 7/8] gnu: chez-scheme: Update and simplify machine-type handling Philip McGrath
@ 2024-04-01 15:45             ` Liliana Marie Prikler
  2024-04-02  3:59               ` Philip McGrath
  0 siblings, 1 reply; 39+ messages in thread
From: Liliana Marie Prikler @ 2024-04-01 15:45 UTC (permalink / raw)
  To: Philip McGrath, 70065; +Cc: Katherine Cox-Buday, Andrew Tropin, Skyler Ferris

Am Montag, dem 01.04.2024 um 02:51 -0400 schrieb Philip McGrath:
> Since Chez Scheme 10.0.0 supports all of the backends added in
> Racket's
> branch, the complexity of '%chez-features-table' is no longer needed.
> Ideally, even more of this logic could be maintained upstream, but
> this
> change will simplify maintenance in the mean time.
> 
> * gnu/packages/chez.scm (target-chez-arch): Recognize loongarch64.
> (chez-upsteam-features-for-system): Remove function.
> (%chez-features-table): Replace with ...
> (define-machine-types, %machine-types): ... this new macro and
> variable,
> using the list copied directly from the Chez Scheme source code.
> (nix-system->pbarch-machine-type): Update docstring, since pbarch
> machine types are supported upstream as of Chez Scheme 10.0.0.
> (racket-cs-native-supported-system?): Replace with ...
> (nix-system->native-chez-machine-type): ... this new function,
> implemented using '%machine-types'.
> (chez-scheme-for-racket): Update accordingly.
> (chez-scheme-for-racket-bootstrap-bootfiles): Likewise.
> * gnu/packages/racket.scm (racket-vm-cs): Likewise.
> 
> Change-Id: I46efebaf48cce388075ab4873c16a6f5f9692bb7
> ---
>  gnu/packages/chez.scm   | 197 ++++++++++++++++----------------------
> --
>  gnu/packages/racket.scm |   4 +-
>  2 files changed, 81 insertions(+), 120 deletions(-)
> 
> diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
> index 807a143f61..4d3f79d9a7 100644
> --- a/gnu/packages/chez.scm
> +++ b/gnu/packages/chez.scm
> @@ -50,7 +50,7 @@ (define-module (gnu packages chez)
>    #:use-module (srfi srfi-1)
>    #:use-module (srfi srfi-26)
>    #:export (chez-scheme-for-system
> -            racket-cs-native-supported-system?
> +            nix-system->native-chez-machine-type
>              nix-system->pbarch-machine-type
>              unpack-nanopass))
>  
> @@ -93,6 +93,8 @@ (define* (target-chez-arch #:optional (system
>      "ppc32")
>     ((target-riscv64? system)
>      "rv64")
> +   ((string-prefix? "loongarch64-" system)
> +    "la64")
>     (else
>      #f)))
>  
> @@ -127,111 +129,67 @@ (define* (target-chez-os #:optional (system
> (or (%current-target-system)
>     (else
>      #f)))
>  
> -(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)
> -     ("rv64" . #f)
> -     ("ppc32" threads))
> -    ;; Hurd
> -    ("gnu"
> -     ("i3" . #f))
> -    ;; 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
> -    ;; QNX
> -    ("qnx"
> -     ("i3" . #f))
> -    ;; 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)
> -                                                 (%current-
> system))))
> -  "Return a list of symbols naming features supported by upstream
> Chez Scheme
> -for the Nix system identifier SYSTEM, or @code{#f} if upstream Chez
> Scheme
> -does not support SYSTEM at all.
> -
> -If native threads are supported, the returned list will include
> -@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-syntax define-machine-types
> +  (lambda (stx)
> +    (syntax-case stx (any)
> +      ((_ any id0 id ...)
> +       #`(define #,(datum->syntax #'id0 '%machine-types)
> +           '(id0 id ...))))))
The datum->syntax call here looks weird.
> +;; The following is copied from s/cmacros.ss, line 36, in the Chez
> source
> +(define-machine-types
> +  any
> +  pb        tpb
You should maybe comment ;; unthreaded    threaded
> +  pb32l     tpb32l
> +  pb32b     tpb32b
> +  pb64l     tpb64l
> +  pb64b     tpb64b
> +  i3nt      ti3nt
> +  i3osx     ti3osx
> +  i3le      ti3le
> +  i3fb      ti3fb
> +  i3ob      ti3ob
> +  i3nb      ti3nb
> +  i3s2      ti3s2
> +  i3qnx     ti3qnx
> +  i3gnu     ti3gnu
> +  a6nt      ta6nt
> +  a6osx     ta6osx
> +  a6le      ta6le
> +  a6fb      ta6fb
> +  a6ob      ta6ob
> +  a6nb      ta6nb
> +  a6s2      ta6s2
> +  ppc32osx  tppc32osx
> +  ppc32le   tppc32le
> +  ppc32fb   tppc32fb
> +  ppc32ob   tppc32ob
> +  ppc32nb   tppc32nb
> +  arm32le   tarm32le
> +  arm32fb   tarm32fb
> +  arm32ob   tarm32ob
> +  arm32nb   tarm32nb
> +  arm64nt   tarm64nt
> +  arm64osx  tarm64osx
> +  arm64le   tarm64le
> +  arm64fb   tarm64fb
> +  arm64ob   tarm64ob
> +  arm64nb   tarm64nb
> +  rv64le    trv64le
> +  rv64fb    trv64fb
> +  rv64ob    trv64ob
> +  rv64nb    trv64nb
> +  la64le    tla64le
> +)
>  
>  (define* (nix-system->pbarch-machine-type #:optional
>                                            (system
>                                             (or (%current-target-
> system)
>                                                 (%current-system)))
>                                            #:key (threads? #t))
> -  "Return a string naming the pseudo–machine type used by Racket's
> variant of
> -Chez Scheme to represent the appropriate ``pbarch'' backend for
> SYSTEM: that
> -is, the ``portable bytecode'' backend specialized for SYSTEM's word
> size and
> -endianness.  The result will name the threaded machine type unless
> THREADS? is
> -provided and is #f."
> +  "Return a string naming the Chez Scheme machine type of the
> appropriate
> +``pbarch'' backend for SYSTEM: that is, the ``portable bytecode''
> backend
> +specialized for SYSTEM's word size and endianness.  The result will
> name the
> +threaded machine type unless THREADS? is provided as #f."
>    (string-append (if threads?
>                       "t"
>                       "")
> @@ -243,20 +201,23 @@ (define* (nix-system->pbarch-machine-type
> #:optional
>                       "l"
>                       "b")))
>  
> -(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?  If
> -so, return the applicable machine type as a string.  Otherwise, when
> SYSTEM
> -can use only the ``portable bytecode'' backends, return #f."
> -  (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 <>))
> -         (string-append "t" chez-arch chez-os))))
> -
> +(define* (nix-system->native-chez-machine-type #:optional
> +                                               (system
> +                                                (or (%current-
> target-system)
> +                                                    (%current-
> system)))
> +                                               #:key (threads? #t))
> +  "Return a string naming the Chez Scheme machine type of the
> native-code
> +backend for SYSTEM, if such a native-code backend exists. 
> Otherwise, when
> +SYSTEM can use only the ``portable bytecode'' backends, return #f. 
> The result
> +will name the threaded machine type unless THREADS? is provided as
> #f."
> +  (let* ((chez-arch (target-chez-arch system))
> +         (chez-os (target-chez-os system))
> +         (machine
> +          (and chez-arch chez-os
> +               (string-append (if threads? "t" "") chez-arch chez-
> os))))
> +    (and machine
> +         (memq (string->symbol machine) %machine-types)
> +         machine)))
>  ;;
>  ;; Chez Scheme:
>  ;;
> @@ -300,7 +261,7 @@ (define-public chez-scheme-for-racket
>      (version "9.9.9-pre-release.23")
>      (source #f)
>      (build-system gnu-build-system)
> -    (inputs `(,@(if (racket-cs-native-supported-system?)
> +    (inputs `(,@(if (nix-system->native-chez-machine-type)
>                      '()
>                      (list libffi))
>                ,chez-scheme-for-racket-bootstrap-bootfiles
> @@ -353,10 +314,10 @@ (define-public chez-scheme-for-racket
>                   (search-input-directory %build-inputs
> "/include/X11"))
>                  '()
>                  '("--disable-x11"))
> -          #$(string-append "-m=" (or (racket-cs-native-supported-
> system?)
> +          #$(string-append "-m=" (or (nix-system->native-chez-
> machine-type)
>                                       (nix-system->pbarch-machine-
> type)))
>            ;; ^ could skip -m= for non-cross non-pbarch builds
> -          #$@(if (racket-cs-native-supported-system?)
> +          #$@(if (nix-system->native-chez-machine-type)
>                   #~()
>                   ;; not inferred on non-native platforms: see
>                   ;; https://racket.discourse.group/t/950/9
> @@ -588,7 +549,7 @@ (define-public chez-scheme-for-racket-bootstrap-
> bootfiles
>                      (invoke "./configure"
>                              "--force" ; don't complain about missing
> bootfiles
>                              #$(string-append
> -                               "-m=" (or (racket-cs-native-
> supported-system?)
> +                               "-m=" (or (nix-system->native-chez-
> machine-type)
>                                           (nix-system->pbarch-
> machine-type)))
>                              "ZUO=zuo"
>                              ;; ignore submodules:
> diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
> index d366f89845..f50f6f3eab 100644
> --- a/gnu/packages/racket.scm
> +++ b/gnu/packages/racket.scm
> @@ -433,7 +433,7 @@ (define-public racket-vm-cs
>      (inputs
>       (let ((inputs (modify-inputs (package-inputs racket-vm-cgc)
>                       (prepend zlib lz4))))
> -       (if (racket-cs-native-supported-system?)
> +       (if (nix-system->native-chez-machine-type)
>             (modify-inputs inputs
>               (delete "libffi"))
>             inputs)))
> @@ -461,7 +461,7 @@ (define-public racket-vm-cs
>                                  #+(this-package-native-input
>                                     "chez-scheme-for-racket")
>                                  "/bin/scheme")
> -                 #$@(if (racket-cs-native-supported-system?)
> +                 #$@(if (nix-system->native-chez-machine-type)
>                          #~()
>                          #~(#$(string-append "--enable-mach="
>                                              (nix-system->pbarch-
> machine-type))
Cheers

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH v2 3/8] gnu: chez-scheme: Reorganize package definitions.
  2024-04-01 15:40             ` Liliana Marie Prikler
@ 2024-04-02  3:59               ` Philip McGrath
  0 siblings, 0 replies; 39+ messages in thread
From: Philip McGrath @ 2024-04-02  3:59 UTC (permalink / raw)
  To: Liliana Marie Prikler, 70065
  Cc: Katherine Cox-Buday, Andrew Tropin, Skyler Ferris

Hi Liliana,

On 4/1/24 11:40, Liliana Marie Prikler wrote:
> Am Montag, dem 01.04.2024 um 02:51 -0400 schrieb Philip McGrath:
>> A future commit will change 'chez-scheme' to inherit from
>> 'chez-scheme-for-racket', so 'chez-scheme-for-racket' will need to be
>> defined before 'chez-scheme'.  In an attempt to produce better diffs,
>> this commit re-orders the definitions while keeping their contents
>> exactly the same.
>>
>> * gnu/packages/chez.scm (chez-scheme): Move below
>> 'chez-scheme-for-racket'.
>> (chez-scheme-bootstrap-bootfiles): Move below
>> 'chez-scheme-for-racket-bootstrap-bootfiles'.
>>
>> Change-Id: Ie088abea2b44329f9d8399fbfb95c51d8912b05e
>> ---
> I don't understand this direction.  Why have chez-scheme inherit from
> chez-scheme-for-racket?  Even if Racket itself pins a particular
> version instead of an upstream release (which, let's face it, would be
> the wiser option here), or requires a special build (again, why?) I
> think keeping the inheritance in the other direction makes ontological
> sense moreso than whatever we're starting here.
> 
> Cheers

We will be using chez-scheme-for-racket to bootstrap chez-scheme. (For 
more rationale, see the comments added to chez.scm in [v2 8/8].) While 
it is possible to have package inheritance go in the opposite direction 
as bootstrapping, my experience before 
daa91a49b2914343afdfcdbea9a22c9d062ba185 was that it was very confusing 
and often triggered unnecessary rebuilds. In this case, it avoids 
potentially rebuilding the entire Racket world when there's a Chez 
Scheme release. (Bootstrapping chez-scheme really does depend on at 
least racket-vm-bc, so we can't avoid rebuilding the Chez Scheme world 
when there's a Racket release.)

Matthew Flatt wrote in <https://racket.discourse.group/t/2739/3>:

> I imagine that Racket's copy of Chez Scheme will be more
> conventionally vendored and aligned with Chez Scheme releases one day,
> but I don't think we're ready to move to that mode in the near future.

I wasn't involved in his efforts together with the other Chez Scheme 
maintainers to merge Racket's changes and to keep development in sync 
going forward, but offhand I can think of both social and technical 
reasons that the approach they've chosen for now makes sense to me.

Thanks,
Philip




^ permalink raw reply	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH v2 7/8] gnu: chez-scheme: Update and simplify machine-type handling.
  2024-04-01 15:45             ` Liliana Marie Prikler
@ 2024-04-02  3:59               ` Philip McGrath
  0 siblings, 0 replies; 39+ messages in thread
From: Philip McGrath @ 2024-04-02  3:59 UTC (permalink / raw)
  To: Liliana Marie Prikler, 70065
  Cc: Katherine Cox-Buday, Andrew Tropin, Skyler Ferris

Hi Liliana,

On 4/1/24 11:45, Liliana Marie Prikler wrote:
> Am Montag, dem 01.04.2024 um 02:51 -0400 schrieb Philip McGrath:
>> Since Chez Scheme 10.0.0 supports all of the backends added in
>> Racket's
>> branch, the complexity of '%chez-features-table' is no longer needed.
>> Ideally, even more of this logic could be maintained upstream, but
>> this
>> change will simplify maintenance in the mean time.
>>
 >> [...]
>>
>> +(define-syntax define-machine-types
>> +  (lambda (stx)
>> +    (syntax-case stx (any)
>> +      ((_ any id0 id ...)
>> +       #`(define #,(datum->syntax #'id0 '%machine-types)
>> +           '(id0 id ...))))))
> The datum->syntax call here looks weird.

It is a little unusual. The goal is to be able to copy the *use* of 
define-machine-types directly from the Chez Scheme source code, making 
it easier to update in the future. The datum->syntax call is needed to 
synthesize an identifier that will bind in the surrounding context.

>> +;; The following is copied from s/cmacros.ss, line 36, in the Chez
>> source
>> +(define-machine-types
>> +  any
>> +  pb        tpb
> You should maybe comment ;; unthreaded    threaded

I wouldn't mind that if you think it would be useful, though I'd rather 
not do a v3 just for this. If someone does want to add it, I'd strongly 
prefer for the comment to outside of the define-machine-types 
S-expression so the use stays exactly as in the Chez source.

>> +  pb32l     tpb32l
>> +  pb32b     tpb32b
>> +  pb64l     tpb64l
>> +  pb64b     tpb64b
>> +  i3nt      ti3nt
>> +  i3osx     ti3osx
>> +  i3le      ti3le
>> +  i3fb      ti3fb
>> +  i3ob      ti3ob
>> +  i3nb      ti3nb
>> +  i3s2      ti3s2
>> +  i3qnx     ti3qnx
>> +  i3gnu     ti3gnu
>> +  a6nt      ta6nt
>> +  a6osx     ta6osx
>> +  a6le      ta6le
>> +  a6fb      ta6fb
>> +  a6ob      ta6ob
>> +  a6nb      ta6nb
>> +  a6s2      ta6s2
>> +  ppc32osx  tppc32osx
>> +  ppc32le   tppc32le
>> +  ppc32fb   tppc32fb
>> +  ppc32ob   tppc32ob
>> +  ppc32nb   tppc32nb
>> +  arm32le   tarm32le
>> +  arm32fb   tarm32fb
>> +  arm32ob   tarm32ob
>> +  arm32nb   tarm32nb
>> +  arm64nt   tarm64nt
>> +  arm64osx  tarm64osx
>> +  arm64le   tarm64le
>> +  arm64fb   tarm64fb
>> +  arm64ob   tarm64ob
>> +  arm64nb   tarm64nb
>> +  rv64le    trv64le
>> +  rv64fb    trv64fb
>> +  rv64ob    trv64ob
>> +  rv64nb    trv64nb
>> +  la64le    tla64le
>> +)
>>   

Thanks,
Philip




^ permalink raw reply	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH 4/6] gnu: chez-scheme: Update to 10.0.0.
  2024-03-31 20:17         ` Philip McGrath
@ 2024-04-02 14:55           ` Skyler Ferris via Guix-patches via
  0 siblings, 0 replies; 39+ messages in thread
From: Skyler Ferris via Guix-patches via @ 2024-04-02 14:55 UTC (permalink / raw)
  To: Philip McGrath, 70065
  Cc: Katherine Cox-Buday, Liliana Marie Prikler, Andrew Tropin

On 3/31/24 13:17, Philip McGrath wrote:
>> The loko.scm file was not recompiled so it searched chez.scm for a
>> variable named chez-scheme-for-system, which is now a syntax
>> transformer. But compiled files have already completed the expansion
>> phase, so this means that a syntax transformer is invalid. This will not
>> cause a problem for `guix pull` because guix rebuilds itself from
>> scratch when it gets updated.
>>
>
> On 3/31/24 10:35, Skyler Ferris wrote:
>   > I haven't worked with define-deprecated before. It's a macro, and I know
>   > that the guile compiler misses recompiling macro dependencies sometimes,
>   > so maybe it was a problem on my end with having mismatching build
>   > artifacts.
>
> Very interesting! I hadn't realized that problem with dependency
> tracking existed: it might explain some issues I've struggled to
> reproduce in the past. It's also given me several surprises about
> Guile's implementation of phases: for one thing, apparently
> (define-syntax x 42) expands to (define x (make-syntax-transformer 'x
> 'macro 42)). I wouldn't have expected a macro to create a value that
> would exist at runtime.
Exists yes, but it (should not be) used/referenced at runtime. I'm going 
to type some more details in case you are interested, but an important 
disclaimer is that my understanding comes from reading documentation on 
an as-needed basis and doing some work writing macros, but not a lot. I 
haven't worked with the code that actually implements these things.

I'm not sure how other schemes implement this, but Guile has a clearly 
defined separation between "compile time" and "load time". Compilation 
is when syntax transformers are used to modify source expressions into 
the expanded form (in addition to other things, like lowering to 
intermediate representations). This is discussed in the documentation 
for eval-when (1). If I define that macro and then use it within the 
same file, the place where it is used will not contain a reference to 
the syntax transformer: it will already be expanded. If I write a new 
file tomorrow which wants to use that macro, Guile will reference the 
compiled version of the module. If the syntax transformer was not 
present in the compiled module then the new file would break. Instead, 
the syntax transformer still exists in the compiled version of the file 
so that the new module can load it at expansion time. But again, once 
the new file is compiled the reference to the macro will disappear. So 
it exists at runtime, but it is only used when compiling code. For 
compiled files, it is not used at runtime. The exception is that when 
code is evaluated at the REPL, or if auto-compilation is disabled, there 
is no practical difference between compile time and load time.

I'm not entirely sure why the compiler doesn't see the dependency here. 
The section on compilation (2) says "Guile does not yet do proper 
dependency tracking" so I assume that it just hasn't been high priority 
enough for anyone to fix it. There would be trade-offs in some cases. In 
this case it is pretty easy to see that the file needs to be recompiled 
because loko.go (the compiled version of the file) contains an explicit 
reference to the macro, because it used to be a procedure. But if it was 
a macro both before and after the change the reference would not be 
there. We could add the list of macros used during compilation as 
metadata to the file but I don't know how much bloat that would cause. 
We could also reference the use-module forms in the original source, but 
I'm not sure if those are typically available in the go files or if that 
would also need to be tracked as additional metadata.

(1) https://www.gnu.org/software/guile/manual/html_node/Eval-When.html
(2) https://www.gnu.org/software/guile/manual/html_node/Compilation.html





^ permalink raw reply	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH v2 2/8] gnu: racket: Update to 8.12.
  2024-04-01  6:51           ` [bug#70065] [PATCH v2 2/8] gnu: racket: Update to 8.12 Philip McGrath
@ 2024-04-09  8:46             ` Efraim Flashner
  2024-04-11 10:44               ` Ludovic Courtès
  0 siblings, 1 reply; 39+ messages in thread
From: Efraim Flashner @ 2024-04-09  8:46 UTC (permalink / raw)
  To: Philip McGrath
  Cc: Katherine Cox-Buday, 70065, Liliana Marie Prikler, Skyler Ferris,
	Andrew Tropin

[-- Attachment #1: Type: text/plain, Size: 8115 bytes --]

On Mon, Apr 01, 2024 at 02:51:07AM -0400, Philip McGrath wrote:
> All of Racket's changes to Chez Scheme have been merged upstream.  They
> are the basis for the Chez Scheme 10.0.0 release.  For the forseeable
> future, Racket will continue to depend on a specific pre-release
> version of Chez Scheme as part of Racket's "ABI": see upstream
> discussion at <https://racket.discourse.group/t/2739/3>.
...
> (chez-scheme-for-racket-bootstrap-bootfiles): Stop inheriting from
> 'chez-scheme-bootstrap-bootfiles'.
> [arguments]: Rewrite without inheritance. Use `make cross.boot` instead
> of broken experimental script for cross builds.
> [home-page]: Use bootstrapping Racket package instead of archived Git
> repository.
> [description]: Rewrite to reflect upstreaming of Racket's changes to
> Chez Scheme.
> @@ -646,58 +725,70 @@ (define-public chez-scheme-bootstrap-bootfiles
...
>  
>  (define-public chez-scheme-for-racket-bootstrap-bootfiles
>    (package
> -    (inherit chez-scheme-bootstrap-bootfiles)
>      (name "chez-scheme-for-racket-bootstrap-bootfiles")
>      (version (package-version chez-scheme-for-racket))
>      (source #f) ; avoid problematic cycle with racket.scm
>      (native-inputs
> -     (cons* chez-nanopass-bootstrap
> -            (if (%current-target-system)
> -                (list zuo
> -                      chez-scheme-for-racket)
> -                (list racket-vm-bc))))
> +     (cons chez-nanopass-bootstrap
> +           (if (%current-target-system)
> +               (list zuo
> +                     chez-scheme-for-racket)
> +               (list racket-vm-bc))))
> +    (build-system copy-build-system)
>      (arguments
> -     (substitute-keyword-arguments
> -         (package-arguments chez-scheme-bootstrap-bootfiles)
> -       ((#:phases those-phases #~%standard-phases)
> -        #~(let* ((those-phases #$those-phases)
> -                 (unpack (assoc-ref those-phases 'unpack)))
> -            (modify-phases those-phases
> -              (replace 'unpack
> -                (lambda args
> -                  (unpack #:source #$(or (package-source this-package)
> -                                         (package-source racket-vm-bc)))))
> -              (add-after 'unpack 'chdir
> -                (lambda args
> -                  (chdir "racket/src/ChezScheme")))
> -              (add-after 'chdir 'unpack-nanopass+stex
> -                (lambda args
> -                  #$unpack-nanopass+stex))
> -              (add-before 'install 'build
> -                (lambda* (#:key native-inputs inputs #:allow-other-keys)
> -                  #$(cond
> -                     ((%current-target-system)
> -                      ;; cross-compiling
> -                      #~(invoke
> -                         (search-input-file (or native-inputs inputs)
> -                                            "/bin/zuo")
> -                         "makefiles/boot.zuo"
> -                         (search-input-file (or native-inputs inputs)
> -                                            "/bin/scheme")
> -                         #$(or (racket-cs-native-supported-system?)
> -                               (nix-system->pbarch-machine-type))))
> -                     (else
> -                      ;; bootstrapping
> -                      #~(invoke
> -                         (search-input-file (or native-inputs inputs)
> -                                            "/opt/racket-vm/bin/racket")
> -                         "../rktboot/main.rkt"))))))))))
> -    (supported-systems
> -     (package-supported-systems chez-scheme-for-racket))
> -    (home-page "https://github.com/racket/ChezScheme")
> -    ;; ^ This is downstream of https://github.com/racket/racket,
> -    ;; but it's designed to be a friendly landing place for people
> -    ;; who want a ChezScheme-shaped repositroy.
> +     (list
> +      #:install-plan
> +      #~`(("boot/" "lib/chez-scheme-bootfiles"))
> +      #:phases
> +      #~(modify-phases %standard-phases
> +          (replace 'unpack
> +            (let ((unpack (assoc-ref %standard-phases 'unpack)))
> +              (lambda args
> +                (unpack #:source #$(or (package-source this-package)
> +                                       (package-source racket-vm-bc))))))
> +          (add-after 'unpack 'unpack-nanopass
> +            #$unpack-nanopass)
> +          (add-after 'unpack-nanopass 'chdir
> +            (lambda args
> +              (chdir "racket/src/ChezScheme")))
> +          (add-before 'install 'build
> +            #$(cond
> +               ((%current-target-system)
> +                ;; cross-compiling
> +                ;; TODO: share more of this with upstream, once we figure out
> +                ;; how best to manage running Chez as a cross-compiler and the
> +                ;; unfortate cycle with %racket-origin.
> +                #~(lambda* (#:key native-inputs inputs (parallel-build? #t)
> +                            #:allow-other-keys)
> +                    (invoke "./configure"
> +                            "--force" ; don't complain about missing bootfiles
> +                            #$(string-append
> +                               "-m=" (or (racket-cs-native-supported-system?)
> +                                         (nix-system->pbarch-machine-type)))
> +                            "ZUO=zuo"
> +                            ;; ignore submodules:
> +                            "ZLIB=-lz"
> +                            "LZ4=-llz4"
> +                            "STEXLIB=/GuixNotUsingStex")
> +                    (apply invoke
> +                           "make"
> +                           `(,@(if parallel-build?
> +                                   `("-j" ,(number->string
> +                                            (parallel-job-count)))
> +                                   '())
> +                             ,(string-append "SCHEME="
> +                                             (search-input-file
> +                                              (or native-inputs inputs)
> +                                              "/bin/scheme"))
> +                             "cross.boot"))))
> +               (else
> +                ;; bootstrapping
> +                #~(lambda* (#:key native-inputs inputs #:allow-other-keys)
> +                    (invoke
> +                     (search-input-file (or native-inputs inputs)
> +                                        "/opt/racket-vm/bin/racket")
> +                     "../rktboot/main.rkt"))))))))
> +    (home-page "https://pkgs.racket-lang.org/package/cs-bootstrap")
>      (synopsis "Chez Scheme bootfiles bootstrapped by Racket")
>      (description "Chez Scheme is a self-hosting compiler: building it
>  requires ``bootfiles'' containing the Scheme-implemented portions compiled for

chez-scheme-for-racket-bootstrap timed out due to 3600 seconds of
silence on riscv64-linux. I'm building it again with allowing for a
longer silent period.

chez-scheme-for-racket-bootstrap fails in the 'build phase on
powerpc-linux.  This is the same way that it fails on master, so there
is no regression here.

starting phase `build'
error: in phase 'build': uncaught exception:
%exception #<&invoke-error program: "/gnu/store/1q72i8fv2fnf5q2rscahdy90jiigym42-racket-vm-bc-8.12/opt/racket-vm/bin/racket" arguments: ("../rktboot/main.rkt") exit-status: #f term-signal: 6 stop-signal: #f>
phase `build' failed after 0.4 seconds
command "/gnu/store/1q72i8fv2fnf5q2rscahdy90jiigym42-racket-vm-bc-8.12/opt/racket-vm/bin/racket" "../rktboot/main.rkt" failed with signal 6
builder for `/gnu/store/hcccfsv6n1llkqgv98y8sk1wywflnk59-chez-scheme-for-racket-bootstrap-bootfiles-9.9.9-pre-release.23.drv' failed with exit code 1

-- 
Efraim Flashner   <efraim@flashner.co.il>   רנשלפ םירפא
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH v2 2/8] gnu: racket: Update to 8.12.
  2024-04-09  8:46             ` Efraim Flashner
@ 2024-04-11 10:44               ` Ludovic Courtès
  2024-04-11 12:34                 ` Efraim Flashner
  0 siblings, 1 reply; 39+ messages in thread
From: Ludovic Courtès @ 2024-04-11 10:44 UTC (permalink / raw)
  To: Efraim Flashner
  Cc: 70065, Philip McGrath, Katherine Cox-Buday, Liliana Marie Prikler,
	Andrew Tropin, Skyler Ferris

Efraim Flashner <efraim@flashner.co.il> skribis:

> chez-scheme-for-racket-bootstrap timed out due to 3600 seconds of
> silence on riscv64-linux. I'm building it again with allowing for a
> longer silent period.

Hi Efraim!  Did it eventually pass?

I’d rather not have it block the patch set since it’s all green
elsewhere:

  https://qa.guix.gnu.org/issue/70065

Ludo’.




^ permalink raw reply	[flat|nested] 39+ messages in thread

* bug#70065: [PATCH v2 0/8] Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9.
  2024-04-01  6:51         ` [bug#70065] [PATCH v2 0/8] Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9 Philip McGrath
                             ` (7 preceding siblings ...)
  2024-04-01  6:51           ` [bug#70065] [PATCH v2 8/8] gnu: chez-scheme: Bootstrap from source Philip McGrath
@ 2024-04-11 10:55           ` Ludovic Courtès
  8 siblings, 0 replies; 39+ messages in thread
From: Ludovic Courtès @ 2024-04-11 10:55 UTC (permalink / raw)
  To: Philip McGrath
  Cc: Andrew Tropin, Katherine Cox-Buday, 70065-done, Skyler Ferris,
	Liliana Marie Prikler

Hello,

Philip McGrath <philip@philipmcgrath.com> skribis:

> Here is v2!
>
> In the second patch, I tweaked the comments based on discussion with Skyler.
>
> To be extra careful about the deprecation of chez-scheme-for-system, I split
> the former [4/6] into:
>
>   * [v2 4/8], which just changes the return value;
>   * [v2 5/8], which changes to define-deprecated; and
>   * [v2 6/8], which updates the uses.
>
> I checked after that all the dependents built and that deprecation warnings
> were shown after [v2 5/8] (and not anywhere else!).

I went ahead and applied v2.  Thank you and thanks to Liliana and Skyler
for reviewing!

Ludo’.




^ permalink raw reply	[flat|nested] 39+ messages in thread

* [bug#70065] [PATCH v2 2/8] gnu: racket: Update to 8.12.
  2024-04-11 10:44               ` Ludovic Courtès
@ 2024-04-11 12:34                 ` Efraim Flashner
  0 siblings, 0 replies; 39+ messages in thread
From: Efraim Flashner @ 2024-04-11 12:34 UTC (permalink / raw)
  To: Ludovic Courtès
  Cc: 70065, Philip McGrath, Katherine Cox-Buday, Liliana Marie Prikler,
	Andrew Tropin, Skyler Ferris

Yes, it built successfully in the end. I didn't check how long the time was but doubling it to two hours should be plenty. 


On April 11, 2024 10:44:41 AM UTC, "Ludovic Courtès" <ludo@gnu.org> wrote:
>Efraim Flashner <efraim@flashner.co.il> skribis:
>
>> chez-scheme-for-racket-bootstrap timed out due to 3600 seconds of
>> silence on riscv64-linux. I'm building it again with allowing for a
>> longer silent period.
>
>Hi Efraim!  Did it eventually pass?
>
>I’d rather not have it block the patch set since it’s all green
>elsewhere:
>
>  https://qa.guix.gnu.org/issue/70065
>
>Ludo’.

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.




^ permalink raw reply	[flat|nested] 39+ messages in thread

end of thread, other threads:[~2024-04-11 12:35 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-29  5:15 [bug#70065] [PATCH 0/6] gnu: Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9 Philip McGrath
2024-03-29  5:18 ` [bug#70065] [PATCH 1/6] gnu: zuo: Update to 1.9 Philip McGrath
2024-03-30 14:31   ` Skyler Ferris via Guix-patches via
2024-03-29  5:18 ` [bug#70065] [PATCH 2/6] gnu: racket: Update to 8.12 Philip McGrath
2024-03-30 14:35   ` Skyler Ferris via Guix-patches via
2024-03-30 22:10     ` Philip McGrath
2024-03-29  5:18 ` [bug#70065] [PATCH 3/6] gnu: chez-scheme: Reorganize package definitions Philip McGrath
2024-03-30 14:35   ` Skyler Ferris via Guix-patches via
2024-03-29  5:18 ` [bug#70065] [PATCH 4/6] gnu: chez-scheme: Update to 10.0.0 Philip McGrath
2024-03-30  7:56   ` Liliana Marie Prikler
2024-03-30 14:39   ` Skyler Ferris via Guix-patches via
2024-03-30 22:49     ` Philip McGrath
2024-03-31 14:35       ` Skyler Ferris via Guix-patches via
2024-03-31 15:28       ` Skyler Ferris via Guix-patches via
2024-03-31 20:17         ` Philip McGrath
2024-04-02 14:55           ` Skyler Ferris via Guix-patches via
2024-04-01  6:51         ` [bug#70065] [PATCH v2 0/8] Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9 Philip McGrath
2024-04-01  6:51           ` [bug#70065] [PATCH v2 1/8] gnu: zuo: Update to 1.9 Philip McGrath
2024-04-01  6:51           ` [bug#70065] [PATCH v2 2/8] gnu: racket: Update to 8.12 Philip McGrath
2024-04-09  8:46             ` Efraim Flashner
2024-04-11 10:44               ` Ludovic Courtès
2024-04-11 12:34                 ` Efraim Flashner
2024-04-01  6:51           ` [bug#70065] [PATCH v2 3/8] gnu: chez-scheme: Reorganize package definitions Philip McGrath
2024-04-01 15:40             ` Liliana Marie Prikler
2024-04-02  3:59               ` Philip McGrath
2024-04-01  6:51           ` [bug#70065] [PATCH v2 4/8] gnu: chez-scheme: Update to 10.0.0 Philip McGrath
2024-04-01  6:51           ` [bug#70065] [PATCH v2 5/8] gnu: Deprecate chez-scheme-for-system.in favor of chez-scheme Philip McGrath
2024-04-01  6:51           ` [bug#70065] [PATCH v2 6/8] gnu: Fix uses of deprecated chez-scheme-for-system Philip McGrath
2024-04-01 15:41             ` Liliana Marie Prikler
2024-04-01  6:51           ` [bug#70065] [PATCH v2 7/8] gnu: chez-scheme: Update and simplify machine-type handling Philip McGrath
2024-04-01 15:45             ` Liliana Marie Prikler
2024-04-02  3:59               ` Philip McGrath
2024-04-01  6:51           ` [bug#70065] [PATCH v2 8/8] gnu: chez-scheme: Bootstrap from source Philip McGrath
2024-04-11 10:55           ` bug#70065: [PATCH v2 0/8] Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9 Ludovic Courtès
2024-03-29  5:18 ` [bug#70065] [PATCH 5/6] gnu: chez-scheme: Update and simplify machine-type handling Philip McGrath
2024-03-30 14:40   ` Skyler Ferris via Guix-patches via
2024-03-29  5:18 ` [bug#70065] [PATCH 6/6] gnu: chez-scheme: Bootstrap from source Philip McGrath
2024-03-30 14:41   ` Skyler Ferris via Guix-patches via
2024-03-30 14:28 ` [bug#70065] [PATCH 0/6] gnu: Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9 Skyler Ferris via Guix-patches via

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).