Allow redhat-rpm-config to select between two different versions of the annobin plugin for gcc

Resolves: #2030671
This commit is contained in:
Nick Clifton 2022-02-01 14:24:48 +00:00
parent 9a446ffeac
commit a981ac7ed2
2 changed files with 25 additions and 2 deletions

View File

@ -1,2 +0,0 @@
*cc1_options:
+ %{!-fno-use-annobin:%{!iplugindir*:%:find-plugindir()} -fplugin=annobin}

1
redhat-annobin-cc1 Symbolic link
View File

@ -0,0 +1 @@
redhat-annobin-select-annobin-built-plugin

View File

@ -23,6 +23,9 @@ Source52: redhat-hardened-clang.cfg
# gcc specs files for annobin builds
Source60: redhat-annobin-cc1
Source61: redhat-annobin-select-gcc-built-plugin
Source62: redhat-annobin-select-annobin-built-plugin
Source63: redhat-annobin-plugin-select.sh
# The macros defined by these files are for things that need to be defined
# at srpm creation time when it is not feasible to require the base packages
@ -111,6 +114,7 @@ Requires: rpm >= 4.11.0
Requires: dwz >= 0.4
Requires: zip
Requires: (annobin if (gcc or clang))
Requires: (gcc-plugin-annobin if gcc)
# for brp-mangle-shebangs
Requires: %{_bindir}/find
@ -160,6 +164,21 @@ mkdir -p %{buildroot}%{_rpmluadir}/fedora/{rpm,srpm}
install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora common.lua
install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua
# This trigger is used to decide which version of the annobin plugin for gcc
# should be used. See comments in the script for full details.
%triggerin -- annobin-plugin-gcc gcc
%{rrcdir}/redhat-annobin-plugin-select.sh
%end
# We also trigger when annobin is uninstalled. This allows us to switch
# over to the gcc generated version of the plugin. It does not matter if
# gcc is uninstalled, since if that happens the plugin cannot be used.
%triggerpostun -- annobin-plugin-gcc
%{rrcdir}/redhat-annobin-plugin-select.sh
%end
%files
%dir %{rrcdir}
%{rrcdir}/macros
@ -186,6 +205,11 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua
%{_rpmluadir}/fedora/*.lua
%{_rpmluadir}/fedora/srpm/*lua
%attr(0755,-,-) %{rrcdir}/redhat-annobin-plugin-select.sh
%verify(owner group mode) %{rrcdir}/redhat-annobin-cc1
%{rrcdir}/redhat-annobin-select-gcc-built-plugin
%{rrcdir}/redhat-annobin-select-annobin-built-plugin
%doc buildflags.md
%changelog