GNU bug report logs - #37027
[PATCH] gnu: zlib: Add support for MinGW targets.

Previous Next

Package: guix-patches;

Reported by: David Thompson <dthompson2 <at> worcester.edu>

Date: Wed, 14 Aug 2019 13:00:02 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 37027 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#37027; Package guix-patches. (Wed, 14 Aug 2019 13:00:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to David Thompson <dthompson2 <at> worcester.edu>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Wed, 14 Aug 2019 13:00:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: David Thompson <dthompson2 <at> worcester.edu>
To: guix-patches <at> gnu.org
Cc: David Thompson <dthompson2 <at> worcester.edu>
Subject: [PATCH] gnu: zlib: Add support for MinGW targets.
Date: Wed, 14 Aug 2019 08:58:53 -0400
---
 gnu/packages/compression.scm | 55 +++++++++++++++++++++++-------------
 1 file changed, 36 insertions(+), 19 deletions(-)

diff --git a/gnu/packages/compression.scm b/gnu/packages/compression.scm
index 9834fcbe63..092eb4a54a 100644
--- a/gnu/packages/compression.scm
+++ b/gnu/packages/compression.scm
@@ -87,26 +87,43 @@
     (arguments
      `(#:phases
        (modify-phases %standard-phases
-         (replace 'configure
-           (lambda* (#:key outputs #:allow-other-keys)
-             ;; Zlib's home-made `configure' fails when passed
-             ;; extra flags like `--enable-fast-install', so we need to
-             ;; invoke it with just what it understand.
-             (let ((out (assoc-ref outputs "out")))
-               ;; 'configure' doesn't understand '--host'.
-               ,@(if (%current-target-system)
-                     `((setenv "CHOST" ,(%current-target-system)))
-                     '())
-               (invoke "./configure"
-                       (string-append "--prefix=" out)))))
+         ,@(if (target-mingw?)
+               `((delete 'configure)
+                 (add-before 'install 'set-install-paths
+                             (lambda* (#:key outputs #:allow-other-keys)
+                               (let ((out (assoc-ref outputs "out")))
+                                 (setenv "INCLUDE_PATH" (string-append out "/include"))
+                                 (setenv "LIBRARY_PATH" (string-append out "/lib"))
+                                 (setenv "BINARY_PATH" (string-append out "/bin"))
+                                 #t))))
+               `((replace 'configure
+                          (lambda* (#:key outputs #:allow-other-keys)
+                            ;; Zlib's home-made `configure' fails when passed
+                            ;; extra flags like `--enable-fast-install', so we need to
+                            ;; invoke it with just what it understand.
+                            (let ((out (assoc-ref outputs "out")))
+                              ;; 'configure' doesn't understand '--host'.
+                              ,@(if (%current-target-system)
+                                    `((setenv "CHOST" ,(%current-target-system)))
+                                    '())
+                              (invoke "./configure"
+                                      (string-append "--prefix=" out)))))))
          (add-after 'install 'move-static-library
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let ((out (assoc-ref outputs "out"))
-                   (static (assoc-ref outputs "static")))
-               (with-directory-excursion (string-append out "/lib")
-                 (install-file "libz.a" (string-append static "/lib"))
-                 (delete-file "libz.a")
-                 #t)))))))
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (let ((out (assoc-ref outputs "out"))
+                            (static (assoc-ref outputs "static")))
+                        (with-directory-excursion (string-append out "/lib")
+                                                  (install-file "libz.a" (string-append static "/lib"))
+                                                  (delete-file "libz.a")
+                                                  #t)))))
+       ,@(if (target-mingw?)
+             `(#:make-flags
+               '("-fwin32/Makefile.gcc"
+                 "SHARED_MODE=1"
+                 ,(string-append "CC=" (%current-target-system) "-gcc")
+                 ,(string-append "RC=" (%current-target-system) "-windres")
+                 ,(string-append "AR=" (%current-target-system) "-ar")))
+             '())))
     (home-page "https://zlib.net/")
     (synopsis "Compression library")
     (description
-- 
2.17.1





Information forwarded to guix-patches <at> gnu.org:
bug#37027; Package guix-patches. (Tue, 27 Aug 2019 22:07:03 GMT) Full text and rfc822 format available.

Message #8 received at 37027 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: David Thompson <dthompson2 <at> worcester.edu>
Cc: 37027 <at> debbugs.gnu.org
Subject: Re: [bug#37027] [PATCH] gnu: zlib: Add support for MinGW targets.
Date: Wed, 28 Aug 2019 00:06:26 +0200
Hi David,

David Thompson <dthompson2 <at> worcester.edu> skribis:

> ---
>  gnu/packages/compression.scm | 55 +++++++++++++++++++++++-------------
>  1 file changed, 36 insertions(+), 19 deletions(-)

Please add a commit log.  :-)

> +               `((delete 'configure)
> +                 (add-before 'install 'set-install-paths
> +                             (lambda* (#:key outputs #:allow-other-keys)
> +                               (let ((out (assoc-ref outputs "out")))
> +                                 (setenv "INCLUDE_PATH" (string-append out "/include"))
> +                                 (setenv "LIBRARY_PATH" (string-append out "/lib"))
> +                                 (setenv "BINARY_PATH" (string-append out "/bin"))
> +                                 #t))))
> +               `((replace 'configure
> +                          (lambda* (#:key outputs #:allow-other-keys)

Minor issue: could you adjust indentation to look like:

  (add-before 'x 'y
    (lambda* …

?  guix.el should take care of that.

> -               (with-directory-excursion (string-append out "/lib")
> -                 (install-file "libz.a" (string-append static "/lib"))
> -                 (delete-file "libz.a")
> -                 #t)))))))
> +                    (lambda* (#:key outputs #:allow-other-keys)
> +                      (let ((out (assoc-ref outputs "out"))
> +                            (static (assoc-ref outputs "static")))
> +                        (with-directory-excursion (string-append out "/lib")
> +                                                  (install-file "libz.a" (string-append static "/lib"))

The ‘with-directory-excursion’ indentation went off here.

> +       ,@(if (target-mingw?)
> +             `(#:make-flags
> +               '("-fwin32/Makefile.gcc"
> +                 "SHARED_MODE=1"
> +                 ,(string-append "CC=" (%current-target-system) "-gcc")
> +                 ,(string-append "RC=" (%current-target-system) "-windres")
> +                 ,(string-append "AR=" (%current-target-system) "-ar")))
> +             '())))

I wonder if we could have a single ‘if’:

  (arguments
    (if (target-mingw?)
        …
        ))

?  Thoughts?

Otherwise LGTM, thanks!

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#37027; Package guix-patches. (Sat, 05 Oct 2024 18:01:01 GMT) Full text and rfc822 format available.

Message #11 received at 37027 <at> debbugs.gnu.org (full text, mbox):

From: Kaelyn <kaelyn.alexi <at> protonmail.com>
To: "37027 <at> debbugs.gnu.org" <37027 <at> debbugs.gnu.org>
Subject: [PATCH] gnu: zlib: Add support for MinGW targets.
Date: Sat, 05 Oct 2024 18:00:20 +0000
Hi,

It looks like mingw cross compilation support for zlib was added about two years ago in commit 0565cde6892c4fcc503a86227e366d3500040076. I believe this issue can be closed now, but am not 100% sure if the extra settings of "CC", "RC", and "AR" in the #:make-flags is necessary (and it looks to be the main functional discrepancy between this patch series and commit 0565cde6892c4fcc503a86227e366d3500040076).

Cheers.
Kaelyn




This bug report was last modified 249 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.