pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/archivers/zstd zstd: fix library detection with GNU ma...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/456149592ede
branches:  trunk
changeset: 439973:456149592ede
user:      mcf <mcf%pkgsrc.org@localhost>
date:      Thu Oct 01 07:25:06 2020 +0000

description:
zstd: fix library detection with GNU make 4.3

GNU make 4.3 no longer uses \ to escape # found inside function
invocations, so the \ gets passed through to the printf commands,
causing library detection to fail.

lib/Makefile is patched on pkgsrc by copying detection logic from
programs/Makefile, which has since been updated[0] to support make
4.3 using the compatibility trick suggested in the GNU make changelog.

In particular, since we modify programs/Makefile to link the zstd
binary with the libzstd shared library, failure to detect pthread
in lib/Makefile results in a zstd built with ZSTD_MULTITHREAD to
be linked against a libzstd built without it. This causes "Unsupported
parameter" errors when it is used (except with --single-thread).

So, apply the fix for programs/Makefile to lib/Makefile as well.

[0] https://github.com/facebook/zstd/commit/06a57cf57e3c4e887cadcf688e3081154f3f6db4

diffstat:

 archivers/zstd/Makefile                   |   3 ++-
 archivers/zstd/distinfo                   |   4 ++--
 archivers/zstd/patches/patch-lib_Makefile |  23 +++++++++++++----------
 3 files changed, 17 insertions(+), 13 deletions(-)

diffs (119 lines):

diff -r d6e8e2238a26 -r 456149592ede archivers/zstd/Makefile
--- a/archivers/zstd/Makefile   Thu Oct 01 06:59:38 2020 +0000
+++ b/archivers/zstd/Makefile   Thu Oct 01 07:25:06 2020 +0000
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.30 2020/06/16 14:58:08 wiz Exp $
+# $NetBSD: Makefile,v 1.31 2020/10/01 07:25:06 mcf Exp $
 
 DISTNAME=      zstd-1.4.5
+PKGREVISION=   1
 CATEGORIES=    archivers
 MASTER_SITES=  ${MASTER_SITE_GITHUB:=facebook/}
 GITHUB_TAG=    v${PKGVERSION_NOREV}
diff -r d6e8e2238a26 -r 456149592ede archivers/zstd/distinfo
--- a/archivers/zstd/distinfo   Thu Oct 01 06:59:38 2020 +0000
+++ b/archivers/zstd/distinfo   Thu Oct 01 07:25:06 2020 +0000
@@ -1,10 +1,10 @@
-$NetBSD: distinfo,v 1.24 2020/06/14 13:51:55 adam Exp $
+$NetBSD: distinfo,v 1.25 2020/10/01 07:25:06 mcf Exp $
 
 SHA1 (zstd-1.4.5.tar.gz) = 9c344c2660c990b6d6a9cced73db3a0dfe2b0092
 RMD160 (zstd-1.4.5.tar.gz) = b7b9df3d4293eab050f84d2fc7f0a29c89905e87
 SHA512 (zstd-1.4.5.tar.gz) = b03c497c3e0590c3d384cb856e3024f144b2bfac0d805d80e68deafa612c68237f12a2d657416d476a28059e80936c79f099fc42331464b417593895ea214387
 Size (zstd-1.4.5.tar.gz) = 1987927 bytes
 SHA1 (patch-Makefile) = daf9d1946513ee24a4c4c187ec80878e9a578744
-SHA1 (patch-lib_Makefile) = 5005ffd50388520f69bd95012f696274e29fd3a9
+SHA1 (patch-lib_Makefile) = 07196103e013532ac60e1ce6dfc9f61de3367287
 SHA1 (patch-programs_Makefile) = 2500df468c2994f1b33165c5d2774817bdc8addc
 SHA1 (patch-zlibWrapper_examples_minigzip.c) = 4ed0cb648bdd6efa61b3f66ba6eb1ea74b7767ec
diff -r d6e8e2238a26 -r 456149592ede archivers/zstd/patches/patch-lib_Makefile
--- a/archivers/zstd/patches/patch-lib_Makefile Thu Oct 01 06:59:38 2020 +0000
+++ b/archivers/zstd/patches/patch-lib_Makefile Thu Oct 01 07:25:06 2020 +0000
@@ -1,4 +1,4 @@
-$NetBSD: patch-lib_Makefile,v 1.9 2020/06/14 13:51:55 adam Exp $
+$NetBSD: patch-lib_Makefile,v 1.10 2020/10/01 07:25:06 mcf Exp $
 
 Detect and use third-party libraries (taken from programs/Makefile).
 -fvisibility=hidden makes error when linking.
@@ -7,14 +7,17 @@
 
 --- lib/Makefile.orig  2020-05-22 05:04:00.000000000 +0000
 +++ lib/Makefile
-@@ -165,6 +165,40 @@ CPPFLAGS  += -DZSTD_LEGACY_SUPPORT=$(ZST
+@@ -165,6 +165,43 @@ CPPFLAGS  += -DZSTD_LEGACY_SUPPORT=$(ZST
  
  ZSTD_OBJ   := $(patsubst %.c,%.o,$(ZSTD_FILES))
  
 +VOID = /dev/null
 +
++# Make 4.3 doesn't support '\#' anymore (https://lwn.net/Articles/810071/)
++NUM_SYMBOL := \#
++
 +# thread detection
-+HAVE_PTHREAD := $(shell printf '\#include <pthread.h>\nint main(void) { return 0; }' | $(CC) $(FLAGS) -o have_pthread$(EXT) -x c - -pthread 2> $(VOID) && rm have_pthread$(EXT) && echo 1 || echo 0)
++HAVE_PTHREAD := $(shell printf '$(NUM_SYMBOL)include <pthread.h>\nint main(void) { return 0; }' | $(CC) $(FLAGS) -o have_pthread$(EXT) -x c - -pthread 2> $(VOID) && rm have_pthread$(EXT) && echo 1 
|| echo 0)
 +HAVE_THREAD := $(shell [ "$(HAVE_PTHREAD)" -eq "1" -o -n "$(filter Windows%,$(OS))" ] && echo 1 || echo 0)
 +ifeq ($(HAVE_THREAD), 1)
 +THREAD_MSG := ==> building with threading support
@@ -23,7 +26,7 @@
 +endif
 +
 +# zlib detection
-+HAVE_ZLIB := $(shell printf '\#include <zlib.h>\nint main(void) { return 0; }' | $(CC) $(FLAGS) -o have_zlib$(EXT) -x c - -lz 2> $(VOID) && rm have_zlib$(EXT) && echo 1 || echo 0)
++HAVE_ZLIB := $(shell printf '$(NUM_SYMBOL)include <zlib.h>\nint main(void) { return 0; }' | $(CC) $(FLAGS) -o have_zlib$(EXT) -x c - -lz 2> $(VOID) && rm have_zlib$(EXT) && echo 1 || echo 0)
 +ifeq ($(HAVE_ZLIB), 1)
 +ZLIB_MSG := ==> building zstd with .gz compression support
 +ZLIBCPP = -DZSTD_GZCOMPRESS -DZSTD_GZDECOMPRESS
@@ -31,14 +34,14 @@
 +endif
 +
 +# lzma detection
-+HAVE_LZMA := $(shell printf '\#include <lzma.h>\nint main(void) { return 0; }' | $(CC) $(FLAGS) -o have_lzma$(EXT) -x c - -llzma 2> $(VOID) && rm have_lzma$(EXT) && echo 1 || echo 0)
++HAVE_LZMA := $(shell printf '$(NUM_SYMBOL)include <lzma.h>\nint main(void) { return 0; }' | $(CC) $(FLAGS) -o have_lzma$(EXT) -x c - -llzma 2> $(VOID) && rm have_lzma$(EXT) && echo 1 || echo 0)
 +ifeq ($(HAVE_LZMA), 1)
 +LZMACPP = -DZSTD_LZMACOMPRESS -DZSTD_LZMADECOMPRESS
 +LZMALD = -llzma
 +endif
 +
 +# lz4 detection
-+HAVE_LZ4 := $(shell printf '\#include <lz4frame.h>\n\#include <lz4.h>\nint main(void) { return 0; }' | $(CC) $(FLAGS) -o have_lz4$(EXT) -x c - -llz4 2> $(VOID) && rm have_lz4$(EXT) && echo 1 || 
echo 0)
++HAVE_LZ4 := $(shell printf '$(NUM_SYMBOL)include <lz4frame.h>\n$(NUM_SYMBOL)include <lz4.h>\nint main(void) { return 0; }' | $(CC) $(FLAGS) -o have_lz4$(EXT) -x c - -llz4 2> $(VOID) && rm 
have_lz4$(EXT) && echo 1 || echo 0)
 +ifeq ($(HAVE_LZ4), 1)
 +LZ4CPP = -DZSTD_LZ4COMPRESS -DZSTD_LZ4DECOMPRESS
 +LZ4LD = -llz4
@@ -48,7 +51,7 @@
  # macOS linker doesn't support -soname, and use different extension
  # see : https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/DynamicLibraryDesignGuidelines.html
  ifeq ($(shell uname), Darwin)
-@@ -204,7 +238,8 @@ $(LIBZSTD): $(ZSTD_FILES)
+@@ -204,7 +241,8 @@ $(LIBZSTD): $(ZSTD_FILES)
  else
  
  LIBZSTD = libzstd.$(SHARED_EXT_VER)
@@ -58,7 +61,7 @@
  $(LIBZSTD): $(ZSTD_FILES)
        @echo compiling dynamic library $(LIBVER)
        $(Q)$(CC) $(FLAGS) $^ $(LDFLAGS) $(SONAME_FLAGS) -o $@
-@@ -251,7 +286,6 @@ clean:
+@@ -251,7 +289,6 @@ clean:
  #-----------------------------------------------------------------------------
  # make install is validated only for below listed environments
  #-----------------------------------------------------------------------------
@@ -66,7 +69,7 @@
  
  all: libzstd.pc
  
-@@ -287,11 +321,7 @@ $(error configured includedir ($(INCLUDE
+@@ -287,11 +324,7 @@ $(error configured includedir ($(INCLUDE
  endif
  endif
  
@@ -78,7 +81,7 @@
  
  ifneq (,$(filter $(shell uname),SunOS))
  INSTALL ?= ginstall
-@@ -351,4 +381,3 @@ uninstall:
+@@ -351,4 +384,3 @@ uninstall:
        $(Q)$(RM) $(DESTDIR)$(INCLUDEDIR)/zdict.h
        @echo zstd libraries successfully uninstalled
  



Home | Main Index | Thread Index | Old Index