## START: Set by rpmautospec
## (rpmautospec version 0.3.0)
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 9;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

# Generated by go2rpm 1.2
%bcond_without check

# https://github.com/nanomsg/mangos
%global goipath         go.nanomsg.org/mangos/v3
%global forgeurl        https://github.com/nanomsg/mangos
Version:                3.2.1

%gometa

%global common_description %{expand:
Mangos is a pure Golang implementation of nanomsg's "Scalablilty Protocols".}

%global golicenses      LICENSE
%global godocs          examples AUTHORS CODE_OF_CONDUCT.md README.adoc\\\
                        macat/README.md macat/macat.txt

Name:           %{goname}
Release:        %autorelease
Summary:        Golang implementation of nanomsg's "Scalablilty Protocols"

# Upstream license specification: Apache-2.0
License:        ASL 2.0
URL:            %{gourl}
Source0:        %{gosource}

BuildRequires:  golang(github.com/gdamore/optopia)
BuildRequires:  golang(github.com/gorilla/websocket)

%description
%{common_description}

%gopkg

%prep
%goprep
rm -rf examples/websocket/.gitignore

%build
for cmd in macat/macat perf; do
  %gobuild -o %{gobuilddir}/bin/$(basename $cmd) %{goipath}/$cmd
done

%install
%gopkginstall
install -m 0755 -vd                     %{buildroot}%{_bindir}
install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/

%ifnarch aarch64
%if %{with check}
%check
# SHA1-RSA has been deprecated in Go 1.18
# https://github.com/nanomsg/mangos/issues/251
export GODEBUG=x509sha1=1
%gocheck
%endif
%endif

%files
%license LICENSE
%doc examples AUTHORS CODE_OF_CONDUCT.md README.adoc macat/README.md
%doc macat/macat.txt
%{_bindir}/*

%gopkgfiles

%changelog
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> 3.2.1-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> 3.2.1-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Tue Jul 19 2022 Maxwell G <gotmax@e.email> 3.2.1-7
- Rebuild for
  CVE-2022-{1705,32148,30631,30633,28131,30635,30632,30630,1962} in golang

* Sat Jun 18 2022 Robert-André Mauchin <zebob.m@gmail.com> 3.2.1-6
- Rebuilt for CVE-2022-1996, CVE-2022-24675, CVE-2022-28327,
  CVE-2022-27191, CVE-2022-29526, CVE-2022-30629

* Wed Feb 23 2022 Robert-André Mauchin <zebob.m@gmail.com> 3.2.1-5
- Fix FTBFS Close: rhbz#2045654

* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Sun May 30 2021 Fabian Affolter <mail@fabian-affolter.ch> - 3.2.1-1
- Update to latest upstream version 3.2.1

* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

* Tue Oct 13 2020 Fabian Affolter <mail@fabian-affolter.ch> - 3.1.3-1
- Initial package for Fedora