aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Devos <maximedevos@telenet.be>2021-07-14 13:12:47 +0200
committerMathieu Othacehe <othacehe@gnu.org>2021-07-14 15:38:03 +0200
commit637a1e7dcce4d1a2c4f2f9c478df4a640ae1f230 (patch)
tree9448c036d0a0021b134f4e60210d0900b70c524f
parentef71965c162ff19c7b4b85889b0330d7c428dda5 (diff)
downloadguix-637a1e7dcce4d1a2c4f2f9c478df4a640ae1f230.tar.gz
guix-637a1e7dcce4d1a2c4f2f9c478df4a640ae1f230.zip
utils: Define 'target-hurd?' predicate.
It behaves similarily to the other target-...? procedures. The usage of hurd-triplet? / target-hurd? in libgc appears incorrect to me, as (%current-system) is normally never false. * gnu/packages/hurd.scm (hurd-triplet?): Move to ... * guix/util.scm (target-hurd?): ... here, let its argument default to (%current-target-system) or (%current-system), and write a docstring. * gnu/packages/hurd.scm (hurd-target?, hurd-system?): Use target-hurd? instead of hurd-triplet?. * gnu/packages/bdw-gc.scm (libgc): Likewise. * gnu/packages/cross-base.scm (cross-libc)[arguments]<#:configure-flags>: Likewise. (cross-libc)[arguments]<#:phases>: Likewise. (cross-libc)[arguments]<#:native-inputs>: Likewise. * gnu/packages/make-boostrap.scm (%glibc-stripped)[inputs]: Likewise. Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
-rw-r--r--gnu/packages/bdw-gc.scm4
-rw-r--r--gnu/packages/cross-base.scm6
-rw-r--r--gnu/packages/hurd.scm10
-rw-r--r--gnu/packages/make-bootstrap.scm2
-rw-r--r--guix/utils.scm7
5 files changed, 16 insertions, 13 deletions
diff --git a/gnu/packages/bdw-gc.scm b/gnu/packages/bdw-gc.scm
index 0d82889bac..5ced11bb64 100644
--- a/gnu/packages/bdw-gc.scm
+++ b/gnu/packages/bdw-gc.scm
@@ -56,8 +56,8 @@
;; to configure script. See bug report and discussion:
;; <https://lists.opendylan.org/pipermail/bdwgc/2017-April/006275.html>
;; <https://lists.gnu.org/archive/html/bug-hurd/2017-01/msg00008.html>
- ,@(if (hurd-triplet? (or (%current-system)
- (%current-target-system)))
+ ,@(if (target-hurd? (or (%current-system)
+ (%current-target-system)))
'("--disable-gcj-support")
'()))))
(native-inputs `(("pkg-config" ,pkg-config)))
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index ced226ef34..78cbf871ac 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -505,7 +505,7 @@ and the cross tool chain."
,@(package-arguments libc))
((#:configure-flags flags)
`(cons ,(string-append "--host=" target)
- ,(if (hurd-triplet? target)
+ ,(if (target-hurd? target)
`(cons "--disable-werror" ,flags)
flags)))
((#:phases phases)
@@ -519,7 +519,7 @@ and the cross tool chain."
(setenv "CROSS_LIBRARY_PATH"
(string-append kernel "/lib")) ; for Hurd's libihash
#t)))
- ,@(if (hurd-triplet? target)
+ ,@(if (target-hurd? target)
'((add-after 'install 'augment-libc.so
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")))
@@ -536,7 +536,7 @@ and the cross tool chain."
(native-inputs `(("cross-gcc" ,xgcc)
("cross-binutils" ,xbinutils)
- ,@(if (hurd-triplet? target)
+ ,@(if (target-hurd? target)
`(("cross-mig"
,@(assoc-ref (package-native-inputs xheaders)
"cross-mig")))
diff --git a/gnu/packages/hurd.scm b/gnu/packages/hurd.scm
index 59a7b55943..222ddbce65 100644
--- a/gnu/packages/hurd.scm
+++ b/gnu/packages/hurd.scm
@@ -51,20 +51,16 @@
hurd-target?
hurd-triplet?))
-(define (hurd-triplet? triplet)
- (and (string-suffix? "-gnu" triplet)
- (not (string-contains triplet "linux"))))
-
(define (hurd-target?)
"Return true if the cross-compilation target or the current system is
GNU/Hurd."
- (or (and=> (%current-target-system) hurd-triplet?)
+ (or (and=> (%current-target-system) target-hurd?)
(and (not (%current-target-system))
- (and=> (%current-system) hurd-triplet?))))
+ (and=> (%current-system) target-hurd?))))
(define (hurd-system?)
"Return true if the current system is the Hurd."
- (and=> (%current-system) hurd-triplet?))
+ (and=> (%current-system) target-hurd?))
(define (hurd-source-url version)
(string-append "mirror://gnu/hurd/hurd-"
diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm
index 265884020e..5c306c145d 100644
--- a/gnu/packages/make-bootstrap.scm
+++ b/gnu/packages/make-bootstrap.scm
@@ -439,7 +439,7 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
(assoc-ref %build-inputs "kernel-headers")))))
(inputs `(("kernel-headers"
,(if (or (and (%current-target-system)
- (hurd-triplet? (%current-target-system)))
+ (target-hurd? (%current-target-system)))
(string-suffix? "-hurd" (%current-system)))
gnumach-headers
linux-libre-headers))
diff --git a/guix/utils.scm b/guix/utils.scm
index 1ac17b3657..8ae912c48b 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -85,6 +85,7 @@
%current-target-system
package-name->name+version
target-linux?
+ target-hurd?
target-mingw?
target-arm32?
target-aarch64?
@@ -639,6 +640,12 @@ a character other than '@'."
"Does the operating system of TARGET use the Linux kernel?"
(->bool (string-contains target "linux")))
+(define* (target-hurd? #:optional (target (or (%current-target-system)
+ (%current-system))))
+ "Does TARGET represent the GNU(/Hurd) system?"
+ (and (string-suffix? "-gnu" target)
+ (not (string-contains target "linux"))))
+
(define* (target-mingw? #:optional (target (%current-target-system)))
(and target
(string-suffix? "-mingw32" target)))