From patchwork Tue Jul 12 16:45:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vivien Kraus X-Patchwork-Id: 40632 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 2ECA627BBE9; Tue, 12 Jul 2022 17:46:25 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 32DD327BBEA for ; Tue, 12 Jul 2022 17:46:24 +0100 (BST) Received: from localhost ([::1]:46260 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oBJ1j-0006TR-C4 for patchwork@mira.cbaines.net; Tue, 12 Jul 2022 12:46:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33604) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBJ1R-0006Nj-6k for guix-patches@gnu.org; Tue, 12 Jul 2022 12:46:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:49714) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oBJ1O-0001aX-5A for guix-patches@gnu.org; Tue, 12 Jul 2022 12:46:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oBJ1N-0008TP-V4 for guix-patches@gnu.org; Tue, 12 Jul 2022 12:46:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#56504] [PATCH] Mingw support for zlib Resent-From: Vivien Kraus Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 12 Jul 2022 16:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56504 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Liliana Marie Prikler , 56504@debbugs.gnu.org Received: via spool by 56504-submit@debbugs.gnu.org id=B56504.165764431232503 (code B ref 56504); Tue, 12 Jul 2022 16:46:01 +0000 Received: (at 56504) by debbugs.gnu.org; 12 Jul 2022 16:45:12 +0000 Received: from localhost ([127.0.0.1]:43611 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oBJ0a-0008SA-Fk for submit@debbugs.gnu.org; Tue, 12 Jul 2022 12:45:12 -0400 Received: from planete-kraus.eu ([89.234.140.182]:59370) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oBJ0X-0008Ry-Qk for 56504@debbugs.gnu.org; Tue, 12 Jul 2022 12:45:10 -0400 Received: from planete-kraus.eu (localhost.lan [127.0.0.1]) by planete-kraus.eu (OpenSMTPD) with ESMTP id dd3b4fd0; Tue, 12 Jul 2022 16:45:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=planete-kraus.eu; h= message-id:subject:from:to:date:in-reply-to:references :content-type:mime-version; s=dkim; bh=hF4MSRRhR8pQuAsIHnLkU15fr 7I=; b=MZfpdlzM0FlOzp4CM6JdgH917Gg2/nPU842ntS4aTylub97CV9qGyeeoQ 3fc8CGKMggshqqM4n+9QKPo0u6ReZll5YxSwNGB6oBT44/70xQZq9ukXymbqojX8 uxkpOLCeLpzx7qhYoZdmCI/XomKKDerdc3kT4C3kh+yiev4OPs= Received: by planete-kraus.eu (OpenSMTPD) with ESMTPSA id c97c1ee3 (TLSv1.3:AEAD-CHACHA20-POLY1305-SHA256:256:NO); Tue, 12 Jul 2022 16:45:04 +0000 (UTC) Message-ID: <29fa1e573d51f351796ba22d7344d9738d71c9be.camel@planete-kraus.eu> Date: Tue, 12 Jul 2022 18:45:03 +0200 In-Reply-To: References: <9418154f0a4f8c2b06b1b5bbce8df570ec4028de.camel@planete-kraus.eu> User-Agent: Evolution 3.42.1 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" Reply-to: Vivien Kraus X-ACL-Warn: , Vivien Kraus via Guix-patches X-Patchwork-Original-From: Vivien Kraus via Guix-patches via From: Vivien Kraus X-getmail-retrieved-from-mailbox: Patches 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: > > > +               ,@(if (and (%current-target-system) > > +                          (string-suffix? "-w64-mingw32" > > (%current- > > target-system))) > I'm pretty sure there's an abbreviation for this like target-mingw? Precisely! Fixed it, thank you. > > +                     `((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? > > +                     `((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. Thank you for your review! Vivien From 1ddb567f30f565e951321b80921f27ed7f10f604 Mon Sep 17 00:00:00 2001 From: Vivien Kraus Date: Sat, 25 Jun 2022 16:33:44 +0200 Subject: [PATCH v2] gnu: zlib: Support mingw cross-compilation. * gnu/packages/compression.scm (zlib): Only run configure if not mingw. --- gnu/packages/compression.scm | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/gnu/packages/compression.scm b/gnu/packages/compression.scm index d5bd3abf0f..ea1bc2a03f 100644 --- a/gnu/packages/compression.scm +++ b/gnu/packages/compression.scm @@ -113,7 +113,15 @@ (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") + ''()) + #:phases (modify-phases %standard-phases (replace 'configure (lambda* (#:key outputs #:allow-other-keys) @@ -125,8 +133,13 @@ (define-public zlib ,@(if (%current-target-system) `((setenv "CHOST" ,(%current-target-system))) '()) - (invoke "./configure" - (string-append "--prefix=" out))))) + ,@(if (target-mingw?) + `((substitute* "win32/Makefile.gcc" + (("prefix \\?= /usr/local") + (string-append "prefix ?= " out))) + (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: f0c8abe85787a0018c0adeb0bc4a6672d46686e4 -- 2.36.1