test: run clang build too

This commit is contained in:
Luca Boccassi 2022-08-29 14:20:25 +01:00
parent 42dfa0c11b
commit 9f2673bf3a
2 changed files with 13 additions and 3 deletions

View File

@ -6,3 +6,5 @@ dnf -y build-dep test.spec
rpmbuild --define '_sourcedir .' --define '_builddir .' -bb test.spec
dnf -y build-dep test.spec -D "_with_ld_lld 1"
rpmbuild --with ld_lld --define '_sourcedir .' --define '_builddir .' -bb test.spec
dnf -y build-dep test.spec -D "_with_clang 1"
rpmbuild --with clang --define '_sourcedir .' --define '_builddir .' -bb test.spec

View File

@ -1,9 +1,13 @@
%bcond_with ld_lld
%bcond_with clang
%if %{with ld_lld}
%global extra_ldflags -fuse-ld=lld
%global _package_note_linker lld
%endif
%if %{with clang}
%global toolchain clang
%endif
Name: test
Version: 1
@ -11,7 +15,11 @@ Release: 1
Summary: Test package for checking package notes
License: MIT
%if %{with clang}
BuildRequires: clang
%else
BuildRequires: gcc
%endif
# For %check
BuildRequires: binutils
BuildRequires: jq
@ -24,10 +32,10 @@ Test package for checking package notes
%build
echo 'int main(int argc, char **argv) { return 0; }' | %{build_cc} ${CFLAGS} -x c -c - -o main.o
%{build_cc} ${LDFLAGS} %{?extra_ldflags} main.o -o main
%{build_cc} -Werror ${LDFLAGS} %{?extra_ldflags} main.o -o main
# Package notes not supported with lld, so the the build succeeding is enough.
%if %{without ld_lld}
# Package notes not supported with clang, so the the build succeeding is enough.
%if %{without clang}
%check
# avoid any attempt to access the network by readelf
export DEBUGINFOD_URLS=