[PATCH 00/11] Update Racket to 8.4. Adjust Chez Scheme

  • Done
  • quality assurance status badge
Details
7 participants
  • Liliana Marie Prikler
  • Liliana Marie Prikler
  • Ludovic Courtès
  • Maxime Devos
  • Philip McGrath
  • Philip McGrath
  • zimoun
Owner
unassigned
Submitted by
Philip McGrath
Severity
normal
Merged with
P
P
Philip McGrath wrote on 8 Feb 2022 16:13
[RFC PATCH 0/9] Update Racket to 8.4. Adjust Chez Scheme packages.
(address . guix-patches@gnu.org)
20220208151316.1897345-1-philip@philipmcgrath.com
Racket 8.4 hasn't been released yet (expect it in a matter of days), but I
wanted to solicit feedback on these changes early.

On the Racket side of things, discussions upstream and with other distribution
packagers have clarified what a ``minimal Racket'' package ought to consist
of, which in turn suggested a nice new boundary between the lowest-level
Racket VM packages, which are concerned with bootstrapping and platform
support, and a more uniform use of layered and tethered installations for both
the 'racket-minimal' and 'racket' packages. I've also started getting the
sources for the other main-distribution Racket packages directly from their
respective repositories, rather than extracting them from the bundled
tarballs. All in all, it's a few steps closer to the goal of a build system
for Racket packages.

For Chez Scheme, I set out to package Racket's variant of Chez Scheme---which
supports architectures not yet supported upstream, e.g. aarch64---and to share
more between the upstream and Racket packages. I also tweaked various things I
found along the way: hopefully some are clear improvements, though there are
some prime opportunities for bikeshedding about naming things.

Let me know what you think!

-Philip

Philip McGrath (9):
gnu: chez-scheme: Move to (gnu packages chez-and-racket-bootstrap).
gnu: chez-scheme: Use "lib/chez-scheme" for search path.
gnu: chez-scheme: Use shared zlib and lz4.
gnu: chez-and-racket-bootstrap: Add utilities for Chez machine types.
gnu: Add stex.
gnu: Add chez-nanopass.
gnu: chez-scheme: Explicitly package bootstrap bootfiles.
gnu: Add chez-scheme-racket-variant.
gnu: racket: Update to 8.3.900.

gnu/local.mk | 5 +-
gnu/packages/chez-and-racket-bootstrap.scm | 1108 ++++++++++++
gnu/packages/chez.scm | 628 +++----
gnu/packages/emacs-xyz.scm | 4 +-
gnu/packages/loko.scm | 4 +-
.../racket-enable-scheme-backport.patch | 465 +++++
...acket-gui-tethered-launcher-backport.patch | 26 +
gnu/packages/racket.scm | 1552 +++++++++++------
8 files changed, 2850 insertions(+), 942 deletions(-)
create mode 100644 gnu/packages/chez-and-racket-bootstrap.scm
create mode 100644 gnu/packages/patches/racket-enable-scheme-backport.patch
create mode 100644 gnu/packages/patches/racket-gui-tethered-launcher-backport.patch

--
2.32.0
P
P
Philip McGrath wrote on 8 Feb 2022 16:18
[RFC PATCH 1/9] gnu: chez-scheme: Move to (gnu packages chez-and-racket-bootstrap).
(address . 53878@debbugs.gnu.org)(name . Philip McGrath)(address . philip@philipmcgrath.com)
20220208151857.1900389-1-philip@philipmcgrath.com
* gnu/packages/chez.scm (nanopass, stex, chez-scheme): Move to ...
* gnu/packages/chez-and-racket-bootstrap.scm: ... this new file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
* gnu/packages/emacs-xyz.scm: Adjust imports accordingly.
* gnu/packages/loko.scm: Likewise.
* gnu/packages/racket.scm: Likewise.
---
gnu/local.mk | 1 +
gnu/packages/chez-and-racket-bootstrap.scm | 278 +++++++++++++++++++++
gnu/packages/chez.scm | 225 +----------------
gnu/packages/emacs-xyz.scm | 2 +-
gnu/packages/loko.scm | 2 +-
gnu/packages/racket.scm | 2 +-
6 files changed, 283 insertions(+), 227 deletions(-)
create mode 100644 gnu/packages/chez-and-racket-bootstrap.scm

Toggle diff (436 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index f14daf2edd..e3104fc0b6 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -144,6 +144,7 @@ GNU_SYSTEM_MODULES = \
%D%/packages/certs.scm \
%D%/packages/check.scm \
%D%/packages/chemistry.scm \
+ %D%/packages/chez-and-racket-bootstrap.scm \
%D%/packages/chez.scm \
%D%/packages/chicken.scm \
%D%/packages/chromium.scm \
diff --git a/gnu/packages/chez-and-racket-bootstrap.scm b/gnu/packages/chez-and-racket-bootstrap.scm
new file mode 100644
index 0000000000..f102b099fb
--- /dev/null
+++ b/gnu/packages/chez-and-racket-bootstrap.scm
@@ -0,0 +1,278 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2016 Federico Beffa <beffa@fbengineering.ch>
+;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2017, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2019 Brett Gilio <brettg@gnu.org>
+;;; Copyright © 2020 Brendan Tildesley <mail@brendan.scot>
+;;; Copyright © 2021, 2022 Philip McGrath <philip@philipmcgrath.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages chez-and-racket-bootstrap)
+ #:use-module (guix packages)
+ #:use-module (guix download)
+ #:use-module (guix git-download)
+ #:use-module (guix utils)
+ #:use-module (guix gexp)
+ #:use-module (ice-9 match)
+ #:use-module (srfi srfi-1)
+ #:use-module (guix build-system gnu)
+ #:use-module (gnu packages)
+ #:use-module (gnu packages compression)
+ #:use-module (gnu packages ghostscript)
+ #:use-module (gnu packages linux)
+ #:use-module (gnu packages ncurses)
+ #:use-module (gnu packages netpbm)
+ #:use-module (gnu packages tex)
+ #:use-module (gnu packages xorg)
+ #:use-module ((guix licenses)
+ #:prefix license:))
+
+;; Commentary:
+;;
+;; Alphabetically and chronologically, Chez comes before Racket.
+;;
+;; The bootstrapping paths for Chez Scheme and Racket are closely
+;; entwined. Racket CS (the default Racket implementation) is based on (a fork
+;; of) Chez Scheme. Racket's variant of Chez Scheme shares sources for
+;; nanopass and stex with upstream Chez Scheme.
+;;
+;; Racket's variant of Chez Scheme can be bootstrapped by an older Racket
+;; implementation, Racket BC, which can be bootstrapped from C. Porting that
+;; code to work with upstream Chez Scheme (or finding an old version that
+;; does) is our best hope for some day bootstrapping upstream Chez Scheme from
+;; source.
+;;
+;; Putting the relevant definitions together in this module avoids having to
+;; work around dependency cycles.
+;;
+;; Code:
+
+(define nanopass
+ (let ((version "1.9.2"))
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/nanopass/nanopass-framework-scheme")
+ (commit (string-append "v" version))))
+ (sha256 (base32 "16vjsik9rrzbabbhbxbaha51ppi3f9n8rk59pc6zdyffs0vziy4i"))
+ (file-name (git-file-name "nanopass" version)))))
+
+(define stex
+ ;; 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")
+ (version "1.2.2")
+ (version (git-version version "1" commit)))
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/dybvig/stex")
+ (commit commit)))
+ (sha256 (base32 "01jnvw8qw33gnpzwrakwhsr05h6b609lm180jnspcrb7lds2p23d"))
+ (file-name (git-file-name "stex" version)))))
+
+(define-public chez-scheme
+ (package
+ (name "chez-scheme")
+ (version "9.5.6")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/cisco/ChezScheme")
+ (commit (string-append "v" version))))
+ (sha256
+ (base32 "07s433hn1z2slfc026sidrpzxv3a8narcd40qqr1xrpb9012xdky"))
+ (file-name (git-file-name name version))
+ (snippet
+ ;; Remove bundled libraries.
+ (with-imported-modules '((guix build utils))
+ #~(begin
+ (use-modules (guix build utils))
+ (for-each (lambda (dir)
+ (when (directory-exists? dir)
+ (delete-file-recursively dir)))
+ '("stex"
+ "nanopass"
+ "lz4"
+ "zlib")))))))
+ (build-system gnu-build-system)
+ (inputs
+ `(("libuuid" ,util-linux "lib")
+ ("zlib" ,zlib)
+ ("zlib:static" ,zlib "static")
+ ("lz4" ,lz4)
+ ("lz4:static" ,lz4 "static")
+ ;; for expeditor:
+ ("ncurses" ,ncurses)
+ ;; for X11 clipboard support in expeditor:
+ ;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
+ ("libx11" ,libx11)))
+ (native-inputs
+ `(("nanopass" ,nanopass) ; source only
+ ;; for docs
+ ("stex" ,stex)
+ ("xorg-rgb" ,xorg-rgb)
+ ("texlive" ,(texlive-updmap.cfg (list texlive-dvips-l3backend
+ texlive-epsf
+ texlive-fonts-ec
+ texlive-oberdiek)))
+ ("ghostscript" ,ghostscript)
+ ("netpbm" ,netpbm)))
+ (native-search-paths
+ (list (search-path-specification
+ (variable "CHEZSCHEMELIBDIRS")
+ (files (list (string-append "lib/csv" version "-site"))))))
+ (outputs '("out" "doc"))
+ (arguments
+ `(#:modules
+ ((guix build gnu-build-system)
+ (guix build utils)
+ (ice-9 ftw)
+ (ice-9 match))
+ #:test-target "test"
+ #:configure-flags
+ '("--threads") ;; TODO when we fix armhf, it doesn't support --threads
+ #:phases
+ (modify-phases %standard-phases
+ ;; put these where configure expects them to be
+ (add-after 'unpack 'unpack-nanopass+stex
+ (lambda* (#:key native-inputs inputs #:allow-other-keys)
+ (for-each (lambda (dep)
+ (define src
+ (assoc-ref (or native-inputs inputs) dep))
+ (copy-recursively src dep
+ #:keep-mtime? #t))
+ '("nanopass" "stex"))))
+ ;; NOTE: the custom Chez 'configure' script doesn't allow
+ ;; unrecognized flags, such as those automatically added
+ ;; by `gnu-build-system`.
+ (replace 'configure
+ (lambda* (#:key inputs outputs
+ (configure-flags '())
+ #:allow-other-keys)
+ (let* ((zlib-static (assoc-ref inputs "zlib:static"))
+ (lz4-static (assoc-ref inputs "lz4:static"))
+ (out (assoc-ref outputs "out"))
+ ;; add flags which are always required:
+ (flags (cons*
+ (string-append "--installprefix=" out)
+ (string-append "ZLIB=" zlib-static "/lib/libz.a")
+ (string-append "LZ4=" lz4-static "/lib/liblz4.a")
+ ;; Guix will do compress man pages,
+ ;; and letting Chez try causes an error
+ "--nogzip-man-pages"
+ configure-flags)))
+ (format #t "configure flags: ~s~%" flags)
+ ;; Some makefiles (for tests) don't seem to propagate CC
+ ;; properly, so we take it out of their hands:
+ (setenv "CC" ,(cc-for-target))
+ (setenv "HOME" "/tmp")
+ (apply invoke
+ "./configure"
+ flags))))
+ ;; The binary file name is called "scheme" as is the one from MIT/GNU
+ ;; Scheme. We add a symlink to use in case both are installed.
+ (add-after 'install 'install-symlink
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (bin (string-append out "/bin"))
+ (lib (string-append out "/lib"))
+ (name "chez-scheme"))
+ (symlink (string-append bin "/scheme")
+ (string-append bin "/" name))
+ (map (lambda (file)
+ (symlink file (string-append (dirname file)
+ "/" name ".boot")))
+ (find-files lib "scheme.boot")))))
+ ;; Building explicitly lets us avoid using substitute*
+ ;; to re-write makefiles.
+ (add-after 'install-symlink 'prepare-stex
+ (lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
+ (let* ((stex+version
+ (strip-store-file-name
+ (assoc-ref (or native-inputs inputs) "stex")))
+ ;; Eventually we want to install stex as a real
+ ;; package so it's reusable. For now:
+ (stex-output "/tmp")
+ (doc-dir (string-append stex-output
+ "/share/doc/"
+ stex+version)))
+ (with-directory-excursion "stex"
+ (invoke "make"
+ "install"
+ (string-append "LIB="
+ stex-output
+ "/lib/"
+ stex+version)
+ (string-append "Scheme="
+ (assoc-ref outputs "out")
+ "/bin/scheme"))
+ (for-each (lambda (pth)
+ (install-file pth doc-dir))
+ '("ReadMe" ; includes the license
+ "doc/stex.html"
+ "doc/stex.css"
+ "doc/stex.pdf"))))))
+ ;; Building the documentation requires stex and a running scheme.
+ ;; FIXME: this is probably wrong for cross-compilation
+ (add-after 'prepare-stex 'install-doc
+ (lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
+ (let* ((chez+version (strip-store-file-name
+ (assoc-ref outputs "out")))
+ (stex+version
+ (strip-store-file-name
+ (assoc-ref (or native-inputs inputs) "stex")))
+ (scheme (string-append (assoc-ref outputs "out")
+ "/bin/scheme"))
+ ;; see note on stex-output in phase build-stex, above:
+ (stexlib (string-append "/tmp"
+ "/lib/"
+ stex+version))
+ (doc-dir (string-append (assoc-ref outputs "doc")
+ "/share/doc/"
+ chez+version)))
+ (define* (stex-make #:optional (suffix ""))
+ (invoke "make"
+ "install"
+ (string-append "Scheme=" scheme)
+ (string-append "STEXLIB=" stexlib)
+ (string-append "installdir=" doc-dir suffix)))
+ (with-directory-excursion "csug"
+ (stex-make "/csug"))
+ (with-directory-excursion "release_notes"
+ (stex-make "/release_notes"))
+ (with-directory-excursion doc-dir
+ (symlink "release_notes/release_notes.pdf"
+ "release_notes.pdf")
+ (symlink "csug/csug9_5.pdf"
+ "csug.pdf"))))))))
+ ;; Chez Scheme does not have a MIPS backend.
+ ;; FIXME: Debian backports patches to get armhf working.
+ ;; We should too. It is the Chez machine type arm32le
+ ;; (no threaded version upstream yet, though there is in
+ ;; Racket's fork), more specifically (per the release notes) ARMv6.
+ (supported-systems (fold delete %supported-systems
+ '("mips64el-linux" "armhf-linux")))
+ (home-page "https://cisco.github.io/ChezScheme/")
+ (synopsis "R6RS Scheme compiler and run-time")
+ (description
+ "Chez Scheme is a compiler and run-time system for the language of the
+Revised^6 Report on Scheme (R6RS), with numerous extensions. The compiler
+generates native code for each target processor, with support for x86, x86_64,
+and 32-bit PowerPC architectures.")
+ (license license:asl2.0)))
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 47904e7b4e..caf61a95f5 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -4,7 +4,6 @@
;;; Copyright © 2017, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2019 Brett Gilio <brettg@gnu.org>
;;; Copyright © 2020 Brendan Tildesley <mail@brendan.scot>
-;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -32,234 +31,12 @@ (define-module (gnu packages chez)
#:use-module (guix utils)
#:use-module (guix gexp)
#:use-module (guix build-system gnu)
- #:use-module (gnu packages compression)
- #:use-module (gnu packages ncurses)
+ #:use-module (gnu packages chez-and-racket-bootstrap)
#:use-module (gnu packages ghostscript)
- #:use-module (gnu packages linux)
- #:use-module (gnu packages netpbm)
#:use-module (gnu packages tex)
- #:use-module (gnu packages compression)
- #:use-module (gnu packages image)
- #:use-module (gnu packages xorg)
#:use-module (ice-9 match)
#:use-module (srfi srfi-1))
-(define nanopass
- (let ((version "1.9.2"))
- (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/nanopass/nanopass-framework-scheme")
- (commit (string-append "v" version))))
- (sha256 (base32 "16vjsik9rrzbabbhbxbaha51ppi3f9n8rk59pc6zdyffs0vziy4i"))
- (file-name (git-file-name "nanopass" version)))))
-
-(define stex
- ;; 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")
- (version "1.2.2")
- (version (git-version version "1" commit)))
- (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/dybvig/stex")
- (commit commit)))
- (sha256 (base32 "01jnvw8qw33gnpzwrakwhsr05h6b609lm180jnspcrb7lds2p23d"))
- (file-name (git-file-name "stex" version)))))
-
-(define-public chez-scheme
- (package
- (name "chez-scheme")
- (version "9.5.6")
- (source
- (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/cisco/ChezScheme")
- (commit (string-append "v" version))))
- (sha256
- (base32 "07s433hn1z2slfc026sidrpzxv3a8narcd40qqr1xrpb9012xdky"))
- (file-name (git-file-name name version))
- (snippet
- ;; Remove bundled libraries.
- (with-imported-modules '((guix build utils))
- #~(begin
- (use-modules (guix build utils))
- (for-each (lambda (dir)
- (when (directory-exists? dir)
- (delete-file-recursively dir)))
- '("stex"
- "nanopass"
- "lz4"
- "zlib")))))))
- (build-system gnu-build-system)
- (inputs
- `(("libuuid" ,util-linux "lib")
- ("zlib" ,zlib)
- ("zlib:static" ,zlib "static")
- ("lz4" ,lz4)
- ("lz4:static" ,lz4 "static")
- ;; for expeditor:
- ("ncurses" ,ncurses)
- ;; for X11 clipboard support in expeditor:
- ;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
- ("libx11" ,libx11)))
- (native-inputs
- `(("nanopass" ,nanopass) ; source only
- ;; for docs
- ("stex" ,stex)
- ("xorg-rgb" ,xorg-rgb)
- ("texlive" ,(texlive-updmap.cfg (list texlive-dvips-l3backend
- texlive-epsf
- texlive-fonts-ec
- texlive-oberdiek)))
- ("ghostscript" ,ghostscript)
- ("netpbm" ,netpbm)))
- (native-search-paths
- (list (search-path-specification
- (variable "CHEZSCHEMELIBDIRS")
- (files (list (string-append "lib/csv" version "-site"))))))
- (outputs '("out" "doc"))
- (arguments
- `(#:modules
- ((guix build gnu-build-system)
- (guix build utils)
- (ice-9 ftw)
- (ice-9 match))
- #:test-target "test"
- #:configure-flags
- '("--threads") ;; TODO when we fix armhf, it doesn't support --threads
- #:phases
- (modify-phases %standard-phases
- ;; put these where configure expects them to be
- (add-after 'unpack 'unpack-nanopass+stex
- (lambda* (#:key native-inputs inputs #:allow-other-keys)
- (for-each (lambda (dep)
- (define src
- (assoc-ref (or native-inputs inputs) dep))
- (copy-recursively src dep
- #:keep-mtime? #t))
- '("nanopass" "stex"))))
- ;; NOTE: the custom Chez 'configure' script doesn't allow
- ;; unrecognized flags, such as those automatically added
- ;; by `gnu-build-system`.
- (replace 'configure
- (lambda* (#:key inputs outputs
- (configure-flags '())
- #:allow-other-keys)
- (let* ((zlib-static (assoc-ref inputs "zlib:static"))
- (lz4-static (assoc-ref inputs "lz4:static"))
- (out (assoc-ref outputs "out"))
- ;; add flags which are always required:
- (flags (cons*
- (string-append "--installprefix=" out)
- (string-append "ZLIB=" zlib-static "/lib/lib
This message was truncated. Download the full message here.
P
P
Philip McGrath wrote on 8 Feb 2022 16:18
[RFC PATCH 2/9] gnu: chez-scheme: Use "lib/chez-scheme" for search path.
(address . 53878@debbugs.gnu.org)(name . Philip McGrath)(address . philip@philipmcgrath.com)
20220208151857.1900389-2-philip@philipmcgrath.com
There does not seem to be any widely accepted standard path to use for
"CHEZSCHEMELIBDIRS". Using a path without a version number in it avoids
having to compute the actual path everywhere, which would be especially
unpleasant when support is added for the Racket variant of Chez Scheme,
which always has a different version number than upstream.

* gnu/packages/chez-and-racket-bootstrap.scm
(chez-scheme)[native-search-paths]: Change to use "lib/chez-scheme"
instead of "lib/csvX.Y.Z-site" for "CHEZSCHEMELIBDIRS".
* gnu/packages/chez.scm (chez-srfi, chez-web, chez-sockets,
chez-matchable, chez-irregex, chez-fmt, chez-mit, chez-scmutils): Update
accordingly. Also, remove input labels and use G-expressions.
---
gnu/packages/chez-and-racket-bootstrap.scm | 2 +-
gnu/packages/chez.scm | 373 +++++++++++----------
2 files changed, 191 insertions(+), 184 deletions(-)

Toggle diff (401 lines)
diff --git a/gnu/packages/chez-and-racket-bootstrap.scm b/gnu/packages/chez-and-racket-bootstrap.scm
index f102b099fb..1ed4631ced 100644
--- a/gnu/packages/chez-and-racket-bootstrap.scm
+++ b/gnu/packages/chez-and-racket-bootstrap.scm
@@ -136,7 +136,7 @@ (define-public chez-scheme
(native-search-paths
(list (search-path-specification
(variable "CHEZSCHEMELIBDIRS")
- (files (list (string-append "lib/csv" version "-site"))))))
+ (files (list (string-append "lib/chez-scheme"))))))
(outputs '("out" "doc"))
(arguments
`(#:modules
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index caf61a95f5..54bbee7923 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -37,6 +37,28 @@ (define-module (gnu packages chez)
#:use-module (ice-9 match)
#:use-module (srfi srfi-1))
+
+;; Help function for Chez Scheme to add the current path to
+;; CHEZSCHEMELIBDIRS.
+(define chez-configure
+ #~(lambda _
+ (let ((chez-env (getenv "CHEZSCHEMELIBDIRS")))
+ (setenv "CHEZSCHEMELIBDIRS"
+ (if chez-env
+ (string-append ".:" chez-env)
+ ".")))))
+
+;; Help function to define make flags for some Chez Scheme custom make
+;; files.
+(define (chez-make-flags name version)
+ #~(let ((out #$output))
+ (list
+ ;; Set 'schemedir' so that libraries are installed in
+ ;; 'lib/chez-scheme' like Chez's 'native-search-paths' expects.
+ (string-append "schemedir=" out "/lib/chez-scheme")
+ (string-append "PREFIX=" out)
+ (string-append "DOCDIR=" out "/share/doc/" #$name "-" #$version))))
+
(define-public chez-srfi
(package
(name "chez-srfi")
@@ -54,13 +76,11 @@ (define-public chez-srfi
(native-inputs
(list chez-scheme))
(arguments
- `(#:make-flags (let ((out (assoc-ref %outputs "out")))
- (list (string-append "PREFIX=" out)
- "CHEZ=chez-scheme --libdirs ./"
- (string-append "chezversion=" ,(package-version chez-scheme))))
- #:test-target "test"
- #:phases (modify-phases %standard-phases
- (delete 'configure))))
+ (list #:make-flags (chez-make-flags name version)
+ #:test-target "test"
+ #:phases #~(modify-phases %standard-phases
+ (replace 'configure
+ #$chez-configure))))
(home-page "https://github.com/fedeinthemix/chez-srfi")
(synopsis "SRFI libraries for Chez Scheme")
(description
@@ -85,42 +105,48 @@ (define-public chez-web
(base32 "1dq25qygyncbfq4kwwqqgyyakfqjwhp5q23vrf3bff1p66nyfl3b"))))
(build-system gnu-build-system)
(native-inputs
- `(("chez-scheme" ,chez-scheme)
- ("ghostscript" ,ghostscript)
- ("texlive" ,(texlive-updmap.cfg (list texlive-oberdiek
- texlive-epsf
- texlive-metapost
- texlive-charter
- texlive-pdftex
- texlive-context
- texlive-cm
- texlive-tex-plain)))))
+ (list chez-scheme
+ ghostscript
+ ;; FIXME: This package fails to build with the error:
+ ;; mktexpk: don't know how to create bitmap font for bchr8r
+ ;; Replacing the following with `texlive` fixes it.
+ ;; What is missing?
+ (texlive-updmap.cfg (list texlive-oberdiek
+ texlive-epsf
+ texlive-metapost
+ texlive-charter
+ texlive-pdftex
+ texlive-context
+ texlive-cm
+ texlive-tex-plain))))
(arguments
- `(#:make-flags (list (string-append "PREFIX=" %output)
- (string-append "DOCDIR=" %output "/share/doc/"
- ,name "-" ,version)
- (string-append "LIBDIR=" %output "/lib/chezweb")
- (string-append "TEXDIR=" %output "/share/texmf-local"))
- #:tests? #f ; no tests
- #:phases
- (modify-phases %standard-phases
- ;; This package has a custom "bootstrap" script that
- ;; is meant to be run from the Makefile.
- (delete 'bootstrap)
- (replace 'configure
- (lambda* _
- (copy-file "config.mk.template" "config.mk")
- (substitute* "tangleit"
- (("\\./cheztangle\\.ss" all)
- (string-append "chez-scheme --program " all)))
- (substitute* "weaveit"
- (("mpost chezweb\\.mp")
- "mpost --tex=tex chezweb.mp")
- (("\\./chezweave" all)
- (string-append "chez-scheme --program " all)))
- (substitute* "installit"
- (("-g \\$GROUP -o \\$OWNER") ""))
- #t)))))
+ (list
+ #:make-flags
+ #~(list (string-append "PREFIX=" #$output)
+ (string-append "DOCDIR=" #$output "/share/doc/"
+ #$name "-" #$version)
+ ;; lib/chez-scheme/chezweb ???
+ (string-append "LIBDIR=" #$output "/lib/chezweb")
+ (string-append "TEXDIR=" #$output "/share/texmf-local"))
+ #:tests? #f ; no tests
+ #:phases
+ #~(modify-phases %standard-phases
+ ;; This package has a custom "bootstrap" script that
+ ;; is meant to be run from the Makefile.
+ (delete 'bootstrap)
+ (replace 'configure
+ (lambda* _
+ (copy-file "config.mk.template" "config.mk")
+ (substitute* "tangleit"
+ (("\\./cheztangle\\.ss" all)
+ (string-append "scheme --program " all)))
+ (substitute* "weaveit"
+ (("mpost chezweb\\.mp")
+ "mpost --tex=tex chezweb.mp")
+ (("\\./chezweave" all)
+ (string-append "scheme --program " all)))
+ (substitute* "installit"
+ (("-g \\$GROUP -o \\$OWNER") "")))))))
(home-page "https://github.com/arcfide/ChezWEB")
(synopsis "Hygienic Literate Programming for Chez Scheme")
(description "ChezWEB is a system for doing Knuthian style WEB
@@ -144,95 +170,74 @@ (define-public chez-sockets
(base32 "1n5fbwwz51fdzvjackgmnsgh363g9inyxv7kmzi0469cwavwcx5m"))))
(build-system gnu-build-system)
(native-inputs
- `(("chez-scheme" ,chez-scheme)
- ("chez-web" ,chez-web)
- ("texlive" ,(texlive-updmap.cfg (list texlive-pdftex)))))
+ (list chez-scheme
+ chez-web
+ (texlive-updmap.cfg (list texlive-pdftex))))
(arguments
- `(#:tests? #f ; no tests
- #:phases
- (modify-phases %standard-phases
- (replace 'configure
- (lambda* (#:key outputs inputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (chez-web (assoc-ref inputs "chez-web"))
- (chez (assoc-ref inputs "chez-scheme"))
- (chez-h (dirname (car (find-files chez "scheme\\.h")))))
- (substitute* "Makefile"
- (("(SCHEMEH=).*$" all var)
- (string-append var chez-h)))
- #t)))
- (add-before 'build 'tangle
- (lambda* (#:key inputs #:allow-other-keys)
- (setenv "TEXINPUTS"
- (string-append
- (getcwd) ":"
- (assoc-ref inputs "chez-web") "/share/texmf-local/tex/generic:"
- ":"))
- ;; just using "make" tries to build the .c files before
- ;; they are created.
- (and (invoke "make" "sockets")
- (invoke "make"))))
- (replace 'build
- (lambda* (#:key outputs inputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (chez-site (string-append out "/lib/csv"
- ,(package-version chez-scheme)
- "-site/arcfide")))
- ;; make sure Chez Scheme can find the shared libraries.
- (substitute* "sockets.ss"
- (("(load-shared-object) \"(socket-ffi-values\\.[sd][oy].*)\""
- all cmd so)
- (string-append cmd " \"" chez-site "/" so "\""))
- (("sockets-stub\\.[sd][oy].*" all)
- (string-append chez-site "/" all)))
- ;; to compile chez-sockets, the .so files must be
- ;; installed (because of the absolute path we
- ;; inserted above).
- (for-each (lambda (f d) (install-file f d))
- '("socket-ffi-values.so" "sockets-stub.so")
- (list chez-site chez-site))
- (zero? (system "echo '(compile-file \"sockets.sls\")' | scheme -q")))))
- (replace 'install
- (lambda* (#:key outputs inputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (lib (string-append out "/lib/chez-sockets"))
- (doc (string-append out "/share/doc/" ,name "-" ,version))
- (chez-site (string-append out "/lib/csv"
- ,(package-version chez-scheme)
- "-site/arcfide")))
- (for-each (lambda (f d) (install-file f d))
- '("sockets.pdf" "sockets.so")
- (list doc chez-site))
- #t))))))
+ (list
+ #:tests? #f ; no tests
+ #:phases
+ #~(modify-phases %standard-phases
+ (replace 'configure
+ (lambda* (#:key native-inputs inputs #:allow-other-keys)
+ (let* ((scheme (search-input-file (or native-inputs inputs)
+ "/bin/scheme"))
+ (lib (string-append (dirname scheme) "/../lib"))
+ (header-file (car (find-files lib "scheme\\.h")))
+ (include-dir (dirname header-file)))
+ (substitute* "Makefile"
+ (("(SCHEMEH=).*$" _ var)
+ (string-append var include-dir))))))
+ (add-before 'build 'tangle
+ (lambda* (#:key inputs #:allow-other-keys)
+ (setenv "TEXINPUTS"
+ (string-append
+ (getcwd) ":"
+ (assoc-ref inputs "chez-web")
+ "/share/texmf-local/tex/generic:"
+ ":"))
+ ;; just using "make" tries to build the .c files before
+ ;; they are created.
+ (and (invoke "make" "sockets")
+ (invoke "make"))))
+ (replace 'build
+ (lambda args
+ (let ((chez-site (string-append #$output
+ "/lib/chez-scheme/arcfide")))
+ ;; make sure Chez Scheme can find the shared libraries.
+ (substitute* "sockets.ss"
+ (("(object \")(socket-ffi-values\\.[sd][oy][^\"]*)(\")"
+ _ pre file post)
+ (string-append pre chez-site "/" file post))
+ (("(\")(sockets-stub\\.[sd][oy][^\"]*)(\")"
+ _ pre file post)
+ (string-append pre chez-site "/" file post)))
+ ;; to compile chez-sockets, the .so files must be
+ ;; installed (because of the absolute path we
+ ;; inserted above).
+ (for-each (lambda (f)
+ (install-file f chez-site))
+ '("socket-ffi-values.so"
+ "sockets-stub.so"))
+ (invoke "bash"
+ "-c"
+ (format #f "echo '~s' | scheme -q"
+ '(compile-file "sockets.sls"))))))
+ (replace 'install
+ (lambda args
+ (install-file "sockets.so"
+ (string-append #$output
+ "/lib/chez-scheme/arcfide"))
+ (install-file "sockets.pdf"
+ (string-append #$output
+ "/share/doc/"
+ #$name "-" #$version)))))))
(home-page "https://github.com/arcfide/chez-sockets")
(synopsis "Extensible sockets library for Chez Scheme")
(description "Chez-sockets is an extensible sockets library for
Chez Scheme.")
(license expat))))
-;; Help function for Chez Scheme to add the current path to
-;; CHEZSCHEMELIBDIRS.
-(define chez-configure
- '(lambda _
- (let ((chez-env (getenv "CHEZSCHEMELIBDIRS")))
- (setenv "CHEZSCHEMELIBDIRS"
- (if chez-env
- (string-append ".:" chez-env)
- "."))
- #t)))
-
-;; Help function to define make flags for some Chez Scheme custom make
-;; files.
-(define (chez-make-flags name version)
- `(let ((out (assoc-ref %outputs "out")))
- (list
- ;; Set 'chezversion' so that libraries are installed in
- ;; 'lib/csvX.Y.Z-site' like Chez's 'native-search-paths' expects.
- (string-append "chezversion=" ,(package-version chez-scheme))
- (string-append "PREFIX=" out)
- (string-append "DOCDIR=" out "/share/doc/"
- ,name "-" ,version))))
-
(define-public chez-matchable
(package
(name "chez-matchable")
@@ -253,10 +258,11 @@ (define-public chez-matchable
(native-inputs
(list chez-scheme))
(arguments
- `(#:make-flags ,(chez-make-flags name version)
- #:test-target "test"
- #:phases (modify-phases %standard-phases
- (replace 'configure ,chez-configure))))
+ (list #:make-flags (chez-make-flags name version)
+ #:test-target "test"
+ #:phases #~(modify-phases %standard-phases
+ (replace 'configure
+ #$chez-configure))))
(synopsis "Portable hygienic pattern matcher for Scheme")
(description "This package provides a superset of the popular Scheme
@code{match} package by Andrew Wright, written in fully portable
@@ -284,10 +290,11 @@ (define-public chez-irregex
(native-inputs
(list chez-scheme))
(arguments
- `(#:make-flags ,(chez-make-flags name version)
- #:test-target "test"
- #:phases (modify-phases %standard-phases
- (replace 'configure ,chez-configure))))
+ (list #:make-flags (chez-make-flags name version)
+ #:test-target "test"
+ #:phases #~(modify-phases %standard-phases
+ (replace 'configure
+ #$chez-configure))))
(home-page "https://github.com/fedeinthemix/chez-irregex")
(synopsis "Portable regular expression library for Scheme")
(description "This package provides a portable and efficient
@@ -314,17 +321,18 @@ (define-public chez-fmt
(native-inputs
(list chez-scheme))
(arguments
- `(#:make-flags ,(chez-make-flags name version)
- #:test-target "chez-check"
- #:phases
- (modify-phases %standard-phases
- (replace 'configure ,chez-configure)
- (replace 'build
- (lambda* (#:key (make-flags '()) #:allow-other-keys)
- (apply invoke "make" "chez-build" make-flags)))
- (replace 'install
- (lambda* (#:key (make-flags '()) #:allow-other-keys)
- (apply invoke "make" "chez-install" make-flags))))))
+ (list #:make-flags (chez-make-flags name version)
+ #:test-target "chez-check"
+ #:phases
+ #~(modify-phases %standard-phases
+ (replace 'configure
+ #$chez-configure)
+ (replace 'build
+ (lambda* (#:key (make-flags '()) #:allow-other-keys)
+ (apply invoke "make" "chez-build" make-flags)))
+ (replace 'install
+ (lambda* (#:key (make-flags '()) #:allow-other-keys)
+ (apply invoke "make" "chez-install" make-flags))))))
(home-page "http://synthcode.com/scheme/fmt")
(synopsis "Combinator formatting library for Chez Scheme")
(description "This package provides a library of procedures for
@@ -354,10 +362,11 @@ (define-public chez-mit
(native-inputs
(list chez-scheme))
(arguments
- `(#:make-flags ,(chez-make-flags name version)
- #:test-target "test"
- #:phases (modify-phases %standard-phases
- (replace 'configure ,chez-configure))))
+ (list #:make-flags (chez-make-flags name version)
+ #:test-target "test"
+ #:phases #~(modify-phases %standard-phases
+ (replace 'configure
+ #$chez-configure))))
(synopsis "MIT/GNU Scheme compatibility library for Chez Scheme")
(description "This package provides a set of MIT/GNU Scheme compatibility
libraries for Chez Scheme. The main goal was to provide the functionality
@@ -386,46 +395,44 @@ (define-public chez-scmutils
(propagated-inputs
(list chez-mit chez-srfi))
(arguments
- `(#:make-flags ,(chez-make-flags name version)
- #:tests? #f ; no test suite
- #:phases
- (modify-phases %standard-phases
- (replace 'configure ,chez-configure)
- ;; Since the documentation is lacking, we install the source
- ;; code. For things to work correctly we have to replace
- ;; relative paths by absolute ones in 'include' forms. This
- ;; in turn requires us to compile the files in the final
- ;; destination.
- (delete 'build)
- (add-after 'install 'install-src
- (lambda* (#:key (make-flags '())
This message was truncated. Download the full message here.
P
P
Philip McGrath wrote on 8 Feb 2022 16:18
[RFC PATCH 3/9] gnu: chez-scheme: Use shared zlib and lz4.
(address . 53878@debbugs.gnu.org)(name . Philip McGrath)(address . philip@philipmcgrath.com)
20220208151857.1900389-3-philip@philipmcgrath.com
This change also involves building 'libkernel.a' instead of 'kernel.o'.

Support for these build options was merged upstream in 2019: see

* gnu/packages/chez-and-racket-bootstrap (chez-scheme)[inputs]: Remove
'zlib:static' and 'lz4:static'.
[arguments]: Adjust configure phase accordingly.
---
gnu/packages/chez-and-racket-bootstrap.scm | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)

Toggle diff (39 lines)
diff --git a/gnu/packages/chez-and-racket-bootstrap.scm b/gnu/packages/chez-and-racket-bootstrap.scm
index 1ed4631ced..11d570059b 100644
--- a/gnu/packages/chez-and-racket-bootstrap.scm
+++ b/gnu/packages/chez-and-racket-bootstrap.scm
@@ -114,9 +114,7 @@ (define-public chez-scheme
(inputs
`(("libuuid" ,util-linux "lib")
("zlib" ,zlib)
- ("zlib:static" ,zlib "static")
("lz4" ,lz4)
- ("lz4:static" ,lz4 "static")
;; for expeditor:
("ncurses" ,ncurses)
;; for X11 clipboard support in expeditor:
@@ -169,14 +167,14 @@ (define src
(lz4-static (assoc-ref inputs "lz4:static"))
(out (assoc-ref outputs "out"))
;; add flags which are always required:
- (flags (cons*
- (string-append "--installprefix=" out)
- (string-append "ZLIB=" zlib-static "/lib/libz.a")
- (string-append "LZ4=" lz4-static "/lib/liblz4.a")
- ;; Guix will do compress man pages,
- ;; and letting Chez try causes an error
- "--nogzip-man-pages"
- configure-flags)))
+ (flags (cons* (string-append "--installprefix=" out)
+ "ZLIB=-lz"
+ "LZ4=-llz4"
+ "--libkernel"
+ ;; Guix will do compress-man-pages,
+ ;; and letting Chez try causes an error
+ "--nogzip-man-pages"
+ configure-flags)))
(format #t "configure flags: ~s~%" flags)
;; Some makefiles (for tests) don't seem to propagate CC
;; properly, so we take it out of their hands:
--
2.32.0
P
P
Philip McGrath wrote on 8 Feb 2022 16:18
[RFC PATCH 4/9] gnu: chez-and-racket-bootstrap: Add utilities for Chez machine types.
(address . 53878@debbugs.gnu.org)(name . Philip McGrath)(address . philip@philipmcgrath.com)
20220208151857.1900389-4-philip@philipmcgrath.com
* gnu/packages/chez-and-racket-bootstrap.scm (chez-machine->unthreaded,
chez-machine->upstream-restriction, chez-machine->nix-system,
nix-system->chez-machine): New private functions.
(%nix-arch-to-chez-alist, %nix-os-to-chez-alist): New private constants.
(chez-scheme)[supported-systems]: Compute based on
'nix-system->chez-machine' and 'chez-machine->upstream-restriction'.
---
gnu/packages/chez-and-racket-bootstrap.scm | 142 ++++++++++++++++++++-
1 file changed, 140 insertions(+), 2 deletions(-)

Toggle diff (170 lines)
diff --git a/gnu/packages/chez-and-racket-bootstrap.scm b/gnu/packages/chez-and-racket-bootstrap.scm
index 11d570059b..fc1da53178 100644
--- a/gnu/packages/chez-and-racket-bootstrap.scm
+++ b/gnu/packages/chez-and-racket-bootstrap.scm
@@ -28,7 +28,9 @@ (define-module (gnu packages chez-and-racket-bootstrap)
#:use-module (guix utils)
#:use-module (guix gexp)
#:use-module (ice-9 match)
+ #:use-module (ice-9 regex)
#:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26)
#:use-module (guix build-system gnu)
#:use-module (gnu packages)
#:use-module (gnu packages compression)
@@ -61,6 +63,134 @@ (define-module (gnu packages chez-and-racket-bootstrap)
;;
;; Code:
+(define (chez-machine->unthreaded mach)
+ "Given a string MACH naming a Chez Scheme machine type, returns a string
+naming the unthreaded machine type for the same architecture and OS as MACH.
+The returned string may share storage with MACH."
+ (if (eqv? #\t (string-ref mach 0))
+ (substring mach 1)
+ mach))
+(define (chez-machine->threaded mach)
+ "Like @code{chez-machine->unthreaded}, but returns the threaded machine
+type."
+ (if (eqv? #\t (string-ref mach 0))
+ mach
+ (string-append "t" mach)))
+
+;; Based on the implementation from raco-cross-lib/private/cross/platform.rkt
+;; in https://github.com/racket/raco-cross.
+;; For supported platforms, refer to release_notes/release_notes.stex in the
+;; upstream Chez Scheme repository or to racket/src/ChezScheme/README.md
+;; in https://github.com/racket/racket.
+(define %nix-arch-to-chez-alist
+ `(("x86_64" . "a6")
+ ("i386" . "i3")
+ ("aarch64" . "arm64")
+ ("armhf" . "arm32") ;; Chez supports ARM v6+
+ ("ppc" . "ppc32")))
+(define %nix-os-to-chez-alist
+ `(("w64-mingw32" . "nt")
+ ("darwin" . "osx")
+ ("linux" . "le")
+ ("freebsd" . "fb")
+ ("openbsd" . "ob")
+ ("netbsd" . "nb")
+ ("solaris" . "s2")))
+
+(define (chez-machine->upstream-restriction mach)
+ "Given a string MACH naming a Chez Scheme machine type, returns a symbol
+naming a restriction on the upstream Chez Scheme implementation compared to
+the Racket variant, or @code{#f} if no such restriction exists. The
+restriction is reported for the architecture--OS pair, regardless of whether
+MACH specifies a threaded or an unthreaded variant.
+
+Possible restrictions currently include:
+@itemize @bullet
+@item
+@code{'no-threads}: Support for native threads is not available upstream.
+@item
+@code{'no-support}: The upstream release doesn't claim to support this
+architecture--OS combination at all.
+@end itemize
+
+See @code{chez-machine->nix-system} for more details about acceptable values
+for MACH."
+ (let ((mach (chez-machine->unthreaded mach)))
+ (cond
+ ((string-prefix? "arm64" mach)
+ 'no-support)
+ ((string-prefix? "arm32" mach)
+ (if (string-suffix? "le" mach)
+ 'no-threads
+ 'no-support))
+ ((string-prefix? "ppc32" mach)
+ (if (string-suffix? "le" mach)
+ #f
+ 'no-support))
+ (else
+ #f))))
+
+(define (chez-machine->nix-system mach)
+ "Return the Nix system type corresponding to the Chez Scheme machine type
+MACH. If MACH is not a string representing a known machine type, an exception
+is raised. This function does not distinguish between threaded and unthreaded
+variants of MACH.
+
+Note that this function only handles Chez Scheme machine types in the
+strictest sense, not other kinds of descriptors sometimes used in place of a
+Chez Scheme machine type by the Racket, such as @code{\"pb\"}, @code{#f}, or
+@code{\"racket\"}. (When using such extensions, the Chez Scheme machine type
+for the host system is often still relevant.)"
+ (let ((mach (chez-machine->unthreaded mach)))
+ (let find-arch ((alist %nix-arch-to-chez-alist))
+ (match alist
+ (((nix . chez) . alist)
+ (if (string-prefix? chez mach)
+ (string-append
+ nix "-" (let ((mach-os (substring mach (string-length chez))))
+ (let find-os ((alist %nix-os-to-chez-alist))
+ (match alist
+ (((nix . chez) . alist)
+ (if (equal? chez mach-os)
+ nix
+ (find-os alist)))))))
+ (find-arch alist)))))))
+
+(define* (nix-system->chez-machine #:optional (system (%current-system))
+ #:key (threads? 'always))
+ "Return the Chez Scheme machine type corresponding to the Nix system
+identifier SYSTEM, or @code{#f} if the translation of SYSTEM to a Chez Scheme
+machine type is undefined.
+
+When THREADS? is @code{'always} (the default), the threaded variant of the
+machine type will be returned: note that the package returned by
+@code{chez-scheme-for-system} will always support native threads. When
+THREADS? is @code{#f}, the unthreaded machine type will be returned. If
+THREADS? is @code{'upstream} (the default), the threaded variant of the
+machine type will be returned if and only if it is supported by upstream Chez
+Scheme (see @code{chez-machine->upstream-restriction}). If THREADS? is any
+other value, an exception is raised."
+ (let* ((hyphen (string-index system #\-))
+ (nix-arch (substring system 0 hyphen))
+ (nix-os (substring system (+ 1 hyphen)))
+ (chez-arch (assoc-ref %nix-arch-to-chez-alist nix-arch))
+ (chez-os (assoc-ref %nix-os-to-chez-alist nix-os))
+ (mach (and chez-arch chez-os (string-append chez-arch chez-os))))
+ (and mach
+ (match threads?
+ ('always
+ (chez-machine->threaded mach))
+ (#f
+ mach)
+ ('upstream
+ (if (chez-machine->upstream-restriction mach)
+ mach
+ (chez-machine->threaded mach)))))))
+
+;;
+;; Chez Scheme:
+;;
+
(define nanopass
(let ((version "1.9.2"))
(origin
@@ -264,8 +394,16 @@ (define* (stex-make #:optional (suffix ""))
;; We should too. It is the Chez machine type arm32le
;; (no threaded version upstream yet, though there is in
;; Racket's fork), more specifically (per the release notes) ARMv6.
- (supported-systems (fold delete %supported-systems
- '("mips64el-linux" "armhf-linux")))
+ (supported-systems
+ (delete
+ "armhf-linux" ;; <-- should work, but reportedly broken
+ (filter
+ (lambda (system)
+ (and=> (nix-system->chez-machine system)
+ (lambda (mach)
+ (not (eq? 'no-support
+ (chez-machine->upstream-restriction mach))))))
+ %supported-systems)))
(home-page "https://cisco.github.io/ChezScheme/")
(synopsis "R6RS Scheme compiler and run-time")
(description
--
2.32.0
P
P
Philip McGrath wrote on 8 Feb 2022 16:18
[RFC PATCH 5/9] gnu: Add stex.
(address . 53878@debbugs.gnu.org)(name . Philip McGrath)(address . philip@philipmcgrath.com)
20220208151857.1900389-5-philip@philipmcgrath.com
* gnu/packages/chez-and-racket-bootstrap.scm (stex-bootstrap): New
variable.
(stex): Change from origin to package inheriting from 'stex-bootstrap'.
(chez-scheme)[native-inputs]: Add 'stex-bootstrap'. Remove
labels. Remove dependencies of stex-bootstrap.
[inputs]: Remove labels.
[arguments]: Adapt to use 'stex-bootstrap', 'search-input-file', and
G-expressions.
(nanopass): Make it public as a temporary workaround for Racket.
* gnu/packages/racket.scm
(racket-bootstrap-chez-bootfiles)[native-inputs]: Update accordingly.
---
gnu/packages/chez-and-racket-bootstrap.scm | 435 ++++++++++++---------
gnu/packages/racket.scm | 5 +-
2 files changed, 263 insertions(+), 177 deletions(-)

Toggle diff (420 lines)
diff --git a/gnu/packages/chez-and-racket-bootstrap.scm b/gnu/packages/chez-and-racket-bootstrap.scm
index fc1da53178..c0d5e2897d 100644
--- a/gnu/packages/chez-and-racket-bootstrap.scm
+++ b/gnu/packages/chez-and-racket-bootstrap.scm
@@ -31,6 +31,7 @@ (define-module (gnu packages chez-and-racket-bootstrap)
#:use-module (ice-9 regex)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
+ #:use-module (guix build-system copy)
#:use-module (guix build-system gnu)
#:use-module (gnu packages)
#:use-module (gnu packages compression)
@@ -191,113 +192,83 @@ (define* (nix-system->chez-machine #:optional (system (%current-system))
;; Chez Scheme:
;;
-(define nanopass
- (let ((version "1.9.2"))
- (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/nanopass/nanopass-framework-scheme")
- (commit (string-append "v" version))))
- (sha256 (base32 "16vjsik9rrzbabbhbxbaha51ppi3f9n8rk59pc6zdyffs0vziy4i"))
- (file-name (git-file-name "nanopass" version)))))
+(define unbundle-chez-submodules
+ #~(begin
+ (use-modules (guix build utils))
+ (for-each (lambda (dir)
+ (when (directory-exists? dir)
+ (delete-file-recursively dir)))
+ '("stex"
+ "nanopass"
+ "lz4"
+ "zlib"))))
-(define stex
- ;; 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")
- (version "1.2.2")
- (version (git-version version "1" commit)))
- (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/dybvig/stex")
- (commit commit)))
- (sha256 (base32 "01jnvw8qw33gnpzwrakwhsr05h6b609lm180jnspcrb7lds2p23d"))
- (file-name (git-file-name "stex" version)))))
+(define (unpack-nanopass+stex)
+ ;; delayed resolution of `nanopass`
+ #~(begin
+ (copy-recursively #$nanopass
+ "nanopass"
+ #:keep-mtime? #t)
+ (mkdir-p "stex")
+ (with-output-to-file "stex/Mf-stex"
+ (lambda ()
+ ;; otherwise, it will try to download submodules
+ (display "# to placate ../configure")))))
(define-public chez-scheme
(package
(name "chez-scheme")
+ ;; The version should match `(scheme-version-number)`.
+ ;; See s/cmacros.ss c. line 360.
(version "9.5.6")
- (source
- (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/cisco/ChezScheme")
- (commit (string-append "v" version))))
- (sha256
- (base32 "07s433hn1z2slfc026sidrpzxv3a8narcd40qqr1xrpb9012xdky"))
- (file-name (git-file-name name version))
- (snippet
- ;; Remove bundled libraries.
- (with-imported-modules '((guix build utils))
- #~(begin
- (use-modules (guix build utils))
- (for-each (lambda (dir)
- (when (directory-exists? dir)
- (delete-file-recursively dir)))
- '("stex"
- "nanopass"
- "lz4"
- "zlib")))))))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/cisco/ChezScheme")
+ (commit (string-append "v" version))))
+ (sha256
+ (base32
+ "07s433hn1z2slfc026sidrpzxv3a8narcd40qqr1xrpb9012xdky"))
+ (file-name (git-file-name name version))
+ (snippet unbundle-chez-submodules)))
(build-system gnu-build-system)
(inputs
- `(("libuuid" ,util-linux "lib")
- ("zlib" ,zlib)
- ("lz4" ,lz4)
- ;; for expeditor:
- ("ncurses" ,ncurses)
- ;; for X11 clipboard support in expeditor:
- ;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
- ("libx11" ,libx11)))
- (native-inputs
- `(("nanopass" ,nanopass) ; source only
- ;; for docs
- ("stex" ,stex)
- ("xorg-rgb" ,xorg-rgb)
- ("texlive" ,(texlive-updmap.cfg (list texlive-dvips-l3backend
- texlive-epsf
- texlive-fonts-ec
- texlive-oberdiek)))
- ("ghostscript" ,ghostscript)
- ("netpbm" ,netpbm)))
+ (list
+ `(,util-linux "lib") ;<-- libuuid
+ zlib
+ lz4
+ ncurses ;<-- for expeditor
+ ;; for X11 clipboard support in expeditor:
+ ;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
+ libx11))
+ (native-inputs (list stex-bootstrap))
(native-search-paths
(list (search-path-specification
(variable "CHEZSCHEMELIBDIRS")
(files (list (string-append "lib/chez-scheme"))))))
(outputs '("out" "doc"))
(arguments
- `(#:modules
- ((guix build gnu-build-system)
+ (list
+ #:modules
+ '((guix build gnu-build-system)
(guix build utils)
(ice-9 ftw)
(ice-9 match))
- #:test-target "test"
- #:configure-flags
- '("--threads") ;; TODO when we fix armhf, it doesn't support --threads
- #:phases
- (modify-phases %standard-phases
- ;; put these where configure expects them to be
- (add-after 'unpack 'unpack-nanopass+stex
- (lambda* (#:key native-inputs inputs #:allow-other-keys)
- (for-each (lambda (dep)
- (define src
- (assoc-ref (or native-inputs inputs) dep))
- (copy-recursively src dep
- #:keep-mtime? #t))
- '("nanopass" "stex"))))
- ;; NOTE: the custom Chez 'configure' script doesn't allow
- ;; unrecognized flags, such as those automatically added
- ;; by `gnu-build-system`.
- (replace 'configure
- (lambda* (#:key inputs outputs
- (configure-flags '())
- #:allow-other-keys)
- (let* ((zlib-static (assoc-ref inputs "zlib:static"))
- (lz4-static (assoc-ref inputs "lz4:static"))
- (out (assoc-ref outputs "out"))
- ;; add flags which are always required:
- (flags (cons* (string-append "--installprefix=" out)
+ #:test-target "test"
+ ;; TODO when we fix armhf, it may not support --threads
+ #:configure-flags #~'("--threads")
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'unpack-nanopass+stex
+ (lambda args
+ #$(unpack-nanopass+stex)))
+ ;; NOTE: the custom Chez 'configure' script doesn't allow
+ ;; unrecognized flags, such as those automatically added
+ ;; by `gnu-build-system`.
+ (replace 'configure
+ (lambda* (#:key inputs (configure-flags '()) #:allow-other-keys)
+ ;; add flags which are always required:
+ (let ((flags (cons* (string-append "--installprefix=" #$output)
"ZLIB=-lz"
"LZ4=-llz4"
"--libkernel"
@@ -305,90 +276,59 @@ (define src
;; and letting Chez try causes an error
"--nogzip-man-pages"
configure-flags)))
- (format #t "configure flags: ~s~%" flags)
- ;; Some makefiles (for tests) don't seem to propagate CC
- ;; properly, so we take it out of their hands:
- (setenv "CC" ,(cc-for-target))
- (setenv "HOME" "/tmp")
- (apply invoke
- "./configure"
- flags))))
- ;; The binary file name is called "scheme" as is the one from MIT/GNU
- ;; Scheme. We add a symlink to use in case both are installed.
- (add-after 'install 'install-symlink
- (lambda* (#:key outputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (bin (string-append out "/bin"))
- (lib (string-append out "/lib"))
- (name "chez-scheme"))
- (symlink (string-append bin "/scheme")
- (string-append bin "/" name))
- (map (lambda (file)
- (symlink file (string-append (dirname file)
- "/" name ".boot")))
- (find-files lib "scheme.boot")))))
- ;; Building explicitly lets us avoid using substitute*
- ;; to re-write makefiles.
- (add-after 'install-symlink 'prepare-stex
- (lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
- (let* ((stex+version
- (strip-store-file-name
- (assoc-ref (or native-inputs inputs) "stex")))
- ;; Eventually we want to install stex as a real
- ;; package so it's reusable. For now:
- (stex-output "/tmp")
- (doc-dir (string-append stex-output
- "/share/doc/"
- stex+version)))
- (with-directory-excursion "stex"
- (invoke "make"
- "install"
- (string-append "LIB="
- stex-output
- "/lib/"
- stex+version)
- (string-append "Scheme="
- (assoc-ref outputs "out")
- "/bin/scheme"))
- (for-each (lambda (pth)
- (install-file pth doc-dir))
- '("ReadMe" ; includes the license
- "doc/stex.html"
- "doc/stex.css"
- "doc/stex.pdf"))))))
- ;; Building the documentation requires stex and a running scheme.
- ;; FIXME: this is probably wrong for cross-compilation
- (add-after 'prepare-stex 'install-doc
- (lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
- (let* ((chez+version (strip-store-file-name
- (assoc-ref outputs "out")))
- (stex+version
- (strip-store-file-name
- (assoc-ref (or native-inputs inputs) "stex")))
- (scheme (string-append (assoc-ref outputs "out")
- "/bin/scheme"))
- ;; see note on stex-output in phase build-stex, above:
- (stexlib (string-append "/tmp"
- "/lib/"
- stex+version))
- (doc-dir (string-append (assoc-ref outputs "doc")
- "/share/doc/"
- chez+version)))
- (define* (stex-make #:optional (suffix ""))
- (invoke "make"
- "install"
- (string-append "Scheme=" scheme)
- (string-append "STEXLIB=" stexlib)
- (string-append "installdir=" doc-dir suffix)))
- (with-directory-excursion "csug"
- (stex-make "/csug"))
- (with-directory-excursion "release_notes"
- (stex-make "/release_notes"))
- (with-directory-excursion doc-dir
- (symlink "release_notes/release_notes.pdf"
- "release_notes.pdf")
- (symlink "csug/csug9_5.pdf"
- "csug.pdf"))))))))
+ (format #t "configure flags: ~s~%" flags)
+ ;; Some makefiles (for tests) don't seem to propagate CC
+ ;; properly, so we take it out of their hands:
+ (setenv "CC" #$(cc-for-target))
+ (setenv "HOME" "/tmp")
+ (apply invoke "./configure" flags))))
+ ;; The binary file name is called "scheme" as is the one from
+ ;; MIT/GNU Scheme. We add a symlink to use in case both are
+ ;; installed.
+ (add-after 'install 'install-symlink
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((scheme (search-input-file outputs "/bin/scheme"))
+ (bin-dir (dirname scheme)))
+ (symlink scheme
+ (string-append bin-dir "/chez-scheme"))
+ (match (find-files (string-append bin-dir "/../lib")
+ "scheme.boot")
+ ((scheme.boot)
+ (symlink scheme.boot
+ (string-append (dirname scheme.boot)
+ "/chez-scheme.boot")))))))
+ ;; Building the documentation requires stex and a running scheme.
+ ;; FIXME: this is probably wrong for cross-compilation
+ (add-after 'install-symlink 'install-doc
+ (lambda* (#:key native-inputs inputs outputs
+ #:allow-other-keys)
+ (match (assoc-ref outputs "doc")
+ (#f
+ (format #t "not installing docs~%"))
+ (doc-prefix
+ (let* ((chez+version (strip-store-file-name #$output))
+ (scheme (search-input-file outputs "/bin/scheme"))
+ (stexlib (search-input-directory
+ (or native-inputs inputs)
+ "/lib/stex"))
+ (doc-dir (string-append doc-prefix
+ "/share/doc/"
+ chez+version)))
+ (define* (stex-make #:optional (suffix ""))
+ (invoke "make" "install"
+ (string-append "Scheme=" scheme)
+ (string-append "STEXLIB=" stexlib)
+ (string-append "installdir="
+ doc-dir suffix)))
+ (with-directory-excursion "csug"
+ (stex-make "/csug"))
+ (with-directory-excursion "release_notes"
+ (stex-make "/release_notes"))
+ (with-directory-excursion doc-dir
+ (symlink "release_notes/release_notes.pdf"
+ "release_notes.pdf")
+ (symlink "csug/csug9_5.pdf"
+ "csug.pdf"))))))))))
;; Chez Scheme does not have a MIPS backend.
;; FIXME: Debian backports patches to get armhf working.
;; We should too. It is the Chez machine type arm32le
@@ -412,3 +352,150 @@ (define* (stex-make #:optional (suffix ""))
generates native code for each target processor, with support for x86, x86_64,
and 32-bit PowerPC architectures.")
(license license:asl2.0)))
+
+;;
+;; Chez's bootstrap dependencies:
+;;
+
+(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"))
+ (hidden-package
+ (package
+ (name "stex")
+ ;; ^ Debian calls this "stex", not "chez-stex". It is a set of
+ ;; command-line tools, and there isn't a Scheme API, let alone a
+ ;; Chez-specific one, except perhaps that the Scheme examples are
+ ;; assumed to be Chez-compatible.
+ (version (git-version "1.2.2" revision commit))
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/dybvig/stex")
+ (commit commit)))
+ (sha256
+ (base32 "01jnvw8qw33gnpzwrakwhsr05h6b609lm180jnspcrb7lds2p23d"))
+ (file-name (git-file-name name version))
+ (snippet
+ #~(for-each delete-file
+ '("sbin/install" "doc/stex.pdf" "doc/stex.html")))))
+ (outputs '("out"))
+ (build-system copy-build-system)
+ ;; N.B. Upstream does not seem to support cross-compilation,
+ ;; though it would probably be easy to add.
+ (propagated-inputs
+ (list xorg-rgb
+ (texlive-updmap.cfg
+ (list texlive-dvips-l3backend
+ texlive-hyperref
+ texlive-bibtex
+ texlive-epsf
+ texlive-fonts-ec
+ texlive-oberdiek))
+ ghostscript
+ netpbm))
+ ;; Debian uses a versionless path for STEXLIB,
+ ;; which is much more convienient.
+ (arguments
+ (list
+ #:install-plan #~`(("inputs" "lib/stex/")
+ ("gifs" "lib/stex/")
+ ("math" "lib/stex/")
+ ("src" "lib/stex/") ;; can run without compiling
+ ("Mf-stex" "lib/stex/")
+ ("Makefile.template" "lib/stex/"))
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-before 'install 'patch-sources
+ (lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
+ (define scheme
+ (false-if-exception
+ (search-input-file inputs "/bin/scheme")))
+ (when scheme
+ (setenv "Scheme" scheme))
+ (substitute* '("Makefile.template"
+ "doc/Makefile")
+ (("STEXLIB=[^\n]*")
+ (string-append "STEXLIB=" #$output "/lib/stex"))
+ (("Scheme=[^\n]*")
+ (string-append "Scheme=" (or scheme "scheme"))))
+ (substitute* '("Mf-stex"
+ "math/Makefile")
+ (("/bin/rm")
+ "rm"))
+ (substitute* "Mf-stex"
+ (("SHELL=bash")
+ ;; avoid Solaris workaround
+ "#SHELL=bash"))))
+ (add-after 'install 'maybe-compile
+ (lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
+ (cond
+ ((getenv "Scheme")
+ => (lambda (scheme)
+ (define makefile
+ (string-append (getcwd) "/Makefile"))
+
This message was truncated. Download the full message here.
P
P
Philip McGrath wrote on 8 Feb 2022 16:18
[RFC PATCH 6/9] gnu: Add chez-nanopass.
(address . 53878@debbugs.gnu.org)(name . Philip McGrath)(address . philip@philipmcgrath.com)
20220208151857.1900389-6-philip@philipmcgrath.com
* gnu/packages/chez-and-racket-bootstrap.scm (nanopass): Rename to ...
(chez-nanopass-bootstrap): ... this new variable, and promote it from an
origin to a package.
(chez-scheme)[native-inputs]: Add it.
(chez-nanopass): New variable.
(unpack-nanopass+stex): Adapt accordingly.
* gnu/packages/racket.scm
(racket-bootstrap-chez-bootfiles)[native-inputs]: Likewise.
---
gnu/packages/chez-and-racket-bootstrap.scm | 96 ++++++++++++++++++----
gnu/packages/racket.scm | 2 +-
2 files changed, 81 insertions(+), 17 deletions(-)

Toggle diff (141 lines)
diff --git a/gnu/packages/chez-and-racket-bootstrap.scm b/gnu/packages/chez-and-racket-bootstrap.scm
index c0d5e2897d..9125d34ab7 100644
--- a/gnu/packages/chez-and-racket-bootstrap.scm
+++ b/gnu/packages/chez-and-racket-bootstrap.scm
@@ -203,12 +203,13 @@ (define unbundle-chez-submodules
"lz4"
"zlib"))))
-(define (unpack-nanopass+stex)
- ;; delayed resolution of `nanopass`
+(define unpack-nanopass+stex
#~(begin
- (copy-recursively #$nanopass
- "nanopass"
- #:keep-mtime? #t)
+ (copy-recursively
+ (dirname (search-input-file %build-inputs
+ "lib/chez-scheme/nanopass.ss"))
+ "nanopass"
+ #:keep-mtime? #t)
(mkdir-p "stex")
(with-output-to-file "stex/Mf-stex"
(lambda ()
@@ -241,7 +242,7 @@ (define-public chez-scheme
;; for X11 clipboard support in expeditor:
;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
libx11))
- (native-inputs (list stex-bootstrap))
+ (native-inputs (list chez-nanopass-bootstrap stex-bootstrap))
(native-search-paths
(list (search-path-specification
(variable "CHEZSCHEMELIBDIRS")
@@ -261,7 +262,7 @@ (define-public chez-scheme
#~(modify-phases %standard-phases
(add-after 'unpack 'unpack-nanopass+stex
(lambda args
- #$(unpack-nanopass+stex)))
+ #$unpack-nanopass+stex))
;; NOTE: the custom Chez 'configure' script doesn't allow
;; unrecognized flags, such as those automatically added
;; by `gnu-build-system`.
@@ -490,12 +491,75 @@ (define-public stex
(outputs '("out" "doc"))
(properties '())))
-(define-public nanopass
- (let ((version "1.9.2"))
- (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/nanopass/nanopass-framework-scheme")
- (commit (string-append "v" version))))
- (sha256 (base32 "16vjsik9rrzbabbhbxbaha51ppi3f9n8rk59pc6zdyffs0vziy4i"))
- (file-name (git-file-name "nanopass" version)))))
+(define-public chez-nanopass-bootstrap
+ (hidden-package
+ (package
+ (name "chez-nanopass")
+ (version "1.9.2")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/nanopass/nanopass-framework-scheme")
+ (commit (string-append "v" version))))
+ (sha256 (base32 "16vjsik9rrzbabbhbxbaha51ppi3f9n8rk59pc6zdyffs0vziy4i"))
+ (file-name (git-file-name "nanopass-framework-scheme" version))
+ (snippet
+ #~(begin
+ (use-modules (guix build utils))
+ (when (file-exists? "doc/user-guide.pdf")
+ (delete-file "doc/user-guide.pdf"))
+ (substitute* "doc/Makefile"
+ (("include ~/stex/Mf-stex")
+ "include $(STEXLIB)/Mf-stex"))))))
+ (build-system copy-build-system)
+ (arguments
+ (list #:install-plan
+ #~`(("nanopass.ss" "lib/chez-scheme/")
+ ("nanopass" "lib/chez-scheme/"))))
+ (home-page "https://nanopass.org")
+ (synopsis "DSL for compiler development")
+ (description "The Nanopass framework is an embedded domain-specific
+language for writing compilers composed of several simple passes that
+operate over well-defined intermediate languages. The goal of this
+organization is both to simplify the understanding of each pass, because it
+is responsible for a single task, and to simplify the addition of new passes
+anywhere in the compiler. Nanopass reduces the boilerplate required to
+create compilers, making them easier to understand and maintain.")
+ (license license:expat))))
+
+(define-public chez-nanopass
+ (package/inherit chez-nanopass-bootstrap
+ (properties '())
+ ;; TODO: cross-compilation
+ (native-inputs (list chez-scheme stex))
+ (arguments
+ (substitute-keyword-arguments (package-arguments chez-nanopass-bootstrap)
+ ((#:install-plan base-plan)
+ #~`(("nanopass.so" "lib/chez-scheme/")
+ ("doc/user-guide.pdf" #$(string-append
+ "share/doc/"
+ (package-name this-package)
+ "-"
+ (package-version this-package)
+ "/"))
+ ,@#$base-plan))
+ ((#:phases base-phases #~%standard-phases)
+ #~(modify-phases #$base-phases
+ (add-before 'install 'compile-and-test
+ (lambda args
+ (invoke "scheme"
+ "--compile-imported-libraries"
+ "--program" "test-all.ss")))
+ (add-after 'compile-and-test 'build-doc
+ (lambda* (#:key native-inputs inputs #:allow-other-keys)
+ (with-directory-excursion "doc"
+ (invoke "make"
+ (string-append "Scheme="
+ (search-input-file
+ (or native-inputs inputs)
+ "/bin/scheme"))
+ (string-append "STEXLIB="
+ (search-input-directory
+ (or native-inputs inputs)
+ "/lib/stex"))))))))))))
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index d8338bcd6f..e8d016c07b 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -334,7 +334,7 @@ (define-public racket-bootstrap-chez-bootfiles
racket-minimal
racket-minimal-bc-3m))
("stex" ,(package-source stex))
- ("nanopass" ,nanopass)))
+ ("nanopass" ,(package-source chez-nanopass))))
(arguments
`(#:phases
(modify-phases %standard-phases
--
2.32.0
P
P
Philip McGrath wrote on 8 Feb 2022 16:18
[RFC PATCH 7/9] gnu: chez-scheme: Explicitly package bootstrap bootfiles.
(address . 53878@debbugs.gnu.org)(name . Philip McGrath)(address . philip@philipmcgrath.com)
20220208151857.1900389-7-philip@philipmcgrath.com
This might seem a bit silly in isolation, but it makes the structure of
the upstream Chez Scheme package the same as for the Racket variant, it
sets things up for (one day, hopefully) actually being able to bootstrap
the upstream Chez Scheme bootfiles, and it may be useful for
cross-compilation and adding support for architectures without pre-built
bootfiles from upstream.

* gnu/packages/chez-and-racket-bootstrap.scm
(chez-scheme-bootstrap-bootfiles): New variable.
(chez-scheme)[native-inputs]: Add it.
[arguments]: Add new phase 'unpack-bootfiles'.
[version, source, home-page]: Derive from 'chez-scheme-bootstrap-bootfiles'.
---
gnu/packages/chez-and-racket-bootstrap.scm | 57 ++++++++++++++++++++--
1 file changed, 52 insertions(+), 5 deletions(-)

Toggle diff (100 lines)
diff --git a/gnu/packages/chez-and-racket-bootstrap.scm b/gnu/packages/chez-and-racket-bootstrap.scm
index 9125d34ab7..c6e4e07085 100644
--- a/gnu/packages/chez-and-racket-bootstrap.scm
+++ b/gnu/packages/chez-and-racket-bootstrap.scm
@@ -216,9 +216,9 @@ (define unpack-nanopass+stex
;; otherwise, it will try to download submodules
(display "# to placate ../configure")))))
-(define-public chez-scheme
+(define-public chez-scheme-bootstrap-bootfiles
(package
- (name "chez-scheme")
+ (name "chez-scheme-bootstrap-bootfiles")
;; The version should match `(scheme-version-number)`.
;; See s/cmacros.ss c. line 360.
(version "9.5.6")
@@ -230,8 +230,45 @@ (define-public chez-scheme
(sha256
(base32
"07s433hn1z2slfc026sidrpzxv3a8narcd40qqr1xrpb9012xdky"))
- (file-name (git-file-name name version))
+ (file-name (git-file-name "chez-scheme" version))
(snippet unbundle-chez-submodules)))
+ (build-system copy-build-system)
+ ;; TODO: cross compilation
+ (arguments
+ (list #:install-plan
+ #~`(("boot/" "lib/chez-scheme-bootfiles"))))
+ (supported-systems
+ ;; Upstream only distributes pre-built bootfiles for
+ ;; arm32le and t?(i3|a6)(le|nt|osx)
+ (filter (lambda (system)
+ (let ((mach (nix-system->chez-machine system #:threads? #f)))
+ (or (equal? "arm32le" mach)
+ (and mach
+ (member (substring mach 0 2) '("i3" "a6"))
+ (or-map (cut string-suffix? <> mach)
+ '("le" "nt" "osx"))))))
+ %supported-systems))
+ (home-page "https://cisco.github.io/ChezScheme/")
+ (synopsis "Chez Scheme bootfiles (binary seed)")
+ (description
+ "Chez Scheme is a self-hosting compiler: building it requires
+``bootfiles'' containing the Scheme-implemented portions compiled for the
+current platform. (Chez can then cross-compile bootfiles for all other
+supported platforms.)
+
+This package provides bootstrap bootfiles for upstream Chez Scheme.
+Currently, it simply packages the binaries checked in to the upsream
+repository. Hopefully we can eventually adapt Racket's @code{cs-bootstrap} to
+work with upstream Chez Scheme so that we can bootstrap these files from
+source.")
+ (properties `((hidden? . #t)))
+ (license license:asl2.0)))
+
+(define-public chez-scheme
+ (package
+ (name "chez-scheme")
+ (version (package-version chez-scheme-bootstrap-bootfiles))
+ (source (package-source chez-scheme-bootstrap-bootfiles))
(build-system gnu-build-system)
(inputs
(list
@@ -242,7 +279,9 @@ (define-public chez-scheme
;; for X11 clipboard support in expeditor:
;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
libx11))
- (native-inputs (list chez-nanopass-bootstrap stex-bootstrap))
+ (native-inputs (list chez-scheme-bootstrap-bootfiles
+ chez-nanopass-bootstrap
+ stex-bootstrap))
(native-search-paths
(list (search-path-specification
(variable "CHEZSCHEMELIBDIRS")
@@ -263,6 +302,14 @@ (define-public chez-scheme
(add-after 'unpack 'unpack-nanopass+stex
(lambda args
#$unpack-nanopass+stex))
+ (add-after 'unpack-nanopass+stex 'unpack-bootfiles
+ (lambda* (#:key native-inputs inputs #:allow-other-keys)
+ (when (directory-exists? "boot")
+ (delete-file-recursively "boot"))
+ (copy-recursively
+ (search-input-directory (or native-inputs inputs)
+ "lib/chez-scheme-bootfiles")
+ "boot")))
;; NOTE: the custom Chez 'configure' script doesn't allow
;; unrecognized flags, such as those automatically added
;; by `gnu-build-system`.
@@ -345,7 +392,7 @@ (define* (stex-make #:optional (suffix ""))
(not (eq? 'no-support
(chez-machine->upstream-restriction mach))))))
%supported-systems)))
- (home-page "https://cisco.github.io/ChezScheme/")
+ (home-page (package-home-page chez-scheme-bootstrap-bootfiles))
(synopsis "R6RS Scheme compiler and run-time")
(description
"Chez Scheme is a compiler and run-time system for the language of the
--
2.32.0
P
P
Philip McGrath wrote on 8 Feb 2022 16:18
[RFC PATCH 8/9] gnu: Add chez-scheme-racket-variant.
(address . 53878@debbugs.gnu.org)(name . Philip McGrath)(address . philip@philipmcgrath.com)
20220208151857.1900389-8-philip@philipmcgrath.com
The Racket variant of Chez Scheme can be used to support platforms that
are not yet supported by upstream Chez Scheme. The new function
'chez-scheme-for-system' selects the Chez Scheme package that best
supports the target system.

In the process, we also add packages for 'racket-vm-cgc',
'racket-vm-bc', and 'racket-vm-cs'. A future commit will change
'racket-minimal' to use the Racket VM implementation that best supports
the target system, as reported by 'racket-vm-for-system'.

* gnu/packages/patches/racket-enable-scheme-backport.patch: New patch.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/chez-and-racket-bootstrap.scm (racket-vm-cgc):
(racket-vm-bc):
(racket-vm-cs):
(chez-scheme-racket-variant-bootstrap-bootfiles):
(chez-scheme-racket-variant): New variables.
(chez-scheme-for-system, racket-vm-for-system): New exported functions.
* gnu/packages/loko.scm (loko-scheme): Use 'chez-scheme-for-system'.
* gnu/packages/emacs-xyz.scm (emacs-geiser-chez): Likewise
* gnu/packages/chez.scm (chez-srfi):
(chez-web):
(chez-sockets):
(chez-matchable):
(chez-irregex):
(chez-fmt):
(chez-mit):
(chez-scmutils): Likewise.
(chez-mit)[origin]<snippet>: Add workaround for Racket variant.
---
gnu/local.mk | 1 +
gnu/packages/chez-and-racket-bootstrap.scm | 512 +++++++++++++++++-
gnu/packages/chez.scm | 40 +-
gnu/packages/emacs-xyz.scm | 2 +-
gnu/packages/loko.scm | 2 +-
.../racket-enable-scheme-backport.patch | 465 ++++++++++++++++
6 files changed, 1003 insertions(+), 19 deletions(-)
create mode 100644 gnu/packages/patches/racket-enable-scheme-backport.patch

Toggle diff (398 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index e3104fc0b6..94de782ca9 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1785,6 +1785,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-enable-scheme-backport.patch \
%D%/packages/patches/racket-minimal-sh-via-rktio.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-and-racket-bootstrap.scm b/gnu/packages/chez-and-racket-bootstrap.scm
index c6e4e07085..46da8e3ef2 100644
--- a/gnu/packages/chez-and-racket-bootstrap.scm
+++ b/gnu/packages/chez-and-racket-bootstrap.scm
@@ -34,15 +34,20 @@ (define-module (gnu packages chez-and-racket-bootstrap)
#:use-module (guix build-system copy)
#:use-module (guix build-system gnu)
#:use-module (gnu packages)
+ #:use-module (gnu packages autotools)
+ #:use-module (gnu packages bash)
#:use-module (gnu packages compression)
#:use-module (gnu packages ghostscript)
+ #:use-module (gnu packages libffi)
#:use-module (gnu packages linux)
#:use-module (gnu packages ncurses)
#:use-module (gnu packages netpbm)
#:use-module (gnu packages tex)
#:use-module (gnu packages xorg)
#:use-module ((guix licenses)
- #:prefix license:))
+ #:prefix license:)
+ #:export (chez-scheme-for-system
+ racket-vm-for-system))
;; Commentary:
;;
@@ -62,8 +67,164 @@ (define-module (gnu packages chez-and-racket-bootstrap)
;; Putting the relevant definitions together in this module avoids having to
;; work around dependency cycles.
;;
+;; Anatomy of Racket:
+;; ------------------
+;;
+;; The main Racket Git repository (<https://github.com/racket/racket>) is
+;; organized broadly like this:
+;;
+;; .
+;; ├── Makefile
+;; ├── pkgs/
+;; └── racket/
+;; ├── collects/
+;; └── src/
+;; ├── configure
+;; ├── Makefile.in
+;; ├── bc/
+;; ├── cs/
+;; ├── ChezScheme/
+;; └── ...
+;;
+;; 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,
+;; e.g. <https://github.com/pycket/pycket>.) One way of thinking about the
+;; bounary between the Racket VM and Racket programs is that the VM implements
+;; the primitives accessed by the 'ffi/unsafe/vm' library. Another perspective
+;; is that DrRacket's ``Open defining file''/``Jump to definition'' features
+;; can navigate into Racket programs, including into the implementation of
+;; 'racket/base', but can not jump into the implementation of the Racket VM
+;; itself. A third, related perspective is that Racket code is usually
+;; installed with source files alongside compiled code (though this is not
+;; mandatory), whereas the Racket VM is installed only in compiled form.
+;;
+;; The 'racket/collects/' directory contains ``built in'' Racket libraries
+;; that are not part of any package, including the implementation of
+;; 'racket/base': in particular, it must contain enough to implement `raco pkg
+;; install'. It is theoretically possible to use the Racket VM layer without
+;; the main collections, but it is not stable or useful.
+;;
+;; The 'pkgs/' directory contains Racket packages that are especially closely
+;; tied to the implementation of the Racket VM, including 'compiler-lib',
+;; 'racket-doc', and 'racket-test'. Some of these packages depend on Racket
+;; packages that are developed in other Git repositories, predominantly but
+;; not exclusively under the 'racket' GitHub organization. Conversely, not all
+;; of the packages developed in the main Git repository are part of the main
+;; Racket distribution. (Additionally, components of the Racket VM that are
+;; implemented in Racket can be installed as packages, mostly for ease of
+;; development.)
+;;
+;; 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.
+;;
+;; A ''minimal Racket'' installation includes two packages: 'base', which is a
+;; sort of bridge between the current ``built-in'' collections and the package
+;; system's model of dependencies, and 'racket-lib', which, for installations
+;; that can not rely on a system package manager, pulls in the SQLite and
+;; OpenSSL shared libraries as platform-specific dependencies for use by the
+;; ``built-in'' collections.
+;;
+;; The main Racket distribution consists of installing the 'main-distribution'
+;; package and all of its dependencies.
+;;
+;; The default mode when building Racket (or installing it with the released
+;; installers) is an ``in-place build'', which produces a self-contained,
+;; relocatable, roughly FHS-like directory. (Racket also supports
+;; ``Unix-style'' installations, which rearrange the parts of an in-place
+;; build into Racket-specific subdirectories and generally tries to work for
+;; installation into an FHS-based system.) Certain tools, e.g. 'distro-build'
+;; and 'raco cross', are able to work with an in-place Racket build.
+;;
+;; 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.
+;;
+;; 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. The 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:
+;; ---------------------
+;;
+;; Here's how bootstrapping Racket works:
+;;
+;; - Racket BC [CGC] can be built with only a C compiler (except for
+;; one caveat discussed below).
+;; - Racket BC [3M] needs an existing Racket to run "xform",
+;; which transforms its own C source code to add additional annotations
+;; for the precise garbage collector.
+;; - Racket CS needs (bootfiles for) Racket's fork of Chez Scheme.
+;; It also needs an existing Racket to compile Racket-implemented
+;; parts of the runtime system to R6RS libraries.
+;; - Chez Scheme also needs bootfiles for itself, but Racket can simulate
+;; enough of Chez Scheme to load Racket's fork of the Chez Scheme compiler
+;; purely from source into Racket and apply the compiler to itself,
+;; producing the needed bootfiles (albeit very slowly).
+;; Any variant of Racket since version 7.1 can run the simulation.
+;;
+;; So, we build CGC to build 3M to build bootfiles and CS.
+;;
+;; (Note: since the CGC variant is basically only for bootstrapping, we
+;; often use "BC" to mean "3M", consistent with `(banner)` and the
+;; suffixes used on executables when more than one variant co-exists.)
+;;
+;; One remaining bootstrapping limitation is that Racket's reader, module
+;; system, and macro expander are implemented in Racket. For Racket CS,
+;; they are compiled to R6RS libraries as discussed above. This note from the
+;; README file applies to all such subsystems:
+;;
+;; The Racket version must be practically the same as the current Racket
+;; verson, although it can be the Racket BC implementation (instead of
+;; the Racket CS implementation).
+;;
+;; Unlike Chez Scheme boot files, the files generated in "schemified"
+;; are human-readable and -editable Scheme code. That provides a way
+;; out of bootstrapping black holes, even without BC.
+;;
+;; 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
+;;
+;; 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:
+(define* (chez-scheme-for-system #:optional
+ (system (or (%current-target-system)
+ (%current-system))))
+ "Return 'chez-scheme' if it supports SYSTEM without restrictions;
+'chez-scheme-racket-variant' otherwise."
+ (if (and=> (nix-system->chez-machine system)
+ chez-machine->upstream-restriction)
+ chez-scheme-racket-variant
+ chez-scheme))
+
+(define* (racket-vm-for-system #:optional
+ (system (or (%current-target-system)
+ (%current-system))))
+ "Return 'racket-vm-cs' if it supports SYSTEM; 'racket-vm-bc' otherwise."
+ (if (nix-system->chez-machine system)
+ racket-vm-cs
+ racket-vm-bc))
+
(define (chez-machine->unthreaded mach)
"Given a string MACH naming a Chez Scheme machine type, returns a string
naming the unthreaded machine type for the same architecture and OS as MACH.
@@ -189,19 +350,19 @@ (define* (nix-system->chez-machine #:optional (system (%current-system))
(chez-machine->threaded mach)))))))
;;
-;; Chez Scheme:
+;; Chez auxiliary G-expressions:
;;
(define unbundle-chez-submodules
#~(begin
(use-modules (guix build utils))
(for-each (lambda (dir)
- (when (directory-exists? dir)
- (delete-file-recursively dir)))
- '("stex"
- "nanopass"
- "lz4"
- "zlib"))))
+ (when (directory-exists? dir)
+ (delete-file-recursively dir)))
+ '("stex"
+ "nanopass"
+ "lz4"
+ "zlib"))))
(define unpack-nanopass+stex
#~(begin
@@ -216,6 +377,235 @@ (define unpack-nanopass+stex
;; otherwise, it will try to download submodules
(display "# to placate ../configure")))))
+;;
+;; Racket VM:
+;;
+
+(define (racket-vm-common-configure-flags)
+ ;; under a lambda extraction to avoid evaluating bash-minimal too early
+ #~`(,@(cond
+ ((false-if-exception
+ (search-input-file %build-inputs "/bin/libtool"))
+ => (lambda (libtool)
+ (list (string-append "--enable-lt=" libtool))))
+ (else
+ '()))
+ ,@(cond
+ ((false-if-exception
+ (search-input-file %build-inputs "/opt/racket-vm/bin/racket"))
+ => (lambda (racket)
+ (list (string-append "--enable-racket=" racket))))
+ (else
+ '()))
+ ,(string-append "CPPFLAGS=-DGUIX_RKTIO_PATCH_BIN_SH="
+ #$(file-append bash-minimal "/bin/sh"))
+ "--disable-strip"
+ "--enable-origtree"))
+
+(define-public racket-vm-cgc
+ ;; Eventually, it may make sense for some vm packages to not be hidden,
+ ;; but this one is especially likely to remain hidden.
+ (hidden-package
+ (package
+ (name "racket-vm-cgc")
+ (version "8.3.900")
+ ;; ^ Remember to also update the version of
+ ;; chez-scheme-racket-variant-bootstrap-bootfiles
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/racket/racket")
+ ;;(commit (string-append "v" version))))
+ (commit "a8f2969753f70e70d73308250cae1d4eda087319")))
+ (sha256
+ (base32 "141c18wmvb6039cw87mvmm6xxs6k01wkcrxj0hfa1r8za25qa934"))
+ (file-name (git-file-name "racket" version))
+ (patches (search-patches "racket-minimal-sh-via-rktio.patch"
+ ;; Remove by Racket 8.5:
+ "racket-enable-scheme-backport.patch"))
+ (modules '((guix build utils)))
+ (snippet
+ #~(begin
+ ;; Unbundle Chez submodules.
+ (with-directory-excursion "racket/src/ChezScheme"
+ #$unbundle-chez-submodules)
+ ;; Unbundle libffi.
+ (delete-file-recursively "racket/src/bc/foreign/libffi")))))
+ (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"))
+ (build-system gnu-build-system)
+ (arguments
+ (list
+ #:configure-flags
+ #~(cons "--enable-cgcdefault"
+ #$(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.
+ #:tests? #f
+ ;; Upstream recommends #:out-of-source?, and it does
+ ;; help with debugging, but it confuses `install-license-files`.
+ #:modules '((ice-9 match)
+ (ice-9 regex)
+ (guix build gnu-build-system)
+ (guix build utils))
+ #:strip-directories #~'("opt/racket-vm/bin"
+ "opt/racket-vm/lib")
+ #:phases
+ #~(let ()
+ (define* ((wrap-racket-vm-outputs phase) . args)
+ (apply
+ phase
+ (let loop ((args args))
+ (match args
+ ((#:outputs outputs . args)
+ `(#:outputs
+ ,(let loop ((outputs outputs))
+ (match outputs
+ ((("out" . out) . outputs)
+ `(("out" . ,(string-append out "/opt/racket-vm/"))
+ ,@outputs))
+ ((other . outputs)
+ (cons other (loop outputs)))))
+ ,@args))
+ ((arg . args)
+ (cons arg (loop args)))))))
+ (modify-phases %standard-phases
+ (add-before 'configure 'initialize-config.rktd
+ (lambda* (#:key inputs #:allow-other-keys)
+ (define (write-racket-hash alist)
+ ;; inside must use dotted pair notation
+ (display "#hash(")
+ (for-each (match-lambda
+ ((k . v)
+ (format #t "(~s . ~s)" k v)))
+ alist)
+ (display ")\n"))
+ (define maybe-release-catalog
+ (let ((v #$(package-version this-package)))
+ (if (string-match "^[0-9]+\\.[0-9]+($|\\.[0-8][0-9]*$)"
+ v)
+ `(,(string-append
+ "https://download.racket-lang.org/releases/"
+ v
+ "/catalog/"))
+ '())))
+ (mkdir-p "racket/etc")
+ (with-output-to-file "racket/etc/config.rktd"
+ (lambda ()
+ (write-racket-hash
+ `((build-stamp . "")
+ (catalogs ,@maybe-release-catalog
+ #f)))))))
+ (add-before 'configure 'chdir
+ (lambda _
+ (chdir "racket/src")))
+ (replace 'configure
+ (wrap-racket-vm-outputs
+ (assoc-ref %standard-phases 'configure)))
+ (replace 'patch-shebangs
+ (wrap-racket-vm-outputs
+ (assoc-ref %standard-phases 'patch-shebangs)))
+ (replace 'validate-runpath
+ (wrap-racket-vm-outputs
+ (assoc-ref %standard-phases 'validate-runpath)))
+ (replace 'make-dynamic-linker-cache
+ (wrap-racket-vm-outputs
+ (assoc-ref %standard-phases 'make-dynamic-linker-cache)))
+ (replace 'patch-dot-desktop-files
+ (wrap-racket-vm-outputs
+ (assoc-ref %standard-phases 'patch-dot-desktop-files)))))))
+ (home-page "https://racket-lang.org")
+ (synopsis "Old Racket implementation used for bootstrapping")
+ (description "This variant of the Racket BC (``before Chez'' or
+``bytecode'') implementation is not recommended for general use. It uses
+CGC (a ``Conservative Garbage Collector''), which was succeeded as default in
+PLT Scheme version 370 (which translates to 3.7 in the current versioning
+scheme) by the 3M variant, which in turn was succeeded in version 8.0 by the
+Racket CS implementation.
+
+Racket CGC is primarily used for bootstrapping Racket BC [3M]. It may
+also be used for embedding applications without the annotations needed in C
+code to use the 3M garbage collector.")
+ ;; https://download.racket-lang.org/license.html
+ ;; The LGPL components are only used by Racket BC.
+ (license (list license:lgpl3+ license:asl2.0 license:expat)))))
+
+(define-public racket-vm-bc
+ (package
+ (inherit racket-vm-cgc)
+ (name "racket-vm-bc")
+ (native-inputs
+ (modify-inputs (package-native-inputs racket-vm-cg
This message was truncated. Download the full message here.
P
P
Philip McGrath wrote on 8 Feb 2022 16:18
[RFC PATCH 9/9] gnu: racket: Update to 8.3.900.
(address . 53878@debbugs.gnu.org)(name . Philip McGrath)(address . philip@philipmcgrath.com)
20220208151857.1900389-9-philip@philipmcgrath.com
* gnu/packages/patches/racket-gui-tethered-launcher-backport.patch: New
patch.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/racket.scm (racket-minimal, racket): Update to 8.3.900.
Rewrite to use 'racket-vm-for-system', label-less inputs,
G-expressions, and Git origins for main-distribution packages.
---
gnu/local.mk | 3 +-
...acket-gui-tethered-launcher-backport.patch | 26 +
gnu/packages/racket.scm | 1549 +++++++++++------
3 files changed, 1053 insertions(+), 525 deletions(-)
create mode 100644 gnu/packages/patches/racket-gui-tethered-launcher-backport.patch

Toggle diff (448 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 94de782ca9..742e072e73 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -41,7 +41,7 @@
# Copyright © 2020 Vinicius Monego <monego@posteo.net>
# Copyright © 2021 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
# Copyright © 2021 Greg Hogan <code@greghogan.com>
-# Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
+# Copyright © 2021, 2022 Philip McGrath <philip@philipmcgrath.com>
# Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net>
# Copyright © 2021 Sharlatan Hellseher <sharlatanus@gmail.com>
# Copyright © 2021 Dmitry Polyakov <polyakov@liltechdude.xyz>
@@ -1786,6 +1786,7 @@ dist_patch_DATA = \
%D%/packages/patches/rpcbind-CVE-2017-8779.patch \
%D%/packages/patches/rtags-separate-rct.patch \
%D%/packages/patches/racket-enable-scheme-backport.patch \
+ %D%/packages/patches/racket-gui-tethered-launcher-backport.patch \
%D%/packages/patches/racket-minimal-sh-via-rktio.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/patches/racket-gui-tethered-launcher-backport.patch b/gnu/packages/patches/racket-gui-tethered-launcher-backport.patch
new file mode 100644
index 0000000000..1e018eaa79
--- /dev/null
+++ b/gnu/packages/patches/racket-gui-tethered-launcher-backport.patch
@@ -0,0 +1,26 @@
+From aa792e707b1fbc5cc33691bfaee5828dc3fbebaa Mon Sep 17 00:00:00 2001
+From: Matthew Flatt <mflatt@racket-lang.org>
+Date: Mon, 31 Jan 2022 15:31:22 -0700
+Subject: [PATCH] fix creation of tethered launchers
+
+Related to racket/racket#4133
+
+(cherry picked from commit 563c68432f127729592f234ef30c31e92618b517)
+---
+ gui-lib/mred/installer.rkt | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/gui-lib/mred/installer.rkt b/gui-lib/mred/installer.rkt
+index b1691472..9ef06c53 100644
+--- a/gui-lib/mred/installer.rkt
++++ b/gui-lib/mred/installer.rkt
+@@ -72,4 +72,5 @@
+ (list "-A" (path->string (find-system-path 'addon-dir)))))
+
+ (define (config-flags)
+- (list "-G" (path->string (find-config-dir))))
++ (list "-X" (path->string (find-collects-dir))
++ "-G" (path->string (find-config-dir))))
+--
+2.32.0
+
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index e8d016c07b..e3c38714c1 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -2,7 +2,7 @@
;;; Copyright © 2013, 2014, 2015, 2016, 2018, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2020 Pierre Neidhardt <mail@ambrevar.xyz>
-;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
+;;; Copyright © 2021, 2022 Philip McGrath <philip@philipmcgrath.com>
;;; Copyright © 2021 jgart <jgart@dismail.de>
;;;
;;; This file is part of GNU Guix.
@@ -21,8 +21,6 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu packages racket)
- #:use-module ((guix licenses)
- #:select (asl2.0 expat lgpl3+))
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix git-download)
@@ -30,7 +28,10 @@ (define-module (gnu packages racket)
#:use-module (guix gexp)
#:use-module (guix build-system gnu)
#:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26)
#:use-module (ice-9 match)
+ #:use-module (ice-9 regex)
+ #:use-module (ice-9 exceptions)
#:use-module (gnu packages)
#:use-module (gnu packages autotools)
#:use-module (gnu packages bash)
@@ -47,200 +48,87 @@ (define-module (gnu packages racket)
#:use-module (gnu packages multiprecision)
#:use-module (gnu packages sqlite)
#:use-module (gnu packages tls)
- #:use-module (gnu packages xorg))
-
-;; Commentary:
-;;
-;; Here's how bootstrapping minimal Racket works:
-;;
-;; - Racket BC [CGC] can be built with only a C compiler (except for
-;; one caveat discussed below).
-;; - Racket BC [3M] needs an existing Racket to run "xform",
-;; which transforms its own C source code to add additional annotations
-;; for the precise garbage collector.
-;; - Racket CS needs (bootfiles for) Racket's fork of Chez Scheme.
-;; It also needs an existing Racket to compile Racket-implemented
-;; parts of the runtime system to R6RS libraries.
-;; - Chez Scheme also needs bootfiles for itself, but Racket can simulate
-;; enough of Chez Scheme to load Racket's fork of the Chez Scheme compiler
-;; purely from source into Racket and apply the compiler to itself,
-;; producing the needed bootfiles (albeit very slowly).
-;; Any variant of Racket since version 7.1 can run the simulation.
-;;
-;; So, we build CGC to build 3M to build bootfiles and CS.
-;;
-;; One remaining bootstrapping limitation is that Racket's reader, module
-;; system, and macro expander are implemented in Racket. For Racket CS,
-;; they are compiled to R6RS libraries as discussed above. This note from the
-;; README file applies to all such subsystems:
-;;
-;; The Racket version must be practically the same as the current Racket
-;; verson, although it can be the Racket BC implementation (instead of
-;; the Racket CS implementation).
-;;
-;; Unlike Chez Scheme boot files, the files generated in "schemified"
-;; are human-readable and -editable Scheme code. That provides a way
-;; out of bootstrapping black holes, even without BC.
-;;
-;; 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.
-;;
-;; 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:
-
-(define cfg-flag:sh-for-rktio
- `(string-append "CPPFLAGS=-DGUIX_RKTIO_PATCH_BIN_SH="
- (assoc-ref %build-inputs "sh")
- "/bin/sh"))
-(define cfg-flag:enable-lt
- `(string-append "--enable-lt="
- (assoc-ref %build-inputs "libtool")
- "/bin/libtool"))
-(define cfg-flag:enable-racket
- `(let ((racket (assoc-ref %build-inputs "racket")))
- (string-append "--enable-racket="
- racket
- "/bin/racket")))
-
-(define unpack-nanopass+stex
- ;; Copied from chez-scheme.
- ;; TODO: Eventually, we should refactor Chez Scheme
- ;; enough to share more directly, so that we can make
- ;; Racket's version of Chez avalable as a Guix package,
- ;; e.g. for architectures not supported upstream.
- ;; For now, we let Racket drive the Chez build process
- ;; other than this step.
- `(for-each (lambda (dep)
- (define src
- (assoc-ref (or native-inputs inputs) dep))
- (copy-recursively src dep
- #:keep-mtime? #t))
- '("nanopass" "stex")))
-
+ #:use-module (gnu packages xorg)
+ #:use-module ((guix licenses)
+ #:prefix license:))
(define-public racket-minimal
(package
(name "racket-minimal")
- (version "8.3") ; note: remember to also update racket!
- (source
- (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/racket/racket")
- (commit (string-append "v" version))))
- (sha256
- "1i1jnv1wb0kanfg47hniafx2vhwjc33qqx66lq7wkf5hbmgsyws3")
- (file-name (git-file-name name version))
- (patches (search-patches "racket-minimal-sh-via-rktio.patch"))
- (modules '((guix build utils)))
- (snippet
- (with-imported-modules '((guix build utils))
- #~(begin
- ;; Unbundle Chez submodules.
- (with-directory-excursion "racket/src/ChezScheme"
- ;; Remove bundled libraries (copied from 'chez-scheme').
- (for-each delete-file-recursively
- '("stex"
- "nanopass"
- "lz4"
- "zlib")))
- ;; Unbundle libffi.
- (delete-file-recursively "racket/src/bc/foreign/libffi"))))))
- (inputs
- `(;; common to all racket-minimal variants:
- ("openssl" ,openssl)
- ("sqlite" ,sqlite)
- ("sh" ,bash-minimal)
- ;; only for CS
- ("zlib" ,zlib)
- ("zlib:static" ,zlib "static")
- ("lz4" ,lz4)
- ("lz4:static" ,lz4 "static")))
- (native-inputs
- `(("bootfiles" ,racket-bootstrap-chez-bootfiles)
- ,@(package-native-inputs racket-bootstrap-chez-bootfiles)))
+ (version (package-version (racket-vm-for-system)))
+ (source (package-source (racket-vm-for-system)))
+ ;; For cross-compilation, Matthew Flatt recommends reusing
+ ;; as much of `raco cross` as possible. So, put that off until
+ ;; we have a build system for Racket packages.
+ (inputs (list openssl sqlite (racket-vm-for-system)))
(build-system gnu-build-system)
(arguments
- `(#:configure-flags
- (list "--enable-csonly"
- "--enable-libz"
- "--enable-liblz4"
- ,cfg-flag:enable-racket
- ,cfg-flag:sh-for-rktio)
- #:out-of-source? #true
- ;; Tests are in packages like racket-test-core and
- ;; main-distribution-test that aren't part of the main distribution.
- #:tests? #f
- #:modules ((ice-9 match)
- (guix build gnu-build-system)
- (guix build utils))
- #:phases
- (modify-phases %standard-phases
- (add-after 'unpack 'unpack-nanopass+stex
- (lambda* (#:key inputs native-inputs #:allow-other-keys)
- (with-directory-excursion "racket/src/ChezScheme"
- ,unpack-nanopass+stex)
- #t))
- (add-after 'unpack-nanopass+stex 'unpack-bootfiles
- (lambda* (#:key inputs #:allow-other-keys)
- (with-directory-excursion "racket/src/ChezScheme"
- (copy-recursively
- (string-append (assoc-ref inputs "bootfiles") "/boot")
- "boot"))
- #t))
- (add-before 'configure 'initialize-config.rktd
- (lambda* (#:key inputs #:allow-other-keys)
- (define (write-racket-hash alist)
- ;; inside must use dotted pair notation
- (display "#hash(")
- (for-each (match-lambda
- ((k . v)
- (format #t "(~s . ~s)" k v)))
- alist)
- (display ")\n"))
- (mkdir-p "racket/etc")
- (with-output-to-file "racket/etc/config.rktd"
- (lambda ()
- (write-racket-hash
- `((lib-search-dirs
- . (#f ,@(map (lambda (lib)
- (string-append (assoc-ref inputs lib)
- "/lib"))
- '("openssl"
- "sqlite"))))
- (build-stamp . "")
- (catalogs
- . (,(string-append
- "https://download.racket-lang.org/releases/"
- ,version
- "/catalog/")
- #f))))))
- #t))
- (add-before 'configure 'change-directory
- (lambda _
- (chdir "racket/src")
- #t))
- (add-after 'install 'remove-pkgs-directory
- ;; If the configured pkgs-dir exists, "pkgs.rktd" does not
- ;; exist, and a lock file does not exist, commands like
- ;; `raco pkg show` will try to create a lock file and fail
- ;; due to the read-only store.
- ;; Arguably this may be a bug in `pkg/private/lock`:
- ;; see <https://github.com/racket/racket/issues/3851>.
- ;; As a workaround, remove the directory.
- (lambda* (#:key outputs #:allow-other-keys)
- ;; rmdir because we want an error if it isn't empty
- (rmdir (string-append (assoc-ref outputs "out")
- "/share/racket/pkgs"))
- #t)))))
+ (list
+ #:configure-flags
+ #~`("--tethered"
+ "--extra-foreign-lib-search-dirs"
+ ,(format #f "~s"
+ (list #$(file-append (this-package-input "openssl") "/lib")
+ #$(file-append (this-package-input "sqlite") "/lib"))))
+ #:make-flags #~`("base")
+ #:tests? #f ;; packaged separately
+ #:modules '((guix build gnu-build-system)
+ (guix build utils)
+ (ice-9 match))
+ #:phases
+ #~(modify-phases %standard-phases
+ (replace 'configure
+ (lambda* (#:key inputs configure-flags make-flags
+ #:allow-other-keys)
+ (let* ((vm-dir (search-input-directory inputs "opt/racket-vm"))
+ (racket (string-append vm-dir "/bin/racket")))
+ (apply invoke
+ racket
+ #$make-installation-layer.rkt
+ `(,@(cond
+ ((false-if-exception
+ (search-input-file
+ inputs "etc/racket/config.rktd"))
+ => (lambda (file)
+ `("--parent"
+ ,(dirname (dirname (dirname file))))))
+ (else
+ '()))
+ ,@configure-flags
+ ,vm-dir
+ ,#$output))
+ (invoke racket
+ "--config" (string-append #$output "/etc/racket")
+ "-l" "raco" "setup"
+ "--no-user"))))
+ (replace 'build
+ (lambda* (#:key inputs #:allow-other-keys)
+ (mkdir-p (string-append #$output "/lib/racket/pkgs"))
+ (for-each (lambda (name)
+ (copy-recursively
+ (string-append "pkgs/" name)
+ (string-append #$output "/lib/racket/pkgs/" name)))
+ '("base" "racket-lib"))))
+ (replace 'install
+ (lambda* (#:key inputs make-flags #:allow-other-keys)
+ (let ((racket
+ (search-input-file inputs "/opt/racket-vm/bin/racket")))
+ (unless (null? make-flags)
+ (invoke racket
+ "-l-"
+ "pkg/dirs-catalog"
+ "--link"
+ "local-catalog"
+ (string-append #$output "/lib/racket/pkgs"))
+ (apply invoke
+ racket
+ "--config" (string-append #$output "/etc/racket")
+ "-l" "raco"
+ "pkg" "install"
+ "--installation"
+ "--auto"
+ "--catalog" "local-catalog"
+ make-flags))))))))
(home-page "https://racket-lang.org")
(synopsis "Racket without bundled packages such as DrRacket")
(description
@@ -254,280 +142,77 @@ (define (write-racket-hash alist)
DrRacket IDE, are not included.")
;; https://download.racket-lang.org/license.html
;; The LGPL components are only used by Racket BC.
- (license (list asl2.0 expat))))
-
-
-(define-public racket-minimal-bc-3m
- (hidden-package
- (package
- (inherit racket-minimal)
- (name "racket-minimal-bc-3m")
- (inputs
- (modify-inputs (package-inputs racket-minimal)
- (delete "zlib" "zlib:static" "lz4" "lz4:static")
- (prepend libffi ;; <- only for BC variants
- )))
- (native-inputs
- `(("libtool" ,libtool)
- ("racket" ,(if (%current-target-system)
- racket-minimal
- racket-minimal-bc-cgc))))
- (arguments
- (substitute-keyword-arguments (package-arguments racket-minimal)
- ((#:configure-flags _ '())
- `(list "--enable-bconly"
- ,cfg-flag:enable-racket
- ,cfg-flag:enable-lt
- ,cfg-flag:sh-for-rktio))
- ((#:phases usual-phases)
- `(modify-phases ,usual-phases
- (delete 'unpack-nanopass+stex)
- (delete 'unpack-bootfiles)))))
- (synopsis "Minimal Racket with the BC [3M] runtime system")
- (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'').
-
-This package is the normal implementation of Racket BC with a precise garbage
-collector, 3M (``Moving Memory Manager'').")
- ;; https://download.racket-lang.org/license.html
- ;; The LGPL components are only used by Racket BC.
- (license (list lgpl3+ asl2.0 expat)))))
-
-
-(define-public racket-minimal-bc-cgc
- (package
- (inherit racket-minimal-bc-3m)
- (name "racket-minimal-bc-cgc")
- (native-inputs
- (alist-delete "racket" (package-native-inputs racket-minimal-bc-3m)))
- (arguments
- (substitute-keyword-arguments (package-arguments racket-minimal-bc-3m)
- ((#:configure-flags _ '())
- `(list "--enable-cgcdefault"
- ,cfg-flag:enable-lt
- ,cfg-flag:sh-for-rktio))))
- (synopsis "Old Racket implementation used for bootstrapping")
- (description "This variant of the Racket BC (``before Chez'' or
-``bytecode'') implementation is not recommended for general use. It uses
-CGC (a ``Conservative Garbage Collector''), which was succeeded as default in
-PLT Scheme version 370 (which translates to 3.7 in the current versioning
-scheme) by the 3M variant, which in turn was succeeded in version 8.0 by the
-Racket CS implementation.
-
-Racket BC [CGC] is primarily used for bootstrapping Racket BC [3M]. It may
-also be used for embedding applications without the annotations needed in C
-code to use the 3M garbage collector.")))
-
-
-(define-public racket-bootstrap-chez-bootfiles
- (hidden-package
- (package
- (inherit racket-minimal)
- (name "racket-bootstrap-chez-bootfiles")
- (inputs `())
- (native-inputs
- `(("racket" ,(if (%current-target-system)
- racket-minimal
- racket-minimal-bc-3m))
- ("stex" ,(package-source stex))
- ("nanopass" ,(package-source chez-nanopass))))
-
This message was truncated. Download the full message here.
L
L
Liliana Marie Prikler wrote on 9 Feb 2022 14:42
Re: [RFC PATCH 8/9] gnu: Add chez-scheme-racket-variant.
769cda9ec17a152dc999592827759234436da712.camel@ist.tugraz.at
Am Dienstag, dem 08.02.2022 um 10:18 -0500 schrieb Philip McGrath:
Toggle quote (33 lines)
> The Racket variant of Chez Scheme can be used to support platforms
> that
> are not yet supported by upstream Chez Scheme. The new function
> 'chez-scheme-for-system' selects the Chez Scheme package that best
> supports the target system.
>
> In the process, we also add packages for 'racket-vm-cgc',
> 'racket-vm-bc', and 'racket-vm-cs'. A future commit will change
> 'racket-minimal' to use the Racket VM implementation that best
> supports
> the target system, as reported by 'racket-vm-for-system'.
>
> * gnu/packages/patches/racket-enable-scheme-backport.patch: New
> patch.
> * gnu/local.mk (dist_patch_DATA): Add it.
> * gnu/packages/chez-and-racket-bootstrap.scm (racket-vm-cgc):
> (racket-vm-bc):
> (racket-vm-cs):
> (chez-scheme-racket-variant-bootstrap-bootfiles):
> (chez-scheme-racket-variant): New variables.
> (chez-scheme-for-system, racket-vm-for-system): New exported
> functions.
> * gnu/packages/loko.scm (loko-scheme): Use 'chez-scheme-for-system'.
> * gnu/packages/emacs-xyz.scm (emacs-geiser-chez): Likewise
> * gnu/packages/chez.scm (chez-srfi):
> (chez-web):
> (chez-sockets):
> (chez-matchable):
> (chez-irregex):
> (chez-fmt):
> (chez-mit):
> (chez-scmutils): Likewise.
> (chez-mit)[origin]<snippet>: Add workaround for Racket variant.
This patch does a lot and should probably be separated into several
commits. As far as the name "chez-scheme-racket-variant" is concerned,
I am not really a fan of it. How would "chez-scheme-for-racket" sound?
P
P
Philip McGrath wrote on 10 Feb 2022 02:30
6abafa84-4f63-2bf0-4464-9c7742798902@philipmcgrath.com
Hi,

On 2/9/22 08:42, Liliana Marie Prikler wrote:
Toggle quote (6 lines)
> Am Dienstag, dem 08.02.2022 um 10:18 -0500 schrieb Philip McGrath:
> This patch does a lot and should probably be separated into several
> commits. As far as the name "chez-scheme-racket-variant" is concerned,
> I am not really a fan of it. How would "chez-scheme-for-racket" sound?
>

Thanks for taking a look!

Calling it "chez-scheme-for-racket" is fine with me---it's a little
shorter, at least.

As far as splitting it up, yes, that makes sense. (There had at one
point been some entanglements that I thought would make that difficult,
but I've since fixed all those issues anyway.) What do you think of
splitting it like this?

>> * gnu/packages/patches/racket-enable-scheme-backport.patch: New
>> patch.
>> * gnu/local.mk (dist_patch_DATA): Add it.
>> * gnu/packages/chez-and-racket-bootstrap.scm (racket-vm-cgc):
---
>> (racket-vm-bc):
---
>> (racket-vm-cs):
---
>> (chez-scheme-racket-variant-bootstrap-bootfiles):
>> (chez-scheme-racket-variant): New variables.
---
>> (chez-scheme-for-system,
---
>> (chez-mit)[origin]<snippet>: Add workaround for Racket variant.
---
>> * gnu/packages/loko.scm (loko-scheme): Use 'chez-scheme-for-system'.
>> * gnu/packages/emacs-xyz.scm (emacs-geiser-chez): Likewise
>> * gnu/packages/chez.scm (chez-srfi):
>> (chez-web):
>> (chez-sockets):
>> (chez-matchable):
>> (chez-irregex):
>> (chez-fmt):
>> (chez-mit):
>> (chez-scmutils): Likewise.
---
>> racket-vm-for-system): New exported
>> functions.

Alternatively, I could see adding the snippet to "chez-mit" in the same
commit as changing it to use "chez-scheme-for-system", or I could split
each changed package into its own commit (though those would be
extremely small), or put the definition of "chez-scheme-for-system"
together with its uses, or ...

Racket 8.4 was just released,[0] so I plan to send a revised series
today or tomorrow.

-Philip

L
L
Liliana Marie Prikler wrote on 10 Feb 2022 08:08
aa99da7a8bf48cb2f375dfad0bca7ddd67c48916.camel@ist.tugraz.at
Hi,

Am Mittwoch, dem 09.02.2022 um 20:30 -0500 schrieb Philip McGrath:
Toggle quote (2 lines)
> Calling it "chez-scheme-for-racket" is fine with me---it's a little
> shorter, at least.
Okay.

Toggle quote (4 lines)
> As far as splitting it up, yes, that makes sense. (There had at one
> point been some entanglements that I thought would make that
> difficult, but I've since fixed all those issues anyway.) What do you
> think of splitting it like this?
I'm not entirely sure how the interdependencies are, but I'd do...

Toggle quote (11 lines)
>  >> * gnu/packages/patches/racket-enable-scheme-backport.patch: New
>  >> patch.
>  >> * gnu/local.mk (dist_patch_DATA): Add it.
>  >> * gnu/packages/chez-and-racket-bootstrap.scm (racket-vm-cgc):
> ---
>  >> (racket-vm-bc):
> ---
>  >> (racket-vm-cs):
> ---
>  >> (chez-scheme-for-racket-bootstrap-bootfiles):
>  >> (chez-scheme-for-racket): New variables.
These, then
Toggle quote (2 lines)
> >> (chez-mit)[origin]<snippet>: Add workaround for chez-scheme-for-
> racket.
then
Toggle quote (15 lines)
> ---
>  >> (chez-scheme-for-system, racket-vm-for-system): New variables.
> ---
>  >> * gnu/packages/loko.scm (loko-scheme): Use 'chez-scheme-for-
> system'.
>  >> * gnu/packages/emacs-xyz.scm (emacs-geiser-chez): Likewise
>  >> * gnu/packages/chez.scm (chez-srfi):
>  >> (chez-web):
>  >> (chez-sockets):
>  >> (chez-matchable):
>  >> (chez-irregex):
>  >> (chez-fmt):
>  >> (chez-mit):
>  >> (chez-scmutils): Likewise.
> ---
If that's not possible, you can keep racket-vm-for-system as the final
patch.

Toggle quote (2 lines)
> Racket 8.4 was just released,[0] so I plan to send a revised series
> today or tomorrow.
Cool.

Toggle quote (1 lines)
P
P
Philip McGrath wrote on 13 Feb 2022 22:51
[PATCH 00/11] Update Racket to 8.4. Adjust Chez Scheme packages.
(address . 53878@debbugs.gnu.org)
20220213215127.218952-1-philip@philipmcgrath.com
Hi,

Here's a revised series with the actual Racket 8.4 release!

I've split the 'chez-scheme-for-racket' patch basically as Liliana suggested
in https://issues.guix.gnu.org/53878#12 except that I've added
'racket-vm-for-system' in the commit which actually uses it (the final one),
rather than the commit that adds 'chez-scheme-for-system'.

-Philip

Philip McGrath (11):
gnu: chez-scheme: Move to (gnu packages chez-and-racket-bootstrap).
gnu: chez-scheme: Use "lib/chez-scheme" for search path.
gnu: chez-scheme: Use shared zlib and lz4.
gnu: chez-and-racket-bootstrap: Add utilities for Chez machine types.
gnu: Add stex.
gnu: Add chez-nanopass.
gnu: chez-scheme: Explicitly package bootstrap bootfiles.
gnu: Add chez-scheme-for-racket.
gnu: chez-mit: Support chez-scheme-for-racket.
gnu: chez-and-racket-bootstrap: Add 'chez-scheme-for-system'.
gnu: racket: Update to 8.4.

gnu/local.mk | 6 +-
gnu/packages/chez-and-racket-bootstrap.scm | 1103 +
gnu/packages/chez.scm | 628 +-
gnu/packages/emacs-xyz.scm | 4 +-
gnu/packages/loko.scm | 4 +-
.../racket-enable-scheme-backport.patch | 465 +
...acket-gui-tethered-launcher-backport.patch | 26 +
.../patches/racket-srfi-fsdg-backport.patch | 41622 ++++++++++++++++
gnu/packages/racket.scm | 1554 +-
9 files changed, 44470 insertions(+), 942 deletions(-)
create mode 100644 gnu/packages/chez-and-racket-bootstrap.scm
create mode 100644 gnu/packages/patches/racket-enable-scheme-backport.patch
create mode 100644 gnu/packages/patches/racket-gui-tethered-launcher-backport.patch
create mode 100644 gnu/packages/patches/racket-srfi-fsdg-backport.patch

--
2.32.0
P
P
Philip McGrath wrote on 13 Feb 2022 22:51
[PATCH 01/11] gnu: chez-scheme: Move to (gnu packages chez-and-racket-bootstrap).
(address . 53878@debbugs.gnu.org)
20220213215127.218952-2-philip@philipmcgrath.com
* gnu/packages/chez.scm (nanopass, stex, chez-scheme): Move to ...
* gnu/packages/chez-and-racket-bootstrap.scm: ... this new file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
* gnu/packages/emacs-xyz.scm: Adjust imports accordingly.
* gnu/packages/loko.scm: Likewise.
* gnu/packages/racket.scm: Likewise.
---
gnu/local.mk | 1 +
gnu/packages/chez-and-racket-bootstrap.scm | 278 +++++++++++++++++++++
gnu/packages/chez.scm | 225 +----------------
gnu/packages/emacs-xyz.scm | 2 +-
gnu/packages/loko.scm | 2 +-
gnu/packages/racket.scm | 2 +-
6 files changed, 283 insertions(+), 227 deletions(-)
create mode 100644 gnu/packages/chez-and-racket-bootstrap.scm

Toggle diff (436 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 1b08b40b9c..72e086d465 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -144,6 +144,7 @@ GNU_SYSTEM_MODULES = \
%D%/packages/certs.scm \
%D%/packages/check.scm \
%D%/packages/chemistry.scm \
+ %D%/packages/chez-and-racket-bootstrap.scm \
%D%/packages/chez.scm \
%D%/packages/chicken.scm \
%D%/packages/chromium.scm \
diff --git a/gnu/packages/chez-and-racket-bootstrap.scm b/gnu/packages/chez-and-racket-bootstrap.scm
new file mode 100644
index 0000000000..f102b099fb
--- /dev/null
+++ b/gnu/packages/chez-and-racket-bootstrap.scm
@@ -0,0 +1,278 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2016 Federico Beffa <beffa@fbengineering.ch>
+;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2017, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2019 Brett Gilio <brettg@gnu.org>
+;;; Copyright © 2020 Brendan Tildesley <mail@brendan.scot>
+;;; Copyright © 2021, 2022 Philip McGrath <philip@philipmcgrath.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages chez-and-racket-bootstrap)
+ #:use-module (guix packages)
+ #:use-module (guix download)
+ #:use-module (guix git-download)
+ #:use-module (guix utils)
+ #:use-module (guix gexp)
+ #:use-module (ice-9 match)
+ #:use-module (srfi srfi-1)
+ #:use-module (guix build-system gnu)
+ #:use-module (gnu packages)
+ #:use-module (gnu packages compression)
+ #:use-module (gnu packages ghostscript)
+ #:use-module (gnu packages linux)
+ #:use-module (gnu packages ncurses)
+ #:use-module (gnu packages netpbm)
+ #:use-module (gnu packages tex)
+ #:use-module (gnu packages xorg)
+ #:use-module ((guix licenses)
+ #:prefix license:))
+
+;; Commentary:
+;;
+;; Alphabetically and chronologically, Chez comes before Racket.
+;;
+;; The bootstrapping paths for Chez Scheme and Racket are closely
+;; entwined. Racket CS (the default Racket implementation) is based on (a fork
+;; of) Chez Scheme. Racket's variant of Chez Scheme shares sources for
+;; nanopass and stex with upstream Chez Scheme.
+;;
+;; Racket's variant of Chez Scheme can be bootstrapped by an older Racket
+;; implementation, Racket BC, which can be bootstrapped from C. Porting that
+;; code to work with upstream Chez Scheme (or finding an old version that
+;; does) is our best hope for some day bootstrapping upstream Chez Scheme from
+;; source.
+;;
+;; Putting the relevant definitions together in this module avoids having to
+;; work around dependency cycles.
+;;
+;; Code:
+
+(define nanopass
+ (let ((version "1.9.2"))
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/nanopass/nanopass-framework-scheme")
+ (commit (string-append "v" version))))
+ (sha256 (base32 "16vjsik9rrzbabbhbxbaha51ppi3f9n8rk59pc6zdyffs0vziy4i"))
+ (file-name (git-file-name "nanopass" version)))))
+
+(define stex
+ ;; 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")
+ (version "1.2.2")
+ (version (git-version version "1" commit)))
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/dybvig/stex")
+ (commit commit)))
+ (sha256 (base32 "01jnvw8qw33gnpzwrakwhsr05h6b609lm180jnspcrb7lds2p23d"))
+ (file-name (git-file-name "stex" version)))))
+
+(define-public chez-scheme
+ (package
+ (name "chez-scheme")
+ (version "9.5.6")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/cisco/ChezScheme")
+ (commit (string-append "v" version))))
+ (sha256
+ (base32 "07s433hn1z2slfc026sidrpzxv3a8narcd40qqr1xrpb9012xdky"))
+ (file-name (git-file-name name version))
+ (snippet
+ ;; Remove bundled libraries.
+ (with-imported-modules '((guix build utils))
+ #~(begin
+ (use-modules (guix build utils))
+ (for-each (lambda (dir)
+ (when (directory-exists? dir)
+ (delete-file-recursively dir)))
+ '("stex"
+ "nanopass"
+ "lz4"
+ "zlib")))))))
+ (build-system gnu-build-system)
+ (inputs
+ `(("libuuid" ,util-linux "lib")
+ ("zlib" ,zlib)
+ ("zlib:static" ,zlib "static")
+ ("lz4" ,lz4)
+ ("lz4:static" ,lz4 "static")
+ ;; for expeditor:
+ ("ncurses" ,ncurses)
+ ;; for X11 clipboard support in expeditor:
+ ;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
+ ("libx11" ,libx11)))
+ (native-inputs
+ `(("nanopass" ,nanopass) ; source only
+ ;; for docs
+ ("stex" ,stex)
+ ("xorg-rgb" ,xorg-rgb)
+ ("texlive" ,(texlive-updmap.cfg (list texlive-dvips-l3backend
+ texlive-epsf
+ texlive-fonts-ec
+ texlive-oberdiek)))
+ ("ghostscript" ,ghostscript)
+ ("netpbm" ,netpbm)))
+ (native-search-paths
+ (list (search-path-specification
+ (variable "CHEZSCHEMELIBDIRS")
+ (files (list (string-append "lib/csv" version "-site"))))))
+ (outputs '("out" "doc"))
+ (arguments
+ `(#:modules
+ ((guix build gnu-build-system)
+ (guix build utils)
+ (ice-9 ftw)
+ (ice-9 match))
+ #:test-target "test"
+ #:configure-flags
+ '("--threads") ;; TODO when we fix armhf, it doesn't support --threads
+ #:phases
+ (modify-phases %standard-phases
+ ;; put these where configure expects them to be
+ (add-after 'unpack 'unpack-nanopass+stex
+ (lambda* (#:key native-inputs inputs #:allow-other-keys)
+ (for-each (lambda (dep)
+ (define src
+ (assoc-ref (or native-inputs inputs) dep))
+ (copy-recursively src dep
+ #:keep-mtime? #t))
+ '("nanopass" "stex"))))
+ ;; NOTE: the custom Chez 'configure' script doesn't allow
+ ;; unrecognized flags, such as those automatically added
+ ;; by `gnu-build-system`.
+ (replace 'configure
+ (lambda* (#:key inputs outputs
+ (configure-flags '())
+ #:allow-other-keys)
+ (let* ((zlib-static (assoc-ref inputs "zlib:static"))
+ (lz4-static (assoc-ref inputs "lz4:static"))
+ (out (assoc-ref outputs "out"))
+ ;; add flags which are always required:
+ (flags (cons*
+ (string-append "--installprefix=" out)
+ (string-append "ZLIB=" zlib-static "/lib/libz.a")
+ (string-append "LZ4=" lz4-static "/lib/liblz4.a")
+ ;; Guix will do compress man pages,
+ ;; and letting Chez try causes an error
+ "--nogzip-man-pages"
+ configure-flags)))
+ (format #t "configure flags: ~s~%" flags)
+ ;; Some makefiles (for tests) don't seem to propagate CC
+ ;; properly, so we take it out of their hands:
+ (setenv "CC" ,(cc-for-target))
+ (setenv "HOME" "/tmp")
+ (apply invoke
+ "./configure"
+ flags))))
+ ;; The binary file name is called "scheme" as is the one from MIT/GNU
+ ;; Scheme. We add a symlink to use in case both are installed.
+ (add-after 'install 'install-symlink
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (bin (string-append out "/bin"))
+ (lib (string-append out "/lib"))
+ (name "chez-scheme"))
+ (symlink (string-append bin "/scheme")
+ (string-append bin "/" name))
+ (map (lambda (file)
+ (symlink file (string-append (dirname file)
+ "/" name ".boot")))
+ (find-files lib "scheme.boot")))))
+ ;; Building explicitly lets us avoid using substitute*
+ ;; to re-write makefiles.
+ (add-after 'install-symlink 'prepare-stex
+ (lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
+ (let* ((stex+version
+ (strip-store-file-name
+ (assoc-ref (or native-inputs inputs) "stex")))
+ ;; Eventually we want to install stex as a real
+ ;; package so it's reusable. For now:
+ (stex-output "/tmp")
+ (doc-dir (string-append stex-output
+ "/share/doc/"
+ stex+version)))
+ (with-directory-excursion "stex"
+ (invoke "make"
+ "install"
+ (string-append "LIB="
+ stex-output
+ "/lib/"
+ stex+version)
+ (string-append "Scheme="
+ (assoc-ref outputs "out")
+ "/bin/scheme"))
+ (for-each (lambda (pth)
+ (install-file pth doc-dir))
+ '("ReadMe" ; includes the license
+ "doc/stex.html"
+ "doc/stex.css"
+ "doc/stex.pdf"))))))
+ ;; Building the documentation requires stex and a running scheme.
+ ;; FIXME: this is probably wrong for cross-compilation
+ (add-after 'prepare-stex 'install-doc
+ (lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
+ (let* ((chez+version (strip-store-file-name
+ (assoc-ref outputs "out")))
+ (stex+version
+ (strip-store-file-name
+ (assoc-ref (or native-inputs inputs) "stex")))
+ (scheme (string-append (assoc-ref outputs "out")
+ "/bin/scheme"))
+ ;; see note on stex-output in phase build-stex, above:
+ (stexlib (string-append "/tmp"
+ "/lib/"
+ stex+version))
+ (doc-dir (string-append (assoc-ref outputs "doc")
+ "/share/doc/"
+ chez+version)))
+ (define* (stex-make #:optional (suffix ""))
+ (invoke "make"
+ "install"
+ (string-append "Scheme=" scheme)
+ (string-append "STEXLIB=" stexlib)
+ (string-append "installdir=" doc-dir suffix)))
+ (with-directory-excursion "csug"
+ (stex-make "/csug"))
+ (with-directory-excursion "release_notes"
+ (stex-make "/release_notes"))
+ (with-directory-excursion doc-dir
+ (symlink "release_notes/release_notes.pdf"
+ "release_notes.pdf")
+ (symlink "csug/csug9_5.pdf"
+ "csug.pdf"))))))))
+ ;; Chez Scheme does not have a MIPS backend.
+ ;; FIXME: Debian backports patches to get armhf working.
+ ;; We should too. It is the Chez machine type arm32le
+ ;; (no threaded version upstream yet, though there is in
+ ;; Racket's fork), more specifically (per the release notes) ARMv6.
+ (supported-systems (fold delete %supported-systems
+ '("mips64el-linux" "armhf-linux")))
+ (home-page "https://cisco.github.io/ChezScheme/")
+ (synopsis "R6RS Scheme compiler and run-time")
+ (description
+ "Chez Scheme is a compiler and run-time system for the language of the
+Revised^6 Report on Scheme (R6RS), with numerous extensions. The compiler
+generates native code for each target processor, with support for x86, x86_64,
+and 32-bit PowerPC architectures.")
+ (license license:asl2.0)))
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 47904e7b4e..caf61a95f5 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -4,7 +4,6 @@
;;; Copyright © 2017, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2019 Brett Gilio <brettg@gnu.org>
;;; Copyright © 2020 Brendan Tildesley <mail@brendan.scot>
-;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -32,234 +31,12 @@ (define-module (gnu packages chez)
#:use-module (guix utils)
#:use-module (guix gexp)
#:use-module (guix build-system gnu)
- #:use-module (gnu packages compression)
- #:use-module (gnu packages ncurses)
+ #:use-module (gnu packages chez-and-racket-bootstrap)
#:use-module (gnu packages ghostscript)
- #:use-module (gnu packages linux)
- #:use-module (gnu packages netpbm)
#:use-module (gnu packages tex)
- #:use-module (gnu packages compression)
- #:use-module (gnu packages image)
- #:use-module (gnu packages xorg)
#:use-module (ice-9 match)
#:use-module (srfi srfi-1))
-(define nanopass
- (let ((version "1.9.2"))
- (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/nanopass/nanopass-framework-scheme")
- (commit (string-append "v" version))))
- (sha256 (base32 "16vjsik9rrzbabbhbxbaha51ppi3f9n8rk59pc6zdyffs0vziy4i"))
- (file-name (git-file-name "nanopass" version)))))
-
-(define stex
- ;; 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")
- (version "1.2.2")
- (version (git-version version "1" commit)))
- (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/dybvig/stex")
- (commit commit)))
- (sha256 (base32 "01jnvw8qw33gnpzwrakwhsr05h6b609lm180jnspcrb7lds2p23d"))
- (file-name (git-file-name "stex" version)))))
-
-(define-public chez-scheme
- (package
- (name "chez-scheme")
- (version "9.5.6")
- (source
- (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/cisco/ChezScheme")
- (commit (string-append "v" version))))
- (sha256
- (base32 "07s433hn1z2slfc026sidrpzxv3a8narcd40qqr1xrpb9012xdky"))
- (file-name (git-file-name name version))
- (snippet
- ;; Remove bundled libraries.
- (with-imported-modules '((guix build utils))
- #~(begin
- (use-modules (guix build utils))
- (for-each (lambda (dir)
- (when (directory-exists? dir)
- (delete-file-recursively dir)))
- '("stex"
- "nanopass"
- "lz4"
- "zlib")))))))
- (build-system gnu-build-system)
- (inputs
- `(("libuuid" ,util-linux "lib")
- ("zlib" ,zlib)
- ("zlib:static" ,zlib "static")
- ("lz4" ,lz4)
- ("lz4:static" ,lz4 "static")
- ;; for expeditor:
- ("ncurses" ,ncurses)
- ;; for X11 clipboard support in expeditor:
- ;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
- ("libx11" ,libx11)))
- (native-inputs
- `(("nanopass" ,nanopass) ; source only
- ;; for docs
- ("stex" ,stex)
- ("xorg-rgb" ,xorg-rgb)
- ("texlive" ,(texlive-updmap.cfg (list texlive-dvips-l3backend
- texlive-epsf
- texlive-fonts-ec
- texlive-oberdiek)))
- ("ghostscript" ,ghostscript)
- ("netpbm" ,netpbm)))
- (native-search-paths
- (list (search-path-specification
- (variable "CHEZSCHEMELIBDIRS")
- (files (list (string-append "lib/csv" version "-site"))))))
- (outputs '("out" "doc"))
- (arguments
- `(#:modules
- ((guix build gnu-build-system)
- (guix build utils)
- (ice-9 ftw)
- (ice-9 match))
- #:test-target "test"
- #:configure-flags
- '("--threads") ;; TODO when we fix armhf, it doesn't support --threads
- #:phases
- (modify-phases %standard-phases
- ;; put these where configure expects them to be
- (add-after 'unpack 'unpack-nanopass+stex
- (lambda* (#:key native-inputs inputs #:allow-other-keys)
- (for-each (lambda (dep)
- (define src
- (assoc-ref (or native-inputs inputs) dep))
- (copy-recursively src dep
- #:keep-mtime? #t))
- '("nanopass" "stex"))))
- ;; NOTE: the custom Chez 'configure' script doesn't allow
- ;; unrecognized flags, such as those automatically added
- ;; by `gnu-build-system`.
- (replace 'configure
- (lambda* (#:key inputs outputs
- (configure-flags '())
- #:allow-other-keys)
- (let* ((zlib-static (assoc-ref inputs "zlib:static"))
- (lz4-static (assoc-ref inputs "lz4:static"))
- (out (assoc-ref outputs "out"))
- ;; add flags which are always required:
- (flags (cons*
- (string-append "--installprefix=" out)
- (string-append "ZLIB=" zlib-static "/lib/lib
This message was truncated. Download the full message here.
P
P
Philip McGrath wrote on 13 Feb 2022 22:51
[PATCH 02/11] gnu: chez-scheme: Use "lib/chez-scheme" for search path.
(address . 53878@debbugs.gnu.org)
20220213215127.218952-3-philip@philipmcgrath.com
There does not seem to be any widely accepted standard path to use for
"CHEZSCHEMELIBDIRS". Using a path without a version number in it avoids
having to compute the actual path everywhere, which would be especially
unpleasant when support is added for the Racket variant of Chez Scheme,
which always has a different version number than upstream.

* gnu/packages/chez-and-racket-bootstrap.scm
(chez-scheme)[native-search-paths]: Change to use "lib/chez-scheme"
instead of "lib/csvX.Y.Z-site" for "CHEZSCHEMELIBDIRS".
* gnu/packages/chez.scm (chez-srfi, chez-web, chez-sockets,
chez-matchable, chez-irregex, chez-fmt, chez-mit, chez-scmutils): Update
accordingly. Also, remove input labels and use G-expressions.
---
gnu/packages/chez-and-racket-bootstrap.scm | 2 +-
gnu/packages/chez.scm | 373 +++++++++++----------
2 files changed, 191 insertions(+), 184 deletions(-)

Toggle diff (401 lines)
diff --git a/gnu/packages/chez-and-racket-bootstrap.scm b/gnu/packages/chez-and-racket-bootstrap.scm
index f102b099fb..1ed4631ced 100644
--- a/gnu/packages/chez-and-racket-bootstrap.scm
+++ b/gnu/packages/chez-and-racket-bootstrap.scm
@@ -136,7 +136,7 @@ (define-public chez-scheme
(native-search-paths
(list (search-path-specification
(variable "CHEZSCHEMELIBDIRS")
- (files (list (string-append "lib/csv" version "-site"))))))
+ (files (list (string-append "lib/chez-scheme"))))))
(outputs '("out" "doc"))
(arguments
`(#:modules
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index caf61a95f5..54bbee7923 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -37,6 +37,28 @@ (define-module (gnu packages chez)
#:use-module (ice-9 match)
#:use-module (srfi srfi-1))
+
+;; Help function for Chez Scheme to add the current path to
+;; CHEZSCHEMELIBDIRS.
+(define chez-configure
+ #~(lambda _
+ (let ((chez-env (getenv "CHEZSCHEMELIBDIRS")))
+ (setenv "CHEZSCHEMELIBDIRS"
+ (if chez-env
+ (string-append ".:" chez-env)
+ ".")))))
+
+;; Help function to define make flags for some Chez Scheme custom make
+;; files.
+(define (chez-make-flags name version)
+ #~(let ((out #$output))
+ (list
+ ;; Set 'schemedir' so that libraries are installed in
+ ;; 'lib/chez-scheme' like Chez's 'native-search-paths' expects.
+ (string-append "schemedir=" out "/lib/chez-scheme")
+ (string-append "PREFIX=" out)
+ (string-append "DOCDIR=" out "/share/doc/" #$name "-" #$version))))
+
(define-public chez-srfi
(package
(name "chez-srfi")
@@ -54,13 +76,11 @@ (define-public chez-srfi
(native-inputs
(list chez-scheme))
(arguments
- `(#:make-flags (let ((out (assoc-ref %outputs "out")))
- (list (string-append "PREFIX=" out)
- "CHEZ=chez-scheme --libdirs ./"
- (string-append "chezversion=" ,(package-version chez-scheme))))
- #:test-target "test"
- #:phases (modify-phases %standard-phases
- (delete 'configure))))
+ (list #:make-flags (chez-make-flags name version)
+ #:test-target "test"
+ #:phases #~(modify-phases %standard-phases
+ (replace 'configure
+ #$chez-configure))))
(home-page "https://github.com/fedeinthemix/chez-srfi")
(synopsis "SRFI libraries for Chez Scheme")
(description
@@ -85,42 +105,48 @@ (define-public chez-web
(base32 "1dq25qygyncbfq4kwwqqgyyakfqjwhp5q23vrf3bff1p66nyfl3b"))))
(build-system gnu-build-system)
(native-inputs
- `(("chez-scheme" ,chez-scheme)
- ("ghostscript" ,ghostscript)
- ("texlive" ,(texlive-updmap.cfg (list texlive-oberdiek
- texlive-epsf
- texlive-metapost
- texlive-charter
- texlive-pdftex
- texlive-context
- texlive-cm
- texlive-tex-plain)))))
+ (list chez-scheme
+ ghostscript
+ ;; FIXME: This package fails to build with the error:
+ ;; mktexpk: don't know how to create bitmap font for bchr8r
+ ;; Replacing the following with `texlive` fixes it.
+ ;; What is missing?
+ (texlive-updmap.cfg (list texlive-oberdiek
+ texlive-epsf
+ texlive-metapost
+ texlive-charter
+ texlive-pdftex
+ texlive-context
+ texlive-cm
+ texlive-tex-plain))))
(arguments
- `(#:make-flags (list (string-append "PREFIX=" %output)
- (string-append "DOCDIR=" %output "/share/doc/"
- ,name "-" ,version)
- (string-append "LIBDIR=" %output "/lib/chezweb")
- (string-append "TEXDIR=" %output "/share/texmf-local"))
- #:tests? #f ; no tests
- #:phases
- (modify-phases %standard-phases
- ;; This package has a custom "bootstrap" script that
- ;; is meant to be run from the Makefile.
- (delete 'bootstrap)
- (replace 'configure
- (lambda* _
- (copy-file "config.mk.template" "config.mk")
- (substitute* "tangleit"
- (("\\./cheztangle\\.ss" all)
- (string-append "chez-scheme --program " all)))
- (substitute* "weaveit"
- (("mpost chezweb\\.mp")
- "mpost --tex=tex chezweb.mp")
- (("\\./chezweave" all)
- (string-append "chez-scheme --program " all)))
- (substitute* "installit"
- (("-g \\$GROUP -o \\$OWNER") ""))
- #t)))))
+ (list
+ #:make-flags
+ #~(list (string-append "PREFIX=" #$output)
+ (string-append "DOCDIR=" #$output "/share/doc/"
+ #$name "-" #$version)
+ ;; lib/chez-scheme/chezweb ???
+ (string-append "LIBDIR=" #$output "/lib/chezweb")
+ (string-append "TEXDIR=" #$output "/share/texmf-local"))
+ #:tests? #f ; no tests
+ #:phases
+ #~(modify-phases %standard-phases
+ ;; This package has a custom "bootstrap" script that
+ ;; is meant to be run from the Makefile.
+ (delete 'bootstrap)
+ (replace 'configure
+ (lambda* _
+ (copy-file "config.mk.template" "config.mk")
+ (substitute* "tangleit"
+ (("\\./cheztangle\\.ss" all)
+ (string-append "scheme --program " all)))
+ (substitute* "weaveit"
+ (("mpost chezweb\\.mp")
+ "mpost --tex=tex chezweb.mp")
+ (("\\./chezweave" all)
+ (string-append "scheme --program " all)))
+ (substitute* "installit"
+ (("-g \\$GROUP -o \\$OWNER") "")))))))
(home-page "https://github.com/arcfide/ChezWEB")
(synopsis "Hygienic Literate Programming for Chez Scheme")
(description "ChezWEB is a system for doing Knuthian style WEB
@@ -144,95 +170,74 @@ (define-public chez-sockets
(base32 "1n5fbwwz51fdzvjackgmnsgh363g9inyxv7kmzi0469cwavwcx5m"))))
(build-system gnu-build-system)
(native-inputs
- `(("chez-scheme" ,chez-scheme)
- ("chez-web" ,chez-web)
- ("texlive" ,(texlive-updmap.cfg (list texlive-pdftex)))))
+ (list chez-scheme
+ chez-web
+ (texlive-updmap.cfg (list texlive-pdftex))))
(arguments
- `(#:tests? #f ; no tests
- #:phases
- (modify-phases %standard-phases
- (replace 'configure
- (lambda* (#:key outputs inputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (chez-web (assoc-ref inputs "chez-web"))
- (chez (assoc-ref inputs "chez-scheme"))
- (chez-h (dirname (car (find-files chez "scheme\\.h")))))
- (substitute* "Makefile"
- (("(SCHEMEH=).*$" all var)
- (string-append var chez-h)))
- #t)))
- (add-before 'build 'tangle
- (lambda* (#:key inputs #:allow-other-keys)
- (setenv "TEXINPUTS"
- (string-append
- (getcwd) ":"
- (assoc-ref inputs "chez-web") "/share/texmf-local/tex/generic:"
- ":"))
- ;; just using "make" tries to build the .c files before
- ;; they are created.
- (and (invoke "make" "sockets")
- (invoke "make"))))
- (replace 'build
- (lambda* (#:key outputs inputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (chez-site (string-append out "/lib/csv"
- ,(package-version chez-scheme)
- "-site/arcfide")))
- ;; make sure Chez Scheme can find the shared libraries.
- (substitute* "sockets.ss"
- (("(load-shared-object) \"(socket-ffi-values\\.[sd][oy].*)\""
- all cmd so)
- (string-append cmd " \"" chez-site "/" so "\""))
- (("sockets-stub\\.[sd][oy].*" all)
- (string-append chez-site "/" all)))
- ;; to compile chez-sockets, the .so files must be
- ;; installed (because of the absolute path we
- ;; inserted above).
- (for-each (lambda (f d) (install-file f d))
- '("socket-ffi-values.so" "sockets-stub.so")
- (list chez-site chez-site))
- (zero? (system "echo '(compile-file \"sockets.sls\")' | scheme -q")))))
- (replace 'install
- (lambda* (#:key outputs inputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (lib (string-append out "/lib/chez-sockets"))
- (doc (string-append out "/share/doc/" ,name "-" ,version))
- (chez-site (string-append out "/lib/csv"
- ,(package-version chez-scheme)
- "-site/arcfide")))
- (for-each (lambda (f d) (install-file f d))
- '("sockets.pdf" "sockets.so")
- (list doc chez-site))
- #t))))))
+ (list
+ #:tests? #f ; no tests
+ #:phases
+ #~(modify-phases %standard-phases
+ (replace 'configure
+ (lambda* (#:key native-inputs inputs #:allow-other-keys)
+ (let* ((scheme (search-input-file (or native-inputs inputs)
+ "/bin/scheme"))
+ (lib (string-append (dirname scheme) "/../lib"))
+ (header-file (car (find-files lib "scheme\\.h")))
+ (include-dir (dirname header-file)))
+ (substitute* "Makefile"
+ (("(SCHEMEH=).*$" _ var)
+ (string-append var include-dir))))))
+ (add-before 'build 'tangle
+ (lambda* (#:key inputs #:allow-other-keys)
+ (setenv "TEXINPUTS"
+ (string-append
+ (getcwd) ":"
+ (assoc-ref inputs "chez-web")
+ "/share/texmf-local/tex/generic:"
+ ":"))
+ ;; just using "make" tries to build the .c files before
+ ;; they are created.
+ (and (invoke "make" "sockets")
+ (invoke "make"))))
+ (replace 'build
+ (lambda args
+ (let ((chez-site (string-append #$output
+ "/lib/chez-scheme/arcfide")))
+ ;; make sure Chez Scheme can find the shared libraries.
+ (substitute* "sockets.ss"
+ (("(object \")(socket-ffi-values\\.[sd][oy][^\"]*)(\")"
+ _ pre file post)
+ (string-append pre chez-site "/" file post))
+ (("(\")(sockets-stub\\.[sd][oy][^\"]*)(\")"
+ _ pre file post)
+ (string-append pre chez-site "/" file post)))
+ ;; to compile chez-sockets, the .so files must be
+ ;; installed (because of the absolute path we
+ ;; inserted above).
+ (for-each (lambda (f)
+ (install-file f chez-site))
+ '("socket-ffi-values.so"
+ "sockets-stub.so"))
+ (invoke "bash"
+ "-c"
+ (format #f "echo '~s' | scheme -q"
+ '(compile-file "sockets.sls"))))))
+ (replace 'install
+ (lambda args
+ (install-file "sockets.so"
+ (string-append #$output
+ "/lib/chez-scheme/arcfide"))
+ (install-file "sockets.pdf"
+ (string-append #$output
+ "/share/doc/"
+ #$name "-" #$version)))))))
(home-page "https://github.com/arcfide/chez-sockets")
(synopsis "Extensible sockets library for Chez Scheme")
(description "Chez-sockets is an extensible sockets library for
Chez Scheme.")
(license expat))))
-;; Help function for Chez Scheme to add the current path to
-;; CHEZSCHEMELIBDIRS.
-(define chez-configure
- '(lambda _
- (let ((chez-env (getenv "CHEZSCHEMELIBDIRS")))
- (setenv "CHEZSCHEMELIBDIRS"
- (if chez-env
- (string-append ".:" chez-env)
- "."))
- #t)))
-
-;; Help function to define make flags for some Chez Scheme custom make
-;; files.
-(define (chez-make-flags name version)
- `(let ((out (assoc-ref %outputs "out")))
- (list
- ;; Set 'chezversion' so that libraries are installed in
- ;; 'lib/csvX.Y.Z-site' like Chez's 'native-search-paths' expects.
- (string-append "chezversion=" ,(package-version chez-scheme))
- (string-append "PREFIX=" out)
- (string-append "DOCDIR=" out "/share/doc/"
- ,name "-" ,version))))
-
(define-public chez-matchable
(package
(name "chez-matchable")
@@ -253,10 +258,11 @@ (define-public chez-matchable
(native-inputs
(list chez-scheme))
(arguments
- `(#:make-flags ,(chez-make-flags name version)
- #:test-target "test"
- #:phases (modify-phases %standard-phases
- (replace 'configure ,chez-configure))))
+ (list #:make-flags (chez-make-flags name version)
+ #:test-target "test"
+ #:phases #~(modify-phases %standard-phases
+ (replace 'configure
+ #$chez-configure))))
(synopsis "Portable hygienic pattern matcher for Scheme")
(description "This package provides a superset of the popular Scheme
@code{match} package by Andrew Wright, written in fully portable
@@ -284,10 +290,11 @@ (define-public chez-irregex
(native-inputs
(list chez-scheme))
(arguments
- `(#:make-flags ,(chez-make-flags name version)
- #:test-target "test"
- #:phases (modify-phases %standard-phases
- (replace 'configure ,chez-configure))))
+ (list #:make-flags (chez-make-flags name version)
+ #:test-target "test"
+ #:phases #~(modify-phases %standard-phases
+ (replace 'configure
+ #$chez-configure))))
(home-page "https://github.com/fedeinthemix/chez-irregex")
(synopsis "Portable regular expression library for Scheme")
(description "This package provides a portable and efficient
@@ -314,17 +321,18 @@ (define-public chez-fmt
(native-inputs
(list chez-scheme))
(arguments
- `(#:make-flags ,(chez-make-flags name version)
- #:test-target "chez-check"
- #:phases
- (modify-phases %standard-phases
- (replace 'configure ,chez-configure)
- (replace 'build
- (lambda* (#:key (make-flags '()) #:allow-other-keys)
- (apply invoke "make" "chez-build" make-flags)))
- (replace 'install
- (lambda* (#:key (make-flags '()) #:allow-other-keys)
- (apply invoke "make" "chez-install" make-flags))))))
+ (list #:make-flags (chez-make-flags name version)
+ #:test-target "chez-check"
+ #:phases
+ #~(modify-phases %standard-phases
+ (replace 'configure
+ #$chez-configure)
+ (replace 'build
+ (lambda* (#:key (make-flags '()) #:allow-other-keys)
+ (apply invoke "make" "chez-build" make-flags)))
+ (replace 'install
+ (lambda* (#:key (make-flags '()) #:allow-other-keys)
+ (apply invoke "make" "chez-install" make-flags))))))
(home-page "http://synthcode.com/scheme/fmt")
(synopsis "Combinator formatting library for Chez Scheme")
(description "This package provides a library of procedures for
@@ -354,10 +362,11 @@ (define-public chez-mit
(native-inputs
(list chez-scheme))
(arguments
- `(#:make-flags ,(chez-make-flags name version)
- #:test-target "test"
- #:phases (modify-phases %standard-phases
- (replace 'configure ,chez-configure))))
+ (list #:make-flags (chez-make-flags name version)
+ #:test-target "test"
+ #:phases #~(modify-phases %standard-phases
+ (replace 'configure
+ #$chez-configure))))
(synopsis "MIT/GNU Scheme compatibility library for Chez Scheme")
(description "This package provides a set of MIT/GNU Scheme compatibility
libraries for Chez Scheme. The main goal was to provide the functionality
@@ -386,46 +395,44 @@ (define-public chez-scmutils
(propagated-inputs
(list chez-mit chez-srfi))
(arguments
- `(#:make-flags ,(chez-make-flags name version)
- #:tests? #f ; no test suite
- #:phases
- (modify-phases %standard-phases
- (replace 'configure ,chez-configure)
- ;; Since the documentation is lacking, we install the source
- ;; code. For things to work correctly we have to replace
- ;; relative paths by absolute ones in 'include' forms. This
- ;; in turn requires us to compile the files in the final
- ;; destination.
- (delete 'build)
- (add-after 'install 'install-src
- (lambda* (#:key (make-flags '())
This message was truncated. Download the full message here.
P
P
Philip McGrath wrote on 13 Feb 2022 22:51
[PATCH 03/11] gnu: chez-scheme: Use shared zlib and lz4.
(address . 53878@debbugs.gnu.org)
20220213215127.218952-4-philip@philipmcgrath.com
This change also involves building 'libkernel.a' instead of 'kernel.o'.

Support for these build options was merged upstream in 2019: see

* gnu/packages/chez-and-racket-bootstrap (chez-scheme)[inputs]: Remove
'zlib:static' and 'lz4:static'.
[arguments]: Adjust configure phase accordingly.
---
gnu/packages/chez-and-racket-bootstrap.scm | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)

Toggle diff (39 lines)
diff --git a/gnu/packages/chez-and-racket-bootstrap.scm b/gnu/packages/chez-and-racket-bootstrap.scm
index 1ed4631ced..11d570059b 100644
--- a/gnu/packages/chez-and-racket-bootstrap.scm
+++ b/gnu/packages/chez-and-racket-bootstrap.scm
@@ -114,9 +114,7 @@ (define-public chez-scheme
(inputs
`(("libuuid" ,util-linux "lib")
("zlib" ,zlib)
- ("zlib:static" ,zlib "static")
("lz4" ,lz4)
- ("lz4:static" ,lz4 "static")
;; for expeditor:
("ncurses" ,ncurses)
;; for X11 clipboard support in expeditor:
@@ -169,14 +167,14 @@ (define src
(lz4-static (assoc-ref inputs "lz4:static"))
(out (assoc-ref outputs "out"))
;; add flags which are always required:
- (flags (cons*
- (string-append "--installprefix=" out)
- (string-append "ZLIB=" zlib-static "/lib/libz.a")
- (string-append "LZ4=" lz4-static "/lib/liblz4.a")
- ;; Guix will do compress man pages,
- ;; and letting Chez try causes an error
- "--nogzip-man-pages"
- configure-flags)))
+ (flags (cons* (string-append "--installprefix=" out)
+ "ZLIB=-lz"
+ "LZ4=-llz4"
+ "--libkernel"
+ ;; Guix will do compress-man-pages,
+ ;; and letting Chez try causes an error
+ "--nogzip-man-pages"
+ configure-flags)))
(format #t "configure flags: ~s~%" flags)
;; Some makefiles (for tests) don't seem to propagate CC
;; properly, so we take it out of their hands:
--
2.32.0
P
P
Philip McGrath wrote on 13 Feb 2022 22:51
[PATCH 04/11] gnu: chez-and-racket-bootstrap: Add utilities for Chez machine types.
(address . 53878@debbugs.gnu.org)
20220213215127.218952-5-philip@philipmcgrath.com
* gnu/packages/chez-and-racket-bootstrap.scm (chez-machine->unthreaded,
chez-machine->upstream-restriction, chez-machine->nix-system,
nix-system->chez-machine): New private functions.
(%nix-arch-to-chez-alist, %nix-os-to-chez-alist): New private constants.
(chez-scheme)[supported-systems]: Compute based on
'nix-system->chez-machine' and 'chez-machine->upstream-restriction'.
---
gnu/packages/chez-and-racket-bootstrap.scm | 142 ++++++++++++++++++++-
1 file changed, 140 insertions(+), 2 deletions(-)

Toggle diff (170 lines)
diff --git a/gnu/packages/chez-and-racket-bootstrap.scm b/gnu/packages/chez-and-racket-bootstrap.scm
index 11d570059b..fc1da53178 100644
--- a/gnu/packages/chez-and-racket-bootstrap.scm
+++ b/gnu/packages/chez-and-racket-bootstrap.scm
@@ -28,7 +28,9 @@ (define-module (gnu packages chez-and-racket-bootstrap)
#:use-module (guix utils)
#:use-module (guix gexp)
#:use-module (ice-9 match)
+ #:use-module (ice-9 regex)
#:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26)
#:use-module (guix build-system gnu)
#:use-module (gnu packages)
#:use-module (gnu packages compression)
@@ -61,6 +63,134 @@ (define-module (gnu packages chez-and-racket-bootstrap)
;;
;; Code:
+(define (chez-machine->unthreaded mach)
+ "Given a string MACH naming a Chez Scheme machine type, returns a string
+naming the unthreaded machine type for the same architecture and OS as MACH.
+The returned string may share storage with MACH."
+ (if (eqv? #\t (string-ref mach 0))
+ (substring mach 1)
+ mach))
+(define (chez-machine->threaded mach)
+ "Like @code{chez-machine->unthreaded}, but returns the threaded machine
+type."
+ (if (eqv? #\t (string-ref mach 0))
+ mach
+ (string-append "t" mach)))
+
+;; Based on the implementation from raco-cross-lib/private/cross/platform.rkt
+;; in https://github.com/racket/raco-cross.
+;; For supported platforms, refer to release_notes/release_notes.stex in the
+;; upstream Chez Scheme repository or to racket/src/ChezScheme/README.md
+;; in https://github.com/racket/racket.
+(define %nix-arch-to-chez-alist
+ `(("x86_64" . "a6")
+ ("i386" . "i3")
+ ("aarch64" . "arm64")
+ ("armhf" . "arm32") ;; Chez supports ARM v6+
+ ("ppc" . "ppc32")))
+(define %nix-os-to-chez-alist
+ `(("w64-mingw32" . "nt")
+ ("darwin" . "osx")
+ ("linux" . "le")
+ ("freebsd" . "fb")
+ ("openbsd" . "ob")
+ ("netbsd" . "nb")
+ ("solaris" . "s2")))
+
+(define (chez-machine->upstream-restriction mach)
+ "Given a string MACH naming a Chez Scheme machine type, returns a symbol
+naming a restriction on the upstream Chez Scheme implementation compared to
+the Racket variant, or @code{#f} if no such restriction exists. The
+restriction is reported for the architecture--OS pair, regardless of whether
+MACH specifies a threaded or an unthreaded variant.
+
+Possible restrictions currently include:
+@itemize @bullet
+@item
+@code{'no-threads}: Support for native threads is not available upstream.
+@item
+@code{'no-support}: The upstream release doesn't claim to support this
+architecture--OS combination at all.
+@end itemize
+
+See @code{chez-machine->nix-system} for more details about acceptable values
+for MACH."
+ (let ((mach (chez-machine->unthreaded mach)))
+ (cond
+ ((string-prefix? "arm64" mach)
+ 'no-support)
+ ((string-prefix? "arm32" mach)
+ (if (string-suffix? "le" mach)
+ 'no-threads
+ 'no-support))
+ ((string-prefix? "ppc32" mach)
+ (if (string-suffix? "le" mach)
+ #f
+ 'no-support))
+ (else
+ #f))))
+
+(define (chez-machine->nix-system mach)
+ "Return the Nix system type corresponding to the Chez Scheme machine type
+MACH. If MACH is not a string representing a known machine type, an exception
+is raised. This function does not distinguish between threaded and unthreaded
+variants of MACH.
+
+Note that this function only handles Chez Scheme machine types in the
+strictest sense, not other kinds of descriptors sometimes used in place of a
+Chez Scheme machine type by the Racket, such as @code{\"pb\"}, @code{#f}, or
+@code{\"racket\"}. (When using such extensions, the Chez Scheme machine type
+for the host system is often still relevant.)"
+ (let ((mach (chez-machine->unthreaded mach)))
+ (let find-arch ((alist %nix-arch-to-chez-alist))
+ (match alist
+ (((nix . chez) . alist)
+ (if (string-prefix? chez mach)
+ (string-append
+ nix "-" (let ((mach-os (substring mach (string-length chez))))
+ (let find-os ((alist %nix-os-to-chez-alist))
+ (match alist
+ (((nix . chez) . alist)
+ (if (equal? chez mach-os)
+ nix
+ (find-os alist)))))))
+ (find-arch alist)))))))
+
+(define* (nix-system->chez-machine #:optional (system (%current-system))
+ #:key (threads? 'always))
+ "Return the Chez Scheme machine type corresponding to the Nix system
+identifier SYSTEM, or @code{#f} if the translation of SYSTEM to a Chez Scheme
+machine type is undefined.
+
+When THREADS? is @code{'always} (the default), the threaded variant of the
+machine type will be returned: note that the package returned by
+@code{chez-scheme-for-system} will always support native threads. When
+THREADS? is @code{#f}, the unthreaded machine type will be returned. If
+THREADS? is @code{'upstream} (the default), the threaded variant of the
+machine type will be returned if and only if it is supported by upstream Chez
+Scheme (see @code{chez-machine->upstream-restriction}). If THREADS? is any
+other value, an exception is raised."
+ (let* ((hyphen (string-index system #\-))
+ (nix-arch (substring system 0 hyphen))
+ (nix-os (substring system (+ 1 hyphen)))
+ (chez-arch (assoc-ref %nix-arch-to-chez-alist nix-arch))
+ (chez-os (assoc-ref %nix-os-to-chez-alist nix-os))
+ (mach (and chez-arch chez-os (string-append chez-arch chez-os))))
+ (and mach
+ (match threads?
+ ('always
+ (chez-machine->threaded mach))
+ (#f
+ mach)
+ ('upstream
+ (if (chez-machine->upstream-restriction mach)
+ mach
+ (chez-machine->threaded mach)))))))
+
+;;
+;; Chez Scheme:
+;;
+
(define nanopass
(let ((version "1.9.2"))
(origin
@@ -264,8 +394,16 @@ (define* (stex-make #:optional (suffix ""))
;; We should too. It is the Chez machine type arm32le
;; (no threaded version upstream yet, though there is in
;; Racket's fork), more specifically (per the release notes) ARMv6.
- (supported-systems (fold delete %supported-systems
- '("mips64el-linux" "armhf-linux")))
+ (supported-systems
+ (delete
+ "armhf-linux" ;; <-- should work, but reportedly broken
+ (filter
+ (lambda (system)
+ (and=> (nix-system->chez-machine system)
+ (lambda (mach)
+ (not (eq? 'no-support
+ (chez-machine->upstream-restriction mach))))))
+ %supported-systems)))
(home-page "https://cisco.github.io/ChezScheme/")
(synopsis "R6RS Scheme compiler and run-time")
(description
--
2.32.0
P
P
Philip McGrath wrote on 13 Feb 2022 22:51
[PATCH 05/11] gnu: Add stex.
(address . 53878@debbugs.gnu.org)
20220213215127.218952-6-philip@philipmcgrath.com
* gnu/packages/chez-and-racket-bootstrap.scm (stex-bootstrap): New
variable.
(stex): Change from origin to package inheriting from 'stex-bootstrap'.
(chez-scheme)[native-inputs]: Add 'stex-bootstrap'. Remove
labels. Remove dependencies of stex-bootstrap.
[inputs]: Remove labels.
[arguments]: Adapt to use 'stex-bootstrap', 'search-input-file', and
G-expressions.
(nanopass): Make it public as a temporary workaround for Racket.
* gnu/packages/racket.scm
(racket-bootstrap-chez-bootfiles)[native-inputs]: Update accordingly.
---
gnu/packages/chez-and-racket-bootstrap.scm | 430 ++++++++++++---------
gnu/packages/racket.scm | 5 +-
2 files changed, 258 insertions(+), 177 deletions(-)

Toggle diff (420 lines)
diff --git a/gnu/packages/chez-and-racket-bootstrap.scm b/gnu/packages/chez-and-racket-bootstrap.scm
index fc1da53178..945d1ce2ed 100644
--- a/gnu/packages/chez-and-racket-bootstrap.scm
+++ b/gnu/packages/chez-and-racket-bootstrap.scm
@@ -31,6 +31,7 @@ (define-module (gnu packages chez-and-racket-bootstrap)
#:use-module (ice-9 regex)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
+ #:use-module (guix build-system copy)
#:use-module (guix build-system gnu)
#:use-module (gnu packages)
#:use-module (gnu packages compression)
@@ -191,113 +192,83 @@ (define* (nix-system->chez-machine #:optional (system (%current-system))
;; Chez Scheme:
;;
-(define nanopass
- (let ((version "1.9.2"))
- (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/nanopass/nanopass-framework-scheme")
- (commit (string-append "v" version))))
- (sha256 (base32 "16vjsik9rrzbabbhbxbaha51ppi3f9n8rk59pc6zdyffs0vziy4i"))
- (file-name (git-file-name "nanopass" version)))))
+(define unbundle-chez-submodules
+ #~(begin
+ (use-modules (guix build utils))
+ (for-each (lambda (dir)
+ (when (directory-exists? dir)
+ (delete-file-recursively dir)))
+ '("stex"
+ "nanopass"
+ "lz4"
+ "zlib"))))
-(define stex
- ;; 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")
- (version "1.2.2")
- (version (git-version version "1" commit)))
- (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/dybvig/stex")
- (commit commit)))
- (sha256 (base32 "01jnvw8qw33gnpzwrakwhsr05h6b609lm180jnspcrb7lds2p23d"))
- (file-name (git-file-name "stex" version)))))
+(define (unpack-nanopass+stex)
+ ;; delayed resolution of `nanopass`
+ #~(begin
+ (copy-recursively #$nanopass
+ "nanopass"
+ #:keep-mtime? #t)
+ (mkdir-p "stex")
+ (with-output-to-file "stex/Mf-stex"
+ (lambda ()
+ ;; otherwise, it will try to download submodules
+ (display "# to placate ../configure")))))
(define-public chez-scheme
(package
(name "chez-scheme")
+ ;; The version should match `(scheme-version-number)`.
+ ;; See s/cmacros.ss c. line 360.
(version "9.5.6")
- (source
- (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/cisco/ChezScheme")
- (commit (string-append "v" version))))
- (sha256
- (base32 "07s433hn1z2slfc026sidrpzxv3a8narcd40qqr1xrpb9012xdky"))
- (file-name (git-file-name name version))
- (snippet
- ;; Remove bundled libraries.
- (with-imported-modules '((guix build utils))
- #~(begin
- (use-modules (guix build utils))
- (for-each (lambda (dir)
- (when (directory-exists? dir)
- (delete-file-recursively dir)))
- '("stex"
- "nanopass"
- "lz4"
- "zlib")))))))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/cisco/ChezScheme")
+ (commit (string-append "v" version))))
+ (sha256
+ (base32
+ "07s433hn1z2slfc026sidrpzxv3a8narcd40qqr1xrpb9012xdky"))
+ (file-name (git-file-name name version))
+ (snippet unbundle-chez-submodules)))
(build-system gnu-build-system)
(inputs
- `(("libuuid" ,util-linux "lib")
- ("zlib" ,zlib)
- ("lz4" ,lz4)
- ;; for expeditor:
- ("ncurses" ,ncurses)
- ;; for X11 clipboard support in expeditor:
- ;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
- ("libx11" ,libx11)))
- (native-inputs
- `(("nanopass" ,nanopass) ; source only
- ;; for docs
- ("stex" ,stex)
- ("xorg-rgb" ,xorg-rgb)
- ("texlive" ,(texlive-updmap.cfg (list texlive-dvips-l3backend
- texlive-epsf
- texlive-fonts-ec
- texlive-oberdiek)))
- ("ghostscript" ,ghostscript)
- ("netpbm" ,netpbm)))
+ (list
+ `(,util-linux "lib") ;<-- libuuid
+ zlib
+ lz4
+ ncurses ;<-- for expeditor
+ ;; for X11 clipboard support in expeditor:
+ ;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
+ libx11))
+ (native-inputs (list stex-bootstrap))
(native-search-paths
(list (search-path-specification
(variable "CHEZSCHEMELIBDIRS")
(files (list (string-append "lib/chez-scheme"))))))
(outputs '("out" "doc"))
(arguments
- `(#:modules
- ((guix build gnu-build-system)
+ (list
+ #:modules
+ '((guix build gnu-build-system)
(guix build utils)
(ice-9 ftw)
(ice-9 match))
- #:test-target "test"
- #:configure-flags
- '("--threads") ;; TODO when we fix armhf, it doesn't support --threads
- #:phases
- (modify-phases %standard-phases
- ;; put these where configure expects them to be
- (add-after 'unpack 'unpack-nanopass+stex
- (lambda* (#:key native-inputs inputs #:allow-other-keys)
- (for-each (lambda (dep)
- (define src
- (assoc-ref (or native-inputs inputs) dep))
- (copy-recursively src dep
- #:keep-mtime? #t))
- '("nanopass" "stex"))))
- ;; NOTE: the custom Chez 'configure' script doesn't allow
- ;; unrecognized flags, such as those automatically added
- ;; by `gnu-build-system`.
- (replace 'configure
- (lambda* (#:key inputs outputs
- (configure-flags '())
- #:allow-other-keys)
- (let* ((zlib-static (assoc-ref inputs "zlib:static"))
- (lz4-static (assoc-ref inputs "lz4:static"))
- (out (assoc-ref outputs "out"))
- ;; add flags which are always required:
- (flags (cons* (string-append "--installprefix=" out)
+ #:test-target "test"
+ ;; TODO when we fix armhf, it may not support --threads
+ #:configure-flags #~'("--threads")
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'unpack-nanopass+stex
+ (lambda args
+ #$(unpack-nanopass+stex)))
+ ;; NOTE: the custom Chez 'configure' script doesn't allow
+ ;; unrecognized flags, such as those automatically added
+ ;; by `gnu-build-system`.
+ (replace 'configure
+ (lambda* (#:key inputs (configure-flags '()) #:allow-other-keys)
+ ;; add flags which are always required:
+ (let ((flags (cons* (string-append "--installprefix=" #$output)
"ZLIB=-lz"
"LZ4=-llz4"
"--libkernel"
@@ -305,90 +276,59 @@ (define src
;; and letting Chez try causes an error
"--nogzip-man-pages"
configure-flags)))
- (format #t "configure flags: ~s~%" flags)
- ;; Some makefiles (for tests) don't seem to propagate CC
- ;; properly, so we take it out of their hands:
- (setenv "CC" ,(cc-for-target))
- (setenv "HOME" "/tmp")
- (apply invoke
- "./configure"
- flags))))
- ;; The binary file name is called "scheme" as is the one from MIT/GNU
- ;; Scheme. We add a symlink to use in case both are installed.
- (add-after 'install 'install-symlink
- (lambda* (#:key outputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (bin (string-append out "/bin"))
- (lib (string-append out "/lib"))
- (name "chez-scheme"))
- (symlink (string-append bin "/scheme")
- (string-append bin "/" name))
- (map (lambda (file)
- (symlink file (string-append (dirname file)
- "/" name ".boot")))
- (find-files lib "scheme.boot")))))
- ;; Building explicitly lets us avoid using substitute*
- ;; to re-write makefiles.
- (add-after 'install-symlink 'prepare-stex
- (lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
- (let* ((stex+version
- (strip-store-file-name
- (assoc-ref (or native-inputs inputs) "stex")))
- ;; Eventually we want to install stex as a real
- ;; package so it's reusable. For now:
- (stex-output "/tmp")
- (doc-dir (string-append stex-output
- "/share/doc/"
- stex+version)))
- (with-directory-excursion "stex"
- (invoke "make"
- "install"
- (string-append "LIB="
- stex-output
- "/lib/"
- stex+version)
- (string-append "Scheme="
- (assoc-ref outputs "out")
- "/bin/scheme"))
- (for-each (lambda (pth)
- (install-file pth doc-dir))
- '("ReadMe" ; includes the license
- "doc/stex.html"
- "doc/stex.css"
- "doc/stex.pdf"))))))
- ;; Building the documentation requires stex and a running scheme.
- ;; FIXME: this is probably wrong for cross-compilation
- (add-after 'prepare-stex 'install-doc
- (lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
- (let* ((chez+version (strip-store-file-name
- (assoc-ref outputs "out")))
- (stex+version
- (strip-store-file-name
- (assoc-ref (or native-inputs inputs) "stex")))
- (scheme (string-append (assoc-ref outputs "out")
- "/bin/scheme"))
- ;; see note on stex-output in phase build-stex, above:
- (stexlib (string-append "/tmp"
- "/lib/"
- stex+version))
- (doc-dir (string-append (assoc-ref outputs "doc")
- "/share/doc/"
- chez+version)))
- (define* (stex-make #:optional (suffix ""))
- (invoke "make"
- "install"
- (string-append "Scheme=" scheme)
- (string-append "STEXLIB=" stexlib)
- (string-append "installdir=" doc-dir suffix)))
- (with-directory-excursion "csug"
- (stex-make "/csug"))
- (with-directory-excursion "release_notes"
- (stex-make "/release_notes"))
- (with-directory-excursion doc-dir
- (symlink "release_notes/release_notes.pdf"
- "release_notes.pdf")
- (symlink "csug/csug9_5.pdf"
- "csug.pdf"))))))))
+ (format #t "configure flags: ~s~%" flags)
+ ;; Some makefiles (for tests) don't seem to propagate CC
+ ;; properly, so we take it out of their hands:
+ (setenv "CC" #$(cc-for-target))
+ (setenv "HOME" "/tmp")
+ (apply invoke "./configure" flags))))
+ ;; The binary file name is called "scheme" as is the one from
+ ;; MIT/GNU Scheme. We add a symlink to use in case both are
+ ;; installed.
+ (add-after 'install 'install-symlink
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((scheme (search-input-file outputs "/bin/scheme"))
+ (bin-dir (dirname scheme)))
+ (symlink scheme
+ (string-append bin-dir "/chez-scheme"))
+ (match (find-files (string-append bin-dir "/../lib")
+ "scheme.boot")
+ ((scheme.boot)
+ (symlink scheme.boot
+ (string-append (dirname scheme.boot)
+ "/chez-scheme.boot")))))))
+ ;; Building the documentation requires stex and a running scheme.
+ ;; FIXME: this is probably wrong for cross-compilation
+ (add-after 'install-symlink 'install-doc
+ (lambda* (#:key native-inputs inputs outputs
+ #:allow-other-keys)
+ (match (assoc-ref outputs "doc")
+ (#f
+ (format #t "not installing docs~%"))
+ (doc-prefix
+ (let* ((chez+version (strip-store-file-name #$output))
+ (scheme (search-input-file outputs "/bin/scheme"))
+ (stexlib (search-input-directory
+ (or native-inputs inputs)
+ "/lib/stex"))
+ (doc-dir (string-append doc-prefix
+ "/share/doc/"
+ chez+version)))
+ (define* (stex-make #:optional (suffix ""))
+ (invoke "make" "install"
+ (string-append "Scheme=" scheme)
+ (string-append "STEXLIB=" stexlib)
+ (string-append "installdir="
+ doc-dir suffix)))
+ (with-directory-excursion "csug"
+ (stex-make "/csug"))
+ (with-directory-excursion "release_notes"
+ (stex-make "/release_notes"))
+ (with-directory-excursion doc-dir
+ (symlink "release_notes/release_notes.pdf"
+ "release_notes.pdf")
+ (symlink "csug/csug9_5.pdf"
+ "csug.pdf"))))))))))
;; Chez Scheme does not have a MIPS backend.
;; FIXME: Debian backports patches to get armhf working.
;; We should too. It is the Chez machine type arm32le
@@ -412,3 +352,145 @@ (define* (stex-make #:optional (suffix ""))
generates native code for each target processor, with support for x86, x86_64,
and 32-bit PowerPC architectures.")
(license license:asl2.0)))
+
+;;
+;; Chez's bootstrap dependencies:
+;;
+
+(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"))
+ (hidden-package
+ (package
+ (name "stex")
+ ;; ^ Debian calls this "stex", not "chez-stex". It is a set of
+ ;; command-line tools, and there isn't a Scheme API, let alone a
+ ;; Chez-specific one, except perhaps that the Scheme examples are
+ ;; assumed to be Chez-compatible.
+ (version (git-version "1.2.2" revision commit))
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/dybvig/stex")
+ (commit commit)))
+ (sha256
+ (base32 "01jnvw8qw33gnpzwrakwhsr05h6b609lm180jnspcrb7lds2p23d"))
+ (file-name (git-file-name name version))
+ (snippet
+ #~(for-each delete-file
+ '("sbin/install" "doc/stex.pdf" "doc/stex.html")))))
+ (outputs '("out"))
+ (build-system copy-build-system)
+ ;; N.B. Upstream does not seem to support cross-compilation,
+ ;; though it would probably be easy to add.
+ (propagated-inputs
+ (list xorg-rgb
+ (texlive-updmap.cfg
+ (list texlive-dvips-l3backend
+ texlive-hyperref
+ texlive-bibtex
+ texlive-epsf
+ texlive-fonts-ec
+ texlive-oberdiek))
+ ghostscript
+ netpbm))
+ ;; Debian uses a versionless path for STEXLIB,
+ ;; which is much more convienient.
+ (arguments
+ (list
+ #:install-plan #~`(("inputs" "lib/stex/")
+ ("gifs" "lib/stex/")
+ ("math" "lib/stex/")
+ ("src" "lib/stex/") ;; can run without compiling
+ ("Mf-stex" "lib/stex/")
+ ("Makefile.template" "lib/stex/"))
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-before 'install 'patch-sources
+ (lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
+ (define scheme
+ (false-if-exception
+ (search-input-file inputs "/bin/scheme")))
+ (when scheme
+ (setenv "Scheme" scheme))
+ (substitute* '("Makefile.template"
+ "doc/Makefile")
+ (("STEXLIB=[^\n]*")
+ (string-append "STEXLIB=" #$output "/lib/stex"))
+ (("Scheme=[^\n]*")
+ (string-append "Scheme=" (or scheme "scheme"))))
+ (substitute* '("Mf-stex"
+ "math/Makefile")
+ (("/bin/rm")
+ "rm"))
+ (substitute* "Mf-stex"
+ (("SHELL=bash")
+ ;; avoid Solaris workaround
+ "#SHELL=bash"))))
+ (add-after 'install 'maybe-compile
+ (lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
+ (cond
+ ((getenv "Scheme")
+ => (lambda (scheme)
+ (define makefile
+ (string-append (getcwd) "/Makefile"))
+
This message was truncated. Download the full message here.
P
P
Philip McGrath wrote on 13 Feb 2022 22:51
[PATCH 06/11] gnu: Add chez-nanopass.
(address . 53878@debbugs.gnu.org)
20220213215127.218952-7-philip@philipmcgrath.com
* gnu/packages/chez-and-racket-bootstrap.scm (nanopass): Rename to ...
(chez-nanopass-bootstrap): ... this new variable, and promote it from an
origin to a package.
(chez-scheme)[native-inputs]: Add it.
(chez-nanopass): New variable.
(unpack-nanopass+stex): Adapt accordingly.
* gnu/packages/racket.scm
(racket-bootstrap-chez-bootfiles)[native-inputs]: Likewise.
---
gnu/packages/chez-and-racket-bootstrap.scm | 97 ++++++++++++++++++----
gnu/packages/racket.scm | 2 +-
2 files changed, 82 insertions(+), 17 deletions(-)

Toggle diff (142 lines)
diff --git a/gnu/packages/chez-and-racket-bootstrap.scm b/gnu/packages/chez-and-racket-bootstrap.scm
index 945d1ce2ed..90fd63b5ae 100644
--- a/gnu/packages/chez-and-racket-bootstrap.scm
+++ b/gnu/packages/chez-and-racket-bootstrap.scm
@@ -203,12 +203,13 @@ (define unbundle-chez-submodules
"lz4"
"zlib"))))
-(define (unpack-nanopass+stex)
- ;; delayed resolution of `nanopass`
+(define unpack-nanopass+stex
#~(begin
- (copy-recursively #$nanopass
- "nanopass"
- #:keep-mtime? #t)
+ (copy-recursively
+ (dirname (search-input-file %build-inputs
+ "lib/chez-scheme/nanopass.ss"))
+ "nanopass"
+ #:keep-mtime? #t)
(mkdir-p "stex")
(with-output-to-file "stex/Mf-stex"
(lambda ()
@@ -241,7 +242,7 @@ (define-public chez-scheme
;; for X11 clipboard support in expeditor:
;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
libx11))
- (native-inputs (list stex-bootstrap))
+ (native-inputs (list chez-nanopass-bootstrap stex-bootstrap))
(native-search-paths
(list (search-path-specification
(variable "CHEZSCHEMELIBDIRS")
@@ -261,7 +262,7 @@ (define-public chez-scheme
#~(modify-phases %standard-phases
(add-after 'unpack 'unpack-nanopass+stex
(lambda args
- #$(unpack-nanopass+stex)))
+ #$unpack-nanopass+stex))
;; NOTE: the custom Chez 'configure' script doesn't allow
;; unrecognized flags, such as those automatically added
;; by `gnu-build-system`.
@@ -485,12 +486,76 @@ (define-public stex
(outputs '("out" "doc"))
(properties '())))
-(define-public nanopass
- (let ((version "1.9.2"))
- (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/nanopass/nanopass-framework-scheme")
- (commit (string-append "v" version))))
- (sha256 (base32 "16vjsik9rrzbabbhbxbaha51ppi3f9n8rk59pc6zdyffs0vziy4i"))
- (file-name (git-file-name "nanopass" version)))))
+(define-public chez-nanopass-bootstrap
+ (hidden-package
+ (package
+ (name "chez-nanopass")
+ (version "1.9.2")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/nanopass/nanopass-framework-scheme")
+ (commit (string-append "v" version))))
+ (sha256
+ (base32 "16vjsik9rrzbabbhbxbaha51ppi3f9n8rk59pc6zdyffs0vziy4i"))
+ (file-name (git-file-name "nanopass-framework-scheme" version))
+ (snippet
+ #~(begin
+ (use-modules (guix build utils))
+ (when (file-exists? "doc/user-guide.pdf")
+ (delete-file "doc/user-guide.pdf"))
+ (substitute* "doc/Makefile"
+ (("include ~/stex/Mf-stex")
+ "include $(STEXLIB)/Mf-stex"))))))
+ (build-system copy-build-system)
+ (arguments
+ (list #:install-plan
+ #~`(("nanopass.ss" "lib/chez-scheme/")
+ ("nanopass" "lib/chez-scheme/"))))
+ (home-page "https://nanopass.org")
+ (synopsis "DSL for compiler development")
+ (description "The Nanopass framework is an embedded domain-specific
+language for writing compilers composed of several simple passes that
+operate over well-defined intermediate languages. The goal of this
+organization is both to simplify the understanding of each pass, because it
+is responsible for a single task, and to simplify the addition of new passes
+anywhere in the compiler. Nanopass reduces the boilerplate required to
+create compilers, making them easier to understand and maintain.")
+ (license license:expat))))
+
+(define-public chez-nanopass
+ (package/inherit chez-nanopass-bootstrap
+ (properties '())
+ ;; TODO: cross-compilation
+ (native-inputs (list chez-scheme stex))
+ (arguments
+ (substitute-keyword-arguments (package-arguments chez-nanopass-bootstrap)
+ ((#:install-plan base-plan)
+ #~`(("nanopass.so" "lib/chez-scheme/")
+ ("doc/user-guide.pdf" #$(string-append
+ "share/doc/"
+ (package-name this-package)
+ "-"
+ (package-version this-package)
+ "/"))
+ ,@#$base-plan))
+ ((#:phases base-phases #~%standard-phases)
+ #~(modify-phases #$base-phases
+ (add-before 'install 'compile-and-test
+ (lambda args
+ (invoke "scheme"
+ "--compile-imported-libraries"
+ "--program" "test-all.ss")))
+ (add-after 'compile-and-test 'build-doc
+ (lambda* (#:key native-inputs inputs #:allow-other-keys)
+ (with-directory-excursion "doc"
+ (invoke "make"
+ (string-append "Scheme="
+ (search-input-file
+ (or native-inputs inputs)
+ "/bin/scheme"))
+ (string-append "STEXLIB="
+ (search-input-directory
+ (or native-inputs inputs)
+ "/lib/stex"))))))))))))
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index d8338bcd6f..e8d016c07b 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -334,7 +334,7 @@ (define-public racket-bootstrap-chez-bootfiles
racket-minimal
racket-minimal-bc-3m))
("stex" ,(package-source stex))
- ("nanopass" ,nanopass)))
+ ("nanopass" ,(package-source chez-nanopass))))
(arguments
`(#:phases
(modify-phases %standard-phases
--
2.32.0
P
P
Philip McGrath wrote on 13 Feb 2022 22:51
[PATCH 07/11] gnu: chez-scheme: Explicitly package bootstrap bootfiles.
(address . 53878@debbugs.gnu.org)
20220213215127.218952-8-philip@philipmcgrath.com
This might seem a bit silly in isolation, but it makes the structure of
the upstream Chez Scheme package the same as for the Racket variant, it
sets things up for (one day, hopefully) actually being able to bootstrap
the upstream Chez Scheme bootfiles, and it may be useful for
cross-compilation and adding support for architectures without pre-built
bootfiles from upstream.

* gnu/packages/chez-and-racket-bootstrap.scm
(chez-scheme-bootstrap-bootfiles): New variable.
(chez-scheme)[native-inputs]: Add it.
[arguments]: Add new phase 'unpack-bootfiles'.
[version, source, home-page]: Derive from 'chez-scheme-bootstrap-bootfiles'.
---
gnu/packages/chez-and-racket-bootstrap.scm | 57 ++++++++++++++++++++--
1 file changed, 52 insertions(+), 5 deletions(-)

Toggle diff (100 lines)
diff --git a/gnu/packages/chez-and-racket-bootstrap.scm b/gnu/packages/chez-and-racket-bootstrap.scm
index 90fd63b5ae..38708ab690 100644
--- a/gnu/packages/chez-and-racket-bootstrap.scm
+++ b/gnu/packages/chez-and-racket-bootstrap.scm
@@ -216,9 +216,9 @@ (define unpack-nanopass+stex
;; otherwise, it will try to download submodules
(display "# to placate ../configure")))))
-(define-public chez-scheme
+(define-public chez-scheme-bootstrap-bootfiles
(package
- (name "chez-scheme")
+ (name "chez-scheme-bootstrap-bootfiles")
;; The version should match `(scheme-version-number)`.
;; See s/cmacros.ss c. line 360.
(version "9.5.6")
@@ -230,8 +230,45 @@ (define-public chez-scheme
(sha256
(base32
"07s433hn1z2slfc026sidrpzxv3a8narcd40qqr1xrpb9012xdky"))
- (file-name (git-file-name name version))
+ (file-name (git-file-name "chez-scheme" version))
(snippet unbundle-chez-submodules)))
+ (build-system copy-build-system)
+ ;; TODO: cross compilation
+ (arguments
+ (list #:install-plan
+ #~`(("boot/" "lib/chez-scheme-bootfiles"))))
+ (supported-systems
+ ;; Upstream only distributes pre-built bootfiles for
+ ;; arm32le and t?(i3|a6)(le|nt|osx)
+ (filter (lambda (system)
+ (let ((mach (nix-system->chez-machine system #:threads? #f)))
+ (or (equal? "arm32le" mach)
+ (and mach
+ (member (substring mach 0 2) '("i3" "a6"))
+ (or-map (cut string-suffix? <> mach)
+ '("le" "nt" "osx"))))))
+ %supported-systems))
+ (home-page "https://cisco.github.io/ChezScheme/")
+ (synopsis "Chez Scheme bootfiles (binary seed)")
+ (description
+ "Chez Scheme is a self-hosting compiler: building it requires
+``bootfiles'' containing the Scheme-implemented portions compiled for the
+current platform. (Chez can then cross-compile bootfiles for all other
+supported platforms.)
+
+This package provides bootstrap bootfiles for upstream Chez Scheme.
+Currently, it simply packages the binaries checked in to the upsream
+repository. Hopefully we can eventually adapt Racket's @code{cs-bootstrap} to
+work with upstream Chez Scheme so that we can bootstrap these files from
+source.")
+ (properties `((hidden? . #t)))
+ (license license:asl2.0)))
+
+(define-public chez-scheme
+ (package
+ (name "chez-scheme")
+ (version (package-version chez-scheme-bootstrap-bootfiles))
+ (source (package-source chez-scheme-bootstrap-bootfiles))
(build-system gnu-build-system)
(inputs
(list
@@ -242,7 +279,9 @@ (define-public chez-scheme
;; for X11 clipboard support in expeditor:
;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
libx11))
- (native-inputs (list chez-nanopass-bootstrap stex-bootstrap))
+ (native-inputs (list chez-scheme-bootstrap-bootfiles
+ chez-nanopass-bootstrap
+ stex-bootstrap))
(native-search-paths
(list (search-path-specification
(variable "CHEZSCHEMELIBDIRS")
@@ -263,6 +302,14 @@ (define-public chez-scheme
(add-after 'unpack 'unpack-nanopass+stex
(lambda args
#$unpack-nanopass+stex))
+ (add-after 'unpack-nanopass+stex 'unpack-bootfiles
+ (lambda* (#:key native-inputs inputs #:allow-other-keys)
+ (when (directory-exists? "boot")
+ (delete-file-recursively "boot"))
+ (copy-recursively
+ (search-input-directory (or native-inputs inputs)
+ "lib/chez-scheme-bootfiles")
+ "boot")))
;; NOTE: the custom Chez 'configure' script doesn't allow
;; unrecognized flags, such as those automatically added
;; by `gnu-build-system`.
@@ -345,7 +392,7 @@ (define* (stex-make #:optional (suffix ""))
(not (eq? 'no-support
(chez-machine->upstream-restriction mach))))))
%supported-systems)))
- (home-page "https://cisco.github.io/ChezScheme/")
+ (home-page (package-home-page chez-scheme-bootstrap-bootfiles))
(synopsis "R6RS Scheme compiler and run-time")
(description
"Chez Scheme is a compiler and run-time system for the language of the
--
2.32.0
P
P
Philip McGrath wrote on 13 Feb 2022 22:51
[PATCH 08/11] gnu: Add chez-scheme-for-racket.
(address . 53878@debbugs.gnu.org)
20220213215127.218952-9-philip@philipmcgrath.com
The Racket variant of Chez Scheme can be used to support platforms that
are not yet supported by upstream Chez Scheme.

In the process, we also add packages for 'racket-vm-cgc',
'racket-vm-bc', and 'racket-vm-cs'. A future commit will change
'racket-minimal' to use the Racket VM implementation that best supports
the target system.

* gnu/packages/patches/racket-enable-scheme-backport.patch: New patch.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/chez-and-racket-bootstrap.scm (racket-vm-cgc):
(racket-vm-bc):
(racket-vm-cs):
(chez-scheme-for-racket-bootstrap-bootfiles):
(chez-scheme-for-racket): New variables.
---
gnu/local.mk | 1 +
gnu/packages/chez-and-racket-bootstrap.scm | 489 +++++++++++++++++-
.../racket-enable-scheme-backport.patch | 465 +++++++++++++++++
3 files changed, 948 insertions(+), 7 deletions(-)
create mode 100644 gnu/packages/patches/racket-enable-scheme-backport.patch

Toggle diff (414 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 72e086d465..8ffdd15ee2 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1787,6 +1787,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-enable-scheme-backport.patch \
%D%/packages/patches/racket-minimal-sh-via-rktio.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-and-racket-bootstrap.scm b/gnu/packages/chez-and-racket-bootstrap.scm
index 38708ab690..d2f78dfae2 100644
--- a/gnu/packages/chez-and-racket-bootstrap.scm
+++ b/gnu/packages/chez-and-racket-bootstrap.scm
@@ -34,8 +34,11 @@ (define-module (gnu packages chez-and-racket-bootstrap)
#:use-module (guix build-system copy)
#:use-module (guix build-system gnu)
#:use-module (gnu packages)
+ #:use-module (gnu packages autotools)
+ #:use-module (gnu packages bash)
#:use-module (gnu packages compression)
#:use-module (gnu packages ghostscript)
+ #:use-module (gnu packages libffi)
#:use-module (gnu packages linux)
#:use-module (gnu packages ncurses)
#:use-module (gnu packages netpbm)
@@ -62,6 +65,144 @@ (define-module (gnu packages chez-and-racket-bootstrap)
;; Putting the relevant definitions together in this module avoids having to
;; work around dependency cycles.
;;
+;; Anatomy of Racket:
+;; ------------------
+;;
+;; The main Racket Git repository (<https://github.com/racket/racket>) is
+;; organized broadly like this:
+;;
+;; .
+;; ├── Makefile
+;; ├── pkgs/
+;; └── racket/
+;; ├── collects/
+;; └── src/
+;; ├── configure
+;; ├── Makefile.in
+;; ├── bc/
+;; ├── cs/
+;; ├── ChezScheme/
+;; └── ...
+;;
+;; 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,
+;; e.g. <https://github.com/pycket/pycket>.) One way of thinking about the
+;; bounary between the Racket VM and Racket programs is that the VM implements
+;; the primitives accessed by the 'ffi/unsafe/vm' library. Another perspective
+;; is that DrRacket's ``Open defining file''/``Jump to definition'' features
+;; can navigate into Racket programs, including into the implementation of
+;; 'racket/base', but can not jump into the implementation of the Racket VM
+;; itself. A third, related perspective is that Racket code is usually
+;; installed with source files alongside compiled code (though this is not
+;; mandatory), whereas the Racket VM is installed only in compiled form.
+;;
+;; The 'racket/collects/' directory contains ``built in'' Racket libraries
+;; that are not part of any package, including the implementation of
+;; 'racket/base': in particular, it must contain enough to implement `raco pkg
+;; install'. It is theoretically possible to use the Racket VM layer without
+;; the main collections, but it is not stable or useful.
+;;
+;; The 'pkgs/' directory contains Racket packages that are especially closely
+;; tied to the implementation of the Racket VM, including 'compiler-lib',
+;; 'racket-doc', and 'racket-test'. Some of these packages depend on Racket
+;; packages that are developed in other Git repositories, predominantly but
+;; not exclusively under the 'racket' GitHub organization. Conversely, not all
+;; of the packages developed in the main Git repository are part of the main
+;; Racket distribution. (Additionally, components of the Racket VM that are
+;; implemented in Racket can be installed as packages, mostly for ease of
+;; development.)
+;;
+;; 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.
+;;
+;; A ''minimal Racket'' installation includes two packages: 'base', which is a
+;; sort of bridge between the current ``built-in'' collections and the package
+;; system's model of dependencies, and 'racket-lib', which, for installations
+;; that can not rely on a system package manager, pulls in the SQLite and
+;; OpenSSL shared libraries as platform-specific dependencies for use by the
+;; ``built-in'' collections.
+;;
+;; The main Racket distribution consists of installing the 'main-distribution'
+;; package and all of its dependencies.
+;;
+;; The default mode when building Racket (or installing it with the released
+;; installers) is an ``in-place build'', which produces a self-contained,
+;; relocatable, roughly FHS-like directory. (Racket also supports
+;; ``Unix-style'' installations, which rearrange the parts of an in-place
+;; build into Racket-specific subdirectories and generally tries to work for
+;; installation into an FHS-based system.) Certain tools, e.g. 'distro-build'
+;; and 'raco cross', are able to work with an in-place Racket build.
+;;
+;; 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.
+;;
+;; 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.
+;;
+;; Bootstrapping Racket:
+;; ---------------------
+;;
+;; Here's how bootstrapping Racket works:
+;;
+;; - Racket BC [CGC] can be built with only a C compiler (except for
+;; one caveat discussed below).
+;; - Racket BC [3M] needs an existing Racket to run "xform",
+;; which transforms its own C source code to add additional annotations
+;; for the precise garbage collector.
+;; - Racket CS needs (bootfiles for) Racket's fork of Chez Scheme.
+;; It also needs an existing Racket to compile Racket-implemented
+;; parts of the runtime system to R6RS libraries.
+;; - Chez Scheme also needs bootfiles for itself, but Racket can simulate
+;; enough of Chez Scheme to load Racket's fork of the Chez Scheme compiler
+;; purely from source into Racket and apply the compiler to itself,
+;; producing the needed bootfiles (albeit very slowly).
+;; Any variant of Racket since version 7.1 can run the simulation.
+;;
+;; So, we build CGC to build 3M to build bootfiles and CS.
+;;
+;; (Note: since the CGC variant is basically only for bootstrapping, we
+;; often use "BC" to mean "3M", consistent with `(banner)` and the
+;; suffixes used on executables when more than one variant co-exists.)
+;;
+;; One remaining bootstrapping limitation is that Racket's reader, module
+;; system, and macro expander are implemented in Racket. For Racket CS,
+;; they are compiled to R6RS libraries as discussed above. This note from the
+;; README file applies to all such subsystems:
+;;
+;; The Racket version must be practically the same as the current Racket
+;; verson, although it can be the Racket BC implementation (instead of
+;; the Racket CS implementation).
+;;
+;; Unlike Chez Scheme boot files, the files generated in "schemified"
+;; are human-readable and -editable Scheme code. That provides a way
+;; out of bootstrapping black holes, even without BC.
+;;
+;; 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
+;;
+;; 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:
(define (chez-machine->unthreaded mach)
@@ -189,19 +330,19 @@ (define* (nix-system->chez-machine #:optional (system (%current-system))
(chez-machine->threaded mach)))))))
;;
-;; Chez Scheme:
+;; Chez auxiliary G-expressions:
;;
(define unbundle-chez-submodules
#~(begin
(use-modules (guix build utils))
(for-each (lambda (dir)
- (when (directory-exists? dir)
- (delete-file-recursively dir)))
- '("stex"
- "nanopass"
- "lz4"
- "zlib"))))
+ (when (directory-exists? dir)
+ (delete-file-recursively dir)))
+ '("stex"
+ "nanopass"
+ "lz4"
+ "zlib"))))
(define unpack-nanopass+stex
#~(begin
@@ -216,6 +357,234 @@ (define unpack-nanopass+stex
;; otherwise, it will try to download submodules
(display "# to placate ../configure")))))
+;;
+;; Racket VM:
+;;
+
+(define (racket-vm-common-configure-flags)
+ ;; under a lambda extraction to avoid evaluating bash-minimal too early
+ #~`(,@(cond
+ ((false-if-exception
+ (search-input-file %build-inputs "/bin/libtool"))
+ => (lambda (libtool)
+ (list (string-append "--enable-lt=" libtool))))
+ (else
+ '()))
+ ,@(cond
+ ((false-if-exception
+ (search-input-file %build-inputs "/opt/racket-vm/bin/racket"))
+ => (lambda (racket)
+ (list (string-append "--enable-racket=" racket))))
+ (else
+ '()))
+ ,(string-append "CPPFLAGS=-DGUIX_RKTIO_PATCH_BIN_SH="
+ #$(file-append bash-minimal "/bin/sh"))
+ "--disable-strip"
+ "--enable-origtree"))
+
+(define-public racket-vm-cgc
+ ;; Eventually, it may make sense for some vm packages to not be hidden,
+ ;; but this one is especially likely to remain hidden.
+ (hidden-package
+ (package
+ (name "racket-vm-cgc")
+ (version "8.4")
+ ;; ^ Remember to also update the version of
+ ;; chez-scheme-for-racket-bootstrap-bootfiles
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/racket/racket")
+ (commit (string-append "v" version))))
+ (sha256
+ (base32 "1vpl66gdgc8rnldmn8rmb7ar9l057jqjvgpfn29k57i3c5skr8s6"))
+ (file-name (git-file-name "racket" version))
+ (patches (search-patches "racket-minimal-sh-via-rktio.patch"
+ ;; Remove by Racket 8.5:
+ "racket-enable-scheme-backport.patch"))
+ (modules '((guix build utils)))
+ (snippet
+ #~(begin
+ ;; Unbundle Chez submodules.
+ (with-directory-excursion "racket/src/ChezScheme"
+ #$unbundle-chez-submodules)
+ ;; Unbundle libffi.
+ (delete-file-recursively "racket/src/bc/foreign/libffi")))))
+ (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"))
+ (build-system gnu-build-system)
+ (arguments
+ (list
+ #:configure-flags
+ #~(cons "--enable-cgcdefault"
+ #$(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.
+ #:tests? #f
+ ;; Upstream recommends #:out-of-source?, and it does
+ ;; help with debugging, but it confuses `install-license-files`.
+ #:modules '((ice-9 match)
+ (ice-9 regex)
+ (guix build gnu-build-system)
+ (guix build utils))
+ #:strip-directories #~'("opt/racket-vm/bin"
+ "opt/racket-vm/lib")
+ #:phases
+ #~(let ()
+ (define* ((wrap-racket-vm-outputs phase) . args)
+ (apply
+ phase
+ (let loop ((args args))
+ (match args
+ ((#:outputs outputs . args)
+ `(#:outputs
+ ,(let loop ((outputs outputs))
+ (match outputs
+ ((("out" . out) . outputs)
+ `(("out" . ,(string-append out "/opt/racket-vm/"))
+ ,@outputs))
+ ((other . outputs)
+ (cons other (loop outputs)))))
+ ,@args))
+ ((arg . args)
+ (cons arg (loop args)))))))
+ (modify-phases %standard-phases
+ (add-before 'configure 'initialize-config.rktd
+ (lambda* (#:key inputs #:allow-other-keys)
+ (define (write-racket-hash alist)
+ ;; inside must use dotted pair notation
+ (display "#hash(")
+ (for-each (match-lambda
+ ((k . v)
+ (format #t "(~s . ~s)" k v)))
+ alist)
+ (display ")\n"))
+ (define maybe-release-catalog
+ (let ((v #$(package-version this-package)))
+ (if (string-match "^[0-9]+\\.[0-9]+($|\\.[0-8][0-9]*$)"
+ v)
+ `(,(string-append
+ "https://download.racket-lang.org/releases/"
+ v
+ "/catalog/"))
+ '())))
+ (mkdir-p "racket/etc")
+ (with-output-to-file "racket/etc/config.rktd"
+ (lambda ()
+ (write-racket-hash
+ `((build-stamp . "")
+ (catalogs ,@maybe-release-catalog
+ #f)))))))
+ (add-before 'configure 'chdir
+ (lambda _
+ (chdir "racket/src")))
+ (replace 'configure
+ (wrap-racket-vm-outputs
+ (assoc-ref %standard-phases 'configure)))
+ (replace 'patch-shebangs
+ (wrap-racket-vm-outputs
+ (assoc-ref %standard-phases 'patch-shebangs)))
+ (replace 'validate-runpath
+ (wrap-racket-vm-outputs
+ (assoc-ref %standard-phases 'validate-runpath)))
+ (replace 'make-dynamic-linker-cache
+ (wrap-racket-vm-outputs
+ (assoc-ref %standard-phases 'make-dynamic-linker-cache)))
+ (replace 'patch-dot-desktop-files
+ (wrap-racket-vm-outputs
+ (assoc-ref %standard-phases 'patch-dot-desktop-files)))))))
+ (home-page "https://racket-lang.org")
+ (synopsis "Old Racket implementation used for bootstrapping")
+ (description "This variant of the Racket BC (``before Chez'' or
+``bytecode'') implementation is not recommended for general use. It uses
+CGC (a ``Conservative Garbage Collector''), which was succeeded as default in
+PLT Scheme version 370 (which translates to 3.7 in the current versioning
+scheme) by the 3M variant, which in turn was succeeded in version 8.0 by the
+Racket CS implementation.
+
+Racket CGC is primarily used for bootstrapping Racket BC [3M]. It may
+also be used for embedding applications without the annotations needed in C
+code to use the 3M garbage collector.")
+ ;; https://download.racket-lang.org/license.html
+ ;; The LGPL components are only used by Racket BC.
+ (license (list license:lgpl3+ license:asl2.0 license:expat)))))
+
+(define-public racket-vm-bc
+ (package
+ (inherit racket-vm-cgc)
+ (name "racket-vm-bc")
+ (native-inputs
+ (modify-inputs (package-native-inputs racket-vm-cgc)
+ (prepend racket-vm-cgc)))
+ (arguments
+ (substitute-keyword-arguments (package-arguments racket-vm-cgc)
+ ((#:configure-flags _ '())
+ #~(cons "--enable-bconly"
+ #$(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
+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.
+
+This package is the normal implementation of Racket BC with a precise garbage
+collector, 3M (``Moving Memory Manager'').")))
+
+(define-public racket-vm-cs
+ (package
+ (inherit racket-vm-bc)
+ (name "racket-vm-cs")
+ (inputs
+ (modify-inputs (package-inputs racket-vm-cgc)
+ (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)))
+ (arguments
+ (substitute-keyword-arguments (package-arguments racket-vm-cgc)
+ ((#:phases those-phases #~%standard-phases)
+ #~(modify-phases #$those-phases
+ (add-after 'unpack 'unpack-nanopass+stex
+ (lambda args
+ (with-directory-excursion "racket/src/ChezScheme"
+ #$unpack-nanopass+stex)))))
+ ((#:configure-flags _ '())
+ #~(cons* "--enable-csonly"
+ "--enable-libz"
+ "--enable-lz4"
+ (string-append "--enable-scheme="
+ #$(this-package-native-input
+ "chez-sch
This message was truncated. Download the full message here.
P
P
Philip McGrath wrote on 13 Feb 2022 22:51
[PATCH 09/11] gnu: chez-mit: Support chez-scheme-for-racket.
(address . 53878@debbugs.gnu.org)
20220213215127.218952-10-philip@philipmcgrath.com
Racket's variant of Chez Scheme defines 'string->uninterned-symbol',
which conflicts with the definition from '(chez mit)'. See discussion at

* gnu/packages/chez.scm (chez-mit)[origin]<snippet>: Add workaround for
chez-scheme-for-racket.
---
gnu/packages/chez.scm | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)

Toggle diff (37 lines)
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 54bbee7923..be251798c3 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -355,7 +355,29 @@ (define-public chez-mit
(commit (string-append "v" version))))
(sha256
(base32 "0c7i3b6i90xk96nmxn1pc9272a4yal4v40dm1a4ybdi87x53zkk0"))
- (file-name (git-file-name name version))))
+ (file-name (git-file-name name version))
+ (snippet
+ ;; Workaround for chez-scheme-for-racket.
+ ;; See: https://github.com/racket/racket/issues/4151
+ #~(begin
+ (use-modules (guix build utils))
+ (substitute* "mit/core.sls"
+ (("[(]import ")
+ "(import (only (chezscheme) import)\n")
+ (("[(]define string->uninterned-symbol gensym[)]")
+ (format #f "~s"
+ '(begin
+ (import (only (chezscheme)
+ meta-cond
+ library-exports))
+ (meta-cond
+ ((memq 'string->uninterned-symbol
+ (library-exports '(chezscheme)))
+ (import (only (chezscheme)
+ string->uninterned-symbol)))
+ (else
+ (define string->uninterned-symbol
+ gensym)))))))))))
(build-system gnu-build-system)
(inputs
(list chez-srfi)) ; for tests
--
2.32.0
P
P
Philip McGrath wrote on 13 Feb 2022 22:51
[PATCH 10/11] gnu: chez-and-racket-bootstrap: Add 'chez-scheme-for-system'.
(address . 53878@debbugs.gnu.org)
20220213215127.218952-11-philip@philipmcgrath.com
* gnu/packages/chez-and-racket-bootstrap.scm (chez-scheme-for-system): New
procedure.
* gnu/packages/loko.scm (loko-scheme): Use 'chez-scheme-for-system'.
* gnu/packages/emacs-xyz.scm (emacs-geiser-chez): Likewise
* gnu/packages/chez.scm (chez-srfi):
(chez-web):
(chez-sockets):
(chez-matchable):
(chez-irregex):
(chez-fmt):
(chez-mit):
(chez-scmutils): Likewise.
---
gnu/packages/chez-and-racket-bootstrap.scm | 13 ++++++++++++-
gnu/packages/chez.scm | 16 ++++++++--------
gnu/packages/emacs-xyz.scm | 2 +-
gnu/packages/loko.scm | 2 +-
4 files changed, 22 insertions(+), 11 deletions(-)

Toggle diff (135 lines)
diff --git a/gnu/packages/chez-and-racket-bootstrap.scm b/gnu/packages/chez-and-racket-bootstrap.scm
index d2f78dfae2..669c54729d 100644
--- a/gnu/packages/chez-and-racket-bootstrap.scm
+++ b/gnu/packages/chez-and-racket-bootstrap.scm
@@ -45,7 +45,8 @@ (define-module (gnu packages chez-and-racket-bootstrap)
#:use-module (gnu packages tex)
#:use-module (gnu packages xorg)
#:use-module ((guix licenses)
- #:prefix license:))
+ #:prefix license:)
+ #:export (chez-scheme-for-system))
;; Commentary:
;;
@@ -205,6 +206,16 @@ (define-module (gnu packages chez-and-racket-bootstrap)
;;
;; Code:
+(define* (chez-scheme-for-system #:optional
+ (system (or (%current-target-system)
+ (%current-system))))
+ "Return 'chez-scheme' if it supports SYSTEM without restrictions;
+'chez-scheme-racket-variant' otherwise."
+ (if (and=> (nix-system->chez-machine system)
+ chez-machine->upstream-restriction)
+ chez-scheme-for-racket
+ chez-scheme))
+
(define (chez-machine->unthreaded mach)
"Given a string MACH naming a Chez Scheme machine type, returns a string
naming the unthreaded machine type for the same architecture and OS as MACH.
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index be251798c3..d5007e0cfd 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -74,7 +74,7 @@ (define-public chez-srfi
(file-name (git-file-name name version))))
(build-system gnu-build-system)
(native-inputs
- (list chez-scheme))
+ (list (chez-scheme-for-system)))
(arguments
(list #:make-flags (chez-make-flags name version)
#:test-target "test"
@@ -105,7 +105,7 @@ (define-public chez-web
(base32 "1dq25qygyncbfq4kwwqqgyyakfqjwhp5q23vrf3bff1p66nyfl3b"))))
(build-system gnu-build-system)
(native-inputs
- (list chez-scheme
+ (list (chez-scheme-for-system)
ghostscript
;; FIXME: This package fails to build with the error:
;; mktexpk: don't know how to create bitmap font for bchr8r
@@ -170,7 +170,7 @@ (define-public chez-sockets
(base32 "1n5fbwwz51fdzvjackgmnsgh363g9inyxv7kmzi0469cwavwcx5m"))))
(build-system gnu-build-system)
(native-inputs
- (list chez-scheme
+ (list (chez-scheme-for-system)
chez-web
(texlive-updmap.cfg (list texlive-pdftex))))
(arguments
@@ -256,7 +256,7 @@ (define-public chez-matchable
(inputs
(list chez-srfi)) ; for tests
(native-inputs
- (list chez-scheme))
+ (list (chez-scheme-for-system)))
(arguments
(list #:make-flags (chez-make-flags name version)
#:test-target "test"
@@ -288,7 +288,7 @@ (define-public chez-irregex
(propagated-inputs
(list chez-srfi)) ; for irregex-utils
(native-inputs
- (list chez-scheme))
+ (list (chez-scheme-for-system)))
(arguments
(list #:make-flags (chez-make-flags name version)
#:test-target "test"
@@ -319,7 +319,7 @@ (define-public chez-fmt
(propagated-inputs
(list chez-srfi)) ; for irregex-utils
(native-inputs
- (list chez-scheme))
+ (list (chez-scheme-for-system)))
(arguments
(list #:make-flags (chez-make-flags name version)
#:test-target "chez-check"
@@ -382,7 +382,7 @@ (define string->uninterned-symbol
(inputs
(list chez-srfi)) ; for tests
(native-inputs
- (list chez-scheme))
+ (list (chez-scheme-for-system)))
(arguments
(list #:make-flags (chez-make-flags name version)
#:test-target "test"
@@ -413,7 +413,7 @@ (define-public chez-scmutils
(inputs
(list chez-srfi)) ; for tests
(native-inputs
- (list chez-scheme))
+ (list (chez-scheme-for-system)))
(propagated-inputs
(list chez-mit chez-srfi))
(arguments
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 02694b636a..f445ab0f25 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -451,7 +451,7 @@ (define-public emacs-geiser-chez
(string-append
"(eval-after-load 'geiser-impl '" all ")"))))))))
(inputs
- (list chez-scheme))
+ (list (chez-scheme-for-system)))
(propagated-inputs
(list emacs-geiser))
(home-page "https://nongnu.org/geiser/")
diff --git a/gnu/packages/loko.scm b/gnu/packages/loko.scm
index 74a649b8a1..a7ab12a0c4 100644
--- a/gnu/packages/loko.scm
+++ b/gnu/packages/loko.scm
@@ -71,7 +71,7 @@ (define-public loko-scheme
#t)))))
(native-inputs
`(("akku" ,akku)
- ("chez-scheme" ,chez-scheme)
+ ("chez-scheme" ,(chez-scheme-for-system))
("struct" ,guile-struct-pack)
("laesare" ,guile-laesare)
("pfds" ,guile-pfds)
--
2.32.0
P
P
Philip McGrath wrote on 13 Feb 2022 22:51
[PATCH 11/11] gnu: racket: Update to 8.4.
(address . 53878@debbugs.gnu.org)
20220213215127.218952-12-philip@philipmcgrath.com
* gnu/packages/patches/racket-gui-tethered-launcher-backport.patch,
gnu/packages/patcheches/racket-srfi-fsdg-backport.patch: New patches.
* gnu/local.mk (dist_patch_DATA): Add them.
* gnu/packages/chez-and-racket-bootstrap.scm (racket-vm-for-system): New
procedure.
* gnu/packages/racket.scm (racket-minimal, racket): Update to 8.4.
Rewrite to use 'racket-vm-for-system', label-less inputs, G-expressions,
and Git origins for main-distribution packages.
---
gnu/local.mk | 4 +-
gnu/packages/chez-and-racket-bootstrap.scm | 11 +-
...acket-gui-tethered-launcher-backport.patch | 26 +
.../patches/racket-srfi-fsdg-backport.patch | 41622 ++++++++++++++++
gnu/packages/racket.scm | 1551 +-
5 files changed, 42688 insertions(+), 526 deletions(-)
create mode 100644 gnu/packages/patches/racket-gui-tethered-launcher-backport.patch
create mode 100644 gnu/packages/patches/racket-srfi-fsdg-backport.patch

Toggle diff (440 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 8ffdd15ee2..ff72ad8565 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -41,7 +41,7 @@
# Copyright © 2020 Vinicius Monego <monego@posteo.net>
# Copyright © 2021 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
# Copyright © 2021 Greg Hogan <code@greghogan.com>
-# Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
+# Copyright © 2021, 2022 Philip McGrath <philip@philipmcgrath.com>
# Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net>
# Copyright © 2021 Sharlatan Hellseher <sharlatanus@gmail.com>
# Copyright © 2021 Dmitry Polyakov <polyakov@liltechdude.xyz>
@@ -1788,7 +1788,9 @@ dist_patch_DATA = \
%D%/packages/patches/rpcbind-CVE-2017-8779.patch \
%D%/packages/patches/rtags-separate-rct.patch \
%D%/packages/patches/racket-enable-scheme-backport.patch \
+ %D%/packages/patches/racket-gui-tethered-launcher-backport.patch \
%D%/packages/patches/racket-minimal-sh-via-rktio.patch \
+ %D%/packages/patches/racket-srfi-fsdg-backport.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-and-racket-bootstrap.scm b/gnu/packages/chez-and-racket-bootstrap.scm
index 669c54729d..89e659a397 100644
--- a/gnu/packages/chez-and-racket-bootstrap.scm
+++ b/gnu/packages/chez-and-racket-bootstrap.scm
@@ -46,7 +46,8 @@ (define-module (gnu packages chez-and-racket-bootstrap)
#:use-module (gnu packages xorg)
#:use-module ((guix licenses)
#:prefix license:)
- #:export (chez-scheme-for-system))
+ #:export (chez-scheme-for-system
+ racket-vm-for-system))
;; Commentary:
;;
@@ -216,6 +217,14 @@ (define* (chez-scheme-for-system #:optional
chez-scheme-for-racket
chez-scheme))
+(define* (racket-vm-for-system #:optional
+ (system (or (%current-target-system)
+ (%current-system))))
+ "Return 'racket-vm-cs' if it supports SYSTEM; 'racket-vm-bc' otherwise."
+ (if (nix-system->chez-machine system)
+ racket-vm-cs
+ racket-vm-bc))
+
(define (chez-machine->unthreaded mach)
"Given a string MACH naming a Chez Scheme machine type, returns a string
naming the unthreaded machine type for the same architecture and OS as MACH.
diff --git a/gnu/packages/patches/racket-gui-tethered-launcher-backport.patch b/gnu/packages/patches/racket-gui-tethered-launcher-backport.patch
new file mode 100644
index 0000000000..1e018eaa79
--- /dev/null
+++ b/gnu/packages/patches/racket-gui-tethered-launcher-backport.patch
@@ -0,0 +1,26 @@
+From aa792e707b1fbc5cc33691bfaee5828dc3fbebaa Mon Sep 17 00:00:00 2001
+From: Matthew Flatt <mflatt@racket-lang.org>
+Date: Mon, 31 Jan 2022 15:31:22 -0700
+Subject: [PATCH] fix creation of tethered launchers
+
+Related to racket/racket#4133
+
+(cherry picked from commit 563c68432f127729592f234ef30c31e92618b517)
+---
+ gui-lib/mred/installer.rkt | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/gui-lib/mred/installer.rkt b/gui-lib/mred/installer.rkt
+index b1691472..9ef06c53 100644
+--- a/gui-lib/mred/installer.rkt
++++ b/gui-lib/mred/installer.rkt
+@@ -72,4 +72,5 @@
+ (list "-A" (path->string (find-system-path 'addon-dir)))))
+
+ (define (config-flags)
+- (list "-G" (path->string (find-config-dir))))
++ (list "-X" (path->string (find-collects-dir))
++ "-G" (path->string (find-config-dir))))
+--
+2.32.0
+
diff --git a/gnu/packages/patches/racket-srfi-fsdg-backport.patch b/gnu/packages/patches/racket-srfi-fsdg-backport.patch
new file mode 100644
index 0000000000..75a5f46960
--- /dev/null
+++ b/gnu/packages/patches/racket-srfi-fsdg-backport.patch
@@ -0,0 +1,41622 @@
+From 82076308af8aeda65283ba83779302304e1a25d1 Mon Sep 17 00:00:00 2001
+From: Philip McGrath <philip@philipmcgrath.com>
+Date: Thu, 20 Jan 2022 01:20:04 -0500
+Subject: [PATCH] Backport FSDG fix for Racket 8.4.
+
+This is a squashed and somewhat reduced version of commits
+46e11b7, 48f8fca, and a2d0199. For detailed discussion, see
+<https://github.com/racket/srfi/pull/15> and
+<https://lists.gnu.org/archive/html/guix-devel/2022-01/msg00426.html>.
+---
+ srfi-doc/info.rkt | 10 +-
+ .../srfi/scribblings/srfi-5-doc-free.scrbl | 164 +
+ srfi-doc/srfi/scribblings/srfi-std/index.html | 351 +-
+ .../srfi/scribblings/srfi-std/racket-srfi.css | 87 +
+ .../srfi/scribblings/srfi-std/srfi-1.html | 2893 ++++++++++-------
+ .../srfi/scribblings/srfi-std/srfi-11.html | 103 +-
+ .../srfi/scribblings/srfi-std/srfi-13.html | 2072 +++++++-----
+ .../srfi/scribblings/srfi-std/srfi-14.html | 1533 +++++----
+ .../srfi/scribblings/srfi-std/srfi-16.html | 101 +-
+ .../srfi/scribblings/srfi-std/srfi-17.html | 137 +-
+ .../srfi/scribblings/srfi-std/srfi-19.html | 863 ++---
+ .../srfi/scribblings/srfi-std/srfi-2.html | 180 +-
+ .../srfi/scribblings/srfi-std/srfi-23.html | 131 +-
+ .../srfi/scribblings/srfi-std/srfi-25.html | 188 +-
+ .../srfi/scribblings/srfi-std/srfi-26.html | 408 ++-
+ .../srfi/scribblings/srfi-std/srfi-27.html | 695 ++--
+ .../srfi/scribblings/srfi-std/srfi-28.html | 78 +-
+ .../srfi/scribblings/srfi-std/srfi-29.html | 88 +-
+ .../srfi/scribblings/srfi-std/srfi-30.html | 121 +-
+ .../srfi/scribblings/srfi-std/srfi-31.html | 338 +-
+ .../srfi/scribblings/srfi-std/srfi-34.html | 230 +-
+ .../srfi/scribblings/srfi-std/srfi-35.html | 222 +-
+ .../srfi/scribblings/srfi-std/srfi-38.html | 207 +-
+ .../srfi/scribblings/srfi-std/srfi-39.html | 278 +-
+ .../srfi/scribblings/srfi-std/srfi-4.html | 277 +-
+ .../srfi/scribblings/srfi-std/srfi-40.html | 232 +-
+ .../scribblings/srfi-std/srfi-41/srfi-41.html | 2116 ++++++------
+ .../srfi/scribblings/srfi-std/srfi-42.html | 2205 +++++++------
+ .../srfi/scribblings/srfi-std/srfi-43.html | 1049 +++---
+ .../srfi/scribblings/srfi-std/srfi-45.html | 303 +-
+ .../srfi/scribblings/srfi-std/srfi-48.html | 535 +--
+ .../srfi/scribblings/srfi-std/srfi-54.html | 179 +-
+ .../srfi/scribblings/srfi-std/srfi-57.html | 458 +--
+ .../srfi/scribblings/srfi-std/srfi-59.html | 314 +-
+ .../srfi/scribblings/srfi-std/srfi-6.html | 156 +-
+ .../srfi/scribblings/srfi-std/srfi-60.html | 998 +++---
+ .../srfi/scribblings/srfi-std/srfi-61.html | 64 +-
+ .../srfi/scribblings/srfi-std/srfi-62.html | 130 +-
+ .../srfi/scribblings/srfi-std/srfi-63.html | 1586 ++++-----
+ .../srfi/scribblings/srfi-std/srfi-64.html | 408 +--
+ .../srfi/scribblings/srfi-std/srfi-66.html | 335 +-
+ .../srfi/scribblings/srfi-std/srfi-69.html | 346 +-
+ .../srfi/scribblings/srfi-std/srfi-7.html | 124 +-
+ .../srfi/scribblings/srfi-std/srfi-71.html | 274 +-
+ .../srfi/scribblings/srfi-std/srfi-74.html | 485 ++-
+ .../srfi/scribblings/srfi-std/srfi-78.html | 445 +--
+ .../srfi/scribblings/srfi-std/srfi-8.html | 77 +-
+ .../srfi/scribblings/srfi-std/srfi-86.html | 202 +-
+ .../srfi/scribblings/srfi-std/srfi-87.html | 118 +-
+ .../srfi/scribblings/srfi-std/srfi-9.html | 223 +-
+ .../srfi/scribblings/srfi-std/srfi-98.html | 137 +-
+ srfi-doc/srfi/scribblings/srfi.scrbl | 70 +-
+ srfi-doc/srfi/scribblings/util.rkt | 17 +
+ srfi-lib/info.rkt | 2 +
+ srfi-lib/srfi/5/let.rkt | 83 +-
+ srfi-test/tests/srfi/5/srfi-5-test.rkt | 163 +-
+ srfi/info.rkt | 6 +-
+ 57 files changed, 14542 insertions(+), 11053 deletions(-)
+ create mode 100644 srfi-doc/srfi/scribblings/srfi-5-doc-free.scrbl
+ create mode 100644 srfi-doc/srfi/scribblings/srfi-std/racket-srfi.css
+
+diff --git a/srfi-doc/info.rkt b/srfi-doc/info.rkt
+index 59d9611..2ce76b3 100644
+--- a/srfi-doc/info.rkt
++++ b/srfi-doc/info.rkt
+@@ -2,20 +2,18 @@
+
+ (define collection 'multi)
+
++(define version "1.1")
++
+ (define build-deps '("mzscheme-doc"
+ "scheme-lib"
+ "base"
+ "scribble-lib"
+ "srfi-lib"
+ "racket-doc"
+- "r5rs-doc"
+- "r6rs-doc"
++ "racket-index"
+ "compatibility-lib"))
+
+-(define deps '("scheme-lib"
+- "base"
+- "scribble-lib"
+- "compatibility-lib"))
++(define deps '("base"))
+
+ (define update-implies '("srfi-lib"))
+
+diff --git a/srfi-doc/srfi/scribblings/srfi-5-doc-free.scrbl b/srfi-doc/srfi/scribblings/srfi-5-doc-free.scrbl
+new file mode 100644
+index 0000000..5ecf3af
+--- /dev/null
++++ b/srfi-doc/srfi/scribblings/srfi-5-doc-free.scrbl
+@@ -0,0 +1,164 @@
++#lang scribble/doc
++@(require "util.rkt"
++ scribble/manual
++ scribble/example
++ scriblib/render-cond
++ scribble/core
++ scribble/html-properties
++ (for-syntax scheme/base)
++ (for-label (except-in scheme/base let)
++ srfi/5
++ racket/stream))
++
++@title[#:tag "srfi-5" #:style 'unnumbered]{
++ SRFI 5: A compatible let form with signatures and rest arguments}
++@defmodule[srfi/5]
++
++@begin[
++ (define-syntax-rule (defrkt rkt-let)
++ (begin
++ (require (for-label racket/base))
++ (define rkt-let (racket let))))
++ (defrkt rkt-let)
++ (define reference-doc
++ '(lib "scribblings/reference/reference.scrbl"))
++ (define guide-doc
++ '(lib "scribblings/guide/guide.scrbl"))
++ (define srfi-nf-doc
++ '(lib "srfi/scribblings/srfi-nf.scrbl"))
++ ]
++
++Original specification:
++@seclink[#:indirect? #t #:doc srfi-nf-doc srfi-5-std-taglet]{SRFI 5}
++
++For @hyperlink[srfi-license-history-url]{historical
++ reasons}, the SRFI 5 specification document has a
++@seclink[#:indirect? #t #:doc srfi-nf-doc srfi-5-license-taglet]{
++ restrictive license} and is not included in the main Racket distribution.
++
++The implementation in @racketmodname[srfi/5] and this
++documentation are distributed under the same
++@racket-license-link{license} as Racket: only the original
++specification document is restrictively licensed.
++
++@defform*[[(let ([id init-expr] ...)
++ body ...+)
++ (let ([id init-expr] ...+ rest-binding)
++ body ...+)
++ (let loop-id ([id init-expr] ... maybe-rest-binding)
++ body ...+)
++ (let (loop-id [id init-expr] ... maybe-rest-binding)
++ body ...+)]
++ #:grammar
++ ([maybe-rest-binding code:blank rest-binding]
++ [rest-binding (code:line rest-id rest-init-expr ...)])]{
++
++ Like @rkt-let from @racketmodname[racket/base], but
++ extended to support additional variants of
++ @tech[#:doc reference-doc]{named @rkt-let}.
++
++ As with @rkt-let from @racketmodname[racket/base], SRFI 5's
++ @racket[let] form conceptually expands to the immediate
++ application of a function to the values of the
++ @racket[init-expr]s: the @racket[id]s are bound in the
++ @racket[body]s (but not in any @racket[init-expr]s or
++ @racket[rest-init-expr]s), and @racket[loop-id], if present,
++ is bound in the @racket[body]s to the function itself,
++ allowing it to be used recursively. An @racket[id] or a
++ @racket[rest-id] can shadow @racket[loop-id], but the
++ @racket[rest-id] (if given) and all @racket[is]s much be
++ distinct.
++
++ SRFI 5's @racket[let] adds support for a syntax like
++ @racket[define]'s @seclink[#:doc guide-doc "Function_Shorthand"]{
++ function shorthand}, which allows the bindings to be written in a
++ syntax resembling an application of the function bound to
++ @racket[loop-id].
++
++ Additionally, SRFI 5's @racket[let] adds support for
++ @tech[#:doc guide-doc]{rest arguments}. If a
++ @racket[rest-id] is present, the function bound to
++ @racket[loop-id] (or the conceptual anonymous function, if
++ @racket[loop-id] is not used) will accept an unlimited
++ number of additional arguments after its required
++ by-position arguments, and the @racket[rest-id] will be
++ bound in the @racket[body]s (but not in any
++ @racket[init-expr]s or @racket[rest-init-expr]s) to a list
++ of those additional arguments. The values of the
++ @racket[rest-init-expr]s are supplied as arguments to the
++ initial, implicit application when the @racket[let] form is
++ evaluated, so the initial value bound to @racket[rest-id] is
++ @racket[(list rest-init-expr ...)].
++
++ @margin-note{Unlike the @racket[_kw-formals] of
++ @racket[lambda] and @racket[define] or the @racket[_formals]
++ of @racket[case-lambda], the bindings of SRFI 5's
++ @racket[let], with or without a @racket[rest-binding], are
++ always a proper (syntactic) list.}
++
++ A @racket[rest-binding] can be used with both the
++ @racket[define]-like and the
++ @tech[#:doc reference-doc]{named-@rkt-let}--like variants of
++ @racket[let]. It is also possible to use @racket[rest-id]
++ without any @racket[loop-id]; however, as specified in the
++ grammar, at least one @racket[id]--@racket[init-expr] pair
++ is required in that case. (Otherwise, there would be an
++ ambiguity with the @racket[define]-like variant).
++
++ @examples[
++ #:eval (make-base-eval '(require srfi/5)) #:once
++ (code:comment "define-like bindings")
++ (define (factorial n)
++ (let (fact [n n] [acc 1])
++ (if (zero? n)
++ acc
++ (fact (sub1 n) (* n acc)))))
++ (eval:check (factorial 5) 120)
++ (eval:check (factorial 11) 39916800)
++ (code:comment "rest arguments with named-let--like bindings")
++ (eval:check (let reverse-onto ([lst '(a b c)]
++ tail)
++ (if (null? lst)
++ tail
++ (apply reverse-onto (cdr lst) (car lst) tail)))
++ '(c b a))
++ (eval:check (let reverse-onto ([lst '(a b c)]
++ tail 'x 'y 'z)
++ (if (null? lst)
++ tail
++ (apply reverse-onto (cdr lst) (car lst) tail)))
++ '(c b a x y z))
++ (eval:check (let no-evens (lst 1 2 3 4 5)
++ (cond
++ [(null? lst)
++ '()]
++ [(even? (car lst))
++ (apply no-evens (cdr lst))]
++ [else
++ (cons (car lst) (apply no-evens (cdr lst)))]))
++ '(1 3 5))
++ (code:comment "rest arguments with define-like bindings")
++ (eval:check (let (reverse-onto [lst '(a b c)] tail)
++ (if (null? lst)
++ tail
++ (apply reverse-onto (cdr lst) (car lst) tail)))
++ '(c b a))
++ (eval:check (let (reverse-onto [lst '(a b c)] . [tail 'x 'y 'z])
++ (if (null? lst)
++ tail
++ (apply reverse-onto (cdr lst) (car lst) tail)))
++ '(c b a x y z))
++ (eval:check (let (loop [continue? 0] args 'a 'a1 'a2)
++ (case continue?
++ [(0) (cons args (loop 1 'b))]
++ [(1) (cons args (loop 2 'c 'd))]
++ [else (list args)]))
++ '((a a1 a2) (b) (c d)))
++ (code:comment "rest arguments without any loop-id")
++ (eval:check (let ([x 1]
++ [y 2]
++ z 3 4 5 6 7)
++ (list* x y z))
++ '(1 2 3 4 5 6 7))
++ ]
++}
+diff --git a/srfi-doc/srfi/scribblings/srfi-std/index.html b/srfi-doc/srfi/scribblings/srfi-std/index.html
+index 6f03f9b..c46dd8b 100644
+--- a/srfi-doc/srfi/scribblings/srfi-std/index.html
++++ b/srfi-doc/srfi/scribblings/srfi-std/index.html
+@@ -1,258 +1,113 @@
+-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+-<html>
++<!DOCTYPE html>
++<!--
++
++The only information that used to be in this document which isn't
++already in "../index.html" (i.e. the Scribble-generated documentation)
++is about modules which export prefixed names. That used to be
++important, before `require` was allowed to shadow bindings from a
++module's language. Is it worth incorporating this information into
++"../index.html"?
++
++Much of this is also present in the similarly-outdated
++"srfi-lib/srfi/doc.txt". Should we do something about that, too?
++
++????????????????????????????????????????????????????????????
++????????????????????????????????????????????????????????????
++????????????????????????????????????????????????????????????
++????????????????????????????????????????????????????????????
++
++Certain SRFIs (currently SRFIs 1, 5, 13, 17, 19, 43, 45, 48, 61, 63, 69 and 87) provide names which conflict with names provided by the racket language. Attempting to require one of these SRFIs in a module written in the racket language will result in an error.
++
++To address this problem, the Racket implementations of these SRFIs provide a different module which renames the problematic exports to avoid these conflicts. For SRFI 1, this library is called list, and should be required like this:
++
++ (require srfi/1/list)
++
++which supplies the colliding names with a prefix of 's:' (e.g. "s:map", "s:reverse!") and is therefore suitable for requires in a module.
++
++For SRFI 19, this library is called time, and should be required like this:
++
++ (require srfi/19/time)
++
++which supplies the colliding names with a prefix of 'srfi:' (e.g. "srfi:date?", "srfi:date-second") and is therefore
++suitable for requires in a module.
++
++ Supported SRFIs
++
++SRFI File name Sub-collection
++SRFI-1 list.rkt 1
++SRFI-2 and-let.rkt 2
++SRFI-4(*1) 4.rkt
++SRFI-5 let.rkt 5
++SRFI-6(+) 6.rkt
++SRFI-7 program.rkt 7
++SRFI-8 receive.rkt 8
++SRFI-9 record.rkt 9
++SRFI-11(+) 11.rkt
++SRFI-13 string.rkt 13
++SRFI-14 char-set.rkt 14
++SRFI-16(+) 16.rkt
++SRFI-17 set.rkt 17
++SRFI-19(*2) time.rkt 19
++SRFI-23(+) 23.rkt
++SRFI-25 array.rkt 25
++SRFI-26 cut.rkt 26
++SRFI-27 random-bits.rkt 27
++SRFI-28(+) 28.rkt
++SRFI-29 localization.rkt 29
++SRFI-30(+) 30.rkt
++SRFI-31 rec.rkt 31
++SRFI-32 sort.scm 32
++SRFI-34 exception.rkt 34
++SRFI-35 condition.rkt 35
++SRFI-38(+) 38.rkt
++SRFI-39(+) 39.rkt
++SRFI-40 stream.rkt 40
++SRFI-42 comprehensions.rkt 42
++SRFI-43 vector-lib.rkt 43
++SRFI-45(*3) lazy.rkt 45
++SRFI-48 format.rkt 48
++SRFI-54 cat.rkt 54
++SRFI-57 records.rkt 57
++SRFI-59 vicinity.rkt 59
++SRFI-60 60.rkt 60
++SRFI-61
This message was truncated. Download the full message here.
P
P
Philip McGrath wrote on 13 Feb 2022 22:57
control message for bug #53878
(address . control@debbugs.gnu.org)
1515f77e-33be-7ca3-1675-1d0bcbee7199@philipmcgrath.com
retitle 53878 [PATCH 00/11] Update Racket to 8.4. Adjust Chez Scheme
packages.
L
L
Liliana Marie Prikler wrote on 14 Feb 2022 15:34
Re: [PATCH 04/11] gnu: chez-and-racket-bootstrap: Add utilities for Chez machine types.
20ade6d2f82b20f25d0eb1c8b2b5c409c189d05a.camel@ist.tugraz.at
Hi,

Am Sonntag, dem 13.02.2022 um 16:51 -0500 schrieb Philip McGrath:
Toggle quote (39 lines)
> [...]
> +(define (chez-machine->upstream-restriction mach)
> +  "Given a string MACH naming a Chez Scheme machine type, returns a
> symbol
> +naming a restriction on the upstream Chez Scheme implementation
> compared to
> +the Racket variant, or @code{#f} if no such restriction exists.  The
> +restriction is reported for the architecture--OS pair, regardless of
> whether
> +MACH specifies a threaded or an unthreaded variant.
> +
> +Possible restrictions currently include:
> +@itemize @bullet
> +@item
> +@code{'no-threads}: Support for native threads is not available
> upstream.
> +@item
> +@code{'no-support}: The upstream release doesn't claim to support
> this
> +architecture--OS combination at all.
> +@end itemize
> +
> +See @code{chez-machine->nix-system} for more details about
> acceptable values
> +for MACH."
> +  (let ((mach (chez-machine->unthreaded mach)))
> +    (cond
> +     ((string-prefix? "arm64" mach)
> +      'no-support)
> +     ((string-prefix? "arm32" mach)
> +      (if (string-suffix? "le" mach)
> +          'no-threads
> +          'no-support))
> +     ((string-prefix? "ppc32" mach)
> +      (if (string-suffix? "le" mach)
> +          #f
> +          'no-support))
> +     (else
> +      #f))))
-> is a conversion operator, not an "accessor".
"upstream-restriction" sounds rather negative, I'd rather have (chez-
machine-features), which yields #f if the machine is unsupported and a
(possibly empty) list of features otherwise, such as '(threads).

I'm also not quite sure what the point is behind using chez machines
here. Why not simply test the systems with the predicates we already
have, i.e. target-arm64?, target-arm32?, target-linux?, target-ppc32?,
...

And as a minor pet peeve, you ought to spell out machine.


Toggle quote (23 lines)
> +(define* (nix-system->chez-machine #:optional (system (%current-
> system))
> +                                   #:key (threads? 'always))
> +  "Return the Chez Scheme machine type corresponding to the Nix
> system
> +identifier SYSTEM, or @code{#f} if the translation of SYSTEM to a
> Chez Scheme
> +machine type is undefined.
> +
> +When THREADS? is @code{'always} (the default), the threaded variant
> of the
> +machine type will be returned: note that the package returned by
> +@code{chez-scheme-for-system} will always support native threads. 
> When
> +THREADS? is @code{#f}, the unthreaded machine type will be
> returned.  If
> +THREADS? is @code{'upstream} (the default), the threaded variant of
> the
> +machine type will be returned if and only if it is supported by
> upstream Chez
> +Scheme (see @code{chez-machine->upstream-restriction}).  If THREADS?
> is any
> +other value, an exception is raised."
What's the point in having THREADS? 'always? In any case, assuming
chez-machine-features is to be exported, this can easily be checked --
even if not, we can add the check internally by writing 
#:key (threads? (chez-supports-threads? system))

Toggle quote (7 lines)
> +  (let* ((hyphen (string-index system #\-))
> +         (nix-arch (substring system 0 hyphen))
> +         (nix-os (substring system (+ 1 hyphen)))
> +         (chez-arch (assoc-ref %nix-arch-to-chez-alist nix-arch))
> +         (chez-os (assoc-ref %nix-os-to-chez-alist nix-os))
> +         (mach (and chez-arch chez-os (string-append chez-arch chez-
> os))))
This series of let-bindings should probably be done in a separate
function called nix-system->chez-machine.

Cheers
L
L
Liliana Marie Prikler wrote on 14 Feb 2022 15:46
Re: [PATCH 05/11] gnu: Add stex.
ae84898fa53ae7c10aff686d99532fc05e34ebc3.camel@ist.tugraz.at
Am Sonntag, dem 13.02.2022 um 16:51 -0500 schrieb Philip McGrath:
Toggle quote (12 lines)
> * gnu/packages/chez-and-racket-bootstrap.scm (stex-bootstrap): New
> variable.
> (stex): Change from origin to package inheriting from 'stex-
> bootstrap'.
> (chez-scheme)[native-inputs]: Add 'stex-bootstrap'. Remove
> labels. Remove dependencies of stex-bootstrap.
> [inputs]: Remove labels.
> [arguments]: Adapt to use 'stex-bootstrap', 'search-input-file', and
> G-expressions.
> (nanopass): Make it public as a temporary workaround for Racket.
> * gnu/packages/racket.scm
> (racket-bootstrap-chez-bootfiles)[native-inputs]: Update accordingly.
This is again a large number of changes in one go. When it comes to
writing good patches, less is more, especially in terms of being
understandable.


Toggle quote (26 lines)
> +(define (unpack-nanopass+stex)
> +  ;; delayed resolution of `nanopass`
> +  #~(begin
> +      (copy-recursively #$nanopass
> +                        "nanopass"
> +                        #:keep-mtime? #t)
> +      (mkdir-p "stex")
> +      (with-output-to-file "stex/Mf-stex"
> +        (lambda ()
> +          ;; otherwise, it will try to download submodules
> +          (display "# to placate ../configure")))))
> [...]
> -       (snippet
> -        ;; Remove bundled libraries.
> -        (with-imported-modules '((guix build utils))
> -          #~(begin
> -              (use-modules (guix build utils))
> -              (for-each (lambda (dir)
> -                          (when (directory-exists? dir)
> -                            (delete-file-recursively dir)))
> -                        '("stex"
> -                          "nanopass"
> -                          "lz4"
> -                          "zlib")))))))
> [...]
> +              (snippet unbundle-chez-submodules)))
Why?

Toggle quote (32 lines)
>      (build-system gnu-build-system)
>      (inputs
> -     `(("libuuid" ,util-linux "lib")
> -       ("zlib" ,zlib)
> -       ("lz4" ,lz4)
> -       ;; for expeditor:
> -       ("ncurses" ,ncurses)
> -       ;; for X11 clipboard support in expeditor:
> -       ;;
> https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
> -       ("libx11" ,libx11)))
> -    (native-inputs
> -     `(("nanopass" ,nanopass) ; source only
> -       ;; for docs
> -       ("stex" ,stex)
> -       ("xorg-rgb" ,xorg-rgb)
> -       ("texlive" ,(texlive-updmap.cfg (list texlive-dvips-l3backend
> -                                             texlive-epsf
> -                                             texlive-fonts-ec
> -                                             texlive-oberdiek)))
> -       ("ghostscript" ,ghostscript)
> -       ("netpbm" ,netpbm)))
> +     (list
> +      `(,util-linux "lib") ;<-- libuuid
> +      zlib
> +      lz4
> +      ncurses ;<-- for expeditor
> +      ;; for X11 clipboard support in expeditor:
> +      ;;
> https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
> +      libx11))
> +    (native-inputs (list stex-bootstrap))
This is a lot of noise. Either first clean up the inputs and then add
new ones or the other way round, but doing both in the same commit
(especially with other stuff as well) is too much imo.

Toggle quote (223 lines)
>      (native-search-paths
>       (list (search-path-specification
>              (variable "CHEZSCHEMELIBDIRS")
>              (files (list (string-append "lib/chez-scheme"))))))
>      (outputs '("out" "doc"))
>      (arguments
> -     `(#:modules
> -       ((guix build gnu-build-system)
> +     (list
> +      #:modules
> +      '((guix build gnu-build-system)
>          (guix build utils)
>          (ice-9 ftw)
>          (ice-9 match))
> -       #:test-target "test"
> -       #:configure-flags
> -       '("--threads") ;; TODO when we fix armhf, it doesn't support
> --threads
> -       #:phases
> -       (modify-phases %standard-phases
> -         ;; put these where configure expects them to be
> -         (add-after 'unpack 'unpack-nanopass+stex
> -           (lambda* (#:key native-inputs inputs #:allow-other-keys)
> -             (for-each (lambda (dep)
> -                         (define src
> -                           (assoc-ref (or native-inputs inputs)
> dep))
> -                         (copy-recursively src dep
> -                                           #:keep-mtime? #t))
> -                       '("nanopass" "stex"))))
> -         ;; NOTE: the custom Chez 'configure' script doesn't allow
> -         ;; unrecognized flags, such as those automatically added
> -         ;; by `gnu-build-system`.
> -         (replace 'configure
> -           (lambda* (#:key inputs outputs
> -                           (configure-flags '())
> -                           #:allow-other-keys)
> -             (let* ((zlib-static (assoc-ref inputs "zlib:static"))
> -                    (lz4-static (assoc-ref inputs "lz4:static"))
> -                    (out (assoc-ref outputs "out"))
> -                    ;; add flags which are always required:
> -                    (flags (cons* (string-append "--installprefix="
> out)
> +      #:test-target "test"
> +      ;; TODO when we fix armhf, it may not support --threads
> +      #:configure-flags #~'("--threads")
> +      #:phases
> +      #~(modify-phases %standard-phases
> +          (add-after 'unpack 'unpack-nanopass+stex
> +            (lambda args
> +              #$(unpack-nanopass+stex)))
> +          ;; NOTE: the custom Chez 'configure' script doesn't allow
> +          ;; unrecognized flags, such as those automatically added
> +          ;; by `gnu-build-system`.
> +          (replace 'configure
> +            (lambda* (#:key inputs (configure-flags '()) #:allow-
> other-keys)
> +              ;; add flags which are always required:
> +              (let ((flags (cons* (string-append "--installprefix="
> #$output)
>                                    "ZLIB=-lz"
>                                    "LZ4=-llz4"
>                                    "--libkernel"
> @@ -305,90 +276,59 @@ (define src
>                                    ;; and letting Chez try causes an
> error
>                                    "--nogzip-man-pages"
>                                    configure-flags)))
> -               (format #t "configure flags: ~s~%" flags)
> -               ;; Some makefiles (for tests) don't seem to propagate
> CC
> -               ;; properly, so we take it out of their hands:
> -               (setenv "CC" ,(cc-for-target))
> -               (setenv "HOME" "/tmp")
> -               (apply invoke
> -                      "./configure"
> -                      flags))))
> -         ;; The binary file name is called "scheme" as is the one
> from MIT/GNU
> -         ;; Scheme.  We add a symlink to use in case both are
> installed.
> -         (add-after 'install 'install-symlink
> -           (lambda* (#:key outputs #:allow-other-keys)
> -             (let* ((out (assoc-ref outputs "out"))
> -                    (bin (string-append out "/bin"))
> -                    (lib (string-append out "/lib"))
> -                    (name "chez-scheme"))
> -               (symlink (string-append bin "/scheme")
> -                        (string-append bin "/" name))
> -               (map (lambda (file)
> -                      (symlink file (string-append (dirname file)
> -                                                   "/" name
> ".boot")))
> -                    (find-files lib "scheme.boot")))))
> -         ;; Building explicitly lets us avoid using substitute*
> -         ;; to re-write makefiles.
> -         (add-after 'install-symlink 'prepare-stex
> -           (lambda* (#:key native-inputs inputs outputs #:allow-
> other-keys)
> -             (let* ((stex+version
> -                     (strip-store-file-name
> -                      (assoc-ref (or native-inputs inputs) "stex")))
> -                    ;; Eventually we want to install stex as a real
> -                    ;; package so it's reusable. For now:
> -                    (stex-output "/tmp")
> -                    (doc-dir (string-append stex-output
> -                                            "/share/doc/"
> -                                            stex+version)))
> -               (with-directory-excursion "stex"
> -                 (invoke "make"
> -                         "install"
> -                         (string-append "LIB="
> -                                        stex-output
> -                                        "/lib/"
> -                                        stex+version)
> -                         (string-append "Scheme="
> -                                        (assoc-ref outputs "out")
> -                                        "/bin/scheme"))
> -                 (for-each (lambda (pth)
> -                             (install-file pth doc-dir))
> -                           '("ReadMe" ; includes the license
> -                             "doc/stex.html"
> -                             "doc/stex.css"
> -                             "doc/stex.pdf"))))))
> -         ;; Building the documentation requires stex and a running
> scheme.
> -         ;; FIXME: this is probably wrong for cross-compilation
> -         (add-after 'prepare-stex 'install-doc
> -           (lambda* (#:key native-inputs inputs outputs #:allow-
> other-keys)
> -             (let* ((chez+version (strip-store-file-name
> -                                   (assoc-ref outputs "out")))
> -                    (stex+version
> -                     (strip-store-file-name
> -                      (assoc-ref (or native-inputs inputs) "stex")))
> -                    (scheme (string-append (assoc-ref outputs "out")
> -                                           "/bin/scheme"))
> -                    ;; see note on stex-output in phase build-stex,
> above:
> -                    (stexlib (string-append "/tmp"
> -                                            "/lib/"
> -                                            stex+version))
> -                    (doc-dir (string-append (assoc-ref outputs
> "doc")
> -                                            "/share/doc/"
> -                                            chez+version)))
> -               (define* (stex-make #:optional (suffix ""))
> -                 (invoke "make"
> -                         "install"
> -                         (string-append "Scheme=" scheme)
> -                         (string-append "STEXLIB=" stexlib)
> -                         (string-append "installdir=" doc-dir
> suffix)))
> -               (with-directory-excursion "csug"
> -                 (stex-make "/csug"))
> -               (with-directory-excursion "release_notes"
> -                 (stex-make "/release_notes"))
> -               (with-directory-excursion doc-dir
> -                 (symlink "release_notes/release_notes.pdf"
> -                          "release_notes.pdf")
> -                 (symlink "csug/csug9_5.pdf"
> -                          "csug.pdf"))))))))
> +                (format #t "configure flags: ~s~%" flags)
> +                ;; Some makefiles (for tests) don't seem to
> propagate CC
> +                ;; properly, so we take it out of their hands:
> +                (setenv "CC" #$(cc-for-target))
> +                (setenv "HOME" "/tmp")
> +                (apply invoke "./configure" flags))))
> +          ;; The binary file name is called "scheme" as is the one
> from
> +          ;; MIT/GNU Scheme.  We add a symlink to use in case both
> are
> +          ;; installed.
> +          (add-after 'install 'install-symlink
> +            (lambda* (#:key outputs #:allow-other-keys)
> +              (let* ((scheme (search-input-file outputs
> "/bin/scheme"))
> +                     (bin-dir (dirname scheme)))
> +                (symlink scheme
> +                         (string-append bin-dir "/chez-scheme"))
> +                (match (find-files (string-append bin-dir "/../lib")
> +                                   "scheme.boot")
> +                  ((scheme.boot)
> +                   (symlink scheme.boot
> +                            (string-append (dirname scheme.boot)
> +                                           "/chez-
> scheme.boot")))))))
> +          ;; Building the documentation requires stex and a running
> scheme.
> +          ;; FIXME: this is probably wrong for cross-compilation
> +          (add-after 'install-symlink 'install-doc
> +            (lambda* (#:key native-inputs inputs outputs
> +                            #:allow-other-keys)
> +              (match (assoc-ref outputs "doc")
> +                (#f
> +                 (format #t "not installing docs~%"))
> +                (doc-prefix
> +                 (let* ((chez+version (strip-store-file-name
> #$output))
> +                        (scheme (search-input-file outputs
> "/bin/scheme"))
> +                        (stexlib (search-input-directory
> +                                  (or native-inputs inputs)
> +                                  "/lib/stex"))
> +                        (doc-dir (string-append doc-prefix
> +                                                "/share/doc/"
> +                                                chez+version)))
> +                   (define* (stex-make #:optional (suffix ""))
> +                     (invoke "make" "install"
> +                             (string-append "Scheme=" scheme)
> +                             (string-append "STEXLIB=" stexlib)
> +                             (string-append "installdir="
> +                                            doc-dir suffix)))
> +                   (with-directory-excursion "csug"
> +                     (stex-make "/csug"))
> +                   (with-directory-excursion "release_notes"
> +                     (stex-make "/release_notes"))
> +                   (with-directory-excursion doc-dir
> +                     (symlink "release_notes/release_notes.pdf"
> +                              "release_notes.pdf")
> +                     (symlink "csug/csug9_5.pdf"
> +                              "csug.pdf"))))))))))
Again mixing cosmetic changes with functional ones.

Toggle quote (140 lines)
>      ;; Chez Scheme does not have a  MIPS backend.
>      ;; FIXME: Debian backports patches to get armhf working.
>      ;; We should too. It is the Chez machine type arm32le
> @@ -412,3 +352,145 @@ (define* (stex-make #:optional (suffix ""))
>  generates native code for each target processor, with support for
> x86, x86_64,
>  and 32-bit PowerPC architectures.")
>      (license license:asl2.0)))
> +
> +;;
> +;; Chez's bootstrap dependencies:
> +;;
> +
> +(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"))
> +    (hidden-package
> +     (package
> +       (name "stex")
> +       ;; ^ Debian calls this "stex", not "chez-stex". It is a set
> of
> +       ;; command-line tools, and there isn't a Scheme API, let
> alone a
> +       ;; Chez-specific one, except perhaps that the Scheme examples
> are
> +       ;; assumed to be Chez-compatible.
> +       (version (git-version "1.2.2" revision commit))
> +       (source
> +        (origin
> +          (method git-fetch)
> +          (uri (git-reference
> +                (url "https://github.com/dybvig/stex")
> +                (commit commit)))
> +          (sha256
> +           (base32
> "01jnvw8qw33gnpzwrakwhsr05h6b609lm180jnspcrb7lds2p23d"))
> +          (file-name (git-file-name name version))
> +          (snippet
> +           #~(for-each delete-file
> +                       '("sbin/install" "doc/stex.pdf"
> "doc/stex.html")))))
> +       (outputs '("out"))
> +       (build-system copy-build-system)
> +       ;; N.B. Upstream does not seem to support cross-compilation,
> +       ;; though it would probably be easy to add.
> +       (propagated-inputs
> +        (list xorg-rgb
> +              (texlive-updmap.cfg
> +               (list texlive-dvips-l3backend
> +                     texlive-hyperref
> +                     texlive-bibtex
> +                     texlive-epsf
> +                     texlive-fonts-ec
> +                     texlive-oberdiek))
> +              ghostscript
> +              netpbm))
> +       ;; Debian uses a versionless path for STEXLIB,
> +       ;; which is much more convienient.
> +       (arguments
> +        (list
> +         #:install-plan #~`(("inputs" "lib/stex/")
> +                            ("gifs" "lib/stex/")
> +                            ("math" "lib/stex/")
> +                            ("src" "lib/stex/") ;; can run without
> compiling
> +                            ("Mf-stex" "lib/stex/")
> +                            ("Makefile.template" "lib/stex/"))
> +         #:phases
> +         #~(modify-phases %standard-phases
> +             (add-before 'install 'patch-sources
> +               (lambda* (#:key native-inputs inputs outputs #:allow-
> other-keys)
> +                 (define scheme
> +                   (false-if-exception
> +                    (search-input-file inputs "/bin/scheme")))
> +                 (when scheme
> +                   (setenv "Scheme" scheme))
> +                 (substitute* '("Makefile.template"
> +                                "doc/Makefile")
> +                   (("STEXLIB=[^\n]*")
> +                    (string-append "STEXLIB=" #$output "/lib/stex"))
> +                   (("Scheme=[^\n]*")
> +                    (string-append "Scheme=" (or scheme "scheme"))))
> +                 (substitute* '("Mf-stex"
> +                                "math/Makefile")
> +                   (("/bin/rm")
> +                    "rm"))
> +                 (substitute* "Mf-stex"
> +                   (("SHELL=bash")
> +                    ;; avoid Solaris workaround
> +                    "#SHELL=bash"))))
> +             (add-after 'install 'maybe-compile
> +               (lambda* (#:key native-inputs inputs outputs #:allow-
> other-keys)
> +                 (cond
> +                  ((getenv "Scheme")
> +                   => (lambda (scheme)
> +                        (define makefile
> +                          (string-append (getcwd) "/Makefile"))
> +                        (define machine
> +                          #$(nix-system->chez-machine
> +                             (or (%current-target-system)
> +                                 (%current-system))))
> +                        (with-directory-excursion
> +                            (search-input-directory outputs
> "/lib/stex")
> +                          (invoke "make"
> +                                  "-f" makefile
> +                                  (string-append "Scheme=" scheme))
> +                          (for-each delete-file
> +                                    (find-files machine "\\.")))))
> +                  (else
> +                   (format #t "not compiling~%")))))
> +             (add-after 'maybe-compile 'maybe-make-docs
> +               (lambda* (#:key native-inputs inputs outputs #:allow-
> other-keys)
> +                 (cond
> +                  ((assoc-ref outputs "doc")
> +                   => (lambda (doc-prefix)
> +                        (define doc-dir
> +                          (string-append doc-prefix
> "/share/doc/stex"))
> +                        ;; the Makefile is referenced in the
> documentation
> +                        (copy-recursively "doc" doc-dir)
> +                        (install-file "ReadMe" doc-dir)
> +                        (with-directory-excursion "doc"
> +                          (invoke "make")
> +                          (install-file "stex.html" doc-dir)
> +                          (install-file "stex.pdf" doc-dir))))
> +                  (else
> +                   (format #t "not making docs~%"))))))))
> +       (home-page "https://github.com/dybvig/stex")
> +       (synopsis "LaTeX with embeded Scheme code and HTML
> generation")
> +       (description "Th
This message was truncated. Download the full message here.
L
L
Liliana Marie Prikler wrote on 14 Feb 2022 15:54
Re: [PATCH 07/11] gnu: chez-scheme: Explicitly package bootstrap bootfiles.
7a5ff55f7c05308cac7bb2aae5dbe0a16b8fa9b9.camel@ist.tugraz.at
Am Sonntag, dem 13.02.2022 um 16:51 -0500 schrieb Philip McGrath:
Toggle quote (14 lines)
> This might seem a bit silly in isolation, but it makes the structure
> of the upstream Chez Scheme package the same as for the Racket
> variant, it sets things up for (one day, hopefully) actually being
> able to bootstrap the upstream Chez Scheme bootfiles, and it may be
> useful for cross-compilation and adding support for architectures
> without pre-built bootfiles from upstream.
>
> * gnu/packages/chez-and-racket-bootstrap.scm
> (chez-scheme-bootstrap-bootfiles): New variable.
> (chez-scheme)[native-inputs]: Add it.
> [arguments]: Add new phase 'unpack-bootfiles'.
> [version, source, home-page]: Derive from 'chez-scheme-bootstrap-
> bootfiles'.
> ---
While having chez-scheme-bootstrap-bootfiles (silly name) does make
some kind of sense, making chez-scheme inherit from it does not. Given
that we don't have a chez-scheme bootstrap tower at hand, you should
probably make (chez-scheme-bootstrap) a procedure which takes chez-
scheme's origin as argument and returns the full package.


Also, while technically a violation of the DRY principle, you are
allowed to type out the homepage multiple times.
L
L
Liliana Marie Prikler wrote on 14 Feb 2022 16:18
Re: [PATCH 08/11] gnu: Add chez-scheme-for-racket.
aabecb425708603b1e7ee33c0858217ac73c0106.camel@ist.tugraz.at
Hi,

Am Sonntag, dem 13.02.2022 um 16:51 -0500 schrieb Philip McGrath:
Toggle quote (6 lines)
> [...]
> * gnu/packages/chez-and-racket-bootstrap.scm (racket-vm-cgc):
> (racket-vm-bc):
> (racket-vm-cs):
> (chez-scheme-for-racket-bootstrap-bootfiles):
> (chez-scheme-for-racket): New variables.
One patch per package is probably better.

Toggle quote (3 lines)
> [...] One way of thinking about the
> +;; bounary between the Racket VM and Racket programs is that the VM
> implements
boundary.

Toggle quote (18 lines)
> +;; the primitives accessed by the 'ffi/unsafe/vm' library. Another
> perspective
> +;; is that DrRacket's ``Open defining file''/``Jump to definition''
> features
> +;; can navigate into Racket programs, including into the
> implementation of
> +;; 'racket/base', but can not jump into the implementation of the
> Racket VM
> +;; itself. A third, related perspective is that Racket code is
> usually
> +;; installed with source files alongside compiled code (though this
> is not
> +;; mandatory), whereas the Racket VM is installed only in compiled
> form.
> [...]
> +;; output. The function 'racket-vm-for-system' returns the
> recomended Racket
> +;; VM package for a given system.
This is a very long comment. Consider how much of it is actually
necessary and how much of it is not (do I really need to know about the
capabilities of DrRacket for instance?)

Toggle quote (27 lines)
> +;; Bootstrapping Racket:
> +;; ---------------------
> +;;
> +;; Here's how bootstrapping Racket works:
> +;;
> +;;   - Racket BC [CGC] can be built with only a C compiler (except
> for
> +;;     one caveat discussed below).
> +;;   - Racket BC [3M] needs an existing Racket to run "xform",
> +;;     which transforms its own C source code to add additional
> annotations
> +;;     for the precise garbage collector.
> +;;   - Racket CS needs (bootfiles for) Racket's fork of Chez Scheme.
> +;;     It also needs an existing Racket to compile Racket-
> implemented
> +;;     parts of the runtime system to R6RS libraries.
> +;;   - Chez Scheme also needs bootfiles for itself, but Racket can
> simulate
> +;;     enough of Chez Scheme to load Racket's fork of the Chez
> Scheme compiler
> +;;     purely from source into Racket and apply the compiler to
> itself,
> +;;     producing the needed bootfiles (albeit very slowly).
> +;;     Any variant of Racket since version 7.1 can run the
> simulation.
> +;;
> +;; So, we build CGC to build 3M to build bootfiles and CS.
This block I'd consider necessary, but again slightly on the verbose
end.

Toggle quote (45 lines)
> +;; (Note: since the CGC variant is basically only for bootstrapping,
> we
> +;; often use "BC" to mean "3M", consistent with `(banner)` and the
> +;; suffixes used on executables when more than one variant co-
> exists.)
> +;;
> +;; One remaining bootstrapping limitation is that Racket's reader,
> module
> +;; system, and macro expander are implemented in Racket. For Racket
> CS,
> +;; they are compiled to R6RS libraries as discussed above. This note
> from the
> +;; README file applies to all such subsystems:
> +;;
> +;;     The Racket version must be practically the same as the
> current Racket
> +;;     verson, although it can be the Racket BC implementation
> (instead of
> +;;     the Racket CS implementation).
> +;;
> +;;     Unlike Chez Scheme boot files, the files generated in
> "schemified"
> +;;     are human-readable and -editable Scheme code. That provides a
> way
> +;;     out of bootstrapping black holes, even without BC.
> +;;
> +;; 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
> +;;
> +;; 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.)
> +;;
Again, you want to be brief and understandable. What does this mean in
practise? Do we have racket bootstrapped yet or is there still some
magic hidden within?

Toggle quote (28 lines)
>  ;; Code:
>  
>  (define (chez-machine->unthreaded mach)
> @@ -189,19 +330,19 @@ (define* (nix-system->chez-machine #:optional
> (system (%current-system))
>                  (chez-machine->threaded mach)))))))
>  
>  ;;
> -;; Chez Scheme:
> +;; Chez auxiliary G-expressions:
>  ;;
>  
>  (define unbundle-chez-submodules
>    #~(begin
>        (use-modules (guix build utils))
>        (for-each (lambda (dir)
> -                (when (directory-exists? dir)
> -                  (delete-file-recursively dir)))
> -              '("stex"
> -                "nanopass"
> -                "lz4"
> -                "zlib"))))
> +                  (when (directory-exists? dir)
> +                    (delete-file-recursively dir)))
> +                '("stex"
> +                  "nanopass"
> +                  "lz4"
> +                  "zlib"))))
As in one of your previous patches, you're mixing cosmetic changes with
non-cosmetic ones. This one could be prevented by correctly indenting
it in the patch that introduces it.

Toggle quote (24 lines)
>  (define unpack-nanopass+stex
>    #~(begin
> @@ -216,6 +357,234 @@ (define unpack-nanopass+stex
>            ;; otherwise, it will try to download submodules
>            (display "# to placate ../configure")))))
>  
> +;;
> +;; Racket VM:
> +;;
> +
> +(define (racket-vm-common-configure-flags)
> +  ;; under a lambda extraction to avoid evaluating bash-minimal too
> early
> +  #~`(,@(cond
> +         ((false-if-exception
> +           (search-input-file %build-inputs "/bin/libtool"))
> +          => (lambda (libtool)
> +               (list (string-append "--enable-lt=" libtool))))
> +         (else
> +          '()))
> +      ,@(cond
> +         ((false-if-exception
> +           (search-input-file %build-inputs "/opt/racket-
> vm/bin/racket"))
Did we have /opt/racket... before? We should probably avoid such
paths.
Toggle quote (8 lines)
> +          => (lambda (racket)
> +               (list (string-append "--enable-racket=" racket))))
> +         (else
> +          '()))
> +      ,(string-append "CPPFLAGS=-DGUIX_RKTIO_PATCH_BIN_SH="
> +                      #$(file-append bash-minimal "/bin/sh"))
> +      "--disable-strip"
> +      "--enable-origtree")
For the record, why do you need double quoting here? Would ungexp-
splicing extract this too soon?

Toggle quote (79 lines)
> +(define-public racket-vm-cgc
> +  ;; Eventually, it may make sense for some vm packages to not be
> hidden,
> +  ;; but this one is especially likely to remain hidden.
> +  (hidden-package
> +   (package
> +     (name "racket-vm-cgc")
> +     (version "8.4")
> +     ;; ^ Remember to also update the version of
> +     ;;   chez-scheme-for-racket-bootstrap-bootfiles
> +     (source
> +      (origin
> +        (method git-fetch)
> +        (uri (git-reference
> +              (url "https://github.com/racket/racket")
> +              (commit (string-append "v" version))))
> +        (sha256
> +         (base32
> "1vpl66gdgc8rnldmn8rmb7ar9l057jqjvgpfn29k57i3c5skr8s6"))
> +        (file-name (git-file-name "racket" version))
> +        (patches (search-patches "racket-minimal-sh-via-rktio.patch"
> +                                 ;; Remove by Racket 8.5:
> +                                 "racket-enable-scheme-
> backport.patch"))
> +        (modules '((guix build utils)))
> +        (snippet
> +         #~(begin
> +             ;; Unbundle Chez submodules.
> +             (with-directory-excursion "racket/src/ChezScheme"
> +               #$unbundle-chez-submodules)
> +             ;; Unbundle libffi.
> +             (delete-file-recursively
> "racket/src/bc/foreign/libffi")))))
> +     (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"))
> +     (build-system gnu-build-system)
> +     (arguments
> +      (list
> +       #:configure-flags
> +       #~(cons "--enable-cgcdefault"
> +               #$(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.
> +       #:tests? #f
> +       ;; Upstream recommends #:out-of-source?, and it does
> +       ;; help with debugging, but it confuses `install-license-
> files`.
> +       #:modules '((ice-9 match)
> +                   (ice-9 regex)
> +                   (guix build gnu-build-system)
> +                   (guix build utils))
> +       #:strip-directories #~'("opt/racket-vm/bin"
> +                               "opt/racket-vm/lib")
> +       #:phases
> +       #~(let ()
> +           (define* ((wrap-racket-vm-outputs phase) . args)
> +             (apply
> +              phase
> +              (let loop ((args args))
> +                (match args
> +                  ((#:outputs outputs . args)
> +                   `(#:outputs
> +                     ,(let loop ((outputs outputs))
> +                        (match outputs
> +                          ((("out" . out) . outputs)
> +                           `(("out" . ,(string-append out
> "/opt/racket-vm/"))
> +                             ,@outputs))
> +                          ((other . outputs)
> +                           (cons other (loop outputs)))))
> +                     ,@args))
> +                  ((arg . args)
> +                   (cons arg (loop args)))))))
Why?


Cheers
L
L
Liliana Marie Prikler wrote on 14 Feb 2022 16:28
Re: [PATCH 11/11] gnu: racket: Update to 8.4.
841fd9aa797eeaa3e5c202e8957574c22098c81f.camel@ist.tugraz.at
Am Sonntag, dem 13.02.2022 um 16:51 -0500 schrieb Philip McGrath:
Toggle quote (8 lines)
> * gnu/packages/patches/racket-gui-tethered-launcher-backport.patch,
> gnu/packages/patcheches/racket-srfi-fsdg-backport.patch: New patches.
> * gnu/local.mk (dist_patch_DATA): Add them.
> * gnu/packages/chez-and-racket-bootstrap.scm (racket-vm-for-system):
> New procedure.
> * gnu/packages/racket.scm (racket-minimal, racket): Update to 8.4.
> Rewrite to use 'racket-vm-for-system', label-less inputs, G-
> expressions, and Git origins for main-distribution packages.
Separate into multiple patches.

Toggle quote (1 lines)
>  .../patches/racket-srfi-fsdg-backport.patch   | 41622 ++++++++++++++++
No.
Patches should be small, not include a bunch of irrelevant doc changes.

Cheers
L
L
Ludovic Courtès wrote on 14 Feb 2022 17:40
control message for bug #53878
(address . control@debbugs.gnu.org)
875yphwgeb.fsf@gnu.org
merge 53878 53997
quit
P
P
Philip McGrath wrote on 16 Feb 2022 20:58
Re: [PATCH 08/11] gnu: Add chez-scheme-for-racket.
58a2566e-370c-9c9c-0284-023808a093ce@philipmcgrath.com
Hi,

On 2/14/22 10:18, Liliana Marie Prikler wrote:
Toggle quote (11 lines)
> Hi,
>
> Am Sonntag, dem 13.02.2022 um 16:51 -0500 schrieb Philip McGrath:
>> [...]
>> * gnu/packages/chez-and-racket-bootstrap.scm (racket-vm-cgc):
>> (racket-vm-bc):
>> (racket-vm-cs):
>> (chez-scheme-for-racket-bootstrap-bootfiles):
>> (chez-scheme-for-racket): New variables.
> One patch per package is probably better.

That's fine; I'll change it. (I thought that's what I'd suggested in

Toggle quote (6 lines)
>
>> [...] One way of thinking about the
>> +;; bounary between the Racket VM and Racket programs is that the VM
>> implements
> boundary.

Thanks, I'll fix it.

Toggle quote (24 lines)
>
>> +;; the primitives accessed by the 'ffi/unsafe/vm' library. Another
>> perspective
>> +;; is that DrRacket's ``Open defining file''/``Jump to definition''
>> features
>> +;; can navigate into Racket programs, including into the
>> implementation of
>> +;; 'racket/base', but can not jump into the implementation of the
>> Racket VM
>> +;; itself. A third, related perspective is that Racket code is
>> usually
>> +;; installed with source files alongside compiled code (though this
>> is not
>> +;; mandatory), whereas the Racket VM is installed only in compiled
>> form.
>> [...]
>> +;; output. The function 'racket-vm-for-system' returns the
>> recomended Racket
>> +;; VM package for a given system.
> This is a very long comment. Consider how much of it is actually
> necessary and how much of it is not (do I really need to know about the
> capabilities of DrRacket for instance?)


I guess it would be ok to cut the explanation of the distinction between
VM primitives and the ``built in'' collections, since the bottom line is
that the truly primitive primitives aren't useful without the main
collections. I'm not sure what else to cut that wouldn't leave room for
confusion.

Toggle quote (49 lines)
>> +;; (Note: since the CGC variant is basically only for bootstrapping,
>> we
>> +;; often use "BC" to mean "3M", consistent with `(banner)` and the
>> +;; suffixes used on executables when more than one variant co-
>> exists.)
>> +;;
>> +;; One remaining bootstrapping limitation is that Racket's reader,
>> module
>> +;; system, and macro expander are implemented in Racket. For Racket
>> CS,
>> +;; they are compiled to R6RS libraries as discussed above. This note
>> from the
>> +;; README file applies to all such subsystems:
>> +;;
>> +;;     The Racket version must be practically the same as the
>> current Racket
>> +;;     verson, although it can be the Racket BC implementation
>> (instead of
>> +;;     the Racket CS implementation).
>> +;;
>> +;;     Unlike Chez Scheme boot files, the files generated in
>> "schemified"
>> +;;     are human-readable and -editable Scheme code. That provides a
>> way
>> +;;     out of bootstrapping black holes, even without BC.
>> +;;
>> +;; 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
>> +;;
>> +;; 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.)
>> +;;
> Again, you want to be brief and understandable. What does this mean in
> practise? Do we have racket bootstrapped yet or is there still some
> magic hidden within?

This is just the comment that is currently at the top of
"gnu/packages/racket.scm", but moved to this file because this is now
going to be where the bootstrapping happens. Are there specific thing
you want to cut?

On the current state of bootstrapping, almost everything is bootstrapped
from C, but the "expander" subsystem (which includes the reader and the
module system) is not currently bootstrappable, though it is readily
auditable. I made another attempt at an explanation in this email:
welcome suggestions to improve the explanation!


Toggle quote (20 lines)
>>  (define unbundle-chez-submodules
>>    #~(begin
>>        (use-modules (guix build utils))
>>        (for-each (lambda (dir)
>> -                (when (directory-exists? dir)
>> -                  (delete-file-recursively dir)))
>> -              '("stex"
>> -                "nanopass"
>> -                "lz4"
>> -                "zlib"))))
>> +                  (when (directory-exists? dir)
>> +                    (delete-file-recursively dir)))
>> +                '("stex"
>> +                  "nanopass"
>> +                  "lz4"
>> +                  "zlib"))))
> As in one of your previous patches, you're mixing cosmetic changes with
> non-cosmetic ones. This one could be prevented by correctly indenting
> it in the patch that introduces it.

Sorry, I missed this in a previous round of indentation fixing.

Toggle quote (21 lines)
>> +;;
>> +;; Racket VM:
>> +;;
>> +
>> +(define (racket-vm-common-configure-flags)
>> +  ;; under a lambda extraction to avoid evaluating bash-minimal too
>> early
>> +  #~`(,@(cond
>> +         ((false-if-exception
>> +           (search-input-file %build-inputs "/bin/libtool"))
>> +          => (lambda (libtool)
>> +               (list (string-append "--enable-lt=" libtool))))
>> +         (else
>> +          '()))
>> +      ,@(cond
>> +         ((false-if-exception
>> +           (search-input-file %build-inputs "/opt/racket-
>> vm/bin/racket"))
> Did we have /opt/racket... before? We should probably avoid such
> paths.

We did not have "opt/racket-vm/" before---adding it was sort of the
point of this patch series.

Is the reason to avoid it a dislike for "opt", or something else?

An ``in place'' build of Racket is not meant to be unpacked directly
into some PREFIX where it will coexist with other software. The build is
vaguely FHS-like in that e.g. it includes a "bin" directory, but it also
e.g. has a "collects" directory at the top level, and it puts other
things in paths like "etc/config.rktd" rather than "etc/racket/config.rktd".

Subdirectories of "opt" often have that sort of layout, so it seemed
like a reasonable place to put it. I considered just embracing Guix not
being tied to FHS and putting it directly in the store output, but in
build-side code it turned out to be useful to be able to use
`search-input-{file,directory}` without potentially confusing the
in-place VM with an intermediate, potentially tethered layer.

If the question is, ``why do we want an in-place build?'', I can go into
as much depth as you want, but it makes the build-side code easier to
reason about, it's more compatible with Racket tools e.g. for
cross-compilation, and it should help to reduce closure sizes by letting
us build packages with non-tethered intermediate layers.

Toggle quote (11 lines)
>> +          => (lambda (racket)
>> +               (list (string-append "--enable-racket=" racket))))
>> +         (else
>> +          '()))
>> +      ,(string-append "CPPFLAGS=-DGUIX_RKTIO_PATCH_BIN_SH="
>> +                      #$(file-append bash-minimal "/bin/sh"))
>> +      "--disable-strip"
>> +      "--enable-origtree")
> For the record, why do you need double quoting here? Would ungexp-
> splicing extract this too soon?

I'm not 100% sure I'm following your question correctly, but yes, there
were problems with referencing `bash-minimal` too early.

(An alternative I considered was to add these arguments in a wrapper
around gnu-build-system's configure phase, so that #:configure-flags
would be only for arguments that variants want to override, or plausibly
might.)

Toggle quote (83 lines)
>
>> +(define-public racket-vm-cgc
>> +  ;; Eventually, it may make sense for some vm packages to not be
>> hidden,
>> +  ;; but this one is especially likely to remain hidden.
>> +  (hidden-package
>> +   (package
>> +     (name "racket-vm-cgc")
>> +     (version "8.4")
>> +     ;; ^ Remember to also update the version of
>> +     ;;   chez-scheme-for-racket-bootstrap-bootfiles
>> +     (source
>> +      (origin
>> +        (method git-fetch)
>> +        (uri (git-reference
>> +              (url "https://github.com/racket/racket")
>> +              (commit (string-append "v" version))))
>> +        (sha256
>> +         (base32
>> "1vpl66gdgc8rnldmn8rmb7ar9l057jqjvgpfn29k57i3c5skr8s6"))
>> +        (file-name (git-file-name "racket" version))
>> +        (patches (search-patches "racket-minimal-sh-via-rktio.patch"
>> +                                 ;; Remove by Racket 8.5:
>> +                                 "racket-enable-scheme-
>> backport.patch"))
>> +        (modules '((guix build utils)))
>> +        (snippet
>> +         #~(begin
>> +             ;; Unbundle Chez submodules.
>> +             (with-directory-excursion "racket/src/ChezScheme"
>> +               #$unbundle-chez-submodules)
>> +             ;; Unbundle libffi.
>> +             (delete-file-recursively
>> "racket/src/bc/foreign/libffi")))))
>> +     (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"))
>> +     (build-system gnu-build-system)
>> +     (arguments
>> +      (list
>> +       #:configure-flags
>> +       #~(cons "--enable-cgcdefault"
>> +               #$(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.
>> +       #:tests? #f
>> +       ;; Upstream recommends #:out-of-source?, and it does
>> +       ;; help with debugging, but it confuses `install-license-
>> files`.
>> +       #:modules '((ice-9 match)
>> +                   (ice-9 regex)
>> +                   (guix build gnu-build-system)
>> +                   (guix build utils))
>> +       #:strip-directories #~'("opt/racket-vm/bin"
>> +                               "opt/racket-vm/lib")
>> +       #:phases
>> +       #~(let ()
>> +           (define* ((wrap-racket-vm-outputs phase) . args)
>> +             (apply
>> +              phase
>> +              (let loop ((args args))
>> +                (match args
>> +                  ((#:outputs outputs . args)
>> +                   `(#:outputs
>> +                     ,(let loop ((outputs outputs))
>> +                        (match outputs
>> +                          ((("out" . out) . outputs)
>> +                           `(("out" . ,(string-append out
>> "/opt/racket-vm/"))
>> +                             ,@outputs))
>> +                          ((other . outputs)
>> +                           (cons other (loop outputs)))))
>> +                     ,@args))
>> +                  ((arg . args)
>> +                   (cons arg (loop args)))))))
> Why?
>

Why what? Why 'wrap-racket-vm-outputs'? The wrapped phases don't have
keywords like #:strip-directories, so adjusting their #:output argument
is the only way to tell them where to find the files they need to
operate on.

-Philip
P
P
Philip McGrath wrote on 16 Feb 2022 21:16
Re: [PATCH 11/11] gnu: racket: Update to 8.4.
e8505784-113b-4ae2-6c8c-d24815e33bc9@philipmcgrath.com
Hi,

On 2/14/22 10:28, Liliana Marie Prikler wrote:
Toggle quote (15 lines)
> Am Sonntag, dem 13.02.2022 um 16:51 -0500 schrieb Philip McGrath:
>> * gnu/packages/patches/racket-gui-tethered-launcher-backport.patch,
>> gnu/packages/patcheches/racket-srfi-fsdg-backport.patch: New patches.
>> * gnu/local.mk (dist_patch_DATA): Add them.
>> * gnu/packages/chez-and-racket-bootstrap.scm (racket-vm-for-system):
>> New procedure.
>> * gnu/packages/racket.scm (racket-minimal, racket): Update to 8.4.
>> Rewrite to use 'racket-vm-for-system', label-less inputs, G-
>> expressions, and Git origins for main-distribution packages.
> Separate into multiple patches.
>
>>  .../patches/racket-srfi-fsdg-backport.patch   | 41622 ++++++++++++++++
> No.
> Patches should be small, not include a bunch of irrelevant doc changes.

The FSDG fix has now been applied upstream, so I can now just point at
the right Git commit.

Other than that, I don't know how this could reasonably be split into
multiple patches. I deleted the vast majority of
"gnu/packages/racket.scm" and rewrote it. Most of the work done by the
old version was bootstrapping, which is now handled by the racket-vm-*
packages: keeping "gnu/packages/racket.scm" nearly unchanged until this
point basically was my attempt at making these changes more granularly,
Even the switch to use Git origins for main-distribution packages rather
than carving them out of the built tarball (which was always an ugly
hack) would not be trivial to move to a separate patch. The new
"racket-gui-tethered-launcher-backport.patch" (without which the
'racket' package would be broken) would have to be manually edited to
apply to the built tarball---the built tarball is really not the
preferred form for modifications by a long shot---and newly added
packages for the new expeditor and the redesigned syntax highlighting
and indentation libraries would need to be added to the old listing,
only to be immediately removed.

-Philip
P
P
Philip McGrath wrote on 16 Feb 2022 21:46
Re: [PATCH 05/11] gnu: Add stex.
a4ca25ea-dc1f-53bf-7a28-1e957132c98b@philipmcgrath.com
Hi,

On 2/16/22 13:35, Philip McGrath wrote:
Toggle quote (20 lines)
> Hi,
>
> On 2/14/22 09:46, Liliana Marie Prikler wrote:
>> Am Sonntag, dem 13.02.2022 um 16:51 -0500 schrieb Philip McGrath:
>>> * gnu/packages/chez-and-racket-bootstrap.scm (stex-bootstrap): New
>>> variable.
>>> (stex): Change from origin to package inheriting from 'stex-
>>> bootstrap'.
>>> (chez-scheme)[native-inputs]: Add 'stex-bootstrap'. Remove
>>> labels. Remove dependencies of stex-bootstrap.
>>> [inputs]: Remove labels.
>>> [arguments]: Adapt to use 'stex-bootstrap', 'search-input-file', and
>>> G-expressions.
>>> (nanopass): Make it public as a temporary workaround for Racket.
>>> * gnu/packages/racket.scm
>>> (racket-bootstrap-chez-bootfiles)[native-inputs]: Update accordingly.
>> This is again a large number of changes in one go.  When it comes to
>> writing good patches, less is more, especially in terms of being
>> understandable.

I will separate the non-substantive changes to input labels and such as
discussed below.

Toggle quote (28 lines)
>>> +(define (unpack-nanopass+stex)
>>> +  ;; delayed resolution of `nanopass`
>>> +  #~(begin
>>> +      (copy-recursively #$nanopass
>>> +                        "nanopass"
>>> +                        #:keep-mtime? #t)
>>> +      (mkdir-p "stex")
>>> +      (with-output-to-file "stex/Mf-stex"
>>> +        (lambda ()
>>> +          ;; otherwise, it will try to download submodules
>>> +          (display "# to placate ../configure")))))
>>> [...]
>>> -       (snippet
>>> -        ;; Remove bundled libraries.
>>> -        (with-imported-modules '((guix build utils))
>>> -          #~(begin
>>> -              (use-modules (guix build utils))
>>> -              (for-each (lambda (dir)
>>> -                          (when (directory-exists? dir)
>>> -                            (delete-file-recursively dir)))
>>> -                        '("stex"
>>> -                          "nanopass"
>>> -                          "lz4"
>>> -                          "zlib")))))))
>>> [...]
>>> +              (snippet unbundle-chez-submodules)))
>> Why?

Why lift the snippet to `unbundle-chez-submodules`? The origin of Racket
also needs it, but wrapped in a `with-directory-excursion`.

Toggle quote (37 lines)
>>
>>>       (build-system gnu-build-system)
>>>       (inputs
>>> -     `(("libuuid" ,util-linux "lib")
>>> -       ("zlib" ,zlib)
>>> -       ("lz4" ,lz4)
>>> -       ;; for expeditor:
>>> -       ("ncurses" ,ncurses)
>>> -       ;; for X11 clipboard support in expeditor:
>>> -       ;;
>>> https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
>>> -       ("libx11" ,libx11)))
>>> -    (native-inputs
>>> -     `(("nanopass" ,nanopass) ; source only
>>> -       ;; for docs
>>> -       ("stex" ,stex)
>>> -       ("xorg-rgb" ,xorg-rgb)
>>> -       ("texlive" ,(texlive-updmap.cfg (list texlive-dvips-l3backend
>>> -                                             texlive-epsf
>>> -                                             texlive-fonts-ec
>>> -                                             texlive-oberdiek)))
>>> -       ("ghostscript" ,ghostscript)
>>> -       ("netpbm" ,netpbm)))
>>> +     (list
>>> +      `(,util-linux "lib") ;<-- libuuid
>>> +      zlib
>>> +      lz4
>>> +      ncurses ;<-- for expeditor
>>> +      ;; for X11 clipboard support in expeditor:
>>> +      ;;
>>> https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
>>> +      libx11))
>>> +    (native-inputs (list stex-bootstrap))
>> This is a lot of noise.  Either first clean up the inputs and then add
>> new ones or the other way round, but doing both in the same commit
>> (especially with other stuff as well) is too much imo.

Ok, I will clean the inputs before lifting out stex.

Toggle quote (226 lines)
>>
>>>       (native-search-paths
>>>        (list (search-path-specification
>>>               (variable "CHEZSCHEMELIBDIRS")
>>>               (files (list (string-append "lib/chez-scheme"))))))
>>>       (outputs '("out" "doc"))
>>>       (arguments
>>> -     `(#:modules
>>> -       ((guix build gnu-build-system)
>>> +     (list
>>> +      #:modules
>>> +      '((guix build gnu-build-system)
>>>           (guix build utils)
>>>           (ice-9 ftw)
>>>           (ice-9 match))
>>> -       #:test-target "test"
>>> -       #:configure-flags
>>> -       '("--threads") ;; TODO when we fix armhf, it doesn't support
>>> --threads
>>> -       #:phases
>>> -       (modify-phases %standard-phases
>>> -         ;; put these where configure expects them to be
>>> -         (add-after 'unpack 'unpack-nanopass+stex
>>> -           (lambda* (#:key native-inputs inputs #:allow-other-keys)
>>> -             (for-each (lambda (dep)
>>> -                         (define src
>>> -                           (assoc-ref (or native-inputs inputs)
>>> dep))
>>> -                         (copy-recursively src dep
>>> -                                           #:keep-mtime? #t))
>>> -                       '("nanopass" "stex"))))
>>> -         ;; NOTE: the custom Chez 'configure' script doesn't allow
>>> -         ;; unrecognized flags, such as those automatically added
>>> -         ;; by `gnu-build-system`.
>>> -         (replace 'configure
>>> -           (lambda* (#:key inputs outputs
>>> -                           (configure-flags '())
>>> -                           #:allow-other-keys)
>>> -             (let* ((zlib-static (assoc-ref inputs "zlib:static"))
>>> -                    (lz4-static (assoc-ref inputs "lz4:static"))
>>> -                    (out (assoc-ref outputs "out"))
>>> -                    ;; add flags which are always required:
>>> -                    (flags (cons* (string-append "--installprefix="
>>> out)
>>> +      #:test-target "test"
>>> +      ;; TODO when we fix armhf, it may not support --threads
>>> +      #:configure-flags #~'("--threads")
>>> +      #:phases
>>> +      #~(modify-phases %standard-phases
>>> +          (add-after 'unpack 'unpack-nanopass+stex
>>> +            (lambda args
>>> +              #$(unpack-nanopass+stex)))
>>> +          ;; NOTE: the custom Chez 'configure' script doesn't allow
>>> +          ;; unrecognized flags, such as those automatically added
>>> +          ;; by `gnu-build-system`.
>>> +          (replace 'configure
>>> +            (lambda* (#:key inputs (configure-flags '()) #:allow-
>>> other-keys)
>>> +              ;; add flags which are always required:
>>> +              (let ((flags (cons* (string-append "--installprefix="
>>> #$output)
>>>                                     "ZLIB=-lz"
>>>                                     "LZ4=-llz4"
>>>                                     "--libkernel"
>>> @@ -305,90 +276,59 @@ (define src
>>>                                     ;; and letting Chez try causes an
>>> error
>>>                                     "--nogzip-man-pages"
>>>                                     configure-flags)))
>>> -               (format #t "configure flags: ~s~%" flags)
>>> -               ;; Some makefiles (for tests) don't seem to propagate
>>> CC
>>> -               ;; properly, so we take it out of their hands:
>>> -               (setenv "CC" ,(cc-for-target))
>>> -               (setenv "HOME" "/tmp")
>>> -               (apply invoke
>>> -                      "./configure"
>>> -                      flags))))
>>> -         ;; The binary file name is called "scheme" as is the one
>>> from MIT/GNU
>>> -         ;; Scheme.  We add a symlink to use in case both are
>>> installed.
>>> -         (add-after 'install 'install-symlink
>>> -           (lambda* (#:key outputs #:allow-other-keys)
>>> -             (let* ((out (assoc-ref outputs "out"))
>>> -                    (bin (string-append out "/bin"))
>>> -                    (lib (string-append out "/lib"))
>>> -                    (name "chez-scheme"))
>>> -               (symlink (string-append bin "/scheme")
>>> -                        (string-append bin "/" name))
>>> -               (map (lambda (file)
>>> -                      (symlink file (string-append (dirname file)
>>> -                                                   "/" name
>>> ".boot")))
>>> -                    (find-files lib "scheme.boot")))))
>>> -         ;; Building explicitly lets us avoid using substitute*
>>> -         ;; to re-write makefiles.
>>> -         (add-after 'install-symlink 'prepare-stex
>>> -           (lambda* (#:key native-inputs inputs outputs #:allow-
>>> other-keys)
>>> -             (let* ((stex+version
>>> -                     (strip-store-file-name
>>> -                      (assoc-ref (or native-inputs inputs) "stex")))
>>> -                    ;; Eventually we want to install stex as a real
>>> -                    ;; package so it's reusable. For now:
>>> -                    (stex-output "/tmp")
>>> -                    (doc-dir (string-append stex-output
>>> -                                            "/share/doc/"
>>> -                                            stex+version)))
>>> -               (with-directory-excursion "stex"
>>> -                 (invoke "make"
>>> -                         "install"
>>> -                         (string-append "LIB="
>>> -                                        stex-output
>>> -                                        "/lib/"
>>> -                                        stex+version)
>>> -                         (string-append "Scheme="
>>> -                                        (assoc-ref outputs "out")
>>> -                                        "/bin/scheme"))
>>> -                 (for-each (lambda (pth)
>>> -                             (install-file pth doc-dir))
>>> -                           '("ReadMe" ; includes the license
>>> -                             "doc/stex.html"
>>> -                             "doc/stex.css"
>>> -                             "doc/stex.pdf"))))))
>>> -         ;; Building the documentation requires stex and a running
>>> scheme.
>>> -         ;; FIXME: this is probably wrong for cross-compilation
>>> -         (add-after 'prepare-stex 'install-doc
>>> -           (lambda* (#:key native-inputs inputs outputs #:allow-
>>> other-keys)
>>> -             (let* ((chez+version (strip-store-file-name
>>> -                                   (assoc-ref outputs "out")))
>>> -                    (stex+version
>>> -                     (strip-store-file-name
>>> -                      (assoc-ref (or native-inputs inputs) "stex")))
>>> -                    (scheme (string-append (assoc-ref outputs "out")
>>> -                                           "/bin/scheme"))
>>> -                    ;; see note on stex-output in phase build-stex,
>>> above:
>>> -                    (stexlib (string-append "/tmp"
>>> -                                            "/lib/"
>>> -                                            stex+version))
>>> -                    (doc-dir (string-append (assoc-ref outputs
>>> "doc")
>>> -                                            "/share/doc/"
>>> -                                            chez+version)))
>>> -               (define* (stex-make #:optional (suffix ""))
>>> -                 (invoke "make"
>>> -                         "install"
>>> -                         (string-append "Scheme=" scheme)
>>> -                         (string-append "STEXLIB=" stexlib)
>>> -                         (string-append "installdir=" doc-dir
>>> suffix)))
>>> -               (with-directory-excursion "csug"
>>> -                 (stex-make "/csug"))
>>> -               (with-directory-excursion "release_notes"
>>> -                 (stex-make "/release_notes"))
>>> -               (with-directory-excursion doc-dir
>>> -                 (symlink "release_notes/release_notes.pdf"
>>> -                          "release_notes.pdf")
>>> -                 (symlink "csug/csug9_5.pdf"
>>> -                          "csug.pdf"))))))))
>>> +                (format #t "configure flags: ~s~%" flags)
>>> +                ;; Some makefiles (for tests) don't seem to
>>> propagate CC
>>> +                ;; properly, so we take it out of their hands:
>>> +                (setenv "CC" #$(cc-for-target))
>>> +                (setenv "HOME" "/tmp")
>>> +                (apply invoke "./configure" flags))))
>>> +          ;; The binary file name is called "scheme" as is the one
>>> from
>>> +          ;; MIT/GNU Scheme.  We add a symlink to use in case both
>>> are
>>> +          ;; installed.
>>> +          (add-after 'install 'install-symlink
>>> +            (lambda* (#:key outputs #:allow-other-keys)
>>> +              (let* ((scheme (search-input-file outputs
>>> "/bin/scheme"))
>>> +                     (bin-dir (dirname scheme)))
>>> +                (symlink scheme
>>> +                         (string-append bin-dir "/chez-scheme"))
>>> +                (match (find-files (string-append bin-dir "/../lib")
>>> +                                   "scheme.boot")
>>> +                  ((scheme.boot)
>>> +                   (symlink scheme.boot
>>> +                            (string-append (dirname scheme.boot)
>>> +                                           "/chez-
>>> scheme.boot")))))))
>>> +          ;; Building the documentation requires stex and a running
>>> scheme.
>>> +          ;; FIXME: this is probably wrong for cross-compilation
>>> +          (add-after 'install-symlink 'install-doc
>>> +            (lambda* (#:key native-inputs inputs outputs
>>> +                            #:allow-other-keys)
>>> +              (match (assoc-ref outputs "doc")
>>> +                (#f
>>> +                 (format #t "not installing docs~%"))
>>> +                (doc-prefix
>>> +                 (let* ((chez+version (strip-store-file-name
>>> #$output))
>>> +                        (scheme (search-input-file outputs
>>> "/bin/scheme"))
>>> +                        (stexlib (search-input-directory
>>> +                                  (or native-inputs inputs)
>>> +                                  "/lib/stex"))
>>> +                        (doc-dir (string-append doc-prefix
>>> +                                                "/share/doc/"
>>> +                                                chez+version)))
>>> +                   (define* (stex-make #:optional (suffix ""))
>>> +                     (invoke "make" "install"
>>> +                             (string-append "Scheme=" scheme)
>>> +                             (string-append "STEXLIB=" stexlib)
>>> +                             (string-append "installdir="
>>> +                                            doc-dir suffix)))
>>> +                   (with-directory-excursion "csug"
>>> +                     (stex-make "/csug"))
>>> +                   (with-directory-excursion "release_notes"
>>> +                     (stex-make "/release_notes"))
>>> +                   (with-directory-excursion doc-dir
>>> +                     (symlink "release_notes/release_notes.pdf"
>>> +                              "release_notes.pdf")
>>> +                     (symlink "csug/csug9_5.pdf"
>>> +                              "csug.pdf"))))))))))
>> Again mixing cosmetic changes with functional ones.

Ok, I separate these.

Toggle quote (10 lines)
>>> @@ -412,3 +352,145 @@ (define* (stex-make #:optional (suffix ""))
>>>   generates native code for each target processor, with support for
>>> x86, x86_64,
>>>   and 32-bit PowerPC architectures.")
>>>       (license license:asl2.0)))
>>> +
>>> +;;
>>> +;; Chez's bootstrap dependencies:
>>> +;;

...

Toggle quote (4 lines)
>> Not quite sure on these hunks.  Could be fine, could not be fine.
>> Disentangling stex from chez and publicly exporting it is probably a
>> good idea, though.

Especially because it is also needed to build the docs for nanopass,
itself, and at least one package not yet in Guix

-Philip
P
P
Philip McGrath wrote on 16 Feb 2022 22:13
Re: [PATCH 07/11] gnu: chez-scheme: Explicitly package bootstrap bootfiles.
9979ce6c-9583-18e1-43da-098d2d74e741@philipmcgrath.com
Hi,

On 2/14/22 09:54, Liliana Marie Prikler wrote:
Toggle quote (21 lines)
> Am Sonntag, dem 13.02.2022 um 16:51 -0500 schrieb Philip McGrath:
>> This might seem a bit silly in isolation, but it makes the structure
>> of the upstream Chez Scheme package the same as for the Racket
>> variant, it sets things up for (one day, hopefully) actually being
>> able to bootstrap the upstream Chez Scheme bootfiles, and it may be
>> useful for cross-compilation and adding support for architectures
>> without pre-built bootfiles from upstream.
>>
>> * gnu/packages/chez-and-racket-bootstrap.scm
>> (chez-scheme-bootstrap-bootfiles): New variable.
>> (chez-scheme)[native-inputs]: Add it.
>> [arguments]: Add new phase 'unpack-bootfiles'.
>> [version, source, home-page]: Derive from 'chez-scheme-bootstrap-
>> bootfiles'.
>> ---
> While having chez-scheme-bootstrap-bootfiles (silly name) does make
> some kind of sense, making chez-scheme inherit from it does not. Given
> that we don't have a chez-scheme bootstrap tower at hand, you should
> probably make (chez-scheme-bootstrap) a procedure which takes chez-
> scheme's origin as argument and returns the full package.
>
Making a function is an interesting idea, but I'm not sure I'm quite
picturing what you have in mind. I will see if I can figure out
something that seems reasonable as I revise this series, if I don't hear
from you before then.

One reason I like making the bootfiles a package is that a set of
bootfiles includes artifacts in addition to the bootfiles themselves,
such as generated C headers describing the layout of Scheme objects in
memory, some of which are not included as part of an installed Chez
Scheme. For example, imagine someone wants to run Chez Scheme on
FreeBSD: upstream does not distribute BSD bootfiles, so they must be
cross-compiled. Even though Guix doesn't have a C toolchain for FreeBSD
(AFAIK), Guix could be used to reproducibly build the needed bootfiles
and pack a "source" tarball to be used on a FreeBSD build machine.

Also, the process for building bootfiles is largely orthogonal to
building the actual `scheme` executable, and it seems like eventually it
may be useful to be able to override options separately.

There may be other ways to address these sorts of things, and it's true
that a lot of this has more to do with my intuition of what might be
work well in the future, rather than something that actually works right
now.

Is there a technical reason to prefer either repeating the home page,
license, etc. or writing e.g. `(package-license
chez-scheme-bootstrap-bootfiles)` rather than using inheritance?

-Philip
P
P
Philip McGrath wrote on 16 Feb 2022 23:54
Re: [PATCH 04/11] gnu: chez-and-racket-bootstrap: Add utilities for Chez machine types.
220923bf-f243-8760-a0cf-1c77a26023cf@philipmcgrath.com
Hi,

On 2/14/22 09:34, Liliana Marie Prikler wrote:
Toggle quote (44 lines)
> Hi,
>
> Am Sonntag, dem 13.02.2022 um 16:51 -0500 schrieb Philip McGrath:
>> [...]
>> +(define (chez-machine->upstream-restriction mach)
>> +  "Given a string MACH naming a Chez Scheme machine type, returns a
>> symbol
>> +naming a restriction on the upstream Chez Scheme implementation
>> compared to
>> +the Racket variant, or @code{#f} if no such restriction exists.  The
>> +restriction is reported for the architecture--OS pair, regardless of
>> whether
>> +MACH specifies a threaded or an unthreaded variant.
>> +
>> +Possible restrictions currently include:
>> +@itemize @bullet
>> +@item
>> +@code{'no-threads}: Support for native threads is not available
>> upstream.
>> +@item
>> +@code{'no-support}: The upstream release doesn't claim to support
>> this
>> +architecture--OS combination at all.
>> +@end itemize
>> +
>> +See @code{chez-machine->nix-system} for more details about
>> acceptable values
>> +for MACH."
>> +  (let ((mach (chez-machine->unthreaded mach)))
>> +    (cond
>> +     ((string-prefix? "arm64" mach)
>> +      'no-support)
>> +     ((string-prefix? "arm32" mach)
>> +      (if (string-suffix? "le" mach)
>> +          'no-threads
>> +          'no-support))
>> +     ((string-prefix? "ppc32" mach)
>> +      (if (string-suffix? "le" mach)
>> +          #f
>> +          'no-support))
>> +     (else
>> +      #f))))
> -> is a conversion operator, not an "accessor".

I thought of this as a conversion more than an accessor.

Toggle quote (9 lines)
> "upstream-restriction" sounds rather negative, I'd rather have (chez-
> machine-features), which yields #f if the machine is unsupported and a
> (possibly empty) list of features otherwise, such as '(threads).
>
> I'm also not quite sure what the point is behind using chez machines
> here. Why not simply test the systems with the predicates we already
> have, i.e. target-arm64?, target-arm32?, target-linux?, target-ppc32?,
> ...

I agree that the name of this procedure should avoid sounding negative:
'restriction' was the best I'd come up with so far. I think I like
'chez-machine-features' somewhat better, but with a few reservations.

Using predicates like 'target-arm32?' makes some sense overall, and I'll
try it. One subtly is that systems supported by neither upstream nor
Racket are currently handled by `and=>` in clients.

Also, I guess it's odd to have this function operate on Chez Scheme
machine types anyway, since a machine type specifies threaded or unthreaded.

I'm currently thinking something like:

Toggle snippet (20 lines)
(define* (chez-upstream-features-for-system #:optional
(system (or
(%current-target-system)
(%current-system))))
(cond
((not (nix-system->chez-machine system))
#f)
((target-arm64? system)
#f)
((target-arm32? system)
(and (target-linux? system)
'()))
((target-ppc32? system)
(and (target-linux? system)
'(threads)))
(else
'(threads))))

Alternatively, there could be an argument called something like
"variant", where the default would be 'upstream or maybe #f, and
supplying 'racket would always return '(threads). (Racket CS requires
the threaded version of Chez Scheme, so the chez-scheme-for-racket has
consistently added thread support immediately upon adding any new target.)

Toggle quote (4 lines)
>
> And as a minor pet peeve, you ought to spell out machine.
>

Ok, will do.

Toggle quote (4 lines)
>
>> +(define* (nix-system->chez-machine #:optional (system (%current-
>> system))

This should have been (or (%current-target-system) (%current-system)).

Toggle quote (36 lines)
>> +                                   #:key (threads? 'always))
>> +  "Return the Chez Scheme machine type corresponding to the Nix
>> system
>> +identifier SYSTEM, or @code{#f} if the translation of SYSTEM to a
>> Chez Scheme
>> +machine type is undefined.
>> +
>> +When THREADS? is @code{'always} (the default), the threaded variant
>> of the
>> +machine type will be returned: note that the package returned by
>> +@code{chez-scheme-for-system} will always support native threads.
>> When
>> +THREADS? is @code{#f}, the unthreaded machine type will be
>> returned.  If
>> +THREADS? is @code{'upstream} (the default), the threaded variant of
>> the
>> +machine type will be returned if and only if it is supported by
>> upstream Chez
>> +Scheme (see @code{chez-machine->upstream-restriction}).  If THREADS?
>> is any
>> +other value, an exception is raised."
> What's the point in having THREADS? 'always? In any case, assuming
> chez-machine-features is to be exported, this can easily be checked --
> even if not, we can add the check internally by writing
> #:key (threads? (chez-supports-threads? system))
>
>> +  (let* ((hyphen (string-index system #\-))
>> +         (nix-arch (substring system 0 hyphen))
>> +         (nix-os (substring system (+ 1 hyphen)))
>> +         (chez-arch (assoc-ref %nix-arch-to-chez-alist nix-arch))
>> +         (chez-os (assoc-ref %nix-os-to-chez-alist nix-os))
>> +         (mach (and chez-arch chez-os (string-append chez-arch chez-
>> os))))
> This series of let-bindings should probably be done in a separate
> function called nix-system->chez-machine.

On the one hand, the result of 'chez-scheme-for-system' will always
support threads, so being threaded by default is convenient. On the
other hand, it looks like I've reduced the use of this function (by
searching for files rather than coding in the machine type directory)
enough that it doesn't have a big impact either way. It will be more
important when we support cross-compilation, and I think we should keep
these functions internal and defer as much as possible of their API
design until then.

For now, I think I'll say that it's unspecified whether the result is a
threaded or unthreaded machine type and add
`chez-machine->{un,}threaded` as needed.

-Philip
L
L
Liliana Marie Prikler wrote on 17 Feb 2022 08:10
Re: [PATCH 07/11] gnu: chez-scheme: Explicitly package bootstrap bootfiles.
b8d30749681a0be910629cfe78229cfca19ce36b.camel@ist.tugraz.at
Hi,

Am Mittwoch, dem 16.02.2022 um 16:13 -0500 schrieb Philip McGrath:
Toggle quote (30 lines)
> Hi,
>
> On 2/14/22 09:54, Liliana Marie Prikler wrote:
> > Am Sonntag, dem 13.02.2022 um 16:51 -0500 schrieb Philip McGrath:
> > > This might seem a bit silly in isolation, but it makes the
> > > structure of the upstream Chez Scheme package the same as for the
> > > Racket variant, it sets things up for (one day, hopefully)
> > > actually being able to bootstrap the upstream Chez Scheme
> > > bootfiles, and it may be useful for cross-compilation and adding
> > > support for architectures without pre-built bootfiles from
> > > upstream.
> > >
> > > * gnu/packages/chez-and-racket-bootstrap.scm
> > > (chez-scheme-bootstrap-bootfiles): New variable.
> > > (chez-scheme)[native-inputs]: Add it.
> > > [arguments]: Add new phase 'unpack-bootfiles'.
> > > [version, source, home-page]: Derive from 'chez-scheme-bootstrap-
> > > bootfiles'.
> > > ---
> > While having chez-scheme-bootstrap-bootfiles (silly name) does make
> > some kind of sense, making chez-scheme inherit from it does not. 
> > Given that we don't have a chez-scheme bootstrap tower at hand, you
> > should probably make (chez-scheme-bootstrap) a procedure which
> > takes chez-scheme's origin as argument and returns the full
> > package.
> >
> Making a function is an interesting idea, but I'm not sure I'm quite
> picturing what you have in mind. I will see if I can figure out
> something that seems reasonable as I revise this series, if I don't
> hear from you before then.
I was picturing something like

(define chez-bootfiles (chez ...)
(package/inherit chez
(inputs ...)
(native-inputs ...)
(build-system ...)
(arguments ...)))

Toggle quote (14 lines)
> One reason I like making the bootfiles a package is that a set of
> bootfiles includes artifacts in addition to the bootfiles themselves,
> such as generated C headers describing the layout of Scheme objects
> in memory, some of which are not included as part of an installed
> Chez Scheme. For example, imagine someone wants to run Chez Scheme on
> FreeBSD: upstream does not distribute BSD bootfiles, so they must be
> cross-compiled. Even though Guix doesn't have a C toolchain for
> FreeBSD (AFAIK), Guix could be used to reproducibly build the needed
> bootfiles and pack a "source" tarball to be used on a FreeBSD build
> machine.
>
> Also, the process for building bootfiles is largely orthogonal to
> building the actual `scheme` executable, and it seems like eventually
> it may be useful to be able to override options separately.
Again, I'm with you on making chez-bootfiles a package and your
rationale sounds reasonable, but I don't think it's correct to say that
chez inherits from them. IIUC it is rather the other way around; the
bootfiles contain precompiled versions of Chez among other things.

Toggle quote (3 lines)
> Is there a technical reason to prefer either repeating the home page,
> license, etc. or writing e.g. `(package-license
> chez-scheme-bootstrap-bootfiles)` rather than using inheritance?
You should not write (package-license chez-scheme-bootstrap-files),
that's the point! For one, that's exactly what inheritance would do
unless you specify the field (technical reason), but more importantly,
as a reader, using (package-license this-other-chez-thing) sends me on
a journey to track down this-other-chez-thing while determining the
license of chez! That's just silly (social reason).

Cheers
L
L
Liliana Marie Prikler wrote on 17 Feb 2022 08:24
Re: [PATCH 04/11] gnu: chez-and-racket-bootstrap: Add utilities for Chez machine types.
aee1027c5a07f9786590fecf0a0aa8f4a4c2606a.camel@ist.tugraz.at
Hi,

Am Mittwoch, dem 16.02.2022 um 17:54 -0500 schrieb Philip McGrath:
Toggle quote (20 lines)
> > > +See @code{chez-machine->nix-system} for more details about
> > > acceptable values
> > > +for MACH."
> > > +  (let ((mach (chez-machine->unthreaded mach)))
> > > +    (cond
> > > +     ((string-prefix? "arm64" mach)
> > > +      'no-support)
> > > +     ((string-prefix? "arm32" mach)
> > > +      (if (string-suffix? "le" mach)
> > > +          'no-threads
> > > +          'no-support))
> > > +     ((string-prefix? "ppc32" mach)
> > > +      (if (string-suffix? "le" mach)
> > > +          #f
> > > +          'no-support))
> > > +     (else
> > > +      #f))))
> > -> is a conversion operator, not an "accessor".
>
> I thought of this as a conversion more than an accessor.
Conversion follows the lines of "is (roughly) a", whereas this is a
"has a" relation, which would imply accessing things.

Toggle quote (23 lines)
> > "upstream-restriction" sounds rather negative, I'd rather have
> > (chez-machine-features), which yields #f if the machine is
> > unsupported and a (possibly empty) list of features otherwise, such
> > as '(threads).
> >
> > I'm also not quite sure what the point is behind using chez
> > machines here.  Why not simply test the systems with the predicates
> > we already have, i.e. target-arm64?, target-arm32?, target-linux?,
> > target-ppc32?,
> > ...
>
> I agree that the name of this procedure should avoid sounding
> negative: 'restriction' was the best I'd come up with so far. I
> think I like 'chez-machine-features' somewhat better, but with a few
> reservations.
>
> Using predicates like 'target-arm32?' makes some sense overall, and
> I'll try it. One subtly (sic) is that systems supported by neither
> upstream nor Racket are currently handled by `and=>` in clients.
>
> Also, I guess it's odd to have this function operate on Chez Scheme
> machine types anyway, since a machine type specifies threaded or
> unthreaded.
Not sure how to deal with these reservations or what they'd imply, so
following along.

Toggle quote (22 lines)
> I'm currently thinking something like:
>
> --8<---------------cut here---------------start------------->8---
> (define* (chez-upstream-features-for-system #:optional
>                                              (system (or
> (%current-target-system)
>  
> (%current-system))))
>    (cond
>     ((not (nix-system->chez-machine system))
>      #f)
>     ((target-arm64? system)
>      #f)
>     ((target-arm32? system)
>      (and (target-linux? system)
>           '()))
>     ((target-ppc32? system)
>      (and (target-linux? system)
>           '(threads)))
>     (else
>      '(threads))))
> --8<---------------cut here---------------end--------------->8---
Haven't tested this, but LGTM.

Toggle quote (6 lines)
> Alternatively, there could be an argument called something like
> "variant", where the default would be 'upstream or maybe #f, and
> supplying 'racket would always return '(threads). (Racket CS requires
> the threaded version of Chez Scheme, so the chez-scheme-for-racket
> has consistently added thread support immediately upon adding any new
> target.)
I don't think delegating to racket this soon is a good idea.

Toggle quote (68 lines)
> > And as a minor pet peeve, you ought to spell out machine.
> >
>
> Ok, will do.
>
> >
> > > +(define* (nix-system->chez-machine #:optional (system (%current-
> > > system))
>
> This should have been (or (%current-target-system) (%current-
> system)).
>
> > > +                                   #:key (threads? 'always))
> > > +  "Return the Chez Scheme machine type corresponding to the Nix
> > > system
> > > +identifier SYSTEM, or @code{#f} if the translation of SYSTEM to
> > > a
> > > Chez Scheme
> > > +machine type is undefined.
> > > +
> > > +When THREADS? is @code{'always} (the default), the threaded
> > > variant
> > > of the
> > > +machine type will be returned: note that the package returned by
> > > +@code{chez-scheme-for-system} will always support native
> > > threads.
> > > When
> > > +THREADS? is @code{#f}, the unthreaded machine type will be
> > > returned.  If
> > > +THREADS? is @code{'upstream} (the default), the threaded variant
> > > of
> > > the
> > > +machine type will be returned if and only if it is supported by
> > > upstream Chez
> > > +Scheme (see @code{chez-machine->upstream-restriction}).  If
> > > THREADS?
> > > is any
> > > +other value, an exception is raised."
> > What's the point in having THREADS? 'always?  In any case, assuming
> > chez-machine-features is to be exported, this can easily be checked
> > --
> > even if not, we can add the check internally by writing
> >    #:key (threads? (chez-supports-threads? system))
> >
> > > +  (let* ((hyphen (string-index system #\-))
> > > +         (nix-arch (substring system 0 hyphen))
> > > +         (nix-os (substring system (+ 1 hyphen)))
> > > +         (chez-arch (assoc-ref %nix-arch-to-chez-alist nix-
> > > arch))
> > > +         (chez-os (assoc-ref %nix-os-to-chez-alist nix-os))
> > > +         (mach (and chez-arch chez-os (string-append chez-arch
> > > chez-
> > > os))))
> > This series of let-bindings should probably be done in a separate
> > function called nix-system->chez-machine.
>
> On the one hand, the result of 'chez-scheme-for-system' will always
> support threads, so being threaded by default is convenient. On the
> other hand, it looks like I've reduced the use of this function (by
> searching for files rather than coding in the machine type directory)
> enough that it doesn't have a big impact either way. It will be more
> important when we support cross-compilation, and I think we should
> keep these functions internal and defer as much as possible of their
> API design until then.
>
> For now, I think I'll say that it's unspecified whether the result is
> a threaded or unthreaded machine type and add
> `chez-machine->{un,}threaded` as needed.
I think you can keep (chez-supports-threads? system) hidden even when
using it to instantiate defaults. I currently don't see the relation
between chez-scheme-for-system and nix-system->chez-machine, so if
that's relevant, you'd have to clarify.

Cheers
P
P
Philip McGrath wrote on 17 Feb 2022 08:37
3fe28b09-37f5-d854-dfc1-1a2ab8952055@philipmcgrath.com
Hi,

On 2/17/22 02:24, Liliana Marie Prikler wrote:
Toggle quote (4 lines)
> I currently don't see the relation
> between chez-scheme-for-system and nix-system->chez-machine, so if
> that's relevant, you'd have to clarify.

It's relevant only in that, unless you as a user have done some
transformation to specifically build an unthreaded variant, you will be
using the threaded machine type.

-Philip
P
P
Philip McGrath wrote on 17 Feb 2022 09:06
Re: [PATCH 07/11] gnu: chez-scheme: Explicitly package bootstrap bootfiles.
0a2fdc03-5b05-02e4-ab0f-d9ef23d6460e@philipmcgrath.com
Hi,

On 2/17/22 02:10, Liliana Marie Prikler wrote:
Toggle quote (43 lines)
> Hi,
>
> Am Mittwoch, dem 16.02.2022 um 16:13 -0500 schrieb Philip McGrath:
>> Hi,
>>
>> On 2/14/22 09:54, Liliana Marie Prikler wrote:
>>> Am Sonntag, dem 13.02.2022 um 16:51 -0500 schrieb Philip McGrath:
>>>> This might seem a bit silly in isolation, but it makes the
>>>> structure of the upstream Chez Scheme package the same as for the
>>>> Racket variant, it sets things up for (one day, hopefully)
>>>> actually being able to bootstrap the upstream Chez Scheme
>>>> bootfiles, and it may be useful for cross-compilation and adding
>>>> support for architectures without pre-built bootfiles from
>>>> upstream.
>>>>
>>>> * gnu/packages/chez-and-racket-bootstrap.scm
>>>> (chez-scheme-bootstrap-bootfiles): New variable.
>>>> (chez-scheme)[native-inputs]: Add it.
>>>> [arguments]: Add new phase 'unpack-bootfiles'.
>>>> [version, source, home-page]: Derive from 'chez-scheme-bootstrap-
>>>> bootfiles'.
>>>> ---
>>> While having chez-scheme-bootstrap-bootfiles (silly name) does make
>>> some kind of sense, making chez-scheme inherit from it does not.
>>> Given that we don't have a chez-scheme bootstrap tower at hand, you
>>> should probably make (chez-scheme-bootstrap) a procedure which
>>> takes chez-scheme's origin as argument and returns the full
>>> package.
>>>
>> Making a function is an interesting idea, but I'm not sure I'm quite
>> picturing what you have in mind. I will see if I can figure out
>> something that seems reasonable as I revise this series, if I don't
>> hear from you before then.
> I was picturing something like
>
> (define chez-bootfiles (chez ...)
> (package/inherit chez
> (inputs ...)
> (native-inputs ...)
> (build-system ...)
> (arguments ...)))
>

Sorry, I still don't think I'm following. Would this rely on the
`mative-inputs` being thunked to let the result of this function be an
input to `chez-scheme`? What commonality is the function abstracting
over, compared to having 'chez-scheme-for-racket-bootstrap-bootfiles'
inherit from 'chez-scheme-bootstrap-bootfiles'?

(I'm using "-bootstrap-bootfiles" because there are also other kinds of
bootfiles: applications can create their own bootfiles, e.g.
"racket.boot", and using Chez as a cross-compiler also involves more
bootfiles.)

Toggle quote (10 lines)
>> Is there a technical reason to prefer either repeating the home page,
>> license, etc. or writing e.g. `(package-license
>> chez-scheme-bootstrap-bootfiles)` rather than using inheritance?
> You should not write (package-license chez-scheme-bootstrap-files),
> that's the point! For one, that's exactly what inheritance would do
> unless you specify the field (technical reason), but more importantly,
> as a reader, using (package-license this-other-chez-thing) sends me on
> a journey to track down this-other-chez-thing while determining the
> license of chez! That's just silly (social reason).

That makes some sense with respect to the license and home page, but
what about 'package-source' and 'package-version'?

-Philip
L
L
Liliana Marie Prikler wrote on 17 Feb 2022 09:19
19a00f93e793a062f3004f1a4f452701fb3234d3.camel@ist.tugraz.at
Hi,

Am Donnerstag, dem 17.02.2022 um 03:06 -0500 schrieb Philip McGrath:
Toggle quote (17 lines)
> Hi,
>
> On 2/17/22 02:10, Liliana Marie Prikler wrote:
> > [...]
> > I was picturing something like
> >
> > (define chez-bootfiles (chez ...)
> >    (package/inherit chez
> >      (inputs ...)
> >      (native-inputs ...)
> >      (build-system ...)
> >      (arguments ...)))
> >
>
> Sorry, I still don't think I'm following. Would this rely on the
> `mative-inputs` being thunked to let the result of this function be
> an input to `chez-scheme`? 
Yes.

Toggle quote (3 lines)
> What commonality is the function abstracting over, compared to having
> 'chez-scheme-for-racket-bootstrap-bootfiles' inherit from 'chez-
> scheme-bootstrap-bootfiles'?
At the moment version, source, home-page and license. I don't really
think bootstrap files ought to be a part of chez' source, so if you
wanted to do this really cleanly, you'd have to drop them from chez and
add restrict chez-bootstrap to them, which would imply you'd have to
use (version (package-version chez-scheme)) explicitly – for now I
don't want to add too much burden to that patch and you can assume
source to be the same between the two.

Toggle quote (4 lines)
> (I'm using "-bootstrap-bootfiles" because there are also other kinds
> of bootfiles: applications can create their own bootfiles, e.g.
> "racket.boot", and using Chez as a cross-compiler also involves more
> bootfiles.)
I have no idea how useful that feature is or how widely it is used, but
if those are just binary blobs needed to get chez scheme running, we
ought to treat them as that.
That makes some sense with respect to the license and home page, but
Toggle quote (4 lines)
> >

> That makes some sense with respect to the license and home page, but
> what about 'package-source' and 'package-version'?
Your patch currently makes them the same for both, so you tell me :P
See above for long-term plans.

Cheers
P
P
Philip McGrath wrote on 17 Feb 2022 09:40
d0e5bede-4a10-fa77-1d16-bff6954c346f@philipmcgrath.com
Hi,

On 2/17/22 03:19, Liliana Marie Prikler wrote:
Toggle quote (34 lines)
> Hi,
>
> Am Donnerstag, dem 17.02.2022 um 03:06 -0500 schrieb Philip McGrath:
>> Hi,
>>
>> On 2/17/22 02:10, Liliana Marie Prikler wrote:
>>> [...]
>>> I was picturing something like
>>>
>>> (define chez-bootfiles (chez ...)
>>>    (package/inherit chez
>>>      (inputs ...)
>>>      (native-inputs ...)
>>>      (build-system ...)
>>>      (arguments ...)))
>>>
>>
>> Sorry, I still don't think I'm following. Would this rely on the
>> `mative-inputs` being thunked to let the result of this function be
>> an input to `chez-scheme`?
> Yes.
>
>> What commonality is the function abstracting over, compared to having
>> 'chez-scheme-for-racket-bootstrap-bootfiles' inherit from 'chez-
>> scheme-bootstrap-bootfiles'?
> At the moment version, source, home-page and license. I don't really
> think bootstrap files ought to be a part of chez' source, so if you
> wanted to do this really cleanly, you'd have to drop them from chez and
> add restrict chez-bootstrap to them, which would imply you'd have to
> use (version (package-version chez-scheme)) explicitly – for now I
> don't want to add too much burden to that patch and you can assume
> source to be the same between the two.
>

Ok, this helps, I think. I'll give it a try.

In https://issues.guix.gnu.org/47153#9 you argued---and convinced
me---that we should keep the pre-built bootfiles in the origin until we
actually don't need them. With 'chez-scheme-for-racket', that's already
true, and there aren't bootfiles in that origin anyway. When someday we
can actually bootstrap upstream Chez Scheme, presumably we'll add a
snippet to delete the pre-built bootfiles from the origin, at which
point the it will still be the same origin for both.

-Philip
L
L
Liliana Marie Prikler wrote on 17 Feb 2022 09:46
97f8916ae5bd8d8459bdfd507864f2f55cc217a1.camel@ist.tugraz.at
Hi,

Am Donnerstag, dem 17.02.2022 um 03:40 -0500 schrieb Philip McGrath:
Toggle quote (52 lines)
> Hi,
>
> On 2/17/22 03:19, Liliana Marie Prikler wrote:
> > Hi,
> >
> > Am Donnerstag, dem 17.02.2022 um 03:06 -0500 schrieb Philip
> > McGrath:
> > > Hi,
> > >
> > > On 2/17/22 02:10, Liliana Marie Prikler wrote:
> > > > [...]
> > > > I was picturing something like
> > > >
> > > > (define chez-bootfiles (chez ...)
> > > >     (package/inherit chez
> > > >       (inputs ...)
> > > >       (native-inputs ...)
> > > >       (build-system ...)
> > > >       (arguments ...)))
> > > >
> > >
> > > Sorry, I still don't think I'm following. Would this rely on the
> > > `mative-inputs` being thunked to let the result of this function
> > > be
> > > an input to `chez-scheme`?
> > Yes.
> >
> > > What commonality is the function abstracting over, compared to
> > > having
> > > 'chez-scheme-for-racket-bootstrap-bootfiles' inherit from 'chez-
> > > scheme-bootstrap-bootfiles'?
> > At the moment version, source, home-page and license.  I don't
> > really
> > think bootstrap files ought to be a part of chez' source, so if you
> > wanted to do this really cleanly, you'd have to drop them from chez
> > and
> > add restrict chez-bootstrap to them, which would imply you'd have
> > to
> > use (version (package-version chez-scheme)) explicitly – for now I
> > don't want to add too much burden to that patch and you can assume
> > source to be the same between the two.
> >
>
> Ok, this helps, I think. I'll give it a try.
>
> In <https://issues.guix.gnu.org/47153#9> you argued---and convinced
> me---that we should keep the pre-built bootfiles in the origin until
> we actually don't need them. With 'chez-scheme-for-racket', that's
> already true, and there aren't bootfiles in that origin anyway. When
> someday we can actually bootstrap upstream Chez Scheme, presumably
> we'll add a snippet to delete the pre-built bootfiles from the
> origin, at which point the it will still be the same origin for both.
This concerns schez-scheme-for-racket, not the current chez-scheme for
which we are packaging the bootfiles, am I right? Given that we build
a set of bootfiles that would be enough to go forward, we no longer
need the original bootfiles beyond that point, i.e. the "bootstrap
bootfiles" would only be needed inside chez-bootstrap, but not chez
itself (which can instead use the native-input). Am I missing
something here?
P
P
Philip McGrath wrote on 17 Feb 2022 21:50
[PATCH v2 00/15] Update Racket to 8.4. Adjust Chez Scheme packages.
(address . 53878@debbugs.gnu.org)
20220217205048.967383-1-philip@philipmcgrath.com
Hi,

Here is a v2!

Liliana, I tried using a function to generate the bootfile packages as you
suggested, but I didn't like the result---though it is very possible I still
didn't properly understand what you had in mind. I hope what I've done in this
version addresses the concerns you raised about inverted inheritance and such
anyway: if you'd like to compare the two, in the repository
at https://gitlab.com/philip1/guix-patches I've tagged this series as
`guix-issue-53878-v2` and the alternate as
`guix-issue-53878-v2-bootfiles-proc`. I'll also include the diff below.

Other than that, I hope I've addressed all your comments.

Toggle quote (99 lines)
> diff --git a/gnu/packages/chez-and-racket-bootstrap.scm b/gnu/packages/chez-and-racket-bootstrap.scm
> index 3e90a15d94..cbdddb1e98 100644
> --- a/gnu/packages/chez-and-racket-bootstrap.scm
> +++ b/gnu/packages/chez-and-racket-bootstrap.scm
> @@ -720,21 +720,18 @@ (define* (stex-make #:optional (suffix ""))
> and 32-bit PowerPC architectures.")
> (license license:asl2.0)))
>
> -(define (bootfiles-for-chez chez)
> - (package/inherit chez
> - (outputs '("out"))
> +(define-public chez-scheme-bootstrap-bootfiles
> + (package
> + (inherit chez-scheme)
> + (name "chez-scheme-bootstrap-bootfiles")
> (inputs '())
> (native-inputs '())
> + (outputs '("out"))
> (build-system copy-build-system)
> ;; TODO: cross compilation
> (arguments
> (list #:install-plan
> - #~`(("boot/" "lib/chez-scheme-bootfiles"))))))
> -
> -(define-public chez-scheme-bootstrap-bootfiles
> - (package
> - (inherit (bootfiles-for-chez chez-scheme))
> - (name "chez-scheme-bootstrap-bootfiles")
> + #~`(("boot/" "lib/chez-scheme-bootfiles"))))
> (supported-systems
> ;; Upstream only distributes pre-built bootfiles for
> ;; arm32le and t?(i3|a6)(le|nt|osx)
> @@ -822,28 +819,34 @@ (define-public chez-scheme-for-racket
> (license license:asl2.0)))
>
> (define-public chez-scheme-for-racket-bootstrap-bootfiles
> - (let ((chez (bootfiles-for-chez chez-scheme-for-racket)))
> - (package
> - (inherit (bootfiles-for-chez chez))
> - (name "chez-scheme-for-racket-bootstrap-bootfiles")
> - (native-inputs (list chez-nanopass-bootstrap racket-vm-bc))
> - (arguments
> - (substitute-keyword-arguments (package-arguments chez)
> - ((#:phases those-phases #~%standard-phases)
> - #~(modify-phases #$those-phases
> - (add-after 'unpack 'chdir
> - (lambda args
> - (chdir "racket/src/ChezScheme")))
> - (add-after 'chdir 'unpack-nanopass+stex
> - (lambda args
> - #$unpack-nanopass+stex))
> - (add-before 'install 'build
> - (lambda* (#:key native-inputs inputs #:allow-other-keys)
> - (invoke (search-input-file (or native-inputs inputs)
> - "/opt/racket-vm/bin/racket")
> - "rktboot/main.rkt")))))))
> - (synopsis "Chez Scheme bootfiles bootstrapped by Racket")
> - (description "Chez Scheme is a self-hosting compiler: building it
> + (package
> + (inherit chez-scheme-bootstrap-bootfiles)
> + (name "chez-scheme-for-racket-bootstrap-bootfiles")
> + (version (package-version chez-scheme-for-racket))
> + (source (package-source chez-scheme-for-racket))
> + (native-inputs (list chez-nanopass-bootstrap racket-vm-bc))
> + (arguments
> + (substitute-keyword-arguments
> + (package-arguments chez-scheme-bootstrap-bootfiles)
> + ((#:phases those-phases #~%standard-phases)
> + #~(modify-phases #$those-phases
> + (add-after 'unpack 'chdir
> + (lambda args
> + (chdir "racket/src/ChezScheme")))
> + (add-after 'chdir 'unpack-nanopass+stex
> + (lambda args
> + #$unpack-nanopass+stex))
> + (add-before 'install 'build
> + (lambda* (#:key native-inputs inputs #:allow-other-keys)
> + (invoke (search-input-file (or native-inputs inputs)
> + "/opt/racket-vm/bin/racket")
> + "rktboot/main.rkt")))))))
> + (home-page "https://github.com/racket/ChezScheme")
> + ;; ^ This is downstream of https://github.com/racket/racket,
> + ;; but it's designed to be a friendly landing place for people
> + ;; who want a ChezScheme-shaped repositroy.
> + (synopsis "Chez Scheme bootfiles bootstrapped by Racket")
> + (description "Chez Scheme is a self-hosting compiler: building it
> requires ``bootfiles'' containing the Scheme-implemented portions compiled for
> the current platform. (Chez can then cross-compile bootfiles for all other
> supported platforms.)
> @@ -857,7 +860,7 @@ (define-public chez-scheme-for-racket-bootstrap-bootfiles
>
> Note that the generated bootfiles are specific to Racket's fork of Chez
> Scheme, and @code{cs-bootstrap} does not currently support building upstream
> -Chez Scheme."))))
> +Chez Scheme.")))
>
> ;;
> ;; Chez's bootstrap dependencies:

-Philip

Philip McGrath (15):
gnu: chez-scheme: Move to (gnu packages chez-and-racket-bootstrap).
gnu: chez-scheme: Use "lib/chez-scheme" for search path.
gnu: chez-scheme: Use shared zlib and lz4.
gnu: chez-and-racket-bootstrap: Add utilities for Chez machine types.
gnu: chez-scheme: Use new package style.
gnu: Add stex.
gnu: Add chez-nanopass.
gnu: chez-scheme: Explicitly package bootstrap bootfiles.
gnu: Add racket-vm-cgc.
gnu: Add racket-vm-bc.
gnu: Add chez-scheme-for-racket.
gnu: Add racket-vm-cs.
gnu: chez-mit: Support chez-scheme-for-racket.
gnu: chez-and-racket-bootstrap: Add 'chez-scheme-for-system'.
gnu: racket: Update to 8.4.

gnu/local.mk | 5 +-
gnu/packages/chez-and-racket-bootstrap.scm | 1070 ++++++++++++
gnu/packages/chez.scm | 628 +++----
gnu/packages/emacs-xyz.scm | 4 +-
gnu/packages/loko.scm | 4 +-
.../racket-enable-scheme-backport.patch | 465 +++++
...acket-gui-tethered-launcher-backport.patch | 26 +
gnu/packages/racket.scm | 1553 +++++++++++------
8 files changed, 2813 insertions(+), 942 deletions(-)
create mode 100644 gnu/packages/chez-and-racket-bootstrap.scm
create mode 100644 gnu/packages/patches/racket-enable-scheme-backport.patch
create mode 100644 gnu/packages/patches/racket-gui-tethered-launcher-backport.patch

--
2.32.0
P
P
Philip McGrath wrote on 17 Feb 2022 21:50
[PATCH v2 01/15] gnu: chez-scheme: Move to (gnu packages chez-and-racket-bootstrap).
(address . 53878@debbugs.gnu.org)
20220217205048.967383-2-philip@philipmcgrath.com
* gnu/packages/chez.scm (nanopass, stex, chez-scheme): Move to ...
* gnu/packages/chez-and-racket-bootstrap.scm: ... this new file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
* gnu/packages/emacs-xyz.scm: Adjust imports accordingly.
* gnu/packages/loko.scm: Likewise.
* gnu/packages/racket.scm: Likewise.
---
gnu/local.mk | 1 +
gnu/packages/chez-and-racket-bootstrap.scm | 278 +++++++++++++++++++++
gnu/packages/chez.scm | 225 +----------------
gnu/packages/emacs-xyz.scm | 2 +-
gnu/packages/loko.scm | 2 +-
gnu/packages/racket.scm | 2 +-
6 files changed, 283 insertions(+), 227 deletions(-)
create mode 100644 gnu/packages/chez-and-racket-bootstrap.scm

Toggle diff (436 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 1252643dc0..fa3a89e7a8 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -144,6 +144,7 @@ GNU_SYSTEM_MODULES = \
%D%/packages/certs.scm \
%D%/packages/check.scm \
%D%/packages/chemistry.scm \
+ %D%/packages/chez-and-racket-bootstrap.scm \
%D%/packages/chez.scm \
%D%/packages/chicken.scm \
%D%/packages/chromium.scm \
diff --git a/gnu/packages/chez-and-racket-bootstrap.scm b/gnu/packages/chez-and-racket-bootstrap.scm
new file mode 100644
index 0000000000..f102b099fb
--- /dev/null
+++ b/gnu/packages/chez-and-racket-bootstrap.scm
@@ -0,0 +1,278 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2016 Federico Beffa <beffa@fbengineering.ch>
+;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2017, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2019 Brett Gilio <brettg@gnu.org>
+;;; Copyright © 2020 Brendan Tildesley <mail@brendan.scot>
+;;; Copyright © 2021, 2022 Philip McGrath <philip@philipmcgrath.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages chez-and-racket-bootstrap)
+ #:use-module (guix packages)
+ #:use-module (guix download)
+ #:use-module (guix git-download)
+ #:use-module (guix utils)
+ #:use-module (guix gexp)
+ #:use-module (ice-9 match)
+ #:use-module (srfi srfi-1)
+ #:use-module (guix build-system gnu)
+ #:use-module (gnu packages)
+ #:use-module (gnu packages compression)
+ #:use-module (gnu packages ghostscript)
+ #:use-module (gnu packages linux)
+ #:use-module (gnu packages ncurses)
+ #:use-module (gnu packages netpbm)
+ #:use-module (gnu packages tex)
+ #:use-module (gnu packages xorg)
+ #:use-module ((guix licenses)
+ #:prefix license:))
+
+;; Commentary:
+;;
+;; Alphabetically and chronologically, Chez comes before Racket.
+;;
+;; The bootstrapping paths for Chez Scheme and Racket are closely
+;; entwined. Racket CS (the default Racket implementation) is based on (a fork
+;; of) Chez Scheme. Racket's variant of Chez Scheme shares sources for
+;; nanopass and stex with upstream Chez Scheme.
+;;
+;; Racket's variant of Chez Scheme can be bootstrapped by an older Racket
+;; implementation, Racket BC, which can be bootstrapped from C. Porting that
+;; code to work with upstream Chez Scheme (or finding an old version that
+;; does) is our best hope for some day bootstrapping upstream Chez Scheme from
+;; source.
+;;
+;; Putting the relevant definitions together in this module avoids having to
+;; work around dependency cycles.
+;;
+;; Code:
+
+(define nanopass
+ (let ((version "1.9.2"))
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/nanopass/nanopass-framework-scheme")
+ (commit (string-append "v" version))))
+ (sha256 (base32 "16vjsik9rrzbabbhbxbaha51ppi3f9n8rk59pc6zdyffs0vziy4i"))
+ (file-name (git-file-name "nanopass" version)))))
+
+(define stex
+ ;; 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")
+ (version "1.2.2")
+ (version (git-version version "1" commit)))
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/dybvig/stex")
+ (commit commit)))
+ (sha256 (base32 "01jnvw8qw33gnpzwrakwhsr05h6b609lm180jnspcrb7lds2p23d"))
+ (file-name (git-file-name "stex" version)))))
+
+(define-public chez-scheme
+ (package
+ (name "chez-scheme")
+ (version "9.5.6")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/cisco/ChezScheme")
+ (commit (string-append "v" version))))
+ (sha256
+ (base32 "07s433hn1z2slfc026sidrpzxv3a8narcd40qqr1xrpb9012xdky"))
+ (file-name (git-file-name name version))
+ (snippet
+ ;; Remove bundled libraries.
+ (with-imported-modules '((guix build utils))
+ #~(begin
+ (use-modules (guix build utils))
+ (for-each (lambda (dir)
+ (when (directory-exists? dir)
+ (delete-file-recursively dir)))
+ '("stex"
+ "nanopass"
+ "lz4"
+ "zlib")))))))
+ (build-system gnu-build-system)
+ (inputs
+ `(("libuuid" ,util-linux "lib")
+ ("zlib" ,zlib)
+ ("zlib:static" ,zlib "static")
+ ("lz4" ,lz4)
+ ("lz4:static" ,lz4 "static")
+ ;; for expeditor:
+ ("ncurses" ,ncurses)
+ ;; for X11 clipboard support in expeditor:
+ ;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
+ ("libx11" ,libx11)))
+ (native-inputs
+ `(("nanopass" ,nanopass) ; source only
+ ;; for docs
+ ("stex" ,stex)
+ ("xorg-rgb" ,xorg-rgb)
+ ("texlive" ,(texlive-updmap.cfg (list texlive-dvips-l3backend
+ texlive-epsf
+ texlive-fonts-ec
+ texlive-oberdiek)))
+ ("ghostscript" ,ghostscript)
+ ("netpbm" ,netpbm)))
+ (native-search-paths
+ (list (search-path-specification
+ (variable "CHEZSCHEMELIBDIRS")
+ (files (list (string-append "lib/csv" version "-site"))))))
+ (outputs '("out" "doc"))
+ (arguments
+ `(#:modules
+ ((guix build gnu-build-system)
+ (guix build utils)
+ (ice-9 ftw)
+ (ice-9 match))
+ #:test-target "test"
+ #:configure-flags
+ '("--threads") ;; TODO when we fix armhf, it doesn't support --threads
+ #:phases
+ (modify-phases %standard-phases
+ ;; put these where configure expects them to be
+ (add-after 'unpack 'unpack-nanopass+stex
+ (lambda* (#:key native-inputs inputs #:allow-other-keys)
+ (for-each (lambda (dep)
+ (define src
+ (assoc-ref (or native-inputs inputs) dep))
+ (copy-recursively src dep
+ #:keep-mtime? #t))
+ '("nanopass" "stex"))))
+ ;; NOTE: the custom Chez 'configure' script doesn't allow
+ ;; unrecognized flags, such as those automatically added
+ ;; by `gnu-build-system`.
+ (replace 'configure
+ (lambda* (#:key inputs outputs
+ (configure-flags '())
+ #:allow-other-keys)
+ (let* ((zlib-static (assoc-ref inputs "zlib:static"))
+ (lz4-static (assoc-ref inputs "lz4:static"))
+ (out (assoc-ref outputs "out"))
+ ;; add flags which are always required:
+ (flags (cons*
+ (string-append "--installprefix=" out)
+ (string-append "ZLIB=" zlib-static "/lib/libz.a")
+ (string-append "LZ4=" lz4-static "/lib/liblz4.a")
+ ;; Guix will do compress man pages,
+ ;; and letting Chez try causes an error
+ "--nogzip-man-pages"
+ configure-flags)))
+ (format #t "configure flags: ~s~%" flags)
+ ;; Some makefiles (for tests) don't seem to propagate CC
+ ;; properly, so we take it out of their hands:
+ (setenv "CC" ,(cc-for-target))
+ (setenv "HOME" "/tmp")
+ (apply invoke
+ "./configure"
+ flags))))
+ ;; The binary file name is called "scheme" as is the one from MIT/GNU
+ ;; Scheme. We add a symlink to use in case both are installed.
+ (add-after 'install 'install-symlink
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (bin (string-append out "/bin"))
+ (lib (string-append out "/lib"))
+ (name "chez-scheme"))
+ (symlink (string-append bin "/scheme")
+ (string-append bin "/" name))
+ (map (lambda (file)
+ (symlink file (string-append (dirname file)
+ "/" name ".boot")))
+ (find-files lib "scheme.boot")))))
+ ;; Building explicitly lets us avoid using substitute*
+ ;; to re-write makefiles.
+ (add-after 'install-symlink 'prepare-stex
+ (lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
+ (let* ((stex+version
+ (strip-store-file-name
+ (assoc-ref (or native-inputs inputs) "stex")))
+ ;; Eventually we want to install stex as a real
+ ;; package so it's reusable. For now:
+ (stex-output "/tmp")
+ (doc-dir (string-append stex-output
+ "/share/doc/"
+ stex+version)))
+ (with-directory-excursion "stex"
+ (invoke "make"
+ "install"
+ (string-append "LIB="
+ stex-output
+ "/lib/"
+ stex+version)
+ (string-append "Scheme="
+ (assoc-ref outputs "out")
+ "/bin/scheme"))
+ (for-each (lambda (pth)
+ (install-file pth doc-dir))
+ '("ReadMe" ; includes the license
+ "doc/stex.html"
+ "doc/stex.css"
+ "doc/stex.pdf"))))))
+ ;; Building the documentation requires stex and a running scheme.
+ ;; FIXME: this is probably wrong for cross-compilation
+ (add-after 'prepare-stex 'install-doc
+ (lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
+ (let* ((chez+version (strip-store-file-name
+ (assoc-ref outputs "out")))
+ (stex+version
+ (strip-store-file-name
+ (assoc-ref (or native-inputs inputs) "stex")))
+ (scheme (string-append (assoc-ref outputs "out")
+ "/bin/scheme"))
+ ;; see note on stex-output in phase build-stex, above:
+ (stexlib (string-append "/tmp"
+ "/lib/"
+ stex+version))
+ (doc-dir (string-append (assoc-ref outputs "doc")
+ "/share/doc/"
+ chez+version)))
+ (define* (stex-make #:optional (suffix ""))
+ (invoke "make"
+ "install"
+ (string-append "Scheme=" scheme)
+ (string-append "STEXLIB=" stexlib)
+ (string-append "installdir=" doc-dir suffix)))
+ (with-directory-excursion "csug"
+ (stex-make "/csug"))
+ (with-directory-excursion "release_notes"
+ (stex-make "/release_notes"))
+ (with-directory-excursion doc-dir
+ (symlink "release_notes/release_notes.pdf"
+ "release_notes.pdf")
+ (symlink "csug/csug9_5.pdf"
+ "csug.pdf"))))))))
+ ;; Chez Scheme does not have a MIPS backend.
+ ;; FIXME: Debian backports patches to get armhf working.
+ ;; We should too. It is the Chez machine type arm32le
+ ;; (no threaded version upstream yet, though there is in
+ ;; Racket's fork), more specifically (per the release notes) ARMv6.
+ (supported-systems (fold delete %supported-systems
+ '("mips64el-linux" "armhf-linux")))
+ (home-page "https://cisco.github.io/ChezScheme/")
+ (synopsis "R6RS Scheme compiler and run-time")
+ (description
+ "Chez Scheme is a compiler and run-time system for the language of the
+Revised^6 Report on Scheme (R6RS), with numerous extensions. The compiler
+generates native code for each target processor, with support for x86, x86_64,
+and 32-bit PowerPC architectures.")
+ (license license:asl2.0)))
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 47904e7b4e..caf61a95f5 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -4,7 +4,6 @@
;;; Copyright © 2017, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2019 Brett Gilio <brettg@gnu.org>
;;; Copyright © 2020 Brendan Tildesley <mail@brendan.scot>
-;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -32,234 +31,12 @@ (define-module (gnu packages chez)
#:use-module (guix utils)
#:use-module (guix gexp)
#:use-module (guix build-system gnu)
- #:use-module (gnu packages compression)
- #:use-module (gnu packages ncurses)
+ #:use-module (gnu packages chez-and-racket-bootstrap)
#:use-module (gnu packages ghostscript)
- #:use-module (gnu packages linux)
- #:use-module (gnu packages netpbm)
#:use-module (gnu packages tex)
- #:use-module (gnu packages compression)
- #:use-module (gnu packages image)
- #:use-module (gnu packages xorg)
#:use-module (ice-9 match)
#:use-module (srfi srfi-1))
-(define nanopass
- (let ((version "1.9.2"))
- (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/nanopass/nanopass-framework-scheme")
- (commit (string-append "v" version))))
- (sha256 (base32 "16vjsik9rrzbabbhbxbaha51ppi3f9n8rk59pc6zdyffs0vziy4i"))
- (file-name (git-file-name "nanopass" version)))))
-
-(define stex
- ;; 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")
- (version "1.2.2")
- (version (git-version version "1" commit)))
- (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/dybvig/stex")
- (commit commit)))
- (sha256 (base32 "01jnvw8qw33gnpzwrakwhsr05h6b609lm180jnspcrb7lds2p23d"))
- (file-name (git-file-name "stex" version)))))
-
-(define-public chez-scheme
- (package
- (name "chez-scheme")
- (version "9.5.6")
- (source
- (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/cisco/ChezScheme")
- (commit (string-append "v" version))))
- (sha256
- (base32 "07s433hn1z2slfc026sidrpzxv3a8narcd40qqr1xrpb9012xdky"))
- (file-name (git-file-name name version))
- (snippet
- ;; Remove bundled libraries.
- (with-imported-modules '((guix build utils))
- #~(begin
- (use-modules (guix build utils))
- (for-each (lambda (dir)
- (when (directory-exists? dir)
- (delete-file-recursively dir)))
- '("stex"
- "nanopass"
- "lz4"
- "zlib")))))))
- (build-system gnu-build-system)
- (inputs
- `(("libuuid" ,util-linux "lib")
- ("zlib" ,zlib)
- ("zlib:static" ,zlib "static")
- ("lz4" ,lz4)
- ("lz4:static" ,lz4 "static")
- ;; for expeditor:
- ("ncurses" ,ncurses)
- ;; for X11 clipboard support in expeditor:
- ;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
- ("libx11" ,libx11)))
- (native-inputs
- `(("nanopass" ,nanopass) ; source only
- ;; for docs
- ("stex" ,stex)
- ("xorg-rgb" ,xorg-rgb)
- ("texlive" ,(texlive-updmap.cfg (list texlive-dvips-l3backend
- texlive-epsf
- texlive-fonts-ec
- texlive-oberdiek)))
- ("ghostscript" ,ghostscript)
- ("netpbm" ,netpbm)))
- (native-search-paths
- (list (search-path-specification
- (variable "CHEZSCHEMELIBDIRS")
- (files (list (string-append "lib/csv" version "-site"))))))
- (outputs '("out" "doc"))
- (arguments
- `(#:modules
- ((guix build gnu-build-system)
- (guix build utils)
- (ice-9 ftw)
- (ice-9 match))
- #:test-target "test"
- #:configure-flags
- '("--threads") ;; TODO when we fix armhf, it doesn't support --threads
- #:phases
- (modify-phases %standard-phases
- ;; put these where configure expects them to be
- (add-after 'unpack 'unpack-nanopass+stex
- (lambda* (#:key native-inputs inputs #:allow-other-keys)
- (for-each (lambda (dep)
- (define src
- (assoc-ref (or native-inputs inputs) dep))
- (copy-recursively src dep
- #:keep-mtime? #t))
- '("nanopass" "stex"))))
- ;; NOTE: the custom Chez 'configure' script doesn't allow
- ;; unrecognized flags, such as those automatically added
- ;; by `gnu-build-system`.
- (replace 'configure
- (lambda* (#:key inputs outputs
- (configure-flags '())
- #:allow-other-keys)
- (let* ((zlib-static (assoc-ref inputs "zlib:static"))
- (lz4-static (assoc-ref inputs "lz4:static"))
- (out (assoc-ref outputs "out"))
- ;; add flags which are always required:
- (flags (cons*
- (string-append "--installprefix=" out)
- (string-append "ZLIB=" zlib-static "/lib/lib
This message was truncated. Download the full message here.
P
P
Philip McGrath wrote on 17 Feb 2022 21:50
[PATCH v2 02/15] gnu: chez-scheme: Use "lib/chez-scheme" for search path.
(address . 53878@debbugs.gnu.org)
20220217205048.967383-3-philip@philipmcgrath.com
There does not seem to be any widely accepted standard path to use for
"CHEZSCHEMELIBDIRS". Using a path without a version number in it avoids
having to compute the actual path everywhere, which would be especially
unpleasant when support is added for the Racket variant of Chez Scheme,
which always has a different version number than upstream.

* gnu/packages/chez-and-racket-bootstrap.scm
(chez-scheme)[native-search-paths]: Change to use "lib/chez-scheme"
instead of "lib/csvX.Y.Z-site" for "CHEZSCHEMELIBDIRS".
* gnu/packages/chez.scm (chez-srfi, chez-web, chez-sockets,
chez-matchable, chez-irregex, chez-fmt, chez-mit, chez-scmutils): Update
accordingly. Also, remove input labels and use G-expressions.
---
gnu/packages/chez-and-racket-bootstrap.scm | 2 +-
gnu/packages/chez.scm | 373 +++++++++++----------
2 files changed, 191 insertions(+), 184 deletions(-)

Toggle diff (401 lines)
diff --git a/gnu/packages/chez-and-racket-bootstrap.scm b/gnu/packages/chez-and-racket-bootstrap.scm
index f102b099fb..1ed4631ced 100644
--- a/gnu/packages/chez-and-racket-bootstrap.scm
+++ b/gnu/packages/chez-and-racket-bootstrap.scm
@@ -136,7 +136,7 @@ (define-public chez-scheme
(native-search-paths
(list (search-path-specification
(variable "CHEZSCHEMELIBDIRS")
- (files (list (string-append "lib/csv" version "-site"))))))
+ (files (list (string-append "lib/chez-scheme"))))))
(outputs '("out" "doc"))
(arguments
`(#:modules
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index caf61a95f5..54bbee7923 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -37,6 +37,28 @@ (define-module (gnu packages chez)
#:use-module (ice-9 match)
#:use-module (srfi srfi-1))
+
+;; Help function for Chez Scheme to add the current path to
+;; CHEZSCHEMELIBDIRS.
+(define chez-configure
+ #~(lambda _
+ (let ((chez-env (getenv "CHEZSCHEMELIBDIRS")))
+ (setenv "CHEZSCHEMELIBDIRS"
+ (if chez-env
+ (string-append ".:" chez-env)
+ ".")))))
+
+;; Help function to define make flags for some Chez Scheme custom make
+;; files.
+(define (chez-make-flags name version)
+ #~(let ((out #$output))
+ (list
+ ;; Set 'schemedir' so that libraries are installed in
+ ;; 'lib/chez-scheme' like Chez's 'native-search-paths' expects.
+ (string-append "schemedir=" out "/lib/chez-scheme")
+ (string-append "PREFIX=" out)
+ (string-append "DOCDIR=" out "/share/doc/" #$name "-" #$version))))
+
(define-public chez-srfi
(package
(name "chez-srfi")
@@ -54,13 +76,11 @@ (define-public chez-srfi
(native-inputs
(list chez-scheme))
(arguments
- `(#:make-flags (let ((out (assoc-ref %outputs "out")))
- (list (string-append "PREFIX=" out)
- "CHEZ=chez-scheme --libdirs ./"
- (string-append "chezversion=" ,(package-version chez-scheme))))
- #:test-target "test"
- #:phases (modify-phases %standard-phases
- (delete 'configure))))
+ (list #:make-flags (chez-make-flags name version)
+ #:test-target "test"
+ #:phases #~(modify-phases %standard-phases
+ (replace 'configure
+ #$chez-configure))))
(home-page "https://github.com/fedeinthemix/chez-srfi")
(synopsis "SRFI libraries for Chez Scheme")
(description
@@ -85,42 +105,48 @@ (define-public chez-web
(base32 "1dq25qygyncbfq4kwwqqgyyakfqjwhp5q23vrf3bff1p66nyfl3b"))))
(build-system gnu-build-system)
(native-inputs
- `(("chez-scheme" ,chez-scheme)
- ("ghostscript" ,ghostscript)
- ("texlive" ,(texlive-updmap.cfg (list texlive-oberdiek
- texlive-epsf
- texlive-metapost
- texlive-charter
- texlive-pdftex
- texlive-context
- texlive-cm
- texlive-tex-plain)))))
+ (list chez-scheme
+ ghostscript
+ ;; FIXME: This package fails to build with the error:
+ ;; mktexpk: don't know how to create bitmap font for bchr8r
+ ;; Replacing the following with `texlive` fixes it.
+ ;; What is missing?
+ (texlive-updmap.cfg (list texlive-oberdiek
+ texlive-epsf
+ texlive-metapost
+ texlive-charter
+ texlive-pdftex
+ texlive-context
+ texlive-cm
+ texlive-tex-plain))))
(arguments
- `(#:make-flags (list (string-append "PREFIX=" %output)
- (string-append "DOCDIR=" %output "/share/doc/"
- ,name "-" ,version)
- (string-append "LIBDIR=" %output "/lib/chezweb")
- (string-append "TEXDIR=" %output "/share/texmf-local"))
- #:tests? #f ; no tests
- #:phases
- (modify-phases %standard-phases
- ;; This package has a custom "bootstrap" script that
- ;; is meant to be run from the Makefile.
- (delete 'bootstrap)
- (replace 'configure
- (lambda* _
- (copy-file "config.mk.template" "config.mk")
- (substitute* "tangleit"
- (("\\./cheztangle\\.ss" all)
- (string-append "chez-scheme --program " all)))
- (substitute* "weaveit"
- (("mpost chezweb\\.mp")
- "mpost --tex=tex chezweb.mp")
- (("\\./chezweave" all)
- (string-append "chez-scheme --program " all)))
- (substitute* "installit"
- (("-g \\$GROUP -o \\$OWNER") ""))
- #t)))))
+ (list
+ #:make-flags
+ #~(list (string-append "PREFIX=" #$output)
+ (string-append "DOCDIR=" #$output "/share/doc/"
+ #$name "-" #$version)
+ ;; lib/chez-scheme/chezweb ???
+ (string-append "LIBDIR=" #$output "/lib/chezweb")
+ (string-append "TEXDIR=" #$output "/share/texmf-local"))
+ #:tests? #f ; no tests
+ #:phases
+ #~(modify-phases %standard-phases
+ ;; This package has a custom "bootstrap" script that
+ ;; is meant to be run from the Makefile.
+ (delete 'bootstrap)
+ (replace 'configure
+ (lambda* _
+ (copy-file "config.mk.template" "config.mk")
+ (substitute* "tangleit"
+ (("\\./cheztangle\\.ss" all)
+ (string-append "scheme --program " all)))
+ (substitute* "weaveit"
+ (("mpost chezweb\\.mp")
+ "mpost --tex=tex chezweb.mp")
+ (("\\./chezweave" all)
+ (string-append "scheme --program " all)))
+ (substitute* "installit"
+ (("-g \\$GROUP -o \\$OWNER") "")))))))
(home-page "https://github.com/arcfide/ChezWEB")
(synopsis "Hygienic Literate Programming for Chez Scheme")
(description "ChezWEB is a system for doing Knuthian style WEB
@@ -144,95 +170,74 @@ (define-public chez-sockets
(base32 "1n5fbwwz51fdzvjackgmnsgh363g9inyxv7kmzi0469cwavwcx5m"))))
(build-system gnu-build-system)
(native-inputs
- `(("chez-scheme" ,chez-scheme)
- ("chez-web" ,chez-web)
- ("texlive" ,(texlive-updmap.cfg (list texlive-pdftex)))))
+ (list chez-scheme
+ chez-web
+ (texlive-updmap.cfg (list texlive-pdftex))))
(arguments
- `(#:tests? #f ; no tests
- #:phases
- (modify-phases %standard-phases
- (replace 'configure
- (lambda* (#:key outputs inputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (chez-web (assoc-ref inputs "chez-web"))
- (chez (assoc-ref inputs "chez-scheme"))
- (chez-h (dirname (car (find-files chez "scheme\\.h")))))
- (substitute* "Makefile"
- (("(SCHEMEH=).*$" all var)
- (string-append var chez-h)))
- #t)))
- (add-before 'build 'tangle
- (lambda* (#:key inputs #:allow-other-keys)
- (setenv "TEXINPUTS"
- (string-append
- (getcwd) ":"
- (assoc-ref inputs "chez-web") "/share/texmf-local/tex/generic:"
- ":"))
- ;; just using "make" tries to build the .c files before
- ;; they are created.
- (and (invoke "make" "sockets")
- (invoke "make"))))
- (replace 'build
- (lambda* (#:key outputs inputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (chez-site (string-append out "/lib/csv"
- ,(package-version chez-scheme)
- "-site/arcfide")))
- ;; make sure Chez Scheme can find the shared libraries.
- (substitute* "sockets.ss"
- (("(load-shared-object) \"(socket-ffi-values\\.[sd][oy].*)\""
- all cmd so)
- (string-append cmd " \"" chez-site "/" so "\""))
- (("sockets-stub\\.[sd][oy].*" all)
- (string-append chez-site "/" all)))
- ;; to compile chez-sockets, the .so files must be
- ;; installed (because of the absolute path we
- ;; inserted above).
- (for-each (lambda (f d) (install-file f d))
- '("socket-ffi-values.so" "sockets-stub.so")
- (list chez-site chez-site))
- (zero? (system "echo '(compile-file \"sockets.sls\")' | scheme -q")))))
- (replace 'install
- (lambda* (#:key outputs inputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (lib (string-append out "/lib/chez-sockets"))
- (doc (string-append out "/share/doc/" ,name "-" ,version))
- (chez-site (string-append out "/lib/csv"
- ,(package-version chez-scheme)
- "-site/arcfide")))
- (for-each (lambda (f d) (install-file f d))
- '("sockets.pdf" "sockets.so")
- (list doc chez-site))
- #t))))))
+ (list
+ #:tests? #f ; no tests
+ #:phases
+ #~(modify-phases %standard-phases
+ (replace 'configure
+ (lambda* (#:key native-inputs inputs #:allow-other-keys)
+ (let* ((scheme (search-input-file (or native-inputs inputs)
+ "/bin/scheme"))
+ (lib (string-append (dirname scheme) "/../lib"))
+ (header-file (car (find-files lib "scheme\\.h")))
+ (include-dir (dirname header-file)))
+ (substitute* "Makefile"
+ (("(SCHEMEH=).*$" _ var)
+ (string-append var include-dir))))))
+ (add-before 'build 'tangle
+ (lambda* (#:key inputs #:allow-other-keys)
+ (setenv "TEXINPUTS"
+ (string-append
+ (getcwd) ":"
+ (assoc-ref inputs "chez-web")
+ "/share/texmf-local/tex/generic:"
+ ":"))
+ ;; just using "make" tries to build the .c files before
+ ;; they are created.
+ (and (invoke "make" "sockets")
+ (invoke "make"))))
+ (replace 'build
+ (lambda args
+ (let ((chez-site (string-append #$output
+ "/lib/chez-scheme/arcfide")))
+ ;; make sure Chez Scheme can find the shared libraries.
+ (substitute* "sockets.ss"
+ (("(object \")(socket-ffi-values\\.[sd][oy][^\"]*)(\")"
+ _ pre file post)
+ (string-append pre chez-site "/" file post))
+ (("(\")(sockets-stub\\.[sd][oy][^\"]*)(\")"
+ _ pre file post)
+ (string-append pre chez-site "/" file post)))
+ ;; to compile chez-sockets, the .so files must be
+ ;; installed (because of the absolute path we
+ ;; inserted above).
+ (for-each (lambda (f)
+ (install-file f chez-site))
+ '("socket-ffi-values.so"
+ "sockets-stub.so"))
+ (invoke "bash"
+ "-c"
+ (format #f "echo '~s' | scheme -q"
+ '(compile-file "sockets.sls"))))))
+ (replace 'install
+ (lambda args
+ (install-file "sockets.so"
+ (string-append #$output
+ "/lib/chez-scheme/arcfide"))
+ (install-file "sockets.pdf"
+ (string-append #$output
+ "/share/doc/"
+ #$name "-" #$version)))))))
(home-page "https://github.com/arcfide/chez-sockets")
(synopsis "Extensible sockets library for Chez Scheme")
(description "Chez-sockets is an extensible sockets library for
Chez Scheme.")
(license expat))))
-;; Help function for Chez Scheme to add the current path to
-;; CHEZSCHEMELIBDIRS.
-(define chez-configure
- '(lambda _
- (let ((chez-env (getenv "CHEZSCHEMELIBDIRS")))
- (setenv "CHEZSCHEMELIBDIRS"
- (if chez-env
- (string-append ".:" chez-env)
- "."))
- #t)))
-
-;; Help function to define make flags for some Chez Scheme custom make
-;; files.
-(define (chez-make-flags name version)
- `(let ((out (assoc-ref %outputs "out")))
- (list
- ;; Set 'chezversion' so that libraries are installed in
- ;; 'lib/csvX.Y.Z-site' like Chez's 'native-search-paths' expects.
- (string-append "chezversion=" ,(package-version chez-scheme))
- (string-append "PREFIX=" out)
- (string-append "DOCDIR=" out "/share/doc/"
- ,name "-" ,version))))
-
(define-public chez-matchable
(package
(name "chez-matchable")
@@ -253,10 +258,11 @@ (define-public chez-matchable
(native-inputs
(list chez-scheme))
(arguments
- `(#:make-flags ,(chez-make-flags name version)
- #:test-target "test"
- #:phases (modify-phases %standard-phases
- (replace 'configure ,chez-configure))))
+ (list #:make-flags (chez-make-flags name version)
+ #:test-target "test"
+ #:phases #~(modify-phases %standard-phases
+ (replace 'configure
+ #$chez-configure))))
(synopsis "Portable hygienic pattern matcher for Scheme")
(description "This package provides a superset of the popular Scheme
@code{match} package by Andrew Wright, written in fully portable
@@ -284,10 +290,11 @@ (define-public chez-irregex
(native-inputs
(list chez-scheme))
(arguments
- `(#:make-flags ,(chez-make-flags name version)
- #:test-target "test"
- #:phases (modify-phases %standard-phases
- (replace 'configure ,chez-configure))))
+ (list #:make-flags (chez-make-flags name version)
+ #:test-target "test"
+ #:phases #~(modify-phases %standard-phases
+ (replace 'configure
+ #$chez-configure))))
(home-page "https://github.com/fedeinthemix/chez-irregex")
(synopsis "Portable regular expression library for Scheme")
(description "This package provides a portable and efficient
@@ -314,17 +321,18 @@ (define-public chez-fmt
(native-inputs
(list chez-scheme))
(arguments
- `(#:make-flags ,(chez-make-flags name version)
- #:test-target "chez-check"
- #:phases
- (modify-phases %standard-phases
- (replace 'configure ,chez-configure)
- (replace 'build
- (lambda* (#:key (make-flags '()) #:allow-other-keys)
- (apply invoke "make" "chez-build" make-flags)))
- (replace 'install
- (lambda* (#:key (make-flags '()) #:allow-other-keys)
- (apply invoke "make" "chez-install" make-flags))))))
+ (list #:make-flags (chez-make-flags name version)
+ #:test-target "chez-check"
+ #:phases
+ #~(modify-phases %standard-phases
+ (replace 'configure
+ #$chez-configure)
+ (replace 'build
+ (lambda* (#:key (make-flags '()) #:allow-other-keys)
+ (apply invoke "make" "chez-build" make-flags)))
+ (replace 'install
+ (lambda* (#:key (make-flags '()) #:allow-other-keys)
+ (apply invoke "make" "chez-install" make-flags))))))
(home-page "http://synthcode.com/scheme/fmt")
(synopsis "Combinator formatting library for Chez Scheme")
(description "This package provides a library of procedures for
@@ -354,10 +362,11 @@ (define-public chez-mit
(native-inputs
(list chez-scheme))
(arguments
- `(#:make-flags ,(chez-make-flags name version)
- #:test-target "test"
- #:phases (modify-phases %standard-phases
- (replace 'configure ,chez-configure))))
+ (list #:make-flags (chez-make-flags name version)
+ #:test-target "test"
+ #:phases #~(modify-phases %standard-phases
+ (replace 'configure
+ #$chez-configure))))
(synopsis "MIT/GNU Scheme compatibility library for Chez Scheme")
(description "This package provides a set of MIT/GNU Scheme compatibility
libraries for Chez Scheme. The main goal was to provide the functionality
@@ -386,46 +395,44 @@ (define-public chez-scmutils
(propagated-inputs
(list chez-mit chez-srfi))
(arguments
- `(#:make-flags ,(chez-make-flags name version)
- #:tests? #f ; no test suite
- #:phases
- (modify-phases %standard-phases
- (replace 'configure ,chez-configure)
- ;; Since the documentation is lacking, we install the source
- ;; code. For things to work correctly we have to replace
- ;; relative paths by absolute ones in 'include' forms. This
- ;; in turn requires us to compile the files in the final
- ;; destination.
- (delete 'build)
- (add-after 'install 'install-src
- (lambda* (#:key (make-flags '())
This message was truncated. Download the full message here.
P
P