From patchwork Tue Jun 15 10:35:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Norbert Lange X-Patchwork-Id: 1492120 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=smtp1.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=heBZXEyv; dkim-atps=neutral Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G44VJ3B8Lz9sW4 for ; Tue, 15 Jun 2021 20:36:07 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 988E383ACA; Tue, 15 Jun 2021 10:36:05 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oQ2FoqeA40TY; Tue, 15 Jun 2021 10:36:04 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp1.osuosl.org (Postfix) with ESMTP id DF4C283A90; Tue, 15 Jun 2021 10:36:03 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id B46201BF296 for ; Tue, 15 Jun 2021 10:36:02 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id A37FB402AE for ; Tue, 15 Jun 2021 10:36:02 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp2.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Joxia10JPAW5 for ; Tue, 15 Jun 2021 10:36:02 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by smtp2.osuosl.org (Postfix) with ESMTPS id DE53740025 for ; Tue, 15 Jun 2021 10:36:01 +0000 (UTC) Received: by mail-wr1-x429.google.com with SMTP id c9so17739581wrt.5 for ; Tue, 15 Jun 2021 03:36:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ukRJNNC5Rs9QXpZAJEPjFjYoxaRKUxp6tDpU9SdQsgA=; b=heBZXEyvfAIxrzGuUefYLBZuxhDTGTmpSBrAFxw2M49y5uy+K6AcL5sEsRAk6CykxT 6OcjaQqbiRkP+7iT6HihNSrSPQLzuhqkiTUXKswEZgHGXQMlb/M0iL4nZPMbZrGTPNin bVlUaNjorCy26VRyDCZ4Fitaxv48ndtTp5r0p5Hlx9aM53Js7Q67GQvvc0uCtN9yTv/O tM8A4l8mqiI914ZcM7TCimBqxqwz0K38/aZPz/SExhTnqJhyvFQ5BoI1v4PcgK4jehtI 7LBWVlsfrGUhq0wJXxby2acla+1EiO2+4eD6CIVk4NUviWNe9VEusNZWwnWblDcUgRBy P6AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ukRJNNC5Rs9QXpZAJEPjFjYoxaRKUxp6tDpU9SdQsgA=; b=t7NoPcvu2/b+bXIhAvDFjsY2zC3d4TatlZaKvGKkydknTLtPcaU6X2gky1CdfC6tvD EwsHsxg1xoGjdzh242DM541yTcAFs83p3gRFN+nyr1TkapucPo14iGBu3FCy3kWRE759 MpmtUQyi5oHK0vDMoLttu3I6TsHphuz9mvE62DHrLIhBrNPiS5MH1ZfBezPj19AFTRbE CDjhtIGah+q5a/+F+814W86aOSfIS8uz50NN3+ikTZLc6tsFRRm5I4rYV7MkRQIkMQoF kvG4Walz7T3Wly5jGSNZcaX/P9YzJPc5skcDbfCjLnCqXYhvaD8a5xjy810JvpeTVDNa ud6g== X-Gm-Message-State: AOAM532heIWmFAQE4/F8bJ/EEiFf5+rSducE5foycGYfvj/sl2k/1HMi k6KYvcF1sZE6B5uWHag/gfPnpb2VWgs= X-Google-Smtp-Source: ABdhPJy3qhKVACj9Uu8Vk1tl8ihKwDysifUCaJ14AS+K6H1HUJlN3+KetlBUGwcejy4rUYOgB+8Bmg== X-Received: by 2002:a5d:5983:: with SMTP id n3mr24321726wri.241.1623753360124; Tue, 15 Jun 2021 03:36:00 -0700 (PDT) Received: from debian-noppl.. (84-114-45-16.cable.dynamic.surfer.at. [84.114.45.16]) by smtp.gmail.com with ESMTPSA id q11sm18132945wrx.80.2021.06.15.03.35.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 03:35:59 -0700 (PDT) From: Norbert Lange To: buildroot@buildroot.org Date: Tue, 15 Jun 2021 12:35:46 +0200 Message-Id: <20210615103549.271478-1-nolange79@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Subject: [Buildroot] [PATCH v3 1/3] package/zstd: rework build and install X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: patrickdepinguin@gmail.com, Andrey Smirnov , Norbert Lange Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" 1.5.0 uses Threads by default for cli tool and DSO, the build now does the same unless: If only static libraries are build, then build that library like the DSO is normally built. This should ensure that programs requsting the DSO will always get the multithreaded version. Signed-off-by: Norbert Lange --- v2->v3: * use normal = for assignment v1->v2: * rebased against upstream/master Signed-off-by: Norbert Lange --- package/zstd/zstd.mk | 52 ++++++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/package/zstd/zstd.mk b/package/zstd/zstd.mk index 2a876376a2..95f25ebfa4 100644 --- a/package/zstd/zstd.mk +++ b/package/zstd/zstd.mk @@ -12,6 +12,8 @@ ZSTD_LICENSE_FILES = LICENSE COPYING ZSTD_CPE_ID_VENDOR = facebook ZSTD_CPE_ID_PRODUCT = zstandard +ZSTD_OPTS += PREFIX=/usr + ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y) ZSTD_OPTS += HAVE_THREAD=1 else @@ -39,43 +41,55 @@ else ZSTD_OPTS += HAVE_LZ4=0 endif -ifeq ($(BR2_STATIC_LIBS),y) -ZSTD_BUILD_LIBS = libzstd.a -ZSTD_INSTALL_LIBS = install-static -else ifeq ($(BR2_SHARED_LIBS),y) -ZSTD_BUILD_LIBS = libzstd -ZSTD_INSTALL_LIBS = install-shared +ZSTD_BUILD_PROG_TARGET = zstd-release + +# Since v1.5.0 the dynamic library is built for +# multithreading, while the static library is not. +# +# Keep those defaults, unless Buildroot is not +# providing the dynamic library and the +# static library will be automatically used instead. +ifeq ($(BR2_STATIC_LIBS)$(BR2_SHARED_STATIC_LIBS),y) +ZSTD_INSTALL_LIBS += install-static +ifeq ($(BR2_STATIC_LIBS)$(BR2_TOOLCHAIN_HAS_THREADS),yy) +# Use the static lib as replacement for the mt dynlib +ZSTD_BUILD_LIBS += libzstd.a-mt else -ZSTD_BUILD_LIBS = libzstd.a libzstd -ZSTD_INSTALL_LIBS = install-static install-shared +ZSTD_BUILD_LIBS += libzstd.a-nomt +endif endif -# The HAVE_THREAD flag is read by the 'programs' makefile but not by the 'lib' -# one. Building a multi-threaded binary with a library (which defaults to -# single-threaded) gives a runtime error when compressing files. -# The 'lib' makefile provides specific '%-mt' targets for this purpose. +ifeq ($(BR2_SHARED_LIBS)$(BR2_SHARED_STATIC_LIBS),y) +ZSTD_INSTALL_LIBS += install-shared ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y) -ZSTD_BUILD_LIBS := $(addsuffix -mt,$(ZSTD_BUILD_LIBS)) +ZSTD_BUILD_LIBS += libzstd-mt +else +ZSTD_BUILD_LIBS += libzstd-nomt +endif endif define ZSTD_BUILD_CMDS $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \ - -C $(@D)/lib $(ZSTD_BUILD_LIBS) + -C $(@D)/lib $(addsuffix -release,$(ZSTD_BUILD_LIBS) libzstd.pc) $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \ - -C $(@D) zstd + -C $(@D)/programs $(ZSTD_BUILD_PROG_TARGET) endef define ZSTD_INSTALL_STAGING_CMDS + [ -e $(@D)/programs/zstd ] && [ -e $(@D)/lib/libzstd.pc ] + $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \ + -C $(@D)/lib DESTDIR=$(STAGING_DIR) $(ZSTD_INSTALL_LIBS) \ + install-pc install-includes $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \ - DESTDIR=$(STAGING_DIR) PREFIX=/usr -C $(@D)/lib \ - install-pc install-includes $(ZSTD_INSTALL_LIBS) + -C $(@D)/programs DESTDIR=$(STAGING_DIR) install endef define ZSTD_INSTALL_TARGET_CMDS + [ -e $(@D)/programs/zstd ] $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \ - DESTDIR=$(TARGET_DIR) PREFIX=/usr -C $(@D)/programs install + -C $(@D)/lib DESTDIR=$(TARGET_DIR) $(ZSTD_INSTALL_LIBS) $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \ - DESTDIR=$(TARGET_DIR) PREFIX=/usr -C $(@D)/lib $(ZSTD_INSTALL_LIBS) + -C $(@D)/programs DESTDIR=$(TARGET_DIR) install endef HOST_ZSTD_OPTS += PREFIX=$(HOST_DIR)