# Generated by go2rpm 1.14.0
%bcond check 1

# https://github.com/terrastruct/d2
%global goipath         oss.terrastruct.com/d2
%global forgeurl        https://github.com/terrastruct/d2
Version:                0.6.8

%gometa -L -f

%global common_description %{expand:
D2 is a modern diagram scripting language that turns text to diagrams.}

Name:           d2
Release:        %autorelease
Summary:        Modern diagram scripting language that turns text to diagrams

# Generated by go-vendor-tools
License:        Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND FTL AND ISC AND MIT AND MPL-2.0
URL:            %{gourl}
Source0:        %{gosource}
# Generated by go-vendor-tools
Source1:        %{archivename}-vendor.tar.bz2
Source2:        go-vendor-tools.toml

BuildRequires:  go-vendor-tools
%if %{with check}
BuildRequires:  git-core
%endif

%description %{common_description}

%prep
%goprep -A
%setup -q -T -D -a1 %{forgesetupargs}

%generate_buildrequires
%go_vendor_license_buildrequires -c %{S:2}

%build
%gobuild -o %{gobuilddir}/bin/d2 %{goipath}

%install
%go_vendor_license_install -c %{S:2}
install -m 0755 -vd                     %{buildroot}%{_bindir}
install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/
install -Dpm0644 -t %{buildroot}%{_mandir}/man1 ci/release/template/man/d2.1

%check
%go_vendor_license_check -c %{S:2}
%if %{with check}
# Disable tests that require Internet access
# This is too coarse, we should only disable tests that trigger playwright
# installation (i.e. those converting to png)
%gocheck -t e2etests-cli
%endif

%files -f %{go_vendor_license_filelist}
%license vendor/modules.txt
%doc docs README.md
%{_bindir}/d2
%{_mandir}/man1/d2.1*

%changelog
%autochangelog