GNU bug report logs - #60847
[PATCH] Enable cross-compilation for the pyproject-build-system.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Maxim Cournoyer <maxim.cournoyer@HIDDEN>; Keywords: patch; dated Mon, 16 Jan 2023 04:05:02 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at 60847 <at> debbugs.gnu.org:


Received: (at 60847) by debbugs.gnu.org; 6 Mar 2023 22:56:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 06 17:56:18 2023
Received: from localhost ([127.0.0.1]:43914 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pZJkg-0006ql-DH
	for submit <at> debbugs.gnu.org; Mon, 06 Mar 2023 17:56:18 -0500
Received: from mx1.dismail.de ([78.46.223.134]:30687)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jgart@HIDDEN>) id 1pZJke-0006qW-BC
 for 60847 <at> debbugs.gnu.org; Mon, 06 Mar 2023 17:56:16 -0500
Received: from mx1.dismail.de (localhost [127.0.0.1])
 by mx1.dismail.de (OpenSMTPD) with ESMTP id 2b8d7e65;
 Mon, 6 Mar 2023 23:56:09 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=dismail.de; h=
 mime-version:date:content-type:content-transfer-encoding:from
 :message-id:subject:to:cc:in-reply-to:references; s=20190914;
 bh=RkCCTeiNEEmd7lyaUf3JNamarLi6UPMLlXBGJmDjtB0=; b=JGxV9lAtKwkJ
 P9GrmZqgo3/L/6tpROxV2DHYvjdSXTZkqtvqTNtivGI5zlDSA/fBFRU6v20+V0Zs
 gAbZFIG1L+E5mGXsiUakeZOiP3m+zyz+THfvYhcdAMX2eaid9gSkcQarGRWZT5C4
 bPvGXQh5GqSCuS5zuveXx41BF4VcuoIgdtYaNCYLuZcOhuWj2SrVxVbpUolEHcgO
 cP9+CWlE6RLrgDblp4p/e1n83VgZMO6jur3BYZXi6D8JYrXeJb0qcPNOwVlWS/m2
 VcNTUIwhGIwHPdMCiXCUnc7JZe2hoFNCyvSNk7/C4sckzUPm5Erk5UJDmBwGCHty
 OTDEF/o5cQ==
Received: from smtp2.dismail.de (<unknown> [10.240.26.12])
 by mx1.dismail.de (OpenSMTPD) with ESMTP id f29ee94c;
 Mon, 6 Mar 2023 23:56:08 +0100 (CET)
Received: from smtp2.dismail.de (localhost [127.0.0.1])
 by smtp2.dismail.de (OpenSMTPD) with ESMTP id 8b459ca8;
 Mon, 6 Mar 2023 23:56:08 +0100 (CET)
Received: by dismail.de (OpenSMTPD) with ESMTPSA id 0e867246
 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); 
 Mon, 6 Mar 2023 23:56:08 +0100 (CET)
MIME-Version: 1.0
Date: Mon, 06 Mar 2023 22:56:07 +0000
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-Mailer: RainLoop/1.16.0a
From: "jgart" <jgart@HIDDEN>
Message-ID: <6c904311d43b36f146475d8722295270@HIDDEN>
Subject: Re: bug#60847: [PATCH] Enable cross-compilation for the
 pyproject-build-system.
To: "=?utf-8?B?THVkb3ZpYyBDb3VydMOocw==?=" <ludo@HIDDEN>, "Maxim
 Cournoyer" <maxim.cournoyer@HIDDEN>
In-Reply-To: <87zg8p7qvw.fsf_-_@HIDDEN>
References: <87zg8p7qvw.fsf_-_@HIDDEN>
 <20230123133217.318-1-maxim.cournoyer@HIDDEN>
 <20230123133217.318-2-maxim.cournoyer@HIDDEN>
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 60847
Cc: Josselin Poiret <dev@HIDDEN>, Christopher Baines <mail@HIDDEN>,
 Simon Tournier <zimon.toutoune@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>,
 60847 <at> debbugs.gnu.org, Tobias 
 Geerinckx-Rice <me@HIDDEN>, Lars-Dominik Braun <lars@HIDDEN>,
 Ricardo Wurmus <rekado@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Hi Ludo,

> I understand there=E2=80=99s an actual bug to fix ...

Is the bug you are referencing exist as an open ticket somewhere on our t=
racker?=20

Just=20trying to get more context on that if it does.

all best,

jgart




Information forwarded to guix-patches@HIDDEN:
bug#60847; Package guix-patches. Full text available.

Message received at 60847 <at> debbugs.gnu.org:


