From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 6A0361382C5 for ; Sun, 3 Jan 2021 13:02:37 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0F9CAE0872; Sun, 3 Jan 2021 13:02:34 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 98C1DE0869 for ; Sun, 3 Jan 2021 13:02:33 +0000 (UTC) Date: Sun, 3 Jan 2021 13:02:22 +0000 From: James Le Cuirot To: gentoo-dev@lists.gentoo.org Subject: Re: [gentoo-dev] [PATCH] systemd.eclass: remove SYSROOT from pkg-config output Message-ID: <20210103130222.5dfddfd3@symphony.aura-online.co.uk> In-Reply-To: <20210103125208.0694a788@symphony.aura-online.co.uk> References: <20210103010904.1158863-1-floppym@gentoo.org> <20210103125208.0694a788@symphony.aura-online.co.uk> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/diqw9_kjL553APoq07.QxEh"; protocol="application/pgp-signature"; micalg=pgp-sha256 X-Archives-Salt: bf3e3862-fcd6-40b5-81b0-90da62595ebb X-Archives-Hash: 363eed3b15ecb079d7dc21396836c05f --Sig_/diqw9_kjL553APoq07.QxEh Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Sun, 3 Jan 2021 12:52:08 +0000 James Le Cuirot wrote: > On Sat, 2 Jan 2021 20:09:04 -0500 > Mike Gilbert wrote: >=20 > > When cross-compiling, users will typically have > > PKG_CONFIG_SYSROOT=3D${SYSROOT} defined via pkg-config wrapper. > >=20 > > When PKG_CONFIG_SYSROOT is set, all paths included in pkg-config > > output get prefixed with this value. > >=20 > > Signed-off-by: Mike Gilbert > > --- > >=20 > > This patch has already been pushed, but I figured I would send it for > > review in case someone else can think of a failure case, or has a better > > solution. > >=20 > > eclass/systemd.eclass | 1 + > > 1 file changed, 1 insertion(+) > >=20 > > diff --git a/eclass/systemd.eclass b/eclass/systemd.eclass > > index 81065a0af79a..f6d1fa2d92d6 100644 > > --- a/eclass/systemd.eclass > > +++ b/eclass/systemd.eclass > > @@ -50,6 +50,7 @@ _systemd_get_dir() { > > =20 > > if $(tc-getPKG_CONFIG) --exists systemd; then > > d=3D$($(tc-getPKG_CONFIG) --variable=3D"${variable}" systemd) || die > > + d=3D${d#${SYSROOT}} > > d=3D${d#${EPREFIX}} > > else > > d=3D${fallback} =20 >=20 > I was going to say this is not the best approach as it would be better > to tell pkg-config to not add the SYSROOT in the first place. I now > realise we have shot ourselves in the foot with cross-pkg-config as it > uses SYSROOT to set both PKG_CONFIG_SYSROOT_DIR to control the output > and PKG_CONFIG_LIBDIR to find the .pc files in the first place. I have > had prefix-related fixes for cross-pkg-config lined up for over a year > but unfortunately they do not address this. Trying to accommodate this > use case would probably just make it more confusing though so maybe > your approach is best after all. >=20 > The EPREFIX line is (sometimes) wrong in EAPI 7 though and the same goes > for udev.eclass. It took a while to get this agreed and corrected in > PMS but if SYSROOT points to / then the effective prefix is BROOT, not > EPREFIX; they may not be the same. If you just strip ESYSROOT then > it will always do the right thing but you'll need this fall back for > older EAPIs. I'm not sure why you didn't do it in one line? I forget if > EPREFIX is normalised to be / rather thank blank. >=20 > d=3D${d#${SYSROOT%/}/${EPREFIX#/}} Had another minute to think. EPREFIX always strips the trailing slash so it would be blank. d=3D${d#${SYSROOT%/}${EPREFIX}} --=20 James Le Cuirot (chewi) Gentoo Linux Developer --Sig_/diqw9_kjL553APoq07.QxEh Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEPxcZ3tkwcedKm2a8EiZBXQDdMTcFAl/xwF4ACgkQEiZBXQDd MTcjag//cnfkJoxXx2qz8Bdz2ou2AKe/HsHdJfxwfC01xaojPAjsSELPowFk9k2B dYRWIk81hJiry99SS5nQyhwZoSUtUd1+rGA2i7LTQEXTTW4AuyXepwtryKjCraTj +s/1cr+rgq7Nck7jzhh+f5r+XjD0LNQsvuJJZxYi1yaBdy1BVWnKutxUK6zqemW6 XIBqgWG3t//bqeDwD0L1ABuwayZc4fYqY+fB55YXElDVBVtG/YNKXdJL327CRcVZ 3GJqVadOWp7ofFsUn4fiSm2754q+MTF7uBQSK9KplOhdjPB5XYKf/E7zmrdwDzyc oJYxJBRGnBzotmUSVmIU5RePLkGvSKEqTjE47QZu2/fI42e9CAbIRfCbHSF8bbQ2 5u6W9cuozQmXSdea3LTyeQfCElKpzXV0bZmwH5y2dnOwlqCDkRx/VQgNRnxhKPFB lMdWrFgQurac4l+Oo309nbXXdj/U9PSpbP8mRAg4S+2A5FRK8s3Q7NTW3F/GWIrw MoQqrZ9WaUsVSrCqx3KG7ajHIEv0MUEoqza23/2YxPNYi+N+YM5h1pG0nQ3jLl9e gpnmhNvYv6Otaujg5QJ3q0P64nCAo86A49dQAhYfpspm0joOvfoWI8fZo4Sp5ZW7 9lsdjirkKwAjCLPCJa9q9+jtQaKRYyg99Tlp5s/zXaExLgBUEB4= =bKue -----END PGP SIGNATURE----- --Sig_/diqw9_kjL553APoq07.QxEh--