[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#49025] [PATCH v3 core-updates 01/37] utils: Define target-linux? pr
From: |
Maxime Devos |
Subject: |
[bug#49025] [PATCH v3 core-updates 01/37] utils: Define target-linux? predicate. |
Date: |
Fri, 18 Jun 2021 19:15:55 +0200 |
* guix/utils.scm (target-linux?): New predicate.
* tests/utils.scm
("target-linux?"): Test it.
("target-mingw?"): Also test ‘target-mingw?’.
---
guix/utils.scm | 6 ++++++
tests/utils.scm | 17 +++++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/guix/utils.scm b/guix/utils.scm
index 19990ceb8a..4ff2602e23 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -11,6 +11,7 @@
;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
;;; Copyright © 2021 Chris Marusich <cmmarusich@gmail.com>
+;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -81,6 +82,7 @@
%current-system
%current-target-system
package-name->name+version
+ target-linux?
target-mingw?
target-arm32?
target-aarch64?
@@ -543,6 +545,10 @@ a character other than '@'."
(idx (values (substring spec 0 idx)
(substring spec (1+ idx))))))
+(define* (target-linux? #:optional (target (or (%current-target-system)
+ (%current-system))))
+ (string-contains target "linux"))
+
(define* (target-mingw? #:optional (target (%current-target-system)))
(and target
(string-suffix? "-mingw32" target)))
diff --git a/tests/utils.scm b/tests/utils.scm
index 7fcbb25552..80a0e669a4 100644
--- a/tests/utils.scm
+++ b/tests/utils.scm
@@ -3,6 +3,7 @@
;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
+;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -289,6 +290,22 @@ skip these tests."
(string-closest "hello" '("kikoo" "helo" "hihihi" "halo"))
(string-closest "hello" '("aaaaa" "12345" "hellohello" "h"))))
+(test-equal "target-linux?"
+ '(#t #f #f #t)
+ (map (compose ->bool target-linux?)
+ '("i686-linux-gnu" "i686-w64-mingw32"
+ ;; Checking that "gnu" is present is not sufficient,
+ ;; as GNU/Hurd exists.
+ "i686-pc-gnu"
+ ;; Some targets have a suffix.
+ "arm-linux-gnueabihf")))
+
+(test-equal "target-mingw?"
+ '(#f #f #t)
+ (map (compose ->bool target-mingw?)
+ '("i686-linux-gnu" "i686-pc-gnu"
+ "i686-w64-mingw32")))
+
(test-end)
(false-if-exception (delete-file temp-file))
--
2.32.0
- [bug#49025] [[PATCH v2 core-updates] 28/37] fontconfig: Fix build error when cross-compiling., (continued)
- [bug#49025] [[PATCH v2 core-updates] 28/37] fontconfig: Fix build error when cross-compiling., Maxime Devos, 2021/06/18
- [bug#49025] [[PATCH v2 core-updates] 11/37] libgpg-error: Fix cross-compilation error., Maxime Devos, 2021/06/18
- [bug#49025] [[PATCH v2 core-updates] 37/37] meson: Support cross-compilation., Maxime Devos, 2021/06/18
- [bug#49025] [[PATCH v2 core-updates] 20/37] openssl: Move all man pages to separate output, not only man3., Maxime Devos, 2021/06/18
- [bug#49025] [[PATCH v2 core-updates] 35/37] opendht: Correct 'nettle' variable name in inputs., Maxime Devos, 2021/06/18
- [bug#49025] [[PATCH v2 core-updates] 36/37] cross-base: Fix cross-compiler for i686-linux-gnu., Maxime Devos, 2021/06/18
- [bug#49025] [[PATCH v2 core-updates] 29/37] glib: Use a correct python in scripts when cross-compiling., Maxime Devos, 2021/06/18
- [bug#49025] [[PATCH v2 core-updates] 27/37] fontconfig: Make the #:configure-flags argument a G-expression., Maxime Devos, 2021/06/18
- [bug#49025] [[PATCH v2 core-updates] 14/37] wrap-python3: Fix cross-compilation., Maxime Devos, 2021/06/18
- [bug#49025] [[PATCH v2 core-updates] 01/37] utils: Define target-linux? predicate., Maxime Devos, 2021/06/18
- [bug#49025] [PATCH v3 core-updates 01/37] utils: Define target-linux? predicate.,
Maxime Devos <=
- [bug#49025] [PATCH v3 core-updates 04/37] net-base: Make #:builder argument a G-expression., Maxime Devos, 2021/06/18
- [bug#49025] [PATCH v3 core-updates 05/37] net-base: Fix cross-compilation, eliminating %build-inputs & friends, Maxime Devos, 2021/06/18
- [bug#49025] [PATCH v3 core-updates 02/37] utils: Define a target-x86-32? and target-x86-64? predicate., Maxime Devos, 2021/06/18
- [bug#49025] [PATCH v3 core-updates 07/37] tzdata: Don't bother with cross-compiling., Maxime Devos, 2021/06/18
- [bug#49025] [PATCH v3 core-updates 08/37] libgpg-error: Remove trailing #f from phases., Maxime Devos, 2021/06/18
- [bug#49025] [PATCH v3 core-updates 06/37] net-base: Don't cross-compile., Maxime Devos, 2021/06/18
- [bug#49025] [PATCH v3 core-updates 11/37] libgpg-error: Fix cross-compilation error., Maxime Devos, 2021/06/18
- [bug#49025] [PATCH v3 core-updates 10/37] libgpgerror: Maybe fix a cross-compilation bug., Maxime Devos, 2021/06/18
- [bug#49025] [PATCH v3 core-updates 03/37] packages: Define this-package-input and this-package-native-input., Maxime Devos, 2021/06/18
- [bug#49025] [PATCH v3 core-updates 14/37] wrap-python3: Fix cross-compilation., Maxime Devos, 2021/06/18