File jd.spec of Package jd
#
# spec file for package jd
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: jd
Version: 2.2.7
Release: 0
Summary: Go program and library for JSON diff and patch
License: MIT
URL: https://github.com/josephburnett/jd
Source: jd-%{version}.tar.gz
Source1: vendor.tar.gz
BuildRequires: go >= 1.24
%description
jd is a commandline utility and Go library for diffing and patching JSON and
YAML values. It supports a native jd format (similar to unified format) as well
as JSON Merge Patch (RFC 7386) and a subset of JSON Patch (RFC 6902). Try it
out at http://play.jd-tool.io/.
%prep
%autosetup -p1 -a 1
mv vendor v2
%build
cd v2
cp "$(go env GOROOT)/lib/wasm/wasm_exec.js" web/assets/ || exit 1
GOOS=js GOARCH=wasm go build -o web/assets/jd.wasm ./web/ui/main.go
go run web/pack/main.go
cd jd
go build \
-mod=vendor \
-buildmode=pie \
-tags include_web \
-o ../../bin/jd
%install
install -D -m 0755 bin/%{name} %{buildroot}/%{_bindir}/%{name}
%check
cd v2
go test .
go test ./jd
%{buildroot}/%{_bindir}/%{name} -version | grep %{version}
%files
%doc README.md
%license LICENSE
%{_bindir}/%{name}
%changelog