Page MenuHomeFreeBSD

If CROSS_TOOLCHAIN isn't set, look for base toolchain makefiles.
AcceptedPublic

Authored by jhb on Mar 6 2019, 6:22 PM.

Details

Summary

These are installed in /usr/share/toolchains. Just hardcode the two
possible names for now rather than invoking ls to get a list.

Test Plan
  • built a self-hosted world + kernel with base/* and suitable files in /usr/share/toolchains. These files set suitable settings per my mail to toolchains@ to turn off the build of base components that are replaced by the base packages and also fixup 'make delete-old' to not delete bits installed by the packages.
  • also tested that 'make buildenv' creates an environment where the Right Thing (tm) happens

Note that I originally pursued a plan of support arbitrary files in
/etc/src.conf.d/, however, there is the problem of ignoring them
when CROSS_TOOLCHAIN is set to support cross builds and the risk of
invoking 'ls' to enumerate those files in each invocation of
make, etc. Note that the installed files I will add to the ports
shortly have to use 'export' for WITH/WITHOUT options since they
are only included in Makefile.inc1 and not by sub-makes.

Diff Detail

Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 22916
Build 22002: arc lint + arc unit

Event Timeline

jhb created this revision.Mar 6 2019, 6:22 PM
lwhsu added a subscriber: lwhsu.Mar 27 2019, 7:43 AM
bapt accepted this revision.Mar 27 2019, 2:24 PM
This revision is now accepted and ready to land.Mar 27 2019, 2:24 PM
bdrewery accepted this revision.Mar 27 2019, 9:00 PM

Technically seems fine.
Feels like a POLA issue though. If I happened to have some package installed then buildworld behaved differently.
Maybe CROSS_TOOLCHAIN=yes or CROSS_TOOLCHAIN=base?
I don't really care either way; default on like you have is fine too as I don't fully understand the use case.

jhb added a comment.Mar 27 2019, 10:53 PM

Technically seems fine.
Feels like a POLA issue though. If I happened to have some package installed then buildworld behaved differently.
Maybe CROSS_TOOLCHAIN=yes or CROSS_TOOLCHAIN=base?
I don't really care either way; default on like you have is fine too as I don't fully understand the use case.

My goal was that if a user has installed base/binutils or base/gcc, I wanted 'make buildworld' to work as-is rather than defaulting to building and installing older binaries that overwrote the files installed by the package. For a platform where external GCC becomes the only toolchain I don't think they should have to remember to use 'make CROSS_TOOLCHAIN=foo' every time. The separate files approach also lets a platform only use base/binutils if, for example, clang works, but lld does not.

jhb added a comment.EditedMar 30 2019, 12:08 AM

FYI, as an update I found that this did break a cross-build that didn't use an explicit CROSS_TOOLCHAIN, e.g. make buildworld TARGET_ARCH=i386. I haven't committed this yet or the port changes to add the new files. I'll have to think a bit more about what the right solution is. I'd really like this to be seamless in terms of the base toolchain just being used without having to have an explicit CROSS_TOOLCHAIN.

imp added a subscriber: imp.Aug 8 2019, 8:36 PM
imp added inline comments.
Makefile.inc1
71

I think we want to gate this on some option like WITH_EXT_TOOLCHAIN so that you don't run afoul of situations where these are installed, but you don't want to use them for some builds.