summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--libdeflate-gcc-13.3-binutils-2.40.patch71
-rw-r--r--libdeflate.spec77
-rw-r--r--sources1
4 files changed, 150 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..0873d15 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/libdeflate-1.21.tar.gz
diff --git a/libdeflate-gcc-13.3-binutils-2.40.patch b/libdeflate-gcc-13.3-binutils-2.40.patch
new file mode 100644
index 0000000..db65bec
--- /dev/null
+++ b/libdeflate-gcc-13.3-binutils-2.40.patch
@@ -0,0 +1,71 @@
+From 7f9179e0dcff95f0d194cc007ed93b8000610bee Mon Sep 17 00:00:00 2001
+From: Eric Biggers <ebiggers@google.com>
+Date: Tue, 6 Aug 2024 22:50:18 -0700
+Subject: [PATCH] lib/arm: avoid build error with gcc 13.3 + binutils 2.40
+
+Resolves https://github.com/ebiggers/libdeflate/issues/383
+---
+ lib/arm/adler32_impl.h | 18 ++++++++++++------
+ lib/arm/crc32_impl.h | 18 ++++++++++++------
+ 2 files changed, 24 insertions(+), 12 deletions(-)
+
+diff --git a/lib/arm/adler32_impl.h b/lib/arm/adler32_impl.h
+index 6144afbc..9e833c39 100644
+--- a/lib/arm/adler32_impl.h
++++ b/lib/arm/adler32_impl.h
+@@ -214,13 +214,19 @@ adler32_arm_neon(u32 adler, const u8 *p, size_t len)
+ # ifdef __clang__
+ # define ATTRIBUTES _target_attribute("dotprod")
+ /*
+- * With gcc 13.1 and earlier (before gcc commit 73d3bc348190 or 9aac37ab8a7b,
+- * "aarch64: Remove architecture dependencies from intrinsics"),
+- * arch=armv8.2-a is needed for the dotprod intrinsics, unless the default
+- * target is armv8.3-a or later in which case it must be omitted. armv8.3-a
+- * or later can be detected by checking for __ARM_FEATURE_JCVT.
++ * Both gcc and binutils originally considered dotprod to depend on
++ * arch=armv8.2-a or later. This was fixed in gcc 13.2 by commit
++ * 9aac37ab8a7b ("aarch64: Remove architecture dependencies from intrinsics")
++ * and in binutils 2.41 by commit 205e4380c800 ("aarch64: Remove version
++ * dependencies from features"). Unfortunately, always using arch=armv8.2-a
++ * causes build errors with some compiler options because it may reduce the
++ * arch rather than increase it. Therefore we try to omit the arch whenever
++ * possible. If gcc is 14 or later, then both gcc and binutils are probably
++ * fixed, so we omit the arch. We also omit the arch if a feature that
++ * depends on armv8.2-a or later (in gcc 13.1 and earlier) is present.
+ */
+-# elif GCC_PREREQ(13, 2) || defined(__ARM_FEATURE_JCVT)
++# elif GCC_PREREQ(14, 0) || defined(__ARM_FEATURE_JCVT) \
++ || defined(__ARM_FEATURE_DOTPROD)
+ # define ATTRIBUTES _target_attribute("+dotprod")
+ # else
+ # define ATTRIBUTES _target_attribute("arch=armv8.2-a+dotprod")
+diff --git a/lib/arm/crc32_impl.h b/lib/arm/crc32_impl.h
+index 53630416..01d0283a 100644
+--- a/lib/arm/crc32_impl.h
++++ b/lib/arm/crc32_impl.h
+@@ -551,13 +551,19 @@ crc32_arm_pmullx4(u32 crc, const u8 *p, size_t len)
+ # ifdef __clang__
+ # define ATTRIBUTES _target_attribute("aes,crc,sha3")
+ /*
+- * With gcc 13.1 and earlier (before gcc commit 73d3bc348190 or 9aac37ab8a7b,
+- * "aarch64: Remove architecture dependencies from intrinsics"),
+- * arch=armv8.2-a is needed for the sha3 intrinsics, unless the default
+- * target is armv8.3-a or later in which case it must be omitted. armv8.3-a
+- * or later can be detected by checking for __ARM_FEATURE_JCVT.
++ * Both gcc and binutils originally considered sha3 to depend on
++ * arch=armv8.2-a or later. This was fixed in gcc 13.2 by commit
++ * 9aac37ab8a7b ("aarch64: Remove architecture dependencies from intrinsics")
++ * and in binutils 2.41 by commit 205e4380c800 ("aarch64: Remove version
++ * dependencies from features"). Unfortunately, always using arch=armv8.2-a
++ * causes build errors with some compiler options because it may reduce the
++ * arch rather than increase it. Therefore we try to omit the arch whenever
++ * possible. If gcc is 14 or later, then both gcc and binutils are probably
++ * fixed, so we omit the arch. We also omit the arch if a feature that
++ * depends on armv8.2-a or later (in gcc 13.1 and earlier) is present.
+ */
+-# elif GCC_PREREQ(13, 2) || defined(__ARM_FEATURE_JCVT)
++# elif GCC_PREREQ(14, 0) || defined(__ARM_FEATURE_JCVT) \
++ || defined(__ARM_FEATURE_DOTPROD)
+ # define ATTRIBUTES _target_attribute("+crypto,+crc,+sha3")
+ # else
+ # define ATTRIBUTES _target_attribute("arch=armv8.2-a+crypto+crc+sha3")
diff --git a/libdeflate.spec b/libdeflate.spec
new file mode 100644
index 0000000..01591a3
--- /dev/null
+++ b/libdeflate.spec
@@ -0,0 +1,77 @@
+%global debug_package %{nil}
+
+Name: libdeflate
+Version: 1.21
+Release: 1
+Summary: Fast implementation of DEFLATE, gzip, and zlib
+License: MIT
+URL: https://github.com/ebiggers/libdeflate
+Source0: https://github.com/ebiggers/libdeflate/releases/download/v%{version}/%{name}-%{version}.tar.gz
+Patch0: libdeflate-gcc-13.3-binutils-2.40.patch
+
+BuildRequires: gcc cmake ninja-build zlib-devel
+
+%description
+libdeflate is a library for fast, whole-buffer DEFLATE-based compression and
+decompression, supporting DEFLATE, gzip, and zlib.
+
+
+%package devel
+Summary: Development files for libdeflate
+Requires: %{name}%{?_isa} = %{version}-%{release}
+
+%description devel
+Development files for libdeflate.
+
+
+%package utils
+Summary: Binaries from libdeflate
+Requires: %{name}%{?_isa} = %{version}-%{release}
+
+%description utils
+Binaries from libdeflate.
+
+%prep
+%autosetup -p1
+
+%build
+%cmake \
+ -DLIBDEFLATE_BUILD_STATIC_LIB:BOOL=OFF \
+ -DLIBDEFLATE_BUILD_SHARED_LIB:BOOL=ON \
+ -DLIBDEFLATE_COMPRESSION_SUPPORT:BOOL=ON \
+ -DLIBDEFLATE_DECOMPRESSION_SUPPORT:BOOL=ON \
+ -DLIBDEFLATE_ZLIB_SUPPORT:BOOL=ON \
+ -DLIBDEFLATE_GZIP_SUPPORT:BOOL=ON \
+ -DLIBDEFLATE_FREESTANDING:BOOL=OFF \
+ -DLIBDEFLATE_BUILD_GZIP:BOOL=ON \
+ -DLIBDEFLATE_BUILD_TESTS:BOOL=ON \
+ -DLIBDEFLATE_USE_SHARED_LIBS:BOOL=ON
+%cmake_build
+
+%install
+%cmake_install
+
+%files
+%doc NEWS.md README.md
+%license COPYING
+%{_libdir}/libdeflate.so.0
+
+%files devel
+%{_includedir}/libdeflate.h
+%{_libdir}/libdeflate.so
+%{_libdir}/cmake/libdeflate/*.cmake
+%{_libdir}/pkgconfig/*
+
+%files utils
+%{_bindir}/libdeflate-gzip
+%{_bindir}/libdeflate-gunzip
+
+%changelog
+* Sun Aug 11 2024 Funda Wang <fundawang@yeah.net> - 1.21-1
+- update to 1.21
+
+* Sat Jun 3 2023 guoyizhang <kuoi@bioarchlinux.org> - 1.18-1
+- update to 1.18
+
+* Fri Jan 28 2022 herengui <herengui@uniontech.com> - 1.9-1
+- Initial package
diff --git a/sources b/sources
new file mode 100644
index 0000000..27bc5cb
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+c654e7e9b232b5ccde7903805dbb2e64 libdeflate-1.21.tar.gz