Bump to zstd 1.4.4 10/285410/4 sandbox/wangbiao/scm_zstd
authorbiao716.wang <biao716.wang@samsung.com>
Mon, 12 Dec 2022 09:12:54 +0000 (18:12 +0900)
committerbiao716.wang <biao716.wang@samsung.com>
Mon, 12 Dec 2022 10:59:21 +0000 (19:59 +0900)
Change-Id: Ib02888eb7d5ca42df397ddb8e019b2d45df12818
Signed-off-by: biao716.wang <biao716.wang@samsung.com>
packaging/baselibs.conf [new file with mode: 0644]
packaging/pzstd.1.patch [new file with mode: 0755]
packaging/zstd.spec [new file with mode: 0644]

diff --git a/packaging/baselibs.conf b/packaging/baselibs.conf
new file mode 100644 (file)
index 0000000..d451099
--- /dev/null
@@ -0,0 +1,2 @@
+libzstd1
+
diff --git a/packaging/pzstd.1.patch b/packaging/pzstd.1.patch
new file mode 100755 (executable)
index 0000000..3bfc292
--- /dev/null
@@ -0,0 +1,17 @@
+Index: zstd-1.4.4/programs/zstd.1
+===================================================================
+--- zstd-1.4.4.orig/programs/zstd.1
++++ zstd-1.4.4/programs/zstd.1
+@@ -213,6 +213,12 @@ All arguments after \fB\-\-\fR are treat
+ .SS "Restricted usage of Environment Variables"
+ Using environment variables to set parameters has security implications\. Therefore, this avenue is intentionally restricted\. Only \fBZSTD_CLEVEL\fR is supported currently, for setting compression level\. \fBZSTD_CLEVEL\fR can be used to set the level between 1 and 19 (the "normal" range)\. If the value of \fBZSTD_CLEVEL\fR is not a valid integer, it will be ignored with a warning message\. \fBZSTD_CLEVEL\fR just replaces the default compression level (\fB3\fR)\. It can be overridden by corresponding command line arguments\.
+ .
++.SH Parallel Zstd OPTIONS
++Additional options for the pzstd utility
++.TP
++.BR \-p ", " --processes
++ number of threads to use for (de)compression (default:4)
++.
+ .SH "DICTIONARY BUILDER"
+ \fBzstd\fR offers \fIdictionary\fR compression, which greatly improves efficiency on small files and messages\. It\'s possible to train \fBzstd\fR with a set of samples, the result of which is saved into a file called a \fBdictionary\fR\. Then during compression and decompression, reference the same dictionary, using command \fB\-D dictionaryFileName\fR\. Compression of small files similar to the sample set will be greatly improved\.
+ .
diff --git a/packaging/zstd.spec b/packaging/zstd.spec
new file mode 100644 (file)
index 0000000..c58f742
--- /dev/null
@@ -0,0 +1,128 @@
+#
+# spec file for package zstd
+#
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+#
+# 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/
+#
+
+
+%define major 1
+%define libname lib%{name}%{major}
+Name:           zstd
+Version:        %{major}.4.4
+Release:        0
+Summary:        Zstandard compression tools
+License:        BSD-3-Clause AND GPL-2.0-only
+Group:          Productivity/Archiving/Compression
+URL:            https://github.com/facebook/zstd
+Source0:        https://github.com/facebook/zstd/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
+Source99:       baselibs.conf
+Patch1:         pzstd.1.patch
+BuildRequires:  gcc
+# C++ is needed for pzstd only
+BuildRequires:  gcc-c++
+BuildRequires:  pkgconfig
+
+%description
+Zstd, short for Zstandard, is a lossless compression algorithm. Speed
+vs. compression trade-off is configurable in small increments.
+Decompression speed is preserved and remains roughly the same at all
+settings, a property shared by most LZ compression algorithms, such
+as zlib or lzma.
+
+At roughly the same ratio, zstd (v1.4.0) achieves ~870%% faster
+compression than gzip. For roughly the same time, zstd achives a
+~12%% better ratio than gzip. LZMA outperforms zstd by ~10%% faster
+compression for same ratio, or ~1–4%% size reduction for same time.
+
+
+%package -n %{libname}
+Summary:        Zstd compression library
+Group:          System/Libraries
+
+%description -n %{libname}
+Zstd, short for Zstandard, is a lossless compression algorithm,
+targeting faster compression than zlib at comparable ratios.
+
+This subpackage contains the implementation as a shared library.
+
+%package -n lib%{name}-devel
+Summary:        Development files for the Zstd compression library
+Group:          Development/Libraries/C and C++
+Requires:       %{libname} = %{version}
+Requires:       glibc-devel
+
+%description -n lib%{name}-devel
+Zstd, short for Zstandard, is a lossless compression algorithm,
+targeting faster compression than zlib at comparable ratios.
+
+Needed for compiling programs that link with the library.
+
+%package -n lib%{name}-devel-static
+Summary:        Development files for the Zstd compression library
+Group:          Development/Libraries/C and C++
+BuildRequires:  glibc-devel-static
+Requires:       lib%{name}-devel = %{version}
+
+%description -n lib%{name}-devel-static
+Zstd, short for Zstandard, is a lossless compression algorithm,
+targeting faster compression than zlib at comparable ratios.
+
+Needed for compiling programs that link with the library.
+
+%prep
+%setup -q
+%patch1 -p1
+
+%build
+%global _lto_cflags %{_lto_cflags} -ffat-lto-objects
+export CFLAGS="%{optflags}"
+export CXXFLAGS="%{optflags} -std=c++11"
+for dir in lib programs contrib/pzstd; do
+  make %{?_smp_mflags} -C "$dir"
+done
+
+%check
+export CFLAGS="%{optflags}"
+export CXXFLAGS="%{optflags} -std=c++11"
+make %{?_smp_mflags} -C tests test-zstd
+
+%install
+%make_install PREFIX=%{_prefix} LIBDIR=%{_libdir}
+install -D -m755 contrib/pzstd/pzstd %{buildroot}%{_bindir}/pzstd
+install -D -m644 programs/zstd.1 %{buildroot}%{_mandir}/man1/pzstd.1
+
+%files
+
+%doc README.md CHANGELOG
+%{_bindir}/*
+%{_mandir}/man1/*.1%{?ext_man}
+
+%files -n %{libname}
+
+%{_libdir}/libzstd.so.*
+
+%files -n lib%{name}-devel
+
+%{_includedir}/*.h
+%{_libdir}/pkgconfig/libzstd.pc
+%{_libdir}/libzstd.so
+
+%files -n lib%{name}-devel-static
+
+%{_libdir}/libzstd.a
+
+%post -n %{libname} -p /sbin/ldconfig
+%postun -n %{libname} -p /sbin/ldconfig
+
+#%changelog