Fix build with go 1.22 and build flags

- Fix incompatibility of the build with go 1.22
  Patches by Carlos Rodriguez-Fernandez <carlosrodrifernandez@gmail.com>
- Reenable PIE in the captree tool
  Patch by Carlos Rodriguez-Fernandez <carlosrodrifernandez@gmail.com>
- Use sbindir location provided by rpm
  Patches by Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>

Related: RHEL-33498

Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
This commit is contained in:
Anderson Toshiyuki Sasaki 2024-05-30 11:53:42 +02:00
parent f5cb5d2a59
commit 4901e2f8c2

View File

@ -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 <ansasaki@redhat.com> - 2.69-4
- Add manpages for pam_cap and capability.conf (by Carlos Rodriguez-Fernandez <carlosrodrifernandez@gmail.com>)
- Fix incompatibility of the build with go 1.22 (by Carlos Rodriguez-Fernandez <carlosrodrifernandez@gmail.com>)
- Reenable PIE in the captree tool (by Carlos Rodriguez-Fernandez <carlosrodrifernandez@gmail.com>)
- Use sbindir location provided by rpm (by Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>)
* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.69-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild