pkgsrc-Bugs archive

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

pkg/56225: zstd compile issues on Solaris 10



>Number:         56225
>Category:       pkg
>Synopsis:       zstd compile issues on Solaris 10
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 01 07:25:00 +0000 2021
>Originator:     Claes Nästén
>Release:        trunk 2021-06-01
>Organization:
>Environment:
SunOS u40 5.10 Generic_147148-26 i86pc i386 i86pc

>Description:
zstd fails to compile and install on Solaris 10 due to two reasons:

* Use of nanosleep without -lrt
* test in /bin/sh does not support -e, used in the install targets
>How-To-Repeat:
Build zstd on Solaris 10
>Fix:
diff --git a/archivers/zstd/Makefile b/archivers/zstd/Makefile
index 6ed5adc2e99..6dc8cc205d2 100644
--- a/archivers/zstd/Makefile
+++ b/archivers/zstd/Makefile
@@ -34,7 +34,7 @@ MAKE_ENV+=            BUILD_DIR=obj
 MAKE_ENV+=             HASH=${FALSE}
 
 USE_LANGUAGES=         c c++
-USE_TOOLS+=            ggrep gmake pkg-config
+USE_TOOLS+=            ggrep gmake pkg-config gtest
 PKGCONFIG_OVERRIDE+=   lib/libzstd.pc.in
 MAKE_FLAGS=            MANDIR=${PREFIX}/${PKGMANDIR}
 MAKE_FLAGS+=           mandir=${PREFIX}/${PKGMANDIR}
diff --git a/archivers/zstd/distinfo b/archivers/zstd/distinfo
index e2e118ca756..945ffa20935 100644
--- a/archivers/zstd/distinfo
+++ b/archivers/zstd/distinfo
@@ -4,8 +4,10 @@ SHA1 (zstd-1.5.0.tar.gz) = 3299248fcd44d7f21ba2f1f198c1173eeb3c4f32
 RMD160 (zstd-1.5.0.tar.gz) = c636d4cb4113bd56e3deade6778e08c73a06937e
 SHA512 (zstd-1.5.0.tar.gz) = 25b657529a698eec891f92ff4a085d1fd95d2ff938ce52c8a4ff6163eb0b668ec642dd09e0db190652638cd92371006afa01d8e437437762c4097ad301675c33
 Size (zstd-1.5.0.tar.gz) = 1867111 bytes
-SHA1 (patch-Makefile) = b7e72910488e946971cde5ad2fac6a6134dbd70b
-SHA1 (patch-lib_Makefile) = 2475241f1f75d353bf6deeccb4f391cd6626aed2
-SHA1 (patch-tests_Makefile) = b83de10222859d656468463071dbce70adcc22b1
+SHA1 (patch-Makefile) = c87768f8b15c537bfe09687d878e0a598c2afe13
+SHA1 (patch-lib_Makefile) = 0978707192cb08e0862735c3aff667b7c08b701b
+SHA1 (patch-programs_Makefile) = 54e94c53e70740a12216a33e95ef47b6749ee038
+SHA1 (patch-tests_Makefile) = 96f91d5d24fcfba0101416189b16b00fd8dacb66
 SHA1 (patch-tests_playTests.sh) = 349f8e400f46b5914add4aee955a040045f62779
+SHA1 (patch-zlibWrapper_Makefile) = cf310df7b78c3c182bd8c0a536bef9b837e4bf0b
 SHA1 (patch-zlibWrapper_examples_minigzip.c) = 4ed0cb648bdd6efa61b3f66ba6eb1ea74b7767ec
diff --git a/archivers/zstd/patches/patch-Makefile b/archivers/zstd/patches/patch-Makefile
index d1101dae32b..e13f350c41c 100644
--- a/archivers/zstd/patches/patch-Makefile
+++ b/archivers/zstd/patches/patch-Makefile
@@ -4,7 +4,16 @@ Enable the "install" target on all OS.
 
 --- Makefile.orig      2021-05-14 14:59:34.000000000 +0000
 +++ Makefile
