From 8e95b050747135b66fc718ea91dac7c34d1a29ac Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Fri, 19 Jul 2019 21:08:19 -0700 Subject: [PATCH] zstd: Update to 1.4.3 Bugfix release. Signed-off-by: Rosen Penev (cherry-picked from 133a02a1153b2fbe9e00e0ec42109d021a533127) --- utils/zstd/Makefile | 28 +++++--- utils/zstd/patches/010-uClibc-ng.patch | 11 --- utils/zstd/patches/010-utime.patch | 97 ++++++++++++++++++++++++++ 3 files changed, 115 insertions(+), 21 deletions(-) delete mode 100644 utils/zstd/patches/010-uClibc-ng.patch create mode 100644 utils/zstd/patches/010-utime.patch diff --git a/utils/zstd/Makefile b/utils/zstd/Makefile index 2f3048e24e..f6bdf5ec43 100644 --- a/utils/zstd/Makefile +++ b/utils/zstd/Makefile @@ -1,12 +1,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=zstd -PKG_VERSION:=1.4.0 -PKG_RELEASE:=4 +PKG_VERSION:=1.4.3 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/facebook/zstd/tar.gz/v$(PKG_VERSION)? -PKG_HASH:=63be339137d2b683c6d19a9e34f4fb684790e864fee13c7dd40e197a64c705c1 +PKG_HASH:=5eda3502ecc285c3c92ee0cc8cd002234dee39d539b3f692997a0e80de1d33de PKG_MAINTAINER:=Amol Bhave PKG_LICENSE:=GPL-2.0-or-later @@ -21,13 +21,6 @@ include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/cmake.mk -ifeq ($(CONFIG_ZSTD_OPTIMIZE_O3),y) - TARGET_CFLAGS := $(filter-out -O%,$(TARGET_CFLAGS)) - TARGET_CFLAGS += -O3 - TARGET_CXXFLAGS := $(filter-out -O%,$(TARGET_CXXFLAGS)) - TARGET_CXXFLAGS += -O3 -endif - define Package/zstd/Default SUBMENU:=Compression URL:=https://github.com/facebook/zstd @@ -38,6 +31,7 @@ $(call Package/zstd/Default) SECTION:=libs CATEGORY:=Libraries TITLE:=zstd library. + MENU:=1 endef define Package/libzstd/description @@ -48,6 +42,7 @@ endef define Package/libzstd/config config ZSTD_OPTIMIZE_O3 bool "Use all optimizations (-O3)" + depends on PACKAGE_libzstd default y help This enables additional optmizations using the -O3 compilation flag. @@ -66,6 +61,19 @@ define Package/zstd/description This package provides the zstd binaries. endef +ifeq ($(CONFIG_ZSTD_OPTIMIZE_O3),y) +TARGET_CFLAGS:= $(filter-out -O%,$(TARGET_CFLAGS)) -O3 +endif + +TARGET_CFLAGS += -flto +TARGET_LDFLAGS += -Wl,--as-needed + +define Build/InstallDev + $(call Build/InstallDev/cmake,$(1)) + $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/libzstd.pc + $(SED) 's,/usr/lib,$$$${prefix}/lib,g' $(1)/usr/lib/pkgconfig/libzstd.pc +endef + define Package/libzstd/install $(INSTALL_DIR) $(1)/usr/lib $(CP) $(PKG_INSTALL_DIR)/usr/lib/libzstd.so* $(1)/usr/lib/ diff --git a/utils/zstd/patches/010-uClibc-ng.patch b/utils/zstd/patches/010-uClibc-ng.patch deleted file mode 100644 index 552286becc..0000000000 --- a/utils/zstd/patches/010-uClibc-ng.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/programs/fileio.c -+++ b/programs/fileio.c -@@ -175,7 +175,7 @@ static void clearHandler(void) - - #if !defined(BACKTRACE_ENABLE) - /* automatic detector : backtrace enabled by default on linux+glibc and osx */ --# if (defined(__linux__) && defined(__GLIBC__)) \ -+# if (defined(__linux__) && (defined(__GLIBC__) && !defined(__UCLIBC__))) \ - || (defined(__APPLE__) && defined(__MACH__)) - # define BACKTRACE_ENABLE 1 - # else diff --git a/utils/zstd/patches/010-utime.patch b/utils/zstd/patches/010-utime.patch new file mode 100644 index 0000000000..a67e696aca --- /dev/null +++ b/utils/zstd/patches/010-utime.patch @@ -0,0 +1,97 @@ +From 245a69c0f5784ba89c28301263bcfd5785ebe0ea Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Tue, 30 Jul 2019 17:17:07 -0700 +Subject: [PATCH] zstd: Don't use utime on Linux + +utime is deprecated by POSIX 2008 and optionally not available with +uClibc-ng. + +Got rid of a few useless headers in timefn.h. + +Signed-off-by: Rosen Penev +--- + programs/platform.h | 2 +- + programs/timefn.h | 6 ------ + programs/util.c | 10 ++++++++++ + programs/util.h | 5 +++-- + 4 files changed, 14 insertions(+), 9 deletions(-) + +diff --git a/programs/platform.h b/programs/platform.h +index 38ded8727..5934e59cf 100644 +--- a/programs/platform.h ++++ b/programs/platform.h +@@ -92,7 +92,7 @@ extern "C" { + + # if defined(__linux__) || defined(__linux) + # ifndef _POSIX_C_SOURCE +-# define _POSIX_C_SOURCE 200112L /* feature test macro : https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html */ ++# define _POSIX_C_SOURCE 200809L /* feature test macro : https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html */ + # endif + # endif + # include /* declares _POSIX_VERSION */ +diff --git a/programs/timefn.h b/programs/timefn.h +index d1ddd31b1..2db3765b9 100644 +--- a/programs/timefn.h ++++ b/programs/timefn.h +@@ -19,12 +19,6 @@ extern "C" { + /*-**************************************** + * Dependencies + ******************************************/ +-#include /* utime */ +-#if defined(_MSC_VER) +-# include /* utime */ +-#else +-# include /* utime */ +-#endif + #include /* clock_t, clock, CLOCKS_PER_SEC */ + + +diff --git a/programs/util.c b/programs/util.c +index fb77d1783..3a2e9e28f 100644 +--- a/programs/util.c ++++ b/programs/util.c +@@ -54,14 +54,24 @@ int UTIL_getFileStat(const char* infilename, stat_t *statbuf) + int UTIL_setFileStat(const char *filename, stat_t *statbuf) + { + int res = 0; ++#if defined(_WIN32) + struct utimbuf timebuf; ++#else ++ struct timespec timebuf[2]; ++#endif + + if (!UTIL_isRegularFile(filename)) + return -1; + ++#if defined(_WIN32) + timebuf.actime = time(NULL); + timebuf.modtime = statbuf->st_mtime; + res += utime(filename, &timebuf); /* set access and modification times */ ++#else ++ timebuf[0].tv_sec = time(NULL); ++ timebuf[1].tv_sec = statbuf->st_mtime; ++ res += utimensat(AT_FDCWD, filename, timebuf, 0); /* set access and modification times */ ++#endif + + #if !defined(_WIN32) + res += chown(filename, statbuf->st_uid, statbuf->st_gid); /* Copy ownership */ +diff --git a/programs/util.h b/programs/util.h +index d6e5bb550..71d4c7c77 100644 +--- a/programs/util.h ++++ b/programs/util.h +@@ -25,12 +25,13 @@ extern "C" { + #include /* fprintf */ + #include /* stat, utime */ + #include /* stat, chmod */ +-#if defined(_MSC_VER) ++#if defined(_WIN32) + # include /* utime */ + # include /* _chmod */ + #else ++# include /* AT_FDCWD */ ++# include /* utimensat */ + # include /* chown, stat */ +-# include /* utime */ + #endif + #include /* clock_t, clock, CLOCKS_PER_SEC, nanosleep */ + #include "mem.h" /* U32, U64 */ -- 2.30.2