From patchwork Mon May 9 06:02:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip McGrath X-Patchwork-Id: 39180 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 7361E27BBEA; Mon, 9 May 2022 07:07:39 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 3927627BBE9 for ; Mon, 9 May 2022 07:07:38 +0100 (BST) Received: from localhost ([::1]:43740 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nnwYT-0002RG-9b for patchwork@mira.cbaines.net; Mon, 09 May 2022 02:07:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44994) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnwVz-0001h6-HU for guix-patches@gnu.org; Mon, 09 May 2022 02:05:07 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:33594) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnwVz-0004o0-2Z for guix-patches@gnu.org; Mon, 09 May 2022 02:05:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nnwVy-0000xE-UW for guix-patches@gnu.org; Mon, 09 May 2022 02:05:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55248] [PATCH v3 8/9] gnu: chez-scheme-for-racket: Fix supported systems. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 09 May 2022 06:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55248 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55248@debbugs.gnu.org Cc: Liliana Marie Prikler , Maxime Devos , Philip McGrath , Liliana Marie Prikler Received: via spool by 55248-submit@debbugs.gnu.org id=B55248.16520762483557 (code B ref 55248); Mon, 09 May 2022 06:05:02 +0000 Received: (at 55248) by debbugs.gnu.org; 9 May 2022 06:04:08 +0000 Received: from localhost ([127.0.0.1]:55715 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nnwV5-0000vC-Nc for submit@debbugs.gnu.org; Mon, 09 May 2022 02:04:08 -0400 Received: from mail-vs1-f43.google.com ([209.85.217.43]:37437) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nnwUy-0000sP-L6 for 55248@debbugs.gnu.org; Mon, 09 May 2022 02:04:01 -0400 Received: by mail-vs1-f43.google.com with SMTP id t85so12826513vst.4 for <55248@debbugs.gnu.org>; Sun, 08 May 2022 23:04:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=philipmcgrath.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uOuOd+Ed4WqIDgrkI6KRUDCnHW8O63JUGYZZc826TOU=; b=fj8tFi4uUoyeC9vGbuI5g5sFZ+foExG5mMds8okV8D3YIQR82J1sI1KQ0efKpv1xnT W1P621ebG4zQK/HuTZpMXmlN/e3oegLdbNRs0zUW0y7pY2NKS4OVt4Lb7pvNaLlTB1P7 BMgW8E+dJu1v4GgvEnRnKnwhVd3Wq1jGwXWxnYpeVnX7ARgljctj4QtMn49Ek9GoE3LB /3ZHK0gfAH53ZzG6kv6+WQC0z9m5StwZQVRnOAGPeK5YBx5r1SwDoxkhW+YYgiqwbeeN gzUd/lJk1269fz3XXToN0SzKML00gJwWhWL1OjC9iVR+XKbaOaofkOTZWH4VTCx65NYc maqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uOuOd+Ed4WqIDgrkI6KRUDCnHW8O63JUGYZZc826TOU=; b=4I1tijDRw1z6H+hhec5US3iROwx2vd+AIYmYegWX9iDZYN0mt4tUIhhJroVtshcoUi fo7kNpilnfxDZDGHgvWhYRgqT8Sb8SyD8Q1RHyEy+daMzNPrf0KAXySKqwLeMRzM1/mP E/duw9tM/8qFND+Ay9ZkFMwvJgayADzQ0gyNtJE2BQSeH7J+g+/8+Ho3QYHmhWwDB3GJ boWVMnDrX6kGpKInMmDGM8TAdGZHTX7Gf9zHWKNRfHHkV/9YOVclKAjcsLI6u4JQSbPE V7jSvStsXXKNLC6FRseF5+gmXWQrRLwnKfgH79f3MTW+5Ozmoe6i6Yedwvq7TaEZoSck egRg== X-Gm-Message-State: AOAM530ODFI6d/2nU/R+ukzenld26AkZDbwk2c/u9mY2M0hYvYXTGWFH bXAOdRGqKJaV0W/2ep8qULEfYcxeWKrfHDY7 X-Google-Smtp-Source: ABdhPJx8JEBE55d0vkzxR88SHUEg0hblWsHY+mivAGQbeUhmTiJeSztchNk9kHVcy+aCXwVqvVrqsQ== X-Received: by 2002:a67:ee90:0:b0:32a:6b7f:777c with SMTP id n16-20020a67ee90000000b0032a6b7f777cmr7149351vsp.83.1652076240268; Sun, 08 May 2022 23:04:00 -0700 (PDT) Received: from localhost (c-73-125-98-51.hsd1.fl.comcast.net. [73.125.98.51]) by smtp.gmail.com with UTF8SMTPSA id o8-20020ab06048000000b003605c1e61dfsm1891481ual.0.2022.05.08.23.03.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 08 May 2022 23:04:00 -0700 (PDT) From: Philip McGrath Date: Mon, 9 May 2022 02:02:49 -0400 Message-Id: <1328772b3ccb2d3909f8bca6fe14659e04434e3e.1652075689.git.philip@philipmcgrath.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches 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 . 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 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 8438945ba0..f010cf3aa4 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))