mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Michael Olbrich <m.olbrich@pengutronix.de>
To: ptxdist@pengutronix.de
Subject: Re: [ptxdist] [PATCH] pkg-config-wrapper: calculate the system paths dynamically as well
Date: Fri, 7 May 2021 14:14:43 +0200	[thread overview]
Message-ID: <20210507121443.GJ28490@pengutronix.de> (raw)
In-Reply-To: <daca0f0a-2010-3a4e-e378-2a8db5aefd61@t2data.com>

On Fri, May 07, 2021 at 01:14:02PM +0200, Christian Melki wrote:
> On 5/7/21 9:15 AM, Michael Olbrich wrote:
> > Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
> > ---
> > 
> > Would this work? Or do we need to exclude /usr/lib explicitly as well?
> > 
> > Michael
> > 
> >  scripts/pkg-config-wrapper | 8 +++++---
> >  1 file changed, 5 insertions(+), 3 deletions(-)
> > 
> > diff --git a/scripts/pkg-config-wrapper b/scripts/pkg-config-wrapper
> > index d86fa7c683b5..dd786e47b212 100755
> > --- a/scripts/pkg-config-wrapper
> > +++ b/scripts/pkg-config-wrapper
> > @@ -17,9 +17,11 @@ else
> >  fi
> >  
> >  declare -a libdir system_path system_incpath
> > -libdir=( $(find ${prefix} -maxdepth 3 -type d -name pkgconfig) > -system_libpath=( "${libdir[@]/%//../../lib}" "${libdir[@]/%//../lib}"
> "/usr/lib" "/lib" )
> > -system_incpath=( "${libdir[@]/%//../../include}" "${libdir[@]/%//../include}" "/usr/include" "/include" )
> > +libdir=( $(find ${prefix} -maxdepth 3 -type d -path */lib*/pkgconfig) )
> > +lib="$(basename $(dirname ${libdir[0]}))"
> 
> Only one libdir? Lost lib64 in translation? Not sure I understand this.

My expectation was that ${libdir[0]} is .../sysroot-target/usr/lib64/pkgconfig
in your case. I want to use it to find out if lib or lib64 is correct.
What's the result of the 'find' above?

> > +libdir+=( "${prefix/%//share/pkgconfig}" )
> > +system_libpath=( "${libdir[@]/%//../../${lib}}" "/usr/${lib}" "/${lib}" )
> 
> This looks strange to me. libdir contains lib64, but $lib is only "lib".
> 
> Doesn't this assume that system libpath is the same as the target?
> I'm a bit confused what the filtering needs to filter.
> Removing host directories, whatever they may be or removing directories
> that are similar to those we are including?

The .pc files usually generate search paths like this:
1. Relative to the .pc file itself. This results in something like this:
   -L[....]/sysroot-target/usr/lib64/pkgconfig/../../lib64
2. Absolute based on the prefix/libdir specified during configure etc.:
   -L/usr/lib64

So note that the second on is not really a host path but a target path
without the sysroot prefix.

> Couldn't host path filtering be of similar construction as the cross libdir?
> 
> > +system_incpath=( "${libdir[@]/%//../../include}" "/usr/include" "/include"

They are not really host paths. See above.

> Not sure i understand libdir to include path filtering either. :)
> This becomes sysroot-target/usr/lib{64}/pkgconfig/../../include,
> /usr/include. /include?

Correct. Those paths will be removed from the pkg-config output.

Michael

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


      reply	other threads:[~2021-05-07 12:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-22 19:59 [ptxdist] pkg-config-wrapper libdir confusion, ABI dynamic-linker path Christian Melki
2021-04-23  7:39 ` Michael Olbrich
2021-04-23  8:17   ` Christian Melki
2021-04-24 17:02   ` Christian Melki
2021-04-25  7:18     ` Michael Olbrich
2021-05-03 13:43       ` Christian Melki
2021-05-07  7:15         ` [ptxdist] [PATCH] pkg-config-wrapper: calculate the system paths dynamically as well Michael Olbrich
2021-05-07 11:14           ` Christian Melki
2021-05-07 12:14             ` Michael Olbrich [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210507121443.GJ28490@pengutronix.de \
    --to=m.olbrich@pengutronix.de \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox