unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#61259] [PATCH] utils: Add target-little-endian?.
@ 2023-02-04  1:14 Philip McGrath
  2023-02-10 22:44 ` bug#61259: " Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Philip McGrath @ 2023-02-04  1:14 UTC (permalink / raw)
  To: 61259; +Cc: Philip McGrath

* 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@tobias.gr>
 ;;; Copyright © 2019 Brett Gilio <brettg@gnu.org>
 ;;; Copyright © 2020 Brendan Tildesley <mail@brendan.scot>
-;;; Copyright © 2021, 2022 Philip McGrath <philip@philipmcgrath.com>
+;;; Copyright © 2021, 2022, 2023 Philip McGrath <philip@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@taiju.info>
 ;;; Copyright © 2022 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
 ;;; Copyright © 2022 Antero Mejr <antero@mailbox.org>
+;;; Copyright © 2023 Philip McGrath <philip@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





^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#61259: [PATCH] utils: Add target-little-endian?.
  2023-02-04  1:14 [bug#61259] [PATCH] utils: Add target-little-endian? Philip McGrath
@ 2023-02-10 22:44 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2023-02-10 22:44 UTC (permalink / raw)
  To: Philip McGrath; +Cc: 61259-done

Hi Philip,

Philip McGrath <philip@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’.




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-02-10 22:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-04  1:14 [bug#61259] [PATCH] utils: Add target-little-endian? Philip McGrath
2023-02-10 22:44 ` bug#61259: " Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).