GNU bug report logs - #61259
[PATCH] utils: Add target-little-endian?.

Previous Next

Package: guix-patches;

Reported by: Philip McGrath <philip <at> philipmcgrath.com>

Date: Sat, 4 Feb 2023 01:15:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 61259 in the body.
You can then email your comments to 61259 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to philip <at> philipmcgrath.com, guix-patches <at> gnu.org:
bug#61259; Package guix-patches. (Sat, 04 Feb 2023 01:15:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Philip McGrath <philip <at> philipmcgrath.com>:
New bug report received and forwarded. Copy sent to philip <at> philipmcgrath.com, guix-patches <at> gnu.org. (Sat, 04 Feb 2023 01:15:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Philip McGrath <philip <at> philipmcgrath.com>
To: guix-patches <at> gnu.org
Subject: [PATCH] utils: Add target-little-endian?.
Date: Fri,  3 Feb 2023 20:14:12 -0500
* 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 <me <at> tobias.gr>
 ;;; Copyright © 2019 Brett Gilio <brettg <at> gnu.org>
 ;;; Copyright © 2020 Brendan Tildesley <mail <at> brendan.scot>
-;;; Copyright © 2021, 2022 Philip McGrath <philip <at> philipmcgrath.com>
+;;; Copyright © 2021, 2022, 2023 Philip McGrath <philip <at> philipmcgrath.com>
 ;;;
 ;;; 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 <higashi <at> taiju.info>
 ;;; Copyright © 2022 Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org>
 ;;; Copyright © 2022 Antero Mejr <antero <at> mailbox.org>
+;;; Copyright © 2023 Philip McGrath <philip <at> philipmcgrath.com>
 ;;;
 ;;; 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")
-- 
2.39.1





Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Fri, 10 Feb 2023 22:45:01 GMT) Full text and rfc822 format available.

Notification sent to Philip McGrath <philip <at> philipmcgrath.com>:
bug acknowledged by developer. (Fri, 10 Feb 2023 22:45:02 GMT) Full text and rfc822 format available.

Message #10 received at 61259-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Philip McGrath <philip <at> philipmcgrath.com>
Cc: 61259-done <at> debbugs.gnu.org
Subject: Re: bug#61259: [PATCH] utils: Add target-little-endian?.
Date: Fri, 10 Feb 2023 23:44:40 +0100
Hi Philip,

Philip McGrath <philip <at> philipmcgrath.com> skribis:

> * 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.

Applied, thanks!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 11 Mar 2023 12:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 38 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.