File gopass.spec of Package failed_gopass

Name:           gopass
Version:        1.15.16
Release:        2.1
Summary:        The slightly-more modern password manager for teams
License:        MIT
URL:            https://github.com/gopasspw/gopass
Source0:        gopass-%{version}.tar.gz
Source1:        vendor.tar.xz
Patch0:         do-not-strip.patch

BuildRequires:  go >= 1.24
BuildRequires:  make
BuildRequires:  git
BuildRequires:  gcc
BuildRequires:  pkgconfig

%description
gopass is the slightly-more modern password manager for teams that uses
gpg for encryption and git for versioning.

%prep
%setup -q -n gopass-%{version}
%if %{patch0}
%patch0 -p1
%endif

%build
# Ensure cgo is enabled in the build environment, some build modes (PIE/external linking)
# require cgo. Make sure git is present via BuildRequires so the Makefile can use it;
# in case git is not available the Makefile often falls back to GOPASS_REVISION, but
# enabling CGO here prevents the build error about external linking.
export CGO_ENABLED=1
# Provide GOPASS_REVISION to match upstream expectations (prefix 'v' is used upstream)
GOPASS_REVISION=v%{version} /usr/bin/make -j%{?_smp_mflags} PREFIX=/usr GOPASS_REVISION=v%{version}

%install
rm -rf %{buildroot}
mkdir -p %{buildroot}/usr/bin
# upstream Makefile supports install target
/usr/bin/make PREFIX=/usr GOPASS_REVISION=v%{version} DESTDIR=%{buildroot} install

%files
%license LICENSE
%doc README.md
%{_bindir}/gopass
%dir /usr/share/man
%dir /usr/share/man/man1
%doc /usr/share/man/man1/gopass.1*

%changelog
* Sun Aug 10 2025 Packager <packager@example.org> - 1.15.16-2.1
- BuildRequires: add git
- Enable CGO in %build to satisfy PIE/external linking requirement
openSUSE Build Service is sponsored by