Gentoo Archives: gentoo-dev

From: Ambroz Bizjak <ambrop7@×××××.com>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] RFC: method of checking for cross compilation from ebuild functions
Date: Thu, 20 Sep 2012 17:36:22
Message-Id: CAOA3yKLj=RZYrK5E-mJTcG-zVdyQ-wgShuTNP0imECS1SNGFjQ@mail.gmail.com
1 I'm working on some EAPI extensions with the goal of making Portage
2 more powerful for cross-compilation. See
3 https://bugs.gentoo.org/show_bug.cgi?id=317337
4 Currently, it's come down to the following:
5
6 - A new dependency type HDEPEND for packages which must be installed
7 in / at build time. With HDEPEND present in the new EAPI (probably
8 4-hdepend), DEPEND will always mean ROOT (target) dependencies, and
9 will no longer be affected by --root-deps option.
10
11 - Another dependency type CROSS_HDEPEND, like HDEPEND, but in effect
12 only when cross compiling. This in particular is required for packages
13 which need themselves on the host when cross compiling, and adding
14 this to HDEPEND would make a package not buildable on native due to a
15 circular dependency.
16
17 - A --crosscompile option to tell emerge when we are cross compiling,
18 and this triggers CROSS_HDEPEND (except for installs to /). Basically
19 we don't want emerge doing any black magic guessing like comparing
20 CHOST.
21
22 But the one thing missing currently is a way to check from within an
23 ebuild function whether we are cross compiling, in a way that would
24 correspond directly to --crosscompile (again, except for /). There is
25 currently "tc-is-cross-compiler" from toolchain-funcs.eclass, but this
26 may not work right when not at build time (pkg_{pre,post}{inst,rm}),
27 and it also may not correspond to presence of --crosscompile.
28
29 The question now is, how should this method for checking
30 --crosscompile be implemented? In particular, we have two options:
31
32 - Environment variable. If so, how to call it? Possible names are
33 CROSSCOMPILE, GENTOO_CROSSCOMPILE, PORTAGE_CROSSCOMPILE,
34 ECROSSCOMPILE... For more generic names (CROSSCOMPILE) it needs to be
35 taken into account that they may inadvertently affect packages.
36 However environment vars have the benefit that it's easy to pass them
37 through programs and scripts.
38
39 - Internal function, similar to "use". Probably "is_crosscompile".
40 This may look nicer and reduces the risk of collisions.
41
42 This RFC is only about checking for presence of --crosscompile. Please
43 do not discuss HDEPEND in general here, or anything that would require
44 major effort to get done.

Replies