1 |
On Sun, 3 Jan 2021 12:52:08 +0000 |
2 |
James Le Cuirot <chewi@g.o> wrote: |
3 |
|
4 |
> On Sat, 2 Jan 2021 20:09:04 -0500 |
5 |
> Mike Gilbert <floppym@g.o> wrote: |
6 |
> |
7 |
> > When cross-compiling, users will typically have |
8 |
> > PKG_CONFIG_SYSROOT=${SYSROOT} defined via pkg-config wrapper. |
9 |
> > |
10 |
> > When PKG_CONFIG_SYSROOT is set, all paths included in pkg-config |
11 |
> > output get prefixed with this value. |
12 |
> > |
13 |
> > Signed-off-by: Mike Gilbert <floppym@g.o> |
14 |
> > --- |
15 |
> > |
16 |
> > This patch has already been pushed, but I figured I would send it for |
17 |
> > review in case someone else can think of a failure case, or has a better |
18 |
> > solution. |
19 |
> > |
20 |
> > eclass/systemd.eclass | 1 + |
21 |
> > 1 file changed, 1 insertion(+) |
22 |
> > |
23 |
> > diff --git a/eclass/systemd.eclass b/eclass/systemd.eclass |
24 |
> > index 81065a0af79a..f6d1fa2d92d6 100644 |
25 |
> > --- a/eclass/systemd.eclass |
26 |
> > +++ b/eclass/systemd.eclass |
27 |
> > @@ -50,6 +50,7 @@ _systemd_get_dir() { |
28 |
> > |
29 |
> > if $(tc-getPKG_CONFIG) --exists systemd; then |
30 |
> > d=$($(tc-getPKG_CONFIG) --variable="${variable}" systemd) || die |
31 |
> > + d=${d#${SYSROOT}} |
32 |
> > d=${d#${EPREFIX}} |
33 |
> > else |
34 |
> > d=${fallback} |
35 |
> |
36 |
> I was going to say this is not the best approach as it would be better |
37 |
> to tell pkg-config to not add the SYSROOT in the first place. I now |
38 |
> realise we have shot ourselves in the foot with cross-pkg-config as it |
39 |
> uses SYSROOT to set both PKG_CONFIG_SYSROOT_DIR to control the output |
40 |
> and PKG_CONFIG_LIBDIR to find the .pc files in the first place. I have |
41 |
> had prefix-related fixes for cross-pkg-config lined up for over a year |
42 |
> but unfortunately they do not address this. Trying to accommodate this |
43 |
> use case would probably just make it more confusing though so maybe |
44 |
> your approach is best after all. |
45 |
> |
46 |
> The EPREFIX line is (sometimes) wrong in EAPI 7 though and the same goes |
47 |
> for udev.eclass. It took a while to get this agreed and corrected in |
48 |
> PMS but if SYSROOT points to / then the effective prefix is BROOT, not |
49 |
> EPREFIX; they may not be the same. If you just strip ESYSROOT then |
50 |
> it will always do the right thing but you'll need this fall back for |
51 |
> older EAPIs. I'm not sure why you didn't do it in one line? I forget if |
52 |
> EPREFIX is normalised to be / rather thank blank. |
53 |
> |
54 |
> d=${d#${SYSROOT%/}/${EPREFIX#/}} |
55 |
|
56 |
Had another minute to think. EPREFIX always strips the trailing slash |
57 |
so it would be blank. |
58 |
|
59 |
d=${d#${SYSROOT%/}${EPREFIX}} |
60 |
|
61 |
-- |
62 |
James Le Cuirot (chewi) |
63 |
Gentoo Linux Developer |