[Buildroot] [PATCH 3/3] pkgconf: Configure using pkgconf-personality

Arnout Vandecappelle arnout at mind.be
Sat Oct 5 13:43:36 UTC 2019



On 03/10/2019 10:28, Thomas Preston wrote:
> On 02/10/2019 21:22, Yann E. MORIN wrote:
>> Thomas, All,
>>
>> On 2019-10-02 09:14 +0100, Thomas Preston spake thusly:
>>> On 01/10/2019 13:41, Thomas Preston wrote:
>>>> The correct way to configure pkgconf when cross-compiling is to use
>>>> pkgconf-personality, rather than using environment variables. The
>>>> personality is selected with a symbolic link mechanism, which we now use
>>>> in the pkg-config wrapper script.
>>>>
>>>> Signed-off-by: Thomas Preston <thomas.preston at codethink.co.uk>
>>>> ---
>>>>  package/pkgconf/pkg-config.in      | 11 +----------
>>>>  package/pkgconf/pkgconf.mk         | 12 +++++++++++-
>>>>  package/pkgconf/target.personality |  5 +++++
>>>>  3 files changed, 17 insertions(+), 11 deletions(-)
>>>>  create mode 100644 package/pkgconf/target.personality
>>>>
>>>> diff --git a/package/pkgconf/pkg-config.in b/package/pkgconf/pkg-config.in
>>>> index 894069c492..51db4d87e1 100644
>>>> --- a/package/pkgconf/pkg-config.in
>>>> +++ b/package/pkgconf/pkg-config.in
>>>> @@ -1,12 +1,3 @@
>>>>  #!/bin/sh
>>>>  PKGCONFDIR=$(dirname $0)
>>>> -DEFAULT_PKG_CONFIG_SYSTEM_LIBRARY_PATH=${PKGCONFDIR}/../@STAGING_SUBDIR@/usr/lib
>>>> -DEFAULT_PKG_CONFIG_SYSTEM_INCLUDE_PATH=${PKGCONFDIR}/../@STAGING_SUBDIR@/usr/include
>>>> -DEFAULT_PKG_CONFIG_LIBDIR=${PKGCONFDIR}/../@STAGING_SUBDIR@/usr/lib/pkgconfig:${PKGCONFDIR}/../@STAGING_SUBDIR@/usr/share/pkgconfig
>>>> -DEFAULT_PKG_CONFIG_SYSROOT_DIR=${PKGCONFDIR}/../@STAGING_SUBDIR@
>>>> -
>>>> -PKG_CONFIG_SYSTEM_LIBRARY_PATH=${PKG_CONFIG_SYSTEM_LIBRARY_PATH:-${DEFAULT_PKG_CONFIG_SYSTEM_LIBRARY_PATH}} \
>>>> -	PKG_CONFIG_SYSTEM_INCLUDE_PATH=${PKG_CONFIG_SYSTEM_INCLUDE_PATH:-${DEFAULT_PKG_CONFIG_SYSTEM_INCLUDE_PATH}} \
>>>> -	PKG_CONFIG_LIBDIR=${PKG_CONFIG_LIBDIR:-${DEFAULT_PKG_CONFIG_LIBDIR}} \
>>>> -	PKG_CONFIG_SYSROOT_DIR=${PKG_CONFIG_SYSROOT_DIR:-${DEFAULT_PKG_CONFIG_SYSROOT_DIR}} \
>>>> -	exec ${PKGCONFDIR}/pkgconf @STATIC@ "$@"
>>>> +exec ${PKGCONFDIR}/@GNU_TARGET_NAME at -pkg-config @STATIC@ "$@"
>>>
>>> In fact, according to @kaniini (pkgconf maintainer), we can do away with this
>>> wrapper script entirely and let the default symlink `pkg-config -> pkgconf`
>>> load the default.personality. Which can be configured for the buildroot target.
>>
>> We've already tried to look into the personality feature in the past,
>> and we concluded back then that we could not easily use it. I don't
>> remember everything about the reasons, but at least one issue is that
>> packages do not expect the TUPPLE-pkg-config mechanism, and most do just
>> call 'pkg-config', so we'd still need to keep our pkg-config wrapper
>> anyway. As such, using the personality was not so much interesting...
>>
> 
> You can set a default.personality, which is used for the base pkg-config
> link, so you could have:
> 
> 	     pkg-config: default.personality
> 	host-pkg-config: host.personality

 I think the personality approach is better than the wrapper script for sure.
However, it's not always easy to override a package's idea of how to call
pkg-config (e.g. quite a few use `pkg-config ...` in the Makefile directly - in
fact, we do the same, in support/kconfig!). Therefore, I think a better approach
is to have a separate "host" and "cross" bin directory, both of which contain a
pkg-config (symlink or wrapper script). For cross-compilation, both directories
are put in PATH, and for host compilation on the host directory.

 The cross dir can then also be populated with the -config script from
STAGING_DIR, which avoids having to pass them explicitly in other packages.

> However, you cannot set --static in the pkgconf-personality file (yet...),
> which rules out using them for now.

 I'm sure that that can be patched...

 Regards,
 Arnout



More information about the buildroot mailing list