From 4901e2f8c2b22f66914349db5592a0b10937e101 Mon Sep 17 00:00:00 2001 From: Anderson Toshiyuki Sasaki Date: Thu, 30 May 2024 11:53:42 +0200 Subject: [PATCH] Fix build with go 1.22 and build flags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix incompatibility of the build with go 1.22 Patches by Carlos Rodriguez-Fernandez - Reenable PIE in the captree tool Patch by Carlos Rodriguez-Fernandez - Use sbindir location provided by rpm Patches by Zbigniew Jędrzejewski-Szmek Related: RHEL-33498 Signed-off-by: Anderson Toshiyuki Sasaki --- libcap.spec | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/libcap.spec b/libcap.spec index 003b9c6..d2047e3 100644 --- a/libcap.spec +++ b/libcap.spec @@ -17,7 +17,14 @@ BuildRequires: glibc-static BuildRequires: gnupg2 %ifarch %{golang_arches} -BuildRequires: golang >= 1.11 +BuildRequires: golang >= 1.22 +%endif + +%if "%{_sbindir}" == "%{_bindir}" +# Compat symlinks for Requires in other packages. +# We rely on filesystem to create the symlinks for us. +Requires: filesystem(unmerged-sbin-symlinks) +Provides: /usr/sbin/setcap %endif %description @@ -62,15 +69,14 @@ the capability status of processes and threads. gzip -cd %{SOURCE0} | %{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data=- %autosetup -p1 - %build -%make_build prefix=%{_prefix} lib=%{_lib} GO_BUILD_FLAGS="-ldflags=-linkmode=external" all +%make_build prefix=%{_prefix} lib=%{_lib} SBINDIR=%{_sbindir} CGO_REQUIRED=1 GO_BUILD_FLAGS="-buildmode=pie -ldflags='-B gobuildid'" all %check make test %install -%make_install prefix=%{_prefix} lib=%{_lib} GO_BUILD_FLAGS="-ldflags=-linkmode=external" +%make_install prefix=%{_prefix} lib=%{_lib} SBINDIR=%{_sbindir} CGO_REQUIRED=1 GO_BUILD_FLAGS="-buildmode=pie -ldflags='-B gobuildid'" mkdir -p %{buildroot}/%{_mandir}/man{2,3,5,8} mv -f doc/*.3 %{buildroot}/%{_mandir}/man3/ @@ -117,6 +123,9 @@ chmod +x %{buildroot}/%{_libdir}/*.so.* %changelog * Thu May 30 2024 Anderson Toshiyuki Sasaki - 2.69-4 - Add manpages for pam_cap and capability.conf (by Carlos Rodriguez-Fernandez ) +- Fix incompatibility of the build with go 1.22 (by Carlos Rodriguez-Fernandez ) +- Reenable PIE in the captree tool (by Carlos Rodriguez-Fernandez ) +- Use sbindir location provided by rpm (by Zbigniew Jędrzejewski-Szmek ) * Thu Jan 25 2024 Fedora Release Engineering - 2.69-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild