gnu: chez-scheme-for-racket: Support all systems.

On systems for which Racket's variant of Chez Scheme cannot generate
native code, it can use a 'pbarch' machine type: a variant of the
``portable bytecode'' backend specialized to word size and endianness.
This allows Racket CS to replace Racket BC on those systems while
maintaining comparable performance. (Racket BC lacks JIT support for
those systems anyway.) It also lets us provide a Chez Scheme package on
all systems Guix supports.

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

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

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Philip McGrath 2022-08-27 14:55:52 -04:00 committed by Ludovic Courtès
parent cb0d106590
commit a15d72f8e1
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 74 additions and 28 deletions

View file

@ -311,7 +311,7 @@ One of the early layers implements macros.")
(version %racket-version)
(source %racket-origin)
(inputs (list ncurses ;; <- common to all variants (for #%terminal)
libffi)) ;; <- only for BC variants
libffi)) ;; <- for BC and non-native CS variants
(native-inputs (cons* zuo ;; <- for all variants
libtool ;; <- only for BC variants
(if (%current-target-system)
@ -417,10 +417,8 @@ code to use the 3M garbage collector.")
(description "The Racket BC (``before Chez'' or ``bytecode'')
implementation was the default before Racket 8.0. It uses a compiler written
in C targeting architecture-independent bytecode, plus a JIT compiler on most
platforms. Racket BC has a different C API and supports a slightly different
set of architectures than the current default runtime system, Racket CS (based
on ``Chez Scheme''). It is the recommended implementation for architectures
that Racket CS doesn't support.
platforms. Racket BC has a different C API than the current default runtime
system, Racket CS (based on ``Chez Scheme'').
This package is the normal implementation of Racket BC with a precise garbage
collector, 3M (``Moving Memory Manager'').")
@ -433,9 +431,12 @@ collector, 3M (``Moving Memory Manager'').")
(inherit racket-vm-bc)
(name "racket-vm-cs")
(inputs
(modify-inputs (package-inputs racket-vm-cgc)
(prepend zlib lz4)
(delete "libffi")))
(let ((inputs (modify-inputs (package-inputs racket-vm-cgc)
(prepend zlib lz4))))
(if (racket-cs-native-supported-system?)
(modify-inputs inputs
(delete "libffi"))
inputs)))
(native-inputs
(let ((native-inputs (package-native-inputs racket-vm-cgc)))
(modify-inputs (if (%current-target-system)
@ -464,12 +465,19 @@ collector, 3M (``Moving Memory Manager'').")
#+(this-package-native-input
"chez-scheme-for-racket")
"/bin/scheme")
#$@(if (racket-cs-native-supported-system?)
#~()
#~(#$(string-append "--enable-mach="
(nix-system->pbarch-machine-type))
"--enable-pb"))
#$racket-vm-common-configure-flags))))
(synopsis "Racket CS implementation")
(description "The Racket CS implementation, which uses ``Chez Scheme'' as
its core compiler and runtime system, has been the default Racket VM
implementation since Racket 8.0. It performs better than the Racket BC
implementation for most programs.
implementation for most programs. On systems for which Racket CS cannot
generate machine code, this package uses a variant of its ``portable
bytecode'' backend specialized for word size and endianness.
Using the Racket VM packages directly is not recommended: instead, install the
@code{racket-minimal} or @code{racket} packages.")