From b0519cc4b04d29ea9327a117eb6c8c21547e6159 Mon Sep 17 00:00:00 2001 From: Maxime Devos Date: Wed, 14 Jul 2021 13:12:49 +0200 Subject: 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 --- guix/utils.scm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'guix') diff --git a/guix/utils.scm b/guix/utils.scm index 2920fa7684..7a00640d85 100644 --- a/guix/utils.scm +++ b/guix/utils.scm @@ -79,6 +79,8 @@ (define-module (guix utils) %current-target-system package-name->name+version target-mingw? + target-x86-32? + target-x86-64? target-arm32? target-aarch64? target-arm? @@ -535,6 +537,24 @@ (define* (target-mingw? #:optional (target (%current-target-system))) (and target (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)) -- cgit v1.2.3