From b45b9b2415b3a8b6e68f81d5a2d5f0243e2175fd Mon Sep 17 00:00:00 2001 From: Viktor Ashirov Date: Wed, 20 Sep 2017 12:20:57 +0200 Subject: [PATCH] Issue 49400 - Add clang support to rpm builds Bug Description: Server falis to build using clang because we need to explicitly link to libatomic. Fix Description: Explicitly link to libatomic. Add support for clang in spec file. https://pagure.io/389-ds-base/issue/49400 Reviewed by: ??? --- Makefile.am | 2 +- rpm/389-ds-base.spec.in | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index c491fd963..24cb7612d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -137,7 +137,7 @@ AM_LDFLAGS = -lpthread else #AM_LDFLAGS = -Wl,-z,defs # Provide the tcmalloc links if needed -AM_LDFLAGS = $(ASAN_DEFINES) $(PROFILING_LINKS) $(TCMALLOC_LINK) +AM_LDFLAGS = $(ASAN_DEFINES) $(PROFILING_LINKS) $(TCMALLOC_LINK) -latomic endif #end hpux # https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html#Updating-version-info diff --git a/rpm/389-ds-base.spec.in b/rpm/389-ds-base.spec.in index 30a1d7d9a..2ca420f46 100644 --- a/rpm/389-ds-base.spec.in +++ b/rpm/389-ds-base.spec.in @@ -27,6 +27,9 @@ %endif %endif +# Use Clang instead of GCC +%global use_clang 0 + # fedora 15 and later uses tmpfiles.d # otherwise, comment this out %{!?with_tmpfiles_d: %global with_tmpfiles_d %{_sysconfdir}/tmpfiles.d} @@ -62,7 +65,12 @@ BuildRequires: cyrus-sasl-devel BuildRequires: icu BuildRequires: libicu-devel BuildRequires: pcre-devel +BuildRequires: libatomic +%if %{use_clang} +BuildRequires: clang +%else BuildRequires: gcc-c++ +%endif # The following are needed to build the snmp ldap-agent BuildRequires: net-snmp-devel BuildRequires: bzip2-devel @@ -253,6 +261,10 @@ The lib389 CI tests that can be run against the Directory Server. cp %{SOURCE2} README.devel %build +%if %{use_clang} +export CC=clang +export CXX=clang++ +%endif %{?with_tmpfiles_d: TMPFILES_FLAG="--with-tmpfiles-d=%{with_tmpfiles_d}"} # hack hack hack https://bugzilla.redhat.com/show_bug.cgi?id=833529 -- 2.14.2