[PATCH 0/6] gnu: Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9.

  • Done
  • quality assurance status badge
Details
5 participants
  • Efraim Flashner
  • Liliana Marie Prikler
  • Ludovic Courtès
  • Philip McGrath
  • Skyler Ferris
Owner
unassigned
Submitted by
Philip McGrath
Severity
normal
P
P
Philip McGrath wrote on 29 Mar 06:15 +0100
(address . guix-patches@gnu.org)(name . Philip McGrath)(address . philip@philipmcgrath.com)
cover.1711688274.git.philip@philipmcgrath.com
Hi,

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

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
P
P
Philip McGrath wrote on 29 Mar 06:18 +0100
[PATCH 1/6] gnu: zuo: Update to 1.9.
(address . 70065@debbugs.gnu.org)
dfc9f189542e4562239f7eeb0a5bf05d6d6d7141.1711688274.git.philip@philipmcgrath.com
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%)

Toggle diff (313 lines)
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
P
P
Philip McGrath wrote on 29 Mar 06:18 +0100
[PATCH 2/6] gnu: racket: Update to 8.12.
(address . 70065@debbugs.gnu.org)
6b2db55dfe43979e28bd85d2999919419d56dd84.1711688274.git.philip@philipmcgrath.com
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

* 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

Toggle diff (373 lines)
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)
+
This message was truncated. Download the full message here.
P
P
Philip McGrath wrote on 29 Mar 06:18 +0100
[PATCH 3/6] gnu: chez-scheme: Reorganize package definitions.
(address . 70065@debbugs.gnu.org)
5c84a4bda522531288944d78c505c4328735ac5d.1711688274.git.philip@philipmcgrath.com
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(-)

Toggle diff (410 lines)
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
This message was truncated. Download the full message here.
P
P
Philip McGrath wrote on 29 Mar 06:18 +0100
[PATCH 5/6] gnu: chez-scheme: Update and simplify machine-type handling.
(address . 70065@debbugs.gnu.org)
1b01392a622c3ba51360ffccfa1746738fc39837.1711688274.git.philip@philipmcgrath.com
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(-)

Toggle diff (282 lines)
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
P
P
Philip McGrath wrote on 29 Mar 06:18 +0100
[PATCH 6/6] gnu: chez-scheme: Bootstrap from source.
(address . 70065@debbugs.gnu.org)
d7d04dfb1c71c7e52caeee7ce41ae11bbe8b0a05.1711688274.git.philip@philipmcgrath.com
* 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(-)

Toggle diff (223 lines)
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
P
P
Philip McGrath wrote on 29 Mar 06:18 +0100
[PATCH 4/6] gnu: chez-scheme: Update to 10.0.0.
(address . 70065@debbugs.gnu.org)
dfda42863f9d5d7128025f87ac423971d6158a2c.1711688274.git.philip@philipmcgrath.com
* 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

Toggle diff (421 lines)
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
This message was truncated. Download the full message here.
L
L
Liliana Marie Prikler wrote on 30 Mar 08:56 +0100
8a2d805ad3c7bbed6c2c778837e8548c505fcef0.camel@gmail.com
Am Freitag, dem 29.03.2024 um 01:18 -0400 schrieb Philip McGrath:
Toggle quote (7 lines)
> * 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?

