summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorVivien Kraus <vivien@planete-kraus.eu>2022-07-19 20:09:14 +0200
committerLudovic Courtès <ludo@gnu.org>2022-08-05 00:14:30 +0200
commita5a88b0248f3ca70db30605c0c2aa93bb360d8ad (patch)
tree27892c5a3bff7c8df9e2b7fb637229e6c35b4f3d /gnu
parent94e0fb1eb7409b3cd1a3e0528c2f199c5a2f48d5 (diff)
downloadguix-a5a88b0248f3ca70db30605c0c2aa93bb360d8ad.tar.gz
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>
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/tls.scm65
1 files changed, 38 insertions, 27 deletions
diff --git a/gnu/packages/tls.scm b/gnu/packages/tls.scm
index a310899b27..1e527ecce2 100644
--- a/gnu/packages/tls.scm
+++ b/gnu/packages/tls.scm
@@ -376,33 +376,44 @@ OpenSSL for 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)
-         (string-append
-          "mingw"
-          (if (string-prefix? "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)
-         ;; linux64-riscv64 isn't recognized until 3.0.0.
-         "linux-generic64")))
+  (if (target-mingw? target)
+      (string-append
+       "mingw"
+       (if (target-x86-64? target)
+           "64"
+           ""))
+      (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.
+               "generic64")
+              (else
+               (error "unsupported openssl target architecture")))))
+        (string-append kernel "-" arch))))
 
 (define-public openssl
   (package