unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Vivien Kraus via Guix-patches via <guix-patches@gnu.org>
To: 56505@debbugs.gnu.org
Subject: [bug#56505] Use the target predicates from (guix utils)
Date: Tue, 19 Jul 2022 20:37:08 +0200	[thread overview]
Message-ID: <70b76f171502fc7122dbfd120093660616632980.camel@planete-kraus.eu> (raw)
In-Reply-To: <660bab87fb7ccee6177be413b72bea7e40463354.camel@planete-kraus.eu>

[-- Attachment #1: Type: text/plain, Size: 706 bytes --]

Dear guix,

antipode on #guix told me that these archaic tests to determine the
openssl target should be replaced with the new target predicates in
(guix utils), and that the kernel and the architecture should be dealt
with independently.

However, it seems that mingw targets do not use the same scheme, so I
had to keep that special case.

I had to introduce a new predicate for mips64el. As far as I
understand, this is also a 64-bit target, so it should also be detected
by target-64bit?, but fortunately this is already the case, so I don’t
have to change target-64bit?. I don’t think there are other predicates
that I should change, but I may be wrong.

What do you think?

Best regards,

Vivien

[-- Attachment #2: v2-0001-gnu-openssl-Cross-compile-to-mingw.patch --]
[-- Type: text/x-patch, Size: 1041 bytes --]

From 4084fb014e84e6b15825c6c37dcdba8bde56fa4e Mon Sep 17 00:00:00 2001
From: Vivien Kraus <vivien@planete-kraus.eu>
Date: Sat, 9 Jul 2022 23:39:16 +0200
Subject: [PATCH v2 1/3] gnu: openssl: Cross-compile to mingw.

* gnu/packages/tls.scm (target->openssl-target): Add cases for mingw and
mingw64.
---
 gnu/packages/tls.scm | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gnu/packages/tls.scm b/gnu/packages/tls.scm
index 1ee5400a9c..b838e75b5c 100644
--- a/gnu/packages/tls.scm
+++ b/gnu/packages/tls.scm
@@ -361,6 +361,12 @@ (define (target->openssl-target target)
   ;; 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)

base-commit: dbf09879710aefe6cedd9ed975cc2b79df01b755
-- 
2.36.1


[-- Attachment #3: v2-0002-guix-Add-target-mips64el.patch --]
[-- Type: text/x-patch, Size: 1345 bytes --]

From e4631751a4e435a2125b5d72f665f6ec0ef5d6e1 Mon Sep 17 00:00:00 2001
From: Vivien Kraus <vivien@planete-kraus.eu>
Date: Tue, 19 Jul 2022 20:05:45 +0200
Subject: [PATCH v2 2/3] guix: Add target-mips64el?.

* guix/utils.scm (target-mips64el?): New function. It detects whether the
target system is mips64el.
---
 guix/utils.scm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/guix/utils.scm b/guix/utils.scm
index 329ef62dde..b4563e1a8f 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -101,6 +101,7 @@ (define-module (guix utils)
             target-ppc64le?
             target-powerpc?
             target-riscv64?
+            target-mips64el?
             target-64bit?
             ar-for-target
             cc-for-target
@@ -732,6 +733,10 @@ (define* (target-riscv64? #:optional (target (or (%current-target-system)
   "Is the architecture of TARGET a 'riscv64' machine?"
   (string-prefix? "riscv64" target))
 
+(define* (target-mips64el? #:optional (target (or (%current-target-system)
+                                                  (%current-system))))
+  (string-prefix? "mips64el-" target))
+
 (define* (target-64bit? #:optional (system (or (%current-target-system)
                                                (%current-system))))
   (any (cut string-prefix? <> system) '("x86_64" "aarch64" "mips64"
-- 
2.36.1


[-- Attachment #4: v2-0003-gnu-openssl-use-target-predicates-from-guix-utils.patch --]
[-- Type: text/x-patch, Size: 2978 bytes --]

From ae3bffd19c2887342e28372c3c613e998eb21840 Mon Sep 17 00:00:00 2001
From: Vivien Kraus <vivien@planete-kraus.eu>
Date: Tue, 19 Jul 2022 20:09:14 +0200
Subject: [PATCH v2 3/3] gnu: openssl: use target predicates from (guix utils)
 for openssl.

---
 gnu/packages/tls.scm | 65 ++++++++++++++++++++++++++------------------
 1 file changed, 38 insertions(+), 27 deletions(-)

diff --git a/gnu/packages/tls.scm b/gnu/packages/tls.scm
index b838e75b5c..a32031acb8 100644
--- a/gnu/packages/tls.scm
+++ b/gnu/packages/tls.scm
@@ -359,33 +359,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)
-         (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
-- 
2.36.1


  reply	other threads:[~2022-07-19 18:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-11 23:55 [bug#56505] [PATCHES] Mingw configuration for openssl Vivien Kraus via Guix-patches via
2022-07-19 18:37 ` Vivien Kraus via Guix-patches via [this message]
2022-08-04 22:14   ` bug#56505: " Ludovic Courtès
2022-08-05  7:58     ` [bug#56505] " Vivien Kraus via Guix-patches via
2022-08-05  9:34       ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=70b76f171502fc7122dbfd120093660616632980.camel@planete-kraus.eu \
    --to=guix-patches@gnu.org \
    --cc=56505@debbugs.gnu.org \
    --cc=vivien@planete-kraus.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).