-@@ -148,7 +148,6 @@ clean:
+@@ -21,6 +21,8 @@ FUZZDIR  = $(TESTDIR)/fuzz
+ # Define nul output
+ VOID = /dev/null
+ 
++TEST ?= /usr/bin/env test
++
+ # When cross-compiling from linux to windows, you might
+ # need to specify this as "Windows." Fedora build fails
+ # without it.
+@@ -148,7 +150,6 @@ clean:
  #------------------------------------------------------------------------------
  # make install is validated only for Linux, macOS, Hurd and some BSD targets
  #------------------------------------------------------------------------------
@@ -12,9 +21,12 @@ Enable the "install" target on all OS.
  
  HOST_OS = POSIX
  
-@@ -354,7 +353,6 @@ clang38install:
+@@ -352,9 +353,8 @@ clang38install:
+ 
+ # Ubuntu 14.04 ships a too-old lz4
  lz4install:
-       [ -e lz4 ] || git clone https://github.com/lz4/lz4 && sudo $(MAKE) -C lz4 install
+-      [ -e lz4 ] || git clone https://github.com/lz4/lz4 && sudo $(MAKE) -C lz4 install
++      $(TEST) -e lz4 || git clone https://github.com/lz4/lz4 && sudo $(MAKE) -C lz4 install
  
 -endif
  
diff --git a/archivers/zstd/patches/patch-lib_Makefile b/archivers/zstd/patches/patch-lib_Makefile
index 9f177a8b072..0f102fdd46e 100644
--- a/archivers/zstd/patches/patch-lib_Makefile
+++ b/archivers/zstd/patches/patch-lib_Makefile
@@ -7,7 +7,15 @@ Fix pkgconfig installation path.
 
 --- lib/Makefile.orig  2021-05-14 14:59:34.000000000 +0000
 +++ lib/Makefile
