diff --git a/redhat-annobin-cc1 b/redhat-annobin-cc1 deleted file mode 100644 index edb8245..0000000 --- a/redhat-annobin-cc1 +++ /dev/null @@ -1,2 +0,0 @@ -*cc1_options: -+ %{!-fno-use-annobin:%{!iplugindir*:%:find-plugindir()} -fplugin=annobin} diff --git a/redhat-annobin-cc1 b/redhat-annobin-cc1 new file mode 120000 index 0000000..25d2836 --- /dev/null +++ b/redhat-annobin-cc1 @@ -0,0 +1 @@ +redhat-annobin-select-annobin-built-plugin \ No newline at end of file diff --git a/redhat-rpm-config.spec b/redhat-rpm-config.spec index 5e97b9e..a4cc99b 100644 --- a/redhat-rpm-config.spec +++ b/redhat-rpm-config.spec @@ -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