tech-pkg archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[PATCH] 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
that create the library detector test source, causing detection to
fail.
The library detection in lib/Makefile is patched on pkgsrc by copying
detection logic from programs/Makefile, which has since been updated
to support make 4.3 [0]. So, just copy the fix to lib/Makefile.
[0] https://github.com/facebook/zstd/commit/06a57cf57e3c4e887cadcf688e3081154f3f6db4
---
archivers/zstd/distinfo | 2 +-
archivers/zstd/patches/patch-lib_Makefile | 21 ++++++++++++---------
2 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/archivers/zstd/distinfo b/archivers/zstd/distinfo
index 5ffa4c5db0f..9b90a00c46e 100644
--- a/archivers/zstd/distinfo
+++ b/archivers/zstd/distinfo
@@ -5,6 +5,6 @@ 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) = 303d90e34bb78b402d15f16620f197c9cd3865c9
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..ad158e6551b 100644
--- a/archivers/zstd/patches/patch-lib_Makefile
+++ b/archivers/zstd/patches/patch-lib_Makefile
@@ -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=$(ZSTD_LEGACY_SUPPO
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\#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 ($(INCLUDEDIR)) is outsi
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
--
2.28.0
Home |
Main Index |
Thread Index |
Old Index