rpm: Support for building with clang on Fedora

Fedora now supports rpm options to build with clang as the compiler
https://docs.fedoraproject.org/en-US/packaging-guidelines/#compiler
This commit is contained in:
John Thacker 2022-01-19 09:12:55 -05:00
parent 62100da7f4
commit 2b24b512ca
2 changed files with 21 additions and 1 deletions

View File

@ -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()

View File

@ -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 <gerald[AT]wireshark.org>
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