Update annobin plugin patch

Resolves: #2030667
This commit is contained in:
Marek Polacek 2022-01-04 11:34:18 -05:00
parent c6f5913fbc
commit 2e9ffefb81

View File

@ -127,8 +127,8 @@
# The next line has been stolen from redhat-rpm-config.spec.
# We install the version info into a file in this directory, rather than
# gcc's plugin directory, because there is no reliable way for redhat-rpm-config
# to determine the name of gcc's plugin directory. Plus there may be more than
# one plugin directory if different versions of gcc are installed.
# to determine the name of gcc's plugin directory.
# FIXME: We need a way to cope if more than one version of gcc is installed.
%global rrcdir /usr/lib/rpm/redhat
# A file that records information about the built gcc-annobin plugin.
@ -137,7 +137,7 @@
Summary: Various compilers (C, C++, Objective-C, ...)
Name: gcc
Version: %{gcc_version}
Release: %{gcc_release}.1%{?dist}
Release: %{gcc_release}.2%{?dist}
# libgcc, libgfortran, libgomp, libstdc++ and crtstuff have
# GCC Runtime Exception.
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD
@ -226,9 +226,10 @@ BuildRequires: graphviz, dblatex, texlive-collection-latex, docbook5-style-xsl
%endif
%if %{with annobin_plugin}
# Starting with release 9.93 annobin puts a copy of the sources in /usr/src/annobin
# Starting with release 10.01 annobin fixed a bug in its configure scripts which prevented them from working with a built but not installed compiler
BuildRequires: annobin >= 10.01
# Starting with release 9.93 annobin-plugin-gcc puts a copy of the sources in /usr/src/annobin
BuildRequires: annobin-plugin-gcc
# See The %%install phase for why we need xz.
BuildRequires: xz
%endif
@ -1302,7 +1303,7 @@ CC="${ccompiler}" CFLAGS="${comp_flags}" \
./configure ${CONFIG_ARGS} || cat config.log
echo "Building the annobin plugin"
make
make
echo "Annobin plugin build complete"
popd
@ -2126,14 +2127,27 @@ rm -f gcc-annobin.so.0 gcc-annobin.so
ln -s gcc-annobin.so.0.0.0 gcc-annobin.so.0
ln -s gcc-annobin.so.0.0.0 gcc-annobin.so
# Record information about the plugin.
mkdir -p %{buildroot}%{rrcdir}
# Note - the comparison logic in redhat-rpm-config's %%triggger macros require
# that the plugin builder information appear as "major.minor.revision-release",
# eg "11.2.1-1" on the first line of the version file.
echo "%{gcc_version}-%{gcc_release}" > %{buildroot}%{gver}
# Record information about the version of the compiler that built the plugin.
#
# Note - we cannot just store %%{gcc_version} and %%{gcc_release} as sometimes
# the gcc rpm version changes without the NVR being altered. See BZ #2030671
# for more discussion on this.
#
# Note that when performing a scratch build %%{release} will not contain
# a distribution tag. Ie it would be "1-7" rather than "1-7.fc36". This means
# that if a scratch build is installed, eg into a mock chroot, then the logic
# in redhat-rpm-config's redhat-annobin-plugin-select.sh script will always
# select the gcc built plugin no matter what. (Since the version string for
# the gcc built plugin can never match the version string for the annobin
# built plugin, as the annobin version string always includes a distribution
# tag). Sadly this is unavoidable.
mkdir -p %{buildroot}%{rrcdir}
echo "%{version}-%{release}" > %{buildroot}%{gver}
# Provide a more complete version information string on the second line.
# This is not used by the comparison logic, but makes the file more useful to humans.
# This is not used by the comparison logic in the redhat-annobin-plugin-select.sh
# script, but it does make the file more useful to humans.
echo "%{ANNOBIN_GCC_PLUGIN_DIR}/gcc-annobin.so.0.0.0 was built by gcc version %{gcc_version}-%{gcc_release} from the ${annobin_dir} sources" >> %{buildroot}%{gver}
popd
# endif for %{with annobin_plugin}
@ -2150,6 +2164,15 @@ ln -s gcc-annobin.so.0.0.0 gcc-annobin.so
popd > /dev/null
%endif
%if %{with annobin_plugin}
%preun
pushd %{ANNOBIN_GCC_PLUGIN_DIR} > /dev/null
# Compress the annobin plugin before it is removed. This avoids a warning from rpm.
rm -f gcc-annobin.so.0 gcc-annobin.so
xz -9 gcc-annobin.so.0.0.0
popd > /dev/null
%endif
%if %{with tests}
%check
cd obj-%{gcc_target_platform}
@ -3303,6 +3326,9 @@ end
%endif
%changelog
* Tue Jan 4 2022 Marek Polacek <polacek@redhat.com> 11.2.1-7.2
- update annobin plugin patch (#2030667)
* Thu Dec 16 2021 Marek Polacek <polacek@redhat.com> 11.2.1-7.1
- build annobin plugin (patch by Nick Clifton) (#2030667)