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")
