From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id 4IHJM3CKO2esPwAAqHPOHw:P1 (envelope-from ) for ; Mon, 18 Nov 2024 18:41:53 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id 4IHJM3CKO2esPwAAqHPOHw (envelope-from ) for ; Mon, 18 Nov 2024 19:41:52 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b="r88/pTTu"; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=M4p0nfRn; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1731955312; a=rsa-sha256; cv=none; b=rmF7VIH/3YFGmDGc/fftQHHFXOfehBzTp+GgmmkH99kYFlzqQYesUAEBY81gpXw5fBJM8r 1wKlDaKWWD7yLBg558W7gQWra0RCaAyKfJQQ22uYSR49mWk1S6PXpoLEbxAkWswNHD/NHq gEZIHGm7YamINvCCDJCKk+pSn1qoZ/n6A/+4tumqIdDWLtLshG2xPUvTjf0whZGpkBmZ5j FNePbKvRQR4xWWdtVyJS2JxgK4CJjoI3HSxcyuCQwvh06IZVG1UyNCKpZ6B8sG67FmRVaQ vrehL8g6Gx3TR101/9qkuy8V8ByXq3VH4Wja++wkDauBWzSQzXkF5tXek7XpbA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b="r88/pTTu"; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=M4p0nfRn; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1731955312; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=SLxRmMjLaxhi3G4XB27XryHba44rTJRmXOHSvLDt5Ys=; b=p6nu1Jzc6pkF2euieQI82w3h99du10yTVBqMT6hIUSN8EL4hxxRUGNe+NwwX+PiG5ocCo5 8azu6rdHkLFul2ehsvCBKjBax4d5n42/gZDWDsURfkkUjEweFxpMpsoFTFr0YgB+t7g5SQ 0zyPkWcu/Ik3MRohvWEn45Truz0XnBMj1MRnFUjYqFG4iaoqgY7WU7iY1EpfeRI1Z0nJxv Oe4FnV3D79yLAjipfY8mQz8tOT+M1TS0ga7v4XXUGfBzqdSlJjpxKGJcSlSU46lezca9n/ TKkC8wg9ZWYT1x/7Ez8+OzYs9dBwvuxnNAHerh2yp2UZ/S3MkdF07ubrwP9m6A== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 654EA8BC2C for ; Mon, 18 Nov 2024 19:41:51 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tD6gh-0008Sd-Se; Mon, 18 Nov 2024 13:41:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tD6gR-0008PK-TH for guix-patches@gnu.org; Mon, 18 Nov 2024 13:41:14 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD6gI-0004bj-IU for guix-patches@gnu.org; Mon, 18 Nov 2024 13:41:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:Subject; bh=SLxRmMjLaxhi3G4XB27XryHba44rTJRmXOHSvLDt5Ys=; b=r88/pTTum24qmYBMy7bDLhph9eO3mpJdi9QNCJTnNsTpz1TN/D9Cmb5WXm1Z2qpibWszwa5z0rn8Fe6Vkj2/76jrFtjk1sLYwU/EYVq4F+L67ZzHOV8LzALUFNVeVjAHarbhSnRP7BMpPAG650U+llnYfx8cjSlf9oGQN/0uEBi89X2k+4hpcdKCrH9SP4ujTE29BapWIswMEptGMJ7X6Pc+A6MdAUakrlA7Yrh7CMehUhcGv7vHFjv9Lwyb9gY5PHgtqkarMqBny9FigOYH2DVJZJNmnUoqpmEaYmXQQoDLq92wphuk6CXh4FT2RXJbF8J2SXmDLci8p0XyaqttgQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tD6gI-0000SL-2P for guix-patches@gnu.org; Mon, 18 Nov 2024 13:41:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#74421] [PATCH] gnu: zstd: Fix cross-building to mingw32. Resent-From: Efraim Flashner Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 18 Nov 2024 18:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 74421 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 74421@debbugs.gnu.org Cc: Efraim Flashner X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.17319552221691 (code B ref -1); Mon, 18 Nov 2024 18:41:01 +0000 Received: (at submit) by debbugs.gnu.org; 18 Nov 2024 18:40:22 +0000 Received: from localhost ([127.0.0.1]:35135 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tD6fd-0000RD-Cy for submit@debbugs.gnu.org; Mon, 18 Nov 2024 13:40:21 -0500 Received: from lists.gnu.org ([209.51.188.17]:44840) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tD6fY-0000R2-Jy for submit@debbugs.gnu.org; Mon, 18 Nov 2024 13:40:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tD6fY-0008FM-3D for guix-patches@gnu.org; Mon, 18 Nov 2024 13:40:16 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD6fV-0004aR-Tv for guix-patches@gnu.org; Mon, 18 Nov 2024 13:40:15 -0500 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-432d866f70fso141555e9.2 for ; Mon, 18 Nov 2024 10:40:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731955212; x=1732560012; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:from:to:cc:subject:date:message-id:reply-to; bh=SLxRmMjLaxhi3G4XB27XryHba44rTJRmXOHSvLDt5Ys=; b=M4p0nfRnT3T9N9WUvMUKVExHwMkyVjhbtG9cTqkLWCyf9fZ8/q3/hKQKnvDUWTmMTN ycngB/FDPxiekEO7O0Ty5Fgd2YYEuYhrLQFMYtAeBBWxezMtKxPIGLUSljw0g2oVTSAn 8E8C+VVMaCGofIvn1I+F06vC4Zap23NgAHqZxkfg5caKUNdn2RAXgn/W4j65iop5+SG/ axQJQarCL2nARLd055tBzKoR0J2UGWPN4JGJMGcM/RltJpEoEzGHyYTuFNJn9Kdi3jsg 0swUvzsEzo+e7zkbgQGPKhgNSW6NP6X6Atl2Zwf0wWnzpoVGPLRMr3OSGvVLOVCus9wU RIZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731955212; x=1732560012; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=SLxRmMjLaxhi3G4XB27XryHba44rTJRmXOHSvLDt5Ys=; b=GDmMZUrYMG+gI531EASCISs2HJ9eHTgHDzWDML6bJAQTAQISFlyHWT0C2hr13kQ3M1 ZNHmgl77ulf1KqpJJ+W8wIg8gVjicZ/q0uBxBPnbwO7Qegq/T5Tm+wUiLYX1hDBCfSoD bsyamhUw8fEY/ZTmOC6w+UrVvbP5PI/oY30fGxQWe+EEctdxyTYCwXaZ9GtCg0k0vJHO F16GMmDFn+ZKEcKU93DjMPcaiFRvP15x3EkIQIcNRs4g81NB0PRgQOY2xpQnnAV+cRnk rPoTY/xp2Tsg6+CDzyEuGvybjTF5a/SvmRGq9L8eOJN7+bEcav0J1CFSjzjG2YY3AXe1 Jp+A== X-Gm-Message-State: AOJu0YxBiVbHok0cbN25XbfZE+CZ5/HYMOjQFxFQd6rvawzlg5IraMWn x28XUPvZEEIOAMzqk1N3EnpDxml+SkoY+2si/y0bFuZlxQodLlaMqaMvEnAv X-Google-Smtp-Source: AGHT+IE1Pyk+SQO7JVm+/FyfksZF7OM2d/lmxTiKB/wr4x4wKpuP0RLY0HtnFar5kHmfUlVA+emPsA== X-Received: by 2002:a05:600c:1382:b0:431:5d4f:73a3 with SMTP id 5b1f17b1804b1-432df74f0d4mr106263535e9.18.1731955211447; Mon, 18 Nov 2024 10:40:11 -0800 (PST) Received: from localhost ([31.210.180.118]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432da298c97sm167891805e9.40.2024.11.18.10.40.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Nov 2024 10:40:10 -0800 (PST) From: Efraim Flashner Date: Mon, 18 Nov 2024 20:39:59 +0200 Message-ID: <174bb50174a1779a66f95dafd90902288adb440d.1731955075.git.efraim@flashner.co.il> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=efraim.flashner@gmail.com; helo=mail-wm1-x330.google.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -5.41 X-Spam-Score: -5.41 X-Migadu-Queue-Id: 654EA8BC2C X-Migadu-Scanner: mx10.migadu.com X-TUID: Yy2sUE4qrxbW * gnu/packages/compression.scm (zstd)[arguments]: Adjust the custom 'adjust-library-locations phase to have separate logic for targeting mingw32. Adjust the make-flags to add some extra flags when targeting mingw32. Change-Id: Ifd32a6bd9157af93c7338dacc96467e2756b9314 --- I tested this to the best of my ability by using it as an input for ncdu@2.6 on the wip-zig-bootstrap branch and by comparing the outputs to the pre-compiled release tarball for win64 on Github. gnu/packages/compression.scm | 45 ++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/gnu/packages/compression.scm b/gnu/packages/compression.scm index b3eca16191c..fcde956c4f9 100644 --- a/gnu/packages/compression.scm +++ b/gnu/packages/compression.scm @@ -7,7 +7,7 @@ ;;; Copyright © 2015, 2016, 2017, 2018, 2020, 2021, 2022, 2024 Ricardo Wurmus ;;; Copyright © 2015, 2017, 2018 Leo Famulari ;;; Copyright © 2015 Jeff Mickey -;;; Copyright © 2015-2023 Efraim Flashner +;;; Copyright © 2015-2024 Efraim Flashner ;;; Copyright © 2016 Ben Woodcroft ;;; Copyright © 2016 Danny Milosavljevic ;;; Copyright © 2016–2022 Tobias Geerinckx-Rice @@ -1779,24 +1779,45 @@ (define-public zstd (static (assoc-ref outputs "static")) (shared-libs (string-append lib "/lib")) (static-libs (string-append static "/lib"))) - ;; Move the static library to its own output to save ~1MiB. (mkdir-p static-libs) - (for-each (lambda (ar) - (link ar (string-append static-libs "/" - (basename ar))) - (delete-file ar)) - (find-files shared-libs "\\.a$")) + ;; This is based on the win64 release zip file from zstd. + ,@(if (target-mingw?) + `((for-each delete-file (find-files out "\\.so")) + (for-each delete-file (find-files shared-libs "\\.so")) + (rename-file (string-append shared-libs "/libzstd.a") + (string-append static-libs "/libzstd_static.lib")) + (delete-file-recursively + (string-append shared-libs "/pkgconfig")) + ;; no binary for interpreter `sh' found in $PATH + (delete-file (string-append out "/bin/zstdgrep")) + (delete-file (string-append out "/bin/zstdless")) + (delete-file (string-append out "/share/man/man1/zstdgrep.1")) + (delete-file (string-append out "/share/man/man1/zstdless.1"))) + `(;; Move the static library to its own output to save ~1MiB. + (for-each (lambda (ar) + (link ar (string-append static-libs "/" + (basename ar))) + (delete-file ar)) + (find-files shared-libs "\\.a$")) - ;; Make sure the pkg-config file refers to the right output. - (substitute* (string-append shared-libs "/pkgconfig/libzstd.pc") - (("^prefix=.*") - ;; Note: The .pc file expects a trailing slash for 'prefix'. - (string-append "prefix=" lib "/\n"))))))) + ;; Make sure the pkg-config file refers to the right output. + (substitute* (string-append shared-libs "/pkgconfig/libzstd.pc") + (("^prefix=.*") + ;; Note: The .pc file expects a trailing slash for 'prefix'. + (string-append "prefix=" lib "/\n"))))))))) #:make-flags (list ,(string-append "CC=" (cc-for-target)) (string-append "prefix=" (assoc-ref %outputs "out")) (string-append "libdir=" (assoc-ref %outputs "lib") "/lib") (string-append "includedir=" (assoc-ref %outputs "lib") "/include") + ,@(if (target-mingw?) + `(;; See the note in the Makefile. + "TARGET_SYSTEM=Windows" + ;; Don't try to link with pthread. + "THREAD_LD=" + ;; This isn't picked up correctly in the Makefiles. + "EXT=.exe") + '()) ;; Auto-detection is over-engineered and buggy. "PCLIBDIR=lib" "PCINCDIR=include" base-commit: 1affd2b5aa7f5467a44cf757c4fc0c6956d3f3c9 -- Efraim Flashner אפרים פלשנר GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted