[Patch] use Requires.private do avoid unnecessary linkage

NIIBE Yutaka gniibe at fsij.org
Mon Sep 2 05:03:03 CEST 2019

Andreas Metzler <ametzler at bebt.de> wrote:
> find attached a one-line patch to avoid unnecessary linkage when using
> pkg-config. For dynamic linking it is not necessary to link libgpg-error
> when linking against libgcrypt (unless functions from libgpg-error are
> used directly, obviously).
> With this patch this works.
> (sid)ametzler at argenau:$ pkg-config --libs libgcrypt
> -lgcrypt
> (sid)ametzler at argenau:$ pkg-config --libs --static libgcrypt
> -lgcrypt -lgpg-error


It's better to support Requires.private field.  I will.

Let me explain the reason why it is so, currently.

Libraries for GnuPG (libgpg-error, libassuan, libgcrypt, npth, libksba,
ntbtls) had their own *-config program, and GnuPG used to use each
*-config program for its build.  (Note that, before pkg-config was
introduced, having each *-config program was common practice.)

Now, we support *.pc files as well.  This is both for (1) developers who
use pkg-config and for (2) build of GnuPG.  We are going to deprecate
*-config program except gpgrt-config.

For build of GnuPG, we don't use pkg-config to minimize dependency.  We
keep using a single program, gpgrt-config, which handles *.pc files.
(We moved from using multiple *-config programs to a single program

At the first phase (currently), we make our *.pc files to have exact
same behavior of old *-config program.

More information about the Gcrypt-devel mailing list