aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--macros.in27
2 files changed, 28 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 8d6718e..34cc601 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+- macros: add support for toolchain selection (GCC/Clang)
+
Version 2.75.1 - 24 March 2024, by Jani Välimaa
- configure: force armv7hl target arch when building for armv7hl with armv8l/aarch64 host machine
- macros: make _host_cpu identical with _target_cpu as ATM rpm uses real build
diff --git a/macros.in b/macros.in
index bea66b9..c9acf17 100644
--- a/macros.in
+++ b/macros.in
@@ -192,6 +192,29 @@ GCONF_CONFIG_SOURCE=`%{_gconftool_bin} --get-default-source` %{_gconftool_bin} -
# '%{version}-%{release}', ie. to automatically add distepoch or epoch if present
%EVRD %{?epoch:%{epoch}:}%{?version:%{version}}%{?release:-%{release}}%{?distepoch::%{distepoch}}
+# GCC toolchain
+%__cc_gcc gcc
+%__cxx_gcc g++
+%__cpp_gcc gcc -E
+
+# Clang toolchain
+%__cc_clang clang
+%__cxx_clang clang++
+%__cpp_clang clang-cpp
+
+# Default to the GCC toolchain
+%toolchain gcc
+
+%__cc %{expand:%%{__cc_%{toolchain}}}
+%__cxx %{expand:%%{__cxx_%{toolchain}}}
+%__cpp %{expand:%%{__cpp_%{toolchain}}}
+
+# Compiler macros to use for invoking compilers in spec files for packages that
+# want to use the default compiler and don't care which compiler that is.
+%build_cc %{__cc}
+%build_cxx %{__cxx}
+%build_cpp %{__cpp}
+
#==============================================================================
# ---- compiler flags.
@@ -237,7 +260,9 @@ GCONF_CONFIG_SOURCE=`%{_gconftool_bin} --get-default-source` %{_gconftool_bin} -
VALAFLAGS="${VALAFLAGS:-%{build_valaflags}}" ; export VALAFLAGS ; \
RUSTFLAGS="${RUSTFLAGS:-%{build_rustflags}}" ; export RUSTFLAGS ; \
LDFLAGS="${LDFLAGS:-%{build_ldflags}}" ; export LDFLAGS ; \
- LT_SYS_LIBRARY_PATH="${LT_SYS_LIBRARY_PATH:-%_libdir:}" ; export LT_SYS_LIBRARY_PATH
+ LT_SYS_LIBRARY_PATH="${LT_SYS_LIBRARY_PATH:-%_libdir:}" ; export LT_SYS_LIBRARY_PATH \
+ CC="${CC:-%{__cc}}" ; export CC ; \
+ CXX="${CXX:-%{__cxx}}" ; export CXX
# For compatibility
%setup_compile_flags \