diff --git a/CMakeLists.txt b/CMakeLists.txt index 9047b5a97d..6cfed13254 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3441,6 +3441,9 @@ if(RPMBUILD_EXECUTABLE) list(APPEND _rpmbuild_with_args -v) endif() endif() + if(CMAKE_C_COMPILER_ID STREQUAL "Clang") + list(APPEND _rpmbuild_with_args --with toolchain_clang) + endif() if(CMAKE_GENERATOR STREQUAL "Ninja") list(APPEND _rpmbuild_with_args --with ninja) endif() diff --git a/packaging/rpm/wireshark.spec.in b/packaging/rpm/wireshark.spec.in index 0c5595499d..cc9ac8a15e 100644 --- a/packaging/rpm/wireshark.spec.in +++ b/packaging/rpm/wireshark.spec.in @@ -3,8 +3,9 @@ # says that recent CMake versions take care of rpathification. # To do: -# - Add bcond_with clang +# - Support clang with non Fedora distributions +%bcond_with toolchain_clang %bcond_with ninja %bcond_with ccache %bcond_without qt5 @@ -22,6 +23,16 @@ %bcond_with ilbc %bcond_with opus +# Fedora options to use clang as the compiler +# https://docs.fedoraproject.org/en-US/packaging-guidelines/#compiler +%if %{with toolchain_clang} +%if 0%{?fedora} +%global toolchain clang +%else +%global toolchain gcc +%endif +%endif + # Set at most one of these two: # Note that setcap requires rpmbuild 4.7.0 or later. %global setuid_dumpcap 0 @@ -49,7 +60,11 @@ Packager: Gerald Combs BuildRequires: cmake >= 3.10 BuildRequires: python3 +%if %{with toolchain_clang} +BuildRequires: clang +%else BuildRequires: gcc +%endif BuildRequires: perl BuildRequires: flex %if %{with ninja} @@ -204,7 +219,9 @@ Summary: Wireshark's Qt-based GUI Group: Applications/Internet Obsoletes: wireshark-gnome < %{version} wireshark-gtk < %{version} Requires: %{name} = %{version}-%{release} +%if %{without toolchain_clang} BuildRequires: gcc-c++ +%endif %if 0%{?suse_version} BuildRequires: libQt5Core-devel BuildRequires: libQt5Gui-devel