Hi James,

James Le Cuirot <ch...@gentoo.org> writes:

>> > What if we want to bootstrap a brand new prefixed system using the
>> > crossdev system as SYSROOT? This is the distinct SYSROOT case. The
>> > problem is that there is no distinct variable for SYSROOT's prefix
>> > and, as already stated, ESYSROOT is always ${SYSROOT}${EPREFIX}. We
>> > therefore cannot do it! If the crossdev prefix is blank then ROOT's
>> > must be blank too.  
>> 
>> My question: is there a case when both SYSROOT and ESYSROOT are needed?
>> As far as I can see, SYSROOT is strictly build-time. Therefore setting
>> SYSROOT=<crossdev toolchain path> would be enough for all.
>> 
>> Why did ESYSROOT exist in the first place?  Was it only for the sake of
>> symmetry, or did I miss something?
>
> Remember that we now install packages to SYSROOT too. Portage needs to
> know the prefix so that it can set EPREFIX when building these
> packages. You'll already know that you can't fake EPREFIX by setting
> ROOT. We could potentially work out EPREFIX by comparing SYSROOT with
> BROOT and EROOT (instead of / and ROOT) but that's not the whole story.
>
> When using crossdev, pkg-config files are sourced from SYSROOT. These
> may return paths like -L/myprefix/usr/lib. If SYSROOT!=/ then
> pkg-config will need to translate this to -L/myroot/myprefix/usr/lib.
> However, it's bad to explicitly add lib and include paths that the
> toolchain would look at anyway as it can change the search order. Under
> a regular setup, pkg-config would omit -L/usr/lib -I/usr/include but for
> this to work in the above setup, we need to know that /myprefix is a
> prefix. As stated, we don't have an explicit variable for SYSROOT's
> prefix but we can work it out using ${ESYSROOT#${SYSROOT}}. This is
> what I have done in my pending cross-pkg-config fixes.
>
> None of that magic happens when not using crossdev. I have debated
> whether it should but native builds with SYSROOT!=/ tend to be a
> disaster for various other reasons so perhaps it's not worth worrying
> about.
>
> There are probably more reasons when we need to know the prefix but I
> can't remember what they are now. :)

I could only remotely understand your argument.  But I feel you know
what you are doing.  So go ahead.

And please excuse me if I raise this again in the future.

>> In conclusion, IMHO, if SYSROOT can be overridden without restriction
>> ("distinct" in your email), we could cover all the use cases.
>
> It's still a little bit restricted but less than it was and the only
> cases we don't handle are obscure ones that we wouldn't want to support
> anyway.
>
> When dealing with this stuff, it's worth remembering that practically no
> one has used crossdev with prefix until recently. I know this because
> I had to fix the glibc ebuild, Portage, and crossdev itself to make it
> work following a bug report this month. ;)

That is an heroic effort.

I have tried to bring together crossdev and Prefix together in the past
but found too many obstacles to achieve it.

Thank you a million times!

Yours,
Benda

Attachment: signature.asc
Description: PGP signature

Reply via email to