Toggle quote (18 lines)
> [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
S
S
Skyler Ferris wrote on 30 Mar 15:28 +0100
Re: [bug#70065] [PATCH 0/6] gnu: Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9.
053c4001-5bab-4077-abb6-b883e7b053d2@protonmail.com
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).

Toggle quote (3 lines)
> 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!

Toggle quote (8 lines)
> 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
S
S
Skyler Ferris wrote on 30 Mar 15:31 +0100
Re: [bug#70065] [PATCH 1/6] gnu: zuo: Update to 1.9.
fcd85e9f-5d38-40f6-a5b9-a46629e8b66e@protonmail.com
No comments on this patch; looks fine.
S
S
Skyler Ferris wrote on 30 Mar 15:35 +0100
Re: [bug#70065] [PATCH 2/6] gnu: racket: Update to 8.12.
1b795f9e-bcef-4b14-8ae3-0b69c79d51f9@protonmail.com
On 3/28/24 22:18, Philip McGrath wrote:
Toggle quote (22 lines)
> +(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?
Toggle quote (2 lines)
> + ;; 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.
S
S
Skyler Ferris wrote on 30 Mar 15:35 +0100
Re: [bug#70065] [PATCH 3/6] gnu: chez-scheme: Reorganize package definitions.
d00fc04c-b163-42b1-bde9-5333ea4c7f2e@protonmail.com
No comments on this patch, other than appreciation for making diffs
readable. =)
S
S
Skyler Ferris wrote on 30 Mar 15:39 +0100
Re: [bug#70065] [PATCH 4/6] gnu: chez-scheme: Update to 10.0.0.
1f2ac17f-8095-41b7-a0c3-db6487d74aea@protonmail.com
On 3/28/24 22:18, Philip McGrath wrote:
Toggle quote (19 lines)
> -(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.
S
S
Skyler Ferris wrote on 30 Mar 15:40 +0100
Re: [bug#70065] [PATCH 5/6] gnu: chez-scheme: Update and simplify machine-type handling.
e77a6fdc-c874-436d-b934-c0bc8ccb2d6f@protonmail.com
No comments on this patch; looks good.
S
S
Skyler Ferris wrote on 30 Mar 15:41 +0100
Re: [bug#70065] [PATCH 6/6] gnu: chez-scheme: Bootstrap from source.
21cedad0-6d33-40a0-9b91-4d91408b3187@protonmail.com
No comments on this patch; looks good.
P
P
Philip McGrath wrote on 30 Mar 23:10 +0100
Re: [bug#70065] [PATCH 2/6] gnu: racket: Update to 8.12.
4dce3077-f540-43f0-902b-b74f77ef9eb8@philipmcgrath.com
Hi Skyler,

On 3/30/24 10:35, Skyler Ferris wrote:
Toggle quote (26 lines)
> 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.

Toggle quote (6 lines)
>> + ;; 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
P
P
Philip McGrath wrote on 30 Mar 23:49 +0100
Re: [bug#70065] [PATCH 4/6] gnu: chez-scheme: Update to 10.0.0.
de10aef3-612e-4b6a-895f-d1dacdecaf59@philipmcgrath.com
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
>

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:
Toggle quote (33 lines)
> 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.

Toggle quote (7 lines)
>
> 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
S
S
Skyler Ferris wrote on 31 Mar 16:35 +0200
bd0f7e4f-19fd-430d-8511-1a83265f5626@protonmail.com
On 3/30/24 15:49, Philip McGrath wrote:
Toggle quote (14 lines)
> 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>
S
S
Skyler Ferris wrote on 31 Mar 17:28 +0200
aa26e895-4326-44ba-b15d-4609370d4bc3@protonmail.com
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:
Toggle quote (72 lines)
> 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>
>
P
P
Philip McGrath wrote on 31 Mar 22:17 +0200
4cef86be-421e-4010-939b-5640764fcf3e@philipmcgrath.com
Hi Skyler,

On 3/31/24 11:28, Skyler Ferris wrote:
Toggle quote (3 lines)
> 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!

Toggle quote (10 lines)
>
> 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
P
P
Philip McGrath wrote on 1 Apr 08:51 +0200
[PATCH v2 0/8] Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9.
(address . 70065@debbugs.gnu.org)
cover.1711953507.git.philip@philipmcgrath.com
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
P
P
Philip McGrath wrote on 1 Apr 08:51 +0200
[PATCH v2 1/8] gnu: zuo: Update to 1.9.
(address . 70065@debbugs.gnu.org)
dfc9f189542e4562239f7eeb0a5bf05d6d6d7141.1711953507.git.philip@philipmcgrath.com
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%)

Toggle diff (313 lines)
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
P
P
Philip McGrath wrote on 1 Apr 08:51 +0200
[PATCH v2 2/8] gnu: racket: Update to 8.12.
(address . 70065@debbugs.gnu.org)
d57255760c875d07e84b9eef5ee575de73940ca6.1711953507.git.philip@philipmcgrath.com
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

* 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

Toggle diff (373 lines)
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)
+
This message was truncated. Download the full message here.
P
P
Philip McGrath wrote on 1 Apr 08:51 +0200
[PATCH v2 3/8] gnu: chez-scheme: Reorganize package definitions.
(address . 70065@debbugs.gnu.org)
92971b8c18a5d69577472b97c8b91b5319527049.1711953507.git.philip@philipmcgrath.com
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(-)

Toggle diff (410 lines)
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
This message was truncated. Download the full message here.
P
P
Philip McGrath wrote on 1 Apr 08:51 +0200
[PATCH v2 4/8] gnu: chez-scheme: Update to 10.0.0.
(address . 70065@debbugs.gnu.org)
71cc7e1a0040f51c7cc324b463c3647f59007b3f.1711953507.git.philip@philipmcgrath.com
* 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

Toggle diff (443 lines)
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 scrip
This message was truncated. Download the full message here.
P
P
Philip McGrath wrote on 1 Apr 08:51 +0200
[PATCH v2 5/8] gnu: Deprecate chez-scheme-for-system.in favor of chez-scheme.
(address . 70065@debbugs.gnu.org)
7e316efea684137afd211b2e882e1aef86067c06.1711953507.git.philip@philipmcgrath.com
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(-)

Toggle diff (24 lines)
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
P
P
Philip McGrath wrote on 1 Apr 08:51 +0200
[PATCH v2 6/8] gnu: Fix uses of deprecated chez-scheme-for-system.
(address . 70065@debbugs.gnu.org)
5dc380b0e8ec34c2682ef5e84d9fd4286037950a.1711953507.git.philip@philipmcgrath.com
(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(-)

Toggle diff (104 lines)
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
P
P
Philip McGrath wrote on 1 Apr 08:51 +0200
[PATCH v2 7/8] gnu: chez-scheme: Update and simplify machine-type handling.
(address . 70065@debbugs.gnu.org)
b0eac54fd3bfa14e92bad4b8e77239aefba0ea2d.1711953507.git.philip@philipmcgrath.com
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(-)

Toggle diff (282 lines)
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
P
P
Philip McGrath wrote on 1 Apr 08:51 +0200
[PATCH v2 8/8] gnu: chez-scheme: Bootstrap from source.
(address . 70065@debbugs.gnu.org)
577e7e3c1b367fc752c399d2a7ff140e8c258b71.1711953507.git.philip@philipmcgrath.com
* 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(-)

Toggle diff (223 lines)
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
L
L
Liliana Marie Prikler wrote on 1 Apr 17:40 +0200
Re: [PATCH v2 3/8] gnu: chez-scheme: Reorganize package definitions.
afcee5bf3215dc16b6d55bb449474e773fe08c86.camel@gmail.com
Am Montag, dem 01.04.2024 um 02:51 -0400 schrieb Philip McGrath:
Toggle quote (13 lines)
> 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
L
L
Liliana Marie Prikler wrote on 1 Apr 17:41 +0200
Re: [PATCH v2 6/8] gnu: Fix uses of deprecated chez-scheme-for-system.
ddad293c358205d9f96a7ac3d58099450b052172.camel@gmail.com
Am Montag, dem 01.04.2024 um 02:51 -0400 schrieb Philip McGrath:
Toggle quote (8 lines)
> (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
L
L
Liliana Marie Prikler wrote on 1 Apr 17:45 +0200
Re: [PATCH v2 7/8] gnu: chez-scheme: Update and simplify machine-type handling.
b43a4205641be9102892363d2e0241332ab56a39.camel@gmail.com
Am Montag, dem 01.04.2024 um 02:51 -0400 schrieb Philip McGrath:
Toggle quote (177 lines)
> 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.
Toggle quote (5 lines)
> +;; 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
Toggle quote (180 lines)
> +  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
P
P
Philip McGrath wrote on 2 Apr 05:59 +0200
Re: [PATCH v2 3/8] gnu: chez-scheme: Reorganize package definitions.
d7590a4c-fe6b-4881-a9bc-4c1fdc6afdef@philipmcgrath.com
Hi Liliana,

On 4/1/24 11:40, Liliana Marie Prikler wrote:
Toggle quote (23 lines)
> 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.)


Toggle quote (4 lines)
> 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
P
P
Philip McGrath wrote on 2 Apr 05:59 +0200
Re: [PATCH v2 7/8] gnu: chez-scheme: Update and simplify machine-type handling.
4efc12ac-8772-4173-8076-49aaddc84aac@philipmcgrath.com
Hi Liliana,

On 4/1/24 11:45, Liliana Marie Prikler wrote:
Toggle quote (8 lines)
> 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.
>>
>> [...]
Toggle quote (9 lines)
>>
>> +(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.

Toggle quote (7 lines)
>> +;; 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.

Toggle quote (43 lines)
>> +  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
S
S
Skyler Ferris wrote on 2 Apr 16:55 +0200
Re: [bug#70065] [PATCH 4/6] gnu: chez-scheme: Update to 10.0.0.
9c25eacc-4c7b-4b8d-99cf-4435301ae9f4@protonmail.com
On 3/31/24 13:17, Philip McGrath wrote:
Toggle quote (21 lines)
>> 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.

E
E
Efraim Flashner wrote on 9 Apr 10:46 +0200
Re: [bug#70065] [PATCH v2 2/8] gnu: racket: Update to 8.12.
(name . Philip McGrath)(address . philip@philipmcgrath.com)
ZhUAcvhyP7e5uLjE@3900XT
Attachment: file
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmYVAG8ACgkQQarn3Mo9
g1E0+Q//ZxrPkPH1mPP8QaxFXWnKvc/R7dQs7jwvdXPI/uHGaxQTiVUrqdEVaF7o
yVT9Z5EHvzgP/W3reey+U60kDrRx+bxuiZH2qdLmwMi+9HrM0zWNenQEIpCRwoh7
fNGj1cYSfKg3s24YR8lwXZmFO1Ab8uAY++yOL1ILbNislyw4bJGSntGfwR6D0We2
Cb8bhEvh8GiY2gVC7tGO1I3nbjvBg6SUWM4W5zEKrxpvRuiQ+zguS65bDs5Ir2LU
4EhuLCCqiEQ87i50LWpjx7JoqqIL5iG1NYwjXXWis13GYpbcwsOJTKuK3slmKrrP
otmgsH6HhkQATDGQYlShOUIvN8cYiNPaFEM1Jo2jcKqDSkZ8Yh5BLsBSN7ewKgaj
+BjV3QG4yeVMsCjvXXowKQ9ToLn+KomXciQ4IN75Y3a4X/itCJhn/m9mizzbO8tK
ucF07MJB98UffXT9bUlkiNh0sqsywtNVFREGdfqpVCOdy77nX7bwaTuo4+XprgKQ
RkSkPAq/L9rv2f0KHCkhbU/LiCQofcds5jCmceJV1mFyTm7Se7NWXFkmwrr9mQtg
16TDU/iTdz5u/MSQP84pWfGrKiYwpbkWM2nSS7eBf4vjK4MXBIuLYasrP5EDmsUJ
eIYcHNuN8zxilPrl6fkv0PQ72F14Bca/zvHqRaPt/btfO4ACFt4=
=7LgQ
-----END PGP SIGNATURE-----


L
L
Ludovic Courtès wrote on 11 Apr 12:44 +0200
(name . Efraim Flashner)(address . efraim@flashner.co.il)
87frvsgova.fsf@gnu.org
Efraim Flashner <efraim@flashner.co.il> skribis:

Toggle quote (4 lines)
> 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:


Ludo’.
L
L
Ludovic Courtès wrote on 11 Apr 12:55 +0200
Re: [bug#70065] [PATCH v2 0/8] Update to Racket 8.12, Chez Scheme 10, and Zuo 1.9.
(name . Philip McGrath)(address . philip@philipmcgrath.com)
87bk6ggocp.fsf@gnu.org
Hello,

Philip McGrath <philip@philipmcgrath.com> skribis:

Toggle quote (14 lines)
> 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’.
Closed
E
E
Efraim Flashner wrote on 11 Apr 14:34 +0200
Re: [bug#70065] [PATCH v2 2/8] gnu: racket: Update to 8.12.
(name . Ludovic Courtès)(address . ludo@gnu.org)
0A4A6FE6-7197-420E-97A0-904A3DCA0A5A@flashner.co.il
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:
Toggle quote (15 lines)
>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.
?
Your comment

This issue is archived.

To comment on this conversation send an email to 70065@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 70065
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch