package/zstd: observe Buildroot optimisation flags
authorNorbert Lange <nolange79@gmail.com>
Thu, 17 Jun 2021 09:14:54 +0000 (11:14 +0200)
committerArnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Wed, 4 Aug 2021 14:28:50 +0000 (16:28 +0200)
Use Buildroot's setting for optimization, zstd's build system
overrides CFLAGS (adds -O3), but MOREFLAGS can override again.
Quick tests show that using -O2 (like buildroot)
is actually a little faster than -O3 on x86_64 Atoms.

Disable the legacy format, these are just needed for
decompressing files created with pre-release version.

Signed-off-by: Norbert Lange <nolange79@gmail.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
package/zstd/zstd.mk

index a0976b07018da6f8e22eac2454e010c23b90cfc2..5a96c113097c27ffabdcac6564c7e1c9cf5091bf 100644 (file)
@@ -12,6 +12,7 @@ ZSTD_LICENSE_FILES = LICENSE COPYING
 ZSTD_CPE_ID_VENDOR = facebook
 ZSTD_CPE_ID_PRODUCT = zstandard
 
+ZSTD_OPTS += ZSTD_LEGACY_SUPPORT=0
 ifeq ($(BR2_PACKAGE_ZLIB),y)
 ZSTD_DEPENDENCIES += zlib
 ZSTD_OPTS += HAVE_ZLIB=1
@@ -33,6 +34,9 @@ else
 ZSTD_OPTS += HAVE_LZ4=0
 endif
 
+# zstd will append -O3 after $(CFLAGS), use MOREFLAGS to override again
+ZSTD_OPTS += MOREFLAGS="$(TARGET_OPTIMIZATION)"
+
 ifeq ($(BR2_STATIC_LIBS),y)
 ZSTD_BUILD_LIBS = libzstd.a
 ZSTD_INSTALL_LIBS = install-static