add the parallel variant command, pzstd(1)

Build/Test/Install the contrib/pzstd util
which is c++ rather than c, and has a new
test dependency on gtest.
This commit is contained in:
Pádraig Brady 2016-10-06 13:37:39 +01:00
parent 5302a3c717
commit 3b98714614
3 changed files with 103 additions and 8 deletions

16
pzstd.1.patch Normal file
View File

@ -0,0 +1,16 @@
--- zstd-1.1.0.orig/programs/zstd.1 2016-09-27 22:15:03.000000000 +0000
+++ zstd-1.1.0.new/programs/zstd.1 2016-10-06 12:25:28.912681891 +0000
@@ -94,6 +94,13 @@
All arguments after -- 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
.PP
\fBzstd\fR offers \fIdictionary\fR compression, useful for very small files and messages.

View File

@ -1,8 +1,76 @@
Proposed upstream at https://github.com/pixelb/zstd/pull/1
diff -Naur zstd-1.1.0.orig/contrib/pzstd/Makefile zstd-1.1.0.new/contrib/pzstd/Makefile
--- zstd-1.1.0.orig/contrib/pzstd/Makefile 2016-09-27 22:15:03.000000000 +0000
+++ zstd-1.1.0.new/contrib/pzstd/Makefile 2016-10-06 11:01:38.436955726 +0000
@@ -37,9 +37,8 @@
all: pzstd
diff -Naur zstd-1.0.0/lib/Makefile zstd-1.0.0.fedora/lib/Makefile
--- zstd-1.0.0/lib/Makefile 2016-08-31 16:09:10.000000000 +0000
+++ zstd-1.0.0.fedora/lib/Makefile 2016-09-05 11:45:59.449374900 +0000
-libzstd.a: $(ZSTD_FILES)
+$(ZSTDDIR)/libzstd.a: $(ZSTD_FILES)
$(MAKE) -C $(ZSTDDIR) libzstd
- @cp $(ZSTDDIR)/libzstd.a .
Pzstd.o: Pzstd.h Pzstd.cpp ErrorHolder.h utils/*.h
$(CXX) $(FLAGS) -c Pzstd.cpp -o $@
@@ -53,12 +52,11 @@
main.o: main.cpp *.h utils/*.h
$(CXX) $(FLAGS) -c main.cpp -o $@
-pzstd: Pzstd.o SkippableFrame.o Options.o main.o libzstd.a
+pzstd: Pzstd.o SkippableFrame.o Options.o main.o $(ZSTDDIR)/libzstd.a
$(CXX) $(FLAGS) $^ -o $@$(EXT) -lpthread
-libzstd32.a: $(ZSTD_FILES)
+$(ZSTDDIR)/libzstd32.a: $(ZSTD_FILES)
$(MAKE) -C $(ZSTDDIR) libzstd MOREFLAGS="-m32"
- @cp $(ZSTDDIR)/libzstd.a libzstd32.a
Pzstd32.o: Pzstd.h Pzstd.cpp ErrorHolder.h utils/*.h
$(CXX) -m32 $(FLAGS) -c Pzstd.cpp -o $@
@@ -94,7 +92,7 @@
cd googletest/build && cmake -G "MSYS Makefiles" .. && $(MAKE)
test:
- $(MAKE) libzstd.a
+ $(MAKE) $(ZSTDDIR)/libzstd.a
$(MAKE) pzstd MOREFLAGS="-Wall -Wextra -pedantic -Werror"
$(MAKE) -C utils/test clean
$(MAKE) -C utils/test test MOREFLAGS="-Wall -Wextra -pedantic -Werror"
@@ -102,7 +100,7 @@
$(MAKE) -C test test MOREFLAGS="-Wall -Wextra -pedantic -Werror"
test32:
- $(MAKE) libzstd.a MOREFLAGS="-m32"
+ $(MAKE) $(ZSTDDIR)/libzstd.a MOREFLAGS="-m32"
$(MAKE) pzstd MOREFLAGS="-m32 -Wall -Wextra -pedantic -Werror"
$(MAKE) -C utils/test clean
$(MAKE) -C utils/test test MOREFLAGS="-m32 -Wall -Wextra -pedantic -Werror"
@@ -114,5 +112,5 @@
$(MAKE) -C $(ZSTDDIR) clean
$(MAKE) -C utils/test clean
$(MAKE) -C test clean
- @$(RM) -rf libzstd.a *.o pzstd$(EXT) pzstd32$(EXT)
+ @$(RM) -rf $(ZSTDDIR)/libzstd.a *.o pzstd$(EXT) pzstd32$(EXT)
@echo Cleaning completed
diff -Naur zstd-1.1.0.orig/contrib/pzstd/test/Makefile zstd-1.1.0.new/contrib/pzstd/test/Makefile
--- zstd-1.1.0.orig/contrib/pzstd/test/Makefile 2016-09-27 22:15:03.000000000 +0000
+++ zstd-1.1.0.new/contrib/pzstd/test/Makefile 2016-10-06 12:46:21.768547487 +0000
@@ -30,10 +30,10 @@
FLAGS = $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS)
datagen.o: $(PROGDIR)/datagen.*
- $(CC) $(CPPFLAGS) -O3 $(MOREFLAGS) $(LDFLAGS) -Wno-long-long -Wno-variadic-macros $(PROGDIR)/datagen.c -c -o $@
+ $(CC) $(CPPFLAGS) $(CFLAGS) $(MOREFLAGS) $(LDFLAGS) -Wno-long-long -Wno-variadic-macros $(PROGDIR)/datagen.c -c -o $@
%: %.cpp *.h datagen.o
- $(CXX) $(FLAGS) $@.cpp datagen.o $(PZSTDDIR)/Pzstd.o $(PZSTDDIR)/SkippableFrame.o $(PZSTDDIR)/Options.o $(PZSTDDIR)/libzstd.a -o $@$(EXT) $(GTEST_FLAGS) -lgtest -lgtest_main -lpthread
+ $(CXX) $(FLAGS) $@.cpp datagen.o $(PZSTDDIR)/Pzstd.o $(PZSTDDIR)/SkippableFrame.o $(PZSTDDIR)/Options.o $(ZSTDDIR)/libzstd.a -o $@$(EXT) $(GTEST_FLAGS) -lgtest -lgtest_main -lpthread
.PHONY: test clean
diff -Naur zstd-1.1.0.orig/lib/Makefile zstd-1.1.0.new/lib/Makefile
--- zstd-1.1.0.orig/lib/Makefile 2016-09-27 22:15:03.000000000 +0000
+++ zstd-1.1.0.new/lib/Makefile 2016-10-06 10:56:25.612493000 +0000
@@ -57,9 +57,9 @@
.PHONY: default all clean install uninstall

View File

@ -1,16 +1,17 @@
Name: zstd
Version: 1.1.0
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Zstd compression library
License: BSD and MIT
URL: https://github.com/facebook/zstd
Source0: https://github.com/facebook/zstd/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
# Proposed upstream at https://github.com/pixelb/zstd/pull/1
# Proposed upstream at https://github.com/facebook/zstd/pull/404
Patch0: zstd-lib-no-rebuild.patch
Patch1: pzstd.1.patch
BuildRequires: gcc
BuildRequires: gcc gtest-devel
%description
Zstd, short for Zstandard, is a fast lossless compression algorithm,
@ -34,27 +35,34 @@ Header files for Zstd library.
%setup -q
find -name .gitignore -delete
%patch0 -p1
%patch1 -p1
%build
%{?__global_ldflags:LDFLAGS="${LDFLAGS:-%__global_ldflags}" ; export LDFLAGS ;}
for dir in lib programs; do
CFLAGS="%{optflags}" %make_build -C "$dir"
done
CXXFLAGS="%{optflags}" %make_build -C 'contrib/pzstd'
%check
%{?__global_ldflags:LDFLAGS="${LDFLAGS:-%__global_ldflags}" ; export LDFLAGS ;}
CFLAGS="%{optflags}" make -C tests test-zstd
CFLAGS="%{optflags}" CXXFLAGS="%{optflags}" make -C contrib/pzstd test
%install
%make_install PREFIX=%{_prefix} LIBDIR=%{_libdir}
install -D -m755 contrib/pzstd/pzstd %{buildroot}/usr/bin/pzstd
install -D -m644 programs/%{name}.1 %{buildroot}/%{_mandir}/man1/p%{name}.1
rm %{buildroot}/%{_libdir}/libzstd.a
%files
%doc NEWS README.md
%{_bindir}/%{name}
%{_bindir}/p%{name}
%{_bindir}/un%{name}
%{_bindir}/%{name}cat
%{_mandir}/man1/%{name}.1*
%{_mandir}/man1/p%{name}.1*
%{_mandir}/man1/un%{name}.1*
%{_mandir}/man1/%{name}cat.1*
%license LICENSE PATENTS
@ -74,6 +82,9 @@ rm %{buildroot}/%{_libdir}/libzstd.a
%postun -n lib%{name} -p /sbin/ldconfig
%changelog
* Thu Oct 6 2016 Pádraig Brady <pbrady@fb.com> 1.1.0-2
- Add pzstd(1)
* Thu Sep 29 2016 Pádraig Brady <pbrady@fb.com> 1.1.0-1
- New upstream release
- Remove examples and static lib