unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Vivien Kraus via Guix-patches via <guix-patches@gnu.org>
To: Liliana Marie Prikler <liliana.prikler@ist.tugraz.at>,
	56504@debbugs.gnu.org
Subject: [bug#56504] [PATCH] Mingw support for zlib
Date: Wed, 13 Jul 2022 17:19:36 +0200	[thread overview]
Message-ID: <d9ac8a144f4a442d4f9d0d6d996dd8962b0c3a8a.camel@planete-kraus.eu> (raw)
In-Reply-To: <c8697df7788f2ad06ed07296f627b59b939cdc01.camel@ist.tugraz.at>

[-- Attachment #1: Type: text/plain, Size: 3112 bytes --]

Le mercredi 13 juillet 2022 à 07:49 +0200, Liliana Marie Prikler a
écrit :
> Am Dienstag, dem 12.07.2022 um 18:45 +0200 schrieb Vivien Kraus:
> > Le mardi 12 juillet 2022 à 08:07 +0200, Liliana Marie Prikler a
> > écrit :
> > > Am Dienstag, dem 12.07.2022 um 01:53 +0200 schrieb Vivien Kraus:
> > > > +                     `((substitute* "win32/Makefile.gcc"
> > > > +                         (("PREFIX =")
> > > > +                          (string-append "PREFIX = "
> > > > ,(%current-
> > > > target-system) "-"))
> > > > +                         (("prefix \\?= /usr/local")
> > > > +                          (string-append "prefix ?= " out))
> > > > +                         (("# BINARY_PATH, INCLUDE_PATH and
> > > > LIBRARY_PATH must be set.")
> > > > +                          "\
> > > > +BINARY_PATH = $(prefix)/bin
> > > > +INCLUDE_PATH = $(prefix)/include
> > > > +LIBRARY_PATH = $(prefix)/lib"))
> > > > +                       (rename-file "win32/Makefile.gcc"
> > > > "Makefile"))
> > > I think these can be conditionally added to #:make-flags
> > I did it for all but prefix, because I have to have the output
> > path.
> > Is there a way to get it from within the make-flags?
> With the gexp-style you'd write #$output, otherwise ,(assoc-ref
> %build-
> outputs "out").
Looking at the "-builder" scheme file that is generated for the
derivation, it looks like what I want is simply %outputs, not %build-
outputs.

> 
> > > > +                     `((invoke "./configure"
> > > > +                               (string-append "--prefix="
> > > > out)))))))
> > > 
> > > > +         ,@(if (and (%current-target-system)
> > > > +                    (string-suffix? "-mingw32" (%current-
> > > > target-
> > > > system)))
> > > > +               `(add-after 'install 'install-mingw-shared
> > > > +                  (lambda* (#:key make-flags #:allow-other-
> > > > keys)
> > > > +                    (apply invoke "make"
> > > > +                           (append make-flags
> > > > +                                   '("install"
> > > > "SHARED_MODE=1")))))
> > > SHARED_MODE might likewise be conditionally added to #:make-
> > > flags.
> > I get both the DLL loader and the DLL in the default output, and
> > the
> > static lib in the static output, so it works.
> Oh, so you mean the static output should be built without
> SHARED_MODE?
No, SHARED_MODE=1 means "please also install the DLL" and SHARED_MODE=0
means "please do not install the DLL". Reading the win32/Makefile.gcc,
nothing special is done if SHARED_MODE=0. It is only used in the
install and uninstall targets. I don’t really understand why you would
want to set SHARED_MODE=0 (even weirder to set it as a default) but I
guess it happens.

[-- Attachment #2: v3-0001-gnu-zlib-Support-mingw-cross-compilation.patch --]
[-- Type: text/x-patch, Size: 2012 bytes --]

From 6991416907cb2b3e8be639c18cecb6bf519da904 Mon Sep 17 00:00:00 2001
From: Vivien Kraus <vivien@planete-kraus.eu>
Date: Sat, 25 Jun 2022 16:33:44 +0200
Subject: [PATCH v3] gnu: zlib: Support mingw cross-compilation.

* gnu/packages/compression.scm (zlib): Only run configure if not mingw.
---
 gnu/packages/compression.scm | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/compression.scm b/gnu/packages/compression.scm
index d5bd3abf0f..871f90656c 100644
--- a/gnu/packages/compression.scm
+++ b/gnu/packages/compression.scm
@@ -113,7 +113,16 @@ (define-public zlib
     (build-system gnu-build-system)
     (outputs '("out" "static"))
     (arguments
-     `(#:phases
+     `(#:make-flags
+       ,(if (target-mingw?)
+            `(list ,(string-append "PREFIX=" (%current-target-system) "-")
+                   "BINARY_PATH = $(prefix)/bin"
+                   "INCLUDE_PATH = $(prefix)/include"
+                   "LIBRARY_PATH = $(prefix)/lib"
+                   "SHARED_MODE = 1"
+                   (string-append "prefix = " (assoc-ref %outputs "out")))
+            ''())
+       #:phases
        (modify-phases %standard-phases
          (replace 'configure
            (lambda* (#:key outputs #:allow-other-keys)
@@ -125,8 +134,10 @@ (define-public zlib
                ,@(if (%current-target-system)
                      `((setenv "CHOST" ,(%current-target-system)))
                      '())
-               (invoke "./configure"
-                       (string-append "--prefix=" out)))))
+               ,@(if (target-mingw?)
+                     `((rename-file "win32/Makefile.gcc" "Makefile"))
+                     `((invoke "./configure"
+                               (string-append "--prefix=" out)))))))
          (add-after 'install 'move-static-library
            (lambda* (#:key outputs #:allow-other-keys)
              (let ((out (assoc-ref outputs "out"))

base-commit: dcf133587ac7d73ba306a314e1a496a7efb9960b
-- 
2.36.1


  reply	other threads:[~2022-07-13 15:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-11 23:53 [bug#56504] [PATCH] Mingw support for zlib Vivien Kraus via Guix-patches via
2022-07-12  6:07 ` Liliana Marie Prikler
2022-07-12 16:45   ` Vivien Kraus via Guix-patches via
2022-07-13  5:49     ` Liliana Marie Prikler
2022-07-13 15:19       ` Vivien Kraus via Guix-patches via [this message]
2022-07-14  6:01         ` Liliana Marie Prikler
2022-07-15 14:28           ` Vivien Kraus via Guix-patches via
2022-07-15 14:30             ` Liliana Marie Prikler
2022-07-19 21:07               ` Ludovic Courtès
2022-07-31 11:21                 ` bug#56504: " Liliana Marie Prikler

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=d9ac8a144f4a442d4f9d0d6d996dd8962b0c3a8a.camel@planete-kraus.eu \
    --to=guix-patches@gnu.org \
    --cc=56504@debbugs.gnu.org \
    --cc=liliana.prikler@ist.tugraz.at \
    --cc=vivien@planete-kraus.eu \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).