all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#37027] [PATCH] gnu: zlib: Add support for MinGW targets.
@ 2019-08-14 12:58 David Thompson
  2019-08-27 22:06 ` Ludovic Courtès
  2024-10-05 18:00 ` [bug#37027] [PATCH] gnu: zlib: Add support for MinGW targets Kaelyn via Guix-patches via
  0 siblings, 2 replies; 5+ messages in thread
From: David Thompson @ 2019-08-14 12:58 UTC (permalink / raw)
  To: 37027

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

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

* [bug#37027] [PATCH] gnu: zlib: Add support for MinGW targets.
  2019-08-14 12:58 [bug#37027] [PATCH] gnu: zlib: Add support for MinGW targets David Thompson
@ 2019-08-27 22:06 ` Ludovic Courtès
  2019-08-28 13:05   ` [bug#37208] " David Thompson
  2024-10-05 18:00 ` [bug#37027] [PATCH] gnu: zlib: Add support for MinGW targets Kaelyn via Guix-patches via
  1 sibling, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2019-08-27 22:06 UTC (permalink / raw)
  To: David Thompson; +Cc: 37027

Hi David,

David Thompson <dthompson2@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’.

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

* [bug#37208] [PATCH] gnu: zlib: Add support for MinGW targets.
  2019-08-27 22:06 ` Ludovic Courtès
@ 2019-08-28 13:05   ` David Thompson
       [not found]     ` <handler.37208.B.15669975368130.ack@debbugs.gnu.org>
  0 siblings, 1 reply; 5+ messages in thread
From: David Thompson @ 2019-08-28 13:05 UTC (permalink / raw)
  To: 37208

---
 gnu/packages/compression.scm | 64 +++++++++++++++++++++++-------------
 1 file changed, 42 insertions(+), 22 deletions(-)

diff --git a/gnu/packages/compression.scm b/gnu/packages/compression.scm
index bda43bfd18..9ca61dda75 100644
--- a/gnu/packages/compression.scm
+++ b/gnu/packages/compression.scm
@@ -85,28 +85,48 @@
     (build-system gnu-build-system)
     (outputs '("out" "static"))
     (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)))))
-         (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)))))))
+     (let ((shared-phase-mod
+            '(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))))))
+       (if (target-mingw?)
+           `(#:phases
+             (modify-phases %standard-phases
+               (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)))
+               ,shared-phase-mod)
+             #: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")))
+           `(#: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)))))
+               ,shared-phase-mod)))))
     (home-page "https://zlib.net/")
     (synopsis "Compression library")
     (description
-- 
2.17.1

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

* bug#37208: Acknowledgement ([PATCH] gnu: zlib: Add support for MinGW targets.)
       [not found]     ` <handler.37208.B.15669975368130.ack@debbugs.gnu.org>
@ 2019-08-28 13:07       ` Thompson, David
  0 siblings, 0 replies; 5+ messages in thread
From: Thompson, David @ 2019-08-28 13:07 UTC (permalink / raw)
  To: 37208-done

Opened in error.

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

* [bug#37027] [PATCH] gnu: zlib: Add support for MinGW targets.
  2019-08-14 12:58 [bug#37027] [PATCH] gnu: zlib: Add support for MinGW targets David Thompson
  2019-08-27 22:06 ` Ludovic Courtès
@ 2024-10-05 18:00 ` Kaelyn via Guix-patches via
  1 sibling, 0 replies; 5+ messages in thread
From: Kaelyn via Guix-patches via @ 2024-10-05 18:00 UTC (permalink / raw)
  To: 37027@debbugs.gnu.org

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




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

end of thread, other threads:[~2024-10-05 18:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-14 12:58 [bug#37027] [PATCH] gnu: zlib: Add support for MinGW targets David Thompson
2019-08-27 22:06 ` Ludovic Courtès
2019-08-28 13:05   ` [bug#37208] " David Thompson
     [not found]     ` <handler.37208.B.15669975368130.ack@debbugs.gnu.org>
2019-08-28 13:07       ` bug#37208: Acknowledgement ([PATCH] gnu: zlib: Add support for MinGW targets.) Thompson, David
2024-10-05 18:00 ` [bug#37027] [PATCH] gnu: zlib: Add support for MinGW targets Kaelyn via Guix-patches via

Code repositories for project(s) associated with this external index

	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.