On Sun, 3 Jan 2021 12:52:08 +0000 James Le Cuirot <[email protected]> wrote:
> On Sat, 2 Jan 2021 20:09:04 -0500 > Mike Gilbert <[email protected]> wrote: > > > When cross-compiling, users will typically have > > PKG_CONFIG_SYSROOT=${SYSROOT} defined via pkg-config wrapper. > > > > When PKG_CONFIG_SYSROOT is set, all paths included in pkg-config > > output get prefixed with this value. > > > > Signed-off-by: Mike Gilbert <[email protected]> > > --- > > > > 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. > > > > eclass/systemd.eclass | 1 + > > 1 file changed, 1 insertion(+) > > > > 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() { > > > > if $(tc-getPKG_CONFIG) --exists systemd; then > > d=$($(tc-getPKG_CONFIG) --variable="${variable}" systemd) || die > > + d=${d#${SYSROOT}} > > d=${d#${EPREFIX}} > > else > > d=${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=${d#${SYSROOT%/}/${EPREFIX#/}} Had another minute to think. EPREFIX always strips the trailing slash so it would be blank. d=${d#${SYSROOT%/}${EPREFIX}} -- James Le Cuirot (chewi) Gentoo Linux Developer
pgp0JKYoJYsgE.pgp
Description: OpenPGP digital signature
