package/zstd: fix build without threads

Move libzstd.pc in ZSTD_BUILD_LIBS so it will be suffixed by -nomt
without threads. As a result, libzstd.pc will not contain -pthread in
Libs.Private which will avoid the following static build failure with
zchunk) raised since commit 0f0e913f10:

/home/buildroot/autobuild/instance-2/output-1/host/bin/aarch64_be-buildroot-linux-uclibc-gcc  -o src/unzck src/unzck.p/unzck.c.o src/unzck.p/util_common.c.o -Wl,--as-needed -Wl,--no-undefined -static -Wl,--start-group src/lib/libzck.a -largp /home/buildroot/autobuild/instance-2/output-1/host/aarch64_be-buildroot-linux-uclibc/sysroot/usr/lib/libzstd.a -pthread /home/buildroot/autobuild/instance-2/output-1/host/aarch64_be-buildroot-linux-uclibc/sysroot/usr/lib/libssl.a /home/buildroot/autobuild/instance-2/output-1/host/aarch64_be-buildroot-linux-uclibc/sysroot/usr/lib/libcrypto.a -Wl,--end-group
/home/buildroot/autobuild/instance-2/output-1/host/lib/gcc/aarch64_be-buildroot-linux-uclibc/10.3.0/../../../../aarch64_be-buildroot-linux-uclibc/bin/ld: cannot find -lpthread

Fixes:
 - http://autobuild.buildroot.org/results/481d1979920daaecac48dec763151e124651740f

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
This commit is contained in:
Fabrice Fontaine 2022-06-12 18:02:17 +02:00 committed by Yann E. MORIN
parent e6904fdd7e
commit 253a951c4f

View File

@ -38,14 +38,15 @@ endif
# zstd will append -O3 after $(CFLAGS), use MOREFLAGS to override again
ZSTD_OPTS += MOREFLAGS="$(TARGET_OPTIMIZATION)"
ZSTD_BUILD_LIBS_BASENAMES = libzstd.pc
ifeq ($(BR2_STATIC_LIBS),y)
ZSTD_BUILD_LIBS = libzstd.a
ZSTD_BUILD_LIBS_BASENAMES += libzstd.a
ZSTD_INSTALL_LIBS = install-static
else ifeq ($(BR2_SHARED_LIBS),y)
ZSTD_BUILD_LIBS = lib
ZSTD_BUILD_LIBS_BASENAMES += lib
ZSTD_INSTALL_LIBS = install-shared
else
ZSTD_BUILD_LIBS = lib
ZSTD_BUILD_LIBS_BASENAMES += lib
ZSTD_INSTALL_LIBS = install-static install-shared
endif
@ -63,17 +64,20 @@ endif
# purpose.
ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
ZSTD_OPTS += HAVE_THREAD=1
ZSTD_BUILD_LIBS := $(addsuffix -mt,$(ZSTD_BUILD_LIBS))
ZSTD_BUILD_LIBS_THREAD_SUFFIX = -mt
else
ZSTD_OPTS += HAVE_THREAD=0
ZSTD_BUILD_LIBS := $(addsuffix -nomt,$(ZSTD_BUILD_LIBS))
ZSTD_BUILD_LIBS_THREAD_SUFFIX = -nomt
endif
# check-package disable OverriddenVariable - override intended
ZSTD_BUILD_LIBS := $(addsuffix -release,$(ZSTD_BUILD_LIBS))
ZSTD_BUILD_LIBS = \
$(addsuffix -release, \
$(addsuffix $(ZSTD_BUILD_LIBS_THREAD_SUFFIX), \
$(ZSTD_BUILD_LIBS_BASENAMES)))
define ZSTD_BUILD_CMDS
$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
-C $(@D)/lib $(ZSTD_BUILD_LIBS) libzstd.pc
-C $(@D)/lib $(ZSTD_BUILD_LIBS)
$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
-C $(@D)/programs $(ZSTD_BUILD_PROG_TARGET)
endef