public inbox for linux-fscrypt@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: luca.boccassi@gmail.com
Cc: linux-fscrypt@vger.kernel.org
Subject: Re: [fsverity-utils PATCH 1/2] Use pkg-config to get libcrypto build flags
Date: Fri, 23 Oct 2020 21:07:26 -0700	[thread overview]
Message-ID: <20201024040726.GB83494@sol.localdomain> (raw)
In-Reply-To: <20201022175934.2999543-1-luca.boccassi@gmail.com>

On Thu, Oct 22, 2020 at 06:59:33PM +0100, luca.boccassi@gmail.com wrote:
> From: Luca Boccassi <luca.boccassi@microsoft.com>
> 
> Especially when cross-compiling or other such cases, it might be necessary
> to pass additional compiler flags. This is commonly done via pkg-config,
> so use it if available, and fall back to the hardcoded -lcrypto if not.
> 
> Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
> ---
>  Makefile | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/Makefile b/Makefile
> index 3fc1bec..122c0a2 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -58,6 +58,7 @@ BINDIR          ?= $(PREFIX)/bin
>  INCDIR          ?= $(PREFIX)/include
>  LIBDIR          ?= $(PREFIX)/lib
>  DESTDIR         ?=
> +PKGCONF         ?= pkg-config
>  
>  # Rebuild if a user-specified setting that affects the build changed.
>  .build-config: FORCE
> @@ -69,7 +70,8 @@ DESTDIR         ?=
>  
>  DEFAULT_TARGETS :=
>  COMMON_HEADERS  := $(wildcard common/*.h)
> -LDLIBS          := -lcrypto
> +LDLIBS          := $(shell $(PKGCONF) libcrypto --libs 2>/dev/null || echo -lcrypto)
> +CFLAGS          += $(shell $(PKGCONF) libcrypto --cflags 2>/dev/null || echo)

There should be a way to prevent pkg-config from being used if someone wants to
link to a local copy of libcrypto.  One might expect setting PKGCONF to an empty
string to work, and it kind of does, but then the shell command executes
"libcrypto", which is strange.  How about quoting "$(PKGCONF)" so that the shell
command is guaranteed to fail as expected in that case?

- Eric

  parent reply	other threads:[~2020-10-24  4:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-22 17:59 [fsverity-utils PATCH 1/2] Use pkg-config to get libcrypto build flags luca.boccassi
2020-10-22 17:59 ` [fsverity-utils PATCH 2/2] Generate and install libfsverity.pc luca.boccassi
2020-10-24  3:56   ` Eric Biggers
2020-10-26 11:16     ` Luca Boccassi
2020-10-24  4:07 ` Eric Biggers [this message]
2020-10-26 11:16   ` [fsverity-utils PATCH 1/2] Use pkg-config to get libcrypto build flags Luca Boccassi
2020-10-26 11:15 ` [fsverity-utils PATCH v2 " luca.boccassi
2020-10-26 11:15   ` [fsverity-utils PATCH v2 2/2] Generate and install libfsverity.pc luca.boccassi
2020-10-26 17:32     ` Eric Biggers
2020-10-26 17:32   ` [fsverity-utils PATCH v2 1/2] Use pkg-config to get libcrypto build flags Eric Biggers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201024040726.GB83494@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=linux-fscrypt@vger.kernel.org \
    --cc=luca.boccassi@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox