Accepting request 819526 from home:marxin:branches:Archiving

- Use %make_build macro.
- Add upstream patch fix-lib-build.patch which fixes lib-mt target.

OBS-URL: https://build.opensuse.org/request/show/819526
OBS-URL: https://build.opensuse.org/package/show/Archiving/zstd?expand=0&rev=49
This commit is contained in:
Bernhard M. Wiedemann 2020-07-08 18:22:50 +00:00 committed by Git OBS Bridge
parent f8de03aee6
commit 9194042aed
3 changed files with 53 additions and 4 deletions

37
fix-lib-build.patch Normal file
View File

@ -0,0 +1,37 @@
From 39a32f40c91c306898d771962aab5bd22235554f Mon Sep 17 00:00:00 2001
From: Yann Collet <cyan@fb.com>
Date: Mon, 25 May 2020 06:50:45 -0700
Subject: [PATCH] fixed default rule for lib/Makefile
default rule is `lib-release`
`lib-release` wasn't working : it was just skipped.
Removing `lib-release` from the list of .PHONY targets fixes it.
Same for `lib-mt`.
---
lib/Makefile | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/Makefile b/lib/Makefile
index e6213ac86..c4305d6f8 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -220,13 +220,14 @@ libzstd : $(LIBZSTD)
.PHONY: lib
lib : libzstd.a libzstd
-.PHONY: lib-mt
+# note : do not define lib-mt or lib-release as .PHONY
+# make does not consider implicit pattern rule for .PHONY target
+
%-mt : CPPFLAGS += -DZSTD_MULTITHREAD
%-mt : LDFLAGS += -pthread
%-mt : %
@echo multi-threading build completed
-.PHONY: lib-release
%-release : DEBUGFLAGS :=
%-release : %
@echo release build completed

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Wed Jul 8 17:47:50 UTC 2020 - Martin Liška <mliska@suse.cz>
- Use %make_build macro.
- Add upstream patch fix-lib-build.patch which fixes lib-mt target.
-------------------------------------------------------------------
Fri May 22 08:05:28 UTC 2020 - Ismail Dönmez <idonmez@suse.com>

View File

@ -28,6 +28,7 @@ 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
Patch2: fix-lib-build.patch
BuildRequires: gcc
# C++ is needed for pzstd only
BuildRequires: gcc-c++
@ -84,23 +85,28 @@ Needed for compiling programs that link with the library.
%prep
%setup -q
%patch1 -p1
%patch2 -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"
# lib-mt is alias for multi-threaded library support
%make_build -C lib lib-mt
for dir in programs contrib/pzstd; do
%make_build -C "$dir"
done
%check
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags} -std=c++11"
make %{?_smp_mflags} -C tests test-zstd
%make_build -C tests test-zstd
#make %{?_smp_mflags} -C contrib/pzstd test-pzstd
%install
%make_install PREFIX=%{_prefix} LIBDIR=%{_libdir}
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags} -std=c++11"
%make_install V=1 VERBOSE=1 PREFIX=%{_prefix} LIBDIR=%{_libdir}
install -D -m755 contrib/pzstd/pzstd %{buildroot}%{_bindir}/pzstd
install -D -m644 programs/zstd.1 %{buildroot}%{_mandir}/man1/pzstd.1