On 01/08/2020 11:28 PM, Miro HronĨok wrote:
On 08. 01. 20 23:47, Tom Stellard wrote:
> 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.
/usr/lib/rpm/macros has:
%___build_pre \
RPM_SOURCE_DIR=\"%{u2p:%{_sourcedir}}\"\
RPM_BUILD_DIR=\"%{u2p:%{_builddir}}\"\
RPM_OPT_FLAGS=\"%{optflags}\"\
RPM_LD_FLAGS=\"%{?build_ldflags}\"\
RPM_ARCH=\"%{_arch}\"\
RPM_OS=\"%{_os}\"\
RPM_BUILD_NCPUS=\"%{_smp_build_ncpus}\"\
export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_LD_FLAGS RPM_ARCH RPM_OS
RPM_BUILD_NCPUS RPM_LD_FLAGS\
RPM_DOC_DIR=\"%{_docdir}\"\
export RPM_DOC_DIR\
RPM_PACKAGE_NAME=\"%{NAME}\"\
RPM_PACKAGE_VERSION=\"%{VERSION}\"\
RPM_PACKAGE_RELEASE=\"%{RELEASE}\"\
export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
LANG=C\
export LANG\
unset CDPATH DISPLAY ||:\
%{?buildroot:RPM_BUILD_ROOT=\"%{u2p:%{buildroot}}\"\
export RPM_BUILD_ROOT}\
%{?_javaclasspath:CLASSPATH=\"%{_javaclasspath}\"\
export CLASSPATH}\
PKG_CONFIG_PATH=\"${PKG_CONFIG_PATH}:%{_libdir}/pkgconfig:%{_datadir}/pkgconfig\"\
export PKG_CONFIG_PATH\
CONFIG_SITE=${CONFIG_SITE:-NONE}\
export CONFIG_SITE\
\
%{verbose:set -x}\
umask 022\
cd \"%{u2p:%{_builddir}}\"\
You should b able to expand (redefine anywhere else) this macro to set the variables you
need or call %set_build_flags.
I did another mass rebuild, this time setting the CC and CXX environment variables
in __build_pre as you suggested. The numbers look a little better now:
Packages Built: 4271
Built with clang: 3355
Built with gcc: 916
cc or c++ was invoked by about 50 packages.
-Tom