# Generated by go2rpm 1.19.0 and customized for Fedora / Copr %bcond check 1 # Disable debugsource package since Go builds statically link and bundle symbols %global debug_package %{nil} # https://github.com/d2lang/d2 %global goipath github.com/d2lang/d2 Version: 0.8.2 %gometa -L -f Name: d2 Release: %autorelease Summary: Modern declarative diagram scripting language that turns text into diagrams # Generated by go-vendor-tools License: Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND EPL-2.0 AND ISC AND MIT AND MPL-2.0 AND OFL-1.1 URL: %{gourl} Source0: %{gosource} # Generated by go-vendor-tools Source1: %{archivename}-vendor.tar.bz2 Source2: go-vendor-tools.toml Source3: d2diagrameditor.py Source4: SKILL.md BuildRequires: go-vendor-tools %description D2 is a modern diagram scripting language that turns text to diagrams. It provides clean syntax, multi-board composition, extensible layout engines (including Dagre and Eclipse Layout Kernel / ELK), themes, and direct SVG export. %package zim Summary: Zim Desktop Wiki plugin for D2 diagrams BuildArch: noarch Requires: %{name} = %{version}-%{release} Requires: zim Recommends: librsvg2-tools %description zim A plugin for Zim Desktop Wiki providing interactive D2 diagram editing, live preview, and native SVG rendering within notebook pages. %package skill Summary: AI Agent Skill definitions for D2 diagramming BuildArch: noarch Requires: %{name} = %{version}-%{release} %description skill Skill definitions, schema patterns, and prompt instructions for AI coding agents (Antigravity CLI, Crush, OpenCode, Claude) to author and refactor declarative D2 diagrams. %prep %goprep -A tar -xf %{S:1} # Relax Go toolchain requirement to allow builds across Go 1.26+ distributions sed -i -e 's/^go 1.27/go 1.26/' go.mod %generate_buildrequires %go_vendor_license_buildrequires -c %{S:2} %build %global gomodulesmode GO111MODULE=on %gobuild -o %{gobuilddir}/bin/d2 -ldflags="-s -w -X %{goipath}/lib/version.Version=v%{version}" %{goipath} %install %go_vendor_license_install -c %{S:2} install -Dpm 0755 %{gobuilddir}/bin/d2 %{buildroot}%{_bindir}/d2 install -Dpm 0644 ci/release/template/man/d2.1 %{buildroot}%{_mandir}/man1/d2.1 install -Dpm 0644 %{SOURCE3} %{buildroot}%{_datadir}/zim/plugins/d2diagrameditor.py install -Dpm 0644 %{SOURCE4} %{buildroot}%{_datadir}/d2/skills/d2-diagramming/SKILL.md %check %go_vendor_license_check -c %{S:2} %if %{with check} %{gobuilddir}/bin/d2 version %{gobuilddir}/bin/d2 layout %endif %files -f %{go_vendor_license_filelist} %doc README.md %{_bindir}/d2 %{_mandir}/man1/d2.1* %dir %{_datadir}/d2 %files zim %{_datadir}/zim/plugins/d2diagrameditor.py %files skill %dir %{_datadir}/d2/skills %dir %{_datadir}/d2/skills/d2-diagramming %{_datadir}/d2/skills/d2-diagramming/SKILL.md %changelog %autochangelog