aboutsummaryrefslogtreecommitdiff
path: root/guix/utils.scm
diff options
context:
space:
mode:
authorMaxime Devos <maximedevos@telenet.be>2021-07-14 13:12:49 +0200
committerMathieu Othacehe <othacehe@gnu.org>2021-07-14 15:38:03 +0200
commitf54852be22c29a0d5b174d15ef6189c57cab2017 (patch)
tree94803e0923752cc5bc673338ca3c4ab0bf593095 /guix/utils.scm
parent42e41181502b1844263a9e0d50f6281444022576 (diff)
downloadguix-f54852be22c29a0d5b174d15ef6189c57cab2017.tar
guix-f54852be22c29a0d5b174d15ef6189c57cab2017.tar.gz
utils: Define a target-x86-32? and target-x86-64? predicate.
* guix/utils.scm (target-x86-32?, target-x86-64?): New predicates. * tests/utils.scm ("target-x86-32?", "target-x86-64?"): New tests. Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
Diffstat (limited to 'guix/utils.scm')
-rw-r--r--guix/utils.scm20
1 files changed, 20 insertions, 0 deletions
diff --git a/guix/utils.scm b/guix/utils.scm
index fe1439a809..b75710eb0d 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -87,6 +87,8 @@
target-linux?
target-hurd?
target-mingw?
+ target-x86-32?
+ target-x86-64?
target-arm32?
target-aarch64?
target-arm?
@@ -654,6 +656,24 @@ a character other than '@'."
;; are 64-bit.
(string-suffix? "-mingw32" target)))
+(define* (target-x86-32? #:optional (target (or (%current-target-system)
+ (%current-system))))
+ "Is the architecture of TARGET a variant of Intel's 32-bit architecture
+(IA32)?"
+ ;; Intel also has a 16-bit architecture in the iN86 series, i286
+ ;; (see, e.g. https://en.wikipedia.org/wiki/Intel/808286) so this
+ ;; procedure is not named target-x86?.
+ (or (string-prefix? "i386-" target)
+ (string-prefix? "i486-" target)
+ (string-prefix? "i586-" target)
+ (string-prefix? "i686-" target)))
+
+(define* (target-x86-64? #:optional (target (or (%current-target-system)
+ (%current-system))))
+ "Is the architecture of TARGET a variant of Intel/AMD's 64-bit
+architecture (x86_64)?"
+ (string-prefix? "x86_64-" target))
+
(define* (target-arm32? #:optional (target (or (%current-target-system)
(%current-system))))
(string-prefix? "arm" target))