Re: git: 4df0e66a3662 - main - llvm.mk: add export/noexport to handle CC/CXX/CPP exports

From: Jan Beich <jbeich_at_FreeBSD.org>
Date: Wed, 13 Sep 2023 11:22:50 UTC
Emmanuel Vadot <manu@bidouilliste.com> writes:

> On Wed, 13 Sep 2023 08:55:48 +0300
> Gleb Popov <arrowd@freebsd.org> wrote:
>
>> On Wed, Sep 13, 2023 at 8:20?AM Tobias C. Berner <tcberner@freebsd.org> wrote:
>> >
>> > +  USES=llvm.mk now supports 'export' (default) and 'noexport' arguments.
>> > +  When export is set, CC, CXX and CPP will be set to the path corresponding
>> > +  to the chosen llvm-version.
>> 
>> The choice for the default seems strange to me. Now every port that
>> has USES=llvm will be switching to building with a non-base compiler.
>> Is this really a sensible default?
>
>  Isn't that what you want when you add USES=llvm ?

Changing CC is USES=compiler job. Contributors starting using USES=llvm
for changing Clang version because USES=compiler is poorly maintained.

I predominantly add USES=llvm to satisfy libLLVM (mesa-devel, rpcs3) or
libclang (USES=cargo + CARGO_CRATES=bindgen). In a few cases when I need
newer Clang (for C++20 std:ranges, C++23) I also need newer libc++ but
devel/llvm* maintainer refuses to provide libc++ (bug 260139).

Forcing CC/CXX/CPP without testing all consumers has a chance of
introducing regressions. For example, when using LTO it's important to
make sure CMake doesn't pick up /usr/bin/llvm-ar or /usr/bin/llvm-ranlib
because those may not support LLVM bitcode used by devel/llvm*.

https://cgit.freebsd.org/ports/commit/?id=5e71e4d45129
https://cgit.freebsd.org/ports/commit/?id=2ce01a07d7c9

While the affected ports had LTO enabled by default there's also
WITH_LTO knob handled by /usr/ports/Mk/Features/lto.mk.