[PATCH 0/6] gnu: Update Racket to 8.6. Add Zuo.

  • Done
  • quality assurance status badge
Details
8 participants
  • Thiago Jung Bauermann
  • Efraim Flashner
  • Liliana Marie Prikler
  • Liliana Marie Prikler
  • Ludovic Courtès
  • Maxime Devos
  • (
  • Philip McGrath
Owner
unassigned
Submitted by
Philip McGrath
Severity
normal
P
P
Philip McGrath wrote on 8 Aug 2022 08:06
(address . guix-patches@gnu.org)
cover.1659936550.git.philip@philipmcgrath.com
Hi,

This patch series contains the Racket 8.6 release, including updating Racket's
variant of Chez Scheme and adding a package for Zuo, the new tiny Racket-like
language used for build scripts starting with this release.

(If you've been waiting for the release announcement, this cycle upstream is
delaying sending it until the new Racket has finished rebuilding all
of https://docs.racket-lang.org, which can take a few days---but the release
itself is live at https://download.racket-lang.org already, and I've been
told distribution packagers should update now.)

As I mentioned on the mailing list in [1], this release lets us use Racket CS
and Racket's variant of Chez Scheme on all systems, even those for which the
compiler can not yet generate native code, such as powerpc64le-linux and
riscv64-linux. (See the relevant patches for more details.) In particular,
this means that we can now provide some Chez Scheme package for every system
Guix supports. Additionally, I resolved the issues I mentioned in [1] with
i586-pc-gnu by getting getting native code generation for the Hurd working in
Racket's Chez, and I've cherry-picked those patches in this series.

-Philip


Philip McGrath (6):
gnu: stex: Update to 1.2.2-2.afa6075.
gnu: stex: Fix read-only gifs and math directories.
gnu: chez-scheme: Fix use of "/bin/sh".
gnu: Update Racket to 8.6. Add Zuo.
gnu: racket: Use Racket CS on all systems.
gnu: chez-scheme-for-racket: Suport all systems.

gnu/local.mk | 10 +-
gnu/packages/chez.scm | 218 +++++--
gnu/packages/patches/chez-scheme-bin-sh.patch | 66 ++
.../racket-backport-8.6-cross-install.patch | 32 +
.../racket-backport-8.6-docindex-write.patch | 36 ++
.../patches/racket-backport-8.6-hurd.patch | 609 ++++++++++++++++++
.../patches/racket-backport-8.6-zuo.patch | 481 ++++++++++++++
.../patches/racket-chez-scheme-bin-sh.patch | 66 ++
...-rktio.patch => racket-rktio-bin-sh.patch} | 28 +-
gnu/packages/patches/racket-zuo-bin-sh.patch | 72 +++
.../stex-copy-from-immutable-store.patch | 41 ++
gnu/packages/racket.scm | 231 ++++---
12 files changed, 1760 insertions(+), 130 deletions(-)
create mode 100644 gnu/packages/patches/chez-scheme-bin-sh.patch
create mode 100644 gnu/packages/patches/racket-backport-8.6-cross-install.patch
create mode 100644 gnu/packages/patches/racket-backport-8.6-docindex-write.patch
create mode 100644 gnu/packages/patches/racket-backport-8.6-hurd.patch
create mode 100644 gnu/packages/patches/racket-backport-8.6-zuo.patch
create mode 100644 gnu/packages/patches/racket-chez-scheme-bin-sh.patch
rename gnu/packages/patches/{racket-minimal-sh-via-rktio.patch => racket-rktio-bin-sh.patch} (79%)
create mode 100644 gnu/packages/patches/racket-zuo-bin-sh.patch
create mode 100644 gnu/packages/patches/stex-copy-from-immutable-store.patch


base-commit: f0ae9da3210cc6d87ca519545203daf9751f3465
--
2.32.0
P
P
Philip McGrath wrote on 8 Aug 2022 08:10
[PATCH 1/6] gnu: stex: Update to 1.2.2-2.afa6075.
(address . 57050@debbugs.gnu.org)(name . Philip McGrath)(address . philip@philipmcgrath.com)
589dad1228cdf770746dd451e1531fc942867c6f.1659936550.git.philip@philipmcgrath.com
* gnu/packages/chez.scm (stex-bootstrap): Update to 1.2.2-2.afa6075.
---
gnu/packages/chez.scm | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

Toggle diff (26 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index b037efe8d4..043f2ae47a 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -594,8 +594,8 @@ (define-public chez-scheme-for-racket-bootstrap-bootfiles
(define-public stex-bootstrap
;; This commit includes a fix which we would otherwise want to use as
;; patch. Let's revert to tagged releases as soon as one becomes available.
- (let ((commit "54051494434a197772bf6ca5b4e6cf6be55f39a5")
- (revision "1"))
+ (let ((commit "afa607564a5662ffd748e824801277a6b5a3d11c")
+ (revision "2"))
(hidden-package
(package
(name "stex")
@@ -611,7 +611,7 @@ (define-public stex-bootstrap
(url "https://github.com/dybvig/stex")
(commit commit)))
(sha256
- (base32 "01jnvw8qw33gnpzwrakwhsr05h6b609lm180jnspcrb7lds2p23d"))
+ (base32 "0n6dryv5j7cw2qmsj55wqb0ph901h83a2hl4j891ppxp0xx18nkp"))
(file-name (git-file-name name version))
(snippet
#~(for-each delete-file
--
2.32.0
P
P
Philip McGrath wrote on 8 Aug 2022 08:10
[PATCH 2/6] gnu: stex: Fix read-only gifs and math directories.
(address . 57050@debbugs.gnu.org)(name . Philip McGrath)(address . philip@philipmcgrath.com)
c3c908bf65547727b14d319c14dc8e52c63ebd94.1659936550.git.philip@philipmcgrath.com
Excplicitly set the user write bit when initializing the gifs or math
directories from the skeletons installed in the store. See also upstream
discussion at https://github.com/dybvig/stex/pull/6. This problem
would be exposed by the upcoming changes to Racket's build system.

* gnu/packages/patches/stex-copy-from-immutable-store.patch: New patch.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/chez.scm (stex-bootstrap)[patches]: Use it.
[version]: Increment revision to 1.2.2-3.afa6075.
---
gnu/local.mk | 1 +
gnu/packages/chez.scm | 5 ++-
.../stex-copy-from-immutable-store.patch | 41 +++++++++++++++++++
3 files changed, 46 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/patches/stex-copy-from-immutable-store.patch

Toggle diff (84 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index a837d16e34..234f21ad33 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1822,6 +1822,7 @@ dist_patch_DATA = \
%D%/packages/patches/slim-reset.patch \
%D%/packages/patches/slim-login.patch \
%D%/packages/patches/slim-display.patch \
+ %D%/packages/patches/stex-copy-from-immutable-store.patch \
%D%/packages/patches/syslinux-gcc10.patch \
%D%/packages/patches/syslinux-strip-gnu-property.patch \
%D%/packages/patches/snappy-add-O2-flag-in-CmakeLists.txt.patch \
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 043f2ae47a..4c253effa0 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -595,7 +595,7 @@ (define-public stex-bootstrap
;; This commit includes a fix which we would otherwise want to use as
;; patch. Let's revert to tagged releases as soon as one becomes available.
(let ((commit "afa607564a5662ffd748e824801277a6b5a3d11c")
- (revision "2"))
+ (revision "3"))
(hidden-package
(package
(name "stex")
@@ -613,6 +613,9 @@ (define-public stex-bootstrap
(sha256
(base32 "0n6dryv5j7cw2qmsj55wqb0ph901h83a2hl4j891ppxp0xx18nkp"))
(file-name (git-file-name name version))
+ (patches
+ ;; submitted upstream in https://github.com/dybvig/stex/pull/6
+ (search-patches "stex-copy-from-immutable-store.patch"))
(snippet
#~(for-each delete-file
'("sbin/install" "doc/stex.pdf" "doc/stex.html")))))
diff --git a/gnu/packages/patches/stex-copy-from-immutable-store.patch b/gnu/packages/patches/stex-copy-from-immutable-store.patch
new file mode 100644
index 0000000000..4562e431c1
--- /dev/null
+++ b/gnu/packages/patches/stex-copy-from-immutable-store.patch
@@ -0,0 +1,41 @@
+From 9434b4a36646c036db8de326158056aa3293fb82 Mon Sep 17 00:00:00 2001
+From: Philip McGrath <philip@philipmcgrath.com>
+Date: Thu, 28 Apr 2022 22:56:20 -0400
+Subject: [PATCH] fix read-only gifs and math directories
+
+An installed copy of stex might have all write permission bits removed,
+even for the owner of the installed files: this is the case with Guix
+package of stex, for example. If such an installation is used to
+initialize the gifs or math directories (e.g. for an out-of-source
+build), tar likewise creates them without write permissions, preventing
+subdirectories from being created later. Set the user write bit
+explicitly to avoid this problem.
+ Mf-stex
+
+Related to https://github.com/racket/racket/pull/4203
+---
+
+Submitted upstream in https://github.com/dybvig/stex/pull/6
+
+ Mf-stex | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/Mf-stex b/Mf-stex
+index 09ec6f3..11fb214 100644
+--- a/Mf-stex
++++ b/Mf-stex
+@@ -112,9 +112,11 @@ $(x).mathrun: gifs $(mathfiles)
+
+ gifs:
+ (cd $(STEXLIB); tar -cf - gifs) | tar -xpf -
++ chmod u+w gifs
+
+ math:
+ (cd $(STEXLIB); tar -cf - math) | tar -xpf -
++ chmod u+w math
+
+ $(mathfiles): $(x).hthirdrun $(figps)
+ echo -n gifs= > $(mathfiles)
+--
+2.32.0
+
--
2.32.0
P
P
Philip McGrath wrote on 8 Aug 2022 08:10
[PATCH 3/6] gnu: chez-scheme: Fix use of "/bin/sh".
(address . 57050@debbugs.gnu.org)(name . Philip McGrath)(address . philip@philipmcgrath.com)
5e5e8f491c7cbee3ef7a21437a52675dd47d186e.1659936550.git.philip@philipmcgrath.com
The unsuccessful attempt to execute "/bin/sh" by Chez Scheme's 'process'
function seems to have caused parts of the Chez Scheme test suite to
have been silently skipped. The issue was exposed by the upcoming
changes to Racket's build system.

* gnu/packages/patches/chez-scheme-bin-sh.patch,
gnu/packages/patches/racket-chez-scheme-bin-sh.patch: New patches.
* gnu/packages/patches/racket-minimal-sh-via-rktio.patch: Rename to ...
* gnu/packages/patches/racket-rktio-bin-sh.patch: ... this, refresh with
upstream, and shorten the macro name.
* gnu/local.mk (dist_patch_DATA): Update accordingly.
* gnu/packages/racket.scm (%racket-origin)[patches]: Likewise.
(racket-vm-common-configure-flags): Likewise.
* gnu/packages/chez.scm (chez-scheme)[origin]<patches>: Likewise.
[inputs]: Add bash-minimal.
[arguments]<#:configure-flags>: Set CPPFLAGS to enable new patches.
---
gnu/local.mk | 4 +-
gnu/packages/chez.scm | 5 ++
gnu/packages/patches/chez-scheme-bin-sh.patch | 66 +++++++++++++++++++
.../patches/racket-chez-scheme-bin-sh.patch | 66 +++++++++++++++++++
...-rktio.patch => racket-rktio-bin-sh.patch} | 28 ++++----
gnu/packages/racket.scm | 5 +-
6 files changed, 158 insertions(+), 16 deletions(-)
create mode 100644 gnu/packages/patches/chez-scheme-bin-sh.patch
create mode 100644 gnu/packages/patches/racket-chez-scheme-bin-sh.patch
rename gnu/packages/patches/{racket-minimal-sh-via-rktio.patch => racket-rktio-bin-sh.patch} (79%)

Toggle diff (314 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 234f21ad33..e827feed36 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -940,6 +940,7 @@ dist_patch_DATA = \
%D%/packages/patches/ceph-boost-compat.patch \
%D%/packages/patches/ceph-rocksdb-compat.patch \
%D%/packages/patches/cheese-vala-update.patch \
+ %D%/packages/patches/chez-scheme-bin-sh.patch \
%D%/packages/patches/chmlib-inttypes.patch \
%D%/packages/patches/cl-asdf-config-directories.patch \
%D%/packages/patches/clamav-config-llvm-libs.patch \
@@ -1769,7 +1770,8 @@ dist_patch_DATA = \
%D%/packages/patches/ripperx-missing-file.patch \
%D%/packages/patches/rpcbind-CVE-2017-8779.patch \
%D%/packages/patches/rtags-separate-rct.patch \
- %D%/packages/patches/racket-minimal-sh-via-rktio.patch \
+ %D%/packages/patches/racket-chez-scheme-bin-sh.patch \
+ %D%/packages/patches/racket-rktio-bin-sh.patch \
%D%/packages/patches/remake-impure-dirs.patch \
%D%/packages/patches/restic-0.9.6-fix-tests-for-go1.15.patch \
%D%/packages/patches/retroarch-LIBRETRO_DIRECTORY.patch \
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 4c253effa0..66098c7a24 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -34,6 +34,7 @@ (define-module (gnu packages chez)
#:use-module (guix build-system copy)
#:use-module (guix build-system gnu)
#:use-module (guix build-system copy)
+ #:use-module (gnu packages bash)
#:use-module (gnu packages compression)
#:use-module (gnu packages ncurses)
#:use-module (gnu packages ghostscript)
@@ -269,6 +270,7 @@ (define-public chez-scheme
(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
@@ -287,6 +289,7 @@ (define-public chez-scheme
`(,util-linux "lib") ;<-- libuuid
zlib
lz4
+ bash-minimal ;<-- for process
ncurses ;<-- for expeditor
;; for X11 clipboard support in expeditor:
;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
@@ -313,6 +316,8 @@ (define-public chez-scheme
(cut memq 'threads <>))
#~("--threads")
#~())
+ ,(string-append "CPPFLAGS=-DGUIX_RKTIO_BIN_SH="
+ #$(file-append bash-minimal "/bin/sh"))
"ZLIB=-lz"
"LZ4=-llz4"
"--libkernel"
diff --git a/gnu/packages/patches/chez-scheme-bin-sh.patch b/gnu/packages/patches/chez-scheme-bin-sh.patch
new file mode 100644
index 0000000000..e6228e3264
--- /dev/null
+++ b/gnu/packages/patches/chez-scheme-bin-sh.patch
@@ -0,0 +1,66 @@
+From c170f0f3a326f293ee1f460a70303382966ca41b Mon Sep 17 00:00:00 2001
+From: Philip McGrath <philip@philipmcgrath.com>
+Date: Thu, 19 May 2022 13:41:56 -0400
+Subject: [PATCH] patch s_process for "/bin/sh" on Guix
+
+This patch reuses the C preprocessor macro `GUIX_RKTIO_BIN_SH`
+from a previous patch.
+
+If:
+
+ 1. The `GUIX_RKTIO_BIN_SH` macro is defined; and
+
+ 2. The path specified by `GUIX_RKTIO_BIN_SH` exists;
+
+then `s_process` will call `execl` with the file specified by
+`GUIX_RKTIO_BIN_SH` instead of "/bin/sh".
+
+This patch does not change the behavior of `s_system`, which relies
+on `system` from the C library.
+---
+ c/prim5.c | 20 +++++++++++++++++++-
+ 1 file changed, 19 insertions(+), 1 deletion(-)
+
+diff --git a/c/prim5.c b/c/prim5.c
+index 5a07893..926d68d 100644
+--- a/c/prim5.c
++++ b/c/prim5.c
+@@ -746,6 +746,22 @@ static ptr s_process(char *s, IBOOL stderrp) {
+
+ INT tofds[2], fromfds[2], errfds[2];
+ struct sigaction act, oint_act;
++ /* BEGIN PATCH for Guix */
++#if defined(GUIX_RKTIO_BIN_SH)
++# define GUIX_AS_a_STR_HELPER(x) #x
++# define GUIX_AS_a_STR(x) GUIX_AS_a_STR_HELPER(x)
++ /* A level of indirection makes `#` work as needed: */
++ struct stat guix_stat_buf;
++ char *guix_sh =
++ (0 == stat(GUIX_AS_a_STR(GUIX_RKTIO_BIN_SH), &guix_stat_buf))
++ ? GUIX_AS_a_STR(GUIX_RKTIO_BIN_SH)
++ : "/bin/sh";
++# undef GUIX_AS_a_STR
++# undef GUIX_AS_a_STR_HELPER
++#else /* GUIX_RKTIO_BIN_SH */
++ char *guix_sh = "/bin/sh";
++#endif
++ /* END PATCH for Guix */
+
+ if (pipe(tofds)) S_error("process","cannot open pipes");
+ if (pipe(fromfds)) {
+@@ -771,7 +787,9 @@ static ptr s_process(char *s, IBOOL stderrp) {
+ CLOSE(1); if (dup(fromfds[1]) != 1) _exit(1);
+ CLOSE(2); if (dup(stderrp ? errfds[1] : 1) != 2) _exit(1);
+ {INT i; for (i = 3; i < NOFILE; i++) (void)CLOSE(i);}
+- execl("/bin/sh", "/bin/sh", "-c", s, NULL);
++ /* BEGIN PATCH for Guix */
++ execl(guix_sh, guix_sh, "-c", s, NULL);
++ /* END PATCH for Guix */
+ _exit(1) /* only if execl fails */;
+ /*NOTREACHED*/
+ } else {
+
+base-commit: 9df56e7b25bc523663eac3da24be33afc5f76c84
+--
+2.32.0
+
diff --git a/gnu/packages/patches/racket-chez-scheme-bin-sh.patch b/gnu/packages/patches/racket-chez-scheme-bin-sh.patch
new file mode 100644
index 0000000000..df2eb671b3
--- /dev/null
+++ b/gnu/packages/patches/racket-chez-scheme-bin-sh.patch
@@ -0,0 +1,66 @@
+From 5f3fc12bf123f30485800960b0493f5dd538d107 Mon Sep 17 00:00:00 2001
+From: Philip McGrath <philip@philipmcgrath.com>
+Date: Thu, 19 May 2022 13:41:56 -0400
+Subject: [PATCH] Chez Scheme: patch s_process for "/bin/sh" on Guix
+
+This patch reuses the C preprocessor macro `GUIX_RKTIO_BIN_SH`
+from a previous patch.
+
+If:
+
+ 1. The `GUIX_RKTIO_BIN_SH` macro is defined; and
+
+ 2. The path specified by `GUIX_RKTIO_BIN_SH` exists;
+
+then `s_process` will call `execl` with the file specified by
+`GUIX_RKTIO_BIN_SH` instead of "/bin/sh".
+
+This patch does not change the behavior of `s_system`, which relies
+on `system` from the C library.
+---
+ racket/src/ChezScheme/c/prim5.c | 20 +++++++++++++++++++-
+ 1 file changed, 19 insertions(+), 1 deletion(-)
+
+diff --git a/racket/src/ChezScheme/c/prim5.c b/racket/src/ChezScheme/c/prim5.c
+index f5e3e345be..9db2989138 100644
+--- a/racket/src/ChezScheme/c/prim5.c
++++ b/racket/src/ChezScheme/c/prim5.c
+@@ -856,6 +856,22 @@ static ptr s_process(s, stderrp) char *s; IBOOL stderrp; {
+
+ INT tofds[2], fromfds[2], errfds[2];
+ struct sigaction act, oint_act;
++ /* BEGIN PATCH for Guix */
++#if defined(GUIX_RKTIO_BIN_SH)
++# define GUIX_AS_a_STR_HELPER(x) #x
++# define GUIX_AS_a_STR(x) GUIX_AS_a_STR_HELPER(x)
++ /* A level of indirection makes `#` work as needed: */
++ struct stat guix_stat_buf;
++ char *guix_sh =
++ (0 == stat(GUIX_AS_a_STR(GUIX_RKTIO_BIN_SH), &guix_stat_buf))
++ ? GUIX_AS_a_STR(GUIX_RKTIO_BIN_SH)
++ : "/bin/sh";
++# undef GUIX_AS_a_STR
++# undef GUIX_AS_a_STR_HELPER
++#else /* GUIX_RKTIO_BIN_SH */
++ char *guix_sh = "/bin/sh";
++#endif
++ /* END PATCH for Guix */
+
+ if (pipe(tofds)) S_error("process","cannot open pipes");
+ if (pipe(fromfds)) {
+@@ -881,7 +897,9 @@ static ptr s_process(s, stderrp) char *s; IBOOL stderrp; {
+ CLOSE(1); if (dup(fromfds[1]) != 1) _exit(1);
+ CLOSE(2); if (dup(stderrp ? errfds[1] : 1) != 2) _exit(1);
+ {INT i; for (i = 3; i < NOFILE; i++) (void)CLOSE(i);}
+- execl("/bin/sh", "/bin/sh", "-c", s, NULL);
++ /* BEGIN PATCH for Guix */
++ execl(guix_sh, guix_sh, "-c", s, NULL);
++ /* END PATCH for Guix */
+ _exit(1) /* only if execl fails */;
+ /*NOTREACHED*/
+ } else {
+
+base-commit: 9d228d16fb99c274c964e5bef93e97333888769f
+--
+2.32.0
+
diff --git a/gnu/packages/patches/racket-minimal-sh-via-rktio.patch b/gnu/packages/patches/racket-rktio-bin-sh.patch
similarity index 79%
rename from gnu/packages/patches/racket-minimal-sh-via-rktio.patch
rename to gnu/packages/patches/racket-rktio-bin-sh.patch
index 6bc2ee8331..4f7f2da083 100644
--- a/gnu/packages/patches/racket-minimal-sh-via-rktio.patch
+++ b/gnu/packages/patches/racket-rktio-bin-sh.patch
@@ -1,7 +1,7 @@
-From 3574b567c486d264d680a37586436c3b5a8cb978 Mon Sep 17 00:00:00 2001
+From 070abbcc0d880ca4f97f997e096ac66650ccaaa0 Mon Sep 17 00:00:00 2001
From: Philip McGrath <philip@philipmcgrath.com>
Date: Thu, 4 Mar 2021 04:11:50 -0500
-Subject: [PATCH] patch rktio_process for "/bin/sh" on Guix
+Subject: [PATCH] rktio: patch rktio_process for "/bin/sh" on Guix
Racket provides the functions `system` and `process`,
which execute shell commands using `sh` (or `cmd` on Windows).
@@ -13,17 +13,17 @@ the C function that implements the core of `system`, `process`,
and related Racket functions.
Guix should enable the special case by defining the C preprocessor
-macro `GUIX_RKTIO_PATCH_BIN_SH` with the path to `sh` in the store.
+macro `GUIX_RKTIO_BIN_SH` with the path to `sh` in the store.
If:
- 1. The `GUIX_RKTIO_PATCH_BIN_SH` macro is defined; and
+ 1. The `GUIX_RKTIO_BIN_SH` macro is defined; and
2. `rktio_process` is called with the exact path "/bin/sh"; and
- 3. The path specified by `GUIX_RKTIO_PATCH_BIN_SH` does exists;
+ 3. The file specified by `GUIX_RKTIO_BIN_SH` exists;
then `rktio_process` will execute the file specified
-by `GUIX_RKTIO_PATCH_BIN_SH` instead of "/bin/sh".
+by `GUIX_RKTIO_BIN_SH` instead of "/bin/sh".
Compared to previous attempts to patch the Racket sources,
making this change at the C level is both:
@@ -39,10 +39,10 @@ making this change at the C level is both:
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/racket/src/rktio/rktio_process.c b/racket/src/rktio/rktio_process.c
-index 89202436c0..465ebdd5c5 100644
+index fafaf728c1..0a319b381a 100644
--- a/racket/src/rktio/rktio_process.c
+++ b/racket/src/rktio/rktio_process.c
-@@ -1224,12 +1224,14 @@ int rktio_process_allowed_flags(rktio_t *rktio)
+@@ -1301,12 +1301,14 @@ int rktio_process_allowed_flags(rktio_t *rktio)
/*========================================================================*/
rktio_process_result_t *rktio_process(rktio_t *rktio,
@@ -58,19 +58,19 @@ index 89202436c0..465ebdd5c5 100644
rktio_process_result_t *result;
intptr_t to_subprocess[2], from_subprocess[2], err_subprocess[2];
int pid;
-@@ -1255,6 +1257,23 @@ rktio_process_result_t *rktio_process(rktio_t *rktio,
+@@ -1333,6 +1335,23 @@ rktio_process_result_t *rktio_process(rktio_t *rktio,
int i;
#endif
+/* BEGIN PATCH for Guix */
-+#if defined(GUIX_RKTIO_PATCH_BIN_SH)
++#if defined(GUIX_RKTIO_BIN_SH)
+# define GUIX_AS_a_STR_HELPER(x) #x
+# define GUIX_AS_a_STR(x) GUIX_AS_a_STR_HELPER(x)
+ /* A level of indirection makes `#` work as needed: */
+ command =
+ ((0 == strcmp(_guix_orig_command, "/bin/sh"))
-+ && rktio_file_exists(rktio, GUIX_AS_a_STR(GUIX_RKTIO_PATCH_BIN_SH)))
-+ ? GUIX_AS_a_STR(GUIX_RKTIO_PATCH_BIN_SH)
++ && rktio_file_exists(rktio, GUIX_AS_a_STR(GUIX_RKTIO_BIN_SH)))
++ ? GUIX_AS_a_STR(GUIX_RKTIO_BIN_SH)
+ : _guix_orig_command;
+# undef GUIX_AS_a_STR
+# undef GUIX_AS_a_STR_HELPER
@@ -82,6 +82,8 @@ index 89202436c0..465ebdd5c5 100644
/* avoid compiler warnings: */
to_subprocess[0] = -1;
to_subprocess[1] = -1;
+
+base-commit: 9d228d16fb99c274c964e5bef93e97333888769f
--
-2.21.1 (Apple Git-122.3)
+2.32.0
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index 3399bcc3fe..cddb617232 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -212,7 +212,8 @@ (define %racket-origin
(sha256
(base32 "0f9zyhdvbh4xsndrqjzl85j5ziz0rmqi676g9s1lw3h3skq2636h"))
(file-name (git-file-name "racket" %racket-version))
- (patches (search-patches "racket-minimal-sh-via-rktio.patch"))
+ (patches (search-patches "racket-chez-scheme-bin-sh.patch"
+ "racket-rktio-bin-sh.patch"))
(modules '((guix build utils)))
(snippet
#~(begin
@@ -248,7 +249,7 @@ (define (racket-vm-common-configure-flags)
(list (string-append "--enable-racket=" racket))))
(else
'()))
- ,(string-append "CPPFLAGS=-DGUIX_RKTIO_PATCH_BIN_SH="
+ ,(string-append "CPPFLAGS=-DGUIX_RKTIO_BIN_SH="
#$(file-append bash-minimal "/bin/sh"))
"--disable-strip"
;; Using --enable-origtree lets us distinguish the VM from subsequent
--
2.32.0
P
P
Philip McGrath wrote on 8 Aug 2022 08:10
[PATCH 4/6] gnu: Update Racket to 8.6. Add Zuo.
(address . 57050@debbugs.gnu.org)(name . Philip McGrath)(address . philip@philipmcgrath.com)
0d47e0372925c83fb72ff37c0f00c8196327c636.1659936550.git.philip@philipmcgrath.com
Also, update 'chez-scheme-for-racket' to 9.5.9.2.

These packages must be updated together because they are built from the
same origin. In particular, Zuo was added after the Racket 8.5 release
and is needed to build this release.

* gnu/packages/patches/racket-chez-scheme-bin-sh.patch: Refresh patch.
* gnu/packages/patches/racket-backport-8.6-cross-install.patch,
gnu/packages/patches/racket-backport-8.6-docindex-write.patch,
gnu/packages/patches/racket-backport-8.6-hurd.patch,
gnu/packages/patches/racket-backport-8.6-zuo.patch,
gnu/packages/patches/racket-zuo-bin-sh.patch: New patches.
* gnu/local.mk (dist_patch_DATA): Add them.
* gnu/packages/racket.scm (%racket-origin)[patches]: Use them.
(%racket-version): Update to 8.6.
(%zuo-version): New variable.
(zuo): New package.
(racket-vm-cgc)[native-inputs]: Add 'zuo'.
[arguments]<#:make-flags>: Use 'zuo' from 'native-inputs'.
(racket)[inputs]<data, db, deinprogramm, draw, drracket, errortrace,
gui, htdp, math, option-contract, parser-tools, pict, rackunit, realm,
redex, scribble, typed-racket, string-constants, swindle, syntax-color,
web-server>: Update checksums.
* gnu/packages/chez.scm (target-chez-os): Handle Hurd and QNX.
(%chez-features-table): Likewise.
(chez-scheme-for-racket): Update to 9.5.9.2.
[native-inputs]: Add 'zuo'.
[arguments]<#:out-of-source?>: Use out-of-source build.
<#:tests?>: Skip them due to ongoing problems.
<#:configure-flags>: Add '--install-csug=' and '--installreleasenotes='.
<#:make-flags>: Use 'zuo' from 'native-inputs'. Supply 'STEXLIB=' here,
rather than in a phase.
<#:phases>: Replace 'install-docs' using new 'make' target.
---
gnu/local.mk | 5 +
gnu/packages/chez.scm | 52 +-
.../racket-backport-8.6-cross-install.patch | 32 +
.../racket-backport-8.6-docindex-write.patch | 36 ++
.../patches/racket-backport-8.6-hurd.patch | 609 ++++++++++++++++++
.../patches/racket-backport-8.6-zuo.patch | 481 ++++++++++++++
.../patches/racket-chez-scheme-bin-sh.patch | 16 +-
gnu/packages/patches/racket-zuo-bin-sh.patch | 72 +++
gnu/packages/racket.scm | 159 +++--
9 files changed, 1403 insertions(+), 59 deletions(-)
create mode 100644 gnu/packages/patches/racket-backport-8.6-cross-install.patch
create mode 100644 gnu/packages/patches/racket-backport-8.6-docindex-write.patch
create mode 100644 gnu/packages/patches/racket-backport-8.6-hurd.patch
create mode 100644 gnu/packages/patches/racket-backport-8.6-zuo.patch
create mode 100644 gnu/packages/patches/racket-zuo-bin-sh.patch

Toggle diff (438 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index e827feed36..a3f2564d44 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1770,8 +1770,13 @@ dist_patch_DATA = \
%D%/packages/patches/ripperx-missing-file.patch \
%D%/packages/patches/rpcbind-CVE-2017-8779.patch \
%D%/packages/patches/rtags-separate-rct.patch \
+ %D%/packages/patches/racket-backport-8.6-cross-install.patch \
+ %D%/packages/patches/racket-backport-8.6-docindex-write.patch \
+ %D%/packages/patches/racket-backport-8.6-hurd.patch \
+ %D%/packages/patches/racket-backport-8.6-zuo.patch \
%D%/packages/patches/racket-chez-scheme-bin-sh.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/restic-0.9.6-fix-tests-for-go1.15.patch \
%D%/packages/patches/retroarch-LIBRETRO_DIRECTORY.patch \
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 66098c7a24..dde2c22ca5 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -116,7 +116,7 @@ (define* (target-chez-os #:optional (system (or (%current-target-system)
((target-linux? system)
"le")
((target-hurd? system)
- #f)
+ "gnu")
((target-mingw? system)
"nt")
;; missing (guix utils) predicates
@@ -132,6 +132,8 @@ (define* (target-chez-os #:optional (system (or (%current-target-system)
;; Nix says "x86_64-solaris", but accommodate "-solaris2"
((string-contains system "solaris")
"s2")
+ ((string-suffix? "-qnx" system)
+ "qnx")
;; unknown
(else
#f)))
@@ -168,6 +170,9 @@ (define %chez-features-table
("arm32" bootstrap-bootfiles)
("arm64" . #f)
("ppc32" threads))
+ ;; Hurd
+ ("gnu"
+ ("i3" . #f))
;; FreeBSD
("fb"
("i3" threads) ;; commented out
@@ -193,6 +198,9 @@ (define %chez-features-table
("s2"
("i3" threads) ;; commented out
("a6" threads)) ;; commented out
+ ;; QNX
+ ("qnx"
+ ("i3" . #f))
;; Windows
("nt"
("i3" threads bootstrap-bootfiles)
@@ -437,7 +445,7 @@ (define-public chez-scheme-for-racket
(package
(inherit chez-scheme)
(name "chez-scheme-for-racket")
- (version "9.5.7.6")
+ (version "9.5.9.2")
;; The version should match `(scheme-fork-version-number)`.
;; See racket/src/ChezScheme/s/cmacros.ss c. line 360.
;; It will always be different than the upstream version!
@@ -448,18 +456,52 @@ (define-public chez-scheme-for-racket
(delete "libx11" "util-linux:lib")))
(native-inputs
(modify-inputs (package-native-inputs chez-scheme)
+ (append zuo)
(replace "chez-scheme-bootstrap-bootfiles"
chez-scheme-for-racket-bootstrap-bootfiles)))
(arguments
(substitute-keyword-arguments (package-arguments chez-scheme)
+ ((#:out-of-source? _ #f)
+ #t)
+ ((#:tests? _ #t)
+ ;; FIXME: There have been some flaky test failures. Some have been
+ ;; fixed upstream post-release but have proven non-trivial to
+ ;; backport; at least one issue remains. Re-enable tests once
+ ;; https://github.com/racket/racket/issues/4359 is fixed.
+ #f)
((#:configure-flags cfg-flags #~'())
- #~(cons* "--disable-x11"
- "--threads" ;; ok to potentially duplicate
- #$cfg-flags))
+ #~`("--disable-x11"
+ "--threads" ;; ok to potentially duplicate
+ ,@(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)
(unpack (assoc-ref those-phases 'unpack)))
(modify-phases those-phases
+ (replace 'install-docs
+ (lambda* (#:key make-flags #:allow-other-keys)
+ (apply invoke
+ "make"
+ "install-docs"
+ make-flags)))
(replace 'unpack
(lambda args
(unpack #:source #$(or (package-source this-package)
diff --git a/gnu/packages/patches/racket-backport-8.6-cross-install.patch b/gnu/packages/patches/racket-backport-8.6-cross-install.patch
new file mode 100644
index 0000000000..4f7849ecc6
--- /dev/null
+++ b/gnu/packages/patches/racket-backport-8.6-cross-install.patch
@@ -0,0 +1,32 @@
+From 585215c5c42f7ee0fee05e6a637ab1bc17f5e8e0 Mon Sep 17 00:00:00 2001
+From: Matthew Flatt <mflatt@racket-lang.org>
+Date: Sat, 30 Jul 2022 07:06:55 -0600
+Subject: [PATCH] CS makefiles: fix Unix-style install for cross compilation
+
+Closes #4377
+
+(cherry picked from commit 053be470e7c5454cdf48e934f3254d2d916bbbc5)
+---
+ racket/src/cs/c/build.zuo | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/racket/src/cs/c/build.zuo b/racket/src/cs/c/build.zuo
+index 8d3950bb27..d8b74c509d 100644
+--- a/racket/src/cs/c/build.zuo
++++ b/racket/src/cs/c/build.zuo
+@@ -1016,10 +1016,9 @@
+ (define (setup)
+ (call-with-dest-racket
+ (lambda (bindir dest-racket)
+- (define copytree-racket (and cross? (config-bootstrap-racket)))
++ (define copytree-racket (and cross? (hash-ref (config-bootstrap-racket) 'racket)))
+ (maybe-copytree config dest-racket copytree-racket at-dir)
+- (run-raco-setup config dest-racket
+- (and cross? (hash-ref (config-bootstrap-racket) 'racket))
++ (run-raco-setup config dest-racket copytree-racket
+ ;; this can be redundant if it's also supplied via `SETUP_MACHINE_FLAGS`,
+ ;; but redundant should be ok:
+ (list "-MCR" (~a (at-dir "compiled") ":")
+--
+2.32.0
+
diff --git a/gnu/packages/patches/racket-backport-8.6-docindex-write.patch b/gnu/packages/patches/racket-backport-8.6-docindex-write.patch
new file mode 100644
index 0000000000..abe1984507
--- /dev/null
+++ b/gnu/packages/patches/racket-backport-8.6-docindex-write.patch
@@ -0,0 +1,36 @@
+From 8b4d686a62fd66dedfc40ecdcf3698316993d614 Mon Sep 17 00:00:00 2001
+From: Philip McGrath <philip@philipmcgrath.com>
+Date: Sun, 17 Jul 2022 22:51:44 -0400
+Subject: [PATCH] racket-index: set write permission when copying
+ `docindex.sqlite`
+
+Fixes https://github.com/racket/racket/issues/4357
+
+(cherry picked from commit 55b6cbdca1f36a4f37bab1519c1b658717d3cad2)
+---
+ pkgs/racket-index/setup/scribble.rkt | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/pkgs/racket-index/setup/scribble.rkt b/pkgs/racket-index/setup/scribble.rkt
+index 6694f0b793..e27a8fa348 100644
+--- a/pkgs/racket-index/setup/scribble.rkt
++++ b/pkgs/racket-index/setup/scribble.rkt
+@@ -252,7 +252,14 @@
+ (unless (file-exists? db-file)
+ (define-values (base name dir?) (split-path db-file))
+ (make-directory* base)
+- (when copy-from (copy-file copy-from db-file))
++ (when copy-from
++ (copy-file copy-from db-file)
++ ;; we might not have write permissions for the previous layer:
++ ;; ensure that we do for the new file
++ (define orig-mode (file-or-directory-permissions db-file 'bits))
++ (define writeable-mode (bitwise-ior user-write-bit orig-mode))
++ (unless (= writeable-mode orig-mode)
++ (file-or-directory-permissions db-file writeable-mode)))
+ (doc-db-disconnect
+ (doc-db-file->connection db-file #t))))
+ (when (or (ormap can-build*? main-docs)
+--
+2.32.0
+
diff --git a/gnu/packages/patches/racket-backport-8.6-hurd.patch b/gnu/packages/patches/racket-backport-8.6-hurd.patch
new file mode 100644
index 0000000000..d593b01e62
--- /dev/null
+++ b/gnu/packages/patches/racket-backport-8.6-hurd.patch
@@ -0,0 +1,609 @@
+From f17b030fa2f902bb3666913d4a3cd6ba9c146d22 Mon Sep 17 00:00:00 2001
+From: Philip McGrath <philip@philipmcgrath.com>
+Date: Wed, 3 Aug 2022 03:13:03 -0400
+Subject: [PATCH 1/3] Chez Scheme: Fix build on GNU/Hurd
+
+Mostly GNU/Hurd should take the same options as GNU/Linux. One
+difference is that the Hurd does not define macros such as `PATH_MAX` or
+`NOFILE`, because it avoids imposing arbitrary limits on such resources.
+This patch provides alternatives for localized uses of those constants,
+but it accepts the pervasive use of `PATH_MAX` in finding bootfiles for
+now. See https://www.gnu.org/software/hurd/hurd/porting/guidelines.html.
+
+(cherry picked from commit 87eee6e2adb8c6bc11e60619c706fa6295096085)
+---
+ racket/src/ChezScheme/README.md | 1 +
+ racket/src/ChezScheme/c/number.c | 22 +++++++++----------
+ racket/src/ChezScheme/c/prim5.c | 35 ++++++++++++++++++++++++++++--
+ racket/src/ChezScheme/c/scheme.c | 34 +++++++++++++++++------------
+ racket/src/ChezScheme/c/version.h | 7 ++++--
+ racket/src/ChezScheme/configure | 17 ++++++++++-----
+ racket/src/ChezScheme/s/cmacros.ss | 1 +
+ racket/src/cs/c/configure | 14 ++++++++++--
+ racket/src/cs/c/configure.ac | 14 ++++++++++--
+ racket/src/cs/rumble/system.ss | 3 +++
+ 10 files changed, 109 insertions(+), 39 deletions(-)
+
+diff --git a/racket/src/ChezScheme/README.md b/racket/src/ChezScheme/README.md
+index a4a11a5eef..25231dd9bb 100644
+--- a/racket/src/ChezScheme/README.md
++++ b/racket/src/ChezScheme/README.md
+@@ -13,6 +13,7 @@ Supported platforms (bytecode interpreter may work for others):
+ * OpenBSD: x86, x86_64, ARMv6, AArch64, PowerPC32
+ * NetBSD: x86, x86_64, ARMv6, AArch64, PowerPC32
+ * Solaris: x86, x86_64
++ * GNU/Hurd: x86
+ * Android: ARMv7, AArch64
+ * iOS: AArch64
+ * WebAssembly via Emscripten (bytecode interpreter only)
+diff --git a/racket/src/ChezScheme/c/number.c b/racket/src/ChezScheme/c/number.c
+index ede38cc626..e2bce0d2d3 100644
+--- a/racket/src/ChezScheme/c/number.c
++++ b/racket/src/ChezScheme/c/number.c
+@@ -1041,15 +1041,15 @@ floating-point operations
+
+ #ifdef IEEE_DOUBLE
+ /* exponent stored + 1024, hidden bit to left of decimal point */
+-#define bias 1023
+-#define bitstoright 52
+-#define m1mask 0xf
+-#ifdef WIN32
+-#define hidden_bit 0x10000000000000
+-#else
+-#define hidden_bit 0x10000000000000ULL
+-#endif
+-#ifdef LITTLE_ENDIAN_IEEE_DOUBLE
++# define bias 1023
++# define bitstoright 52
++# define m1mask 0xf
++# ifdef WIN32
++# define hidden_bit 0x10000000000000
++# else
++# define hidden_bit 0x10000000000000ULL
++# endif
++# ifdef LITTLE_ENDIAN_IEEE_DOUBLE
+ struct dblflt {
+ UINT m4: 16;
+ UINT m3: 16;
+@@ -1058,7 +1058,7 @@ struct dblflt {
+ UINT e: 11;
+ UINT sign: 1;
+ };
+-#else
++# else
+ struct dblflt {
+ UINT sign: 1;
+ UINT e: 11;
+@@ -1067,7 +1067,7 @@ struct dblflt {
+ UINT m3: 16;
+ UINT m4: 16;
+ };
+-#endif
++# endif
+ #endif
+
+ double S_random_double(U32 m1, U32 m2, U32 m3, U32 m4, double scale) {
+diff --git a/racket/src/ChezScheme/c/prim5.c b/racket/src/ChezScheme/c/prim5.c
+index 124d1e049c..82bbf8d687 100644
+--- a/racket/src/ChezScheme/c/prim5.c
++++ b/racket/src/ChezScheme/c/prim5.c
+@@ -23,6 +23,10 @@
+ #include <ctype.h>
+ #include <math.h>
+
++#if defined(__GNU__) /* Hurd */
++#include <sys/resource.h>
++#endif
++
+ /* locally defined functions */
+ static INT s_errno(void);
+ static IBOOL s_addr_in_heap(uptr x);
+@@ -58,7 +62,7 @@ static void s_showalloc(IBOOL show_dump, const char *outfn);
+ static ptr s_system(const char *s);
+ static ptr s_process(char *s, IBOOL stderrp);
+ static I32 s_chdir(const char *inpath);
+-#ifdef GETWD
++#if defined(GETWD) || defined(__GNU__) /* Hurd */
+ static char *s_getwd(void);
+ #endif
+ static ptr s_set_code_byte(ptr p, ptr n, ptr x);
+@@ -881,7 +885,18 @@ static ptr s_process(char *s, IBOOL stderrp) {
+ CLOSE(0); if (dup(tofds[0]) != 0) _exit(1);
+ CLOSE(1); if (dup(fromfds[1]) != 1) _exit(1);
+ CLOSE(2); if (dup(stderrp ? errfds[1] : 1) != 2) _exit(1);
++#ifndef __GNU__ /* Hurd */
+ {INT i; for (i = 3; i < NOFILE; i++) (void)CLOSE(i);}
++#else /* __GNU__ Hurd: no NOFILE */
++ {
++ INT i;
++ struct rlimit rlim;
++ getrlimit(RLIMIT_NOFILE, &rlim);
++ for (i = 3; i < rlim.rlim_cur; i++) {
++ (void)CLOSE(i);
++ }
++ }
++#endif /* __GNU__ Hurd */
+ execl("/bin/sh", "/bin/sh", "-c", s, NULL);
+ _exit(1) /* only if execl fails */;
+ /*NOTREACHED*/
+@@ -927,6 +942,22 @@ static I32 s_chdir(const char *inpath) {
+ static char *s_getwd() {
+ return GETWD(TO_VOIDP(&BVIT(S_bytevector(PATH_MAX), 0)));
+ }
++#elif defined(__GNU__) /* Hurd: no PATH_MAX */
++static char *s_getwd() {
++ char *path;
++ size_t len;
++ ptr bv;
++ path = getcwd(NULL, 0);
++ if (NULL == path) {
++ return NULL;
++ } else {
++ len = strlen(path);
++ bv = S_bytevector(len);
++ memcpy(TO_VOIDP(&BVIT(bv, 0)), path, len);
++ free(path);
++ return TO_VOIDP(&BVIT(bv, 0));
++ }
++}
+ #endif /* GETWD */
+
+ static ptr s_set_code_byte(ptr p, ptr n, ptr x) {
+@@ -1817,7 +1848,7 @@ void S_prim5_init(void) {
+ Sforeign_symbol("(cs)s_rational", (void *)S_rational);
+ Sforeign_symbol("(cs)sub", (void *)S_sub);
+ Sforeign_symbol("(cs)rem", (void *)S_rem);
+-#ifdef GETWD
++#if defined(GETWD) || defined(__GNU__) /* Hurd */
+ Sforeign_symbol("(cs)s_getwd", (void *)s_getwd);
+ #endif
+ Sforeign_symbol("(cs)s_chdir", (void *)s_chdir);
+diff --git a/racket/src/ChezScheme/c/scheme.c b/racket/src/ChezScheme/c/scheme.c
+index ed5564540b..0c40e3eaf0 100644
+--- a/racket/src/ChezScheme/c/scheme.c
++++ b/racket/src/ChezScheme/c/scheme.c
+@@ -458,6 +458,12 @@ static IBOOL next_path(char *path, const char *name, const char *ext, const char
+ static const char *path_last(const char *path);
+ static char *get_defaultheapdirs(void);
+
++#ifdef PATH_MAX
++# define BOOT_PATH_MAX PATH_MAX
++#else /* hack for Hurd: better to remove the restriction */
++# define BOOT_PATH_MAX 4096
++#endif
++
+ static const char *path_last(const char *p) {
+ const char *s;
+ #ifdef WIN32
+@@ -483,7 +489,7 @@ static const char *path_last(const char *p) {
+
+ static char *get_defaultheapdirs() {
+ char *result;
+- wchar_t buf[PATH_MAX];
++ wchar_t buf[BOOT_PATH_MAX];
+ DWORD len = sizeof(buf);
+ if (ERROR_SUCCESS != RegGetValueW(HKEY_LOCAL_MACHINE, L"Software\\Chez Scheme\\csv" VERSION, L"HeapSearchPath", RRF_RT_REG_SZ, NULL, buf, &len))
+ return DEFAULT_HEAP_PATH;
+@@ -512,14 +518,14 @@ static char *get_defaultheapdirs() {
+ * leaving the full path with name affixed in path and *sp / *dsp pointing
+ * past the current entry. it returns 1 on success and 0 if at the end of
+ * the search path. path should be a pointer to an unoccupied buffer
+- * PATH_MAX characters long. either or both of sp/dsp may be empty,
++ * BOOT_PATH_MAX characters long. either or both of sp/dsp may be empty,
+ * but neither may be null, i.e., (char *)0. */
+ static IBOOL next_path(char *path, const char *name, const char *ext,
+ const char **sp, const char **dsp) {
+ char *p;
+ const char *s, *t;
+
+-#define setp(c) if (p >= path + PATH_MAX) { fprintf(stderr, "search path entry too long\n"); S_abnormal_exit(); } else *p++ = (c)
++#define setp(c) if (p >= path + BOOT_PATH_MAX) { fprintf(stderr, "search path entry too long\n"); S_abnormal_exit(); } else *p++ = (c)
+ for (;;) {
+ s = *sp;
+ p = path;
+@@ -532,10 +538,10 @@ static IBOOL next_path(char *path, const char *name, const char *ext,
+ switch (*s) {
+ #ifdef WIN32
+ case 'x': {
+- wchar_t exepath[PATH_MAX]; DWORD n;
++ wchar_t exepath[BOOT_PATH_MAX]; DWORD n;
+ s += 1;
+- n = GetModuleFileNameW(NULL, exepath, PATH_MAX);
+- if (n == 0 || (n == PATH_MAX && GetLastError() == ERROR_INSUFFICIENT_BUFFER)) {
++ n = GetModuleFileNameW(NULL, exepath, BOOT_PATH_MAX);
++ if (n == 0 || (n == BOOT_PATH_MAX && GetLastError() == ERROR_INSUFFICIENT_BUFFER)) {
+ fprintf(stderr, "warning: executable path is too long; ignoring %%x\n");
+ } else {
+ char *tstart;
+@@ -608,7 +614,7 @@ typedef struct {
+ iptr len; /* 0 => unknown */
+ iptr offset;
+ IBOOL need_check, close_after;
+- char path[PATH_MAX];
++ char path[BOOT_PATH_MAX];
+ } boot_desc;
+
+ #define MAX_BOOT_FILES 10
+@@ -695,14 +701
This message was truncated. Download the full message here.
P
P
Philip McGrath wrote on 8 Aug 2022 08:10
[PATCH 5/6] gnu: racket: Use Racket CS on all systems.
(address . 57050@debbugs.gnu.org)(name . Philip McGrath)(address . philip@philipmcgrath.com)
497d143fafeb9c866e278454dd0b1235796ac68f.1659936550.git.philip@philipmcgrath.com
On systems for which Racket CS cannot generate native code, it can use a
'pbarch' machine type---a variant of the ``portable bytecode'' backend
specialized to word size and endianness---allowing Racket CS to replace
Racket BC on those systems while maintaining comparable performance.
(Racket BC lacks JIT support for those systems anyway.)

This patch adds 'pbarch' support to 'racket-vm-cs' and
'chez-scheme-for-racket-bootstrap-bootfiles' and changes 'racket' and
'racket-minimal' to use 'racket-vm-cs' on all systems.

In the process, it also adds support for cross-compiling the bootfiles,
'racket-vm-cgc', 'racket-vm-bc', and 'racket-vm-cs'. This is not enough
to cross-compile 'racket-minimal' or 'racket': that would require
building and loading cross-compilation pluggins for 'racket-vm-cs',
which will be much easier once we can build the package 'raco-cross'.

This patch does not address 'chez-scheme-for-racket'.

* gnu/packages/chez.scm (nix-system->pbarch-machine-type): New variable.
(racket-cs-native-supported-system): Change to return the applicable
machine type instead of '#t'.
(chez-scheme-for-racket-bootstrap-bootfiles)[native-inputs]: When
cross-compiling, use 'zuo' and 'chez-scheme-for-racket' instead of
'racket-vm-bc'.
[arguments]: Support cross-compilation and 'pbarch' machine types.
[supported-systems]: Use '%supported-systems' instead of inheriting.
* gnu/packages/racket.scm (racket-vm-for-system): Remove.
(racket-vm-cgc)[native-inputs]: Add 'this-package' when cross-compiling.
(racket-vm-bc)[native-inputs]: Adjust accordingly.
[description]: Update.
(racket-vm-cs)[description]: Likewise.
[inputs]: Use 'libffi' for 'pbarch' machine types.
[native-inputs]: Use 'racket-vm-cs' instead of 'racket-vm-bc' when
cross-compiling. Adapt to changes to 'racket-vm-cgc'.
[arguments]<#:configure-flags>: Support cross-compilation and 'pbarch'
machine types.
(racket-minimal, racket)[inputs]: Replace '(racket-vm-for-system)' with
'racket-vm-cs'.
---
gnu/packages/chez.scm | 65 ++++++++++++++++++++++++++++------
gnu/packages/racket.scm | 77 ++++++++++++++++++++++-------------------
2 files changed, 97 insertions(+), 45 deletions(-)

Toggle diff (261 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index dde2c22ca5..2afef8d3bd 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -50,6 +50,7 @@ (define-module (gnu packages chez)
#:use-module (srfi srfi-26)
#:export (chez-scheme-for-system
racket-cs-native-supported-system?
+ nix-system->pbarch-machine-type
unpack-nanopass+stex))
;; Commentary:
@@ -232,18 +233,41 @@ (define* (chez-upstream-features-for-system #:optional
(and=> (assoc-ref %chez-features-table chez-os)
(cut assoc-ref <> chez-arch))))
+(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."
+ (string-append (if threads?
+ "t"
+ "")
+ "pb"
+ (if (target-64bit? system)
+ "64"
+ "32")
+ ;; missing (guix utils) predicate target-little-endian?
+ (if (target-ppc32? system)
+ "b"
+ "l")))
+
(define* (racket-cs-native-supported-system? #:optional
(system
(or (%current-target-system)
(%current-system))))
- "Can Racket's variant of Chez Scheme generate native code for SYSTEM?
-Otherwise, SYSTEM can use only the ``portable bytecode'' backends."
+ "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 <>))
- #t)))
+ (string-append "t" chez-arch chez-os))))
;;
;; Chez Scheme:
@@ -587,8 +611,12 @@ (define-public chez-scheme-for-racket-bootstrap-bootfiles
(name "chez-scheme-for-racket-bootstrap-bootfiles")
(version (package-version chez-scheme-for-racket))
(source #f) ; avoid problematic cycle with racket.scm
- (native-inputs (list chez-nanopass-bootstrap racket-vm-bc))
- ;; TODO: cross compilation
+ (native-inputs
+ (cons* chez-nanopass-bootstrap
+ (if (%current-target-system)
+ (list zuo
+ chez-scheme-for-racket)
+ (list racket-vm-bc))))
(arguments
(substitute-keyword-arguments
(package-arguments chez-scheme-bootstrap-bootfiles)
@@ -608,11 +636,28 @@ (define-public chez-scheme-for-racket-bootstrap-bootfiles
#$unpack-nanopass+stex))
(add-before 'install 'build
(lambda* (#:key native-inputs inputs #:allow-other-keys)
- (invoke (search-input-file (or native-inputs inputs)
- "/opt/racket-vm/bin/racket")
- "rktboot/main.rkt"))))))))
- (supported-systems
- (package-supported-systems chez-scheme-for-racket))
+ #$(cond
+ ((%current-target-system)
+ ;; cross-compiling
+ #~(invoke
+ (search-input-file (or native-inputs inputs)
+ "/bin/zuo")
+ "makefiles/boot.zuo"
+ (search-input-file (or native-inputs inputs)
+ "/bin/scheme")
+ #$(or (racket-cs-native-supported-system?)
+ (nix-system->pbarch-machine-type))))
+ (else
+ ;; bootstrapping
+ #~(invoke
+ (search-input-file (or native-inputs inputs)
+ "/opt/racket-vm/bin/racket")
+ "rktboot/main.rkt"
+ #$@(if (racket-cs-native-supported-system?)
+ #~()
+ (let ((m (nix-system->pbarch-machine-type)))
+ #~("--machine" #$m)))))))))))))
+ (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
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index f1a2794164..7920d6812c 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -129,10 +129,9 @@ (define-module (gnu packages racket)
;; This file defines the packages 'racket-vm-cgc', 'racket-vm-bc', and
;; 'racket-vm-cs'. All three are in-place builds of 'racket/src/' and
;; 'racket/collects/' and are installed to 'opt/racket-vm/' in the store
-;; output. The function 'racket-vm-for-system' returns the recomended Racket
-;; VM package for a given system.
+;; output.
;;
-;; We then define the packages 'racket-minimal' and
+;; Using 'racket-vm-cs', we then define the packages 'racket-minimal' and
;; 'racket'. These use Racket's support for ``layered installations'', which
;; allow an immutable base layer to be extended with additional packages.
;; They use the layer configuration directly provide ready-to-install FHS-like
@@ -193,17 +192,6 @@ (define-module (gnu packages racket)
;;
;; CODE:
-(define* (racket-vm-for-system #:optional
- (system (or (%current-target-system)
- (%current-system))))
- "Return 'racket-vm-cs' if we are able to build it for SYSTEM; 'racket-vm-bc'
-otherwise."
- ;; Once we figure out the issues in https://racket.discourse.group/t/950,
- ;; we can use 'racket-vm-cs' everywhere.
- (if (racket-cs-native-supported-system? system)
- racket-vm-cs
- racket-vm-bc))
-
(define %racket-version "8.6") ; Remember to update chez-scheme-for-racket!
(define %zuo-version "1.0") ;; defined in racket/src/zuo/zuo.c
(define %racket-commit
@@ -331,9 +319,12 @@ (define-public racket-vm-cgc
(source %racket-origin)
(inputs (list ncurses ;; <- common to all variants (for #%terminal)
bash-minimal ;; <- common to all variants (for `system`)
- libffi)) ;; <- only for BC variants
- (native-inputs (list zuo ;; <- for all variants
- libtool)) ;; <- only for BC variants
+ libffi)) ;; <- for BC and non-native CS variants
+ (native-inputs (cons* zuo ;; <- for all variants
+ libtool ;; <- only for BC variants
+ (if (%current-target-system)
+ (list this-package)
+ '())))
(outputs '("out" "debug"))
(build-system gnu-build-system)
(arguments
@@ -421,8 +412,10 @@ (define-public racket-vm-bc
(inherit racket-vm-cgc)
(name "racket-vm-bc")
(native-inputs
- (modify-inputs (package-native-inputs racket-vm-cgc)
- (prepend racket-vm-cgc)))
+ (if (%current-target-system)
+ (package-native-inputs racket-vm-cgc)
+ (modify-inputs (package-native-inputs racket-vm-cgc)
+ (prepend racket-vm-cgc))))
(arguments
(substitute-keyword-arguments (package-arguments racket-vm-cgc)
((#:configure-flags _ '())
@@ -432,10 +425,8 @@ (define-public racket-vm-bc
(description "The Racket BC (``before Chez'' or ``bytecode'')
implementation was the default before Racket 8.0. It uses a compiler written
in C targeting architecture-independent bytecode, plus a JIT compiler on most
-platforms. Racket BC has a different C API and supports a slightly different
-set of architectures than the current default runtime system, Racket CS (based
-on ``Chez Scheme''). It is the recommended implementation for architectures
-that Racket CS doesn't support.
+platforms. Racket BC has a different C API than the current default runtime
+system, Racket CS (based on ``Chez Scheme'').
This package is the normal implementation of Racket BC with a precise garbage
collector, 3M (``Moving Memory Manager'').")
@@ -448,15 +439,24 @@ (define-public racket-vm-cs
(inherit racket-vm-bc)
(name "racket-vm-cs")
(inputs
- (modify-inputs (package-inputs racket-vm-cgc)
- (prepend zlib lz4)
- (delete "libffi")))
+ (let ((inputs (modify-inputs (package-inputs racket-vm-cgc)
+ (prepend zlib lz4))))
+ (if (racket-cs-native-supported-system?)
+ (modify-inputs inputs
+ (delete "libffi"))
+ inputs)))
(native-inputs
- (modify-inputs (package-native-inputs racket-vm-cgc)
- (delete "libtool")
- (prepend chez-scheme-for-racket
- chez-nanopass-bootstrap
- racket-vm-bc)))
+ (let ((native-inputs (package-native-inputs racket-vm-cgc)))
+ (modify-inputs (if (%current-target-system)
+ (modify-inputs native-inputs
+ (delete "racket-vm-cgc"))
+ native-inputs)
+ (delete "libtool")
+ (prepend chez-scheme-for-racket
+ chez-nanopass-bootstrap
+ (if (%current-target-system)
+ racket-vm-cs
+ racket-vm-bc)))))
(arguments
(substitute-keyword-arguments (package-arguments racket-vm-cgc)
((#:phases those-phases #~%standard-phases)
@@ -470,15 +470,22 @@ (define-public racket-vm-cs
"--enable-libz"
"--enable-lz4"
(string-append "--enable-scheme="
- #$(this-package-native-input
+ #+(this-package-native-input
"chez-scheme-for-racket")
"/bin/scheme")
+ #$@(if (racket-cs-native-supported-system?)
+ #~()
+ #~(#$(string-append "--enable-mach="
+ (nix-system->pbarch-machine-type))
+ "--enable-pb"))
#$(racket-vm-common-configure-flags)))))
(synopsis "Racket CS implementation")
(description "The Racket CS implementation, which uses ``Chez Scheme'' as
its core compiler and runtime system, has been the default Racket VM
implementation since Racket 8.0. It performs better than the Racket BC
-implementation for most programs.
+implementation for most programs. On systems for which Racket CS cannot
+generate machine code, this package uses a variant of its ``portable
+bytecode'' backend specialized for word size and endianness.
Using the Racket VM packages directly is not recommended: instead, install the
@code{racket-minimal} or @code{racket} packages.")
@@ -554,7 +561,7 @@ (define-public racket-minimal
(inputs
(list openssl
sqlite
- (racket-vm-for-system)
+ racket-vm-cs
(racket-packages-origin
"base" %racket-origin
'(("base" "pkgs/base")
@@ -672,7 +679,7 @@ (define-public racket
unixodbc
libedit ;; TODO reconsider in light of expeditor and readline-gpl
racket-minimal ;; <-- TODO non-tethered layer
- (racket-vm-for-system)
+ racket-vm-cs
(simple-racket-origin
"2d" (base32 "0fb5v6058ls08xw3zbmqyr2ym0psm119gl9ffgmhm9w8rs9i4dq7")
'("2d" "2d-doc" "2d-lib"))
--
2.32.0
P
P
Philip McGrath wrote on 8 Aug 2022 08:10
[PATCH 6/6] gnu: chez-scheme-for-racket: Suport all systems.
(address . 57050@debbugs.gnu.org)(name . Philip McGrath)(address . philip@philipmcgrath.com)
00975c823227acd41fc714d237449834f88d1530.1659936550.git.philip@philipmcgrath.com
On systems for which 'chez-scheme-for-racket' cannot generate native
code, use the applicable 'pbarch' machine type as with 'racket-vm-cs'.

In the process, this commit adds support for cross-compiling
'chez-scheme-for-racket', though not support for compiling it as a
cross-compiler to use in cross-compiling other Scheme programs.

* gnu/packages/chez.scm (chez-scheme)[native-inputs]: Move
'chez-scheme-bootstrap-bootfiles' to ...
[inputs]: ... this field.
[arguments]<#:phases>: Update 'unpack-bootfiles' accordingly.
(chez-scheme-for-racket)[native-inputs]: Add 'this-package' when
cross-compiling. Move 'chez-scheme-for-racket-bootstrap-bootfiles' to ...
[inputs]: ... this field. Add 'libffi' for 'pbarch' machine types.
[arguments]: Support cross-compilation and 'pbarch' machine types.
[supported-systems]: Use '%supported-systems'.
[description]: Update.
---
gnu/packages/chez.scm | 93 ++++++++++++++++++++++++++++++++-----------
1 file changed, 70 insertions(+), 23 deletions(-)

Toggle diff (177 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 2afef8d3bd..0ab82ef8bf 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -38,6 +38,7 @@ (define-module (gnu packages chez)
#:use-module (gnu packages compression)
#:use-module (gnu packages ncurses)
#:use-module (gnu packages ghostscript)
+ #:use-module (gnu packages libffi)
#:use-module (gnu packages linux)
#:use-module (gnu packages netpbm)
#:use-module (gnu packages racket)
@@ -318,6 +319,7 @@ (define-public chez-scheme
(build-system gnu-build-system)
(inputs
(list
+ chez-scheme-bootstrap-bootfiles
`(,util-linux "lib") ;<-- libuuid
zlib
lz4
@@ -326,8 +328,7 @@ (define-public chez-scheme
;; for X11 clipboard support in expeditor:
;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
libx11))
- (native-inputs (list chez-scheme-bootstrap-bootfiles
- chez-nanopass-bootstrap
+ (native-inputs (list chez-nanopass-bootstrap
stex-bootstrap))
(native-search-paths
(list (search-path-specification
@@ -366,7 +367,7 @@ (define-public chez-scheme
(when (directory-exists? "boot")
(delete-file-recursively "boot"))
(copy-recursively
- (search-input-directory (or native-inputs inputs)
+ (search-input-directory inputs
"lib/chez-scheme-bootfiles")
"boot")))
;; NOTE: The custom Chez 'configure' script doesn't allow
@@ -476,13 +477,21 @@ (define-public chez-scheme-for-racket
;; When updating, remember to also update %racket-version in racket.scm.
(source #f) ; avoid problematic cycle with racket.scm
(inputs
- (modify-inputs (package-inputs chez-scheme)
- (delete "libx11" "util-linux:lib")))
+ (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
+ (append libffi)))))
(native-inputs
- (modify-inputs (package-native-inputs chez-scheme)
- (append zuo)
- (replace "chez-scheme-bootstrap-bootfiles"
- chez-scheme-for-racket-bootstrap-bootfiles)))
+ (let ((native-inputs (modify-inputs (package-native-inputs chez-scheme)
+ (append zuo))))
+ (if (%current-target-system)
+ (modify-inputs native-inputs
+ (append this-package))
+ native-inputs)))
(arguments
(substitute-keyword-arguments (package-arguments chez-scheme)
((#:out-of-source? _ #f)
@@ -496,6 +505,21 @@ (define-public chez-scheme-for-racket
((#: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
@@ -518,25 +542,46 @@ (define-public chez-scheme-for-racket
#$mk-flags))
((#:phases those-phases #~%standard-phases)
#~(let* ((those-phases #$those-phases)
- (unpack (assoc-ref those-phases 'unpack)))
+ (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 make-flags #:allow-other-keys)
+ (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"
- make-flags)))
+ (if native-inputs
+ (cons (string-append
+ "Scheme="
+ (search-input-file native-inputs
+ "/bin/scheme"))
+ make-flags)
+ make-flags))))
(replace 'unpack
(lambda args
- (unpack #:source #$(or (package-source this-package)
- (package-source racket-vm-bc)))))
+ (gnu:unpack #:source #$(or (package-source this-package)
+ (package-source racket-vm-bc)))))
(add-after 'unpack 'chdir
(lambda args
(chdir "racket/src/ChezScheme"))))))))
- ;; TODO: How to build pbarch/pbchunks for other systems?
- ;; See https://racket.discourse.group/t/950
- (supported-systems (filter racket-cs-native-supported-system?
- %supported-systems))
+ (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
@@ -549,13 +594,17 @@ (define-public chez-scheme-for-racket
Main additions to Chez Scheme in the Racket variant:
@itemize @bullet
@item
-AArch64 support
+AArch64 code generation
@item
-Portable bytes (@code{pb}) support, which is mainly useful for bootstrapping
-a build on any supported platform
+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 attachments
@@ -566,8 +615,6 @@ (define-public chez-scheme-for-racket
@item
Ordered finalization, immobile (but collectable) objects, weak/ephemeron
generic hash tables, and reference bytevectors
-@item
-Faster multiplication and division for large exact numbers
@end itemize")
(license asl2.0)))
--
2.32.0
L
L
Liliana Marie Prikler wrote on 8 Aug 2022 10:53
Re: [PATCH 3/6] gnu: chez-scheme: Fix use of "/bin/sh".
77d198cb202f2fa77ec8b54bc26a3d2e3836792c.camel@ist.tugraz.at
Am Montag, dem 08.08.2022 um 02:10 -0400 schrieb Philip McGrath:
Toggle quote (159 lines)
> The unsuccessful attempt to execute "/bin/sh" by Chez Scheme's
> 'process'
> function seems to have caused parts of the Chez Scheme test suite to
> have been silently skipped. The issue was exposed by the upcoming
> changes to Racket's build system.
>
> * gnu/packages/patches/chez-scheme-bin-sh.patch,
> gnu/packages/patches/racket-chez-scheme-bin-sh.patch: New patches.
> * gnu/packages/patches/racket-minimal-sh-via-rktio.patch: Rename to
> ...
> * gnu/packages/patches/racket-rktio-bin-sh.patch: ... this, refresh
> with
> upstream, and shorten the macro name.
> * gnu/local.mk (dist_patch_DATA): Update accordingly.
> * gnu/packages/racket.scm (%racket-origin)[patches]: Likewise.
> (racket-vm-common-configure-flags): Likewise.
> * gnu/packages/chez.scm (chez-scheme)[origin]<patches>: Likewise.
> [inputs]: Add bash-minimal.
> [arguments]<#:configure-flags>: Set CPPFLAGS to enable new patches.
> ---
>  gnu/local.mk                                  |  4 +-
>  gnu/packages/chez.scm                         |  5 ++
>  gnu/packages/patches/chez-scheme-bin-sh.patch | 66
> +++++++++++++++++++
>  .../patches/racket-chez-scheme-bin-sh.patch   | 66
> +++++++++++++++++++
>  ...-rktio.patch => racket-rktio-bin-sh.patch} | 28 ++++----
>  gnu/packages/racket.scm                       |  5 +-
>  6 files changed, 158 insertions(+), 16 deletions(-)
>  create mode 100644 gnu/packages/patches/chez-scheme-bin-sh.patch
>  create mode 100644 gnu/packages/patches/racket-chez-scheme-bin-
> sh.patch
>  rename gnu/packages/patches/{racket-minimal-sh-via-rktio.patch =>
> racket-rktio-bin-sh.patch} (79%)
>
> diff --git a/gnu/local.mk b/gnu/local.mk
> index 234f21ad33..e827feed36 100644
> --- a/gnu/local.mk
> +++ b/gnu/local.mk
> @@ -940,6 +940,7 @@ dist_patch_DATA
> =                                           \
>    %D%/packages/patches/ceph-boost-compat.patch                 \
>    %D%/packages/patches/ceph-rocksdb-compat.patch               \
>    %D%/packages/patches/cheese-vala-
> update.patch                        \
> +  %D%/packages/patches/chez-scheme-bin-
> sh.patch                        \
>    %D%/packages/patches/chmlib-inttypes.patch                   \
>    %D%/packages/patches/cl-asdf-config-
> directories.patch                \
>    %D%/packages/patches/clamav-config-llvm-libs.patch           \
> @@ -1769,7 +1770,8 @@ dist_patch_DATA
> =                                         \
>    %D%/packages/patches/ripperx-missing-file.patch              \
>    %D%/packages/patches/rpcbind-CVE-2017-8779.patch             \
>    %D%/packages/patches/rtags-separate-
> rct.patch                        \
> -  %D%/packages/patches/racket-minimal-sh-via-rktio.patch       \
> +  %D%/packages/patches/racket-chez-scheme-bin-sh.patch         \
> +  %D%/packages/patches/racket-rktio-bin-sh.patch               \
>    %D%/packages/patches/remake-impure-
> dirs.patch                        \
>    %D%/packages/patches/restic-0.9.6-fix-tests-for-go1.15.patch \
>    %D%/packages/patches/retroarch-LIBRETRO_DIRECTORY.patch      \
> diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
> index 4c253effa0..66098c7a24 100644
> --- a/gnu/packages/chez.scm
> +++ b/gnu/packages/chez.scm
> @@ -34,6 +34,7 @@ (define-module (gnu packages chez)
>    #:use-module (guix build-system copy)
>    #:use-module (guix build-system gnu)
>    #:use-module (guix build-system copy)
> +  #:use-module (gnu packages bash)
>    #:use-module (gnu packages compression)
>    #:use-module (gnu packages ncurses)
>    #:use-module (gnu packages ghostscript)
> @@ -269,6 +270,7 @@ (define-public chez-scheme
>                 (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
> @@ -287,6 +289,7 @@ (define-public chez-scheme
>        `(,util-linux "lib") ;<-- libuuid
>        zlib
>        lz4
> +      bash-minimal ;<-- for process
>        ncurses ;<-- for expeditor
>        ;; for X11 clipboard support in expeditor:
>        ;;
> https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
> @@ -313,6 +316,8 @@ (define-public chez-scheme
>                          (cut memq 'threads <>))
>                   #~("--threads")
>                   #~())
> +          ,(string-append "CPPFLAGS=-DGUIX_RKTIO_BIN_SH="
> +                          #$(file-append bash-minimal "/bin/sh"))
>            "ZLIB=-lz"
>            "LZ4=-llz4"
>            "--libkernel"
> diff --git a/gnu/packages/patches/chez-scheme-bin-sh.patch
> b/gnu/packages/patches/chez-scheme-bin-sh.patch
> new file mode 100644
> index 0000000000..e6228e3264
> --- /dev/null
> +++ b/gnu/packages/patches/chez-scheme-bin-sh.patch
> @@ -0,0 +1,66 @@
> +From c170f0f3a326f293ee1f460a70303382966ca41b Mon Sep 17 00:00:00
> 2001
> +From: Philip McGrath <philip@philipmcgrath.com>
> +Date: Thu, 19 May 2022 13:41:56 -0400
> +Subject: [PATCH] patch s_process for "/bin/sh" on Guix
> +
> +This patch reuses the C preprocessor macro `GUIX_RKTIO_BIN_SH`
> +from a previous patch.
> +
> +If:
> +
> +    1. The `GUIX_RKTIO_BIN_SH` macro is defined; and
> +
> +    2. The path specified by `GUIX_RKTIO_BIN_SH` exists;
> +
> +then `s_process` will call `execl` with the file specified by
> +`GUIX_RKTIO_BIN_SH` instead of "/bin/sh".
> +
> +This patch does not change the behavior of `s_system`, which relies
> +on `system` from the C library.
> +---
> + c/prim5.c | 20 +++++++++++++++++++-
> + 1 file changed, 19 insertions(+), 1 deletion(-)
> +
> +diff --git a/c/prim5.c b/c/prim5.c
> +index 5a07893..926d68d 100644
> +--- a/c/prim5.c
> ++++ b/c/prim5.c
> +@@ -746,6 +746,22 @@ static ptr s_process(char *s, IBOOL stderrp) {
> +
> +     INT tofds[2], fromfds[2], errfds[2];
> +     struct sigaction act, oint_act;
> ++    /* BEGIN PATCH for Guix */
> ++#if defined(GUIX_RKTIO_BIN_SH)
> ++# define GUIX_AS_a_STR_HELPER(x) #x
> ++# define GUIX_AS_a_STR(x) GUIX_AS_a_STR_HELPER(x)
> ++    /* A level of indirection makes `#` work as needed: */
> ++    struct stat guix_stat_buf;
> ++    char *guix_sh =
> ++      (0 == stat(GUIX_AS_a_STR(GUIX_RKTIO_BIN_SH), &guix_stat_buf))
> ++      ? GUIX_AS_a_STR(GUIX_RKTIO_BIN_SH)
> ++      : "/bin/sh";
> ++# undef GUIX_AS_a_STR
> ++# undef GUIX_AS_a_STR_HELPER
> ++#else /* GUIX_RKTIO_BIN_SH */
> ++    char *guix_sh = "/bin/sh";
> ++#endif
> ++    /* END PATCH for Guix */
/* BEGIN PATCH for Guix */ and /* END PATCH for Guix */ is in my humble
opinion superfluous (though apparently also present in the already
exsting patch, whose author might disagree).
Also, I think this could easily be submitted upstream if you named it
RKTIO_SHELL and rktio_shell respectively, with the default to
"/bin/sh". Then, we'd simply have to -DRKTIO_SHELL=/path/to/bin/sh in
our #:make-flags.

Toggle quote (3 lines)
> ++        /* BEGIN PATCH for Guix */
> ++        execl(guix_sh, guix_sh, "-c", s, NULL);
> ++        /* END PATCH for Guix */
Likewise.

As for absorbing racket-specific patches into chez-scheme itself, I'm
not too sure if I agree with that approach. Maybe a different prefix
rather than RKTIO should be used here – one that fits chez.


Cheers
L
L
Liliana Marie Prikler wrote on 8 Aug 2022 11:01
Re: [PATCH 4/6] gnu: Update Racket to 8.6. Add Zuo.
96f3cec04fae1abefe2e4273b1aed941e3159752.camel@ist.tugraz.at
You should really split this into two patches. One to add Zuo, one to
upgrade the Racket stuff. Maybe you need even more steps if Zuo
depends on parts of the racket bootstrap.

You will probably have to parameterize the Racket origin in a bunch of
packages to get things going. As an upside, this added flexibility
hopefully comes in handy with the next Racket upgrade.

Cheers
L
L
Liliana Marie Prikler wrote on 8 Aug 2022 11:10
Re: [PATCH 5/6] gnu: racket: Use Racket CS on all systems.
3e75d0e60cb79ca6c8762f6afba9395e98ce3741.camel@ist.tugraz.at
Am Montag, dem 08.08.2022 um 02:10 -0400 schrieb Philip McGrath:
Toggle quote (18 lines)
> On systems for which Racket CS cannot generate native code, it can
> use a 'pbarch' machine type---a variant of the ``portable bytecode''
> backend specialized to word size and endianness---allowing Racket CS
> to replace Racket BC on those systems while maintaining comparable
> performance. (Racket BC lacks JIT support for those systems anyway.)
>
> This patch adds 'pbarch' support to 'racket-vm-cs' and
> 'chez-scheme-for-racket-bootstrap-bootfiles' and changes 'racket' and
> 'racket-minimal' to use 'racket-vm-cs' on all systems.
>
> In the process, it also adds support for cross-compiling the
> bootfiles, 'racket-vm-cgc', 'racket-vm-bc', and 'racket-vm-cs'. This
> is not enough to cross-compile 'racket-minimal' or 'racket': that
> would require building and loading cross-compilation pluggins for
> 'racket-vm-cs' which will be much easier once we can build the
> package 'raco-cross'.
>
> This patch does not address 'chez-scheme-for-racket'.
This patch still does a lot. I'd suggest splitting it into at least
two parts: one to build pbarch, possibly one to address cross-compiling
(i.e. the adding of this-package to native-inputs), and one to use it
everywhere.



Cheers
L
L
Liliana Marie Prikler wrote on 8 Aug 2022 11:15
Re: [PATCH 6/6] gnu: chez-scheme-for-racket: Suport all systems.
1b4362544ff95c3868d84bce4822afaede9b155a.camel@ist.tugraz.at
Am Montag, dem 08.08.2022 um 02:10 -0400 schrieb Philip McGrath:
Toggle quote (20 lines)
> On systems for which 'chez-scheme-for-racket' cannot generate native
> code, use the applicable 'pbarch' machine type as with 'racket-vm-
> cs'.
>
> In the process, this commit adds support for cross-compiling
> 'chez-scheme-for-racket', though not support for compiling it as a
> cross-compiler to use in cross-compiling other Scheme programs.
>
> * gnu/packages/chez.scm (chez-scheme)[native-inputs]: Move
> 'chez-scheme-bootstrap-bootfiles' to ...
> [inputs]: ... this field.
> [arguments]<#:phases>: Update 'unpack-bootfiles' accordingly.
> (chez-scheme-for-racket)[native-inputs]: Add 'this-package' when
> cross-compiling. Move 'chez-scheme-for-racket-bootstrap-bootfiles' to
> ...
> [inputs]: ... this field. Add 'libffi' for 'pbarch' machine types.
> [arguments]: Support cross-compilation and 'pbarch' machine types.
> [supported-systems]: Use '%supported-systems'.
> [description]: Update.
> ---
Also split into three: 1. move the bootfiles and unpack them correctly
(I suspect this is a noop because cross-compilation is not supported
atm), 2. add the machine types and update %supported-systems, 3. cross-
compile.

Cheers
P
P
Philip McGrath wrote on 9 Aug 2022 22:25
Re: [PATCH 3/6] gnu: chez-scheme: Fix use of "/bin/sh".
10947119.NyiUUSuA9g@avalon
Hi,

On Monday, August 8, 2022 4:53:42 AM EDT Liliana Marie Prikler wrote:
Toggle quote (30 lines)
> Am Montag, dem 08.08.2022 um 02:10 -0400 schrieb Philip McGrath:
> > +diff --git a/c/prim5.c b/c/prim5.c
> > +index 5a07893..926d68d 100644
> > +--- a/c/prim5.c
> > ++++ b/c/prim5.c
> > +@@ -746,6 +746,22 @@ static ptr s_process(char *s, IBOOL stderrp) {
> > +
> > + INT tofds[2], fromfds[2], errfds[2];
> > + struct sigaction act, oint_act;
> > ++ /* BEGIN PATCH for Guix */
> > ++#if defined(GUIX_RKTIO_BIN_SH)
> > ++# define GUIX_AS_a_STR_HELPER(x) #x
> > ++# define GUIX_AS_a_STR(x) GUIX_AS_a_STR_HELPER(x)
> > ++ /* A level of indirection makes `#` work as needed: */
> > ++ struct stat guix_stat_buf;
> > ++ char *guix_sh =
> > ++ (0 == stat(GUIX_AS_a_STR(GUIX_RKTIO_BIN_SH), &guix_stat_buf))
> > ++ ? GUIX_AS_a_STR(GUIX_RKTIO_BIN_SH)
> > ++ : "/bin/sh";
> > ++# undef GUIX_AS_a_STR
> > ++# undef GUIX_AS_a_STR_HELPER
> > ++#else /* GUIX_RKTIO_BIN_SH */
> > ++ char *guix_sh = "/bin/sh";
> > ++#endif
> > ++ /* END PATCH for Guix */
>
> /* BEGIN PATCH for Guix */ and /* END PATCH for Guix */ is in my humble
> opinion superfluous (though apparently also present in the already
> exsting patch, whose author might disagree).

My goal here originally was making it clear in `guix build --source` exactly
what we'd changed from upstream. (That's less relevant for the patches with
"backport" in the name, which have all been merged upstream.) It certainly is
debatable, given that "guix" is mentioned in the variable/macro names, but,
given that it's currently there, I'm not inclined to change the status quo.

Toggle quote (6 lines)
> Also, I think this could easily be submitted upstream if you named it
> RKTIO_SHELL and rktio_shell respectively, with the default to
> "/bin/sh". Then, we'd simply have to -DRKTIO_SHELL=/path/to/bin/sh in
> our #:make-flags.
>

I'm not strongly opposed to sending these patches upstream. The main reason I
haven't, and also the reason that, were I a Racket committer (which I'm not),
I'd be slightly hesitant to merge them, is that I can't think of a
circumstance other than Guix for which these patches would be useful: even Nix
apparently provides "/bin/sh" and "/bin/env" in build containers.

If the patches are indeed specific to Guix, they haven't been a burden to
maintain—this is the only time they've been changed at all—and keeping them
ourselves gives us maximum flexibility to change them if we do want to for any
reason.

In any case, even if we do upstream them, we'd still need the patches until
8.7.

Toggle quote (6 lines)
>
> As for absorbing racket-specific patches into chez-scheme itself, I'm
> not too sure if I agree with that approach. Maybe a different prefix
> rather than RKTIO should be used here – one that fits chez.
>

I can understand the hesitation, but I think on balance these are not "Racket-
specific patches". First, just in case this wasn't clear, the issue affects both
variants of Chez Scheme: see the end of this email for an example. More
generally, any programming language that provides a way to run shell commands
will need to deal with this issue: that includes libc's `system` function (I
haven't looked at what we do there), and it also came up with SML/NJ: https://
lists.gnu.org/archive/html/help-guix/2021-11/msg00036.html

For the packages that are developed in the main Racket Git repository, I would
be loathe to use more than one preprocessor macro for this purpose. While at
the moment it works nicely for us to control all of the intermediate build
steps explicitly as Guix packages, many build modes handle some of those steps
automatically, and it would be very unpleasant to have to configure with three
different flags, potentially in both CPPFLAGS and CPPFLAGS_FOR_BUILD.

The question, then, comes down to upstream Chez Scheme, and to me the benefits
of using the same macro for these two very closely related projects far
outweighs the downside. (For one metric of their interrelationship, over 10%
of the commits to upstream Chez since it became free software in 2016 have
come from Racket contributors—though this metric badly undercounts the c.
375,000 lines of code developed by Dybvig et al. since 1984.)

I guess another possibility would be to call the macro something like
GUIX_BIN_SH. That would make sense if we intended to adopt this approach more
broadly, as I suggested in the email linked above about SML/NJ, but I think
we'd need some consensus in that case to reserve a concise name that wouldn't
conflict with other uses in Guix.

-Philip

Toggle snippet (40 lines)
philip@avalon:~$ guix shell --container chez-scheme -- scheme
Chez Scheme Version 9.5.8
Copyright 1984-2022 Cisco Systems, Inc.

> (get-string-all (car (process "echo $BASH")))
"/bin/sh\n"
>
philip@avalon:~$ guix shell --container chez-scheme-for-racket -- scheme
Chez Scheme Version 9.5.7.6
Copyright 1984-2021 Cisco Systems, Inc.

> (get-string-all (car (process "echo $BASH")))
"/bin/sh\n"
>
philip@avalon:~$
philip@avalon:~$ guix time-machine --url=https://gitlab.com/philip1/guix-patches --commit=5e5e8f491c7cbee3ef7a21437a52675dd47d186e --disable-
authentication -- shell --container chez-scheme -- scheme
Updating channel 'guix' from Git repository at 'https://gitlab.com/philip1/
guix-patches'...
guix time-machine: warning: channel authentication disabled
Computing Guix derivation for 'x86_64-linux'... -
Chez Scheme Version 9.5.8
Copyright 1984-2022 Cisco Systems, Inc.

> (get-string-all (car (process "echo $BASH")))
"/gnu/store/chfwin3a4qp1znnpsjbmydr2jbzk0d6y-bash-minimal-5.1.8/bin/sh\n"
>
philip@avalon:~$ guix time-machine --url=https://gitlab.com/philip1/guix-patches --commit=5e5e8f491c7cbee3ef7a21437a52675dd47d186e --disable-
authentication -- shell --container chez-scheme-for-racket -- scheme
Updating channel 'guix' from Git repository at 'https://gitlab.com/philip1/
guix-patches'...
guix time-machine: warning: channel authentication disabled
Computing Guix derivation for 'x86_64-linux'... -
Chez Scheme Version 9.5.7.6
Copyright 1984-2021 Cisco Systems, Inc.

> (get-string-all (car (process "echo $BASH")))
"/gnu/store/chfwin3a4qp1znnpsjbmydr2jbzk0d6y-bash-minimal-5.1.8/bin/sh\n"
>
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEE9GWrrNY3rqwUFVXPygNjjfo/HHoFAmLywtIACgkQygNjjfo/
HHprphAAtObMqsomh1epZIg2h/O/j1gKZkGOTpcHxZVdBOoLdgSwhAt8lXo/Vvo8
p6ig3b9L7tYgRY37BJPo2L5TBWiMo/vwIT4MTmaU46f9Zl8dnOJrX04yv4X4L1zu
gtoBll5UWoLB4E6A6KPgBEh5ZvARwTXQ8tdmrM8nq73nWM5bWCwS79gf62xRQOxL
/9twly4clqqZ4CgYJYr9ISZfj6/jwLWXRBnmPlyTiP+UU44OP9w+WKQUQVzssIc5
cHKECptyy1Cqz++AzkXVHdUIg67JMufRYrKGmeW0JfgkH9C2E1UzlM0keQdlha6G
/oz9r/JcUBH1JLNsFAUe7rkZrXtADBehuQwchs1YLuuG+uYiCksNHVBI4+sGnni6
//Rhqvbro0becNHHpz6xgLDGfN/kxE5hVbSV5n48ibf0IiE7c+CSfsTTbBYZX5Vp
0RoVz5wzJDXqma8Sk9JRZBJUAJ3Wz2SX4o/Cc12YMIKoz8aBgTCQ4drcJFlaRItc
aFVc7ru4SIogLSJIgXQki0o1Xso48AUcI8AMzZf/DaRAVpD0EBl2j3qJkVnYH2GH
y2if+mx52aS6CDIIEHHeqnUjrGkI/wMsBHHA+bH8x6YR5UJz8gGwiAE/9BEmV8vD
jiCgT1NExFwmiBerpgDjgmUTmEtCB3UV6OlQVfJH9H5v6hFL0Ic=
=6Ozx
-----END PGP SIGNATURE-----


P
P
Philip McGrath wrote on 9 Aug 2022 22:56
Re: [PATCH 4/6] gnu: Update Racket to 8.6. Add Zuo.
8096362.Sb9uPGUboI@avalon
Hi,

On Monday, August 8, 2022 5:01:31 AM EDT Liliana Marie Prikler wrote:
Toggle quote (9 lines)
> You should really split this into two patches. One to add Zuo, one to
> upgrade the Racket stuff. Maybe you need even more steps if Zuo
> depends on parts of the racket bootstrap.
>
> You will probably have to parameterize the Racket origin in a bunch of
> packages to get things going. As an upside, this added flexibility
> hopefully comes in handy with the next Racket upgrade.
>

I am especially reluctant to split this patch apart.

If I had to, I could make one patch adding the Zuo package with an origin
inheriting from the previous %racket-origin, but adjusting the patches,
commit, file name, and checksum to make the %racket-origin in this patch. (As I
wrote in the patch, Zuo has no dependencies, it's just `cc -o zuo zuo.c`.)
Then, a second patch would make %racket-origin as it is in this package,
change Zuo to use it, and update the other packages.

But I do not see the benefit in doing so. I would still need a commit changing
the same set of packages, short of leaving some of them broken. And adding,
then immediately removing, a temporary origin for Zuo would seem to me to make
reviewing this harder, not easier, both now and when reviewing these changes
in the future.

The packages developed in the main Racket Git repository are very tightly
linked. They are developed there precisely to make sure they are all always at
consistent versions. Fighting against that is just going to cause difficulty
with every Racket update. For example, there is no commitment that the version
of Zuo released with Racket 8.5 will be able to build Racket 8.6.

I think this patch is better as a single commit, and at lease as justified as
commits like b97f549b14402421fcfb360ddd4cff7de93b9af0.

-Philip
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEE9GWrrNY3rqwUFVXPygNjjfo/HHoFAmLyyg0ACgkQygNjjfo/
HHqLzRAAs5ACsXRHCCBY9QdVpq76mNqTv6+Ilw5kztDvJwPUDT8bawGFNkEi1LZ5
frOZKOfzxY5pP/s4uXKvqUkGvI3AAdQ9luWE72NrwNaddb1Qu4xPceRwDXP1Kg6d
07qwjdQrlinaEWk08wEQ1Ic2wT8IOzdBs+EbltuHtKRTPOnX8iLjefTlGPJAE6oI
/hG66AGG06es7FF4Gz1daMT64L411WkC07oeLmjkXhjL/h+RbVihSkwlcIFgjO/Q
u/Gqdj8zaJTY1H6zoKOhDdXx21Ow4vpxbxZ6An5lfB6m79eVEYpUbXCNYW2K+BvV
TviGkW7oaSzkrCksrKMw5i7Zd7IDjvdyT75H8MtrYg1JfZwV9cSudZ2Dkg0s7Kwq
5hxsWb+GRZX+GIR/UO4psZ3/8ym36EmxIXrqP4gHqiufaHLMQyWlbJA4zyEclS2Y
Zf9CSX6+3XLAMdekeVSpm/WI5LfqN1mpNTHJES7ZL9niMcqX2+nARBN9fzamrFAT
E+JW+v5lYfgFNBWwQFuq+UrVlyistt2sZULnEoNEEbQ1qQkbW4thhhrDJPBkUlBk
ipy+MXu5JnNz7jDgLuFuEsEGjgZygnkvvpEB0zORuUmaOF/vvQtVAJoRG3+nvZcP
tSkeKzl/L6Ou+TcwHxzPN5TOSzd1Z8gUqcG0GmVMt/yj9HmMTFI=
=+TFz
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 9 Aug 2022 23:24
Re: [bug#57050] [PATCH 3/6] gnu: chez-scheme: Fix use of "/bin/sh".
7494a36b-f80d-2365-6148-48b809607b86@telenet.be
On 09-08-2022 22:25, Philip McGrath wrote:
Toggle quote (5 lines)
> I guess another possibility would be to call the macro something like
> GUIX_BIN_SH. That would make sense if we intended to adopt this approach more
> broadly, as I suggested in the email linked above about SML/NJ, but I think
> we'd need some consensus in that case to reserve a concise name that wouldn't
> conflict with other uses in Guix.
In the glibc headers, there's some (POSIX?) standard macro that points
at "/gnu/store/.../bin/sh" (I don't recall the name), any reason we
aren't using that macro?  That would be Guix-independent. I'm not sure
if a /gnu/store/... prefix is included, but if not, maybe we could try
overriding it with -D...="/gnu/store/...", or failing that, add a
post-unpack substitute* replacing [the macro name] ->
"/gnu/store/.../bin/sh".
Greetings,
Maxime.
Attachment: OpenPGP_signature
(
CM1TNDWWOLD9.E9YKGLHO2139@guix-aspire
On Tue Aug 9, 2022 at 10:24 PM BST, Maxime Devos wrote:
Toggle quote (8 lines)
> In the glibc headers, there's some (POSIX?) standard macro that points
> at "/gnu/store/.../bin/sh" (I don't recall the name), any reason we
> aren't using that macro?  That would be Guix-independent. I'm not sure
> if a /gnu/store/... prefix is included, but if not, maybe we could try
> overriding it with -D...="/gnu/store/...", or failing that, add a
> post-unpack substitute* replacing [the macro name] ->
> "/gnu/store/.../bin/sh".

I believe you might be referring to <paths.h>, which defines _PATH_BSHELL.

It's not standard C https://en.cppreference.com/w/c/header nor POSIX

-- (
P
P
Philip McGrath wrote on 9 Aug 2022 23:58
4968242.72vocr9iq0@avalon
On Tuesday, August 9, 2022 5:38:56 PM EDT ( wrote:
Toggle quote (16 lines)
> On Tue Aug 9, 2022 at 10:24 PM BST, Maxime Devos wrote:
> > In the glibc headers, there's some (POSIX?) standard macro that points
> > at "/gnu/store/.../bin/sh" (I don't recall the name), any reason we
> > aren't using that macro? That would be Guix-independent. I'm not sure
> > if a /gnu/store/... prefix is included, but if not, maybe we could try
> > overriding it with -D...="/gnu/store/...", or failing that, add a
> > post-unpack substitute* replacing [the macro name] ->
> > "/gnu/store/.../bin/sh".
>
> I believe you might be referring to <paths.h>, which defines _PATH_BSHELL.
>
> It's not standard C <https://en.cppreference.com/w/c/header> nor POSIX
> <https://pubs.opengroup.org/onlinepubs/9699919799/idx/head.html> though.
>
> -- (

I'd love to be wrong, but I also can't find such a macro. In the glibc source
tree, "stdlib/system.c" defines a stub implementation that always fails with
ENOSYS, and "sysdeps/posix/system.c" contains:

#define SHELL_PATH "/bin/sh" /* Path of the shell. */
#define SHELL_NAME "sh" /* Name to give it. */

Concretely, I think Guix's glibc currently uses /bin/sh dynamically: in my
Chez example above, if you replace `process` with `system` (which uses libc's
`system`), the result is always "/bin/sh\n".

-Philip
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEE9GWrrNY3rqwUFVXPygNjjfo/HHoFAmLy2HoACgkQygNjjfo/
HHpaaRAApknkIY7JrOl0de5PgY5Ol6NmP9SGNOnPR4LhYcA+0cIBZkQhQrtGxatV
KGaBhRAfcSwJygA8FTTA4S2cHRSOQaBKPXZRaytWJjZBJSHKv34MiBI+n0kQvRQf
wb8y9p8n42tl8RafProB7iWyYhVV3XBVfNzu3IZEOD0zqAF1uY0qCQ5vGdodZ/iP
+lIj0p+yJPXYRFUNMkroDiRP2brYZBGZdS9rqgM7JaYmDyo1dljwRirt49o0kXiX
fxy9r5pAdhoNI0XbNDeSe0Uy++C2Ca208rQKedC56nR+uVXuICzuXJG7oaN86lby
IouI1ioj+Fd4uPhTjER+4RZsIBrGU+EJ2brIxImmuBROHPTGj4t2jJkw1qDlKLCD
CKez7CXPpfuZlgEieOUF5SPn+WluuWgSuz7ymrDKgqmrFziZh6ybSz6uox/aWc0s
UjGXToB4enuut6RS8qbLMIWkMt5taZHg0H7am0YgXChiM8pAJbD1WgLuMQQYzXv1
54lAFhSm21zj8ifDQY2Kru9PTlgoE+dQiLpas3W14vjdKDX9pNgTSZBsSxMudzhX
Z4AJymct33HmvKILq+tBR5BbrSXpNPg6cm3DZSRzCRMZzDeNUAFCR6zv/XInUPKg
v2WHAjht32T+BhWC79cfLcF96OUn1UMwTVNk87rxUBvGcfx1JU0=
=bmvv
-----END PGP SIGNATURE-----


(
CM1UAQ3QV65W.1GM37IZUYM082@guix-aspire
On Tue Aug 9, 2022 at 10:58 PM BST, Philip McGrath wrote:
Toggle quote (2 lines)
> I'd love to be wrong, but I also can't find such a macro.

Have a look at sysdeps/generic/paths.h.

-- (
L
L
Liliana Marie Prikler wrote on 10 Aug 2022 09:34
Re: [PATCH 4/6] gnu: Update Racket to 8.6. Add Zuo.
4cc4eedb34c8fea583b2f41ed1ed52095786fe44.camel@ist.tugraz.at
Am Dienstag, dem 09.08.2022 um 16:56 -0400 schrieb Philip McGrath:
Toggle quote (29 lines)
> Hi,
>
> On Monday, August 8, 2022 5:01:31 AM EDT Liliana Marie Prikler wrote:
> > You should really split this into two patches.  One to add Zuo, one
> > to
> > upgrade the Racket stuff.  Maybe you need even more steps if Zuo
> > depends on parts of the racket bootstrap.
> >
> > You will probably have to parameterize the Racket origin in a bunch
> > of
> > packages to get things going.  As an upside, this added flexibility
> > hopefully comes in handy with the next Racket upgrade.
> >
>
> I am especially reluctant to split this patch apart.
>
> If I had to, I could make one patch adding the Zuo package with an
> origin inheriting from the previous %racket-origin, but adjusting
> the patches, commit, file name, and checksum to make the %racket-
> origin in this patch. (As I wrote in the patch, Zuo has no
> dependencies, it's just `cc -o zuo zuo.c`.)
> Then, a second patch would make %racket-origin as it is in this
> package, change Zuo to use it, and update the other packages.
>
> But I do not see the benefit in doing so. I would still need a commit
> changing the same set of packages, short of leaving some of them
> broken. And adding, then immediately removing, a temporary origin
> for Zuo would seem to me to make reviewing this harder, not easier,
> both now and when reviewing these changes in the future.
I don't think you'd need to add an extra variable for the zuo origin,
though. You can simply write (source (origin <whatever>)) and once
you're done switch to (source %racket-origin). That ought to be easy
enough to review.

As for future series, I sadly can't predict what Racket is up to next.
It seems every minor release brings with it a chain of bootstrap
changes and that's very exhausting (at least for me it is, but I can
imagine it's not that easy for you either). We could place our hopes
in the belief that the next Racket upgrade won't be that – then you
simply need to bump Racket origin and that's it. But I personally fear
it won't be that easy and we should prepare.

Toggle quote (2 lines)
> The packages developed in the main Racket Git repository are very
> tightly linked. 
You mean coupled.

Toggle quote (8 lines)
> They are developed there precisely to make sure they are all always
> at consistent versions. Fighting against that is just going to cause
> difficulty with every Racket update. For example, there is no
> commitment that the version of Zuo released with Racket 8.5 will be
> able to build Racket 8.6.
>
> I think this patch is better as a single commit, and at lease as
> justified as commits like b97f549b14402421fcfb360ddd4cff7de93b9af0.
Such commits are an exception rather than a norm, and personally, I
wouldn't sign them off. Since you claim that zuo has no dependencies,
this could easily be avoided, no?

Cheers
M
M
Maxime Devos wrote on 10 Aug 2022 13:46
Re: [bug#57050] [PATCH 3/6] gnu: chez-scheme: Fix use of "/bin/sh".
09795955-8ba6-1bd2-37e7-165105729b8f@telenet.be
On 09-08-2022 23:58, Philip McGrath wrote:
Toggle quote (15 lines)
> On Tuesday, August 9, 2022 5:38:56 PM EDT ( wrote:
>> On Tue Aug 9, 2022 at 10:24 PM BST, Maxime Devos wrote:
>>> In the glibc headers, there's some (POSIX?) standard macro that points
>>> at "/gnu/store/.../bin/sh" (I don't recall the name), any reason we
>>> aren't using that macro? That would be Guix-independent. I'm not sure
>>> if a /gnu/store/... prefix is included, but if not, maybe we could try
>>> overriding it with -D...="/gnu/store/...", or failing that, add a
>>> post-unpack substitute* replacing [the macro name] ->
>>> "/gnu/store/.../bin/sh".
>> I believe you might be referring to <paths.h>, which defines _PATH_BSHELL.
>>
>> It's not standard C <https://en.cppreference.com/w/c/header> nor POSIX
>> <https://pubs.opengroup.org/onlinepubs/9699919799/idx/head.html> though.
>>
>> -- (
Looking at the "paths.h" header, it appears to be a BSDism. Not really standard but still better than a Guix-ism.
Toggle quote (10 lines)
> I'd love to be wrong, but I also can't find such a macro. In the glibc source
> tree, "stdlib/system.c" defines a stub implementation that always fails with
> ENOSYS, and "sysdeps/posix/system.c" contains:
>
> #define SHELL_PATH "/bin/sh" /* Path of the shell. */
> #define SHELL_NAME "sh" /* Name to give it. */
>
> Concretely, I think Guix's glibc currently uses /bin/sh dynamically: in my
> Chez example above, if you replace `process` with `system` (which uses libc's
> `system`), the result is always "/bin/sh\n".
If so, that's a bug.  I do not know what result you are referring to.
Anyway, the Guix package definition of glibc substitutes _PATH_BSHELL
and SHELL_PATH, so unless there's a bug, it doesn't depend on /bin/sh.
Greetings,
Maxime.
Attachment: OpenPGP_signature
T
T
Thiago Jung Bauermann wrote on 10 Aug 2022 17:30
Re: [bug#57050] [PATCH 0/6] gnu: Update Racket to 8.6. Add Zuo.
(name . Philip McGrath)(address . philip@philipmcgrath.com)(address . 57050@debbugs.gnu.org)
87ilmzk04q.fsf@kolabnow.com
Hello Philip,

Philip McGrath <philip@philipmcgrath.com> writes:

Toggle quote (17 lines)
> This patch series contains the Racket 8.6 release, including updating Racket's
> variant of Chez Scheme and adding a package for Zuo, the new tiny Racket-like
> language used for build scripts starting with this release.
>
> (If you've been waiting for the release announcement, this cycle upstream is
> delaying sending it until the new Racket has finished rebuilding all
> of <https://docs.racket-lang.org>, which can take a few days---but the release
> itself is live at <https://download.racket-lang.org> already, and I've been
> told distribution packagers should update now.)
>
> As I mentioned on the mailing list in [1], this release lets us use Racket CS
> and Racket's variant of Chez Scheme on all systems, even those for which the
> compiler can not yet generate native code, such as powerpc64le-linux and
> riscv64-linux. (See the relevant patches for more details.) In particular,
> this means that we can now provide some Chez Scheme package for every system
> Guix supports.

I tried building the zuo branch from your gitlab repo (commit
00975c823227 “gnu: chez-scheme-for-racket: Suport all systems.” from
August 8th) on powerpc64le-linux and had this build failure in
chez-scheme-for-racket-bootstrap-bootfiles-9.5.9.2:

Toggle snippet (46 lines)
starting phase `build'
Assuming current directory has Chez Scheme sources
Use /tmp/guix-build-chez-scheme-for-racket-bootstrap-bootfiles-9.5.9.2.drv-0/source/racket/src/ChezScheme/rktboot/.
Use /tmp/guix-build-chez-scheme-for-racket-bootstrap-bootfiles-9.5.9.2.drv-0/source/racket/src/ChezScheme/nanopass
Use /tmp/guix-build-chez-scheme-for-racket-bootstrap-bootfiles-9.5.9.2.drv-0/source/racket/src/ChezScheme/s
Check /tmp/guix-build-chez-scheme-for-racket-bootstrap-bootfiles-9.5.9.2.drv-0/source/racket/src/ChezScheme/boot/tpb64l
Load nanopass
Apply nanopass patch
Load cmacros parts
Load enum
Load cprep
Load expander
Install evaluator
Load cmacros using expander
Continue loading expander
Initialize system libraries
Load nanopass using expander
Load priminfo and primvars
Load expander using expander
Initialize system libraries in bootstrapped expander
Declare nanopass in bootstrapped expander
Load some io.ss declarations
Load some strip.ss declarations
Load some 7.ss declarations
Load most front.ss declarations
Define $filter-foreign-type
Load mkheader
Generate headers
Load mkgc
Generate GC
Load ftype.ss
Load fasl.ss
Load reloc.ss
Load format.ss
Load cp0.ss
Load cpvalid.ss
Load cpcheck.ss
Load cpletrec.ss
Load cpcommonize.ss
Load cpnanopass.ss
error: in phase 'build': uncaught exception:
%exception #<&invoke-error program: "/gnu/store/f72x3mdyagp67ybwdy9cqqsid9v8jk9l-racket-vm-bc-8.6/opt/racket-vm/bin/racket" arguments: ("rktboot/main.rkt" "--machine" "tpb64l") exit-status: 1 term-signal: #f stop-signal: #f>
phase `build' failed after 707.9 seconds
command "/gnu/store/f72x3mdyagp67ybwdy9cqqsid9v8jk9l-racket-vm-bc-8.6/opt/racket-vm/bin/racket" "rktboot/main.rkt" "--machine" "tpb64l" failed with status 1

I didn't have the chance yet to dig into why rktboot/main.rkt is
failing. If you have any tips on how to find more details on what is
going on (e.g., is there some verbose flag that can be passed to it?) I
can try to investigate.

--
Thanks
Thiago
P
P
Philip McGrath wrote on 11 Aug 2022 06:00
(name . Thiago Jung Bauermann)(address . bauermann@kolabnow.com)(address . 57050@debbugs.gnu.org)
2ef11386-5362-40af-981a-39f9562242c0@www.fastmail.com
Hi Thiago,

On Wed, Aug 10, 2022, at 11:30 AM, Thiago Jung Bauermann wrote:
Toggle quote (88 lines)
> Hello Philip,
>
> Philip McGrath <philip@philipmcgrath.com> writes:
>
>> This patch series contains the Racket 8.6 release, including updating Racket's
>> variant of Chez Scheme and adding a package for Zuo, the new tiny Racket-like
>> language used for build scripts starting with this release.
>>
>> (If you've been waiting for the release announcement, this cycle upstream is
>> delaying sending it until the new Racket has finished rebuilding all
>> of <https://docs.racket-lang.org>, which can take a few days---but the release
>> itself is live at <https://download.racket-lang.org> already, and I've been
>> told distribution packagers should update now.)
>>
>> As I mentioned on the mailing list in [1], this release lets us use Racket CS
>> and Racket's variant of Chez Scheme on all systems, even those for which the
>> compiler can not yet generate native code, such as powerpc64le-linux and
>> riscv64-linux. (See the relevant patches for more details.) In particular,
>> this means that we can now provide some Chez Scheme package for every system
>> Guix supports.
>
> I tried building the zuo branch from your gitlab repo (commit
> 00975c823227 “gnu: chez-scheme-for-racket: Suport all systems.” from
> August 8th) on powerpc64le-linux and had this build failure in
> chez-scheme-for-racket-bootstrap-bootfiles-9.5.9.2:
>
> --8<---------------cut here---------------start------------->8---
> starting phase `build'
> Assuming current directory has Chez Scheme sources
> Use
> /tmp/guix-build-chez-scheme-for-racket-bootstrap-bootfiles-9.5.9.2.drv-0/source/racket/src/ChezScheme/rktboot/.
> Use
> /tmp/guix-build-chez-scheme-for-racket-bootstrap-bootfiles-9.5.9.2.drv-0/source/racket/src/ChezScheme/nanopass
> Use
> /tmp/guix-build-chez-scheme-for-racket-bootstrap-bootfiles-9.5.9.2.drv-0/source/racket/src/ChezScheme/s
> Check
> /tmp/guix-build-chez-scheme-for-racket-bootstrap-bootfiles-9.5.9.2.drv-0/source/racket/src/ChezScheme/boot/tpb64l
> Load nanopass
> Apply nanopass patch
> Load cmacros parts
> Load enum
> Load cprep
> Load expander
> Install evaluator
> Load cmacros using expander
> Continue loading expander
> Initialize system libraries
> Load nanopass using expander
> Load priminfo and primvars
> Load expander using expander
> Initialize system libraries in bootstrapped expander
> Declare nanopass in bootstrapped expander
> Load some io.ss declarations
> Load some strip.ss declarations
> Load some 7.ss declarations
> Load most front.ss declarations
> Define $filter-foreign-type
> Load mkheader
> Generate headers
> Load mkgc
> Generate GC
> Load ftype.ss
> Load fasl.ss
> Load reloc.ss
> Load format.ss
> Load cp0.ss
> Load cpvalid.ss
> Load cpcheck.ss
> Load cpletrec.ss
> Load cpcommonize.ss
> Load cpnanopass.ss
> error: in phase 'build': uncaught exception:
> %exception #<&invoke-error program:
> "/gnu/store/f72x3mdyagp67ybwdy9cqqsid9v8jk9l-racket-vm-bc-8.6/opt/racket-vm/bin/racket"
> arguments: ("rktboot/main.rkt" "--machine" "tpb64l") exit-status: 1
> term-signal: #f stop-signal: #f>
> phase `build' failed after 707.9 seconds
> command
> "/gnu/store/f72x3mdyagp67ybwdy9cqqsid9v8jk9l-racket-vm-bc-8.6/opt/racket-vm/bin/racket"
> "rktboot/main.rkt" "--machine" "tpb64l" failed with status 1
> --8<---------------cut here---------------end--------------->8---
>
> I didn't have the chance yet to dig into why rktboot/main.rkt is
> failing. If you have any tips on how to find more details on what is
> going on (e.g., is there some verbose flag that can be passed to it?) I
> can try to investigate.
>

Thanks very much for this report!

I am going to report this upstream at
because I don't know much I can do to pin down what's going wrong. When cross-compiling, the bootfiles are built with Chez Scheme rather than bootstrapped via Racket BC (because it is 10x faster), but I just tried manually running rktboot for tpb64l from my x86_64-linux machine, and it worked for me.

One thing that would help is if you can try to reproduce this outside of the Guix build environment. You can get the source either checking out https://github.com/racket/racket at the v8.6 tag or by downloading and unpacking https://download.racket-lang.org/releases/8.6/installers/racket-minimal-8.6-src.tgz . Navigate to the Chez Scheme source directory, which is "racket/src/ChezScheme" in the Git repository or just "src/ChezScheme" in the tarball. You can run rktboot even with an old Racket, so try something like:

guix shell --container racket-minimal -- racket rktboot/main.rkt --machine tpb64l

If it works, you could try building Racket and/or Chez Scheme, if you want. Even if it doesn't work, you may be able to build Racket and/or Chez Scheme, because Racket distributes "pb" bootfiles (not specialized to word size and endianness) that can be used for bootstrapping. To build Chez Scheme, you probably will need to configure with:

-m=tpb64l --threads --enable-libffi "CFLAGS=-g -O2 -D_REENTRANT -pthread" "LIBS=-lm -ldl -lrt -lffi -lncurses"

Racket is built from the parent of the Chez Scheme source directory, and you will probably need to configure with:

--enable-pb --enable-mach=tpb64l

If you are trying to build Chez Scheme or Racket (as opposed to just the bootfiles) from the Git repository and "rktboot" doesn't work, you'll need to run `make pb-fetch` in the root directory of the checkout to get the "pb" bootfiles. More details about options for building from the Git repository are documented at https://docs.racket-lang.org/racket-build-guide/, which is also rendered to "build.md" in the root directory of the Git repository itself.

Thanks again for trying this!

-Philip
P
P
Philip McGrath wrote on 11 Aug 2022 13:08
[PATCH v2 00/13] gnu: Update Racket to 8.6. Add Zuo.
(address . 57050@debbugs.gnu.org)
cover.1660215295.git.philip@philipmcgrath.com
Hi,

Here is a v2 of this series, split up as Liliana requested.

Thiago, Matthew Flatt suggested a workaround for powerpc64le-linux
in https://racket.discourse.group/t/950/22, and I've added it in patch
10/13. Can you give it a try? I'm also trying it via QEMU. For convienience,
I've updated the 'zuo' branch at https://gitlab.com/philip1/guix-patchesto
point to this v2 (commit aaa95de8c6cff1ba749a9dd0365dedb822ffa625) and tagged
it as guix-issue-57050-v2; I've tagged the previous version as
guix-issue-57050.

(Note that you need at least patch 11/13 for 'racket-minimal' or 'racket' to
use CS on powerpc64le-linux.)

-Philip

Philip McGrath (13):
gnu: stex: Update to 1.2.2-2.afa6075.
gnu: stex: Fix read-only gifs and math directories.
gnu: chez-scheme: Fix use of "/bin/sh".
gnu: Add Zuo.
gnu: racket: Update to 8.6.
gnu: chez-scheme: Bootfiles should not be native inputs.
gnu: chez-scheme-for-racket: Support cross-compilation.
gnu: racket: Support cross-compiling the VM packages.
gnu: chez-scheme-for-racket: Suport all systems.
gnu: racket-vm-bc: Add workaround for ppc64le.
gnu: racket: Use Racket CS on all systems.
etc: teams: Add racket team.
etc: teams: Add entry for Philip McGrath.

etc/teams.scm.in | 12 +
gnu/local.mk | 7 +-
gnu/packages/chez.scm | 215 +++++--
gnu/packages/patches/chez-scheme-bin-sh.patch | 66 ++
.../racket-backport-8.6-cross-install.patch | 32 +
.../racket-backport-8.6-docindex-write.patch | 36 ++
.../patches/racket-backport-8.6-hurd.patch | 609 ++++++++++++++++++
.../patches/racket-backport-8.6-zuo.patch | 481 ++++++++++++++
.../patches/racket-chez-scheme-bin-sh.patch | 66 ++
...-rktio.patch => racket-rktio-bin-sh.patch} | 28 +-
gnu/packages/patches/racket-zuo-bin-sh.patch | 72 +++
.../stex-copy-from-immutable-store.patch | 41 ++
gnu/packages/racket.scm | 246 ++++---
13 files changed, 1782 insertions(+), 129 deletions(-)
create mode 100644 gnu/packages/patches/chez-scheme-bin-sh.patch
create mode 100644 gnu/packages/patches/racket-backport-8.6-cross-install.patch
create mode 100644 gnu/packages/patches/racket-backport-8.6-docindex-write.patch
create mode 100644 gnu/packages/patches/racket-backport-8.6-hurd.patch
create mode 100644 gnu/packages/patches/racket-backport-8.6-zuo.patch
create mode 100644 gnu/packages/patches/racket-chez-scheme-bin-sh.patch
rename gnu/packages/patches/{racket-minimal-sh-via-rktio.patch => racket-rktio-bin-sh.patch} (79%)
create mode 100644 gnu/packages/patches/racket-zuo-bin-sh.patch
create mode 100644 gnu/packages/patches/stex-copy-from-immutable-store.patch


base-commit: f030ae422b6d13a7a21158d9a37c9760597d1573
--
2.32.0
P
P
Philip McGrath wrote on 11 Aug 2022 13:08
[PATCH v2 01/13] gnu: stex: Update to 1.2.2-2.afa6075.
(address . 57050@debbugs.gnu.org)
672555b265c88be3e84db33a5744ffc7e302c6ad.1660215295.git.philip@philipmcgrath.com
* gnu/packages/chez.scm (stex-bootstrap): Update to 1.2.2-2.afa6075.
---
gnu/packages/chez.scm | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

Toggle diff (26 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index b037efe8d4..043f2ae47a 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -594,8 +594,8 @@ (define-public chez-scheme-for-racket-bootstrap-bootfiles
(define-public stex-bootstrap
;; This commit includes a fix which we would otherwise want to use as
;; patch. Let's revert to tagged releases as soon as one becomes available.
- (let ((commit "54051494434a197772bf6ca5b4e6cf6be55f39a5")
- (revision "1"))
+ (let ((commit "afa607564a5662ffd748e824801277a6b5a3d11c")
+ (revision "2"))
(hidden-package
(package
(name "stex")
@@ -611,7 +611,7 @@ (define-public stex-bootstrap
(url "https://github.com/dybvig/stex")
(commit commit)))
(sha256
- (base32 "01jnvw8qw33gnpzwrakwhsr05h6b609lm180jnspcrb7lds2p23d"))
+ (base32 "0n6dryv5j7cw2qmsj55wqb0ph901h83a2hl4j891ppxp0xx18nkp"))
(file-name (git-file-name name version))
(snippet
#~(for-each delete-file
--
2.32.0
P
P
Philip McGrath wrote on 11 Aug 2022 13:08
[PATCH v2 02/13] gnu: stex: Fix read-only gifs and math directories.
(address . 57050@debbugs.gnu.org)
3cbb1636a31c0896f85e3a6f04ddef096a6be29a.1660215295.git.philip@philipmcgrath.com
Excplicitly set the user write bit when initializing the gifs or math
directories from the skeletons installed in the store. See also upstream
discussion at https://github.com/dybvig/stex/pull/6. This problem
would be exposed by the upcoming changes to Racket's build system.

* gnu/packages/patches/stex-copy-from-immutable-store.patch: New patch.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/chez.scm (stex-bootstrap)[patches]: Use it.
[version]: Increment revision to 1.2.2-3.afa6075.
---
gnu/local.mk | 1 +
gnu/packages/chez.scm | 5 ++-
.../stex-copy-from-immutable-store.patch | 41 +++++++++++++++++++
3 files changed, 46 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/patches/stex-copy-from-immutable-store.patch

Toggle diff (84 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 1bd791fb0c..d35c6748c9 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1826,6 +1826,7 @@ dist_patch_DATA = \
%D%/packages/patches/slim-reset.patch \
%D%/packages/patches/slim-login.patch \
%D%/packages/patches/slim-display.patch \
+ %D%/packages/patches/stex-copy-from-immutable-store.patch \
%D%/packages/patches/syslinux-gcc10.patch \
%D%/packages/patches/syslinux-strip-gnu-property.patch \
%D%/packages/patches/snappy-add-O2-flag-in-CmakeLists.txt.patch \
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 043f2ae47a..4c253effa0 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -595,7 +595,7 @@ (define-public stex-bootstrap
;; This commit includes a fix which we would otherwise want to use as
;; patch. Let's revert to tagged releases as soon as one becomes available.
(let ((commit "afa607564a5662ffd748e824801277a6b5a3d11c")
- (revision "2"))
+ (revision "3"))
(hidden-package
(package
(name "stex")
@@ -613,6 +613,9 @@ (define-public stex-bootstrap
(sha256
(base32 "0n6dryv5j7cw2qmsj55wqb0ph901h83a2hl4j891ppxp0xx18nkp"))
(file-name (git-file-name name version))
+ (patches
+ ;; submitted upstream in https://github.com/dybvig/stex/pull/6
+ (search-patches "stex-copy-from-immutable-store.patch"))
(snippet
#~(for-each delete-file
'("sbin/install" "doc/stex.pdf" "doc/stex.html")))))
diff --git a/gnu/packages/patches/stex-copy-from-immutable-store.patch b/gnu/packages/patches/stex-copy-from-immutable-store.patch
new file mode 100644
index 0000000000..4562e431c1
--- /dev/null
+++ b/gnu/packages/patches/stex-copy-from-immutable-store.patch
@@ -0,0 +1,41 @@
+From 9434b4a36646c036db8de326158056aa3293fb82 Mon Sep 17 00:00:00 2001
+From: Philip McGrath <philip@philipmcgrath.com>
+Date: Thu, 28 Apr 2022 22:56:20 -0400
+Subject: [PATCH] fix read-only gifs and math directories
+
+An installed copy of stex might have all write permission bits removed,
+even for the owner of the installed files: this is the case with Guix
+package of stex, for example. If such an installation is used to
+initialize the gifs or math directories (e.g. for an out-of-source
+build), tar likewise creates them without write permissions, preventing
+subdirectories from being created later. Set the user write bit
+explicitly to avoid this problem.
+ Mf-stex
+
+Related to https://github.com/racket/racket/pull/4203
+---
+
+Submitted upstream in https://github.com/dybvig/stex/pull/6
+
+ Mf-stex | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/Mf-stex b/Mf-stex
+index 09ec6f3..11fb214 100644
+--- a/Mf-stex
++++ b/Mf-stex
+@@ -112,9 +112,11 @@ $(x).mathrun: gifs $(mathfiles)
+
+ gifs:
+ (cd $(STEXLIB); tar -cf - gifs) | tar -xpf -
++ chmod u+w gifs
+
+ math:
+ (cd $(STEXLIB); tar -cf - math) | tar -xpf -
++ chmod u+w math
+
+ $(mathfiles): $(x).hthirdrun $(figps)
+ echo -n gifs= > $(mathfiles)
+--
+2.32.0
+
--
2.32.0
P
P
Philip McGrath wrote on 11 Aug 2022 13:08
[PATCH v2 03/13] gnu: chez-scheme: Fix use of "/bin/sh".
(address . 57050@debbugs.gnu.org)
86c1205b1144c03620cce866e7d22c67d1e9c47d.1660215295.git.philip@philipmcgrath.com
The unsuccessful attempt to execute "/bin/sh" by Chez Scheme's 'process'
function seems to have caused parts of the Chez Scheme test suite to
have been silently skipped. The issue was exposed by the upcoming
changes to Racket's build system.

* gnu/packages/patches/chez-scheme-bin-sh.patch,
gnu/packages/patches/racket-chez-scheme-bin-sh.patch: New patches.
* gnu/packages/patches/racket-minimal-sh-via-rktio.patch: Rename to ...
* gnu/packages/patches/racket-rktio-bin-sh.patch: ... this, refresh with
upstream, and shorten the macro name.
* gnu/local.mk (dist_patch_DATA): Update accordingly.
* gnu/packages/racket.scm (%racket-origin)[patches]: Likewise.
(racket-vm-common-configure-flags): Likewise.
* gnu/packages/chez.scm (chez-scheme)[origin]<patches>: Likewise.
[inputs]: Add bash-minimal.
[arguments]<#:configure-flags>: Set CPPFLAGS to enable new patches.
---
gnu/local.mk | 4 +-
gnu/packages/chez.scm | 5 ++
gnu/packages/patches/chez-scheme-bin-sh.patch | 66 +++++++++++++++++++
.../patches/racket-chez-scheme-bin-sh.patch | 66 +++++++++++++++++++
...-rktio.patch => racket-rktio-bin-sh.patch} | 28 ++++----
gnu/packages/racket.scm | 5 +-
6 files changed, 158 insertions(+), 16 deletions(-)
create mode 100644 gnu/packages/patches/chez-scheme-bin-sh.patch
create mode 100644 gnu/packages/patches/racket-chez-scheme-bin-sh.patch
rename gnu/packages/patches/{racket-minimal-sh-via-rktio.patch => racket-rktio-bin-sh.patch} (79%)

Toggle diff (314 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index d35c6748c9..076fa341e9 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -941,6 +941,7 @@ dist_patch_DATA = \
%D%/packages/patches/ceph-boost-compat.patch \
%D%/packages/patches/ceph-rocksdb-compat.patch \
%D%/packages/patches/cheese-vala-update.patch \
+ %D%/packages/patches/chez-scheme-bin-sh.patch \
%D%/packages/patches/chmlib-inttypes.patch \
%D%/packages/patches/cl-asdf-config-directories.patch \
%D%/packages/patches/clamav-config-llvm-libs.patch \
@@ -1773,7 +1774,8 @@ dist_patch_DATA = \
%D%/packages/patches/ripperx-missing-file.patch \
%D%/packages/patches/rpcbind-CVE-2017-8779.patch \
%D%/packages/patches/rtags-separate-rct.patch \
- %D%/packages/patches/racket-minimal-sh-via-rktio.patch \
+ %D%/packages/patches/racket-chez-scheme-bin-sh.patch \
+ %D%/packages/patches/racket-rktio-bin-sh.patch \
%D%/packages/patches/remake-impure-dirs.patch \
%D%/packages/patches/restic-0.9.6-fix-tests-for-go1.15.patch \
%D%/packages/patches/retroarch-LIBRETRO_DIRECTORY.patch \
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 4c253effa0..66098c7a24 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -34,6 +34,7 @@ (define-module (gnu packages chez)
#:use-module (guix build-system copy)
#:use-module (guix build-system gnu)
#:use-module (guix build-system copy)
+ #:use-module (gnu packages bash)
#:use-module (gnu packages compression)
#:use-module (gnu packages ncurses)
#:use-module (gnu packages ghostscript)
@@ -269,6 +270,7 @@ (define-public chez-scheme
(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
@@ -287,6 +289,7 @@ (define-public chez-scheme
`(,util-linux "lib") ;<-- libuuid
zlib
lz4
+ bash-minimal ;<-- for process
ncurses ;<-- for expeditor
;; for X11 clipboard support in expeditor:
;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
@@ -313,6 +316,8 @@ (define-public chez-scheme
(cut memq 'threads <>))
#~("--threads")
#~())
+ ,(string-append "CPPFLAGS=-DGUIX_RKTIO_BIN_SH="
+ #$(file-append bash-minimal "/bin/sh"))
"ZLIB=-lz"
"LZ4=-llz4"
"--libkernel"
diff --git a/gnu/packages/patches/chez-scheme-bin-sh.patch b/gnu/packages/patches/chez-scheme-bin-sh.patch
new file mode 100644
index 0000000000..e6228e3264
--- /dev/null
+++ b/gnu/packages/patches/chez-scheme-bin-sh.patch
@@ -0,0 +1,66 @@
+From c170f0f3a326f293ee1f460a70303382966ca41b Mon Sep 17 00:00:00 2001
+From: Philip McGrath <philip@philipmcgrath.com>
+Date: Thu, 19 May 2022 13:41:56 -0400
+Subject: [PATCH] patch s_process for "/bin/sh" on Guix
+
+This patch reuses the C preprocessor macro `GUIX_RKTIO_BIN_SH`
+from a previous patch.
+
+If:
+
+ 1. The `GUIX_RKTIO_BIN_SH` macro is defined; and
+
+ 2. The path specified by `GUIX_RKTIO_BIN_SH` exists;
+
+then `s_process` will call `execl` with the file specified by
+`GUIX_RKTIO_BIN_SH` instead of "/bin/sh".
+
+This patch does not change the behavior of `s_system`, which relies
+on `system` from the C library.
+---
+ c/prim5.c | 20 +++++++++++++++++++-
+ 1 file changed, 19 insertions(+), 1 deletion(-)
+
+diff --git a/c/prim5.c b/c/prim5.c
+index 5a07893..926d68d 100644
+--- a/c/prim5.c
++++ b/c/prim5.c
+@@ -746,6 +746,22 @@ static ptr s_process(char *s, IBOOL stderrp) {
+
+ INT tofds[2], fromfds[2], errfds[2];
+ struct sigaction act, oint_act;
++ /* BEGIN PATCH for Guix */
++#if defined(GUIX_RKTIO_BIN_SH)
++# define GUIX_AS_a_STR_HELPER(x) #x
++# define GUIX_AS_a_STR(x) GUIX_AS_a_STR_HELPER(x)
++ /* A level of indirection makes `#` work as needed: */
++ struct stat guix_stat_buf;
++ char *guix_sh =
++ (0 == stat(GUIX_AS_a_STR(GUIX_RKTIO_BIN_SH), &guix_stat_buf))
++ ? GUIX_AS_a_STR(GUIX_RKTIO_BIN_SH)
++ : "/bin/sh";
++# undef GUIX_AS_a_STR
++# undef GUIX_AS_a_STR_HELPER
++#else /* GUIX_RKTIO_BIN_SH */
++ char *guix_sh = "/bin/sh";
++#endif
++ /* END PATCH for Guix */
+
+ if (pipe(tofds)) S_error("process","cannot open pipes");
+ if (pipe(fromfds)) {
+@@ -771,7 +787,9 @@ static ptr s_process(char *s, IBOOL stderrp) {
+ CLOSE(1); if (dup(fromfds[1]) != 1) _exit(1);
+ CLOSE(2); if (dup(stderrp ? errfds[1] : 1) != 2) _exit(1);
+ {INT i; for (i = 3; i < NOFILE; i++) (void)CLOSE(i);}
+- execl("/bin/sh", "/bin/sh", "-c", s, NULL);
++ /* BEGIN PATCH for Guix */
++ execl(guix_sh, guix_sh, "-c", s, NULL);
++ /* END PATCH for Guix */
+ _exit(1) /* only if execl fails */;
+ /*NOTREACHED*/
+ } else {
+
+base-commit: 9df56e7b25bc523663eac3da24be33afc5f76c84
+--
+2.32.0
+
diff --git a/gnu/packages/patches/racket-chez-scheme-bin-sh.patch b/gnu/packages/patches/racket-chez-scheme-bin-sh.patch
new file mode 100644
index 0000000000..df2eb671b3
--- /dev/null
+++ b/gnu/packages/patches/racket-chez-scheme-bin-sh.patch
@@ -0,0 +1,66 @@
+From 5f3fc12bf123f30485800960b0493f5dd538d107 Mon Sep 17 00:00:00 2001
+From: Philip McGrath <philip@philipmcgrath.com>
+Date: Thu, 19 May 2022 13:41:56 -0400
+Subject: [PATCH] Chez Scheme: patch s_process for "/bin/sh" on Guix
+
+This patch reuses the C preprocessor macro `GUIX_RKTIO_BIN_SH`
+from a previous patch.
+
+If:
+
+ 1. The `GUIX_RKTIO_BIN_SH` macro is defined; and
+
+ 2. The path specified by `GUIX_RKTIO_BIN_SH` exists;
+
+then `s_process` will call `execl` with the file specified by
+`GUIX_RKTIO_BIN_SH` instead of "/bin/sh".
+
+This patch does not change the behavior of `s_system`, which relies
+on `system` from the C library.
+---
+ racket/src/ChezScheme/c/prim5.c | 20 +++++++++++++++++++-
+ 1 file changed, 19 insertions(+), 1 deletion(-)
+
+diff --git a/racket/src/ChezScheme/c/prim5.c b/racket/src/ChezScheme/c/prim5.c
+index f5e3e345be..9db2989138 100644
+--- a/racket/src/ChezScheme/c/prim5.c
++++ b/racket/src/ChezScheme/c/prim5.c
+@@ -856,6 +856,22 @@ static ptr s_process(s, stderrp) char *s; IBOOL stderrp; {
+
+ INT tofds[2], fromfds[2], errfds[2];
+ struct sigaction act, oint_act;
++ /* BEGIN PATCH for Guix */
++#if defined(GUIX_RKTIO_BIN_SH)
++# define GUIX_AS_a_STR_HELPER(x) #x
++# define GUIX_AS_a_STR(x) GUIX_AS_a_STR_HELPER(x)
++ /* A level of indirection makes `#` work as needed: */
++ struct stat guix_stat_buf;
++ char *guix_sh =
++ (0 == stat(GUIX_AS_a_STR(GUIX_RKTIO_BIN_SH), &guix_stat_buf))
++ ? GUIX_AS_a_STR(GUIX_RKTIO_BIN_SH)
++ : "/bin/sh";
++# undef GUIX_AS_a_STR
++# undef GUIX_AS_a_STR_HELPER
++#else /* GUIX_RKTIO_BIN_SH */
++ char *guix_sh = "/bin/sh";
++#endif
++ /* END PATCH for Guix */
+
+ if (pipe(tofds)) S_error("process","cannot open pipes");
+ if (pipe(fromfds)) {
+@@ -881,7 +897,9 @@ static ptr s_process(s, stderrp) char *s; IBOOL stderrp; {
+ CLOSE(1); if (dup(fromfds[1]) != 1) _exit(1);
+ CLOSE(2); if (dup(stderrp ? errfds[1] : 1) != 2) _exit(1);
+ {INT i; for (i = 3; i < NOFILE; i++) (void)CLOSE(i);}
+- execl("/bin/sh", "/bin/sh", "-c", s, NULL);
++ /* BEGIN PATCH for Guix */
++ execl(guix_sh, guix_sh, "-c", s, NULL);
++ /* END PATCH for Guix */
+ _exit(1) /* only if execl fails */;
+ /*NOTREACHED*/
+ } else {
+
+base-commit: 9d228d16fb99c274c964e5bef93e97333888769f
+--
+2.32.0
+
diff --git a/gnu/packages/patches/racket-minimal-sh-via-rktio.patch b/gnu/packages/patches/racket-rktio-bin-sh.patch
similarity index 79%
rename from gnu/packages/patches/racket-minimal-sh-via-rktio.patch
rename to gnu/packages/patches/racket-rktio-bin-sh.patch
index 6bc2ee8331..4f7f2da083 100644
--- a/gnu/packages/patches/racket-minimal-sh-via-rktio.patch
+++ b/gnu/packages/patches/racket-rktio-bin-sh.patch
@@ -1,7 +1,7 @@
-From 3574b567c486d264d680a37586436c3b5a8cb978 Mon Sep 17 00:00:00 2001
+From 070abbcc0d880ca4f97f997e096ac66650ccaaa0 Mon Sep 17 00:00:00 2001
From: Philip McGrath <philip@philipmcgrath.com>
Date: Thu, 4 Mar 2021 04:11:50 -0500
-Subject: [PATCH] patch rktio_process for "/bin/sh" on Guix
+Subject: [PATCH] rktio: patch rktio_process for "/bin/sh" on Guix
Racket provides the functions `system` and `process`,
which execute shell commands using `sh` (or `cmd` on Windows).
@@ -13,17 +13,17 @@ the C function that implements the core of `system`, `process`,
and related Racket functions.
Guix should enable the special case by defining the C preprocessor
-macro `GUIX_RKTIO_PATCH_BIN_SH` with the path to `sh` in the store.
+macro `GUIX_RKTIO_BIN_SH` with the path to `sh` in the store.
If:
- 1. The `GUIX_RKTIO_PATCH_BIN_SH` macro is defined; and
+ 1. The `GUIX_RKTIO_BIN_SH` macro is defined; and
2. `rktio_process` is called with the exact path "/bin/sh"; and
- 3. The path specified by `GUIX_RKTIO_PATCH_BIN_SH` does exists;
+ 3. The file specified by `GUIX_RKTIO_BIN_SH` exists;
then `rktio_process` will execute the file specified
-by `GUIX_RKTIO_PATCH_BIN_SH` instead of "/bin/sh".
+by `GUIX_RKTIO_BIN_SH` instead of "/bin/sh".
Compared to previous attempts to patch the Racket sources,
making this change at the C level is both:
@@ -39,10 +39,10 @@ making this change at the C level is both:
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/racket/src/rktio/rktio_process.c b/racket/src/rktio/rktio_process.c
-index 89202436c0..465ebdd5c5 100644
+index fafaf728c1..0a319b381a 100644
--- a/racket/src/rktio/rktio_process.c
+++ b/racket/src/rktio/rktio_process.c
-@@ -1224,12 +1224,14 @@ int rktio_process_allowed_flags(rktio_t *rktio)
+@@ -1301,12 +1301,14 @@ int rktio_process_allowed_flags(rktio_t *rktio)
/*========================================================================*/
rktio_process_result_t *rktio_process(rktio_t *rktio,
@@ -58,19 +58,19 @@ index 89202436c0..465ebdd5c5 100644
rktio_process_result_t *result;
intptr_t to_subprocess[2], from_subprocess[2], err_subprocess[2];
int pid;
-@@ -1255,6 +1257,23 @@ rktio_process_result_t *rktio_process(rktio_t *rktio,
+@@ -1333,6 +1335,23 @@ rktio_process_result_t *rktio_process(rktio_t *rktio,
int i;
#endif
+/* BEGIN PATCH for Guix */
-+#if defined(GUIX_RKTIO_PATCH_BIN_SH)
++#if defined(GUIX_RKTIO_BIN_SH)
+# define GUIX_AS_a_STR_HELPER(x) #x
+# define GUIX_AS_a_STR(x) GUIX_AS_a_STR_HELPER(x)
+ /* A level of indirection makes `#` work as needed: */
+ command =
+ ((0 == strcmp(_guix_orig_command, "/bin/sh"))
-+ && rktio_file_exists(rktio, GUIX_AS_a_STR(GUIX_RKTIO_PATCH_BIN_SH)))
-+ ? GUIX_AS_a_STR(GUIX_RKTIO_PATCH_BIN_SH)
++ && rktio_file_exists(rktio, GUIX_AS_a_STR(GUIX_RKTIO_BIN_SH)))
++ ? GUIX_AS_a_STR(GUIX_RKTIO_BIN_SH)
+ : _guix_orig_command;
+# undef GUIX_AS_a_STR
+# undef GUIX_AS_a_STR_HELPER
@@ -82,6 +82,8 @@ index 89202436c0..465ebdd5c5 100644
/* avoid compiler warnings: */
to_subprocess[0] = -1;
to_subprocess[1] = -1;
+
+base-commit: 9d228d16fb99c274c964e5bef93e97333888769f
--
-2.21.1 (Apple Git-122.3)
+2.32.0
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index 3399bcc3fe..cddb617232 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -212,7 +212,8 @@ (define %racket-origin
(sha256
(base32 "0f9zyhdvbh4xsndrqjzl85j5ziz0rmqi676g9s1lw3h3skq2636h"))
(file-name (git-file-name "racket" %racket-version))
- (patches (search-patches "racket-minimal-sh-via-rktio.patch"))
+ (patches (search-patches "racket-chez-scheme-bin-sh.patch"
+ "racket-rktio-bin-sh.patch"))
(modules '((guix build utils)))
(snippet
#~(begin
@@ -248,7 +249,7 @@ (define (racket-vm-common-configure-flags)
(list (string-append "--enable-racket=" racket))))
(else
'()))
- ,(string-append "CPPFLAGS=-DGUIX_RKTIO_PATCH_BIN_SH="
+ ,(string-append "CPPFLAGS=-DGUIX_RKTIO_BIN_SH="
#$(file-append bash-minimal "/bin/sh"))
"--disable-strip"
;; Using --enable-origtree lets us distinguish the VM from subsequent
--
2.32.0
P
P
Philip McGrath wrote on 11 Aug 2022 13:08
[PATCH v2 05/13] gnu: racket: Update to 8.6.
(address . 57050@debbugs.gnu.org)
5e784e0d35bf5b342bd7df77c4fa137deb942e47.1660215295.git.philip@philipmcgrath.com
Also, update 'chez-scheme-for-racket' to 9.5.9.2.

* gnu/packages/patches/racket-chez-scheme-bin-sh.patch: Refresh patch.
* gnu/packages/patches/racket-backport-8.6-cross-install.patch,
gnu/packages/patches/racket-backport-8.6-docindex-write.patch,
gnu/packages/patches/racket-backport-8.6-hurd.patch: New patches.
* gnu/local.mk (dist_patch_DATA): Add them.
* gnu/packages/racket.scm (%racket-origin)[patches]: Use them and the
patches for Zuo.
(%racket-version): Update to 8.6.
(zuo)[version]: Refer to '%racket-version'.
[origin]: Use '%racket-origin'.
(racket-vm-cgc)[native-inputs]: Add 'zuo'.
[arguments]<#:make-flags>: Use 'zuo' from 'native-inputs'.
(racket)[inputs]<data, db, deinprogramm, draw, drracket, errortrace,
gui, htdp, math, option-contract, parser-tools, pict, rackunit, realm,
redex, scribble, typed-racket, string-constants, swindle, syntax-color,
web-server>: Update checksums.
* gnu/packages/chez.scm (target-chez-os): Handle Hurd and QNX.
(%chez-features-table): Likewise.
(chez-scheme-for-racket): Update to 9.5.9.2.
[native-inputs]: Add 'zuo'.
[arguments]<#:out-of-source?>: Use out-of-source build.
<#:tests?>: Skip them due to ongoing problems.
<#:configure-flags>: Add '--install-csug=' and '--installreleasenotes='.
<#:make-flags>: Use 'zuo' from 'native-inputs'. Supply 'STEXLIB=' here,
rather than in a phase.
<#:phases>: Replace 'install-docs' using new 'make' target.
---
gnu/packages/chez.scm | 52 +-
.../racket-backport-8.6-cross-install.patch | 32 +
.../racket-backport-8.6-docindex-write.patch | 36 ++
.../patches/racket-backport-8.6-hurd.patch | 609 ++++++++++++++++++
.../patches/racket-chez-scheme-bin-sh.patch | 16 +-
gnu/packages/racket.scm | 121 ++--
6 files changed, 794 insertions(+), 72 deletions(-)
create mode 100644 gnu/packages/patches/racket-backport-8.6-cross-install.patch
create mode 100644 gnu/packages/patches/racket-backport-8.6-docindex-write.patch
create mode 100644 gnu/packages/patches/racket-backport-8.6-hurd.patch

Toggle diff (452 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 66098c7a24..dde2c22ca5 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -116,7 +116,7 @@ (define* (target-chez-os #:optional (system (or (%current-target-system)
((target-linux? system)
"le")
((target-hurd? system)
- #f)
+ "gnu")
((target-mingw? system)
"nt")
;; missing (guix utils) predicates
@@ -132,6 +132,8 @@ (define* (target-chez-os #:optional (system (or (%current-target-system)
;; Nix says "x86_64-solaris", but accommodate "-solaris2"
((string-contains system "solaris")
"s2")
+ ((string-suffix? "-qnx" system)
+ "qnx")
;; unknown
(else
#f)))
@@ -168,6 +170,9 @@ (define %chez-features-table
("arm32" bootstrap-bootfiles)
("arm64" . #f)
("ppc32" threads))
+ ;; Hurd
+ ("gnu"
+ ("i3" . #f))
;; FreeBSD
("fb"
("i3" threads) ;; commented out
@@ -193,6 +198,9 @@ (define %chez-features-table
("s2"
("i3" threads) ;; commented out
("a6" threads)) ;; commented out
+ ;; QNX
+ ("qnx"
+ ("i3" . #f))
;; Windows
("nt"
("i3" threads bootstrap-bootfiles)
@@ -437,7 +445,7 @@ (define-public chez-scheme-for-racket
(package
(inherit chez-scheme)
(name "chez-scheme-for-racket")
- (version "9.5.7.6")
+ (version "9.5.9.2")
;; The version should match `(scheme-fork-version-number)`.
;; See racket/src/ChezScheme/s/cmacros.ss c. line 360.
;; It will always be different than the upstream version!
@@ -448,18 +456,52 @@ (define-public chez-scheme-for-racket
(delete "libx11" "util-linux:lib")))
(native-inputs
(modify-inputs (package-native-inputs chez-scheme)
+ (append zuo)
(replace "chez-scheme-bootstrap-bootfiles"
chez-scheme-for-racket-bootstrap-bootfiles)))
(arguments
(substitute-keyword-arguments (package-arguments chez-scheme)
+ ((#:out-of-source? _ #f)
+ #t)
+ ((#:tests? _ #t)
+ ;; FIXME: There have been some flaky test failures. Some have been
+ ;; fixed upstream post-release but have proven non-trivial to
+ ;; backport; at least one issue remains. Re-enable tests once
+ ;; https://github.com/racket/racket/issues/4359 is fixed.
+ #f)
((#:configure-flags cfg-flags #~'())
- #~(cons* "--disable-x11"
- "--threads" ;; ok to potentially duplicate
- #$cfg-flags))
+ #~`("--disable-x11"
+ "--threads" ;; ok to potentially duplicate
+ ,@(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)
(unpack (assoc-ref those-phases 'unpack)))
(modify-phases those-phases
+ (replace 'install-docs
+ (lambda* (#:key make-flags #:allow-other-keys)
+ (apply invoke
+ "make"
+ "install-docs"
+ make-flags)))
(replace 'unpack
(lambda args
(unpack #:source #$(or (package-source this-package)
diff --git a/gnu/packages/patches/racket-backport-8.6-cross-install.patch b/gnu/packages/patches/racket-backport-8.6-cross-install.patch
new file mode 100644
index 0000000000..4f7849ecc6
--- /dev/null
+++ b/gnu/packages/patches/racket-backport-8.6-cross-install.patch
@@ -0,0 +1,32 @@
+From 585215c5c42f7ee0fee05e6a637ab1bc17f5e8e0 Mon Sep 17 00:00:00 2001
+From: Matthew Flatt <mflatt@racket-lang.org>
+Date: Sat, 30 Jul 2022 07:06:55 -0600
+Subject: [PATCH] CS makefiles: fix Unix-style install for cross compilation
+
+Closes #4377
+
+(cherry picked from commit 053be470e7c5454cdf48e934f3254d2d916bbbc5)
+---
+ racket/src/cs/c/build.zuo | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/racket/src/cs/c/build.zuo b/racket/src/cs/c/build.zuo
+index 8d3950bb27..d8b74c509d 100644
+--- a/racket/src/cs/c/build.zuo
++++ b/racket/src/cs/c/build.zuo
+@@ -1016,10 +1016,9 @@
+ (define (setup)
+ (call-with-dest-racket
+ (lambda (bindir dest-racket)
+- (define copytree-racket (and cross? (config-bootstrap-racket)))
++ (define copytree-racket (and cross? (hash-ref (config-bootstrap-racket) 'racket)))
+ (maybe-copytree config dest-racket copytree-racket at-dir)
+- (run-raco-setup config dest-racket
+- (and cross? (hash-ref (config-bootstrap-racket) 'racket))
++ (run-raco-setup config dest-racket copytree-racket
+ ;; this can be redundant if it's also supplied via `SETUP_MACHINE_FLAGS`,
+ ;; but redundant should be ok:
+ (list "-MCR" (~a (at-dir "compiled") ":")
+--
+2.32.0
+
diff --git a/gnu/packages/patches/racket-backport-8.6-docindex-write.patch b/gnu/packages/patches/racket-backport-8.6-docindex-write.patch
new file mode 100644
index 0000000000..abe1984507
--- /dev/null
+++ b/gnu/packages/patches/racket-backport-8.6-docindex-write.patch
@@ -0,0 +1,36 @@
+From 8b4d686a62fd66dedfc40ecdcf3698316993d614 Mon Sep 17 00:00:00 2001
+From: Philip McGrath <philip@philipmcgrath.com>
+Date: Sun, 17 Jul 2022 22:51:44 -0400
+Subject: [PATCH] racket-index: set write permission when copying
+ `docindex.sqlite`
+
+Fixes https://github.com/racket/racket/issues/4357
+
+(cherry picked from commit 55b6cbdca1f36a4f37bab1519c1b658717d3cad2)
+---
+ pkgs/racket-index/setup/scribble.rkt | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/pkgs/racket-index/setup/scribble.rkt b/pkgs/racket-index/setup/scribble.rkt
+index 6694f0b793..e27a8fa348 100644
+--- a/pkgs/racket-index/setup/scribble.rkt
++++ b/pkgs/racket-index/setup/scribble.rkt
+@@ -252,7 +252,14 @@
+ (unless (file-exists? db-file)
+ (define-values (base name dir?) (split-path db-file))
+ (make-directory* base)
+- (when copy-from (copy-file copy-from db-file))
++ (when copy-from
++ (copy-file copy-from db-file)
++ ;; we might not have write permissions for the previous layer:
++ ;; ensure that we do for the new file
++ (define orig-mode (file-or-directory-permissions db-file 'bits))
++ (define writeable-mode (bitwise-ior user-write-bit orig-mode))
++ (unless (= writeable-mode orig-mode)
++ (file-or-directory-permissions db-file writeable-mode)))
+ (doc-db-disconnect
+ (doc-db-file->connection db-file #t))))
+ (when (or (ormap can-build*? main-docs)
+--
+2.32.0
+
diff --git a/gnu/packages/patches/racket-backport-8.6-hurd.patch b/gnu/packages/patches/racket-backport-8.6-hurd.patch
new file mode 100644
index 0000000000..d593b01e62
--- /dev/null
+++ b/gnu/packages/patches/racket-backport-8.6-hurd.patch
@@ -0,0 +1,609 @@
+From f17b030fa2f902bb3666913d4a3cd6ba9c146d22 Mon Sep 17 00:00:00 2001
+From: Philip McGrath <philip@philipmcgrath.com>
+Date: Wed, 3 Aug 2022 03:13:03 -0400
+Subject: [PATCH 1/3] Chez Scheme: Fix build on GNU/Hurd
+
+Mostly GNU/Hurd should take the same options as GNU/Linux. One
+difference is that the Hurd does not define macros such as `PATH_MAX` or
+`NOFILE`, because it avoids imposing arbitrary limits on such resources.
+This patch provides alternatives for localized uses of those constants,
+but it accepts the pervasive use of `PATH_MAX` in finding bootfiles for
+now. See https://www.gnu.org/software/hurd/hurd/porting/guidelines.html.
+
+(cherry picked from commit 87eee6e2adb8c6bc11e60619c706fa6295096085)
+---
+ racket/src/ChezScheme/README.md | 1 +
+ racket/src/ChezScheme/c/number.c | 22 +++++++++----------
+ racket/src/ChezScheme/c/prim5.c | 35 ++++++++++++++++++++++++++++--
+ racket/src/ChezScheme/c/scheme.c | 34 +++++++++++++++++------------
+ racket/src/ChezScheme/c/version.h | 7 ++++--
+ racket/src/ChezScheme/configure | 17 ++++++++++-----
+ racket/src/ChezScheme/s/cmacros.ss | 1 +
+ racket/src/cs/c/configure | 14 ++++++++++--
+ racket/src/cs/c/configure.ac | 14 ++++++++++--
+ racket/src/cs/rumble/system.ss | 3 +++
+ 10 files changed, 109 insertions(+), 39 deletions(-)
+
+diff --git a/racket/src/ChezScheme/README.md b/racket/src/ChezScheme/README.md
+index a4a11a5eef..25231dd9bb 100644
+--- a/racket/src/ChezScheme/README.md
++++ b/racket/src/ChezScheme/README.md
+@@ -13,6 +13,7 @@ Supported platforms (bytecode interpreter may work for others):
+ * OpenBSD: x86, x86_64, ARMv6, AArch64, PowerPC32
+ * NetBSD: x86, x86_64, ARMv6, AArch64, PowerPC32
+ * Solaris: x86, x86_64
++ * GNU/Hurd: x86
+ * Android: ARMv7, AArch64
+ * iOS: AArch64
+ * WebAssembly via Emscripten (bytecode interpreter only)
+diff --git a/racket/src/ChezScheme/c/number.c b/racket/src/ChezScheme/c/number.c
+index ede38cc626..e2bce0d2d3 100644
+--- a/racket/src/ChezScheme/c/number.c
++++ b/racket/src/ChezScheme/c/number.c
+@@ -1041,15 +1041,15 @@ floating-point operations
+
+ #ifdef IEEE_DOUBLE
+ /* exponent stored + 1024, hidden bit to left of decimal point */
+-#define bias 1023
+-#define bitstoright 52
+-#define m1mask 0xf
+-#ifdef WIN32
+-#define hidden_bit 0x10000000000000
+-#else
+-#define hidden_bit 0x10000000000000ULL
+-#endif
+-#ifdef LITTLE_ENDIAN_IEEE_DOUBLE
++# define bias 1023
++# define bitstoright 52
++# define m1mask 0xf
++# ifdef WIN32
++# define hidden_bit 0x10000000000000
++# else
++# define hidden_bit 0x10000000000000ULL
++# endif
++# ifdef LITTLE_ENDIAN_IEEE_DOUBLE
+ struct dblflt {
+ UINT m4: 16;
+ UINT m3: 16;
+@@ -1058,7 +1058,7 @@ struct dblflt {
+ UINT e: 11;
+ UINT sign: 1;
+ };
+-#else
++# else
+ struct dblflt {
+ UINT sign: 1;
+ UINT e: 11;
+@@ -1067,7 +1067,7 @@ struct dblflt {
+ UINT m3: 16;
+ UINT m4: 16;
+ };
+-#endif
++# endif
+ #endif
+
+ double S_random_double(U32 m1, U32 m2, U32 m3, U32 m4, double scale) {
+diff --git a/racket/src/ChezScheme/c/prim5.c b/racket/src/ChezScheme/c/prim5.c
+index 124d1e049c..82bbf8d687 100644
+--- a/racket/src/ChezScheme/c/prim5.c
++++ b/racket/src/ChezScheme/c/prim5.c
+@@ -23,6 +23,10 @@
+ #include <ctype.h>
+ #include <math.h>
+
++#if defined(__GNU__) /* Hurd */
++#include <sys/resource.h>
++#endif
++
+ /* locally defined functions */
+ static INT s_errno(void);
+ static IBOOL s_addr_in_heap(uptr x);
+@@ -58,7 +62,7 @@ static void s_showalloc(IBOOL show_dump, const char *outfn);
+ static ptr s_system(const char *s);
+ static ptr s_process(char *s, IBOOL stderrp);
+ static I32 s_chdir(const char *inpath);
+-#ifdef GETWD
++#if defined(GETWD) || defined(__GNU__) /* Hurd */
+ static char *s_getwd(void);
+ #endif
+ static ptr s_set_code_byte(ptr p, ptr n, ptr x);
+@@ -881,7 +885,18 @@ static ptr s_process(char *s, IBOOL stderrp) {
+ CLOSE(0); if (dup(tofds[0]) != 0) _exit(1);
+ CLOSE(1); if (dup(fromfds[1]) != 1) _exit(1);
+ CLOSE(2); if (dup(stderrp ? errfds[1] : 1) != 2) _exit(1);
++#ifndef __GNU__ /* Hurd */
+ {INT i; for (i = 3; i < NOFILE; i++) (void)CLOSE(i);}
++#else /* __GNU__ Hurd: no NOFILE */
++ {
++ INT i;
++ struct rlimit rlim;
++ getrlimit(RLIMIT_NOFILE, &rlim);
++ for (i = 3; i < rlim.rlim_cur; i++) {
++ (void)CLOSE(i);
++ }
++ }
++#endif /* __GNU__ Hurd */
+ execl("/bin/sh", "/bin/sh", "-c", s, NULL);
+ _exit(1) /* only if execl fails */;
+ /*NOTREACHED*/
+@@ -927,6 +942,22 @@ static I32 s_chdir(const char *inpath) {
+ static char *s_getwd() {
+ return GETWD(TO_VOIDP(&BVIT(S_bytevector(PATH_MAX), 0)));
+ }
++#elif defined(__GNU__) /* Hurd: no PATH_MAX */
++static char *s_getwd() {
++ char *path;
++ size_t len;
++ ptr bv;
++ path = getcwd(NULL, 0);
++ if (NULL == path) {
++ return NULL;
++ } else {
++ len = strlen(path);
++ bv = S_bytevector(len);
++ memcpy(TO_VOIDP(&BVIT(bv, 0)), path, len);
++ free(path);
++ return TO_VOIDP(&BVIT(bv, 0));
++ }
++}
+ #endif /* GETWD */
+
+ static ptr s_set_code_byte(ptr p, ptr n, ptr x) {
+@@ -1817,7 +1848,7 @@ void S_prim5_init(void) {
+ Sforeign_symbol("(cs)s_rational", (void *)S_rational);
+ Sforeign_symbol("(cs)sub", (void *)S_sub);
+ Sforeign_symbol("(cs)rem", (void *)S_rem);
+-#ifdef GETWD
++#if defined(GETWD) || defined(__GNU__) /* Hurd */
+ Sforeign_symbol("(cs)s_getwd", (void *)s_getwd);
+ #endif
+ Sforeign_symbol("(cs)s_chdir", (void *)s_chdir);
+diff --git a/racket/src/ChezScheme/c/scheme.c b/racket/src/ChezScheme/c/scheme.c
+index ed5564540b..0c40e3eaf0 100644
+--- a/racket/src/ChezScheme/c/scheme.c
++++ b/racket/src/ChezScheme/c/scheme.c
+@@ -458,6 +458,12 @@ static IBOOL next_path(char *path, const char *name, const char *ext, const char
+ static const char *path_last(const char *path);
+ static char *get_defaultheapdirs(void);
+
++#ifdef PATH_MAX
++# define BOOT_PATH_MAX PATH_MAX
++#else /* hack for Hurd: better to remove the restriction */
++# define BOOT_PATH_MAX 4096
++#endif
++
+ static const char *path_last(const char *p) {
+ const char *s;
+ #ifdef WIN32
+@@ -483,7 +489,7 @@ static const char *path_last(const char *p) {
+
+ static char *get_defaultheapdirs() {
+ char *result;
+- wchar_t buf[PATH_MAX];
++ wchar_t buf[BOOT_PATH_MAX];
+ DWORD len = sizeof(buf);
+ if (ERROR_SUCCESS != RegGetValueW(HKEY_LOCAL_MACHINE, L"Software\\Chez Scheme\\csv" VERSION, L"HeapSearchPath", RRF_RT_REG_SZ, NULL, buf, &len))
+ return DEFAULT_HEAP_PATH;
+@@ -512,14 +518,14 @@ static char *get_defaultheapdirs() {
+ * leaving the full path with name affixed in path and *sp / *dsp pointing
+ * past the current entry. it returns 1 on success and 0 if at the end of
+ * the search path. path should be a pointer to an unoccupied buffer
+- * PATH_MAX characters long. either or both of sp/dsp may be empty,
++ * BOOT_PATH_MAX characters long. either or both of sp/dsp may be empty,
+ * but neither may be null, i.e., (char *)0. */
+ static IBOOL next_path(char *path, const char *name, const char *ext,
+ const char **sp, const char **dsp) {
+ char *p;
+ const char *s, *t;
+
+-#define setp(c) if (p >= path + PATH_MAX) { fprintf(stderr, "search path entry too long\n"); S_abnormal_exit(); } else *p++ = (c)
++#define setp(c) if (p >= path + BOOT_PATH_MAX) { fprintf(stderr, "search path entry too long\n"); S_abnormal_exit(); } else *p++ = (c)
+ for (;;) {
+ s = *sp;
+ p = path;
+@@ -532,10 +538,10 @@ static IBOOL next_path(char *path, const char *name, const char *ext,
+ switch (*s) {
+ #ifdef WIN32
+ case 'x': {
+- wchar_t exepath[PATH_MAX]; DWORD n;
++ wchar_t exepath[BOOT_PATH_MAX]; DWORD n;
+ s += 1;
+- n = GetModuleFileNameW(NULL, exepath, PATH_MAX);
+- if (n == 0 || (n == PATH_MAX && GetLastError() == ERROR_INSUFFICIENT_BUFFER)) {
++ n = GetModuleFileNameW(NULL, exepath, BOOT_PATH_MAX);
++ if (n == 0 || (n == BOOT_PATH_MAX && GetLastError() == ERROR_INSUFFICIENT_BUFFER)) {
+ fprintf(stderr, "warning: executable path is too long; ignoring %%x\n");
+ } else {
+ char *tstart;
+@@ -608,7 +614,7 @@ typedef struct {
+ iptr len; /* 0 => unknown */
+ iptr offset;
+ IBOOL need_check, close_after;
+- char path[PATH_MAX];
++ char path[BOOT_PATH_MAX];
+ } boot_desc;
+
+ #define MAX_BOOT_FILES 10
+@@ -695,14 +701,14 @@ static void finish_dependencies_header(int fd, const char *path, int c) {
+ static IBOOL find_boot(const char *name, const char *ext, IBOOL direct_pathp,
+ int fd,
+ IBOOL errorp) {
+- char pathbuf[PATH_MAX], buf[PATH_MAX];
++ char pathbuf[BOOT_PATH_MAX], buf[BOOT_PATH_MAX];
+ uptr n = 0;
+ INT c;
+ const char *path;
+ char *expandedpath;
+
+ if ((fd != -1) || direct_pathp || S_fixedpathp(name)) {
+- if (strlen(name) >= PATH_MAX) {
++ if (strlen(name) >= BOOT_PATH_MAX) {
+ fprintf(stderr, "boot-file path is too long %s\n", name);
+ S_abnormal_exit();
+ }
+@@ -776,7 +782,7 @@ static IBOOL find_boot(const char *name, const char *ext, IBOOL direct_pathp,
+ if (boot_count == 0) {
+ for (;;) {
+ /* try to load heap or boot file this boot file requires */
+- if (get_string(fd, buf, PATH_MAX, &c) != 0) {
++ if (get_string(fd, buf, BOOT_PATH_MAX, &c) != 0) {
+ fprintf(stderr, "unexpected end of file on %s\n", path);
+ CLOSE(fd);
+ S_abnormal_exit();
+@@ -796,7 +802,7 @@ static IBOOL find_boot(const char *name, const char *ext, IBOOL direct_pathp,
+ c = get_u8(fd);
+ for (sep = " "; ; sep = "or ") {
+ if (c == ')') break;
+- (void) get_string(fd, buf, PATH_MAX, &c);
++ (void) get_string(fd, buf, BOOT_PATH_MAX, &c);
+ fprintf(stderr, "%s%s
This message was truncated. Download the full message here.
P
P
Philip McGrath wrote on 11 Aug 2022 13:08
[PATCH v2 04/13] gnu: Add Zuo.
(address . 57050@debbugs.gnu.org)
285372112d70bcb4011d6c085592787df4f57d44.1660215295.git.philip@philipmcgrath.com
* gnu/packages/patches/racket-backport-8.6-zuo.patch,
gnu/packages/patches/racket-zuo-bin-sh.patch: New patches.
* gnu/local.mk (dist_patch_DATA): Add them.
* gnu/packages/racket.scm (%zuo-version): New variable.
(zuo): New variable.
---
gnu/local.mk | 2 +
.../patches/racket-backport-8.6-zuo.patch | 481 ++++++++++++++++++
gnu/packages/patches/racket-zuo-bin-sh.patch | 72 +++
gnu/packages/racket.scm | 64 +++
4 files changed, 619 insertions(+)
create mode 100644 gnu/packages/patches/racket-backport-8.6-zuo.patch
create mode 100644 gnu/packages/patches/racket-zuo-bin-sh.patch

Toggle diff (554 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 076fa341e9..4a87380350 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1774,8 +1774,10 @@ dist_patch_DATA = \
%D%/packages/patches/ripperx-missing-file.patch \
%D%/packages/patches/rpcbind-CVE-2017-8779.patch \
%D%/packages/patches/rtags-separate-rct.patch \
+ %D%/packages/patches/racket-backport-8.6-zuo.patch \
%D%/packages/patches/racket-chez-scheme-bin-sh.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/restic-0.9.6-fix-tests-for-go1.15.patch \
%D%/packages/patches/retroarch-LIBRETRO_DIRECTORY.patch \
diff --git a/gnu/packages/patches/racket-backport-8.6-zuo.patch b/gnu/packages/patches/racket-backport-8.6-zuo.patch
new file mode 100644
index 0000000000..b86679b7ec
--- /dev/null
+++ b/gnu/packages/patches/racket-backport-8.6-zuo.patch
@@ -0,0 +1,481 @@
+From 8761fc06b188b9ca2f4b7f2b7d1235075c44a321 Mon Sep 17 00:00:00 2001
+From: Matthew Flatt <mflatt@racket-lang.org>
+Date: Sat, 23 Jul 2022 17:10:58 -0600
+Subject: [PATCH 1/4] Zuo: support cross compilation via `configure` and
+ `CC_FOR_BUILD`
+
+(cherry picked from commit 798a989ba6d1a30c491a3120b2c2f1570ecab911)
+---
+ racket/src/zuo/Makefile.in | 7 ++++++-
+ racket/src/zuo/README.md | 10 ++++++++++
+ racket/src/zuo/configure | 15 +++++++++++++++
+ racket/src/zuo/configure.ac | 11 +++++++++++
+ 4 files changed, 42 insertions(+), 1 deletion(-)
+
+diff --git a/racket/src/zuo/Makefile.in b/racket/src/zuo/Makefile.in
+index 5d16e145bf..747b584c5c 100644
+--- a/racket/src/zuo/Makefile.in
++++ b/racket/src/zuo/Makefile.in
+@@ -17,6 +17,11 @@ CPPFLAGS = @CPPFLAGS@
+ LDFLAGS = @LDFLAGS@
+ LIBS = @LIBS@
+
++CC_FOR_BUILD = @CC_FOR_BUILD@
++CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
++LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
++LIBS_FOR_BUILD = @LIBS_FOR_BUILD@
++
+ EMBED_LIBS = @EMBED_LIBS@
+
+ .PHONY: zuos-to-run-and-install
+@@ -24,7 +29,7 @@ zuos-to-run-and-install: zuo
+ ./zuo . zuos-to-run-and-install
+
+ zuo: $(srcdir)/zuo.c
+- $(CC) $(CPPFLAGS) $(CFLAGS) -DZUO_LIB_PATH='"'"$(srcdir)/lib"'"' -o zuo $(srcdir)/zuo.c $(LDFLAGS) $(LIBS)
++ $(CC_FOR_BUILD) $(FLAGS_FOR_BUILD) -DZUO_LIB_PATH='"'"$(srcdir)/lib"'"' -o zuo $(srcdir)/zuo.c $(LDFLAGS_FOR_BUILD) $(LIBS_FOR_BUILD)
+
+ .PHONY: check
+ check: zuo
+diff --git a/racket/src/zuo/README.md b/racket/src/zuo/README.md
+index 17c88ee9ec..3aad504b7e 100644
+--- a/racket/src/zuo/README.md
++++ b/racket/src/zuo/README.md
+@@ -84,6 +84,16 @@ A boot image is machine-independent, whether in a stand-alone file or
+ embedded in `.c` source.
+
+
++Cross Compiling
++---------------
++
++If you use `./configure --host=...` to cross compile, then you will
++also need to add something like `CC_FOR_BUILD=cc` as a `./configure`
++argument to specify the compiler for a `zuo` to use on the build
++machine. If necessary, you can also specify `CFLAGS_FOR_BUILD`,
++`LDFLAGS_FOR_BUILD`, and/or `LIBS_FOR_BUILD`.
++
++
+ Embedding Zuo in Another Application
+ ------------------------------------
+
+diff --git a/racket/src/zuo/configure b/racket/src/zuo/configure
+index 1fa34a3fe8..575ce07d96 100755
+--- a/racket/src/zuo/configure
++++ b/racket/src/zuo/configure
+@@ -589,6 +589,10 @@ enable_embed="zuo"
+ ac_subst_vars='LTLIBOBJS
+ LIBOBJS
+ EMBED_LIBS
++LIBS_FOR_BUILD
++LDFLAGS_FOR_BUILD
++CFLAGS_FOR_BUILD
++CC_FOR_BUILD
+ OBJEXT
+ EXEEXT
+ ac_ct_CC
+@@ -2584,6 +2588,17 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
+ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
++if test "${CC_FOR_BUILD}" = ""; then
++ CC_FOR_BUILD='$(CC) -O2'
++ CFLAGS_FOR_BUILD='$(CPPFLAGS) $(CFLAGS)'
++ LDFLAGS_FOR_BUILD='$(LDFLAGS)'
++ LIBS_FOR_BUILD='$(LIBS)'
++fi
++
++
++
++
++
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: zuo libraries to embed: \"${EMBED_LIBS}\"" >&5
+ $as_echo "$as_me: zuo libraries to embed: \"${EMBED_LIBS}\"" >&6;}
+diff --git a/racket/src/zuo/configure.ac b/racket/src/zuo/configure.ac
+index 89b3c6391d..598ff79629 100644
+--- a/racket/src/zuo/configure.ac
++++ b/racket/src/zuo/configure.ac
+@@ -25,6 +25,17 @@ AS_IF([test "x$enable_embed" = xno],
+ AC_PROG_MAKE_SET()
+ AC_PROG_CC
+
++if test "${CC_FOR_BUILD}" = ""; then
++ CC_FOR_BUILD='$(CC) -O2'
++ CFLAGS_FOR_BUILD='$(CPPFLAGS) $(CFLAGS)'
++ LDFLAGS_FOR_BUILD='$(LDFLAGS)'
++ LIBS_FOR_BUILD='$(LIBS)'
++fi
++AC_SUBST(CC_FOR_BUILD)
++AC_SUBST(CFLAGS_FOR_BUILD)
++AC_SUBST(LDFLAGS_FOR_BUILD)
++AC_SUBST(LIBS_FOR_BUILD)
++
+ AC_SUBST(EMBED_LIBS)
+ AC_MSG_NOTICE([zuo libraries to embed: "${EMBED_LIBS}"])
+
+--
+2.32.0
+
+
+From f65194ea41eb472fbdd45d5f6c13eabe5e681704 Mon Sep 17 00:00:00 2001
+From: Matthew Flatt <mflatt@racket-lang.org>
+Date: Sat, 23 Jul 2022 17:47:03 -0600
+Subject: [PATCH 2/4] Zuo: sort hash keys
+
+Printing in a sorted order is helpful to make things more
+deterministic independent of symbol inputs. Making `hash-keys`
+produce a sorted list generalizes that determinism.
+
+(cherry picked from commit 4e7ffd3b365d01c5d0993c0b3fd24c9623962edf)
+---
+ racket/src/zuo/build.zuo | 5 ++-
+ racket/src/zuo/tests/hash.zuo | 8 ++--
+ racket/src/zuo/zuo-doc/lang-zuo.scrbl | 18 +++++++--
+ racket/src/zuo/zuo.c | 57 ++++++++++++++++++++++++++-
+ 4 files changed, 78 insertions(+), 10 deletions(-)
+
+diff --git a/racket/src/zuo/build.zuo b/racket/src/zuo/build.zuo
+index c1b5e8ce66..129240120a 100644
+--- a/racket/src/zuo/build.zuo
++++ b/racket/src/zuo/build.zuo
+@@ -47,7 +47,10 @@
+ (target (at-dir (add-exe name))
+ (lambda (path token)
+ (rule (list image_zuo.c
+- (input-data-target 'config config)
++ (input-data-target 'config (cons
++ lib-path
++ (map (lambda (key) (hash-ref config key))
++ '(CC CPPFLAGS CFLAGS LDFLAGS LIBS))))
+ (quote-module-path))
+ (lambda ()
+ (define l (split-path path))
+diff --git a/racket/src/zuo/tests/hash.zuo b/racket/src/zuo/tests/hash.zuo
+index a35741c730..0d3d7f3af6 100644
+--- a/racket/src/zuo/tests/hash.zuo
++++ b/racket/src/zuo/tests/hash.zuo
+@@ -35,9 +35,7 @@
+
+ (check (hash-keys (hash)) '())
+ (check (hash-keys (hash 'a 1)) '(a))
+-(check (let ([keys (hash-keys (hash 'a 1 'b 2))])
+- (or (equal? keys '(a b))
+- (equal? keys '(b a)))))
++(check (hash-keys (hash 'a 1 'b 2)) '(a b)) ; always in order
+ (check (length (hash-keys (hash 'a 1 'b 2 'c 3))) 3)
+ (check (length (hash-keys (hash 'a 1 'b 2 'a 3))) 2)
+ (check-arg-fail (hash-keys 0) "not a hash table")
+@@ -50,3 +48,7 @@
+ (check (hash-keys-subset? (hash 'a 1 'b 2) (hash 'b 1)) #f)
+ (check-arg-fail (hash-keys-subset? 0 (hash)) "not a hash table")
+ (check-arg-fail (hash-keys-subset? (hash) 0) "not a hash table")
++
++;; print sorts keys alphabetically:
++(check (~a (hash 'a 1 'b 2)) "#hash((a . 1) (b . 2))")
++(check (~a (hash 'b 2 'a 1)) "#hash((a . 1) (b . 2))")
+diff --git a/racket/src/zuo/zuo-doc/lang-zuo.scrbl b/racket/src/zuo/zuo-doc/lang-zuo.scrbl
+index 94641d041e..4605e47471 100644
+--- a/racket/src/zuo/zuo-doc/lang-zuo.scrbl
++++ b/racket/src/zuo/zuo-doc/lang-zuo.scrbl
+@@ -538,10 +538,20 @@ support to convert the textual form back into a hash table value.
+
+ Analogous to @realracket*[hash? hash hash-ref hash-set hash-remove
+ hash-keys hash-count hash-keys-subset?] from @racketmodname[racket].
+-Besides being constrained to symbol keys, there is one additional
+-difference: the third argument to @racket[hash-ref], when supplied,
+-is always used as a value to return if a key is missing, as
+-opposed to a failure thunk.}
++
++Besides being constrained to symbol keys, there are two additional
++differences:
++
++@itemlist[
++
++ @item{the third argument to @racket[hash-ref], when supplied, is
++ always used as a value to return if a key is missing, as
++ opposed to a failure thunk; and}
++
++ @item{the @racket[hash-keys] function returns interned keys sorted
++ alphabetically.}
++
++]}
+
+
+ @section{Procedures}
+diff --git a/racket/src/zuo/zuo.c b/racket/src/zuo/zuo.c
+index 2957d478af..88d5747326 100644
+--- a/racket/src/zuo/zuo.c
++++ b/racket/src/zuo/zuo.c
+@@ -1298,6 +1298,59 @@ static zuo_t *zuo_trie_keys(zuo_t *trie_in, zuo_t *accum) {
+ return accum;
+ }
+
++/*======================================================================*/
++/* symbol-list sorting */
++/*======================================================================*/
++
++/* merge sort used to make hash printing deterministic */
++static zuo_t *zuo_symbol_list_sort(zuo_t *l_in) {
++ zuo_t *l, *left, *right, *first, *last;
++ zuo_uint_t len = 0, i;
++
++ for (l = l_in, len = 0; l != z.o_null; l = _zuo_cdr(l))
++ len++;
++
++ if (len < 2)
++ return l_in;
++
++ left = z.o_null;
++ for (l = l_in, i = len >> 1; i > 0; l = _zuo_cdr(l), i--)
++ left = zuo_cons(_zuo_car(l), left);
++ right = l;
++
++ left = zuo_symbol_list_sort(left);
++ right = zuo_symbol_list_sort(right);
++
++ first = last = z.o_null;
++ while ((left != z.o_null) && (right != z.o_null)) {
++ zuo_t *p;
++
++ if (strcmp(ZUO_STRING_PTR(((zuo_symbol_t *)_zuo_car(left))->str),
++ ZUO_STRING_PTR(((zuo_symbol_t *)_zuo_car(right))->str))
++ < 1) {
++ p = zuo_cons(_zuo_car(left), z.o_null);
++ left = _zuo_cdr(left);
++ } else {
++ p = zuo_cons(_zuo_car(right), z.o_null);
++ right = _zuo_cdr(right);
++ }
++
++ if (first == z.o_null)
++ first = p;
++ else
++ ((zuo_pair_t *)last)->cdr = p;
++ last = p;
++ }
++
++ ((zuo_pair_t *)last)->cdr = ((left != z.o_null) ? left : right);
++
++ return first;
++}
++
++static zuo_t *zuo_trie_sorted_keys(zuo_t *trie_in, zuo_t *accum) {
++ return zuo_symbol_list_sort(zuo_trie_keys(trie_in, accum));
++}
++
+ /*======================================================================*/
+ /* terminal support */
+ /*======================================================================*/
+@@ -1571,7 +1624,7 @@ static void zuo_out(zuo_out_t *out, zuo_t *obj, zuo_print_mode_t mode) {
+ out_string(out, "opaque");
+ out_string(out, ">");
+ } else if (obj->tag == zuo_trie_node_tag) {
+- zuo_t *keys = zuo_trie_keys(obj, z.o_null);
++ zuo_t *keys = zuo_trie_sorted_keys(obj, z.o_null);
+ if (mode == zuo_print_mode) {
+ out_string(out, "(hash");
+ if (keys != z.o_null)
+@@ -2587,7 +2640,7 @@ static zuo_t *zuo_hash_remove(zuo_t *ht, zuo_t *sym) {
+
+ static zuo_t *zuo_hash_keys(zuo_t *ht) {
+ check_hash("hash-keys", ht);
+- return zuo_trie_keys(ht, z.o_null);
++ return zuo_trie_sorted_keys(ht, z.o_null);
+ }
+
+ static zuo_t *zuo_hash_keys_subset_p(zuo_t *ht, zuo_t *ht2) {
+--
+2.32.0
+
+
+From f2eecaa1dd875479d2cf51566223b3d0d7b9f738 Mon Sep 17 00:00:00 2001
+From: Matthew Flatt <mflatt@racket-lang.org>
+Date: Sat, 23 Jul 2022 18:06:41 -0600
+Subject: [PATCH 3/4] Zuo: check for nul characters in `string->symbol`
+
+(cherry picked from commit e20022ccfad40d0ba2e77aa75bc4f775018c781f)
+---
+ racket/src/zuo/tests/symbol.zuo | 3 +++
+ racket/src/zuo/zuo-doc/lang-zuo.scrbl | 4 ++-
+ racket/src/zuo/zuo.c | 37 +++++++++++++++++----------
+ 3 files changed, 29 insertions(+), 15 deletions(-)
+
+diff --git a/racket/src/zuo/tests/symbol.zuo b/racket/src/zuo/tests/symbol.zuo
+index 7775aeeb04..5600a89755 100644
+--- a/racket/src/zuo/tests/symbol.zuo
++++ b/racket/src/zuo/tests/symbol.zuo
+@@ -19,3 +19,6 @@
+ (check (not (equal? 'apple (string->uninterned-symbol "apple"))))
+ (check-arg-fail (string->symbol 'apple) not-string)
+ (check-arg-fail (string->uninterned-symbol 'apple) not-string)
++
++(check-arg-fail (string->symbol "apple\0spice") "without a nul character")
++(check (symbol? (string->uninterned-symbol "apple\0spice")))
+diff --git a/racket/src/zuo/zuo-doc/lang-zuo.scrbl b/racket/src/zuo/zuo-doc/lang-zuo.scrbl
+index 4605e47471..07dd5815b0 100644
+--- a/racket/src/zuo/zuo-doc/lang-zuo.scrbl
++++ b/racket/src/zuo/zuo-doc/lang-zuo.scrbl
+@@ -500,7 +500,9 @@ back into Zuo.
+ )]{
+
+ Analogous to @realracket*[symbol? symbol->string string->symbol
+-string->uninterned-symbol] from @racketmodname[racket].}
++string->uninterned-symbol] from @racketmodname[racket], but
++@racket[string->symbol] accepts only strings that do not contain the
++null character.}
+
+
+ @section{Hash Tables (Persistent Maps)}
+diff --git a/racket/src/zuo/zuo.c b/racket/src/zuo/zuo.c
+index 88d5747326..17f161826d 100644
+--- a/racket/src/zuo/zuo.c
++++ b/racket/src/zuo/zuo.c
+@@ -1323,7 +1323,7 @@ static zuo_t *zuo_symbol_list_sort(zuo_t *l_in) {
+
+ first = last = z.o_null;
+ while ((left != z.o_null) && (right != z.o_null)) {
+- zuo_t *p;
++ zuo_t *p, *s_left, *s_right;
+
+ if (strcmp(ZUO_STRING_PTR(((zuo_symbol_t *)_zuo_car(left))->str),
+ ZUO_STRING_PTR(((zuo_symbol_t *)_zuo_car(right))->str))
+@@ -2573,8 +2573,28 @@ static zuo_t *zuo_substring(zuo_t *obj, zuo_t *start_i, zuo_t *end_i) {
+ return zuo_sized_string((const char *)&((zuo_string_t *)obj)->s[s_idx], e_idx - s_idx);
+ }
+
++static int zuo_is_string_without_nul(zuo_t *obj) {
++ zuo_int_t i;
++
++ if ((obj->tag != zuo_string_tag)
++ || ZUO_STRING_LEN(obj) == 0)
++ return 0;
++
++ for (i = ZUO_STRING_LEN(obj); i--; ) {
++ if (((zuo_string_t *)obj)->s[i] == 0)
++ return 0;
++ }
++
++ return 1;
++}
++
+ static zuo_t *zuo_string_to_symbol(zuo_t *obj) {
+- check_string("string->symbol", obj);
++ if (!zuo_is_string_without_nul(obj)) {
++ const char *who = "string->symbol";
++ check_string(who, obj);
++ zuo_fail_arg(who, "string without a nul character", obj);
++ }
++
+ return zuo_symbol_from_string(ZUO_STRING_PTR(obj), obj);
+ }
+
+@@ -3577,18 +3597,7 @@ static void *zuo_envvars_block(const char *who, zuo_t *envvars)
+ #endif
+
+ static int zuo_is_path_string(zuo_t *obj) {
+- zuo_int_t i;
+-
+- if ((obj->tag != zuo_string_tag)
+- || ZUO_STRING_LEN(obj) == 0)
+- return 0;
+-
+- for (i = ZUO_STRING_LEN(obj); i--; ) {
+- if (((zuo_string_t *)obj)->s[i] == 0)
+- return 0;
+- }
+-
+- return 1;
++ return zuo_is_string_without_nul(obj);
+ }
+
+ static zuo_t *zuo_path_string_p(zuo_t *obj) {
+--
+2.32.0
+
+
+From de6618cb3819d25580e3cd400ea09c8cf4f673a9 Mon Sep 17 00:00:00 2001
+From: Matthew Flatt <mflatt@racket-lang.org>
+Date: Sat, 23 Jul 2022 19:50:46 -0600
+Subject: [PATCH 4/4] Zuo: CPPFLAGS_FOR_BUILD, too
+
+(cherry picked from commit cf82706c4b298f654a04c4bc8d98dff39b62a2ac)
+---
+ racket/src/zuo/Makefile.in | 3 ++-
+ racket/src/zuo/configure | 5 ++++-
+ racket/src/zuo/configure.ac | 4 +++-
+ 3 files changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/racket/src/zuo/Makefile.in b/racket/src/zuo/Makefile.in
+index 747b584c5c..0376c038a8 100644
+--- a/racket/src/zuo/Makefile.in
++++ b/racket/src/zuo/Makefile.in
+@@ -19,6 +19,7 @@ LIBS = @LIBS@
+
+ CC_FOR_BUILD = @CC_FOR_BUILD@
+ CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
++CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@
+ LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
+ LIBS_FOR_BUILD = @LIBS_FOR_BUILD@
+
+@@ -29,7 +30,7 @@ zuos-to-run-and-install: zuo
+ ./zuo . zuos-to-run-and-install
+
+ zuo: $(srcdir)/zuo.c
+- $(CC_FOR_BUILD) $(FLAGS_FOR_BUILD) -DZUO_LIB_PATH='"'"$(srcdir)/lib"'"' -o zuo $(srcdir)/zuo.c $(LDFLAGS_FOR_BUILD) $(LIBS_FOR_BUILD)
++ $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) -DZUO_LIB_PATH='"'"$(srcdir)/lib"'"' -o zuo $(srcdir)/zuo.c $(LDFLAGS_FOR_BUILD) $(LIBS_FOR_BUILD)
+
+ .PHONY: check
+ check: zuo
+diff --git a/racket/src/zuo/configure b/racket/src/zuo/configure
+index 575ce07d96..7ac453e3bc 100755
+--- a/racket/src/zuo/configure
++++ b/racket/src/zuo/configure
+@@ -591,6 +591,7 @@ LIBOBJS
+ EMBED_LIBS
+ LIBS_FOR_BUILD
+ LDFLAGS_FOR_BUILD
++CPPFLAGS_FOR_BUILD
+ CFLAGS_FOR_BUILD
+ CC_FOR_BUILD
+ OBJEXT
+@@ -2590,7 +2591,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ if test "${CC_FOR_BUILD}" = ""; then
+ CC_FOR_BUILD='$(CC) -O2'
+- CFLAGS_FOR_BUILD='$(CPPFLAGS) $(CFLAGS)'
++ CPPFLAGS_FOR_BUILD='$(CPPFLAGS)'
++ CFLAGS_FOR_BUILD='$(CFLAGS)'
+ LDFLAGS_FOR_BUILD='$(LDFLAGS)'
+ LIBS_FOR_BUILD='$(LIBS)'
+ fi
+@@ -2600,6 +2602,7 @@ fi
+
+
+
++
+ { $as_echo "$as_me:${as_lineno-$LINENO}: zuo libraries to embed: \"${EMBED_LIBS}\"" >&5
+ $as_echo "$as_me: zuo libraries to embed: \"${EMBED_LIBS}\"" >&6;}
+
+diff --git a/racket/src/zuo/configure.ac b/racket/src/zuo/configure.ac
+index 598ff79629..051ea0beb5 100644
+--- a/racket/src/zuo/configure.ac
++++ b/racket/src/zuo/configure.ac
+@@ -27,12 +27,14 @@ AC_PROG_CC
+
+ if test "${CC_FOR_BUILD}" = ""; then
+ CC_FOR_BUILD='$(CC) -O2'
+- CFLAGS_FOR_BUILD='$(CPPFLAGS) $(CFLAGS)'
++ CPPFLAGS_FOR_BUILD='$(CPPFLAGS)'
++ CFLAGS_FOR_BUILD='$(CFLAGS)'
+ LDFLAGS_FOR_BUILD='$(LDFLAGS)'
+ LIBS_FOR_BUILD='$(LIBS)'
+ fi
+ AC_SUBST(CC_FOR_BUILD)
+ AC_SUBST(CFLAGS_FOR_BUILD)
++AC_SUBST(CPPFLAGS_FOR_BUILD)
+ AC_SUBST(LDFLAGS_FOR_BUILD)
+ AC_SUBST(LIBS_FOR_BUILD)
+
+--
+2.32.0
+
diff --git a/gnu/packages/patches/racket-zuo-bin-sh.patch b/gnu/packages/patches/racket-zuo-bin-sh.patch
new file mode 100644
index 0000000000..392ea05129
--- /dev/null
+++ b/gnu/packages/patches/racket-zuo-bin-sh.patch
@@ -0,0 +1,72 @@
+From 4888106cdfd80d1af925e5a485a2812d35a83b46 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
+
+This patch reuses the C preprocessor macro `GUIX_RKTIO_BIN_SH`
+from a previous patch.
+
+If:
+
+ 1. The `GUIX_RKTIO_BIN_SH` macro is defined; and
+
+ 2. `zuo_process` is called with the exact path "/bin/sh"; and
+
+ 3. The path specified by `GUIX_RKTIO_BIN_SH` exists;
+
+then `zuo_process` will execute the file specified by
+`GUIX_RKTIO_BIN_SH` instead of "/bin/sh".
+---
+ racket/src/zuo/zuo.c | 27 +++++++++++++++++++++++++--
+ 1 file changed, 25 insertions(+), 2 deletions(-)
+
+diff --git a/racket/src/zuo/zuo.c b/racket/src/zuo/zuo.c
+index 17f161826d..10e7a2a297 100644
+--- a/racket/src/zuo/zuo.c
++++ b/racket/src/zuo/zuo.c
+@@ -5730,7 +5730,18 @@ 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";
+- zuo_t *command = _zuo_car(command_and_args);
++ /* BEGIN PATCH for Guix */
++ zuo_t *_guix_orig_command = _zuo_car(command_and_args);
++ zuo_t *command;
++#if defined(GUIX_RKTIO_BIN_SH)
++# define GUIX_AS_a_STR_HELPER(x) #x
++# define GUIX_AS_a_STR(x) GUIX_AS_a_STR_HELPER(x)
++ /* A level of indirection makes `#` work as needed: */
++ const char *guix_sh = GUIX_AS_a_STR(GUIX_RKTIO_BIN_SH);
++# undef GUIX_AS_a_STR
++# undef GUIX_AS_a_STR_HELPER
++#endif
++ /* END PATCH for Guix */
+ zuo_t *args = _zuo_cdr(command_and_args), *rev_args = z.o_null;
+ zuo_t *options = z.o_empty_hash, *opt;
+ zuo_t *di
This message was truncated. Download the full message here.
P
P
Philip McGrath wrote on 11 Aug 2022 13:08
[PATCH v2 07/13] gnu: chez-scheme-for-racket: Support cross-compilation.
(address . 57050@debbugs.gnu.org)
c4a4369546a20e92b6301abdc89164b7b72f59f4.1660215295.git.philip@philipmcgrath.com
* gnu/packages/chez.scm (racket-cs-native-supported-system): Change to
return the applicable machine type instead of '#t'.
(chez-scheme-for-racket)[native-inputs]: When cross-compiling, add
'this-package'.
[arguments]<#:configure-flags>: When cross-compiling, supply '-m=' and
'--toolprefix='.
<#:phases>: Work around cross-compilation issues in 'build' and
'install-docs'.
(chez-scheme-for-racket-bootstrap-bootfiles): When cross-compiling,
use 'zuo' and 'chez-scheme-for-racket' instead of 'racket-vm-bc'.
[arguments]<#:phases>: Adapt 'build' phase for cross-compilation.
---
gnu/packages/chez.scm | 85 +++++++++++++++++++++++++++++++++++--------
1 file changed, 70 insertions(+), 15 deletions(-)

Toggle diff (145 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 294edca1a4..be9884b3d2 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -236,14 +236,15 @@ (define* (racket-cs-native-supported-system? #:optional
(system
(or (%current-target-system)
(%current-system))))
- "Can Racket's variant of Chez Scheme generate native code for SYSTEM?
-Otherwise, SYSTEM can use only the ``portable bytecode'' backends."
+ "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 <>))
- #t)))
+ (string-append "t" chez-arch chez-os))))
;;
;; Chez Scheme:
@@ -457,8 +458,12 @@ (define-public chez-scheme-for-racket
(replace "chez-scheme-bootstrap-bootfiles"
chez-scheme-for-racket-bootstrap-bootfiles)))
(native-inputs
- (modify-inputs (package-native-inputs chez-scheme)
- (append zuo)))
+ (let ((native-inputs (modify-inputs (package-native-inputs chez-scheme)
+ (append zuo))))
+ (if (%current-target-system)
+ (modify-inputs native-inputs
+ (append this-package))
+ native-inputs)))
(arguments
(substitute-keyword-arguments (package-arguments chez-scheme)
((#:out-of-source? _ #f)
@@ -472,6 +477,15 @@ (define-public chez-scheme-for-racket
((#:configure-flags cfg-flags #~'())
#~`("--disable-x11"
"--threads" ;; ok to potentially duplicate
+ #$@(if (%current-target-system)
+ (list (string-append "-m="
+ (racket-cs-native-supported-system?)))
+ '())
+ #$@(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
@@ -494,18 +508,42 @@ (define-public chez-scheme-for-racket
#$mk-flags))
((#:phases those-phases #~%standard-phases)
#~(let* ((those-phases #$those-phases)
- (unpack (assoc-ref those-phases 'unpack)))
+ (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 make-flags #:allow-other-keys)
+ (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"
- make-flags)))
+ (if native-inputs
+ (cons (string-append
+ "Scheme="
+ (search-input-file native-inputs
+ "/bin/scheme"))
+ make-flags)
+ make-flags))))
(replace 'unpack
(lambda args
- (unpack #:source #$(or (package-source this-package)
- (package-source racket-vm-bc)))))
+ (gnu:unpack #:source #$(or (package-source this-package)
+ (package-source racket-vm-bc)))))
(add-after 'unpack 'chdir
(lambda args
(chdir "racket/src/ChezScheme"))))))))
@@ -587,8 +625,12 @@ (define-public chez-scheme-for-racket-bootstrap-bootfiles
(name "chez-scheme-for-racket-bootstrap-bootfiles")
(version (package-version chez-scheme-for-racket))
(source #f) ; avoid problematic cycle with racket.scm
- (native-inputs (list chez-nanopass-bootstrap racket-vm-bc))
- ;; TODO: cross compilation
+ (native-inputs
+ (cons* chez-nanopass-bootstrap
+ (if (%current-target-system)
+ (list zuo
+ chez-scheme-for-racket)
+ (list racket-vm-bc))))
(arguments
(substitute-keyword-arguments
(package-arguments chez-scheme-bootstrap-bootfiles)
@@ -608,9 +650,22 @@ (define-public chez-scheme-for-racket-bootstrap-bootfiles
#$unpack-nanopass+stex))
(add-before 'install 'build
(lambda* (#:key native-inputs inputs #:allow-other-keys)
- (invoke (search-input-file (or native-inputs inputs)
- "/opt/racket-vm/bin/racket")
- "rktboot/main.rkt"))))))))
+ #$(cond
+ ((%current-target-system)
+ ;; cross-compiling
+ #~(invoke
+ (search-input-file (or native-inputs inputs)
+ "/bin/zuo")
+ "makefiles/boot.zuo"
+ (search-input-file (or native-inputs inputs)
+ "/bin/scheme")
+ #$(racket-cs-native-supported-system?)))
+ (else
+ ;; bootstrapping
+ #~(invoke
+ (search-input-file (or native-inputs inputs)
+ "/opt/racket-vm/bin/racket")
+ "rktboot/main.rkt"))))))))))
(supported-systems
(package-supported-systems chez-scheme-for-racket))
(home-page "https://github.com/racket/ChezScheme")
--
2.32.0
P
P
Philip McGrath wrote on 11 Aug 2022 13:08
[PATCH v2 06/13] gnu: chez-scheme: Bootfiles should not be native inputs.
(address . 57050@debbugs.gnu.org)
760b29c0cb071c142a637e538233a661ad4a5c87.1660215295.git.philip@philipmcgrath.com
This makes a difference for cross-compilation.

* gnu/packages/chez.scm (chez-scheme)[native-inputs]: Move
'chez-scheme-bootstrap-bootfiles' to ...
[inputs]: ... this field.
[arguments]<#:phases>: Update 'unpack-bootfiles' accordingly.
(chez-scheme-for-racket)[native-inputs]: Move
'chez-scheme-for-racket-bootstrap-bootfiles' to ...
[inputs]: ... this field.
---
gnu/packages/chez.scm | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

Toggle diff (50 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index dde2c22ca5..294edca1a4 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -294,6 +294,7 @@ (define-public chez-scheme
(build-system gnu-build-system)
(inputs
(list
+ chez-scheme-bootstrap-bootfiles
`(,util-linux "lib") ;<-- libuuid
zlib
lz4
@@ -302,8 +303,7 @@ (define-public chez-scheme
;; for X11 clipboard support in expeditor:
;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
libx11))
- (native-inputs (list chez-scheme-bootstrap-bootfiles
- chez-nanopass-bootstrap
+ (native-inputs (list chez-nanopass-bootstrap
stex-bootstrap))
(native-search-paths
(list (search-path-specification
@@ -342,7 +342,7 @@ (define-public chez-scheme
(when (directory-exists? "boot")
(delete-file-recursively "boot"))
(copy-recursively
- (search-input-directory (or native-inputs inputs)
+ (search-input-directory inputs
"lib/chez-scheme-bootfiles")
"boot")))
;; NOTE: The custom Chez 'configure' script doesn't allow
@@ -453,12 +453,12 @@ (define-public chez-scheme-for-racket
(source #f) ; avoid problematic cycle with racket.scm
(inputs
(modify-inputs (package-inputs chez-scheme)
- (delete "libx11" "util-linux:lib")))
+ (delete "libx11" "util-linux:lib")
+ (replace "chez-scheme-bootstrap-bootfiles"
+ chez-scheme-for-racket-bootstrap-bootfiles)))
(native-inputs
(modify-inputs (package-native-inputs chez-scheme)
- (append zuo)
- (replace "chez-scheme-bootstrap-bootfiles"
- chez-scheme-for-racket-bootstrap-bootfiles)))
+ (append zuo)))
(arguments
(substitute-keyword-arguments (package-arguments chez-scheme)
((#:out-of-source? _ #f)
--
2.32.0
P
P
Philip McGrath wrote on 11 Aug 2022 13:08
[PATCH v2 08/13] gnu: racket: Support cross-compiling the VM packages.
(address . 57050@debbugs.gnu.org)
c3b1f87232f152742f0a46d87437d4cad6a205d7.1660215295.git.philip@philipmcgrath.com
Cross-compilation works for 'racket-vm-cgc', 'racket-vm-bc', and
'racket-vm-cs'. These changes are not enough to cross-compile
'racket-minimal' or 'racket': that would require building and loading
cross-compilation pluggins for 'racket-vm-cs', which will be much
easier once we can build the package 'raco-cross'.

* gnu/packages/racket.scm (racket-vm-cgc): Add 'this-package' when
cross-compiling.
(racket-vm-bc)[native-inputs]: Adjust accordingly.
(racket-vm-cs)[native-inputs]: Use 'racket-vm-cs' instead of
'racket-vm-bc' when cross-compiling. Adapt to changes to
'racket-vm-cgc'.
[arguments]<#:configure-flags>: Fix '--enable-scheme' for
cross-compilation.
---
gnu/packages/racket.scm | 31 +++++++++++++++++++++----------
1 file changed, 21 insertions(+), 10 deletions(-)

Toggle diff (65 lines)
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index 31f3394fa3..ef353103d6 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -332,8 +332,11 @@ (define-public racket-vm-cgc
(inputs (list ncurses ;; <- common to all variants (for #%terminal)
bash-minimal ;; <- common to all variants (for `system`)
libffi)) ;; <- only for BC variants
- (native-inputs (list zuo ;; <- for all variants
- libtool)) ;; <- only for BC variants
+ (native-inputs (cons* zuo ;; <- for all variants
+ libtool ;; <- only for BC variants
+ (if (%current-target-system)
+ (list this-package)
+ '())))
(outputs '("out" "debug"))
(build-system gnu-build-system)
(arguments
@@ -421,8 +424,10 @@ (define-public racket-vm-bc
(inherit racket-vm-cgc)
(name "racket-vm-bc")
(native-inputs
- (modify-inputs (package-native-inputs racket-vm-cgc)
- (prepend racket-vm-cgc)))
+ (if (%current-target-system)
+ (package-native-inputs racket-vm-cgc)
+ (modify-inputs (package-native-inputs racket-vm-cgc)
+ (prepend racket-vm-cgc))))
(arguments
(substitute-keyword-arguments (package-arguments racket-vm-cgc)
((#:configure-flags _ '())
@@ -452,11 +457,17 @@ (define-public racket-vm-cs
(prepend zlib lz4)
(delete "libffi")))
(native-inputs
- (modify-inputs (package-native-inputs racket-vm-cgc)
- (delete "libtool")
- (prepend chez-scheme-for-racket
- chez-nanopass-bootstrap
- racket-vm-bc)))
+ (let ((native-inputs (package-native-inputs racket-vm-cgc)))
+ (modify-inputs (if (%current-target-system)
+ (modify-inputs native-inputs
+ (delete "racket-vm-cgc"))
+ native-inputs)
+ (delete "libtool")
+ (prepend chez-scheme-for-racket
+ chez-nanopass-bootstrap
+ (if (%current-target-system)
+ racket-vm-cs
+ racket-vm-bc)))))
(arguments
(substitute-keyword-arguments (package-arguments racket-vm-cgc)
((#:phases those-phases #~%standard-phases)
@@ -470,7 +481,7 @@ (define-public racket-vm-cs
"--enable-libz"
"--enable-lz4"
(string-append "--enable-scheme="
- #$(this-package-native-input
+ #+(this-package-native-input
"chez-scheme-for-racket")
"/bin/scheme")
#$(racket-vm-common-configure-flags)))))
--
2.32.0
P
P
Philip McGrath wrote on 11 Aug 2022 13:08
[PATCH v2 09/13] gnu: chez-scheme-for-racket: Suport all systems.
(address . 57050@debbugs.gnu.org)
4d63cf22559de641440810e451b9366aa6091774.1660215295.git.philip@philipmcgrath.com
On systems for which Racket's variant of Chez Scheme cannot generate
native code, it can use a 'pbarch' machine type: a variant of the
``portable bytecode'' backend specialized to word size and endianness.
This allows Racket CS to replace Racket BC on those systems while
maintaining comparable performance. (Racket BC lacks JIT support for
those systems anyway.) It also lets us provide a Chez Scheme package on
all systems Guix supports.

This patch adds 'pbarch' support to both 'chez-scheme-for-racket' and
'racket-vm-cs', but it does not change the Racket VM implementation used
for the 'racket' and 'racket-minimal' packages.

* gnu/packages/chez.scm (nix-system->pbarch-machine-type): New variable.
(chez-scheme-for-racket)[inputs]: Use 'libffi' for non-native systems.
[arguments]<#:configure-flags>: Always supply '-m='. Add applicable
flags for non-native systems.
[supported-systems]: Use '%supported-systems'.
[description]: Update.
(chez-scheme-for-racket-bootstrap-bootfiles)[arguments]<#:phases>: Adapt
'build' phase for non-native systems.
* gnu/packages/racket.scm (racket-vm-bc)[description]: Update.
(racket-vm-cs)[description]: Likewise.
[inputs]: Use 'libffi' for non-native systems.
[arguments]<#:configure-flags>: Add applicable flags for non-native
systems.
---
gnu/packages/chez.scm | 76 ++++++++++++++++++++++++++++++-----------
gnu/packages/racket.scm | 26 +++++++++-----
2 files changed, 74 insertions(+), 28 deletions(-)

Toggle diff (217 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index be9884b3d2..38b724ae5f 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -38,6 +38,7 @@ (define-module (gnu packages chez)
#:use-module (gnu packages compression)
#:use-module (gnu packages ncurses)
#:use-module (gnu packages ghostscript)
+ #:use-module (gnu packages libffi)
#:use-module (gnu packages linux)
#:use-module (gnu packages netpbm)
#:use-module (gnu packages racket)
@@ -50,6 +51,7 @@ (define-module (gnu packages chez)
#:use-module (srfi srfi-26)
#:export (chez-scheme-for-system
racket-cs-native-supported-system?
+ nix-system->pbarch-machine-type
unpack-nanopass+stex))
;; Commentary:
@@ -232,6 +234,28 @@ (define* (chez-upstream-features-for-system #:optional
(and=> (assoc-ref %chez-features-table chez-os)
(cut assoc-ref <> chez-arch))))
+(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."
+ (string-append (if threads?
+ "t"
+ "")
+ "pb"
+ (if (target-64bit? system)
+ "64"
+ "32")
+ ;; missing (guix utils) predicate target-little-endian?
+ (if (target-ppc32? system)
+ "b"
+ "l")))
+
(define* (racket-cs-native-supported-system? #:optional
(system
(or (%current-target-system)
@@ -453,10 +477,14 @@ (define-public chez-scheme-for-racket
;; When updating, remember to also update %racket-version in racket.scm.
(source #f) ; avoid problematic cycle with racket.scm
(inputs
- (modify-inputs (package-inputs chez-scheme)
- (delete "libx11" "util-linux:lib")
- (replace "chez-scheme-bootstrap-bootfiles"
- chez-scheme-for-racket-bootstrap-bootfiles)))
+ (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
+ (append libffi)))))
(native-inputs
(let ((native-inputs (modify-inputs (package-native-inputs chez-scheme)
(append zuo))))
@@ -477,10 +505,16 @@ (define-public chez-scheme-for-racket
((#:configure-flags cfg-flags #~'())
#~`("--disable-x11"
"--threads" ;; ok to potentially duplicate
- #$@(if (%current-target-system)
- (list (string-append "-m="
- (racket-cs-native-supported-system?)))
- '())
+ #$(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)
@@ -547,10 +581,7 @@ (define-public chez-scheme-for-racket
(add-after 'unpack 'chdir
(lambda args
(chdir "racket/src/ChezScheme"))))))))
- ;; TODO: How to build pbarch/pbchunks for other systems?
- ;; See https://racket.discourse.group/t/950
- (supported-systems (filter racket-cs-native-supported-system?
- %supported-systems))
+ (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
@@ -563,13 +594,17 @@ (define-public chez-scheme-for-racket
Main additions to Chez Scheme in the Racket variant:
@itemize @bullet
@item
-AArch64 support
+AArch64 code generation
@item
-Portable bytes (@code{pb}) support, which is mainly useful for bootstrapping
-a build on any supported platform
+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 attachments
@@ -580,8 +615,6 @@ (define-public chez-scheme-for-racket
@item
Ordered finalization, immobile (but collectable) objects, weak/ephemeron
generic hash tables, and reference bytevectors
-@item
-Faster multiplication and division for large exact numbers
@end itemize")
(license asl2.0)))
@@ -659,13 +692,18 @@ (define-public chez-scheme-for-racket-bootstrap-bootfiles
"makefiles/boot.zuo"
(search-input-file (or native-inputs inputs)
"/bin/scheme")
- #$(racket-cs-native-supported-system?)))
+ #$(or (racket-cs-native-supported-system?)
+ (nix-system->pbarch-machine-type))))
(else
;; bootstrapping
#~(invoke
(search-input-file (or native-inputs inputs)
"/opt/racket-vm/bin/racket")
- "rktboot/main.rkt"))))))))))
+ "rktboot/main.rkt"
+ #$@(if (racket-cs-native-supported-system?)
+ #~()
+ (let ((m (nix-system->pbarch-machine-type)))
+ #~("--machine" #$m)))))))))))))
(supported-systems
(package-supported-systems chez-scheme-for-racket))
(home-page "https://github.com/racket/ChezScheme")
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index ef353103d6..3b96cf46ef 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -331,7 +331,7 @@ (define-public racket-vm-cgc
(source %racket-origin)
(inputs (list ncurses ;; <- common to all variants (for #%terminal)
bash-minimal ;; <- common to all variants (for `system`)
- libffi)) ;; <- only for BC variants
+ libffi)) ;; <- for BC and non-native CS variants
(native-inputs (cons* zuo ;; <- for all variants
libtool ;; <- only for BC variants
(if (%current-target-system)
@@ -437,10 +437,8 @@ (define-public racket-vm-bc
(description "The Racket BC (``before Chez'' or ``bytecode'')
implementation was the default before Racket 8.0. It uses a compiler written
in C targeting architecture-independent bytecode, plus a JIT compiler on most
-platforms. Racket BC has a different C API and supports a slightly different
-set of architectures than the current default runtime system, Racket CS (based
-on ``Chez Scheme''). It is the recommended implementation for architectures
-that Racket CS doesn't support.
+platforms. Racket BC has a different C API than the current default runtime
+system, Racket CS (based on ``Chez Scheme'').
This package is the normal implementation of Racket BC with a precise garbage
collector, 3M (``Moving Memory Manager'').")
@@ -453,9 +451,12 @@ (define-public racket-vm-cs
(inherit racket-vm-bc)
(name "racket-vm-cs")
(inputs
- (modify-inputs (package-inputs racket-vm-cgc)
- (prepend zlib lz4)
- (delete "libffi")))
+ (let ((inputs (modify-inputs (package-inputs racket-vm-cgc)
+ (prepend zlib lz4))))
+ (if (racket-cs-native-supported-system?)
+ (modify-inputs inputs
+ (delete "libffi"))
+ inputs)))
(native-inputs
(let ((native-inputs (package-native-inputs racket-vm-cgc)))
(modify-inputs (if (%current-target-system)
@@ -484,12 +485,19 @@ (define-public racket-vm-cs
#+(this-package-native-input
"chez-scheme-for-racket")
"/bin/scheme")
+ #$@(if (racket-cs-native-supported-system?)
+ #~()
+ #~(#$(string-append "--enable-mach="
+ (nix-system->pbarch-machine-type))
+ "--enable-pb"))
#$(racket-vm-common-configure-flags)))))
(synopsis "Racket CS implementation")
(description "The Racket CS implementation, which uses ``Chez Scheme'' as
its core compiler and runtime system, has been the default Racket VM
implementation since Racket 8.0. It performs better than the Racket BC
-implementation for most programs.
+implementation for most programs. On systems for which Racket CS cannot
+generate machine code, this package uses a variant of its ``portable
+bytecode'' backend specialized for word size and endianness.
Using the Racket VM packages directly is not recommended: instead, install the
@code{racket-minimal} or @code{racket} packages.")
--
2.32.0
P
P
Philip McGrath wrote on 11 Aug 2022 13:08
[PATCH v2 11/13] gnu: racket: Use Racket CS on all systems.
(address . 57050@debbugs.gnu.org)
72d693448b5e07e8322eb3eeb302b16d20adfaf5.1660215295.git.philip@philipmcgrath.com
This patch uses the 'pbarch' support added to 'racket-vm-cs' to make it
the default Racket VM implementation on all systems.

* gnu/packages/racket.scm (racket-vm-for-system): Remove.
(racket-minimal, racket)[inputs]: Replace '(racket-vm-for-system)' with
'racket-vm-cs'.
---
gnu/packages/racket.scm | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)

Toggle diff (55 lines)
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index 008adcc072..b1de6cf885 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -129,10 +129,9 @@ (define-module (gnu packages racket)
;; This file defines the packages 'racket-vm-cgc', 'racket-vm-bc', and
;; 'racket-vm-cs'. All three are in-place builds of 'racket/src/' and
;; 'racket/collects/' and are installed to 'opt/racket-vm/' in the store
-;; output. The function 'racket-vm-for-system' returns the recomended Racket
-;; VM package for a given system.
+;; output.
;;
-;; We then define the packages 'racket-minimal' and
+;; Using 'racket-vm-cs', we then define the packages 'racket-minimal' and
;; 'racket'. These use Racket's support for ``layered installations'', which
;; allow an immutable base layer to be extended with additional packages.
;; They use the layer configuration directly provide ready-to-install FHS-like
@@ -193,17 +192,6 @@ (define-module (gnu packages racket)
;;
;; CODE:
-(define* (racket-vm-for-system #:optional
- (system (or (%current-target-system)
- (%current-system))))
- "Return 'racket-vm-cs' if we are able to build it for SYSTEM; 'racket-vm-bc'
-otherwise."
- ;; Once we figure out the issues in https://racket.discourse.group/t/950,
- ;; we can use 'racket-vm-cs' everywhere.
- (if (racket-cs-native-supported-system? system)
- racket-vm-cs
- racket-vm-bc))
-
(define %racket-version "8.6") ; Remember to update chez-scheme-for-racket!
(define %zuo-version "1.0") ; defined in racket/src/zuo/zuo.c
(define %racket-commit
@@ -586,7 +574,7 @@ (define-public racket-minimal
(inputs
(list openssl
sqlite
- (racket-vm-for-system)
+ racket-vm-cs
(racket-packages-origin
"base" %racket-origin
'(("base" "pkgs/base")
@@ -704,7 +692,7 @@ (define-public racket
unixodbc
libedit ;; TODO reconsider in light of expeditor and readline-gpl
racket-minimal ;; <-- TODO non-tethered layer
- (racket-vm-for-system)
+ racket-vm-cs
(simple-racket-origin
"2d" (base32 "0fb5v6058ls08xw3zbmqyr2ym0psm119gl9ffgmhm9w8rs9i4dq7")
'("2d" "2d-doc" "2d-lib"))
--
2.32.0
P
P
Philip McGrath wrote on 11 Aug 2022 13:08
[PATCH v2 10/13] gnu: racket-vm-bc: Add workaround for ppc64le.
(address . 57050@debbugs.gnu.org)
7421f7c6769f500334adeffae9a61d7b5d2e7cf0.1660215295.git.philip@philipmcgrath.com
This is an attempt to avoid a problem with Racket BC on ppc64 reported
in https://issues.guix.gnu.org/57050#19 that was exposed by attempting
to use Racket BC to bootstrap Chez Scheme. Thanks to Matthew Flatt for

* gnu/packages/racket.scm (racket-vm-bc)[arguments]<#:configure-flags>:
Increase the number of bytes that should be available on the stack for
"safety" when checking for stack overflow.
---
gnu/packages/racket.scm | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)

Toggle diff (28 lines)
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index 3b96cf46ef..008adcc072 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -432,7 +432,20 @@ (define-public racket-vm-bc
(substitute-keyword-arguments (package-arguments racket-vm-cgc)
((#:configure-flags _ '())
#~(cons "--enable-bconly"
- #$(racket-vm-common-configure-flags)))))
+ #$(cond
+ ((target-ppc64le?)
+ ;; Attempt to avoid a problem bootstrapping Chez Scheme:
+ ;; see <https://issues.guix.gnu.org/57050#19>
+ ;; and <https://racket.discourse.group/t/950/22>.
+ #~(map
+ (lambda (flag)
+ (if (string-prefix? "CPPFLAGS=" flag)
+ (string-append flag
+ " -DSTACK_SAFETY_MARGIN=200000")
+ flag))
+ #$(racket-vm-common-configure-flags)))
+ (else
+ (racket-vm-common-configure-flags)))))))
(synopsis "Racket BC [3M] implementation")
(description "The Racket BC (``before Chez'' or ``bytecode'')
implementation was the default before Racket 8.0. It uses a compiler written
--
2.32.0
P
P
Philip McGrath wrote on 11 Aug 2022 13:08
[PATCH v2 12/13] etc: teams: Add racket team.
(address . 57050@debbugs.gnu.org)
f1aa4ae0e0cabb1bcb2ffe9497b25e1cef32cdf6.1660215295.git.philip@philipmcgrath.com
* etc/teams.scm.in (racket): New team.
---
etc/teams.scm.in | 8 ++++++++
1 file changed, 8 insertions(+)

Toggle diff (21 lines)
diff --git a/etc/teams.scm.in b/etc/teams.scm.in
index adee5d4356..af70f7525e 100644
--- a/etc/teams.scm.in
+++ b/etc/teams.scm.in
@@ -185,6 +185,14 @@ (define-team mozilla
"Taking care about Icecat and Icedove, built from Mozilla Firefox
and Thunderbird."))
+(define-team racket
+ (team 'racket
+ #:name "Racket team"
+ #:description
+ "The Racket language and Racket-based languages, Racket packages,
+Racket's variant of Chez Scheme, and development of a Racket build system and
+importer."))
+
(define-member (person "Thiago Jung Bauermann"
"bauermann@kolabnow.com")
--
2.32.0
P
P
Philip McGrath wrote on 11 Aug 2022 13:08
[PATCH v2 13/13] etc: teams: Add entry for Philip McGrath.
(address . 57050@debbugs.gnu.org)
aaa95de8c6cff1ba749a9dd0365dedb822ffa625.1660215295.git.philip@philipmcgrath.com
* etc/teams.scm.in ("Philip McGrath"): New member.
---
etc/teams.scm.in | 4 ++++
1 file changed, 4 insertions(+)

Toggle diff (17 lines)
diff --git a/etc/teams.scm.in b/etc/teams.scm.in
index af70f7525e..8f0191f1fa 100644
--- a/etc/teams.scm.in
+++ b/etc/teams.scm.in
@@ -238,6 +238,10 @@ (define-member (person "Julien Lepiller"
"julien@lepiller.eu")
java ocaml translations)
+(define-member (person "Philip McGrath"
+ "philip@philipmcgrath.com")
+ racket)
+
(define-member (person "Mathieu Othacehe"
"othacehe@gnu.org")
core installer)
--
2.32.0
L
L
Liliana Marie Prikler wrote on 11 Aug 2022 13:13
Re: [PATCH v2 02/13] gnu: stex: Fix read-only gifs and math directories.
2eaf622eeaacfc9d8c4fc42437deba5d65cb5949.camel@ist.tugraz.at
Am Donnerstag, dem 11.08.2022 um 07:08 -0400 schrieb Philip McGrath:
Toggle quote (48 lines)
> Excplicitly set the user write bit when initializing the gifs or math
> directories from the skeletons installed in the store. See also
> upstream
> discussion at <https://github.com/dybvig/stex/pull/6>. This problem
> would be exposed by the upcoming changes to Racket's build system.
>
> * gnu/packages/patches/stex-copy-from-immutable-store.patch: New
> patch.
> * gnu/local.mk (dist_patch_DATA): Add it.
> * gnu/packages/chez.scm (stex-bootstrap)[patches]: Use it.
> [version]: Increment revision to 1.2.2-3.afa6075.
> ---
>  gnu/local.mk                                  |  1 +
>  gnu/packages/chez.scm                         |  5 ++-
>  .../stex-copy-from-immutable-store.patch      | 41
> +++++++++++++++++++
>  3 files changed, 46 insertions(+), 1 deletion(-)
>  create mode 100644 gnu/packages/patches/stex-copy-from-immutable-
> store.patch
>
> diff --git a/gnu/local.mk b/gnu/local.mk
> index 1bd791fb0c..d35c6748c9 100644
> --- a/gnu/local.mk
> +++ b/gnu/local.mk
> @@ -1826,6 +1826,7 @@ dist_patch_DATA
> =                                         \
>    %D%/packages/patches/slim-
> reset.patch                                \
>    %D%/packages/patches/slim-
> login.patch                                \
>    %D%/packages/patches/slim-display.patch                      \
> +  %D%/packages/patches/stex-copy-from-immutable-store.patch    \
>    %D%/packages/patches/syslinux-gcc10.patch                    \
>    %D%/packages/patches/syslinux-strip-gnu-property.patch       \
>    %D%/packages/patches/snappy-add-O2-flag-in-
> CmakeLists.txt.patch      \
> diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
> index 043f2ae47a..4c253effa0 100644
> --- a/gnu/packages/chez.scm
> +++ b/gnu/packages/chez.scm
> @@ -595,7 +595,7 @@ (define-public stex-bootstrap
>    ;; This commit includes a fix which we would otherwise want to use
> as
>    ;; patch.  Let's revert to tagged releases as soon as one becomes
> available.
>    (let ((commit "afa607564a5662ffd748e824801277a6b5a3d11c")
> -        (revision "2"))
> +        (revision "3"))
You don't need to bump the revision to introduce a patch. Other than
that LGTM, but could you also do this with a build phase using make-
file-writable? (It's fine if not, just curious where the actual issue
lies)


Cheers
L
L
Liliana Marie Prikler wrote on 11 Aug 2022 13:31
Re: [PATCH v2 04/13] gnu: Add Zuo.
bde8ed75e4db40bdb25a1850d8fe83d4e8cd5e6d.camel@ist.tugraz.at
Am Donnerstag, dem 11.08.2022 um 07:08 -0400 schrieb Philip McGrath:
Toggle quote (5 lines)
> [...]
>  
>  (define %racket-version "8.5") ; Remember to update chez-scheme-for-
> racket!
> +(define %zuo-version "1.0") ; defined in racket/src/zuo/zuo.c
Is that publicly visible?
Toggle quote (18 lines)
>  (define %racket-commit
>    (string-append "v" %racket-version))
>  (define %racket-origin
> @@ -233,6 +234,69 @@ (define %racket-origin
>           ;; Unbundle libffi.
>           (delete-file-recursively
> "racket/src/bc/foreign/libffi")))))
>  
> +
> +(define-public zuo
> +  (let ((revision #f))
> +    (package
> +      (name "zuo")
> +      (version (string-append %zuo-version
> +                              "-racket"
> +                              "8.6"
> +                              (if revision "-guix" "")
> +                              (or revision "")))
Is this really needed? If we expect to maintain zuo split from racket,
I'd rather go with https://github.com/racket/zuoand git-version.
Toggle quote (26 lines)
> +      (source
> +       (origin
> +         (inherit %racket-origin)
> +         (uri (git-reference
> +               (url "https://github.com/racket/racket")
> +               (commit "v8.6")))
> +         (sha256
> +          (base32
> "1yi36nr7zrdwrnvpmliirxxjz4pyfyhkar6yvk3rapvmg4q2vmnk"))
> +         (patches (append (origin-patches %racket-origin)
> +                          (search-patches "racket-backport-8.6-
> zuo.patch"
> +                                          "racket-zuo-bin-
> sh.patch")))
> +         (file-name (git-file-name "racket" "8.6"))))
> +      (outputs '("out" "debug"))
> +      (build-system gnu-build-system)
> +      (inputs (list bash-minimal))
> +      (native-inputs (list bash-minimal))
> +      (arguments
> +       (list
> +        #:configure-flags
> +        #~`(,(string-append "CPPFLAGS=-DGUIX_RKTIO_BIN_SH="
> +                            #$(file-append (this-package-input
> "bash-minimal")
> +                                           "/bin/sh"))
As with chez-scheme, I do think using a Racket-agnostic macro name is
helpful here.
Toggle quote (20 lines)
> +            #+@(if (%current-target-system)
> +                   (list #~,(string-append
> +                             "CPPFLAGS_FOR_BUILD=-
> DGUIX_RKTIO_BIN_SH="
> +                             #+(file-append
> +                                (this-package-native-input "bash-
> minimal")
> +                                "/bin/sh")))
> +                   '()))
> +        #: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 "You should use Racket to write scripts.
Sorry, but I prefer Guile.

Toggle quote (19 lines)
>   But what if you
> +need something much smaller than Racket for some reason—or what if
> you're
> +trying to script a build of Racket itself?  Zuo is a tiny Racket
> with
> +primitives for dealing with files and running processes, and it
> comes with a
> +@command{make}-like embedded DSL.
> +
> +Zuo (?) is a Racket variant in the sense that program files start
> with
> +@code{#lang}, and the module path after @code{#lang} determines the
> parsing
> +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)))))
Rarely have I read a description this long, yet uninformative. Let me
shorten that a little: "Zuo is a tiny Racket variant that can be used
to bootstrap Racket. It comes with primitives for dealing with files
and processes, as well as a @command{make}-like DSL."

Cheers
L
L
Liliana Marie Prikler wrote on 11 Aug 2022 13:44
Re: [PATCH v2 05/13] gnu: racket: Update to 8.6.
a80efe423b84480faf5a51cdde90ea00f468a4ae.camel@ist.tugraz.at
Am Donnerstag, dem 11.08.2022 um 07:08 -0400 schrieb Philip McGrath:
Toggle quote (1 lines)
> Also, update 'chez-scheme-for-racket' to 9.5.9.2.
As with Zuo, can this be split into a separate patch? If not, why does
it get mentioned here as something noteworthy rather than just being
part of the ChangeLog?

Toggle quote (8 lines)
> [...]
> @@ -448,18 +456,52 @@ (define-public chez-scheme-for-racket
>         (delete "libx11" "util-linux:lib")))
>      (native-inputs
>       (modify-inputs (package-native-inputs chez-scheme)
> +       (append zuo)
>         (replace "chez-scheme-bootstrap-bootfiles"
>           chez-scheme-for-racket-bootstrap-bootfiles)))
Prefer prepend over append.

Toggle quote (11 lines)
>      (arguments
>       (substitute-keyword-arguments (package-arguments chez-scheme)
> +       ((#:out-of-source? _ #f)
> +        #t)
> +       ((#:tests? _ #t)
> +        ;; FIXME: There have been some flaky test failures. Some have
> been
> +        ;; fixed upstream post-release but have proven non-trivial to
> +        ;; backport; at least one issue remains. Re-enable tests once
> +        ;; https://github.com/racket/racket/issues/4359 is fixed.
> +        #f)
Rather than skipping tests altogether, skip just the flaky ones.

Toggle quote (27 lines)
> @@ -130,12 +132,12 @@ (define-module (gnu packages racket)
>  ;; output. The function 'racket-vm-for-system' returns the
> recomended Racket
>  ;; VM package for a given system.
>  ;;
> -;; The file 'racket.scm' builds on these packages to define 'racket-
> minimal'
> -;; and 'racket' packages. These use Racket's support for ``layered
> -;; installations'', which allow an immutable base layer to be
> extended with
> -;; additional packages. They use the layer configuration directly
> provide
> -;; ready-to-install FHS-like trees, rather than relying on the built
> in
> -;; ``Unix-style install'' mechanism.
> +;; We then define the packages 'racket-minimal' and
> +;; 'racket'. These use Racket's support for ``layered
> installations'', which
> +;; allow an immutable base layer to be extended with additional
> packages.
> +;; They use the layer configuration directly provide ready-to-
> install FHS-like
> +;; trees, rather than relying on the built in ``Unix-style install''
> +;; mechanism.
>  ;;
>  ;; Bootstrapping Racket:
>  ;; ---------------------
This is a leftover from 8.6, but do the "FHS-like" installations
actually adhere to the FHS or just to the bit that says "opt means we
can do whatever we want ??"?

Toggle quote (33 lines)
> @@ -178,16 +180,18 @@ (define-module (gnu packages racket)
>  ;; However, other Racket subsystems implemented in Racket for Racket
> CS
>  ;; use older C implementations for Racket BC, whereas the reader,
> expander,
>  ;; and module system were completely replaced with the Racket
> implementation
> -;; as of Racket 7.0.
> +;; as of Racket 7.0. See also
> <https://racket.discourse.group/t/951/4>.
>  ;;
>  ;; For Racket BC, the compiled "linklet" s-expressions (primitive
> modules)
>  ;; are embeded in C as a static string constant. Eventually, they
> are further
>  ;; compiled by the C-implemented Racket BC bytecode and JIT
> compilers.
> -;; (On platforms where Racket BC's JIT is not supported, yet another
> compiler
> -;; instead compiles the linklets to C code, but this is not a
> bootstrapping
> -;; issue.)
>  ;;
> -;; Code:
> +;; 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.)
> +;;
> +;; CODE:
Is that something that needs be mentioned?

As always, Racket contains a gazillion of updated hashes that I will
simply trust you on until a build fails.

Cheers
L
L
Liliana Marie Prikler wrote on 11 Aug 2022 13:47
Re: [PATCH v2 06/13] gnu: chez-scheme: Bootfiles should not be native inputs.
3f5d56d42bcbcd6961b8324606adf8767c3db888.camel@ist.tugraz.at
Am Donnerstag, dem 11.08.2022 um 07:08 -0400 schrieb Philip McGrath:
Toggle quote (1 lines)
> This makes a difference for cross-compilation.
The title should be something like "Make bootfiles regular inputs". If
you want to claim that this makes a difference, please offer an
explanation. You do not need to restrict yourself to a line here.

Toggle quote (7 lines)
> * gnu/packages/chez.scm (chez-scheme)[native-inputs]: Move
> 'chez-scheme-bootstrap-bootfiles' to ...
> [inputs]: ... this field.
> [arguments]<#:phases>: Update 'unpack-bootfiles' accordingly.
> (chez-scheme-for-racket)[native-inputs]: Move
> 'chez-scheme-for-racket-bootstrap-bootfiles' to ...
> [inputs]: ... this field.
Other than that LGTM.

Cheers
L
L
Liliana Marie Prikler wrote on 11 Aug 2022 13:56
Re: [PATCH v2 07/13] gnu: chez-scheme-for-racket: Support cross-compilation.
2729b9f4060b1e3e7aa0d0e8f22b1412b81b18eb.camel@ist.tugraz.at
Am Donnerstag, dem 11.08.2022 um 07:08 -0400 schrieb Philip McGrath:
Toggle quote (13 lines)
> * gnu/packages/chez.scm (racket-cs-native-supported-system): Change
> to
> return the applicable machine type instead of '#t'.
> (chez-scheme-for-racket)[native-inputs]: When cross-compiling, add
> 'this-package'.
> [arguments]<#:configure-flags>: When cross-compiling, supply '-m='
> and
> '--toolprefix='.
> <#:phases>: Work around cross-compilation issues in 'build' and
> 'install-docs'.
> (chez-scheme-for-racket-bootstrap-bootfiles): When cross-compiling,
> use 'zuo' and 'chez-scheme-for-racket' instead of 'racket-vm-bc'.
> [arguments]<#:phases>: Adapt 'build' phase for cross-compilation.
I think this patch can further be split into one for the bootstrap-
bootfiles and one for chez-scheme. I don't know where exactly racket-
cs-native-supported-system fits into any of this and what the
dependencies for it are.

Cheers
L
L
Liliana Marie Prikler wrote on 11 Aug 2022 13:58
Re: [PATCH v2 08/13] gnu: racket: Support cross-compiling the VM packages.
412a5cbf52798c9725eaba8575232fef75889c91.camel@ist.tugraz.at
Am Donnerstag, dem 11.08.2022 um 07:08 -0400 schrieb Philip McGrath:
Toggle quote (4 lines)
> Cross-compilation works for 'racket-vm-cgc', 'racket-vm-bc', and
> 'racket-vm-cs'. These changes are not enough to cross-compile
> 'racket-minimal' or 'racket': that would require building and loading
> cross-compilation pluggins for 'racket-vm-cs', which will be much
plugins
Toggle quote (8 lines)
> easier once we can build the package 'raco-cross'.
>
> * gnu/packages/racket.scm (racket-vm-cgc): Add 'this-package' when
> cross-compiling.
> (racket-vm-bc)[native-inputs]: Adjust accordingly.
> (racket-vm-cs)[native-inputs]: Use 'racket-vm-cs' instead of
> 'racket-vm-bc' when cross-compiling. Adapt to changes to
> 'racket-vm-cgc'.
Is that needed? Can racket-vm-cs not be "cross-bootstrapped"?
Toggle quote (3 lines)
> [arguments]<#:configure-flags>: Fix '--enable-scheme' for
> cross-compilation.

Cheers
L
L
Liliana Marie Prikler wrote on 11 Aug 2022 14:02
Re: [PATCH v2 09/13] gnu: chez-scheme-for-racket: Suport all systems.
4cd27ff2354ca8b109455be0cddda620f5a36486.camel@ist.tugraz.at
Am Donnerstag, dem 11.08.2022 um 07:08 -0400 schrieb Philip McGrath:
Toggle quote (22 lines)
> On systems for which Racket's variant of Chez Scheme cannot generate
> native code, it can use a 'pbarch' machine type: a variant of the
> ``portable bytecode'' backend specialized to word size and
> endianness.
> This allows Racket CS to replace Racket BC on those systems while
> maintaining comparable performance. (Racket BC lacks JIT support for
> those systems anyway.) It also lets us provide a Chez Scheme package
> on
> all systems Guix supports.
>
> This patch adds 'pbarch' support to both 'chez-scheme-for-racket' and
> 'racket-vm-cs', but it does not change the Racket VM implementation
> used
> for the 'racket' and 'racket-minimal' packages.
>
> * gnu/packages/chez.scm (nix-system->pbarch-machine-type): New
> variable.
> (chez-scheme-for-racket)[inputs]: Use 'libffi' for non-native
> systems.
> [arguments]<#:configure-flags>: Always supply '-m='. Add applicable
> flags for non-native systems.
> [supported-systems]: Use '%supported-systems'.
As a follow-up, you could probably inline %supported-systems now, no?


Cheers
L
L
Liliana Marie Prikler wrote on 11 Aug 2022 14:03
Re: [PATCH v2 11/13] gnu: racket: Use Racket CS on all systems.
69eea4e1c98683c6263ac7499219c7f5f77ba87f.camel@ist.tugraz.at
Am Donnerstag, dem 11.08.2022 um 07:08 -0400 schrieb Philip McGrath:
Toggle quote (7 lines)
> This patch uses the 'pbarch' support added to 'racket-vm-cs' to make
> it
> the default Racket VM implementation on all systems.
>
> * gnu/packages/racket.scm (racket-vm-for-system): Remove.
> (racket-minimal, racket)[inputs]: Replace '(racket-vm-for-system)'
> with 'racket-vm-cs'.
LGTM
L
L
Liliana Marie Prikler wrote on 11 Aug 2022 14:11
Re: [PATCH v2 12/13] etc: teams: Add racket team.
73258526092d428916728fba7441bd7788e03425.camel@ist.tugraz.at
Am Donnerstag, dem 11.08.2022 um 07:08 -0400 schrieb Philip McGrath:
Toggle quote (1 lines)
> * etc/teams.scm.in (racket): New team.
This one plus the next can probably go to master regardless of the rest
of this series.

Cheers
P
P
Philip McGrath wrote on 11 Aug 2022 16:00
Re: [PATCH v2 04/13] gnu: Add Zuo.
4ae7af77-4ab6-4642-8c2f-854adec719c5@www.fastmail.com
Hi,

On Thu, Aug 11, 2022, at 7:31 AM, Liliana Marie Prikler wrote:
Toggle quote (8 lines)
> Am Donnerstag, dem 11.08.2022 um 07:08 -0400 schrieb Philip McGrath:
>> [...]
>>  
>>  (define %racket-version "8.5") ; Remember to update chez-scheme-for-
>> racket!
>> +(define %zuo-version "1.0") ; defined in racket/src/zuo/zuo.c
> Is that publicly visible?

For example:

echo "#lang zuo (hash-ref (runtime-env) 'version)" | zuo ""


I likewise have comments in the definitions of 'chez-scheme' and 'chez-scheme-for-racket' explaining where in the source code to find the version number.

Toggle quote (13 lines)
>> +
>> +(define-public zuo
>> +  (let ((revision #f))
>> +    (package
>> +      (name "zuo")
>> +      (version (string-append %zuo-version
>> +                              "-racket"
>> +                              "8.6"
>> +                              (if revision "-guix" "")
>> +                              (or revision "")))
> Is this really needed? If we expect to maintain zuo split from racket,
> I'd rather go with https://github.com/racket/zuo and git-version.

I mean, I don't think it's profoundly essential, but I've been using it for the last four months. I don't see any harm in leaving the level of indentation there so it can be used more easily if it is needed or wanted.

Building from https://github.com/racket/zuowould basically never be useful. It is generated intermittently from https://github.com/racket/racket using `git subtree`.

Toggle quote (15 lines)
>> +         (file-name (git-file-name "racket" "8.6"))))
>> +      (outputs '("out" "debug"))
>> +      (build-system gnu-build-system)
>> +      (inputs (list bash-minimal))
>> +      (native-inputs (list bash-minimal))
>> +      (arguments
>> +       (list
>> +        #:configure-flags
>> +        #~`(,(string-append "CPPFLAGS=-DGUIX_RKTIO_BIN_SH="
>> +                            #$(file-append (this-package-input
>> "bash-minimal")
>> +                                           "/bin/sh"))
> As with chez-scheme, I do think using a Racket-agnostic macro name is
> helpful here.

I'm planning to respond in the other thread about the possibility of a truly generic macro name, but I hope it doesn't need to become an issue blocking this patch series. For now, I'm not entirely sure what "Racket-agnostic" means; the bottom line for my is I think it would be absurdly awful to have to write, e.g. if cross-compiling using `distro-build` with the top-level Makefile:

./configure CPPFLAGS="GUIX_RKTIO_BIN_SH=/input/bin/sh GUIX_ZUO_BIN_SH=/input/bin/sh GUIX_CHEZ_BIN_SH=/input/bin/sh" CPPFLAGS_FOR_BUILD="GUIX_RKTIO_BIN_SH=/native-input/bin/sh GUIX_ZUO_BIN_SH=/native-input/bin/sh GUIX_CHEZ_BIN_SH=/native-input/bin/sh"

Toggle quote (7 lines)
>> +      (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 "You should use Racket to write scripts.
> Sorry, but I prefer Guile.

(At the risk of responding seriously to what was probably meant to be a joke:) I've never tried to use Guile on Windows, but, given that the manual chapter is called "POSIX System Calls and Networking", it's not clear to me that Guile provides as portable and powerful "primitives for dealing with files and running processes" as Zuo, let alone Racket.

Toggle quote (26 lines)
>
>>   But what if you
>> +need something much smaller than Racket for some reason—or what if
>> you're
>> +trying to script a build of Racket itself?  Zuo is a tiny Racket
>> with
>> +primitives for dealing with files and running processes, and it
>> comes with a
>> +@command{make}-like embedded DSL.
>> +
>> +Zuo (?) is a Racket variant in the sense that program files start
>> with
>> +@code{#lang}, and the module path after @code{#lang} determines the
>> parsing
>> +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)))))
> Rarely have I read a description this long, yet uninformative. Let me
> shorten that a little: "Zuo is a tiny Racket variant that can be used
> to bootstrap Racket. It comes with primitives for dealing with files
> and processes, as well as a @command{make}-like DSL."
>

This is the description from the Zuo documentation and readme file. I find your shortened version less clear than the original. The details about `#lang` as a Racketeer are important to understand in what sense Zuo is a "Racket variant", given that it is not currently possible to run `#lang zuo` programs using the `racket` executable. (IIUC someone is working on a Racket package implementing `#lang zuo/kernel`, at which point that will change.) I also think "can be used to bootstrap Racket" greatly underplays the potential of Zuo. A number people have already taken an interest in or started experimenting with Zuo outside of building Racket.

-Philip
L
L
Liliana Marie Prikler wrote on 11 Aug 2022 17:34
(name . Thiago Jung Bauermann)(address . bauermann@kolabnow.com)
3fb8e7c9e08178a331726c1e5a303dfd5a622ca6.camel@gmail.com
Hi,

Am Donnerstag, dem 11.08.2022 um 10:00 -0400 schrieb Philip McGrath:
Toggle quote (12 lines)
>
> > If we expect to maintain zuo split from racket, I'd rather go with
> > https://github.com/racket/zuo and git-version.
>
> I mean, I don't think it's profoundly essential, but I've been using
> it for the last four months. I don't see any harm in leaving the
> level of indentation there so it can be used more easily if it is
> needed or wanted.
>
> Building from https://github.com/racket/zuo would basically never be
> useful. It is generated intermittently from
> https://github.com/racket/racket using `git subtree`.
I don't think that matters much in the grand scheme of things (pun
intended). Rather, having such subtrees available is beneficial in and
of itself, because it means we don't have to split the monorepo. At
the very least, it's one chdir less. Now, building from the zuo
subtree is not a requirement, but imho it would make a better case for
versioning.

Toggle quote (28 lines)
>
> > > +         (file-name (git-file-name "racket" "8.6"))))
> > > +      (outputs '("out" "debug"))
> > > +      (build-system gnu-build-system)
> > > +      (inputs (list bash-minimal))
> > > +      (native-inputs (list bash-minimal))
> > > +      (arguments
> > > +       (list
> > > +        #:configure-flags
> > > +        #~`(,(string-append "CPPFLAGS=-DGUIX_RKTIO_BIN_SH="
> > > +                            #$(file-append (this-package-input
> > > "bash-minimal")
> > > +                                           "/bin/sh"))
> > As with chez-scheme, I do think using a Racket-agnostic macro name
> > is helpful here.
>
> I'm planning to respond in the other thread about the possibility of
> a truly generic macro name, but I hope it doesn't need to become an
> issue blocking this patch series. For now, I'm not entirely sure what
> "Racket-agnostic" means; the bottom line for my is I think it would
> be absurdly awful to have to write, e.g. if cross-compiling using
> `distro-build` with the top-level Makefile:
>
>     ./configure CPPFLAGS="GUIX_RKTIO_BIN_SH=/input/bin/sh
> GUIX_ZUO_BIN_SH=/input/bin/sh GUIX_CHEZ_BIN_SH=/input/bin/sh"
> CPPFLAGS_FOR_BUILD="GUIX_RKTIO_BIN_SH=/native-input/bin/sh
> GUIX_ZUO_BIN_SH=/native-input/bin/sh GUIX_CHEZ_BIN_SH=/native-
> input/bin/sh"
GUIX_CHEZ_BIN_SH would semantically cover all four however, no?
(Ignoring more generic options for now.)

Toggle quote (14 lines)
> > > +      (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 "You should use Racket to write scripts.
> > Sorry, but I prefer Guile.
>
> (At the risk of responding seriously to what was probably meant to be
> a joke:) I've never tried to use Guile on Windows, but, given that
> the manual chapter is called "POSIX System Calls and Networking",
> it's not clear to me that Guile provides as portable and powerful
> "primitives for dealing with files and running processes" as Zuo, let
> alone Racket.
At the risk of responding seriously to what was probably meant to be a
joke, I don't use Winblows ??

Toggle quote (38 lines)
> >
> > >   But what if you
> > > +need something much smaller than Racket for some reason—or what
> > > if
> > > you're
> > > +trying to script a build of Racket itself?  Zuo is a tiny Racket
> > > with
> > > +primitives for dealing with files and running processes, and it
> > > comes with a
> > > +@command{make}-like embedded DSL.
> > > +
> > > +Zuo (?) is a Racket variant in the sense that program files
> > > start
> > > with
> > > +@code{#lang}, and the module path after @code{#lang} determines
> > > the
> > > parsing
> > > +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)))))
> > Rarely have I read a description this long, yet uninformative.  Let
> > me
> > shorten that a little: "Zuo is a tiny Racket variant that can be
> > used
> > to bootstrap Racket.  It comes with primitives for dealing with
> > files
> > and processes, as well as a @command{make}-like DSL."
> >
>
> This is the description from the Zuo documentation and readme file. I
> find your shortened version less clear than the original. The details
> about `#lang` as a Racketeer are important to understand in what
> sense Zuo is a "Racket variant", given that it is not currently
> possible to run `#lang zuo` programs using the `racket` executable.
Would it make sense to call zuo a "dialect" then?

Toggle quote (5 lines)
> (IIUC someone is working on a Racket package implementing `#lang
> zuo/kernel`, at which point that will change.) I also think "can be
> used to bootstrap Racket" greatly underplays the potential of Zuo. A
> number people have already taken an interest in or started
> experimenting with Zuo outside of building Racket.
I have not claimed that it's use is limited to bootstrapping Racket.
Rather, I think this bootstrapping capability shows that Zuo can be
used to do real programming™.

Cheers
P
P
Philip McGrath wrote on 12 Aug 2022 00:40
Re: [PATCH v2 05/13] gnu: racket: Update to 8.6.
9c26881e-fbeb-4910-bf56-e27d9dc77359@www.fastmail.com
Hi,

On Thu, Aug 11, 2022, at 7:44 AM, Liliana Marie Prikler wrote:
Toggle quote (7 lines)
> Am Donnerstag, dem 11.08.2022 um 07:08 -0400 schrieb Philip McGrath:
>> Also, update 'chez-scheme-for-racket' to 9.5.9.2.
> As with Zuo, can this be split into a separate patch? If not, why does
> it get mentioned here as something noteworthy rather than just being
> part of the ChangeLog?
>

This absolutely should not be split into more patches. While I split out Zuo as you requested, I continue to believe that it was better as a single patch.

More broadly, I hope to put together a 'racket-build-system' before the 8.7 release. Whenever that happens, it will mean turning the inputs of the 'racket' and 'racket-minimal' packages into, last I counted, 203 additional packages. I think it would be bad for everyone—patch writers, patch reviewers, users, and people reading the history later—to break Racket releases into a deluge of little patches, many of which would leave the Racket universe as a whole in states no one had ever built or tested, because Racket has combinations of technical and social mechanisms to make certain potentially problematic states difficult to fall into.

A Racket release is an update to a family of packages that are developed and released together. Like a TeX Live update (cf. ee25e3fcab9d2e24c2826b771b52d797c152193b) or the KDE Frameworks libraries (cf. 9d3965edca29f80667374da45214cc6f22a85be4), the contents of a Racket release should be updated together. I wouldn't insist on one commit in all imaginable circumstances, but I think it should be the norm. That's all the more true of Racket components that share a canonical Git repository, for which Racket tools take steps to warn you if not fail if you have mismatched versions.

I also want to emphasize that splitting up patches is not free. Splitting/rebasing v2 of this series took hours of work. Even specifically in splitting off Zuo, I made a (trivial) error in my first version of this particular patch and had to amend the commit and rebuild. Splitting this any further would get farther away both from how I actually wrote and tested this patch series over the past four months and from the way Racket is developed and released. It would take a non-negligible amount of effort, all to produce a result that I believe would be worse.

I mention the version number for 'chez-scheme-for-racket' because it shows up relatively prominently in Guix tooling and even e.g. in the path of the package documentation. I don't know why it would be a problem to do so, but I would vastly prefer to remove the mention than to split the patch, if it really has to be a choice. The Racket release notes don't mention the corresponding version of Chez Scheme.

Toggle quote (11 lines)
>> [...]
>> @@ -448,18 +456,52 @@ (define-public chez-scheme-for-racket
>>         (delete "libx11" "util-linux:lib")))
>>      (native-inputs
>>       (modify-inputs (package-native-inputs chez-scheme)
>> +       (append zuo)
>>         (replace "chez-scheme-bootstrap-bootfiles"
>>           chez-scheme-for-racket-bootstrap-bootfiles)))
> Prefer prepend over append.
>

Why?

Toggle quote (14 lines)
>>      (arguments
>>       (substitute-keyword-arguments (package-arguments chez-scheme)
>> +       ((#:out-of-source? _ #f)
>> +        #t)
>> +       ((#:tests? _ #t)
>> +        ;; FIXME: There have been some flaky test failures. Some have
>> been
>> +        ;; fixed upstream post-release but have proven non-trivial to
>> +        ;; backport; at least one issue remains. Re-enable tests once
>> +        ;; https://github.com/racket/racket/issues/4359 is fixed.
>> +        #f)
> Rather than skipping tests altogether, skip just the flaky ones.
>

If I knew how to do that, I absolutely would. Well, short of making the `process` function silently fail to run `/bin/sh` again, maybe. If you look at the linked issue, you'll see that I've been chasing down failures for the last month. For a while I had cherry-picked 153ff9acb7ad63717a50bb26cd5aaa053870c666, which fixed the only issue with the implementation (a race condition in one mode of the garbage collector), but it didn't seem worth carrying the patch when things were still failing. The other issues seem to be problems with running the test suite. Probably they appeared now because we hadn't actually been running as much of it as we seemed to be. So far, I haven't had failures building with current master, but there aren't any commits touching anything obviously related, and Unicode 14 and grapheme cluster support have landed since the release branch, so it wouldn't be reasonable to just sweep in all the changes indiscriminately. Further, it's at least possible that I may just have been winning the race recently and that the actual problem might still be there. The Chez test suite takes an hour to run (maybe more), and I haven't been able to reproduce the failures outside of Guix, so it's not exactly rapid iteration. All in all, I don't know any change to make other than turning off tests that I can feel confident will work reliably for Guix users.

For what it's worth, difficulty running the Chez tests is not unique to Guix. In the course of adding Zuo, Matthew Flatt commented, "After this conversion, I was able to run the Chez Scheme test suite on Windows for the first time; it must have been possible before, but I never quite got the right tools installed in the right way to make it work." [1] AFAICT Debian skips the Chez test suite unless it is specifically requested [2]: I don't know why, maybe just because it takes so long.


Toggle quote (32 lines)
>> @@ -130,12 +132,12 @@ (define-module (gnu packages racket)
>>  ;; output. The function 'racket-vm-for-system' returns the
>> recomended Racket
>>  ;; VM package for a given system.
>>  ;;
>> -;; The file 'racket.scm' builds on these packages to define 'racket-
>> minimal'
>> -;; and 'racket' packages. These use Racket's support for ``layered
>> -;; installations'', which allow an immutable base layer to be
>> extended with
>> -;; additional packages. They use the layer configuration directly
>> provide
>> -;; ready-to-install FHS-like trees, rather than relying on the built
>> in
>> -;; ``Unix-style install'' mechanism.
>> +;; We then define the packages 'racket-minimal' and
>> +;; 'racket'. These use Racket's support for ``layered
>> installations'', which
>> +;; allow an immutable base layer to be extended with additional
>> packages.
>> +;; They use the layer configuration directly provide ready-to-
>> install FHS-like
>> +;; trees, rather than relying on the built in ``Unix-style install''
>> +;; mechanism.
>>  ;;
>>  ;; Bootstrapping Racket:
>>  ;; ---------------------
> This is a leftover from 8.6, but do the "FHS-like" installations
> actually adhere to the FHS or just to the bit that says "opt means we
> can do whatever we want ??"?
>

The 'racket' and 'racket-minimal' packages follow FHS. (Pedantically, because compiled Racket code may or may not be architecture specific, and used to always be architecture-independent, some configuration modes put things in "share" that belong in "lib", but the current upstream "Unix-style" defaults and out packages do not do that.)

Here's a comparison of the hierarchy of our non-VM Racket packages vs. an in-place Racket installation, with the bracketed numbers indicating how the two match up:

/gnu/store/xyz-racket-8.5/
??? bin/ [1]
??? etc/
?   ??? racket/
?   ??? config.rktd [2]
??? lib/
?   ??? racket/ [3]
?   ??? links.rktd
?   ??? mans.rktd
?   ??? pkgs/ [4]
??? share/
??? applications/ [5]
? ??? drracket.desktop
??? doc/
? ??? racket/ [6]
? ??? index.html
??? man/ [7]
? ??? man1/
? ??? racket.1.gz
??? racket/ [8]
??? infocache.rktd

/gnu/store/xyz-racket-vm-cs-8.5/opt/racket-vm/
??? bin/ [1]
??? collects/ [would be share/racket/collects, but not duplicated in layers]
??? doc/ [6]
??? etc/
?   ??? config.rktd [2]
??? include/
?   ??? chezscheme.h
?   ??? racketcsboot.h
?   ??? racketcs.h
??? lib/ [3]
?   ??? libracketcs.a
?   ??? petite.boot
?   ??? racket.boot
?   ??? scheme.boot
??? man/ [7]
?   ??? man1/
??? share/ [8]
??? applications/ [5]
??? pkgs/ [4]


Toggle quote (14 lines)
>>  ;;
>> -;; Code:
>> +;; 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.)
>> +;;
>> +;; CODE:
> Is that something that needs be mentioned?
>

Some people have asked whether the Zuo implementation does or should share things with Racket and/or Chez Scheme. It seemed worth noting that it intentionally does not, for the sake of bootstrapping.

-Philip
P
P
Philip McGrath wrote on 12 Aug 2022 00:45
Re: [PATCH v2 06/13] gnu: chez-scheme: Bootfiles should not be native inputs.
8201cfc8-3e39-4d1f-90d7-6eb19dc64e3a@www.fastmail.com
Hi,

On Thu, Aug 11, 2022, at 7:47 AM, Liliana Marie Prikler wrote:
Toggle quote (4 lines)
> Am Donnerstag, dem 11.08.2022 um 07:08 -0400 schrieb Philip McGrath:
>> This makes a difference for cross-compilation.
> The title should be something like "Make bootfiles regular inputs".

To me, it would not be clear what makes an input "regular". Or perhaps the unclear part is what makes an input *not* "regular".

Toggle quote (5 lines)
> If
> you want to claim that this makes a difference, please offer an
> explanation. You do not need to restrict yourself to a line here.
>

I'm not sure what's unclear here. If you are on x86_64 and trying to cross-compile for riscv64, you need to have generated riscv64 machine code, not x86_64.

-Philip
P
P
Philip McGrath wrote on 12 Aug 2022 00:49
Re: [PATCH v2 07/13] gnu: chez-scheme-for-racket: Support cross-compilation.
ee793228-d2a0-4b30-9505-47c988fe65b1@www.fastmail.com
Hi,

On Thu, Aug 11, 2022, at 7:56 AM, Liliana Marie Prikler wrote:
Toggle quote (20 lines)
> Am Donnerstag, dem 11.08.2022 um 07:08 -0400 schrieb Philip McGrath:
>> * gnu/packages/chez.scm (racket-cs-native-supported-system): Change
>> to
>> return the applicable machine type instead of '#t'.
>> (chez-scheme-for-racket)[native-inputs]: When cross-compiling, add
>> 'this-package'.
>> [arguments]<#:configure-flags>: When cross-compiling, supply '-m='
>> and
>> '--toolprefix='.
>> <#:phases>: Work around cross-compilation issues in 'build' and
>> 'install-docs'.
>> (chez-scheme-for-racket-bootstrap-bootfiles): When cross-compiling,
>> use 'zuo' and 'chez-scheme-for-racket' instead of 'racket-vm-bc'.
>> [arguments]<#:phases>: Adapt 'build' phase for cross-compilation.
> I think this patch can further be split into one for the bootstrap-
> bootfiles and one for chez-scheme. I don't know where exactly racket-
> cs-native-supported-system fits into any of this and what the
> dependencies for it are.
>

Among other issues, if you cross-compile the bootfiles but can't compile anything that uses the cross-compiled bootfiles, there's no reasonable way to tell if the bootfiles you've built actually work.

-Philip
P
P
Philip McGrath wrote on 12 Aug 2022 01:23
Re: [PATCH v2 08/13] gnu: racket: Support cross-compiling the VM packages.
eb546776-3872-4a72-a22f-a787786f5fb6@www.fastmail.com
Hi,

On Thu, Aug 11, 2022, at 7:58 AM, Liliana Marie Prikler wrote:
Toggle quote (16 lines)
> Am Donnerstag, dem 11.08.2022 um 07:08 -0400 schrieb Philip McGrath:
>> Cross-compilation works for 'racket-vm-cgc', 'racket-vm-bc', and
>> 'racket-vm-cs'. These changes are not enough to cross-compile
>> 'racket-minimal' or 'racket': that would require building and loading
>> cross-compilation pluggins for 'racket-vm-cs', which will be much
> plugins
>> easier once we can build the package 'raco-cross'.
>>
>> * gnu/packages/racket.scm (racket-vm-cgc): Add 'this-package' when
>> cross-compiling.
>> (racket-vm-bc)[native-inputs]: Adjust accordingly.
>> (racket-vm-cs)[native-inputs]: Use 'racket-vm-cs' instead of
>> 'racket-vm-bc' when cross-compiling. Adapt to changes to
>> 'racket-vm-cgc'.
> Is that needed? Can racket-vm-cs not be "cross-bootstrapped"?

I'm not sure what "cross-bootstrapped" means.

Chez Scheme is more like GCC than LLVM in that it only generates code for one target at a time. Unlike GCC, you don't have a separate executable for each backend: the C part and the pure Scheme part can be shared. For cross-compilation, you generate an "xpatch" file, a compiler plugin somewhat like a bootfile, for the target machine type. You use it by loading it into a running `scheme` process: AIUI it, as a side-effect, mutates parts of the compiler to turn it into a compiler for the target architecture. Once an "xpatch" is loaded, some parts of the host functionality are no longer accessible. Racket provides a somewhat more convenient interface, including the ability to run a copy of itself in a subprocess to drive the compilation. In keeping with Racket's overall design, the VM layer provides only primitive hooks, leaving it up to packages to provide higher-level interfaces that deal with managing native- and cross-compiled files in parallel, dependency management, and other issues.

The shorter version is that I asked Matthew Flatt how he recommended managing cross-compilation, and he strongly suggested first getting non-cross package builds working well, then reusing as much of `raco cross` as possible.

-Philip
P
P
Philip McGrath wrote on 12 Aug 2022 01:25
Re: [PATCH v2 09/13] gnu: chez-scheme-for-racket: Suport all systems.
1c56ce0f-f781-4e5d-953c-b0eb1742091d@www.fastmail.com
On Thu, Aug 11, 2022, at 8:02 AM, Liliana Marie Prikler wrote:
Toggle quote (26 lines)
> Am Donnerstag, dem 11.08.2022 um 07:08 -0400 schrieb Philip McGrath:
>> On systems for which Racket's variant of Chez Scheme cannot generate
>> native code, it can use a 'pbarch' machine type: a variant of the
>> ``portable bytecode'' backend specialized to word size and
>> endianness.
>> This allows Racket CS to replace Racket BC on those systems while
>> maintaining comparable performance. (Racket BC lacks JIT support for
>> those systems anyway.) It also lets us provide a Chez Scheme package
>> on
>> all systems Guix supports.
>>
>> This patch adds 'pbarch' support to both 'chez-scheme-for-racket' and
>> 'racket-vm-cs', but it does not change the Racket VM implementation
>> used
>> for the 'racket' and 'racket-minimal' packages.
>>
>> * gnu/packages/chez.scm (nix-system->pbarch-machine-type): New
>> variable.
>> (chez-scheme-for-racket)[inputs]: Use 'libffi' for non-native
>> systems.
>> [arguments]<#:configure-flags>: Always supply '-m='. Add applicable
>> flags for non-native systems.
>> [supported-systems]: Use '%supported-systems'.
> As a follow-up, you could probably inline %supported-systems now, no?
>

I'm not sure I understand what you mean. We need the -for-racket packages to not inherit the supported systems from upstream Chez.

-Philip
P
P
Philip McGrath wrote on 12 Aug 2022 01:32
Re: [PATCH v2 04/13] gnu: Add Zuo.
(name . Thiago Jung Bauermann)(address . bauermann@kolabnow.com)
d92f6836-e791-4564-a013-92b103c814d6@www.fastmail.com
Hi,

On Thu, Aug 11, 2022, at 11:34 AM, Liliana Marie Prikler wrote:
Toggle quote (17 lines)
> Am Donnerstag, dem 11.08.2022 um 10:00 -0400 schrieb Philip McGrath:
>> I'm planning to respond in the other thread about the possibility of
>> a truly generic macro name, but I hope it doesn't need to become an
>> issue blocking this patch series. For now, I'm not entirely sure what
>> "Racket-agnostic" means; the bottom line for my is I think it would
>> be absurdly awful to have to write, e.g. if cross-compiling using
>> `distro-build` with the top-level Makefile:
>>
>>     ./configure CPPFLAGS="GUIX_RKTIO_BIN_SH=/input/bin/sh
>> GUIX_ZUO_BIN_SH=/input/bin/sh GUIX_CHEZ_BIN_SH=/input/bin/sh"
>> CPPFLAGS_FOR_BUILD="GUIX_RKTIO_BIN_SH=/native-input/bin/sh
>> GUIX_ZUO_BIN_SH=/native-input/bin/sh GUIX_CHEZ_BIN_SH=/native-
>> input/bin/sh"
> GUIX_CHEZ_BIN_SH would semantically cover all four however, no?
> (Ignoring more generic options for now.)
>

I don't think so. Zuo and Racket BC have at least as little to do with Chez as upstream Chez has to do with rktio.

Toggle quote (18 lines)
>> > > +      (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 "You should use Racket to write scripts.
>> > Sorry, but I prefer Guile.
>>
>> (At the risk of responding seriously to what was probably meant to be
>> a joke:) I've never tried to use Guile on Windows, but, given that
>> the manual chapter is called "POSIX System Calls and Networking",
>> it's not clear to me that Guile provides as portable and powerful
>> "primitives for dealing with files and running processes" as Zuo, let
>> alone Racket.
> At the risk of responding seriously to what was probably meant to be a
> joke, I don't use Winblows ??
>

If you want to be horrified, read https://docs.racket-lang.org/reference/windowspaths.html. I'm very glad Racket manages all that complexity for me. (And in fairness, even on Unix, there are valid paths which can not be represented as Scheme strings.)

-Philip
L
L
Liliana Marie Prikler wrote on 12 Aug 2022 06:21
Re: [PATCH v2 06/13] gnu: chez-scheme: Bootfiles should not be native inputs.
(name . Thiago Jung Bauermann)(address . bauermann@kolabnow.com)
5725b95bb6b4a3fab3559536ac42de44397ba8bc.camel@gmail.com
Am Donnerstag, dem 11.08.2022 um 18:45 -0400 schrieb Philip McGrath:
Toggle quote (10 lines)
> Hi,
>
> On Thu, Aug 11, 2022, at 7:47 AM, Liliana Marie Prikler wrote:
> > Am Donnerstag, dem 11.08.2022 um 07:08 -0400 schrieb Philip
> > McGrath:
> > > This makes a difference for cross-compilation.
> > The title should be something like "Make bootfiles regular inputs".
>
> To me, it would not be clear what makes an input "regular". Or
> perhaps the unclear part is what makes an input *not* "regular".
"Regular" means "not native and not propagated", i.e. just "inputs".

Toggle quote (7 lines)
> > If you want to claim that this makes a difference, please offer an
> > explanation.  You do not need to restrict yourself to a line here.
> >
>
> I'm not sure what's unclear here. If you are on x86_64 and trying to
> cross-compile for riscv64, you need to have generated riscv64 machine
> code, not x86_64.
This sentence itself is already ambiguous: ((need to) (have generated)
code) vs. ((need to) have (generated code)).

Cheers
L
L
Liliana Marie Prikler wrote on 12 Aug 2022 08:34
Re: [PATCH v2 05/13] gnu: racket: Update to 8.6.
b8ba6b2083bd101e4d34163cb3bd651e268e2ada.camel@ist.tugraz.at
Am Donnerstag, dem 11.08.2022 um 18:40 -0400 schrieb Philip McGrath:
Toggle quote (15 lines)
> Hi,
>
> On Thu, Aug 11, 2022, at 7:44 AM, Liliana Marie Prikler wrote:
> > Am Donnerstag, dem 11.08.2022 um 07:08 -0400 schrieb Philip
> > McGrath:
> >
> > > Also, update 'chez-scheme-for-racket' to 9.5.9.2.
> > As with Zuo, can this be split into a separate patch?  If not, why
> > does it get mentioned here as something noteworthy rather than just
> > being part of the ChangeLog?
> >
>
> This absolutely should not be split into more patches. While I split
> out Zuo as you requested, I continue to believe that it was better as
> a single patch.
Belief is one thing, but I think you're cherry-picking commits to not
have said beliefs questioned, which imho is a dangerous thing to do.

Toggle quote (4 lines)
> More broadly, I hope to put together a 'racket-build-system' before
> the 8.7 release. Whenever that happens, it will mean turning the
> inputs of the 'racket' and 'racket-minimal' packages into, last I
> counted, 203 additional packages.
That's great. I hope this will also let us unvendor some of racket
itself.

Toggle quote (3 lines)
> I think it would be bad for everyone—patch writers, patch reviewers,
> users, and people reading the history later—to break Racket releases
> into a deluge of little patches
Well, first of all that's debatable, second we do have wip branches for
big workloads like gnome, r, and some others, and I think racket would
probably fit into that category. Thus, users sitting on the main
branch would only observe the "merge wip-racket into master" commit,
whereas reviewers can take their time to observe each package in
isolation.

Toggle quote (2 lines)
> combinations of technical and social mechanisms to make certain
> potentially problematic states difficult to fall into.
Just call it a monorepo.

Toggle quote (9 lines)
> A Racket release is an update to a family of packages that are
> developed and released together. Like a TeX Live update (cf.
> ee25e3fcab9d2e24c2826b771b52d797c152193b) or the KDE Frameworks
> libraries (cf. 9d3965edca29f80667374da45214cc6f22a85be4), the
> contents of a Racket release should be updated together. I wouldn't
> insist on one commit in all imaginable circumstances, but I think it
> should be the norm. That's all the more true of Racket components
> that share a canonical Git repository, for which Racket tools take
> steps to warn you if not fail if you have mismatched versions.
The difference between the two commits you mention and the one you
provide is that the upgrades to those derived packages mostly come for
free, whereas yours doesn't. Compare

Toggle quote (24 lines)
> * gnu/packages/kde-frameworks.scm (extra-cmake-modules, attica,
> bluez-qt,
> breeze-icons, kapidox, karchive, kcalendarcore, kcodecs, kconfig,
> kcoreaddons,
> kdbusaddons, kdnssd, kguiaddons, kholidays, ki18n, kidletime,
> kirigami,
> kitemmodels, kitemviews, kplotting, ksyntaxhighlighting,
> kwidgetsaddons,
> kwindowsystem, modemmanager-qt, networkmanager-qt, oxygen-icons,
> prison,
> qqc2-desktop-style, solid, sonnet, threadweaver, kactivities, kauth,
> kcompletion, kcontacts, kcrash, kdoctools, kfilemetadata,
> kimageformats,
> kjobwidgets, knotifications, kpackage, kpty, kunitconversion,
> syndication,
> baloo, kactivities-stats, kbookmarks, kcmutils, kconfigwidgets,
> kdeclarative,
> kded, kdesignerplugin, kdesu, kdewebkit, kemoticons, kglobalaccel,
> kiconthemes, kinit, knewstuff, knotifyconfig ,kparts, kpeople,
> krunner,
> kservice, ktextwidgets, kwallet, kxmlgui, kxmlrpcclient, purpose,
> kde-frameworkintegration, kdelibs4support, khtml, kjs, kjsembed,
> kmediaplayer,
> kross): Update to 5.70.0.
to
Toggle quote (12 lines)
> (chez-scheme-for-racket): Update to 9.5.9.2.
> [native-inputs]: Add 'zuo'.
> [arguments]<#:out-of-source?>: Use out-of-source build.
> <#:tests?>: Skip them due to ongoing problems.
> <#:configure-flags>: Add '--install-csug=' and '--
> installreleasenotes='.
> <#:make-flags>: Use 'zuo' from 'native-inputs'. Supply 'STEXLIB='
> here,
> rather than in a phase.
> <#:phases>: Replace 'install-docs' using new 'make' target.

> I also want to emphasize that splitting up patches is not free.
I also want to emphasize that reviewing patches is not free.

Toggle quote (8 lines)
> Splitting/rebasing v2 of this series took hours of work. Even
> specifically in splitting off Zuo, I made a (trivial) error in my
> first version of this particular patch and had to amend the commit
> and rebuild. Splitting this any further would get farther away both
> from how I actually wrote and tested this patch series over the past
> four months and from the way Racket is developed and released. It
> would take a non-negligible amount of effort, all to produce a result
> that I believe would be worse.
As someone who's authored larger series myself, I can somewhat
understand your pain. However, I don't think the development
guidelines of any particular package ought to influence how we do
things in Guix. Otherwise, we'd have adopted emoji commit messages for
some of them by now.

Toggle quote (6 lines)
> I mention the version number for 'chez-scheme-for-racket' because it
> shows up relatively prominently in Guix tooling and even e.g. in the
> path of the package documentation. I don't know why it would be a
> problem to do so, but I would vastly prefer to remove the mention
> than to split the patch, if it really has to be a choice. The Racket
> release notes don't mention the corresponding version of Chez Scheme.
If chez and racket were that tightly coupled, you'd think they go
together without mention, no? For instance, when upgrading Emacs to
28.1, I don't have to mention all the built-in packages that've been
updated, you get those from the release notes.

However, looking at the ChangeLog above, I don't think these two are
tightly enough coupled to just say that simultaneous upgrades come for
free (as they do with Emacs, but also Renpy, WebkitGTK, and a bunch of
others that I'm not personally involved with).

Toggle quote (12 lines)
> > > [...]
> > > @@ -448,18 +456,52 @@ (define-public chez-scheme-for-racket
> > >         (delete "libx11" "util-linux:lib")))
> > >      (native-inputs
> > >       (modify-inputs (package-native-inputs chez-scheme)
> > > +       (append zuo)
> > >         (replace "chez-scheme-bootstrap-bootfiles"
> > >           chez-scheme-for-racket-bootstrap-bootfiles)))
> > Prefer prepend over append.
> >
>
> Why?
Prepend is a cons internally, so it's both faster and more natural.
Alphabetic ordering doesn't matter here and I hope neither do search
paths in your use case.

Toggle quote (40 lines)
> > >      (arguments
> > >       (substitute-keyword-arguments (package-arguments chez-
> > > scheme)
> > > +       ((#:out-of-source? _ #f)
> > > +        #t)
> > > +       ((#:tests? _ #t)
> > > +        ;; FIXME: There have been some flaky test failures. Some
> > > have
> > > been
> > > +        ;; fixed upstream post-release but have proven non-
> > > trivial to
> > > +        ;; backport; at least one issue remains. Re-enable tests
> > > once
> > > +        ;; https://github.com/racket/racket/issues/4359 is
> > > fixed.
> > > +        #f)
> > Rather than skipping tests altogether, skip just the flaky ones.
> >
>
> If I knew how to do that, I absolutely would. Well, short of making
> the `process` function silently fail to run `/bin/sh` again, maybe.
> If you look at the linked issue, you'll see that I've been chasing
> down failures for the last month. For a while I had cherry-picked
> 153ff9acb7ad63717a50bb26cd5aaa053870c666, which fixed the only issue
> with the implementation (a race condition in one mode of the garbage
> collector), but it didn't seem worth carrying the patch when things
> were still failing. The other issues seem to be problems with running
> the test suite. Probably they appeared now because we hadn't actually
> been running as much of it as we seemed to be. So far, I haven't had
> failures building with current master, but there aren't any commits
> touching anything obviously related, and Unicode 14 and grapheme
> cluster support have landed since the release branch, so it wouldn't
> be reasonable to just sweep in all the changes indiscriminately.
> Further, it's at least possible that I may just have been winning the
> race recently and that the actual problem might still be there. The
> Chez test suite takes an hour to run (maybe more), and I haven't been
> able to reproduce the failures outside of Guix, so it's not exactly
> rapid iteration. All in all, I don't know any change to make other
> than turning off tests that I can feel confident will work reliably
> for Guix users.
There surely must be more than a single test file, no? The typical way
to do this in autotools would be to specify TESTS="the tests to run",
or to (substitute* "tests/Makefile.am" ((" bad-test") "")). HTH

Toggle quote (13 lines)
> For what it's worth, difficulty running the Chez tests is not unique
> to Guix. In the course of adding Zuo, Matthew Flatt commented, "After
> this conversion, I was able to run the Chez Scheme test suite on
> Windows for the first time; it must have been possible before, but I
> never quite got the right tools installed in the right way to make it
> work." [1] AFAICT Debian skips the Chez test suite unless it is
> specifically requested [2]: I don't know why, maybe just because it
> takes so long.
>
> [1]:
> https://github.com/racket/racket/pull/4179#issuecomment-1094137092
> [2]:
> https://salsa.debian.org/scheme-team/chezscheme/-/blob/fbfa9c35db184f5b22ac6c0058d754e1a45f5f68/debian/rules#L66-69
That's horrible.

Toggle quote (91 lines)
> > > @@ -130,12 +132,12 @@ (define-module (gnu packages racket)
> > >  ;; output. The function 'racket-vm-for-system' returns the
> > > recomended Racket
> > >  ;; VM package for a given system.
> > >  ;;
> > > -;; The file 'racket.scm' builds on these packages to define
> > > 'racket-
> > > minimal'
> > > -;; and 'racket' packages. These use Racket's support for
> > > ``layered
> > > -;; installations'', which allow an immutable base layer to be
> > > extended with
> > > -;; additional packages. They use the layer configuration
> > > directly
> > > provide
> > > -;; ready-to-install FHS-like trees, rather than relying on the
> > > built
> > > in
> > > -;; ``Unix-style install'' mechanism.
> > > +;; We then define the packages 'racket-minimal' and
> > > +;; 'racket'. These use Racket's support for ``layered
> > > installations'', which
> > > +;; allow an immutable base layer to be extended with additional
> > > packages.
> > > +;; They use the layer configuration directly provide ready-to-
> > > install FHS-like
> > > +;; trees, rather than relying on the built in ``Unix-style
> > > install''
> > > +;; mechanism.
> > >  ;;
> > >  ;; Bootstrapping Racket:
> > >  ;; ---------------------
> > This is a leftover from 8.6, but do the "FHS-like" installations
> > actually adhere to the FHS or just to the bit that says "opt means
> > we
> > can do whatever we want ??"?
> >
>
> The 'racket' and 'racket-minimal' packages follow FHS. (Pedantically,
> because compiled Racket code may or may not be architecture specific,
> and used to always be architecture-independent, some configuration
> modes put things in "share" that belong in "lib", but the current
> upstream "Unix-style" defaults and out packages do not do that.)
>
> Here's a comparison of the hierarchy of our non-VM Racket packages
> vs. an in-place Racket installation, with the bracketed numbers
> indicating how the two match up:
>
> /gnu/store/xyz-racket-8.5/
> ??? bin/ [1]
> ??? etc/
> ?   ??? racket/
> ?       ??? config.rktd [2]
> ??? lib/
> ?   ??? racket/ [3]
> ?       ??? links.rktd
> ?       ??? mans.rktd
> ?       ??? pkgs/ [4]
> ??? share/
>     ??? applications/ [5]
>     ?       ??? drracket.desktop
>     ??? doc/
>     ?       ??? racket/ [6]
>     ?           ??? index.html
>     ??? man/ [7]
>     ?       ??? man1/
>     ?           ??? racket.1.gz
>     ??? racket/ [8]
>              ??? infocache.rktd
>
> /gnu/store/xyz-racket-vm-cs-8.5/opt/racket-vm/
> ??? bin/ [1]
> ??? collects/ [would be share/racket/collects, but not duplicated in
> layers]
> ??? doc/ [6]
> ??? etc/
> ?   ??? config.rktd [2]
> ??? include/
> ?   ??? chezscheme.h
> ?   ??? racketcsboot.h
> ?   ??? racketcs.h
> ??? lib/ [3]
> ?   ??? libracketcs.a
> ?   ??? petite.boot
> ?   ??? racket.boot
> ?   ??? scheme.boot
> ??? man/ [7]
> ?   ??? man1/
> ??? share/ [8]
>     ??? applications/ [5]
>     ??? pkgs/ [4]
Your [8] seems broken.

But understanding this correctly, we'd have to move vm collects to lib
or share and man+doc to share? This doesn't look too bad, but I bet
there's some complication with layers.
Toggle quote (19 lines)
>
> > >  ;;
> > > -;; Code:
> > > +;; 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.)
> > > +;;
> > > +;; CODE:
> > Is that something that needs be mentioned?
> >
>
> Some people have asked whether the Zuo implementation does or should
> share things with Racket and/or Chez Scheme. It seemed worth noting
> that it intentionally does not, for the sake of bootstrapping.
In reply to this bug? In Chez/Racket spaces? I think the package
description for zuo should make it clear that it can be used for
bootstrapping, so from a Guix side that comment seems superfluous.

Cheers
T
T
Thiago Jung Bauermann wrote on 13 Aug 2022 19:43
Re: [PATCH v2 00/13] gnu: Update Racket to 8.6. Add Zuo.
(name . Philip McGrath)(address . philip@philipmcgrath.com)
875yiwxc6o.fsf@kolabnow.com
Hello Philip,

Philip McGrath <philip@philipmcgrath.com> writes:

Toggle quote (8 lines)
> Thiago, Matthew Flatt suggested a workaround for powerpc64le-linux
> in <https://racket.discourse.group/t/950/22>, and I've added it in patch
> 10/13. Can you give it a try? I'm also trying it via QEMU. For convienience,
> I've updated the 'zuo' branch at https://gitlab.com/philip1/guix-patches to
> point to this v2 (commit aaa95de8c6cff1ba749a9dd0365dedb822ffa625) and tagged
> it as guix-issue-57050-v2; I've tagged the previous version as
> guix-issue-57050.

Nice! thanks for the quick fix. I tested guix-issue-57050-v2 and now
chez-scheme-for-racket-bootstrap-bootfiles builds successfully!
Unfortunately there's still a holdup: the install phase of
racket-vm-cs-8.6 fails:

Toggle snippet (54 lines)
starting phase `install'
/gnu/store/i9h1vc67h9148xvn8djk8j3smlkhaf09-zuo-1.0-racket8.6/bin/zuo . install DESTDIR=""
cp cs/c/racketcs /gnu/store/cb84hlf8gb0nspc8f6n7qhihsflj7k6x-racket-vm-cs-8.6/opt/racket-vm/bin/racket
: /gnu/store/cb84hlf8gb0nspc8f6n7qhihsflj7k6x-racket-vm-cs-8.6/opt/racket-vm/bin/racket
cp ../src/start/starter-sh /gnu/store/cb84hlf8gb0nspc8f6n7qhihsflj7k6x-racket-vm-cs-8.6/opt/racket-vm/lib/starter-sh
cp cs/c/starter /gnu/store/cb84hlf8gb0nspc8f6n7qhihsflj7k6x-racket-vm-cs-8.6/opt/racket-vm/lib/starter
: /gnu/store/cb84hlf8gb0nspc8f6n7qhihsflj7k6x-racket-vm-cs-8.6/opt/racket-vm/lib/starter
/gnu/store/w675i4y454bgcyr69fp672h51p24l1fg-racket-vm-bc-8.6/opt/racket-vm/bin/racket -O info'@'compiler/cm -l- setup --chain ../src/setup-go.rkt cs/c/compiled ignored cs/c/ignored.d ../src/start/collects-path.rkt ../src/ /gnu/store/cb84hlf8gb0nspc8f6n7qhihsflj7k6x-racket-vm-cs-8.6/opt/racket-vm/lib/starter ../collects ../etc
compiler/cm: start-compile: /tmp/guix-build-racket-vm-cs-8.6.drv-0/source/racket/src/start/collects-path.rkt
compiler/cm: finish-compile: /tmp/guix-build-racket-vm-cs-8.6.drv-0/source/racket/src/start/collects-path.rkt
/gnu/store/w675i4y454bgcyr69fp672h51p24l1fg-racket-vm-bc-8.6/opt/racket-vm/bin/racket -O info'@'compiler/cm -l- setup --chain ../src/setup-go.rkt cs/c/compiled ignored cs/c/ignored.d ../src/cs/c/gen-system.rkt /gnu/store/cb84hlf8gb0nspc8f6n7qhihsflj7k6x-racket-vm-cs-8.6/opt/racket-vm/lib/system.rktd tpb64l tpb64l machine ../src/cs/c/ ""
compiler/cm: start-compile: /tmp/guix-build-racket-vm-cs-8.6.drv-0/source/racket/src/cs/c/gen-system.rkt
compiler/cm: finish-compile: /tmp/guix-build-racket-vm-cs-8.6.drv-0/source/racket/src/cs/c/gen-system.rkt
cp ../src/cs/c/api.h /gnu/store/cb84hlf8gb0nspc8f6n7qhihsflj7k6x-racket-vm-cs-8.6/opt/racket-vm/include/racketcs.h
cp ../src/cs/c/boot.h /gnu/store/cb84hlf8gb0nspc8f6n7qhihsflj7k6x-racket-vm-cs-8.6/opt/racket-vm/include/racketcsboot.h
cp cs/c/ChezScheme/tpb64l/boot/tpb64l/scheme.h /gnu/store/cb84hlf8gb0nspc8f6n7qhihsflj7k6x-racket-vm-cs-8.6/opt/racket-vm/include/chezscheme.h
cd cs/c/repack && ar x ../rktio/librktio.a
cd cs/c/repack && ar x ../ChezScheme/tpb64l/boot/tpb64l/libkernel.a
ar rc cs/c/libracketcs.a cs/c/repack/expeditor.o cs/c/repack/schsig.o cs/c/repack/compress-io.o cs/c/repack/rktio_flock.o cs/c/repack/gc-par.o cs/c/repack/rktio_shellex.o cs/c/repack/flushcache.o cs/c/repack/new-io.o cs/c/repack/rktio_signal.o cs/c/repack/print.o cs/c/repack/rktio_fd.o cs/c/repack/symbol.o cs/c/repack/rktio_poll_set.o cs/c/repack/schlib.o cs/c/repack/rktio_fs.o cs/c/repack/scheme.o cs/c/repack/rktio_wide.o cs/c/repack/rktio_main.o cs/c/repack/rktio_dll.o cs/c/repack/prim.o cs/c/repack/gc-oce.o cs/c/repack/fasl.o cs/c/repack/ffi.o cs/c/repack/segment.o cs/c/repack/rktio_convert.o cs/c/repack/rktio_error.o cs/c/repack/thread.o cs/c/repack/number.o cs/c/repack/rktio_process.o cs/c/repack/gc-ocd.o cs/c/repack/gc-011.o cs/c/repack/rktio_sha1.o cs/c/repack/rktio_network.o cs/c/repack/rktio_file.o cs/c/repack/random.o cs/c/repack/prim5.o cs/c/repack/io.o cs/c/repack/rktio_syslog.o cs/c/repack/rktio_hash.o cs/c/repack/vfasl.o cs/c/repack/rktio_console.o cs/c/repack/intern.o cs/c/repack/rktio_pipe.o cs/c/repack/rktio_sleep.o cs/c/repack/gcwrapper.o cs/c/repack/stats.o cs/c/repack/rktio_fs_change.o cs/c/repack/rktio_envvars.o cs/c/repack/rktio_ltps.o cs/c/repack/statics.o cs/c/repack/rktio_sha2.o cs/c/repack/foreign.o cs/c/repack/pb.o cs/c/repack/alloc.o cs/c/repack/rktio_time.o cs/c/repack/rktio_cpu.o cs/c/boot.o
cp cs/c/libracketcs.a /gnu/store/cb84hlf8gb0nspc8f6n7qhihsflj7k6x-racket-vm-cs-8.6/opt/racket-vm/lib/libracketcs.a
: /gnu/store/cb84hlf8gb0nspc8f6n7qhihsflj7k6x-racket-vm-cs-8.6/opt/racket-vm/lib/libracketcs.a
cp cs/c/gracketcs /gnu/store/cb84hlf8gb0nspc8f6n7qhihsflj7k6x-racket-vm-cs-8.6/opt/racket-vm/lib/gracket
/gnu/store/w675i4y454bgcyr69fp672h51p24l1fg-racket-vm-bc-8.6/opt/racket-vm/bin/racket -O info'@'compiler/cm -l- setup --chain ../src/setup-go.rkt cs/c/compiled ignored cs/c/ignored.d ../src/start/collects-path.rkt ../src/ /gnu/store/cb84hlf8gb0nspc8f6n7qhihsflj7k6x-racket-vm-cs-8.6/opt/racket-vm/bin/racket ../collects ../etc
/gnu/store/w675i4y454bgcyr69fp672h51p24l1fg-racket-vm-bc-8.6/opt/racket-vm/bin/racket -O info'@'compiler/cm -l- setup --chain ../src/setup-go.rkt cs/c/compiled ignored cs/c/ignored.d ../src/start/collects-path.rkt ../src/ /gnu/store/cb84hlf8gb0nspc8f6n7qhihsflj7k6x-racket-vm-cs-8.6/opt/racket-vm/lib/gracket ../collects ../etc
/gnu/store/w675i4y454bgcyr69fp672h51p24l1fg-racket-vm-bc-8.6/opt/racket-vm/bin/racket -O info'@'compiler/cm -l- setup --chain ../src/setup-go.rkt cs/c/compiled ignored cs/c/ignored.d ../src/cs/c/add-terminator.rkt cs/c/petite-v.boot /gnu/store/cb84hlf8gb0nspc8f6n7qhihsflj7k6x-racket-vm-cs-8.6/opt/racket-vm/lib/petite.boot
compiler/cm: start-compile: /tmp/guix-build-racket-vm-cs-8.6.drv-0/source/racket/src/cs/c/add-terminator.rkt
compiler/cm: finish-compile: /tmp/guix-build-racket-vm-cs-8.6.drv-0/source/racket/src/cs/c/add-terminator.rkt
/gnu/store/w675i4y454bgcyr69fp672h51p24l1fg-racket-vm-bc-8.6/opt/racket-vm/bin/racket -O info'@'compiler/cm -l- setup --chain ../src/setup-go.rkt cs/c/compiled ignored cs/c/ignored.d ../src/cs/c/add-terminator.rkt cs/c/scheme-v.boot /gnu/store/cb84hlf8gb0nspc8f6n7qhihsflj7k6x-racket-vm-cs-8.6/opt/racket-vm/lib/scheme.boot
/gnu/store/w675i4y454bgcyr69fp672h51p24l1fg-racket-vm-bc-8.6/opt/racket-vm/bin/racket -O info'@'compiler/cm -l- setup --chain ../src/setup-go.rkt cs/c/compiled ignored cs/c/ignored.d ../src/cs/c/add-terminator.rkt cs/c/racket-v.boot /gnu/store/cb84hlf8gb0nspc8f6n7qhihsflj7k6x-racket-vm-cs-8.6/opt/racket-vm/lib/racket.boot
/gnu/store/w675i4y454bgcyr69fp672h51p24l1fg-racket-vm-bc-8.6/opt/racket-vm/bin/racket -O info'@'compiler/cm -l- setup --chain ../src/setup-go.rkt cs/c/compiled ignored cs/c/ignored.d ../collects/setup/unixstyle-install.rkt make-install-copytree ../ /gnu/store/cb84hlf8gb0nspc8f6n7qhihsflj7k6x-racket-vm-cs-8.6/opt/racket-vm/bin /gnu/store/cb84hlf8gb0nspc8f6n7qhihsflj7k6x-racket-vm-cs-8.6/opt/racket-vm/collects /gnu/store/cb84hlf8gb0nspc8f6n7qhihsflj7k6x-racket-vm-cs-8.6/opt/racket-vm/share/pkgs /gnu/store/cb84hlf8gb0nspc8f6n7qhihsflj7k6x-racket-vm-cs-8.6/opt/racket-vm/doc /gnu/store/cb84hlf8gb0nspc8f6n7qhihsflj7k6x-racket-vm-cs-8.6/opt/racket-vm/lib /gnu/store/cb84hlf8gb0nspc8f6n7qhihsflj7k6x-racket-vm-cs-8.6/opt/racket-vm/include /gnu/store/cb84hlf8gb0nspc8f6n7qhihsflj7k6x-racket-vm-cs-8.6/opt/racket-vm/lib /gnu/store/cb84hlf8gb0nspc8f6n7qhihsflj7k6x-racket-vm-cs-8.6/opt/racket-vm/share /gnu/store/cb84hlf8gb0nspc8f6n7qhihsflj7k6x-racket-vm-cs-8.6/opt/racket-vm/etc /gnu/store/cb84hlf8gb0nspc8f6n7qhihsflj7k6x-racket-vm-cs-8.6/opt/racket-vm/share/applications /gnu/store/cb84hlf8gb0nspc8f6n7qhihsflj7k6x-racket-vm-cs-8.6/opt/racket-vm/man yes
compiler/cm: start-compile: /tmp/guix-build-racket-vm-cs-8.6.drv-0/source/racket/collects/setup/unixstyle-install.rkt
compiler/cm: finish-compile: /tmp/guix-build-racket-vm-cs-8.6.drv-0/source/racket/collects/setup/unixstyle-install.rkt
Copying collects -> /gnu/store/cb84hlf8gb0nspc8f6n7qhihsflj7k6x-racket-vm-cs-8.6/opt/racket-vm/collects
Copying share/pkgs -> /gnu/store/cb84hlf8gb0nspc8f6n7qhihsflj7k6x-racket-vm-cs-8.6/opt/racket-vm/share/pkgs
missing source path "share/pkgs", skipping...
Copying share -> /gnu/store/cb84hlf8gb0nspc8f6n7qhihsflj7k6x-racket-vm-cs-8.6/opt/racket-vm/share
missing source path "share", skipping...
Copying doc -> /gnu/store/cb84hlf8gb0nspc8f6n7qhihsflj7k6x-racket-vm-cs-8.6/opt/racket-vm/doc
missing source path "doc", skipping...
Copying etc -> /gnu/store/cb84hlf8gb0nspc8f6n7qhihsflj7k6x-racket-vm-cs-8.6/opt/racket-vm/etc
/gnu/store/w675i4y454bgcyr69fp672h51p24l1fg-racket-vm-bc-8.6/opt/racket-vm/bin/racket -MCR cs/c/compiled: --cross-compiler tpb64l cs/c -X /gnu/store/cb84hlf8gb0nspc8f6n7qhihsflj7k6x-racket-vm-cs-8.6/opt/racket-vm/collects -G /gnu/store/cb84hlf8gb0nspc8f6n7qhihsflj7k6x-racket-vm-cs-8.6/opt/racket-vm/etc -N raco -l- setup --no-user
/gnu/store/w675i4y454bgcyr69fp672h51p24l1fg-racket-vm-bc-8.6/opt/racket-vm/bin/racket: bad switch: --cross-compiler
Use the --help or -h flag for help.
failed
in build-one
in loop
in module->hash
make: *** [Makefile:16: install] Error 1
error: in phase 'install': uncaught exception:
%exception #<&invoke-error program: "make" arguments: ("install" "ZUO=/gnu/store/i9h1vc67h9148xvn8djk8j3smlkhaf09-zuo-1.0-racket8.6/bin/zuo") exit-status: 2 term-signal: #f stop-signal: #f>
phase `install' failed after 26.8 seconds
command "make" "install" "ZUO=/gnu/store/i9h1vc67h9148xvn8djk8j3smlkhaf09-zuo-1.0-racket8.6/bin/zuo" failed with status 2

Apparently some part of the racket-vm-cs build system thinks that it's
cross-compiling when it's not. I'm still trying to figure out where this
“--cross-compiler” argument is being added but thought I'd provide an
early report.

Toggle quote (3 lines)
> (Note that you need at least patch 11/13 for 'racket-minimal' or 'racket' to
> use CS on powerpc64le-linux.)

As I mentioned above, I'm testing the guix-issue-57050-v2 tag so I
believe I'm covered. My test consists of simply doing
“./pre-inst-env guix build racket”.

--
Thanks
Thiago
P
P
Philip McGrath wrote on 15 Aug 2022 07:47
[RFC PATCH] gnu: racket-vm-cs: Avoid 'configure' bug with '--enable-racket'.
(name . Thiago Jung Bauermann)(address . bauermann@kolabnow.com)
64be5566c119d5b4ab83d5fb44d01aa1ecaed599.1660541551.git.philip@philipmcgrath.com
Hi Thiago,

Toggle quote (13 lines)
> Nice! thanks for the quick fix. I tested guix-issue-57050-v2 and now
> chez-scheme-for-racket-bootstrap-bootfiles builds successfully!
> Unfortunately there's still a holdup: the install phase of racket-vm-cs-8.6
> fails:
>
> [...]
>
> Apparently some part of the racket-vm-cs build system thinks that it's
> cross-compiling when it's not. I'm still trying to figure out where this
> “--cross-compiler” argument is being added but thought I'd provide an early
> report.
>

Thanks for trying this! I think I've found what's going wrong in the
'configure' script is going wrong, but I'm not sure yet what's the right way
to fix it. In the meantime, I think the patch below on top of the
guix-issue-57050-v2 tag should avoid triggering the bad assumption in the
'configure' script: could you give it a try? It's also at
https://gitlab.com/philip1/guix-patchesas the current tip of the 'zuo'
branch, commit 64be5566c119d5b4ab83d5fb44d01aa1ecaed599.

-Philip

-- >8 --
Date: Mon, 15 Aug 2022 00:35:23 -0400
Subject: gnu: racket-vm-cs: Avoid 'configure' bug with '--enable-racket'.

On systems like powerpc64le-linux that rely on the 'pbarch' backends for
Chez Scheme, configuring with '--enable-racket' incorrectly triggers
cross-compilation mode: see https://racket.discourse.group/t//950/26
and https://issues.guix.gnu.org/57050#54. We can avoid the problem by
including a bootstrap Racket in 'native-inputs' only for
cross-compilation.

The fact that this works reveals that we are bootstrapping slightly less
that we thought we were. We have to rely on generated code for Racket's
macro expander (which includes the reader and module system) because it
is not bootstrappable, though it is auditable. However, apparently we
are also relying on generated code for the 'io', 'regexp', and 'thread'
subsystems, which can be bootstrapped via Racket BC. We should bootstrap
them once the 'configure' issue is fixed.

* gnu/packages/racket.scm (racket-vm-cs)[native-inputs]: Don't use
'racket-vm-bc' for non-cross builds.
---
gnu/packages/racket.scm | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

Toggle diff (25 lines)
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index b1de6cf885..4ff36077ef 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -462,14 +462,12 @@ (define-public racket-vm-cs
(let ((native-inputs (package-native-inputs racket-vm-cgc)))
(modify-inputs (if (%current-target-system)
(modify-inputs native-inputs
+ (prepend racket-vm-cs)
(delete "racket-vm-cgc"))
native-inputs)
(delete "libtool")
(prepend chez-scheme-for-racket
- chez-nanopass-bootstrap
- (if (%current-target-system)
- racket-vm-cs
- racket-vm-bc)))))
+ chez-nanopass-bootstrap))))
(arguments
(substitute-keyword-arguments (package-arguments racket-vm-cgc)
((#:phases those-phases #~%standard-phases)

base-commit: aaa95de8c6cff1ba749a9dd0365dedb822ffa625
--
2.32.0
P
P
Philip McGrath wrote on 15 Aug 2022 08:12
(name . Thiago Jung Bauermann)(address . bauermann@kolabnow.com)
c47a9fc3-2e10-489d-b3b5-dba0967a7b11@www.fastmail.com
On Mon, Aug 15, 2022, at 1:47 AM, Philip McGrath wrote:
Toggle quote (24 lines)
> Hi Thiago,
>
>> Nice! thanks for the quick fix. I tested guix-issue-57050-v2 and now
>> chez-scheme-for-racket-bootstrap-bootfiles builds successfully!
>> Unfortunately there's still a holdup: the install phase of racket-vm-cs-8.6
>> fails:
>>
>> [...]
>>
>> Apparently some part of the racket-vm-cs build system thinks that it's
>> cross-compiling when it's not. I'm still trying to figure out where this
>> “--cross-compiler” argument is being added but thought I'd provide an early
>> report.
>>
>
> Thanks for trying this! I think I've found what's going wrong in the
> 'configure' script is going wrong, but I'm not sure yet what's the right way
> to fix it. In the meantime, I think the patch below on top of the
> guix-issue-57050-v2 tag should avoid triggering the bad assumption in the
> 'configure' script: could you give it a try? It's also at
> https://gitlab.com/philip1/guix-patches as the current tip of the 'zuo'
> branch, commit 64be5566c119d5b4ab83d5fb44d01aa1ecaed599.
>

P.S. If the patch doesn't work, it would be useful if you could save, from the "source/racket/build/cs/c/" directory relative to the build directory reported by `guix build --keep-failed`, you could send the files "Makefile", "cs_config.h", "config.status", and "config.log", which might have useful information for debugging.
P
P
Philip McGrath wrote on 15 Aug 2022 21:54
[RFC PATCH v2] gnu: racket: Backport fix for powerpc64le.
(name . Thiago Jung Bauermann)(address . bauermann@kolabnow.com)
ddc94a778b196e9425f0057cbd21404e7ecf6605.1660585915.git.philip@philipmcgrath.com
Hi Thiago,

Toggle quote (17 lines)
> > Nice! thanks for the quick fix. I tested guix-issue-57050-v2 and now
> > chez-scheme-for-racket-bootstrap-bootfiles builds successfully! >
> > Unfortunately there's still a holdup: the install phase of
> > racket-vm-cs-8.6 > fails:
> >
> > [...]
> >
> > Apparently some part of the racket-vm-cs build system thinks that it's
> > cross-compiling when it's not. I'm still trying to figure out where this >
> > “--cross-compiler” argument is being added but thought I'd provide an
> > early > report. >
>
> Thanks for trying this! I think I've found what's going wrong in the
> 'configure' script is going wrong, but I'm not sure yet what's the right way
> to fix it.
>

Matthew Flatt fixed our use-case in 'configure' upstream, and I've
cherry-picked it for Guix in the patch below. Can you try this instead?

I've updated the 'zuo' branch at https://gitlab.com/philip1/guix-patchesto
point to this (commit ddc94a778b196e9425f0057cbd21404e7ecf6605) and tagged it
as guix-issue-57050-v2-rfc2; I also tagged the previous attempt as
guix-issue-57050-v2-rfc1.

I will send a clean v3 of this series once this and other remaining questions
are resolved.

I tried bootstrapping the 'regexp', 'io', and 'thread' layers, but it's not so
simple as just deleting the generated files in a snippet. I'll look into that
further once this series is merged and either send patches or deal with it
during the 8.7 update.

Thanks!

-Philip

-- >8 --
From: Philip McGrath <philip@philipmcgrath.com>
Date: Mon, 15 Aug 2022 12:32:57 -0400
Subject: [RFC PATCH v2] gnu: racket: Backport fix for powerpc64le.

Racket's configure script had incorrectly assumed that the combination
of '--enable-racket' and '--enable-pb' implied cross-compilation. On
systems like powerpc64le-linux which always require '--enable-pb' (since
they lack native Chez Scheme backends), this was a particular problem,
breaking `make install`: see https://issues.guix.gnu.org/57050#54.
This patch cherry-picks an upstream repair for the problem affecting
Guix, though other configurations may need further work: see

* gnu/packages/patches/racket-backport-8.6-cross-install.patch: Add
additional backport.
---
.../racket-backport-8.6-cross-install.patch | 98 ++++++++++++++++++-
1 file changed, 96 insertions(+), 2 deletions(-)

Toggle diff (116 lines)
diff --git a/gnu/packages/patches/racket-backport-8.6-cross-install.patch b/gnu/packages/patches/racket-backport-8.6-cross-install.patch
index 4f7849ecc6..2c4d8924ed 100644
--- a/gnu/packages/patches/racket-backport-8.6-cross-install.patch
+++ b/gnu/packages/patches/racket-backport-8.6-cross-install.patch
@@ -1,7 +1,8 @@
-From 585215c5c42f7ee0fee05e6a637ab1bc17f5e8e0 Mon Sep 17 00:00:00 2001
+From fbe2094f56fb81c888076c781e90fb0abbc0cc07 Mon Sep 17 00:00:00 2001
From: Matthew Flatt <mflatt@racket-lang.org>
Date: Sat, 30 Jul 2022 07:06:55 -0600
-Subject: [PATCH] CS makefiles: fix Unix-style install for cross compilation
+Subject: [PATCH 1/2] CS makefiles: fix Unix-style install for cross
+ compilation
Closes #4377
@@ -30,3 +31,96 @@ index 8d3950bb27..d8b74c509d 100644
--
2.32.0
+
+From 85802f4d515e310e657928707800ad709a676e2a Mon Sep 17 00:00:00 2001
+From: Matthew Flatt <mflatt@racket-lang.org>
+Date: Mon, 15 Aug 2022 10:37:01 +0800
+Subject: [PATCH 2/2] configure: adjust cross-build assumption for a pb build
+
+Don't assume a cross build for a pb target on a platform that's only
+supported via pb.
+
+(cherry picked from commit 70e484e885637c495be5481983dae2207fdd67bb)
+
+(Edited to remove unrelated tweak to comments in
+"racket/src/expander/expand/require+provide.rkt".)
+---
+ racket/src/cs/c/configure | 15 +++++++++++----
+ racket/src/cs/c/configure.ac | 15 +++++++++++----
+ 2 files changed, 22 insertions(+), 8 deletions(-)
+
+diff --git a/racket/src/cs/c/configure b/racket/src/cs/c/configure
+index 454d79e11a..7e0fa5600d 100755
+--- a/racket/src/cs/c/configure
++++ b/racket/src/cs/c/configure
+@@ -4679,6 +4679,11 @@ case "$MACH_HOST_CPU" in
+ ;;
+ esac
+
++if test "${MACH}" = "" ; then
++ default_mach_was_empty=yes
++else
++ default_mach_was_empty=no
++fi
+
+ if test "${enable_mach}" != "" ; then
+ MACH="${enable_mach}"
+@@ -4701,13 +4706,15 @@ elif test "$MACH" = "" -o "$MACH_OS" = "" ; then
+ exit 1
+ fi
+
+-# For a pb build where Racket is supplied, force cross-build
+-# mode on the assumption that the host is not a pb build
+-# (because it should be created with default configure options)
++# For a pb build where Racket is supplied and MACH was not originally
++# empty, force cross-build mode on the assumption that the host is not
++# a pb build (because it should be created with default configure options)
+ if test "${enable_pb}" = "yes" ; then
+ if test "${enable_racket}" != "" ; then
+ if test "${enable_target}" = "" ; then
+- enable_target="${MACH}"
++ if test "${default_mach_was_empty}" = "no" ; then
++ enable_target="${MACH}"
++ fi
+ fi
+ fi
+ fi
+diff --git a/racket/src/cs/c/configure.ac b/racket/src/cs/c/configure.ac
+index 5bce979c92..734c1e8feb 100644
+--- a/racket/src/cs/c/configure.ac
++++ b/racket/src/cs/c/configure.ac
+@@ -415,6 +415,11 @@ case "$MACH_HOST_CPU" in
+ ;;
+ esac
+
++if test "${MACH}" = "" ; then
++ default_mach_was_empty=yes
++else
++ default_mach_was_empty=no
++fi
+
+ if test "${enable_mach}" != "" ; then
+ MACH="${enable_mach}"
+@@ -437,13 +442,15 @@ elif test "$MACH" = "" -o "$MACH_OS" = "" ; then
+ exit 1
+ fi
+
+-# For a pb build where Racket is supplied, force cross-build
+-# mode on the assumption that the host is not a pb build
+-# (because it should be created with default configure options)
++# For a pb build where Racket is supplied and MACH was not originally
++# empty, force cross-build mode on the assumption that the host is not
++# a pb build (because it should be created with default configure options)
+ if test "${enable_pb}" = "yes" ; then
+ if test "${enable_racket}" != "" ; then
+ if test "${enable_target}" = "" ; then
+- enable_target="${MACH}"
++ if test "${default_mach_was_empty}" = "no" ; then
++ enable_target="${MACH}"
++ fi
+ fi
+ fi
+ fi
+--
+2.32.0
+

base-commit: aaa95de8c6cff1ba749a9dd0365dedb822ffa625
--
2.32.0
M
M
Maxime Devos wrote on 16 Aug 2022 16:47
Re: [bug#57050] [PATCH v2 04/13] gnu: Add Zuo.
923c0709-4fe9-5f02-06a1-196095f5199e@telenet.be
On 11-08-2022 16:00, Philip McGrath wrote:
Toggle quote (9 lines)
>>> +        #~`(,(string-append "CPPFLAGS=-DGUIX_RKTIO_BIN_SH="
>>> +                            #$(file-append (this-package-input
>>> "bash-minimal")
>>> +                                           "/bin/sh"))
>> As with chez-scheme, I do think using a Racket-agnostic macro name is
>> helpful here.
> I'm planning to respond in the other thread about the possibility of a truly generic macro name, but I hope it doesn't need to become an issue blocking this patch series. For now, I'm not entirely sure what "Racket-agnostic" means; the bottom line for my is I think it would be absurdly awful to have to write, e.g. if cross-compiling using `distro-build` with the top-level Makefile:
>
> ./configure CPPFLAGS="GUIX_RKTIO_BIN_SH=/input/bin/sh GUIX_ZUO_BIN_SH=/input/bin/sh GUIX_CHEZ_BIN_SH=/input/bin/sh" CPPFLAGS_FOR_BUILD="GUIX_RKTIO_BIN_SH=/native-input/bin/sh GUIX_ZUO_BIN_SH=/native-input/bin/sh GUIX_CHEZ_BIN_SH=/native-input/bin/sh"
Example: GUIX_SH=/inputs/bin/sh.
I haven't been following the discussion on the other patches, but didn't
I give an example of something independent of the Racket component in
use and even independent of Racket itself? See the suggestion of using
the already existing _PATH_BSHELL from <paths.h>. It's even not
Guix-specific, apparently it's a BSD-ism!
Greetings,
Maxime.
Attachment: file
Attachment: OpenPGP_signature
T
T
Thiago Jung Bauermann wrote on 19 Aug 2022 02:51
Re: [RFC PATCH v2] gnu: racket: Backport fix for powerpc64le.
(name . Philip McGrath)(address . philip@philipmcgrath.com)
875yipqboa.fsf@kolabnow.com
Hello Philip,

Philip McGrath <philip@philipmcgrath.com> writes:

Toggle quote (22 lines)
> Hi Thiago,
>
>> > Nice! thanks for the quick fix. I tested guix-issue-57050-v2 and now
>> > chez-scheme-for-racket-bootstrap-bootfiles builds successfully! >
>> > Unfortunately there's still a holdup: the install phase of
>> > racket-vm-cs-8.6 > fails:
>> >
>> > [...]
>> >
>> > Apparently some part of the racket-vm-cs build system thinks that it's
>> > cross-compiling when it's not. I'm still trying to figure out where this >
>> > “--cross-compiler” argument is being added but thought I'd provide an
>> > early > report. >
>>
>> Thanks for trying this! I think I've found what's going wrong in the
>> 'configure' script is going wrong, but I'm not sure yet what's the right way
>> to fix it.
>>
>
> Matthew Flatt fixed our use-case in 'configure' upstream, and I've
> cherry-picked it for Guix in the patch below. Can you try this instead?

Great!

Toggle quote (5 lines)
> I've updated the 'zuo' branch at https://gitlab.com/philip1/guix-patchesto
> point to this (commit ddc94a778b196e9425f0057cbd21404e7ecf6605) and tagged it
> as guix-issue-57050-v2-rfc2; I also tagged the previous attempt as
> guix-issue-57050-v2-rfc1.

I tried it but ran into two problems:

1. For some reason I didn't understand, the problem I first reported
about rktboot/main.rkt failing during the build of
chez-scheme-for-racket-bootstrap-bootfiles came back. I had to increase
STACK_SAFETY_MARGIN again. I simply increased it 10x to make sure it
would work. If you want I can experiment with different values to find
an appropriate one.

2. I could be wrong, but I don't think Guix supports having more than
one patch per file. After I moved the new patch to its own file, the
racket packet was built!

Toggle quote (3 lines)
> I will send a clean v3 of this series once this and other remaining questions
> are resolved.

Nice. Below are the changes are made on top of guix-issue-57050-v2-rfc2.

--
Thanks
Thiago


Fix cross-install patches and increase STACK_SAFETY_MARGIN.
Also, add the patches to gnu/local.mk.
---
gnu/local.mk | 2 +
.../racket-backport-8.6-cross-install-2.patch | 92 ++++++++++++++++++
.../racket-backport-8.6-cross-install.patch | 93 -------------------
gnu/packages/racket.scm | 3 +-
4 files changed, 96 insertions(+), 94 deletions(-)
create mode 100644 gnu/packages/patches/racket-backport-8.6-cross-install-2.patch

Toggle diff (233 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 4a873803506a..412968ef3066 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1774,6 +1774,8 @@ dist_patch_DATA = \
%D%/packages/patches/ripperx-missing-file.patch \
%D%/packages/patches/rpcbind-CVE-2017-8779.patch \
%D%/packages/patches/rtags-separate-rct.patch \
+ %D%/packages/patches/racket-backport-8.6-cross-install.patch \
+ %D%/packages/patches/racket-backport-8.6-cross-install-2.patch \
%D%/packages/patches/racket-backport-8.6-zuo.patch \
%D%/packages/patches/racket-chez-scheme-bin-sh.patch \
%D%/packages/patches/racket-rktio-bin-sh.patch \
diff --git a/gnu/packages/patches/racket-backport-8.6-cross-install-2.patch b/gnu/packages/patches/racket-backport-8.6-cross-install-2.patch
new file mode 100644
index 000000000000..f3317e39b10c
--- /dev/null
+++ b/gnu/packages/patches/racket-backport-8.6-cross-install-2.patch
@@ -0,0 +1,92 @@
+From 85802f4d515e310e657928707800ad709a676e2a Mon Sep 17 00:00:00 2001
+From: Matthew Flatt <mflatt@racket-lang.org>
+Date: Mon, 15 Aug 2022 10:37:01 +0800
+Subject: [PATCH 2/2] configure: adjust cross-build assumption for a pb build
+
+Don't assume a cross build for a pb target on a platform that's only
+supported via pb.
+
+(cherry picked from commit 70e484e885637c495be5481983dae2207fdd67bb)
+
+(Edited to remove unrelated tweak to comments in
+"racket/src/expander/expand/require+provide.rkt".)
+---
+ racket/src/cs/c/configure | 15 +++++++++++----
+ racket/src/cs/c/configure.ac | 15 +++++++++++----
+ 2 files changed, 22 insertions(+), 8 deletions(-)
+
+diff --git a/racket/src/cs/c/configure b/racket/src/cs/c/configure
+index 454d79e11a..7e0fa5600d 100755
+--- a/racket/src/cs/c/configure
++++ b/racket/src/cs/c/configure
+@@ -4679,6 +4679,11 @@ case "$MACH_HOST_CPU" in
+ ;;
+ esac
+
++if test "${MACH}" = "" ; then
++ default_mach_was_empty=yes
++else
++ default_mach_was_empty=no
++fi
+
+ if test "${enable_mach}" != "" ; then
+ MACH="${enable_mach}"
+@@ -4701,13 +4706,15 @@ elif test "$MACH" = "" -o "$MACH_OS" = "" ; then
+ exit 1
+ fi
+
+-# For a pb build where Racket is supplied, force cross-build
+-# mode on the assumption that the host is not a pb build
+-# (because it should be created with default configure options)
++# For a pb build where Racket is supplied and MACH was not originally
++# empty, force cross-build mode on the assumption that the host is not
++# a pb build (because it should be created with default configure options)
+ if test "${enable_pb}" = "yes" ; then
+ if test "${enable_racket}" != "" ; then
+ if test "${enable_target}" = "" ; then
+- enable_target="${MACH}"
++ if test "${default_mach_was_empty}" = "no" ; then
++ enable_target="${MACH}"
++ fi
+ fi
+ fi
+ fi
+diff --git a/racket/src/cs/c/configure.ac b/racket/src/cs/c/configure.ac
+index 5bce979c92..734c1e8feb 100644
+--- a/racket/src/cs/c/configure.ac
++++ b/racket/src/cs/c/configure.ac
+@@ -415,6 +415,11 @@ case "$MACH_HOST_CPU" in
+ ;;
+ esac
+
++if test "${MACH}" = "" ; then
++ default_mach_was_empty=yes
++else
++ default_mach_was_empty=no
++fi
+
+ if test "${enable_mach}" != "" ; then
+ MACH="${enable_mach}"
+@@ -437,13 +442,15 @@ elif test "$MACH" = "" -o "$MACH_OS" = "" ; then
+ exit 1
+ fi
+
+-# For a pb build where Racket is supplied, force cross-build
+-# mode on the assumption that the host is not a pb build
+-# (because it should be created with default configure options)
++# For a pb build where Racket is supplied and MACH was not originally
++# empty, force cross-build mode on the assumption that the host is not
++# a pb build (because it should be created with default configure options)
+ if test "${enable_pb}" = "yes" ; then
+ if test "${enable_racket}" != "" ; then
+ if test "${enable_target}" = "" ; then
+- enable_target="${MACH}"
++ if test "${default_mach_was_empty}" = "no" ; then
++ enable_target="${MACH}"
++ fi
+ fi
+ fi
+ fi
+--
+2.32.0
+
diff --git a/gnu/packages/patches/racket-backport-8.6-cross-install.patch b/gnu/packages/patches/racket-backport-8.6-cross-install.patch
index 2c4d8924ed5b..81cd4d2b225f 100644
--- a/gnu/packages/patches/racket-backport-8.6-cross-install.patch
+++ b/gnu/packages/patches/racket-backport-8.6-cross-install.patch
@@ -31,96 +31,3 @@ index 8d3950bb27..d8b74c509d 100644
--
2.32.0
-
-From 85802f4d515e310e657928707800ad709a676e2a Mon Sep 17 00:00:00 2001
-From: Matthew Flatt <mflatt@racket-lang.org>
-Date: Mon, 15 Aug 2022 10:37:01 +0800
-Subject: [PATCH 2/2] configure: adjust cross-build assumption for a pb build
-
-Don't assume a cross build for a pb target on a platform that's only
-supported via pb.
-
-(cherry picked from commit 70e484e885637c495be5481983dae2207fdd67bb)
-
-(Edited to remove unrelated tweak to comments in
-"racket/src/expander/expand/require+provide.rkt".)
----
- racket/src/cs/c/configure | 15 +++++++++++----
- racket/src/cs/c/configure.ac | 15 +++++++++++----
- 2 files changed, 22 insertions(+), 8 deletions(-)
-
-diff --git a/racket/src/cs/c/configure b/racket/src/cs/c/configure
-index 454d79e11a..7e0fa5600d 100755
---- a/racket/src/cs/c/configure
-+++ b/racket/src/cs/c/configure
-@@ -4679,6 +4679,11 @@ case "$MACH_HOST_CPU" in
- ;;
- esac
-
-+if test "${MACH}" = "" ; then
-+ default_mach_was_empty=yes
-+else
-+ default_mach_was_empty=no
-+fi
-
- if test "${enable_mach}" != "" ; then
- MACH="${enable_mach}"
-@@ -4701,13 +4706,15 @@ elif test "$MACH" = "" -o "$MACH_OS" = "" ; then
- exit 1
- fi
-
--# For a pb build where Racket is supplied, force cross-build
--# mode on the assumption that the host is not a pb build
--# (because it should be created with default configure options)
-+# For a pb build where Racket is supplied and MACH was not originally
-+# empty, force cross-build mode on the assumption that the host is not
-+# a pb build (because it should be created with default configure options)
- if test "${enable_pb}" = "yes" ; then
- if test "${enable_racket}" != "" ; then
- if test "${enable_target}" = "" ; then
-- enable_target="${MACH}"
-+ if test "${default_mach_was_empty}" = "no" ; then
-+ enable_target="${MACH}"
-+ fi
- fi
- fi
- fi
-diff --git a/racket/src/cs/c/configure.ac b/racket/src/cs/c/configure.ac
-index 5bce979c92..734c1e8feb 100644
---- a/racket/src/cs/c/configure.ac
-+++ b/racket/src/cs/c/configure.ac
-@@ -415,6 +415,11 @@ case "$MACH_HOST_CPU" in
- ;;
- esac
-
-+if test "${MACH}" = "" ; then
-+ default_mach_was_empty=yes
-+else
-+ default_mach_was_empty=no
-+fi
-
- if test "${enable_mach}" != "" ; then
- MACH="${enable_mach}"
-@@ -437,13 +442,15 @@ elif test "$MACH" = "" -o "$MACH_OS" = "" ; then
- exit 1
- fi
-
--# For a pb build where Racket is supplied, force cross-build
--# mode on the assumption that the host is not a pb build
--# (because it should be created with default configure options)
-+# For a pb build where Racket is supplied and MACH was not originally
-+# empty, force cross-build mode on the assumption that the host is not
-+# a pb build (because it should be created with default configure options)
- if test "${enable_pb}" = "yes" ; then
- if test "${enable_racket}" != "" ; then
- if test "${enable_target}" = "" ; then
-- enable_target="${MACH}"
-+ if test "${default_mach_was_empty}" = "no" ; then
-+ enable_target="${MACH}"
-+ fi
- fi
- fi
- fi
---
-2.32.0
-
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index b1de6cf88519..a38aeb08b503 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -206,6 +206,7 @@ (define %racket-origin
(base32 "1yi36nr7zrdwrnvpmliirxxjz4pyfyhkar6yvk3rapvmg4q2vmnk"))
(file-name (git-file-name "racket" %racket-version))
(patches (search-patches "racket-backport-8.6-cross-install.patch"
+ "racket-backport-8.6-cross-install-2.patch"
"racket-backport-8.6-docindex-write.patch"
"racket-backport-8.6-hurd.patch"
"racket-backport-8.6-zuo.patch"
@@ -429,7 +430,7 @@ (define-public racket-vm-bc
(lambda (flag)
(if (string-prefix? "CPPFLAGS=" flag)
(string-append flag
- " -DSTACK_SAFETY_MARGIN=200000")
+ " -DSTACK_SAFETY_MARGIN=2000000")
flag))
#$(racket-vm-common-configure-flags)))
(else
M
M
Maxime Devos wrote on 19 Aug 2022 12:10
Re: [bug#57050] [RFC PATCH v2] gnu: racket: Backport fix for powerpc64le.
7170febc-2af8-5087-5767-b2ef01717038@telenet.be
On 19-08-2022 02:51, Thiago Jung Bauermann via Guix-patches via wrote:
Toggle quote (3 lines)
> 2. I could be wrong, but I don't think Guix supports having more than
> one patch per file. After I moved the new patch to its own file, the
> racket packet was built!
I don't know what happened there, but multiple patches in a single file
appears to work for at least rust-meval and
'rust-meval-update-dependencies.patch' in the antioxidant channel.
Greetings,
Maxime.
Attachment: OpenPGP_signature
E
E
Efraim Flashner wrote on 22 Aug 2022 10:41
Re: [bug#57050] [PATCH v2 05/13] gnu: racket: Update to 8.6.
(name . Philip McGrath)(address . philip@philipmcgrath.com)
YwNBLdQpoS2g3rtO@3900XT
On Thu, Aug 11, 2022 at 07:08:15AM -0400, Philip McGrath wrote:
Toggle quote (15 lines)
> Also, update 'chez-scheme-for-racket' to 9.5.9.2.

> -(define %racket-version "8.5") ; Remember to update chez-scheme-for-racket!
> +(define %racket-version "8.6") ; Remember to update chez-scheme-for-racket!
> (define %zuo-version "1.0") ; defined in racket/src/zuo/zuo.c
> (define %racket-commit
> (string-append "v" %racket-version))
> @@ -211,10 +215,15 @@ (define %racket-origin
> (url "https://github.com/racket/racket")
> (commit %racket-commit)))
> (sha256
> - (base32 "0f9zyhdvbh4xsndrqjzl85j5ziz0rmqi676g9s1lw3h3skq2636h"))
> + (base32 "1yi36nr7zrdwrnvpmliirxxjz4pyfyhkar6yvk3rapvmg4q2vmnk"))
> (file-name (git-file-name "racket" %racket-version))

I got a different hash just now, and the tag on GitHub says it's from
6 days ago. It looks like the tagged commit might've changed in the past
week or two.

--
Efraim Flashner <efraim@flashner.co.il> ????? ?????
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmMDQSoACgkQQarn3Mo9
g1FGyw//RpvaaLJFZ9gaVVazxt0h5+qOkH2OVj2tEIuqjTTax1YgCAK/0ZDWYmfG
yDwSkPLTkuumdKbmB7mebvdzOZohJ7UNStnIgreY3UvoUs+yL4WSgr7PV8b8BB2H
9u/KqdOc8duzaaFqIsGUg9bjfB0Ouyu0k9AgpmxSdEle3yV6bX5xH0o4GdXtHwTF
zM1H8yZJ+5yKrbh7ZpU3ViSR+P95AdVI5LSxHEqIL+QjwXDrYlWiDROUF6tpye38
v1sGQPq+yL2jLSniV8K8gDNOKy1U3MP035sVzIaHBu01wVQWn6uPhWcfd55xkGOR
LsgiGHVDc+yAULmGCbPmxH5cY2xH9YkwknIT2Gxd/pslKJIVS1UQlm7RMlOkh0iM
G/MLiIKbY/SVvsp9FjpMNcDVSiuHqoa9F1PiHGSjjh0hT3Zqic8I5XXrG0XW+7lw
Sxz50zKmajuzZuMvie0T0bdmvdr/PbrtR97qw/qATxCmy/2bK70aRTXsBAhE34cW
ng9b95J26EBO63wtpwb0O1Thx6Ztv6to8+nmUU6zQU6X/tkd2EzzQ1v+y64dxMOM
r5mJI0b/KDQmbTUrxoMzkD4AmN6jSEMcs3EyI4xmW+tMKtgxIgcUAknkWDZ+hKjR
ZoyV0gZPEZhEyaoNxLiRhjqNlV88yIfOqgcGxdnDE752Jro2g38=
=IfsU
-----END PGP SIGNATURE-----


P
P
Philip McGrath wrote on 22 Aug 2022 20:56
(name . Efraim Flashner)(address . efraim@flashner.co.il)
ab4c82bb-1370-4748-8d51-9b5c1a5d4732@www.fastmail.com
On Mon, Aug 22, 2022, at 4:41 AM, Efraim Flashner wrote:
Toggle quote (21 lines)
> On Thu, Aug 11, 2022 at 07:08:15AM -0400, Philip McGrath wrote:
>> Also, update 'chez-scheme-for-racket' to 9.5.9.2.
>
>> -(define %racket-version "8.5") ; Remember to update chez-scheme-for-racket!
>> +(define %racket-version "8.6") ; Remember to update chez-scheme-for-racket!
>> (define %zuo-version "1.0") ; defined in racket/src/zuo/zuo.c
>> (define %racket-commit
>> (string-append "v" %racket-version))
>> @@ -211,10 +215,15 @@ (define %racket-origin
>> (url "https://github.com/racket/racket")
>> (commit %racket-commit)))
>> (sha256
>> - (base32 "0f9zyhdvbh4xsndrqjzl85j5ziz0rmqi676g9s1lw3h3skq2636h"))
>> + (base32 "1yi36nr7zrdwrnvpmliirxxjz4pyfyhkar6yvk3rapvmg4q2vmnk"))
>> (file-name (git-file-name "racket" %racket-version))
>
> I got a different hash just now, and the tag on GitHub says it's from
> 6 days ago. It looks like the tagged commit might've changed in the past
> week or two.
>

Thanks for the report. Yes, the tag apparently changed to point to 3c5e37774fa7acd04fb648187e080a3c62a0d4ea instead of 90d2dac7976b6ac0369c267f0adec3f37bd98460. (The change doesn't affect the Guix packages at all.) I've reminded upstream about the problems this causes---it is definitely not Racket's normal practice!---and I'll send a v3 of this series soon.

-Philip
P
P
Philip McGrath wrote on 23 Aug 2022 03:40
Re: [bug#57050] [PATCH v2 04/13] gnu: Add Zuo.
d77982b0-50df-4bf9-9fc4-1a0e3e700cbe@www.fastmail.com
Hi,

On Tue, Aug 16, 2022, at 10:47 AM, Maxime Devos wrote:
Toggle quote (16 lines)
> On 11-08-2022 16:00, Philip McGrath wrote:
>>>> + #~`(,(string-append "CPPFLAGS=-DGUIX_RKTIO_BIN_SH="
>>>> + #$(file-append (this-package-input
>>>> "bash-minimal")
>>>> + "/bin/sh"))
>>>>
>>> As with chez-scheme, I do think using a Racket-agnostic macro name is
>>> helpful here.
>>>
>> I'm planning to respond in the other thread about the possibility of a truly generic macro name, but I hope it doesn't need to become an issue blocking this patch series. For now, I'm not entirely sure what "Racket-agnostic" means; the bottom line for my is I think it would be absurdly awful to have to write, e.g. if cross-compiling using `distro-build` with the top-level Makefile:
>>
>> ./configure CPPFLAGS="GUIX_RKTIO_BIN_SH=/input/bin/sh GUIX_ZUO_BIN_SH=/input/bin/sh GUIX_CHEZ_BIN_SH=/input/bin/sh" CPPFLAGS_FOR_BUILD="GUIX_RKTIO_BIN_SH=/native-input/bin/sh GUIX_ZUO_BIN_SH=/native-input/bin/sh GUIX_CHEZ_BIN_SH=/native-input/bin/sh"
>
> Example: GUIX_SH=/inputs/bin/sh.
>

I will use GUIX_SH in v3 of this series.

My concern with it originally was that it's generic enough that it might be used in other ways elsewhere in Guix, but, since I'm hoping it's only going to be a medium-term solution, it seems good enough, and I haven't heard any objections to it.

Toggle quote (3 lines)
> I haven't been following the discussion on the other patches, but didn't I give an example of something independent of the Racket component in use and even independent of Racket itself? See the suggestion of using the already existing _PATH_BSHELL from <paths.h>. It's even not Guix-specific, apparently it's a BSD-ism!
>

On Wed, Aug 10, 2022, at 7:46 AM, Maxime Devos wrote:
Toggle quote (34 lines)
> On 09-08-2022 23:58, Philip McGrath wrote:
>
>> On Tuesday, August 9, 2022 5:38:56 PM EDT ( wrote:
>>> On Tue Aug 9, 2022 at 10:24 PM BST, Maxime Devos wrote:
>>>> In the glibc headers, there's some (POSIX?) standard macro that points
>>>> at "/gnu/store/.../bin/sh" (I don't recall the name), any reason we
>>>> aren't using that macro? That would be Guix-independent. I'm not sure
>>>> if a /gnu/store/... prefix is included, but if not, maybe we could try
>>>> overriding it with -D...="/gnu/store/...", or failing that, add a
>>>> post-unpack substitute* replacing [the macro name] ->
>>>> "/gnu/store/.../bin/sh".
>>> I believe you might be referring to <paths.h>, which defines _PATH_BSHELL.
>>>
>>> It's not standard C <https://en.cppreference.com/w/c/header> nor POSIX
>>> <https://pubs.opengroup.org/onlinepubs/9699919799/idx/head.html> though.
>>>
>>> -- (
>
> Looking at the "paths.h" header, it appears to be a BSDism. Not really
> standard but still better than a Guix-ism.
>
>> I'd love to be wrong, but I also can't find such a macro. In the glibc source
>> tree, "stdlib/system.c" defines a stub implementation that always fails with
>> ENOSYS, and "sysdeps/posix/system.c" contains:
>>
>> #define SHELL_PATH "/bin/sh" /* Path of the shell. */
>> #define SHELL_NAME "sh" /* Name to give it. */
>>
>> Concretely, I think Guix's glibc currently uses /bin/sh dynamically: in my
>> Chez example above, if you replace `process` with `system` (which uses libc's
>> `system`), the result is always "/bin/sh\n".
>
> If so, that's a bug. I do not know what result you are referring to.

(Disregard this part; I think I was thinking about some other way I had tried things.)

Toggle quote (5 lines)
>
> Anyway, the Guix package definition of glibc substitutes _PATH_BSHELL
> and SHELL_PATH, so unless there's a bug, it doesn't depend on /bin/sh.
>

I have been looking further into options for addressing this upstream.

First of all, I have found that there *is* another Unix-like system where "/bin/sh" doesn't exist: on Android, the POSIX shell is usually at "/system/bin/sh". Also, at least on some versions, _PATH_BSHELL isn't a compile-time constant. It is:

#define _PATH_BSHELL __bionic_get_shell_path()

(There are also systems where "/bin/sh" is some non-POSIX shell and the POSIX shell is at "/usr/xpg4/bin/sh". If changing this upstream, Racket may need to decide whether POSIX compatibility or historical compatibility is more important there.)

I've found that there does seem to be a POSIX recommendation for finding "sh". The POSIX spec for `system` https://pubs.opengroup.org/onlinepubs/9699919799/functions/system.html says, under "Application Usage", "There is no defined way for an application to find the specific path for the shell. However, confstr() can provide a value for PATH that is guaranteed to find the sh utility." Similarly, https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html says that "applications should note that the standard PATH to the shell cannot be assumed to be either /bin/sh or /usr/bin/sh, and should be determined by interrogation of the PATH returned by getconf PATH, ensuring that the returned pathname is an absolute pathname and not a shell built-in." Most emphatically, https://pubs.opengroup.org/onlinepubs/9699919799/functions/confstr.html says in the normative "Description":

Toggle quote (8 lines)
>
> If the implementation supports the POSIX shell option, the string stored in buf after a call to:
>
> confstr(_CS_PATH, buf, sizeof(buf))
>
> can be used as a value of the PATH environment variable that accesses all of the standard utilities of POSIX.1-2017, that are provided in a manner accessible via the exec family of functions, if the return value is less than or equal to sizeof(buf).
>

However, apparently using `confstr` with `_CS_PATH` does not give a useful result in Guix build environments. Try building the following package with `guix build -f`: I've put the interesting log output in the description. In particular, note that *both* bash-minimal and bash-static are present!

Toggle snippet (57 lines)
(use-modules
(guix build-system gnu)
(guix gexp)
((guix licenses) #:prefix license:)
(guix packages))
(define src
(plain-file "demo.c"
"#include <stdlib.h>
#include <stdio.h>
#include <paths.h>
#include <unistd.h>
int main(int argc, char *argv[]) {
puts(_PATH_BSHELL);
size_t buf_len = confstr(_CS_PATH, NULL, 0);
char* buf = malloc(buf_len);
if (NULL == buf) {
return 1;
};
confstr(_CS_PATH, buf, buf_len);
puts(buf);
fflush(stdout);
int status = system(\"echo $BASH\");
fflush(stdout);
printf(\"status: %i\\n\", status);
return 0;
}
"))
(package
(name "libc-system-demo")
(version "0")
(source src)
(build-system gnu-build-system)
(arguments
(list
#:phases
#~(modify-phases %standard-phases
(delete 'configure)
(replace 'build
(lambda args
(invoke "gcc" "-o" "demo" #$src)))
(replace 'check
(lambda args
(invoke "./demo")))
(replace 'install
(lambda args
(install-file "demo" (string-append #$output "/bin")))))))
(home-page "https://issues.guix.gnu.org/57050")
(synopsis "Some 'sh'-related values from glibc")
(description "starting phase `check'
/gnu/store/720rj90bch716isd8z7lcwrnvz28ap4y-bash-static-5.1.8/bin/sh
/bin:/usr/bin
/gnu/store/4y5m9lb8k3qkb1y9m02sw9w9a6hacd16-bash-minimal-5.1.8/bin/sh
status: 0
phase `check' succeeded after 0.0 seconds")
(license license:cc0))

AFAICT, Glibc's `confstr` implementation for `_CS_PATH` doesn't have any mechanism for configuring the search path; it simply uses the compile-time version, `CS_PATH`, which is:

#define CS_PATH "/bin:/usr/bin"

More generally, it seems questionable for our glibc to retain a store reference to Bash (let alone two). Wouldn't that prevent creating containers or packs without a shell present?

After I've sent a v3 of this series, I plan to raise these questions on the guix-devel list. Then, once I have a sense of whether Guix would like to support `confstr` with `_CS_PATH` as a way of finding the shell, I'll propose some changes to Racket upstream.

-Philip
M
M
Maxime Devos wrote on 23 Aug 2022 11:11
1292f8b6-8a95-0e1f-6a41-2122a3164bbe@telenet.be
On 23-08-2022 03:40, Philip McGrath wrote:
Toggle quote (1 lines)
> More generally, it seems questionable for our glibc to retain a store reference to Bash (let alone two). Wouldn't that prevent creating containers or packs without a shell present?
glibc needs to retain a reference to a shell for the 'system' function
to work.
I don't see what containers or packs have to do with anything, it's the
same for profiles in general.
Greetings,
Maxime.
Attachment: OpenPGP_signature
M
M
Maxime Devos wrote on 23 Aug 2022 11:20
6fe5b257-8554-92ed-2449-40559b73133f@telenet.be
Toggle quote (4 lines)
> [...]
> I will use GUIX_SH in v3 of this series.
>
> My concern with it originally was that it's generic enough that it might be used in other ways elsewhere in Guix, but, since I'm hoping it's only going to be a medium-term solution, it seems good enough, and I haven't heard any objections to it.
_PATH_BSHELL seems better to me, as it is not Guix-specific and does not
require adding preprocessor arguments. Even simpler would be to
substitute* the /bin/sh to (search-input-file inputs "bin/sh") like done
for other packages.
I have previously objected to it, though not explicitly:
Toggle quote (6 lines)
> I haven't been following the discussion on the other patches, but
> didn't I give an example of something independent of the Racket
> component in use and even independent of Racket itself? See the
> suggestion of using the already existing _PATH_BSHELL from <paths.h>.
> It's even not Guix-specific, apparently it's a BSD-ism!
>
I don't see the point of a GUIX_SH macro when the standard-ish
_PATH_BSHELL appears to suffice.
On 23-08-2022 03:40, Philip McGrath wrote:
Toggle quote (3 lines)
> First of all, I have found that there*is* another Unix-like system where "/bin/sh" doesn't exist: on Android, the POSIX shell is usually at "/system/bin/sh". Also, at least on some versions, _PATH_BSHELL isn't a compile-time constant. It is:
>
> #define _PATH_BSHELL __bionic_get_shell_path()
Looking at the patch, it not being a compile-time constant does not
appear to be a problem to me.
Greetings,
Maxime.
Attachment: OpenPGP_signature
P
P
Philip McGrath wrote on 24 Aug 2022 01:24
6115438b-5c46-46cf-9a58-5cf3d76e0e49@www.fastmail.com
On Tue, Aug 23, 2022, at 5:11 AM, Maxime Devos wrote:
Toggle quote (11 lines)
> On 23-08-2022 03:40, Philip McGrath wrote:
>
>> More generally, it seems questionable for our glibc to retain a store reference to Bash (let alone two). Wouldn't that prevent creating containers or packs without a shell present?
>
> glibc needs to retain a reference to a shell for the 'system' function
> to work.
>
> I don't see what containers or packs have to do with anything, it's the
> same for profiles in general.
>

Without involving Guix, it's possible to create a chroot, container, or various other kinds of environments where a shell is not present. Inside such an environment, the 'system' function "works" by returning 0 if the command is NULL, 127 otherwise.

AFAICT, even when Guix creates a container or otherwise isolated environment, any program linking to glibc pulls along Bash. (Indeed, two different versions of Bash!)

-Philip
P
P
Philip McGrath wrote on 24 Aug 2022 02:27
ce3a8303-03cf-43ea-952c-705724e736a7@www.fastmail.com
On Tue, Aug 23, 2022, at 5:20 AM, Maxime Devos wrote:
Toggle quote (7 lines)
>> [...]
>> I will use GUIX_SH in v3 of this series.
>>
>> My concern with it originally was that it's generic enough that it might be used in other ways elsewhere in Guix, but, since I'm hoping it's only going to be a medium-term solution, it seems good enough, and I haven't heard any objections to it.
> _PATH_BSHELL seems better to me, as it is not Guix-specific and does not
> require adding preprocessor arguments.

Not needing preprocessor arguments would be a nice advantage. I will try _PATH_BSHELL.

Toggle quote (5 lines)
> Even simpler would be to
> substitute* the /bin/sh to (search-input-file inputs "bin/sh") like done
> for other packages.
>

Unfortunately, that doesn't work well here. We cannot refer to store paths in Racket or Chez source code (as opposed to C code) because the grafter cannot handle the format of compiled code: see https://issues.guix.gnu.org/47180#6. (I don't know about Zuo image dumps, but the binary format is unspecified, so it seems safer not to.)

Also, especially for Racket, there are many entry points where "/bin/sh" might come from, including both functions like 'system' and also programs that explicitly use "/bin/sh" with functions like 'system*'. When I first wrote the current patch, maintaining Guix-specific patches for all of them seemed unsustainable, so I instead patched the low-level function for running subprocesses to interpose on any attempt to execute "/bin/sh", regardless of where it came from.

If I addressed this upstream, I'd probably extend an existing function to support `(find-system-path 'shell)`, change `system` and friends to use it, and likewise change scripts that currently use "/bin/sh" explicitly.

Toggle quote (9 lines)
> On 23-08-2022 03:40, Philip McGrath wrote:
>> First of all, I have found that there*is* another Unix-like system where "/bin/sh" doesn't exist: on Android, the POSIX shell is usually at "/system/bin/sh". Also, at least on some versions, _PATH_BSHELL isn't a compile-time constant. It is:
>>
>> #define _PATH_BSHELL __bionic_get_shell_path()
>
> Looking at the patch, it not being a compile-time constant does not
> appear to be a problem to me.
>

It's not an issue with the current patch. It could be relevant for some ways of addressing this upstream. Mostly, it's part of my thinking that "where is the shell, if any?" is a question best answered at runtime rather than compile time.

-Philip
L
L
Liliana Marie Prikler wrote on 24 Aug 2022 07:42
2c4ecca1ab70bdd25672d65e885abeb29b644e50.camel@gmail.com
Am Dienstag, dem 23.08.2022 um 20:27 -0400 schrieb Philip McGrath:
Toggle quote (11 lines)
>
> > Even simpler would be to substitute* the /bin/sh to (search-input-
> > file inputs "bin/sh") like
> > done for other packages.
>
> Unfortunately, that doesn't work well here. We cannot refer to store
> paths in Racket or Chez source code (as opposed to C code) because
> the grafter cannot handle the format of compiled code: see
> <https://issues.guix.gnu.org/47180#6>. (I don't know about Zuo image
> dumps, but the binary format is unspecified, so it seems safer not
> to.)
We are talking about some C source code, though, so I doubt this point
is relevant, is it?
P
P
Philip McGrath wrote on 24 Aug 2022 07:47
3ba9a229-f008-429e-b135-1e20c2e10a1c@www.fastmail.com
On Wed, Aug 24, 2022, at 1:42 AM, Liliana Marie Prikler wrote:
Toggle quote (15 lines)
> Am Dienstag, dem 23.08.2022 um 20:27 -0400 schrieb Philip McGrath:
>>
>> > Even simpler would be to substitute* the /bin/sh to (search-input-
>> > file inputs "bin/sh") like
>> > done for other packages.
>>
>> Unfortunately, that doesn't work well here. We cannot refer to store
>> paths in Racket or Chez source code (as opposed to C code) because
>> the grafter cannot handle the format of compiled code: see
>> <https://issues.guix.gnu.org/47180#6>. (I don't know about Zuo image
>> dumps, but the binary format is unspecified, so it seems safer not
>> to.)
> We are talking about some C source code, though, so I doubt this point
> is relevant, is it?

For rktio and Zuo, the string "/bin/sh" doesn't appear in the C source code, only in the Racket/Zuo libraries.

-Philip
P
P
Philip McGrath wrote on 25 Aug 2022 10:54
[PATCH v3 00/14] gnu: Update Racket to 8.6. Add Zuo.
(address . 57050@debbugs.gnu.org)
cover.1661416343.git.philip@philipmcgrath.com
Hi,

Here is a v3 of this series. The major changes from v2 are:

1. Reflecting the change upstream to the v8.6 tag (which they will not
do again);

2. Changing the patches to use _PATH_BSHELL for "/bin/sh"; and

3. Incorporating all of the powerpc64le fixes, including the 10x higher
STACK_SAFETY_MARGIN that got the build working for Thiago.

I've also made many of the smaller changes requested.

For convienience, I've also pushed this series to the 'zuo' branch of
guix-issue-57050-v3 (commit 9b429caf1d9cd6574debcb11065b957874d2a31a).

-Philip

Philip McGrath (14):
gnu: stex: Update to 1.2.2-2.afa6075.
gnu: stex: Fix read-only gifs and math directories.
etc: teams: Add racket team.
etc: teams: Add entry for Philip McGrath.
gnu: racket: Adjust patch for "/bin/sh" in rktio.
gnu: chez-scheme: Fix use of "/bin/sh".
gnu: Add Zuo.
gnu: racket: Update to 8.6.
gnu: chez-scheme: Make bootfiles regular inputs.
gnu: chez-scheme-for-racket: Support cross-compilation.
gnu: racket: Support cross-compiling the VM packages.
gnu: chez-scheme-for-racket: Suport all systems.
gnu: racket-vm-bc: Add workaround for ppc64le.
gnu: racket: Use Racket CS on all systems.

etc/teams.scm.in | 12 +
gnu/local.mk | 7 +-
gnu/packages/chez.scm | 211 ++++--
gnu/packages/patches/chez-scheme-bin-sh.patch | 76 +++
.../racket-backport-8.6-cross-install.patch | 126 ++++
.../racket-backport-8.6-docindex-write.patch | 36 ++
.../patches/racket-backport-8.6-hurd.patch | 609 ++++++++++++++++++
.../patches/racket-backport-8.6-zuo.patch | 481 ++++++++++++++
.../patches/racket-chez-scheme-bin-sh.patch | 76 +++
...-rktio.patch => racket-rktio-bin-sh.patch} | 60 +-
gnu/packages/patches/racket-zuo-bin-sh.patch | 74 +++
.../stex-copy-from-immutable-store.patch | 41 ++
gnu/packages/racket.scm | 242 ++++---
13 files changed, 1897 insertions(+), 154 deletions(-)
create mode 100644 gnu/packages/patches/chez-scheme-bin-sh.patch
create mode 100644 gnu/packages/patches/racket-backport-8.6-cross-install.patch
create mode 100644 gnu/packages/patches/racket-backport-8.6-docindex-write.patch
create mode 100644 gnu/packages/patches/racket-backport-8.6-hurd.patch
create mode 100644 gnu/packages/patches/racket-backport-8.6-zuo.patch
create mode 100644 gnu/packages/patches/racket-chez-scheme-bin-sh.patch
rename gnu/packages/patches/{racket-minimal-sh-via-rktio.patch => racket-rktio-bin-sh.patch} (54%)
create mode 100644 gnu/packages/patches/racket-zuo-bin-sh.patch
create mode 100644 gnu/packages/patches/stex-copy-from-immutable-store.patch


base-commit: a39207f7afd977e4e4299c6f0bb34bcb6d153818
--
2.32.0
P
P
Philip McGrath wrote on 25 Aug 2022 10:54
[PATCH v3 01/14] gnu: stex: Update to 1.2.2-2.afa6075.
(address . 57050@debbugs.gnu.org)
bafc0db97e092753bbdd280f3131ca268d3f9b74.1661416343.git.philip@philipmcgrath.com
* gnu/packages/chez.scm (stex-bootstrap): Update to 1.2.2-2.afa6075.
---
gnu/packages/chez.scm | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

Toggle diff (26 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index b037efe8d4..043f2ae47a 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -594,8 +594,8 @@ (define-public chez-scheme-for-racket-bootstrap-bootfiles
(define-public stex-bootstrap
;; This commit includes a fix which we would otherwise want to use as
;; patch. Let's revert to tagged releases as soon as one becomes available.
- (let ((commit "54051494434a197772bf6ca5b4e6cf6be55f39a5")
- (revision "1"))
+ (let ((commit "afa607564a5662ffd748e824801277a6b5a3d11c")
+ (revision "2"))
(hidden-package
(package
(name "stex")
@@ -611,7 +611,7 @@ (define-public stex-bootstrap
(url "https://github.com/dybvig/stex")
(commit commit)))
(sha256
- (base32 "01jnvw8qw33gnpzwrakwhsr05h6b609lm180jnspcrb7lds2p23d"))
+ (base32 "0n6dryv5j7cw2qmsj55wqb0ph901h83a2hl4j891ppxp0xx18nkp"))
(file-name (git-file-name name version))
(snippet
#~(for-each delete-file
--
2.32.0
P
P
Philip McGrath wrote on 25 Aug 2022 10:54
[PATCH v3 02/14] gnu: stex: Fix read-only gifs and math directories.
(address . 57050@debbugs.gnu.org)
4f6b9cc1870adc84a421d101e4a4e6f4ea5102cd.1661416343.git.philip@philipmcgrath.com
Excplicitly set the user write bit when initializing the gifs or math
directories from the skeletons installed in the store. See also upstream
discussion at https://github.com/dybvig/stex/pull/6. This problem
would be exposed by the upcoming changes to Racket's build system.

* gnu/packages/patches/stex-copy-from-immutable-store.patch: New patch.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/chez.scm (stex-bootstrap)[patches]: Use it.
---
gnu/local.mk | 1 +
gnu/packages/chez.scm | 3 ++
.../stex-copy-from-immutable-store.patch | 41 +++++++++++++++++++
3 files changed, 45 insertions(+)
create mode 100644 gnu/packages/patches/stex-copy-from-immutable-store.patch

Toggle diff (75 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 26dfb6afe2..558fed8a0d 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1821,6 +1821,7 @@ dist_patch_DATA = \
%D%/packages/patches/slim-reset.patch \
%D%/packages/patches/slim-login.patch \
%D%/packages/patches/slim-display.patch \
+ %D%/packages/patches/stex-copy-from-immutable-store.patch \
%D%/packages/patches/syslinux-gcc10.patch \
%D%/packages/patches/syslinux-strip-gnu-property.patch \
%D%/packages/patches/snappy-add-O2-flag-in-CmakeLists.txt.patch \
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 043f2ae47a..812d41fc5b 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -613,6 +613,9 @@ (define-public stex-bootstrap
(sha256
(base32 "0n6dryv5j7cw2qmsj55wqb0ph901h83a2hl4j891ppxp0xx18nkp"))
(file-name (git-file-name name version))
+ (patches
+ ;; submitted upstream in https://github.com/dybvig/stex/pull/6
+ (search-patches "stex-copy-from-immutable-store.patch"))
(snippet
#~(for-each delete-file
'("sbin/install" "doc/stex.pdf" "doc/stex.html")))))
diff --git a/gnu/packages/patches/stex-copy-from-immutable-store.patch b/gnu/packages/patches/stex-copy-from-immutable-store.patch
new file mode 100644
index 0000000000..4562e431c1
--- /dev/null
+++ b/gnu/packages/patches/stex-copy-from-immutable-store.patch
@@ -0,0 +1,41 @@
+From 9434b4a36646c036db8de326158056aa3293fb82 Mon Sep 17 00:00:00 2001
+From: Philip McGrath <philip@philipmcgrath.com>
+Date: Thu, 28 Apr 2022 22:56:20 -0400
+Subject: [PATCH] fix read-only gifs and math directories
+
+An installed copy of stex might have all write permission bits removed,
+even for the owner of the installed files: this is the case with Guix
+package of stex, for example. If such an installation is used to
+initialize the gifs or math directories (e.g. for an out-of-source
+build), tar likewise creates them without write permissions, preventing
+subdirectories from being created later. Set the user write bit
+explicitly to avoid this problem.
+ Mf-stex
+
+Related to https://github.com/racket/racket/pull/4203
+---
+
+Submitted upstream in https://github.com/dybvig/stex/pull/6
+
+ Mf-stex | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/Mf-stex b/Mf-stex
+index 09ec6f3..11fb214 100644
+--- a/Mf-stex
++++ b/Mf-stex
+@@ -112,9 +112,11 @@ $(x).mathrun: gifs $(mathfiles)
+
+ gifs:
+ (cd $(STEXLIB); tar -cf - gifs) | tar -xpf -
++ chmod u+w gifs
+
+ math:
+ (cd $(STEXLIB); tar -cf - math) | tar -xpf -
++ chmod u+w math
+
+ $(mathfiles): $(x).hthirdrun $(figps)
+ echo -n gifs= > $(mathfiles)
+--
+2.32.0
+
--
2.32.0
P
P
Philip McGrath wrote on 25 Aug 2022 10:54
[PATCH v3 04/14] etc: teams: Add entry for Philip McGrath.
(address . 57050@debbugs.gnu.org)
c1d7ad56d360d73d5e438e43c4a2f2cd2e70fdd1.1661416343.git.philip@philipmcgrath.com
* etc/teams.scm.in ("Philip McGrath"): New member.
---
etc/teams.scm.in | 4 ++++
1 file changed, 4 insertions(+)

Toggle diff (17 lines)
diff --git a/etc/teams.scm.in b/etc/teams.scm.in
index e2eb5048f6..38b7ab8e1d 100644
--- a/etc/teams.scm.in
+++ b/etc/teams.scm.in
@@ -238,6 +238,10 @@ (define-member (person "Julien Lepiller"
"julien@lepiller.eu")
java ocaml translations)
+(define-member (person "Philip McGrath"
+ "philip@philipmcgrath.com")
+ racket)
+
(define-member (person "Mathieu Othacehe"
"othacehe@gnu.org")
core installer mentors)
--
2.32.0
P
P
Philip McGrath wrote on 25 Aug 2022 10:54
[PATCH v3 03/14] etc: teams: Add racket team.
(address . 57050@debbugs.gnu.org)
dbab94916627a7e531885a21c2d9575a181b353f.1661416343.git.philip@philipmcgrath.com
* etc/teams.scm.in (racket): New team.
---
etc/teams.scm.in | 8 ++++++++
1 file changed, 8 insertions(+)

Toggle diff (21 lines)
diff --git a/etc/teams.scm.in b/etc/teams.scm.in
index c99d794697..e2eb5048f6 100644
--- a/etc/teams.scm.in
+++ b/etc/teams.scm.in
@@ -185,6 +185,14 @@ (define-team mozilla
"Taking care about Icecat and Icedove, built from Mozilla Firefox
and Thunderbird."))
+(define-team racket
+ (team 'racket
+ #:name "Racket team"
+ #:description
+ "The Racket language and Racket-based languages, Racket packages,
+Racket's variant of Chez Scheme, and development of a Racket build system and
+importer."))
+
(define-member (person "Thiago Jung Bauermann"
"bauermann@kolabnow.com")
--
2.32.0
P
P
Philip McGrath wrote on 25 Aug 2022 10:54
[PATCH v3 05/14] gnu: racket: Adjust patch for "/bin/sh" in rktio.
(address . 57050@debbugs.gnu.org)
e97bb719b1db34af90d0488abdc5414faf625328.1661416343.git.philip@philipmcgrath.com
Use '_PATH_BSHELL' instead of a custom preprocessor macro. This may not
be The Right Thing in the long term, but it at least avoids a
proliferation of 'CPPFLAGS'.

* gnu/packages/patches/racket-minimal-sh-via-rktio.patch: Rename to ...
* gnu/packages/patches/racket-rktio-bin-sh.patch: ... this, and change
to use '_PATH_BSHELL'.
* gnu/local.mk (dist_patch_DATA): Update accordingly.
* gnu/packages/racket.scm (%racket-origin)[patches]: Likewise.
(racket-vm-common-configure-flags): Stop setting 'CPPFLAGS'. Change to a
constant instead of a function, since we no longer need the delay.
(racket-vm-cgc, racket-vm-bc,
racket-vm-cs)[arguments]<#:configure-flags>: Update accordingly.
[inputs]: Remove 'bash-minimal'.
---
gnu/local.mk | 2 +-
...-rktio.patch => racket-rktio-bin-sh.patch} | 60 +++++++++----------
gnu/packages/racket.scm | 15 ++---
3 files changed, 35 insertions(+), 42 deletions(-)
rename gnu/packages/patches/{racket-minimal-sh-via-rktio.patch => racket-rktio-bin-sh.patch} (54%)

Toggle diff (202 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 558fed8a0d..fae32a11e5 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1768,7 +1768,7 @@ dist_patch_DATA = \
%D%/packages/patches/ripperx-missing-file.patch \
%D%/packages/patches/rpcbind-CVE-2017-8779.patch \
%D%/packages/patches/rtags-separate-rct.patch \
- %D%/packages/patches/racket-minimal-sh-via-rktio.patch \
+ %D%/packages/patches/racket-rktio-bin-sh.patch \
%D%/packages/patches/remake-impure-dirs.patch \
%D%/packages/patches/restic-0.9.6-fix-tests-for-go1.15.patch \
%D%/packages/patches/retroarch-LIBRETRO_DIRECTORY.patch \
diff --git a/gnu/packages/patches/racket-minimal-sh-via-rktio.patch b/gnu/packages/patches/racket-rktio-bin-sh.patch
similarity index 54%
rename from gnu/packages/patches/racket-minimal-sh-via-rktio.patch
rename to gnu/packages/patches/racket-rktio-bin-sh.patch
index 6bc2ee8331..ec6f0d9c56 100644
--- a/gnu/packages/patches/racket-minimal-sh-via-rktio.patch
+++ b/gnu/packages/patches/racket-rktio-bin-sh.patch
@@ -1,7 +1,7 @@
-From 3574b567c486d264d680a37586436c3b5a8cb978 Mon Sep 17 00:00:00 2001
+From 6a553f24439fe64fd3a2f0b5902f00590ca4241f Mon Sep 17 00:00:00 2001
From: Philip McGrath <philip@philipmcgrath.com>
Date: Thu, 4 Mar 2021 04:11:50 -0500
-Subject: [PATCH] patch rktio_process for "/bin/sh" on Guix
+Subject: [PATCH] rktio: patch rktio_process for "/bin/sh" on Guix
Racket provides the functions `system` and `process`,
which execute shell commands using `sh` (or `cmd` on Windows).
@@ -12,37 +12,38 @@ This patch adds a special case for "/bin/sh" to `rktio_process`,
the C function that implements the core of `system`, `process`,
and related Racket functions.
-Guix should enable the special case by defining the C preprocessor
-macro `GUIX_RKTIO_PATCH_BIN_SH` with the path to `sh` in the store.
If:
- 1. The `GUIX_RKTIO_PATCH_BIN_SH` macro is defined; and
+ 1. The nonstandard but ubiquitous macro `_PATH_BSHELL` from
+ <paths.h> is defined; and
2. `rktio_process` is called with the exact path "/bin/sh"; and
- 3. The path specified by `GUIX_RKTIO_PATCH_BIN_SH` does exists;
+ 3. The file specified by `_PATH_BSHELL` exists;
-then `rktio_process` will execute the file specified
-by `GUIX_RKTIO_PATCH_BIN_SH` instead of "/bin/sh".
+then `rktio_process` will execute the file specified by `_PATH_BSHELL`
+instead of "/bin/sh".
-Compared to previous attempts to patch the Racket sources,
-making this change at the C level is both:
-
- - More comprehensive: it catches all attempts to execute "/bin/sh",
- without having to track down the source of every occurance; and
-
- - Less intrusive: by guarding the special case with a C preprocessor
- conditional and a runtime check that the file in the store exists,
- we make it much less likely that it will "leak" out of Guix.
+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.
---
- racket/src/rktio/rktio_process.c | 21 ++++++++++++++++++++-
- 1 file changed, 20 insertions(+), 1 deletion(-)
+ 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 89202436c0..465ebdd5c5 100644
+index fafaf728c1..796ebc59ce 100644
--- a/racket/src/rktio/rktio_process.c
+++ b/racket/src/rktio/rktio_process.c
-@@ -1224,12 +1224,14 @@ int rktio_process_allowed_flags(rktio_t *rktio)
+@@ -9,6 +9,7 @@
+ # include <sys/wait.h>
+ # include <errno.h>
+ # include <unistd.h>
++# include <paths.h> /* PATCHED for Guix */
+ # ifdef USE_ULIMIT
+ # include <ulimit.h>
+ # endif
+@@ -1301,12 +1302,14 @@ int rktio_process_allowed_flags(rktio_t *rktio)
/*========================================================================*/
rktio_process_result_t *rktio_process(rktio_t *rktio,
@@ -58,22 +59,17 @@ index 89202436c0..465ebdd5c5 100644
rktio_process_result_t *result;
intptr_t to_subprocess[2], from_subprocess[2], err_subprocess[2];
int pid;
-@@ -1255,6 +1257,23 @@ rktio_process_result_t *rktio_process(rktio_t *rktio,
+@@ -1333,6 +1336,18 @@ rktio_process_result_t *rktio_process(rktio_t *rktio,
int i;
#endif
+/* BEGIN PATCH for Guix */
-+#if defined(GUIX_RKTIO_PATCH_BIN_SH)
-+# define GUIX_AS_a_STR_HELPER(x) #x
-+# define GUIX_AS_a_STR(x) GUIX_AS_a_STR_HELPER(x)
-+ /* A level of indirection makes `#` work as needed: */
++#if defined(_PATH_BSHELL)
+ command =
+ ((0 == strcmp(_guix_orig_command, "/bin/sh"))
-+ && rktio_file_exists(rktio, GUIX_AS_a_STR(GUIX_RKTIO_PATCH_BIN_SH)))
-+ ? GUIX_AS_a_STR(GUIX_RKTIO_PATCH_BIN_SH)
++ && rktio_file_exists(rktio, _PATH_BSHELL))
++ ? _PATH_BSHELL
+ : _guix_orig_command;
-+# undef GUIX_AS_a_STR
-+# undef GUIX_AS_a_STR_HELPER
+#else
+ command = _guix_orig_command;
+#endif
@@ -82,6 +78,8 @@ index 89202436c0..465ebdd5c5 100644
/* avoid compiler warnings: */
to_subprocess[0] = -1;
to_subprocess[1] = -1;
+
+base-commit: 9d228d16fb99c274c964e5bef93e97333888769f
--
-2.21.1 (Apple Git-122.3)
+2.32.0
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index 3399bcc3fe..319f63f9d2 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -36,7 +36,6 @@ (define-module (gnu packages racket)
#:use-module (ice-9 match)
#:use-module (gnu packages)
#:use-module (gnu packages autotools)
- #:use-module (gnu packages bash)
#:use-module (gnu packages chez)
#:use-module (gnu packages compression)
#:use-module (gnu packages databases)
@@ -212,7 +211,7 @@ (define %racket-origin
(sha256
(base32 "0f9zyhdvbh4xsndrqjzl85j5ziz0rmqi676g9s1lw3h3skq2636h"))
(file-name (git-file-name "racket" %racket-version))
- (patches (search-patches "racket-minimal-sh-via-rktio.patch"))
+ (patches (search-patches "racket-rktio-bin-sh.patch"))
(modules '((guix build utils)))
(snippet
#~(begin
@@ -232,8 +231,7 @@ (define %racket-origin
;; Unbundle libffi.
(delete-file-recursively "racket/src/bc/foreign/libffi")))))
-(define (racket-vm-common-configure-flags)
- ;; under a lambda abstraction to avoid evaluating bash-minimal too early.
+(define racket-vm-common-configure-flags
#~`(,@(cond
((false-if-exception
(search-input-file %build-inputs "/bin/libtool"))
@@ -248,8 +246,6 @@ (define (racket-vm-common-configure-flags)
(list (string-append "--enable-racket=" racket))))
(else
'()))
- ,(string-append "CPPFLAGS=-DGUIX_RKTIO_PATCH_BIN_SH="
- #$(file-append bash-minimal "/bin/sh"))
"--disable-strip"
;; Using --enable-origtree lets us distinguish the VM from subsequent
;; layers and produces a build with the shape expected by tools such as
@@ -267,7 +263,6 @@ (define-public racket-vm-cgc
(version %racket-version)
(source %racket-origin)
(inputs (list ncurses ;; <- common to all variants (for #%terminal)
- bash-minimal ;; <- common to all variants (for `system`)
libffi)) ;; <- only for BC variants
(native-inputs (list libtool)) ;; <- only for BC variants
(outputs '("out" "debug"))
@@ -276,7 +271,7 @@ (define-public racket-vm-cgc
(list
#:configure-flags
#~(cons "--enable-cgcdefault"
- #$(racket-vm-common-configure-flags))
+ #$racket-vm-common-configure-flags)
;; Tests are in packages like racket-test-core and
;; main-distribution-test that aren't part of the main
;; distribution.
@@ -359,7 +354,7 @@ (define-public racket-vm-bc
(substitute-keyword-arguments (package-arguments racket-vm-cgc)
((#:configure-flags _ '())
#~(cons "--enable-bconly"
- #$(racket-vm-common-configure-flags)))))
+ #$racket-vm-common-configure-flags))))
(synopsis "Racket BC [3M] implementation")
(description "The Racket BC (``before Chez'' or ``bytecode'')
implementation was the default before Racket 8.0. It uses a compiler written
@@ -405,7 +400,7 @@ (define-public racket-vm-cs
#$(this-package-native-input
"chez-scheme-for-racket")
"/bin/scheme")
- #$(racket-vm-common-configure-flags)))))
+ #$racket-vm-common-configure-flags))))
(synopsis "Racket CS implementation")
(description "The Racket CS implementation, which uses ``Chez Scheme'' as
its core compiler and runtime system, has been the default Racket VM
--
2.32.0
P
P
Philip McGrath wrote on 25 Aug 2022 10:54
[PATCH v3 06/14] gnu: chez-scheme: Fix use of "/bin/sh".
(address . 57050@debbugs.gnu.org)
109112fc6b4d2b21f5a322a266d51194a00ea2de.1661416343.git.philip@philipmcgrath.com
The unsuccessful attempt to execute "/bin/sh" by Chez Scheme's 'process'
function seems to have caused parts of the Chez Scheme test suite to
have been silently skipped. The issue was exposed by the upcoming
changes to Racket's build system.

* gnu/packages/patches/chez-scheme-bin-sh.patch,
gnu/packages/patches/racket-chez-scheme-bin-sh.patch: New patches.
* gnu/local.mk (dist_patch_DATA): Add them.
* gnu/packages/racket.scm (%racket-origin)[patches]: Update accordingly.
* gnu/packages/chez.scm (chez-scheme)[origin]<patches>: Likewise.
---
gnu/local.mk | 2 +
gnu/packages/chez.scm | 1 +
gnu/packages/patches/chez-scheme-bin-sh.patch | 76 +++++++++++++++++++
.../patches/racket-chez-scheme-bin-sh.patch | 76 +++++++++++++++++++
gnu/packages/racket.scm | 3 +-
5 files changed, 157 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/patches/chez-scheme-bin-sh.patch
create mode 100644 gnu/packages/patches/racket-chez-scheme-bin-sh.patch

Toggle diff (212 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index fae32a11e5..babd54c8c6 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -941,6 +941,7 @@ dist_patch_DATA = \
%D%/packages/patches/ceph-boost-compat.patch \
%D%/packages/patches/ceph-rocksdb-compat.patch \
%D%/packages/patches/cheese-vala-update.patch \
+ %D%/packages/patches/chez-scheme-bin-sh.patch \
%D%/packages/patches/chmlib-inttypes.patch \
%D%/packages/patches/cl-asdf-config-directories.patch \
%D%/packages/patches/clamav-config-llvm-libs.patch \
@@ -1768,6 +1769,7 @@ dist_patch_DATA = \
%D%/packages/patches/ripperx-missing-file.patch \
%D%/packages/patches/rpcbind-CVE-2017-8779.patch \
%D%/packages/patches/rtags-separate-rct.patch \
+ %D%/packages/patches/racket-chez-scheme-bin-sh.patch \
%D%/packages/patches/racket-rktio-bin-sh.patch \
%D%/packages/patches/remake-impure-dirs.patch \
%D%/packages/patches/restic-0.9.6-fix-tests-for-go1.15.patch \
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 812d41fc5b..c627c4d842 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -269,6 +269,7 @@ (define-public chez-scheme
(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
diff --git a/gnu/packages/patches/chez-scheme-bin-sh.patch b/gnu/packages/patches/chez-scheme-bin-sh.patch
new file mode 100644
index 0000000000..7650914f01
--- /dev/null
+++ b/gnu/packages/patches/chez-scheme-bin-sh.patch
@@ -0,0 +1,76 @@
+From 3c838e6a0c3214d95bf02048cddccfd1b69a679f Mon Sep 17 00:00:00 2001
+From: Philip McGrath <philip@philipmcgrath.com>
+Date: Thu, 19 May 2022 13:41:56 -0400
+Subject: [PATCH] patch s_process for "/bin/sh" on Guix
+
+If:
+
+ 1. The nonstandard but ubiquitous macro `_PATH_BSHELL` from
+ <paths.h> is defined; and
+
+ 2. The path specified by `_PATH_BSHELL` exists;
+
+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.
+
+This patch does not change the behavior of `s_system`, which relies
+on `system` from the C library.
+---
+ c/prim5.c | 21 ++++++++++++++++++++-
+ 1 file changed, 20 insertions(+), 1 deletion(-)
+
+diff --git a/c/prim5.c b/c/prim5.c
+index 5a07893..bc2736c 100644
+--- a/c/prim5.c
++++ b/c/prim5.c
+@@ -23,6 +23,12 @@
+ #include <ctype.h>
+ #include <math.h>
+
++/* BEGIN PATCH for Guix */
++#ifndef WIN32
++# include <paths.h>
++#endif
++/* END PATCH for Guix */
++
+ /* locally defined functions */
+ static INT s_errno(void);
+ static iptr s_addr_in_heap(uptr x);
+@@ -746,6 +752,17 @@ static ptr s_process(char *s, IBOOL stderrp) {
+
+ INT tofds[2], fromfds[2], errfds[2];
+ struct sigaction act, oint_act;
++ /* BEGIN PATCH for Guix */
++#if defined(_PATH_BSHELL)
++ struct stat guix_stat_buf;
++ char *guix_sh =
++ (0 == stat(_PATH_BSHELL, &guix_stat_buf))
++ ? _PATH_BSHELL
++ : "/bin/sh";
++#else /* _PATH_BSHELL */
++ char *guix_sh = "/bin/sh";
++#endif
++ /* END PATCH for Guix */
+
+ if (pipe(tofds)) S_error("process","cannot open pipes");
+ if (pipe(fromfds)) {
+@@ -771,7 +788,9 @@ static ptr s_process(char *s, IBOOL stderrp) {
+ CLOSE(1); if (dup(fromfds[1]) != 1) _exit(1);
+ CLOSE(2); if (dup(stderrp ? errfds[1] : 1) != 2) _exit(1);
+ {INT i; for (i = 3; i < NOFILE; i++) (void)CLOSE(i);}
+- execl("/bin/sh", "/bin/sh", "-c", s, NULL);
++ /* BEGIN PATCH for Guix */
++ execl(guix_sh, guix_sh, "-c", s, NULL);
++ /* END PATCH for Guix */
+ _exit(1) /* only if execl fails */;
+ /*NOTREACHED*/
+ } else {
+
+base-commit: 9df56e7b25bc523663eac3da24be33afc5f76c84
+--
+2.32.0
+
diff --git a/gnu/packages/patches/racket-chez-scheme-bin-sh.patch b/gnu/packages/patches/racket-chez-scheme-bin-sh.patch
new file mode 100644
index 0000000000..65cf2f99f3
--- /dev/null
+++ b/gnu/packages/patches/racket-chez-scheme-bin-sh.patch
@@ -0,0 +1,76 @@
+From e982b6687494bf071386c67be74e57a29cf4ce00 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
+
+If:
+
+ 1. The nonstandard but ubiquitous macro `_PATH_BSHELL` from
+ <paths.h> is defined; and
+
+ 2. The path specified by `_PATH_BSHELL` exists;
+
+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.
+
+This patch does not change the behavior of `s_system`, which relies
+on `system` from the C library.
+---
+ 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 f5e3e345be..922421ca75 100644
+--- a/racket/src/ChezScheme/c/prim5.c
++++ b/racket/src/ChezScheme/c/prim5.c
+@@ -22,6 +22,12 @@
+ #include <limits.h>
+ #include <ctype.h>
+
++/* BEGIN PATCH for Guix */
++#ifndef WIN32
++# include <paths.h>
++#endif
++/* END PATCH for Guix */
++
+ /* locally defined functions */
+ static INT s_errno PROTO((void));
+ static IBOOL s_addr_in_heap PROTO((uptr x));
+@@ -856,6 +862,17 @@ static ptr s_process(s, stderrp) char *s; IBOOL stderrp; {
+
+ INT tofds[2], fromfds[2], errfds[2];
+ struct sigaction act, oint_act;
++ /* BEGIN PATCH for Guix */
++#if defined(_PATH_BSHELL)
++ struct stat guix_stat_buf;
++ char *guix_sh =
++ (0 == stat(_PATH_BSHELL, &guix_stat_buf))
++ ? _PATH_BSHELL
++ : "/bin/sh";
++#else /* _PATH_BSHELL */
++ char *guix_sh = "/bin/sh";
++#endif
++ /* END PATCH for Guix */
+
+ if (pipe(tofds)) S_error("process","cannot open pipes");
+ if (pipe(fromfds)) {
+@@ -881,7 +898,9 @@ static ptr s_process(s, stderrp) char *s; IBOOL stderrp; {
+ CLOSE(1); if (dup(fromfds[1]) != 1) _exit(1);
+ CLOSE(2); if (dup(stderrp ? errfds[1] : 1) != 2) _exit(1);
+ {INT i; for (i = 3; i < NOFILE; i++) (void)CLOSE(i);}
+- execl("/bin/sh", "/bin/sh", "-c", s, NULL);
++ /* BEGIN PATCH for Guix */
++ execl(guix_sh, guix_sh, "-c", s, NULL);
++ /* END PATCH for Guix */
+ _exit(1) /* only if execl fails */;
+ /*NOTREACHED*/
+ } else {
+
+base-commit: 9d228d16fb99c274c964e5bef93e97333888769f
+--
+2.32.0
+
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index 319f63f9d2..0f766e7850 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -211,7 +211,8 @@ (define %racket-origin
(sha256
(base32 "0f9zyhdvbh4xsndrqjzl85j5ziz0rmqi676g9s1lw3h3skq2636h"))
(file-name (git-file-name "racket" %racket-version))
- (patches (search-patches "racket-rktio-bin-sh.patch"))
+ (patches (search-patches "racket-chez-scheme-bin-sh.patch"
+ "racket-rktio-bin-sh.patch"))
(modules '((guix build utils)))
(snippet
#~(begin
--
2.32.0
P
P
Philip McGrath wrote on 25 Aug 2022 10:54
[PATCH v3 07/14] gnu: Add Zuo.
(address . 57050@debbugs.gnu.org)
3231fd55699bd60448e5aaa3ca8ddf9fbea085c6.1661416343.git.philip@philipmcgrath.com
* gnu/packages/patches/racket-backport-8.6-zuo.patch,
gnu/packages/patches/racket-zuo-bin-sh.patch: New patches.
* gnu/local.mk (dist_patch_DATA): Add them.
* gnu/packages/racket.scm (%zuo-version): New variable.
(zuo): New variable.
---
gnu/local.mk | 2 +
.../patches/racket-backport-8.6-zuo.patch | 481 ++++++++++++++++++
gnu/packages/patches/racket-zuo-bin-sh.patch | 74 +++
gnu/packages/racket.scm | 51 ++
4 files changed, 608 insertions(+)
create mode 100644 gnu/packages/patches/racket-backport-8.6-zuo.patch
create mode 100644 gnu/packages/patches/racket-zuo-bin-sh.patch

Toggle diff (555 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index babd54c8c6..c9c3061b33 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1769,8 +1769,10 @@ dist_patch_DATA = \
%D%/packages/patches/ripperx-missing-file.patch \
%D%/packages/patches/rpcbind-CVE-2017-8779.patch \
%D%/packages/patches/rtags-separate-rct.patch \
+ %D%/packages/patches/racket-backport-8.6-zuo.patch \
%D%/packages/patches/racket-chez-scheme-bin-sh.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/restic-0.9.6-fix-tests-for-go1.15.patch \
%D%/packages/patches/retroarch-LIBRETRO_DIRECTORY.patch \
diff --git a/gnu/packages/patches/racket-backport-8.6-zuo.patch b/gnu/packages/patches/racket-backport-8.6-zuo.patch
new file mode 100644
index 0000000000..b86679b7ec
--- /dev/null
+++ b/gnu/packages/patches/racket-backport-8.6-zuo.patch
@@ -0,0 +1,481 @@
+From 8761fc06b188b9ca2f4b7f2b7d1235075c44a321 Mon Sep 17 00:00:00 2001
+From: Matthew Flatt <mflatt@racket-lang.org>
+Date: Sat, 23 Jul 2022 17:10:58 -0600
+Subject: [PATCH 1/4] Zuo: support cross compilation via `configure` and
+ `CC_FOR_BUILD`
+
+(cherry picked from commit 798a989ba6d1a30c491a3120b2c2f1570ecab911)
+---
+ racket/src/zuo/Makefile.in | 7 ++++++-
+ racket/src/zuo/README.md | 10 ++++++++++
+ racket/src/zuo/configure | 15 +++++++++++++++
+ racket/src/zuo/configure.ac | 11 +++++++++++
+ 4 files changed, 42 insertions(+), 1 deletion(-)
+
+diff --git a/racket/src/zuo/Makefile.in b/racket/src/zuo/Makefile.in
+index 5d16e145bf..747b584c5c 100644
+--- a/racket/src/zuo/Makefile.in
++++ b/racket/src/zuo/Makefile.in
+@@ -17,6 +17,11 @@ CPPFLAGS = @CPPFLAGS@
+ LDFLAGS = @LDFLAGS@
+ LIBS = @LIBS@
+
++CC_FOR_BUILD = @CC_FOR_BUILD@
++CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
++LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
++LIBS_FOR_BUILD = @LIBS_FOR_BUILD@
++
+ EMBED_LIBS = @EMBED_LIBS@
+
+ .PHONY: zuos-to-run-and-install
+@@ -24,7 +29,7 @@ zuos-to-run-and-install: zuo
+ ./zuo . zuos-to-run-and-install
+
+ zuo: $(srcdir)/zuo.c
+- $(CC) $(CPPFLAGS) $(CFLAGS) -DZUO_LIB_PATH='"'"$(srcdir)/lib"'"' -o zuo $(srcdir)/zuo.c $(LDFLAGS) $(LIBS)
++ $(CC_FOR_BUILD) $(FLAGS_FOR_BUILD) -DZUO_LIB_PATH='"'"$(srcdir)/lib"'"' -o zuo $(srcdir)/zuo.c $(LDFLAGS_FOR_BUILD) $(LIBS_FOR_BUILD)
+
+ .PHONY: check
+ check: zuo
+diff --git a/racket/src/zuo/README.md b/racket/src/zuo/README.md
+index 17c88ee9ec..3aad504b7e 100644
+--- a/racket/src/zuo/README.md
++++ b/racket/src/zuo/README.md
+@@ -84,6 +84,16 @@ A boot image is machine-independent, whether in a stand-alone file or
+ embedded in `.c` source.
+
+
++Cross Compiling
++---------------
++
++If you use `./configure --host=...` to cross compile, then you will
++also need to add something like `CC_FOR_BUILD=cc` as a `./configure`
++argument to specify the compiler for a `zuo` to use on the build
++machine. If necessary, you can also specify `CFLAGS_FOR_BUILD`,
++`LDFLAGS_FOR_BUILD`, and/or `LIBS_FOR_BUILD`.
++
++
+ Embedding Zuo in Another Application
+ ------------------------------------
+
+diff --git a/racket/src/zuo/configure b/racket/src/zuo/configure
+index 1fa34a3fe8..575ce07d96 100755
+--- a/racket/src/zuo/configure
++++ b/racket/src/zuo/configure
+@@ -589,6 +589,10 @@ enable_embed="zuo"
+ ac_subst_vars='LTLIBOBJS
+ LIBOBJS
+ EMBED_LIBS
++LIBS_FOR_BUILD
++LDFLAGS_FOR_BUILD
++CFLAGS_FOR_BUILD
++CC_FOR_BUILD
+ OBJEXT
+ EXEEXT
+ ac_ct_CC
+@@ -2584,6 +2588,17 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
+ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
++if test "${CC_FOR_BUILD}" = ""; then
++ CC_FOR_BUILD='$(CC) -O2'
++ CFLAGS_FOR_BUILD='$(CPPFLAGS) $(CFLAGS)'
++ LDFLAGS_FOR_BUILD='$(LDFLAGS)'
++ LIBS_FOR_BUILD='$(LIBS)'
++fi
++
++
++
++
++
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: zuo libraries to embed: \"${EMBED_LIBS}\"" >&5
+ $as_echo "$as_me: zuo libraries to embed: \"${EMBED_LIBS}\"" >&6;}
+diff --git a/racket/src/zuo/configure.ac b/racket/src/zuo/configure.ac
+index 89b3c6391d..598ff79629 100644
+--- a/racket/src/zuo/configure.ac
++++ b/racket/src/zuo/configure.ac
+@@ -25,6 +25,17 @@ AS_IF([test "x$enable_embed" = xno],
+ AC_PROG_MAKE_SET()
+ AC_PROG_CC
+
++if test "${CC_FOR_BUILD}" = ""; then
++ CC_FOR_BUILD='$(CC) -O2'
++ CFLAGS_FOR_BUILD='$(CPPFLAGS) $(CFLAGS)'
++ LDFLAGS_FOR_BUILD='$(LDFLAGS)'
++ LIBS_FOR_BUILD='$(LIBS)'
++fi
++AC_SUBST(CC_FOR_BUILD)
++AC_SUBST(CFLAGS_FOR_BUILD)
++AC_SUBST(LDFLAGS_FOR_BUILD)
++AC_SUBST(LIBS_FOR_BUILD)
++
+ AC_SUBST(EMBED_LIBS)
+ AC_MSG_NOTICE([zuo libraries to embed: "${EMBED_LIBS}"])
+
+--
+2.32.0
+
+
+From f65194ea41eb472fbdd45d5f6c13eabe5e681704 Mon Sep 17 00:00:00 2001
+From: Matthew Flatt <mflatt@racket-lang.org>
+Date: Sat, 23 Jul 2022 17:47:03 -0600
+Subject: [PATCH 2/4] Zuo: sort hash keys
+
+Printing in a sorted order is helpful to make things more
+deterministic independent of symbol inputs. Making `hash-keys`
+produce a sorted list generalizes that determinism.
+
+(cherry picked from commit 4e7ffd3b365d01c5d0993c0b3fd24c9623962edf)
+---
+ racket/src/zuo/build.zuo | 5 ++-
+ racket/src/zuo/tests/hash.zuo | 8 ++--
+ racket/src/zuo/zuo-doc/lang-zuo.scrbl | 18 +++++++--
+ racket/src/zuo/zuo.c | 57 ++++++++++++++++++++++++++-
+ 4 files changed, 78 insertions(+), 10 deletions(-)
+
+diff --git a/racket/src/zuo/build.zuo b/racket/src/zuo/build.zuo
+index c1b5e8ce66..129240120a 100644
+--- a/racket/src/zuo/build.zuo
++++ b/racket/src/zuo/build.zuo
+@@ -47,7 +47,10 @@
+ (target (at-dir (add-exe name))
+ (lambda (path token)
+ (rule (list image_zuo.c
+- (input-data-target 'config config)
++ (input-data-target 'config (cons
++ lib-path
++ (map (lambda (key) (hash-ref config key))
++ '(CC CPPFLAGS CFLAGS LDFLAGS LIBS))))
+ (quote-module-path))
+ (lambda ()
+ (define l (split-path path))
+diff --git a/racket/src/zuo/tests/hash.zuo b/racket/src/zuo/tests/hash.zuo
+index a35741c730..0d3d7f3af6 100644
+--- a/racket/src/zuo/tests/hash.zuo
++++ b/racket/src/zuo/tests/hash.zuo
+@@ -35,9 +35,7 @@
+
+ (check (hash-keys (hash)) '())
+ (check (hash-keys (hash 'a 1)) '(a))
+-(check (let ([keys (hash-keys (hash 'a 1 'b 2))])
+- (or (equal? keys '(a b))
+- (equal? keys '(b a)))))
++(check (hash-keys (hash 'a 1 'b 2)) '(a b)) ; always in order
+ (check (length (hash-keys (hash 'a 1 'b 2 'c 3))) 3)
+ (check (length (hash-keys (hash 'a 1 'b 2 'a 3))) 2)
+ (check-arg-fail (hash-keys 0) "not a hash table")
+@@ -50,3 +48,7 @@
+ (check (hash-keys-subset? (hash 'a 1 'b 2) (hash 'b 1)) #f)
+ (check-arg-fail (hash-keys-subset? 0 (hash)) "not a hash table")
+ (check-arg-fail (hash-keys-subset? (hash) 0) "not a hash table")
++
++;; print sorts keys alphabetically:
++(check (~a (hash 'a 1 'b 2)) "#hash((a . 1) (b . 2))")
++(check (~a (hash 'b 2 'a 1)) "#hash((a . 1) (b . 2))")
+diff --git a/racket/src/zuo/zuo-doc/lang-zuo.scrbl b/racket/src/zuo/zuo-doc/lang-zuo.scrbl
+index 94641d041e..4605e47471 100644
+--- a/racket/src/zuo/zuo-doc/lang-zuo.scrbl
++++ b/racket/src/zuo/zuo-doc/lang-zuo.scrbl
+@@ -538,10 +538,20 @@ support to convert the textual form back into a hash table value.
+
+ Analogous to @realracket*[hash? hash hash-ref hash-set hash-remove
+ hash-keys hash-count hash-keys-subset?] from @racketmodname[racket].
+-Besides being constrained to symbol keys, there is one additional
+-difference: the third argument to @racket[hash-ref], when supplied,
+-is always used as a value to return if a key is missing, as
+-opposed to a failure thunk.}
++
++Besides being constrained to symbol keys, there are two additional
++differences:
++
++@itemlist[
++
++ @item{the third argument to @racket[hash-ref], when supplied, is
++ always used as a value to return if a key is missing, as
++ opposed to a failure thunk; and}
++
++ @item{the @racket[hash-keys] function returns interned keys sorted
++ alphabetically.}
++
++]}
+
+
+ @section{Procedures}
+diff --git a/racket/src/zuo/zuo.c b/racket/src/zuo/zuo.c
+index 2957d478af..88d5747326 100644
+--- a/racket/src/zuo/zuo.c
++++ b/racket/src/zuo/zuo.c
+@@ -1298,6 +1298,59 @@ static zuo_t *zuo_trie_keys(zuo_t *trie_in, zuo_t *accum) {
+ return accum;
+ }
+
++/*======================================================================*/
++/* symbol-list sorting */
++/*======================================================================*/
++
++/* merge sort used to make hash printing deterministic */
++static zuo_t *zuo_symbol_list_sort(zuo_t *l_in) {
++ zuo_t *l, *left, *right, *first, *last;
++ zuo_uint_t len = 0, i;
++
++ for (l = l_in, len = 0; l != z.o_null; l = _zuo_cdr(l))
++ len++;
++
++ if (len < 2)
++ return l_in;
++
++ left = z.o_null;
++ for (l = l_in, i = len >> 1; i > 0; l = _zuo_cdr(l), i--)
++ left = zuo_cons(_zuo_car(l), left);
++ right = l;
++
++ left = zuo_symbol_list_sort(left);
++ right = zuo_symbol_list_sort(right);
++
++ first = last = z.o_null;
++ while ((left != z.o_null) && (right != z.o_null)) {
++ zuo_t *p;
++
++ if (strcmp(ZUO_STRING_PTR(((zuo_symbol_t *)_zuo_car(left))->str),
++ ZUO_STRING_PTR(((zuo_symbol_t *)_zuo_car(right))->str))
++ < 1) {
++ p = zuo_cons(_zuo_car(left), z.o_null);
++ left = _zuo_cdr(left);
++ } else {
++ p = zuo_cons(_zuo_car(right), z.o_null);
++ right = _zuo_cdr(right);
++ }
++
++ if (first == z.o_null)
++ first = p;
++ else
++ ((zuo_pair_t *)last)->cdr = p;
++ last = p;
++ }
++
++ ((zuo_pair_t *)last)->cdr = ((left != z.o_null) ? left : right);
++
++ return first;
++}
++
++static zuo_t *zuo_trie_sorted_keys(zuo_t *trie_in, zuo_t *accum) {
++ return zuo_symbol_list_sort(zuo_trie_keys(trie_in, accum));
++}
++
+ /*======================================================================*/
+ /* terminal support */
+ /*======================================================================*/
+@@ -1571,7 +1624,7 @@ static void zuo_out(zuo_out_t *out, zuo_t *obj, zuo_print_mode_t mode) {
+ out_string(out, "opaque");
+ out_string(out, ">");
+ } else if (obj->tag == zuo_trie_node_tag) {
+- zuo_t *keys = zuo_trie_keys(obj, z.o_null);
++ zuo_t *keys = zuo_trie_sorted_keys(obj, z.o_null);
+ if (mode == zuo_print_mode) {
+ out_string(out, "(hash");
+ if (keys != z.o_null)
+@@ -2587,7 +2640,7 @@ static zuo_t *zuo_hash_remove(zuo_t *ht, zuo_t *sym) {
+
+ static zuo_t *zuo_hash_keys(zuo_t *ht) {
+ check_hash("hash-keys", ht);
+- return zuo_trie_keys(ht, z.o_null);
++ return zuo_trie_sorted_keys(ht, z.o_null);
+ }
+
+ static zuo_t *zuo_hash_keys_subset_p(zuo_t *ht, zuo_t *ht2) {
+--
+2.32.0
+
+
+From f2eecaa1dd875479d2cf51566223b3d0d7b9f738 Mon Sep 17 00:00:00 2001
+From: Matthew Flatt <mflatt@racket-lang.org>
+Date: Sat, 23 Jul 2022 18:06:41 -0600
+Subject: [PATCH 3/4] Zuo: check for nul characters in `string->symbol`
+
+(cherry picked from commit e20022ccfad40d0ba2e77aa75bc4f775018c781f)
+---
+ racket/src/zuo/tests/symbol.zuo | 3 +++
+ racket/src/zuo/zuo-doc/lang-zuo.scrbl | 4 ++-
+ racket/src/zuo/zuo.c | 37 +++++++++++++++++----------
+ 3 files changed, 29 insertions(+), 15 deletions(-)
+
+diff --git a/racket/src/zuo/tests/symbol.zuo b/racket/src/zuo/tests/symbol.zuo
+index 7775aeeb04..5600a89755 100644
+--- a/racket/src/zuo/tests/symbol.zuo
++++ b/racket/src/zuo/tests/symbol.zuo
+@@ -19,3 +19,6 @@
+ (check (not (equal? 'apple (string->uninterned-symbol "apple"))))
+ (check-arg-fail (string->symbol 'apple) not-string)
+ (check-arg-fail (string->uninterned-symbol 'apple) not-string)
++
++(check-arg-fail (string->symbol "apple\0spice") "without a nul character")
++(check (symbol? (string->uninterned-symbol "apple\0spice")))
+diff --git a/racket/src/zuo/zuo-doc/lang-zuo.scrbl b/racket/src/zuo/zuo-doc/lang-zuo.scrbl
+index 4605e47471..07dd5815b0 100644
+--- a/racket/src/zuo/zuo-doc/lang-zuo.scrbl
++++ b/racket/src/zuo/zuo-doc/lang-zuo.scrbl
+@@ -500,7 +500,9 @@ back into Zuo.
+ )]{
+
+ Analogous to @realracket*[symbol? symbol->string string->symbol
+-string->uninterned-symbol] from @racketmodname[racket].}
++string->uninterned-symbol] from @racketmodname[racket], but
++@racket[string->symbol] accepts only strings that do not contain the
++null character.}
+
+
+ @section{Hash Tables (Persistent Maps)}
+diff --git a/racket/src/zuo/zuo.c b/racket/src/zuo/zuo.c
+index 88d5747326..17f161826d 100644
+--- a/racket/src/zuo/zuo.c
++++ b/racket/src/zuo/zuo.c
+@@ -1323,7 +1323,7 @@ static zuo_t *zuo_symbol_list_sort(zuo_t *l_in) {
+
+ first = last = z.o_null;
+ while ((left != z.o_null) && (right != z.o_null)) {
+- zuo_t *p;
++ zuo_t *p, *s_left, *s_right;
+
+ if (strcmp(ZUO_STRING_PTR(((zuo_symbol_t *)_zuo_car(left))->str),
+ ZUO_STRING_PTR(((zuo_symbol_t *)_zuo_car(right))->str))
+@@ -2573,8 +2573,28 @@ static zuo_t *zuo_substring(zuo_t *obj, zuo_t *start_i, zuo_t *end_i) {
+ return zuo_sized_string((const char *)&((zuo_string_t *)obj)->s[s_idx], e_idx - s_idx);
+ }
+
++static int zuo_is_string_without_nul(zuo_t *obj) {
++ zuo_int_t i;
++
++ if ((obj->tag != zuo_string_tag)
++ || ZUO_STRING_LEN(obj) == 0)
++ return 0;
++
++ for (i = ZUO_STRING_LEN(obj); i--; ) {
++ if (((zuo_string_t *)obj)->s[i] == 0)
++ return 0;
++ }
++
++ return 1;
++}
++
+ static zuo_t *zuo_string_to_symbol(zuo_t *obj) {
+- check_string("string->symbol", obj);
++ if (!zuo_is_string_without_nul(obj)) {
++ const char *who = "string->symbol";
++ check_string(who, obj);
++ zuo_fail_arg(who, "string without a nul character", obj);
++ }
++
+ return zuo_symbol_from_string(ZUO_STRING_PTR(obj), obj);
+ }
+
+@@ -3577,18 +3597,7 @@ static void *zuo_envvars_block(const char *who, zuo_t *envvars)
+ #endif
+
+ static int zuo_is_path_string(zuo_t *obj) {
+- zuo_int_t i;
+-
+- if ((obj->tag != zuo_string_tag)
+- || ZUO_STRING_LEN(obj) == 0)
+- return 0;
+-
+- for (i = ZUO_STRING_LEN(obj); i--; ) {
+- if (((zuo_string_t *)obj)->s[i] == 0)
+- return 0;
+- }
+-
+- return 1;
++ return zuo_is_string_without_nul(obj);
+ }
+
+ static zuo_t *zuo_path_string_p(zuo_t *obj) {
+--
+2.32.0
+
+
+From de6618cb3819d25580e3cd400ea09c8cf4f673a9 Mon Sep 17 00:00:00 2001
+From: Matthew Flatt <mflatt@racket-lang.org>
+Date: Sat, 23 Jul 2022 19:50:46 -0600
+Subject: [PATCH 4/4] Zuo: CPPFLAGS_FOR_BUILD, too
+
+(cherry picked from commit cf82706c4b298f654a04c4bc8d98dff39b62a2ac)
+---
+ racket/src/zuo/Makefile.in | 3 ++-
+ racket/src/zuo/configure | 5 ++++-
+ racket/src/zuo/configure.ac | 4 +++-
+ 3 files changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/racket/src/zuo/Makefile.in b/racket/src/zuo/Makefile.in
+index 747b584c5c..0376c038a8 100644
+--- a/racket/src/zuo/Makefile.in
++++ b/racket/src/zuo/Makefile.in
+@@ -19,6 +19,7 @@ LIBS = @LIBS@
+
+ CC_FOR_BUILD = @CC_FOR_BUILD@
+ CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
++CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@
+ LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
+ LIBS_FOR_BUILD = @LIBS_FOR_BUILD@
+
+@@ -29,7 +30,7 @@ zuos-to-run-and-install: zuo
+ ./zuo . zuos-to-run-and-install
+
+ zuo: $(srcdir)/zuo.c
+- $(CC_FOR_BUILD) $(FLAGS_FOR_BUILD) -DZUO_LIB_PATH='"'"$(srcdir)/lib"'"' -o zuo $(srcdir)/zuo.c $(LDFLAGS_FOR_BUILD) $(LIBS_FOR_BUILD)
++ $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) -DZUO_LIB_PATH='"'"$(srcdir)/lib"'"' -o zuo $(srcdir)/zuo.c $(LDFLAGS_FOR_BUILD) $(LIBS_FOR_BUILD)
+
+ .PHONY: check
+ check: zuo
+diff --git a/racket/src/zuo/configure b/racket/src/zuo/configure
+index 575ce07d96..7ac453e3bc 100755
+--- a/racket/src/zuo/configure
++++ b/racket/src/zuo/configure
+@@ -591,6 +591,7 @@ LIBOBJS
+ EMBED_LIBS
+ LIBS_FOR_BUILD
+ LDFLAGS_FOR_BUILD
++CPPFLAGS_FOR_BUILD
+ CFLAGS_FOR_BUILD
+ CC_FOR_BUILD
+ OBJEXT
+@@ -2590,7 +2591,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ if test "${CC_FOR_BUILD}" = ""; then
+ CC_FOR_BUILD='$(CC) -O2'
+- CFLAGS_FOR_BUILD='$(CPPFLAGS) $(CFLAGS)'
++ CPPFLAGS_FOR_BUILD='$(CPPFLAGS)'
++ CFLAGS_FOR_BUILD='$(CFLAGS)'
+ LDFLAGS_FOR_BUILD='$(LDFLAGS)'
+ LIBS_FOR_BUILD='$(LIBS)'
+ fi
+@@ -2600,6 +2602,7 @@ fi
+
+
+
++
+ { $as_echo "$as_me:${as_lineno-$LINENO}: zuo libraries to embed: \"${EMBED_LIBS}\"" >&5
+ $as_echo "$as_me: zuo libraries to embed: \"${EMBED_LIBS}\"" >&6;}
+
+diff --git a/racket/src/zuo/configure.ac b/racket/src/zuo/configure.ac
+index 598ff79629..051ea0beb5 100644
+--- a/racket/src/zuo/configure.ac
++++ b/racket/src/zuo/configure.ac
+@@ -27,12 +27,14 @@ AC_PROG_CC
+
+ if test "${CC_FOR_BUILD}" = ""; then
+ CC_FOR_BUILD='$(CC) -O2'
+- CFLAGS_FOR_BUILD='$(CPPFLAGS) $(CFLAGS)'
++ CPPFLAGS_FOR_BUILD='$(CPPFLAGS)'
++ CFLAGS_FOR_BUILD='$(CFLAGS)'
+ LDFLAGS_FOR_BUILD='$(LDFLAGS)'
+ LIBS_FOR_BUILD='$(LIBS)'
+ fi
+ AC_SUBST(CC_FOR_BUILD)
+ AC_SUBST(CFLAGS_FOR_BUILD)
++AC_SUBST(CPPFLAGS_FOR_BUILD)
+ AC_SUBST(LDFLAGS_FOR_BUILD)
+ AC_SUBST(LIBS_FOR_BUILD)
+
+--
+2.32.0
+
diff --git a/gnu/packages/patches/racket-zuo-bin-sh.patch b/gnu/packages/patches/racket-zuo-bin-sh.patch
new file mode 100644
index 0000000000..bcdcb8e963
--- /dev/null
+++ b/gnu/packages/patches/racket-zuo-bin-sh.patch
@@ -0,0 +1,74 @@
+From 73d9b77a11b4516905caf579abb559736f715ea6 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
+
+If:
+
+ 1. The nonstandard but ubiquitous macro `_PATH_BSHELL` from
+ <paths.h> is defined; and
+
+ 2. `zuo_process` is called with the exact path "/bin/sh"; and
+
+ 3. The path specified by `_PATH_BSHELL` exists;
+
+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.
+---
+ racket/src/zuo/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 @@
+ #include <string.h>
+ #include <ctype.h>
+ #ifdef ZUO_UNIX
++# include <paths.h> /* PATCHED for Guix */
+ # 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)
+ zuo_t *zuo_process(zuo_t *command_and_args)
+ {
+ const char *who = "process";
+- zuo_t *command = _zuo_car(command_and_args);
++ /* BEGIN PATCH for Guix */
++ zuo_t *_guix_orig_command = _zuo_car(command_and_args);
++ zuo_t *command;
++ /* END PATCH for Guix */
+ zuo_t *args = _zuo_cdr(command_and_args), *rev_args = z.o_null;
+ zuo_t *options = z.o_empty_hash,
This message was truncated. Download the full message here.
P
P
Philip McGrath wrote on 25 Aug 2022 10:54
[PATCH v3 08/14] gnu: racket: Update to 8.6.
(address . 57050@debbugs.gnu.org)
af6cfa80c99a12bce8f204f89eda1d6af3bf8666.1661416343.git.philip@philipmcgrath.com
Also, update 'chez-scheme-for-racket' to 9.5.9.2.

* gnu/packages/patches/racket-chez-scheme-bin-sh.patch: Refresh patch.
* gnu/packages/patches/racket-backport-8.6-cross-install.patch,
gnu/packages/patches/racket-backport-8.6-docindex-write.patch,
gnu/packages/patches/racket-backport-8.6-hurd.patch: New patches.
* gnu/local.mk (dist_patch_DATA): Add them.
* gnu/packages/racket.scm (%racket-origin)[patches]: Use them and the
patches for Zuo.
(%racket-version): Update to 8.6.
(zuo)[version]: Refer to '%racket-version'.
[origin]: Use '%racket-origin'.
(racket-vm-cgc)[native-inputs]: Add 'zuo'.
[arguments]<#:make-flags>: Use 'zuo' from 'native-inputs'.
(racket)[inputs]<data, db, deinprogramm, draw, drracket, errortrace,
gui, htdp, math, option-contract, parser-tools, pict, rackunit, realm,
redex, scribble, typed-racket, string-constants, swindle, syntax-color,
web-server>: Update checksums.
* gnu/packages/chez.scm (target-chez-os): Handle Hurd and QNX.
(%chez-features-table): Likewise.
(chez-scheme-for-racket): Update to 9.5.9.2.
[native-inputs]: Add 'zuo'.
[arguments]<#:out-of-source?>: Use out-of-source build.
<#:tests?>: Skip them due to ongoing problems.
<#:configure-flags>: Add '--install-csug=' and '--installreleasenotes='.
<#:make-flags>: Use 'zuo' from 'native-inputs'. Supply 'STEXLIB=' here,
rather than in a phase.
<#:phases>: Replace 'install-docs' using new 'make' target.
---
gnu/packages/chez.scm | 52 +-
.../racket-backport-8.6-cross-install.patch | 126 ++++
.../racket-backport-8.6-docindex-write.patch | 36 ++
.../patches/racket-backport-8.6-hurd.patch | 609 ++++++++++++++++++
.../patches/racket-chez-scheme-bin-sh.patch | 26 +-
gnu/packages/racket.scm | 121 ++--
6 files changed, 893 insertions(+), 77 deletions(-)
create mode 100644 gnu/packages/patches/racket-backport-8.6-cross-install.patch
create mode 100644 gnu/packages/patches/racket-backport-8.6-docindex-write.patch
create mode 100644 gnu/packages/patches/racket-backport-8.6-hurd.patch

Toggle diff (478 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index c627c4d842..b59398578a 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -115,7 +115,7 @@ (define* (target-chez-os #:optional (system (or (%current-target-system)
((target-linux? system)
"le")
((target-hurd? system)
- #f)
+ "gnu")
((target-mingw? system)
"nt")
;; missing (guix utils) predicates
@@ -131,6 +131,8 @@ (define* (target-chez-os #:optional (system (or (%current-target-system)
;; Nix says "x86_64-solaris", but accommodate "-solaris2"
((string-contains system "solaris")
"s2")
+ ((string-suffix? "-qnx" system)
+ "qnx")
;; unknown
(else
#f)))
@@ -167,6 +169,9 @@ (define %chez-features-table
("arm32" bootstrap-bootfiles)
("arm64" . #f)
("ppc32" threads))
+ ;; Hurd
+ ("gnu"
+ ("i3" . #f))
;; FreeBSD
("fb"
("i3" threads) ;; commented out
@@ -192,6 +197,9 @@ (define %chez-features-table
("s2"
("i3" threads) ;; commented out
("a6" threads)) ;; commented out
+ ;; QNX
+ ("qnx"
+ ("i3" . #f))
;; Windows
("nt"
("i3" threads bootstrap-bootfiles)
@@ -433,7 +441,7 @@ (define-public chez-scheme-for-racket
(package
(inherit chez-scheme)
(name "chez-scheme-for-racket")
- (version "9.5.7.6")
+ (version "9.5.9.2")
;; The version should match `(scheme-fork-version-number)`.
;; See racket/src/ChezScheme/s/cmacros.ss c. line 360.
;; It will always be different than the upstream version!
@@ -444,18 +452,52 @@ (define-public chez-scheme-for-racket
(delete "libx11" "util-linux:lib")))
(native-inputs
(modify-inputs (package-native-inputs chez-scheme)
+ (prepend zuo)
(replace "chez-scheme-bootstrap-bootfiles"
chez-scheme-for-racket-bootstrap-bootfiles)))
(arguments
(substitute-keyword-arguments (package-arguments chez-scheme)
+ ((#:out-of-source? _ #f)
+ #t)
+ ((#:tests? _ #t)
+ ;; FIXME: There have been some flaky test failures. Some have been
+ ;; fixed upstream post-release but have proven non-trivial to
+ ;; backport; at least one issue remains. Re-enable tests once
+ ;; https://github.com/racket/racket/issues/4359 is fixed.
+ #f)
((#:configure-flags cfg-flags #~'())
- #~(cons* "--disable-x11"
- "--threads" ;; ok to potentially duplicate
- #$cfg-flags))
+ #~`("--disable-x11"
+ "--threads" ;; ok to potentially duplicate
+ ,@(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)
(unpack (assoc-ref those-phases 'unpack)))
(modify-phases those-phases
+ (replace 'install-docs
+ (lambda* (#:key make-flags #:allow-other-keys)
+ (apply invoke
+ "make"
+ "install-docs"
+ make-flags)))
(replace 'unpack
(lambda args
(unpack #:source #$(or (package-source this-package)
diff --git a/gnu/packages/patches/racket-backport-8.6-cross-install.patch b/gnu/packages/patches/racket-backport-8.6-cross-install.patch
new file mode 100644
index 0000000000..2c4d8924ed
--- /dev/null
+++ b/gnu/packages/patches/racket-backport-8.6-cross-install.patch
@@ -0,0 +1,126 @@
+From fbe2094f56fb81c888076c781e90fb0abbc0cc07 Mon Sep 17 00:00:00 2001
+From: Matthew Flatt <mflatt@racket-lang.org>
+Date: Sat, 30 Jul 2022 07:06:55 -0600
+Subject: [PATCH 1/2] CS makefiles: fix Unix-style install for cross
+ compilation
+
+Closes #4377
+
+(cherry picked from commit 053be470e7c5454cdf48e934f3254d2d916bbbc5)
+---
+ racket/src/cs/c/build.zuo | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/racket/src/cs/c/build.zuo b/racket/src/cs/c/build.zuo
+index 8d3950bb27..d8b74c509d 100644
+--- a/racket/src/cs/c/build.zuo
++++ b/racket/src/cs/c/build.zuo
+@@ -1016,10 +1016,9 @@
+ (define (setup)
+ (call-with-dest-racket
+ (lambda (bindir dest-racket)
+- (define copytree-racket (and cross? (config-bootstrap-racket)))
++ (define copytree-racket (and cross? (hash-ref (config-bootstrap-racket) 'racket)))
+ (maybe-copytree config dest-racket copytree-racket at-dir)
+- (run-raco-setup config dest-racket
+- (and cross? (hash-ref (config-bootstrap-racket) 'racket))
++ (run-raco-setup config dest-racket copytree-racket
+ ;; this can be redundant if it's also supplied via `SETUP_MACHINE_FLAGS`,
+ ;; but redundant should be ok:
+ (list "-MCR" (~a (at-dir "compiled") ":")
+--
+2.32.0
+
+
+From 85802f4d515e310e657928707800ad709a676e2a Mon Sep 17 00:00:00 2001
+From: Matthew Flatt <mflatt@racket-lang.org>
+Date: Mon, 15 Aug 2022 10:37:01 +0800
+Subject: [PATCH 2/2] configure: adjust cross-build assumption for a pb build
+
+Don't assume a cross build for a pb target on a platform that's only
+supported via pb.
+
+(cherry picked from commit 70e484e885637c495be5481983dae2207fdd67bb)
+
+(Edited to remove unrelated tweak to comments in
+"racket/src/expander/expand/require+provide.rkt".)
+---
+ racket/src/cs/c/configure | 15 +++++++++++----
+ racket/src/cs/c/configure.ac | 15 +++++++++++----
+ 2 files changed, 22 insertions(+), 8 deletions(-)
+
+diff --git a/racket/src/cs/c/configure b/racket/src/cs/c/configure
+index 454d79e11a..7e0fa5600d 100755
+--- a/racket/src/cs/c/configure
++++ b/racket/src/cs/c/configure
+@@ -4679,6 +4679,11 @@ case "$MACH_HOST_CPU" in
+ ;;
+ esac
+
++if test "${MACH}" = "" ; then
++ default_mach_was_empty=yes
++else
++ default_mach_was_empty=no
++fi
+
+ if test "${enable_mach}" != "" ; then
+ MACH="${enable_mach}"
+@@ -4701,13 +4706,15 @@ elif test "$MACH" = "" -o "$MACH_OS" = "" ; then
+ exit 1
+ fi
+
+-# For a pb build where Racket is supplied, force cross-build
+-# mode on the assumption that the host is not a pb build
+-# (because it should be created with default configure options)
++# For a pb build where Racket is supplied and MACH was not originally
++# empty, force cross-build mode on the assumption that the host is not
++# a pb build (because it should be created with default configure options)
+ if test "${enable_pb}" = "yes" ; then
+ if test "${enable_racket}" != "" ; then
+ if test "${enable_target}" = "" ; then
+- enable_target="${MACH}"
++ if test "${default_mach_was_empty}" = "no" ; then
++ enable_target="${MACH}"
++ fi
+ fi
+ fi
+ fi
+diff --git a/racket/src/cs/c/configure.ac b/racket/src/cs/c/configure.ac
+index 5bce979c92..734c1e8feb 100644
+--- a/racket/src/cs/c/configure.ac
++++ b/racket/src/cs/c/configure.ac
+@@ -415,6 +415,11 @@ case "$MACH_HOST_CPU" in
+ ;;
+ esac
+
++if test "${MACH}" = "" ; then
++ default_mach_was_empty=yes
++else
++ default_mach_was_empty=no
++fi
+
+ if test "${enable_mach}" != "" ; then
+ MACH="${enable_mach}"
+@@ -437,13 +442,15 @@ elif test "$MACH" = "" -o "$MACH_OS" = "" ; then
+ exit 1
+ fi
+
+-# For a pb build where Racket is supplied, force cross-build
+-# mode on the assumption that the host is not a pb build
+-# (because it should be created with default configure options)
++# For a pb build where Racket is supplied and MACH was not originally
++# empty, force cross-build mode on the assumption that the host is not
++# a pb build (because it should be created with default configure options)
+ if test "${enable_pb}" = "yes" ; then
+ if test "${enable_racket}" != "" ; then
+ if test "${enable_target}" = "" ; then
+- enable_target="${MACH}"
++ if test "${default_mach_was_empty}" = "no" ; then
++ enable_target="${MACH}"
++ fi
+ fi
+ fi
+ fi
+--
+2.32.0
+
diff --git a/gnu/packages/patches/racket-backport-8.6-docindex-write.patch b/gnu/packages/patches/racket-backport-8.6-docindex-write.patch
new file mode 100644
index 0000000000..abe1984507
--- /dev/null
+++ b/gnu/packages/patches/racket-backport-8.6-docindex-write.patch
@@ -0,0 +1,36 @@
+From 8b4d686a62fd66dedfc40ecdcf3698316993d614 Mon Sep 17 00:00:00 2001
+From: Philip McGrath <philip@philipmcgrath.com>
+Date: Sun, 17 Jul 2022 22:51:44 -0400
+Subject: [PATCH] racket-index: set write permission when copying
+ `docindex.sqlite`
+
+Fixes https://github.com/racket/racket/issues/4357
+
+(cherry picked from commit 55b6cbdca1f36a4f37bab1519c1b658717d3cad2)
+---
+ pkgs/racket-index/setup/scribble.rkt | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/pkgs/racket-index/setup/scribble.rkt b/pkgs/racket-index/setup/scribble.rkt
+index 6694f0b793..e27a8fa348 100644
+--- a/pkgs/racket-index/setup/scribble.rkt
++++ b/pkgs/racket-index/setup/scribble.rkt
+@@ -252,7 +252,14 @@
+ (unless (file-exists? db-file)
+ (define-values (base name dir?) (split-path db-file))
+ (make-directory* base)
+- (when copy-from (copy-file copy-from db-file))
++ (when copy-from
++ (copy-file copy-from db-file)
++ ;; we might not have write permissions for the previous layer:
++ ;; ensure that we do for the new file
++ (define orig-mode (file-or-directory-permissions db-file 'bits))
++ (define writeable-mode (bitwise-ior user-write-bit orig-mode))
++ (unless (= writeable-mode orig-mode)
++ (file-or-directory-permissions db-file writeable-mode)))
+ (doc-db-disconnect
+ (doc-db-file->connection db-file #t))))
+ (when (or (ormap can-build*? main-docs)
+--
+2.32.0
+
diff --git a/gnu/packages/patches/racket-backport-8.6-hurd.patch b/gnu/packages/patches/racket-backport-8.6-hurd.patch
new file mode 100644
index 0000000000..d593b01e62
--- /dev/null
+++ b/gnu/packages/patches/racket-backport-8.6-hurd.patch
@@ -0,0 +1,609 @@
+From f17b030fa2f902bb3666913d4a3cd6ba9c146d22 Mon Sep 17 00:00:00 2001
+From: Philip McGrath <philip@philipmcgrath.com>
+Date: Wed, 3 Aug 2022 03:13:03 -0400
+Subject: [PATCH 1/3] Chez Scheme: Fix build on GNU/Hurd
+
+Mostly GNU/Hurd should take the same options as GNU/Linux. One
+difference is that the Hurd does not define macros such as `PATH_MAX` or
+`NOFILE`, because it avoids imposing arbitrary limits on such resources.
+This patch provides alternatives for localized uses of those constants,
+but it accepts the pervasive use of `PATH_MAX` in finding bootfiles for
+now. See https://www.gnu.org/software/hurd/hurd/porting/guidelines.html.
+
+(cherry picked from commit 87eee6e2adb8c6bc11e60619c706fa6295096085)
+---
+ racket/src/ChezScheme/README.md | 1 +
+ racket/src/ChezScheme/c/number.c | 22 +++++++++----------
+ racket/src/ChezScheme/c/prim5.c | 35 ++++++++++++++++++++++++++++--
+ racket/src/ChezScheme/c/scheme.c | 34 +++++++++++++++++------------
+ racket/src/ChezScheme/c/version.h | 7 ++++--
+ racket/src/ChezScheme/configure | 17 ++++++++++-----
+ racket/src/ChezScheme/s/cmacros.ss | 1 +
+ racket/src/cs/c/configure | 14 ++++++++++--
+ racket/src/cs/c/configure.ac | 14 ++++++++++--
+ racket/src/cs/rumble/system.ss | 3 +++
+ 10 files changed, 109 insertions(+), 39 deletions(-)
+
+diff --git a/racket/src/ChezScheme/README.md b/racket/src/ChezScheme/README.md
+index a4a11a5eef..25231dd9bb 100644
+--- a/racket/src/ChezScheme/README.md
++++ b/racket/src/ChezScheme/README.md
+@@ -13,6 +13,7 @@ Supported platforms (bytecode interpreter may work for others):
+ * OpenBSD: x86, x86_64, ARMv6, AArch64, PowerPC32
+ * NetBSD: x86, x86_64, ARMv6, AArch64, PowerPC32
+ * Solaris: x86, x86_64
++ * GNU/Hurd: x86
+ * Android: ARMv7, AArch64
+ * iOS: AArch64
+ * WebAssembly via Emscripten (bytecode interpreter only)
+diff --git a/racket/src/ChezScheme/c/number.c b/racket/src/ChezScheme/c/number.c
+index ede38cc626..e2bce0d2d3 100644
+--- a/racket/src/ChezScheme/c/number.c
++++ b/racket/src/ChezScheme/c/number.c
+@@ -1041,15 +1041,15 @@ floating-point operations
+
+ #ifdef IEEE_DOUBLE
+ /* exponent stored + 1024, hidden bit to left of decimal point */
+-#define bias 1023
+-#define bitstoright 52
+-#define m1mask 0xf
+-#ifdef WIN32
+-#define hidden_bit 0x10000000000000
+-#else
+-#define hidden_bit 0x10000000000000ULL
+-#endif
+-#ifdef LITTLE_ENDIAN_IEEE_DOUBLE
++# define bias 1023
++# define bitstoright 52
++# define m1mask 0xf
++# ifdef WIN32
++# define hidden_bit 0x10000000000000
++# else
++# define hidden_bit 0x10000000000000ULL
++# endif
++# ifdef LITTLE_ENDIAN_IEEE_DOUBLE
+ struct dblflt {
+ UINT m4: 16;
+ UINT m3: 16;
+@@ -1058,7 +1058,7 @@ struct dblflt {
+ UINT e: 11;
+ UINT sign: 1;
+ };
+-#else
++# else
+ struct dblflt {
+ UINT sign: 1;
+ UINT e: 11;
+@@ -1067,7 +1067,7 @@ struct dblflt {
+ UINT m3: 16;
+ UINT m4: 16;
+ };
+-#endif
++# endif
+ #endif
+
+ double S_random_double(U32 m1, U32 m2, U32 m3, U32 m4, double scale) {
+diff --git a/racket/src/ChezScheme/c/prim5.c b/racket/src/ChezScheme/c/prim5.c
+index 124d1e049c..82bbf8d687 100644
+--- a/racket/src/ChezScheme/c/prim5.c
++++ b/racket/src/ChezScheme/c/prim5.c
+@@ -23,6 +23,10 @@
+ #include <ctype.h>
+ #include <math.h>
+
++#if defined(__GNU__) /* Hurd */
++#include <sys/resource.h>
++#endif
++
+ /* locally defined functions */
+ static INT s_errno(void);
+ static IBOOL s_addr_in_heap(uptr x);
+@@ -58,7 +62,7 @@ static void s_showalloc(IBOOL show_dump, const char *outfn);
+ static ptr s_system(const char *s);
+ static ptr s_process(char *s, IBOOL stderrp);
+ static I32 s_chdir(const char *inpath);
+-#ifdef GETWD
++#if defined(GETWD) || defined(__GNU__) /* Hurd */
+ static char *s_getwd(void);
+ #endif
+ static ptr s_set_code_byte(ptr p, ptr n, ptr x);
+@@ -881,7 +885,18 @@ static ptr s_process(char *s, IBOOL stderrp) {
+ CLOSE(0); if (dup(tofds[0]) != 0) _exit(1);
+ CLOSE(1); if (dup(fromfds[1]) != 1) _exit(1);
+ CLOSE(2); if (dup(stderrp ? errfds[1] : 1) != 2) _exit(1);
++#ifndef __GNU__ /* Hurd */
+ {INT i; for (i = 3; i < NOFILE; i++) (void)CLOSE(i);}
++#else /* __GNU__ Hurd: no NOFILE */
++ {
++ INT i;
++ struct rlimit rlim;
++ getrlimit(RLIMIT_NOFILE, &rlim);
++ for (i = 3; i < rlim.rlim_cur; i++) {
++ (void)CLOSE(i);
++ }
++ }
++#endif /* __GNU__ Hurd */
+ execl("/bin/sh", "/bin/sh", "-c", s, NULL);
+ _exit(1) /* only if execl fails */;
+ /*NOTREACHED*/
+@@ -927,6 +942,22 @@ static I32 s_chdir(const char *inpath) {
+ static char *s_getwd() {
+ return GETWD(TO_VOIDP(&BVIT(S_bytevector(PATH_MAX), 0)));
+ }
++#elif defined(__GNU__) /* Hurd: no PATH_MAX */
++static char *s_getwd() {
++ char *path;
++ size_t len;
++ ptr bv;
++ path = getcwd(NULL, 0);
++ if (NULL == path) {
++ return NULL;
++ } else {
++ len = strlen(path);
++ bv = S_bytevector(len);
++ memcpy(TO_VOIDP(&BVIT(bv, 0)), path, len);
++ free(path);
++ return TO_VOIDP(&BVIT(bv, 0));
++ }
++}
+ #endif /* GETWD */
+
+ static ptr s_set_code_byte(ptr p, ptr n, ptr x) {
+@@ -1817,7 +1848,7 @@ void S_prim5_init(void) {
+ Sforeign_symbol("(cs)s_rational", (void *)S_rational);
+ Sforeign_symbol("(cs)sub", (void *)S_sub);
+ Sforeign_symbol("(cs)rem", (void *)S_rem);
+-#ifdef GETWD
++#if defined(GETWD) || defined(__GNU__) /* Hurd */
+ Sforeign_symbol("(cs)s_getwd", (void *)s_getwd);
+ #endif
+ Sforeign_symbol("(cs)s_chdir", (void *)s_chdir);
+diff --git a/racket/src/ChezScheme/c/scheme.c b/racket/src/ChezScheme/c/scheme.c
+index ed5564540b..0c40e3eaf0 100644
+--- a/racket/src/ChezScheme/c/scheme.c
++++ b/racket/src/ChezScheme/c/scheme.c
+@@ -458,6 +458,12 @@ static IBOOL next_path(char *path, const char *name, const char *ext, const char
+ static const char *path_last(const char *path);
+ static char *get_defaultheapdirs(void);
+
++#ifdef PATH_MAX
++# define BOOT_PATH_MAX PATH_MAX
++#else /* hack for Hurd: better to remove the restriction */
++# define BOOT_PATH_MAX 4096
++#endif
++
+ static const char *path_last(const char *p) {
+ const char *s;
+ #ifdef WIN32
+@@ -483,7 +489,7 @@ static const char *path_last(const char *p) {
+
+ static char *get_defaultheapdirs() {
+ char *result;
+- wchar_t buf[PATH_MAX];
++ wchar_t buf[BOOT_PATH_MAX];
+ DWORD len = sizeof(buf);
+ if (ERROR_SUCCESS != RegGetValueW(HKEY_LOCAL_MACHINE, L"Software\\Chez Scheme\\csv" VERSION, L"HeapSearchPath", RRF_RT_REG_SZ, NULL, buf, &len))
+ return DEFAULT_HEAP_PATH;
+@@ -512,14 +518,14 @@ static char *get_defaultheapdirs() {
+ * leaving the full path with name affixed in path and *sp / *dsp pointing
+ * past the current entry. it returns 1 on success and 0 if at the end of
+ * the search path. path should be a pointer to an unoccupied buffer
+- * PATH_MAX characters long. either or both of sp/dsp
This message was truncated. Download the full message here.
P
P
Philip McGrath wrote on 25 Aug 2022 10:54
[PATCH v3 10/14] gnu: chez-scheme-for-racket: Support cross-compilation.
(address . 57050@debbugs.gnu.org)
b7e14db0f08011159ab05ce5804f0239772f3567.1661416343.git.philip@philipmcgrath.com
* gnu/packages/chez.scm (racket-cs-native-supported-system): Change to
return the applicable machine type instead of '#t'.
(chez-scheme-for-racket)[native-inputs]: When cross-compiling, add
'this-package'.
[arguments]<#:configure-flags>: When cross-compiling, supply '-m=' and
'--toolprefix='.
<#:phases>: Work around cross-compilation issues in 'build' and
'install-docs'.
(chez-scheme-for-racket-bootstrap-bootfiles): When cross-compiling,
use 'zuo' and 'chez-scheme-for-racket' instead of 'racket-vm-bc'.
[arguments]<#:phases>: Adapt 'build' phase for cross-compilation.
---
gnu/packages/chez.scm | 85 +++++++++++++++++++++++++++++++++++--------
1 file changed, 70 insertions(+), 15 deletions(-)

Toggle diff (145 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index c87786c091..26f653ea9d 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -235,14 +235,15 @@ (define* (racket-cs-native-supported-system? #:optional
(system
(or (%current-target-system)
(%current-system))))
- "Can Racket's variant of Chez Scheme generate native code for SYSTEM?
-Otherwise, SYSTEM can use only the ``portable bytecode'' backends."
+ "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 <>))
- #t)))
+ (string-append "t" chez-arch chez-os))))
;;
;; Chez Scheme:
@@ -453,8 +454,12 @@ (define-public chez-scheme-for-racket
(replace "chez-scheme-bootstrap-bootfiles"
chez-scheme-for-racket-bootstrap-bootfiles)))
(native-inputs
- (modify-inputs (package-native-inputs chez-scheme)
- (prepend zuo)))
+ (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)))
(arguments
(substitute-keyword-arguments (package-arguments chez-scheme)
((#:out-of-source? _ #f)
@@ -468,6 +473,15 @@ (define-public chez-scheme-for-racket
((#:configure-flags cfg-flags #~'())
#~`("--disable-x11"
"--threads" ;; ok to potentially duplicate
+ #$@(if (%current-target-system)
+ (list (string-append "-m="
+ (racket-cs-native-supported-system?)))
+ '())
+ #$@(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
@@ -490,18 +504,42 @@ (define-public chez-scheme-for-racket
#$mk-flags))
((#:phases those-phases #~%standard-phases)
#~(let* ((those-phases #$those-phases)
- (unpack (assoc-ref those-phases 'unpack)))
+ (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 make-flags #:allow-other-keys)
+ (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"
- make-flags)))
+ (if native-inputs
+ (cons (string-append
+ "Scheme="
+ (search-input-file native-inputs
+ "/bin/scheme"))
+ make-flags)
+ make-flags))))
(replace 'unpack
(lambda args
- (unpack #:source #$(or (package-source this-package)
- (package-source racket-vm-bc)))))
+ (gnu:unpack #:source #$(or (package-source this-package)
+ (package-source racket-vm-bc)))))
(add-after 'unpack 'chdir
(lambda args
(chdir "racket/src/ChezScheme"))))))))
@@ -583,8 +621,12 @@ (define-public chez-scheme-for-racket-bootstrap-bootfiles
(name "chez-scheme-for-racket-bootstrap-bootfiles")
(version (package-version chez-scheme-for-racket))
(source #f) ; avoid problematic cycle with racket.scm
- (native-inputs (list chez-nanopass-bootstrap racket-vm-bc))
- ;; TODO: cross compilation
+ (native-inputs
+ (cons* chez-nanopass-bootstrap
+ (if (%current-target-system)
+ (list zuo
+ chez-scheme-for-racket)
+ (list racket-vm-bc))))
(arguments
(substitute-keyword-arguments
(package-arguments chez-scheme-bootstrap-bootfiles)
@@ -604,9 +646,22 @@ (define-public chez-scheme-for-racket-bootstrap-bootfiles
#$unpack-nanopass+stex))
(add-before 'install 'build
(lambda* (#:key native-inputs inputs #:allow-other-keys)
- (invoke (search-input-file (or native-inputs inputs)
- "/opt/racket-vm/bin/racket")
- "rktboot/main.rkt"))))))))
+ #$(cond
+ ((%current-target-system)
+ ;; cross-compiling
+ #~(invoke
+ (search-input-file (or native-inputs inputs)
+ "/bin/zuo")
+ "makefiles/boot.zuo"
+ (search-input-file (or native-inputs inputs)
+ "/bin/scheme")
+ #$(racket-cs-native-supported-system?)))
+ (else
+ ;; bootstrapping
+ #~(invoke
+ (search-input-file (or native-inputs inputs)
+ "/opt/racket-vm/bin/racket")
+ "rktboot/main.rkt"))))))))))
(supported-systems
(package-supported-systems chez-scheme-for-racket))
(home-page "https://github.com/racket/ChezScheme")
--
2.32.0
P
P
Philip McGrath wrote on 25 Aug 2022 10:54
[PATCH v3 09/14] gnu: chez-scheme: Make bootfiles regular inputs.
(address . 57050@debbugs.gnu.org)
dc9bf655994da44305e77268c0a1a4e0a5f5ab13.1661416343.git.philip@philipmcgrath.com
* gnu/packages/chez.scm (chez-scheme)[native-inputs]: Move
'chez-scheme-bootstrap-bootfiles' to ...
[inputs]: ... this field.
[arguments]<#:phases>: Update 'unpack-bootfiles' accordingly.
(chez-scheme-for-racket)[native-inputs]: Move
'chez-scheme-for-racket-bootstrap-bootfiles' to ...
[inputs]: ... this field.
---
gnu/packages/chez.scm | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

Toggle diff (50 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index b59398578a..c87786c091 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -293,6 +293,7 @@ (define-public chez-scheme
(build-system gnu-build-system)
(inputs
(list
+ chez-scheme-bootstrap-bootfiles
`(,util-linux "lib") ;<-- libuuid
zlib
lz4
@@ -300,8 +301,7 @@ (define-public chez-scheme
;; for X11 clipboard support in expeditor:
;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
libx11))
- (native-inputs (list chez-scheme-bootstrap-bootfiles
- chez-nanopass-bootstrap
+ (native-inputs (list chez-nanopass-bootstrap
stex-bootstrap))
(native-search-paths
(list (search-path-specification
@@ -338,7 +338,7 @@ (define-public chez-scheme
(when (directory-exists? "boot")
(delete-file-recursively "boot"))
(copy-recursively
- (search-input-directory (or native-inputs inputs)
+ (search-input-directory inputs
"lib/chez-scheme-bootfiles")
"boot")))
;; NOTE: The custom Chez 'configure' script doesn't allow
@@ -449,12 +449,12 @@ (define-public chez-scheme-for-racket
(source #f) ; avoid problematic cycle with racket.scm
(inputs
(modify-inputs (package-inputs chez-scheme)
- (delete "libx11" "util-linux:lib")))
+ (delete "libx11" "util-linux:lib")
+ (replace "chez-scheme-bootstrap-bootfiles"
+ chez-scheme-for-racket-bootstrap-bootfiles)))
(native-inputs
(modify-inputs (package-native-inputs chez-scheme)
- (prepend zuo)
- (replace "chez-scheme-bootstrap-bootfiles"
- chez-scheme-for-racket-bootstrap-bootfiles)))
+ (prepend zuo)))
(arguments
(substitute-keyword-arguments (package-arguments chez-scheme)
((#:out-of-source? _ #f)
--
2.32.0
P
P
Philip McGrath wrote on 25 Aug 2022 10:54
[PATCH v3 11/14] gnu: racket: Support cross-compiling the VM packages.
(address . 57050@debbugs.gnu.org)
4b5de88c4a2cd08dd601b6adbbe7389a9c611785.1661416343.git.philip@philipmcgrath.com
Cross-compilation works for 'racket-vm-cgc', 'racket-vm-bc', and
'racket-vm-cs'. These changes are not enough to cross-compile
'racket-minimal' or 'racket': that would require building and loading
cross-compilation pluggins for 'racket-vm-cs', which will be much
easier once we can build the package 'raco-cross'.

* gnu/packages/racket.scm (racket-vm-cgc): Add 'this-package' when
cross-compiling.
(racket-vm-bc)[native-inputs]: Adjust accordingly.
(racket-vm-cs)[native-inputs]: Use 'racket-vm-cs' instead of
'racket-vm-bc' when cross-compiling. Adapt to changes to
'racket-vm-cgc'.
[arguments]<#:configure-flags>: Fix '--enable-scheme' for
cross-compilation.
---
gnu/packages/racket.scm | 31 +++++++++++++++++++++----------
1 file changed, 21 insertions(+), 10 deletions(-)

Toggle diff (65 lines)
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index efabdd16f3..90e5e88be5 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -314,8 +314,11 @@ (define-public racket-vm-cgc
(source %racket-origin)
(inputs (list ncurses ;; <- common to all variants (for #%terminal)
libffi)) ;; <- only for BC variants
- (native-inputs (list zuo ;; <- for all variants
- libtool)) ;; <- only for BC variants
+ (native-inputs (cons* zuo ;; <- for all variants
+ libtool ;; <- only for BC variants
+ (if (%current-target-system)
+ (list this-package)
+ '())))
(outputs '("out" "debug"))
(build-system gnu-build-system)
(arguments
@@ -403,8 +406,10 @@ (define-public racket-vm-bc
(inherit racket-vm-cgc)
(name "racket-vm-bc")
(native-inputs
- (modify-inputs (package-native-inputs racket-vm-cgc)
- (prepend racket-vm-cgc)))
+ (if (%current-target-system)
+ (package-native-inputs racket-vm-cgc)
+ (modify-inputs (package-native-inputs racket-vm-cgc)
+ (prepend racket-vm-cgc))))
(arguments
(substitute-keyword-arguments (package-arguments racket-vm-cgc)
((#:configure-flags _ '())
@@ -434,11 +439,17 @@ (define-public racket-vm-cs
(prepend zlib lz4)
(delete "libffi")))
(native-inputs
- (modify-inputs (package-native-inputs racket-vm-cgc)
- (delete "libtool")
- (prepend chez-scheme-for-racket
- chez-nanopass-bootstrap
- racket-vm-bc)))
+ (let ((native-inputs (package-native-inputs racket-vm-cgc)))
+ (modify-inputs (if (%current-target-system)
+ (modify-inputs native-inputs
+ (delete "racket-vm-cgc"))
+ native-inputs)
+ (delete "libtool")
+ (prepend chez-scheme-for-racket
+ chez-nanopass-bootstrap
+ (if (%current-target-system)
+ racket-vm-cs
+ racket-vm-bc)))))
(arguments
(substitute-keyword-arguments (package-arguments racket-vm-cgc)
((#:phases those-phases #~%standard-phases)
@@ -452,7 +463,7 @@ (define-public racket-vm-cs
"--enable-libz"
"--enable-lz4"
(string-append "--enable-scheme="
- #$(this-package-native-input
+ #+(this-package-native-input
"chez-scheme-for-racket")
"/bin/scheme")
#$racket-vm-common-configure-flags))))
--
2.32.0
P
P
Philip McGrath wrote on 25 Aug 2022 10:54
[PATCH v3 12/14] gnu: chez-scheme-for-racket: Suport all systems.
(address . 57050@debbugs.gnu.org)
7c5ee85372e4682282dc6a543c99a3620abf2cd5.1661416343.git.philip@philipmcgrath.com
On systems for which Racket's variant of Chez Scheme cannot generate
native code, it can use a 'pbarch' machine type: a variant of the
``portable bytecode'' backend specialized to word size and endianness.
This allows Racket CS to replace Racket BC on those systems while
maintaining comparable performance. (Racket BC lacks JIT support for
those systems anyway.) It also lets us provide a Chez Scheme package on
all systems Guix supports.

This patch adds 'pbarch' support to both 'chez-scheme-for-racket' and
'racket-vm-cs', but it does not change the Racket VM implementation used
for the 'racket' and 'racket-minimal' packages.

* gnu/packages/chez.scm (nix-system->pbarch-machine-type): New variable.
(chez-scheme-for-racket)[inputs]: Use 'libffi' for non-native systems.
[arguments]<#:configure-flags>: Always supply '-m='. Add applicable
flags for non-native systems.
[supported-systems]: Use '%supported-systems'.
[description]: Update.
(chez-scheme-for-racket-bootstrap-bootfiles)[arguments]<#:phases>: Adapt
'build' phase for non-native systems.
* gnu/packages/racket.scm (racket-vm-bc)[description]: Update.
(racket-vm-cs)[description]: Likewise.
[inputs]: Use 'libffi' for non-native systems.
[arguments]<#:configure-flags>: Add applicable flags for non-native
systems.
---
gnu/packages/chez.scm | 76 ++++++++++++++++++++++++++++++-----------
gnu/packages/racket.scm | 26 +++++++++-----
2 files changed, 74 insertions(+), 28 deletions(-)

Toggle diff (217 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 26f653ea9d..5d152b3db5 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -37,6 +37,7 @@ (define-module (gnu packages chez)
#:use-module (gnu packages compression)
#:use-module (gnu packages ncurses)
#:use-module (gnu packages ghostscript)
+ #:use-module (gnu packages libffi)
#:use-module (gnu packages linux)
#:use-module (gnu packages netpbm)
#:use-module (gnu packages racket)
@@ -49,6 +50,7 @@ (define-module (gnu packages chez)
#:use-module (srfi srfi-26)
#:export (chez-scheme-for-system
racket-cs-native-supported-system?
+ nix-system->pbarch-machine-type
unpack-nanopass+stex))
;; Commentary:
@@ -231,6 +233,28 @@ (define* (chez-upstream-features-for-system #:optional
(and=> (assoc-ref %chez-features-table chez-os)
(cut assoc-ref <> chez-arch))))
+(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."
+ (string-append (if threads?
+ "t"
+ "")
+ "pb"
+ (if (target-64bit? system)
+ "64"
+ "32")
+ ;; missing (guix utils) predicate target-little-endian?
+ (if (target-ppc32? system)
+ "b"
+ "l")))
+
(define* (racket-cs-native-supported-system? #:optional
(system
(or (%current-target-system)
@@ -449,10 +473,14 @@ (define-public chez-scheme-for-racket
;; When updating, remember to also update %racket-version in racket.scm.
(source #f) ; avoid problematic cycle with racket.scm
(inputs
- (modify-inputs (package-inputs chez-scheme)
- (delete "libx11" "util-linux:lib")
- (replace "chez-scheme-bootstrap-bootfiles"
- chez-scheme-for-racket-bootstrap-bootfiles)))
+ (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))))
@@ -473,10 +501,16 @@ (define-public chez-scheme-for-racket
((#:configure-flags cfg-flags #~'())
#~`("--disable-x11"
"--threads" ;; ok to potentially duplicate
- #$@(if (%current-target-system)
- (list (string-append "-m="
- (racket-cs-native-supported-system?)))
- '())
+ #$(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)
@@ -543,10 +577,7 @@ (define-public chez-scheme-for-racket
(add-after 'unpack 'chdir
(lambda args
(chdir "racket/src/ChezScheme"))))))))
- ;; TODO: How to build pbarch/pbchunks for other systems?
- ;; See https://racket.discourse.group/t/950
- (supported-systems (filter racket-cs-native-supported-system?
- %supported-systems))
+ (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
@@ -559,13 +590,17 @@ (define-public chez-scheme-for-racket
Main additions to Chez Scheme in the Racket variant:
@itemize @bullet
@item
-AArch64 support
+AArch64 code generation
@item
-Portable bytes (@code{pb}) support, which is mainly useful for bootstrapping
-a build on any supported platform
+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 attachments
@@ -576,8 +611,6 @@ (define-public chez-scheme-for-racket
@item
Ordered finalization, immobile (but collectable) objects, weak/ephemeron
generic hash tables, and reference bytevectors
-@item
-Faster multiplication and division for large exact numbers
@end itemize")
(license asl2.0)))
@@ -655,13 +688,18 @@ (define-public chez-scheme-for-racket-bootstrap-bootfiles
"makefiles/boot.zuo"
(search-input-file (or native-inputs inputs)
"/bin/scheme")
- #$(racket-cs-native-supported-system?)))
+ #$(or (racket-cs-native-supported-system?)
+ (nix-system->pbarch-machine-type))))
(else
;; bootstrapping
#~(invoke
(search-input-file (or native-inputs inputs)
"/opt/racket-vm/bin/racket")
- "rktboot/main.rkt"))))))))))
+ "rktboot/main.rkt"
+ #$@(if (racket-cs-native-supported-system?)
+ #~()
+ (let ((m (nix-system->pbarch-machine-type)))
+ #~("--machine" #$m)))))))))))))
(supported-systems
(package-supported-systems chez-scheme-for-racket))
(home-page "https://github.com/racket/ChezScheme")
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index 90e5e88be5..2fecae31f8 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -313,7 +313,7 @@ (define-public racket-vm-cgc
(version %racket-version)
(source %racket-origin)
(inputs (list ncurses ;; <- common to all variants (for #%terminal)
- libffi)) ;; <- only for BC variants
+ libffi)) ;; <- for BC and non-native CS variants
(native-inputs (cons* zuo ;; <- for all variants
libtool ;; <- only for BC variants
(if (%current-target-system)
@@ -419,10 +419,8 @@ (define-public racket-vm-bc
(description "The Racket BC (``before Chez'' or ``bytecode'')
implementation was the default before Racket 8.0. It uses a compiler written
in C targeting architecture-independent bytecode, plus a JIT compiler on most
-platforms. Racket BC has a different C API and supports a slightly different
-set of architectures than the current default runtime system, Racket CS (based
-on ``Chez Scheme''). It is the recommended implementation for architectures
-that Racket CS doesn't support.
+platforms. Racket BC has a different C API than the current default runtime
+system, Racket CS (based on ``Chez Scheme'').
This package is the normal implementation of Racket BC with a precise garbage
collector, 3M (``Moving Memory Manager'').")
@@ -435,9 +433,12 @@ (define-public racket-vm-cs
(inherit racket-vm-bc)
(name "racket-vm-cs")
(inputs
- (modify-inputs (package-inputs racket-vm-cgc)
- (prepend zlib lz4)
- (delete "libffi")))
+ (let ((inputs (modify-inputs (package-inputs racket-vm-cgc)
+ (prepend zlib lz4))))
+ (if (racket-cs-native-supported-system?)
+ (modify-inputs inputs
+ (delete "libffi"))
+ inputs)))
(native-inputs
(let ((native-inputs (package-native-inputs racket-vm-cgc)))
(modify-inputs (if (%current-target-system)
@@ -466,12 +467,19 @@ (define-public racket-vm-cs
#+(this-package-native-input
"chez-scheme-for-racket")
"/bin/scheme")
+ #$@(if (racket-cs-native-supported-system?)
+ #~()
+ #~(#$(string-append "--enable-mach="
+ (nix-system->pbarch-machine-type))
+ "--enable-pb"))
#$racket-vm-common-configure-flags))))
(synopsis "Racket CS implementation")
(description "The Racket CS implementation, which uses ``Chez Scheme'' as
its core compiler and runtime system, has been the default Racket VM
implementation since Racket 8.0. It performs better than the Racket BC
-implementation for most programs.
+implementation for most programs. On systems for which Racket CS cannot
+generate machine code, this package uses a variant of its ``portable
+bytecode'' backend specialized for word size and endianness.
Using the Racket VM packages directly is not recommended: instead, install the
@code{racket-minimal} or @code{racket} packages.")
--
2.32.0
P
P
Philip McGrath wrote on 25 Aug 2022 10:54
[PATCH v3 13/14] gnu: racket-vm-bc: Add workaround for ppc64le.
(address . 57050@debbugs.gnu.org)
c390ff40c6e1ae4ce704245a18fd07bed38a4b75.1661416343.git.philip@philipmcgrath.com
This is an attempt to avoid a problem with Racket BC on ppc64 reported
in https://issues.guix.gnu.org/57050#19 that was exposed by attempting
to use Racket BC to bootstrap Chez Scheme. Thanks to Matthew Flatt for

* gnu/packages/racket.scm (racket-vm-bc)[arguments]<#:configure-flags>:
Increase the number of bytes that should be available on the stack for
"safety" when checking for stack overflow.
---
gnu/packages/racket.scm | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)

Toggle diff (28 lines)
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index 2fecae31f8..2d6bebf10e 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -414,7 +414,20 @@ (define-public racket-vm-bc
(substitute-keyword-arguments (package-arguments racket-vm-cgc)
((#:configure-flags _ '())
#~(cons "--enable-bconly"
- #$racket-vm-common-configure-flags))))
+ #$(cond
+ ((target-ppc64le?)
+ ;; Attempt to avoid a problem bootstrapping Chez Scheme:
+ ;; see <https://issues.guix.gnu.org/57050#19>
+ ;; and <https://racket.discourse.group/t/950/30>.
+ #~(map
+ (lambda (flag)
+ (if (string-prefix? "CPPFLAGS=" flag)
+ (string-append flag
+ " -DSTACK_SAFETY_MARGIN=2000000")
+ flag))
+ #$racket-vm-common-configure-flags))
+ (else
+ racket-vm-common-configure-flags))))))
(synopsis "Racket BC [3M] implementation")
(description "The Racket BC (``before Chez'' or ``bytecode'')
implementation was the default before Racket 8.0. It uses a compiler written
--
2.32.0
P
P
Philip McGrath wrote on 25 Aug 2022 10:54
[PATCH v3 14/14] gnu: racket: Use Racket CS on all systems.
(address . 57050@debbugs.gnu.org)
9b429caf1d9cd6574debcb11065b957874d2a31a.1661416343.git.philip@philipmcgrath.com
This patch uses the 'pbarch' support added to 'racket-vm-cs' to make it
the default Racket VM implementation on all systems.

* gnu/packages/racket.scm (racket-vm-for-system): Remove.
(racket-minimal, racket)[inputs]: Replace '(racket-vm-for-system)' with
'racket-vm-cs'.
---
gnu/packages/racket.scm | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)

Toggle diff (55 lines)
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index 2d6bebf10e..16ad6eef8f 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -128,10 +128,9 @@ (define-module (gnu packages racket)
;; This file defines the packages 'racket-vm-cgc', 'racket-vm-bc', and
;; 'racket-vm-cs'. All three are in-place builds of 'racket/src/' and
;; 'racket/collects/' and are installed to 'opt/racket-vm/' in the store
-;; output. The function 'racket-vm-for-system' returns the recomended Racket
-;; VM package for a given system.
+;; output.
;;
-;; We then define the packages 'racket-minimal' and
+;; Using 'racket-vm-cs', we then define the packages 'racket-minimal' and
;; 'racket'. These use Racket's support for ``layered installations'', which
;; allow an immutable base layer to be extended with additional packages.
;; They use the layer configuration directly provide ready-to-install FHS-like
@@ -192,17 +191,6 @@ (define-module (gnu packages racket)
;;
;; CODE:
-(define* (racket-vm-for-system #:optional
- (system (or (%current-target-system)
- (%current-system))))
- "Return 'racket-vm-cs' if we are able to build it for SYSTEM; 'racket-vm-bc'
-otherwise."
- ;; Once we figure out the issues in https://racket.discourse.group/t/950,
- ;; we can use 'racket-vm-cs' everywhere.
- (if (racket-cs-native-supported-system? system)
- racket-vm-cs
- racket-vm-bc))
-
(define %racket-version "8.6") ; Remember to update chez-scheme-for-racket!
(define %zuo-version "1.0") ; defined in racket/src/zuo/zuo.c
(define %racket-commit
@@ -568,7 +556,7 @@ (define-public racket-minimal
(inputs
(list openssl
sqlite
- (racket-vm-for-system)
+ racket-vm-cs
(racket-packages-origin
"base" %racket-origin
'(("base" "pkgs/base")
@@ -686,7 +674,7 @@ (define-public racket
unixodbc
libedit ;; TODO reconsider in light of expeditor and readline-gpl
racket-minimal ;; <-- TODO non-tethered layer
- (racket-vm-for-system)
+ racket-vm-cs
(simple-racket-origin
"2d" (base32 "0fb5v6058ls08xw3zbmqyr2ym0psm119gl9ffgmhm9w8rs9i4dq7")
'("2d" "2d-doc" "2d-lib"))
--
2.32.0
L
L
Liliana Marie Prikler wrote on 25 Aug 2022 11:09
Re: [PATCH v3 05/14] gnu: racket: Adjust patch for "/bin/sh" in rktio.
6315c99fee19aa14228754ad3341aedcef838f4b.camel@gmail.com
Am Donnerstag, dem 25.08.2022 um 04:54 -0400 schrieb Philip McGrath:
Toggle quote (18 lines)
> Use '_PATH_BSHELL' instead of a custom preprocessor macro. This may
> not
> be The Right Thing in the long term, but it at least avoids a
> proliferation of 'CPPFLAGS'.
>
> * gnu/packages/patches/racket-minimal-sh-via-rktio.patch: Rename to
> ...
> * gnu/packages/patches/racket-rktio-bin-sh.patch: ... this, and
> change
> to use '_PATH_BSHELL'.
> * gnu/local.mk (dist_patch_DATA): Update accordingly.
> * gnu/packages/racket.scm (%racket-origin)[patches]: Likewise.
> (racket-vm-common-configure-flags): Stop setting 'CPPFLAGS'. Change
> to a
> constant instead of a function, since we no longer need the delay.
> (racket-vm-cgc, racket-vm-bc,
> racket-vm-cs)[arguments]<#:configure-flags>: Update accordingly.
> [inputs]: Remove 'bash-minimal'.
I'm not quite sure about removing bash-minimal, but otherwise LGTM.
L
L
Liliana Marie Prikler wrote on 25 Aug 2022 11:12
Re: [PATCH v3 07/14] gnu: Add Zuo.
b1093c801a51d05295010d572c92ad4935608263.camel@gmail.com
Hi,

Am Donnerstag, dem 25.08.2022 um 04:54 -0400 schrieb Philip McGrath:
Toggle quote (2 lines)
> * gnu/packages/patches/racket-backport-8.6-zuo.patch,
> gnu/packages/patches/racket-zuo-bin-sh.patch: New patches.
This should probably be zuo-bin-sh.patch.
Toggle quote (584 lines)
> * gnu/local.mk (dist_patch_DATA): Add them.
> * gnu/packages/racket.scm (%zuo-version): New variable.
> (zuo): New variable.
> ---
>  gnu/local.mk                                  |   2 +
>  .../patches/racket-backport-8.6-zuo.patch     | 481
> ++++++++++++++++++
>  gnu/packages/patches/racket-zuo-bin-sh.patch  |  74 +++
>  gnu/packages/racket.scm                       |  51 ++
>  4 files changed, 608 insertions(+)
>  create mode 100644 gnu/packages/patches/racket-backport-8.6-
> zuo.patch
>  create mode 100644 gnu/packages/patches/racket-zuo-bin-sh.patch
>
> diff --git a/gnu/local.mk b/gnu/local.mk
> index babd54c8c6..c9c3061b33 100644
> --- a/gnu/local.mk
> +++ b/gnu/local.mk
> @@ -1769,8 +1769,10 @@ dist_patch_DATA
> =                                                \
>    %D%/packages/patches/ripperx-missing-file.patch              \
>    %D%/packages/patches/rpcbind-CVE-2017-8779.patch             \
>    %D%/packages/patches/rtags-separate-
> rct.patch                        \
> +  %D%/packages/patches/racket-backport-8.6-zuo.patch           \
>    %D%/packages/patches/racket-chez-scheme-bin-sh.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/restic-0.9.6-fix-tests-for-go1.15.patch \
>    %D%/packages/patches/retroarch-LIBRETRO_DIRECTORY.patch      \
> diff --git a/gnu/packages/patches/racket-backport-8.6-zuo.patch
> b/gnu/packages/patches/racket-backport-8.6-zuo.patch
> new file mode 100644
> index 0000000000..b86679b7ec
> --- /dev/null
> +++ b/gnu/packages/patches/racket-backport-8.6-zuo.patch
> @@ -0,0 +1,481 @@
> +From 8761fc06b188b9ca2f4b7f2b7d1235075c44a321 Mon Sep 17 00:00:00
> 2001
> +From: Matthew Flatt <mflatt@racket-lang.org>
> +Date: Sat, 23 Jul 2022 17:10:58 -0600
> +Subject: [PATCH 1/4] Zuo: support cross compilation via `configure`
> and
> + `CC_FOR_BUILD`
> +
> +(cherry picked from commit 798a989ba6d1a30c491a3120b2c2f1570ecab911)
> +---
> + racket/src/zuo/Makefile.in  |  7 ++++++-
> + racket/src/zuo/README.md    | 10 ++++++++++
> + racket/src/zuo/configure    | 15 +++++++++++++++
> + racket/src/zuo/configure.ac | 11 +++++++++++
> + 4 files changed, 42 insertions(+), 1 deletion(-)
> +
> +diff --git a/racket/src/zuo/Makefile.in b/racket/src/zuo/Makefile.in
> +index 5d16e145bf..747b584c5c 100644
> +--- a/racket/src/zuo/Makefile.in
> ++++ b/racket/src/zuo/Makefile.in
> +@@ -17,6 +17,11 @@ CPPFLAGS = @CPPFLAGS@
> + LDFLAGS = @LDFLAGS@
> + LIBS = @LIBS@
> +
> ++CC_FOR_BUILD = @CC_FOR_BUILD@
> ++CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
> ++LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
> ++LIBS_FOR_BUILD = @LIBS_FOR_BUILD@
> ++
> + EMBED_LIBS = @EMBED_LIBS@
> +
> + .PHONY: zuos-to-run-and-install
> +@@ -24,7 +29,7 @@ zuos-to-run-and-install: zuo
> +       ./zuo . zuos-to-run-and-install
> +
> + zuo: $(srcdir)/zuo.c
> +-      $(CC) $(CPPFLAGS) $(CFLAGS) -
> DZUO_LIB_PATH='"'"$(srcdir)/lib"'"' -o zuo $(srcdir)/zuo.c $(LDFLAGS)
> $(LIBS)
> ++      $(CC_FOR_BUILD) $(FLAGS_FOR_BUILD) -
> DZUO_LIB_PATH='"'"$(srcdir)/lib"'"' -o zuo $(srcdir)/zuo.c
> $(LDFLAGS_FOR_BUILD) $(LIBS_FOR_BUILD)
> +
> + .PHONY: check
> + check: zuo
> +diff --git a/racket/src/zuo/README.md b/racket/src/zuo/README.md
> +index 17c88ee9ec..3aad504b7e 100644
> +--- a/racket/src/zuo/README.md
> ++++ b/racket/src/zuo/README.md
> +@@ -84,6 +84,16 @@ A boot image is machine-independent, whether in a
> stand-alone file or
> + embedded in `.c` source.
> +
> +
> ++Cross Compiling
> ++---------------
> ++
> ++If you use `./configure --host=...` to cross compile, then you will
> ++also need to add something like `CC_FOR_BUILD=cc` as a
> `./configure`
> ++argument to specify the compiler for a `zuo` to use on the build
> ++machine. If necessary, you can also specify `CFLAGS_FOR_BUILD`,
> ++`LDFLAGS_FOR_BUILD`, and/or `LIBS_FOR_BUILD`.
> ++
> ++
> + Embedding Zuo in Another Application
> + ------------------------------------
> +
> +diff --git a/racket/src/zuo/configure b/racket/src/zuo/configure
> +index 1fa34a3fe8..575ce07d96 100755
> +--- a/racket/src/zuo/configure
> ++++ b/racket/src/zuo/configure
> +@@ -589,6 +589,10 @@ enable_embed="zuo"
> + ac_subst_vars='LTLIBOBJS
> + LIBOBJS
> + EMBED_LIBS
> ++LIBS_FOR_BUILD
> ++LDFLAGS_FOR_BUILD
> ++CFLAGS_FOR_BUILD
> ++CC_FOR_BUILD
> + OBJEXT
> + EXEEXT
> + ac_ct_CC
> +@@ -2584,6 +2588,17 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS
> $CPPFLAGS $LDFLAGS conftest.$ac_ext $
> + ac_compiler_gnu=$ac_cv_c_compiler_gnu
> +
> +
> ++if test "${CC_FOR_BUILD}" = ""; then
> ++  CC_FOR_BUILD='$(CC) -O2'
> ++  CFLAGS_FOR_BUILD='$(CPPFLAGS) $(CFLAGS)'
> ++  LDFLAGS_FOR_BUILD='$(LDFLAGS)'
> ++  LIBS_FOR_BUILD='$(LIBS)'
> ++fi
> ++
> ++
> ++
> ++
> ++
> +
> + { $as_echo "$as_me:${as_lineno-$LINENO}: zuo libraries to embed:
> \"${EMBED_LIBS}\"" >&5
> + $as_echo "$as_me: zuo libraries to embed: \"${EMBED_LIBS}\"" >&6;}
> +diff --git a/racket/src/zuo/configure.ac
> b/racket/src/zuo/configure.ac
> +index 89b3c6391d..598ff79629 100644
> +--- a/racket/src/zuo/configure.ac
> ++++ b/racket/src/zuo/configure.ac
> +@@ -25,6 +25,17 @@ AS_IF([test "x$enable_embed" = xno],
> + AC_PROG_MAKE_SET()
> + AC_PROG_CC
> +
> ++if test "${CC_FOR_BUILD}" = ""; then
> ++  CC_FOR_BUILD='$(CC) -O2'
> ++  CFLAGS_FOR_BUILD='$(CPPFLAGS) $(CFLAGS)'
> ++  LDFLAGS_FOR_BUILD='$(LDFLAGS)'
> ++  LIBS_FOR_BUILD='$(LIBS)'
> ++fi
> ++AC_SUBST(CC_FOR_BUILD)
> ++AC_SUBST(CFLAGS_FOR_BUILD)
> ++AC_SUBST(LDFLAGS_FOR_BUILD)
> ++AC_SUBST(LIBS_FOR_BUILD)
> ++
> + AC_SUBST(EMBED_LIBS)
> + AC_MSG_NOTICE([zuo libraries to embed: "${EMBED_LIBS}"])
> +
> +--
> +2.32.0
> +
> +
> +From f65194ea41eb472fbdd45d5f6c13eabe5e681704 Mon Sep 17 00:00:00
> 2001
> +From: Matthew Flatt <mflatt@racket-lang.org>
> +Date: Sat, 23 Jul 2022 17:47:03 -0600
> +Subject: [PATCH 2/4] Zuo: sort hash keys
> +
> +Printing in a sorted order is helpful to make things more
> +deterministic independent of symbol inputs. Making `hash-keys`
> +produce a sorted list generalizes that determinism.
> +
> +(cherry picked from commit 4e7ffd3b365d01c5d0993c0b3fd24c9623962edf)
> +---
> + racket/src/zuo/build.zuo              |  5 ++-
> + racket/src/zuo/tests/hash.zuo         |  8 ++--
> + racket/src/zuo/zuo-doc/lang-zuo.scrbl | 18 +++++++--
> + racket/src/zuo/zuo.c                  | 57
> ++++++++++++++++++++++++++-
> + 4 files changed, 78 insertions(+), 10 deletions(-)
> +
> +diff --git a/racket/src/zuo/build.zuo b/racket/src/zuo/build.zuo
> +index c1b5e8ce66..129240120a 100644
> +--- a/racket/src/zuo/build.zuo
> ++++ b/racket/src/zuo/build.zuo
> +@@ -47,7 +47,10 @@
> +     (target (at-dir (add-exe name))
> +             (lambda (path token)
> +               (rule (list image_zuo.c
> +-                          (input-data-target 'config config)
> ++                          (input-data-target 'config (cons
> ++                                                      lib-path
> ++                                                      (map (lambda
> (key) (hash-ref config key))
> ++                                                           '(CC
> CPPFLAGS CFLAGS LDFLAGS LIBS))))
> +                           (quote-module-path))
> +                     (lambda ()
> +                       (define l (split-path path))
> +diff --git a/racket/src/zuo/tests/hash.zuo
> b/racket/src/zuo/tests/hash.zuo
> +index a35741c730..0d3d7f3af6 100644
> +--- a/racket/src/zuo/tests/hash.zuo
> ++++ b/racket/src/zuo/tests/hash.zuo
> +@@ -35,9 +35,7 @@
> +
> + (check (hash-keys (hash)) '())
> + (check (hash-keys (hash 'a 1)) '(a))
> +-(check (let ([keys (hash-keys (hash 'a 1 'b 2))])
> +-         (or (equal? keys '(a b))
> +-             (equal? keys '(b a)))))
> ++(check (hash-keys (hash 'a 1 'b 2)) '(a b)) ; always in order
> + (check (length (hash-keys (hash 'a 1 'b 2 'c 3))) 3)
> + (check (length (hash-keys (hash 'a 1 'b 2 'a 3))) 2)
> + (check-arg-fail (hash-keys 0) "not a hash table")
> +@@ -50,3 +48,7 @@
> + (check (hash-keys-subset? (hash 'a 1 'b 2) (hash 'b 1)) #f)
> + (check-arg-fail (hash-keys-subset? 0 (hash)) "not a hash table")
> + (check-arg-fail (hash-keys-subset? (hash) 0) "not a hash table")
> ++
> ++;; print sorts keys alphabetically:
> ++(check (~a (hash 'a 1 'b 2)) "#hash((a . 1) (b . 2))")
> ++(check (~a (hash 'b 2 'a 1)) "#hash((a . 1) (b . 2))")
> +diff --git a/racket/src/zuo/zuo-doc/lang-zuo.scrbl
> b/racket/src/zuo/zuo-doc/lang-zuo.scrbl
> +index 94641d041e..4605e47471 100644
> +--- a/racket/src/zuo/zuo-doc/lang-zuo.scrbl
> ++++ b/racket/src/zuo/zuo-doc/lang-zuo.scrbl
> +@@ -538,10 +538,20 @@ support to convert the textual form back into
> a hash table value.
> +
> + Analogous to @realracket*[hash? hash hash-ref hash-set hash-remove
> + hash-keys hash-count hash-keys-subset?] from
> @racketmodname[racket].
> +-Besides being constrained to symbol keys, there is one additional
> +-difference: the third argument to @racket[hash-ref], when supplied,
> +-is always used as a value to return if a key is missing, as
> +-opposed to a failure thunk.}
> ++
> ++Besides being constrained to symbol keys, there are two additional
> ++differences:
> ++
> ++@itemlist[
> ++
> ++ @item{the third argument to @racket[hash-ref], when supplied, is
> ++       always used as a value to return if a key is missing, as
> ++       opposed to a failure thunk; and}
> ++
> ++ @item{the @racket[hash-keys] function returns interned keys sorted
> ++       alphabetically.}
> ++
> ++]}
> +
> +
> + @section{Procedures}
> +diff --git a/racket/src/zuo/zuo.c b/racket/src/zuo/zuo.c
> +index 2957d478af..88d5747326 100644
> +--- a/racket/src/zuo/zuo.c
> ++++ b/racket/src/zuo/zuo.c
> +@@ -1298,6 +1298,59 @@ static zuo_t *zuo_trie_keys(zuo_t *trie_in,
> zuo_t *accum) {
> +   return accum;
> + }
> +
> ++/*=================================================================
> =====*/
> ++/* symbol-list
> sorting                                                  */
> ++/*=================================================================
> =====*/
> ++
> ++/* merge sort used to make hash printing deterministic */
> ++static zuo_t *zuo_symbol_list_sort(zuo_t *l_in) {
> ++  zuo_t *l, *left, *right, *first, *last;
> ++  zuo_uint_t len = 0, i;
> ++
> ++  for (l = l_in, len = 0; l != z.o_null; l = _zuo_cdr(l))
> ++    len++;
> ++
> ++  if (len < 2)
> ++    return l_in;
> ++
> ++  left = z.o_null;
> ++  for (l = l_in, i = len >> 1; i > 0; l = _zuo_cdr(l), i--)
> ++    left = zuo_cons(_zuo_car(l), left);
> ++  right = l;
> ++
> ++  left = zuo_symbol_list_sort(left);
> ++  right = zuo_symbol_list_sort(right);
> ++
> ++  first = last = z.o_null;
> ++  while ((left != z.o_null) && (right != z.o_null)) {
> ++    zuo_t *p;
> ++
> ++    if (strcmp(ZUO_STRING_PTR(((zuo_symbol_t *)_zuo_car(left))-
> >str),
> ++               ZUO_STRING_PTR(((zuo_symbol_t *)_zuo_car(right))-
> >str))
> ++        < 1) {
> ++      p = zuo_cons(_zuo_car(left), z.o_null);
> ++      left = _zuo_cdr(left);
> ++    } else {
> ++      p = zuo_cons(_zuo_car(right), z.o_null);
> ++      right = _zuo_cdr(right);
> ++    }
> ++
> ++    if (first == z.o_null)
> ++      first = p;
> ++    else
> ++      ((zuo_pair_t *)last)->cdr = p;
> ++    last = p;
> ++  }
> ++
> ++  ((zuo_pair_t *)last)->cdr = ((left != z.o_null) ? left : right);
> ++
> ++  return first;
> ++}
> ++
> ++static zuo_t *zuo_trie_sorted_keys(zuo_t *trie_in, zuo_t *accum) {
> ++  return zuo_symbol_list_sort(zuo_trie_keys(trie_in, accum));
> ++}
> ++
> +
> /*===================================================================
> ===*/
> + /* terminal
> support                                                     */
> +
> /*===================================================================
> ===*/
> +@@ -1571,7 +1624,7 @@ static void zuo_out(zuo_out_t *out, zuo_t
> *obj, zuo_print_mode_t mode) {
> +         out_string(out, "opaque");
> +       out_string(out, ">");
> +     } else if (obj->tag == zuo_trie_node_tag) {
> +-      zuo_t *keys = zuo_trie_keys(obj, z.o_null);
> ++      zuo_t *keys = zuo_trie_sorted_keys(obj, z.o_null);
> +       if (mode == zuo_print_mode) {
> +         out_string(out, "(hash");
> +         if (keys != z.o_null)
> +@@ -2587,7 +2640,7 @@ static zuo_t *zuo_hash_remove(zuo_t *ht, zuo_t
> *sym) {
> +
> + static zuo_t *zuo_hash_keys(zuo_t *ht) {
> +   check_hash("hash-keys", ht);
> +-  return zuo_trie_keys(ht, z.o_null);
> ++  return zuo_trie_sorted_keys(ht, z.o_null);
> + }
> +
> + static zuo_t *zuo_hash_keys_subset_p(zuo_t *ht, zuo_t *ht2) {
> +--
> +2.32.0
> +
> +
> +From f2eecaa1dd875479d2cf51566223b3d0d7b9f738 Mon Sep 17 00:00:00
> 2001
> +From: Matthew Flatt <mflatt@racket-lang.org>
> +Date: Sat, 23 Jul 2022 18:06:41 -0600
> +Subject: [PATCH 3/4] Zuo: check for nul characters in `string-
> >symbol`
> +
> +(cherry picked from commit e20022ccfad40d0ba2e77aa75bc4f775018c781f)
> +---
> + racket/src/zuo/tests/symbol.zuo       |  3 +++
> + racket/src/zuo/zuo-doc/lang-zuo.scrbl |  4 ++-
> + racket/src/zuo/zuo.c                  | 37 +++++++++++++++++-------
> ---
> + 3 files changed, 29 insertions(+), 15 deletions(-)
> +
> +diff --git a/racket/src/zuo/tests/symbol.zuo
> b/racket/src/zuo/tests/symbol.zuo
> +index 7775aeeb04..5600a89755 100644
> +--- a/racket/src/zuo/tests/symbol.zuo
> ++++ b/racket/src/zuo/tests/symbol.zuo
> +@@ -19,3 +19,6 @@
> + (check (not (equal? 'apple (string->uninterned-symbol "apple"))))
> + (check-arg-fail (string->symbol 'apple) not-string)
> + (check-arg-fail (string->uninterned-symbol 'apple) not-string)
> ++
> ++(check-arg-fail (string->symbol "apple\0spice") "without a nul
> character")
> ++(check (symbol? (string->uninterned-symbol "apple\0spice")))
> +diff --git a/racket/src/zuo/zuo-doc/lang-zuo.scrbl
> b/racket/src/zuo/zuo-doc/lang-zuo.scrbl
> +index 4605e47471..07dd5815b0 100644
> +--- a/racket/src/zuo/zuo-doc/lang-zuo.scrbl
> ++++ b/racket/src/zuo/zuo-doc/lang-zuo.scrbl
> +@@ -500,7 +500,9 @@ back into Zuo.
> + )]{
> +
> + Analogous to @realracket*[symbol? symbol->string string->symbol
> +-string->uninterned-symbol] from @racketmodname[racket].}
> ++string->uninterned-symbol] from @racketmodname[racket], but
> ++@racket[string->symbol] accepts only strings that do not contain
> the
> ++null character.}
> +
> +
> + @section{Hash Tables (Persistent Maps)}
> +diff --git a/racket/src/zuo/zuo.c b/racket/src/zuo/zuo.c
> +index 88d5747326..17f161826d 100644
> +--- a/racket/src/zuo/zuo.c
> ++++ b/racket/src/zuo/zuo.c
> +@@ -1323,7 +1323,7 @@ static zuo_t *zuo_symbol_list_sort(zuo_t
> *l_in) {
> +
> +   first = last = z.o_null;
> +   while ((left != z.o_null) && (right != z.o_null)) {
> +-    zuo_t *p;
> ++    zuo_t *p, *s_left, *s_right;
> +
> +     if (strcmp(ZUO_STRING_PTR(((zuo_symbol_t *)_zuo_car(left))-
> >str),
> +                ZUO_STRING_PTR(((zuo_symbol_t *)_zuo_car(right))-
> >str))
> +@@ -2573,8 +2573,28 @@ static zuo_t *zuo_substring(zuo_t *obj, zuo_t
> *start_i, zuo_t *end_i) {
> +   return zuo_sized_string((const char *)&((zuo_string_t *)obj)-
> >s[s_idx], e_idx - s_idx);
> + }
> +
> ++static int zuo_is_string_without_nul(zuo_t *obj) {
> ++  zuo_int_t i;
> ++
> ++  if ((obj->tag != zuo_string_tag)
> ++      || ZUO_STRING_LEN(obj) == 0)
> ++    return 0;
> ++
> ++  for (i = ZUO_STRING_LEN(obj); i--; ) {
> ++    if (((zuo_string_t *)obj)->s[i] == 0)
> ++      return 0;
> ++  }
> ++
> ++  return 1;
> ++}
> ++
> + static zuo_t *zuo_string_to_symbol(zuo_t *obj) {
> +-  check_string("string->symbol", obj);
> ++  if (!zuo_is_string_without_nul(obj)) {
> ++    const char *who = "string->symbol";
> ++    check_string(who, obj);
> ++    zuo_fail_arg(who, "string without a nul character", obj);
> ++  }
> ++
> +   return zuo_symbol_from_string(ZUO_STRING_PTR(obj), obj);
> + }
> +
> +@@ -3577,18 +3597,7 @@ static void *zuo_envvars_block(const char
> *who, zuo_t *envvars)
> + #endif
> +
> + static int zuo_is_path_string(zuo_t *obj) {
> +-  zuo_int_t i;
> +-
> +-  if ((obj->tag != zuo_string_tag)
> +-      || ZUO_STRING_LEN(obj) == 0)
> +-    return 0;
> +-
> +-  for (i = ZUO_STRING_LEN(obj); i--; ) {
> +-    if (((zuo_string_t *)obj)->s[i] == 0)
> +-      return 0;
> +-  }
> +-
> +-  return 1;
> ++  return zuo_is_string_without_nul(obj);
> + }
> +
> + static zuo_t *zuo_path_string_p(zuo_t *obj) {
> +--
> +2.32.0
> +
> +
> +From de6618cb3819d25580e3cd400ea09c8cf4f673a9 Mon Sep 17 00:00:00
> 2001
> +From: Matthew Flatt <mflatt@racket-lang.org>
> +Date: Sat, 23 Jul 2022 19:50:46 -0600
> +Subject: [PATCH 4/4] Zuo: CPPFLAGS_FOR_BUILD, too
> +
> +(cherry picked from commit cf82706c4b298f654a04c4bc8d98dff39b62a2ac)
> +---
> + racket/src/zuo/Makefile.in  | 3 ++-
> + racket/src/zuo/configure    | 5 ++++-
> + racket/src/zuo/configure.ac | 4 +++-
> + 3 files changed, 9 insertions(+), 3 deletions(-)
> +
> +diff --git a/racket/src/zuo/Makefile.in b/racket/src/zuo/Makefile.in
> +index 747b584c5c..0376c038a8 100644
> +--- a/racket/src/zuo/Makefile.in
> ++++ b/racket/src/zuo/Makefile.in
> +@@ -19,6 +19,7 @@ LIBS = @LIBS@
> +
> + CC_FOR_BUILD = @CC_FOR_BUILD@
> + CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
> ++CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@
> + LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
> + LIBS_FOR_BUILD = @LIBS_FOR_BUILD@
> +
> +@@ -29,7 +30,7 @@ zuos-to-run-and-install: zuo
> +       ./zuo . zuos-to-run-and-install
> +
> + zuo: $(srcdir)/zuo.c
> +-      $(CC_FOR_BUILD) $(FLAGS_FOR_BUILD) -
> DZUO_LIB_PATH='"'"$(srcdir)/lib"'"' -o zuo $(srcdir)/zuo.c
> $(LDFLAGS_FOR_BUILD) $(LIBS_FOR_BUILD)
> ++      $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) -
> DZUO_LIB_PATH='"'"$(srcdir)/lib"'"' -o zuo $(srcdir)/zuo.c
> $(LDFLAGS_FOR_BUILD) $(LIBS_FOR_BUILD)
> +
> + .PHONY: check
> + check: zuo
> +diff --git a/racket/src/zuo/configure b/racket/src/zuo/configure
> +index 575ce07d96..7ac453e3bc 100755
> +--- a/racket/src/zuo/configure
> ++++ b/racket/src/zuo/configure
> +@@ -591,6 +591,7 @@ LIBOBJS
> + EMBED_LIBS
> + LIBS_FOR_BUILD
> + LDFLAGS_FOR_BUILD
> ++CPPFLAGS_FOR_BUILD
> + CFLAGS_FOR_BUILD
> + CC_FOR_BUILD
> + OBJEXT
> +@@ -2590,7 +2591,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
> +
> + if test "${CC_FOR_BUILD}" = ""; then
> +   CC_FOR_BUILD='$(CC) -O2'
> +-  CFLAGS_FOR_BUILD='$(CPPFLAGS) $(CFLAGS)'
> ++  CPPFLAGS_FOR_BUILD='$(CPPFLAGS)'
> ++  CFLAGS_FOR_BUILD='$(CFLAGS)'
> +   LDFLAGS_FOR_BUILD='$(LDFLAGS)'
> +   LIBS_FOR_BUILD='$(LIBS)'
> + fi
> +@@ -2600,6 +2602,7 @@ fi
> +
> +
> +
> ++
> + { $as_echo "$as_me:${as_lineno-$LINENO}: zuo libraries to embed:
> \"${EMBED_LIBS}\"" >&5
> + $as_echo "$as_me: zuo libraries to embed: \"${EMBED_LIBS}\"" >&6;}
> +
> +diff --git a/racket/src/zuo/configure.ac
> b/racket/src/zuo/configure.ac
> +index 598ff79629..051ea0beb5 100644
> +--- a/racket/src/zuo/configure.ac
> ++++ b/racket/src/zuo/configure.ac
> +@@ -27,12 +27,14 @@ AC_PROG_CC
> +
> + if test "${CC_FOR_BUILD}" = ""; then
> +   CC_FOR_BUILD='$(CC) -O2'
> +-  CFLAGS_FOR_BUILD='$(CPPFLAGS) $(CFLAGS)'
> ++  CPPFLAGS_FOR_BUILD='$(CPPFLAGS)'
> ++  CFLAGS_FOR_BUILD='$(CFLAGS)'
> +   LDFLAGS_FOR_BUILD='$(LDFLAGS)'
> +   LIBS_FOR_BUILD='$(LIBS)'
> + fi
> + AC_SUBST(CC_FOR_BUILD)
> + AC_SUBST(CFLAGS_FOR_BUILD)
> ++AC_SUBST(CPPFLAGS_FOR_BUILD)
> + AC_SUBST(LDFLAGS_FOR_BUILD)
> + AC_SUBST(LIBS_FOR_BUILD)
> +
> +--
> +2.32.0
> +
> diff --git a/gnu/packages/patches/racket-zuo-bin-sh.patch
> b/gnu/packages/patches/racket-zuo-bin-sh.patch
> new file mode 100644
> index 0000000000..bcdcb8e963
> --- /dev/null
> +++ b/gnu/packages/patches/racket-zuo-bin-sh.patch
> @@ -0,0 +1,74 @@
> +From 73d9b77a11b4516905caf579abb559736f715ea6 Mon Sep 17 00:00:00
> 2001
> +From: Philip McGrath <philip@philipmcgrath.com>
> +Date: Mon, 11 Apr 2022 20:43:18 -0400
> +Subject: [
This message was truncated. Download the full message here.
L
L
Liliana Marie Prikler wrote on 25 Aug 2022 11:14
Re: [PATCH v3 08/14] gnu: racket: Update to 8.6.
0f82d20277054e3d7d4562db7bb3b29a23f9ab86.camel@gmail.com
Am Donnerstag, dem 25.08.2022 um 04:54 -0400 schrieb Philip McGrath:
Toggle quote (1 lines)
> Also, update 'chez-scheme-for-racket' to 9.5.9.2.
Reiterate my argument for splitting this in two along the "Also" line.
L
L
Liliana Marie Prikler wrote on 25 Aug 2022 11:17
Re: [PATCH v3 14/14] gnu: racket: Use Racket CS on all systems.
0f2a526ce3b7aaea7c069b7a699e027d781e64f7.camel@gmail.com
Am Donnerstag, dem 25.08.2022 um 04:54 -0400 schrieb Philip McGrath:
Toggle quote (6 lines)
> This patch uses the 'pbarch' support added to 'racket-vm-cs' to make
> it the default Racket VM implementation on all systems.
>
> * gnu/packages/racket.scm (racket-vm-for-system): Remove.
> (racket-minimal, racket)[inputs]: Replace '(racket-vm-for-system)'
> with 'racket-vm-cs'.
LGTM.
L
L
Liliana Marie Prikler wrote on 25 Aug 2022 11:24
Re: [PATCH v3 12/14] gnu: chez-scheme-for-racket: Suport all systems.
ed5522d2ee3fcf41c2029e92c178988d7751883c.camel@gmail.com
Should be "Support all systems".

Am Donnerstag, dem 25.08.2022 um 04:54 -0400 schrieb Philip McGrath:
Toggle quote (86 lines)
> On systems for which Racket's variant of Chez Scheme cannot generate
> native code, it can use a 'pbarch' machine type: a variant of the
> ``portable bytecode'' backend specialized to word size and endianness.
> This allows Racket CS to replace Racket BC on those systems while
> maintaining comparable performance. (Racket BC lacks JIT support for
> those systems anyway.) It also lets us provide a Chez Scheme package on
> all systems Guix supports.
>
> This patch adds 'pbarch' support to both 'chez-scheme-for-racket' and
> 'racket-vm-cs', but it does not change the Racket VM implementation
> used
> for the 'racket' and 'racket-minimal' packages.
>
> * gnu/packages/chez.scm (nix-system->pbarch-machine-type): New
> variable.
> (chez-scheme-for-racket)[inputs]: Use 'libffi' for non-native systems.
> [arguments]<#:configure-flags>: Always supply '-m='. Add applicable
> flags for non-native systems.
> [supported-systems]: Use '%supported-systems'.
> [description]: Update.
> (chez-scheme-for-racket-bootstrap-bootfiles)[arguments]<#:phases>:
> Adapt
> 'build' phase for non-native systems.
> * gnu/packages/racket.scm (racket-vm-bc)[description]: Update.
> (racket-vm-cs)[description]: Likewise.
> [inputs]: Use 'libffi' for non-native systems.
> [arguments]<#:configure-flags>: Add applicable flags for non-native
> systems.
> ---
>  gnu/packages/chez.scm   | 76 ++++++++++++++++++++++++++++++-----------
>  gnu/packages/racket.scm | 26 +++++++++-----
>  2 files changed, 74 insertions(+), 28 deletions(-)
>
> diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
> index 26f653ea9d..5d152b3db5 100644
> --- a/gnu/packages/chez.scm
> +++ b/gnu/packages/chez.scm
> @@ -37,6 +37,7 @@ (define-module (gnu packages chez)
>    #:use-module (gnu packages compression)
>    #:use-module (gnu packages ncurses)
>    #:use-module (gnu packages ghostscript)
> +  #:use-module (gnu packages libffi)
>    #:use-module (gnu packages linux)
>    #:use-module (gnu packages netpbm)
>    #:use-module (gnu packages racket)
> @@ -49,6 +50,7 @@ (define-module (gnu packages chez)
>    #:use-module (srfi srfi-26)
>    #:export (chez-scheme-for-system
>              racket-cs-native-supported-system?
> +            nix-system->pbarch-machine-type
>              unpack-nanopass+stex))
>  
>  ;; Commentary:
> @@ -231,6 +233,28 @@ (define* (chez-upstream-features-for-system
> #:optional
>      (and=> (assoc-ref %chez-features-table chez-os)
>             (cut assoc-ref <> chez-arch))))
>  
> +(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."
> +  (string-append (if threads?
> +                     "t"
> +                     "")
> +                 "pb"
> +                 (if (target-64bit? system)
> +                     "64"
> +                     "32")
> +                 ;; missing (guix utils) predicate target-little-
> endian?
> +                 (if (target-ppc32? system)
> +                     "b"
> +                     "l")))
> +
Don't we already have a function that does something similar? Can't we
add a #:portable-bytecode? keyword to that one?

Toggle quote (58 lines)
>  (define* (racket-cs-native-supported-system? #:optional
>                                               (system
>                                                (or (%current-target-
> system)
> @@ -449,10 +473,14 @@ (define-public chez-scheme-for-racket
>      ;; When updating, remember to also update %racket-version in
> racket.scm.
>      (source #f) ; avoid problematic cycle with racket.scm
>      (inputs
> -     (modify-inputs (package-inputs chez-scheme)
> -       (delete "libx11" "util-linux:lib")
> -        (replace "chez-scheme-bootstrap-bootfiles"
> -          chez-scheme-for-racket-bootstrap-bootfiles)))
> +     (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))))
> @@ -473,10 +501,16 @@ (define-public chez-scheme-for-racket
>         ((#:configure-flags cfg-flags #~'())
>          #~`("--disable-x11"
>              "--threads" ;; ok to potentially duplicate
> -            #$@(if (%current-target-system)
> -                   (list (string-append "-m="
> -                                        (racket-cs-native-supported-
> system?)))
> -                   '())
> +            #$(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)
> @@ -543,10 +577,7 @@ (define-public chez-scheme-for-racket
>                (add-after 'unpack 'chdir
>                  (lambda args
>                    (chdir "racket/src/ChezScheme"))))))))
> -    ;; TODO: How to build pbarch/pbchunks for other systems?
> -    ;; See https://racket.discourse.group/t/950
> -    (supported-systems (filter racket-cs-native-supported-system?
> -                               %supported-systems))
> +    (supported-systems %supported-systems)
I don't think this needs to be specified, does it?

See the definition in guix/packages.scm:
(supported-systems package-supported-systems ; list of strings
(default %supported-systems))

Cheers
E
E
Efraim Flashner wrote on 25 Aug 2022 12:30
Re: [PATCH v3 07/14] gnu: Add Zuo.
(name . Philip McGrath)(address . philip@philipmcgrath.com)
YwdPVdZqMmD/9cDq@3900XT
Attachment: file
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmMHT1MACgkQQarn3Mo9
g1GM+BAAlUy7u7/yc5/BA3wR8dbKn3hMCsbnlud/N4qpqHpTaimhQZkk4gk1U3b1
5hN5PT69SEsYtQjeZkAgHI/x2hR3wMOUT8CfqjNDlQiqfVNIBI0HCHBB6eqjgn99
baiIEThgQ0Jz+29l4xGAw7LeoQBdRx9pI3Jz3fT8EZfErfG2VbRaYXpxrb1nEwY7
kSxkuffrSuEt3blP1w0xcAwMpTE0ptIqN/PwaJLPHrh7ul+/VFfXJk/AXqCINDNL
P40bg06UarmRdWamwyJNTIU9WJUq06mlkN9pBpjstApvYEtpOnbpka2qECLczxkk
YZDyQzzAvas378BU8bUuOIdSwlo4qOGOUo4j7jYyn5DL6PqEyRIFL+OTMYGdFcQl
ZtTD8OoE47v/Gxgrh1w9z3IQa7yz9I3AWGCZi10YIE/WaUJs6JEgdyvzOmvCNvpQ
8esO0kiQpjH1gx/PVIxqQpH3IHHCsw6ZwiuqY0BMtm3WpH21vYqraY5rW1/JorzN
2wcbf/1MwGcIc9n6awyzOVROz0/b8lgIWMG+zHBzKoQgXtIuAwCto6BhRS77xiOg
BPokLVWFgPGGbRa3U+4ksRr01BuW1x/IBmtYa1XK3nadBH3430Svu1CEbsB/bTD8
c/oYoKLxr5um1JMpyoRbguCZGIVaOtYBbqXTVqM4SZg+O0jg9qc=
=sTOb
-----END PGP SIGNATURE-----


E
E
Efraim Flashner wrote on 25 Aug 2022 12:39
Re: [PATCH v3 08/14] gnu: racket: Update to 8.6.
(name . Philip McGrath)(address . philip@philipmcgrath.com)
YwdRcVxzOk9C949N@3900XT
Attachment: file
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmMHUXEACgkQQarn3Mo9
g1E4lQ//ZAC3SYCAuANcGAu4ELlfn8E9ExOYfK1IpelaUX9NKj4dZysZILsYuYMj
5wtLEzYWyGU5lZEpL8vIDm26PtO5f9ey5fG7pGyMpW9bp8r5KGaobi6LfppK1tFb
pCIWN92pXnsLAOcrMBBAQo/HY1b6yLTn40MxyBFjF81fuENW1sX4K3nSjYpjm7yt
XYEwLCQa1yusv+l+fYLpSb3Gezp8JXsq4TapdiH4EwBUF3lrEuORKwDo/aspUBoJ
axTXLvYlR7YvMUqMC7jhONHGg6vWeTxK36k9dE2XqAWmvBzfQHAHFnBECoNAiPs6
wafvgEcoaWIeNAvgv7VuAXwkhisJALZNagpxmb9Ey9Ic6161heHK9A8RdEw32SFI
zAUnl6fC93g0mY+DHY0SSnGzLEVZEZczwmdfiuRZ8sj2RWfjAwExivdNc/YU5F8+
hyHVDJHCHmOQxFUgS41ZP1FZSPpAEKpQtj8vtr2/Car9QqW21vxE84Tcg+4W0fyX
ZOM0gCNeyVTd78geqcc/021UgcWyt2SdG9/QgMVPpip7QnMRCRS1psjNVkPXZ4Tn
lzWubbp2ytOH0VC8iIqm1zFmMkbXTWDsKbxJLMoTKakTH5kaMZqBiezJ3p+DGeFS
30zNEBPTSXNwXkk/P+laheh3wRnFRG9LVtbPvR4fHCt36FM3lZ8=
=nsS4
-----END PGP SIGNATURE-----


E
E
Efraim Flashner wrote on 25 Aug 2022 12:50
Re: [PATCH v3 12/14] gnu: chez-scheme-for-racket: Suport all systems.
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)
YwdT3SX4D9tSsUIB@3900XT
Attachment: file
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmMHU9oACgkQQarn3Mo9
g1ETwA//eELhvdrXEw5ImOWWiEPz38AlNtPYzPPupKbu4OsJWs82z2YVEefeAgU6
/9YC83HUMtMoso4z41r6UzeyZPwVWjB7sMH4eWhjZVvR/KfGPjYR1iSqnLSSmjsB
GE7AXRkl0mg3S5xTbP5TwmbOOZDy/IazJCvRUfqYA25SVpgwRLawLzo2IQb7HUUS
4h5E8V26y2aXGYOU7px1kz9GUcjNgsuFY6x4I6qubsP4lGpqmDpn/0bRwNnr9qec
4/g3ExB49DDBP6b1/PmP2yC8bWyZ487YOukByPka/YMTO/ig+BMq6ohmzmKfmva4
j+BbHyRoyusfSpeWVMNHFECJaj6qLv0Kj8Er6v392jfFlS6ICy5abSIyquIF+IH2
qI1VQjMcLBVFKg9AywQD5Pz15BQtM6gzz/qOhUiU4iaFHXSTbem1o0/YYX9OUqkh
WzP5mjA8t4pYt2CJQWpVvQBC45/Y3/5yVZyhDg3hgvtQbAa0x7BLOC7Vdn4N79L7
gbR2nlLpreY7EPZ9pd3tTBGCxSk1JubLx56PH8MCGxeewue7w8Fyz2MQ9jJCC1dD
HqE5w209H6J84AdV0d+42fNUWJ/kjzo7mfnsM+RK7qdU+F/bUP4XAufk3AvH/HaY
pgzLzJAuAN+M0Fp3BlH7azDXniwYgCc3rrEgk3eeq+MU+7JaZM8=
=Hmfz
-----END PGP SIGNATURE-----


P
P
Philip McGrath wrote on 25 Aug 2022 21:16
Re: [PATCH v3 05/14] gnu: racket: Adjust patch for "/bin/sh" in rktio.
8acb845a-9710-4cff-a537-93076c18f7bd@www.fastmail.com
On Thu, Aug 25, 2022, at 5:09 AM, Liliana Marie Prikler wrote:
Toggle quote (21 lines)
> Am Donnerstag, dem 25.08.2022 um 04:54 -0400 schrieb Philip McGrath:
>> Use '_PATH_BSHELL' instead of a custom preprocessor macro. This may
>> not
>> be The Right Thing in the long term, but it at least avoids a
>> proliferation of 'CPPFLAGS'.
>>
>> * gnu/packages/patches/racket-minimal-sh-via-rktio.patch: Rename to
>> ...
>> * gnu/packages/patches/racket-rktio-bin-sh.patch: ... this, and
>> change
>> to use '_PATH_BSHELL'.
>> * gnu/local.mk (dist_patch_DATA): Update accordingly.
>> * gnu/packages/racket.scm (%racket-origin)[patches]: Likewise.
>> (racket-vm-common-configure-flags): Stop setting 'CPPFLAGS'. Change
>> to a
>> constant instead of a function, since we no longer need the delay.
>> (racket-vm-cgc, racket-vm-bc,
>> racket-vm-cs)[arguments]<#:configure-flags>: Update accordingly.
>> [inputs]: Remove 'bash-minimal'.
> I'm not quite sure about removing bash-minimal, but otherwise LGTM.

`_PATH_BSHELL` expands to "/gnu/store/720rj90bch716isd8z7lcwrnvz28ap4y-bash-static-5.1.8/bin/sh", not bash-minimal.
P
P
Philip McGrath wrote on 25 Aug 2022 22:04
Re: [PATCH v3 07/14] gnu: Add Zuo.
(name . Efraim Flashner)(address . efraim@flashner.co.il)
490171b8-eb12-4274-830d-039f23d1bb6f@www.fastmail.com
On Thu, Aug 25, 2022, at 6:30 AM, Efraim Flashner wrote:
Toggle quote (21 lines)
> On Thu, Aug 25, 2022 at 04:54:09AM -0400, Philip McGrath wrote:
>> + (synopsis "Tiny Racket for build scripts")
>> + (description "You should use Racket to write scripts. But what if you
>> +need something much smaller than Racket for some reason—or what if you're
>> +trying to script a build of Racket itself? Zuo (?) is a tiny Racket with
>> +primitives for dealing with files and running processes, and it comes with a
>> +@command{make}-like embedded DSL.
>> +
>> +Zuo is a Racket variant in the sense that program files start with
>> +@code{#lang}, and the module path after @code{#lang} determines the parsing
>> +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)))))
>
> I'm not sold on the second paragraph, but I understand it's from
> upstream so that's not too bad. For the first paragraph I'd drop the
> first two sentences and consider @acronym{symbol, Zuo} for the next
> sentence.
>

That seems reasonable. For acronym, though, the manual says that "in Texinfo, an acronym (but not an abbreviation) should consist only of capital letters and periods, no lowercase," and when I tried '@abbr{Zuo, ?}' it was rejected as "invalid Texinfo markup". I'm also not sure that the generated HTML would be semantically correct.

How does this seem?

(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.

Zuo is a Racket variant in the sense that program files start with
@code{#lang}, and the module path after @code{#lang} determines the parsing
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.")

-Philip
P
P
Philip McGrath wrote on 25 Aug 2022 22:17
Re: [PATCH v3 12/14] gnu: chez-scheme-for-racket: Suport all systems.
4105f2b6-14a8-4835-b446-5682931ede50@www.fastmail.com
On Thu, Aug 25, 2022, at 6:50 AM, Efraim Flashner wrote:
Toggle quote (4 lines)
> On Thu, Aug 25, 2022 at 11:24:31AM +0200, Liliana Marie Prikler wrote:
>> Should be "Support all systems".
>>

Thanks.

Toggle quote (37 lines)
>> Am Donnerstag, dem 25.08.2022 um 04:54 -0400 schrieb Philip McGrath:
>> > +(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."
>> > +  (string-append (if threads?
>> > +                     "t"
>> > +                     "")
>> > +                 "pb"
>> > +                 (if (target-64bit? system)
>> > +                     "64"
>> > +                     "32")
>> > +                 ;; missing (guix utils) predicate target-little-
>> > endian?
>> > +                 (if (target-ppc32? system)
>> > +                     "b"
>> > +                     "l")))
>> > +
>> Don't we already have a function that does something similar? Can't we
>> add a #:portable-bytecode? keyword to that one?
>
> I'm not aware of a function that checks for endianness. The only other
> place I know of is (guix build-system meson), but there the logic is
> hand-written.
>

I also don't know of any function we could readily adapt. Thanks for the pointer to (guix build-system meson): I see 'target-ppc32?' is the only big-endian case there as well.

Toggle quote (23 lines)
>> > @@ -543,10 +577,7 @@ (define-public chez-scheme-for-racket
>> >                (add-after 'unpack 'chdir
>> >                  (lambda args
>> >                    (chdir "racket/src/ChezScheme"))))))))
>> > -    ;; TODO: How to build pbarch/pbchunks for other systems?
>> > -    ;; See https://racket.discourse.group/t/950
>> > -    (supported-systems (filter racket-cs-native-supported-system?
>> > -                               %supported-systems))
>> > +    (supported-systems %supported-systems)
>> I don't think this needs to be specified, does it?
>>
>> See the definition in guix/packages.scm:
>> (supported-systems package-supported-systems ; list of strings
>> (default %supported-systems))
>
> Unless this package inherits from somewhere else then by default
> supported-systems is all systems. (Regardless if all dependencies are
> supported. To see more look at the difference between
> (package-supported-systems "pandoc") and
> (package-transitive-supported-systems "pandoc"))
>
>

'chez-scheme-for-racket' and 'chez-scheme-for-racket-bootstrap-bootfiles' inherit from
'chez-scheme' and 'chez-scheme-bootstrap-bootfiles', respectively, so we need to override the inherited value.

-Philip
L
L
Liliana Marie Prikler wrote on 26 Aug 2022 14:01
Re: [PATCH v3 07/14] gnu: Add Zuo.
764bd6d01effa26b02f5a070c1bcbadb93f81357.camel@gmail.com
Am Donnerstag, dem 25.08.2022 um 16:04 -0400 schrieb Philip McGrath:
Toggle quote (4 lines)
> How does this seem?
>
>       (description "Zuo (?) is a tiny Racket with primitives for
> dealing
I don't think (?) adds anything meaningful. Perhaps a Chinese
translation might want to use that character, but in English we have to
deal with the fact that most no one will understand that.
Toggle quote (12 lines)
> with files and running processes.  It comes with a @command{make}-
> like
> embedded DSL, which is used to build Racket itself.
>
> Zuo is a Racket variant in the sense that program files start with
> @code{#lang}, and the module path after @code{#lang} determines the
> parsing
> 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.")
I'd probably cut out the middle sentence in this paragraph, but
otherwise LGTM.

Cheers
T
T
Thiago Jung Bauermann wrote on 26 Aug 2022 23:15
Re: [PATCH v3 00/14] gnu: Update Racket to 8.6. Add Zuo.
(name . Philip McGrath)(address . philip@philipmcgrath.com)
874jxyyabj.fsf@kolabnow.com
Hello Philip,

Philip McGrath <philip@philipmcgrath.com> writes:

Toggle quote (18 lines)
> Hi,
>
> Here is a v3 of this series. The major changes from v2 are:
>
> 1. Reflecting the change upstream to the v8.6 tag (which they will not
> do again);
>
> 2. Changing the patches to use _PATH_BSHELL for "/bin/sh"; and
>
> 3. Incorporating all of the powerpc64le fixes, including the 10x higher
> STACK_SAFETY_MARGIN that got the build working for Thiago.
>
> I've also made many of the smaller changes requested.
>
> For convienience, I've also pushed this series to the 'zuo' branch of
> https://gitlab.com/philip1/guix-patches and tagged it as
> guix-issue-57050-v3 (commit 9b429caf1d9cd6574debcb11065b957874d2a31a).

Thank you! This version built successfully on powerpc64le-linux.

--
Thanks
Thiago
P
P
Philip McGrath wrote on 27 Aug 2022 20:08
Re: [PATCH v3 07/14] gnu: Add Zuo.
13c01780-4990-496b-9a2d-531c1a7d51db@www.fastmail.com
On Fri, Aug 26, 2022, at 8:01 AM, Liliana Marie Prikler wrote:
Toggle quote (9 lines)
> Am Donnerstag, dem 25.08.2022 um 16:04 -0400 schrieb Philip McGrath:
>> How does this seem?
>>
>>       (description "Zuo (?) is a tiny Racket with primitives for
>> dealing
> I don't think (?) adds anything meaningful. Perhaps a Chinese
> translation might want to use that character, but in English we have to
> deal with the fact that most no one will understand that.

I think "(?)" concisely answers the question, "Why is this called Zuo?" (Answer: ? means, roughly, "make".)

-Philip
P
P
Philip McGrath wrote on 27 Aug 2022 20:55
[PATCH v4 00/14] gnu: Update Racket to 8.6. Add Zuo.
(address . 57050@debbugs.gnu.org)
cover.1661626113.git.philip@philipmcgrath.com
Hi,

Here is a v4 with the revised description for Zuo (07/14) and the typo fix in
the commit message for 12/14.

I've once again pushed this series to the 'zuo' branch of
guix-issue-57050-v4 (commit b9652c2a85201f8183346a6e3a4f4fd245649d69).

-Philip

Philip McGrath (14):
gnu: stex: Update to 1.2.2-2.afa6075.
gnu: stex: Fix read-only gifs and math directories.
etc: teams: Add racket team.
etc: teams: Add entry for Philip McGrath.
gnu: racket: Adjust patch for "/bin/sh" in rktio.
gnu: chez-scheme: Fix use of "/bin/sh".
gnu: Add Zuo.
gnu: racket: Update to 8.6.
gnu: chez-scheme: Make bootfiles regular inputs.
gnu: chez-scheme-for-racket: Support cross-compilation.
gnu: racket: Support cross-compiling the VM packages.
gnu: chez-scheme-for-racket: Support all systems.
gnu: racket-vm-bc: Add workaround for ppc64le.
gnu: racket: Use Racket CS on all systems.

etc/teams.scm.in | 12 +
gnu/local.mk | 7 +-
gnu/packages/chez.scm | 211 ++++--
gnu/packages/patches/chez-scheme-bin-sh.patch | 76 +++
.../racket-backport-8.6-cross-install.patch | 126 ++++
.../racket-backport-8.6-docindex-write.patch | 36 ++
.../patches/racket-backport-8.6-hurd.patch | 609 ++++++++++++++++++
.../patches/racket-backport-8.6-zuo.patch | 481 ++++++++++++++
.../patches/racket-chez-scheme-bin-sh.patch | 76 +++
...-rktio.patch => racket-rktio-bin-sh.patch} | 60 +-
gnu/packages/patches/racket-zuo-bin-sh.patch | 74 +++
.../stex-copy-from-immutable-store.patch | 41 ++
gnu/packages/racket.scm | 240 ++++---
13 files changed, 1895 insertions(+), 154 deletions(-)
create mode 100644 gnu/packages/patches/chez-scheme-bin-sh.patch
create mode 100644 gnu/packages/patches/racket-backport-8.6-cross-install.patch
create mode 100644 gnu/packages/patches/racket-backport-8.6-docindex-write.patch
create mode 100644 gnu/packages/patches/racket-backport-8.6-hurd.patch
create mode 100644 gnu/packages/patches/racket-backport-8.6-zuo.patch
create mode 100644 gnu/packages/patches/racket-chez-scheme-bin-sh.patch
rename gnu/packages/patches/{racket-minimal-sh-via-rktio.patch => racket-rktio-bin-sh.patch} (54%)
create mode 100644 gnu/packages/patches/racket-zuo-bin-sh.patch
create mode 100644 gnu/packages/patches/stex-copy-from-immutable-store.patch


base-commit: b594c7354ce1daedecb3310b55817b69e90adbe9
--
2.32.0
P
P
Philip McGrath wrote on 27 Aug 2022 20:55
[PATCH v4 01/14] gnu: stex: Update to 1.2.2-2.afa6075.
(address . 57050@debbugs.gnu.org)
17a6fbf231448ebf8edeb69a0f2ee6a75934ac7a.1661626113.git.philip@philipmcgrath.com
* gnu/packages/chez.scm (stex-bootstrap): Update to 1.2.2-2.afa6075.
---
gnu/packages/chez.scm | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

Toggle diff (26 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index b037efe8d4..043f2ae47a 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -594,8 +594,8 @@ (define-public chez-scheme-for-racket-bootstrap-bootfiles
(define-public stex-bootstrap
;; This commit includes a fix which we would otherwise want to use as
;; patch. Let's revert to tagged releases as soon as one becomes available.
- (let ((commit "54051494434a197772bf6ca5b4e6cf6be55f39a5")
- (revision "1"))
+ (let ((commit "afa607564a5662ffd748e824801277a6b5a3d11c")
+ (revision "2"))
(hidden-package
(package
(name "stex")
@@ -611,7 +611,7 @@ (define-public stex-bootstrap
(url "https://github.com/dybvig/stex")
(commit commit)))
(sha256
- (base32 "01jnvw8qw33gnpzwrakwhsr05h6b609lm180jnspcrb7lds2p23d"))
+ (base32 "0n6dryv5j7cw2qmsj55wqb0ph901h83a2hl4j891ppxp0xx18nkp"))
(file-name (git-file-name name version))
(snippet
#~(for-each delete-file
--
2.32.0
P
P
Philip McGrath wrote on 27 Aug 2022 20:55
[PATCH v4 02/14] gnu: stex: Fix read-only gifs and math directories.
(address . 57050@debbugs.gnu.org)
9c0d1272c936807806d05b5dfdd33403f9e7f336.1661626113.git.philip@philipmcgrath.com
Excplicitly set the user write bit when initializing the gifs or math
directories from the skeletons installed in the store. See also upstream
discussion at https://github.com/dybvig/stex/pull/6. This problem
would be exposed by the upcoming changes to Racket's build system.

* gnu/packages/patches/stex-copy-from-immutable-store.patch: New patch.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/chez.scm (stex-bootstrap)[patches]: Use it.
---
gnu/local.mk | 1 +
gnu/packages/chez.scm | 3 ++
.../stex-copy-from-immutable-store.patch | 41 +++++++++++++++++++
3 files changed, 45 insertions(+)
create mode 100644 gnu/packages/patches/stex-copy-from-immutable-store.patch

Toggle diff (75 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 26dfb6afe2..558fed8a0d 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1821,6 +1821,7 @@ dist_patch_DATA = \
%D%/packages/patches/slim-reset.patch \
%D%/packages/patches/slim-login.patch \
%D%/packages/patches/slim-display.patch \
+ %D%/packages/patches/stex-copy-from-immutable-store.patch \
%D%/packages/patches/syslinux-gcc10.patch \
%D%/packages/patches/syslinux-strip-gnu-property.patch \
%D%/packages/patches/snappy-add-O2-flag-in-CmakeLists.txt.patch \
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 043f2ae47a..812d41fc5b 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -613,6 +613,9 @@ (define-public stex-bootstrap
(sha256
(base32 "0n6dryv5j7cw2qmsj55wqb0ph901h83a2hl4j891ppxp0xx18nkp"))
(file-name (git-file-name name version))
+ (patches
+ ;; submitted upstream in https://github.com/dybvig/stex/pull/6
+ (search-patches "stex-copy-from-immutable-store.patch"))
(snippet
#~(for-each delete-file
'("sbin/install" "doc/stex.pdf" "doc/stex.html")))))
diff --git a/gnu/packages/patches/stex-copy-from-immutable-store.patch b/gnu/packages/patches/stex-copy-from-immutable-store.patch
new file mode 100644
index 0000000000..4562e431c1
--- /dev/null
+++ b/gnu/packages/patches/stex-copy-from-immutable-store.patch
@@ -0,0 +1,41 @@
+From 9434b4a36646c036db8de326158056aa3293fb82 Mon Sep 17 00:00:00 2001
+From: Philip McGrath <philip@philipmcgrath.com>
+Date: Thu, 28 Apr 2022 22:56:20 -0400
+Subject: [PATCH] fix read-only gifs and math directories
+
+An installed copy of stex might have all write permission bits removed,
+even for the owner of the installed files: this is the case with Guix
+package of stex, for example. If such an installation is used to
+initialize the gifs or math directories (e.g. for an out-of-source
+build), tar likewise creates them without write permissions, preventing
+subdirectories from being created later. Set the user write bit
+explicitly to avoid this problem.
+ Mf-stex
+
+Related to https://github.com/racket/racket/pull/4203
+---
+
+Submitted upstream in https://github.com/dybvig/stex/pull/6
+
+ Mf-stex | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/Mf-stex b/Mf-stex
+index 09ec6f3..11fb214 100644
+--- a/Mf-stex
++++ b/Mf-stex
+@@ -112,9 +112,11 @@ $(x).mathrun: gifs $(mathfiles)
+
+ gifs:
+ (cd $(STEXLIB); tar -cf - gifs) | tar -xpf -
++ chmod u+w gifs
+
+ math:
+ (cd $(STEXLIB); tar -cf - math) | tar -xpf -
++ chmod u+w math
+
+ $(mathfiles): $(x).hthirdrun $(figps)
+ echo -n gifs= > $(mathfiles)
+--
+2.32.0
+
--
2.32.0
P
P
Philip McGrath wrote on 27 Aug 2022 20:55
[PATCH v4 03/14] etc: teams: Add racket team.
(address . 57050@debbugs.gnu.org)
55e51008769c8622525f4a935ccc5d75885b5245.1661626113.git.philip@philipmcgrath.com
* etc/teams.scm.in (racket): New team.
---
etc/teams.scm.in | 8 ++++++++
1 file changed, 8 insertions(+)

Toggle diff (21 lines)
diff --git a/etc/teams.scm.in b/etc/teams.scm.in
index c99d794697..e2eb5048f6 100644
--- a/etc/teams.scm.in
+++ b/etc/teams.scm.in
@@ -185,6 +185,14 @@ (define-team mozilla
"Taking care about Icecat and Icedove, built from Mozilla Firefox
and Thunderbird."))
+(define-team racket
+ (team 'racket
+ #:name "Racket team"
+ #:description
+ "The Racket language and Racket-based languages, Racket packages,
+Racket's variant of Chez Scheme, and development of a Racket build system and
+importer."))
+
(define-member (person "Thiago Jung Bauermann"
"bauermann@kolabnow.com")
--
2.32.0
P
P
Philip McGrath wrote on 27 Aug 2022 20:55
[PATCH v4 05/14] gnu: racket: Adjust patch for "/bin/sh" in rktio.
(address . 57050@debbugs.gnu.org)
05bbd3ccda12d47c22c6df15b505ba76e7facebd.1661626113.git.philip@philipmcgrath.com
Use '_PATH_BSHELL' instead of a custom preprocessor macro. This may not
be The Right Thing in the long term, but it at least avoids a
proliferation of 'CPPFLAGS'.

* gnu/packages/patches/racket-minimal-sh-via-rktio.patch: Rename to ...
* gnu/packages/patches/racket-rktio-bin-sh.patch: ... this, and change
to use '_PATH_BSHELL'.
* gnu/local.mk (dist_patch_DATA): Update accordingly.
* gnu/packages/racket.scm (%racket-origin)[patches]: Likewise.
(racket-vm-common-configure-flags): Stop setting 'CPPFLAGS'. Change to a
constant instead of a function, since we no longer need the delay.
(racket-vm-cgc, racket-vm-bc,
racket-vm-cs)[arguments]<#:configure-flags>: Update accordingly.
[inputs]: Remove 'bash-minimal'.
---
gnu/local.mk | 2 +-
...-rktio.patch => racket-rktio-bin-sh.patch} | 60 +++++++++----------
gnu/packages/racket.scm | 15 ++---
3 files changed, 35 insertions(+), 42 deletions(-)
rename gnu/packages/patches/{racket-minimal-sh-via-rktio.patch => racket-rktio-bin-sh.patch} (54%)

Toggle diff (202 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 558fed8a0d..fae32a11e5 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1768,7 +1768,7 @@ dist_patch_DATA = \
%D%/packages/patches/ripperx-missing-file.patch \
%D%/packages/patches/rpcbind-CVE-2017-8779.patch \
%D%/packages/patches/rtags-separate-rct.patch \
- %D%/packages/patches/racket-minimal-sh-via-rktio.patch \
+ %D%/packages/patches/racket-rktio-bin-sh.patch \
%D%/packages/patches/remake-impure-dirs.patch \
%D%/packages/patches/restic-0.9.6-fix-tests-for-go1.15.patch \
%D%/packages/patches/retroarch-LIBRETRO_DIRECTORY.patch \
diff --git a/gnu/packages/patches/racket-minimal-sh-via-rktio.patch b/gnu/packages/patches/racket-rktio-bin-sh.patch
similarity index 54%
rename from gnu/packages/patches/racket-minimal-sh-via-rktio.patch
rename to gnu/packages/patches/racket-rktio-bin-sh.patch
index 6bc2ee8331..ec6f0d9c56 100644
--- a/gnu/packages/patches/racket-minimal-sh-via-rktio.patch
+++ b/gnu/packages/patches/racket-rktio-bin-sh.patch
@@ -1,7 +1,7 @@
-From 3574b567c486d264d680a37586436c3b5a8cb978 Mon Sep 17 00:00:00 2001
+From 6a553f24439fe64fd3a2f0b5902f00590ca4241f Mon Sep 17 00:00:00 2001
From: Philip McGrath <philip@philipmcgrath.com>
Date: Thu, 4 Mar 2021 04:11:50 -0500
-Subject: [PATCH] patch rktio_process for "/bin/sh" on Guix
+Subject: [PATCH] rktio: patch rktio_process for "/bin/sh" on Guix
Racket provides the functions `system` and `process`,
which execute shell commands using `sh` (or `cmd` on Windows).
@@ -12,37 +12,38 @@ This patch adds a special case for "/bin/sh" to `rktio_process`,
the C function that implements the core of `system`, `process`,
and related Racket functions.
-Guix should enable the special case by defining the C preprocessor
-macro `GUIX_RKTIO_PATCH_BIN_SH` with the path to `sh` in the store.
If:
- 1. The `GUIX_RKTIO_PATCH_BIN_SH` macro is defined; and
+ 1. The nonstandard but ubiquitous macro `_PATH_BSHELL` from
+ <paths.h> is defined; and
2. `rktio_process` is called with the exact path "/bin/sh"; and
- 3. The path specified by `GUIX_RKTIO_PATCH_BIN_SH` does exists;
+ 3. The file specified by `_PATH_BSHELL` exists;
-then `rktio_process` will execute the file specified
-by `GUIX_RKTIO_PATCH_BIN_SH` instead of "/bin/sh".
+then `rktio_process` will execute the file specified by `_PATH_BSHELL`
+instead of "/bin/sh".
-Compared to previous attempts to patch the Racket sources,
-making this change at the C level is both:
-
- - More comprehensive: it catches all attempts to execute "/bin/sh",
- without having to track down the source of every occurance; and
-
- - Less intrusive: by guarding the special case with a C preprocessor
- conditional and a runtime check that the file in the store exists,
- we make it much less likely that it will "leak" out of Guix.
+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.
---
- racket/src/rktio/rktio_process.c | 21 ++++++++++++++++++++-
- 1 file changed, 20 insertions(+), 1 deletion(-)
+ 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 89202436c0..465ebdd5c5 100644
+index fafaf728c1..796ebc59ce 100644
--- a/racket/src/rktio/rktio_process.c
+++ b/racket/src/rktio/rktio_process.c
-@@ -1224,12 +1224,14 @@ int rktio_process_allowed_flags(rktio_t *rktio)
+@@ -9,6 +9,7 @@
+ # include <sys/wait.h>
+ # include <errno.h>
+ # include <unistd.h>
++# include <paths.h> /* PATCHED for Guix */
+ # ifdef USE_ULIMIT
+ # include <ulimit.h>
+ # endif
+@@ -1301,12 +1302,14 @@ int rktio_process_allowed_flags(rktio_t *rktio)
/*========================================================================*/
rktio_process_result_t *rktio_process(rktio_t *rktio,
@@ -58,22 +59,17 @@ index 89202436c0..465ebdd5c5 100644
rktio_process_result_t *result;
intptr_t to_subprocess[2], from_subprocess[2], err_subprocess[2];
int pid;
-@@ -1255,6 +1257,23 @@ rktio_process_result_t *rktio_process(rktio_t *rktio,
+@@ -1333,6 +1336,18 @@ rktio_process_result_t *rktio_process(rktio_t *rktio,
int i;
#endif
+/* BEGIN PATCH for Guix */
-+#if defined(GUIX_RKTIO_PATCH_BIN_SH)
-+# define GUIX_AS_a_STR_HELPER(x) #x
-+# define GUIX_AS_a_STR(x) GUIX_AS_a_STR_HELPER(x)
-+ /* A level of indirection makes `#` work as needed: */
++#if defined(_PATH_BSHELL)
+ command =
+ ((0 == strcmp(_guix_orig_command, "/bin/sh"))
-+ && rktio_file_exists(rktio, GUIX_AS_a_STR(GUIX_RKTIO_PATCH_BIN_SH)))
-+ ? GUIX_AS_a_STR(GUIX_RKTIO_PATCH_BIN_SH)
++ && rktio_file_exists(rktio, _PATH_BSHELL))
++ ? _PATH_BSHELL
+ : _guix_orig_command;
-+# undef GUIX_AS_a_STR
-+# undef GUIX_AS_a_STR_HELPER
+#else
+ command = _guix_orig_command;
+#endif
@@ -82,6 +78,8 @@ index 89202436c0..465ebdd5c5 100644
/* avoid compiler warnings: */
to_subprocess[0] = -1;
to_subprocess[1] = -1;
+
+base-commit: 9d228d16fb99c274c964e5bef93e97333888769f
--
-2.21.1 (Apple Git-122.3)
+2.32.0
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index 3399bcc3fe..319f63f9d2 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -36,7 +36,6 @@ (define-module (gnu packages racket)
#:use-module (ice-9 match)
#:use-module (gnu packages)
#:use-module (gnu packages autotools)
- #:use-module (gnu packages bash)
#:use-module (gnu packages chez)
#:use-module (gnu packages compression)
#:use-module (gnu packages databases)
@@ -212,7 +211,7 @@ (define %racket-origin
(sha256
(base32 "0f9zyhdvbh4xsndrqjzl85j5ziz0rmqi676g9s1lw3h3skq2636h"))
(file-name (git-file-name "racket" %racket-version))
- (patches (search-patches "racket-minimal-sh-via-rktio.patch"))
+ (patches (search-patches "racket-rktio-bin-sh.patch"))
(modules '((guix build utils)))
(snippet
#~(begin
@@ -232,8 +231,7 @@ (define %racket-origin
;; Unbundle libffi.
(delete-file-recursively "racket/src/bc/foreign/libffi")))))
-(define (racket-vm-common-configure-flags)
- ;; under a lambda abstraction to avoid evaluating bash-minimal too early.
+(define racket-vm-common-configure-flags
#~`(,@(cond
((false-if-exception
(search-input-file %build-inputs "/bin/libtool"))
@@ -248,8 +246,6 @@ (define (racket-vm-common-configure-flags)
(list (string-append "--enable-racket=" racket))))
(else
'()))
- ,(string-append "CPPFLAGS=-DGUIX_RKTIO_PATCH_BIN_SH="
- #$(file-append bash-minimal "/bin/sh"))
"--disable-strip"
;; Using --enable-origtree lets us distinguish the VM from subsequent
;; layers and produces a build with the shape expected by tools such as
@@ -267,7 +263,6 @@ (define-public racket-vm-cgc
(version %racket-version)
(source %racket-origin)
(inputs (list ncurses ;; <- common to all variants (for #%terminal)
- bash-minimal ;; <- common to all variants (for `system`)
libffi)) ;; <- only for BC variants
(native-inputs (list libtool)) ;; <- only for BC variants
(outputs '("out" "debug"))
@@ -276,7 +271,7 @@ (define-public racket-vm-cgc
(list
#:configure-flags
#~(cons "--enable-cgcdefault"
- #$(racket-vm-common-configure-flags))
+ #$racket-vm-common-configure-flags)
;; Tests are in packages like racket-test-core and
;; main-distribution-test that aren't part of the main
;; distribution.
@@ -359,7 +354,7 @@ (define-public racket-vm-bc
(substitute-keyword-arguments (package-arguments racket-vm-cgc)
((#:configure-flags _ '())
#~(cons "--enable-bconly"
- #$(racket-vm-common-configure-flags)))))
+ #$racket-vm-common-configure-flags))))
(synopsis "Racket BC [3M] implementation")
(description "The Racket BC (``before Chez'' or ``bytecode'')
implementation was the default before Racket 8.0. It uses a compiler written
@@ -405,7 +400,7 @@ (define-public racket-vm-cs
#$(this-package-native-input
"chez-scheme-for-racket")
"/bin/scheme")
- #$(racket-vm-common-configure-flags)))))
+ #$racket-vm-common-configure-flags))))
(synopsis "Racket CS implementation")
(description "The Racket CS implementation, which uses ``Chez Scheme'' as
its core compiler and runtime system, has been the default Racket VM
--
2.32.0
P
P
Philip McGrath wrote on 27 Aug 2022 20:55
[PATCH v4 04/14] etc: teams: Add entry for Philip McGrath.
(address . 57050@debbugs.gnu.org)
c8527081eb459eca51e229cd2be49612b42adcae.1661626113.git.philip@philipmcgrath.com
* etc/teams.scm.in ("Philip McGrath"): New member.
---
etc/teams.scm.in | 4 ++++
1 file changed, 4 insertions(+)

Toggle diff (17 lines)
diff --git a/etc/teams.scm.in b/etc/teams.scm.in
index e2eb5048f6..38b7ab8e1d 100644
--- a/etc/teams.scm.in
+++ b/etc/teams.scm.in
@@ -238,6 +238,10 @@ (define-member (person "Julien Lepiller"
"julien@lepiller.eu")
java ocaml translations)
+(define-member (person "Philip McGrath"
+ "philip@philipmcgrath.com")
+ racket)
+
(define-member (person "Mathieu Othacehe"
"othacehe@gnu.org")
core installer mentors)
--
2.32.0
P
P
Philip McGrath wrote on 27 Aug 2022 20:55
[PATCH v4 06/14] gnu: chez-scheme: Fix use of "/bin/sh".
(address . 57050@debbugs.gnu.org)
c0246dec3c6cd8d80022dc1dac29ac6f8b173180.1661626113.git.philip@philipmcgrath.com
The unsuccessful attempt to execute "/bin/sh" by Chez Scheme's 'process'
function seems to have caused parts of the Chez Scheme test suite to
have been silently skipped. The issue was exposed by the upcoming
changes to Racket's build system.

* gnu/packages/patches/chez-scheme-bin-sh.patch,
gnu/packages/patches/racket-chez-scheme-bin-sh.patch: New patches.
* gnu/local.mk (dist_patch_DATA): Add them.
* gnu/packages/racket.scm (%racket-origin)[patches]: Update accordingly.
* gnu/packages/chez.scm (chez-scheme)[origin]<patches>: Likewise.
---
gnu/local.mk | 2 +
gnu/packages/chez.scm | 1 +
gnu/packages/patches/chez-scheme-bin-sh.patch | 76 +++++++++++++++++++
.../patches/racket-chez-scheme-bin-sh.patch | 76 +++++++++++++++++++
gnu/packages/racket.scm | 3 +-
5 files changed, 157 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/patches/chez-scheme-bin-sh.patch
create mode 100644 gnu/packages/patches/racket-chez-scheme-bin-sh.patch

Toggle diff (212 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index fae32a11e5..babd54c8c6 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -941,6 +941,7 @@ dist_patch_DATA = \
%D%/packages/patches/ceph-boost-compat.patch \
%D%/packages/patches/ceph-rocksdb-compat.patch \
%D%/packages/patches/cheese-vala-update.patch \
+ %D%/packages/patches/chez-scheme-bin-sh.patch \
%D%/packages/patches/chmlib-inttypes.patch \
%D%/packages/patches/cl-asdf-config-directories.patch \
%D%/packages/patches/clamav-config-llvm-libs.patch \
@@ -1768,6 +1769,7 @@ dist_patch_DATA = \
%D%/packages/patches/ripperx-missing-file.patch \
%D%/packages/patches/rpcbind-CVE-2017-8779.patch \
%D%/packages/patches/rtags-separate-rct.patch \
+ %D%/packages/patches/racket-chez-scheme-bin-sh.patch \
%D%/packages/patches/racket-rktio-bin-sh.patch \
%D%/packages/patches/remake-impure-dirs.patch \
%D%/packages/patches/restic-0.9.6-fix-tests-for-go1.15.patch \
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 812d41fc5b..c627c4d842 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -269,6 +269,7 @@ (define-public chez-scheme
(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
diff --git a/gnu/packages/patches/chez-scheme-bin-sh.patch b/gnu/packages/patches/chez-scheme-bin-sh.patch
new file mode 100644
index 0000000000..7650914f01
--- /dev/null
+++ b/gnu/packages/patches/chez-scheme-bin-sh.patch
@@ -0,0 +1,76 @@
+From 3c838e6a0c3214d95bf02048cddccfd1b69a679f Mon Sep 17 00:00:00 2001
+From: Philip McGrath <philip@philipmcgrath.com>
+Date: Thu, 19 May 2022 13:41:56 -0400
+Subject: [PATCH] patch s_process for "/bin/sh" on Guix
+
+If:
+
+ 1. The nonstandard but ubiquitous macro `_PATH_BSHELL` from
+ <paths.h> is defined; and
+
+ 2. The path specified by `_PATH_BSHELL` exists;
+
+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.
+
+This patch does not change the behavior of `s_system`, which relies
+on `system` from the C library.
+---
+ c/prim5.c | 21 ++++++++++++++++++++-
+ 1 file changed, 20 insertions(+), 1 deletion(-)
+
+diff --git a/c/prim5.c b/c/prim5.c
+index 5a07893..bc2736c 100644
+--- a/c/prim5.c
++++ b/c/prim5.c
+@@ -23,6 +23,12 @@
+ #include <ctype.h>
+ #include <math.h>
+
++/* BEGIN PATCH for Guix */
++#ifndef WIN32
++# include <paths.h>
++#endif
++/* END PATCH for Guix */
++
+ /* locally defined functions */
+ static INT s_errno(void);
+ static iptr s_addr_in_heap(uptr x);
+@@ -746,6 +752,17 @@ static ptr s_process(char *s, IBOOL stderrp) {
+
+ INT tofds[2], fromfds[2], errfds[2];
+ struct sigaction act, oint_act;
++ /* BEGIN PATCH for Guix */
++#if defined(_PATH_BSHELL)
++ struct stat guix_stat_buf;
++ char *guix_sh =
++ (0 == stat(_PATH_BSHELL, &guix_stat_buf))
++ ? _PATH_BSHELL
++ : "/bin/sh";
++#else /* _PATH_BSHELL */
++ char *guix_sh = "/bin/sh";
++#endif
++ /* END PATCH for Guix */
+
+ if (pipe(tofds)) S_error("process","cannot open pipes");
+ if (pipe(fromfds)) {
+@@ -771,7 +788,9 @@ static ptr s_process(char *s, IBOOL stderrp) {
+ CLOSE(1); if (dup(fromfds[1]) != 1) _exit(1);
+ CLOSE(2); if (dup(stderrp ? errfds[1] : 1) != 2) _exit(1);
+ {INT i; for (i = 3; i < NOFILE; i++) (void)CLOSE(i);}
+- execl("/bin/sh", "/bin/sh", "-c", s, NULL);
++ /* BEGIN PATCH for Guix */
++ execl(guix_sh, guix_sh, "-c", s, NULL);
++ /* END PATCH for Guix */
+ _exit(1) /* only if execl fails */;
+ /*NOTREACHED*/
+ } else {
+
+base-commit: 9df56e7b25bc523663eac3da24be33afc5f76c84
+--
+2.32.0
+
diff --git a/gnu/packages/patches/racket-chez-scheme-bin-sh.patch b/gnu/packages/patches/racket-chez-scheme-bin-sh.patch
new file mode 100644
index 0000000000..65cf2f99f3
--- /dev/null
+++ b/gnu/packages/patches/racket-chez-scheme-bin-sh.patch
@@ -0,0 +1,76 @@
+From e982b6687494bf071386c67be74e57a29cf4ce00 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
+
+If:
+
+ 1. The nonstandard but ubiquitous macro `_PATH_BSHELL` from
+ <paths.h> is defined; and
+
+ 2. The path specified by `_PATH_BSHELL` exists;
+
+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.
+
+This patch does not change the behavior of `s_system`, which relies
+on `system` from the C library.
+---
+ 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 f5e3e345be..922421ca75 100644
+--- a/racket/src/ChezScheme/c/prim5.c
++++ b/racket/src/ChezScheme/c/prim5.c
+@@ -22,6 +22,12 @@
+ #include <limits.h>
+ #include <ctype.h>
+
++/* BEGIN PATCH for Guix */
++#ifndef WIN32
++# include <paths.h>
++#endif
++/* END PATCH for Guix */
++
+ /* locally defined functions */
+ static INT s_errno PROTO((void));
+ static IBOOL s_addr_in_heap PROTO((uptr x));
+@@ -856,6 +862,17 @@ static ptr s_process(s, stderrp) char *s; IBOOL stderrp; {
+
+ INT tofds[2], fromfds[2], errfds[2];
+ struct sigaction act, oint_act;
++ /* BEGIN PATCH for Guix */
++#if defined(_PATH_BSHELL)
++ struct stat guix_stat_buf;
++ char *guix_sh =
++ (0 == stat(_PATH_BSHELL, &guix_stat_buf))
++ ? _PATH_BSHELL
++ : "/bin/sh";
++#else /* _PATH_BSHELL */
++ char *guix_sh = "/bin/sh";
++#endif
++ /* END PATCH for Guix */
+
+ if (pipe(tofds)) S_error("process","cannot open pipes");
+ if (pipe(fromfds)) {
+@@ -881,7 +898,9 @@ static ptr s_process(s, stderrp) char *s; IBOOL stderrp; {
+ CLOSE(1); if (dup(fromfds[1]) != 1) _exit(1);
+ CLOSE(2); if (dup(stderrp ? errfds[1] : 1) != 2) _exit(1);
+ {INT i; for (i = 3; i < NOFILE; i++) (void)CLOSE(i);}
+- execl("/bin/sh", "/bin/sh", "-c", s, NULL);
++ /* BEGIN PATCH for Guix */
++ execl(guix_sh, guix_sh, "-c", s, NULL);
++ /* END PATCH for Guix */
+ _exit(1) /* only if execl fails */;
+ /*NOTREACHED*/
+ } else {
+
+base-commit: 9d228d16fb99c274c964e5bef93e97333888769f
+--
+2.32.0
+
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index 319f63f9d2..0f766e7850 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -211,7 +211,8 @@ (define %racket-origin
(sha256
(base32 "0f9zyhdvbh4xsndrqjzl85j5ziz0rmqi676g9s1lw3h3skq2636h"))
(file-name (git-file-name "racket" %racket-version))
- (patches (search-patches "racket-rktio-bin-sh.patch"))
+ (patches (search-patches "racket-chez-scheme-bin-sh.patch"
+ "racket-rktio-bin-sh.patch"))
(modules '((guix build utils)))
(snippet
#~(begin
--
2.32.0
P
P
Philip McGrath wrote on 27 Aug 2022 20:55
[PATCH v4 08/14] gnu: racket: Update to 8.6.
(address . 57050@debbugs.gnu.org)
75705f7ebdc1bbacbc79b98020533bb0a7417443.1661626113.git.philip@philipmcgrath.com
Also, update 'chez-scheme-for-racket' to 9.5.9.2.

* gnu/packages/patches/racket-chez-scheme-bin-sh.patch: Refresh patch.
* gnu/packages/patches/racket-backport-8.6-cross-install.patch,
gnu/packages/patches/racket-backport-8.6-docindex-write.patch,
gnu/packages/patches/racket-backport-8.6-hurd.patch: New patches.
* gnu/local.mk (dist_patch_DATA): Add them.
* gnu/packages/racket.scm (%racket-origin)[patches]: Use them and the
patches for Zuo.
(%racket-version): Update to 8.6.
(zuo)[version]: Refer to '%racket-version'.
[origin]: Use '%racket-origin'.
(racket-vm-cgc)[native-inputs]: Add 'zuo'.
[arguments]<#:make-flags>: Use 'zuo' from 'native-inputs'.
(racket)[inputs]<data, db, deinprogramm, draw, drracket, errortrace,
gui, htdp, math, option-contract, parser-tools, pict, rackunit, realm,
redex, scribble, typed-racket, string-constants, swindle, syntax-color,
web-server>: Update checksums.
* gnu/packages/chez.scm (target-chez-os): Handle Hurd and QNX.
(%chez-features-table): Likewise.
(chez-scheme-for-racket): Update to 9.5.9.2.
[native-inputs]: Add 'zuo'.
[arguments]<#:out-of-source?>: Use out-of-source build.
<#:tests?>: Skip them due to ongoing problems.
<#:configure-flags>: Add '--install-csug=' and '--installreleasenotes='.
<#:make-flags>: Use 'zuo' from 'native-inputs'. Supply 'STEXLIB=' here,
rather than in a phase.
<#:phases>: Replace 'install-docs' using new 'make' target.
---
gnu/packages/chez.scm | 52 +-
.../racket-backport-8.6-cross-install.patch | 126 ++++
.../racket-backport-8.6-docindex-write.patch | 36 ++
.../patches/racket-backport-8.6-hurd.patch | 609 ++++++++++++++++++
.../patches/racket-chez-scheme-bin-sh.patch | 26 +-
gnu/packages/racket.scm | 121 ++--
6 files changed, 893 insertions(+), 77 deletions(-)
create mode 100644 gnu/packages/patches/racket-backport-8.6-cross-install.patch
create mode 100644 gnu/packages/patches/racket-backport-8.6-docindex-write.patch
create mode 100644 gnu/packages/patches/racket-backport-8.6-hurd.patch

Toggle diff (478 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index c627c4d842..b59398578a 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -115,7 +115,7 @@ (define* (target-chez-os #:optional (system (or (%current-target-system)
((target-linux? system)
"le")
((target-hurd? system)
- #f)
+ "gnu")
((target-mingw? system)
"nt")
;; missing (guix utils) predicates
@@ -131,6 +131,8 @@ (define* (target-chez-os #:optional (system (or (%current-target-system)
;; Nix says "x86_64-solaris", but accommodate "-solaris2"
((string-contains system "solaris")
"s2")
+ ((string-suffix? "-qnx" system)
+ "qnx")
;; unknown
(else
#f)))
@@ -167,6 +169,9 @@ (define %chez-features-table
("arm32" bootstrap-bootfiles)
("arm64" . #f)
("ppc32" threads))
+ ;; Hurd
+ ("gnu"
+ ("i3" . #f))
;; FreeBSD
("fb"
("i3" threads) ;; commented out
@@ -192,6 +197,9 @@ (define %chez-features-table
("s2"
("i3" threads) ;; commented out
("a6" threads)) ;; commented out
+ ;; QNX
+ ("qnx"
+ ("i3" . #f))
;; Windows
("nt"
("i3" threads bootstrap-bootfiles)
@@ -433,7 +441,7 @@ (define-public chez-scheme-for-racket
(package
(inherit chez-scheme)
(name "chez-scheme-for-racket")
- (version "9.5.7.6")
+ (version "9.5.9.2")
;; The version should match `(scheme-fork-version-number)`.
;; See racket/src/ChezScheme/s/cmacros.ss c. line 360.
;; It will always be different than the upstream version!
@@ -444,18 +452,52 @@ (define-public chez-scheme-for-racket
(delete "libx11" "util-linux:lib")))
(native-inputs
(modify-inputs (package-native-inputs chez-scheme)
+ (prepend zuo)
(replace "chez-scheme-bootstrap-bootfiles"
chez-scheme-for-racket-bootstrap-bootfiles)))
(arguments
(substitute-keyword-arguments (package-arguments chez-scheme)
+ ((#:out-of-source? _ #f)
+ #t)
+ ((#:tests? _ #t)
+ ;; FIXME: There have been some flaky test failures. Some have been
+ ;; fixed upstream post-release but have proven non-trivial to
+ ;; backport; at least one issue remains. Re-enable tests once
+ ;; https://github.com/racket/racket/issues/4359 is fixed.
+ #f)
((#:configure-flags cfg-flags #~'())
- #~(cons* "--disable-x11"
- "--threads" ;; ok to potentially duplicate
- #$cfg-flags))
+ #~`("--disable-x11"
+ "--threads" ;; ok to potentially duplicate
+ ,@(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)
(unpack (assoc-ref those-phases 'unpack)))
(modify-phases those-phases
+ (replace 'install-docs
+ (lambda* (#:key make-flags #:allow-other-keys)
+ (apply invoke
+ "make"
+ "install-docs"
+ make-flags)))
(replace 'unpack
(lambda args
(unpack #:source #$(or (package-source this-package)
diff --git a/gnu/packages/patches/racket-backport-8.6-cross-install.patch b/gnu/packages/patches/racket-backport-8.6-cross-install.patch
new file mode 100644
index 0000000000..2c4d8924ed
--- /dev/null
+++ b/gnu/packages/patches/racket-backport-8.6-cross-install.patch
@@ -0,0 +1,126 @@
+From fbe2094f56fb81c888076c781e90fb0abbc0cc07 Mon Sep 17 00:00:00 2001
+From: Matthew Flatt <mflatt@racket-lang.org>
+Date: Sat, 30 Jul 2022 07:06:55 -0600
+Subject: [PATCH 1/2] CS makefiles: fix Unix-style install for cross
+ compilation
+
+Closes #4377
+
+(cherry picked from commit 053be470e7c5454cdf48e934f3254d2d916bbbc5)
+---
+ racket/src/cs/c/build.zuo | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/racket/src/cs/c/build.zuo b/racket/src/cs/c/build.zuo
+index 8d3950bb27..d8b74c509d 100644
+--- a/racket/src/cs/c/build.zuo
++++ b/racket/src/cs/c/build.zuo
+@@ -1016,10 +1016,9 @@
+ (define (setup)
+ (call-with-dest-racket
+ (lambda (bindir dest-racket)
+- (define copytree-racket (and cross? (config-bootstrap-racket)))
++ (define copytree-racket (and cross? (hash-ref (config-bootstrap-racket) 'racket)))
+ (maybe-copytree config dest-racket copytree-racket at-dir)
+- (run-raco-setup config dest-racket
+- (and cross? (hash-ref (config-bootstrap-racket) 'racket))
++ (run-raco-setup config dest-racket copytree-racket
+ ;; this can be redundant if it's also supplied via `SETUP_MACHINE_FLAGS`,
+ ;; but redundant should be ok:
+ (list "-MCR" (~a (at-dir "compiled") ":")
+--
+2.32.0
+
+
+From 85802f4d515e310e657928707800ad709a676e2a Mon Sep 17 00:00:00 2001
+From: Matthew Flatt <mflatt@racket-lang.org>
+Date: Mon, 15 Aug 2022 10:37:01 +0800
+Subject: [PATCH 2/2] configure: adjust cross-build assumption for a pb build
+
+Don't assume a cross build for a pb target on a platform that's only
+supported via pb.
+
+(cherry picked from commit 70e484e885637c495be5481983dae2207fdd67bb)
+
+(Edited to remove unrelated tweak to comments in
+"racket/src/expander/expand/require+provide.rkt".)
+---
+ racket/src/cs/c/configure | 15 +++++++++++----
+ racket/src/cs/c/configure.ac | 15 +++++++++++----
+ 2 files changed, 22 insertions(+), 8 deletions(-)
+
+diff --git a/racket/src/cs/c/configure b/racket/src/cs/c/configure
+index 454d79e11a..7e0fa5600d 100755
+--- a/racket/src/cs/c/configure
++++ b/racket/src/cs/c/configure
+@@ -4679,6 +4679,11 @@ case "$MACH_HOST_CPU" in
+ ;;
+ esac
+
++if test "${MACH}" = "" ; then
++ default_mach_was_empty=yes
++else
++ default_mach_was_empty=no
++fi
+
+ if test "${enable_mach}" != "" ; then
+ MACH="${enable_mach}"
+@@ -4701,13 +4706,15 @@ elif test "$MACH" = "" -o "$MACH_OS" = "" ; then
+ exit 1
+ fi
+
+-# For a pb build where Racket is supplied, force cross-build
+-# mode on the assumption that the host is not a pb build
+-# (because it should be created with default configure options)
++# For a pb build where Racket is supplied and MACH was not originally
++# empty, force cross-build mode on the assumption that the host is not
++# a pb build (because it should be created with default configure options)
+ if test "${enable_pb}" = "yes" ; then
+ if test "${enable_racket}" != "" ; then
+ if test "${enable_target}" = "" ; then
+- enable_target="${MACH}"
++ if test "${default_mach_was_empty}" = "no" ; then
++ enable_target="${MACH}"
++ fi
+ fi
+ fi
+ fi
+diff --git a/racket/src/cs/c/configure.ac b/racket/src/cs/c/configure.ac
+index 5bce979c92..734c1e8feb 100644
+--- a/racket/src/cs/c/configure.ac
++++ b/racket/src/cs/c/configure.ac
+@@ -415,6 +415,11 @@ case "$MACH_HOST_CPU" in
+ ;;
+ esac
+
++if test "${MACH}" = "" ; then
++ default_mach_was_empty=yes
++else
++ default_mach_was_empty=no
++fi
+
+ if test "${enable_mach}" != "" ; then
+ MACH="${enable_mach}"
+@@ -437,13 +442,15 @@ elif test "$MACH" = "" -o "$MACH_OS" = "" ; then
+ exit 1
+ fi
+
+-# For a pb build where Racket is supplied, force cross-build
+-# mode on the assumption that the host is not a pb build
+-# (because it should be created with default configure options)
++# For a pb build where Racket is supplied and MACH was not originally
++# empty, force cross-build mode on the assumption that the host is not
++# a pb build (because it should be created with default configure options)
+ if test "${enable_pb}" = "yes" ; then
+ if test "${enable_racket}" != "" ; then
+ if test "${enable_target}" = "" ; then
+- enable_target="${MACH}"
++ if test "${default_mach_was_empty}" = "no" ; then
++ enable_target="${MACH}"
++ fi
+ fi
+ fi
+ fi
+--
+2.32.0
+
diff --git a/gnu/packages/patches/racket-backport-8.6-docindex-write.patch b/gnu/packages/patches/racket-backport-8.6-docindex-write.patch
new file mode 100644
index 0000000000..abe1984507
--- /dev/null
+++ b/gnu/packages/patches/racket-backport-8.6-docindex-write.patch
@@ -0,0 +1,36 @@
+From 8b4d686a62fd66dedfc40ecdcf3698316993d614 Mon Sep 17 00:00:00 2001
+From: Philip McGrath <philip@philipmcgrath.com>
+Date: Sun, 17 Jul 2022 22:51:44 -0400
+Subject: [PATCH] racket-index: set write permission when copying
+ `docindex.sqlite`
+
+Fixes https://github.com/racket/racket/issues/4357
+
+(cherry picked from commit 55b6cbdca1f36a4f37bab1519c1b658717d3cad2)
+---
+ pkgs/racket-index/setup/scribble.rkt | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/pkgs/racket-index/setup/scribble.rkt b/pkgs/racket-index/setup/scribble.rkt
+index 6694f0b793..e27a8fa348 100644
+--- a/pkgs/racket-index/setup/scribble.rkt
++++ b/pkgs/racket-index/setup/scribble.rkt
+@@ -252,7 +252,14 @@
+ (unless (file-exists? db-file)
+ (define-values (base name dir?) (split-path db-file))
+ (make-directory* base)
+- (when copy-from (copy-file copy-from db-file))
++ (when copy-from
++ (copy-file copy-from db-file)
++ ;; we might not have write permissions for the previous layer:
++ ;; ensure that we do for the new file
++ (define orig-mode (file-or-directory-permissions db-file 'bits))
++ (define writeable-mode (bitwise-ior user-write-bit orig-mode))
++ (unless (= writeable-mode orig-mode)
++ (file-or-directory-permissions db-file writeable-mode)))
+ (doc-db-disconnect
+ (doc-db-file->connection db-file #t))))
+ (when (or (ormap can-build*? main-docs)
+--
+2.32.0
+
diff --git a/gnu/packages/patches/racket-backport-8.6-hurd.patch b/gnu/packages/patches/racket-backport-8.6-hurd.patch
new file mode 100644
index 0000000000..d593b01e62
--- /dev/null
+++ b/gnu/packages/patches/racket-backport-8.6-hurd.patch
@@ -0,0 +1,609 @@
+From f17b030fa2f902bb3666913d4a3cd6ba9c146d22 Mon Sep 17 00:00:00 2001
+From: Philip McGrath <philip@philipmcgrath.com>
+Date: Wed, 3 Aug 2022 03:13:03 -0400
+Subject: [PATCH 1/3] Chez Scheme: Fix build on GNU/Hurd
+
+Mostly GNU/Hurd should take the same options as GNU/Linux. One
+difference is that the Hurd does not define macros such as `PATH_MAX` or
+`NOFILE`, because it avoids imposing arbitrary limits on such resources.
+This patch provides alternatives for localized uses of those constants,
+but it accepts the pervasive use of `PATH_MAX` in finding bootfiles for
+now. See https://www.gnu.org/software/hurd/hurd/porting/guidelines.html.
+
+(cherry picked from commit 87eee6e2adb8c6bc11e60619c706fa6295096085)
+---
+ racket/src/ChezScheme/README.md | 1 +
+ racket/src/ChezScheme/c/number.c | 22 +++++++++----------
+ racket/src/ChezScheme/c/prim5.c | 35 ++++++++++++++++++++++++++++--
+ racket/src/ChezScheme/c/scheme.c | 34 +++++++++++++++++------------
+ racket/src/ChezScheme/c/version.h | 7 ++++--
+ racket/src/ChezScheme/configure | 17 ++++++++++-----
+ racket/src/ChezScheme/s/cmacros.ss | 1 +
+ racket/src/cs/c/configure | 14 ++++++++++--
+ racket/src/cs/c/configure.ac | 14 ++++++++++--
+ racket/src/cs/rumble/system.ss | 3 +++
+ 10 files changed, 109 insertions(+), 39 deletions(-)
+
+diff --git a/racket/src/ChezScheme/README.md b/racket/src/ChezScheme/README.md
+index a4a11a5eef..25231dd9bb 100644
+--- a/racket/src/ChezScheme/README.md
++++ b/racket/src/ChezScheme/README.md
+@@ -13,6 +13,7 @@ Supported platforms (bytecode interpreter may work for others):
+ * OpenBSD: x86, x86_64, ARMv6, AArch64, PowerPC32
+ * NetBSD: x86, x86_64, ARMv6, AArch64, PowerPC32
+ * Solaris: x86, x86_64
++ * GNU/Hurd: x86
+ * Android: ARMv7, AArch64
+ * iOS: AArch64
+ * WebAssembly via Emscripten (bytecode interpreter only)
+diff --git a/racket/src/ChezScheme/c/number.c b/racket/src/ChezScheme/c/number.c
+index ede38cc626..e2bce0d2d3 100644
+--- a/racket/src/ChezScheme/c/number.c
++++ b/racket/src/ChezScheme/c/number.c
+@@ -1041,15 +1041,15 @@ floating-point operations
+
+ #ifdef IEEE_DOUBLE
+ /* exponent stored + 1024, hidden bit to left of decimal point */
+-#define bias 1023
+-#define bitstoright 52
+-#define m1mask 0xf
+-#ifdef WIN32
+-#define hidden_bit 0x10000000000000
+-#else
+-#define hidden_bit 0x10000000000000ULL
+-#endif
+-#ifdef LITTLE_ENDIAN_IEEE_DOUBLE
++# define bias 1023
++# define bitstoright 52
++# define m1mask 0xf
++# ifdef WIN32
++# define hidden_bit 0x10000000000000
++# else
++# define hidden_bit 0x10000000000000ULL
++# endif
++# ifdef LITTLE_ENDIAN_IEEE_DOUBLE
+ struct dblflt {
+ UINT m4: 16;
+ UINT m3: 16;
+@@ -1058,7 +1058,7 @@ struct dblflt {
+ UINT e: 11;
+ UINT sign: 1;
+ };
+-#else
++# else
+ struct dblflt {
+ UINT sign: 1;
+ UINT e: 11;
+@@ -1067,7 +1067,7 @@ struct dblflt {
+ UINT m3: 16;
+ UINT m4: 16;
+ };
+-#endif
++# endif
+ #endif
+
+ double S_random_double(U32 m1, U32 m2, U32 m3, U32 m4, double scale) {
+diff --git a/racket/src/ChezScheme/c/prim5.c b/racket/src/ChezScheme/c/prim5.c
+index 124d1e049c..82bbf8d687 100644
+--- a/racket/src/ChezScheme/c/prim5.c
++++ b/racket/src/ChezScheme/c/prim5.c
+@@ -23,6 +23,10 @@
+ #include <ctype.h>
+ #include <math.h>
+
++#if defined(__GNU__) /* Hurd */
++#include <sys/resource.h>
++#endif
++
+ /* locally defined functions */
+ static INT s_errno(void);
+ static IBOOL s_addr_in_heap(uptr x);
+@@ -58,7 +62,7 @@ static void s_showalloc(IBOOL show_dump, const char *outfn);
+ static ptr s_system(const char *s);
+ static ptr s_process(char *s, IBOOL stderrp);
+ static I32 s_chdir(const char *inpath);
+-#ifdef GETWD
++#if defined(GETWD) || defined(__GNU__) /* Hurd */
+ static char *s_getwd(void);
+ #endif
+ static ptr s_set_code_byte(ptr p, ptr n, ptr x);
+@@ -881,7 +885,18 @@ static ptr s_process(char *s, IBOOL stderrp) {
+ CLOSE(0); if (dup(tofds[0]) != 0) _exit(1);
+ CLOSE(1); if (dup(fromfds[1]) != 1) _exit(1);
+ CLOSE(2); if (dup(stderrp ? errfds[1] : 1) != 2) _exit(1);
++#ifndef __GNU__ /* Hurd */
+ {INT i; for (i = 3; i < NOFILE; i++) (void)CLOSE(i);}
++#else /* __GNU__ Hurd: no NOFILE */
++ {
++ INT i;
++ struct rlimit rlim;
++ getrlimit(RLIMIT_NOFILE, &rlim);
++ for (i = 3; i < rlim.rlim_cur; i++) {
++ (void)CLOSE(i);
++ }
++ }
++#endif /* __GNU__ Hurd */
+ execl("/bin/sh", "/bin/sh", "-c", s, NULL);
+ _exit(1) /* only if execl fails */;
+ /*NOTREACHED*/
+@@ -927,6 +942,22 @@ static I32 s_chdir(const char *inpath) {
+ static char *s_getwd() {
+ return GETWD(TO_VOIDP(&BVIT(S_bytevector(PATH_MAX), 0)));
+ }
++#elif defined(__GNU__) /* Hurd: no PATH_MAX */
++static char *s_getwd() {
++ char *path;
++ size_t len;
++ ptr bv;
++ path = getcwd(NULL, 0);
++ if (NULL == path) {
++ return NULL;
++ } else {
++ len = strlen(path);
++ bv = S_bytevector(len);
++ memcpy(TO_VOIDP(&BVIT(bv, 0)), path, len);
++ free(path);
++ return TO_VOIDP(&BVIT(bv, 0));
++ }
++}
+ #endif /* GETWD */
+
+ static ptr s_set_code_byte(ptr p, ptr n, ptr x) {
+@@ -1817,7 +1848,7 @@ void S_prim5_init(void) {
+ Sforeign_symbol("(cs)s_rational", (void *)S_rational);
+ Sforeign_symbol("(cs)sub", (void *)S_sub);
+ Sforeign_symbol("(cs)rem", (void *)S_rem);
+-#ifdef GETWD
++#if defined(GETWD) || defined(__GNU__) /* Hurd */
+ Sforeign_symbol("(cs)s_getwd", (void *)s_getwd);
+ #endif
+ Sforeign_symbol("(cs)s_chdir", (void *)s_chdir);
+diff --git a/racket/src/ChezScheme/c/scheme.c b/racket/src/ChezScheme/c/scheme.c
+index ed5564540b..0c40e3eaf0 100644
+--- a/racket/src/ChezScheme/c/scheme.c
++++ b/racket/src/ChezScheme/c/scheme.c
+@@ -458,6 +458,12 @@ static IBOOL next_path(char *path, const char *name, const char *ext, const char
+ static const char *path_last(const char *path);
+ static char *get_defaultheapdirs(void);
+
++#ifdef PATH_MAX
++# define BOOT_PATH_MAX PATH_MAX
++#else /* hack for Hurd: better to remove the restriction */
++# define BOOT_PATH_MAX 4096
++#endif
++
+ static const char *path_last(const char *p) {
+ const char *s;
+ #ifdef WIN32
+@@ -483,7 +489,7 @@ static const char *path_last(const char *p) {
+
+ static char *get_defaultheapdirs() {
+ char *result;
+- wchar_t buf[PATH_MAX];
++ wchar_t buf[BOOT_PATH_MAX];
+ DWORD len = sizeof(buf);
+ if (ERROR_SUCCESS != RegGetValueW(HKEY_LOCAL_MACHINE, L"Software\\Chez Scheme\\csv" VERSION, L"HeapSearchPath", RRF_RT_REG_SZ, NULL, buf, &len))
+ return DEFAULT_HEAP_PATH;
+@@ -512,14 +518,14 @@ static char *get_defaultheapdirs() {
+ * leaving the full path with name affixed in path and *sp / *dsp pointing
+ * past the current entry. it returns 1 on success and 0 if at the end of
+ * the search path. path should be a pointer to an unoccupied buffer
+- * PATH_MAX characters long. either or both of sp/dsp
This message was truncated. Download the full message here.
P
P
Philip McGrath wrote on 27 Aug 2022 20:55
[PATCH v4 07/14] gnu: Add Zuo.
(address . 57050@debbugs.gnu.org)
dd79e097309d24801e65f27fd19d25adaebb7a5e.1661626113.git.philip@philipmcgrath.com
* gnu/packages/patches/racket-backport-8.6-zuo.patch,
gnu/packages/patches/racket-zuo-bin-sh.patch: New patches.
* gnu/local.mk (dist_patch_DATA): Add them.
* gnu/packages/racket.scm (%zuo-version): New variable.
(zuo): New variable.
---
gnu/local.mk | 2 +
.../patches/racket-backport-8.6-zuo.patch | 481 ++++++++++++++++++
gnu/packages/patches/racket-zuo-bin-sh.patch | 74 +++
gnu/packages/racket.scm | 49 ++
4 files changed, 606 insertions(+)
create mode 100644 gnu/packages/patches/racket-backport-8.6-zuo.patch
create mode 100644 gnu/packages/patches/racket-zuo-bin-sh.patch

Toggle diff (555 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index babd54c8c6..c9c3061b33 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1769,8 +1769,10 @@ dist_patch_DATA = \
%D%/packages/patches/ripperx-missing-file.patch \
%D%/packages/patches/rpcbind-CVE-2017-8779.patch \
%D%/packages/patches/rtags-separate-rct.patch \
+ %D%/packages/patches/racket-backport-8.6-zuo.patch \
%D%/packages/patches/racket-chez-scheme-bin-sh.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/restic-0.9.6-fix-tests-for-go1.15.patch \
%D%/packages/patches/retroarch-LIBRETRO_DIRECTORY.patch \
diff --git a/gnu/packages/patches/racket-backport-8.6-zuo.patch b/gnu/packages/patches/racket-backport-8.6-zuo.patch
new file mode 100644
index 0000000000..b86679b7ec
--- /dev/null
+++ b/gnu/packages/patches/racket-backport-8.6-zuo.patch
@@ -0,0 +1,481 @@
+From 8761fc06b188b9ca2f4b7f2b7d1235075c44a321 Mon Sep 17 00:00:00 2001
+From: Matthew Flatt <mflatt@racket-lang.org>
+Date: Sat, 23 Jul 2022 17:10:58 -0600
+Subject: [PATCH 1/4] Zuo: support cross compilation via `configure` and
+ `CC_FOR_BUILD`
+
+(cherry picked from commit 798a989ba6d1a30c491a3120b2c2f1570ecab911)
+---
+ racket/src/zuo/Makefile.in | 7 ++++++-
+ racket/src/zuo/README.md | 10 ++++++++++
+ racket/src/zuo/configure | 15 +++++++++++++++
+ racket/src/zuo/configure.ac | 11 +++++++++++
+ 4 files changed, 42 insertions(+), 1 deletion(-)
+
+diff --git a/racket/src/zuo/Makefile.in b/racket/src/zuo/Makefile.in
+index 5d16e145bf..747b584c5c 100644
+--- a/racket/src/zuo/Makefile.in
++++ b/racket/src/zuo/Makefile.in
+@@ -17,6 +17,11 @@ CPPFLAGS = @CPPFLAGS@
+ LDFLAGS = @LDFLAGS@
+ LIBS = @LIBS@
+
++CC_FOR_BUILD = @CC_FOR_BUILD@
++CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
++LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
++LIBS_FOR_BUILD = @LIBS_FOR_BUILD@
++
+ EMBED_LIBS = @EMBED_LIBS@
+
+ .PHONY: zuos-to-run-and-install
+@@ -24,7 +29,7 @@ zuos-to-run-and-install: zuo
+ ./zuo . zuos-to-run-and-install
+
+ zuo: $(srcdir)/zuo.c
+- $(CC) $(CPPFLAGS) $(CFLAGS) -DZUO_LIB_PATH='"'"$(srcdir)/lib"'"' -o zuo $(srcdir)/zuo.c $(LDFLAGS) $(LIBS)
++ $(CC_FOR_BUILD) $(FLAGS_FOR_BUILD) -DZUO_LIB_PATH='"'"$(srcdir)/lib"'"' -o zuo $(srcdir)/zuo.c $(LDFLAGS_FOR_BUILD) $(LIBS_FOR_BUILD)
+
+ .PHONY: check
+ check: zuo
+diff --git a/racket/src/zuo/README.md b/racket/src/zuo/README.md
+index 17c88ee9ec..3aad504b7e 100644
+--- a/racket/src/zuo/README.md
++++ b/racket/src/zuo/README.md
+@@ -84,6 +84,16 @@ A boot image is machine-independent, whether in a stand-alone file or
+ embedded in `.c` source.
+
+
++Cross Compiling
++---------------
++
++If you use `./configure --host=...` to cross compile, then you will
++also need to add something like `CC_FOR_BUILD=cc` as a `./configure`
++argument to specify the compiler for a `zuo` to use on the build
++machine. If necessary, you can also specify `CFLAGS_FOR_BUILD`,
++`LDFLAGS_FOR_BUILD`, and/or `LIBS_FOR_BUILD`.
++
++
+ Embedding Zuo in Another Application
+ ------------------------------------
+
+diff --git a/racket/src/zuo/configure b/racket/src/zuo/configure
+index 1fa34a3fe8..575ce07d96 100755
+--- a/racket/src/zuo/configure
++++ b/racket/src/zuo/configure
+@@ -589,6 +589,10 @@ enable_embed="zuo"
+ ac_subst_vars='LTLIBOBJS
+ LIBOBJS
+ EMBED_LIBS
++LIBS_FOR_BUILD
++LDFLAGS_FOR_BUILD
++CFLAGS_FOR_BUILD
++CC_FOR_BUILD
+ OBJEXT
+ EXEEXT
+ ac_ct_CC
+@@ -2584,6 +2588,17 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
+ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
++if test "${CC_FOR_BUILD}" = ""; then
++ CC_FOR_BUILD='$(CC) -O2'
++ CFLAGS_FOR_BUILD='$(CPPFLAGS) $(CFLAGS)'
++ LDFLAGS_FOR_BUILD='$(LDFLAGS)'
++ LIBS_FOR_BUILD='$(LIBS)'
++fi
++
++
++
++
++
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: zuo libraries to embed: \"${EMBED_LIBS}\"" >&5
+ $as_echo "$as_me: zuo libraries to embed: \"${EMBED_LIBS}\"" >&6;}
+diff --git a/racket/src/zuo/configure.ac b/racket/src/zuo/configure.ac
+index 89b3c6391d..598ff79629 100644
+--- a/racket/src/zuo/configure.ac
++++ b/racket/src/zuo/configure.ac
+@@ -25,6 +25,17 @@ AS_IF([test "x$enable_embed" = xno],
+ AC_PROG_MAKE_SET()
+ AC_PROG_CC
+
++if test "${CC_FOR_BUILD}" = ""; then
++ CC_FOR_BUILD='$(CC) -O2'
++ CFLAGS_FOR_BUILD='$(CPPFLAGS) $(CFLAGS)'
++ LDFLAGS_FOR_BUILD='$(LDFLAGS)'
++ LIBS_FOR_BUILD='$(LIBS)'
++fi
++AC_SUBST(CC_FOR_BUILD)
++AC_SUBST(CFLAGS_FOR_BUILD)
++AC_SUBST(LDFLAGS_FOR_BUILD)
++AC_SUBST(LIBS_FOR_BUILD)
++
+ AC_SUBST(EMBED_LIBS)
+ AC_MSG_NOTICE([zuo libraries to embed: "${EMBED_LIBS}"])
+
+--
+2.32.0
+
+
+From f65194ea41eb472fbdd45d5f6c13eabe5e681704 Mon Sep 17 00:00:00 2001
+From: Matthew Flatt <mflatt@racket-lang.org>
+Date: Sat, 23 Jul 2022 17:47:03 -0600
+Subject: [PATCH 2/4] Zuo: sort hash keys
+
+Printing in a sorted order is helpful to make things more
+deterministic independent of symbol inputs. Making `hash-keys`
+produce a sorted list generalizes that determinism.
+
+(cherry picked from commit 4e7ffd3b365d01c5d0993c0b3fd24c9623962edf)
+---
+ racket/src/zuo/build.zuo | 5 ++-
+ racket/src/zuo/tests/hash.zuo | 8 ++--
+ racket/src/zuo/zuo-doc/lang-zuo.scrbl | 18 +++++++--
+ racket/src/zuo/zuo.c | 57 ++++++++++++++++++++++++++-
+ 4 files changed, 78 insertions(+), 10 deletions(-)
+
+diff --git a/racket/src/zuo/build.zuo b/racket/src/zuo/build.zuo
+index c1b5e8ce66..129240120a 100644
+--- a/racket/src/zuo/build.zuo
++++ b/racket/src/zuo/build.zuo
+@@ -47,7 +47,10 @@
+ (target (at-dir (add-exe name))
+ (lambda (path token)
+ (rule (list image_zuo.c
+- (input-data-target 'config config)
++ (input-data-target 'config (cons
++ lib-path
++ (map (lambda (key) (hash-ref config key))
++ '(CC CPPFLAGS CFLAGS LDFLAGS LIBS))))
+ (quote-module-path))
+ (lambda ()
+ (define l (split-path path))
+diff --git a/racket/src/zuo/tests/hash.zuo b/racket/src/zuo/tests/hash.zuo
+index a35741c730..0d3d7f3af6 100644
+--- a/racket/src/zuo/tests/hash.zuo
++++ b/racket/src/zuo/tests/hash.zuo
+@@ -35,9 +35,7 @@
+
+ (check (hash-keys (hash)) '())
+ (check (hash-keys (hash 'a 1)) '(a))
+-(check (let ([keys (hash-keys (hash 'a 1 'b 2))])
+- (or (equal? keys '(a b))
+- (equal? keys '(b a)))))
++(check (hash-keys (hash 'a 1 'b 2)) '(a b)) ; always in order
+ (check (length (hash-keys (hash 'a 1 'b 2 'c 3))) 3)
+ (check (length (hash-keys (hash 'a 1 'b 2 'a 3))) 2)
+ (check-arg-fail (hash-keys 0) "not a hash table")
+@@ -50,3 +48,7 @@
+ (check (hash-keys-subset? (hash 'a 1 'b 2) (hash 'b 1)) #f)
+ (check-arg-fail (hash-keys-subset? 0 (hash)) "not a hash table")
+ (check-arg-fail (hash-keys-subset? (hash) 0) "not a hash table")
++
++;; print sorts keys alphabetically:
++(check (~a (hash 'a 1 'b 2)) "#hash((a . 1) (b . 2))")
++(check (~a (hash 'b 2 'a 1)) "#hash((a . 1) (b . 2))")
+diff --git a/racket/src/zuo/zuo-doc/lang-zuo.scrbl b/racket/src/zuo/zuo-doc/lang-zuo.scrbl
+index 94641d041e..4605e47471 100644
+--- a/racket/src/zuo/zuo-doc/lang-zuo.scrbl
++++ b/racket/src/zuo/zuo-doc/lang-zuo.scrbl
+@@ -538,10 +538,20 @@ support to convert the textual form back into a hash table value.
+
+ Analogous to @realracket*[hash? hash hash-ref hash-set hash-remove
+ hash-keys hash-count hash-keys-subset?] from @racketmodname[racket].
+-Besides being constrained to symbol keys, there is one additional
+-difference: the third argument to @racket[hash-ref], when supplied,
+-is always used as a value to return if a key is missing, as
+-opposed to a failure thunk.}
++
++Besides being constrained to symbol keys, there are two additional
++differences:
++
++@itemlist[
++
++ @item{the third argument to @racket[hash-ref], when supplied, is
++ always used as a value to return if a key is missing, as
++ opposed to a failure thunk; and}
++
++ @item{the @racket[hash-keys] function returns interned keys sorted
++ alphabetically.}
++
++]}
+
+
+ @section{Procedures}
+diff --git a/racket/src/zuo/zuo.c b/racket/src/zuo/zuo.c
+index 2957d478af..88d5747326 100644
+--- a/racket/src/zuo/zuo.c
++++ b/racket/src/zuo/zuo.c
+@@ -1298,6 +1298,59 @@ static zuo_t *zuo_trie_keys(zuo_t *trie_in, zuo_t *accum) {
+ return accum;
+ }
+
++/*======================================================================*/
++/* symbol-list sorting */
++/*======================================================================*/
++
++/* merge sort used to make hash printing deterministic */
++static zuo_t *zuo_symbol_list_sort(zuo_t *l_in) {
++ zuo_t *l, *left, *right, *first, *last;
++ zuo_uint_t len = 0, i;
++
++ for (l = l_in, len = 0; l != z.o_null; l = _zuo_cdr(l))
++ len++;
++
++ if (len < 2)
++ return l_in;
++
++ left = z.o_null;
++ for (l = l_in, i = len >> 1; i > 0; l = _zuo_cdr(l), i--)
++ left = zuo_cons(_zuo_car(l), left);
++ right = l;
++
++ left = zuo_symbol_list_sort(left);
++ right = zuo_symbol_list_sort(right);
++
++ first = last = z.o_null;
++ while ((left != z.o_null) && (right != z.o_null)) {
++ zuo_t *p;
++
++ if (strcmp(ZUO_STRING_PTR(((zuo_symbol_t *)_zuo_car(left))->str),
++ ZUO_STRING_PTR(((zuo_symbol_t *)_zuo_car(right))->str))
++ < 1) {
++ p = zuo_cons(_zuo_car(left), z.o_null);
++ left = _zuo_cdr(left);
++ } else {
++ p = zuo_cons(_zuo_car(right), z.o_null);
++ right = _zuo_cdr(right);
++ }
++
++ if (first == z.o_null)
++ first = p;
++ else
++ ((zuo_pair_t *)last)->cdr = p;
++ last = p;
++ }
++
++ ((zuo_pair_t *)last)->cdr = ((left != z.o_null) ? left : right);
++
++ return first;
++}
++
++static zuo_t *zuo_trie_sorted_keys(zuo_t *trie_in, zuo_t *accum) {
++ return zuo_symbol_list_sort(zuo_trie_keys(trie_in, accum));
++}
++
+ /*======================================================================*/
+ /* terminal support */
+ /*======================================================================*/
+@@ -1571,7 +1624,7 @@ static void zuo_out(zuo_out_t *out, zuo_t *obj, zuo_print_mode_t mode) {
+ out_string(out, "opaque");
+ out_string(out, ">");
+ } else if (obj->tag == zuo_trie_node_tag) {
+- zuo_t *keys = zuo_trie_keys(obj, z.o_null);
++ zuo_t *keys = zuo_trie_sorted_keys(obj, z.o_null);
+ if (mode == zuo_print_mode) {
+ out_string(out, "(hash");
+ if (keys != z.o_null)
+@@ -2587,7 +2640,7 @@ static zuo_t *zuo_hash_remove(zuo_t *ht, zuo_t *sym) {
+
+ static zuo_t *zuo_hash_keys(zuo_t *ht) {
+ check_hash("hash-keys", ht);
+- return zuo_trie_keys(ht, z.o_null);
++ return zuo_trie_sorted_keys(ht, z.o_null);
+ }
+
+ static zuo_t *zuo_hash_keys_subset_p(zuo_t *ht, zuo_t *ht2) {
+--
+2.32.0
+
+
+From f2eecaa1dd875479d2cf51566223b3d0d7b9f738 Mon Sep 17 00:00:00 2001
+From: Matthew Flatt <mflatt@racket-lang.org>
+Date: Sat, 23 Jul 2022 18:06:41 -0600
+Subject: [PATCH 3/4] Zuo: check for nul characters in `string->symbol`
+
+(cherry picked from commit e20022ccfad40d0ba2e77aa75bc4f775018c781f)
+---
+ racket/src/zuo/tests/symbol.zuo | 3 +++
+ racket/src/zuo/zuo-doc/lang-zuo.scrbl | 4 ++-
+ racket/src/zuo/zuo.c | 37 +++++++++++++++++----------
+ 3 files changed, 29 insertions(+), 15 deletions(-)
+
+diff --git a/racket/src/zuo/tests/symbol.zuo b/racket/src/zuo/tests/symbol.zuo
+index 7775aeeb04..5600a89755 100644
+--- a/racket/src/zuo/tests/symbol.zuo
++++ b/racket/src/zuo/tests/symbol.zuo
+@@ -19,3 +19,6 @@
+ (check (not (equal? 'apple (string->uninterned-symbol "apple"))))
+ (check-arg-fail (string->symbol 'apple) not-string)
+ (check-arg-fail (string->uninterned-symbol 'apple) not-string)
++
++(check-arg-fail (string->symbol "apple\0spice") "without a nul character")
++(check (symbol? (string->uninterned-symbol "apple\0spice")))
+diff --git a/racket/src/zuo/zuo-doc/lang-zuo.scrbl b/racket/src/zuo/zuo-doc/lang-zuo.scrbl
+index 4605e47471..07dd5815b0 100644
+--- a/racket/src/zuo/zuo-doc/lang-zuo.scrbl
++++ b/racket/src/zuo/zuo-doc/lang-zuo.scrbl
+@@ -500,7 +500,9 @@ back into Zuo.
+ )]{
+
+ Analogous to @realracket*[symbol? symbol->string string->symbol
+-string->uninterned-symbol] from @racketmodname[racket].}
++string->uninterned-symbol] from @racketmodname[racket], but
++@racket[string->symbol] accepts only strings that do not contain the
++null character.}
+
+
+ @section{Hash Tables (Persistent Maps)}
+diff --git a/racket/src/zuo/zuo.c b/racket/src/zuo/zuo.c
+index 88d5747326..17f161826d 100644
+--- a/racket/src/zuo/zuo.c
++++ b/racket/src/zuo/zuo.c
+@@ -1323,7 +1323,7 @@ static zuo_t *zuo_symbol_list_sort(zuo_t *l_in) {
+
+ first = last = z.o_null;
+ while ((left != z.o_null) && (right != z.o_null)) {
+- zuo_t *p;
++ zuo_t *p, *s_left, *s_right;
+
+ if (strcmp(ZUO_STRING_PTR(((zuo_symbol_t *)_zuo_car(left))->str),
+ ZUO_STRING_PTR(((zuo_symbol_t *)_zuo_car(right))->str))
+@@ -2573,8 +2573,28 @@ static zuo_t *zuo_substring(zuo_t *obj, zuo_t *start_i, zuo_t *end_i) {
+ return zuo_sized_string((const char *)&((zuo_string_t *)obj)->s[s_idx], e_idx - s_idx);
+ }
+
++static int zuo_is_string_without_nul(zuo_t *obj) {
++ zuo_int_t i;
++
++ if ((obj->tag != zuo_string_tag)
++ || ZUO_STRING_LEN(obj) == 0)
++ return 0;
++
++ for (i = ZUO_STRING_LEN(obj); i--; ) {
++ if (((zuo_string_t *)obj)->s[i] == 0)
++ return 0;
++ }
++
++ return 1;
++}
++
+ static zuo_t *zuo_string_to_symbol(zuo_t *obj) {
+- check_string("string->symbol", obj);
++ if (!zuo_is_string_without_nul(obj)) {
++ const char *who = "string->symbol";
++ check_string(who, obj);
++ zuo_fail_arg(who, "string without a nul character", obj);
++ }
++
+ return zuo_symbol_from_string(ZUO_STRING_PTR(obj), obj);
+ }
+
+@@ -3577,18 +3597,7 @@ static void *zuo_envvars_block(const char *who, zuo_t *envvars)
+ #endif
+
+ static int zuo_is_path_string(zuo_t *obj) {
+- zuo_int_t i;
+-
+- if ((obj->tag != zuo_string_tag)
+- || ZUO_STRING_LEN(obj) == 0)
+- return 0;
+-
+- for (i = ZUO_STRING_LEN(obj); i--; ) {
+- if (((zuo_string_t *)obj)->s[i] == 0)
+- return 0;
+- }
+-
+- return 1;
++ return zuo_is_string_without_nul(obj);
+ }
+
+ static zuo_t *zuo_path_string_p(zuo_t *obj) {
+--
+2.32.0
+
+
+From de6618cb3819d25580e3cd400ea09c8cf4f673a9 Mon Sep 17 00:00:00 2001
+From: Matthew Flatt <mflatt@racket-lang.org>
+Date: Sat, 23 Jul 2022 19:50:46 -0600
+Subject: [PATCH 4/4] Zuo: CPPFLAGS_FOR_BUILD, too
+
+(cherry picked from commit cf82706c4b298f654a04c4bc8d98dff39b62a2ac)
+---
+ racket/src/zuo/Makefile.in | 3 ++-
+ racket/src/zuo/configure | 5 ++++-
+ racket/src/zuo/configure.ac | 4 +++-
+ 3 files changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/racket/src/zuo/Makefile.in b/racket/src/zuo/Makefile.in
+index 747b584c5c..0376c038a8 100644
+--- a/racket/src/zuo/Makefile.in
++++ b/racket/src/zuo/Makefile.in
+@@ -19,6 +19,7 @@ LIBS = @LIBS@
+
+ CC_FOR_BUILD = @CC_FOR_BUILD@
+ CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
++CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@
+ LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
+ LIBS_FOR_BUILD = @LIBS_FOR_BUILD@
+
+@@ -29,7 +30,7 @@ zuos-to-run-and-install: zuo
+ ./zuo . zuos-to-run-and-install
+
+ zuo: $(srcdir)/zuo.c
+- $(CC_FOR_BUILD) $(FLAGS_FOR_BUILD) -DZUO_LIB_PATH='"'"$(srcdir)/lib"'"' -o zuo $(srcdir)/zuo.c $(LDFLAGS_FOR_BUILD) $(LIBS_FOR_BUILD)
++ $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) -DZUO_LIB_PATH='"'"$(srcdir)/lib"'"' -o zuo $(srcdir)/zuo.c $(LDFLAGS_FOR_BUILD) $(LIBS_FOR_BUILD)
+
+ .PHONY: check
+ check: zuo
+diff --git a/racket/src/zuo/configure b/racket/src/zuo/configure
+index 575ce07d96..7ac453e3bc 100755
+--- a/racket/src/zuo/configure
++++ b/racket/src/zuo/configure
+@@ -591,6 +591,7 @@ LIBOBJS
+ EMBED_LIBS
+ LIBS_FOR_BUILD
+ LDFLAGS_FOR_BUILD
++CPPFLAGS_FOR_BUILD
+ CFLAGS_FOR_BUILD
+ CC_FOR_BUILD
+ OBJEXT
+@@ -2590,7 +2591,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ if test "${CC_FOR_BUILD}" = ""; then
+ CC_FOR_BUILD='$(CC) -O2'
+- CFLAGS_FOR_BUILD='$(CPPFLAGS) $(CFLAGS)'
++ CPPFLAGS_FOR_BUILD='$(CPPFLAGS)'
++ CFLAGS_FOR_BUILD='$(CFLAGS)'
+ LDFLAGS_FOR_BUILD='$(LDFLAGS)'
+ LIBS_FOR_BUILD='$(LIBS)'
+ fi
+@@ -2600,6 +2602,7 @@ fi
+
+
+
++
+ { $as_echo "$as_me:${as_lineno-$LINENO}: zuo libraries to embed: \"${EMBED_LIBS}\"" >&5
+ $as_echo "$as_me: zuo libraries to embed: \"${EMBED_LIBS}\"" >&6;}
+
+diff --git a/racket/src/zuo/configure.ac b/racket/src/zuo/configure.ac
+index 598ff79629..051ea0beb5 100644
+--- a/racket/src/zuo/configure.ac
++++ b/racket/src/zuo/configure.ac
+@@ -27,12 +27,14 @@ AC_PROG_CC
+
+ if test "${CC_FOR_BUILD}" = ""; then
+ CC_FOR_BUILD='$(CC) -O2'
+- CFLAGS_FOR_BUILD='$(CPPFLAGS) $(CFLAGS)'
++ CPPFLAGS_FOR_BUILD='$(CPPFLAGS)'
++ CFLAGS_FOR_BUILD='$(CFLAGS)'
+ LDFLAGS_FOR_BUILD='$(LDFLAGS)'
+ LIBS_FOR_BUILD='$(LIBS)'
+ fi
+ AC_SUBST(CC_FOR_BUILD)
+ AC_SUBST(CFLAGS_FOR_BUILD)
++AC_SUBST(CPPFLAGS_FOR_BUILD)
+ AC_SUBST(LDFLAGS_FOR_BUILD)
+ AC_SUBST(LIBS_FOR_BUILD)
+
+--
+2.32.0
+
diff --git a/gnu/packages/patches/racket-zuo-bin-sh.patch b/gnu/packages/patches/racket-zuo-bin-sh.patch
new file mode 100644
index 0000000000..bcdcb8e963
--- /dev/null
+++ b/gnu/packages/patches/racket-zuo-bin-sh.patch
@@ -0,0 +1,74 @@
+From 73d9b77a11b4516905caf579abb559736f715ea6 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
+
+If:
+
+ 1. The nonstandard but ubiquitous macro `_PATH_BSHELL` from
+ <paths.h> is defined; and
+
+ 2. `zuo_process` is called with the exact path "/bin/sh"; and
+
+ 3. The path specified by `_PATH_BSHELL` exists;
+
+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.
+---
+ racket/src/zuo/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 @@
+ #include <string.h>
+ #include <ctype.h>
+ #ifdef ZUO_UNIX
++# include <paths.h> /* PATCHED for Guix */
+ # 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)
+ zuo_t *zuo_process(zuo_t *command_and_args)
+ {
+ const char *who = "process";
+- zuo_t *command = _zuo_car(command_and_args);
++ /* BEGIN PATCH for Guix */
++ zuo_t *_guix_orig_command = _zuo_car(command_and_args);
++ zuo_t *command;
++ /* END PATCH for Guix */
+ zuo_t *args = _zuo_cdr(command_and_args), *rev_args = z.o_null;
+ zuo_t *options = z.o_empty_hash,
This message was truncated. Download the full message here.
P
P
Philip McGrath wrote on 27 Aug 2022 20:55
[PATCH v4 09/14] gnu: chez-scheme: Make bootfiles regular inputs.
(address . 57050@debbugs.gnu.org)
0f44a1c29bd332808927cc4bf679fd11dc88cf98.1661626113.git.philip@philipmcgrath.com
* gnu/packages/chez.scm (chez-scheme)[native-inputs]: Move
'chez-scheme-bootstrap-bootfiles' to ...
[inputs]: ... this field.
[arguments]<#:phases>: Update 'unpack-bootfiles' accordingly.
(chez-scheme-for-racket)[native-inputs]: Move
'chez-scheme-for-racket-bootstrap-bootfiles' to ...
[inputs]: ... this field.
---
gnu/packages/chez.scm | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

Toggle diff (50 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index b59398578a..c87786c091 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -293,6 +293,7 @@ (define-public chez-scheme
(build-system gnu-build-system)
(inputs
(list
+ chez-scheme-bootstrap-bootfiles
`(,util-linux "lib") ;<-- libuuid
zlib
lz4
@@ -300,8 +301,7 @@ (define-public chez-scheme
;; for X11 clipboard support in expeditor:
;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
libx11))
- (native-inputs (list chez-scheme-bootstrap-bootfiles
- chez-nanopass-bootstrap
+ (native-inputs (list chez-nanopass-bootstrap
stex-bootstrap))
(native-search-paths
(list (search-path-specification
@@ -338,7 +338,7 @@ (define-public chez-scheme
(when (directory-exists? "boot")
(delete-file-recursively "boot"))
(copy-recursively
- (search-input-directory (or native-inputs inputs)
+ (search-input-directory inputs
"lib/chez-scheme-bootfiles")
"boot")))
;; NOTE: The custom Chez 'configure' script doesn't allow
@@ -449,12 +449,12 @@ (define-public chez-scheme-for-racket
(source #f) ; avoid problematic cycle with racket.scm
(inputs
(modify-inputs (package-inputs chez-scheme)
- (delete "libx11" "util-linux:lib")))
+ (delete "libx11" "util-linux:lib")
+ (replace "chez-scheme-bootstrap-bootfiles"
+ chez-scheme-for-racket-bootstrap-bootfiles)))
(native-inputs
(modify-inputs (package-native-inputs chez-scheme)
- (prepend zuo)
- (replace "chez-scheme-bootstrap-bootfiles"
- chez-scheme-for-racket-bootstrap-bootfiles)))
+ (prepend zuo)))
(arguments
(substitute-keyword-arguments (package-arguments chez-scheme)
((#:out-of-source? _ #f)
--
2.32.0
P
P
Philip McGrath wrote on 27 Aug 2022 20:55
[PATCH v4 10/14] gnu: chez-scheme-for-racket: Support cross-compilation.
(address . 57050@debbugs.gnu.org)
66d68c8973ac72a28424697187cc936ee941c6d4.1661626113.git.philip@philipmcgrath.com
* gnu/packages/chez.scm (racket-cs-native-supported-system): Change to
return the applicable machine type instead of '#t'.
(chez-scheme-for-racket)[native-inputs]: When cross-compiling, add
'this-package'.
[arguments]<#:configure-flags>: When cross-compiling, supply '-m=' and
'--toolprefix='.
<#:phases>: Work around cross-compilation issues in 'build' and
'install-docs'.
(chez-scheme-for-racket-bootstrap-bootfiles): When cross-compiling,
use 'zuo' and 'chez-scheme-for-racket' instead of 'racket-vm-bc'.
[arguments]<#:phases>: Adapt 'build' phase for cross-compilation.
---
gnu/packages/chez.scm | 85 +++++++++++++++++++++++++++++++++++--------
1 file changed, 70 insertions(+), 15 deletions(-)

Toggle diff (145 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index c87786c091..26f653ea9d 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -235,14 +235,15 @@ (define* (racket-cs-native-supported-system? #:optional
(system
(or (%current-target-system)
(%current-system))))
- "Can Racket's variant of Chez Scheme generate native code for SYSTEM?
-Otherwise, SYSTEM can use only the ``portable bytecode'' backends."
+ "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 <>))
- #t)))
+ (string-append "t" chez-arch chez-os))))
;;
;; Chez Scheme:
@@ -453,8 +454,12 @@ (define-public chez-scheme-for-racket
(replace "chez-scheme-bootstrap-bootfiles"
chez-scheme-for-racket-bootstrap-bootfiles)))
(native-inputs
- (modify-inputs (package-native-inputs chez-scheme)
- (prepend zuo)))
+ (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)))
(arguments
(substitute-keyword-arguments (package-arguments chez-scheme)
((#:out-of-source? _ #f)
@@ -468,6 +473,15 @@ (define-public chez-scheme-for-racket
((#:configure-flags cfg-flags #~'())
#~`("--disable-x11"
"--threads" ;; ok to potentially duplicate
+ #$@(if (%current-target-system)
+ (list (string-append "-m="
+ (racket-cs-native-supported-system?)))
+ '())
+ #$@(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
@@ -490,18 +504,42 @@ (define-public chez-scheme-for-racket
#$mk-flags))
((#:phases those-phases #~%standard-phases)
#~(let* ((those-phases #$those-phases)
- (unpack (assoc-ref those-phases 'unpack)))
+ (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 make-flags #:allow-other-keys)
+ (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"
- make-flags)))
+ (if native-inputs
+ (cons (string-append
+ "Scheme="
+ (search-input-file native-inputs
+ "/bin/scheme"))
+ make-flags)
+ make-flags))))
(replace 'unpack
(lambda args
- (unpack #:source #$(or (package-source this-package)
- (package-source racket-vm-bc)))))
+ (gnu:unpack #:source #$(or (package-source this-package)
+ (package-source racket-vm-bc)))))
(add-after 'unpack 'chdir
(lambda args
(chdir "racket/src/ChezScheme"))))))))
@@ -583,8 +621,12 @@ (define-public chez-scheme-for-racket-bootstrap-bootfiles
(name "chez-scheme-for-racket-bootstrap-bootfiles")
(version (package-version chez-scheme-for-racket))
(source #f) ; avoid problematic cycle with racket.scm
- (native-inputs (list chez-nanopass-bootstrap racket-vm-bc))
- ;; TODO: cross compilation
+ (native-inputs
+ (cons* chez-nanopass-bootstrap
+ (if (%current-target-system)
+ (list zuo
+ chez-scheme-for-racket)
+ (list racket-vm-bc))))
(arguments
(substitute-keyword-arguments
(package-arguments chez-scheme-bootstrap-bootfiles)
@@ -604,9 +646,22 @@ (define-public chez-scheme-for-racket-bootstrap-bootfiles
#$unpack-nanopass+stex))
(add-before 'install 'build
(lambda* (#:key native-inputs inputs #:allow-other-keys)
- (invoke (search-input-file (or native-inputs inputs)
- "/opt/racket-vm/bin/racket")
- "rktboot/main.rkt"))))))))
+ #$(cond
+ ((%current-target-system)
+ ;; cross-compiling
+ #~(invoke
+ (search-input-file (or native-inputs inputs)
+ "/bin/zuo")
+ "makefiles/boot.zuo"
+ (search-input-file (or native-inputs inputs)
+ "/bin/scheme")
+ #$(racket-cs-native-supported-system?)))
+ (else
+ ;; bootstrapping
+ #~(invoke
+ (search-input-file (or native-inputs inputs)
+ "/opt/racket-vm/bin/racket")
+ "rktboot/main.rkt"))))))))))
(supported-systems
(package-supported-systems chez-scheme-for-racket))
(home-page "https://github.com/racket/ChezScheme")
--
2.32.0
P
P
Philip McGrath wrote on 27 Aug 2022 20:55
[PATCH v4 11/14] gnu: racket: Support cross-compiling the VM packages.
(address . 57050@debbugs.gnu.org)
2db8cb32ba8b8ca5edd3f76334b0bda0a91d6d15.1661626113.git.philip@philipmcgrath.com
Cross-compilation works for 'racket-vm-cgc', 'racket-vm-bc', and
'racket-vm-cs'. These changes are not enough to cross-compile
'racket-minimal' or 'racket': that would require building and loading
cross-compilation pluggins for 'racket-vm-cs', which will be much
easier once we can build the package 'raco-cross'.

* gnu/packages/racket.scm (racket-vm-cgc): Add 'this-package' when
cross-compiling.
(racket-vm-bc)[native-inputs]: Adjust accordingly.
(racket-vm-cs)[native-inputs]: Use 'racket-vm-cs' instead of
'racket-vm-bc' when cross-compiling. Adapt to changes to
'racket-vm-cgc'.
[arguments]<#:configure-flags>: Fix '--enable-scheme' for
cross-compilation.
---
gnu/packages/racket.scm | 31 +++++++++++++++++++++----------
1 file changed, 21 insertions(+), 10 deletions(-)

Toggle diff (65 lines)
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index 349cf38e07..4fcdd2f721 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -312,8 +312,11 @@ (define-public racket-vm-cgc
(source %racket-origin)
(inputs (list ncurses ;; <- common to all variants (for #%terminal)
libffi)) ;; <- only for BC variants
- (native-inputs (list zuo ;; <- for all variants
- libtool)) ;; <- only for BC variants
+ (native-inputs (cons* zuo ;; <- for all variants
+ libtool ;; <- only for BC variants
+ (if (%current-target-system)
+ (list this-package)
+ '())))
(outputs '("out" "debug"))
(build-system gnu-build-system)
(arguments
@@ -401,8 +404,10 @@ (define-public racket-vm-bc
(inherit racket-vm-cgc)
(name "racket-vm-bc")
(native-inputs
- (modify-inputs (package-native-inputs racket-vm-cgc)
- (prepend racket-vm-cgc)))
+ (if (%current-target-system)
+ (package-native-inputs racket-vm-cgc)
+ (modify-inputs (package-native-inputs racket-vm-cgc)
+ (prepend racket-vm-cgc))))
(arguments
(substitute-keyword-arguments (package-arguments racket-vm-cgc)
((#:configure-flags _ '())
@@ -432,11 +437,17 @@ (define-public racket-vm-cs
(prepend zlib lz4)
(delete "libffi")))
(native-inputs
- (modify-inputs (package-native-inputs racket-vm-cgc)
- (delete "libtool")
- (prepend chez-scheme-for-racket
- chez-nanopass-bootstrap
- racket-vm-bc)))
+ (let ((native-inputs (package-native-inputs racket-vm-cgc)))
+ (modify-inputs (if (%current-target-system)
+ (modify-inputs native-inputs
+ (delete "racket-vm-cgc"))
+ native-inputs)
+ (delete "libtool")
+ (prepend chez-scheme-for-racket
+ chez-nanopass-bootstrap
+ (if (%current-target-system)
+ racket-vm-cs
+ racket-vm-bc)))))
(arguments
(substitute-keyword-arguments (package-arguments racket-vm-cgc)
((#:phases those-phases #~%standard-phases)
@@ -450,7 +461,7 @@ (define-public racket-vm-cs
"--enable-libz"
"--enable-lz4"
(string-append "--enable-scheme="
- #$(this-package-native-input
+ #+(this-package-native-input
"chez-scheme-for-racket")
"/bin/scheme")
#$racket-vm-common-configure-flags))))
--
2.32.0
P
P
Philip McGrath wrote on 27 Aug 2022 20:55
[PATCH v4 13/14] gnu: racket-vm-bc: Add workaround for ppc64le.
(address . 57050@debbugs.gnu.org)
3b4d21a89901a434b1d37f53a0ad7f51a0e4adfa.1661626113.git.philip@philipmcgrath.com
This is an attempt to avoid a problem with Racket BC on ppc64 reported
in https://issues.guix.gnu.org/57050#19 that was exposed by attempting
to use Racket BC to bootstrap Chez Scheme. Thanks to Matthew Flatt for

* gnu/packages/racket.scm (racket-vm-bc)[arguments]<#:configure-flags>:
Increase the number of bytes that should be available on the stack for
"safety" when checking for stack overflow.
---
gnu/packages/racket.scm | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)

Toggle diff (28 lines)
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index 264b44b7fd..74052d47eb 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -412,7 +412,20 @@ (define-public racket-vm-bc
(substitute-keyword-arguments (package-arguments racket-vm-cgc)
((#:configure-flags _ '())
#~(cons "--enable-bconly"
- #$racket-vm-common-configure-flags))))
+ #$(cond
+ ((target-ppc64le?)
+ ;; Attempt to avoid a problem bootstrapping Chez Scheme:
+ ;; see <https://issues.guix.gnu.org/57050#19>
+ ;; and <https://racket.discourse.group/t/950/30>.
+ #~(map
+ (lambda (flag)
+ (if (string-prefix? "CPPFLAGS=" flag)
+ (string-append flag
+ " -DSTACK_SAFETY_MARGIN=2000000")
+ flag))
+ #$racket-vm-common-configure-flags))
+ (else
+ racket-vm-common-configure-flags))))))
(synopsis "Racket BC [3M] implementation")
(description "The Racket BC (``before Chez'' or ``bytecode'')
implementation was the default before Racket 8.0. It uses a compiler written
--
2.32.0
P
P
Philip McGrath wrote on 27 Aug 2022 20:55
[PATCH v4 12/14] gnu: chez-scheme-for-racket: Support all systems.
(address . 57050@debbugs.gnu.org)
e505a517075c3455df5bb2f607b3081504fc0821.1661626113.git.philip@philipmcgrath.com
On systems for which Racket's variant of Chez Scheme cannot generate
native code, it can use a 'pbarch' machine type: a variant of the
``portable bytecode'' backend specialized to word size and endianness.
This allows Racket CS to replace Racket BC on those systems while
maintaining comparable performance. (Racket BC lacks JIT support for
those systems anyway.) It also lets us provide a Chez Scheme package on
all systems Guix supports.

This patch adds 'pbarch' support to both 'chez-scheme-for-racket' and
'racket-vm-cs', but it does not change the Racket VM implementation used
for the 'racket' and 'racket-minimal' packages.

* gnu/packages/chez.scm (nix-system->pbarch-machine-type): New variable.
(chez-scheme-for-racket)[inputs]: Use 'libffi' for non-native systems.
[arguments]<#:configure-flags>: Always supply '-m='. Add applicable
flags for non-native systems.
[supported-systems]: Use '%supported-systems'.
[description]: Update.
(chez-scheme-for-racket-bootstrap-bootfiles)[arguments]<#:phases>: Adapt
'build' phase for non-native systems.
* gnu/packages/racket.scm (racket-vm-bc)[description]: Update.
(racket-vm-cs)[description]: Likewise.
[inputs]: Use 'libffi' for non-native systems.
[arguments]<#:configure-flags>: Add applicable flags for non-native
systems.
---
gnu/packages/chez.scm | 76 ++++++++++++++++++++++++++++++-----------
gnu/packages/racket.scm | 26 +++++++++-----
2 files changed, 74 insertions(+), 28 deletions(-)

Toggle diff (217 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 26f653ea9d..5d152b3db5 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -37,6 +37,7 @@ (define-module (gnu packages chez)
#:use-module (gnu packages compression)
#:use-module (gnu packages ncurses)
#:use-module (gnu packages ghostscript)
+ #:use-module (gnu packages libffi)
#:use-module (gnu packages linux)
#:use-module (gnu packages netpbm)
#:use-module (gnu packages racket)
@@ -49,6 +50,7 @@ (define-module (gnu packages chez)
#:use-module (srfi srfi-26)
#:export (chez-scheme-for-system
racket-cs-native-supported-system?
+ nix-system->pbarch-machine-type
unpack-nanopass+stex))
;; Commentary:
@@ -231,6 +233,28 @@ (define* (chez-upstream-features-for-system #:optional
(and=> (assoc-ref %chez-features-table chez-os)
(cut assoc-ref <> chez-arch))))
+(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."
+ (string-append (if threads?
+ "t"
+ "")
+ "pb"
+ (if (target-64bit? system)
+ "64"
+ "32")
+ ;; missing (guix utils) predicate target-little-endian?
+ (if (target-ppc32? system)
+ "b"
+ "l")))
+
(define* (racket-cs-native-supported-system? #:optional
(system
(or (%current-target-system)
@@ -449,10 +473,14 @@ (define-public chez-scheme-for-racket
;; When updating, remember to also update %racket-version in racket.scm.
(source #f) ; avoid problematic cycle with racket.scm
(inputs
- (modify-inputs (package-inputs chez-scheme)
- (delete "libx11" "util-linux:lib")
- (replace "chez-scheme-bootstrap-bootfiles"
- chez-scheme-for-racket-bootstrap-bootfiles)))
+ (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))))
@@ -473,10 +501,16 @@ (define-public chez-scheme-for-racket
((#:configure-flags cfg-flags #~'())
#~`("--disable-x11"
"--threads" ;; ok to potentially duplicate
- #$@(if (%current-target-system)
- (list (string-append "-m="
- (racket-cs-native-supported-system?)))
- '())
+ #$(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)
@@ -543,10 +577,7 @@ (define-public chez-scheme-for-racket
(add-after 'unpack 'chdir
(lambda args
(chdir "racket/src/ChezScheme"))))))))
- ;; TODO: How to build pbarch/pbchunks for other systems?
- ;; See https://racket.discourse.group/t/950
- (supported-systems (filter racket-cs-native-supported-system?
- %supported-systems))
+ (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
@@ -559,13 +590,17 @@ (define-public chez-scheme-for-racket
Main additions to Chez Scheme in the Racket variant:
@itemize @bullet
@item
-AArch64 support
+AArch64 code generation
@item
-Portable bytes (@code{pb}) support, which is mainly useful for bootstrapping
-a build on any supported platform
+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 attachments
@@ -576,8 +611,6 @@ (define-public chez-scheme-for-racket
@item
Ordered finalization, immobile (but collectable) objects, weak/ephemeron
generic hash tables, and reference bytevectors
-@item
-Faster multiplication and division for large exact numbers
@end itemize")
(license asl2.0)))
@@ -655,13 +688,18 @@ (define-public chez-scheme-for-racket-bootstrap-bootfiles
"makefiles/boot.zuo"
(search-input-file (or native-inputs inputs)
"/bin/scheme")
- #$(racket-cs-native-supported-system?)))
+ #$(or (racket-cs-native-supported-system?)
+ (nix-system->pbarch-machine-type))))
(else
;; bootstrapping
#~(invoke
(search-input-file (or native-inputs inputs)
"/opt/racket-vm/bin/racket")
- "rktboot/main.rkt"))))))))))
+ "rktboot/main.rkt"
+ #$@(if (racket-cs-native-supported-system?)
+ #~()
+ (let ((m (nix-system->pbarch-machine-type)))
+ #~("--machine" #$m)))))))))))))
(supported-systems
(package-supported-systems chez-scheme-for-racket))
(home-page "https://github.com/racket/ChezScheme")
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index 4fcdd2f721..264b44b7fd 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -311,7 +311,7 @@ (define-public racket-vm-cgc
(version %racket-version)
(source %racket-origin)
(inputs (list ncurses ;; <- common to all variants (for #%terminal)
- libffi)) ;; <- only for BC variants
+ libffi)) ;; <- for BC and non-native CS variants
(native-inputs (cons* zuo ;; <- for all variants
libtool ;; <- only for BC variants
(if (%current-target-system)
@@ -417,10 +417,8 @@ (define-public racket-vm-bc
(description "The Racket BC (``before Chez'' or ``bytecode'')
implementation was the default before Racket 8.0. It uses a compiler written
in C targeting architecture-independent bytecode, plus a JIT compiler on most
-platforms. Racket BC has a different C API and supports a slightly different
-set of architectures than the current default runtime system, Racket CS (based
-on ``Chez Scheme''). It is the recommended implementation for architectures
-that Racket CS doesn't support.
+platforms. Racket BC has a different C API than the current default runtime
+system, Racket CS (based on ``Chez Scheme'').
This package is the normal implementation of Racket BC with a precise garbage
collector, 3M (``Moving Memory Manager'').")
@@ -433,9 +431,12 @@ (define-public racket-vm-cs
(inherit racket-vm-bc)
(name "racket-vm-cs")
(inputs
- (modify-inputs (package-inputs racket-vm-cgc)
- (prepend zlib lz4)
- (delete "libffi")))
+ (let ((inputs (modify-inputs (package-inputs racket-vm-cgc)
+ (prepend zlib lz4))))
+ (if (racket-cs-native-supported-system?)
+ (modify-inputs inputs
+ (delete "libffi"))
+ inputs)))
(native-inputs
(let ((native-inputs (package-native-inputs racket-vm-cgc)))
(modify-inputs (if (%current-target-system)
@@ -464,12 +465,19 @@ (define-public racket-vm-cs
#+(this-package-native-input
"chez-scheme-for-racket")
"/bin/scheme")
+ #$@(if (racket-cs-native-supported-system?)
+ #~()
+ #~(#$(string-append "--enable-mach="
+ (nix-system->pbarch-machine-type))
+ "--enable-pb"))
#$racket-vm-common-configure-flags))))
(synopsis "Racket CS implementation")
(description "The Racket CS implementation, which uses ``Chez Scheme'' as
its core compiler and runtime system, has been the default Racket VM
implementation since Racket 8.0. It performs better than the Racket BC
-implementation for most programs.
+implementation for most programs. On systems for which Racket CS cannot
+generate machine code, this package uses a variant of its ``portable
+bytecode'' backend specialized for word size and endianness.
Using the Racket VM packages directly is not recommended: instead, install the
@code{racket-minimal} or @code{racket} packages.")
--
2.32.0
P
P
Philip McGrath wrote on 27 Aug 2022 20:55
[PATCH v4 14/14] gnu: racket: Use Racket CS on all systems.
(address . 57050@debbugs.gnu.org)
b9652c2a85201f8183346a6e3a4f4fd245649d69.1661626113.git.philip@philipmcgrath.com
This patch uses the 'pbarch' support added to 'racket-vm-cs' to make it
the default Racket VM implementation on all systems.

* gnu/packages/racket.scm (racket-vm-for-system): Remove.
(racket-minimal, racket)[inputs]: Replace '(racket-vm-for-system)' with
'racket-vm-cs'.
---
gnu/packages/racket.scm | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)

Toggle diff (55 lines)
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index 74052d47eb..32ea866bff 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -128,10 +128,9 @@ (define-module (gnu packages racket)
;; This file defines the packages 'racket-vm-cgc', 'racket-vm-bc', and
;; 'racket-vm-cs'. All three are in-place builds of 'racket/src/' and
;; 'racket/collects/' and are installed to 'opt/racket-vm/' in the store
-;; output. The function 'racket-vm-for-system' returns the recomended Racket
-;; VM package for a given system.
+;; output.
;;
-;; We then define the packages 'racket-minimal' and
+;; Using 'racket-vm-cs', we then define the packages 'racket-minimal' and
;; 'racket'. These use Racket's support for ``layered installations'', which
;; allow an immutable base layer to be extended with additional packages.
;; They use the layer configuration directly provide ready-to-install FHS-like
@@ -192,17 +191,6 @@ (define-module (gnu packages racket)
;;
;; CODE:
-(define* (racket-vm-for-system #:optional
- (system (or (%current-target-system)
- (%current-system))))
- "Return 'racket-vm-cs' if we are able to build it for SYSTEM; 'racket-vm-bc'
-otherwise."
- ;; Once we figure out the issues in https://racket.discourse.group/t/950,
- ;; we can use 'racket-vm-cs' everywhere.
- (if (racket-cs-native-supported-system? system)
- racket-vm-cs
- racket-vm-bc))
-
(define %racket-version "8.6") ; Remember to update chez-scheme-for-racket!
(define %zuo-version "1.0") ; defined in racket/src/zuo/zuo.c
(define %racket-commit
@@ -566,7 +554,7 @@ (define-public racket-minimal
(inputs
(list openssl
sqlite
- (racket-vm-for-system)
+ racket-vm-cs
(racket-packages-origin
"base" %racket-origin
'(("base" "pkgs/base")
@@ -684,7 +672,7 @@ (define-public racket
unixodbc
libedit ;; TODO reconsider in light of expeditor and readline-gpl
racket-minimal ;; <-- TODO non-tethered layer
- (racket-vm-for-system)
+ racket-vm-cs
(simple-racket-origin
"2d" (base32 "0fb5v6058ls08xw3zbmqyr2ym0psm119gl9ffgmhm9w8rs9i4dq7")
'("2d" "2d-doc" "2d-lib"))
--
2.32.0
L
L
Liliana Marie Prikler wrote on 27 Aug 2022 20:58
Re: [PATCH v3 07/14] gnu: Add Zuo.
b3642d9023bf6e85dd4683e60f3ddeeb305c443e.camel@gmail.com
Am Samstag, dem 27.08.2022 um 14:08 -0400 schrieb Philip McGrath:
Toggle quote (14 lines)
> On Fri, Aug 26, 2022, at 8:01 AM, Liliana Marie Prikler wrote:
> > Am Donnerstag, dem 25.08.2022 um 16:04 -0400 schrieb Philip
> > McGrath:
> > > How does this seem?
> > >
> > >       (description "Zuo (?) is a tiny Racket with primitives for
> > > dealing
> > I don't think (?) adds anything meaningful.  Perhaps a Chinese
> > translation might want to use that character, but in English we
> > have to
> > deal with the fact that most no one will understand that.
>
> I think "(?)" concisely answers the question, "Why is this called
> Zuo?" (Answer: ? means, roughly, "make".)
To the average English speaker, which you'll have to assume in a
description, it really doesn't. You'll have to know that Zuo means
make, at which point it is no longer that concise :)
L
L
Liliana Marie Prikler wrote on 27 Aug 2022 21:21
Re: [PATCH v4 08/14] gnu: racket: Update to 8.6.
d845b1a4cf61cca010b3fe2a6124a6fe5cf3f699.camel@gmail.com
Am Samstag, dem 27.08.2022 um 14:55 -0400 schrieb Philip McGrath:
Toggle quote (9 lines)
> +       ((#:tests? _ #t)
> +        ;; FIXME: There have been some flaky test failures. Some
> have been
> +        ;; fixed upstream post-release but have proven non-trivial
> to
> +        ;; backport; at least one issue remains. Re-enable tests
> once
> +        ;; https://github.com/racket/racket/issues/4359 is fixed.
> +        #f)
Rather than discarding all tests, just discard the flaky ones.
P
P
Philip McGrath wrote on 27 Aug 2022 21:54
Re: [PATCH v3 07/14] gnu: Add Zuo.
a889a0ae-d320-43a4-bf9c-af52c7769ad6@www.fastmail.com
On Sat, Aug 27, 2022, at 2:58 PM, Liliana Marie Prikler wrote:
Toggle quote (19 lines)
> Am Samstag, dem 27.08.2022 um 14:08 -0400 schrieb Philip McGrath:
>> On Fri, Aug 26, 2022, at 8:01 AM, Liliana Marie Prikler wrote:
>> > Am Donnerstag, dem 25.08.2022 um 16:04 -0400 schrieb Philip
>> > McGrath:
>> > > How does this seem?
>> > >
>> > >       (description "Zuo (?) is a tiny Racket with primitives for
>> > > dealing
>> > I don't think (?) adds anything meaningful.  Perhaps a Chinese
>> > translation might want to use that character, but in English we
>> > have to
>> > deal with the fact that most no one will understand that.
>>
>> I think "(?)" concisely answers the question, "Why is this called
>> Zuo?" (Answer: ? means, roughly, "make".)
> To the average English speaker, which you'll have to assume in a
> description, it really doesn't. You'll have to know that Zuo means
> make, at which point it is no longer that concise :)

I really think this is quite normal English usage. Consider, for example, The Chicago Manual of Style, 16th ed., 6.93 (Parentheses for glosses or translations), 11.7 (Translated titles), and, most specifically, 11.119 (Inclusion of Chinese and Japanese characters), which says that "Chinese and Japanese characters, immediately following the romanized version of the item they represent, are sometimes necessary to help readers identify references cited or terms used" and that "where needed in running text, they may be enclosed in parentheses."

When I search for the ascii string "zuo" in a general search engine, I see results about a wholesale furniture company, a "cloud-based subscription management platform provider", a music video, a video game, and several individuals whose names contain "zuo" before I get to any information about a Chinese word or character.

I don't think it's absolutely essential, but I don't see why including it would be a problem.

-Philip
P
P
Philip McGrath wrote on 27 Aug 2022 22:30
Re: [PATCH v4 08/14] gnu: racket: Update to 8.6.
b9d402db-d1cb-4984-b9ba-7ae210eeeacf@www.fastmail.com
On Sat, Aug 27, 2022, at 3:21 PM, Liliana Marie Prikler wrote:
Toggle quote (12 lines)
> Am Samstag, dem 27.08.2022 um 14:55 -0400 schrieb Philip McGrath:
>> +       ((#:tests? _ #t)
>> +        ;; FIXME: There have been some flaky test failures. Some
>> have been
>> +        ;; fixed upstream post-release but have proven non-trivial
>> to
>> +        ;; backport; at least one issue remains. Re-enable tests
>> once
>> +        ;; https://github.com/racket/racket/issues/4359 is fixed.
>> +        #f)
> Rather than discarding all tests, just discard the flaky ones.

I've tried to explain this before, but, as far as I've been able to determine, the problem doesn't seem to be that a particular test or group of tests is flaky: the mysterious problems all seem to be related to setting up the test environment. There have been problems, for example, with files not being found, or the complex pile of patches used to construct variants on the expected error output not working properly. At least the unix, windows, ieee, date, oop, primvars, and misc test groups have been affected. Since it's not been easy to reproduce the problem (I've thought it was fixed several times), I have no reason to believe it wouldn't affect other test groups if we skipped those. An unfortunate consequence of the way the tests are organized, skipping particular test groups means that expected error output is never checked and requires manually choosing the configurations (combinations of compiler/interpreter settings) you want to test.

I do not see a viable path to fixing the tests for this release, and I don't know a way of running a subset of tests that would be both reliable and meaningful.

Other distributions are also skipping these tests.

In fact, Guix is currently skipping an unknown (probably large) portion of these tests because of the issue with "/bin/sh", which has lead to things silently not running.

I hope we will get this fixed upstream for the 8.7 release. In fact, I've not yet encountered the problem while building from Git HEAD, but it's not clear what change might be relevant. (Indeed, the problem might still be there, and I might just not have hit it yet.)

-Philip
L
L
Liliana Marie Prikler wrote on 27 Aug 2022 23:18
Re: [PATCH v3 07/14] gnu: Add Zuo.
c8b6201ba18209b40ebdad2b1def5757355fa4e8.camel@gmail.com
Am Samstag, dem 27.08.2022 um 15:54 -0400 schrieb Philip McGrath:
Toggle quote (2 lines)
> When I search for the ascii string "zuo" in a general search
> engine[...]
The home-page field exists, as does `guix build -S'. One more reason
to use the subtree repo.

Cheers
P
P
Philip McGrath wrote on 27 Aug 2022 23:28
faf4d85b-5041-4a6e-9ecb-dda5a46affc2@www.fastmail.com
On Sat, Aug 27, 2022, at 5:18 PM, Liliana Marie Prikler wrote:
Toggle quote (8 lines)
> Am Samstag, dem 27.08.2022 um 15:54 -0400 schrieb Philip McGrath:
>> When I search for the ascii string "zuo" in a general search
>> engine[...]
> The home-page field exists, as does `guix build -S'. One more reason
> to use the subtree repo.
>
> Cheers

I understand that you don't think mentioning ? is necessary. I don't understand why you seem to think mentioning ? is bad.
L
L
Liliana Marie Prikler wrote on 28 Aug 2022 00:26
3aec93b3106424b6238ec3a294eb882682df3a84.camel@gmail.com
Am Samstag, dem 27.08.2022 um 17:28 -0400 schrieb Philip McGrath:
Toggle quote (12 lines)
> On Sat, Aug 27, 2022, at 5:18 PM, Liliana Marie Prikler wrote:
> > Am Samstag, dem 27.08.2022 um 15:54 -0400 schrieb Philip McGrath:
> > > When I search for the ascii string "zuo" in a general search
> > > engine[...]
> > The home-page field exists, as does `guix build -S'.  One more
> > reason
> > to use the subtree repo.
> >
> > Cheers
>
> I understand that you don't think mentioning ? is necessary. I don't
> understand why you seem to think mentioning ? is bad.
A package description is not a Wikipedia entry. Different styles
apply. In an encyclopedia, the bracket form you mentioned can be a
handy way of including "useful" information right at the start when the
article itself is much more long-winded. This is not the case here,
though, and the entire bracket expression only serves as a distraction
from the rest of the sentence.
L
L
Ludovic Courtès wrote on 4 Sep 2022 22:53
Re: bug#57050: [PATCH 0/6] gnu: Update Racket to 8.6. Add Zuo.
(name . Philip McGrath)(address . philip@philipmcgrath.com)
87sfl6svyq.fsf_-_@gnu.org
Hi Philip,

Philip McGrath <philip@philipmcgrath.com> skribis:

Toggle quote (7 lines)
> Here is a v4 with the revised description for Zuo (07/14) and the typo fix in
> the commit message for 12/14.
>
> I've once again pushed this series to the 'zuo' branch of
> https://gitlab.com/philip1/guix-patches and tagged it as
> guix-issue-57050-v4 (commit b9652c2a85201f8183346a6e3a4f4fd245649d69).

I applied this series (looks like it was about to be forgotten!), it
seems to work like a charm. :-)

Thank you Philip for the work, & thanks Liliana, Thiago, Maxime, Efraim,
and all for the review process!

Ludo’.
Closed
?
Your comment

This issue is archived.

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

To respond to this issue using the mumi CLI, first switch to it
mumi current 57050
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