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.