Page MenuHomeFreeBSD

Don't override CC with cmake and CROSS_TOOLCHAIN
Needs ReviewPublic

Authored by brooks on Mar 12 2021, 7:43 PM.

Details

Reviewers
bapt
jhb
Group Reviewers
portmgr
Summary

The current native (non-qemu-user-mode) cross build support works by
overriding CC, CXX, etc with versions that build target binaries. This
doesn't work with CMake because it expects that those build native
binaries and that a toolchain file be supplied to build target binaries.

This change includes the toolchain file to get XCC, etc, but doesn't
override CC when USES contains cmake.

Diff Detail

Repository
rP FreeBSD ports repository
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 37800
Build 34689: arc lint + arc unit

Event Timeline

With this I've been able to construct a set of changes to llvm-devel to allow it to cross build a dependency-free version of clang which is most of the way to having base/llvm* ports suitable for use with a root fs containing no compiler.

This seems fine to me in terms of how it effects using CROSS_TOOLCHAIN for base/*, but I can't speak to whether or not checking USES directly is the best way to check for cmake.

Doing this we might miss cases where the cmake uses is inherited from a USES (which does not exist in the ports tree - yet ? but is a valid usage)

In D29236#669332, @bapt wrote:

Doing this we might miss cases where the cmake uses is inherited from a USES (which does not exist in the ports tree - yet ? but is a valid usage)

Hmm, an alternative might be do gate this on defined(GNU_CONFIGURE) instead, but I think that also suffers from the implied definition issue since this is so early in bsd.port.mk (actual code doesn't start until after line 1000).

We could also do something gross like adding an && !defined(DONT_OVERRIDE_TOOLCHAIN_FOR_CROSS_TOOLCHAIN). At the moment, I just want something that works since the current code makes it impossible to cross build cmake ports.