# Generated by goreleaser
%bcond_without check

%global goipath         {{ .ImportPath }}
%global commit          {{ .FullCommit }}

%gometa -f

%global common_description %{expand:
{{ .Description }}}

{{ if .LicenseFileName }}
%global golicenses      {{ .LicenseFileName }}
{{ end }}
{{ if .Docs }}
%global godocs         {{ range .Docs }} {{ . }}{{ end }}
{{ end }}

Name:           %{goname}
Version:        {{ .Version }}
Release:        %autorelease -p
Summary:        {{ .Summary }}

License:        {{ .License }}
URL:            {{ .URL }}
Source:         {{ .Source }}

%description %{common_description}

%gopkg

%prep
%goprep

%generate_buildrequires
%go_generate_buildrequires

%build
{{ range $binary, $importPath := .Bins }}
%gobuild -o %{gobuilddir}/bin/{{ $binary }} {{ $importPath }}
{{ end }}

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

%if %{with check}
%check
%gocheck
%endif

%files
{{ range .Docs }}
%doc {{ . }}
{{ end }}
{{ if .LicenseFileName }}
%license {{ .LicenseFileName }}
{{ end }}
%{_bindir}/*

%gopkgfiles

%changelog
%autochangelog
