File lz4-java.spec of Package lz4-java

#
# spec file for package lz4-java
#
# Copyright (c) 2024 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/
#


%global lz4_version 1.9.4
Name:           lz4-java
Version:        1.8.0
Release:        0
Summary:        LZ4 compression for Java
License:        Apache-2.0
Group:          Development/Libraries/Java
URL:            https://github.com/lz4/%{name}
Source0:        %{url}/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1:        %{url}/../lz4/archive/refs/tags/v%{lz4_version}.tar.gz#/lz4-%{lz4_version}.tar.gz
Patch1:         0001-remove-unsafe.patch
Patch2:         0002-remove-comments-from-templates.patch
Patch3:         0003-remove-cpptasks.patch
Patch4:         0004-remove-randomizedtesting-tests.patch
Patch5:         lz4-sourcetarget.patch
BuildRequires:  ant
BuildRequires:  aqute-bnd
BuildRequires:  bsh2
BuildRequires:  ivy-local
BuildRequires:  java-devel >= 1.8
BuildRequires:  mvel2

%description
LZ4 compression for Java, based on Yann Collet’s work available at
http://code.google.com/p/lz4/.

This library provides access to two compression methods that both generate a
valid LZ4 stream:
• fast scan (LZ4):
  - low memory footprint (~ 16 KB),
  - very fast (fast scan with skipping heuristics in case the input looks
    incompressible),
  - reasonable compression ratio (depending on the redundancy of the input).
• high compression (LZ4 HC):
  - medium memory footprint (~ 256 KB),
  - rather slow (~ 10 times slower than LZ4),
  - good compression ratio (depending on the size and the redundancy of the
    input).

The streams produced by those 2 compression algorithms use the same compression
format, are very fast to decompress and can be decompressed by the same
decompressor instance.

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

%description javadoc
API documentation for %{name}.

%prep
%setup -q
%patch -P 1 -p1
%patch -P 2 -p1
%patch -P 3 -p1
%patch -P 4 -p1
%patch -P 5 -p1
tar -Csrc/lz4 -xf %{SOURCE1} --strip=1
rm src/resources/net/jpountz/util/{{linux,win32}/*/*.so,darwin/*/*.dylib}

%pom_remove_dep com.carrotsearch.randomizedtesting:junit4-ant

%pom_xpath_replace 'info' \
    '<info organisation="org.lz4" module="lz4-java" revision="%{version}"/>'

%pom_xpath_replace 'ivy:cachepath[@module="mvel2"]' \
    "<path id='mvel.classpath' path='$(build-classpath mvel2)'/>" build.xml
%pom_xpath_replace 'ivy:cachepath[@pathid="bnd.classpath"]' \
    "<path id='bnd.classpath' path='$(build-classpath aqute-bnd)'/>" build.xml
%pom_xpath_replace 'ivy:cachepath[@pathid="bsh.classpath"]' \
    "<path id='bsh.classpath' path='$(build-classpath bsh2)'/>" build.xml

for i in lz4-java.bnd lz4-pure-java.bnd; do
    echo "-reproducible: true" >> ${i}
    echo "-noextraheaders: true" >> ${i}
    echo "-snapshot: SNAPSHOT" >> ${i}
done

%{mvn_alias} : net.jpountz.lz4:lz4

%{mvn_file} : %{name}

%build
ant

%install
%{mvn_artifact} dist/%{name}-%{version}.pom dist/%{name}-%{version}.jar
%mvn_install -J build/docs

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

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

%changelog
openSUSE Build Service is sponsored by