Add llvm dependency if clang toolchain used

Also remove the in-repo test for this functionality. This was not
actually enabled, and is the wrong test kind to boot (tmt rather
than sti). The actual test for this lives in the corresponding
tests repository.

Resolves: rhbz#2193406
This commit is contained in:
Nikita Popov 2023-05-08 10:52:50 +02:00
parent bc835f7074
commit 1b3b6ded14
8 changed files with 8 additions and 96 deletions

View File

@ -6,7 +6,7 @@
Summary: Red Hat specific rpm configuration files
Name: redhat-rpm-config
Version: 200
Version: 201
Release: 1%{?dist}
# No version specified.
License: GPL+
@ -127,6 +127,9 @@ Requires: %{_bindir}/grep
Requires: %{_bindir}/sed
Requires: %{_bindir}/xargs
# for brp-llvm-compile-lto-elf
Requires: (llvm if clang)
# -fstack-clash-protection and -fcf-protection require GCC 8.
Conflicts: gcc < 8.0.1-0.22
@ -250,6 +253,10 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua
%doc buildflags.md
%changelog
* Mon May 08 2023 Nikita Popov <npopov@redhat.com> - 201-1
- Add llvm dependency if clang toolchain used
- Resolves: rhbz#2193406
* Wed Apr 19 2023 Nikita Popov <npopov@redhat.com> - 200-1
- Change clang LTO default to ThinLTO
- Resolves: rhbz#2178788

View File

@ -1,5 +0,0 @@
#include <stdio.h>
void hello(void) {
printf("Hello, world!\n");
}

View File

@ -1,34 +0,0 @@
Name: brp-llvm-compile-lto-elf-test-lib
Version: 1
Release: 1
Summary: Library package for testing brp-llvm-compile-lto-elf
License: MIT
BuildRequires: clang binutils
Source0: %{name}.c
Source1: %{name}.h
# FIXME: I'm not sure why this doesn't work
%undefine _package_note_file
%global toolchain clang
%description
%{summary}
%build
clang ${CFLAGS} -c %{SOURCE0} -o lib.o
ar cr %{name}.a lib.o
ranlib %{name}.a
%install
mkdir -p %{buildroot}%{_libdir}
mkdir -p %{buildroot}%{_includedir}
%{__install} -p -m 644 -t %{buildroot}%{_libdir} %{name}.a
%{__install} -p -m 644 -t %{buildroot}%{_includedir} %{SOURCE1}
%files
%{_libdir}/%{name}.a
%{_includedir}/%{name}.h

View File

@ -1,6 +0,0 @@
#include <brp-llvm-compile-lto-elf-test-lib.h>
int main(int argc, char **argv) {
hello();
return 0;
}

View File

@ -1,24 +0,0 @@
Name: brp-llvm-compile-lto-elf-test
Version: 1
Release: 1
Summary: Library package for testing brp-llvm-compile-lto-elf
License: MIT
BuildRequires: gcc
BuildRequires: brp-llvm-compile-lto-elf-test-lib
Source0: %{name}.c
# FIXME: I'm not sure why this doesn't work
%undefine _package_note_file
%description
%{summary}
%build
gcc ${CFLAGS} -c %{SOURCE0} -o %{name}.o
gcc ${LDFLAGS} %{name}.o %{_libdir}/%{name}-lib.a -o %{name}
%check
./%{name} | grep "Hello, world!"

View File

@ -1,8 +0,0 @@
Summary: Test that the brp-llvm-compile-lto-elf script is working correctly
require:
- dnf-plugins-core
- redhat-rpm-config
- rpm-build
test: ./runtest.sh

View File

@ -1,17 +0,0 @@
#!/bin/bash
set -ex
lib_dir=brp-llvm-compile-lto-elf-test-lib
lib_spec=$lib_dir/brp-llvm-compile-lto-elf-test-lib.spec
dnf -y build-dep $lib_spec
rpmbuild --define "_sourcedir ." --define "_builddir ./$lib_dir" --define "_rpmdir ." -bb $lib_spec
dnf -y install ./`rpm --eval '%{_arch}'`/*.rpm
test_dir=brp-llvm-compile-lto-elf-test
test_spec=$test_dir/brp-llvm-compile-lto-elf-test.spec
dnf -y build-dep $test_spec
rpmbuild --define "_sourcedir ." --define "_builddir ./$test_dir" -bi $test_spec