guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#37208] [PATCH] gnu: zlib: Add support for MinGW targets.


From: David Thompson
Subject: [bug#37208] [PATCH] gnu: zlib: Add support for MinGW targets.
Date: Wed, 28 Aug 2019 09:05:22 -0400

---
 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 via email to

[Prev in Thread] Current Thread [Next in Thread]