Package: guix-patches;
Reported by: Philip McGrath <philip <at> philipmcgrath.com>
Date: Mon, 8 Aug 2022 06:07:02 UTC
Severity: normal
Tags: patch
Done: Ludovic Courtès <ludo <at> gnu.org>
Bug is archived. No further changes may be made.
Message #281 received at 57050 <at> debbugs.gnu.org (full text, mbox):
From: Efraim Flashner <efraim <at> flashner.co.il> To: Liliana Marie Prikler <liliana.prikler <at> gmail.com> Cc: Philip McGrath <philip <at> philipmcgrath.com>, Thiago Jung Bauermann <bauermann <at> kolabnow.com>, "\(" <paren <at> disroot.org>, Maxime Devos <maximedevos <at> telenet.be>, Liliana Marie Prikler <liliana.prikler <at> ist.tugraz.at>, 57050 <at> debbugs.gnu.org Subject: Re: [PATCH v3 12/14] gnu: chez-scheme-for-racket: Suport all systems. Date: Thu, 25 Aug 2022 13:50:05 +0300
[Message part 1 (text/plain, inline)]
On Thu, Aug 25, 2022 at 11:24:31AM +0200, Liliana Marie Prikler wrote: > Should be "Support all systems". > > Am Donnerstag, dem 25.08.2022 um 04:54 -0400 schrieb Philip McGrath: > > On systems for which Racket's variant of Chez Scheme cannot generate > > native code, it can use a 'pbarch' machine type: a variant of the > > ``portable bytecode'' backend specialized to word size and endianness. > > This allows Racket CS to replace Racket BC on those systems while > > maintaining comparable performance. (Racket BC lacks JIT support for > > those systems anyway.) It also lets us provide a Chez Scheme package on > > all systems Guix supports. > > > > This patch adds 'pbarch' support to both 'chez-scheme-for-racket' and > > 'racket-vm-cs', but it does not change the Racket VM implementation > > used > > for the 'racket' and 'racket-minimal' packages. > > > > * gnu/packages/chez.scm (nix-system->pbarch-machine-type): New > > variable. > > (chez-scheme-for-racket)[inputs]: Use 'libffi' for non-native systems. > > [arguments]<#:configure-flags>: Always supply '-m='. Add applicable > > flags for non-native systems. > > [supported-systems]: Use '%supported-systems'. > > [description]: Update. > > (chez-scheme-for-racket-bootstrap-bootfiles)[arguments]<#:phases>: > > Adapt > > 'build' phase for non-native systems. > > * gnu/packages/racket.scm (racket-vm-bc)[description]: Update. > > (racket-vm-cs)[description]: Likewise. > > [inputs]: Use 'libffi' for non-native systems. > > [arguments]<#:configure-flags>: Add applicable flags for non-native > > systems. > > --- > > gnu/packages/chez.scm | 76 ++++++++++++++++++++++++++++++----------- > > gnu/packages/racket.scm | 26 +++++++++----- > > 2 files changed, 74 insertions(+), 28 deletions(-) > > > > diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm > > index 26f653ea9d..5d152b3db5 100644 > > --- a/gnu/packages/chez.scm > > +++ b/gnu/packages/chez.scm > > @@ -37,6 +37,7 @@ (define-module (gnu packages chez) > > #:use-module (gnu packages compression) > > #:use-module (gnu packages ncurses) > > #:use-module (gnu packages ghostscript) > > + #:use-module (gnu packages libffi) > > #:use-module (gnu packages linux) > > #:use-module (gnu packages netpbm) > > #:use-module (gnu packages racket) > > @@ -49,6 +50,7 @@ (define-module (gnu packages chez) > > #:use-module (srfi srfi-26) > > #:export (chez-scheme-for-system > > racket-cs-native-supported-system? > > + nix-system->pbarch-machine-type > > unpack-nanopass+stex)) > > > > ;; Commentary: > > @@ -231,6 +233,28 @@ (define* (chez-upstream-features-for-system > > #:optional > > (and=> (assoc-ref %chez-features-table chez-os) > > (cut assoc-ref <> chez-arch)))) > > > > +(define* (nix-system->pbarch-machine-type #:optional > > + (system > > + (or (%current-target- > > system) > > + (%current-system))) > > + #:key (threads? #t)) > > + "Return a string naming the pseudo–machine type used by Racket's > > variant of > > +Chez Scheme to represent the appropriate ``pbarch'' backend for > > SYSTEM: that > > +is, the ``portable bytecode'' backend specialized for SYSTEM's word > > size and > > +endianness. The result will name the threaded machine type unless > > THREADS? is > > +provided and is #f." > > + (string-append (if threads? > > + "t" > > + "") > > + "pb" > > + (if (target-64bit? system) > > + "64" > > + "32") > > + ;; missing (guix utils) predicate target-little- > > endian? > > + (if (target-ppc32? system) > > + "b" > > + "l"))) > > + > Don't we already have a function that does something similar? Can't we > add a #:portable-bytecode? keyword to that one? I'm not aware of a function that checks for endianness. The only other place I know of is (guix build-system meson), but there the logic is hand-written. > > (define* (racket-cs-native-supported-system? #:optional > > (system > > (or (%current-target- > > system) > > @@ -449,10 +473,14 @@ (define-public chez-scheme-for-racket > > ;; When updating, remember to also update %racket-version in > > racket.scm. > > (source #f) ; avoid problematic cycle with racket.scm > > (inputs > > - (modify-inputs (package-inputs chez-scheme) > > - (delete "libx11" "util-linux:lib") > > - (replace "chez-scheme-bootstrap-bootfiles" > > - chez-scheme-for-racket-bootstrap-bootfiles))) > > + (let ((inputs (modify-inputs (package-inputs chez-scheme) > > + (replace "chez-scheme-bootstrap-bootfiles" > > + chez-scheme-for-racket-bootstrap-bootfiles) > > + (delete "libx11" "util-linux:lib")))) > > + (if (racket-cs-native-supported-system?) > > + inputs > > + (modify-inputs inputs > > + (prepend libffi))))) > > (native-inputs > > (let ((native-inputs (modify-inputs (package-native-inputs chez- > > scheme) > > (prepend zuo)))) > > @@ -473,10 +501,16 @@ (define-public chez-scheme-for-racket > > ((#:configure-flags cfg-flags #~'()) > > #~`("--disable-x11" > > "--threads" ;; ok to potentially duplicate > > - #$@(if (%current-target-system) > > - (list (string-append "-m=" > > - (racket-cs-native-supported- > > system?))) > > - '()) > > + #$(string-append "-m=" (or (racket-cs-native-supported- > > system?) > > + (nix-system->pbarch-machine- > > type))) > > + ;; ^ could skip -m= for non-cross non-pbarch builds > > + #$@(if (racket-cs-native-supported-system?) > > + #~() > > + ;; not inferred on non-native platforms: see > > + ;; https://racket.discourse.group/t/950/9 > > + #~("--enable-libffi" > > + "CFLAGS=-g -O2 -D_REENTRANT -pthread" > > + "LIBS=-lm -ldl -lrt -lffi -lncurses")) > > #$@(if (%current-target-system) > > (list (string-append "--toolprefix=" > > (%current-target-system) > > @@ -543,10 +577,7 @@ (define-public chez-scheme-for-racket > > (add-after 'unpack 'chdir > > (lambda args > > (chdir "racket/src/ChezScheme")))))))) > > - ;; TODO: How to build pbarch/pbchunks for other systems? > > - ;; See https://racket.discourse.group/t/950 > > - (supported-systems (filter racket-cs-native-supported-system? > > - %supported-systems)) > > + (supported-systems %supported-systems) > I don't think this needs to be specified, does it? > > See the definition in guix/packages.scm: > (supported-systems package-supported-systems ; list of strings > (default %supported-systems)) Unless this package inherits from somewhere else then by default supported-systems is all systems. (Regardless if all dependencies are supported. To see more look at the difference between (package-supported-systems "pandoc") and (package-transitive-supported-systems "pandoc")) -- Efraim Flashner <efraim <at> flashner.co.il> אפרים פלשנר GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted
[signature.asc (application/pgp-signature, inline)]
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.