summary refs log tree commit diff
path: root/guix/utils.scm
diff options
context:
space:
mode:
authorPhilip McGrath <philip@philipmcgrath.com>2023-02-03 20:14:12 -0500
committerLudovic Courtès <ludo@gnu.org>2023-02-11 00:09:40 +0100
commita89aa4523befd8c30d9f13800b4833abbc911ba1 (patch)
treefd1f0c52d1450e08678fbb975806a2bbb51b31e3 /guix/utils.scm
parentfb2bf136f0e27b2b6fd48fb3bb38c121f81af7f9 (diff)
downloadguix-a89aa4523befd8c30d9f13800b4833abbc911ba1.tar.gz
utils: Add target-little-endian?.
* 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.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'guix/utils.scm')
-rw-r--r--guix/utils.scm8
1 files changed, 8 insertions, 0 deletions
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 @@
             target-riscv64?
             target-mips64el?
             target-64bit?
+            target-little-endian?
             ar-for-target
             as-for-target
             cc-for-target
@@ -744,6 +746,12 @@ architecture (x86_64)?"
   (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")