gnu: openssl: Use 'target-*' predicates from (guix utils).

* gnu/packages/tls.scm (target->openssl-target): Rewrite in terms of the
'target-*' predicates.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Vivien Kraus 2022-07-19 20:09:14 +02:00 committed by Ludovic Courtès
parent 94e0fb1eb7
commit a5a88b0248
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -376,33 +376,44 @@ (define (target->openssl-target target)
;; Keep this code outside the build code,
;; such that new targets can be added
;; without causing rebuilds for other targets.
(cond ((string-prefix? "i586" target)
"hurd-x86")
((string-suffix? "mingw32" target)
(if (target-mingw? target)
(string-append
"mingw"
(if (string-prefix? "x86_64" target)
(if (target-x86-64? target)
"64"
"")))
((string-prefix? "i686" target)
"linux-x86")
((string-prefix? "x86_64" target)
"linux-x86_64")
((string-prefix? "mips64el" target)
"linux-mips64")
((string-prefix? "arm" target)
"linux-armv4")
((string-prefix? "aarch64" target)
"linux-aarch64")
((string-prefix? "powerpc64le" target)
"linux-ppc64le")
((string-prefix? "powerpc64" target)
"linux-ppc64")
((string-prefix? "powerpc" target)
"linux-ppc")
((string-prefix? "riscv64" target)
""))
(let ((kernel
(cond ((target-hurd? target)
"hurd")
((target-linux? target)
"linux")
(else
(error "unsupported openssl target kernel"))))
(arch
(cond
((target-x86-32? target)
"x86")
((target-x86-64? target)
"x86_64")
((target-mips64el? target)
"mips64")
((target-arm32? target)
"armv4")
((target-aarch64? target)
"aarch64")
((target-ppc64le? target)
"ppc64le")
((target-ppc32? target)
"ppc")
((and (target-powerpc? target)
(target-64bit? target))
"ppc64")
((target-64bit? target)
;; linux64-riscv64 isn't recognized until 3.0.0.
"linux-generic64")))
"generic64")
(else
(error "unsupported openssl target architecture")))))
(string-append kernel "-" arch))))
(define-public openssl
(package