From patchwork Wed Jan 13 12:49:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rolf Eike Beer X-Patchwork-Id: 12016739 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC026C433E6 for ; Wed, 13 Jan 2021 12:50:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7F2F0233EA for ; Wed, 13 Jan 2021 12:50:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726781AbhAMMt4 convert rfc822-to-8bit (ORCPT ); Wed, 13 Jan 2021 07:49:56 -0500 Received: from mx1.emlix.com ([136.243.223.33]:34712 "EHLO mx1.emlix.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725809AbhAMMtz (ORCPT ); Wed, 13 Jan 2021 07:49:55 -0500 Received: from mailer.emlix.com (p5098be52.dip0.t-ipconnect.de [80.152.190.82]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.emlix.com (Postfix) with ESMTPS id 5386F5FA09; Wed, 13 Jan 2021 13:49:13 +0100 (CET) From: Rolf Eike Beer To: David Woodhouse Cc: Linux Kernel Developers List , David Howells , keyrings@vger.kernel.org, linux-kbuild@vger.kernel.org Subject: [PATCH v5] scripts: use pkg-config to locate libcrypto Date: Wed, 13 Jan 2021 13:49:12 +0100 Message-ID: <3394639.6NgGvCfkNl@devpool47> Organization: emlix GmbH In-Reply-To: <2278760.8Yd83Mgoko@devpool35> References: <20538915.Wj2CyUsUYa@devpool35> <2278760.8Yd83Mgoko@devpool35> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Otherwise build fails if the headers are not in the default location. While at it also ask pkg-config for the libs, with fallback to the existing value. Signed-off-by: Rolf Eike Beer Cc: stable@vger.kernel.org # 5.6.x Reviewed-by: Ben Boeckel Acked-by: Jarkko Sakkinen Acked-by: Jarkko Sakkinen --- scripts/Makefile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) This has been sent multiple times since more than 2 year, please pick it up through whatever tree. I need to patch every new stable kernel version to make them build in our chrooted environment. diff --git a/scripts/Makefile b/scripts/Makefile index b5418ec587fb..7553692d241f 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -3,6 +3,11 @@ # scripts contains sources for various helper programs used throughout # the kernel for the build process. +PKG_CONFIG ?= pkg-config + +CRYPTO_LIBS = $(shell $(PKG_CONFIG) --libs libcrypto 2> /dev/null || echo -lcrypto) +CRYPTO_CFLAGS = $(shell $(PKG_CONFIG) --cflags libcrypto 2> /dev/null) + hostprogs-always-$(CONFIG_BUILD_BIN2C) += bin2c hostprogs-always-$(CONFIG_KALLSYMS) += kallsyms hostprogs-always-$(BUILD_C_RECORDMCOUNT) += recordmcount @@ -14,8 +19,9 @@ hostprogs-always-$(CONFIG_SYSTEM_EXTRA_CERTIFICATE) += insert-sys-cert HOSTCFLAGS_sorttable.o = -I$(srctree)/tools/include HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include -HOSTLDLIBS_sign-file = -lcrypto -HOSTLDLIBS_extract-cert = -lcrypto +HOSTLDLIBS_sign-file = $(CRYPTO_LIBS) +HOSTCFLAGS_extract-cert.o = $(CRYPTO_CFLAGS) +HOSTLDLIBS_extract-cert = $(CRYPTO_LIBS) ifdef CONFIG_UNWINDER_ORC ifeq ($(ARCH),x86_64)