Up to [cvs.NetBSD.org] / pkgsrc / mk / tools
Request diff between arbitrary revisions
Keyword substitution: kv
Default branch: MAIN
mk: New CROSS_* variable scheme for cross-compilation.
This change brings in support for cross-OS-compilation.
Caveat: Existing mk.conf files used for cross-compilation no longer
work; they must be adapted to the new scheme.
Under this new scheme, if an mk.conf variable X can be different for
native and cross builds like OPSYS, MACHINE_ARCH, LOCALBASE, &c., you
just define X in mk.conf to set it for native builds, and CROSS_X in
mk.conf to set it for cross builds.
Example:
LOCALBASE= /home/riastradh/pkgsrc/cross/pkg
CROSS_LOCALBASE= /opt/pkg
CROSS_MACHINE_ARCH= powerpc
For now, _all_ OS-related variables must be defined in cross-builds;
none are filled in automatically. For NetBSD, this means:
CROSS_OPSYS= NetBSD
CROSS_OS_VERSION= 10.0
CROSS_OPSYS_VERSION= 100000
CROSS_LOWER_OPSYS= netbsd
CROSS_LOWER_OPSYS_VERSUFFIX=# empty
CROSS_LOWER_OS_VARIANT= # empty
CROSS_LOWER_VARIANT_VERSION=# empty
CROSS_LOWER_VENDOR= # empty
This new scheme may raise make(1) costs by making a lot of variables
like OPSYS expand to conditionals rather than fixed strings. It is
difficult to make these fixed strings because:
- they can only be committed _after_ mk.conf is loaded, before which
USE_CROSS_COMPILE isn't yet determined, but
- the conditionals must be applied _before_ the rest of bsd.own.mk
which uses these variables.
So we can't just have conditionals in bsd.prefs.mk after loading
bsd.own.mk -- we would need to put the conditionals in the middle of
bsd.own.mk between loading mk.conf and everything else.
As a followup commit, we can consider committing the variables after
bsd.own.mk as an optimization so that the conditional expansions are
only used inside bsd.own.mk and not in any other infrastructure. Or
we can consider putting a hook inside bsd.own.mk for committing the
variables there too. But let's see how this works out in practice
first.