mirror of
https://abf.rosa.ru/djam/zstd.git
synced 2025-02-23 09:22:54 +00:00
adjust build, use cmake
This commit is contained in:
parent
f46b0f7e35
commit
c07f28ef16
3 changed files with 63 additions and 52 deletions
|
@ -1,11 +1,10 @@
|
||||||
diff -Naur -Naru zstd-1.3.4/programs/zstd.1 zstd-1.3.4.new/programs/zstd.1
|
diff -Naur zstd-1.4.4.orig/programs/zstd.1 zstd-1.4.4/programs/zstd.1
|
||||||
--- zstd-1.3.4/programs/zstd.1 2018-03-26 22:19:34.000000000 +0000
|
--- zstd-1.4.4.orig/programs/zstd.1 2019-11-04 17:54:32.000000000 +0000
|
||||||
+++ zstd-1.3.4.new/programs/zstd.1 2018-03-28 04:28:27.532777239 +0000
|
+++ zstd-1.4.4/programs/zstd.1 2020-01-15 14:25:34.227060058 +0000
|
||||||
@@ -177,7 +177,14 @@
|
@@ -209,6 +209,14 @@
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-\fR
|
\fB\-\-\fR
|
||||||
All arguments after \fB\-\-\fR are treated as files
|
All arguments after \fB\-\-\fR are treated as files
|
||||||
-.
|
|
||||||
+
|
+
|
||||||
+.SH Parallel Zstd OPTIONS
|
+.SH Parallel Zstd OPTIONS
|
||||||
+Additional options for the pzstd utility
|
+Additional options for the pzstd utility
|
||||||
|
@ -14,6 +13,6 @@ diff -Naur -Naru zstd-1.3.4/programs/zstd.1 zstd-1.3.4.new/programs/zstd.1
|
||||||
+ number of threads to use for (de)compression (default:4)
|
+ 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\.
|
|
||||||
.
|
.
|
||||||
|
.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\.
|
||||||
|
|
13
zstd-1.3.4-multi-thread-default.patch
Normal file
13
zstd-1.3.4-multi-thread-default.patch
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
diff -Naur zstd-1.3.8/programs/zstdcli.c zstd-1.3.8/programs/new-zstdcli.c
|
||||||
|
--- zstd-1.3.8/programs/zstdcli.c 2018-12-27 13:42:44.000000000 +0100
|
||||||
|
+++ zstd-1.3.8/programs/new-zstdcli.c 2019-01-01 04:30:50.000000000 +0100
|
||||||
|
@@ -576,7 +576,7 @@
|
||||||
|
cLevel = init_cLevel();
|
||||||
|
programName = lastNameFromPath(programName);
|
||||||
|
#ifdef ZSTD_MULTITHREAD
|
||||||
|
- nbWorkers = 1;
|
||||||
|
+ nbWorkers = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* preset behaviors */
|
||||||
|
|
89
zstd.spec
89
zstd.spec
|
@ -2,12 +2,8 @@
|
||||||
%define major 1
|
%define major 1
|
||||||
%define libname %mklibname %{oname} %{major}
|
%define libname %mklibname %{oname} %{major}
|
||||||
%define devname %mklibname %{oname} -d
|
%define devname %mklibname %{oname} -d
|
||||||
|
# static libraries are used by qemu. Please don't disable them.
|
||||||
# aarch64 and armv7hl at least currently segfault
|
%define sdevname %mklibname %{name} -d -s
|
||||||
# in ThreadPool test for the pzstd util
|
|
||||||
%ifarch %{ix86} x86_64
|
|
||||||
%bcond_without pzstd
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%bcond_with tests
|
%bcond_with tests
|
||||||
|
|
||||||
|
@ -19,30 +15,28 @@ License: BSD and GPLv2+
|
||||||
Group: Archiving/Compression
|
Group: Archiving/Compression
|
||||||
Url: http://www.zstd.net/
|
Url: http://www.zstd.net/
|
||||||
Source0: https://github.com/facebook/zstd/archive/v%{version}/%{name}-%{version}.tar.gz
|
Source0: https://github.com/facebook/zstd/archive/v%{version}/%{name}-%{version}.tar.gz
|
||||||
|
Patch0: zstd-1.3.4-multi-thread-default.patch
|
||||||
Patch1: pzstd.1.patch
|
Patch1: pzstd.1.patch
|
||||||
BuildRequires: gtest-devel
|
BuildRequires: gtest-devel
|
||||||
|
BuildRequires: pkgconfig(liblz4)
|
||||||
|
BuildRequires: pkgconfig(liblzma)
|
||||||
|
BuildRequires: pkgconfig(zlib)
|
||||||
|
BuildRequires: cmake
|
||||||
|
BuildRequires: ninja
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Zstd, short for Zstandard, is a fast lossless compression algorithm,
|
Zstd, short for Zstandard, is a fast lossless compression algorithm,
|
||||||
targeting real-time compression scenarios at zlib-level compression ratio.
|
targeting real-time compression scenarios at zlib-level compression ratio.
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%doc CHANGELOG README.md
|
|
||||||
%{_bindir}/%{name}
|
%{_bindir}/%{name}
|
||||||
%{_bindir}/%{name}cat
|
%{_bindir}/%{name}cat
|
||||||
%{_bindir}/%{name}grep
|
%{_bindir}/%{name}grep
|
||||||
%{_bindir}/%{name}less
|
%{_bindir}/%{name}less
|
||||||
%{_bindir}/%{name}mt
|
%{_bindir}/%{name}mt
|
||||||
%if %{with pzstd}
|
|
||||||
%{_bindir}/p%{name}
|
%{_bindir}/p%{name}
|
||||||
%{_mandir}/man1/p%{name}.1*
|
|
||||||
%endif
|
|
||||||
%{_bindir}/un%{name}
|
%{_bindir}/un%{name}
|
||||||
%{_mandir}/man1/%{name}.1*
|
%{_mandir}/man1/*
|
||||||
%{_mandir}/man1/%{name}cat.1*
|
|
||||||
%{_mandir}/man1/%{name}grep.1*
|
|
||||||
%{_mandir}/man1/%{name}less.1*
|
|
||||||
%{_mandir}/man1/un%{name}.1*
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -68,44 +62,49 @@ Provides: %{name}-devel = %{EVRD}
|
||||||
Header files for Zstd library.
|
Header files for Zstd library.
|
||||||
|
|
||||||
%files -n %{devname}
|
%files -n %{devname}
|
||||||
%{_includedir}/zbuff.h
|
%doc %{_docdir}/zstd
|
||||||
%{_includedir}/zdict.h
|
%{_includedir}/*.h
|
||||||
%{_includedir}/zstd.h
|
|
||||||
%{_includedir}/zstd_errors.h
|
|
||||||
%{_libdir}/pkgconfig/libzstd.pc
|
%{_libdir}/pkgconfig/libzstd.pc
|
||||||
%{_libdir}/libzstd.so
|
%{_libdir}/libzstd.so
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
%package -n %{sdevname}
|
||||||
|
Summary: Static libraries for zstd
|
||||||
|
Group: Development/C
|
||||||
|
Requires: %{devname} = %{version}-%{release}
|
||||||
|
|
||||||
|
%description -n %{sdevname}
|
||||||
|
Static library for zstd.
|
||||||
|
|
||||||
|
%files -n %{sdevname}
|
||||||
|
%{_libdir}/libzstd.a
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%autosetup -p1
|
||||||
|
# Get rid of -L/usr/lib insanity
|
||||||
|
sed -i -e 's,-L\${libdir} ,,g' lib/*.pc.in
|
||||||
|
sed -i -e '/^Cflags:/d' lib/*.pc.in
|
||||||
find -name .gitignore -delete
|
find -name .gitignore -delete
|
||||||
%if %{with pzstd}
|
|
||||||
%patch1 -p1
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
for dir in lib programs; do
|
%set_build_flags
|
||||||
CFLAGS="%{optflags}" LDFLAGS="%{ldflags}" %make CC=%{__cc} -C "$dir"
|
pushd build/cmake
|
||||||
done
|
%cmake -DZSTD_BUILD_CONTRIB:BOOL=ON \
|
||||||
%if %{with pzstd}
|
-DZSTD_LEGACY_SUPPORT:BOOL=ON \
|
||||||
CFLAGS="%{optflags}" LDFLAGS="%{ldflags}" CXXFLAGS="%{optflags} -std=c++11" %make CC=%{__cc} -C 'contrib/pzstd'
|
-DZSTD_LZ4_SUPPORT:BOOL=ON \
|
||||||
%endif
|
-DZSTD_LZMA_SUPPORT:BOOL=ON \
|
||||||
|
-DZSTD_PROGRAMS_LINK_SHARED:BOOL=ON \
|
||||||
|
-DZSTD_ZLIB_SUPPORT:BOOL=ON -G Ninja
|
||||||
|
|
||||||
|
%ninja_build
|
||||||
|
popd
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%makeinstall_std PREFIX=%{_prefix} LIBDIR=%{_libdir}
|
pushd build/cmake
|
||||||
|
%ninja_install -C build
|
||||||
# Don't install the static lib
|
install -m 755 build/contrib/pzstd/pzstd %{buildroot}%{_bindir}/
|
||||||
rm %{buildroot}%{_libdir}/libzstd.a
|
install -D -m644 build/programs/%{name}.1 %{buildroot}%{_mandir}/man1/p%{name}.1
|
||||||
%if %{with pzstd}
|
popd
|
||||||
install -D -m755 contrib/pzstd/pzstd %{buildroot}%{_bindir}/pzstd
|
|
||||||
install -D -m644 programs/%{name}.1 %{buildroot}%{_mandir}/man1/p%{name}.1
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%if %{with tests}
|
|
||||||
%check
|
|
||||||
CFLAGS="%{optflags}" LDFLAGS="%{ldflags}" make -C tests test-zstd
|
|
||||||
%if %{with pzstd}
|
|
||||||
CFLAGS="%{optflags}" LDFLAGS="%{ldflags}" CXXFLAGS="%{optflags} -std=c++11" make -C contrib/pzstd test
|
|
||||||
%endif
|
|
||||||
%endif
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue