%global debug_package %nil
Name:                lz4-java
Version:             1.7.1
Release:             2
Summary:             LZ4 compression for Java
License:             Apache-2.0
URL:                 https://github.com/jpountz/lz4-java
Source0:             https://github.com/jpountz/lz4-java/archive/%{version}.tar.gz
Patch0:              0-remove-unsafe.patch
Patch1:              1-remove-comments-from-templates.patch
Patch2:              2-remove-cpptasks.patch
Patch3:              3-remove-randomizedtesting-tests.patch
BuildRequires:       ant ant-junit aqute-bnd cpptasks ivy-local java-devel javapackages-local mvel gcc xxhash-devel
BuildRequires:       objectweb-asm randomizedtesting-junit4-ant bea-stax-api xerces-j2 apache-parent lz4 lz4-devel
Requires:            javapackages-tools

Provides:            bundled(lz4) = r122
Provides:            bundled(libxxhash) = r37
%description
LZ4 compression for Java, based on Yann Collet's work.
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:             Javadoc for %{name}
BuildArch:           noarch
%description javadoc
This package contains javadoc for %{name}.

%prep
%setup -q -n %{name}-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
find -name '*.dylib' -print -delete
find -name '*.so' -print -delete

%build
pushd /usr/lib/jvm
dirname=`ls | grep java-1.8.0-openjdk-`
javapath=/usr/lib/jvm/$dirname
popd
export JAVA_HOME=$javapath
export LIB_DIR=/usr/lib64/
ant -Divy.mode=local -Divy.revision=1.7.1 -Divy.pom.version=1.7.1 jar test docs makepom
bnd wrap -p lz4-java.bnd -o dist/lz4-java-%{version}.jar --version %{version} dist/lz4-java.jar

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

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

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

%changelog
* Tue May 10 2022 wangkai <wangkai385@h-partners.com> - 1.7.1-2
- License compliance rectification

* Tue Jan 18 2022 SimpleUpdate Robot <tc@openeuler.org> - 1.7.1-1
- Upgrade to version 1.7.1

* Wed Jun 09 2021 wulei <wulei80@huawei.com> - 1.3.0-2
- fixes failed: Could not launch gcc

* Tue Aug 25 2020 Jeffery.Gao <gaojianxing@huawei.com> - 1.3.0-1
- Package init