Received: (at 60847) by debbugs.gnu.org; 6 Mar 2023 17:04:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 06 12:04:50 2023
Received: from localhost ([127.0.0.1]:43515 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pZEGX-0006Bd-Ox
	for submit <at> debbugs.gnu.org; Mon, 06 Mar 2023 12:04:49 -0500
Received: from eggs.gnu.org ([209.51.188.92]:53108)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1pZEGW-0006BR-JS
 for 60847 <at> debbugs.gnu.org; Mon, 06 Mar 2023 12:04:49 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1pZEGQ-0002cG-PW; Mon, 06 Mar 2023 12:04:42 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To:
 From; bh=4HyrjNlKU/X046YF+Kbdn7btcX1CPUo0/R9EZoZuGGA=; b=H14vT1+dWkU7t3j8zzdO
 Scy5yjT1cSdjdmU1hL9nPJTd6w9mdfpN4jCZU1zoQ0x9hEc/xPNUFmTdh+Jtd667LRCNG/d3c/Mcr
 F2wt+741xsoO1y1naYRlsd2ioHrzgRZhIlFVjeqN3Z3zmBMeXWOyJL+P7IlJEOR5hubW08WJtKmyq
 oCq0cLkgtKCu7bdqhQsu0P3/cx3WOLo0jwCB4kZ7a9uLLe2BLtDMu9p9l2fVChUj4YHCXy32PqfNc
 MpBaNhBxXHbJZ4J2E8giYhFPRGc7uSXXQ7zW1Ym2dw8hDruBJY+RBsSI22tCzuwaYbBCcXnYs0wNh
 jWsDJXsAuBDWyQ==;
Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1pZEGN-0005Ou-FI; Mon, 06 Mar 2023 12:04:40 -0500
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Subject: Re: bug#60847: [PATCH] Enable cross-compilation for the
 pyproject-build-system.
References: <20230123133217.318-1-maxim.cournoyer@HIDDEN>
 <20230123133217.318-2-maxim.cournoyer@HIDDEN>
Date: Mon, 06 Mar 2023 18:04:35 +0100
In-Reply-To: <20230123133217.318-2-maxim.cournoyer@HIDDEN> (Maxim
 Cournoyer's message of "Mon, 23 Jan 2023 08:32:16 -0500")
Message-ID: <87zg8p7qvw.fsf_-_@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 60847
Cc: Josselin Poiret <dev@HIDDEN>, Christopher Baines <mail@HIDDEN>,
 Simon Tournier <zimon.toutoune@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>,
 60847 <at> debbugs.gnu.org, Tobias Geerinckx-Rice <me@HIDDEN>,
 Lars-Dominik Braun <lars@HIDDEN>, Ricardo Wurmus <rekado@HIDDEN>,
 jgart <jgart@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hello,

Maxim Cournoyer <maxim.cournoyer@HIDDEN> skribis:

> +++ b/guix/packages.scm
> @@ -1864,28 +1864,30 @@ (define* (bag->derivation bag #:optional context)

[=E2=80=A6]

> +  (let ((builder-name (procedure-name (bag-build bag))))
> +    (if (or (bag-target bag)
> +            (eq? 'pyproject-build builder-name))
> +        (bag->cross-derivation bag)

This one part is a showstopper to me, for two reasons:

  1. We cannot rely on =E2=80=98procedure-name=E2=80=99 (it=E2=80=99s a deb=
ugging aid and it=E2=80=99s
     not guaranteed to return something useful).

  2. Special-casing build systems here is not okay: the bag and build
     system abstractions exist to maintain separation of concerns.

I understand there=E2=80=99s an actual bug to fix and the desire to fix a m=
ore
common issue, but I think this one approach is not the way forward.

I hope that makes sense!

Ludo=E2=80=99.




Information forwarded to guix-patches@HIDDEN:
bug#60847; Package guix-patches. Full text available.

Message received at 60847 <at> debbugs.gnu.org:


Received: (at 60847) by debbugs.gnu.org; 24 Jan 2023 02:05:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 23 21:05:22 2023
Received: from localhost ([127.0.0.1]:55657 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pK8gc-0000sH-7C
	for submit <at> debbugs.gnu.org; Mon, 23 Jan 2023 21:05:22 -0500
Received: from mx1.dismail.de ([78.46.223.134]:28807)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jgart@HIDDEN>) id 1pK8ga-0000s0-FL
 for 60847 <at> debbugs.gnu.org; Mon, 23 Jan 2023 21:05:21 -0500
Received: from mx1.dismail.de (localhost [127.0.0.1])
 by mx1.dismail.de (OpenSMTPD) with ESMTP id e1d02547;
 Tue, 24 Jan 2023 03:05:12 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=dismail.de; h=
 mime-version:date:content-type:content-transfer-encoding:from
 :message-id:subject:to:cc:in-reply-to:references; s=20190914;
 bh=TYXFnsit223VV681AR2gzqNHJekRiYbNJGAD5nIuAlM=; b=QqiW870huh62
 bNlCN14V0J/LuXTn9BH1lSwqCoxSjIQWR6xhzJDl3XNjJEk301dQpvVIDx/gqIxl
 xVs6CdrMd0G0qkTzaFI1LeetcrpV4LmIW698J7EUehLBt6czXGSbWMXWva1qT9vF
 VvXrc7byw7mZ6gVs6LkR1EBrpKEHncy19FU+x15SkEURw8FGJdareMDMLJGdwEsf
 NNZgJ9P6YDV/WQUj4Dmip54celbonwlJSpSy+XTFNAHvje4d2SmJmU8bNXrW7yUv
 BEjzq67f8equ1l+GMzPG/wv3775b/fikY5U9T0viAaiZ66No03nve2kY36ieFaIC
 OpoEeNud1g==
Received: from smtp2.dismail.de (<unknown> [10.240.26.12])
 by mx1.dismail.de (OpenSMTPD) with ESMTP id d74e0c13;
 Tue, 24 Jan 2023 03:05:12 +0100 (CET)
Received: from smtp2.dismail.de (localhost [127.0.0.1])
 by smtp2.dismail.de (OpenSMTPD) with ESMTP id 0c82e315;
 Tue, 24 Jan 2023 03:05:12 +0100 (CET)
Received: by dismail.de (OpenSMTPD) with ESMTPSA id bb90babb
 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); 
 Tue, 24 Jan 2023 03:05:11 +0100 (CET)
MIME-Version: 1.0
Date: Tue, 24 Jan 2023 02:05:11 +0000
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-Mailer: RainLoop/1.16.0a
From: "jgart" <jgart@HIDDEN>
Message-ID: <065abd9e926ff892b97b45662685943e@HIDDEN>
Subject: Re: [PATCH v2 1/1] build: Enable cross-compilation for
 pyproject-build-system.
To: "Maxim Cournoyer" <maxim.cournoyer@HIDDEN>, 60847 <at> debbugs.gnu.org
In-Reply-To: <20230123133217.318-2-maxim.cournoyer@HIDDEN>
References: <20230123133217.318-2-maxim.cournoyer@HIDDEN>
 <20230123133217.318-1-maxim.cournoyer@HIDDEN>
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 60847
Cc: Josselin Poiret <dev@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN>,
 Simon Tournier <zimon.toutoune@HIDDEN>, Mathieu
 Othacehe <othacehe@HIDDEN>, ludo@HIDDEN,
 Christopher Baines <mail@HIDDEN>, Lars-Dominik Braun <lars@HIDDEN>,
 Ricardo Wurmus <rekado@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Hi Maxim,

Sorry, This week is still too busy for me with work to review this. Looki=
ng forward to reviewing future patches or these if still needed.

all best,

jgart




Information forwarded to guix-patches@HIDDEN:
bug#60847; Package guix-patches. Full text available.

Message received at 60847 <at> debbugs.gnu.org:


Received: (at 60847) by debbugs.gnu.org; 23 Jan 2023 13:32:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 23 08:32:44 2023
Received: from localhost ([127.0.0.1]:53658 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pJwwF-0000og-Ia
	for submit <at> debbugs.gnu.org; Mon, 23 Jan 2023 08:32:44 -0500
Received: from mail-yb1-f172.google.com ([209.85.219.172]:43783)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maxim.cournoyer@HIDDEN>) id 1pJwwC-0000oH-Cj
 for 60847 <at> debbugs.gnu.org; Mon, 23 Jan 2023 08:32:41 -0500
Received: by mail-yb1-f172.google.com with SMTP id 203so14722344yby.10
 for <60847 <at> debbugs.gnu.org>; Mon, 23 Jan 2023 05:32:40 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=nFj2fNRl7xo3quMdxjde7HXLuvLMdVx8PwgtKf3EIkE=;
 b=KUH9SkXabC3sEpLy/VFLD6fogHhie/ievvChIl7lc5pGg/iFlxWfwtv3B23z3E3U20
 tU8+sTspReybOY+uAwIsAJfLiQCxPunV01MvuzBDP9B4B320/56hjMBQIlKbF80DbBdB
 XO7v1nJk0WBpBRp7FAa93/oLQ+s1R2MKNhYk1JYEQ8+sKp65hg+rrnoW5gwQrR6Eu3Ym
 v6k/+CO+bd06FdizvVSL0rmpUodcmUR1lcp17QpdqmToxfFZLdNRL5mk7IgTvRrIhcy9
 kG2R2WTLopBgH1ROUZI+WkTF0UG71Ykg6rK7HnvsJtEkOPxGhxZodQp3WgupDn8CgEW/
 7ylA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=nFj2fNRl7xo3quMdxjde7HXLuvLMdVx8PwgtKf3EIkE=;
 b=TYdI08SST/Idtn3CkRZW5H0TnUfMLdwPiKsoOIxUBbhNwskrKDu+tcHuBueQ5RQNEh
 NhifsmV9Am5/xQwVxUXARINv7wzreqYM/wKSFm/n3N5jYY0joJQ/Ty9xbQcoeEhGwR5E
 +8geyCFKVCn4M050Bg0jq3JgyBMbcVr3dumUJ8o4968l9VC3UzDaNvOvYzzx1j3WiVio
 VTvJrocGodFkeBtHTw58jVXOTvCaVYtxcN8dvDo3sZEuVDYdo3QaqesLIWIiwBaeF/vD
 6zd3y6fgneT0bQBjzIkAxljVFWp95FINmcvK64Z0WyV9VivyxcgIsG/sQyLJL7ZXtXpX
 eEhw==
X-Gm-Message-State: AFqh2kpQqBD7+YP+ONH/ImqDMLHfzZo32zOapeg+hSAmPxIX4Gf/ZWLN
 3m3ugR2hhLtrV2CgNNlX71z/g1CxuKwKkgDO
X-Google-Smtp-Source: AMrXdXsD4fXJGc7iA6L7W6LhKZr2tLndAHl0YGYJmpcE8M8Dck/CYorUoOM2w83UngGy7K2KRTmY1Q==
X-Received: by 2002:a25:d683:0:b0:802:5b06:4d1f with SMTP id
 n125-20020a25d683000000b008025b064d1fmr5773007ybg.17.1674480754384; 
 Mon, 23 Jan 2023 05:32:34 -0800 (PST)
Received: from localhost.localdomain ([2607:fad8:4:3::1001])
 by smtp.gmail.com with ESMTPSA id
 h4-20020a05620a244400b00706adbdf8b8sm11718274qkn.83.2023.01.23.05.32.33
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 23 Jan 2023 05:32:34 -0800 (PST)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: 60847 <at> debbugs.gnu.org
Subject: [PATCH v2 1/1] build: Enable cross-compilation for
 pyproject-build-system.
Date: Mon, 23 Jan 2023 08:32:16 -0500
Message-Id: <20230123133217.318-2-maxim.cournoyer@HIDDEN>
X-Mailer: git-send-email 2.39.1
In-Reply-To: <20230123133217.318-1-maxim.cournoyer@HIDDEN>
References: <20230123133217.318-1-maxim.cournoyer@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: 3.0 (+++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview: * guix/build-system/pyproject.scm (lower): Do not return #f
 when TARGET is set. Add the target field. Separate build-inputs from
 target-inputs, 
 and extend these with the standard-packages or standard- [...] 
 Content analysis details:   (3.0 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 3.0 MANY_TO_CC             Sent to 10+ recipients
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (maxim.cournoyer[at]gmail.com)
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.0 SPF_PASS               SPF: sender matches SPF record
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
 [209.85.219.172 listed in wl.mailspike.net]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [209.85.219.172 listed in list.dnswl.org]
X-Debbugs-Envelope-To: 60847
Cc: Josselin Poiret <dev@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN>,
 Maxim Cournoyer <maxim.cournoyer@HIDDEN>,
 Simon Tournier <zimon.toutoune@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>,
 ludo@HIDDEN, Christopher Baines <mail@HIDDEN>,
 Lars-Dominik Braun <lars@HIDDEN>, Ricardo Wurmus <rekado@HIDDEN>,
 jgart <jgart@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 2.0 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  * guix/build-system/pyproject.scm (lower): Do not return #f
    when TARGET is set. Add the target field. Separate build-inputs from target-inputs,
    and extend these with the standard-packages or standard- [...] 
 
 Content analysis details:   (2.0 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
                             [209.85.219.172 listed in wl.mailspike.net]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
                              no trust
                             [209.85.219.172 listed in list.dnswl.org]
  3.0 MANY_TO_CC             Sent to 10+ recipients
  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
                             provider (maxim.cournoyer[at]gmail.com)
  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.0 SPF_PASS               SPF: sender matches SPF record
 -1.0 MAILING_LIST_MULTI     Multiple indicators imply a widely-seen list
                             manager

* guix/build-system/pyproject.scm (lower): Do not return #f when TARGET is
set.  Add the target field.  Separate build-inputs from target-inputs, and
extend these with the standard-packages or standard-cross-packages procedures.
(pyproject-build): Add the target, build-inputs, target-inputs, host-inputs
and native-search-paths arguments.  Remove the inputs argument.  Adjust doc.
Adjust the call to the build-side pyproject-build procedure.  Always pass the
target to the gexp->derivation call.
* guix/packages.scm (bag->derivation): Special case the pyproject-build
builder to always use cross-derivation bags
* guix/build/pyproject-build-system.scm (set-paths): New procedure, overriding
that provided by gnu-build-system.
(check) [TARGET]: New argument.  Disable the phase when it is set.
(install): Adjust to look for Python in the native-inputs instead of inputs.
(compile-bytecode): Likewise.
(create-entrypoints): Likewise.
(set-setuptools-env): New procedure.
(sanity-check): Adjust to look for Python in the native-inputs instead of
inputs.
(add-install-to-pythonpath, wrap, rename-pth-file): Likewise.
(%standard-phases): Override set-paths, add-install-to-pythonpath, wrap,
sanity-check and rename-pth-file.  Register set-setuptools-env.

---

Changes in v2:
- Rebase

 guix/build-system/pyproject.scm       | 115 ++++++++++++++---------
 guix/build/pyproject-build-system.scm | 126 +++++++++++++++++++++++---
 guix/packages.scm                     |  46 +++++-----
 3 files changed, 210 insertions(+), 77 deletions(-)

diff --git a/guix/build-system/pyproject.scm b/guix/build-system/pyproject.scm
index 8f3b562ca3..74d739023f 100644
--- a/guix/build-system/pyproject.scm
+++ b/guix/build-system/pyproject.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2021 Lars-Dominik Braun <lars@HIDDEN>
 ;;; Copyright © 2022 Marius Bakke <marius@HIDDEN>
+;;; Copyright © 2023 Maxim Cournoyer <maxim.cournoyer@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -69,28 +70,37 @@ (define* (lower name
                 #:rest arguments)
   "Return a bag for NAME."
   (define private-keywords
-    '(#:target #:python #:inputs #:native-inputs))
-
-  (and (not target)                               ;XXX: no cross-compilation
-       (bag
-         (name name)
-         (system system)
-         (host-inputs `(,@(if source
-                              `(("source" ,source))
-                              '())
-                        ,@inputs
-
-                        ;; Keep the standard inputs of 'gnu-build-system'.
-                        ,@(standard-packages)))
-         (build-inputs `(("python" ,python)
-                         ("sanity-check.py" ,(local-file sanity-check.py))
-                         ,@native-inputs))
-         (outputs (append outputs '(wheel)))
-         (build pyproject-build)
-         (arguments (strip-keyword-arguments private-keywords arguments)))))
-
-(define* (pyproject-build name inputs
-                          #:key source
+    `(#:python #:inputs #:native-inputs
+      ,@(if target '() '(#:target))))
+
+  (bag
+    (name name)
+    (system system)
+    (target target)
+    (build-inputs `(,@(if source
+                          `(("source" ,source))
+                          '())
+                    ("python" ,python)
+                    ("sanity-check.py" ,(local-file sanity-check.py))
+                    ,@native-inputs
+                    ,@(if target
+                          (standard-cross-packages target 'host)
+                          '())
+                    ;; Keep the standard inputs of 'gnu-build-system'.
+                    ,@(standard-packages)))
+    (host-inputs inputs)
+    (target-inputs (if target
+                       (standard-cross-packages target 'target)
+                       '()))
+    (outputs (append outputs '(wheel)))
+    (build pyproject-build)
+    (arguments (strip-keyword-arguments private-keywords arguments))))
+
+(define* (pyproject-build name
+                          #:key
+                          target
+                          build-inputs target-inputs host-inputs
+                          source
                           (tests? #t)
                           (configure-flags ''())
                           (build-backend #f)
@@ -98,44 +108,63 @@ (define* (pyproject-build name inputs
                           (test-flags ''())
                           (phases '%standard-phases)
                           (outputs '("out" "wheel"))
+                          (native-search-paths '())
                           (search-paths '())
                           (system (%current-system))
                           (guile #f)
                           (imported-modules %pyproject-build-system-modules)
                           (modules '((guix build pyproject-build-system)
                                      (guix build utils))))
-  "Build SOURCE using PYTHON, and with INPUTS."
+  "Build SOURCE using PYTHON, and with BUILD-INPUTS, HOST-INPUTS and
+TARGET-INPUTS (if available)."
   (define build
     (with-imported-modules imported-modules
       #~(begin
           (use-modules #$@(sexp->gexp modules))
 
-          #$(with-build-variables inputs outputs
-              #~(pyproject-build
-                 #:name #$name
-                 #:source #+source
-                 #:configure-flags #$configure-flags
-                 #:system #$system
-                 #:build-backend #$build-backend
-                 #:test-backend #$test-backend
-                 #:test-flags #$test-flags
-                 #:tests? #$tests?
-                 #:phases #$(if (pair? phases)
-                                (sexp->gexp phases)
-                                phases)
-                 #:outputs %outputs
-                 #:search-paths '#$(sexp->gexp
-                                    (map search-path-specification->sexp
-                                         search-paths))
-                 #:inputs %build-inputs)))))
+          (define %build-host-inputs
+            #+(input-tuples->gexp build-inputs))
+
+          (define %build-target-inputs
+            (append #$(input-tuples->gexp host-inputs)
+                    #+(input-tuples->gexp target-inputs)))
+
+          (define %build-inputs
+            (append %build-host-inputs %build-target-inputs))
+
+          (define %outputs
+            #$(outputs->gexp outputs))
 
+          (pyproject-build #:name #$name
+                           #:source #+source
+                           #:configure-flags #$configure-flags
+                           #:system #$system
+                           #:target #$target
+                           #:build-backend #$build-backend
+                           #:test-backend #$test-backend
+                           #:test-flags #$test-flags
+                           #:tests? #$tests?
+                           #:phases #$(if (pair? phases)
+                                          (sexp->gexp phases)
+                                          phases)
+                           #:outputs %outputs
+                           #:search-paths
+                           '#$(sexp->gexp
+                               (map search-path-specification->sexp
+                                    search-paths))
+                           #:native-search-paths
+                           '#$(sexp->gexp
+                               (map search-path-specification->sexp
+                                    native-search-paths))
+                           #:native-inputs %build-host-inputs
+                           #:inputs %build-target-inputs))))
 
   (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
                                                   system #:graft? #f)))
     (gexp->derivation name build
                       #:system system
-                      #:graft? #f                 ;consistent with 'gnu-build'
-                      #:target #f
+                      #:target target
+                      #:graft? #f       ;consistent with 'gnu-build'
                       #:guile-for-build guile)))
 
 (define pyproject-build-system
diff --git a/guix/build/pyproject-build-system.scm b/guix/build/pyproject-build-system.scm
index c69ccc9d64..e51b5cfc43 100644
--- a/guix/build/pyproject-build-system.scm
+++ b/guix/build/pyproject-build-system.scm
@@ -86,6 +86,58 @@ (define-condition-type &cannot-extract-multiple-wheels &python-build-error
 ;; Raised, when no wheel has been built by the build system.
 (define-condition-type &no-wheels-built &python-build-error no-wheels-built?)
 
+;;; XXX: This is the same as in (guix build gnu-build-system), except adjusted
+;;; for the fact that native-inputs always exist now, whether cross-compiling
+;;; or not.  When not cross-compiling, input-directories are appended to
+;;; native-input-directories to so that native-search-paths are computed for
+;;; all inputs.
+(define* (set-paths #:key target inputs native-inputs
+                    search-paths native-search-paths
+                    #:allow-other-keys)
+  (define input-directories
+    ;; The "source" input can be a directory, but we don't want it for search
+    ;; paths.  See <https://issues.guix.gnu.org/44924>.
+    (match (alist-delete "source" inputs)
+      (((_ . dir) ...)
+       dir)))
+
+  (define native-input-directories
+    (match (alist-delete "source" native-inputs)
+      (((_ . dir) ...)
+       dir)))
+
+  ;; Tell 'ld-wrapper' to disallow non-store libraries.
+  (setenv "GUIX_LD_WRAPPER_ALLOW_IMPURITIES" "no")
+
+  ;; When cross building, $PATH must refer only to native (host) inputs since
+  ;; target inputs are not executable.
+  (set-path-environment-variable "PATH" '("bin" "sbin")
+                                 (append native-input-directories
+                                         (if target
+                                             '()
+                                             input-directories)))
+
+  (for-each (match-lambda
+              ((env-var (files ...) separator type pattern)
+               (set-path-environment-variable env-var files
+                                              input-directories
+                                              #:separator separator
+                                              #:type type
+                                              #:pattern pattern)))
+            search-paths)
+
+  (for-each (match-lambda
+              ((env-var (files ...) separator type pattern)
+               (set-path-environment-variable env-var files
+                                              (append native-input-directories
+                                                      (if target
+                                                          '()
+                                                          input-directories))
+                                              #:separator separator
+                                              #:type type
+                                              #:pattern pattern)))
+            native-search-paths))
+
 (define* (build #:key outputs build-backend configure-flags #:allow-other-keys)
   "Build a given Python package."
 
@@ -135,9 +187,9 @@ (define (pyproject.toml->build-backend file)
      wheel-dir
      config-settings)))
 
-(define* (check #:key tests? test-backend test-flags #:allow-other-keys)
+(define* (check #:key target tests? test-backend test-flags #:allow-other-keys)
   "Run the test suite of a given Python package."
-  (if tests?
+  (if (and tests? (not target))
       ;; Unfortunately with PEP 517 there is no common method to specify test
       ;; systems.  Guess test system based on inputs instead.
       (let* ((pytest (which "pytest"))
@@ -172,11 +224,11 @@ (define* (check #:key tests? test-backend test-flags #:allow-other-keys)
           (else (raise (condition (&test-system-not-found))))))
       (format #t "test suite not run~%")))
 
-(define* (install #:key inputs outputs #:allow-other-keys)
+(define* (install #:key native-inputs outputs #:allow-other-keys)
   "Install a wheel file according to PEP 427"
   ;; See https://www.python.org/dev/peps/pep-0427/#installing-a-wheel-distribution-1-0-py32-none-any-whl
-  (let ((site-dir (site-packages inputs outputs))
-        (python (assoc-ref inputs "python"))
+  (let ((site-dir (site-packages native-inputs outputs))
+        (python (assoc-ref native-inputs "python"))
         (out (assoc-ref outputs "out")))
     (define (extract file)
       "Extract wheel (ZIP file) into site-packages directory"
@@ -262,10 +314,10 @@ (define (list-directories base predicate)
                   (expand-data-directory directory)
                   (rmdir directory)) datadirs))))
 
-(define* (compile-bytecode #:key inputs outputs #:allow-other-keys)
+(define* (compile-bytecode #:key native-inputs outputs #:allow-other-keys)
   "Compile installed byte-code in site-packages."
-  (let* ((site-dir (site-packages inputs outputs))
-         (python (assoc-ref inputs "python"))
+  (let* ((site-dir (site-packages native-inputs outputs))
+         (python (assoc-ref native-inputs "python"))
          (major-minor (map string->number
                            (take (string-split (python-version python) #\.) 2)))
          (<3.7? (match major-minor
@@ -281,7 +333,7 @@ (define* (compile-bytecode #:key inputs outputs #:allow-other-keys)
         (invoke "python" "-m" "compileall"
                 "--invalidation-mode=unchecked-hash" site-dir))))
 
-(define* (create-entrypoints #:key inputs outputs #:allow-other-keys)
+(define* (create-entrypoints #:key native-inputs outputs #:allow-other-keys)
   "Implement Entry Points Specification
 (https://packaging.python.org/specifications/entry-points/) by PyPa,
 which creates runnable scripts in bin/ from entry point specification
@@ -337,8 +389,7 @@ (define (create-script path name module function)
 import ~a as mod
 sys.exit (mod.~a ())~%" interpreter module function)))
         (chmod file-path #o755)))
-
-  (let* ((site-dir (site-packages inputs outputs))
+  (let* ((site-dir (site-packages native-inputs outputs))
          (out (assoc-ref outputs "out"))
          (bin-dir (string-append out "/bin"))
          (entry-point-files (find-files site-dir "^entry_points.txt$")))
@@ -358,6 +409,51 @@ (define* (set-SOURCE-DATE-EPOCH* #:rest _)
   ;; not support timestamps before 1980.
   (setenv "SOURCE_DATE_EPOCH" "315619200"))
 
+(define* (set-setuptools-env #:key target #:allow-other-keys)
+  "Set environment variables such as LDSHARED, LDXXSHARED, etc. used by
+setuptools when building native extensions.  This is particularly useful for
+cross-compilation."
+  (define cc-for-target (if target
+                            (string-append target "-gcc")
+                            "gcc"))
+  (define cxx-for-target (if target
+                             (string-append target "-g++")
+                             "g++"))
+  ;; The variables defined here are taken from CPython's configure.ac file.
+  ;; The explanations are those of the Poky (from Yocto) project.
+  (setenv "CC" cc-for-target)
+  (setenv "CXX" cxx-for-target)
+  ;; LDSHARED is the ld *command* used to create shared library.
+  (setenv "LDSHARED" (string-append cc-for-target " -shared"))
+  ;; LDXXSHARED is the ld *command* used to create shared library of C++
+  ;; objects.
+  (setenv "LDCXXSHARED" (string-append cxx-for-target " -shared"))
+  ;; CCSHARED are the C *flags* used to create objects to go into a shared
+  ;; library (module).
+  (setenv "CCSHARED" "-fPIC")
+  ;; LINKFORSHARED are the flags passed to the $(CC) command that links the
+  ;; python executable.
+  (setenv "LINKFORSHARED" "-Xlinker -export-dynamic"))
+
+(define* (sanity-check #:key tests? native-inputs outputs #:allow-other-keys
+                       #:rest args)
+  (apply (assoc-ref python:%standard-phases 'sanity-check)
+         (append args (list #:inputs native-inputs))))
+
+(define* (add-install-to-pythonpath #:key native-inputs outputs
+                                    #:allow-other-keys)
+  "A phase that just wraps the 'add-installed-pythonpath' procedure."
+  (add-installed-pythonpath native-inputs outputs))
+
+(define* (wrap #:key native-inputs outputs #:allow-other-keys #:rest args)
+  (apply (assoc-ref python:%standard-phases 'wrap)
+         (append args (list #:inputs native-inputs))))
+
+(define* (rename-pth-file #:key name native-inputs outputs #:allow-other-keys
+                          #:rest args)
+  (apply (assoc-ref python:%standard-phases 'rename-pth-file)
+         (append args (list #:inputs native-inputs))))
+
 (define %standard-phases
   ;; The build phase only builds C extensions and copies the Python sources,
   ;; while the install phase copies then byte-compiles the sources to the
@@ -365,13 +461,19 @@ (define %standard-phases
   ;; to ease testing the built package.
   (modify-phases python:%standard-phases
     (replace 'set-SOURCE-DATE-EPOCH set-SOURCE-DATE-EPOCH*)
+    (replace 'set-paths set-paths)
+    (add-after 'set-paths 'set-setuptools-env set-setuptools-env)
     (replace 'build build)
     (replace 'install install)
+    (replace 'add-install-to-pythonpath add-install-to-pythonpath)
+    (replace 'wrap wrap)
     (delete 'check)
     ;; Must be before tests, so they can use installed packages’ entry points.
     (add-before 'wrap 'create-entrypoints create-entrypoints)
     (add-after 'wrap 'check check)
-    (add-before 'check 'compile-bytecode compile-bytecode)))
+    (add-before 'check 'compile-bytecode compile-bytecode)
+    (replace 'sanity-check sanity-check)
+    (replace 'rename-pth-file rename-pth-file)))
 
 (define* (pyproject-build #:key inputs (phases %standard-phases)
                           #:allow-other-keys #:rest args)
diff --git a/guix/packages.scm b/guix/packages.scm
index 041a872f9d..6d7df17fc3 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -1864,28 +1864,30 @@ (define* (bag->derivation bag #:optional context)
   "Return the derivation to build BAG for SYSTEM.  Optionally, CONTEXT can be
 a package object describing the context in which the call occurs, for improved
 error reporting."
-  (if (bag-target bag)
-      (bag->cross-derivation bag)
-      (mlet* %store-monad ((system ->  (bag-system bag))
-                           (inputs ->  (bag-transitive-inputs bag))
-                           (input-drvs (mapm %store-monad
-                                             (cut expand-input context <> system)
-                                             inputs))
-                           (paths ->   (delete-duplicates
-                                        (append-map (match-lambda
-                                                      ((_ (? package? p) _ ...)
-                                                       (package-native-search-paths
-                                                        p))
-                                                      (_ '()))
-                                                    inputs))))
-        ;; It's possible that INPUTS contains packages that are not 'eq?' but
-        ;; that lead to the same derivation.  Delete those duplicates to avoid
-        ;; issues down the road, such as duplicate entries in '%build-inputs'.
-        (apply (bag-build bag) (bag-name bag)
-               (delete-duplicates input-drvs input=?)
-               #:search-paths paths
-               #:outputs (bag-outputs bag) #:system system
-               (bag-arguments bag)))))
+  (let ((builder-name (procedure-name (bag-build bag))))
+    (if (or (bag-target bag)
+            (eq? 'pyproject-build builder-name))
+        (bag->cross-derivation bag)
+        (mlet* %store-monad ((system ->  (bag-system bag))
+                             (inputs ->  (bag-transitive-inputs bag))
+                             (input-drvs (mapm %store-monad
+                                               (cut expand-input context <> system)
+                                               inputs))
+                             (paths ->   (delete-duplicates
+                                          (append-map (match-lambda
+                                                        ((_ (? package? p) _ ...)
+                                                         (package-native-search-paths
+                                                          p))
+                                                        (_ '()))
+                                                      inputs))))
+          ;; It's possible that INPUTS contains packages that are not 'eq?' but
+          ;; that lead to the same derivation.  Delete those duplicates to avoid
+          ;; issues down the road, such as duplicate entries in '%build-inputs'.
+          (apply (bag-build bag) (bag-name bag)
+                 (delete-duplicates input-drvs input=?)
+                 #:search-paths paths
+                 #:outputs (bag-outputs bag) #:system system
+                 (bag-arguments bag))))))
 
 (define* (bag->cross-derivation bag #:optional context)
   "Return the derivation to build BAG, which is actually a cross build.
-- 
2.39.1





Information forwarded to guix-patches@HIDDEN:
bug#60847; Package guix-patches. Full text available.

Message received at 60847 <at> debbugs.gnu.org:


Received: (at 60847) by debbugs.gnu.org; 23 Jan 2023 13:32:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 23 08:32:37 2023
Received: from localhost ([127.0.0.1]:53655 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pJww9-0000oO-8r
	for submit <at> debbugs.gnu.org; Mon, 23 Jan 2023 08:32:37 -0500
Received: from mail-yb1-f170.google.com ([209.85.219.170]:39710)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maxim.cournoyer@HIDDEN>) id 1pJww7-0000oA-9a
 for 60847 <at> debbugs.gnu.org; Mon, 23 Jan 2023 08:32:35 -0500
Received: by mail-yb1-f170.google.com with SMTP id 123so14735285ybv.6
 for <60847 <at> debbugs.gnu.org>; Mon, 23 Jan 2023 05:32:35 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=aR3Cd32jsIpB/qaZMl46CjT9HybJqzHaQfNriE3Hl+k=;
 b=W0mpxJoLwEM2dov2UvhXAO2XNjtHRvyFPtKltKfdD7jRkcs97N1cjfLQIiXNwVEPvd
 g4S2ctfCOZpIKygFZHUGFlJIEfvU7drl5b1ROIN5EQkyBYY2BP8zDCbDDmVmOwACSO5B
 hHyCYhKfBbmpH8dtBz818T+fNB83f9ok4OQ5wzdgyHzCl7pAdgOicuZ6/OxtCb7DpwCg
 xLmNt+utlN0qkVLnaQNeGcVuMdnESAZF6vfvGxcydBQYAs3GiILCUAqYkRpibVHUg243
 uPBbpo7wlSZ/fNstrVdLNDP1/HehR4ImBIQf6A4YQAGP/O2EN0R2mxJ4Pnrl7zun33PE
 8Wkg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=aR3Cd32jsIpB/qaZMl46CjT9HybJqzHaQfNriE3Hl+k=;
 b=amuFKiiy1Jqc5dQDf9Poghlx71jubpljX1hbPtf9qoqgVNfrfM1qeyUvi0798Hd4wA
 mBuXYVsVVNJP20imf/Am2ekOFOPyHBXrPX7CM2fWwBbxH9sTfiSr1oIbSO4dasamxuJX
 2SGQ3cjdc040GCDdVUD6kpUDbShydPaTfpEi9PgZs5QV7K8PboMMlak1V2HyyqN2mSkq
 QdbJXHbHgD6KsSeZ94PbO5FvdWO9jD3lSHQ+hnbXAmOSliBQmW/XKnVxJDkKsevlmMDD
 v6MnN8ymddoL06HeZ8S30aETvjEEaGKZhmk3TGr67NG4dLfGwCfyU1A1y7o04+L0KzCj
 vA1g==
X-Gm-Message-State: AFqh2kqecXwbYsYN7YCfPp7duwoUzZls+3aAz+usMLBT80jXwVA4FcAP
 COO6yFrokuxUgGWk25z5XF5LEOsT8CGNmLPJ
X-Google-Smtp-Source: AMrXdXt/fPl3Zf51jOJWCkhPFcJ5JplzkE+ZhjOKNeON/JZxo2YQdj8H20Zh0Vc8UmrIYWTS4mGaWg==
X-Received: by 2002:a25:5ec2:0:b0:7ff:b107:d3db with SMTP id
 s185-20020a255ec2000000b007ffb107d3dbmr8985781ybb.19.1674480749412; 
 Mon, 23 Jan 2023 05:32:29 -0800 (PST)
Received: from localhost.localdomain ([2607:fad8:4:3::1001])
 by smtp.gmail.com with ESMTPSA id
 h4-20020a05620a244400b00706adbdf8b8sm11718274qkn.83.2023.01.23.05.32.28
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 23 Jan 2023 05:32:28 -0800 (PST)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: 60847 <at> debbugs.gnu.org
Subject: [PATCH v2 0/1] Enable cross-compilation for the pyproject-build-system
Date: Mon, 23 Jan 2023 08:32:15 -0500
Message-Id: <20230123133217.318-1-maxim.cournoyer@HIDDEN>
X-Mailer: git-send-email 2.39.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: 3.0 (+++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview: This change enables cross-compilation for the
 pyproject-build-system, 
 at the same time paving the way to fix the longstanding bug #25235 (Wrapped
 python programs get native-inputs in PYTHONPATH), by k [...] 
 Content analysis details:   (3.0 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 3.0 MANY_TO_CC             Sent to 10+ recipients
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (maxim.cournoyer[at]gmail.com)
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.0 SPF_PASS               SPF: sender matches SPF record
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
 [209.85.219.170 listed in wl.mailspike.net]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [209.85.219.170 listed in list.dnswl.org]
X-Debbugs-Envelope-To: 60847
Cc: Josselin Poiret <dev@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN>,
 Maxim Cournoyer <maxim.cournoyer@HIDDEN>,
 Simon Tournier <zimon.toutoune@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>,
 ludo@HIDDEN, Christopher Baines <mail@HIDDEN>,
 Lars-Dominik Braun <lars@HIDDEN>, Ricardo Wurmus <rekado@HIDDEN>,
 jgart <jgart@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 2.0 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  This change enables cross-compilation for the pyproject-build-system,
    at the same time paving the way to fix the longstanding bug #25235 (Wrapped
    python programs get native-inputs in PYTHONPATH), by k [...] 
 
 Content analysis details:   (2.0 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
                             [209.85.219.170 listed in wl.mailspike.net]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
                              no trust
                             [209.85.219.170 listed in list.dnswl.org]
  3.0 MANY_TO_CC             Sent to 10+ recipients
  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
                             provider (maxim.cournoyer[at]gmail.com)
  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.0 SPF_PASS               SPF: sender matches SPF record
 -1.0 MAILING_LIST_MULTI     Multiple indicators imply a widely-seen list
                             manager

This change enables cross-compilation for the pyproject-build-system, at the
same time paving the way to fix the longstanding bug #25235 (Wrapped python
programs get native-inputs in PYTHONPATH), by keeping the distinction between
native and host (regular) inputs even when not cross-compiling.  A unified
builder is used, which departs from the other build systems (which use one
builder for the native build and another one for the cross build, where
implemented).

If this change is accepted, there would be adjustments needed to some of the
~120 Python packages using pyproject (looking for a native inputs now needs to
be done using the 'native-inputs' instead of 'inputs' argument even in the
native compilation mode).  Over time I think it'd make sense to migrate more
build systems to use this scheme, since it gives more control as to what
inputs go into the wrapper.

A demo package, python-pycryptodome, that contains C extensions is adjusted so
that it can be cross-compiled using this new build system.  It is provided
separately as it would need to go to core-updates.

Changes in v2:
- Rebase

Maxim Cournoyer (1):
  build: Enable cross-compilation for pyproject-build-system.

 guix/build-system/pyproject.scm       | 115 ++++++++++++++---------
 guix/build/pyproject-build-system.scm | 126 +++++++++++++++++++++++---
 guix/packages.scm                     |  46 +++++-----
 3 files changed, 210 insertions(+), 77 deletions(-)


base-commit: 3a1b18aa4540e6f96ded0a98dd907a8033262582
-- 
2.39.1





Information forwarded to guix-patches@HIDDEN:
bug#60847; Package guix-patches. Full text available.
Added indication that bug 60847 blocks25235 Request was from Maxim Cournoyer <maxim.cournoyer@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Added indication that bug 60847 blocks60849 Request was from Maxim Cournoyer <maxim.cournoyer@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 60847 <at> debbugs.gnu.org:


Received: (at 60847) by debbugs.gnu.org; 16 Jan 2023 05:08:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 16 00:08:22 2023
Received: from localhost ([127.0.0.1]:60151 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pHHjJ-0004UD-21
	for submit <at> debbugs.gnu.org; Mon, 16 Jan 2023 00:08:22 -0500
Received: from mail-qt1-f175.google.com ([209.85.160.175]:39432)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maxim.cournoyer@HIDDEN>) id 1pHHjG-0004Ty-2i
 for 60847 <at> debbugs.gnu.org; Mon, 16 Jan 2023 00:08:19 -0500
Received: by mail-qt1-f175.google.com with SMTP id r15so651983qtx.6
 for <60847 <at> debbugs.gnu.org>; Sun, 15 Jan 2023 21:08:18 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=JegOH7l/A/D6onkrN2Qg61DNzKdDzrEzOLktAC+r3ho=;
 b=WvsXa5pUrFji2J1WFqVNXC7JrPUAhtU/WWyQT5GvCbVnOwwwfYajaCsFZaE9DrFk31
 mUROGhdIcf+DxsFsFzhCsbXvloVVTs0rIKxqFz323jbEgFPHwKt3TnlLndYtbecLD+hF
 5SEmTd/auMFfHxIjJoY2MzSo8MTnV/mzioEKNyF2UJCH2SLXahawyAsAGsa5RuqhANfG
 9F3twSZKV7QnUwm8mLKlaQNacc4PKRCOZs98mh7yx7Qdrb6DlVL5PxfXbCL6aJ1mLnP6
 hJuBcFnY367mauKH75YstXSqPxuKnes5aIxPKOYOJdNe6VEoUXvt2iylzv7PvbcQPQvM
 GyVw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=JegOH7l/A/D6onkrN2Qg61DNzKdDzrEzOLktAC+r3ho=;
 b=fDIfNKVcbHfNuScpfMTXYIbQ7XgsJd1aJuOBQg7gYiiCKmvQi+UHVENYL3nWmw+xOi
 MHj+W/krH8tuMvdZ6ly+9TvYjrwfx4s1cbUiuQ0J0qu/m9vbTqzvCt5lJprs+JxfqrAy
 YKxroGJaKxd0oTFznabSADYXQjccc+xSHLtMPTQV66wm2w5/WBZbc1YYdew3q5n2hY3t
 3O6dtdx/qw4AhgbWBM3NCHaUmz7D2KvbBp4LgbxikmEqARFIFNfJl7m5EvmSl46ncKE5
 zYsPDoLt1FmvnKNNQHT+Be7HPFdARGphn8PDs2RYPRexzSDfyj/nrPV/RX9Br+Gu+Gxt
 FUEw==
X-Gm-Message-State: AFqh2kp+/HBuHFPGzzYgujFCnzv+s6Qk28xrL7DFgutvzoW2I4b7BSlC
 np5pxLaOngYFkeT9D0ch6dPJP1J8/+8nZtCy
X-Google-Smtp-Source: AMrXdXupIRF6KtfwVW+p/mIRHdpY/71/qvjm5w06d1zwvbt3y5jEcKeIakBiEi6ATflBpPdoO7kHmg==
X-Received: by 2002:a05:622a:1a92:b0:3b6:36f2:5f63 with SMTP id
 s18-20020a05622a1a9200b003b636f25f63mr507248qtc.49.1673845691944; 
 Sun, 15 Jan 2023 21:08:11 -0800 (PST)
Received: from localhost.localdomain (dsl-10-130-209.b2b2c.ca. [72.10.130.209])
 by smtp.gmail.com with ESMTPSA id
 ay40-20020a05620a17a800b006f956766f76sm17401318qkb.1.2023.01.15.21.08.06
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 15 Jan 2023 21:08:11 -0800 (PST)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: 60847 <at> debbugs.gnu.org
Subject: [PATCH 1/1] build: Enable cross-compilation for
 pyproject-build-system.
Date: Mon, 16 Jan 2023 00:01:31 -0500
Message-Id: <20230116050132.24313-2-maxim.cournoyer@HIDDEN>
X-Mailer: git-send-email 2.38.1
In-Reply-To: <20230116050132.24313-1-maxim.cournoyer@HIDDEN>
References: <20230116050132.24313-1-maxim.cournoyer@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: 3.0 (+++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview: * guix/build-system/pyproject.scm (lower): Do not return #f
 when TARGET is set. Add the target field. Separate build-inputs from
 target-inputs, 
 and extend these with the standard-packages or standard- [...] 
 Content analysis details:   (3.0 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 3.0 MANY_TO_CC             Sent to 10+ recipients
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [209.85.160.175 listed in list.dnswl.org]
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (maxim.cournoyer[at]gmail.com)
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
 [209.85.160.175 listed in wl.mailspike.net]
 -0.0 SPF_PASS               SPF: sender matches SPF record
X-Debbugs-Envelope-To: 60847
Cc: Josselin Poiret <dev@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN>,
 Maxim Cournoyer <maxim.cournoyer@HIDDEN>,
 Simon Tournier <zimon.toutoune@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>,
 =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@HIDDEN>,
 Christopher Baines <mail@HIDDEN>, Lars-Dominik Braun <lars@HIDDEN>,
 Ricardo Wurmus <rekado@HIDDEN>, jgart <jgart@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 2.0 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  * guix/build-system/pyproject.scm (lower): Do not return #f
    when TARGET is set. Add the target field. Separate build-inputs from target-inputs,
    and extend these with the standard-packages or standard- [...] 
 
 Content analysis details:   (2.0 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
                             [209.85.160.175 listed in wl.mailspike.net]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
                              no trust
                             [209.85.160.175 listed in list.dnswl.org]
  3.0 MANY_TO_CC             Sent to 10+ recipients
  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
                             provider (maxim.cournoyer[at]gmail.com)
  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.0 SPF_PASS               SPF: sender matches SPF record
 -1.0 MAILING_LIST_MULTI     Multiple indicators imply a widely-seen list
                             manager

* guix/build-system/pyproject.scm (lower): Do not return #f when TARGET is
set.  Add the target field.  Separate build-inputs from target-inputs, and
extend these with the standard-packages or standard-cross-packages procedures.
(pyproject-build): Add the target, build-inputs, target-inputs, host-inputs
and native-search-paths arguments.  Remove the inputs argument.  Adjust doc.
Adjust the call to the build-side pyproject-build procedure.  Always pass the
target to the gexp->derivation call.
* guix/packages.scm (bag->derivation): Special case the pyproject-build
builder to always use cross-derivation bags
* guix/build/pyproject-build-system.scm (set-paths): New procedure, overriding
that provided by gnu-build-system.
(check) [TARGET]: New argument.  Disable the phase when it is set.
(install): Adjust to look for Python in the native-inputs instead of inputs.
(compile-bytecode): Likewise.
(create-entrypoints): Likewise.
(set-setuptools-env): New procedure.
(sanity-check): Adjust to look for Python in the native-inputs instead of
inputs.
(add-install-to-pythonpath, wrap, rename-pth-file): Likewise.
(%standard-phases): Override set-paths, add-install-to-pythonpath, wrap,
sanity-check and rename-pth-file.  Register set-setuptools-env.

---

 guix/build-system/pyproject.scm       | 115 ++++++++++++++---------
 guix/build/pyproject-build-system.scm | 126 +++++++++++++++++++++++---
 guix/packages.scm                     |  46 +++++-----
 3 files changed, 210 insertions(+), 77 deletions(-)

diff --git a/guix/build-system/pyproject.scm b/guix/build-system/pyproject.scm
index 8f3b562ca3..74d739023f 100644
--- a/guix/build-system/pyproject.scm
+++ b/guix/build-system/pyproject.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2021 Lars-Dominik Braun <lars@HIDDEN>
 ;;; Copyright © 2022 Marius Bakke <marius@HIDDEN>
+;;; Copyright © 2023 Maxim Cournoyer <maxim.cournoyer@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -69,28 +70,37 @@ (define* (lower name
                 #:rest arguments)
   "Return a bag for NAME."
   (define private-keywords
-    '(#:target #:python #:inputs #:native-inputs))
-
-  (and (not target)                               ;XXX: no cross-compilation
-       (bag
-         (name name)
-         (system system)
-         (host-inputs `(,@(if source
-                              `(("source" ,source))
-                              '())
-                        ,@inputs
-
-                        ;; Keep the standard inputs of 'gnu-build-system'.
-                        ,@(standard-packages)))
-         (build-inputs `(("python" ,python)
-                         ("sanity-check.py" ,(local-file sanity-check.py))
-                         ,@native-inputs))
-         (outputs (append outputs '(wheel)))
-         (build pyproject-build)
-         (arguments (strip-keyword-arguments private-keywords arguments)))))
-
-(define* (pyproject-build name inputs
-                          #:key source
+    `(#:python #:inputs #:native-inputs
+      ,@(if target '() '(#:target))))
+
+  (bag
+    (name name)
+    (system system)
+    (target target)
+    (build-inputs `(,@(if source
+                          `(("source" ,source))
+                          '())
+                    ("python" ,python)
+                    ("sanity-check.py" ,(local-file sanity-check.py))
+                    ,@native-inputs
+                    ,@(if target
+                          (standard-cross-packages target 'host)
+                          '())
+                    ;; Keep the standard inputs of 'gnu-build-system'.
+                    ,@(standard-packages)))
+    (host-inputs inputs)
+    (target-inputs (if target
+                       (standard-cross-packages target 'target)
+                       '()))
+    (outputs (append outputs '(wheel)))
+    (build pyproject-build)
+    (arguments (strip-keyword-arguments private-keywords arguments))))
+
+(define* (pyproject-build name
+                          #:key
+                          target
+                          build-inputs target-inputs host-inputs
+                          source
                           (tests? #t)
                           (configure-flags ''())
                           (build-backend #f)
@@ -98,44 +108,63 @@ (define* (pyproject-build name inputs
                           (test-flags ''())
                           (phases '%standard-phases)
                           (outputs '("out" "wheel"))
+                          (native-search-paths '())
                           (search-paths '())
                           (system (%current-system))
                           (guile #f)
                           (imported-modules %pyproject-build-system-modules)
                           (modules '((guix build pyproject-build-system)
                                      (guix build utils))))
-  "Build SOURCE using PYTHON, and with INPUTS."
+  "Build SOURCE using PYTHON, and with BUILD-INPUTS, HOST-INPUTS and
+TARGET-INPUTS (if available)."
   (define build
     (with-imported-modules imported-modules
       #~(begin
           (use-modules #$@(sexp->gexp modules))
 
-          #$(with-build-variables inputs outputs
-              #~(pyproject-build
-                 #:name #$name
-                 #:source #+source
-                 #:configure-flags #$configure-flags
-                 #:system #$system
-                 #:build-backend #$build-backend
-                 #:test-backend #$test-backend
-                 #:test-flags #$test-flags
-                 #:tests? #$tests?
-                 #:phases #$(if (pair? phases)
-                                (sexp->gexp phases)
-                                phases)
-                 #:outputs %outputs
-                 #:search-paths '#$(sexp->gexp
-                                    (map search-path-specification->sexp
-                                         search-paths))
-                 #:inputs %build-inputs)))))
+          (define %build-host-inputs
+            #+(input-tuples->gexp build-inputs))
+
+          (define %build-target-inputs
+            (append #$(input-tuples->gexp host-inputs)
+                    #+(input-tuples->gexp target-inputs)))
+
+          (define %build-inputs
+            (append %build-host-inputs %build-target-inputs))
+
+          (define %outputs
+            #$(outputs->gexp outputs))
 
+          (pyproject-build #:name #$name
+                           #:source #+source
+                           #:configure-flags #$configure-flags
+                           #:system #$system
+                           #:target #$target
+                           #:build-backend #$build-backend
+                           #:test-backend #$test-backend
+                           #:test-flags #$test-flags
+                           #:tests? #$tests?
+                           #:phases #$(if (pair? phases)
+                                          (sexp->gexp phases)
+                                          phases)
+                           #:outputs %outputs
+                           #:search-paths
+                           '#$(sexp->gexp
+                               (map search-path-specification->sexp
+                                    search-paths))
+                           #:native-search-paths
+                           '#$(sexp->gexp
+                               (map search-path-specification->sexp
+                                    native-search-paths))
+                           #:native-inputs %build-host-inputs
+                           #:inputs %build-target-inputs))))
 
   (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
                                                   system #:graft? #f)))
     (gexp->derivation name build
                       #:system system
-                      #:graft? #f                 ;consistent with 'gnu-build'
-                      #:target #f
+                      #:target target
+                      #:graft? #f       ;consistent with 'gnu-build'
                       #:guile-for-build guile)))
 
 (define pyproject-build-system
diff --git a/guix/build/pyproject-build-system.scm b/guix/build/pyproject-build-system.scm
index c69ccc9d64..e51b5cfc43 100644
--- a/guix/build/pyproject-build-system.scm
+++ b/guix/build/pyproject-build-system.scm
@@ -86,6 +86,58 @@ (define-condition-type &cannot-extract-multiple-wheels &python-build-error
 ;; Raised, when no wheel has been built by the build system.
 (define-condition-type &no-wheels-built &python-build-error no-wheels-built?)
 
+;;; XXX: This is the same as in (guix build gnu-build-system), except adjusted
+;;; for the fact that native-inputs always exist now, whether cross-compiling
+;;; or not.  When not cross-compiling, input-directories are appended to
+;;; native-input-directories to so that native-search-paths are computed for
+;;; all inputs.
+(define* (set-paths #:key target inputs native-inputs
+                    search-paths native-search-paths
+                    #:allow-other-keys)
+  (define input-directories
+    ;; The "source" input can be a directory, but we don't want it for search
+    ;; paths.  See <https://issues.guix.gnu.org/44924>.
+    (match (alist-delete "source" inputs)
+      (((_ . dir) ...)
+       dir)))
+
+  (define native-input-directories
+    (match (alist-delete "source" native-inputs)
+      (((_ . dir) ...)
+       dir)))
+
+  ;; Tell 'ld-wrapper' to disallow non-store libraries.
+  (setenv "GUIX_LD_WRAPPER_ALLOW_IMPURITIES" "no")
+
+  ;; When cross building, $PATH must refer only to native (host) inputs since
+  ;; target inputs are not executable.
+  (set-path-environment-variable "PATH" '("bin" "sbin")
+                                 (append native-input-directories
+                                         (if target
+                                             '()
+                                             input-directories)))
+
+  (for-each (match-lambda
+              ((env-var (files ...) separator type pattern)
+               (set-path-environment-variable env-var files
+                                              input-directories
+                                              #:separator separator
+                                              #:type type
+                                              #:pattern pattern)))
+            search-paths)
+
+  (for-each (match-lambda
+              ((env-var (files ...) separator type pattern)
+               (set-path-environment-variable env-var files
+                                              (append native-input-directories
+                                                      (if target
+                                                          '()
+                                                          input-directories))
+                                              #:separator separator
+                                              #:type type
+                                              #:pattern pattern)))
+            native-search-paths))
+
 (define* (build #:key outputs build-backend configure-flags #:allow-other-keys)
   "Build a given Python package."
 
@@ -135,9 +187,9 @@ (define (pyproject.toml->build-backend file)
      wheel-dir
      config-settings)))
 
-(define* (check #:key tests? test-backend test-flags #:allow-other-keys)
+(define* (check #:key target tests? test-backend test-flags #:allow-other-keys)
   "Run the test suite of a given Python package."
-  (if tests?
+  (if (and tests? (not target))
       ;; Unfortunately with PEP 517 there is no common method to specify test
       ;; systems.  Guess test system based on inputs instead.
       (let* ((pytest (which "pytest"))
@@ -172,11 +224,11 @@ (define* (check #:key tests? test-backend test-flags #:allow-other-keys)
           (else (raise (condition (&test-system-not-found))))))
       (format #t "test suite not run~%")))
 
-(define* (install #:key inputs outputs #:allow-other-keys)
+(define* (install #:key native-inputs outputs #:allow-other-keys)
   "Install a wheel file according to PEP 427"
   ;; See https://www.python.org/dev/peps/pep-0427/#installing-a-wheel-distribution-1-0-py32-none-any-whl
-  (let ((site-dir (site-packages inputs outputs))
-        (python (assoc-ref inputs "python"))
+  (let ((site-dir (site-packages native-inputs outputs))
+        (python (assoc-ref native-inputs "python"))
         (out (assoc-ref outputs "out")))
     (define (extract file)
       "Extract wheel (ZIP file) into site-packages directory"
@@ -262,10 +314,10 @@ (define (list-directories base predicate)
                   (expand-data-directory directory)
                   (rmdir directory)) datadirs))))
 
-(define* (compile-bytecode #:key inputs outputs #:allow-other-keys)
+(define* (compile-bytecode #:key native-inputs outputs #:allow-other-keys)
   "Compile installed byte-code in site-packages."
-  (let* ((site-dir (site-packages inputs outputs))
-         (python (assoc-ref inputs "python"))
+  (let* ((site-dir (site-packages native-inputs outputs))
+         (python (assoc-ref native-inputs "python"))
          (major-minor (map string->number
                            (take (string-split (python-version python) #\.) 2)))
          (<3.7? (match major-minor
@@ -281,7 +333,7 @@ (define* (compile-bytecode #:key inputs outputs #:allow-other-keys)
         (invoke "python" "-m" "compileall"
                 "--invalidation-mode=unchecked-hash" site-dir))))
 
-(define* (create-entrypoints #:key inputs outputs #:allow-other-keys)
+(define* (create-entrypoints #:key native-inputs outputs #:allow-other-keys)
   "Implement Entry Points Specification
 (https://packaging.python.org/specifications/entry-points/) by PyPa,
 which creates runnable scripts in bin/ from entry point specification
@@ -337,8 +389,7 @@ (define (create-script path name module function)
 import ~a as mod
 sys.exit (mod.~a ())~%" interpreter module function)))
         (chmod file-path #o755)))
-
-  (let* ((site-dir (site-packages inputs outputs))
+  (let* ((site-dir (site-packages native-inputs outputs))
          (out (assoc-ref outputs "out"))
          (bin-dir (string-append out "/bin"))
          (entry-point-files (find-files site-dir "^entry_points.txt$")))
@@ -358,6 +409,51 @@ (define* (set-SOURCE-DATE-EPOCH* #:rest _)
   ;; not support timestamps before 1980.
   (setenv "SOURCE_DATE_EPOCH" "315619200"))
 
+(define* (set-setuptools-env #:key target #:allow-other-keys)
+  "Set environment variables such as LDSHARED, LDXXSHARED, etc. used by
+setuptools when building native extensions.  This is particularly useful for
+cross-compilation."
+  (define cc-for-target (if target
+                            (string-append target "-gcc")
+                            "gcc"))
+  (define cxx-for-target (if target
+                             (string-append target "-g++")
+                             "g++"))
+  ;; The variables defined here are taken from CPython's configure.ac file.
+  ;; The explanations are those of the Poky (from Yocto) project.
+  (setenv "CC" cc-for-target)
+  (setenv "CXX" cxx-for-target)
+  ;; LDSHARED is the ld *command* used to create shared library.
+  (setenv "LDSHARED" (string-append cc-for-target " -shared"))
+  ;; LDXXSHARED is the ld *command* used to create shared library of C++
+  ;; objects.
+  (setenv "LDCXXSHARED" (string-append cxx-for-target " -shared"))
+  ;; CCSHARED are the C *flags* used to create objects to go into a shared
+  ;; library (module).
+  (setenv "CCSHARED" "-fPIC")
+  ;; LINKFORSHARED are the flags passed to the $(CC) command that links the
+  ;; python executable.
+  (setenv "LINKFORSHARED" "-Xlinker -export-dynamic"))
+
+(define* (sanity-check #:key tests? native-inputs outputs #:allow-other-keys
+                       #:rest args)
+  (apply (assoc-ref python:%standard-phases 'sanity-check)
+         (append args (list #:inputs native-inputs))))
+
+(define* (add-install-to-pythonpath #:key native-inputs outputs
+                                    #:allow-other-keys)
+  "A phase that just wraps the 'add-installed-pythonpath' procedure."
+  (add-installed-pythonpath native-inputs outputs))
+
+(define* (wrap #:key native-inputs outputs #:allow-other-keys #:rest args)
+  (apply (assoc-ref python:%standard-phases 'wrap)
+         (append args (list #:inputs native-inputs))))
+
+(define* (rename-pth-file #:key name native-inputs outputs #:allow-other-keys
+                          #:rest args)
+  (apply (assoc-ref python:%standard-phases 'rename-pth-file)
+         (append args (list #:inputs native-inputs))))
+
 (define %standard-phases
   ;; The build phase only builds C extensions and copies the Python sources,
   ;; while the install phase copies then byte-compiles the sources to the
@@ -365,13 +461,19 @@ (define %standard-phases
   ;; to ease testing the built package.
   (modify-phases python:%standard-phases
     (replace 'set-SOURCE-DATE-EPOCH set-SOURCE-DATE-EPOCH*)
+    (replace 'set-paths set-paths)
+    (add-after 'set-paths 'set-setuptools-env set-setuptools-env)
     (replace 'build build)
     (replace 'install install)
+    (replace 'add-install-to-pythonpath add-install-to-pythonpath)
+    (replace 'wrap wrap)
     (delete 'check)
     ;; Must be before tests, so they can use installed packages’ entry points.
     (add-before 'wrap 'create-entrypoints create-entrypoints)
     (add-after 'wrap 'check check)
-    (add-before 'check 'compile-bytecode compile-bytecode)))
+    (add-before 'check 'compile-bytecode compile-bytecode)
+    (replace 'sanity-check sanity-check)
+    (replace 'rename-pth-file rename-pth-file)))
 
 (define* (pyproject-build #:key inputs (phases %standard-phases)
                           #:allow-other-keys #:rest args)
diff --git a/guix/packages.scm b/guix/packages.scm
index 041a872f9d..6d7df17fc3 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -1864,28 +1864,30 @@ (define* (bag->derivation bag #:optional context)
   "Return the derivation to build BAG for SYSTEM.  Optionally, CONTEXT can be
 a package object describing the context in which the call occurs, for improved
 error reporting."
-  (if (bag-target bag)
-      (bag->cross-derivation bag)
-      (mlet* %store-monad ((system ->  (bag-system bag))
-                           (inputs ->  (bag-transitive-inputs bag))
-                           (input-drvs (mapm %store-monad
-                                             (cut expand-input context <> system)
-                                             inputs))
-                           (paths ->   (delete-duplicates
-                                        (append-map (match-lambda
-                                                      ((_ (? package? p) _ ...)
-                                                       (package-native-search-paths
-                                                        p))
-                                                      (_ '()))
-                                                    inputs))))
-        ;; It's possible that INPUTS contains packages that are not 'eq?' but
-        ;; that lead to the same derivation.  Delete those duplicates to avoid
-        ;; issues down the road, such as duplicate entries in '%build-inputs'.
-        (apply (bag-build bag) (bag-name bag)
-               (delete-duplicates input-drvs input=?)
-               #:search-paths paths
-               #:outputs (bag-outputs bag) #:system system
-               (bag-arguments bag)))))
+  (let ((builder-name (procedure-name (bag-build bag))))
+    (if (or (bag-target bag)
+            (eq? 'pyproject-build builder-name))
+        (bag->cross-derivation bag)
+        (mlet* %store-monad ((system ->  (bag-system bag))
+                             (inputs ->  (bag-transitive-inputs bag))
+                             (input-drvs (mapm %store-monad
+                                               (cut expand-input context <> system)
+                                               inputs))
+                             (paths ->   (delete-duplicates
+                                          (append-map (match-lambda
+                                                        ((_ (? package? p) _ ...)
+                                                         (package-native-search-paths
+                                                          p))
+                                                        (_ '()))
+                                                      inputs))))
+          ;; It's possible that INPUTS contains packages that are not 'eq?' but
+          ;; that lead to the same derivation.  Delete those duplicates to avoid
+          ;; issues down the road, such as duplicate entries in '%build-inputs'.
+          (apply (bag-build bag) (bag-name bag)
+                 (delete-duplicates input-drvs input=?)
+                 #:search-paths paths
+                 #:outputs (bag-outputs bag) #:system system
+                 (bag-arguments bag))))))
 
 (define* (bag->cross-derivation bag #:optional context)
   "Return the derivation to build BAG, which is actually a cross build.
-- 
2.38.1





Information forwarded to guix-patches@HIDDEN:
bug#60847; Package guix-patches. Full text available.

Message received at 60847 <at> debbugs.gnu.org:


Received: (at 60847) by debbugs.gnu.org; 16 Jan 2023 05:02:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 16 00:02:08 2023
Received: from localhost ([127.0.0.1]:60145 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pHHdI-0004Ki-A0
	for submit <at> debbugs.gnu.org; Mon, 16 Jan 2023 00:02:08 -0500
Received: from mail-qt1-f173.google.com ([209.85.160.173]:37393)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maxim.cournoyer@HIDDEN>) id 1pHHdH-0004KG-0d
 for 60847 <at> debbugs.gnu.org; Mon, 16 Jan 2023 00:02:07 -0500
Received: by mail-qt1-f173.google.com with SMTP id j9so1099029qtv.4
 for <60847 <at> debbugs.gnu.org>; Sun, 15 Jan 2023 21:02:07 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=U6sCICU/tnz7NkBthC8kkkSm6LX0KB4Rb1TZvcBA8I4=;
 b=olFmQEVPjGkNdHZvOyVAZpLmDx1Iiwpd34HGCo7O+2nr/SaYsKOdcToz33LyGh7Dyk
 rrqfcuIg4icxGH4CvYYl4azOlKEc8kfVF8n2Z3Hs8pAQFur1rqwpL+SMD1EGiQI0+dx2
 0QoINXk6kfdfi0DGHIouzlNDf8hLwOFmzeXdRl+P9iAdhpCJci0L5D64m/eWwDhurI+x
 ZxE3NtI+wZVHI2HG0qNrGZkOVErq2YHh1bZoyvD8AiP4xzz2tnN/oPEPODjx2uK30uFR
 0T/p8aVSmkHXyWLGrFOBUVZk8pVPTItlpIS1Nhz9P6XAhRgglU+vt3tvhMWbpty5m2/X
 L4CA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=U6sCICU/tnz7NkBthC8kkkSm6LX0KB4Rb1TZvcBA8I4=;
 b=tm7/E588Y+4EBMnOFPTo0ZbE5eQJ0gs0ULfAK5u3kcp2K39ExU37Heawk4f+4EPRCx
 JeZOfG2vmXo+bxgB1wQyVTZvoO25K41c6mURWRc9gU4cUorRBrla+ZH4+213KktFNLdQ
 KlojOCWF3w78zv5S4BkULr3JLLsh7Eo50+wSDOdwoHNsjkuQpQWbu0/TXE7gRt0Vvjp/
 k9EuLhPBEMn46czv2Tz0k8ssbTK6aR/SfilmqYp/pEcPai6Mzd28i2P7kLH3QfyGnUZb
 EWm0dYgwrCUqPqCOPLNRPuZQTeCx9nf5KkrAxgkse6LwgWTnWONJ/47L0VFBBBfnI0ft
 yf8g==
X-Gm-Message-State: AFqh2kqjLZNI2x+6QYOC59dmdj0VrxWhu9tby0OxELofwpLHD6NDuudu
 gFrqSkSvOd/8dD6uhJEylvvlUXZ5ixjhHmyI
X-Google-Smtp-Source: AMrXdXtKomLwiYF2hWCRYZ2UE2C9FanZ7v6ESezxeL7tmbMWn058FQm0mDdrHu4OYad+S4pAQfN66w==
X-Received: by 2002:ac8:7457:0:b0:3a8:2122:7c28 with SMTP id
 h23-20020ac87457000000b003a821227c28mr130954331qtr.47.1673845321448; 
 Sun, 15 Jan 2023 21:02:01 -0800 (PST)
Received: from localhost.localdomain (dsl-10-130-209.b2b2c.ca. [72.10.130.209])
 by smtp.gmail.com with ESMTPSA id
 ay40-20020a05620a17a800b006f956766f76sm17401318qkb.1.2023.01.15.21.01.55
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 15 Jan 2023 21:02:01 -0800 (PST)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: 60847 <at> debbugs.gnu.org
Subject: [PATCH 0/1] Enable cross-compilation for the pyproject-build-system
Date: Mon, 16 Jan 2023 00:01:30 -0500
Message-Id: <20230116050132.24313-1-maxim.cournoyer@HIDDEN>
X-Mailer: git-send-email 2.38.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: 3.0 (+++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview: This change enables cross-compilation for the
 pyproject-build-system, 
 at the same time paving the way to fix the longstanding bug #25235 (Wrapped
 python programs get native-inputs in PYTHONPATH), by k [...] 
 Content analysis details:   (3.0 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 3.0 MANY_TO_CC             Sent to 10+ recipients
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (maxim.cournoyer[at]gmail.com)
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.0 SPF_PASS               SPF: sender matches SPF record
 0.0 RCVD_IN_MSPIKE_H3      RBL: Good reputation (+3)
 [209.85.160.173 listed in wl.mailspike.net]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [209.85.160.173 listed in list.dnswl.org]
 0.0 RCVD_IN_MSPIKE_WL      Mailspike good senders
X-Debbugs-Envelope-To: 60847
Cc: Josselin Poiret <dev@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN>,
 Maxim Cournoyer <maxim.cournoyer@HIDDEN>,
 Simon Tournier <zimon.toutoune@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>,
 =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@HIDDEN>,
 Christopher Baines <mail@HIDDEN>, Lars-Dominik Braun <lars@HIDDEN>,
 Ricardo Wurmus <rekado@HIDDEN>, jgart <jgart@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 2.0 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  This change enables cross-compilation for the pyproject-build-system,
    at the same time paving the way to fix the longstanding bug #25235 (Wrapped
    python programs get native-inputs in PYTHONPATH), by k [...] 
 
 Content analysis details:   (2.0 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
  0.0 RCVD_IN_MSPIKE_H3      RBL: Good reputation (+3)
                             [209.85.160.173 listed in wl.mailspike.net]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
                              no trust
                             [209.85.160.173 listed in list.dnswl.org]
  3.0 MANY_TO_CC             Sent to 10+ recipients
  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
                             provider (maxim.cournoyer[at]gmail.com)
  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.0 SPF_PASS               SPF: sender matches SPF record
  0.0 RCVD_IN_MSPIKE_WL      Mailspike good senders
 -1.0 MAILING_LIST_MULTI     Multiple indicators imply a widely-seen list
                             manager

This change enables cross-compilation for the pyproject-build-system, at the
same time paving the way to fix the longstanding bug #25235 (Wrapped python
programs get native-inputs in PYTHONPATH), by keeping the distinction between
native and host (regular) inputs even when not cross-compiling.  A unified
builder is used, which departs from the other build systems (which use one
builder for the native build and another one for the cross build, where
implemented).

If this change is accepted, there would be adjustments needed to some of the
~120 Python packages using pyproject (looking for a native inputs now needs to
be done using the 'native-inputs' instead of 'inputs' argument even in the
native compilation mode).  Over time I think it'd make sense to migrate more
build systems to use this scheme, since it gives more control as to what
inputs go into the wrapper.

A demo package, python-pycryptodome, that contains C extensions is adjusted so
that it can be cross-compiled using this new build system.  It is provided
separately as it would need to go to core-updates.


Maxim Cournoyer (1):
  build: Enable cross-compilation for pyproject-build-system.

 guix/build-system/pyproject.scm       | 115 ++++++++++++++---------
 guix/build/pyproject-build-system.scm | 126 +++++++++++++++++++++++---
 guix/packages.scm                     |  46 +++++-----
 3 files changed, 210 insertions(+), 77 deletions(-)


base-commit: 5c921977179489caef4a9e54ada6696fc86d2f0b
-- 
2.38.1





Information forwarded to guix-patches@HIDDEN:
bug#60847; Package guix-patches. Full text available.
Changed bug title to '[PATCH] Enable cross-compilation for the pyproject-build-system.' from '[PATCH 0/5] Enable cross-compilation for the pyproject-build-system' Request was from Maxim Cournoyer <maxim.cournoyer@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 16 Jan 2023 04:04:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 15 23:04:16 2023
Received: from localhost ([127.0.0.1]:60110 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pHGjI-0002mr-7H
	for submit <at> debbugs.gnu.org; Sun, 15 Jan 2023 23:04:16 -0500
Received: from lists.gnu.org ([209.51.188.17]:32872)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maxim.cournoyer@HIDDEN>) id 1pHGjG-0002mk-IT
 for submit <at> debbugs.gnu.org; Sun, 15 Jan 2023 23:04:15 -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 <maxim.cournoyer@HIDDEN>)
 id 1pHGjG-0001x6-9c
 for guix-patches@HIDDEN; Sun, 15 Jan 2023 23:04:14 -0500
Received: from mail-qv1-xf2b.google.com ([2607:f8b0:4864:20::f2b])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <maxim.cournoyer@HIDDEN>)
 id 1pHGjE-0002IG-Kd
 for guix-patches@HIDDEN; Sun, 15 Jan 2023 23:04:13 -0500
Received: by mail-qv1-xf2b.google.com with SMTP id h10so18891993qvq.7
 for <guix-patches@HIDDEN>; Sun, 15 Jan 2023 20:04:12 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=0/gwamCB0n8pU62hU32wtr7xNnAi86qaUQ1NZsc6BQI=;
 b=Pc9Tq95hGfCpKBERBddGK75VbYoaRHBGE+WPV2dT7hfLK8FjyxnPu+w8RK/zpWGUlw
 8xZYhO9g51XomU8ButZC1YZAP60KoJfxUwPoibgrXOKtUZoLQy9qZc7a2ewCIl95wvbe
 iX+EE+VWYDDs54pXnxMBJ8wedF1t//D31u7H1AKCpJeQsw0KIXTZ/vqCQq0RY4zfe47D
 qJKUMMpxapVWOOKImxz6Ou+ewCAFqnZ4capMg1lXWi7ffHKIStJyV1Ogngqoram9g8Tf
 XLVcE/beLcYKWYqDh2gV8kUVm3qPZEk7PyRGhtIM/FX/rfMiZdfmTfYPaCW2Sc53ghsw
 /Tqw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=0/gwamCB0n8pU62hU32wtr7xNnAi86qaUQ1NZsc6BQI=;
 b=qYOTc1vopN58prCzvpy0FuQ4+Duqva7vDKmEBrAGzbM8GgXbrf+f40wjxrlIhzewKE
 lSRvOnOb/UxrRh/gOHs8hU99j1K98NNfVbj0w398zJA+HIdCeavSxMABZA5/6bINw7mN
 aJyOSOHK1/Efw8P5VU0uNYlASPgEm704QQp9wVb3eBBWPbXZjzLs0snJSwr7biOZweeJ
 hWHYBwrUzZedsNqPUCS5Te1ns0nRfaSREl3hqBN/sgckCSlbWMk6AMHWSqT/cVBcShND
 6zVu1rc/MyKFVy6WWR606atZKiicQZyu6x1urJmC+4MyrWBMKUgTS0ZM6K8lfKgCiOsp
 qSJg==
X-Gm-Message-State: AFqh2kqZfJ6tvWog/P3Ti1ukrKxr7KkWuOpePAstGD/Xm4Q4HQLQfasz
 ngkeYQKFONUaZ8U36iSvFzICSpHTVsdzTV9+
X-Google-Smtp-Source: AMrXdXuMSb6TzbMb3YKSsNPR7I71hi0WSdWhmJKMmiFvvcNFLtxAqDtPdpDJCBM8BPvBgQA2/eU9zg==
X-Received: by 2002:a05:6214:2d13:b0:534:80c0:6b64 with SMTP id
 mz19-20020a0562142d1300b0053480c06b64mr15136175qvb.1.1673841851277; 
 Sun, 15 Jan 2023 20:04:11 -0800 (PST)
Received: from localhost.localdomain (dsl-10-130-209.b2b2c.ca. [72.10.130.209])
 by smtp.gmail.com with ESMTPSA id
 f23-20020ac84657000000b003b62d1ccd85sm1919175qto.40.2023.01.15.20.04.10
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 15 Jan 2023 20:04:10 -0800 (PST)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH 0/5] Enable cross-compilation for the pyproject-build-system
Date: Sun, 15 Jan 2023 23:04:02 -0500
Message-Id: <20230116040402.7350-1-maxim.cournoyer@HIDDEN>
X-Mailer: git-send-email 2.38.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=2607:f8b0:4864:20::f2b;
 envelope-from=maxim.cournoyer@HIDDEN; helo=mail-qv1-xf2b.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
Cc: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

This change enables cross-compilation for the pyproject-build-system, at the
same time paving the way to fix the longstanding bug #25235 (Wrapped python
programs get native-inputs in PYTHONPATH), by keeping the distinction between
native and host (regular) inputs even when not cross-compiling.  A unified
builder is used, which departs from the other build systems (which use one
builder for the native build and another one for the cross build, where
implemented).

If this change is accepted, there would be adjustments needed to some of the
~150 Python packages using pyproject (looking for a native inputs now needs to
be done using the 'native-inputs' instead of 'inputs' argument even in the
native compilation mode).  Over time I think it'd make sense to migrate more
build systems to use this scheme, since it gives more control as to what
inputs go into the wrapper.

A demo package, python-pycryptodome, that contains C extensions is adjusted so
that it can be cross-compiled using this new build system.


Maxim Cournoyer (5):
  gnu: libtommath: Update to 1.2.0-0.03de03d.
  gnu: libtomcrypt: Update to 1.18.2-0.29986d0.
  build: Enable cross-compilation for pyproject-build-system.
  gnu: python-pycryptodome: Fix build and enable cross-compilation.
  gnu: python-coverage: Switch to pyproject-build-system.

 gnu/packages/check.scm                |   2 +-
 gnu/packages/multiprecision.scm       | 179 +++++++++-----------------
 gnu/packages/python-crypto.scm        |  20 ++-
 guix/build-system/pyproject.scm       | 115 ++++++++++-------
 guix/build/pyproject-build-system.scm | 126 ++++++++++++++++--
 guix/packages.scm                     |  46 +++----
 6 files changed, 288 insertions(+), 200 deletions(-)


base-commit: 5c921977179489caef4a9e54ada6696fc86d2f0b
-- 
2.38.1





Acknowledgement sent to Maxim Cournoyer <maxim.cournoyer@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#60847; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 6 Mar 2023 23:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.