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

  • Done
  • quality assurance status badge
Details
One participant
  • David Thompson
Owner
unassigned
Submitted by
David Thompson
Severity
normal
D
D
David Thompson wrote on 28 Aug 2019 15:05
(address . guix-patches@gnu.org)(address . ludo@gnu.org)
20190828130522.9469-1-dthompson2@worcester.edu
---
gnu/packages/compression.scm | 64 +++++++++++++++++++++++-------------
1 file changed, 42 insertions(+), 22 deletions(-)

Toggle diff (77 lines)
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
T
T
Thompson, David wrote on 28 Aug 2019 15:07
Re: bug#37208: Acknowledgement ([PATCH] gnu: zlib: Add support for MinGW targets.)
(address . 37208-done@debbugs.gnu.org)
CAJ=RwfagCwJo1w60kT0zUbgXq07WbKB52Zp9Ry6u18dMOngTSg@mail.gmail.com
Opened in error.
Closed
?