-@@ -204,6 +204,43 @@ endif
+@@ -34,6 +34,7 @@ LIBVER_PATCH := $(shell echo $(LIBVER_PA
+ LIBVER := $(shell echo $(LIBVER_SCRIPT))
+ VERSION?= $(LIBVER)
+ CCVER := $(shell $(CC) --version)
++TEST ?= /usr/bin/env test
+ 
+ # ZSTD_LIB_MINIFY is a helper variable that
+ # configures a bunch of other variables to space-optimized defaults.
+@@ -204,6 +205,43 @@ endif
  endif # BUILD_DIR
  
  
@@ -51,7 +59,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 ($(UNAME), Darwin)
-@@ -374,7 +411,6 @@ clean:
+@@ -374,7 +412,6 @@ clean:
  #-----------------------------------------------------------------------------
  # make install is validated only for below listed environments
  #-----------------------------------------------------------------------------
@@ -59,7 +67,7 @@ Fix pkgconfig installation path.
  
  all: libzstd.pc
  
-@@ -405,11 +441,7 @@ PCLIBPREFIX := $(if $(findstring $(LIBDI
+@@ -405,11 +442,7 @@ PCLIBPREFIX := $(if $(findstring $(LIBDI
  # to PREFIX, rather than as a resolved value.
  PCEXEC_PREFIX := $(if $(HAS_EXPLICIT_EXEC_PREFIX),$(EXEC_PREFIX),$${prefix})
  
@@ -71,7 +79,44 @@ Fix pkgconfig installation path.
  
  ifneq (,$(filter $(UNAME),SunOS))
    INSTALL ?= ginstall
-@@ -479,4 +511,3 @@ uninstall:
+@@ -438,22 +471,22 @@ install: install-pc install-static insta
+ 
+ .PHONY: install-pc
+ install-pc: libzstd.pc
+-      [ -e $(DESTDIR)$(PKGCONFIGDIR) ] || $(INSTALL) -d -m 755 $(DESTDIR)$(PKGCONFIGDIR)/
++      $(TEST) -e $(DESTDIR)$(PKGCONFIGDIR) || $(INSTALL) -d -m 755 $(DESTDIR)$(PKGCONFIGDIR)/
+       $(INSTALL_DATA) libzstd.pc $(DESTDIR)$(PKGCONFIGDIR)/
+ 
+ .PHONY: install-static
+ install-static:
+       # only generate libzstd.a if it's not already present
+-      [ -e libzstd.a ] || $(MAKE) libzstd.a-release
+-      [ -e $(DESTDIR)$(LIBDIR) ] || $(INSTALL) -d -m 755 $(DESTDIR)$(LIBDIR)/
++      $(TEST) -e libzstd.a || $(MAKE) libzstd.a-release
++      $(TEST) -e $(DESTDIR)$(LIBDIR) || $(INSTALL) -d -m 755 $(DESTDIR)$(LIBDIR)/
+       @echo Installing static library
+       $(INSTALL_DATA) libzstd.a $(DESTDIR)$(LIBDIR)
+ 
+ .PHONY: install-shared
+ install-shared:
+       # only generate libzstd.so if it's not already present
+-      [ -e $(LIBZSTD) ] || $(MAKE) libzstd-release
+-      [ -e $(DESTDIR)$(LIBDIR) ] || $(INSTALL) -d -m 755 $(DESTDIR)$(LIBDIR)/
++      $(TEST) -e $(LIBZSTD) || $(MAKE) libzstd-release
++      $(TEST) -e $(DESTDIR)$(LIBDIR) || $(INSTALL) -d -m 755 $(DESTDIR)$(LIBDIR)/
+       @echo Installing shared library
+       $(INSTALL_PROGRAM) $(LIBZSTD) $(DESTDIR)$(LIBDIR)
+       ln -sf $(LIBZSTD) $(DESTDIR)$(LIBDIR)/libzstd.$(SHARED_EXT_MAJOR)
+@@ -461,7 +494,7 @@ install-shared:
+ 
+ .PHONY: install-includes
+ install-includes:
+-      [ -e $(DESTDIR)$(INCLUDEDIR) ] || $(INSTALL) -d -m 755 $(DESTDIR)$(INCLUDEDIR)/
++      $(TEST) -e $(DESTDIR)$(INCLUDEDIR) || $(INSTALL) -d -m 755 $(DESTDIR)$(INCLUDEDIR)/
+       @echo Installing includes
+       $(INSTALL_DATA) zstd.h $(DESTDIR)$(INCLUDEDIR)
+       $(INSTALL_DATA) zstd_errors.h $(DESTDIR)$(INCLUDEDIR)
+@@ -479,4 +512,3 @@ uninstall:
        $(RM) $(DESTDIR)$(INCLUDEDIR)/zdict.h
        @echo zstd libraries successfully uninstalled
  
diff --git a/archivers/zstd/patches/patch-programs_Makefile b/archivers/zstd/patches/patch-programs_Makefile
new file mode 100644
index 00000000000..939173f08e3
--- /dev/null
+++ b/archivers/zstd/patches/patch-programs_Makefile
@@ -0,0 +1,35 @@
+$NetBSD$
+
+--- programs/Makefile.orig     2021-05-14 14:59:34.000000000 +0000
++++ programs/Makefile
+@@ -44,6 +44,8 @@ ifeq ($HAVE_COLORNEVER, 1)
+ endif
+ GREP = grep $(GREP_OPTIONS)
+ 
++TEST = /usr/bin/env test
++
+ ifeq ($(shell $(CC) -v 2>&1 | $(GREP) -c "gcc version "), 1)
+   ALIGN_LOOP = -falign-loops=32
+ else
+@@ -317,7 +319,7 @@ zstd-pgo :
+       ./zstd -b7i2 $(PROFILE_WITH)
+       ./zstd -b5 $(PROFILE_WITH)
+       $(RM) zstd *.o
+-      case $(CC) in *clang*) if ! [ -e default.profdata ]; then llvm-profdata merge -output=default.profdata default*.profraw; fi ;; esac
++      case $(CC) in *clang*) if ! $(TEST) -e default.profdata; then llvm-profdata merge -output=default.profdata default*.profraw; fi ;; esac
+       $(MAKE) zstd MOREFLAGS=-fprofile-use
+ 
+ ## zstd-small: minimal target, supporting only zstd compression and decompression. no bench. no legacy. no other format.
+@@ -475,9 +477,9 @@ INSTALL_MAN     ?= $(INSTALL_DATA)
+ .PHONY: install
+ install:
+       # generate zstd only if not already present
+-      [ -e zstd ] || $(MAKE) zstd-release
+-      [ -e $(DESTDIR)$(BINDIR) ] || $(INSTALL) -d -m 755 $(DESTDIR)$(BINDIR)/
+-      [ -e $(DESTDIR)$(MAN1DIR) ] || $(INSTALL) -d -m 755 $(DESTDIR)$(MAN1DIR)/
++      $(TEST) -e zstd || $(MAKE) zstd-release
++      $(TEST) -e $(DESTDIR)$(BINDIR) || $(INSTALL) -d -m 755 $(DESTDIR)$(BINDIR)/
++      $(TEST) -e $(DESTDIR)$(MAN1DIR) || $(INSTALL) -d -m 755 $(DESTDIR)$(MAN1DIR)/
+       @echo Installing binaries
+       $(INSTALL_PROGRAM) zstd$(EXT) $(DESTDIR)$(BINDIR)/zstd$(EXT)
+       ln -sf zstd$(EXT) $(DESTDIR)$(BINDIR)/zstdcat$(EXT)
diff --git a/archivers/zstd/patches/patch-tests_Makefile b/archivers/zstd/patches/patch-tests_Makefile
index ede84f63759..c3e0e11a263 100644
--- a/archivers/zstd/patches/patch-tests_Makefile
+++ b/archivers/zstd/patches/patch-tests_Makefile
@@ -2,9 +2,58 @@ $NetBSD: patch-tests_Makefile,v 1.1 2021/02/27 16:40:59 wiz Exp $
 
 Fix running tests with shared zstd library.
 
---- tests/Makefile.orig        2020-12-19 00:39:42.000000000 +0000
+--- tests/Makefile.orig        2021-05-14 14:59:34.000000000 +0000
 +++ tests/Makefile
-@@ -327,7 +327,7 @@ test-zstd-nolegacy: zstd-nolegacy
+@@ -60,6 +60,9 @@ ZSTDMT_OBJ2 := $(subst $(ZSTDDIR)/compre
+ ZSTDMT_OBJ3 := $(subst $(ZSTDDIR)/decompress/,zstdmt_d_,$(ZSTDMT_OBJ2))
+ ZSTDMT_OBJECTS := $(ZSTDMT_OBJ3:.c=.o)
+ 
++UNAME := $(shell uname)
++UNAME_R := $(shell uname -r)
++
+ # Define *.exe as extension for Windows systems
+ ifneq (,$(filter Windows%,$(OS)))
+ EXT =.exe
+@@ -72,6 +75,12 @@ MULTITHREAD_LD  = -pthread
+ endif
+ MULTITHREAD = $(MULTITHREAD_CPP) $(MULTITHREAD_LD)
+ 
++ifneq (,$(filter $(UNAME),SunOS))
++ifeq (5.10,$(UNAME_R))
++NANOSLEEP_LD = -lrt
++endif
++endif
++
+ VOID = /dev/null
+ ZSTREAM_TESTTIME ?= -T90s
+ FUZZERTEST ?= -T200s
+@@ -148,7 +157,7 @@ fullbench-dll: $(PRGDIR)/datagen.c $(PRG
+       $(LINK.c) $^ $(LDLIBS) -o $@$(EXT)
+ 
+ fuzzer : CPPFLAGS += $(MULTITHREAD_CPP) -Wno-deprecated-declarations
+-fuzzer : LDFLAGS += $(MULTITHREAD_LD)
++fuzzer : LDFLAGS += $(MULTITHREAD_LD) $(NANOSLEEP_LD)
+ fuzzer : $(ZSTDMT_OBJECTS)
+ fuzzer fuzzer32 : $(ZDICT_FILES) $(PRGDIR)/util.c $(PRGDIR)/timefn.c $(PRGDIR)/datagen.c fuzzer.c
+ 
+@@ -208,7 +217,7 @@ decodecorpus : LDLIBS += -lm
+ decodecorpus : $(filter-out zstdc_zstd_compress.o, $(ZSTD_OBJECTS)) $(ZDICT_FILES) $(PRGDIR)/util.c $(PRGDIR)/timefn.c decodecorpus.c
+ 
+ poolTests : $(PRGDIR)/util.c $(PRGDIR)/timefn.c poolTests.c $(ZSTDDIR)/common/pool.c $(ZSTDDIR)/common/threading.c $(ZSTDDIR)/common/zstd_common.c $(ZSTDDIR)/common/error_private.c
+-      $(LINK.c) $(MULTITHREAD) $^ -o $@$(EXT)
++      $(LINK.c) $(MULTITHREAD) $(NANOSLEEP_LD) $^ -o $@$(EXT)
+ 
+ .PHONY: versionsTest
+ versionsTest: clean
+@@ -243,7 +252,6 @@ clean:
+ #----------------------------------------------------------------------------------
+ # valgrind tests are validated only for some posix platforms
+ #----------------------------------------------------------------------------------
+-UNAME := $(shell uname)
+ ifneq (,$(filter $(UNAME),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS))
+ HOST_OS = POSIX
+ 
+@@ -317,7 +325,7 @@ test-zstd-nolegacy: zstd-nolegacy
  
  test-zstd test-zstd32 test-zstd-nolegacy: datagen
        file $(ZSTD)
diff --git a/archivers/zstd/patches/patch-zlibWrapper_Makefile b/archivers/zstd/patches/patch-zlibWrapper_Makefile
new file mode 100644
index 00000000000..80d31009a90
--- /dev/null
+++ b/archivers/zstd/patches/patch-zlibWrapper_Makefile
@@ -0,0 +1,35 @@
+$NetBSD$
+
+--- zlibWrapper/Makefile.orig  2021-06-01 06:48:51.639135599 +0000
++++ zlibWrapper/Makefile
+@@ -33,6 +33,9 @@ CFLAGS   += $(STDFLAGS) $(DEBUGFLAGS)
+ CPPFLAGS += $(MOREFLAGS)
+ LDLIBS   += $(ZLIB_LIBRARY)
+ 
++UNAME := $(shell uname)
++UNAME_R := $(shell uname -r)
++
+ # Define *.exe as extension for Windows systems
+ ifneq (,$(filter Windows%,$(OS)))
+ EXT =.exe
+@@ -40,6 +43,12 @@ else
+ EXT =
+ endif
+ 
++ifneq (,$(filter $(UNAME),SunOS))
++ifeq (5.10,$(UNAME_R))
++NANOSLEEP_LD = -lrt
++endif
++endif
++
+ default : release
+ 
+ release : STDFLAGS =
+@@ -98,6 +107,7 @@ fitblk_zstd: fitblk.o zstdTurnedOn_zlibw
+       $(LINK.o) $^ $(LDLIBS) $(OUTPUT_OPTION)
+ 
+ zwrapbench: zwrapbench.o zstd_zlibwrapper.o util.o timefn.o datagen.o $(ZSTDLIBRARY)
++      $(LINK.o) $^ $(LDLIBS) $(NANOSLEEP_LD) $(OUTPUT_OPTION)
+ 
+ 
+ zstd_zlibwrapper.o: zstd_zlibwrapper.h


Home | Main Index | Thread Index | Old Index