* [bug#57050] [PATCH 0/6] gnu: Update Racket to 8.6. Add Zuo. @ 2022-08-08 6:06 Philip McGrath 2022-08-08 6:10 ` [bug#57050] [PATCH 1/6] gnu: stex: Update to 1.2.2-2.afa6075 Philip McGrath ` (6 more replies) 0 siblings, 7 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-08 6:06 UTC (permalink / raw) To: 57050; +Cc: Philip McGrath 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 [1]: https://lists.gnu.org/archive/html/help-guix/2022-08/msg00018.html 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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH 1/6] gnu: stex: Update to 1.2.2-2.afa6075. 2022-08-08 6:06 [bug#57050] [PATCH 0/6] gnu: Update Racket to 8.6. Add Zuo Philip McGrath @ 2022-08-08 6:10 ` Philip McGrath 2022-08-08 6:10 ` [bug#57050] [PATCH 2/6] gnu: stex: Fix read-only gifs and math directories Philip McGrath ` (5 subsequent siblings) 6 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-08 6:10 UTC (permalink / raw) To: 57050; +Cc: Philip McGrath * 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(-) 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH 2/6] gnu: stex: Fix read-only gifs and math directories. 2022-08-08 6:06 [bug#57050] [PATCH 0/6] gnu: Update Racket to 8.6. Add Zuo Philip McGrath 2022-08-08 6:10 ` [bug#57050] [PATCH 1/6] gnu: stex: Update to 1.2.2-2.afa6075 Philip McGrath @ 2022-08-08 6:10 ` Philip McGrath 2022-08-08 6:10 ` [bug#57050] [PATCH 3/6] gnu: chez-scheme: Fix use of "/bin/sh" Philip McGrath ` (4 subsequent siblings) 6 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-08 6:10 UTC (permalink / raw) To: 57050; +Cc: Philip McGrath 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 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH 3/6] gnu: chez-scheme: Fix use of "/bin/sh". 2022-08-08 6:06 [bug#57050] [PATCH 0/6] gnu: Update Racket to 8.6. Add Zuo Philip McGrath 2022-08-08 6:10 ` [bug#57050] [PATCH 1/6] gnu: stex: Update to 1.2.2-2.afa6075 Philip McGrath 2022-08-08 6:10 ` [bug#57050] [PATCH 2/6] gnu: stex: Fix read-only gifs and math directories Philip McGrath @ 2022-08-08 6:10 ` Philip McGrath 2022-08-08 8:53 ` Liliana Marie Prikler 2022-08-08 6:10 ` [bug#57050] [PATCH 4/6] gnu: Update Racket to 8.6. Add Zuo Philip McGrath ` (3 subsequent siblings) 6 siblings, 1 reply; 122+ messages in thread From: Philip McGrath @ 2022-08-08 6:10 UTC (permalink / raw) To: 57050; +Cc: Philip McGrath 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 */ + + 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH 3/6] gnu: chez-scheme: Fix use of "/bin/sh". 2022-08-08 6:10 ` [bug#57050] [PATCH 3/6] gnu: chez-scheme: Fix use of "/bin/sh" Philip McGrath @ 2022-08-08 8:53 ` Liliana Marie Prikler 2022-08-09 20:25 ` Philip McGrath 0 siblings, 1 reply; 122+ messages in thread From: Liliana Marie Prikler @ 2022-08-08 8:53 UTC (permalink / raw) To: Philip McGrath, 57050 Am Montag, dem 08.08.2022 um 02:10 -0400 schrieb Philip McGrath: > 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. > ++ /* 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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH 3/6] gnu: chez-scheme: Fix use of "/bin/sh". 2022-08-08 8:53 ` Liliana Marie Prikler @ 2022-08-09 20:25 ` Philip McGrath 2022-08-09 21:24 ` Maxime Devos 0 siblings, 1 reply; 122+ messages in thread From: Philip McGrath @ 2022-08-09 20:25 UTC (permalink / raw) To: 57050, Liliana Marie Prikler [-- Attachment #1: Type: text/plain, Size: 6464 bytes --] Hi, On Monday, August 8, 2022 4:53:42 AM EDT Liliana Marie Prikler wrote: > 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. > 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. > > 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 --8<---------------cut here---------------start------------->8--- 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" > --8<---------------cut here---------------end--------------->8--- [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH 3/6] gnu: chez-scheme: Fix use of "/bin/sh". 2022-08-09 20:25 ` Philip McGrath @ 2022-08-09 21:24 ` Maxime Devos 2022-08-09 21:38 ` ( via Guix-patches via 0 siblings, 1 reply; 122+ messages in thread From: Maxime Devos @ 2022-08-09 21:24 UTC (permalink / raw) To: Philip McGrath, 57050, Liliana Marie Prikler [-- Attachment #1.1.1: Type: text/plain, Size: 865 bytes --] On 09-08-2022 22:25, Philip McGrath wrote: > 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 #1.1.2: OpenPGP public key --] [-- Type: application/pgp-keys, Size: 929 bytes --] [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 236 bytes --] ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH 3/6] gnu: chez-scheme: Fix use of "/bin/sh". 2022-08-09 21:24 ` Maxime Devos @ 2022-08-09 21:38 ` ( via Guix-patches via 2022-08-09 21:58 ` Philip McGrath 0 siblings, 1 reply; 122+ messages in thread From: ( via Guix-patches via @ 2022-08-09 21:38 UTC (permalink / raw) To: Maxime Devos, Philip McGrath, 57050, Liliana Marie Prikler 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. -- ( ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH 3/6] gnu: chez-scheme: Fix use of "/bin/sh". 2022-08-09 21:38 ` ( via Guix-patches via @ 2022-08-09 21:58 ` Philip McGrath 2022-08-09 22:09 ` ( via Guix-patches via 2022-08-10 11:46 ` Maxime Devos 0 siblings, 2 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-09 21:58 UTC (permalink / raw) To: Maxime Devos, 57050, Liliana Marie Prikler, ( [-- Attachment #1: Type: text/plain, Size: 1334 bytes --] 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. > > -- ( 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 [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH 3/6] gnu: chez-scheme: Fix use of "/bin/sh". 2022-08-09 21:58 ` Philip McGrath @ 2022-08-09 22:09 ` ( via Guix-patches via 2022-08-10 11:46 ` Maxime Devos 1 sibling, 0 replies; 122+ messages in thread From: ( via Guix-patches via @ 2022-08-09 22:09 UTC (permalink / raw) To: Philip McGrath, Maxime Devos, 57050, Liliana Marie Prikler On Tue Aug 9, 2022 at 10:58 PM BST, Philip McGrath wrote: > I'd love to be wrong, but I also can't find such a macro. Have a look at sysdeps/generic/paths.h. -- ( ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH 3/6] gnu: chez-scheme: Fix use of "/bin/sh". 2022-08-09 21:58 ` Philip McGrath 2022-08-09 22:09 ` ( via Guix-patches via @ 2022-08-10 11:46 ` Maxime Devos 1 sibling, 0 replies; 122+ messages in thread From: Maxime Devos @ 2022-08-10 11:46 UTC (permalink / raw) To: Philip McGrath, 57050, Liliana Marie Prikler, ( [-- Attachment #1.1.1: Type: text/plain, Size: 1781 bytes --] 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. 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 #1.1.2: OpenPGP public key --] [-- Type: application/pgp-keys, Size: 929 bytes --] [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 236 bytes --] ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH 4/6] gnu: Update Racket to 8.6. Add Zuo. 2022-08-08 6:06 [bug#57050] [PATCH 0/6] gnu: Update Racket to 8.6. Add Zuo Philip McGrath ` (2 preceding siblings ...) 2022-08-08 6:10 ` [bug#57050] [PATCH 3/6] gnu: chez-scheme: Fix use of "/bin/sh" Philip McGrath @ 2022-08-08 6:10 ` Philip McGrath 2022-08-08 9:01 ` Liliana Marie Prikler 2022-08-08 6:10 ` [bug#57050] [PATCH 5/6] gnu: racket: Use Racket CS on all systems Philip McGrath ` (2 subsequent siblings) 6 siblings, 1 reply; 122+ messages in thread From: Philip McGrath @ 2022-08-08 6:10 UTC (permalink / raw) To: 57050; +Cc: Philip McGrath 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 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,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.boot ", sep, buf); + } + fprintf(stderr, "required by %s\n", path); +@@ -1090,7 +1096,7 @@ extern void Sregister_boot_file_fd_region(const char *name, + int close_after) { + check_boot_file_state("Sregister_boot_file_fd"); + +- 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(); + } +@@ -1141,14 +1147,14 @@ extern void Sbuild_heap(const char *kernel, void (*custom_init)(void)) { + } + + name = path_last(kernel); +- if (strlen(name) >= PATH_MAX) { ++ if (strlen(name) >= BOOT_PATH_MAX) { + fprintf(stderr, "executable name too long: %s\n", name); + S_abnormal_exit(); + } + + #ifdef WIN32 + { /* strip off trailing .exe, if any */ +- static char buf[PATH_MAX]; ++ static char buf[BOOT_PATH_MAX]; + iptr n; + + n = strlen(name) - 4; +diff --git a/racket/src/ChezScheme/c/version.h b/racket/src/ChezScheme/c/version.h +index a79d12621b..61751a9fad 100644 +--- a/racket/src/ChezScheme/c/version.h ++++ b/racket/src/ChezScheme/c/version.h +@@ -80,7 +80,7 @@ FORCEINLINE void store_unaligned_uptr(uptr *addr, uptr val) { + /*****************************************/ + /* Operating systems */ + +-#if defined(__linux__) ++#if defined(__linux__) || defined(__GNU__) /* Hurd */ + #define NOBLOCK O_NONBLOCK + #define LOAD_SHARED_OBJECT + #define USE_MMAP +@@ -91,7 +91,10 @@ FORCEINLINE void store_unaligned_uptr(uptr *addr, uptr val) { + #define GETPAGESIZE() getpagesize() + typedef char *memcpy_t; + #define MAKE_NAN(x) { x = 0.0; x = x / x; } +-#define GETWD(x) getcwd((x),PATH_MAX) ++#ifndef __GNU__ /* Hurd: no PATH_MAX */ ++/* n.b. don't test PATH_MAX directly: we have not yet included <limits.h> */ ++# define GETWD(x) getcwd((x),PATH_MAX) ++#endif + typedef int tputsputcchar; + #ifndef __ANDROID__ + # define LOCKF +diff --git a/racket/src/ChezScheme/configure b/racket/src/ChezScheme/configure +index f64b639c3a..efdb6029cb 100755 +--- a/racket/src/ChezScheme/configure ++++ b/racket/src/ChezScheme/configure +@@ -102,6 +102,11 @@ case "${CONFIG_UNAME}" in + installprefix=/usr + installmansuffix=share/man + ;; ++ GNU) ++ unixsuffix=gnu # the Hurd ++ installprefix=/usr ++ installmansuffix=share/man ++ ;; + QNX) + if uname -a | egrep 'x86' > /dev/null 2>&1 ; then + m32=i3qnx +@@ -591,7 +596,7 @@ fi + + # Infer flags needed for threads: + case "${flagsm}" in +- *le|*fb|*ob|*nb) ++ *le|*gnu|*fb|*ob|*nb) + threadFlags="-D_REENTRANT -pthread" + threadLibs="-lpthread" + ;; +@@ -627,7 +632,7 @@ if [ "$cflagsset" = "no" ] ; then + a6*) + CFLAGS="-m64 ${optFlags}" + ;; +- i3le) ++ i3le) # intentionally not including i3gnu, which may not support sse2 + CFLAGS="-m32 -msse2 -mfpmath=sse ${optFlags}" + ;; + i3nt) +@@ -688,7 +693,7 @@ fi + # Add automatic linking flags, unless suppressed by --disable-auto-flags + if [ "$addflags" = "yes" ] ; then + case "${flagsm}" in +- *le) ++ *le|*gnu) + LDFLAGS="${LDFLAGS} -rdynamic" + ;; + *fb|*nb) +@@ -702,7 +707,7 @@ if [ "$addflags" = "yes" ] ; then + esac + + case "${flagsm}" in +- *le) ++ *le|*gnu) + LIBS="${LIBS} -lm -ldl ${ncursesLib} -lrt" + ;; + *fb|*ob) +@@ -749,7 +754,7 @@ exeSuffix= + + # compile flags for c/Mf-unix and mats/Mf-unix + case "${flagsmuni}" in +- *le) ++ *le|*gnu) + mdcflags="-fPIC -shared" + ;; + *fb|*ob) +@@ -781,7 +786,7 @@ case "${flagsmuni}" in + i3le) + mdldflags="-melf_i386" + ;; +- *le) ++ *le|*gnu) + ;; + i3nb) + mdldflags="-m elf_i386" +diff --git a/racket/src/ChezScheme/s/cmacros.ss b/racket/src/ChezScheme/s/cmacros.ss +index ff2b09217b..2e79a4d8de 100644 +--- a/racket/src/ChezScheme/s/cmacros.ss ++++ b/racket/src/ChezScheme/s/cmacros.ss +@@ -385,6 +385,7 @@ + i3fb ti3fb + i3ob ti3ob + i3osx ti3osx ++ i3gnu ti3gnu + a6le ta6le + a6osx ta6osx + a6ob ta6ob +diff --git a/racket/src/cs/c/configure b/racket/src/cs/c/configure +index 454d79e11a..dab545c0b4 100755 +--- a/racket/src/cs/c/configure ++++ b/racket/src/cs/c/configure +@@ -4449,8 +4449,15 @@ case "$host_os" in + ;; + irix*) + ;; +- linux*) +- MACH_OS=le ++ linux*|gnu*) ++ case "$host_os" in ++ *linux*) ++ MACH_OS=le ++ ;; ++ *) ++ MACH_OS=gnu # Hurd ++ ;; ++ esac + case "$host_os" in + *linux-android*) + ;; +@@ -4730,6 +4737,9 @@ if test "${build_os}_${build_cpu}" != "${host_os}_${host_cpu}" ; then + linux*) + BUILD_OS=le + ;; ++ gnu*) # Hurd: must come after linux* ++ BUILD_OS=gnu ++ ;; + *mingw*) + BUILD_OS=nt + ;; +diff --git a/racket/src/cs/c/configure.ac b/racket/src/cs/c/configure.ac +index 5bce979c92..43e7307b1b 100644 +--- a/racket/src/cs/c/configure.ac ++++ b/racket/src/cs/c/configure.ac +@@ -272,8 +272,15 @@ case "$host_os" in + ;; + irix*) + ;; +- linux*) +- MACH_OS=le ++ linux*|gnu*) ++ case "$host_os" in ++ linux*) ++ MACH_OS=le ++ ;; ++ *) ++ MACH_OS=gnu # Hurd ++ ;; ++ esac + case "$host_os" in + *linux-android*) + ;; +@@ -466,6 +473,9 @@ if test "${build_os}_${build_cpu}" != "${host_os}_${host_cpu}" ; then + linux*) + BUILD_OS=le + ;; ++ gnu*) # Hurd - must come after linux* ++ BUILD_OS=gnu ++ ;; + *mingw*) + BUILD_OS=nt + ;; +diff --git a/racket/src/cs/rumble/system.ss b/racket/src/cs/rumble/system.ss +index 2319cbe7a5..773eb79cf3 100644 +--- a/racket/src/cs/rumble/system.ss ++++ b/racket/src/cs/rumble/system.ss +@@ -48,6 +48,8 @@ + arm32le tarm32le arm64le tarm64le + ppc32le tppc32le) + 'linux] ++ [(i3gnu ti3gnu) ++ 'gnu-hurd] + [(a6fb ta6fb i3fb ti3fb + arm32fb tarm32fb arm64fb tarm64fb + ppc32fb tppc32fb) +@@ -85,6 +87,7 @@ + i3nb ti3nb + i3fb ti3fb + i3s2 ti3s2 ++ i3gnu ti3gnu + i3qnx) + 'i386] + [(arm32le tarm32le +-- +2.32.0 + + +From 8653294b771c741d320aba31e692b4f0ed0c702f Mon Sep 17 00:00:00 2001 +From: Philip McGrath <philip@philipmcgrath.com> +Date: Thu, 4 Aug 2022 20:18:09 -0400 +Subject: [PATCH 2/3] BC: Fix build on GNU/Hurd + +(cherry picked from commit 5c05496afd6159c2f9cd52e7f23389fdc6b55f43) +--- + racket/src/bc/configure | 2 +- + racket/src/bc/configure.ac | 2 +- + racket/src/bc/sconfig.h | 14 +++++++++----- + 3 files changed, 11 insertions(+), 7 deletions(-) + +diff --git a/racket/src/bc/configure b/racket/src/bc/configure +index 4ddb607b37..4ee346014d 100755 +--- a/racket/src/bc/configure ++++ b/racket/src/bc/configure +@@ -5018,7 +5018,7 @@ case "$host_os" in + X_PRE_LIBS="" + fi + ;; +- linux*) ++ linux*,gnu*) + LIBS="$LIBS -ldl -lm -lrt -rdynamic" + DYN_CFLAGS="-fPIC" + curses_portable_link="/usr/lib/${host_cpu}-${host_os}/libncurses.a /usr/lib/${host_cpu}-${host_os}/libtermcap.a" +diff --git a/racket/src/bc/configure.ac b/racket/src/bc/configure.ac +index deef8f3077..866851236e 100644 +--- a/racket/src/bc/configure.ac ++++ b/racket/src/bc/configure.ac +@@ -557,7 +557,7 @@ case "$host_os" in + X_PRE_LIBS="" + fi + ;; +- linux*) ++ linux*,gnu*) + LIBS="$LIBS -ldl -lm -lrt -rdynamic" + DYN_CFLAGS="-fPIC" + curses_portable_link="/usr/lib/${host_cpu}-${host_os}/libncurses.a /usr/lib/${host_cpu}-${host_os}/libtermcap.a" +diff --git a/racket/src/bc/sconfig.h b/racket/src/bc/sconfig.h +index 01ecb48158..8468942fcd 100644 +--- a/racket/src/bc/sconfig.h ++++ b/racket/src/bc/sconfig.h +@@ -79,12 +79,14 @@ + + #endif + +- /************** Linux with gcc ****************/ ++ /************** Linux (or Hurd) with gcc ****************/ + +-#if defined(__linux__) ++#if defined(__linux__) || defined(__GNU__) + + # ifdef __ANDROID__ + # define SCHEME_OS "android" ++# elif defined(__GNU__) ++# define SCHEME_OS "gnu-hurd" + # else + # define SCHEME_OS "linux" + # endif +@@ -146,13 +148,15 @@ + # define USE_IEEE_FP_PREDS + # define USE_EXPLICT_FP_FORM_CHECK + +-# define LINUX_FIND_STACK_BASE ++# define LINUX_FIND_STACK_BASE /* also ok for Hurd */ + + # define FLAGS_ALREADY_SET + + #if defined(__i386__) +-# define MZ_USE_JIT_I386 +-# define MZ_JIT_USE_MPROTECT ++# ifndef __GNU__ /* Hurd */ ++# define MZ_USE_JIT_I386 ++# define MZ_JIT_USE_MPROTECT ++# endif + # ifndef MZ_NO_UNWIND_SUPPORT + # define MZ_USE_DWARF_LIBUNWIND + # endif +-- +2.32.0 + + +From 1b0cd08557f58506c96f0ddd855bd9051a45a2f1 Mon Sep 17 00:00:00 2001 +From: Philip McGrath <philip@philipmcgrath.com> +Date: Sat, 6 Aug 2022 22:48:40 -0400 +Subject: [PATCH 3/3] BC: repair configure script + +Hopefully this will fix the DrDr failures caused by 5c05496. + +Related to https://github.com/racket/racket/pull/4384 + +(cherry picked from commit c3dd01055ed7589a18136904510fe4db557d6e77) +--- + racket/src/bc/configure | 2 +- + racket/src/bc/configure.ac | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/racket/src/bc/configure b/racket/src/bc/configure +index 4ee346014d..b1c5175b84 100755 +--- a/racket/src/bc/configure ++++ b/racket/src/bc/configure +@@ -5018,7 +5018,7 @@ case "$host_os" in + X_PRE_LIBS="" + fi + ;; +- linux*,gnu*) ++ linux*|gnu*) + LIBS="$LIBS -ldl -lm -lrt -rdynamic" + DYN_CFLAGS="-fPIC" + curses_portable_link="/usr/lib/${host_cpu}-${host_os}/libncurses.a /usr/lib/${host_cpu}-${host_os}/libtermcap.a" +diff --git a/racket/src/bc/configure.ac b/racket/src/bc/configure.ac +index 866851236e..ecc3b0b579 100644 +--- a/racket/src/bc/configure.ac ++++ b/racket/src/bc/configure.ac +@@ -557,7 +557,7 @@ case "$host_os" in + X_PRE_LIBS="" + fi + ;; +- linux*,gnu*) ++ linux*|gnu*) + LIBS="$LIBS -ldl -lm -lrt -rdynamic" + DYN_CFLAGS="-fPIC" + curses_portable_link="/usr/lib/${host_cpu}-${host_os}/libncurses.a /usr/lib/${host_cpu}-${host_os}/libtermcap.a" +-- +2.32.0 + 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-chez-scheme-bin-sh.patch b/gnu/packages/patches/racket-chez-scheme-bin-sh.patch index df2eb671b3..69aca3b483 100644 --- a/gnu/packages/patches/racket-chez-scheme-bin-sh.patch +++ b/gnu/packages/patches/racket-chez-scheme-bin-sh.patch @@ -1,4 +1,4 @@ -From 5f3fc12bf123f30485800960b0493f5dd538d107 Mon Sep 17 00:00:00 2001 +From 988eea0a875d570d8ec155cb0925b4586d36e8d7 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 @@ -22,10 +22,10 @@ on `system` from the C library. 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 +index 82bbf8d687..307c8673a1 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; { +@@ -861,6 +861,22 @@ static ptr s_process(char *s, IBOOL stderrp) { INT tofds[2], fromfds[2], errfds[2]; struct sigaction act, oint_act; @@ -48,10 +48,10 @@ index f5e3e345be..9db2989138 100644 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);} +@@ -897,7 +913,9 @@ static ptr s_process(char *s, IBOOL stderrp) { + } + } + #endif /* __GNU__ Hurd */ - execl("/bin/sh", "/bin/sh", "-c", s, NULL); + /* BEGIN PATCH for Guix */ + execl(guix_sh, guix_sh, "-c", s, NULL); @@ -60,7 +60,7 @@ index f5e3e345be..9db2989138 100644 /*NOTREACHED*/ } else { -base-commit: 9d228d16fb99c274c964e5bef93e97333888769f +base-commit: 87eee6e2adb8c6bc11e60619c706fa6295096085 -- 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 *dir, *l, *p_handle, *result; +@@ -5741,7 +5752,19 @@ zuo_t *zuo_process(zuo_t *command_and_args) + void *env; + int as_child, exact_cmdline; + +- check_path_string(who, command); ++ /* BEGIN PATCH for Guix */ ++ check_path_string(who, _guix_orig_command); ++#if defined(GUIX_RKTIO_BIN_SH) ++ command = ++ ((z.o_false == zuo_string_eql(_guix_orig_command, zuo_string("/bin/sh"))) ++ || (z.o_false == zuo_stat(zuo_string(guix_sh), z.o_false, z.o_true))) ++ ? _guix_orig_command ++ : zuo_string(guix_sh); ++#else ++ command = _guix_orig_command; ++#endif ++ /* END PATCH for Guix */ ++ + for (l = args; l->tag == zuo_pair_tag; l = _zuo_cdr(l)) { + zuo_t *a = _zuo_car(l); + if (a == z.o_null) { + +base-commit: 87eee6e2adb8c6bc11e60619c706fa6295096085 +-- +2.32.0 + diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm index cddb617232..f1a2794164 100644 --- a/gnu/packages/racket.scm +++ b/gnu/packages/racket.scm @@ -54,7 +54,7 @@ (define-module (gnu packages racket) #:use-module (gnu packages xorg) #:use-module ((guix licenses) #:prefix license:)) -;; Commentary: +;; COMMENTARY: ;; ;; Anatomy of Racket: ;; ------------------ @@ -73,14 +73,16 @@ (define-module (gnu packages racket) ;; ├── bc/ ;; ├── cs/ ;; ├── ChezScheme/ +;; ├── zuo/ ;; └── ... ;; ;; The 'racket/src/' directory contains the source of the runtime system, core ;; compiler, and primitives for the major Racket implementations: this layer -;; is called the ``Racket VM''. It is basically a normal autotools -;; project. (Even when Racket VM implementations use components implemented in -;; Racket, they are compiled in special modes to produce VM primitives.) -;; (There are or have been experimental Racket VM implementations elsewhere, +;; is called the ``Racket VM''. It is basically a normal Autoconf project, +;; except that the makefiles just run Zuo to do the real work. (Even when +;; Racket VM implementations use components implemented in Racket, they are +;; compiled in special modes to produce VM primitives.) (There are or have +;; been experimental Racket VM implementations elsewhere, ;; e.g. <https://github.com/pycket/pycket>.) ;; ;; The 'racket/collects/' directory contains ``built in'' Racket libraries @@ -101,10 +103,10 @@ (define-module (gnu packages racket) ;; ;; The top-level 'Makefile' is more like a directory of scripts: it has ;; convienience targets for developing Racket, and it cooperates with the -;; 'distro-build' package to assemble custom Racket distributions. It is not -;; part of Racket source distributions: the root of a source distribution is -;; basically 'racket/src' with some extra package sources and configuration -;; added. +;; 'distro-build' package to assemble custom Racket distributions. (Again, +;; the makefile just delegates to Zuo.) It is not part of Racket source +;; distributions: the root of a source distribution is basically 'racket/src' +;; with some extra package sources and configuration added. ;; ;; A ''minimal Racket'' installation includes two packages: 'base', which is a ;; sort of bridge between the current ``built-in'' collections and the package @@ -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: ;; --------------------- @@ -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: (define* (racket-vm-for-system #:optional (system (or (%current-target-system) @@ -200,7 +204,8 @@ (define* (racket-vm-for-system #:optional racket-vm-cs racket-vm-bc)) -(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)) (define %racket-origin @@ -210,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)) - (patches (search-patches "racket-chez-scheme-bin-sh.patch" - "racket-rktio-bin-sh.patch")) + (patches (search-patches "racket-backport-8.6-cross-install.patch" + "racket-backport-8.6-docindex-write.patch" + "racket-backport-8.6-hurd.patch" + "racket-backport-8.6-zuo.patch" + "racket-chez-scheme-bin-sh.patch" + "racket-rktio-bin-sh.patch" + "racket-zuo-bin-sh.patch")) (modules '((guix build utils))) (snippet #~(begin @@ -233,6 +243,58 @@ (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" + %racket-version + (if revision "-guix" "") + (or revision ""))) + (source %racket-origin) + (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")) + #+@(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. 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))))) + + (define (racket-vm-common-configure-flags) ;; under a lambda abstraction to avoid evaluating bash-minimal too early. #~`(,@(cond @@ -270,7 +332,8 @@ (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 libtool)) ;; <- only for BC variants + (native-inputs (list zuo ;; <- for all variants + libtool)) ;; <- only for BC variants (outputs '("out" "debug")) (build-system gnu-build-system) (arguments @@ -278,6 +341,10 @@ (define-public racket-vm-cgc #:configure-flags #~(cons "--enable-cgcdefault" #$(racket-vm-common-configure-flags)) + #:make-flags + #~(list (string-append "ZUO=" + #+(this-package-native-input "zuo") + "/bin/zuo")) ;; Tests are in packages like racket-test-core and ;; main-distribution-test that aren't part of the main ;; distribution. @@ -637,25 +704,25 @@ (define-public racket "contract-profile" (base32 "1xm2z8g0dpv5d9h2sg680vx1a8ix9gbsdpxxb8qv1w7akp73paj3") '(("contract-profile" "."))) (simple-racket-origin - "data" (base32 "10iabgrk9alaggvksnyb0hdq7f1p30pq6pq2bcakvhzpxwiv1f55") + "data" (base32 "08sj4m0g0cp7gwb0nq90m770f0c21b7ydif7nljc8rxmcdprfisc") '("data" "data-doc" "data-enumerate-lib" "data-lib")) (simple-racket-origin "datalog" (base32 "0nf6cy4djpyhfvgpa6yn72apbz9s83gp0qg95pzjd0az4v6qwq1s") '(("datalog" "."))) (simple-racket-origin - "db" (base32 "1n02ja0yj3mjjhmz0yv04yfhyvrsznbljn8bjviyfxnm4xf9rcc5") + "db" (base32 "0jzsbfcdm3xj0g8xxw3ky2swrhiqqsq2aqa3r08m641dc981dmjq") '("db" "db-doc" "db-lib")) (simple-racket-origin - "deinprogramm" (base32 "0g8flr1qg3bcyhdinqhs4w7dyisaqyailbxrjgd2a7zlqmdyicfr") + "deinprogramm" (base32 "16ncs3ms3mmdavbk0mkhm2qi62vyyif9cch3sn1y64pij489x34v") '("deinprogramm" "deinprogramm-signature")) (simple-racket-origin "distributed-places" (base32 "1dajpkj9balqcpv6cdk9hwjz592h1vq8rrx5vncariiac4vbdpa0") '("distributed-places" "distributed-places-doc" "distributed-places-lib")) (simple-racket-origin - "draw" (base32 "1fpk85rs2crd63bxnmwj2pysisd62pxcqaip01si67dv1ri8ff92") + "draw" (base32 "00rq5y4ba6z1d6jh76kl8rwpxrlqqp81a875zyhk3k81i42635sm") '("draw" "draw-doc" "draw-lib")) (simple-racket-origin - "drracket" (base32 "0dipnz92c63zxys9z1kl5215rm7arc35g9r8bs8ivp96p75mljnz") + "drracket" (base32 "05d7wssi0ry13alb5hl3llpsg30dd0jhyfv5nb1nmg189fn42q62") '("drracket" "drracket-plugin-lib" "drracket-tool" @@ -672,7 +739,7 @@ (define-public racket "eopl" (base32 "1fmiixj6rxsgzwvgva8lvrvv0gl49v2405mp3s0i7ipis5c4n27s") '(("eopl" "."))) (simple-racket-origin - "errortrace" (base32 "14m7rhaxngj36070iw15am434hm438pfgmwjfsiqhsglz4pcxhip") + "errortrace" (base32 "0r5630bb2d6hk0fbi95fmyfja54nnwdfcj2zjba124pp6xkjyavx") '("errortrace" "errortrace-doc" "errortrace-lib")) (simple-racket-origin "expeditor" (base32 "0mjfwb4wzwsg5xj3k6cmik0va432n56rp5h7rxx1c2yy3prh1j7q") @@ -689,13 +756,13 @@ (define-public racket "games" (base32 "0kpn3izlx1ccd0pj0dnvmnrhny51b85xy418a7psj70lz8j8415d") '(("games" "."))) (simple-racket-origin - "gui" (base32 "0r3ck4gxdhnzr1a1fi0f1i7gwfip7akq10qgcxza66pp57hnl0wx") + "gui" (base32 "18pcnx3wi8f32i2frm8bn9pi08n4y3c5jgqs4gy21w6f84dv401w") '("gui" "gui-doc" "gui-lib" "tex-table")) (simple-racket-origin "gui-pkg-manager" (base32 "1ji9448d723nklqvycwdswj0ni28sabrncag14f9mx47did5myb5") '("gui-pkg-manager-lib")) (simple-racket-origin - "htdp" (base32 "19xqixrqbwdxph17w9jga19008j88harb5wgml4hpqj3x0apx9g3") + "htdp" (base32 "173xy6ks55npvwn6cykjs41s9qfb70hc2gfjiqvw91hdsbjykwir") '("htdp" "htdp-doc" "htdp-lib")) (simple-racket-origin "html" (base32 "18n1jnjgzfknc8nv8dppi85nb8q08gqdwkg6hfjk08x0p00anx2x") @@ -719,7 +786,7 @@ (define-public racket "make" (base32 "10852fj30bz5r46c3d99s37fkgy5yh44gb01j29sf3kxnhi0g2sa") '(("make" "."))) (simple-racket-origin - "math" (base32 "02sqbnvxvmvslk33b44fx4v93zafcvhva0cx8z21jqbl5wp217ac") + "math" (base32 "00ld38in5jfshs1q4zf07w84cyv4yjr40kmw30pyd5wqgs2zq9ai") '("math" "math-doc" "math-lib")) (simple-racket-origin "mysterx" (base32 "11p9jzrafw0hizhl0cs4sxx7rv281185q8hryic2rpk0kzjdyr48") @@ -754,16 +821,16 @@ (define-public racket (git-file-name "stamourv-optimization-coach" %racket-version))) '(("optimization-coach" "."))) (simple-racket-origin - "option-contract" (base32 "026b7n5l0c3024nymshz8zp1yhn493rdzgpflzfd52hj7awafqhk") + "option-contract" (base32 "07cncg9pi15cm19k7rzv54vx83wq7y42i2m6bgzaqja1h8vnj2ww") '("option-contract" "option-contract-doc" "option-contract-lib")) (simple-racket-origin - "parser-tools" (base32 "08pvz4zramirzm3j64hbhjm0mmh5zfy37iv4s3vmq0rj49cr8fl3") + "parser-tools" (base32 "04ycihliikh0c47ivp09gayxiql9d9wpl216czic19cj6f7rmcnj") '("parser-tools" "parser-tools-doc" "parser-tools-lib")) (simple-racket-origin "pconvert" (base32 "00czi0p399mmyrvxyrs5kniizpkqfxyz2ncxqi2jy79a7wk79pb1") '("pconvert-lib")) (simple-racket-origin - "pict" (base32 "0v7a3l77swsbh80mnb9rakdwgw7s66ji0mall7qcqfwyg1b4zmlv") + "pict" (base32 "1n0v7kynkiin1v8igs9m8k8vfwjn5cswanhq2imp1pxzjvdyq6sx") '("pict" "pict-doc" "pict-lib")) (simple-racket-origin "pict-snip" (base32 "081nwiy4a0n4f7xws16hqbhf0j3kz5alizndi3nnyr3chm4kng6x") @@ -817,7 +884,7 @@ (define-public racket "racklog" (base32 "0fbq0fpfb3l6h7h772dvkmlzlk2dnq5f8296xx1qxhhwypibqzr9") '(("racklog" "."))) (simple-racket-origin - "rackunit" (base32 "0vfwcddzrgrdv5awjka7m0jzqhqvfc5wlkih83a670y96496a83n") + "rackunit" (base32 "1gpz9sgnm8hrc0cb3rii0wzbcwp9mgy5k1amnxidy7gyzl7prn81") '("rackunit" "rackunit-doc" "rackunit-gui" @@ -830,10 +897,10 @@ (define-public racket "readline" (base32 "13kbcn2wchv82d709mw3r8n37bk8iwq0y4kpvm9dbzx0w2pxkfwn") '("readline" "readline-doc" "readline-lib")) (simple-racket-origin - "realm" (base32 "0hxcgla08iack54j8v40fj51811chpy66ym2zq76zb52c7kzn0hi") + "realm" (base32 "0rlvwyd6rpyl0zda4a5p8dp346fvqzc8555dgfnrhliymkxb6x4g") '(("realm" "."))) (simple-racket-origin - "redex" (base32 "18rn8ddsqh1s7hdlb2cb9wxln63bz0wysjssaf9v92r712xnnv8i") + "redex" (base32 "06dhyqmin0qdm6b6sdvgzpy3pa4svlw42ld9k2h1dxcr852czil7") '("redex" "redex-benchmark" "redex-doc" @@ -848,7 +915,7 @@ (define-public racket "scheme-lib" (base32 "0pcf0y8rp4qyjhaz5ww5sr5diq0wpcdfrrnask7zapyklzx1jx8x") '(("scheme-lib" "."))) (simple-racket-origin - "scribble" (base32 "0fbb7xgz95y90247hfc1a19v7ry8m6blvv4y8irdgzhjvik70zb3") + "scribble" (base32 "0a11kvcnzp04mp4xxq68rkl09jv00hv81k2nmwkmwpfx9b2acvd3") '("scribble" "scribble-doc" "scribble-html-lib" @@ -880,7 +947,7 @@ (define-public racket "snip" (base32 "01r9wc5xr3q3n4yyif6j0a37rgdzmpslxn05k13ksik73b3wj6hj") '("snip" "snip-lib")) (simple-racket-origin - "typed-racket" (base32 "0z6bagp6qiw0i3slhvq035y5hqgq664xw3bdlvdayad0bgbg0mdc") + "typed-racket" (base32 "03wsz647fi58brbg33fw1xavp100gzfvngdy8bk7bdc0jfg8a18l") '("source-syntax" "typed-racket" "typed-racket-compatibility" @@ -891,13 +958,13 @@ (define-public racket "srfi" (base32 "0aqbcdv2dfc2xnk0h6zfi56p7bpwqji8s88qds3d03hhh9k28gvn") '("srfi" "srfi-doc" "srfi-lib" "srfi-lite-lib")) (simple-racket-origin - "string-constants" (base32 "0b1ji31pv6bjb0a2bh9sqp5abvf91gn2rai8r4c4nkar1fzfwfac") + "string-constants" (base32 "1kg3vxq2hcd0vl76brgpzdwbrb65a4nrrkc6hj4az5lfbbdvqz47") '("string-constants" "string-constants-doc" "string-constants-lib")) (simple-racket-origin - "swindle" (base32 "164gdsphjzdl2vv7zxz7dfk9jwax8njpmim6sidm8qz8a8589y67") + "swindle" (base32 "03n9ymjhrw45h7hxkw4nq8nidnvs9mfzb4228s2cjfaqbgqxvsyb") '(("swindle" "."))) (simple-racket-origin - "syntax-color" (base32 "17lb2403ymz6sflw4vs3gsh2y7kgsf0gn8sncsxjhi16rpj3a9vm") + "syntax-color" (base32 "02dcd4yvdnw35m3srvfd43csxffxw3j4rk6zi379b8dsvbbrjyq1") '("syntax-color" "syntax-color-doc" "syntax-color-lib")) (simple-racket-origin "trace" (base32 "070ihla5j796hdarn5wxdwn4xj0xnkm50shgh49jy994mribvhia") @@ -906,7 +973,7 @@ (define-public racket "unix-socket" (base32 "02dfwas5ynbpyz74w9kwb4wgb37y5wys7svrlmir8k0n9ph9vq0y") '("unix-socket" "unix-socket-doc" "unix-socket-lib")) (simple-racket-origin - "web-server" (base32 "1g4x79ym3mgxv4f3z3z84j12355pf44pjlzlb7f0h6r0i7p0cbjd") + "web-server" (base32 "104lnzjykkd6f3gxpv7p14l94if6zac33nmb4sj5jxmd6r3fwcpf") '("web-server" "web-server-doc" "web-server-lib")) (simple-racket-origin "wxme" (base32 "1qp5gr9gqsakiq3alw6m4yyv5vw4i3hp4y4nhq8vl2nkjmirvn0b") -- 2.32.0 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH 4/6] gnu: Update Racket to 8.6. Add Zuo. 2022-08-08 6:10 ` [bug#57050] [PATCH 4/6] gnu: Update Racket to 8.6. Add Zuo Philip McGrath @ 2022-08-08 9:01 ` Liliana Marie Prikler 2022-08-09 20:56 ` Philip McGrath 0 siblings, 1 reply; 122+ messages in thread From: Liliana Marie Prikler @ 2022-08-08 9:01 UTC (permalink / raw) To: Philip McGrath, 57050 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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH 4/6] gnu: Update Racket to 8.6. Add Zuo. 2022-08-08 9:01 ` Liliana Marie Prikler @ 2022-08-09 20:56 ` Philip McGrath 2022-08-10 7:34 ` Liliana Marie Prikler 0 siblings, 1 reply; 122+ messages in thread From: Philip McGrath @ 2022-08-09 20:56 UTC (permalink / raw) To: 57050, Liliana Marie Prikler [-- Attachment #1: Type: text/plain, Size: 1806 bytes --] 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. 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 [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH 4/6] gnu: Update Racket to 8.6. Add Zuo. 2022-08-09 20:56 ` Philip McGrath @ 2022-08-10 7:34 ` Liliana Marie Prikler 0 siblings, 0 replies; 122+ messages in thread From: Liliana Marie Prikler @ 2022-08-10 7:34 UTC (permalink / raw) To: Philip McGrath, 57050 Am Dienstag, dem 09.08.2022 um 16:56 -0400 schrieb Philip McGrath: > 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. > The packages developed in the main Racket Git repository are very > tightly linked. You mean coupled. > 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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH 5/6] gnu: racket: Use Racket CS on all systems. 2022-08-08 6:06 [bug#57050] [PATCH 0/6] gnu: Update Racket to 8.6. Add Zuo Philip McGrath ` (3 preceding siblings ...) 2022-08-08 6:10 ` [bug#57050] [PATCH 4/6] gnu: Update Racket to 8.6. Add Zuo Philip McGrath @ 2022-08-08 6:10 ` Philip McGrath 2022-08-08 9:10 ` Liliana Marie Prikler 2022-08-08 6:10 ` [bug#57050] [PATCH 6/6] gnu: chez-scheme-for-racket: Suport " Philip McGrath 2022-08-10 15:30 ` [bug#57050] [PATCH 0/6] gnu: Update Racket to 8.6. Add Zuo Thiago Jung Bauermann via Guix-patches via 6 siblings, 1 reply; 122+ messages in thread From: Philip McGrath @ 2022-08-08 6:10 UTC (permalink / raw) To: 57050; +Cc: Philip McGrath 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(-) 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH 5/6] gnu: racket: Use Racket CS on all systems. 2022-08-08 6:10 ` [bug#57050] [PATCH 5/6] gnu: racket: Use Racket CS on all systems Philip McGrath @ 2022-08-08 9:10 ` Liliana Marie Prikler 0 siblings, 0 replies; 122+ messages in thread From: Liliana Marie Prikler @ 2022-08-08 9:10 UTC (permalink / raw) To: Philip McGrath, 57050 Am Montag, dem 08.08.2022 um 02:10 -0400 schrieb Philip McGrath: > 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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH 6/6] gnu: chez-scheme-for-racket: Suport all systems. 2022-08-08 6:06 [bug#57050] [PATCH 0/6] gnu: Update Racket to 8.6. Add Zuo Philip McGrath ` (4 preceding siblings ...) 2022-08-08 6:10 ` [bug#57050] [PATCH 5/6] gnu: racket: Use Racket CS on all systems Philip McGrath @ 2022-08-08 6:10 ` Philip McGrath 2022-08-08 9:15 ` Liliana Marie Prikler 2022-08-10 15:30 ` [bug#57050] [PATCH 0/6] gnu: Update Racket to 8.6. Add Zuo Thiago Jung Bauermann via Guix-patches via 6 siblings, 1 reply; 122+ messages in thread From: Philip McGrath @ 2022-08-08 6:10 UTC (permalink / raw) To: 57050; +Cc: Philip McGrath 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(-) 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH 6/6] gnu: chez-scheme-for-racket: Suport all systems. 2022-08-08 6:10 ` [bug#57050] [PATCH 6/6] gnu: chez-scheme-for-racket: Suport " Philip McGrath @ 2022-08-08 9:15 ` Liliana Marie Prikler 0 siblings, 0 replies; 122+ messages in thread From: Liliana Marie Prikler @ 2022-08-08 9:15 UTC (permalink / raw) To: Philip McGrath, 57050 Am Montag, dem 08.08.2022 um 02:10 -0400 schrieb Philip McGrath: > 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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH 0/6] gnu: Update Racket to 8.6. Add Zuo. 2022-08-08 6:06 [bug#57050] [PATCH 0/6] gnu: Update Racket to 8.6. Add Zuo Philip McGrath ` (5 preceding siblings ...) 2022-08-08 6:10 ` [bug#57050] [PATCH 6/6] gnu: chez-scheme-for-racket: Suport " Philip McGrath @ 2022-08-10 15:30 ` Thiago Jung Bauermann via Guix-patches via 2022-08-11 4:00 ` Philip McGrath 6 siblings, 1 reply; 122+ messages in thread From: Thiago Jung Bauermann via Guix-patches via @ 2022-08-10 15:30 UTC (permalink / raw) To: Philip McGrath; +Cc: 57050 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 Thiago ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH 0/6] gnu: Update Racket to 8.6. Add Zuo. 2022-08-10 15:30 ` [bug#57050] [PATCH 0/6] gnu: Update Racket to 8.6. Add Zuo Thiago Jung Bauermann via Guix-patches via @ 2022-08-11 4:00 ` Philip McGrath 2022-08-11 11:08 ` [bug#57050] [PATCH v2 00/13] " Philip McGrath 0 siblings, 1 reply; 122+ messages in thread From: Philip McGrath @ 2022-08-11 4:00 UTC (permalink / raw) To: Thiago Jung Bauermann; +Cc: 57050 Hi Thiago, On Wed, Aug 10, 2022, at 11:30 AM, Thiago Jung Bauermann wrote: > 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 <https://racket.discourse.group/t/chez-for-architectures-without-native-backends/950/>, 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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 00/13] gnu: Update Racket to 8.6. Add Zuo. 2022-08-11 4:00 ` Philip McGrath @ 2022-08-11 11:08 ` Philip McGrath 2022-08-11 11:08 ` [bug#57050] [PATCH v2 01/13] gnu: stex: Update to 1.2.2-2.afa6075 Philip McGrath ` (15 more replies) 0 siblings, 16 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-11 11:08 UTC (permalink / raw) To: 57050 Cc: Liliana Marie Prikler, Liliana Marie Prikler, Philip McGrath, Thiago Jung Bauermann 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-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. (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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 01/13] gnu: stex: Update to 1.2.2-2.afa6075. 2022-08-11 11:08 ` [bug#57050] [PATCH v2 00/13] " Philip McGrath @ 2022-08-11 11:08 ` Philip McGrath 2022-08-11 11:08 ` [bug#57050] [PATCH v2 02/13] gnu: stex: Fix read-only gifs and math directories Philip McGrath ` (14 subsequent siblings) 15 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-11 11:08 UTC (permalink / raw) To: 57050 Cc: Liliana Marie Prikler, Liliana Marie Prikler, Philip McGrath, Thiago Jung Bauermann * 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(-) 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 02/13] gnu: stex: Fix read-only gifs and math directories. 2022-08-11 11:08 ` [bug#57050] [PATCH v2 00/13] " Philip McGrath 2022-08-11 11:08 ` [bug#57050] [PATCH v2 01/13] gnu: stex: Update to 1.2.2-2.afa6075 Philip McGrath @ 2022-08-11 11:08 ` Philip McGrath 2022-08-11 11:13 ` Liliana Marie Prikler 2022-08-11 11:08 ` [bug#57050] [PATCH v2 03/13] gnu: chez-scheme: Fix use of "/bin/sh" Philip McGrath ` (13 subsequent siblings) 15 siblings, 1 reply; 122+ messages in thread From: Philip McGrath @ 2022-08-11 11:08 UTC (permalink / raw) To: 57050 Cc: Liliana Marie Prikler, Liliana Marie Prikler, Philip McGrath, Thiago Jung Bauermann 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")) (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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 02/13] gnu: stex: Fix read-only gifs and math directories. 2022-08-11 11:08 ` [bug#57050] [PATCH v2 02/13] gnu: stex: Fix read-only gifs and math directories Philip McGrath @ 2022-08-11 11:13 ` Liliana Marie Prikler 0 siblings, 0 replies; 122+ messages in thread From: Liliana Marie Prikler @ 2022-08-11 11:13 UTC (permalink / raw) To: Philip McGrath, 57050; +Cc: Liliana Marie Prikler, Thiago Jung Bauermann Am Donnerstag, dem 11.08.2022 um 07:08 -0400 schrieb Philip McGrath: > 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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 03/13] gnu: chez-scheme: Fix use of "/bin/sh". 2022-08-11 11:08 ` [bug#57050] [PATCH v2 00/13] " Philip McGrath 2022-08-11 11:08 ` [bug#57050] [PATCH v2 01/13] gnu: stex: Update to 1.2.2-2.afa6075 Philip McGrath 2022-08-11 11:08 ` [bug#57050] [PATCH v2 02/13] gnu: stex: Fix read-only gifs and math directories Philip McGrath @ 2022-08-11 11:08 ` Philip McGrath 2022-08-11 11:08 ` [bug#57050] [PATCH v2 04/13] gnu: Add Zuo Philip McGrath ` (12 subsequent siblings) 15 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-11 11:08 UTC (permalink / raw) To: 57050 Cc: Liliana Marie Prikler, Liliana Marie Prikler, Philip McGrath, Thiago Jung Bauermann 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 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 04/13] gnu: Add Zuo. 2022-08-11 11:08 ` [bug#57050] [PATCH v2 00/13] " Philip McGrath ` (2 preceding siblings ...) 2022-08-11 11:08 ` [bug#57050] [PATCH v2 03/13] gnu: chez-scheme: Fix use of "/bin/sh" Philip McGrath @ 2022-08-11 11:08 ` Philip McGrath 2022-08-11 11:31 ` Liliana Marie Prikler 2022-08-11 11:08 ` [bug#57050] [PATCH v2 05/13] gnu: racket: Update to 8.6 Philip McGrath ` (11 subsequent siblings) 15 siblings, 1 reply; 122+ messages in thread From: Philip McGrath @ 2022-08-11 11:08 UTC (permalink / raw) To: 57050 Cc: Liliana Marie Prikler, Liliana Marie Prikler, Philip McGrath, Thiago Jung Bauermann * 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 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 *dir, *l, *p_handle, *result; +@@ -5741,7 +5752,19 @@ zuo_t *zuo_process(zuo_t *command_and_args) + void *env; + int as_child, exact_cmdline; + +- check_path_string(who, command); ++ /* BEGIN PATCH for Guix */ ++ check_path_string(who, _guix_orig_command); ++#if defined(GUIX_RKTIO_BIN_SH) ++ command = ++ ((z.o_false == zuo_string_eql(_guix_orig_command, zuo_string("/bin/sh"))) ++ || (z.o_false == zuo_stat(zuo_string(guix_sh), z.o_false, z.o_true))) ++ ? _guix_orig_command ++ : zuo_string(guix_sh); ++#else ++ command = _guix_orig_command; ++#endif ++ /* END PATCH for Guix */ ++ + for (l = args; l->tag == zuo_pair_tag; l = _zuo_cdr(l)) { + zuo_t *a = _zuo_car(l); + if (a == z.o_null) { + +base-commit: 87eee6e2adb8c6bc11e60619c706fa6295096085 +-- +2.32.0 + diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm index cddb617232..0c8b3b6bb8 100644 --- a/gnu/packages/racket.scm +++ b/gnu/packages/racket.scm @@ -201,6 +201,7 @@ (define* (racket-vm-for-system #:optional racket-vm-bc)) (define %racket-version "8.5") ; 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)) (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 ""))) + (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")) + #+@(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. 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))))) + + (define (racket-vm-common-configure-flags) ;; under a lambda abstraction to avoid evaluating bash-minimal too early. #~`(,@(cond -- 2.32.0 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 04/13] gnu: Add Zuo. 2022-08-11 11:08 ` [bug#57050] [PATCH v2 04/13] gnu: Add Zuo Philip McGrath @ 2022-08-11 11:31 ` Liliana Marie Prikler 2022-08-11 14:00 ` Philip McGrath 0 siblings, 1 reply; 122+ messages in thread From: Liliana Marie Prikler @ 2022-08-11 11:31 UTC (permalink / raw) To: Philip McGrath, 57050; +Cc: Liliana Marie Prikler, Thiago Jung Bauermann 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? > (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/zuo and git-version. > + (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. > + #+@(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. > 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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 04/13] gnu: Add Zuo. 2022-08-11 11:31 ` Liliana Marie Prikler @ 2022-08-11 14:00 ` Philip McGrath 2022-08-11 15:34 ` Liliana Marie Prikler 2022-08-16 14:47 ` Maxime Devos 0 siblings, 2 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-11 14:00 UTC (permalink / raw) To: Liliana Marie Prikler, 57050; +Cc: Liliana Marie Prikler, Thiago Jung Bauermann Hi, On Thu, Aug 11, 2022, at 7:31 AM, Liliana Marie Prikler wrote: > 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 "" See also https://racket.discourse.group/t/writing-the-zuo-version-number/1105 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. >> + >> +(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/zuo would basically never be useful. It is generated intermittently from https://github.com/racket/racket using `git subtree`. >> + (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" >> + (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. > >> 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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 04/13] gnu: Add Zuo. 2022-08-11 14:00 ` Philip McGrath @ 2022-08-11 15:34 ` Liliana Marie Prikler 2022-08-11 23:32 ` Philip McGrath 2022-08-16 14:47 ` Maxime Devos 1 sibling, 1 reply; 122+ messages in thread From: Liliana Marie Prikler @ 2022-08-11 15:34 UTC (permalink / raw) To: Philip McGrath, 57050; +Cc: Thiago Jung Bauermann Hi, Am Donnerstag, dem 11.08.2022 um 10:00 -0400 schrieb Philip McGrath: > > > 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. > > > > + (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.) > > > + (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 😉️ > > > > > 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? > (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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 04/13] gnu: Add Zuo. 2022-08-11 15:34 ` Liliana Marie Prikler @ 2022-08-11 23:32 ` Philip McGrath 0 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-11 23:32 UTC (permalink / raw) To: Liliana Marie Prikler, 57050; +Cc: Thiago Jung Bauermann Hi, On Thu, Aug 11, 2022, at 11:34 AM, Liliana Marie Prikler wrote: > 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. >> > > + (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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 04/13] gnu: Add Zuo. 2022-08-11 14:00 ` Philip McGrath 2022-08-11 15:34 ` Liliana Marie Prikler @ 2022-08-16 14:47 ` Maxime Devos 2022-08-23 1:40 ` Philip McGrath 1 sibling, 1 reply; 122+ messages in thread From: Maxime Devos @ 2022-08-16 14:47 UTC (permalink / raw) To: Philip McGrath, Liliana Marie Prikler, 57050 Cc: Liliana Marie Prikler, Thiago Jung Bauermann [-- Attachment #1.1.1.1: Type: text/plain, Size: 1477 bytes --] 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 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 #1.1.1.2: Type: text/html, Size: 2171 bytes --] [-- Attachment #1.1.2: OpenPGP public key --] [-- Type: application/pgp-keys, Size: 929 bytes --] [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 236 bytes --] ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 04/13] gnu: Add Zuo. 2022-08-16 14:47 ` Maxime Devos @ 2022-08-23 1:40 ` Philip McGrath 2022-08-23 9:11 ` Maxime Devos 2022-08-23 9:20 ` Maxime Devos 0 siblings, 2 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-23 1:40 UTC (permalink / raw) To: Maxime Devos, Liliana Marie Prikler, 57050 Cc: Liliana Marie Prikler, Efraim Flashner, Thiago Jung Bauermann Hi, On Tue, Aug 16, 2022, at 10:47 AM, Maxime Devos wrote: > 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. > 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: > 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.) > > 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": > > 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! --8<---------------cut here---------------start------------->8--- (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)) --8<---------------cut here---------------end--------------->8--- 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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 04/13] gnu: Add Zuo. 2022-08-23 1:40 ` Philip McGrath @ 2022-08-23 9:11 ` Maxime Devos 2022-08-23 23:24 ` Philip McGrath 2022-08-23 9:20 ` Maxime Devos 1 sibling, 1 reply; 122+ messages in thread From: Maxime Devos @ 2022-08-23 9:11 UTC (permalink / raw) To: Philip McGrath, Liliana Marie Prikler, 57050 Cc: Liliana Marie Prikler, Efraim Flashner, Thiago Jung Bauermann [-- Attachment #1.1.1: Type: text/plain, Size: 445 bytes --] 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. Greetings, Maxime. [-- Attachment #1.1.2: OpenPGP public key --] [-- Type: application/pgp-keys, Size: 929 bytes --] [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 236 bytes --] ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 04/13] gnu: Add Zuo. 2022-08-23 9:11 ` Maxime Devos @ 2022-08-23 23:24 ` Philip McGrath 0 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-23 23:24 UTC (permalink / raw) To: Maxime Devos, Liliana Marie Prikler, 57050 Cc: Liliana Marie Prikler, Efraim Flashner, Thiago Jung Bauermann On Tue, Aug 23, 2022, at 5:11 AM, Maxime Devos wrote: > 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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 04/13] gnu: Add Zuo. 2022-08-23 1:40 ` Philip McGrath 2022-08-23 9:11 ` Maxime Devos @ 2022-08-23 9:20 ` Maxime Devos 2022-08-24 0:27 ` Philip McGrath 1 sibling, 1 reply; 122+ messages in thread From: Maxime Devos @ 2022-08-23 9:20 UTC (permalink / raw) To: Philip McGrath, Liliana Marie Prikler, 57050 Cc: Liliana Marie Prikler, Efraim Flashner, Thiago Jung Bauermann [-- Attachment #1.1.1: Type: text/plain, Size: 1525 bytes --] > [...] > 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: > 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: > 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 #1.1.2: OpenPGP public key --] [-- Type: application/pgp-keys, Size: 929 bytes --] [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 236 bytes --] ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 04/13] gnu: Add Zuo. 2022-08-23 9:20 ` Maxime Devos @ 2022-08-24 0:27 ` Philip McGrath 2022-08-24 5:42 ` Liliana Marie Prikler ` (2 more replies) 0 siblings, 3 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-24 0:27 UTC (permalink / raw) To: Maxime Devos, Liliana Marie Prikler, 57050 Cc: Liliana Marie Prikler, Efraim Flashner, Thiago Jung Bauermann On Tue, Aug 23, 2022, at 5:20 AM, Maxime Devos wrote: >> [...] >> 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. > 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. > 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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 04/13] gnu: Add Zuo. 2022-08-24 0:27 ` Philip McGrath @ 2022-08-24 5:42 ` Liliana Marie Prikler 2022-08-24 5:47 ` Philip McGrath 2022-08-25 8:54 ` [bug#57050] [PATCH v3 00/14] gnu: Update Racket to 8.6. " Philip McGrath 2022-08-27 18:55 ` [bug#57050] [PATCH v4 " Philip McGrath 2 siblings, 1 reply; 122+ messages in thread From: Liliana Marie Prikler @ 2022-08-24 5:42 UTC (permalink / raw) To: Philip McGrath, Maxime Devos, 57050 Cc: Efraim Flashner, Thiago Jung Bauermann 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? ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 04/13] gnu: Add Zuo. 2022-08-24 5:42 ` Liliana Marie Prikler @ 2022-08-24 5:47 ` Philip McGrath 0 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-24 5:47 UTC (permalink / raw) To: Liliana Marie Prikler, Maxime Devos, 57050 Cc: Efraim Flashner, Thiago Jung Bauermann On Wed, Aug 24, 2022, at 1:42 AM, Liliana Marie Prikler wrote: > 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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v3 00/14] gnu: Update Racket to 8.6. Add Zuo. 2022-08-24 0:27 ` Philip McGrath 2022-08-24 5:42 ` Liliana Marie Prikler @ 2022-08-25 8:54 ` Philip McGrath 2022-08-25 8:54 ` [bug#57050] [PATCH v3 01/14] gnu: stex: Update to 1.2.2-2.afa6075 Philip McGrath ` (14 more replies) 2022-08-27 18:55 ` [bug#57050] [PATCH v4 " Philip McGrath 2 siblings, 15 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-25 8:54 UTC (permalink / raw) To: 57050 Cc: Philip McGrath, Thiago Jung Bauermann, (, Maxime Devos, Liliana Marie Prikler, Efraim Flashner, Liliana Marie Prikler 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). -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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v3 01/14] gnu: stex: Update to 1.2.2-2.afa6075. 2022-08-25 8:54 ` [bug#57050] [PATCH v3 00/14] gnu: Update Racket to 8.6. " Philip McGrath @ 2022-08-25 8:54 ` Philip McGrath 2022-08-25 8:54 ` [bug#57050] [PATCH v3 02/14] gnu: stex: Fix read-only gifs and math directories Philip McGrath ` (13 subsequent siblings) 14 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-25 8:54 UTC (permalink / raw) To: 57050 Cc: Philip McGrath, Thiago Jung Bauermann, (, Maxime Devos, Liliana Marie Prikler, Efraim Flashner, Liliana Marie Prikler * 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(-) 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v3 02/14] gnu: stex: Fix read-only gifs and math directories. 2022-08-25 8:54 ` [bug#57050] [PATCH v3 00/14] gnu: Update Racket to 8.6. " Philip McGrath 2022-08-25 8:54 ` [bug#57050] [PATCH v3 01/14] gnu: stex: Update to 1.2.2-2.afa6075 Philip McGrath @ 2022-08-25 8:54 ` Philip McGrath 2022-08-25 8:54 ` [bug#57050] [PATCH v3 03/14] etc: teams: Add racket team Philip McGrath ` (12 subsequent siblings) 14 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-25 8:54 UTC (permalink / raw) To: 57050 Cc: Philip McGrath, Thiago Jung Bauermann, (, Maxime Devos, Liliana Marie Prikler, Efraim Flashner, Liliana Marie Prikler 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 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v3 03/14] etc: teams: Add racket team. 2022-08-25 8:54 ` [bug#57050] [PATCH v3 00/14] gnu: Update Racket to 8.6. " Philip McGrath 2022-08-25 8:54 ` [bug#57050] [PATCH v3 01/14] gnu: stex: Update to 1.2.2-2.afa6075 Philip McGrath 2022-08-25 8:54 ` [bug#57050] [PATCH v3 02/14] gnu: stex: Fix read-only gifs and math directories Philip McGrath @ 2022-08-25 8:54 ` Philip McGrath 2022-08-25 8:54 ` [bug#57050] [PATCH v3 04/14] etc: teams: Add entry for Philip McGrath Philip McGrath ` (11 subsequent siblings) 14 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-25 8:54 UTC (permalink / raw) To: 57050 Cc: Philip McGrath, Thiago Jung Bauermann, (, Maxime Devos, Liliana Marie Prikler, Efraim Flashner, Liliana Marie Prikler * etc/teams.scm.in (racket): New team. --- etc/teams.scm.in | 8 ++++++++ 1 file changed, 8 insertions(+) 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.")) + \f (define-member (person "Thiago Jung Bauermann" "bauermann@kolabnow.com") -- 2.32.0 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v3 04/14] etc: teams: Add entry for Philip McGrath. 2022-08-25 8:54 ` [bug#57050] [PATCH v3 00/14] gnu: Update Racket to 8.6. " Philip McGrath ` (2 preceding siblings ...) 2022-08-25 8:54 ` [bug#57050] [PATCH v3 03/14] etc: teams: Add racket team Philip McGrath @ 2022-08-25 8:54 ` Philip McGrath 2022-08-25 8:54 ` [bug#57050] [PATCH v3 05/14] gnu: racket: Adjust patch for "/bin/sh" in rktio Philip McGrath ` (10 subsequent siblings) 14 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-25 8:54 UTC (permalink / raw) To: 57050 Cc: Philip McGrath, Thiago Jung Bauermann, (, Maxime Devos, Liliana Marie Prikler, Efraim Flashner, Liliana Marie Prikler * etc/teams.scm.in ("Philip McGrath"): New member. --- etc/teams.scm.in | 4 ++++ 1 file changed, 4 insertions(+) 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v3 05/14] gnu: racket: Adjust patch for "/bin/sh" in rktio. 2022-08-25 8:54 ` [bug#57050] [PATCH v3 00/14] gnu: Update Racket to 8.6. " Philip McGrath ` (3 preceding siblings ...) 2022-08-25 8:54 ` [bug#57050] [PATCH v3 04/14] etc: teams: Add entry for Philip McGrath Philip McGrath @ 2022-08-25 8:54 ` Philip McGrath 2022-08-25 9:09 ` Liliana Marie Prikler 2022-08-25 8:54 ` [bug#57050] [PATCH v3 06/14] gnu: chez-scheme: Fix use of "/bin/sh" Philip McGrath ` (9 subsequent siblings) 14 siblings, 1 reply; 122+ messages in thread From: Philip McGrath @ 2022-08-25 8:54 UTC (permalink / raw) To: 57050 Cc: Philip McGrath, Thiago Jung Bauermann, (, Maxime Devos, Liliana Marie Prikler, Efraim Flashner, Liliana Marie Prikler 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%) 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v3 05/14] gnu: racket: Adjust patch for "/bin/sh" in rktio. 2022-08-25 8:54 ` [bug#57050] [PATCH v3 05/14] gnu: racket: Adjust patch for "/bin/sh" in rktio Philip McGrath @ 2022-08-25 9:09 ` Liliana Marie Prikler 2022-08-25 19:16 ` Philip McGrath 0 siblings, 1 reply; 122+ messages in thread From: Liliana Marie Prikler @ 2022-08-25 9:09 UTC (permalink / raw) To: Philip McGrath, 57050 Cc: (, Maxime Devos, Efraim Flashner, Thiago Jung Bauermann 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. ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v3 05/14] gnu: racket: Adjust patch for "/bin/sh" in rktio. 2022-08-25 9:09 ` Liliana Marie Prikler @ 2022-08-25 19:16 ` Philip McGrath 0 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-25 19:16 UTC (permalink / raw) To: Liliana Marie Prikler, 57050 Cc: (, Maxime Devos, Efraim Flashner, Thiago Jung Bauermann On Thu, Aug 25, 2022, at 5:09 AM, Liliana Marie Prikler wrote: > 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. ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v3 06/14] gnu: chez-scheme: Fix use of "/bin/sh". 2022-08-25 8:54 ` [bug#57050] [PATCH v3 00/14] gnu: Update Racket to 8.6. " Philip McGrath ` (4 preceding siblings ...) 2022-08-25 8:54 ` [bug#57050] [PATCH v3 05/14] gnu: racket: Adjust patch for "/bin/sh" in rktio Philip McGrath @ 2022-08-25 8:54 ` Philip McGrath 2022-08-25 8:54 ` [bug#57050] [PATCH v3 07/14] gnu: Add Zuo Philip McGrath ` (8 subsequent siblings) 14 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-25 8:54 UTC (permalink / raw) To: 57050 Cc: Philip McGrath, Thiago Jung Bauermann, (, Maxime Devos, Liliana Marie Prikler, Efraim Flashner, Liliana Marie Prikler 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 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v3 07/14] gnu: Add Zuo. 2022-08-25 8:54 ` [bug#57050] [PATCH v3 00/14] gnu: Update Racket to 8.6. " Philip McGrath ` (5 preceding siblings ...) 2022-08-25 8:54 ` [bug#57050] [PATCH v3 06/14] gnu: chez-scheme: Fix use of "/bin/sh" Philip McGrath @ 2022-08-25 8:54 ` Philip McGrath 2022-08-25 9:12 ` Liliana Marie Prikler 2022-08-25 10:30 ` Efraim Flashner 2022-08-25 8:54 ` [bug#57050] [PATCH v3 08/14] gnu: racket: Update to 8.6 Philip McGrath ` (7 subsequent siblings) 14 siblings, 2 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-25 8:54 UTC (permalink / raw) To: 57050 Cc: Philip McGrath, Thiago Jung Bauermann, (, Maxime Devos, Liliana Marie Prikler, Efraim Flashner, Liliana Marie Prikler * 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 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, *opt; + zuo_t *dir, *l, *p_handle, *result; +@@ -5741,7 +5745,19 @@ zuo_t *zuo_process(zuo_t *command_and_args) + void *env; + int as_child, exact_cmdline; + +- check_path_string(who, command); ++ /* BEGIN PATCH for Guix */ ++ check_path_string(who, _guix_orig_command); ++#if defined(_PATH_BSHELL) ++ command = ++ ((z.o_false == zuo_string_eql(_guix_orig_command, zuo_string("/bin/sh"))) ++ || (z.o_false == zuo_stat(zuo_string(_PATH_BSHELL), z.o_false, z.o_true))) ++ ? _guix_orig_command ++ : zuo_string(_PATH_BSHELL); ++#else ++ command = _guix_orig_command; ++#endif ++ /* END PATCH for Guix */ ++ + for (l = args; l->tag == zuo_pair_tag; l = _zuo_cdr(l)) { + zuo_t *a = _zuo_car(l); + if (a == z.o_null) { + +base-commit: 87eee6e2adb8c6bc11e60619c706fa6295096085 +-- +2.32.0 + diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm index 0f766e7850..6433897981 100644 --- a/gnu/packages/racket.scm +++ b/gnu/packages/racket.scm @@ -200,6 +200,7 @@ (define* (racket-vm-for-system #:optional racket-vm-bc)) (define %racket-version "8.5") ; 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)) (define %racket-origin @@ -232,6 +233,56 @@ (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 ""))) + (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) + (arguments + (list + #:out-of-source? #t + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'chdir + (lambda args + (chdir "racket/src/zuo")))))) + (home-page "https://github.com/racket/zuo") + ;; ^ This is downstream of https://github.com/racket/racket, + ;; but it's designed to be a friendly landing place + (synopsis "Tiny Racket for build scripts") + (description "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))))) + + (define racket-vm-common-configure-flags #~`(,@(cond ((false-if-exception -- 2.32.0 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v3 07/14] gnu: Add Zuo. 2022-08-25 8:54 ` [bug#57050] [PATCH v3 07/14] gnu: Add Zuo Philip McGrath @ 2022-08-25 9:12 ` Liliana Marie Prikler 2022-08-25 10:30 ` Efraim Flashner 1 sibling, 0 replies; 122+ messages in thread From: Liliana Marie Prikler @ 2022-08-25 9:12 UTC (permalink / raw) To: Philip McGrath, 57050 Cc: (, Maxime Devos, Efraim Flashner, Thiago Jung Bauermann Hi, Am Donnerstag, dem 25.08.2022 um 04:54 -0400 schrieb Philip McGrath: > * 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. > * 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: [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, *opt; > + zuo_t *dir, *l, *p_handle, *result; > +@@ -5741,7 +5745,19 @@ zuo_t *zuo_process(zuo_t *command_and_args) > + void *env; > + int as_child, exact_cmdline; > + > +- check_path_string(who, command); > ++ /* BEGIN PATCH for Guix */ > ++ check_path_string(who, _guix_orig_command); > ++#if defined(_PATH_BSHELL) > ++ command = > ++ ((z.o_false == zuo_string_eql(_guix_orig_command, > zuo_string("/bin/sh"))) > ++ || (z.o_false == zuo_stat(zuo_string(_PATH_BSHELL), z.o_false, > z.o_true))) > ++ ? _guix_orig_command > ++ : zuo_string(_PATH_BSHELL); > ++#else > ++ command = _guix_orig_command; > ++#endif > ++ /* END PATCH for Guix */ > ++ > + for (l = args; l->tag == zuo_pair_tag; l = _zuo_cdr(l)) { > + zuo_t *a = _zuo_car(l); > + if (a == z.o_null) { > + > +base-commit: 87eee6e2adb8c6bc11e60619c706fa6295096085 > +-- > +2.32.0 > + > diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm > index 0f766e7850..6433897981 100644 > --- a/gnu/packages/racket.scm > +++ b/gnu/packages/racket.scm > @@ -200,6 +200,7 @@ (define* (racket-vm-for-system #:optional > racket-vm-bc)) > > (define %racket-version "8.5") ; 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)) > (define %racket-origin > @@ -232,6 +233,56 @@ (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 ""))) > + (source > + (origin > + (inherit %racket-origin) > + (uri (git-reference > + (url "https://github.com/racket/racket") > + (commit "v8.6"))) Reiterate my old point on git-version. > + (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) > + (arguments > + (list > + #:out-of-source? #t > + #:phases > + #~(modify-phases %standard-phases > + (add-after 'unpack 'chdir > + (lambda args > + (chdir "racket/src/zuo")))))) > + (home-page "https://github.com/racket/zuo") > + ;; ^ This is downstream of https://github.com/racket/racket, > + ;; but it's designed to be a friendly landing place > + (synopsis "Tiny Racket for build scripts") > + (description "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))))) Reiterate my aversion to advertisements. Cheers ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v3 07/14] gnu: Add Zuo. 2022-08-25 8:54 ` [bug#57050] [PATCH v3 07/14] gnu: Add Zuo Philip McGrath 2022-08-25 9:12 ` Liliana Marie Prikler @ 2022-08-25 10:30 ` Efraim Flashner 2022-08-25 20:04 ` Philip McGrath 1 sibling, 1 reply; 122+ messages in thread From: Efraim Flashner @ 2022-08-25 10:30 UTC (permalink / raw) To: Philip McGrath Cc: Thiago Jung Bauermann, (, Maxime Devos, Liliana Marie Prikler, Liliana Marie Prikler, 57050 [-- Attachment #1: Type: text/plain, Size: 26681 bytes --] On Thu, Aug 25, 2022 at 04:54:09AM -0400, Philip McGrath wrote: > * 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 > > 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, *opt; > + zuo_t *dir, *l, *p_handle, *result; > +@@ -5741,7 +5745,19 @@ zuo_t *zuo_process(zuo_t *command_and_args) > + void *env; > + int as_child, exact_cmdline; > + > +- check_path_string(who, command); > ++ /* BEGIN PATCH for Guix */ > ++ check_path_string(who, _guix_orig_command); > ++#if defined(_PATH_BSHELL) > ++ command = > ++ ((z.o_false == zuo_string_eql(_guix_orig_command, zuo_string("/bin/sh"))) > ++ || (z.o_false == zuo_stat(zuo_string(_PATH_BSHELL), z.o_false, z.o_true))) > ++ ? _guix_orig_command > ++ : zuo_string(_PATH_BSHELL); > ++#else > ++ command = _guix_orig_command; > ++#endif > ++ /* END PATCH for Guix */ > ++ > + for (l = args; l->tag == zuo_pair_tag; l = _zuo_cdr(l)) { > + zuo_t *a = _zuo_car(l); > + if (a == z.o_null) { > + > +base-commit: 87eee6e2adb8c6bc11e60619c706fa6295096085 > +-- > +2.32.0 > + > diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm > index 0f766e7850..6433897981 100644 > --- a/gnu/packages/racket.scm > +++ b/gnu/packages/racket.scm > @@ -200,6 +200,7 @@ (define* (racket-vm-for-system #:optional > racket-vm-bc)) > > (define %racket-version "8.5") ; 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)) > (define %racket-origin > @@ -232,6 +233,56 @@ (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" Should the 8.6 instead be %racket-version? I understand above it is currently 8.5 but why is it hardcoded? I'm a little late to the party. > + (if revision "-guix" "") > + (or revision ""))) I'd rather this be (if revision (string-append "-guix" revision) "") > + (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")))) I see a third instance of "8.6", lets factor this out either use %racket-version (I see we've decided on updating separately from racket, so that's out) or zuo-racket-version would also work, as a variable up with revision. > + (outputs '("out" "debug")) > + (build-system gnu-build-system) > + (arguments > + (list > + #:out-of-source? #t > + #:phases > + #~(modify-phases %standard-phases > + (add-after 'unpack 'chdir > + (lambda args > + (chdir "racket/src/zuo")))))) > + (home-page "https://github.com/racket/zuo") > + ;; ^ This is downstream of https://github.com/racket/racket, > + ;; but it's designed to be a friendly landing place > + (synopsis "Tiny Racket for build scripts") > + (description "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. > + > + > (define racket-vm-common-configure-flags > #~`(,@(cond > ((false-if-exception > -- > 2.32.0 > -- Efraim Flashner <efraim@flashner.co.il> אפרים פלשנר GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v3 07/14] gnu: Add Zuo. 2022-08-25 10:30 ` Efraim Flashner @ 2022-08-25 20:04 ` Philip McGrath 2022-08-26 12:01 ` Liliana Marie Prikler 0 siblings, 1 reply; 122+ messages in thread From: Philip McGrath @ 2022-08-25 20:04 UTC (permalink / raw) To: Efraim Flashner Cc: Thiago Jung Bauermann, (, Maxime Devos, Liliana Marie Prikler, Liliana Marie Prikler, 57050 On Thu, Aug 25, 2022, at 6:30 AM, Efraim Flashner wrote: > 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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v3 07/14] gnu: Add Zuo. 2022-08-25 20:04 ` Philip McGrath @ 2022-08-26 12:01 ` Liliana Marie Prikler 2022-08-27 18:08 ` Philip McGrath 0 siblings, 1 reply; 122+ messages in thread From: Liliana Marie Prikler @ 2022-08-26 12:01 UTC (permalink / raw) To: Philip McGrath, Efraim Flashner Cc: 57050, (, Maxime Devos, Thiago Jung Bauermann 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. > 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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v3 07/14] gnu: Add Zuo. 2022-08-26 12:01 ` Liliana Marie Prikler @ 2022-08-27 18:08 ` Philip McGrath 2022-08-27 18:58 ` Liliana Marie Prikler 0 siblings, 1 reply; 122+ messages in thread From: Philip McGrath @ 2022-08-27 18:08 UTC (permalink / raw) To: Liliana Marie Prikler, Efraim Flashner Cc: 57050, (, Maxime Devos, Thiago Jung Bauermann 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".) -Philip ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v3 07/14] gnu: Add Zuo. 2022-08-27 18:08 ` Philip McGrath @ 2022-08-27 18:58 ` Liliana Marie Prikler 2022-08-27 19:54 ` Philip McGrath 0 siblings, 1 reply; 122+ messages in thread From: Liliana Marie Prikler @ 2022-08-27 18:58 UTC (permalink / raw) To: Philip McGrath, Efraim Flashner Cc: 57050, (, Maxime Devos, Thiago Jung Bauermann 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 :) ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v3 07/14] gnu: Add Zuo. 2022-08-27 18:58 ` Liliana Marie Prikler @ 2022-08-27 19:54 ` Philip McGrath 2022-08-27 21:18 ` Liliana Marie Prikler 0 siblings, 1 reply; 122+ messages in thread From: Philip McGrath @ 2022-08-27 19:54 UTC (permalink / raw) To: Liliana Marie Prikler, Efraim Flashner Cc: 57050, (, Maxime Devos, Thiago Jung Bauermann On Sat, Aug 27, 2022, at 2:58 PM, Liliana Marie Prikler wrote: > 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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v3 07/14] gnu: Add Zuo. 2022-08-27 19:54 ` Philip McGrath @ 2022-08-27 21:18 ` Liliana Marie Prikler 2022-08-27 21:28 ` Philip McGrath 0 siblings, 1 reply; 122+ messages in thread From: Liliana Marie Prikler @ 2022-08-27 21:18 UTC (permalink / raw) To: Philip McGrath, Efraim Flashner Cc: 57050, (, Maxime Devos, Thiago Jung Bauermann 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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v3 07/14] gnu: Add Zuo. 2022-08-27 21:18 ` Liliana Marie Prikler @ 2022-08-27 21:28 ` Philip McGrath 2022-08-27 22:26 ` Liliana Marie Prikler 0 siblings, 1 reply; 122+ messages in thread From: Philip McGrath @ 2022-08-27 21:28 UTC (permalink / raw) To: Liliana Marie Prikler, Efraim Flashner Cc: 57050, (, Maxime Devos, Thiago Jung Bauermann 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. ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v3 07/14] gnu: Add Zuo. 2022-08-27 21:28 ` Philip McGrath @ 2022-08-27 22:26 ` Liliana Marie Prikler 0 siblings, 0 replies; 122+ messages in thread From: Liliana Marie Prikler @ 2022-08-27 22:26 UTC (permalink / raw) To: Philip McGrath, Efraim Flashner Cc: 57050, (, Maxime Devos, Thiago Jung Bauermann Am Samstag, dem 27.08.2022 um 17:28 -0400 schrieb Philip McGrath: > 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. ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v3 08/14] gnu: racket: Update to 8.6. 2022-08-25 8:54 ` [bug#57050] [PATCH v3 00/14] gnu: Update Racket to 8.6. " Philip McGrath ` (6 preceding siblings ...) 2022-08-25 8:54 ` [bug#57050] [PATCH v3 07/14] gnu: Add Zuo Philip McGrath @ 2022-08-25 8:54 ` Philip McGrath 2022-08-25 9:14 ` Liliana Marie Prikler 2022-08-25 10:39 ` Efraim Flashner 2022-08-25 8:54 ` [bug#57050] [PATCH v3 09/14] gnu: chez-scheme: Make bootfiles regular inputs Philip McGrath ` (6 subsequent siblings) 14 siblings, 2 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-25 8:54 UTC (permalink / raw) To: 57050 Cc: Philip McGrath, Thiago Jung Bauermann, (, Maxime Devos, Liliana Marie Prikler, Efraim Flashner, Liliana Marie Prikler 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 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 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.boot ", sep, buf); + } + fprintf(stderr, "required by %s\n", path); +@@ -1090,7 +1096,7 @@ extern void Sregister_boot_file_fd_region(const char *name, + int close_after) { + check_boot_file_state("Sregister_boot_file_fd"); + +- 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(); + } +@@ -1141,14 +1147,14 @@ extern void Sbuild_heap(const char *kernel, void (*custom_init)(void)) { + } + + name = path_last(kernel); +- if (strlen(name) >= PATH_MAX) { ++ if (strlen(name) >= BOOT_PATH_MAX) { + fprintf(stderr, "executable name too long: %s\n", name); + S_abnormal_exit(); + } + + #ifdef WIN32 + { /* strip off trailing .exe, if any */ +- static char buf[PATH_MAX]; ++ static char buf[BOOT_PATH_MAX]; + iptr n; + + n = strlen(name) - 4; +diff --git a/racket/src/ChezScheme/c/version.h b/racket/src/ChezScheme/c/version.h +index a79d12621b..61751a9fad 100644 +--- a/racket/src/ChezScheme/c/version.h ++++ b/racket/src/ChezScheme/c/version.h +@@ -80,7 +80,7 @@ FORCEINLINE void store_unaligned_uptr(uptr *addr, uptr val) { + /*****************************************/ + /* Operating systems */ + +-#if defined(__linux__) ++#if defined(__linux__) || defined(__GNU__) /* Hurd */ + #define NOBLOCK O_NONBLOCK + #define LOAD_SHARED_OBJECT + #define USE_MMAP +@@ -91,7 +91,10 @@ FORCEINLINE void store_unaligned_uptr(uptr *addr, uptr val) { + #define GETPAGESIZE() getpagesize() + typedef char *memcpy_t; + #define MAKE_NAN(x) { x = 0.0; x = x / x; } +-#define GETWD(x) getcwd((x),PATH_MAX) ++#ifndef __GNU__ /* Hurd: no PATH_MAX */ ++/* n.b. don't test PATH_MAX directly: we have not yet included <limits.h> */ ++# define GETWD(x) getcwd((x),PATH_MAX) ++#endif + typedef int tputsputcchar; + #ifndef __ANDROID__ + # define LOCKF +diff --git a/racket/src/ChezScheme/configure b/racket/src/ChezScheme/configure +index f64b639c3a..efdb6029cb 100755 +--- a/racket/src/ChezScheme/configure ++++ b/racket/src/ChezScheme/configure +@@ -102,6 +102,11 @@ case "${CONFIG_UNAME}" in + installprefix=/usr + installmansuffix=share/man + ;; ++ GNU) ++ unixsuffix=gnu # the Hurd ++ installprefix=/usr ++ installmansuffix=share/man ++ ;; + QNX) + if uname -a | egrep 'x86' > /dev/null 2>&1 ; then + m32=i3qnx +@@ -591,7 +596,7 @@ fi + + # Infer flags needed for threads: + case "${flagsm}" in +- *le|*fb|*ob|*nb) ++ *le|*gnu|*fb|*ob|*nb) + threadFlags="-D_REENTRANT -pthread" + threadLibs="-lpthread" + ;; +@@ -627,7 +632,7 @@ if [ "$cflagsset" = "no" ] ; then + a6*) + CFLAGS="-m64 ${optFlags}" + ;; +- i3le) ++ i3le) # intentionally not including i3gnu, which may not support sse2 + CFLAGS="-m32 -msse2 -mfpmath=sse ${optFlags}" + ;; + i3nt) +@@ -688,7 +693,7 @@ fi + # Add automatic linking flags, unless suppressed by --disable-auto-flags + if [ "$addflags" = "yes" ] ; then + case "${flagsm}" in +- *le) ++ *le|*gnu) + LDFLAGS="${LDFLAGS} -rdynamic" + ;; + *fb|*nb) +@@ -702,7 +707,7 @@ if [ "$addflags" = "yes" ] ; then + esac + + case "${flagsm}" in +- *le) ++ *le|*gnu) + LIBS="${LIBS} -lm -ldl ${ncursesLib} -lrt" + ;; + *fb|*ob) +@@ -749,7 +754,7 @@ exeSuffix= + + # compile flags for c/Mf-unix and mats/Mf-unix + case "${flagsmuni}" in +- *le) ++ *le|*gnu) + mdcflags="-fPIC -shared" + ;; + *fb|*ob) +@@ -781,7 +786,7 @@ case "${flagsmuni}" in + i3le) + mdldflags="-melf_i386" + ;; +- *le) ++ *le|*gnu) + ;; + i3nb) + mdldflags="-m elf_i386" +diff --git a/racket/src/ChezScheme/s/cmacros.ss b/racket/src/ChezScheme/s/cmacros.ss +index ff2b09217b..2e79a4d8de 100644 +--- a/racket/src/ChezScheme/s/cmacros.ss ++++ b/racket/src/ChezScheme/s/cmacros.ss +@@ -385,6 +385,7 @@ + i3fb ti3fb + i3ob ti3ob + i3osx ti3osx ++ i3gnu ti3gnu + a6le ta6le + a6osx ta6osx + a6ob ta6ob +diff --git a/racket/src/cs/c/configure b/racket/src/cs/c/configure +index 454d79e11a..dab545c0b4 100755 +--- a/racket/src/cs/c/configure ++++ b/racket/src/cs/c/configure +@@ -4449,8 +4449,15 @@ case "$host_os" in + ;; + irix*) + ;; +- linux*) +- MACH_OS=le ++ linux*|gnu*) ++ case "$host_os" in ++ *linux*) ++ MACH_OS=le ++ ;; ++ *) ++ MACH_OS=gnu # Hurd ++ ;; ++ esac + case "$host_os" in + *linux-android*) + ;; +@@ -4730,6 +4737,9 @@ if test "${build_os}_${build_cpu}" != "${host_os}_${host_cpu}" ; then + linux*) + BUILD_OS=le + ;; ++ gnu*) # Hurd: must come after linux* ++ BUILD_OS=gnu ++ ;; + *mingw*) + BUILD_OS=nt + ;; +diff --git a/racket/src/cs/c/configure.ac b/racket/src/cs/c/configure.ac +index 5bce979c92..43e7307b1b 100644 +--- a/racket/src/cs/c/configure.ac ++++ b/racket/src/cs/c/configure.ac +@@ -272,8 +272,15 @@ case "$host_os" in + ;; + irix*) + ;; +- linux*) +- MACH_OS=le ++ linux*|gnu*) ++ case "$host_os" in ++ linux*) ++ MACH_OS=le ++ ;; ++ *) ++ MACH_OS=gnu # Hurd ++ ;; ++ esac + case "$host_os" in + *linux-android*) + ;; +@@ -466,6 +473,9 @@ if test "${build_os}_${build_cpu}" != "${host_os}_${host_cpu}" ; then + linux*) + BUILD_OS=le + ;; ++ gnu*) # Hurd - must come after linux* ++ BUILD_OS=gnu ++ ;; + *mingw*) + BUILD_OS=nt + ;; +diff --git a/racket/src/cs/rumble/system.ss b/racket/src/cs/rumble/system.ss +index 2319cbe7a5..773eb79cf3 100644 +--- a/racket/src/cs/rumble/system.ss ++++ b/racket/src/cs/rumble/system.ss +@@ -48,6 +48,8 @@ + arm32le tarm32le arm64le tarm64le + ppc32le tppc32le) + 'linux] ++ [(i3gnu ti3gnu) ++ 'gnu-hurd] + [(a6fb ta6fb i3fb ti3fb + arm32fb tarm32fb arm64fb tarm64fb + ppc32fb tppc32fb) +@@ -85,6 +87,7 @@ + i3nb ti3nb + i3fb ti3fb + i3s2 ti3s2 ++ i3gnu ti3gnu + i3qnx) + 'i386] + [(arm32le tarm32le +-- +2.32.0 + + +From 8653294b771c741d320aba31e692b4f0ed0c702f Mon Sep 17 00:00:00 2001 +From: Philip McGrath <philip@philipmcgrath.com> +Date: Thu, 4 Aug 2022 20:18:09 -0400 +Subject: [PATCH 2/3] BC: Fix build on GNU/Hurd + +(cherry picked from commit 5c05496afd6159c2f9cd52e7f23389fdc6b55f43) +--- + racket/src/bc/configure | 2 +- + racket/src/bc/configure.ac | 2 +- + racket/src/bc/sconfig.h | 14 +++++++++----- + 3 files changed, 11 insertions(+), 7 deletions(-) + +diff --git a/racket/src/bc/configure b/racket/src/bc/configure +index 4ddb607b37..4ee346014d 100755 +--- a/racket/src/bc/configure ++++ b/racket/src/bc/configure +@@ -5018,7 +5018,7 @@ case "$host_os" in + X_PRE_LIBS="" + fi + ;; +- linux*) ++ linux*,gnu*) + LIBS="$LIBS -ldl -lm -lrt -rdynamic" + DYN_CFLAGS="-fPIC" + curses_portable_link="/usr/lib/${host_cpu}-${host_os}/libncurses.a /usr/lib/${host_cpu}-${host_os}/libtermcap.a" +diff --git a/racket/src/bc/configure.ac b/racket/src/bc/configure.ac +index deef8f3077..866851236e 100644 +--- a/racket/src/bc/configure.ac ++++ b/racket/src/bc/configure.ac +@@ -557,7 +557,7 @@ case "$host_os" in + X_PRE_LIBS="" + fi + ;; +- linux*) ++ linux*,gnu*) + LIBS="$LIBS -ldl -lm -lrt -rdynamic" + DYN_CFLAGS="-fPIC" + curses_portable_link="/usr/lib/${host_cpu}-${host_os}/libncurses.a /usr/lib/${host_cpu}-${host_os}/libtermcap.a" +diff --git a/racket/src/bc/sconfig.h b/racket/src/bc/sconfig.h +index 01ecb48158..8468942fcd 100644 +--- a/racket/src/bc/sconfig.h ++++ b/racket/src/bc/sconfig.h +@@ -79,12 +79,14 @@ + + #endif + +- /************** Linux with gcc ****************/ ++ /************** Linux (or Hurd) with gcc ****************/ + +-#if defined(__linux__) ++#if defined(__linux__) || defined(__GNU__) + + # ifdef __ANDROID__ + # define SCHEME_OS "android" ++# elif defined(__GNU__) ++# define SCHEME_OS "gnu-hurd" + # else + # define SCHEME_OS "linux" + # endif +@@ -146,13 +148,15 @@ + # define USE_IEEE_FP_PREDS + # define USE_EXPLICT_FP_FORM_CHECK + +-# define LINUX_FIND_STACK_BASE ++# define LINUX_FIND_STACK_BASE /* also ok for Hurd */ + + # define FLAGS_ALREADY_SET + + #if defined(__i386__) +-# define MZ_USE_JIT_I386 +-# define MZ_JIT_USE_MPROTECT ++# ifndef __GNU__ /* Hurd */ ++# define MZ_USE_JIT_I386 ++# define MZ_JIT_USE_MPROTECT ++# endif + # ifndef MZ_NO_UNWIND_SUPPORT + # define MZ_USE_DWARF_LIBUNWIND + # endif +-- +2.32.0 + + +From 1b0cd08557f58506c96f0ddd855bd9051a45a2f1 Mon Sep 17 00:00:00 2001 +From: Philip McGrath <philip@philipmcgrath.com> +Date: Sat, 6 Aug 2022 22:48:40 -0400 +Subject: [PATCH 3/3] BC: repair configure script + +Hopefully this will fix the DrDr failures caused by 5c05496. + +Related to https://github.com/racket/racket/pull/4384 + +(cherry picked from commit c3dd01055ed7589a18136904510fe4db557d6e77) +--- + racket/src/bc/configure | 2 +- + racket/src/bc/configure.ac | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/racket/src/bc/configure b/racket/src/bc/configure +index 4ee346014d..b1c5175b84 100755 +--- a/racket/src/bc/configure ++++ b/racket/src/bc/configure +@@ -5018,7 +5018,7 @@ case "$host_os" in + X_PRE_LIBS="" + fi + ;; +- linux*,gnu*) ++ linux*|gnu*) + LIBS="$LIBS -ldl -lm -lrt -rdynamic" + DYN_CFLAGS="-fPIC" + curses_portable_link="/usr/lib/${host_cpu}-${host_os}/libncurses.a /usr/lib/${host_cpu}-${host_os}/libtermcap.a" +diff --git a/racket/src/bc/configure.ac b/racket/src/bc/configure.ac +index 866851236e..ecc3b0b579 100644 +--- a/racket/src/bc/configure.ac ++++ b/racket/src/bc/configure.ac +@@ -557,7 +557,7 @@ case "$host_os" in + X_PRE_LIBS="" + fi + ;; +- linux*,gnu*) ++ linux*|gnu*) + LIBS="$LIBS -ldl -lm -lrt -rdynamic" + DYN_CFLAGS="-fPIC" + curses_portable_link="/usr/lib/${host_cpu}-${host_os}/libncurses.a /usr/lib/${host_cpu}-${host_os}/libtermcap.a" +-- +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 index 65cf2f99f3..331b4f244b 100644 --- a/gnu/packages/patches/racket-chez-scheme-bin-sh.patch +++ b/gnu/packages/patches/racket-chez-scheme-bin-sh.patch @@ -1,4 +1,4 @@ -From e982b6687494bf071386c67be74e57a29cf4ce00 Mon Sep 17 00:00:00 2001 +From f86370295c5bb14d4bb93d0ccfa37a2b79f19f25 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 @@ -24,12 +24,12 @@ on `system` from the C library. 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 +index 82bbf8d687..be8f603447 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> +@@ -27,6 +27,12 @@ + #include <sys/resource.h> + #endif +/* BEGIN PATCH for Guix */ +#ifndef WIN32 @@ -38,9 +38,9 @@ index f5e3e345be..922421ca75 100644 +/* 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; { + static INT s_errno(void); + static IBOOL s_addr_in_heap(uptr x); +@@ -861,6 +867,17 @@ static ptr s_process(char *s, IBOOL stderrp) { INT tofds[2], fromfds[2], errfds[2]; struct sigaction act, oint_act; @@ -58,10 +58,10 @@ index f5e3e345be..922421ca75 100644 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);} +@@ -897,7 +914,9 @@ static ptr s_process(char *s, IBOOL stderrp) { + } + } + #endif /* __GNU__ Hurd */ - execl("/bin/sh", "/bin/sh", "-c", s, NULL); + /* BEGIN PATCH for Guix */ + execl(guix_sh, guix_sh, "-c", s, NULL); @@ -70,7 +70,7 @@ index f5e3e345be..922421ca75 100644 /*NOTREACHED*/ } else { -base-commit: 9d228d16fb99c274c964e5bef93e97333888769f +base-commit: 87eee6e2adb8c6bc11e60619c706fa6295096085 -- 2.32.0 diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm index 6433897981..efabdd16f3 100644 --- a/gnu/packages/racket.scm +++ b/gnu/packages/racket.scm @@ -53,7 +53,7 @@ (define-module (gnu packages racket) #:use-module (gnu packages xorg) #:use-module ((guix licenses) #:prefix license:)) -;; Commentary: +;; COMMENTARY: ;; ;; Anatomy of Racket: ;; ------------------ @@ -72,14 +72,16 @@ (define-module (gnu packages racket) ;; ├── bc/ ;; ├── cs/ ;; ├── ChezScheme/ +;; ├── zuo/ ;; └── ... ;; ;; The 'racket/src/' directory contains the source of the runtime system, core ;; compiler, and primitives for the major Racket implementations: this layer -;; is called the ``Racket VM''. It is basically a normal autotools -;; project. (Even when Racket VM implementations use components implemented in -;; Racket, they are compiled in special modes to produce VM primitives.) -;; (There are or have been experimental Racket VM implementations elsewhere, +;; is called the ``Racket VM''. It is basically a normal Autoconf project, +;; except that the makefiles just run Zuo to do the real work. (Even when +;; Racket VM implementations use components implemented in Racket, they are +;; compiled in special modes to produce VM primitives.) (There are or have +;; been experimental Racket VM implementations elsewhere, ;; e.g. <https://github.com/pycket/pycket>.) ;; ;; The 'racket/collects/' directory contains ``built in'' Racket libraries @@ -100,10 +102,10 @@ (define-module (gnu packages racket) ;; ;; The top-level 'Makefile' is more like a directory of scripts: it has ;; convienience targets for developing Racket, and it cooperates with the -;; 'distro-build' package to assemble custom Racket distributions. It is not -;; part of Racket source distributions: the root of a source distribution is -;; basically 'racket/src' with some extra package sources and configuration -;; added. +;; 'distro-build' package to assemble custom Racket distributions. (Again, +;; the makefile just delegates to Zuo.) It is not part of Racket source +;; distributions: the root of a source distribution is basically 'racket/src' +;; with some extra package sources and configuration added. ;; ;; A ''minimal Racket'' installation includes two packages: 'base', which is a ;; sort of bridge between the current ``built-in'' collections and the package @@ -129,12 +131,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: ;; --------------------- @@ -177,16 +179,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: (define* (racket-vm-for-system #:optional (system (or (%current-target-system) @@ -199,7 +203,7 @@ (define* (racket-vm-for-system #:optional racket-vm-cs racket-vm-bc)) -(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)) @@ -210,10 +214,15 @@ (define %racket-origin (url "https://github.com/racket/racket") (commit %racket-commit))) (sha256 - (base32 "0f9zyhdvbh4xsndrqjzl85j5ziz0rmqi676g9s1lw3h3skq2636h")) + (base32 "1lw6h70dk8zqpl96zz0hmhn8vjcc0c7gw4prkfz2wid5bkq4mhg4")) (file-name (git-file-name "racket" %racket-version)) - (patches (search-patches "racket-chez-scheme-bin-sh.patch" - "racket-rktio-bin-sh.patch")) + (patches (search-patches "racket-backport-8.6-cross-install.patch" + "racket-backport-8.6-docindex-write.patch" + "racket-backport-8.6-hurd.patch" + "racket-backport-8.6-zuo.patch" + "racket-chez-scheme-bin-sh.patch" + "racket-rktio-bin-sh.patch" + "racket-zuo-bin-sh.patch")) (modules '((guix build utils))) (snippet #~(begin @@ -240,21 +249,10 @@ (define-public zuo (name "zuo") (version (string-append %zuo-version "-racket" - "8.6" + %racket-version (if revision "-guix" "") (or revision ""))) - (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")))) + (source %racket-origin) (outputs '("out" "debug")) (build-system gnu-build-system) (arguments @@ -316,7 +314,8 @@ (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 libtool)) ;; <- only for BC variants + (native-inputs (list zuo ;; <- for all variants + libtool)) ;; <- only for BC variants (outputs '("out" "debug")) (build-system gnu-build-system) (arguments @@ -324,6 +323,10 @@ (define-public racket-vm-cgc #:configure-flags #~(cons "--enable-cgcdefault" #$racket-vm-common-configure-flags) + #:make-flags + #~(list (string-append "ZUO=" + #+(this-package-native-input "zuo") + "/bin/zuo")) ;; Tests are in packages like racket-test-core and ;; main-distribution-test that aren't part of the main ;; distribution. @@ -683,25 +686,25 @@ (define-public racket "contract-profile" (base32 "1xm2z8g0dpv5d9h2sg680vx1a8ix9gbsdpxxb8qv1w7akp73paj3") '(("contract-profile" "."))) (simple-racket-origin - "data" (base32 "10iabgrk9alaggvksnyb0hdq7f1p30pq6pq2bcakvhzpxwiv1f55") + "data" (base32 "08sj4m0g0cp7gwb0nq90m770f0c21b7ydif7nljc8rxmcdprfisc") '("data" "data-doc" "data-enumerate-lib" "data-lib")) (simple-racket-origin "datalog" (base32 "0nf6cy4djpyhfvgpa6yn72apbz9s83gp0qg95pzjd0az4v6qwq1s") '(("datalog" "."))) (simple-racket-origin - "db" (base32 "1n02ja0yj3mjjhmz0yv04yfhyvrsznbljn8bjviyfxnm4xf9rcc5") + "db" (base32 "0jzsbfcdm3xj0g8xxw3ky2swrhiqqsq2aqa3r08m641dc981dmjq") '("db" "db-doc" "db-lib")) (simple-racket-origin - "deinprogramm" (base32 "0g8flr1qg3bcyhdinqhs4w7dyisaqyailbxrjgd2a7zlqmdyicfr") + "deinprogramm" (base32 "16ncs3ms3mmdavbk0mkhm2qi62vyyif9cch3sn1y64pij489x34v") '("deinprogramm" "deinprogramm-signature")) (simple-racket-origin "distributed-places" (base32 "1dajpkj9balqcpv6cdk9hwjz592h1vq8rrx5vncariiac4vbdpa0") '("distributed-places" "distributed-places-doc" "distributed-places-lib")) (simple-racket-origin - "draw" (base32 "1fpk85rs2crd63bxnmwj2pysisd62pxcqaip01si67dv1ri8ff92") + "draw" (base32 "00rq5y4ba6z1d6jh76kl8rwpxrlqqp81a875zyhk3k81i42635sm") '("draw" "draw-doc" "draw-lib")) (simple-racket-origin - "drracket" (base32 "0dipnz92c63zxys9z1kl5215rm7arc35g9r8bs8ivp96p75mljnz") + "drracket" (base32 "05d7wssi0ry13alb5hl3llpsg30dd0jhyfv5nb1nmg189fn42q62") '("drracket" "drracket-plugin-lib" "drracket-tool" @@ -718,7 +721,7 @@ (define-public racket "eopl" (base32 "1fmiixj6rxsgzwvgva8lvrvv0gl49v2405mp3s0i7ipis5c4n27s") '(("eopl" "."))) (simple-racket-origin - "errortrace" (base32 "14m7rhaxngj36070iw15am434hm438pfgmwjfsiqhsglz4pcxhip") + "errortrace" (base32 "0r5630bb2d6hk0fbi95fmyfja54nnwdfcj2zjba124pp6xkjyavx") '("errortrace" "errortrace-doc" "errortrace-lib")) (simple-racket-origin "expeditor" (base32 "0mjfwb4wzwsg5xj3k6cmik0va432n56rp5h7rxx1c2yy3prh1j7q") @@ -735,13 +738,13 @@ (define-public racket "games" (base32 "0kpn3izlx1ccd0pj0dnvmnrhny51b85xy418a7psj70lz8j8415d") '(("games" "."))) (simple-racket-origin - "gui" (base32 "0r3ck4gxdhnzr1a1fi0f1i7gwfip7akq10qgcxza66pp57hnl0wx") + "gui" (base32 "18pcnx3wi8f32i2frm8bn9pi08n4y3c5jgqs4gy21w6f84dv401w") '("gui" "gui-doc" "gui-lib" "tex-table")) (simple-racket-origin "gui-pkg-manager" (base32 "1ji9448d723nklqvycwdswj0ni28sabrncag14f9mx47did5myb5") '("gui-pkg-manager-lib")) (simple-racket-origin - "htdp" (base32 "19xqixrqbwdxph17w9jga19008j88harb5wgml4hpqj3x0apx9g3") + "htdp" (base32 "173xy6ks55npvwn6cykjs41s9qfb70hc2gfjiqvw91hdsbjykwir") '("htdp" "htdp-doc" "htdp-lib")) (simple-racket-origin "html" (base32 "18n1jnjgzfknc8nv8dppi85nb8q08gqdwkg6hfjk08x0p00anx2x") @@ -765,7 +768,7 @@ (define-public racket "make" (base32 "10852fj30bz5r46c3d99s37fkgy5yh44gb01j29sf3kxnhi0g2sa") '(("make" "."))) (simple-racket-origin - "math" (base32 "02sqbnvxvmvslk33b44fx4v93zafcvhva0cx8z21jqbl5wp217ac") + "math" (base32 "00ld38in5jfshs1q4zf07w84cyv4yjr40kmw30pyd5wqgs2zq9ai") '("math" "math-doc" "math-lib")) (simple-racket-origin "mysterx" (base32 "11p9jzrafw0hizhl0cs4sxx7rv281185q8hryic2rpk0kzjdyr48") @@ -800,16 +803,16 @@ (define-public racket (git-file-name "stamourv-optimization-coach" %racket-version))) '(("optimization-coach" "."))) (simple-racket-origin - "option-contract" (base32 "026b7n5l0c3024nymshz8zp1yhn493rdzgpflzfd52hj7awafqhk") + "option-contract" (base32 "07cncg9pi15cm19k7rzv54vx83wq7y42i2m6bgzaqja1h8vnj2ww") '("option-contract" "option-contract-doc" "option-contract-lib")) (simple-racket-origin - "parser-tools" (base32 "08pvz4zramirzm3j64hbhjm0mmh5zfy37iv4s3vmq0rj49cr8fl3") + "parser-tools" (base32 "04ycihliikh0c47ivp09gayxiql9d9wpl216czic19cj6f7rmcnj") '("parser-tools" "parser-tools-doc" "parser-tools-lib")) (simple-racket-origin "pconvert" (base32 "00czi0p399mmyrvxyrs5kniizpkqfxyz2ncxqi2jy79a7wk79pb1") '("pconvert-lib")) (simple-racket-origin - "pict" (base32 "0v7a3l77swsbh80mnb9rakdwgw7s66ji0mall7qcqfwyg1b4zmlv") + "pict" (base32 "1n0v7kynkiin1v8igs9m8k8vfwjn5cswanhq2imp1pxzjvdyq6sx") '("pict" "pict-doc" "pict-lib")) (simple-racket-origin "pict-snip" (base32 "081nwiy4a0n4f7xws16hqbhf0j3kz5alizndi3nnyr3chm4kng6x") @@ -863,7 +866,7 @@ (define-public racket "racklog" (base32 "0fbq0fpfb3l6h7h772dvkmlzlk2dnq5f8296xx1qxhhwypibqzr9") '(("racklog" "."))) (simple-racket-origin - "rackunit" (base32 "0vfwcddzrgrdv5awjka7m0jzqhqvfc5wlkih83a670y96496a83n") + "rackunit" (base32 "1gpz9sgnm8hrc0cb3rii0wzbcwp9mgy5k1amnxidy7gyzl7prn81") '("rackunit" "rackunit-doc" "rackunit-gui" @@ -876,10 +879,10 @@ (define-public racket "readline" (base32 "13kbcn2wchv82d709mw3r8n37bk8iwq0y4kpvm9dbzx0w2pxkfwn") '("readline" "readline-doc" "readline-lib")) (simple-racket-origin - "realm" (base32 "0hxcgla08iack54j8v40fj51811chpy66ym2zq76zb52c7kzn0hi") + "realm" (base32 "0rlvwyd6rpyl0zda4a5p8dp346fvqzc8555dgfnrhliymkxb6x4g") '(("realm" "."))) (simple-racket-origin - "redex" (base32 "18rn8ddsqh1s7hdlb2cb9wxln63bz0wysjssaf9v92r712xnnv8i") + "redex" (base32 "06dhyqmin0qdm6b6sdvgzpy3pa4svlw42ld9k2h1dxcr852czil7") '("redex" "redex-benchmark" "redex-doc" @@ -894,7 +897,7 @@ (define-public racket "scheme-lib" (base32 "0pcf0y8rp4qyjhaz5ww5sr5diq0wpcdfrrnask7zapyklzx1jx8x") '(("scheme-lib" "."))) (simple-racket-origin - "scribble" (base32 "0fbb7xgz95y90247hfc1a19v7ry8m6blvv4y8irdgzhjvik70zb3") + "scribble" (base32 "0a11kvcnzp04mp4xxq68rkl09jv00hv81k2nmwkmwpfx9b2acvd3") '("scribble" "scribble-doc" "scribble-html-lib" @@ -926,7 +929,7 @@ (define-public racket "snip" (base32 "01r9wc5xr3q3n4yyif6j0a37rgdzmpslxn05k13ksik73b3wj6hj") '("snip" "snip-lib")) (simple-racket-origin - "typed-racket" (base32 "0z6bagp6qiw0i3slhvq035y5hqgq664xw3bdlvdayad0bgbg0mdc") + "typed-racket" (base32 "03wsz647fi58brbg33fw1xavp100gzfvngdy8bk7bdc0jfg8a18l") '("source-syntax" "typed-racket" "typed-racket-compatibility" @@ -937,13 +940,13 @@ (define-public racket "srfi" (base32 "0aqbcdv2dfc2xnk0h6zfi56p7bpwqji8s88qds3d03hhh9k28gvn") '("srfi" "srfi-doc" "srfi-lib" "srfi-lite-lib")) (simple-racket-origin - "string-constants" (base32 "0b1ji31pv6bjb0a2bh9sqp5abvf91gn2rai8r4c4nkar1fzfwfac") + "string-constants" (base32 "1kg3vxq2hcd0vl76brgpzdwbrb65a4nrrkc6hj4az5lfbbdvqz47") '("string-constants" "string-constants-doc" "string-constants-lib")) (simple-racket-origin - "swindle" (base32 "164gdsphjzdl2vv7zxz7dfk9jwax8njpmim6sidm8qz8a8589y67") + "swindle" (base32 "03n9ymjhrw45h7hxkw4nq8nidnvs9mfzb4228s2cjfaqbgqxvsyb") '(("swindle" "."))) (simple-racket-origin - "syntax-color" (base32 "17lb2403ymz6sflw4vs3gsh2y7kgsf0gn8sncsxjhi16rpj3a9vm") + "syntax-color" (base32 "02dcd4yvdnw35m3srvfd43csxffxw3j4rk6zi379b8dsvbbrjyq1") '("syntax-color" "syntax-color-doc" "syntax-color-lib")) (simple-racket-origin "trace" (base32 "070ihla5j796hdarn5wxdwn4xj0xnkm50shgh49jy994mribvhia") @@ -952,7 +955,7 @@ (define-public racket "unix-socket" (base32 "02dfwas5ynbpyz74w9kwb4wgb37y5wys7svrlmir8k0n9ph9vq0y") '("unix-socket" "unix-socket-doc" "unix-socket-lib")) (simple-racket-origin - "web-server" (base32 "1g4x79ym3mgxv4f3z3z84j12355pf44pjlzlb7f0h6r0i7p0cbjd") + "web-server" (base32 "104lnzjykkd6f3gxpv7p14l94if6zac33nmb4sj5jxmd6r3fwcpf") '("web-server" "web-server-doc" "web-server-lib")) (simple-racket-origin "wxme" (base32 "1qp5gr9gqsakiq3alw6m4yyv5vw4i3hp4y4nhq8vl2nkjmirvn0b") -- 2.32.0 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v3 08/14] gnu: racket: Update to 8.6. 2022-08-25 8:54 ` [bug#57050] [PATCH v3 08/14] gnu: racket: Update to 8.6 Philip McGrath @ 2022-08-25 9:14 ` Liliana Marie Prikler 2022-08-25 10:39 ` Efraim Flashner 1 sibling, 0 replies; 122+ messages in thread From: Liliana Marie Prikler @ 2022-08-25 9:14 UTC (permalink / raw) To: Philip McGrath, 57050 Cc: (, Maxime Devos, Efraim Flashner, Thiago Jung Bauermann Am Donnerstag, dem 25.08.2022 um 04:54 -0400 schrieb Philip McGrath: > Also, update 'chez-scheme-for-racket' to 9.5.9.2. Reiterate my argument for splitting this in two along the "Also" line. ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v3 08/14] gnu: racket: Update to 8.6. 2022-08-25 8:54 ` [bug#57050] [PATCH v3 08/14] gnu: racket: Update to 8.6 Philip McGrath 2022-08-25 9:14 ` Liliana Marie Prikler @ 2022-08-25 10:39 ` Efraim Flashner 1 sibling, 0 replies; 122+ messages in thread From: Efraim Flashner @ 2022-08-25 10:39 UTC (permalink / raw) To: Philip McGrath Cc: Thiago Jung Bauermann, (, Maxime Devos, Liliana Marie Prikler, Liliana Marie Prikler, 57050 [-- Attachment #1: Type: text/plain, Size: 56749 bytes --] On Thu, Aug 25, 2022 at 04:54:10AM -0400, Philip McGrath wrote: > 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. I see this addresses my comments from the other patch about having 8.6 everywhere, so disregard those comments. > (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 > > 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)) I would've used (string-append #$name "-" #$version) but that works too. > + (doc-prefix (assoc-ref %outputs "doc")) This can be #$output:doc, but what you have is also ok. > + (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 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.boot ", sep, buf); > + } > + fprintf(stderr, "required by %s\n", path); > +@@ -1090,7 +1096,7 @@ extern void Sregister_boot_file_fd_region(const char *name, > + int close_after) { > + check_boot_file_state("Sregister_boot_file_fd"); > + > +- 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(); > + } > +@@ -1141,14 +1147,14 @@ extern void Sbuild_heap(const char *kernel, void (*custom_init)(void)) { > + } > + > + name = path_last(kernel); > +- if (strlen(name) >= PATH_MAX) { > ++ if (strlen(name) >= BOOT_PATH_MAX) { > + fprintf(stderr, "executable name too long: %s\n", name); > + S_abnormal_exit(); > + } > + > + #ifdef WIN32 > + { /* strip off trailing .exe, if any */ > +- static char buf[PATH_MAX]; > ++ static char buf[BOOT_PATH_MAX]; > + iptr n; > + > + n = strlen(name) - 4; > +diff --git a/racket/src/ChezScheme/c/version.h b/racket/src/ChezScheme/c/version.h > +index a79d12621b..61751a9fad 100644 > +--- a/racket/src/ChezScheme/c/version.h > ++++ b/racket/src/ChezScheme/c/version.h > +@@ -80,7 +80,7 @@ FORCEINLINE void store_unaligned_uptr(uptr *addr, uptr val) { > + /*****************************************/ > + /* Operating systems */ > + > +-#if defined(__linux__) > ++#if defined(__linux__) || defined(__GNU__) /* Hurd */ > + #define NOBLOCK O_NONBLOCK > + #define LOAD_SHARED_OBJECT > + #define USE_MMAP > +@@ -91,7 +91,10 @@ FORCEINLINE void store_unaligned_uptr(uptr *addr, uptr val) { > + #define GETPAGESIZE() getpagesize() > + typedef char *memcpy_t; > + #define MAKE_NAN(x) { x = 0.0; x = x / x; } > +-#define GETWD(x) getcwd((x),PATH_MAX) > ++#ifndef __GNU__ /* Hurd: no PATH_MAX */ > ++/* n.b. don't test PATH_MAX directly: we have not yet included <limits.h> */ > ++# define GETWD(x) getcwd((x),PATH_MAX) > ++#endif > + typedef int tputsputcchar; > + #ifndef __ANDROID__ > + # define LOCKF > +diff --git a/racket/src/ChezScheme/configure b/racket/src/ChezScheme/configure > +index f64b639c3a..efdb6029cb 100755 > +--- a/racket/src/ChezScheme/configure > ++++ b/racket/src/ChezScheme/configure > +@@ -102,6 +102,11 @@ case "${CONFIG_UNAME}" in > + installprefix=/usr > + installmansuffix=share/man > + ;; > ++ GNU) > ++ unixsuffix=gnu # the Hurd > ++ installprefix=/usr > ++ installmansuffix=share/man > ++ ;; > + QNX) > + if uname -a | egrep 'x86' > /dev/null 2>&1 ; then > + m32=i3qnx > +@@ -591,7 +596,7 @@ fi > + > + # Infer flags needed for threads: > + case "${flagsm}" in > +- *le|*fb|*ob|*nb) > ++ *le|*gnu|*fb|*ob|*nb) > + threadFlags="-D_REENTRANT -pthread" > + threadLibs="-lpthread" > + ;; > +@@ -627,7 +632,7 @@ if [ "$cflagsset" = "no" ] ; then > + a6*) > + CFLAGS="-m64 ${optFlags}" > + ;; > +- i3le) > ++ i3le) # intentionally not including i3gnu, which may not support sse2 > + CFLAGS="-m32 -msse2 -mfpmath=sse ${optFlags}" > + ;; > + i3nt) > +@@ -688,7 +693,7 @@ fi > + # Add automatic linking flags, unless suppressed by --disable-auto-flags > + if [ "$addflags" = "yes" ] ; then > + case "${flagsm}" in > +- *le) > ++ *le|*gnu) > + LDFLAGS="${LDFLAGS} -rdynamic" > + ;; > + *fb|*nb) > +@@ -702,7 +707,7 @@ if [ "$addflags" = "yes" ] ; then > + esac > + > + case "${flagsm}" in > +- *le) > ++ *le|*gnu) > + LIBS="${LIBS} -lm -ldl ${ncursesLib} -lrt" > + ;; > + *fb|*ob) > +@@ -749,7 +754,7 @@ exeSuffix= > + > + # compile flags for c/Mf-unix and mats/Mf-unix > + case "${flagsmuni}" in > +- *le) > ++ *le|*gnu) > + mdcflags="-fPIC -shared" > + ;; > + *fb|*ob) > +@@ -781,7 +786,7 @@ case "${flagsmuni}" in > + i3le) > + mdldflags="-melf_i386" > + ;; > +- *le) > ++ *le|*gnu) > + ;; > + i3nb) > + mdldflags="-m elf_i386" > +diff --git a/racket/src/ChezScheme/s/cmacros.ss b/racket/src/ChezScheme/s/cmacros.ss > +index ff2b09217b..2e79a4d8de 100644 > +--- a/racket/src/ChezScheme/s/cmacros.ss > ++++ b/racket/src/ChezScheme/s/cmacros.ss > +@@ -385,6 +385,7 @@ > + i3fb ti3fb > + i3ob ti3ob > + i3osx ti3osx > ++ i3gnu ti3gnu > + a6le ta6le > + a6osx ta6osx > + a6ob ta6ob > +diff --git a/racket/src/cs/c/configure b/racket/src/cs/c/configure > +index 454d79e11a..dab545c0b4 100755 > +--- a/racket/src/cs/c/configure > ++++ b/racket/src/cs/c/configure > +@@ -4449,8 +4449,15 @@ case "$host_os" in > + ;; > + irix*) > + ;; > +- linux*) > +- MACH_OS=le > ++ linux*|gnu*) > ++ case "$host_os" in > ++ *linux*) > ++ MACH_OS=le > ++ ;; > ++ *) > ++ MACH_OS=gnu # Hurd > ++ ;; > ++ esac > + case "$host_os" in > + *linux-android*) > + ;; > +@@ -4730,6 +4737,9 @@ if test "${build_os}_${build_cpu}" != "${host_os}_${host_cpu}" ; then > + linux*) > + BUILD_OS=le > + ;; > ++ gnu*) # Hurd: must come after linux* > ++ BUILD_OS=gnu > ++ ;; > + *mingw*) > + BUILD_OS=nt > + ;; > +diff --git a/racket/src/cs/c/configure.ac b/racket/src/cs/c/configure.ac > +index 5bce979c92..43e7307b1b 100644 > +--- a/racket/src/cs/c/configure.ac > ++++ b/racket/src/cs/c/configure.ac > +@@ -272,8 +272,15 @@ case "$host_os" in > + ;; > + irix*) > + ;; > +- linux*) > +- MACH_OS=le > ++ linux*|gnu*) > ++ case "$host_os" in > ++ linux*) > ++ MACH_OS=le > ++ ;; > ++ *) > ++ MACH_OS=gnu # Hurd > ++ ;; > ++ esac > + case "$host_os" in > + *linux-android*) > + ;; > +@@ -466,6 +473,9 @@ if test "${build_os}_${build_cpu}" != "${host_os}_${host_cpu}" ; then > + linux*) > + BUILD_OS=le > + ;; > ++ gnu*) # Hurd - must come after linux* > ++ BUILD_OS=gnu > ++ ;; > + *mingw*) > + BUILD_OS=nt > + ;; > +diff --git a/racket/src/cs/rumble/system.ss b/racket/src/cs/rumble/system.ss > +index 2319cbe7a5..773eb79cf3 100644 > +--- a/racket/src/cs/rumble/system.ss > ++++ b/racket/src/cs/rumble/system.ss > +@@ -48,6 +48,8 @@ > + arm32le tarm32le arm64le tarm64le > + ppc32le tppc32le) > + 'linux] > ++ [(i3gnu ti3gnu) > ++ 'gnu-hurd] > + [(a6fb ta6fb i3fb ti3fb > + arm32fb tarm32fb arm64fb tarm64fb > + ppc32fb tppc32fb) > +@@ -85,6 +87,7 @@ > + i3nb ti3nb > + i3fb ti3fb > + i3s2 ti3s2 > ++ i3gnu ti3gnu > + i3qnx) > + 'i386] > + [(arm32le tarm32le > +-- > +2.32.0 > + > + > +From 8653294b771c741d320aba31e692b4f0ed0c702f Mon Sep 17 00:00:00 2001 > +From: Philip McGrath <philip@philipmcgrath.com> > +Date: Thu, 4 Aug 2022 20:18:09 -0400 > +Subject: [PATCH 2/3] BC: Fix build on GNU/Hurd > + > +(cherry picked from commit 5c05496afd6159c2f9cd52e7f23389fdc6b55f43) > +--- > + racket/src/bc/configure | 2 +- > + racket/src/bc/configure.ac | 2 +- > + racket/src/bc/sconfig.h | 14 +++++++++----- > + 3 files changed, 11 insertions(+), 7 deletions(-) > + > +diff --git a/racket/src/bc/configure b/racket/src/bc/configure > +index 4ddb607b37..4ee346014d 100755 > +--- a/racket/src/bc/configure > ++++ b/racket/src/bc/configure > +@@ -5018,7 +5018,7 @@ case "$host_os" in > + X_PRE_LIBS="" > + fi > + ;; > +- linux*) > ++ linux*,gnu*) > + LIBS="$LIBS -ldl -lm -lrt -rdynamic" > + DYN_CFLAGS="-fPIC" > + curses_portable_link="/usr/lib/${host_cpu}-${host_os}/libncurses.a /usr/lib/${host_cpu}-${host_os}/libtermcap.a" > +diff --git a/racket/src/bc/configure.ac b/racket/src/bc/configure.ac > +index deef8f3077..866851236e 100644 > +--- a/racket/src/bc/configure.ac > ++++ b/racket/src/bc/configure.ac > +@@ -557,7 +557,7 @@ case "$host_os" in > + X_PRE_LIBS="" > + fi > + ;; > +- linux*) > ++ linux*,gnu*) > + LIBS="$LIBS -ldl -lm -lrt -rdynamic" > + DYN_CFLAGS="-fPIC" > + curses_portable_link="/usr/lib/${host_cpu}-${host_os}/libncurses.a /usr/lib/${host_cpu}-${host_os}/libtermcap.a" > +diff --git a/racket/src/bc/sconfig.h b/racket/src/bc/sconfig.h > +index 01ecb48158..8468942fcd 100644 > +--- a/racket/src/bc/sconfig.h > ++++ b/racket/src/bc/sconfig.h > +@@ -79,12 +79,14 @@ > + > + #endif > + > +- /************** Linux with gcc ****************/ > ++ /************** Linux (or Hurd) with gcc ****************/ > + > +-#if defined(__linux__) > ++#if defined(__linux__) || defined(__GNU__) > + > + # ifdef __ANDROID__ > + # define SCHEME_OS "android" > ++# elif defined(__GNU__) > ++# define SCHEME_OS "gnu-hurd" > + # else > + # define SCHEME_OS "linux" > + # endif > +@@ -146,13 +148,15 @@ > + # define USE_IEEE_FP_PREDS > + # define USE_EXPLICT_FP_FORM_CHECK > + > +-# define LINUX_FIND_STACK_BASE > ++# define LINUX_FIND_STACK_BASE /* also ok for Hurd */ > + > + # define FLAGS_ALREADY_SET > + > + #if defined(__i386__) > +-# define MZ_USE_JIT_I386 > +-# define MZ_JIT_USE_MPROTECT > ++# ifndef __GNU__ /* Hurd */ > ++# define MZ_USE_JIT_I386 > ++# define MZ_JIT_USE_MPROTECT > ++# endif > + # ifndef MZ_NO_UNWIND_SUPPORT > + # define MZ_USE_DWARF_LIBUNWIND > + # endif > +-- > +2.32.0 > + > + > +From 1b0cd08557f58506c96f0ddd855bd9051a45a2f1 Mon Sep 17 00:00:00 2001 > +From: Philip McGrath <philip@philipmcgrath.com> > +Date: Sat, 6 Aug 2022 22:48:40 -0400 > +Subject: [PATCH 3/3] BC: repair configure script > + > +Hopefully this will fix the DrDr failures caused by 5c05496. > + > +Related to https://github.com/racket/racket/pull/4384 > + > +(cherry picked from commit c3dd01055ed7589a18136904510fe4db557d6e77) > +--- > + racket/src/bc/configure | 2 +- > + racket/src/bc/configure.ac | 2 +- > + 2 files changed, 2 insertions(+), 2 deletions(-) > + > +diff --git a/racket/src/bc/configure b/racket/src/bc/configure > +index 4ee346014d..b1c5175b84 100755 > +--- a/racket/src/bc/configure > ++++ b/racket/src/bc/configure > +@@ -5018,7 +5018,7 @@ case "$host_os" in > + X_PRE_LIBS="" > + fi > + ;; > +- linux*,gnu*) > ++ linux*|gnu*) > + LIBS="$LIBS -ldl -lm -lrt -rdynamic" > + DYN_CFLAGS="-fPIC" > + curses_portable_link="/usr/lib/${host_cpu}-${host_os}/libncurses.a /usr/lib/${host_cpu}-${host_os}/libtermcap.a" > +diff --git a/racket/src/bc/configure.ac b/racket/src/bc/configure.ac > +index 866851236e..ecc3b0b579 100644 > +--- a/racket/src/bc/configure.ac > ++++ b/racket/src/bc/configure.ac > +@@ -557,7 +557,7 @@ case "$host_os" in > + X_PRE_LIBS="" > + fi > + ;; > +- linux*,gnu*) > ++ linux*|gnu*) > + LIBS="$LIBS -ldl -lm -lrt -rdynamic" > + DYN_CFLAGS="-fPIC" > + curses_portable_link="/usr/lib/${host_cpu}-${host_os}/libncurses.a /usr/lib/${host_cpu}-${host_os}/libtermcap.a" > +-- > +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 > index 65cf2f99f3..331b4f244b 100644 > --- a/gnu/packages/patches/racket-chez-scheme-bin-sh.patch > +++ b/gnu/packages/patches/racket-chez-scheme-bin-sh.patch > @@ -1,4 +1,4 @@ > -From e982b6687494bf071386c67be74e57a29cf4ce00 Mon Sep 17 00:00:00 2001 > +From f86370295c5bb14d4bb93d0ccfa37a2b79f19f25 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 > @@ -24,12 +24,12 @@ on `system` from the C library. > 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 > +index 82bbf8d687..be8f603447 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> > +@@ -27,6 +27,12 @@ > + #include <sys/resource.h> > + #endif > > +/* BEGIN PATCH for Guix */ > +#ifndef WIN32 > @@ -38,9 +38,9 @@ index f5e3e345be..922421ca75 100644 > +/* 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; { > + static INT s_errno(void); > + static IBOOL s_addr_in_heap(uptr x); > +@@ -861,6 +867,17 @@ static ptr s_process(char *s, IBOOL stderrp) { > > INT tofds[2], fromfds[2], errfds[2]; > struct sigaction act, oint_act; > @@ -58,10 +58,10 @@ index f5e3e345be..922421ca75 100644 > > 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);} > +@@ -897,7 +914,9 @@ static ptr s_process(char *s, IBOOL stderrp) { > + } > + } > + #endif /* __GNU__ Hurd */ > - execl("/bin/sh", "/bin/sh", "-c", s, NULL); > + /* BEGIN PATCH for Guix */ > + execl(guix_sh, guix_sh, "-c", s, NULL); > @@ -70,7 +70,7 @@ index f5e3e345be..922421ca75 100644 > /*NOTREACHED*/ > } else { > > -base-commit: 9d228d16fb99c274c964e5bef93e97333888769f > +base-commit: 87eee6e2adb8c6bc11e60619c706fa6295096085 > -- > 2.32.0 > > diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm > index 6433897981..efabdd16f3 100644 > --- a/gnu/packages/racket.scm > +++ b/gnu/packages/racket.scm > @@ -53,7 +53,7 @@ (define-module (gnu packages racket) > #:use-module (gnu packages xorg) > #:use-module ((guix licenses) #:prefix license:)) > > -;; Commentary: > +;; COMMENTARY: > ;; > ;; Anatomy of Racket: > ;; ------------------ > @@ -72,14 +72,16 @@ (define-module (gnu packages racket) > ;; ├── bc/ > ;; ├── cs/ > ;; ├── ChezScheme/ > +;; ├── zuo/ > ;; └── ... > ;; > ;; The 'racket/src/' directory contains the source of the runtime system, core > ;; compiler, and primitives for the major Racket implementations: this layer > -;; is called the ``Racket VM''. It is basically a normal autotools > -;; project. (Even when Racket VM implementations use components implemented in > -;; Racket, they are compiled in special modes to produce VM primitives.) > -;; (There are or have been experimental Racket VM implementations elsewhere, > +;; is called the ``Racket VM''. It is basically a normal Autoconf project, > +;; except that the makefiles just run Zuo to do the real work. (Even when > +;; Racket VM implementations use components implemented in Racket, they are > +;; compiled in special modes to produce VM primitives.) (There are or have > +;; been experimental Racket VM implementations elsewhere, > ;; e.g. <https://github.com/pycket/pycket>.) > ;; > ;; The 'racket/collects/' directory contains ``built in'' Racket libraries > @@ -100,10 +102,10 @@ (define-module (gnu packages racket) > ;; > ;; The top-level 'Makefile' is more like a directory of scripts: it has > ;; convienience targets for developing Racket, and it cooperates with the > -;; 'distro-build' package to assemble custom Racket distributions. It is not > -;; part of Racket source distributions: the root of a source distribution is > -;; basically 'racket/src' with some extra package sources and configuration > -;; added. > +;; 'distro-build' package to assemble custom Racket distributions. (Again, > +;; the makefile just delegates to Zuo.) It is not part of Racket source > +;; distributions: the root of a source distribution is basically 'racket/src' > +;; with some extra package sources and configuration added. > ;; > ;; A ''minimal Racket'' installation includes two packages: 'base', which is a > ;; sort of bridge between the current ``built-in'' collections and the package > @@ -129,12 +131,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: > ;; --------------------- > @@ -177,16 +179,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: > > (define* (racket-vm-for-system #:optional > (system (or (%current-target-system) > @@ -199,7 +203,7 @@ (define* (racket-vm-for-system #:optional > racket-vm-cs > racket-vm-bc)) > > -(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)) > @@ -210,10 +214,15 @@ (define %racket-origin > (url "https://github.com/racket/racket") > (commit %racket-commit))) > (sha256 > - (base32 "0f9zyhdvbh4xsndrqjzl85j5ziz0rmqi676g9s1lw3h3skq2636h")) > + (base32 "1lw6h70dk8zqpl96zz0hmhn8vjcc0c7gw4prkfz2wid5bkq4mhg4")) > (file-name (git-file-name "racket" %racket-version)) > - (patches (search-patches "racket-chez-scheme-bin-sh.patch" > - "racket-rktio-bin-sh.patch")) > + (patches (search-patches "racket-backport-8.6-cross-install.patch" > + "racket-backport-8.6-docindex-write.patch" > + "racket-backport-8.6-hurd.patch" > + "racket-backport-8.6-zuo.patch" > + "racket-chez-scheme-bin-sh.patch" > + "racket-rktio-bin-sh.patch" > + "racket-zuo-bin-sh.patch")) > (modules '((guix build utils))) > (snippet > #~(begin > @@ -240,21 +249,10 @@ (define-public zuo > (name "zuo") > (version (string-append %zuo-version > "-racket" > - "8.6" > + %racket-version > (if revision "-guix" "") > (or revision ""))) > - (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")))) > + (source %racket-origin) > (outputs '("out" "debug")) > (build-system gnu-build-system) > (arguments > @@ -316,7 +314,8 @@ (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 libtool)) ;; <- only for BC variants > + (native-inputs (list zuo ;; <- for all variants > + libtool)) ;; <- only for BC variants > (outputs '("out" "debug")) > (build-system gnu-build-system) > (arguments > @@ -324,6 +323,10 @@ (define-public racket-vm-cgc > #:configure-flags > #~(cons "--enable-cgcdefault" > #$racket-vm-common-configure-flags) > + #:make-flags > + #~(list (string-append "ZUO=" > + #+(this-package-native-input "zuo") > + "/bin/zuo")) > ;; Tests are in packages like racket-test-core and > ;; main-distribution-test that aren't part of the main > ;; distribution. > @@ -683,25 +686,25 @@ (define-public racket > "contract-profile" (base32 "1xm2z8g0dpv5d9h2sg680vx1a8ix9gbsdpxxb8qv1w7akp73paj3") > '(("contract-profile" "."))) > (simple-racket-origin > - "data" (base32 "10iabgrk9alaggvksnyb0hdq7f1p30pq6pq2bcakvhzpxwiv1f55") > + "data" (base32 "08sj4m0g0cp7gwb0nq90m770f0c21b7ydif7nljc8rxmcdprfisc") > '("data" "data-doc" "data-enumerate-lib" "data-lib")) > (simple-racket-origin > "datalog" (base32 "0nf6cy4djpyhfvgpa6yn72apbz9s83gp0qg95pzjd0az4v6qwq1s") > '(("datalog" "."))) > (simple-racket-origin > - "db" (base32 "1n02ja0yj3mjjhmz0yv04yfhyvrsznbljn8bjviyfxnm4xf9rcc5") > + "db" (base32 "0jzsbfcdm3xj0g8xxw3ky2swrhiqqsq2aqa3r08m641dc981dmjq") > '("db" "db-doc" "db-lib")) > (simple-racket-origin > - "deinprogramm" (base32 "0g8flr1qg3bcyhdinqhs4w7dyisaqyailbxrjgd2a7zlqmdyicfr") > + "deinprogramm" (base32 "16ncs3ms3mmdavbk0mkhm2qi62vyyif9cch3sn1y64pij489x34v") > '("deinprogramm" "deinprogramm-signature")) > (simple-racket-origin > "distributed-places" (base32 "1dajpkj9balqcpv6cdk9hwjz592h1vq8rrx5vncariiac4vbdpa0") > '("distributed-places" "distributed-places-doc" "distributed-places-lib")) > (simple-racket-origin > - "draw" (base32 "1fpk85rs2crd63bxnmwj2pysisd62pxcqaip01si67dv1ri8ff92") > + "draw" (base32 "00rq5y4ba6z1d6jh76kl8rwpxrlqqp81a875zyhk3k81i42635sm") > '("draw" "draw-doc" "draw-lib")) > (simple-racket-origin > - "drracket" (base32 "0dipnz92c63zxys9z1kl5215rm7arc35g9r8bs8ivp96p75mljnz") > + "drracket" (base32 "05d7wssi0ry13alb5hl3llpsg30dd0jhyfv5nb1nmg189fn42q62") > '("drracket" > "drracket-plugin-lib" > "drracket-tool" > @@ -718,7 +721,7 @@ (define-public racket > "eopl" (base32 "1fmiixj6rxsgzwvgva8lvrvv0gl49v2405mp3s0i7ipis5c4n27s") > '(("eopl" "."))) > (simple-racket-origin > - "errortrace" (base32 "14m7rhaxngj36070iw15am434hm438pfgmwjfsiqhsglz4pcxhip") > + "errortrace" (base32 "0r5630bb2d6hk0fbi95fmyfja54nnwdfcj2zjba124pp6xkjyavx") > '("errortrace" "errortrace-doc" "errortrace-lib")) > (simple-racket-origin > "expeditor" (base32 "0mjfwb4wzwsg5xj3k6cmik0va432n56rp5h7rxx1c2yy3prh1j7q") > @@ -735,13 +738,13 @@ (define-public racket > "games" (base32 "0kpn3izlx1ccd0pj0dnvmnrhny51b85xy418a7psj70lz8j8415d") > '(("games" "."))) > (simple-racket-origin > - "gui" (base32 "0r3ck4gxdhnzr1a1fi0f1i7gwfip7akq10qgcxza66pp57hnl0wx") > + "gui" (base32 "18pcnx3wi8f32i2frm8bn9pi08n4y3c5jgqs4gy21w6f84dv401w") > '("gui" "gui-doc" "gui-lib" "tex-table")) > (simple-racket-origin > "gui-pkg-manager" (base32 "1ji9448d723nklqvycwdswj0ni28sabrncag14f9mx47did5myb5") > '("gui-pkg-manager-lib")) > (simple-racket-origin > - "htdp" (base32 "19xqixrqbwdxph17w9jga19008j88harb5wgml4hpqj3x0apx9g3") > + "htdp" (base32 "173xy6ks55npvwn6cykjs41s9qfb70hc2gfjiqvw91hdsbjykwir") > '("htdp" "htdp-doc" "htdp-lib")) > (simple-racket-origin > "html" (base32 "18n1jnjgzfknc8nv8dppi85nb8q08gqdwkg6hfjk08x0p00anx2x") > @@ -765,7 +768,7 @@ (define-public racket > "make" (base32 "10852fj30bz5r46c3d99s37fkgy5yh44gb01j29sf3kxnhi0g2sa") > '(("make" "."))) > (simple-racket-origin > - "math" (base32 "02sqbnvxvmvslk33b44fx4v93zafcvhva0cx8z21jqbl5wp217ac") > + "math" (base32 "00ld38in5jfshs1q4zf07w84cyv4yjr40kmw30pyd5wqgs2zq9ai") > '("math" "math-doc" "math-lib")) > (simple-racket-origin > "mysterx" (base32 "11p9jzrafw0hizhl0cs4sxx7rv281185q8hryic2rpk0kzjdyr48") > @@ -800,16 +803,16 @@ (define-public racket > (git-file-name "stamourv-optimization-coach" %racket-version))) > '(("optimization-coach" "."))) > (simple-racket-origin > - "option-contract" (base32 "026b7n5l0c3024nymshz8zp1yhn493rdzgpflzfd52hj7awafqhk") > + "option-contract" (base32 "07cncg9pi15cm19k7rzv54vx83wq7y42i2m6bgzaqja1h8vnj2ww") > '("option-contract" "option-contract-doc" "option-contract-lib")) > (simple-racket-origin > - "parser-tools" (base32 "08pvz4zramirzm3j64hbhjm0mmh5zfy37iv4s3vmq0rj49cr8fl3") > + "parser-tools" (base32 "04ycihliikh0c47ivp09gayxiql9d9wpl216czic19cj6f7rmcnj") > '("parser-tools" "parser-tools-doc" "parser-tools-lib")) > (simple-racket-origin > "pconvert" (base32 "00czi0p399mmyrvxyrs5kniizpkqfxyz2ncxqi2jy79a7wk79pb1") > '("pconvert-lib")) > (simple-racket-origin > - "pict" (base32 "0v7a3l77swsbh80mnb9rakdwgw7s66ji0mall7qcqfwyg1b4zmlv") > + "pict" (base32 "1n0v7kynkiin1v8igs9m8k8vfwjn5cswanhq2imp1pxzjvdyq6sx") > '("pict" "pict-doc" "pict-lib")) > (simple-racket-origin > "pict-snip" (base32 "081nwiy4a0n4f7xws16hqbhf0j3kz5alizndi3nnyr3chm4kng6x") > @@ -863,7 +866,7 @@ (define-public racket > "racklog" (base32 "0fbq0fpfb3l6h7h772dvkmlzlk2dnq5f8296xx1qxhhwypibqzr9") > '(("racklog" "."))) > (simple-racket-origin > - "rackunit" (base32 "0vfwcddzrgrdv5awjka7m0jzqhqvfc5wlkih83a670y96496a83n") > + "rackunit" (base32 "1gpz9sgnm8hrc0cb3rii0wzbcwp9mgy5k1amnxidy7gyzl7prn81") > '("rackunit" > "rackunit-doc" > "rackunit-gui" > @@ -876,10 +879,10 @@ (define-public racket > "readline" (base32 "13kbcn2wchv82d709mw3r8n37bk8iwq0y4kpvm9dbzx0w2pxkfwn") > '("readline" "readline-doc" "readline-lib")) > (simple-racket-origin > - "realm" (base32 "0hxcgla08iack54j8v40fj51811chpy66ym2zq76zb52c7kzn0hi") > + "realm" (base32 "0rlvwyd6rpyl0zda4a5p8dp346fvqzc8555dgfnrhliymkxb6x4g") > '(("realm" "."))) > (simple-racket-origin > - "redex" (base32 "18rn8ddsqh1s7hdlb2cb9wxln63bz0wysjssaf9v92r712xnnv8i") > + "redex" (base32 "06dhyqmin0qdm6b6sdvgzpy3pa4svlw42ld9k2h1dxcr852czil7") > '("redex" > "redex-benchmark" > "redex-doc" > @@ -894,7 +897,7 @@ (define-public racket > "scheme-lib" (base32 "0pcf0y8rp4qyjhaz5ww5sr5diq0wpcdfrrnask7zapyklzx1jx8x") > '(("scheme-lib" "."))) > (simple-racket-origin > - "scribble" (base32 "0fbb7xgz95y90247hfc1a19v7ry8m6blvv4y8irdgzhjvik70zb3") > + "scribble" (base32 "0a11kvcnzp04mp4xxq68rkl09jv00hv81k2nmwkmwpfx9b2acvd3") > '("scribble" > "scribble-doc" > "scribble-html-lib" > @@ -926,7 +929,7 @@ (define-public racket > "snip" (base32 "01r9wc5xr3q3n4yyif6j0a37rgdzmpslxn05k13ksik73b3wj6hj") > '("snip" "snip-lib")) > (simple-racket-origin > - "typed-racket" (base32 "0z6bagp6qiw0i3slhvq035y5hqgq664xw3bdlvdayad0bgbg0mdc") > + "typed-racket" (base32 "03wsz647fi58brbg33fw1xavp100gzfvngdy8bk7bdc0jfg8a18l") > '("source-syntax" > "typed-racket" > "typed-racket-compatibility" > @@ -937,13 +940,13 @@ (define-public racket > "srfi" (base32 "0aqbcdv2dfc2xnk0h6zfi56p7bpwqji8s88qds3d03hhh9k28gvn") > '("srfi" "srfi-doc" "srfi-lib" "srfi-lite-lib")) > (simple-racket-origin > - "string-constants" (base32 "0b1ji31pv6bjb0a2bh9sqp5abvf91gn2rai8r4c4nkar1fzfwfac") > + "string-constants" (base32 "1kg3vxq2hcd0vl76brgpzdwbrb65a4nrrkc6hj4az5lfbbdvqz47") > '("string-constants" "string-constants-doc" "string-constants-lib")) > (simple-racket-origin > - "swindle" (base32 "164gdsphjzdl2vv7zxz7dfk9jwax8njpmim6sidm8qz8a8589y67") > + "swindle" (base32 "03n9ymjhrw45h7hxkw4nq8nidnvs9mfzb4228s2cjfaqbgqxvsyb") > '(("swindle" "."))) > (simple-racket-origin > - "syntax-color" (base32 "17lb2403ymz6sflw4vs3gsh2y7kgsf0gn8sncsxjhi16rpj3a9vm") > + "syntax-color" (base32 "02dcd4yvdnw35m3srvfd43csxffxw3j4rk6zi379b8dsvbbrjyq1") > '("syntax-color" "syntax-color-doc" "syntax-color-lib")) > (simple-racket-origin > "trace" (base32 "070ihla5j796hdarn5wxdwn4xj0xnkm50shgh49jy994mribvhia") > @@ -952,7 +955,7 @@ (define-public racket > "unix-socket" (base32 "02dfwas5ynbpyz74w9kwb4wgb37y5wys7svrlmir8k0n9ph9vq0y") > '("unix-socket" "unix-socket-doc" "unix-socket-lib")) > (simple-racket-origin > - "web-server" (base32 "1g4x79ym3mgxv4f3z3z84j12355pf44pjlzlb7f0h6r0i7p0cbjd") > + "web-server" (base32 "104lnzjykkd6f3gxpv7p14l94if6zac33nmb4sj5jxmd6r3fwcpf") > '("web-server" "web-server-doc" "web-server-lib")) > (simple-racket-origin > "wxme" (base32 "1qp5gr9gqsakiq3alw6m4yyv5vw4i3hp4y4nhq8vl2nkjmirvn0b") > -- > 2.32.0 > -- Efraim Flashner <efraim@flashner.co.il> אפרים פלשנר GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v3 09/14] gnu: chez-scheme: Make bootfiles regular inputs. 2022-08-25 8:54 ` [bug#57050] [PATCH v3 00/14] gnu: Update Racket to 8.6. " Philip McGrath ` (7 preceding siblings ...) 2022-08-25 8:54 ` [bug#57050] [PATCH v3 08/14] gnu: racket: Update to 8.6 Philip McGrath @ 2022-08-25 8:54 ` Philip McGrath 2022-08-25 8:54 ` [bug#57050] [PATCH v3 10/14] gnu: chez-scheme-for-racket: Support cross-compilation Philip McGrath ` (5 subsequent siblings) 14 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-25 8:54 UTC (permalink / raw) To: 57050 Cc: Philip McGrath, Thiago Jung Bauermann, (, Maxime Devos, Liliana Marie Prikler, Efraim Flashner, Liliana Marie Prikler * 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(-) 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v3 10/14] gnu: chez-scheme-for-racket: Support cross-compilation. 2022-08-25 8:54 ` [bug#57050] [PATCH v3 00/14] gnu: Update Racket to 8.6. " Philip McGrath ` (8 preceding siblings ...) 2022-08-25 8:54 ` [bug#57050] [PATCH v3 09/14] gnu: chez-scheme: Make bootfiles regular inputs Philip McGrath @ 2022-08-25 8:54 ` Philip McGrath 2022-08-25 8:54 ` [bug#57050] [PATCH v3 11/14] gnu: racket: Support cross-compiling the VM packages Philip McGrath ` (4 subsequent siblings) 14 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-25 8:54 UTC (permalink / raw) To: 57050 Cc: Philip McGrath, Thiago Jung Bauermann, (, Maxime Devos, Liliana Marie Prikler, Efraim Flashner, Liliana Marie Prikler * 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(-) 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v3 11/14] gnu: racket: Support cross-compiling the VM packages. 2022-08-25 8:54 ` [bug#57050] [PATCH v3 00/14] gnu: Update Racket to 8.6. " Philip McGrath ` (9 preceding siblings ...) 2022-08-25 8:54 ` [bug#57050] [PATCH v3 10/14] gnu: chez-scheme-for-racket: Support cross-compilation Philip McGrath @ 2022-08-25 8:54 ` Philip McGrath 2022-08-25 8:54 ` [bug#57050] [PATCH v3 12/14] gnu: chez-scheme-for-racket: Suport all systems Philip McGrath ` (3 subsequent siblings) 14 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-25 8:54 UTC (permalink / raw) To: 57050 Cc: Philip McGrath, Thiago Jung Bauermann, (, Maxime Devos, Liliana Marie Prikler, Efraim Flashner, Liliana Marie Prikler 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(-) 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v3 12/14] gnu: chez-scheme-for-racket: Suport all systems. 2022-08-25 8:54 ` [bug#57050] [PATCH v3 00/14] gnu: Update Racket to 8.6. " Philip McGrath ` (10 preceding siblings ...) 2022-08-25 8:54 ` [bug#57050] [PATCH v3 11/14] gnu: racket: Support cross-compiling the VM packages Philip McGrath @ 2022-08-25 8:54 ` Philip McGrath 2022-08-25 9:24 ` Liliana Marie Prikler 2022-08-25 8:54 ` [bug#57050] [PATCH v3 13/14] gnu: racket-vm-bc: Add workaround for ppc64le Philip McGrath ` (2 subsequent siblings) 14 siblings, 1 reply; 122+ messages in thread From: Philip McGrath @ 2022-08-25 8:54 UTC (permalink / raw) To: 57050 Cc: Philip McGrath, Thiago Jung Bauermann, (, Maxime Devos, Liliana Marie Prikler, Efraim Flashner, Liliana Marie Prikler 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"))) + (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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v3 12/14] gnu: chez-scheme-for-racket: Suport all systems. 2022-08-25 8:54 ` [bug#57050] [PATCH v3 12/14] gnu: chez-scheme-for-racket: Suport all systems Philip McGrath @ 2022-08-25 9:24 ` Liliana Marie Prikler 2022-08-25 10:50 ` Efraim Flashner 0 siblings, 1 reply; 122+ messages in thread From: Liliana Marie Prikler @ 2022-08-25 9:24 UTC (permalink / raw) To: Philip McGrath, 57050 Cc: Liliana Marie Prikler, (, Maxime Devos, Efraim Flashner, Thiago Jung Bauermann Should be "Support all systems". Am Donnerstag, dem 25.08.2022 um 04:54 -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'. > [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? > (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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v3 12/14] gnu: chez-scheme-for-racket: Suport all systems. 2022-08-25 9:24 ` Liliana Marie Prikler @ 2022-08-25 10:50 ` Efraim Flashner 2022-08-25 20:17 ` Philip McGrath 0 siblings, 1 reply; 122+ messages in thread From: Efraim Flashner @ 2022-08-25 10:50 UTC (permalink / raw) To: Liliana Marie Prikler Cc: Philip McGrath, Thiago Jung Bauermann, (, Maxime Devos, Liliana Marie Prikler, 57050 [-- Attachment #1: Type: text/plain, Size: 9243 bytes --] On Thu, Aug 25, 2022 at 11:24:31AM +0200, Liliana Marie Prikler wrote: > Should be "Support all systems". > > Am Donnerstag, dem 25.08.2022 um 04:54 -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'. > > [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? 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. > > (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)) 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")) -- Efraim Flashner <efraim@flashner.co.il> אפרים פלשנר GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v3 12/14] gnu: chez-scheme-for-racket: Suport all systems. 2022-08-25 10:50 ` Efraim Flashner @ 2022-08-25 20:17 ` Philip McGrath 0 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-25 20:17 UTC (permalink / raw) To: Efraim Flashner, Liliana Marie Prikler Cc: 57050, Liliana Marie Prikler, (, Maxime Devos, Thiago Jung Bauermann On Thu, Aug 25, 2022, at 6:50 AM, Efraim Flashner wrote: > On Thu, Aug 25, 2022 at 11:24:31AM +0200, Liliana Marie Prikler wrote: >> Should be "Support all systems". >> Thanks. >> 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. >> > @@ -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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v3 13/14] gnu: racket-vm-bc: Add workaround for ppc64le. 2022-08-25 8:54 ` [bug#57050] [PATCH v3 00/14] gnu: Update Racket to 8.6. " Philip McGrath ` (11 preceding siblings ...) 2022-08-25 8:54 ` [bug#57050] [PATCH v3 12/14] gnu: chez-scheme-for-racket: Suport all systems Philip McGrath @ 2022-08-25 8:54 ` Philip McGrath 2022-08-25 8:54 ` [bug#57050] [PATCH v3 14/14] gnu: racket: Use Racket CS on all systems Philip McGrath 2022-08-26 21:15 ` [bug#57050] [PATCH v3 00/14] gnu: Update Racket to 8.6. Add Zuo Thiago Jung Bauermann via Guix-patches via 14 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-25 8:54 UTC (permalink / raw) To: 57050 Cc: Philip McGrath, Thiago Jung Bauermann, (, Maxime Devos, Liliana Marie Prikler, Efraim Flashner, Liliana Marie Prikler 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 the workaround: <https://racket.discourse.group/t/950/30>. * 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(-) 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v3 14/14] gnu: racket: Use Racket CS on all systems. 2022-08-25 8:54 ` [bug#57050] [PATCH v3 00/14] gnu: Update Racket to 8.6. " Philip McGrath ` (12 preceding siblings ...) 2022-08-25 8:54 ` [bug#57050] [PATCH v3 13/14] gnu: racket-vm-bc: Add workaround for ppc64le Philip McGrath @ 2022-08-25 8:54 ` Philip McGrath 2022-08-25 9:17 ` Liliana Marie Prikler 2022-08-26 21:15 ` [bug#57050] [PATCH v3 00/14] gnu: Update Racket to 8.6. Add Zuo Thiago Jung Bauermann via Guix-patches via 14 siblings, 1 reply; 122+ messages in thread From: Philip McGrath @ 2022-08-25 8:54 UTC (permalink / raw) To: 57050 Cc: Philip McGrath, Thiago Jung Bauermann, (, Maxime Devos, Liliana Marie Prikler, Efraim Flashner, Liliana Marie Prikler 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(-) 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v3 14/14] gnu: racket: Use Racket CS on all systems. 2022-08-25 8:54 ` [bug#57050] [PATCH v3 14/14] gnu: racket: Use Racket CS on all systems Philip McGrath @ 2022-08-25 9:17 ` Liliana Marie Prikler 0 siblings, 0 replies; 122+ messages in thread From: Liliana Marie Prikler @ 2022-08-25 9:17 UTC (permalink / raw) To: Philip McGrath, 57050 Cc: (, Maxime Devos, Efraim Flashner, Thiago Jung Bauermann Am Donnerstag, dem 25.08.2022 um 04:54 -0400 schrieb Philip McGrath: > 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. ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v3 00/14] gnu: Update Racket to 8.6. Add Zuo. 2022-08-25 8:54 ` [bug#57050] [PATCH v3 00/14] gnu: Update Racket to 8.6. " Philip McGrath ` (13 preceding siblings ...) 2022-08-25 8:54 ` [bug#57050] [PATCH v3 14/14] gnu: racket: Use Racket CS on all systems Philip McGrath @ 2022-08-26 21:15 ` Thiago Jung Bauermann via Guix-patches via 14 siblings, 0 replies; 122+ messages in thread From: Thiago Jung Bauermann via Guix-patches via @ 2022-08-26 21:15 UTC (permalink / raw) To: Philip McGrath Cc: (, Maxime Devos, Liliana Marie Prikler, Efraim Flashner, Liliana Marie Prikler, 57050 Hello Philip, Philip McGrath <philip@philipmcgrath.com> writes: > 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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v4 00/14] gnu: Update Racket to 8.6. Add Zuo. 2022-08-24 0:27 ` Philip McGrath 2022-08-24 5:42 ` Liliana Marie Prikler 2022-08-25 8:54 ` [bug#57050] [PATCH v3 00/14] gnu: Update Racket to 8.6. " Philip McGrath @ 2022-08-27 18:55 ` Philip McGrath 2022-08-27 18:55 ` [bug#57050] [PATCH v4 01/14] gnu: stex: Update to 1.2.2-2.afa6075 Philip McGrath ` (14 more replies) 2 siblings, 15 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-27 18:55 UTC (permalink / raw) To: 57050 Cc: Philip McGrath, Thiago Jung Bauermann, (, Maxime Devos, Liliana Marie Prikler, Efraim Flashner, Liliana Marie Prikler 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 https://gitlab.com/philip1/guix-patches and tagged it as 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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v4 01/14] gnu: stex: Update to 1.2.2-2.afa6075. 2022-08-27 18:55 ` [bug#57050] [PATCH v4 " Philip McGrath @ 2022-08-27 18:55 ` Philip McGrath 2022-08-27 18:55 ` [bug#57050] [PATCH v4 02/14] gnu: stex: Fix read-only gifs and math directories Philip McGrath ` (13 subsequent siblings) 14 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-27 18:55 UTC (permalink / raw) To: 57050 Cc: Philip McGrath, Thiago Jung Bauermann, (, Maxime Devos, Liliana Marie Prikler, Efraim Flashner, Liliana Marie Prikler * 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(-) 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v4 02/14] gnu: stex: Fix read-only gifs and math directories. 2022-08-27 18:55 ` [bug#57050] [PATCH v4 " Philip McGrath 2022-08-27 18:55 ` [bug#57050] [PATCH v4 01/14] gnu: stex: Update to 1.2.2-2.afa6075 Philip McGrath @ 2022-08-27 18:55 ` Philip McGrath 2022-08-27 18:55 ` [bug#57050] [PATCH v4 03/14] etc: teams: Add racket team Philip McGrath ` (12 subsequent siblings) 14 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-27 18:55 UTC (permalink / raw) To: 57050 Cc: Philip McGrath, Thiago Jung Bauermann, (, Maxime Devos, Liliana Marie Prikler, Efraim Flashner, Liliana Marie Prikler 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 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v4 03/14] etc: teams: Add racket team. 2022-08-27 18:55 ` [bug#57050] [PATCH v4 " Philip McGrath 2022-08-27 18:55 ` [bug#57050] [PATCH v4 01/14] gnu: stex: Update to 1.2.2-2.afa6075 Philip McGrath 2022-08-27 18:55 ` [bug#57050] [PATCH v4 02/14] gnu: stex: Fix read-only gifs and math directories Philip McGrath @ 2022-08-27 18:55 ` Philip McGrath 2022-08-27 18:55 ` [bug#57050] [PATCH v4 04/14] etc: teams: Add entry for Philip McGrath Philip McGrath ` (11 subsequent siblings) 14 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-27 18:55 UTC (permalink / raw) To: 57050 Cc: Philip McGrath, Thiago Jung Bauermann, (, Maxime Devos, Liliana Marie Prikler, Efraim Flashner, Liliana Marie Prikler * etc/teams.scm.in (racket): New team. --- etc/teams.scm.in | 8 ++++++++ 1 file changed, 8 insertions(+) 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.")) + \f (define-member (person "Thiago Jung Bauermann" "bauermann@kolabnow.com") -- 2.32.0 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v4 04/14] etc: teams: Add entry for Philip McGrath. 2022-08-27 18:55 ` [bug#57050] [PATCH v4 " Philip McGrath ` (2 preceding siblings ...) 2022-08-27 18:55 ` [bug#57050] [PATCH v4 03/14] etc: teams: Add racket team Philip McGrath @ 2022-08-27 18:55 ` Philip McGrath 2022-08-27 18:55 ` [bug#57050] [PATCH v4 05/14] gnu: racket: Adjust patch for "/bin/sh" in rktio Philip McGrath ` (10 subsequent siblings) 14 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-27 18:55 UTC (permalink / raw) To: 57050 Cc: Philip McGrath, Thiago Jung Bauermann, (, Maxime Devos, Liliana Marie Prikler, Efraim Flashner, Liliana Marie Prikler * etc/teams.scm.in ("Philip McGrath"): New member. --- etc/teams.scm.in | 4 ++++ 1 file changed, 4 insertions(+) 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v4 05/14] gnu: racket: Adjust patch for "/bin/sh" in rktio. 2022-08-27 18:55 ` [bug#57050] [PATCH v4 " Philip McGrath ` (3 preceding siblings ...) 2022-08-27 18:55 ` [bug#57050] [PATCH v4 04/14] etc: teams: Add entry for Philip McGrath Philip McGrath @ 2022-08-27 18:55 ` Philip McGrath 2022-08-27 18:55 ` [bug#57050] [PATCH v4 06/14] gnu: chez-scheme: Fix use of "/bin/sh" Philip McGrath ` (9 subsequent siblings) 14 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-27 18:55 UTC (permalink / raw) To: 57050 Cc: Philip McGrath, Thiago Jung Bauermann, (, Maxime Devos, Liliana Marie Prikler, Efraim Flashner, Liliana Marie Prikler 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%) 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v4 06/14] gnu: chez-scheme: Fix use of "/bin/sh". 2022-08-27 18:55 ` [bug#57050] [PATCH v4 " Philip McGrath ` (4 preceding siblings ...) 2022-08-27 18:55 ` [bug#57050] [PATCH v4 05/14] gnu: racket: Adjust patch for "/bin/sh" in rktio Philip McGrath @ 2022-08-27 18:55 ` Philip McGrath 2022-08-27 18:55 ` [bug#57050] [PATCH v4 07/14] gnu: Add Zuo Philip McGrath ` (8 subsequent siblings) 14 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-27 18:55 UTC (permalink / raw) To: 57050 Cc: Philip McGrath, Thiago Jung Bauermann, (, Maxime Devos, Liliana Marie Prikler, Efraim Flashner, Liliana Marie Prikler 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 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v4 07/14] gnu: Add Zuo. 2022-08-27 18:55 ` [bug#57050] [PATCH v4 " Philip McGrath ` (5 preceding siblings ...) 2022-08-27 18:55 ` [bug#57050] [PATCH v4 06/14] gnu: chez-scheme: Fix use of "/bin/sh" Philip McGrath @ 2022-08-27 18:55 ` Philip McGrath 2022-08-27 18:55 ` [bug#57050] [PATCH v4 08/14] gnu: racket: Update to 8.6 Philip McGrath ` (7 subsequent siblings) 14 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-27 18:55 UTC (permalink / raw) To: 57050 Cc: Philip McGrath, Thiago Jung Bauermann, (, Maxime Devos, Liliana Marie Prikler, Efraim Flashner, Liliana Marie Prikler * 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 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, *opt; + zuo_t *dir, *l, *p_handle, *result; +@@ -5741,7 +5745,19 @@ zuo_t *zuo_process(zuo_t *command_and_args) + void *env; + int as_child, exact_cmdline; + +- check_path_string(who, command); ++ /* BEGIN PATCH for Guix */ ++ check_path_string(who, _guix_orig_command); ++#if defined(_PATH_BSHELL) ++ command = ++ ((z.o_false == zuo_string_eql(_guix_orig_command, zuo_string("/bin/sh"))) ++ || (z.o_false == zuo_stat(zuo_string(_PATH_BSHELL), z.o_false, z.o_true))) ++ ? _guix_orig_command ++ : zuo_string(_PATH_BSHELL); ++#else ++ command = _guix_orig_command; ++#endif ++ /* END PATCH for Guix */ ++ + for (l = args; l->tag == zuo_pair_tag; l = _zuo_cdr(l)) { + zuo_t *a = _zuo_car(l); + if (a == z.o_null) { + +base-commit: 87eee6e2adb8c6bc11e60619c706fa6295096085 +-- +2.32.0 + diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm index 0f766e7850..70df5482fb 100644 --- a/gnu/packages/racket.scm +++ b/gnu/packages/racket.scm @@ -200,6 +200,7 @@ (define* (racket-vm-for-system #:optional racket-vm-bc)) (define %racket-version "8.5") ; 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)) (define %racket-origin @@ -232,6 +233,54 @@ (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 ""))) + (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) + (arguments + (list + #:out-of-source? #t + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'chdir + (lambda args + (chdir "racket/src/zuo")))))) + (home-page "https://github.com/racket/zuo") + ;; ^ This is downstream of https://github.com/racket/racket, + ;; but it's designed to be a friendly landing place + (synopsis "Tiny Racket for build scripts") + (description "Zuo (作) is a tiny Racket with primitives for dealing +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.") + (license (list license:asl2.0 license:expat))))) + + (define racket-vm-common-configure-flags #~`(,@(cond ((false-if-exception -- 2.32.0 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v4 08/14] gnu: racket: Update to 8.6. 2022-08-27 18:55 ` [bug#57050] [PATCH v4 " Philip McGrath ` (6 preceding siblings ...) 2022-08-27 18:55 ` [bug#57050] [PATCH v4 07/14] gnu: Add Zuo Philip McGrath @ 2022-08-27 18:55 ` Philip McGrath 2022-08-27 19:21 ` Liliana Marie Prikler 2022-08-27 18:55 ` [bug#57050] [PATCH v4 09/14] gnu: chez-scheme: Make bootfiles regular inputs Philip McGrath ` (6 subsequent siblings) 14 siblings, 1 reply; 122+ messages in thread From: Philip McGrath @ 2022-08-27 18:55 UTC (permalink / raw) To: 57050 Cc: Philip McGrath, Thiago Jung Bauermann, (, Maxime Devos, Liliana Marie Prikler, Efraim Flashner, Liliana Marie Prikler 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 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 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.boot ", sep, buf); + } + fprintf(stderr, "required by %s\n", path); +@@ -1090,7 +1096,7 @@ extern void Sregister_boot_file_fd_region(const char *name, + int close_after) { + check_boot_file_state("Sregister_boot_file_fd"); + +- 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(); + } +@@ -1141,14 +1147,14 @@ extern void Sbuild_heap(const char *kernel, void (*custom_init)(void)) { + } + + name = path_last(kernel); +- if (strlen(name) >= PATH_MAX) { ++ if (strlen(name) >= BOOT_PATH_MAX) { + fprintf(stderr, "executable name too long: %s\n", name); + S_abnormal_exit(); + } + + #ifdef WIN32 + { /* strip off trailing .exe, if any */ +- static char buf[PATH_MAX]; ++ static char buf[BOOT_PATH_MAX]; + iptr n; + + n = strlen(name) - 4; +diff --git a/racket/src/ChezScheme/c/version.h b/racket/src/ChezScheme/c/version.h +index a79d12621b..61751a9fad 100644 +--- a/racket/src/ChezScheme/c/version.h ++++ b/racket/src/ChezScheme/c/version.h +@@ -80,7 +80,7 @@ FORCEINLINE void store_unaligned_uptr(uptr *addr, uptr val) { + /*****************************************/ + /* Operating systems */ + +-#if defined(__linux__) ++#if defined(__linux__) || defined(__GNU__) /* Hurd */ + #define NOBLOCK O_NONBLOCK + #define LOAD_SHARED_OBJECT + #define USE_MMAP +@@ -91,7 +91,10 @@ FORCEINLINE void store_unaligned_uptr(uptr *addr, uptr val) { + #define GETPAGESIZE() getpagesize() + typedef char *memcpy_t; + #define MAKE_NAN(x) { x = 0.0; x = x / x; } +-#define GETWD(x) getcwd((x),PATH_MAX) ++#ifndef __GNU__ /* Hurd: no PATH_MAX */ ++/* n.b. don't test PATH_MAX directly: we have not yet included <limits.h> */ ++# define GETWD(x) getcwd((x),PATH_MAX) ++#endif + typedef int tputsputcchar; + #ifndef __ANDROID__ + # define LOCKF +diff --git a/racket/src/ChezScheme/configure b/racket/src/ChezScheme/configure +index f64b639c3a..efdb6029cb 100755 +--- a/racket/src/ChezScheme/configure ++++ b/racket/src/ChezScheme/configure +@@ -102,6 +102,11 @@ case "${CONFIG_UNAME}" in + installprefix=/usr + installmansuffix=share/man + ;; ++ GNU) ++ unixsuffix=gnu # the Hurd ++ installprefix=/usr ++ installmansuffix=share/man ++ ;; + QNX) + if uname -a | egrep 'x86' > /dev/null 2>&1 ; then + m32=i3qnx +@@ -591,7 +596,7 @@ fi + + # Infer flags needed for threads: + case "${flagsm}" in +- *le|*fb|*ob|*nb) ++ *le|*gnu|*fb|*ob|*nb) + threadFlags="-D_REENTRANT -pthread" + threadLibs="-lpthread" + ;; +@@ -627,7 +632,7 @@ if [ "$cflagsset" = "no" ] ; then + a6*) + CFLAGS="-m64 ${optFlags}" + ;; +- i3le) ++ i3le) # intentionally not including i3gnu, which may not support sse2 + CFLAGS="-m32 -msse2 -mfpmath=sse ${optFlags}" + ;; + i3nt) +@@ -688,7 +693,7 @@ fi + # Add automatic linking flags, unless suppressed by --disable-auto-flags + if [ "$addflags" = "yes" ] ; then + case "${flagsm}" in +- *le) ++ *le|*gnu) + LDFLAGS="${LDFLAGS} -rdynamic" + ;; + *fb|*nb) +@@ -702,7 +707,7 @@ if [ "$addflags" = "yes" ] ; then + esac + + case "${flagsm}" in +- *le) ++ *le|*gnu) + LIBS="${LIBS} -lm -ldl ${ncursesLib} -lrt" + ;; + *fb|*ob) +@@ -749,7 +754,7 @@ exeSuffix= + + # compile flags for c/Mf-unix and mats/Mf-unix + case "${flagsmuni}" in +- *le) ++ *le|*gnu) + mdcflags="-fPIC -shared" + ;; + *fb|*ob) +@@ -781,7 +786,7 @@ case "${flagsmuni}" in + i3le) + mdldflags="-melf_i386" + ;; +- *le) ++ *le|*gnu) + ;; + i3nb) + mdldflags="-m elf_i386" +diff --git a/racket/src/ChezScheme/s/cmacros.ss b/racket/src/ChezScheme/s/cmacros.ss +index ff2b09217b..2e79a4d8de 100644 +--- a/racket/src/ChezScheme/s/cmacros.ss ++++ b/racket/src/ChezScheme/s/cmacros.ss +@@ -385,6 +385,7 @@ + i3fb ti3fb + i3ob ti3ob + i3osx ti3osx ++ i3gnu ti3gnu + a6le ta6le + a6osx ta6osx + a6ob ta6ob +diff --git a/racket/src/cs/c/configure b/racket/src/cs/c/configure +index 454d79e11a..dab545c0b4 100755 +--- a/racket/src/cs/c/configure ++++ b/racket/src/cs/c/configure +@@ -4449,8 +4449,15 @@ case "$host_os" in + ;; + irix*) + ;; +- linux*) +- MACH_OS=le ++ linux*|gnu*) ++ case "$host_os" in ++ *linux*) ++ MACH_OS=le ++ ;; ++ *) ++ MACH_OS=gnu # Hurd ++ ;; ++ esac + case "$host_os" in + *linux-android*) + ;; +@@ -4730,6 +4737,9 @@ if test "${build_os}_${build_cpu}" != "${host_os}_${host_cpu}" ; then + linux*) + BUILD_OS=le + ;; ++ gnu*) # Hurd: must come after linux* ++ BUILD_OS=gnu ++ ;; + *mingw*) + BUILD_OS=nt + ;; +diff --git a/racket/src/cs/c/configure.ac b/racket/src/cs/c/configure.ac +index 5bce979c92..43e7307b1b 100644 +--- a/racket/src/cs/c/configure.ac ++++ b/racket/src/cs/c/configure.ac +@@ -272,8 +272,15 @@ case "$host_os" in + ;; + irix*) + ;; +- linux*) +- MACH_OS=le ++ linux*|gnu*) ++ case "$host_os" in ++ linux*) ++ MACH_OS=le ++ ;; ++ *) ++ MACH_OS=gnu # Hurd ++ ;; ++ esac + case "$host_os" in + *linux-android*) + ;; +@@ -466,6 +473,9 @@ if test "${build_os}_${build_cpu}" != "${host_os}_${host_cpu}" ; then + linux*) + BUILD_OS=le + ;; ++ gnu*) # Hurd - must come after linux* ++ BUILD_OS=gnu ++ ;; + *mingw*) + BUILD_OS=nt + ;; +diff --git a/racket/src/cs/rumble/system.ss b/racket/src/cs/rumble/system.ss +index 2319cbe7a5..773eb79cf3 100644 +--- a/racket/src/cs/rumble/system.ss ++++ b/racket/src/cs/rumble/system.ss +@@ -48,6 +48,8 @@ + arm32le tarm32le arm64le tarm64le + ppc32le tppc32le) + 'linux] ++ [(i3gnu ti3gnu) ++ 'gnu-hurd] + [(a6fb ta6fb i3fb ti3fb + arm32fb tarm32fb arm64fb tarm64fb + ppc32fb tppc32fb) +@@ -85,6 +87,7 @@ + i3nb ti3nb + i3fb ti3fb + i3s2 ti3s2 ++ i3gnu ti3gnu + i3qnx) + 'i386] + [(arm32le tarm32le +-- +2.32.0 + + +From 8653294b771c741d320aba31e692b4f0ed0c702f Mon Sep 17 00:00:00 2001 +From: Philip McGrath <philip@philipmcgrath.com> +Date: Thu, 4 Aug 2022 20:18:09 -0400 +Subject: [PATCH 2/3] BC: Fix build on GNU/Hurd + +(cherry picked from commit 5c05496afd6159c2f9cd52e7f23389fdc6b55f43) +--- + racket/src/bc/configure | 2 +- + racket/src/bc/configure.ac | 2 +- + racket/src/bc/sconfig.h | 14 +++++++++----- + 3 files changed, 11 insertions(+), 7 deletions(-) + +diff --git a/racket/src/bc/configure b/racket/src/bc/configure +index 4ddb607b37..4ee346014d 100755 +--- a/racket/src/bc/configure ++++ b/racket/src/bc/configure +@@ -5018,7 +5018,7 @@ case "$host_os" in + X_PRE_LIBS="" + fi + ;; +- linux*) ++ linux*,gnu*) + LIBS="$LIBS -ldl -lm -lrt -rdynamic" + DYN_CFLAGS="-fPIC" + curses_portable_link="/usr/lib/${host_cpu}-${host_os}/libncurses.a /usr/lib/${host_cpu}-${host_os}/libtermcap.a" +diff --git a/racket/src/bc/configure.ac b/racket/src/bc/configure.ac +index deef8f3077..866851236e 100644 +--- a/racket/src/bc/configure.ac ++++ b/racket/src/bc/configure.ac +@@ -557,7 +557,7 @@ case "$host_os" in + X_PRE_LIBS="" + fi + ;; +- linux*) ++ linux*,gnu*) + LIBS="$LIBS -ldl -lm -lrt -rdynamic" + DYN_CFLAGS="-fPIC" + curses_portable_link="/usr/lib/${host_cpu}-${host_os}/libncurses.a /usr/lib/${host_cpu}-${host_os}/libtermcap.a" +diff --git a/racket/src/bc/sconfig.h b/racket/src/bc/sconfig.h +index 01ecb48158..8468942fcd 100644 +--- a/racket/src/bc/sconfig.h ++++ b/racket/src/bc/sconfig.h +@@ -79,12 +79,14 @@ + + #endif + +- /************** Linux with gcc ****************/ ++ /************** Linux (or Hurd) with gcc ****************/ + +-#if defined(__linux__) ++#if defined(__linux__) || defined(__GNU__) + + # ifdef __ANDROID__ + # define SCHEME_OS "android" ++# elif defined(__GNU__) ++# define SCHEME_OS "gnu-hurd" + # else + # define SCHEME_OS "linux" + # endif +@@ -146,13 +148,15 @@ + # define USE_IEEE_FP_PREDS + # define USE_EXPLICT_FP_FORM_CHECK + +-# define LINUX_FIND_STACK_BASE ++# define LINUX_FIND_STACK_BASE /* also ok for Hurd */ + + # define FLAGS_ALREADY_SET + + #if defined(__i386__) +-# define MZ_USE_JIT_I386 +-# define MZ_JIT_USE_MPROTECT ++# ifndef __GNU__ /* Hurd */ ++# define MZ_USE_JIT_I386 ++# define MZ_JIT_USE_MPROTECT ++# endif + # ifndef MZ_NO_UNWIND_SUPPORT + # define MZ_USE_DWARF_LIBUNWIND + # endif +-- +2.32.0 + + +From 1b0cd08557f58506c96f0ddd855bd9051a45a2f1 Mon Sep 17 00:00:00 2001 +From: Philip McGrath <philip@philipmcgrath.com> +Date: Sat, 6 Aug 2022 22:48:40 -0400 +Subject: [PATCH 3/3] BC: repair configure script + +Hopefully this will fix the DrDr failures caused by 5c05496. + +Related to https://github.com/racket/racket/pull/4384 + +(cherry picked from commit c3dd01055ed7589a18136904510fe4db557d6e77) +--- + racket/src/bc/configure | 2 +- + racket/src/bc/configure.ac | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/racket/src/bc/configure b/racket/src/bc/configure +index 4ee346014d..b1c5175b84 100755 +--- a/racket/src/bc/configure ++++ b/racket/src/bc/configure +@@ -5018,7 +5018,7 @@ case "$host_os" in + X_PRE_LIBS="" + fi + ;; +- linux*,gnu*) ++ linux*|gnu*) + LIBS="$LIBS -ldl -lm -lrt -rdynamic" + DYN_CFLAGS="-fPIC" + curses_portable_link="/usr/lib/${host_cpu}-${host_os}/libncurses.a /usr/lib/${host_cpu}-${host_os}/libtermcap.a" +diff --git a/racket/src/bc/configure.ac b/racket/src/bc/configure.ac +index 866851236e..ecc3b0b579 100644 +--- a/racket/src/bc/configure.ac ++++ b/racket/src/bc/configure.ac +@@ -557,7 +557,7 @@ case "$host_os" in + X_PRE_LIBS="" + fi + ;; +- linux*,gnu*) ++ linux*|gnu*) + LIBS="$LIBS -ldl -lm -lrt -rdynamic" + DYN_CFLAGS="-fPIC" + curses_portable_link="/usr/lib/${host_cpu}-${host_os}/libncurses.a /usr/lib/${host_cpu}-${host_os}/libtermcap.a" +-- +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 index 65cf2f99f3..331b4f244b 100644 --- a/gnu/packages/patches/racket-chez-scheme-bin-sh.patch +++ b/gnu/packages/patches/racket-chez-scheme-bin-sh.patch @@ -1,4 +1,4 @@ -From e982b6687494bf071386c67be74e57a29cf4ce00 Mon Sep 17 00:00:00 2001 +From f86370295c5bb14d4bb93d0ccfa37a2b79f19f25 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 @@ -24,12 +24,12 @@ on `system` from the C library. 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 +index 82bbf8d687..be8f603447 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> +@@ -27,6 +27,12 @@ + #include <sys/resource.h> + #endif +/* BEGIN PATCH for Guix */ +#ifndef WIN32 @@ -38,9 +38,9 @@ index f5e3e345be..922421ca75 100644 +/* 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; { + static INT s_errno(void); + static IBOOL s_addr_in_heap(uptr x); +@@ -861,6 +867,17 @@ static ptr s_process(char *s, IBOOL stderrp) { INT tofds[2], fromfds[2], errfds[2]; struct sigaction act, oint_act; @@ -58,10 +58,10 @@ index f5e3e345be..922421ca75 100644 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);} +@@ -897,7 +914,9 @@ static ptr s_process(char *s, IBOOL stderrp) { + } + } + #endif /* __GNU__ Hurd */ - execl("/bin/sh", "/bin/sh", "-c", s, NULL); + /* BEGIN PATCH for Guix */ + execl(guix_sh, guix_sh, "-c", s, NULL); @@ -70,7 +70,7 @@ index f5e3e345be..922421ca75 100644 /*NOTREACHED*/ } else { -base-commit: 9d228d16fb99c274c964e5bef93e97333888769f +base-commit: 87eee6e2adb8c6bc11e60619c706fa6295096085 -- 2.32.0 diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm index 70df5482fb..349cf38e07 100644 --- a/gnu/packages/racket.scm +++ b/gnu/packages/racket.scm @@ -53,7 +53,7 @@ (define-module (gnu packages racket) #:use-module (gnu packages xorg) #:use-module ((guix licenses) #:prefix license:)) -;; Commentary: +;; COMMENTARY: ;; ;; Anatomy of Racket: ;; ------------------ @@ -72,14 +72,16 @@ (define-module (gnu packages racket) ;; ├── bc/ ;; ├── cs/ ;; ├── ChezScheme/ +;; ├── zuo/ ;; └── ... ;; ;; The 'racket/src/' directory contains the source of the runtime system, core ;; compiler, and primitives for the major Racket implementations: this layer -;; is called the ``Racket VM''. It is basically a normal autotools -;; project. (Even when Racket VM implementations use components implemented in -;; Racket, they are compiled in special modes to produce VM primitives.) -;; (There are or have been experimental Racket VM implementations elsewhere, +;; is called the ``Racket VM''. It is basically a normal Autoconf project, +;; except that the makefiles just run Zuo to do the real work. (Even when +;; Racket VM implementations use components implemented in Racket, they are +;; compiled in special modes to produce VM primitives.) (There are or have +;; been experimental Racket VM implementations elsewhere, ;; e.g. <https://github.com/pycket/pycket>.) ;; ;; The 'racket/collects/' directory contains ``built in'' Racket libraries @@ -100,10 +102,10 @@ (define-module (gnu packages racket) ;; ;; The top-level 'Makefile' is more like a directory of scripts: it has ;; convienience targets for developing Racket, and it cooperates with the -;; 'distro-build' package to assemble custom Racket distributions. It is not -;; part of Racket source distributions: the root of a source distribution is -;; basically 'racket/src' with some extra package sources and configuration -;; added. +;; 'distro-build' package to assemble custom Racket distributions. (Again, +;; the makefile just delegates to Zuo.) It is not part of Racket source +;; distributions: the root of a source distribution is basically 'racket/src' +;; with some extra package sources and configuration added. ;; ;; A ''minimal Racket'' installation includes two packages: 'base', which is a ;; sort of bridge between the current ``built-in'' collections and the package @@ -129,12 +131,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: ;; --------------------- @@ -177,16 +179,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: (define* (racket-vm-for-system #:optional (system (or (%current-target-system) @@ -199,7 +203,7 @@ (define* (racket-vm-for-system #:optional racket-vm-cs racket-vm-bc)) -(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)) @@ -210,10 +214,15 @@ (define %racket-origin (url "https://github.com/racket/racket") (commit %racket-commit))) (sha256 - (base32 "0f9zyhdvbh4xsndrqjzl85j5ziz0rmqi676g9s1lw3h3skq2636h")) + (base32 "1lw6h70dk8zqpl96zz0hmhn8vjcc0c7gw4prkfz2wid5bkq4mhg4")) (file-name (git-file-name "racket" %racket-version)) - (patches (search-patches "racket-chez-scheme-bin-sh.patch" - "racket-rktio-bin-sh.patch")) + (patches (search-patches "racket-backport-8.6-cross-install.patch" + "racket-backport-8.6-docindex-write.patch" + "racket-backport-8.6-hurd.patch" + "racket-backport-8.6-zuo.patch" + "racket-chez-scheme-bin-sh.patch" + "racket-rktio-bin-sh.patch" + "racket-zuo-bin-sh.patch")) (modules '((guix build utils))) (snippet #~(begin @@ -240,21 +249,10 @@ (define-public zuo (name "zuo") (version (string-append %zuo-version "-racket" - "8.6" + %racket-version (if revision "-guix" "") (or revision ""))) - (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")))) + (source %racket-origin) (outputs '("out" "debug")) (build-system gnu-build-system) (arguments @@ -314,7 +312,8 @@ (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 libtool)) ;; <- only for BC variants + (native-inputs (list zuo ;; <- for all variants + libtool)) ;; <- only for BC variants (outputs '("out" "debug")) (build-system gnu-build-system) (arguments @@ -322,6 +321,10 @@ (define-public racket-vm-cgc #:configure-flags #~(cons "--enable-cgcdefault" #$racket-vm-common-configure-flags) + #:make-flags + #~(list (string-append "ZUO=" + #+(this-package-native-input "zuo") + "/bin/zuo")) ;; Tests are in packages like racket-test-core and ;; main-distribution-test that aren't part of the main ;; distribution. @@ -681,25 +684,25 @@ (define-public racket "contract-profile" (base32 "1xm2z8g0dpv5d9h2sg680vx1a8ix9gbsdpxxb8qv1w7akp73paj3") '(("contract-profile" "."))) (simple-racket-origin - "data" (base32 "10iabgrk9alaggvksnyb0hdq7f1p30pq6pq2bcakvhzpxwiv1f55") + "data" (base32 "08sj4m0g0cp7gwb0nq90m770f0c21b7ydif7nljc8rxmcdprfisc") '("data" "data-doc" "data-enumerate-lib" "data-lib")) (simple-racket-origin "datalog" (base32 "0nf6cy4djpyhfvgpa6yn72apbz9s83gp0qg95pzjd0az4v6qwq1s") '(("datalog" "."))) (simple-racket-origin - "db" (base32 "1n02ja0yj3mjjhmz0yv04yfhyvrsznbljn8bjviyfxnm4xf9rcc5") + "db" (base32 "0jzsbfcdm3xj0g8xxw3ky2swrhiqqsq2aqa3r08m641dc981dmjq") '("db" "db-doc" "db-lib")) (simple-racket-origin - "deinprogramm" (base32 "0g8flr1qg3bcyhdinqhs4w7dyisaqyailbxrjgd2a7zlqmdyicfr") + "deinprogramm" (base32 "16ncs3ms3mmdavbk0mkhm2qi62vyyif9cch3sn1y64pij489x34v") '("deinprogramm" "deinprogramm-signature")) (simple-racket-origin "distributed-places" (base32 "1dajpkj9balqcpv6cdk9hwjz592h1vq8rrx5vncariiac4vbdpa0") '("distributed-places" "distributed-places-doc" "distributed-places-lib")) (simple-racket-origin - "draw" (base32 "1fpk85rs2crd63bxnmwj2pysisd62pxcqaip01si67dv1ri8ff92") + "draw" (base32 "00rq5y4ba6z1d6jh76kl8rwpxrlqqp81a875zyhk3k81i42635sm") '("draw" "draw-doc" "draw-lib")) (simple-racket-origin - "drracket" (base32 "0dipnz92c63zxys9z1kl5215rm7arc35g9r8bs8ivp96p75mljnz") + "drracket" (base32 "05d7wssi0ry13alb5hl3llpsg30dd0jhyfv5nb1nmg189fn42q62") '("drracket" "drracket-plugin-lib" "drracket-tool" @@ -716,7 +719,7 @@ (define-public racket "eopl" (base32 "1fmiixj6rxsgzwvgva8lvrvv0gl49v2405mp3s0i7ipis5c4n27s") '(("eopl" "."))) (simple-racket-origin - "errortrace" (base32 "14m7rhaxngj36070iw15am434hm438pfgmwjfsiqhsglz4pcxhip") + "errortrace" (base32 "0r5630bb2d6hk0fbi95fmyfja54nnwdfcj2zjba124pp6xkjyavx") '("errortrace" "errortrace-doc" "errortrace-lib")) (simple-racket-origin "expeditor" (base32 "0mjfwb4wzwsg5xj3k6cmik0va432n56rp5h7rxx1c2yy3prh1j7q") @@ -733,13 +736,13 @@ (define-public racket "games" (base32 "0kpn3izlx1ccd0pj0dnvmnrhny51b85xy418a7psj70lz8j8415d") '(("games" "."))) (simple-racket-origin - "gui" (base32 "0r3ck4gxdhnzr1a1fi0f1i7gwfip7akq10qgcxza66pp57hnl0wx") + "gui" (base32 "18pcnx3wi8f32i2frm8bn9pi08n4y3c5jgqs4gy21w6f84dv401w") '("gui" "gui-doc" "gui-lib" "tex-table")) (simple-racket-origin "gui-pkg-manager" (base32 "1ji9448d723nklqvycwdswj0ni28sabrncag14f9mx47did5myb5") '("gui-pkg-manager-lib")) (simple-racket-origin - "htdp" (base32 "19xqixrqbwdxph17w9jga19008j88harb5wgml4hpqj3x0apx9g3") + "htdp" (base32 "173xy6ks55npvwn6cykjs41s9qfb70hc2gfjiqvw91hdsbjykwir") '("htdp" "htdp-doc" "htdp-lib")) (simple-racket-origin "html" (base32 "18n1jnjgzfknc8nv8dppi85nb8q08gqdwkg6hfjk08x0p00anx2x") @@ -763,7 +766,7 @@ (define-public racket "make" (base32 "10852fj30bz5r46c3d99s37fkgy5yh44gb01j29sf3kxnhi0g2sa") '(("make" "."))) (simple-racket-origin - "math" (base32 "02sqbnvxvmvslk33b44fx4v93zafcvhva0cx8z21jqbl5wp217ac") + "math" (base32 "00ld38in5jfshs1q4zf07w84cyv4yjr40kmw30pyd5wqgs2zq9ai") '("math" "math-doc" "math-lib")) (simple-racket-origin "mysterx" (base32 "11p9jzrafw0hizhl0cs4sxx7rv281185q8hryic2rpk0kzjdyr48") @@ -798,16 +801,16 @@ (define-public racket (git-file-name "stamourv-optimization-coach" %racket-version))) '(("optimization-coach" "."))) (simple-racket-origin - "option-contract" (base32 "026b7n5l0c3024nymshz8zp1yhn493rdzgpflzfd52hj7awafqhk") + "option-contract" (base32 "07cncg9pi15cm19k7rzv54vx83wq7y42i2m6bgzaqja1h8vnj2ww") '("option-contract" "option-contract-doc" "option-contract-lib")) (simple-racket-origin - "parser-tools" (base32 "08pvz4zramirzm3j64hbhjm0mmh5zfy37iv4s3vmq0rj49cr8fl3") + "parser-tools" (base32 "04ycihliikh0c47ivp09gayxiql9d9wpl216czic19cj6f7rmcnj") '("parser-tools" "parser-tools-doc" "parser-tools-lib")) (simple-racket-origin "pconvert" (base32 "00czi0p399mmyrvxyrs5kniizpkqfxyz2ncxqi2jy79a7wk79pb1") '("pconvert-lib")) (simple-racket-origin - "pict" (base32 "0v7a3l77swsbh80mnb9rakdwgw7s66ji0mall7qcqfwyg1b4zmlv") + "pict" (base32 "1n0v7kynkiin1v8igs9m8k8vfwjn5cswanhq2imp1pxzjvdyq6sx") '("pict" "pict-doc" "pict-lib")) (simple-racket-origin "pict-snip" (base32 "081nwiy4a0n4f7xws16hqbhf0j3kz5alizndi3nnyr3chm4kng6x") @@ -861,7 +864,7 @@ (define-public racket "racklog" (base32 "0fbq0fpfb3l6h7h772dvkmlzlk2dnq5f8296xx1qxhhwypibqzr9") '(("racklog" "."))) (simple-racket-origin - "rackunit" (base32 "0vfwcddzrgrdv5awjka7m0jzqhqvfc5wlkih83a670y96496a83n") + "rackunit" (base32 "1gpz9sgnm8hrc0cb3rii0wzbcwp9mgy5k1amnxidy7gyzl7prn81") '("rackunit" "rackunit-doc" "rackunit-gui" @@ -874,10 +877,10 @@ (define-public racket "readline" (base32 "13kbcn2wchv82d709mw3r8n37bk8iwq0y4kpvm9dbzx0w2pxkfwn") '("readline" "readline-doc" "readline-lib")) (simple-racket-origin - "realm" (base32 "0hxcgla08iack54j8v40fj51811chpy66ym2zq76zb52c7kzn0hi") + "realm" (base32 "0rlvwyd6rpyl0zda4a5p8dp346fvqzc8555dgfnrhliymkxb6x4g") '(("realm" "."))) (simple-racket-origin - "redex" (base32 "18rn8ddsqh1s7hdlb2cb9wxln63bz0wysjssaf9v92r712xnnv8i") + "redex" (base32 "06dhyqmin0qdm6b6sdvgzpy3pa4svlw42ld9k2h1dxcr852czil7") '("redex" "redex-benchmark" "redex-doc" @@ -892,7 +895,7 @@ (define-public racket "scheme-lib" (base32 "0pcf0y8rp4qyjhaz5ww5sr5diq0wpcdfrrnask7zapyklzx1jx8x") '(("scheme-lib" "."))) (simple-racket-origin - "scribble" (base32 "0fbb7xgz95y90247hfc1a19v7ry8m6blvv4y8irdgzhjvik70zb3") + "scribble" (base32 "0a11kvcnzp04mp4xxq68rkl09jv00hv81k2nmwkmwpfx9b2acvd3") '("scribble" "scribble-doc" "scribble-html-lib" @@ -924,7 +927,7 @@ (define-public racket "snip" (base32 "01r9wc5xr3q3n4yyif6j0a37rgdzmpslxn05k13ksik73b3wj6hj") '("snip" "snip-lib")) (simple-racket-origin - "typed-racket" (base32 "0z6bagp6qiw0i3slhvq035y5hqgq664xw3bdlvdayad0bgbg0mdc") + "typed-racket" (base32 "03wsz647fi58brbg33fw1xavp100gzfvngdy8bk7bdc0jfg8a18l") '("source-syntax" "typed-racket" "typed-racket-compatibility" @@ -935,13 +938,13 @@ (define-public racket "srfi" (base32 "0aqbcdv2dfc2xnk0h6zfi56p7bpwqji8s88qds3d03hhh9k28gvn") '("srfi" "srfi-doc" "srfi-lib" "srfi-lite-lib")) (simple-racket-origin - "string-constants" (base32 "0b1ji31pv6bjb0a2bh9sqp5abvf91gn2rai8r4c4nkar1fzfwfac") + "string-constants" (base32 "1kg3vxq2hcd0vl76brgpzdwbrb65a4nrrkc6hj4az5lfbbdvqz47") '("string-constants" "string-constants-doc" "string-constants-lib")) (simple-racket-origin - "swindle" (base32 "164gdsphjzdl2vv7zxz7dfk9jwax8njpmim6sidm8qz8a8589y67") + "swindle" (base32 "03n9ymjhrw45h7hxkw4nq8nidnvs9mfzb4228s2cjfaqbgqxvsyb") '(("swindle" "."))) (simple-racket-origin - "syntax-color" (base32 "17lb2403ymz6sflw4vs3gsh2y7kgsf0gn8sncsxjhi16rpj3a9vm") + "syntax-color" (base32 "02dcd4yvdnw35m3srvfd43csxffxw3j4rk6zi379b8dsvbbrjyq1") '("syntax-color" "syntax-color-doc" "syntax-color-lib")) (simple-racket-origin "trace" (base32 "070ihla5j796hdarn5wxdwn4xj0xnkm50shgh49jy994mribvhia") @@ -950,7 +953,7 @@ (define-public racket "unix-socket" (base32 "02dfwas5ynbpyz74w9kwb4wgb37y5wys7svrlmir8k0n9ph9vq0y") '("unix-socket" "unix-socket-doc" "unix-socket-lib")) (simple-racket-origin - "web-server" (base32 "1g4x79ym3mgxv4f3z3z84j12355pf44pjlzlb7f0h6r0i7p0cbjd") + "web-server" (base32 "104lnzjykkd6f3gxpv7p14l94if6zac33nmb4sj5jxmd6r3fwcpf") '("web-server" "web-server-doc" "web-server-lib")) (simple-racket-origin "wxme" (base32 "1qp5gr9gqsakiq3alw6m4yyv5vw4i3hp4y4nhq8vl2nkjmirvn0b") -- 2.32.0 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v4 08/14] gnu: racket: Update to 8.6. 2022-08-27 18:55 ` [bug#57050] [PATCH v4 08/14] gnu: racket: Update to 8.6 Philip McGrath @ 2022-08-27 19:21 ` Liliana Marie Prikler 2022-08-27 20:30 ` Philip McGrath 0 siblings, 1 reply; 122+ messages in thread From: Liliana Marie Prikler @ 2022-08-27 19:21 UTC (permalink / raw) To: Philip McGrath, 57050 Cc: (, Maxime Devos, Efraim Flashner, Thiago Jung Bauermann 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. ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v4 08/14] gnu: racket: Update to 8.6. 2022-08-27 19:21 ` Liliana Marie Prikler @ 2022-08-27 20:30 ` Philip McGrath 0 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-27 20:30 UTC (permalink / raw) To: Liliana Marie Prikler, 57050 Cc: (, Maxime Devos, Efraim Flashner, Thiago Jung Bauermann On Sat, Aug 27, 2022, at 3:21 PM, Liliana Marie Prikler wrote: > 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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v4 09/14] gnu: chez-scheme: Make bootfiles regular inputs. 2022-08-27 18:55 ` [bug#57050] [PATCH v4 " Philip McGrath ` (7 preceding siblings ...) 2022-08-27 18:55 ` [bug#57050] [PATCH v4 08/14] gnu: racket: Update to 8.6 Philip McGrath @ 2022-08-27 18:55 ` Philip McGrath 2022-08-27 18:55 ` [bug#57050] [PATCH v4 10/14] gnu: chez-scheme-for-racket: Support cross-compilation Philip McGrath ` (5 subsequent siblings) 14 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-27 18:55 UTC (permalink / raw) To: 57050 Cc: Philip McGrath, Thiago Jung Bauermann, (, Maxime Devos, Liliana Marie Prikler, Efraim Flashner, Liliana Marie Prikler * 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(-) 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v4 10/14] gnu: chez-scheme-for-racket: Support cross-compilation. 2022-08-27 18:55 ` [bug#57050] [PATCH v4 " Philip McGrath ` (8 preceding siblings ...) 2022-08-27 18:55 ` [bug#57050] [PATCH v4 09/14] gnu: chez-scheme: Make bootfiles regular inputs Philip McGrath @ 2022-08-27 18:55 ` Philip McGrath 2022-08-27 18:55 ` [bug#57050] [PATCH v4 11/14] gnu: racket: Support cross-compiling the VM packages Philip McGrath ` (4 subsequent siblings) 14 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-27 18:55 UTC (permalink / raw) To: 57050 Cc: Philip McGrath, Thiago Jung Bauermann, (, Maxime Devos, Liliana Marie Prikler, Efraim Flashner, Liliana Marie Prikler * 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(-) 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v4 11/14] gnu: racket: Support cross-compiling the VM packages. 2022-08-27 18:55 ` [bug#57050] [PATCH v4 " Philip McGrath ` (9 preceding siblings ...) 2022-08-27 18:55 ` [bug#57050] [PATCH v4 10/14] gnu: chez-scheme-for-racket: Support cross-compilation Philip McGrath @ 2022-08-27 18:55 ` Philip McGrath 2022-08-27 18:55 ` [bug#57050] [PATCH v4 12/14] gnu: chez-scheme-for-racket: Support all systems Philip McGrath ` (3 subsequent siblings) 14 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-27 18:55 UTC (permalink / raw) To: 57050 Cc: Philip McGrath, Thiago Jung Bauermann, (, Maxime Devos, Liliana Marie Prikler, Efraim Flashner, Liliana Marie Prikler 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(-) 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v4 12/14] gnu: chez-scheme-for-racket: Support all systems. 2022-08-27 18:55 ` [bug#57050] [PATCH v4 " Philip McGrath ` (10 preceding siblings ...) 2022-08-27 18:55 ` [bug#57050] [PATCH v4 11/14] gnu: racket: Support cross-compiling the VM packages Philip McGrath @ 2022-08-27 18:55 ` Philip McGrath 2022-08-27 18:55 ` [bug#57050] [PATCH v4 13/14] gnu: racket-vm-bc: Add workaround for ppc64le Philip McGrath ` (2 subsequent siblings) 14 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-27 18:55 UTC (permalink / raw) To: 57050 Cc: Philip McGrath, Thiago Jung Bauermann, (, Maxime Devos, Liliana Marie Prikler, Efraim Flashner, Liliana Marie Prikler 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"))) + (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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v4 13/14] gnu: racket-vm-bc: Add workaround for ppc64le. 2022-08-27 18:55 ` [bug#57050] [PATCH v4 " Philip McGrath ` (11 preceding siblings ...) 2022-08-27 18:55 ` [bug#57050] [PATCH v4 12/14] gnu: chez-scheme-for-racket: Support all systems Philip McGrath @ 2022-08-27 18:55 ` Philip McGrath 2022-08-27 18:55 ` [bug#57050] [PATCH v4 14/14] gnu: racket: Use Racket CS on all systems Philip McGrath 2022-09-04 20:53 ` bug#57050: [PATCH 0/6] gnu: Update Racket to 8.6. Add Zuo Ludovic Courtès 14 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-27 18:55 UTC (permalink / raw) To: 57050 Cc: Philip McGrath, Thiago Jung Bauermann, (, Maxime Devos, Liliana Marie Prikler, Efraim Flashner, Liliana Marie Prikler 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 the workaround: <https://racket.discourse.group/t/950/30>. * 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(-) 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v4 14/14] gnu: racket: Use Racket CS on all systems. 2022-08-27 18:55 ` [bug#57050] [PATCH v4 " Philip McGrath ` (12 preceding siblings ...) 2022-08-27 18:55 ` [bug#57050] [PATCH v4 13/14] gnu: racket-vm-bc: Add workaround for ppc64le Philip McGrath @ 2022-08-27 18:55 ` Philip McGrath 2022-09-04 20:53 ` bug#57050: [PATCH 0/6] gnu: Update Racket to 8.6. Add Zuo Ludovic Courtès 14 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-27 18:55 UTC (permalink / raw) To: 57050 Cc: Philip McGrath, Thiago Jung Bauermann, (, Maxime Devos, Liliana Marie Prikler, Efraim Flashner, Liliana Marie Prikler 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(-) 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* bug#57050: [PATCH 0/6] gnu: Update Racket to 8.6. Add Zuo. 2022-08-27 18:55 ` [bug#57050] [PATCH v4 " Philip McGrath ` (13 preceding siblings ...) 2022-08-27 18:55 ` [bug#57050] [PATCH v4 14/14] gnu: racket: Use Racket CS on all systems Philip McGrath @ 2022-09-04 20:53 ` Ludovic Courtès 14 siblings, 0 replies; 122+ messages in thread From: Ludovic Courtès @ 2022-09-04 20:53 UTC (permalink / raw) To: Philip McGrath Cc: 57050-done, Thiago Jung Bauermann, (, Maxime Devos, Liliana Marie Prikler, Efraim Flashner, Liliana Marie Prikler Hi Philip, Philip McGrath <philip@philipmcgrath.com> skribis: > 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’. ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 05/13] gnu: racket: Update to 8.6. 2022-08-11 11:08 ` [bug#57050] [PATCH v2 00/13] " Philip McGrath ` (3 preceding siblings ...) 2022-08-11 11:08 ` [bug#57050] [PATCH v2 04/13] gnu: Add Zuo Philip McGrath @ 2022-08-11 11:08 ` Philip McGrath 2022-08-11 11:44 ` Liliana Marie Prikler 2022-08-22 8:41 ` Efraim Flashner 2022-08-11 11:08 ` [bug#57050] [PATCH v2 06/13] gnu: chez-scheme: Bootfiles should not be native inputs Philip McGrath ` (10 subsequent siblings) 15 siblings, 2 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-11 11:08 UTC (permalink / raw) To: 57050 Cc: Liliana Marie Prikler, Liliana Marie Prikler, Philip McGrath, Thiago Jung Bauermann 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 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.boot ", sep, buf); + } + fprintf(stderr, "required by %s\n", path); +@@ -1090,7 +1096,7 @@ extern void Sregister_boot_file_fd_region(const char *name, + int close_after) { + check_boot_file_state("Sregister_boot_file_fd"); + +- 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(); + } +@@ -1141,14 +1147,14 @@ extern void Sbuild_heap(const char *kernel, void (*custom_init)(void)) { + } + + name = path_last(kernel); +- if (strlen(name) >= PATH_MAX) { ++ if (strlen(name) >= BOOT_PATH_MAX) { + fprintf(stderr, "executable name too long: %s\n", name); + S_abnormal_exit(); + } + + #ifdef WIN32 + { /* strip off trailing .exe, if any */ +- static char buf[PATH_MAX]; ++ static char buf[BOOT_PATH_MAX]; + iptr n; + + n = strlen(name) - 4; +diff --git a/racket/src/ChezScheme/c/version.h b/racket/src/ChezScheme/c/version.h +index a79d12621b..61751a9fad 100644 +--- a/racket/src/ChezScheme/c/version.h ++++ b/racket/src/ChezScheme/c/version.h +@@ -80,7 +80,7 @@ FORCEINLINE void store_unaligned_uptr(uptr *addr, uptr val) { + /*****************************************/ + /* Operating systems */ + +-#if defined(__linux__) ++#if defined(__linux__) || defined(__GNU__) /* Hurd */ + #define NOBLOCK O_NONBLOCK + #define LOAD_SHARED_OBJECT + #define USE_MMAP +@@ -91,7 +91,10 @@ FORCEINLINE void store_unaligned_uptr(uptr *addr, uptr val) { + #define GETPAGESIZE() getpagesize() + typedef char *memcpy_t; + #define MAKE_NAN(x) { x = 0.0; x = x / x; } +-#define GETWD(x) getcwd((x),PATH_MAX) ++#ifndef __GNU__ /* Hurd: no PATH_MAX */ ++/* n.b. don't test PATH_MAX directly: we have not yet included <limits.h> */ ++# define GETWD(x) getcwd((x),PATH_MAX) ++#endif + typedef int tputsputcchar; + #ifndef __ANDROID__ + # define LOCKF +diff --git a/racket/src/ChezScheme/configure b/racket/src/ChezScheme/configure +index f64b639c3a..efdb6029cb 100755 +--- a/racket/src/ChezScheme/configure ++++ b/racket/src/ChezScheme/configure +@@ -102,6 +102,11 @@ case "${CONFIG_UNAME}" in + installprefix=/usr + installmansuffix=share/man + ;; ++ GNU) ++ unixsuffix=gnu # the Hurd ++ installprefix=/usr ++ installmansuffix=share/man ++ ;; + QNX) + if uname -a | egrep 'x86' > /dev/null 2>&1 ; then + m32=i3qnx +@@ -591,7 +596,7 @@ fi + + # Infer flags needed for threads: + case "${flagsm}" in +- *le|*fb|*ob|*nb) ++ *le|*gnu|*fb|*ob|*nb) + threadFlags="-D_REENTRANT -pthread" + threadLibs="-lpthread" + ;; +@@ -627,7 +632,7 @@ if [ "$cflagsset" = "no" ] ; then + a6*) + CFLAGS="-m64 ${optFlags}" + ;; +- i3le) ++ i3le) # intentionally not including i3gnu, which may not support sse2 + CFLAGS="-m32 -msse2 -mfpmath=sse ${optFlags}" + ;; + i3nt) +@@ -688,7 +693,7 @@ fi + # Add automatic linking flags, unless suppressed by --disable-auto-flags + if [ "$addflags" = "yes" ] ; then + case "${flagsm}" in +- *le) ++ *le|*gnu) + LDFLAGS="${LDFLAGS} -rdynamic" + ;; + *fb|*nb) +@@ -702,7 +707,7 @@ if [ "$addflags" = "yes" ] ; then + esac + + case "${flagsm}" in +- *le) ++ *le|*gnu) + LIBS="${LIBS} -lm -ldl ${ncursesLib} -lrt" + ;; + *fb|*ob) +@@ -749,7 +754,7 @@ exeSuffix= + + # compile flags for c/Mf-unix and mats/Mf-unix + case "${flagsmuni}" in +- *le) ++ *le|*gnu) + mdcflags="-fPIC -shared" + ;; + *fb|*ob) +@@ -781,7 +786,7 @@ case "${flagsmuni}" in + i3le) + mdldflags="-melf_i386" + ;; +- *le) ++ *le|*gnu) + ;; + i3nb) + mdldflags="-m elf_i386" +diff --git a/racket/src/ChezScheme/s/cmacros.ss b/racket/src/ChezScheme/s/cmacros.ss +index ff2b09217b..2e79a4d8de 100644 +--- a/racket/src/ChezScheme/s/cmacros.ss ++++ b/racket/src/ChezScheme/s/cmacros.ss +@@ -385,6 +385,7 @@ + i3fb ti3fb + i3ob ti3ob + i3osx ti3osx ++ i3gnu ti3gnu + a6le ta6le + a6osx ta6osx + a6ob ta6ob +diff --git a/racket/src/cs/c/configure b/racket/src/cs/c/configure +index 454d79e11a..dab545c0b4 100755 +--- a/racket/src/cs/c/configure ++++ b/racket/src/cs/c/configure +@@ -4449,8 +4449,15 @@ case "$host_os" in + ;; + irix*) + ;; +- linux*) +- MACH_OS=le ++ linux*|gnu*) ++ case "$host_os" in ++ *linux*) ++ MACH_OS=le ++ ;; ++ *) ++ MACH_OS=gnu # Hurd ++ ;; ++ esac + case "$host_os" in + *linux-android*) + ;; +@@ -4730,6 +4737,9 @@ if test "${build_os}_${build_cpu}" != "${host_os}_${host_cpu}" ; then + linux*) + BUILD_OS=le + ;; ++ gnu*) # Hurd: must come after linux* ++ BUILD_OS=gnu ++ ;; + *mingw*) + BUILD_OS=nt + ;; +diff --git a/racket/src/cs/c/configure.ac b/racket/src/cs/c/configure.ac +index 5bce979c92..43e7307b1b 100644 +--- a/racket/src/cs/c/configure.ac ++++ b/racket/src/cs/c/configure.ac +@@ -272,8 +272,15 @@ case "$host_os" in + ;; + irix*) + ;; +- linux*) +- MACH_OS=le ++ linux*|gnu*) ++ case "$host_os" in ++ linux*) ++ MACH_OS=le ++ ;; ++ *) ++ MACH_OS=gnu # Hurd ++ ;; ++ esac + case "$host_os" in + *linux-android*) + ;; +@@ -466,6 +473,9 @@ if test "${build_os}_${build_cpu}" != "${host_os}_${host_cpu}" ; then + linux*) + BUILD_OS=le + ;; ++ gnu*) # Hurd - must come after linux* ++ BUILD_OS=gnu ++ ;; + *mingw*) + BUILD_OS=nt + ;; +diff --git a/racket/src/cs/rumble/system.ss b/racket/src/cs/rumble/system.ss +index 2319cbe7a5..773eb79cf3 100644 +--- a/racket/src/cs/rumble/system.ss ++++ b/racket/src/cs/rumble/system.ss +@@ -48,6 +48,8 @@ + arm32le tarm32le arm64le tarm64le + ppc32le tppc32le) + 'linux] ++ [(i3gnu ti3gnu) ++ 'gnu-hurd] + [(a6fb ta6fb i3fb ti3fb + arm32fb tarm32fb arm64fb tarm64fb + ppc32fb tppc32fb) +@@ -85,6 +87,7 @@ + i3nb ti3nb + i3fb ti3fb + i3s2 ti3s2 ++ i3gnu ti3gnu + i3qnx) + 'i386] + [(arm32le tarm32le +-- +2.32.0 + + +From 8653294b771c741d320aba31e692b4f0ed0c702f Mon Sep 17 00:00:00 2001 +From: Philip McGrath <philip@philipmcgrath.com> +Date: Thu, 4 Aug 2022 20:18:09 -0400 +Subject: [PATCH 2/3] BC: Fix build on GNU/Hurd + +(cherry picked from commit 5c05496afd6159c2f9cd52e7f23389fdc6b55f43) +--- + racket/src/bc/configure | 2 +- + racket/src/bc/configure.ac | 2 +- + racket/src/bc/sconfig.h | 14 +++++++++----- + 3 files changed, 11 insertions(+), 7 deletions(-) + +diff --git a/racket/src/bc/configure b/racket/src/bc/configure +index 4ddb607b37..4ee346014d 100755 +--- a/racket/src/bc/configure ++++ b/racket/src/bc/configure +@@ -5018,7 +5018,7 @@ case "$host_os" in + X_PRE_LIBS="" + fi + ;; +- linux*) ++ linux*,gnu*) + LIBS="$LIBS -ldl -lm -lrt -rdynamic" + DYN_CFLAGS="-fPIC" + curses_portable_link="/usr/lib/${host_cpu}-${host_os}/libncurses.a /usr/lib/${host_cpu}-${host_os}/libtermcap.a" +diff --git a/racket/src/bc/configure.ac b/racket/src/bc/configure.ac +index deef8f3077..866851236e 100644 +--- a/racket/src/bc/configure.ac ++++ b/racket/src/bc/configure.ac +@@ -557,7 +557,7 @@ case "$host_os" in + X_PRE_LIBS="" + fi + ;; +- linux*) ++ linux*,gnu*) + LIBS="$LIBS -ldl -lm -lrt -rdynamic" + DYN_CFLAGS="-fPIC" + curses_portable_link="/usr/lib/${host_cpu}-${host_os}/libncurses.a /usr/lib/${host_cpu}-${host_os}/libtermcap.a" +diff --git a/racket/src/bc/sconfig.h b/racket/src/bc/sconfig.h +index 01ecb48158..8468942fcd 100644 +--- a/racket/src/bc/sconfig.h ++++ b/racket/src/bc/sconfig.h +@@ -79,12 +79,14 @@ + + #endif + +- /************** Linux with gcc ****************/ ++ /************** Linux (or Hurd) with gcc ****************/ + +-#if defined(__linux__) ++#if defined(__linux__) || defined(__GNU__) + + # ifdef __ANDROID__ + # define SCHEME_OS "android" ++# elif defined(__GNU__) ++# define SCHEME_OS "gnu-hurd" + # else + # define SCHEME_OS "linux" + # endif +@@ -146,13 +148,15 @@ + # define USE_IEEE_FP_PREDS + # define USE_EXPLICT_FP_FORM_CHECK + +-# define LINUX_FIND_STACK_BASE ++# define LINUX_FIND_STACK_BASE /* also ok for Hurd */ + + # define FLAGS_ALREADY_SET + + #if defined(__i386__) +-# define MZ_USE_JIT_I386 +-# define MZ_JIT_USE_MPROTECT ++# ifndef __GNU__ /* Hurd */ ++# define MZ_USE_JIT_I386 ++# define MZ_JIT_USE_MPROTECT ++# endif + # ifndef MZ_NO_UNWIND_SUPPORT + # define MZ_USE_DWARF_LIBUNWIND + # endif +-- +2.32.0 + + +From 1b0cd08557f58506c96f0ddd855bd9051a45a2f1 Mon Sep 17 00:00:00 2001 +From: Philip McGrath <philip@philipmcgrath.com> +Date: Sat, 6 Aug 2022 22:48:40 -0400 +Subject: [PATCH 3/3] BC: repair configure script + +Hopefully this will fix the DrDr failures caused by 5c05496. + +Related to https://github.com/racket/racket/pull/4384 + +(cherry picked from commit c3dd01055ed7589a18136904510fe4db557d6e77) +--- + racket/src/bc/configure | 2 +- + racket/src/bc/configure.ac | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/racket/src/bc/configure b/racket/src/bc/configure +index 4ee346014d..b1c5175b84 100755 +--- a/racket/src/bc/configure ++++ b/racket/src/bc/configure +@@ -5018,7 +5018,7 @@ case "$host_os" in + X_PRE_LIBS="" + fi + ;; +- linux*,gnu*) ++ linux*|gnu*) + LIBS="$LIBS -ldl -lm -lrt -rdynamic" + DYN_CFLAGS="-fPIC" + curses_portable_link="/usr/lib/${host_cpu}-${host_os}/libncurses.a /usr/lib/${host_cpu}-${host_os}/libtermcap.a" +diff --git a/racket/src/bc/configure.ac b/racket/src/bc/configure.ac +index 866851236e..ecc3b0b579 100644 +--- a/racket/src/bc/configure.ac ++++ b/racket/src/bc/configure.ac +@@ -557,7 +557,7 @@ case "$host_os" in + X_PRE_LIBS="" + fi + ;; +- linux*,gnu*) ++ linux*|gnu*) + LIBS="$LIBS -ldl -lm -lrt -rdynamic" + DYN_CFLAGS="-fPIC" + curses_portable_link="/usr/lib/${host_cpu}-${host_os}/libncurses.a /usr/lib/${host_cpu}-${host_os}/libtermcap.a" +-- +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 index df2eb671b3..69aca3b483 100644 --- a/gnu/packages/patches/racket-chez-scheme-bin-sh.patch +++ b/gnu/packages/patches/racket-chez-scheme-bin-sh.patch @@ -1,4 +1,4 @@ -From 5f3fc12bf123f30485800960b0493f5dd538d107 Mon Sep 17 00:00:00 2001 +From 988eea0a875d570d8ec155cb0925b4586d36e8d7 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 @@ -22,10 +22,10 @@ on `system` from the C library. 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 +index 82bbf8d687..307c8673a1 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; { +@@ -861,6 +861,22 @@ static ptr s_process(char *s, IBOOL stderrp) { INT tofds[2], fromfds[2], errfds[2]; struct sigaction act, oint_act; @@ -48,10 +48,10 @@ index f5e3e345be..9db2989138 100644 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);} +@@ -897,7 +913,9 @@ static ptr s_process(char *s, IBOOL stderrp) { + } + } + #endif /* __GNU__ Hurd */ - execl("/bin/sh", "/bin/sh", "-c", s, NULL); + /* BEGIN PATCH for Guix */ + execl(guix_sh, guix_sh, "-c", s, NULL); @@ -60,7 +60,7 @@ index f5e3e345be..9db2989138 100644 /*NOTREACHED*/ } else { -base-commit: 9d228d16fb99c274c964e5bef93e97333888769f +base-commit: 87eee6e2adb8c6bc11e60619c706fa6295096085 -- 2.32.0 diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm index 0c8b3b6bb8..31f3394fa3 100644 --- a/gnu/packages/racket.scm +++ b/gnu/packages/racket.scm @@ -54,7 +54,7 @@ (define-module (gnu packages racket) #:use-module (gnu packages xorg) #:use-module ((guix licenses) #:prefix license:)) -;; Commentary: +;; COMMENTARY: ;; ;; Anatomy of Racket: ;; ------------------ @@ -73,14 +73,16 @@ (define-module (gnu packages racket) ;; ├── bc/ ;; ├── cs/ ;; ├── ChezScheme/ +;; ├── zuo/ ;; └── ... ;; ;; The 'racket/src/' directory contains the source of the runtime system, core ;; compiler, and primitives for the major Racket implementations: this layer -;; is called the ``Racket VM''. It is basically a normal autotools -;; project. (Even when Racket VM implementations use components implemented in -;; Racket, they are compiled in special modes to produce VM primitives.) -;; (There are or have been experimental Racket VM implementations elsewhere, +;; is called the ``Racket VM''. It is basically a normal Autoconf project, +;; except that the makefiles just run Zuo to do the real work. (Even when +;; Racket VM implementations use components implemented in Racket, they are +;; compiled in special modes to produce VM primitives.) (There are or have +;; been experimental Racket VM implementations elsewhere, ;; e.g. <https://github.com/pycket/pycket>.) ;; ;; The 'racket/collects/' directory contains ``built in'' Racket libraries @@ -101,10 +103,10 @@ (define-module (gnu packages racket) ;; ;; The top-level 'Makefile' is more like a directory of scripts: it has ;; convienience targets for developing Racket, and it cooperates with the -;; 'distro-build' package to assemble custom Racket distributions. It is not -;; part of Racket source distributions: the root of a source distribution is -;; basically 'racket/src' with some extra package sources and configuration -;; added. +;; 'distro-build' package to assemble custom Racket distributions. (Again, +;; the makefile just delegates to Zuo.) It is not part of Racket source +;; distributions: the root of a source distribution is basically 'racket/src' +;; with some extra package sources and configuration added. ;; ;; A ''minimal Racket'' installation includes two packages: 'base', which is a ;; sort of bridge between the current ``built-in'' collections and the package @@ -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: ;; --------------------- @@ -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: (define* (racket-vm-for-system #:optional (system (or (%current-target-system) @@ -200,7 +204,7 @@ (define* (racket-vm-for-system #:optional racket-vm-cs racket-vm-bc)) -(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)) - (patches (search-patches "racket-chez-scheme-bin-sh.patch" - "racket-rktio-bin-sh.patch")) + (patches (search-patches "racket-backport-8.6-cross-install.patch" + "racket-backport-8.6-docindex-write.patch" + "racket-backport-8.6-hurd.patch" + "racket-backport-8.6-zuo.patch" + "racket-chez-scheme-bin-sh.patch" + "racket-rktio-bin-sh.patch" + "racket-zuo-bin-sh.patch")) (modules '((guix build utils))) (snippet #~(begin @@ -241,21 +250,10 @@ (define-public zuo (name "zuo") (version (string-append %zuo-version "-racket" - "8.6" + %racket-version (if revision "-guix" "") (or revision ""))) - (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")))) + (source %racket-origin) (outputs '("out" "debug")) (build-system gnu-build-system) (inputs (list bash-minimal)) @@ -334,7 +332,8 @@ (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 libtool)) ;; <- only for BC variants + (native-inputs (list zuo ;; <- for all variants + libtool)) ;; <- only for BC variants (outputs '("out" "debug")) (build-system gnu-build-system) (arguments @@ -342,6 +341,10 @@ (define-public racket-vm-cgc #:configure-flags #~(cons "--enable-cgcdefault" #$(racket-vm-common-configure-flags)) + #:make-flags + #~(list (string-append "ZUO=" + #+(this-package-native-input "zuo") + "/bin/zuo")) ;; Tests are in packages like racket-test-core and ;; main-distribution-test that aren't part of the main ;; distribution. @@ -701,25 +704,25 @@ (define-public racket "contract-profile" (base32 "1xm2z8g0dpv5d9h2sg680vx1a8ix9gbsdpxxb8qv1w7akp73paj3") '(("contract-profile" "."))) (simple-racket-origin - "data" (base32 "10iabgrk9alaggvksnyb0hdq7f1p30pq6pq2bcakvhzpxwiv1f55") + "data" (base32 "08sj4m0g0cp7gwb0nq90m770f0c21b7ydif7nljc8rxmcdprfisc") '("data" "data-doc" "data-enumerate-lib" "data-lib")) (simple-racket-origin "datalog" (base32 "0nf6cy4djpyhfvgpa6yn72apbz9s83gp0qg95pzjd0az4v6qwq1s") '(("datalog" "."))) (simple-racket-origin - "db" (base32 "1n02ja0yj3mjjhmz0yv04yfhyvrsznbljn8bjviyfxnm4xf9rcc5") + "db" (base32 "0jzsbfcdm3xj0g8xxw3ky2swrhiqqsq2aqa3r08m641dc981dmjq") '("db" "db-doc" "db-lib")) (simple-racket-origin - "deinprogramm" (base32 "0g8flr1qg3bcyhdinqhs4w7dyisaqyailbxrjgd2a7zlqmdyicfr") + "deinprogramm" (base32 "16ncs3ms3mmdavbk0mkhm2qi62vyyif9cch3sn1y64pij489x34v") '("deinprogramm" "deinprogramm-signature")) (simple-racket-origin "distributed-places" (base32 "1dajpkj9balqcpv6cdk9hwjz592h1vq8rrx5vncariiac4vbdpa0") '("distributed-places" "distributed-places-doc" "distributed-places-lib")) (simple-racket-origin - "draw" (base32 "1fpk85rs2crd63bxnmwj2pysisd62pxcqaip01si67dv1ri8ff92") + "draw" (base32 "00rq5y4ba6z1d6jh76kl8rwpxrlqqp81a875zyhk3k81i42635sm") '("draw" "draw-doc" "draw-lib")) (simple-racket-origin - "drracket" (base32 "0dipnz92c63zxys9z1kl5215rm7arc35g9r8bs8ivp96p75mljnz") + "drracket" (base32 "05d7wssi0ry13alb5hl3llpsg30dd0jhyfv5nb1nmg189fn42q62") '("drracket" "drracket-plugin-lib" "drracket-tool" @@ -736,7 +739,7 @@ (define-public racket "eopl" (base32 "1fmiixj6rxsgzwvgva8lvrvv0gl49v2405mp3s0i7ipis5c4n27s") '(("eopl" "."))) (simple-racket-origin - "errortrace" (base32 "14m7rhaxngj36070iw15am434hm438pfgmwjfsiqhsglz4pcxhip") + "errortrace" (base32 "0r5630bb2d6hk0fbi95fmyfja54nnwdfcj2zjba124pp6xkjyavx") '("errortrace" "errortrace-doc" "errortrace-lib")) (simple-racket-origin "expeditor" (base32 "0mjfwb4wzwsg5xj3k6cmik0va432n56rp5h7rxx1c2yy3prh1j7q") @@ -753,13 +756,13 @@ (define-public racket "games" (base32 "0kpn3izlx1ccd0pj0dnvmnrhny51b85xy418a7psj70lz8j8415d") '(("games" "."))) (simple-racket-origin - "gui" (base32 "0r3ck4gxdhnzr1a1fi0f1i7gwfip7akq10qgcxza66pp57hnl0wx") + "gui" (base32 "18pcnx3wi8f32i2frm8bn9pi08n4y3c5jgqs4gy21w6f84dv401w") '("gui" "gui-doc" "gui-lib" "tex-table")) (simple-racket-origin "gui-pkg-manager" (base32 "1ji9448d723nklqvycwdswj0ni28sabrncag14f9mx47did5myb5") '("gui-pkg-manager-lib")) (simple-racket-origin - "htdp" (base32 "19xqixrqbwdxph17w9jga19008j88harb5wgml4hpqj3x0apx9g3") + "htdp" (base32 "173xy6ks55npvwn6cykjs41s9qfb70hc2gfjiqvw91hdsbjykwir") '("htdp" "htdp-doc" "htdp-lib")) (simple-racket-origin "html" (base32 "18n1jnjgzfknc8nv8dppi85nb8q08gqdwkg6hfjk08x0p00anx2x") @@ -783,7 +786,7 @@ (define-public racket "make" (base32 "10852fj30bz5r46c3d99s37fkgy5yh44gb01j29sf3kxnhi0g2sa") '(("make" "."))) (simple-racket-origin - "math" (base32 "02sqbnvxvmvslk33b44fx4v93zafcvhva0cx8z21jqbl5wp217ac") + "math" (base32 "00ld38in5jfshs1q4zf07w84cyv4yjr40kmw30pyd5wqgs2zq9ai") '("math" "math-doc" "math-lib")) (simple-racket-origin "mysterx" (base32 "11p9jzrafw0hizhl0cs4sxx7rv281185q8hryic2rpk0kzjdyr48") @@ -818,16 +821,16 @@ (define-public racket (git-file-name "stamourv-optimization-coach" %racket-version))) '(("optimization-coach" "."))) (simple-racket-origin - "option-contract" (base32 "026b7n5l0c3024nymshz8zp1yhn493rdzgpflzfd52hj7awafqhk") + "option-contract" (base32 "07cncg9pi15cm19k7rzv54vx83wq7y42i2m6bgzaqja1h8vnj2ww") '("option-contract" "option-contract-doc" "option-contract-lib")) (simple-racket-origin - "parser-tools" (base32 "08pvz4zramirzm3j64hbhjm0mmh5zfy37iv4s3vmq0rj49cr8fl3") + "parser-tools" (base32 "04ycihliikh0c47ivp09gayxiql9d9wpl216czic19cj6f7rmcnj") '("parser-tools" "parser-tools-doc" "parser-tools-lib")) (simple-racket-origin "pconvert" (base32 "00czi0p399mmyrvxyrs5kniizpkqfxyz2ncxqi2jy79a7wk79pb1") '("pconvert-lib")) (simple-racket-origin - "pict" (base32 "0v7a3l77swsbh80mnb9rakdwgw7s66ji0mall7qcqfwyg1b4zmlv") + "pict" (base32 "1n0v7kynkiin1v8igs9m8k8vfwjn5cswanhq2imp1pxzjvdyq6sx") '("pict" "pict-doc" "pict-lib")) (simple-racket-origin "pict-snip" (base32 "081nwiy4a0n4f7xws16hqbhf0j3kz5alizndi3nnyr3chm4kng6x") @@ -881,7 +884,7 @@ (define-public racket "racklog" (base32 "0fbq0fpfb3l6h7h772dvkmlzlk2dnq5f8296xx1qxhhwypibqzr9") '(("racklog" "."))) (simple-racket-origin - "rackunit" (base32 "0vfwcddzrgrdv5awjka7m0jzqhqvfc5wlkih83a670y96496a83n") + "rackunit" (base32 "1gpz9sgnm8hrc0cb3rii0wzbcwp9mgy5k1amnxidy7gyzl7prn81") '("rackunit" "rackunit-doc" "rackunit-gui" @@ -894,10 +897,10 @@ (define-public racket "readline" (base32 "13kbcn2wchv82d709mw3r8n37bk8iwq0y4kpvm9dbzx0w2pxkfwn") '("readline" "readline-doc" "readline-lib")) (simple-racket-origin - "realm" (base32 "0hxcgla08iack54j8v40fj51811chpy66ym2zq76zb52c7kzn0hi") + "realm" (base32 "0rlvwyd6rpyl0zda4a5p8dp346fvqzc8555dgfnrhliymkxb6x4g") '(("realm" "."))) (simple-racket-origin - "redex" (base32 "18rn8ddsqh1s7hdlb2cb9wxln63bz0wysjssaf9v92r712xnnv8i") + "redex" (base32 "06dhyqmin0qdm6b6sdvgzpy3pa4svlw42ld9k2h1dxcr852czil7") '("redex" "redex-benchmark" "redex-doc" @@ -912,7 +915,7 @@ (define-public racket "scheme-lib" (base32 "0pcf0y8rp4qyjhaz5ww5sr5diq0wpcdfrrnask7zapyklzx1jx8x") '(("scheme-lib" "."))) (simple-racket-origin - "scribble" (base32 "0fbb7xgz95y90247hfc1a19v7ry8m6blvv4y8irdgzhjvik70zb3") + "scribble" (base32 "0a11kvcnzp04mp4xxq68rkl09jv00hv81k2nmwkmwpfx9b2acvd3") '("scribble" "scribble-doc" "scribble-html-lib" @@ -944,7 +947,7 @@ (define-public racket "snip" (base32 "01r9wc5xr3q3n4yyif6j0a37rgdzmpslxn05k13ksik73b3wj6hj") '("snip" "snip-lib")) (simple-racket-origin - "typed-racket" (base32 "0z6bagp6qiw0i3slhvq035y5hqgq664xw3bdlvdayad0bgbg0mdc") + "typed-racket" (base32 "03wsz647fi58brbg33fw1xavp100gzfvngdy8bk7bdc0jfg8a18l") '("source-syntax" "typed-racket" "typed-racket-compatibility" @@ -955,13 +958,13 @@ (define-public racket "srfi" (base32 "0aqbcdv2dfc2xnk0h6zfi56p7bpwqji8s88qds3d03hhh9k28gvn") '("srfi" "srfi-doc" "srfi-lib" "srfi-lite-lib")) (simple-racket-origin - "string-constants" (base32 "0b1ji31pv6bjb0a2bh9sqp5abvf91gn2rai8r4c4nkar1fzfwfac") + "string-constants" (base32 "1kg3vxq2hcd0vl76brgpzdwbrb65a4nrrkc6hj4az5lfbbdvqz47") '("string-constants" "string-constants-doc" "string-constants-lib")) (simple-racket-origin - "swindle" (base32 "164gdsphjzdl2vv7zxz7dfk9jwax8njpmim6sidm8qz8a8589y67") + "swindle" (base32 "03n9ymjhrw45h7hxkw4nq8nidnvs9mfzb4228s2cjfaqbgqxvsyb") '(("swindle" "."))) (simple-racket-origin - "syntax-color" (base32 "17lb2403ymz6sflw4vs3gsh2y7kgsf0gn8sncsxjhi16rpj3a9vm") + "syntax-color" (base32 "02dcd4yvdnw35m3srvfd43csxffxw3j4rk6zi379b8dsvbbrjyq1") '("syntax-color" "syntax-color-doc" "syntax-color-lib")) (simple-racket-origin "trace" (base32 "070ihla5j796hdarn5wxdwn4xj0xnkm50shgh49jy994mribvhia") @@ -970,7 +973,7 @@ (define-public racket "unix-socket" (base32 "02dfwas5ynbpyz74w9kwb4wgb37y5wys7svrlmir8k0n9ph9vq0y") '("unix-socket" "unix-socket-doc" "unix-socket-lib")) (simple-racket-origin - "web-server" (base32 "1g4x79ym3mgxv4f3z3z84j12355pf44pjlzlb7f0h6r0i7p0cbjd") + "web-server" (base32 "104lnzjykkd6f3gxpv7p14l94if6zac33nmb4sj5jxmd6r3fwcpf") '("web-server" "web-server-doc" "web-server-lib")) (simple-racket-origin "wxme" (base32 "1qp5gr9gqsakiq3alw6m4yyv5vw4i3hp4y4nhq8vl2nkjmirvn0b") -- 2.32.0 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 05/13] gnu: racket: Update to 8.6. 2022-08-11 11:08 ` [bug#57050] [PATCH v2 05/13] gnu: racket: Update to 8.6 Philip McGrath @ 2022-08-11 11:44 ` Liliana Marie Prikler 2022-08-11 22:40 ` Philip McGrath 2022-08-22 8:41 ` Efraim Flashner 1 sibling, 1 reply; 122+ messages in thread From: Liliana Marie Prikler @ 2022-08-11 11:44 UTC (permalink / raw) To: Philip McGrath, 57050; +Cc: Liliana Marie Prikler, Thiago Jung Bauermann 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? > [...] > @@ -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. > (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. > @@ -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 😎️"? > @@ -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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 05/13] gnu: racket: Update to 8.6. 2022-08-11 11:44 ` Liliana Marie Prikler @ 2022-08-11 22:40 ` Philip McGrath 2022-08-12 6:34 ` Liliana Marie Prikler 0 siblings, 1 reply; 122+ messages in thread From: Philip McGrath @ 2022-08-11 22:40 UTC (permalink / raw) To: Liliana Marie Prikler, 57050; +Cc: Liliana Marie Prikler, Thiago Jung Bauermann 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. 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. >> [...] >> @@ -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? >> (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. [1]: https://github.com/racket/racket/pull/4179#issuecomment-1094137092 [2]: https://salsa.debian.org/scheme-team/chezscheme/-/blob/fbfa9c35db184f5b22ac6c0058d754e1a45f5f68/debian/rules#L66-69 >> @@ -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] >> ;; >> -;; 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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 05/13] gnu: racket: Update to 8.6. 2022-08-11 22:40 ` Philip McGrath @ 2022-08-12 6:34 ` Liliana Marie Prikler 0 siblings, 0 replies; 122+ messages in thread From: Liliana Marie Prikler @ 2022-08-12 6:34 UTC (permalink / raw) To: Philip McGrath, 57050; +Cc: Liliana Marie Prikler, Thiago Jung Bauermann Am Donnerstag, dem 11.08.2022 um 18:40 -0400 schrieb Philip McGrath: > 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. > 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. > 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. > combinations of technical and social mechanisms to make certain > potentially problematic states difficult to fall into. Just call it a monorepo. > 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 > * 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 > (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. > 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. > 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). > > > [...] > > > @@ -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. > > > (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 > 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. > > > @@ -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. > > > > ;; > > > -;; 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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 05/13] gnu: racket: Update to 8.6. 2022-08-11 11:08 ` [bug#57050] [PATCH v2 05/13] gnu: racket: Update to 8.6 Philip McGrath 2022-08-11 11:44 ` Liliana Marie Prikler @ 2022-08-22 8:41 ` Efraim Flashner 2022-08-22 18:56 ` Philip McGrath 1 sibling, 1 reply; 122+ messages in thread From: Efraim Flashner @ 2022-08-22 8:41 UTC (permalink / raw) To: Philip McGrath Cc: 57050, Liliana Marie Prikler, Liliana Marie Prikler, Thiago Jung Bauermann [-- Attachment #1: Type: text/plain, Size: 1158 bytes --] 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. -- Efraim Flashner <efraim@flashner.co.il> אפרים פלשנר GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 05/13] gnu: racket: Update to 8.6. 2022-08-22 8:41 ` Efraim Flashner @ 2022-08-22 18:56 ` Philip McGrath 0 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-22 18:56 UTC (permalink / raw) To: Efraim Flashner Cc: 57050, Liliana Marie Prikler, Liliana Marie Prikler, Thiago Jung Bauermann On Mon, Aug 22, 2022, at 4:41 AM, Efraim Flashner wrote: > 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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 06/13] gnu: chez-scheme: Bootfiles should not be native inputs. 2022-08-11 11:08 ` [bug#57050] [PATCH v2 00/13] " Philip McGrath ` (4 preceding siblings ...) 2022-08-11 11:08 ` [bug#57050] [PATCH v2 05/13] gnu: racket: Update to 8.6 Philip McGrath @ 2022-08-11 11:08 ` Philip McGrath 2022-08-11 11:47 ` Liliana Marie Prikler 2022-08-11 11:08 ` [bug#57050] [PATCH v2 07/13] gnu: chez-scheme-for-racket: Support cross-compilation Philip McGrath ` (9 subsequent siblings) 15 siblings, 1 reply; 122+ messages in thread From: Philip McGrath @ 2022-08-11 11:08 UTC (permalink / raw) To: 57050 Cc: Liliana Marie Prikler, Liliana Marie Prikler, Philip McGrath, Thiago Jung Bauermann 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(-) 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 06/13] gnu: chez-scheme: Bootfiles should not be native inputs. 2022-08-11 11:08 ` [bug#57050] [PATCH v2 06/13] gnu: chez-scheme: Bootfiles should not be native inputs Philip McGrath @ 2022-08-11 11:47 ` Liliana Marie Prikler 2022-08-11 22:45 ` Philip McGrath 0 siblings, 1 reply; 122+ messages in thread From: Liliana Marie Prikler @ 2022-08-11 11:47 UTC (permalink / raw) To: Philip McGrath, 57050; +Cc: Liliana Marie Prikler, Thiago Jung Bauermann 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". 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. > * 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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 06/13] gnu: chez-scheme: Bootfiles should not be native inputs. 2022-08-11 11:47 ` Liliana Marie Prikler @ 2022-08-11 22:45 ` Philip McGrath 2022-08-12 4:21 ` Liliana Marie Prikler 0 siblings, 1 reply; 122+ messages in thread From: Philip McGrath @ 2022-08-11 22:45 UTC (permalink / raw) To: Liliana Marie Prikler, 57050; +Cc: Liliana Marie Prikler, Thiago Jung Bauermann 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". > 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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 06/13] gnu: chez-scheme: Bootfiles should not be native inputs. 2022-08-11 22:45 ` Philip McGrath @ 2022-08-12 4:21 ` Liliana Marie Prikler 0 siblings, 0 replies; 122+ messages in thread From: Liliana Marie Prikler @ 2022-08-12 4:21 UTC (permalink / raw) To: Philip McGrath, Liliana Marie Prikler, 57050; +Cc: Thiago Jung Bauermann Am Donnerstag, dem 11.08.2022 um 18:45 -0400 schrieb Philip McGrath: > 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". > > 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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 07/13] gnu: chez-scheme-for-racket: Support cross-compilation. 2022-08-11 11:08 ` [bug#57050] [PATCH v2 00/13] " Philip McGrath ` (5 preceding siblings ...) 2022-08-11 11:08 ` [bug#57050] [PATCH v2 06/13] gnu: chez-scheme: Bootfiles should not be native inputs Philip McGrath @ 2022-08-11 11:08 ` Philip McGrath 2022-08-11 11:56 ` Liliana Marie Prikler 2022-08-11 11:08 ` [bug#57050] [PATCH v2 08/13] gnu: racket: Support cross-compiling the VM packages Philip McGrath ` (8 subsequent siblings) 15 siblings, 1 reply; 122+ messages in thread From: Philip McGrath @ 2022-08-11 11:08 UTC (permalink / raw) To: 57050 Cc: Liliana Marie Prikler, Liliana Marie Prikler, Philip McGrath, Thiago Jung Bauermann * 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(-) 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 07/13] gnu: chez-scheme-for-racket: Support cross-compilation. 2022-08-11 11:08 ` [bug#57050] [PATCH v2 07/13] gnu: chez-scheme-for-racket: Support cross-compilation Philip McGrath @ 2022-08-11 11:56 ` Liliana Marie Prikler 2022-08-11 22:49 ` Philip McGrath 0 siblings, 1 reply; 122+ messages in thread From: Liliana Marie Prikler @ 2022-08-11 11:56 UTC (permalink / raw) To: Philip McGrath, 57050; +Cc: Liliana Marie Prikler, Thiago Jung Bauermann 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. Cheers ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 07/13] gnu: chez-scheme-for-racket: Support cross-compilation. 2022-08-11 11:56 ` Liliana Marie Prikler @ 2022-08-11 22:49 ` Philip McGrath 0 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-11 22:49 UTC (permalink / raw) To: Liliana Marie Prikler, 57050; +Cc: Liliana Marie Prikler, Thiago Jung Bauermann Hi, On Thu, Aug 11, 2022, at 7:56 AM, Liliana Marie Prikler wrote: > 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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 08/13] gnu: racket: Support cross-compiling the VM packages. 2022-08-11 11:08 ` [bug#57050] [PATCH v2 00/13] " Philip McGrath ` (6 preceding siblings ...) 2022-08-11 11:08 ` [bug#57050] [PATCH v2 07/13] gnu: chez-scheme-for-racket: Support cross-compilation Philip McGrath @ 2022-08-11 11:08 ` Philip McGrath 2022-08-11 11:58 ` Liliana Marie Prikler 2022-08-11 11:08 ` [bug#57050] [PATCH v2 09/13] gnu: chez-scheme-for-racket: Suport all systems Philip McGrath ` (7 subsequent siblings) 15 siblings, 1 reply; 122+ messages in thread From: Philip McGrath @ 2022-08-11 11:08 UTC (permalink / raw) To: 57050 Cc: Liliana Marie Prikler, Liliana Marie Prikler, Philip McGrath, Thiago Jung Bauermann 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(-) 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 08/13] gnu: racket: Support cross-compiling the VM packages. 2022-08-11 11:08 ` [bug#57050] [PATCH v2 08/13] gnu: racket: Support cross-compiling the VM packages Philip McGrath @ 2022-08-11 11:58 ` Liliana Marie Prikler 2022-08-11 23:23 ` Philip McGrath 0 siblings, 1 reply; 122+ messages in thread From: Liliana Marie Prikler @ 2022-08-11 11:58 UTC (permalink / raw) To: Philip McGrath, 57050; +Cc: Liliana Marie Prikler, Thiago Jung Bauermann 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"? > [arguments]<#:configure-flags>: Fix '--enable-scheme' for > cross-compilation. Cheers ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 08/13] gnu: racket: Support cross-compiling the VM packages. 2022-08-11 11:58 ` Liliana Marie Prikler @ 2022-08-11 23:23 ` Philip McGrath 0 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-11 23:23 UTC (permalink / raw) To: Liliana Marie Prikler, 57050; +Cc: Liliana Marie Prikler, Thiago Jung Bauermann Hi, On Thu, Aug 11, 2022, at 7:58 AM, Liliana Marie Prikler wrote: > 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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 09/13] gnu: chez-scheme-for-racket: Suport all systems. 2022-08-11 11:08 ` [bug#57050] [PATCH v2 00/13] " Philip McGrath ` (7 preceding siblings ...) 2022-08-11 11:08 ` [bug#57050] [PATCH v2 08/13] gnu: racket: Support cross-compiling the VM packages Philip McGrath @ 2022-08-11 11:08 ` Philip McGrath 2022-08-11 12:02 ` Liliana Marie Prikler 2022-08-11 11:08 ` [bug#57050] [PATCH v2 10/13] gnu: racket-vm-bc: Add workaround for ppc64le Philip McGrath ` (6 subsequent siblings) 15 siblings, 1 reply; 122+ messages in thread From: Philip McGrath @ 2022-08-11 11:08 UTC (permalink / raw) To: 57050 Cc: Liliana Marie Prikler, Liliana Marie Prikler, Philip McGrath, Thiago Jung Bauermann 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 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 09/13] gnu: chez-scheme-for-racket: Suport all systems. 2022-08-11 11:08 ` [bug#57050] [PATCH v2 09/13] gnu: chez-scheme-for-racket: Suport all systems Philip McGrath @ 2022-08-11 12:02 ` Liliana Marie Prikler 2022-08-11 23:25 ` Philip McGrath 0 siblings, 1 reply; 122+ messages in thread From: Liliana Marie Prikler @ 2022-08-11 12:02 UTC (permalink / raw) To: Philip McGrath, 57050; +Cc: Liliana Marie Prikler, Thiago Jung Bauermann 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? Cheers ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 09/13] gnu: chez-scheme-for-racket: Suport all systems. 2022-08-11 12:02 ` Liliana Marie Prikler @ 2022-08-11 23:25 ` Philip McGrath 0 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-11 23:25 UTC (permalink / raw) To: Liliana Marie Prikler, 57050; +Cc: Liliana Marie Prikler, Thiago Jung Bauermann On Thu, Aug 11, 2022, at 8:02 AM, Liliana Marie Prikler wrote: > 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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 10/13] gnu: racket-vm-bc: Add workaround for ppc64le. 2022-08-11 11:08 ` [bug#57050] [PATCH v2 00/13] " Philip McGrath ` (8 preceding siblings ...) 2022-08-11 11:08 ` [bug#57050] [PATCH v2 09/13] gnu: chez-scheme-for-racket: Suport all systems Philip McGrath @ 2022-08-11 11:08 ` Philip McGrath 2022-08-11 11:08 ` [bug#57050] [PATCH v2 11/13] gnu: racket: Use Racket CS on all systems Philip McGrath ` (5 subsequent siblings) 15 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-11 11:08 UTC (permalink / raw) To: 57050 Cc: Liliana Marie Prikler, Liliana Marie Prikler, Philip McGrath, Thiago Jung Bauermann 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 the workaround: <https://racket.discourse.group/t/950/22>. * 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(-) 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 11/13] gnu: racket: Use Racket CS on all systems. 2022-08-11 11:08 ` [bug#57050] [PATCH v2 00/13] " Philip McGrath ` (9 preceding siblings ...) 2022-08-11 11:08 ` [bug#57050] [PATCH v2 10/13] gnu: racket-vm-bc: Add workaround for ppc64le Philip McGrath @ 2022-08-11 11:08 ` Philip McGrath 2022-08-11 12:03 ` Liliana Marie Prikler 2022-08-11 11:08 ` [bug#57050] [PATCH v2 12/13] etc: teams: Add racket team Philip McGrath ` (4 subsequent siblings) 15 siblings, 1 reply; 122+ messages in thread From: Philip McGrath @ 2022-08-11 11:08 UTC (permalink / raw) To: 57050 Cc: Liliana Marie Prikler, Liliana Marie Prikler, Philip McGrath, Thiago Jung Bauermann 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(-) 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 11/13] gnu: racket: Use Racket CS on all systems. 2022-08-11 11:08 ` [bug#57050] [PATCH v2 11/13] gnu: racket: Use Racket CS on all systems Philip McGrath @ 2022-08-11 12:03 ` Liliana Marie Prikler 0 siblings, 0 replies; 122+ messages in thread From: Liliana Marie Prikler @ 2022-08-11 12:03 UTC (permalink / raw) To: Philip McGrath, 57050; +Cc: Liliana Marie Prikler, Thiago Jung Bauermann Am Donnerstag, dem 11.08.2022 um 07:08 -0400 schrieb Philip McGrath: > 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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 12/13] etc: teams: Add racket team. 2022-08-11 11:08 ` [bug#57050] [PATCH v2 00/13] " Philip McGrath ` (10 preceding siblings ...) 2022-08-11 11:08 ` [bug#57050] [PATCH v2 11/13] gnu: racket: Use Racket CS on all systems Philip McGrath @ 2022-08-11 11:08 ` Philip McGrath 2022-08-11 12:11 ` Liliana Marie Prikler 2022-08-11 11:08 ` [bug#57050] [PATCH v2 13/13] etc: teams: Add entry for Philip McGrath Philip McGrath ` (3 subsequent siblings) 15 siblings, 1 reply; 122+ messages in thread From: Philip McGrath @ 2022-08-11 11:08 UTC (permalink / raw) To: 57050 Cc: Liliana Marie Prikler, Liliana Marie Prikler, Philip McGrath, Thiago Jung Bauermann * etc/teams.scm.in (racket): New team. --- etc/teams.scm.in | 8 ++++++++ 1 file changed, 8 insertions(+) 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.")) + \f (define-member (person "Thiago Jung Bauermann" "bauermann@kolabnow.com") -- 2.32.0 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 12/13] etc: teams: Add racket team. 2022-08-11 11:08 ` [bug#57050] [PATCH v2 12/13] etc: teams: Add racket team Philip McGrath @ 2022-08-11 12:11 ` Liliana Marie Prikler 0 siblings, 0 replies; 122+ messages in thread From: Liliana Marie Prikler @ 2022-08-11 12:11 UTC (permalink / raw) To: Philip McGrath, 57050; +Cc: Liliana Marie Prikler, Thiago Jung Bauermann Am Donnerstag, dem 11.08.2022 um 07:08 -0400 schrieb Philip McGrath: > * 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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 13/13] etc: teams: Add entry for Philip McGrath. 2022-08-11 11:08 ` [bug#57050] [PATCH v2 00/13] " Philip McGrath ` (11 preceding siblings ...) 2022-08-11 11:08 ` [bug#57050] [PATCH v2 12/13] etc: teams: Add racket team Philip McGrath @ 2022-08-11 11:08 ` Philip McGrath 2022-08-13 17:43 ` [bug#57050] [PATCH v2 00/13] gnu: Update Racket to 8.6. Add Zuo Thiago Jung Bauermann via Guix-patches via ` (2 subsequent siblings) 15 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-11 11:08 UTC (permalink / raw) To: 57050 Cc: Liliana Marie Prikler, Liliana Marie Prikler, Philip McGrath, Thiago Jung Bauermann * etc/teams.scm.in ("Philip McGrath"): New member. --- etc/teams.scm.in | 4 ++++ 1 file changed, 4 insertions(+) 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [PATCH v2 00/13] gnu: Update Racket to 8.6. Add Zuo. 2022-08-11 11:08 ` [bug#57050] [PATCH v2 00/13] " Philip McGrath ` (12 preceding siblings ...) 2022-08-11 11:08 ` [bug#57050] [PATCH v2 13/13] etc: teams: Add entry for Philip McGrath Philip McGrath @ 2022-08-13 17:43 ` Thiago Jung Bauermann via Guix-patches via 2022-08-15 5:47 ` [bug#57050] [RFC PATCH] gnu: racket-vm-cs: Avoid 'configure' bug with '--enable-racket' Philip McGrath 2022-08-15 19:54 ` [bug#57050] [RFC PATCH v2] gnu: racket: Backport fix for powerpc64le Philip McGrath 15 siblings, 0 replies; 122+ messages in thread From: Thiago Jung Bauermann via Guix-patches via @ 2022-08-13 17:43 UTC (permalink / raw) To: Philip McGrath; +Cc: 57050, Liliana Marie Prikler, Liliana Marie Prikler Hello Philip, Philip McGrath <philip@philipmcgrath.com> writes: > 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: --8<---------------cut here---------------start------------->8--- 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 --8<---------------cut here---------------end--------------->8--- 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. > (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 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [RFC PATCH] gnu: racket-vm-cs: Avoid 'configure' bug with '--enable-racket'. 2022-08-11 11:08 ` [bug#57050] [PATCH v2 00/13] " Philip McGrath ` (13 preceding siblings ...) 2022-08-13 17:43 ` [bug#57050] [PATCH v2 00/13] gnu: Update Racket to 8.6. Add Zuo Thiago Jung Bauermann via Guix-patches via @ 2022-08-15 5:47 ` Philip McGrath 2022-08-15 6:12 ` Philip McGrath 2022-08-15 19:54 ` [bug#57050] [RFC PATCH v2] gnu: racket: Backport fix for powerpc64le Philip McGrath 15 siblings, 1 reply; 122+ messages in thread From: Philip McGrath @ 2022-08-15 5:47 UTC (permalink / raw) To: Thiago Jung Bauermann Cc: 57050, Liliana Marie Prikler, Philip McGrath, Liliana Marie Prikler 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. -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(-) 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [RFC PATCH] gnu: racket-vm-cs: Avoid 'configure' bug with '--enable-racket'. 2022-08-15 5:47 ` [bug#57050] [RFC PATCH] gnu: racket-vm-cs: Avoid 'configure' bug with '--enable-racket' Philip McGrath @ 2022-08-15 6:12 ` Philip McGrath 0 siblings, 0 replies; 122+ messages in thread From: Philip McGrath @ 2022-08-15 6:12 UTC (permalink / raw) To: Thiago Jung Bauermann; +Cc: 57050, Liliana Marie Prikler, Liliana Marie Prikler On Mon, Aug 15, 2022, at 1:47 AM, Philip McGrath wrote: > 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. ^ permalink raw reply [flat|nested] 122+ messages in thread
* [bug#57050] [RFC PATCH v2] gnu: racket: Backport fix for powerpc64le. 2022-08-11 11:08 ` [bug#57050] [PATCH v2 00/13] " Philip McGrath ` (14 preceding siblings ...) 2022-08-15 5:47 ` [bug#57050] [RFC PATCH] gnu: racket-vm-cs: Avoid 'configure' bug with '--enable-racket' Philip McGrath @ 2022-08-15 19:54 ` Philip McGrath 2022-08-19 0:51 ` Thiago Jung Bauermann via Guix-patches via 15 siblings, 1 reply; 122+ messages in thread From: Philip McGrath @ 2022-08-15 19:54 UTC (permalink / raw) To: Thiago Jung Bauermann Cc: 57050, Liliana Marie Prikler, Philip McGrath, Liliana Marie Prikler 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? I've updated the 'zuo' branch at https://gitlab.com/philip1/guix-patches to 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 <https://racket.discourse.group/t/950/29>. * 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(-) 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [RFC PATCH v2] gnu: racket: Backport fix for powerpc64le. 2022-08-15 19:54 ` [bug#57050] [RFC PATCH v2] gnu: racket: Backport fix for powerpc64le Philip McGrath @ 2022-08-19 0:51 ` Thiago Jung Bauermann via Guix-patches via 2022-08-19 10:10 ` Maxime Devos 0 siblings, 1 reply; 122+ messages in thread From: Thiago Jung Bauermann via Guix-patches via @ 2022-08-19 0:51 UTC (permalink / raw) To: Philip McGrath; +Cc: 57050, Liliana Marie Prikler, Liliana Marie Prikler Hello Philip, Philip McGrath <philip@philipmcgrath.com> writes: > 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! > I've updated the 'zuo' branch at https://gitlab.com/philip1/guix-patches to > 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! > 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 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 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [bug#57050] [RFC PATCH v2] gnu: racket: Backport fix for powerpc64le. 2022-08-19 0:51 ` Thiago Jung Bauermann via Guix-patches via @ 2022-08-19 10:10 ` Maxime Devos 0 siblings, 0 replies; 122+ messages in thread From: Maxime Devos @ 2022-08-19 10:10 UTC (permalink / raw) To: Thiago Jung Bauermann, Philip McGrath Cc: 57050, Liliana Marie Prikler, Liliana Marie Prikler [-- Attachment #1.1.1: Type: text/plain, Size: 462 bytes --] On 19-08-2022 02:51, Thiago Jung Bauermann via Guix-patches via wrote: > 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 #1.1.2: OpenPGP public key --] [-- Type: application/pgp-keys, Size: 929 bytes --] [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 236 bytes --] ^ permalink raw reply [flat|nested] 122+ messages in thread
end of thread, other threads:[~2022-09-04 20:54 UTC | newest] Thread overview: 122+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-08-08 6:06 [bug#57050] [PATCH 0/6] gnu: Update Racket to 8.6. Add Zuo Philip McGrath 2022-08-08 6:10 ` [bug#57050] [PATCH 1/6] gnu: stex: Update to 1.2.2-2.afa6075 Philip McGrath 2022-08-08 6:10 ` [bug#57050] [PATCH 2/6] gnu: stex: Fix read-only gifs and math directories Philip McGrath 2022-08-08 6:10 ` [bug#57050] [PATCH 3/6] gnu: chez-scheme: Fix use of "/bin/sh" Philip McGrath 2022-08-08 8:53 ` Liliana Marie Prikler 2022-08-09 20:25 ` Philip McGrath 2022-08-09 21:24 ` Maxime Devos 2022-08-09 21:38 ` ( via Guix-patches via 2022-08-09 21:58 ` Philip McGrath 2022-08-09 22:09 ` ( via Guix-patches via 2022-08-10 11:46 ` Maxime Devos 2022-08-08 6:10 ` [bug#57050] [PATCH 4/6] gnu: Update Racket to 8.6. Add Zuo Philip McGrath 2022-08-08 9:01 ` Liliana Marie Prikler 2022-08-09 20:56 ` Philip McGrath 2022-08-10 7:34 ` Liliana Marie Prikler 2022-08-08 6:10 ` [bug#57050] [PATCH 5/6] gnu: racket: Use Racket CS on all systems Philip McGrath 2022-08-08 9:10 ` Liliana Marie Prikler 2022-08-08 6:10 ` [bug#57050] [PATCH 6/6] gnu: chez-scheme-for-racket: Suport " Philip McGrath 2022-08-08 9:15 ` Liliana Marie Prikler 2022-08-10 15:30 ` [bug#57050] [PATCH 0/6] gnu: Update Racket to 8.6. Add Zuo Thiago Jung Bauermann via Guix-patches via 2022-08-11 4:00 ` Philip McGrath 2022-08-11 11:08 ` [bug#57050] [PATCH v2 00/13] " Philip McGrath 2022-08-11 11:08 ` [bug#57050] [PATCH v2 01/13] gnu: stex: Update to 1.2.2-2.afa6075 Philip McGrath 2022-08-11 11:08 ` [bug#57050] [PATCH v2 02/13] gnu: stex: Fix read-only gifs and math directories Philip McGrath 2022-08-11 11:13 ` Liliana Marie Prikler 2022-08-11 11:08 ` [bug#57050] [PATCH v2 03/13] gnu: chez-scheme: Fix use of "/bin/sh" Philip McGrath 2022-08-11 11:08 ` [bug#57050] [PATCH v2 04/13] gnu: Add Zuo Philip McGrath 2022-08-11 11:31 ` Liliana Marie Prikler 2022-08-11 14:00 ` Philip McGrath 2022-08-11 15:34 ` Liliana Marie Prikler 2022-08-11 23:32 ` Philip McGrath 2022-08-16 14:47 ` Maxime Devos 2022-08-23 1:40 ` Philip McGrath 2022-08-23 9:11 ` Maxime Devos 2022-08-23 23:24 ` Philip McGrath 2022-08-23 9:20 ` Maxime Devos 2022-08-24 0:27 ` Philip McGrath 2022-08-24 5:42 ` Liliana Marie Prikler 2022-08-24 5:47 ` Philip McGrath 2022-08-25 8:54 ` [bug#57050] [PATCH v3 00/14] gnu: Update Racket to 8.6. " Philip McGrath 2022-08-25 8:54 ` [bug#57050] [PATCH v3 01/14] gnu: stex: Update to 1.2.2-2.afa6075 Philip McGrath 2022-08-25 8:54 ` [bug#57050] [PATCH v3 02/14] gnu: stex: Fix read-only gifs and math directories Philip McGrath 2022-08-25 8:54 ` [bug#57050] [PATCH v3 03/14] etc: teams: Add racket team Philip McGrath 2022-08-25 8:54 ` [bug#57050] [PATCH v3 04/14] etc: teams: Add entry for Philip McGrath Philip McGrath 2022-08-25 8:54 ` [bug#57050] [PATCH v3 05/14] gnu: racket: Adjust patch for "/bin/sh" in rktio Philip McGrath 2022-08-25 9:09 ` Liliana Marie Prikler 2022-08-25 19:16 ` Philip McGrath 2022-08-25 8:54 ` [bug#57050] [PATCH v3 06/14] gnu: chez-scheme: Fix use of "/bin/sh" Philip McGrath 2022-08-25 8:54 ` [bug#57050] [PATCH v3 07/14] gnu: Add Zuo Philip McGrath 2022-08-25 9:12 ` Liliana Marie Prikler 2022-08-25 10:30 ` Efraim Flashner 2022-08-25 20:04 ` Philip McGrath 2022-08-26 12:01 ` Liliana Marie Prikler 2022-08-27 18:08 ` Philip McGrath 2022-08-27 18:58 ` Liliana Marie Prikler 2022-08-27 19:54 ` Philip McGrath 2022-08-27 21:18 ` Liliana Marie Prikler 2022-08-27 21:28 ` Philip McGrath 2022-08-27 22:26 ` Liliana Marie Prikler 2022-08-25 8:54 ` [bug#57050] [PATCH v3 08/14] gnu: racket: Update to 8.6 Philip McGrath 2022-08-25 9:14 ` Liliana Marie Prikler 2022-08-25 10:39 ` Efraim Flashner 2022-08-25 8:54 ` [bug#57050] [PATCH v3 09/14] gnu: chez-scheme: Make bootfiles regular inputs Philip McGrath 2022-08-25 8:54 ` [bug#57050] [PATCH v3 10/14] gnu: chez-scheme-for-racket: Support cross-compilation Philip McGrath 2022-08-25 8:54 ` [bug#57050] [PATCH v3 11/14] gnu: racket: Support cross-compiling the VM packages Philip McGrath 2022-08-25 8:54 ` [bug#57050] [PATCH v3 12/14] gnu: chez-scheme-for-racket: Suport all systems Philip McGrath 2022-08-25 9:24 ` Liliana Marie Prikler 2022-08-25 10:50 ` Efraim Flashner 2022-08-25 20:17 ` Philip McGrath 2022-08-25 8:54 ` [bug#57050] [PATCH v3 13/14] gnu: racket-vm-bc: Add workaround for ppc64le Philip McGrath 2022-08-25 8:54 ` [bug#57050] [PATCH v3 14/14] gnu: racket: Use Racket CS on all systems Philip McGrath 2022-08-25 9:17 ` Liliana Marie Prikler 2022-08-26 21:15 ` [bug#57050] [PATCH v3 00/14] gnu: Update Racket to 8.6. Add Zuo Thiago Jung Bauermann via Guix-patches via 2022-08-27 18:55 ` [bug#57050] [PATCH v4 " Philip McGrath 2022-08-27 18:55 ` [bug#57050] [PATCH v4 01/14] gnu: stex: Update to 1.2.2-2.afa6075 Philip McGrath 2022-08-27 18:55 ` [bug#57050] [PATCH v4 02/14] gnu: stex: Fix read-only gifs and math directories Philip McGrath 2022-08-27 18:55 ` [bug#57050] [PATCH v4 03/14] etc: teams: Add racket team Philip McGrath 2022-08-27 18:55 ` [bug#57050] [PATCH v4 04/14] etc: teams: Add entry for Philip McGrath Philip McGrath 2022-08-27 18:55 ` [bug#57050] [PATCH v4 05/14] gnu: racket: Adjust patch for "/bin/sh" in rktio Philip McGrath 2022-08-27 18:55 ` [bug#57050] [PATCH v4 06/14] gnu: chez-scheme: Fix use of "/bin/sh" Philip McGrath 2022-08-27 18:55 ` [bug#57050] [PATCH v4 07/14] gnu: Add Zuo Philip McGrath 2022-08-27 18:55 ` [bug#57050] [PATCH v4 08/14] gnu: racket: Update to 8.6 Philip McGrath 2022-08-27 19:21 ` Liliana Marie Prikler 2022-08-27 20:30 ` Philip McGrath 2022-08-27 18:55 ` [bug#57050] [PATCH v4 09/14] gnu: chez-scheme: Make bootfiles regular inputs Philip McGrath 2022-08-27 18:55 ` [bug#57050] [PATCH v4 10/14] gnu: chez-scheme-for-racket: Support cross-compilation Philip McGrath 2022-08-27 18:55 ` [bug#57050] [PATCH v4 11/14] gnu: racket: Support cross-compiling the VM packages Philip McGrath 2022-08-27 18:55 ` [bug#57050] [PATCH v4 12/14] gnu: chez-scheme-for-racket: Support all systems Philip McGrath 2022-08-27 18:55 ` [bug#57050] [PATCH v4 13/14] gnu: racket-vm-bc: Add workaround for ppc64le Philip McGrath 2022-08-27 18:55 ` [bug#57050] [PATCH v4 14/14] gnu: racket: Use Racket CS on all systems Philip McGrath 2022-09-04 20:53 ` bug#57050: [PATCH 0/6] gnu: Update Racket to 8.6. Add Zuo Ludovic Courtès 2022-08-11 11:08 ` [bug#57050] [PATCH v2 05/13] gnu: racket: Update to 8.6 Philip McGrath 2022-08-11 11:44 ` Liliana Marie Prikler 2022-08-11 22:40 ` Philip McGrath 2022-08-12 6:34 ` Liliana Marie Prikler 2022-08-22 8:41 ` Efraim Flashner 2022-08-22 18:56 ` Philip McGrath 2022-08-11 11:08 ` [bug#57050] [PATCH v2 06/13] gnu: chez-scheme: Bootfiles should not be native inputs Philip McGrath 2022-08-11 11:47 ` Liliana Marie Prikler 2022-08-11 22:45 ` Philip McGrath 2022-08-12 4:21 ` Liliana Marie Prikler 2022-08-11 11:08 ` [bug#57050] [PATCH v2 07/13] gnu: chez-scheme-for-racket: Support cross-compilation Philip McGrath 2022-08-11 11:56 ` Liliana Marie Prikler 2022-08-11 22:49 ` Philip McGrath 2022-08-11 11:08 ` [bug#57050] [PATCH v2 08/13] gnu: racket: Support cross-compiling the VM packages Philip McGrath 2022-08-11 11:58 ` Liliana Marie Prikler 2022-08-11 23:23 ` Philip McGrath 2022-08-11 11:08 ` [bug#57050] [PATCH v2 09/13] gnu: chez-scheme-for-racket: Suport all systems Philip McGrath 2022-08-11 12:02 ` Liliana Marie Prikler 2022-08-11 23:25 ` Philip McGrath 2022-08-11 11:08 ` [bug#57050] [PATCH v2 10/13] gnu: racket-vm-bc: Add workaround for ppc64le Philip McGrath 2022-08-11 11:08 ` [bug#57050] [PATCH v2 11/13] gnu: racket: Use Racket CS on all systems Philip McGrath 2022-08-11 12:03 ` Liliana Marie Prikler 2022-08-11 11:08 ` [bug#57050] [PATCH v2 12/13] etc: teams: Add racket team Philip McGrath 2022-08-11 12:11 ` Liliana Marie Prikler 2022-08-11 11:08 ` [bug#57050] [PATCH v2 13/13] etc: teams: Add entry for Philip McGrath Philip McGrath 2022-08-13 17:43 ` [bug#57050] [PATCH v2 00/13] gnu: Update Racket to 8.6. Add Zuo Thiago Jung Bauermann via Guix-patches via 2022-08-15 5:47 ` [bug#57050] [RFC PATCH] gnu: racket-vm-cs: Avoid 'configure' bug with '--enable-racket' Philip McGrath 2022-08-15 6:12 ` Philip McGrath 2022-08-15 19:54 ` [bug#57050] [RFC PATCH v2] gnu: racket: Backport fix for powerpc64le Philip McGrath 2022-08-19 0:51 ` Thiago Jung Bauermann via Guix-patches via 2022-08-19 10:10 ` Maxime Devos
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/guix.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.