all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#56505] [PATCHES] Mingw configuration for openssl
@ 2022-07-11 23:55 Vivien Kraus via Guix-patches via
  2022-07-19 18:37 ` [bug#56505] Use the target predicates from (guix utils) Vivien Kraus via Guix-patches via
  0 siblings, 1 reply; 5+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2022-07-11 23:55 UTC (permalink / raw)
  To: 56505

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

Dear guix,

openssl can be cross-compiled to mingw, by adding a mingw entry in the
list of known openssl targets.

What do you think?

Best regards,

Vivien

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

From 6b65f4f152529f4ac9096f14c940dde2658fe16c 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] 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: 6ffb3ef4d61e47c39b9ee4d1dceeaeb9360094c0
prerequisite-patch-id: cb331cf7152091377b37baa313ba3a5a87b3143f
prerequisite-patch-id: 92209f66b90c79d7bf060944906c869625b407dd
prerequisite-patch-id: 5e408465a1d766662ee1c33a4b807a779a4c664b
prerequisite-patch-id: eb8a798c6dc097419cb5bdf51641e3169e681e2e
prerequisite-patch-id: ea2b7638049e23e80fe2716e78900ea14cf922cd
prerequisite-patch-id: ca6164abf3d0287d49f726b3ae92b75ef94a8103
prerequisite-patch-id: 3265f90d5769feeed4b62de20c4f69c5a5e7a81d
prerequisite-patch-id: f85ec750b9f798b9e41bb00d7edb82d421353b33
prerequisite-patch-id: 6b60605cbf22b6ad4eff2f0da74a74c30fe2a9c8
prerequisite-patch-id: d6051ad60e172c8f11ef40772e502d86f4333acb
prerequisite-patch-id: 1dbff988e2360cb1ee029f64f300ce44c11d76e9
prerequisite-patch-id: 66ad9148ea45252dbef3037bd7a50a4ec32e2b5b
prerequisite-patch-id: 0c3aa04452a6a1d3f56951aa177a174a032ff299
prerequisite-patch-id: 42948a36a16f9824c17b8e7b7294ea33e81eb238
prerequisite-patch-id: b1b2b2215d1a71bfac6239766067c34cfbb70ebb
prerequisite-patch-id: 91f834615aed988f8f2d9b1655721debd65e0cdf
prerequisite-patch-id: 4a5b6330f14470cc7688ba1ffabd38414d3d9860
prerequisite-patch-id: 86c9604f41fa8d1e0a02fdd1a0ac3fbed3ac37e2
prerequisite-patch-id: 4551ff825ddc78669180eaa1826e8b581e2726f7
prerequisite-patch-id: 0c89c6e62602aded309ea47143fea68aed8c1617
prerequisite-patch-id: 4ad64d116fb8674505d7411a296137046096c60c
prerequisite-patch-id: 9939453dfc6bcac6f98aafdf60812b2bf884fb3a
prerequisite-patch-id: 8c206238029371a28c49cd914d7aae780114b10c
prerequisite-patch-id: f95b376c7e13855b8d3784a6cefc4800b945d502
prerequisite-patch-id: b39addb89db4cb5f5727a492411eae5ace52ad8b
prerequisite-patch-id: d9bc7451845593d839c8921801d3db8ab58f14ad
prerequisite-patch-id: 836dc57a4ee4aa788d05eed45b3804c139e4f995
prerequisite-patch-id: 0b4c563142f8f5ae6ca10e34b814266310be2686
prerequisite-patch-id: 2a36fa42b196e12812d7e1a25d72f2c58c67eca9
-- 
2.36.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#56505] Use the target predicates from (guix utils)
  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
  2022-08-04 22:14   ` bug#56505: [PATCHES] Mingw configuration for openssl Ludovic Courtès
  0 siblings, 1 reply; 5+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2022-07-19 18:37 UTC (permalink / raw)
  To: 56505

