diff options
author | mcf <mcf@pkgsrc.org> | 2020-10-01 07:25:06 +0000 |
---|---|---|
committer | mcf <mcf@pkgsrc.org> | 2020-10-01 07:25:06 +0000 |
commit | 80069163bd9be0018bc57ccb7841e30797d0609a (patch) | |
tree | 637c486a7c8bf920247d43f9a42b4f70e3e5c78b /archivers/zstd | |
parent | fc13de3de7d7f652f0aa67dc8c905ad194719f47 (diff) | |
download | pkgsrc-80069163bd9be0018bc57ccb7841e30797d0609a.tar.gz |
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 (limited to 'archivers/zstd')
-rw-r--r-- | archivers/zstd/Makefile | 3 | ||||
-rw-r--r-- | archivers/zstd/distinfo | 4 | ||||
-rw-r--r-- | archivers/zstd/patches/patch-lib_Makefile | 23 |
3 files changed, 17 insertions, 13 deletions
diff --git a/archivers/zstd/Makefile b/archivers/zstd/Makefile index 968383a77be..61ac89c72bd 100644 --- a/archivers/zstd/Makefile +++ b/archivers/zstd/Makefile @@ -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 --git a/archivers/zstd/distinfo b/archivers/zstd/distinfo index 5ffa4c5db0f..e82f5f36f78 100644 --- a/archivers/zstd/distinfo +++ b/archivers/zstd/distinfo @@ -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 --git a/archivers/zstd/patches/patch-lib_Makefile b/archivers/zstd/patches/patch-lib_Makefile index 1f270109126..34bbea6eba7 100644 --- a/archivers/zstd/patches/patch-lib_Makefile +++ b/archivers/zstd/patches/patch-lib_Makefile @@ -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 @@ Fix pkgconfig installation path. --- 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 @@ Fix pkgconfig installation path. +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 @@ Fix pkgconfig installation path. +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 @@ Fix pkgconfig installation path. # 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 @@ Fix pkgconfig installation path. $(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 @@ Fix pkgconfig installation path. 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 @@ Fix pkgconfig installation path. 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 |