guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#55248] [PATCH v2 8/9] gnu: chez-scheme-for-racket: Fix supported sy


From: Philip McGrath
Subject: [bug#55248] [PATCH v2 8/9] gnu: chez-scheme-for-racket: Fix supported systems.
Date: Sun, 8 May 2022 16:07:51 -0400

This commit fixes the treatment of systems like "powerpc-w64-mingw32",
where the combination of architecture and kernel is not supported, even
though both are supported in other combinations. The build failure fixed
in b8fc9169515ef1a6d6037c84e30ad308e5418b6f highlighted this problem:
see also <https://issues.guix.gnu.org/54292#6>. The correct support
status is specified by '%chez-features-table', which was added to
improve 'chez-upstream-features-for-system': this commit uses it to fix
the repair.

Once the issues in <https://racket.discourse.group/t/950> are resolved,
'chez-scheme-for-racket' and 'racket-vm-cs' will be able to run even on
systems for which native code generation is not supported. It's not
clear what behavior would be useful from 'nix-system->chez-machine':
since the current implementation is flawed and easy to misuse, we remove
it for now, replacing the remaining uses with
'racket-cs-native-supported-system?'.

* gnu/packages/chez.scm (nix-system->chez-machine): Remove it.
(racket-cs-native-supported-system?): New variable.
(chez-scheme-for-racket)[supported-systems]: Use it.
* gnu/packages/racket.scm (racket-vm-for-system): Likewise.
---
 gnu/packages/chez.scm   | 32 +++++++++++++++++---------------
 gnu/packages/racket.scm |  7 +++++--
 2 files changed, 22 insertions(+), 17 deletions(-)

diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 41f083e0ac..cae17580f8 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -48,7 +48,7 @@ (define-module (gnu packages chez)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26)
   #:export (chez-scheme-for-system
-            nix-system->chez-machine
+            racket-cs-native-supported-system?
             unpack-nanopass+stex))
 
 ;; Commentary:
@@ -132,19 +132,6 @@ (define* (target-chez-os #:optional (system (or 
(%current-target-system)
    (else
     #f)))
 
-(define* (nix-system->chez-machine #:optional
-                                   (system (or (%current-target-system)
-                                               (%current-system))))
-  "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.
-
-It is unspecified whether the resulting string will name a threaded or a
-nonthreaded machine type."
-  (let* ((chez-arch (target-chez-arch system))
-         (chez-os (target-chez-os system)))
-    (and chez-arch chez-os (string-append chez-arch chez-os))))
-
 (define %chez-features-table
   ;; An alist of alists mapping:
   ;;   os -> arch -> (or/c #f (listof symbol?))
@@ -233,6 +220,19 @@ (define* (chez-upstream-features-for-system #:optional
     (and=> (assoc-ref %chez-features-table chez-os)
            (cut assoc-ref <> chez-arch))))
 
+(define* (racket-cs-native-supported-system? #:optional
+                                             (system
+                                              (or (%current-target-system)
+                                                  (%current-system))))
+  "Can Racket's variant of Chez Scheme generate native code for SYSTEM?
+Otherwise, SYSTEM can use only the ``portable bytecode'' backends."
+  (let ((chez-arch (target-chez-arch system))
+        (chez-os (target-chez-os system)))
+    (and (and=> (assoc-ref %chez-features-table chez-os)
+                ;; NOT assoc-ref: supported even if cdr is #f
+                (cut assoc chez-arch <>))
+         #t)))
+
 ;;
 ;; Chez Scheme:
 ;;
@@ -459,7 +459,9 @@ (define-public chez-scheme-for-racket
               (add-after 'unpack 'chdir
                 (lambda args
                   (chdir "racket/src/ChezScheme"))))))))
-    (supported-systems (filter nix-system->chez-machine
+    ;; 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))
     (home-page "https://github.com/racket/ChezScheme";)
     ;; ^ This is downstream of https://github.com/racket/racket,
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index 904dfe9bef..1f020f1276 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -190,8 +190,11 @@ (define-module (gnu packages racket)
 (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)
+  "Return 'racket-vm-cs' if we are able to build it for SYSTEM; 'racket-vm-bc'
+otherwise."
+  ;; Once we figure out the issues in https://racket.discourse.group/t/950,
+  ;; we can use 'racket-vm-cs' everywhere.
+  (if (racket-cs-native-supported-system? system)
       racket-vm-cs
       racket-vm-bc))
 
-- 
2.32.0






reply via email to

[Prev in Thread] Current Thread [Next in Thread]