My idea was to have general CC=, CXX=... options set in makepkg.conf, then makepkg would use: CFLAGS_GCC when CC=gcc and CFLAGS_CLANG when CC=clang This way instead of setting common minimal compatible flags we could enable all features that compiler have and maintainer/user would only need to set different CC= option in PKGBUILD or globally in makepkg.conf (it's already possible but flags have to be also manually changed).
-------- Original Message -------- Subject: Re: [arch-general] [arch-dev-public] Changing compilation flags From: arch-general@archlinux.org To: arch-general@archlinux.org Eli Schwartz <eschwartz93@gmail.com> On 07/08/2017 06:53 AM, LoneVVolf wrote:
On 08-07-17 04:31, Evangelos Foutras via arch-general wrote:
There are multiple ways the compiler can be selected; two of them are: 1) exporting CC/CXX in the PKGBUILD and 2) the project"s configure script picking one of the available compilers. makepkg can"t realistically know which compiler is going to be used and thus must have only one set of flags that is supported by both GCC and Clang.
An alternative solution would be to tailor things to the compiler used by the majority (gcc) and to avoid clang as much as possible. That would ocourse require special settings for packages compiled with clang.
NOTE : whether that is a good idea is another matter, but it IS an option. AIUI that is already what we do, in the sense that gcc is the assumed default everywhere, and our (C|CXX|LD)FLAGS are written with the assumption that gcc is the default compiler. Any packages that need to deviate from the default makepkg.conf flags (because they *already* have special settings to use clang, those settings are in the project build configuration files) can currently modify those flags on a PKGBUILD-by-PKGBUILD basis, or alternatively we can try to get clang to deal with basic gcc compatibility in a graceful manner. -- Eli Schwartz