diff --git a/.gitignore b/.gitignore index 162c6a7..c2f67b2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ pax_global_header -v1.5.2 -zstd-1.5.2/ +zstd*/ log/ install log.STABLE diff --git a/buildenv b/buildenv index 1f12dda..153cc54 100644 --- a/buildenv +++ b/buildenv @@ -1,17 +1,22 @@ # bump: zstd-version /ZSTD_VERSION=(.*)/ https://github.com/facebook/zstd.git|semver:^1 -ZSTD_VERSION=1.5.5 +ZSTD_VERSION=1.5.7 export ZOPEN_BUILD_LINE="STABLE" export ZOPEN_CATEGORIES="compression" -export ZOPEN_STABLE_URL="https://github.com/facebook/zstd/archive/refs/tags/v${ZSTD_VERSION}.tar.gz" -export ZOPEN_STABLE_DEPS="curl gzip make coreutils zoslib check_python" +export ZOPEN_STABLE_URL="https://github.com/facebook/zstd.git" +export ZOPEN_STABLE_TAG="v${ZSTD_VERSION}" +export ZOPEN_STABLE_DEPS="make coreutils check_python diffutils which" export ZOPEN_BOOTSTRAP=skip export ZOPEN_CONFIGURE=skip export ZSTD_NO_ASM=1 +export MT=1 export ZOPEN_COMP=CLANG -export ZOPEN_MAKE_OPTS="prefix=\${ZOPEN_INSTALL_DIR}" +export ZOPEN_MAKE_OPTS="prefix=\${ZOPEN_INSTALL_DIR} lib-mt" export ZOPEN_CHECK_OPTS="-i check" export ZOPEN_INSTALL_OPTS="install POSIX_ENV=Yes prefix=\${ZOPEN_INSTALL_DIR}" +export ZOPEN_CONFIGURE_MINIMAL="yes" +export ZOPEN_MAKE_MINIMAL="yes" +export USE_CLANG_WRAPPER=1 # # Starter for Python @@ -21,10 +26,6 @@ if ! type python3 >/dev/null ; then return 4 fi -export ZOPEN_NAME="zstd-${ZSTD_VERSION}" -rm -f "v${ZSTD_VERSION}" -ln -s ${ZOPEN_NAME} "v${ZSTD_VERSION}" - zopen_append_to_env() { cat < /dev/null 2> /dev/null && echo 1 || echo 0) - EGREP_OPTIONS ?= -@@ -404,15 +404,10 @@ install: - [ -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) -- ln -sf zstd$(EXT) $(DESTDIR)$(BINDIR)/unzstd$(EXT) -- ln -sf zstd$(EXT) $(DESTDIR)$(BINDIR)/zstdmt$(EXT) - $(INSTALL_SCRIPT) zstdless $(DESTDIR)$(BINDIR)/zstdless - $(INSTALL_SCRIPT) zstdgrep $(DESTDIR)$(BINDIR)/zstdgrep - @echo Installing man pages - $(INSTALL_MAN) zstd.1 $(DESTDIR)$(MAN1DIR)/zstd.1 -- ln -sf zstd.1 $(DESTDIR)$(MAN1DIR)/zstdcat.1 -- ln -sf zstd.1 $(DESTDIR)$(MAN1DIR)/unzstd.1 - $(INSTALL_MAN) zstdgrep.1 $(DESTDIR)$(MAN1DIR)/zstdgrep.1 - $(INSTALL_MAN) zstdless.1 $(DESTDIR)$(MAN1DIR)/zstdless.1 - @echo zstd installation completed diff --git a/patches/PR1/addzostomakefile.patch b/patches/PR1/addzostomakefile.patch deleted file mode 100644 index edebb59..0000000 --- a/patches/PR1/addzostomakefile.patch +++ /dev/null @@ -1,44 +0,0 @@ -diff --git a/Makefile b/Makefile -index 9b5451d..6c3f937 100644 ---- a/Makefile -+++ b/Makefile -@@ -149,7 +149,7 @@ clean: - #------------------------------------------------------------------------------ - # make install is validated only for Linux, macOS, Hurd and some BSD targets - #------------------------------------------------------------------------------ --ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD DragonFly NetBSD MSYS_NT Haiku AIX)) -+ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD DragonFly NetBSD MSYS_NT Haiku AIX OS/390)) - - HOST_OS = POSIX - -diff --git i/lib/Makefile w/lib/Makefile -index a4cf61a..15636a1 100644 ---- i/lib/Makefile -+++ w/lib/Makefile -@@ -77,6 +77,8 @@ ifeq ($(UNAME), Darwin) - else - ifeq ($(UNAME), AIX) - SONAME_FLAGS = -+ else ifeq ($(UNAME), OS/390) -+ SONAME_FLAGS = - else - SONAME_FLAGS = -Wl,-soname=libzstd.$(SHARED_EXT).$(LIBVER_MAJOR) - endif -@@ -160,7 +162,7 @@ $(ZSTD_DYNLIB): $(ZSTD_DYNLIB_OBJ) - $(if $(filter -DZSTD_MULTITHREAD,$(CPPFLAGS)),\ - @echo compiling multi-threaded dynamic library $(LIBVER),\ - @echo compiling single-threaded dynamic library $(LIBVER)) -- $(CC) $(FLAGS) $^ $(LDFLAGS) $(SONAME_FLAGS) -o $@ -+ $(CC) $(FLAGS) $^ $(LDFLAGS) $(SONAME_FLAGS) -o $@ $(LIBS) - @echo creating versioned links - ln -sf $@ libzstd.$(SHARED_EXT_MAJOR) - ln -sf $@ libzstd.$(SHARED_EXT) -@@ -249,7 +251,7 @@ clean: - #----------------------------------------------------------------------------- - # make install is validated only for below listed environments - #----------------------------------------------------------------------------- --ifneq (,$(filter $(UNAME),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku AIX)) -+ifneq (,$(filter $(UNAME),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku AIX OS/390 )) - - lib: libzstd.pc - diff --git a/patches/lib.patch b/patches/lib.patch new file mode 100644 index 0000000..8aec36f --- /dev/null +++ b/patches/lib.patch @@ -0,0 +1,87 @@ +diff --git a/lib/Makefile b/lib/Makefile +index a6a0eb0..c3fb5fd 100644 +--- a/lib/Makefile ++++ b/lib/Makefile +@@ -83,12 +83,19 @@ ifeq ($(UNAME_TARGET_SYSTEM), Darwin) + else + ifeq ($(UNAME_TARGET_SYSTEM), AIX) + SONAME_FLAGS = ++ else ifeq ($(UNAME_TARGET_SYSTEM), OS/390) ++ SONAME_FLAGS = + else + SONAME_FLAGS = -Wl,-soname=libzstd.$(SHARED_EXT).$(LIBVER_MAJOR) + endif + SHARED_EXT = so +- SHARED_EXT_MAJOR = $(SHARED_EXT).$(LIBVER_MAJOR) +- SHARED_EXT_VER = $(SHARED_EXT).$(LIBVER) ++ ifeq ($(UNAME_TARGET_SYSTEM), OS/390) ++ SHARED_EXT_MAJOR = $(SHARED_EXT) ++ SHARED_EXT_VER = $(SHARED_EXT) ++ else ++ SHARED_EXT_MAJOR = $(SHARED_EXT).$(LIBVER_MAJOR) ++ SHARED_EXT_VER = $(SHARED_EXT).$(LIBVER) ++ endif + endif + + +@@ -145,6 +152,9 @@ LIBZSTD = libzstd.$(SHARED_EXT_VER) + .PHONY: $(LIBZSTD) # must be run every time + $(LIBZSTD): CPPFLAGS += $(CPPFLAGS_DYNLIB) + $(LIBZSTD): CFLAGS += -fPIC -fvisibility=hidden ++ifeq ($(UNAME_TARGET_SYSTEM), OS/390) ++$(LIBZSTD): CFLAGS += -shared ++endif + $(LIBZSTD): LDFLAGS += -shared $(LDFLAGS_DYNLIB) + + ifndef BUILD_DIR +@@ -167,12 +177,17 @@ $(ZSTD_DYNLIB): $(ZSTD_DYNLIB_OBJ) + @echo compiling multi-threaded dynamic library $(LIBVER),\ + @echo compiling single-threaded dynamic library $(LIBVER)) + $(CC) $(FLAGS) $^ $(LDFLAGS) $(SONAME_FLAGS) -o $@ ++ifneq ($(UNAME_TARGET_SYSTEM), OS/390) + @echo creating versioned links + ln -sf $@ libzstd.$(SHARED_EXT_MAJOR) + ln -sf $@ libzstd.$(SHARED_EXT) ++endif + + $(LIBZSTD): $(ZSTD_DYNLIB) + cp -f $< $@ ++ifeq ($(UNAME_TARGET_SYSTEM), OS/390) ++ [ ! -f $(dir $<)libzstd.x ] || cp -f $(dir $<)libzstd.x libzstd.x ++endif + + endif # ifndef BUILD_DIR + endif # if windows +@@ -247,6 +262,9 @@ $(DEPFILES): + ZSTDMT_FILES = zstdmt_compress.c + ZSTD_NOMT_FILES = $(filter-out $(ZSTDMT_FILES),$(notdir $(ZSTD_FILES))) + libzstd-nomt: CFLAGS += -fPIC -fvisibility=hidden ++ifeq ($(UNAME_TARGET_SYSTEM), OS/390) ++libzstd-nomt: CFLAGS += -shared ++endif + libzstd-nomt: LDFLAGS += -shared + libzstd-nomt: $(ZSTD_NOMT_FILES) + @echo compiling single-thread dynamic library $(LIBVER) +@@ -268,7 +286,7 @@ clean: + #----------------------------------------------------------------------------- + # make install is validated only for below listed environments + #----------------------------------------------------------------------------- +-ifneq (,$(filter Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku AIX MSYS_NT% CYGWIN_NT%,$(UNAME))) ++ifneq (,$(filter Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku AIX MSYS_NT% CYGWIN_NT% OS/390,$(UNAME))) + + lib: libzstd.pc + +@@ -363,8 +381,13 @@ install-shared: + [ -e $(DESTDIR)$(LIBDIR) ] || $(INSTALL) -d -m 755 $(DESTDIR)$(LIBDIR)/ + @echo Installing shared library + $(INSTALL_PROGRAM) $(LIBZSTD) $(DESTDIR)$(LIBDIR) ++ifeq ($(UNAME_TARGET_SYSTEM), OS/390) ++ [ ! -f libzstd.x ] || $(INSTALL_DATA) libzstd.x $(DESTDIR)$(LIBDIR) ++endif ++ifneq ($(UNAME_TARGET_SYSTEM), OS/390) + ln -sf $(LIBZSTD) $(DESTDIR)$(LIBDIR)/libzstd.$(SHARED_EXT_MAJOR) + ln -sf $(LIBZSTD) $(DESTDIR)$(LIBDIR)/libzstd.$(SHARED_EXT) ++endif + + .PHONY: install-includes + install-includes: diff --git a/patches/PR1/assertfirst.patch b/patches/programs.patch similarity index 66% rename from patches/PR1/assertfirst.patch rename to patches/programs.patch index 24bfa6a..efda977 100644 --- a/patches/PR1/assertfirst.patch +++ b/patches/programs.patch @@ -1,25 +1,39 @@ +diff --git a/programs/Makefile b/programs/Makefile +index f4af5e9..be62692 100644 +--- a/programs/Makefile ++++ b/programs/Makefile +@@ -345,7 +345,7 @@ include $(wildcard $(DEPFILES)) + #----------------------------------------------------------------------------- + # make install is validated only for Linux, macOS, BSD, Hurd and Solaris targets + #----------------------------------------------------------------------------- +-ifneq (,$(filter Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku AIX MSYS_NT% CYGWIN_NT%,$(UNAME))) ++ifneq (,$(filter Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku AIX MSYS_NT% CYGWIN_NT% OS/390,$(UNAME))) + + HAVE_COLORNEVER = $(shell echo a | egrep --color=never a > /dev/null 2> /dev/null && echo 1 || echo 0) + EGREP_OPTIONS ?= diff --git a/programs/benchzstd.c b/programs/benchzstd.c -index 9bc3628..bdbf7f3 100644 +index f9274a5..3ca5908 100644 --- a/programs/benchzstd.c +++ b/programs/benchzstd.c -@@ -20,13 +20,13 @@ +@@ -18,15 +18,13 @@ /* ************************************* - * Includes - ***************************************/ --#include "platform.h" /* Large Files support */ --#include "util.h" /* UTIL_getFileSize, UTIL_sleep */ - #include /* malloc, free */ - #include /* memset, strerror */ - #include /* fprintf, fopen */ + * Includes + ***************************************/ +-/* this must be included first */ +-#include "platform.h" /* Large Files support, compiler specifics */ +- + /* then following system includes */ + #include /* assert */ #include - #include /* assert */ -+#include "platform.h" /* Large Files support */ -+#include "util.h" /* UTIL_getFileSize, UTIL_sleep */ - - #include "timefn.h" /* UTIL_time_t */ + #include /* fprintf, fopen */ + #include /* malloc, free */ + #include /* memset, strerror */ ++#include "platform.h" /* Large Files support, compiler specifics */ + #include "util.h" /* UTIL_getFileSize, UTIL_sleep */ + #include "../lib/common/mem.h" #include "benchfn.h" diff --git a/programs/dibio.c b/programs/dibio.c -index 26ebe5c..7b448b2 100644 +index 7ba22d1..66abdd0 100644 --- a/programs/dibio.c +++ b/programs/dibio.c @@ -21,12 +21,12 @@ @@ -38,7 +52,7 @@ index 26ebe5c..7b448b2 100644 #include "timefn.h" /* UTIL_time_t, UTIL_clockSpanMicro, UTIL_getTime */ #include "../lib/common/debug.h" /* assert */ diff --git a/programs/fileio.c b/programs/fileio.c -index 84a0f48..9d1e9b4 100644 +index 0ecca40..3c85983 100644 --- a/programs/fileio.c +++ b/programs/fileio.c @@ -23,8 +23,6 @@ @@ -60,10 +74,10 @@ index 84a0f48..9d1e9b4 100644 #if defined (_MSC_VER) diff --git a/programs/util.c b/programs/util.c -index c9031e9..29b1547 100644 +index 065a358..21d8e67 100644 --- a/programs/util.c +++ b/programs/util.c -@@ -16,12 +16,12 @@ extern "C" { +@@ -11,12 +11,12 @@ /*-**************************************** * Dependencies ******************************************/ @@ -75,13 +89,13 @@ index c9031e9..29b1547 100644 #include +#include "util.h" /* note : ensure that platform.h is included first ! */ - #if defined(_WIN32) - # include /* utime */ + #if defined(__FreeBSD__) + #include /* __FreeBSD_version */ diff --git a/programs/zstdcli.c b/programs/zstdcli.c -index d246545..70d3cab 100644 +index 83d9b88..6b7012f 100644 --- a/programs/zstdcli.c +++ b/programs/zstdcli.c -@@ -27,13 +27,13 @@ +@@ -11,12 +11,12 @@ /*-************************************ * Dependencies **************************************/ @@ -90,7 +104,6 @@ index d246545..70d3cab 100644 #include /* getenv */ #include /* strcmp, strlen */ #include /* fprintf(), stdin, stdout, stderr */ - #include /* errno */ #include /* assert */ +#include "platform.h" /* PLATFORM_POSIX_VERSION */ +#include "util.h" /* UTIL_HAS_CREATEFILELIST, UTIL_createFileList, UTIL_isConsole */ diff --git a/patches/test.patch b/patches/test.patch new file mode 100644 index 0000000..a4f9171 --- /dev/null +++ b/patches/test.patch @@ -0,0 +1,13 @@ +diff --git a/tests/Makefile b/tests/Makefile +index 406c7f2..ef9405b 100644 +--- a/tests/Makefile ++++ b/tests/Makefile +@@ -273,7 +273,7 @@ clean: + # valgrind tests validated only for some posix platforms + #---------------------------------------------------------------------------------- + UNAME := $(shell sh -c 'MSYSTEM="MSYS" uname') +-ifneq (,$(filter Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS AIX CYGWIN_NT%,$(UNAME))) ++ifneq (,$(filter Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS AIX CYGWIN_NT% OS/390,$(UNAME))) + HOST_OS = POSIX + + .PHONY: test-valgrind diff --git a/patches/tests_Makefile.patch b/patches/tests_Makefile.patch deleted file mode 100644 index 02542ae..0000000 --- a/patches/tests_Makefile.patch +++ /dev/null @@ -1,64 +0,0 @@ -diff --git a/tests/Makefile b/tests/Makefile -index 778c7d6..d65014f 100644 ---- a/tests/Makefile -+++ b/tests/Makefile -@@ -35,9 +35,10 @@ PYTHON ?= python3 - TESTARTEFACT := versionsTest - - DEBUGFLAGS += -g -Wno-c++-compat --CPPFLAGS += -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(ZSTDDIR)/compress \ -+CPPFLAGS_EXTRA += -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(ZSTDDIR)/compress \ - -I$(ZSTDDIR)/dictBuilder -I$(ZSTDDIR)/deprecated -I$(PRGDIR) \ - -DZSTD_WINDOW_OVERFLOW_CORRECT_FREQUENTLY=1 -+override CPPFLAGS += $(CPPFLAGS_EXTRA) - - ZSTDCOMMON_FILES := $(sort $(ZSTD_COMMON_FILES)) - ZSTDCOMP_FILES := $(sort $(ZSTD_COMPRESS_FILES)) -@@ -58,15 +59,20 @@ ZSTDMT_OBJ3 := $(subst $(ZSTDDIR)/decompress/,zstdmt_d_,$(ZSTDMT_OBJ2)) - ZSTDMT_OBJ4 := $(ZSTDMT_OBJ3:.c=.o) - ZSTDMT_OBJECTS := $(ZSTDMT_OBJ4:.S=.o) - -+UNAME := $(shell uname) - # Define *.exe as extension for Windows systems - ifneq (,$(filter Windows%,$(OS))) - EXT =.exe - MULTITHREAD_CPP = -DZSTD_MULTITHREAD -+ifneq (,$(filter $(UNAME), OS/390)) -+MULTITHREAD_LD = -pthread -+else - MULTITHREAD_LD = -+#endif - else - EXT = - MULTITHREAD_CPP = -DZSTD_MULTITHREAD --MULTITHREAD_LD = -pthread -+MULTITHREAD_LD = - endif - MULTITHREAD = $(MULTITHREAD_CPP) $(MULTITHREAD_LD) - -@@ -207,7 +213,7 @@ paramgrill : $(ZSTD_FILES) $(PRGDIR)/util.c $(PRGDIR)/timefn.c $(PRGDIR)/benchfn - - CLEAN += datagen - datagen : $(PRGDIR)/datagen.c datagencli.c -- $(LINK.c) $^ -o $@$(EXT) -+ $(LINK.c) $(CPPFLAGS) $^ -o $@$(EXT) - - CLEAN += roundTripCrash - roundTripCrash: CFLAGS += $(MULTITHREAD) -@@ -263,7 +269,7 @@ clean: - # valgrind tests validated only for some posix platforms - #---------------------------------------------------------------------------------- - UNAME := $(shell uname) --ifneq (,$(filter $(UNAME),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS AIX)) -+ifneq (,$(filter $(UNAME),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS AIX OS/390)) - HOST_OS = POSIX - - .PHONY: test-valgrind -@@ -307,6 +313,7 @@ shortest: ZSTDRTTEST= # remove long tests - shortest: test-zstd - - .PHONY: check -+check : CPPFLAGS += $(CPPFLAGS) - check: shortest - - .PHONY: fuzztest