From patchwork Sat Feb 4 01:14:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Philip McGrath X-Patchwork-Id: 46663 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 86C6227BBEB; Sat, 4 Feb 2023 01:15:11 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,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 6E1F727BBE9 for ; Sat, 4 Feb 2023 01:15:09 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pO78z-00065e-6m; Fri, 03 Feb 2023 20:15:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pO78w-00065R-TE for guix-patches@gnu.org; Fri, 03 Feb 2023 20:15:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pO78w-0005Yy-IU for guix-patches@gnu.org; Fri, 03 Feb 2023 20:15:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pO78w-0003bU-A3; Fri, 03 Feb 2023 20:15:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#61259] [PATCH] utils: Add target-little-endian?. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: philip@philipmcgrath.com, guix-patches@gnu.org Resent-Date: Sat, 04 Feb 2023 01:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 61259 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 61259@debbugs.gnu.org Cc: Philip McGrath X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: Philip McGrath Received: via spool by submit@debbugs.gnu.org id=B.167547327013791 (code B ref -1); Sat, 04 Feb 2023 01:15:02 +0000 Received: (at submit) by debbugs.gnu.org; 4 Feb 2023 01:14:30 +0000 Received: from localhost ([127.0.0.1]:40242 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pO78P-0003aM-HZ for submit@debbugs.gnu.org; Fri, 03 Feb 2023 20:14:30 -0500 Received: from lists.gnu.org ([209.51.188.17]:46064) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pO78M-0003aA-5Q for submit@debbugs.gnu.org; Fri, 03 Feb 2023 20:14:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pO78L-0005qd-NU for guix-patches@gnu.org; Fri, 03 Feb 2023 20:14:25 -0500 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pO78H-0005S2-2x for guix-patches@gnu.org; Fri, 03 Feb 2023 20:14:25 -0500 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id D8C253200488 for ; Fri, 3 Feb 2023 20:14:16 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Fri, 03 Feb 2023 20:14:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= philipmcgrath.com; h=cc:content-transfer-encoding:content-type :date:date:from:from:in-reply-to:message-id:mime-version :reply-to:sender:subject:subject:to:to; s=fm3; t=1675473256; x= 1675559656; bh=7+5o7PjZxcAcm2w9cihP+AywsEeXt9VX/Feq3cBqRuY=; b=R vpzLajSdcMpSBZswzNPwj9umCB8lZhzg3rSzJ3EchZqfky+ZzJoeUJ//JCx+eE76 1/X1E2p762VeSPl0FS60s6K8vTZl3XOdP83WVrVtzEOh5Y0aVxMJrEpqgt/uGkoo 7oMWNY2ntIhS9pa030ITpd5aFZhEe08mR4cSYP7gcpfjgA4Ab6mED4vSVIfEsiSA 93E8XGS4kBhCoqfCMSw+xftEy8QW899vLuHmhzpzCOe45+PiK2EbSBlHzh6RdCtv zzunXHLoq3lCt6p60bhK45FdqoOfZwPwn/QnYjcM+5PqzlHTOF6U75Suqb6J9sjy 6rXXFkShsiYaB3qNXxGaw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :message-id:mime-version:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1675473256; x=1675559656; bh=7+5o7PjZxcAcm2w9cihP+AywsEeX t9VX/Feq3cBqRuY=; b=Z4taD4oyuUNI2g9O9JYyB+nujCA9dz12ImNstuGyYF5b Dw3iCqWr5YeGBXNwMR05sr1Us9YopjAt7Co0J8SRsCNWJAhj9/RsAyUbgqxw72SW Npn/MKlbtrQzeMqd7W3ODccyuczQ7BkYs1g1jJItig1eIN3g2udYCgfPz5/sawbp ZwEgoOIArZ2zNT0RBhC/To99dwQiByJ0MyGhUBpuj2j4iUH9ghgWT7UclXah2ZhJ 6km726uzcvp4wXlOAbdkqQB2NkWwIkyUxkhz3xrZIEaYe2V/tlfp4Z+6fg+0ckEc 5Wo81LHMJFwCuW5xj4us/n/cyah6qviFa87HyCJufw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudeguddgfedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofggtgfgsehtkeertd ertdejnecuhfhrohhmpefrhhhilhhiphcuofgtifhrrghthhcuoehphhhilhhiphesphhh ihhlihhpmhgtghhrrghthhdrtghomheqnecuggftrfgrthhtvghrnhepvdevhfefheffke egtefhieeikeettdfghfeujeeuveekleehjeffteetveevgeeknecuvehluhhsthgvrhfu ihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphhhihhlihhpsehphhhilhhiph hmtghgrhgrthhhrdgtohhm X-ME-Proxy: Feedback-ID: i2b1146f3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Fri, 3 Feb 2023 20:14:16 -0500 (EST) From: Philip McGrath Date: Fri, 3 Feb 2023 20:14:12 -0500 Message-Id: <376cd64a8f207dd957ec0ccf3ef7cd63d81dc70b.1675473088.git.philip@philipmcgrath.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Received-SPF: pass client-ip=64.147.123.25; envelope-from=philip@philipmcgrath.com; helo=wout2-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/utils.scm (target-little-endian?): New function. * guix/build-system/meson.scm (make-machine-alist): Use it. * gnu/packages/chez.scm (nix-system->pbarch-machine-type): Likewise. --- gnu/packages/chez.scm | 9 ++++----- guix/build-system/meson.scm | 13 +++---------- guix/utils.scm | 8 ++++++++ 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm index 0d22e2e20f..1f178d2c72 100644 --- a/gnu/packages/chez.scm +++ b/gnu/packages/chez.scm @@ -4,7 +4,7 @@ ;;; Copyright © 2017, 2019 Tobias Geerinckx-Rice ;;; Copyright © 2019 Brett Gilio ;;; Copyright © 2020 Brendan Tildesley -;;; Copyright © 2021, 2022 Philip McGrath +;;; Copyright © 2021, 2022, 2023 Philip McGrath ;;; ;;; This file is part of GNU Guix. ;;; @@ -251,10 +251,9 @@ (define* (nix-system->pbarch-machine-type #:optional (if (target-64bit? system) "64" "32") - ;; missing (guix utils) predicate target-little-endian? - (if (target-ppc32? system) - "b" - "l"))) + (if (target-little-endian? system) + "l" + "b"))) (define* (racket-cs-native-supported-system? #:optional (system diff --git a/guix/build-system/meson.scm b/guix/build-system/meson.scm index b0bf8cb6e6..7d413a991d 100644 --- a/guix/build-system/meson.scm +++ b/guix/build-system/meson.scm @@ -74,16 +74,9 @@ (define (make-machine-alist triplet) ;; for selecting optimisations, so set it to something ;; arbitrary. (#t "strawberries"))) - (endian . ,(cond ((string-prefix? "powerpc64le-" triplet) "little") - ((string-prefix? "mips64el-" triplet) "little") - ((target-x86-32? triplet) "little") - ((target-x86-64? triplet) "little") - ;; At least in Guix. Aarch64 and 32-bit arm - ;; have a big-endian mode as well. - ((target-arm? triplet) "little") - ((target-ppc32? triplet) "big") - ((target-riscv64? triplet) "little") - (#t (error "meson: unknown architecture")))))) + (endian . ,(if (target-little-endian? triplet) + "little" + "big")))) (define (make-binaries-alist triplet) "Make an associatoin list describing what should go into diff --git a/guix/utils.scm b/guix/utils.scm index aca0af4e4b..774b80cd25 100644 --- a/guix/utils.scm +++ b/guix/utils.scm @@ -16,6 +16,7 @@ ;;; Copyright © 2022 Taiju HIGASHI ;;; Copyright © 2022 Denis 'GNUtoo' Carikli ;;; Copyright © 2022 Antero Mejr +;;; Copyright © 2023 Philip McGrath ;;; ;;; This file is part of GNU Guix. ;;; @@ -104,6 +105,7 @@ (define-module (guix utils) target-riscv64? target-mips64el? target-64bit? + target-little-endian? ar-for-target as-for-target cc-for-target @@ -744,6 +746,12 @@ (define* (target-64bit? #:optional (system (or (%current-target-system) (any (cut string-prefix? <> system) '("x86_64" "aarch64" "mips64" "powerpc64" "riscv64"))) +(define* (target-little-endian? #:optional (target (or (%current-target-system) + (%current-system)))) + "Is the architecture of TARGET little-endian?" + ;; At least in Guix. Aarch64 and 32-bit arm have a big-endian mode as well. + (not (target-ppc32? target))) + (define* (ar-for-target #:optional (target (%current-target-system))) (if target (string-append target "-ar")