unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#56504] [PATCH] Mingw support for zlib
@ 2022-07-11 23:53 Vivien Kraus via Guix-patches via
  2022-07-12  6:07 ` Liliana Marie Prikler
  0 siblings, 1 reply; 10+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2022-07-11 23:53 UTC (permalink / raw)
  To: 56504

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

Dear guix,

zlib can be cross-compiled to mingw. It can be done by not running
configure, but instead using the win32/Makefile.gcc makefile, with some
tweaks for guix.

I think it should not rebuild anything, but I’m not sure. What do you
think?

Best regards,

Vivien

[-- Attachment #2: 0001-gnu-zlib-Support-mingw-cross-compilation.patch --]
[-- Type: text/x-patch, Size: 4145 bytes --]

From 956c0491ea489ceaafe951f40f49efe8733b2563 Mon Sep 17 00:00:00 2001
From: Vivien Kraus <vivien@planete-kraus.eu>
Date: Sat, 25 Jun 2022 16:33:44 +0200
Subject: [PATCH] gnu: zlib: Support mingw cross-compilation.

* gnu/packages/compression.scm (zlib): Only run configure if not mingw.
---
 gnu/packages/compression.scm | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/compression.scm b/gnu/packages/compression.scm
index d5bd3abf0f..5bce852523 100644
--- a/gnu/packages/compression.scm
+++ b/gnu/packages/compression.scm
@@ -125,8 +125,29 @@ (define-public zlib
                ,@(if (%current-target-system)
                      `((setenv "CHOST" ,(%current-target-system)))
                      '())
-               (invoke "./configure"
-                       (string-append "--prefix=" out)))))
+               ,@(if (and (%current-target-system)
+                          (string-suffix? "-w64-mingw32" (%current-target-system)))
+                     `((substitute* "win32/Makefile.gcc"
+                         (("PREFIX =")
+                          (string-append "PREFIX = " ,(%current-target-system) "-"))
+                         (("prefix \\?= /usr/local")
+                          (string-append "prefix ?= " out))
+                         (("# BINARY_PATH, INCLUDE_PATH and LIBRARY_PATH must be set.")
+                          "\
+BINARY_PATH = $(prefix)/bin
+INCLUDE_PATH = $(prefix)/include
+LIBRARY_PATH = $(prefix)/lib"))
+                       (rename-file "win32/Makefile.gcc" "Makefile"))
+                     `((invoke "./configure"
+                               (string-append "--prefix=" out)))))))
+         ,@(if (and (%current-target-system)
+                    (string-suffix? "-mingw32" (%current-target-system)))
+               `(add-after 'install 'install-mingw-shared
+                  (lambda* (#:key make-flags #:allow-other-keys)
+                    (apply invoke "make"
+                           (append make-flags
+                                   '("install" "SHARED_MODE=1")))))
+               '())
          (add-after 'install 'move-static-library
            (lambda* (#:key outputs #:allow-other-keys)
              (let ((out (assoc-ref outputs "out"))

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


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

end of thread, other threads:[~2022-07-31 11:22 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-11 23:53 [bug#56504] [PATCH] Mingw support for zlib Vivien Kraus via Guix-patches via
2022-07-12  6:07 ` Liliana Marie Prikler
2022-07-12 16:45   ` Vivien Kraus via Guix-patches via
2022-07-13  5:49     ` Liliana Marie Prikler
2022-07-13 15:19       ` Vivien Kraus via Guix-patches via
2022-07-14  6:01         ` Liliana Marie Prikler
2022-07-15 14:28           ` Vivien Kraus via Guix-patches via
2022-07-15 14:30             ` Liliana Marie Prikler
2022-07-19 21:07               ` Ludovic Courtès
2022-07-31 11:21                 ` bug#56504: " Liliana Marie Prikler

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