[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gentoo-dev
Subject:    [gentoo-dev] RFC: method of checking for cross compilation from ebuild functions
From:       Ambroz Bizjak <ambrop7 () gmail ! com>
Date:       2012-09-20 17:34:45
Message-ID: CAOA3yKLj=RZYrK5E-mJTcG-zVdyQ-wgShuTNP0imECS1SNGFjQ () mail ! gmail ! com
[Download RAW message or body]

I'm working on some EAPI extensions with the goal of making Portage
more powerful for cross-compilation. See
https://bugs.gentoo.org/show_bug.cgi?id=317337
Currently, it's come down to the following:

- A new dependency type HDEPEND for packages which must be installed
in / at build time. With HDEPEND present in the new EAPI (probably
4-hdepend), DEPEND will always mean ROOT (target) dependencies, and
will no longer be affected by --root-deps option.

- Another dependency type CROSS_HDEPEND, like HDEPEND, but in effect
only when cross compiling. This in particular is required for packages
which need themselves on the host when cross compiling, and adding
this to HDEPEND would make a package not buildable on native due to a
circular dependency.

- A --crosscompile option to tell emerge when we are cross compiling,
and this triggers CROSS_HDEPEND (except for installs to /). Basically
we don't want emerge doing any black magic guessing like comparing
CHOST.

But the one thing missing currently is a way to check from within an
ebuild function whether we are cross compiling, in a way that would
correspond directly to --crosscompile (again, except for /). There is
currently "tc-is-cross-compiler" from toolchain-funcs.eclass, but this
may not work right when not at build time (pkg_{pre,post}{inst,rm}),
and it also may not correspond to presence of --crosscompile.

The question now is, how should this method for checking
--crosscompile be implemented? In particular, we have two options:

- Environment variable. If so, how to call it? Possible names are
CROSSCOMPILE, GENTOO_CROSSCOMPILE, PORTAGE_CROSSCOMPILE,
ECROSSCOMPILE... For more generic names (CROSSCOMPILE) it needs to be
taken into account that they may inadvertently affect packages.
However environment vars have the benefit that it's easy to pass them
through programs and scripts.

- Internal function, similar to "use". Probably "is_crosscompile".
This may look nicer and reduces the risk of collisions.

This RFC is only about checking for presence of --crosscompile. Please
do not discuss HDEPEND in general here, or anything that would require
major effort to get done.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic