%global upstream_version 1.5.2-3 %global short_version %(echo %{upstream_version} | sed 's/-.*//') # no debugsource is generated since the shared object is not installed %undefine _debugsource_packages Name: zstd-jni Version: %(echo %{upstream_version} | tr - .) Release: 1%{?dist} Summary: JNI bindings for Zstd native library License: BSD URL: https://github.com/luben/zstd-jni # ./generate-tarball.sh Source0: %{name}-%{version}.tar.gz Source1: https://repo1.maven.org/maven2/com/github/luben/zstd-jni/%{upstream_version}/zstd-jni-%{upstream_version}.pom Patch1: 0001-Suppress-warnings.patch Patch2: 0002-Remove-dependency-on-internal-headers.patch ExclusiveArch: %{java_arches} BuildRequires: gcc BuildRequires: libzstd-devel = %{short_version} BuildRequires: maven-local Requires: libzstd = %{short_version} %description JNI bindings for Zstd native library that provides fast and high compression lossless algorithm for Android, Java and all JVM languages. It features: * static compress/decompress methods * implementation of InputStream and OutputStream for transparent compression of data streams fully compatible with the "zstd" program. * minimal performance overhead %package javadoc BuildArch: noarch Summary: Javadoc for %{name} %description javadoc Javadoc for %{name}. %prep %setup -q -n zstd-jni-%{upstream_version} %patch1 -p1 %patch2 -p1 cp -p %{SOURCE1} pom.xml %pom_remove_dep :scalatest_2.13 %pom_remove_dep :scalacheck_2.13 # Java file containing the version cat > src/main/java/com/github/luben/zstd/util/ZstdVersion.java << EOF package com.github.luben.zstd.util; public class ZstdVersion { public static final String VERSION = "%{upstream_version}"; } EOF %mvn_file : %{name} %build # JNI headers CPATH+=:%{_jvmdir}/java/include:%{_jvmdir}/java/include/linux export CPATH # create a path for the result that corresponds to what the Java code searches for native_path=linux/$(echo 'System.out.println(System.getProperty("os.arch"))' | jshell -) mkdir -p ${native_path} %{build_cc} -o ${native_path}/libzstd-jni-%{upstream_version}.so -fPIC -shared -lzstd %{build_cflags} %{build_ldflags} src/main/native/*.c # tests require scala and a package scalatest, which we do not have %mvn_build jar -uf target/zstd-jni-%{upstream_version}.jar ${native_path}/libzstd-jni-%{upstream_version}.so %install %mvn_install %files -f .mfiles %license LICENSE %doc README.md %files javadoc -f .mfiles-javadoc %license LICENSE %changelog * Mon May 16 2022 Marian Koncek - 1.5.2.3-1 - Initial release