[-- 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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#56505: [PATCHES] Mingw configuration for openssl
  2022-07-19 18:37 ` [bug#56505] Use the target predicates from (guix utils) Vivien Kraus via Guix-patches via
@ 2022-08-04 22:14   ` Ludovic Courtès
  2022-08-05  7:58     ` [bug#56505] " Vivien Kraus via Guix-patches via
  0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2022-08-04 22:14 UTC (permalink / raw)
  To: Vivien Kraus; +Cc: 56505-done

Hi Vivien,

Vivien Kraus <vivien@planete-kraus.eu> skribis:

> 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.

Good idea.

> 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?

I think that’s good!

> 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.

[...]

> 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.

[...]

> 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(-)

Added a commit log to this one and committed, thanks!

‘guix build openssl --target=x86_64-w64-mingw32’ works and the funny
part is that .dll files end up in bin/, but I think that’s intended on
Windows?

Ludo’.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#56505] [PATCHES] Mingw configuration for openssl
  2022-08-04 22:14   ` bug#56505: [PATCHES] Mingw configuration for openssl Ludovic Courtès
@ 2022-08-05  7:58     ` Vivien Kraus via Guix-patches via
  2022-08-05  9:34       ` Ludovic Courtès
  0 siblings, 1 reply; 5+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2022-08-05  7:58 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 56505-done

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

Hi,

Le vendredi 05 août 2022 à 00:14 +0200, Ludovic Courtès a écrit :
> ‘guix build openssl --target=x86_64-w64-mingw32’ works and the funny
> part is that .dll files end up in bin/, but I think that’s intended
> on
> Windows?

That’s right. Windows does not have shared objects, and DLLs are not.
You cannot use the compiler to link to a DLL as far as I understand, so
you wouldn’t put them in lib. What you have in lib are the so-called
"import libraries" (.dll.a). These are static libraries that pretend to
provide the functionality, but in fact open the DLL at run-time to
fetch the library implementation from the DLL. So DLLs are kind of
resources.

Anyway, you see that in lib/ you have all the .dll.a files… Oops… I may
have forgotten to check this… This is not a huge problem, because all
outputs would be available when building a dependent package, but it’s
still not right I think.

Now, the .dll.a files are smaller than the static libraries, but not
that small. I don’t know why exactly.

Should I open a new issue with this patch, or is it somehow possible to
continue the discussion here?

Best regards,

Vivien

[-- Attachment #2: 0001-gnu-openssl-Keep-.dll.a-files-in-main-output.patch --]
[-- Type: text/x-patch, Size: 1419 bytes --]

From 1ee8daf446ca874ff4e5daa65d6f4034df51838e Mon Sep 17 00:00:00 2001
From: Vivien Kraus <vivien@planete-kraus.eu>
Date: Fri, 5 Aug 2022 09:52:21 +0200
Subject: [PATCH] gnu: openssl: Keep .dll.a files in main output.

* gnu/packages/tls.scm (openssl) [phase move-static-libraries]: Do not move
.dll.a files to the static output when targetting mingw.
---
 gnu/packages/tls.scm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/tls.scm b/gnu/packages/tls.scm
index 1e527ecce2..4ee75ace3d 100644
--- a/gnu/packages/tls.scm
+++ b/gnu/packages/tls.scm
@@ -507,7 +507,13 @@ (define-public openssl
                (for-each (lambda (file)
                            (install-file file slib)
                            (delete-file file))
-                         (find-files lib "\\.a$")))))
+                         (find-files
+                          lib
+                          #$(if (target-mingw?)
+                                '(lambda (filename _)
+                                   (and (string-suffix? ".a" filename)
+                                        (not (string-suffix? ".dll.a" filename))))
+                                "\\.a$"))))))
          (add-after 'install 'move-extra-documentation
            (lambda _
              ;; Move man pages and full HTML documentation to "doc".

base-commit: cc4c02e346a71ccef897e2d9f04fa2df2529a269
-- 
2.37.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#56505] [PATCHES] Mingw configuration for openssl
  2022-08-05  7:58     ` [bug#56505] " Vivien Kraus via Guix-patches via
@ 2022-08-05  9:34       ` Ludovic Courtès
  0 siblings, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2022-08-05  9:34 UTC (permalink / raw)
  To: Vivien Kraus; +Cc: 56505-done

Hi,

Vivien Kraus <vivien@planete-kraus.eu> skribis:

> Le vendredi 05 août 2022 à 00:14 +0200, Ludovic Courtès a écrit :
>> ‘guix build openssl --target=x86_64-w64-mingw32’ works and the funny
>> part is that .dll files end up in bin/, but I think that’s intended
>> on
>> Windows?
>
> That’s right. Windows does not have shared objects, and DLLs are not.
> You cannot use the compiler to link to a DLL as far as I understand, so
> you wouldn’t put them in lib. What you have in lib are the so-called
> "import libraries" (.dll.a). These are static libraries that pretend to
> provide the functionality, but in fact open the DLL at run-time to
> fetch the library implementation from the DLL. So DLLs are kind of
> resources.
>
> Anyway, you see that in lib/ you have all the .dll.a files… Oops… I may
> have forgotten to check this… This is not a huge problem, because all
> outputs would be available when building a dependent package, but it’s
> still not right I think.

Oh, I see.

> From 1ee8daf446ca874ff4e5daa65d6f4034df51838e Mon Sep 17 00:00:00 2001
> From: Vivien Kraus <vivien@planete-kraus.eu>
> Date: Fri, 5 Aug 2022 09:52:21 +0200
> Subject: [PATCH] gnu: openssl: Keep .dll.a files in main output.
>
> * gnu/packages/tls.scm (openssl) [phase move-static-libraries]: Do not move
> .dll.a files to the static output when targetting mingw.

Applied, thanks!

Ludo’.




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-08-05  9:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-11 23:55 [bug#56505] [PATCHES] Mingw configuration for openssl Vivien Kraus via Guix-patches via
2022-07-19 18:37 ` [bug#56505] Use the target predicates from (guix utils) Vivien Kraus via Guix-patches via
2022-08-04 22:14   ` bug#56505: [PATCHES] Mingw configuration for openssl Ludovic Courtès
2022-08-05  7:58     ` [bug#56505] " Vivien Kraus via Guix-patches via
2022-08-05  9:34       ` Ludovic Courtès

Code repositories for project(s) associated with this inbox:

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.