So this just means that packages do not respect the environment. What about fixing them instead of trying to hack the environment?

On Wed, Jan 8, 2020, 23:53 Tom Stellard <tstellar@redhat.com> wrote:
On 12/23/2019 11:59 AM, Tom Stellard wrote:
> On 12/21/2019 02:30 PM, Tomasz Kłoczko wrote:
>>
>>
>> On Sat, 21 Dec 2019 at 00:37, Neal Gompa <ngompa13@gmail.com <mailto:ngompa13@gmail.com>> wrote:
>> [..]
>>
>>     I believe it's also used by the %cmake and %meson macros.
>>
>>
>> Yep.
>> Look on the output of the “rpm -E %cmake” and you will find that to switch to other C and C++ compilers all what you need to do is redefine %__cc and %__cxx macros,
>
> I'm not seeing this, at least with the current rawhide build, but I
> patched cmake to enable this in the latest mass rebuild that I'm doing.
> I'll post numbers on how effective using __cc and __cxx are once it's
> complete.
>

I completed a rebuild of all rawhide with the following modifications:

1. Added this to %set_build_flags

CC="${CC:-%{__cc}}" ; export CC ; \
CXX="${CXX:-%{__cxx}}"; export CXX ; \

2. Added %set_build_flags to %cmake macro

3. Remove -fstack-clash-protection and add -Qunused-arguments flags to %optflags

4. Set these macros:

config_opts['macros']['%__cc'] = "clang"
config_opts['macros']['%__cxx'] = "clang++"
config_opts['macros']['%__cpp'] = "clang-cpp"
config_opts['macros']['%build_cflags'] = optflags
config_opts['macros']['%build_cxxflags'] = optflags


Here are the results:

Packages Built: 4228
Built with clang: 2695
Built with gcc: 1533

Based on grep'ing logs, around 320 of the packages built with gcc invoke
gcc using cc or c++.  It's hard to know the exact number though, because
I'm not sure if all packages echo their build steps and also my grep expressions
may not have caught everything.

I suspect that if I can find some way to set the CC and CXX environment
variables for all builds, not just ones using autoconf, cmake or meson,
that might help cut down on the number of packages that still use gcc.
I'm just not quite sure how to implement this yet, but I'm looking into
it.

-Tom


> -Tom
>
>> The same is with %configure and %meson,
>>
>> In other words you can switch NOW from non-root account to other compiler without execution update-alternatives from root.
>>
>> In other words this proposal is pointless.
>>
>> kloczek
>> --
>> --
>> Tomasz Kłoczko | Tel: 0774 1209067 | LinkedIn: *http://lnkd.in/FXPWxH*
> _______________________________________________
> devel mailing list -- devel@lists.fedoraproject.org
> To unsubscribe send an email to devel-leave@lists.fedoraproject.org
> Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
> List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
> List Archives: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
>
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-leave@lists.fedoraproject.org
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org