diff --git a/.abf.yml b/.abf.yml index d730beb..a06f931 100644 --- a/.abf.yml +++ b/.abf.yml @@ -1,2 +1,2 @@ sources: - zstd-1.4.3.tar.gz: aa9628839ba5032482f4df805d1f15aa485583cf + zstd-1.5.6.tar.gz: f7fab0328d710aa077b6c83433073be852938d79 diff --git a/pzstd.1.patch b/pzstd.1.patch deleted file mode 100644 index cfe2e45..0000000 --- a/pzstd.1.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff -Naur -Naru zstd-1.3.4/programs/zstd.1 zstd-1.3.4.new/programs/zstd.1 ---- zstd-1.3.4/programs/zstd.1 2018-03-26 22:19:34.000000000 +0000 -+++ zstd-1.3.4.new/programs/zstd.1 2018-03-28 04:28:27.532777239 +0000 -@@ -177,7 +177,14 @@ - .TP - \fB\-\-\fR - All arguments after \fB\-\-\fR are treated as files --. -+ -+.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/zstd.spec b/zstd.spec index b273d49..afd5498 100644 --- a/zstd.spec +++ b/zstd.spec @@ -2,47 +2,39 @@ %define major 1 %define libname %mklibname %{oname} %{major} %define devname %mklibname %{oname} -d - -# aarch64 and armv7hl at least currently segfault -# in ThreadPool test for the pzstd util -%ifarch %{ix86} x86_64 -%bcond_without pzstd -%endif +# static libraries are used by qemu. Please don't disable them. +%define sdevname %mklibname %{name} -d -s %bcond_with tests Summary: Zstd compression library Name: zstd -Version: 1.4.3 +Version: 1.5.6 Release: 1 License: BSD and GPLv2+ Group: Archiving/Compression Url: http://www.zstd.net/ Source0: https://github.com/facebook/zstd/archive/v%{version}/%{name}-%{version}.tar.gz -Patch1: pzstd.1.patch BuildRequires: gtest-devel +BuildRequires: pkgconfig(liblz4) +BuildRequires: pkgconfig(liblzma) +BuildRequires: pkgconfig(zlib) +BuildRequires: cmake +BuildRequires: ninja %description Zstd, short for Zstandard, is a fast lossless compression algorithm, targeting real-time compression scenarios at zlib-level compression ratio. %files -%doc CHANGELOG README.md %{_bindir}/%{name} %{_bindir}/%{name}cat %{_bindir}/%{name}grep %{_bindir}/%{name}less %{_bindir}/%{name}mt -%if %{with pzstd} %{_bindir}/p%{name} -%{_mandir}/man1/p%{name}.1* -%endif %{_bindir}/un%{name} -%{_mandir}/man1/%{name}.1* -%{_mandir}/man1/%{name}cat.1* -%{_mandir}/man1/%{name}grep.1* -%{_mandir}/man1/%{name}less.1* -%{_mandir}/man1/un%{name}.1* +%{_mandir}/man1/* #---------------------------------------------------------------------------- @@ -68,44 +60,58 @@ Provides: %{name}-devel = %{EVRD} Header files for Zstd library. %files -n %{devname} -%{_includedir}/zbuff.h -%{_includedir}/zdict.h -%{_includedir}/zstd.h -%{_includedir}/zstd_errors.h +%doc %{_docdir}/zstd +%{_includedir}/*.h %{_libdir}/pkgconfig/libzstd.pc %{_libdir}/libzstd.so +%{_libdir}/cmake/%{name}/*.cmake + +#---------------------------------------------------------------------------- + +%package -n %{sdevname} +Summary: Static libraries for zstd +Group: Development/C +Requires: %{devname} = %{version}-%{release} +Provides: %{name}-static-devel = %{EVRD} + +%description -n %{sdevname} +Static library for zstd. + +%files -n %{sdevname} +%{_libdir}/libzstd.a #---------------------------------------------------------------------------- %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 -%if %{with pzstd} -%patch1 -p1 -%endif +# Don't use obsolete standards +# https://github.com/facebook/zstd/issues/3163 +sed -i -e 's,c99,gnu2a,g' build/cmake/CMakeModules/AddZstdCompilationFlags.cmake %build -for dir in lib programs; do - CFLAGS="%{optflags}" LDFLAGS="%{ldflags}" %make -C "$dir" -done -%if %{with pzstd} -CFLAGS="%{optflags}" LDFLAGS="%{ldflags}" CXXFLAGS="%{optflags} -std=c++11" %make -C 'contrib/pzstd' +%set_build_flags +%ifarch %{riscv} +export LDFLAGS="%{ldflags} -latomic" %endif +pushd build/cmake +%cmake -DZSTD_BUILD_CONTRIB:BOOL=ON \ + -DZSTD_LEGACY_SUPPORT:BOOL=ON \ + -DZSTD_LZ4_SUPPORT:BOOL=ON \ + -DZSTD_LZMA_SUPPORT:BOOL=ON \ + -DZSTD_PROGRAMS_LINK_SHARED:BOOL=ON \ + -DZSTD_ZLIB_SUPPORT:BOOL=ON -G Ninja + +%ninja_build +popd + %install -%make_install PREFIX=%{_prefix} LIBDIR=%{_libdir} - -# Don't install the static lib -rm %{buildroot}%{_libdir}/libzstd.a -%if %{with pzstd} -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 +pushd build/cmake +%ninja_install -C build +install -m 755 build/contrib/pzstd/pzstd %{buildroot}%{_bindir}/ +install -D -m644 build/programs/%{name}.1 %{buildroot}%{_mandir}/man1/p%{name}.1 +popd