all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: David Thompson <dthompson2@worcester.edu>
To: 37208@debbugs.gnu.org
Subject: [bug#37208] [PATCH] gnu: zlib: Add support for MinGW targets.
Date: Wed, 28 Aug 2019 09:05:22 -0400	[thread overview]
Message-ID: <20190828130522.9469-1-dthompson2@worcester.edu> (raw)
In-Reply-To: <87a7bumffh.fsf@gnu.org>

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

  reply	other threads:[~2019-08-28 13:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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   ` David Thompson [this message]
     [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

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

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

  git send-email \
    --in-reply-to=20190828130522.9469-1-dthompson2@worcester.edu \
    --to=dthompson2@worcester.edu \
    --cc=37208@debbugs.gnu.org \
    /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 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.