File pcap4j.spec of Package pcap4j

#
# spec file for package pcap4j
#
# 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:           pcap4j
Version:        1.8.2
Release:        0
Summary:        A Java library for capturing, crafting, and sending packets
License:        MIT
Group:          Development/Libraries/Java
URL:            https://www.%{name}.org/
Source0:        https://github.com/kaitoy/%{name}/archive/refs/tags/%{name}-%{version}.tar.gz
BuildRequires:  fdupes
BuildRequires:  maven-local
BuildRequires:  mvn(net.java.dev.jna:jna)
BuildRequires:  mvn(org.apache.maven.plugins:maven-dependency-plugin)

%description
Pcap4J is a Java library for capturing, crafting and sending packets. Pcap4J
wraps a native packet capture library (libpcap, WinPcap, or Npcap) via JNA and
provides you Java-Oriented APIs.

%package javadoc
Summary:        API documentation for %{name}
Group:          Documentation/HTML

%description javadoc
API documentation for %{name}.

%prep
%autosetup -n %{name}-%{name}-%{version}

%pom_xpath_set 'pom:plugin[pom:artifactId="maven-compiler-plugin"]/pom:configuration/pom:source' 8
%pom_xpath_set 'pom:plugin[pom:artifactId="maven-compiler-plugin"]/pom:configuration/pom:target' 8

%pom_remove_plugin :maven-toolchains-plugin

sed -i -e 's/slf4j\.api/org.slf4j/' \
	pcap4j-core/src/main/java/module-info.java

%build
%{mvn_build} -f -- \
	-Dproject.build.outputTimestamp=$(date -u -d @${SOURCE_DATE_EPOCH:-$(date +%%s)} +%%Y-%%m-%%dT%%H:%%M:%%SZ)

%install
%mvn_install
%fdupes %{buildroot}%{_javadocdir}/%{name}

%files -f .mfiles
%license LICENSE
%doc {CHANGES,README*}.md

%files javadoc -f .mfiles-javadoc
%license LICENSE

%changelog
openSUSE Build Service is sponsored by