The NetBSD Project

CVS log for pkgsrc/mk/tools/cross.NetBSD.mk

[BACK] Up to [cvs.NetBSD.org] / pkgsrc / mk / tools

Request diff between arbitrary revisions


Keyword substitution: kv
Default branch: MAIN


Revision 1.1: download - view: text, markup, annotated - select for diffs
Fri Apr 12 19:53:25 2024 UTC (2 years, 7 months ago) by riastradh
Branches: MAIN
CVS tags: pkgsrc-2026Q3-base, pkgsrc-2026Q3, pkgsrc-2026Q2-base, pkgsrc-2026Q2, pkgsrc-2026Q1-base, pkgsrc-2026Q1, pkgsrc-2025Q4-base, pkgsrc-2025Q4, pkgsrc-2025Q3-base, pkgsrc-2025Q3, pkgsrc-2025Q2-base, pkgsrc-2025Q2, pkgsrc-2025Q1-base, pkgsrc-2025Q1, pkgsrc-2024Q4-base, pkgsrc-2024Q4, pkgsrc-2024Q3-base, pkgsrc-2024Q3, pkgsrc-2024Q2-base, pkgsrc-2024Q2, HEAD
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.

Diff request

This form allows you to request diffs between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.

Log view options

CVSweb <webmaster@jp.NetBSD.org>