%global debug_package %nil
Name:                snappy-java
Version:             1.1.10.9
Release:             1
Summary:             Fast compressor/decompresser
License:             Apache-2.0
URL:                 http://xerial.org/snappy-java/
Source0:             https://github.com/xerial/snappy-java/archive/v%{version}/%{name}-%{version}.tar.gz
Source1:             https://repo1.maven.org/maven2/org/xerial/snappy/%{name}/%{version}/%{name}-%{version}.pom

BuildRequires:       make gcc-c++ libstdc++-static snappy-devel
BuildRequires:       maven-local mvn(org.apache.felix:maven-bundle-plugin)
BuildRequires:       mvn(org.osgi:osgi.core)
Requires:            snappy

%description
A Java port of the snappy, a fast compresser/decompresser written in C++.

%package javadoc
Summary:             Javadoc for %{name}
BuildArch:           noarch

%description javadoc
This package contains the API documentation for %{name}.

%prep
%autosetup -p1
find -name "*.class" -print -delete
find -name "*.jar" -print -delete
rm -r ./*sbt* project
find -name "*.jnilib" -print -delete
find -name "*.dll" -print -delete
find -name "*.so" -print -delete
find -name "*.a" -print -delete
find -name "*.h" -print -delete
cp %{SOURCE1} pom.xml
%pom_change_dep org.osgi:org.osgi.core :osgi.core
%pom_xpath_remove "pom:dependency[pom:scope = 'test']"
%pom_add_plugin org.apache.felix:maven-bundle-plugin:2.5.4 . '
<extensions>true</extensions>
<configuration>
  <instructions>
    <Bundle-Activator>org.xerial.snappy.SnappyBundleActivator</Bundle-Activator>
    <Bundle-ActivationPolicy>lazy</Bundle-ActivationPolicy>
    <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
    <Bundle-Version>${project.version}</Bundle-Version>
    <Import-Package>org.osgi.framework,*</Import-Package>
  </instructions>
</configuration>
<executions>
  <execution>
    <id>bundle-manifest</id>
    <phase>process-classes</phase>
    <goals>
      <goal>manifest</goal>
    </goals>
  </execution>
</executions>'
%pom_add_plugin org.apache.maven.plugins:maven-compiler-plugin:3.0 . '
<configuration>
 <source>1.8</source>
 <target>1.8</target>
</configuration>'
chmod 644 NOTICE README.md
for file in LICENSE NOTICE README.md; do
 sed -i.orig 's|\r||g' $file
 touch -r $file.orig $file
 rm $file.orig
done

%build
CXXFLAGS="${CXXFLAGS:-%optflags}"
export CXXFLAGS
%mvn_build -f -- -Dproject.build.sourceEncoding=UTF-8

%install
%mvn_install

%files -f .mfiles
%doc README.md
%license LICENSE NOTICE

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

%changelog
* Fri Nov 13 2026 xu_ping <707078654@qq.com> - 1.1.10.9-1
- Update to 1.1.10.9 to fix CVE-2026-116590
- Remove CVE-2026-108106.patch, upstream 1.1.10.9 already contains the fix

* Mon Oct 12 2026 gaoyukun <gaoyukun@kylinos.cn> - 1.1.10.8-5
- Fix CVE-2026-108106

* Mon Apr 27 2026 yaoxin <1024769339@qq.com> - 1.1.10.8-3
- Delete the dependencies that have been removed

* Tue Mar 17 2026 yaoxin <1024769339@qq.com> - 1.1.10.8-2
- Fix build failure

* Fri Aug 01 2025 yaoxin <1024769339@qq.com> - 1.1.10.8-1
- Update to 1.1.10.8:
  * Add support for IBM ppc 64 little endian
  * feat: add support to x64 systems using musl
  * Remove the problematic catch of OOM.
  * Fix the scope of the default values in SnappyOutputStream

* Wed Oct 09 2024 Ge Wang <wang__ge@126.com> - 1.1.10.7-1
- Upgrade to 1.1.10.7

* Thu Mar 21 2024 yaoxin <yao_xin001@hoperun.com> - 1.1.10.5-1
- Upgrade to 1.1.10.5

* Tue Sep 26 2023 wangkai <13474090681@163.com> - 1.1.2.4-3
- Fix CVE-2023-43642

* Mon Jul 03 2023 wangkai <13474090681@163.com> - 1.1.2.4-2
- Fix CVE-2023-34455 and CVE-2023-34454

* Tue Jul 28 2020 leiju <leiju4@huawei.com> - 1.1.2.4-1
- Package init