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 8DB741382C5 for ; Sun, 3 Jan 2021 12:52:28 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 6B267E086E; Sun, 3 Jan 2021 12:52:25 +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 033FEE0858 for ; Sun, 3 Jan 2021 12:52:24 +0000 (UTC) Date: Sun, 3 Jan 2021 12:52:08 +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: <20210103125208.0694a788@symphony.aura-online.co.uk> In-Reply-To: <20210103010904.1158863-1-floppym@gentoo.org> References: <20210103010904.1158863-1-floppym@gentoo.org> 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_/3qewREdSmCtWnZkAzgn9RpM"; protocol="application/pgp-signature"; micalg=pgp-sha256 X-Archives-Salt: 492ddb81-e8cb-4aae-a70d-45fe5691f0ae X-Archives-Hash: e91ee1c556aed4b4ecd516b4b5598dea --Sig_/3qewREdSmCtWnZkAzgn9RpM Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Sat, 2 Jan 2021 20:09:04 -0500 Mike Gilbert wrote: > 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} 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. 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. d=3D${d#${SYSROOT%/}/${EPREFIX#/}} --=20 James Le Cuirot (chewi) Gentoo Linux Developer --Sig_/3qewREdSmCtWnZkAzgn9RpM Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEPxcZ3tkwcedKm2a8EiZBXQDdMTcFAl/xvfgACgkQEiZBXQDd MTcJyQ/+KFw5eINKMNB4ZsR8u8+k+bzPNsesOT+5r72MQ7aekHzvcGUWOfEk1oIt bF5ovJ+F6sxxR6AbwbAyQmHIoJveu4WEqAh2qcYMBBKPH96Q4YpKr5n3OF6hiEk2 yW/woda/F5dTEsEMWFI5McwU86jJIsS2Q6vU1mPH2e8ja8Y2lj2DZU8HidFyySdL LrJmBDV1R6XihomIlZHRzOJR3SU/RiMkFTGOLp5vKGvmYsZEduI1HYEdZmcCiJUs dh9kHAAYrPMq1JI7EHzHw8ix4afAuyv6hYwWFR08w1o9ZmtTonLH4dGMgXawSmxP 8aACvmmLJRUWFPic1oWTXUT4xvOEDXkRTdx2xn1SPsfNL5q2nRYhJDPClXyMLBQ5 lABS/8LFEwupC9VxxINXsSScvVvck0ClZqS8Xn7eIE1dlSc2AglsSoL2DoR7l7M4 7RhTqHVa1NHCzMKTD5elGNg6mhSJ9XjoosNoFK5AcCpYJ0S3S7A34URXVJctQmkh adrcU1MveisyGwyqQBbW43wDljw/XMRmfIWtuXIWPPKhHOk9UNhYDncKtVdGl2iI gNmbpuhbMPQo0TYUft+yNXCH+FFn7hyAlNknuOs+JzM2GfS0C1OvZHpIxrH5Z3dl TFasUvVXaReci/8Ihj+gIypd+25jnxl+6mrEQ/oESPW5bi0iz6c= =HHCK -----END PGP SIGNATURE----- --Sig_/3qewREdSmCtWnZkAzgn9RpM--