#
# spec file for package agrona
#
# 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: agrona
Version: 2.2.2
Release: 0
Summary: High Performance data structures and utility methods for Java
License: Apache-2.0
Group: Development/Libraries/Java
URL: https://github.com/real-logic/%{name}
Source0: %{url}/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: https://repo1.maven.org/maven2/org/%{name}/%{name}/%{version}/%{name}-%{version}.pom
Source2: https://repo1.maven.org/maven2/org/%{name}/%{name}-agent/%{version}/%{name}-agent-%{version}.pom
BuildRequires: fdupes
BuildRequires: java-devel >= 17
BuildRequires: maven-local
BuildRequires: mvn(net.bytebuddy:byte-buddy)
BuildRequires: mvn(org.codehaus.mojo:build-helper-maven-plugin)
BuildRequires: mvn(org.codehaus.mojo:exec-maven-plugin)
BuildArch: noarch
%description
Agrona provides a library of data structures and utility methods that are a
common need when building high-performance applications in Java. Many of these
utilities are used in the Aeron efficient reliable UDP unicast, multicast, and
IPC message transport and provides high-performance buffer implementations to
support the Simple Binary Encoding Message Codec.
%package javadoc
Summary: API documentation for %{name}
Group: Documentation/HTML
%description javadoc
API documentation for %{name}.
%prep
%autosetup
cp %{SOURCE1} %{name}/pom.xml
cp %{SOURCE2} %{name}-agent/pom.xml
%pom_add_dep org.%{name}:%{name}:%{version} %{name}-agent
%pom_add_dep net.bytebuddy:byte-buddy %{name}-agent
cat >pom.xml <<__POM__
4.0.0org.%{name}%{name}-parent%{version}pom%{name}%{name}-agent
__POM__
sed -i \
-e 's#src/main/java/#%{name}/src/main/java/#' \
-e 's#build/generated-src#%{name}/target/generated-sources/java#' \
%{name}/src/main/java/org/agrona/generation/SpecialisationGenerator.java
%pom_add_plugin org.apache.maven.plugins:maven-compiler-plugin %{name} \
'1717compile-generatorgenerate-sourcescompilecompile-generated-sourcesprocess-sourcescompile'
%pom_add_plugin org.apache.maven.plugins:maven-compiler-plugin %{name}-agent \
'1111'
%pom_add_plugin org.codehaus.mojo:exec-maven-plugin %{name} \
'process-sourcesjavaorg.agrona.generation.SpecialisationGenerator'
%pom_add_plugin org.codehaus.mojo:build-helper-maven-plugin %{name} \
'generate-sourcesadd-sourcetarget/generated-sources/java'
%pom_add_plugin org.apache.maven.plugins:maven-jar-plugin %{name} \
'org.agrona.coreAgronaReal Logic Limited%{version}org.agrona.coreorg.agrona.core'
%pom_add_plugin org.apache.maven.plugins:maven-jar-plugin %{name}-agent \
'org.agrona.agentAgronaReal Logic Limited%{version}org.agrona.agent.BufferAlignmentAgentorg.agrona.agent.BufferAlignmentAgenttruetrue'
%build
%{mvn_build} -f -- \
-DlegacyMode=true -Dverbose=true
%install
%{mvn_package} :%{name}-parent __noinstall
%mvn_install
%fdupes %{buildroot}%{_javadocdir}/%{name}
%files -f .mfiles
%license LICENSE
%doc README.md
%files javadoc -f .mfiles-javadoc
%license LICENSE
%changelog