aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJani Välimaa <wally@mageia.org>2024-03-30 11:40:13 +0200
committerJani Välimaa <wally@mageia.org>2024-03-30 11:40:13 +0200
commit848a0e95c775f75fc3281ff222a77f229dfb813e (patch)
tree394bd388c64e9236cfc81bc42ff59f69a5f3c55d
parent57775198596c79341e2faf17fadee4db3ce4b5eb (diff)
downloadrpm-setup-848a0e95c775f75fc3281ff222a77f229dfb813e.tar
rpm-setup-848a0e95c775f75fc3281ff222a77f229dfb813e.tar.gz
rpm-setup-848a0e95c775f75fc3281ff222a77f229dfb813e.tar.bz2
rpm-setup-848a0e95c775f75fc3281ff222a77f229dfb813e.tar.xz
rpm-setup-848a0e95c775f75fc3281ff222a77f229dfb813e.zip
macros: add support for toolchain selection (GCC/Clang)
-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 \