Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v7 07/18] package/pkgconf: make the pkg-config wrapper relocatable
Date: Thu, 10 Mar 2016 21:53:15 +0100	[thread overview]
Message-ID: <20160310215315.6555ac80@free-electrons.com> (raw)
In-Reply-To: <1457564339-27294-8-git-send-email-s.martin49@gmail.com>

Samuel,

On Wed,  9 Mar 2016 23:58:48 +0100, Samuel Martin wrote:

> diff --git a/package/pkgconf/pkg-config.in b/package/pkgconf/pkg-config.in
> old mode 100644
> new mode 100755
> index 4dec487..aa4e484
> --- a/package/pkgconf/pkg-config.in
> +++ b/package/pkgconf/pkg-config.in
> @@ -1,2 +1,4 @@
>  #!/bin/sh
> -PKG_CONFIG_LIBDIR=${PKG_CONFIG_LIBDIR:- at PKG_CONFIG_LIBDIR@} PKG_CONFIG_SYSROOT_DIR=${PKG_CONFIG_SYSROOT_DIR:- at STAGING_DIR@} $(dirname $0)/pkgconf @STATIC@ $@
> +STAGING_DIR="$(readlink -f "$(dirname "$0")/../..")/@STAGING_SUBDIR@"

I think Peter said on IRC that $0 is not guaranteed to be correct, and
that /proc/self/exe should be used instead.

> +TARGET_PKG_CONFIG_LIBDIR="$( echo @PKG_CONFIG_LIBDIR@ | sed -e "s@^@${STAGING_DIR}/@ ; s@:@:${STAGING_DIR}/@g" )"

I must say I hate those spaces after ( and before ). Especially when
the line just above doesn't have those spaces.

> +PKG_CONFIG_LIBDIR=${PKG_CONFIG_LIBDIR:-${TARGET_PKG_CONFIG_LIBDIR}} PKG_CONFIG_SYSROOT_DIR=${PKG_CONFIG_SYSROOT_DIR:-${STAGING_DIR}} $(dirname $0)/pkgconf @STATIC@ $@
> diff --git a/package/pkgconf/pkgconf.mk b/package/pkgconf/pkgconf.mk
> index c8b0cba..d27672c 100644
> --- a/package/pkgconf/pkgconf.mk
> +++ b/package/pkgconf/pkgconf.mk
> @@ -19,8 +19,12 @@ endef
>  define HOST_PKGCONF_INSTALL_WRAPPER
>  	$(INSTALL) -m 0755 -D package/pkgconf/pkg-config.in \
>  		$(HOST_DIR)/usr/bin/pkg-config
> -	$(SED) 's, at PKG_CONFIG_LIBDIR@,$(STAGING_DIR)/usr/lib/pkgconfig:$(STAGING_DIR)/usr/share/pkgconfig,' \
> -		-e 's, at STAGING_DIR@,$(STAGING_DIR),' \
> +	# @PKG_CONFIG_LIBDIR@ is a colon-separated list of paths to search.
> +	# These paths are relative to the root of the staging directory; they will
> +	# be automatically prefixed with the staging directory path by the wrapper
> +	# at runtime to ensure its relocatability.
> +	$(SED) 's, at PKG_CONFIG_LIBDIR@,/usr/lib/pkgconfig:/usr/share/pkgconfig,' \

I don't understand this first part of the expression. Why are you doing
a replacement if you're replacing by something that always has the same
value? Why don't you simply
hardcode /usr/lib/pkgconfig:/usr/share/pkgconfig in the wrapper?

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

  reply	other threads:[~2016-03-10 20:53 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-09 22:58 [Buildroot] [PATCH v7 00/18] Relocatable SDK / build machine leaks Samuel Martin
2016-03-09 22:58 ` [Buildroot] [PATCH v7 01/18] package/linux-headers: cleanup installation Samuel Martin
2016-03-09 23:09   ` Yann E. MORIN
2016-03-12  8:46     ` Samuel Martin
2016-03-22 22:10       ` Yann E. MORIN
2016-03-09 22:58 ` [Buildroot] [PATCH v7 02/18] core: use $(CURDIR) to set TOPDIR Samuel Martin
2016-03-09 23:10   ` Yann E. MORIN
2016-03-09 23:51   ` Arnout Vandecappelle
2016-03-10 20:45     ` Thomas Petazzoni
2016-03-10 22:50   ` Thomas Petazzoni
2016-03-09 22:58 ` [Buildroot] [PATCH v7 03/18] core: re-enter make if $(CURDIR) or $(O) are not absolute canonical path Samuel Martin
2016-03-09 23:15   ` Yann E. MORIN
2016-03-12  8:48     ` Samuel Martin
     [not found]   ` <CAFt09wNvtXGcfZ3PFZOgGu+bDvp6mEr44uwxa_ryjeP6DDQKBQ@mail.gmail.com>
2016-03-21  1:45     ` Matthew Weber
2016-03-21  5:21       ` Samuel Martin
2016-03-21 11:40         ` Matthew Weber
2016-03-22  3:03           ` Matthew Weber
2016-03-22  5:55             ` Samuel Martin
2016-03-22 11:10               ` Matthew Weber
2016-03-22 22:07       ` Yann E. MORIN
2016-03-22 23:11         ` Matthew Weber
2016-03-23  0:54           ` Matthew Weber
2016-03-23  1:36             ` Matthew Weber
2016-03-25  6:31               ` Samuel Martin
2016-03-26 12:21                 ` Arnout Vandecappelle
2016-03-23 17:41           ` Yann E. MORIN
2016-03-09 22:58 ` [Buildroot] [PATCH v7 04/18] core: staging symlink uses a relative path when possible Samuel Martin
2016-03-09 23:20   ` Yann E. MORIN
2016-03-10 20:47   ` Thomas Petazzoni
2016-03-12  9:11     ` Samuel Martin
2016-03-12 13:12       ` Thomas Petazzoni
2016-03-09 22:58 ` [Buildroot] [PATCH v7 05/18] core: make staging *-config scripts relocatable Samuel Martin
2016-03-09 23:24   ` Yann E. MORIN
2016-03-10  0:07     ` Arnout Vandecappelle
2016-03-12  9:22       ` Samuel Martin
2016-03-09 22:58 ` [Buildroot] [PATCH v7 06/18] core: make host " Samuel Martin
2016-03-10  0:12   ` Arnout Vandecappelle
2016-03-10 12:30     ` Samuel Martin
2016-03-10 20:50   ` Thomas Petazzoni
2016-03-09 22:58 ` [Buildroot] [PATCH v7 07/18] package/pkgconf: make the pkg-config wrapper relocatable Samuel Martin
2016-03-10 20:53   ` Thomas Petazzoni [this message]
2016-03-10 21:33     ` Peter Korsgaard
2016-03-09 22:58 ` [Buildroot] [PATCH v7 08/18] support/scripts: add fix-rpath script + a bunch of helpers Samuel Martin
2016-03-09 22:58 ` [Buildroot] [PATCH v7 09/18] core: add HOST_SANITIZE_RPATH_HOOK to TARGET_FINALIZE_HOOKS Samuel Martin
2016-03-09 22:58 ` [Buildroot] [PATCH v7 10/18] core: add {TARGET, STAGING}_SANITIZE_RPATH_HOOK " Samuel Martin
2016-03-09 22:58 ` [Buildroot] [PATCH v7 11/18] package/speex: remove no longer needed hook Samuel Martin
2016-03-09 22:58 ` [Buildroot] [PATCH v7 12/18] toolchain: add post-install hooks making the toolchain relocatable Samuel Martin
2016-03-09 22:58 ` [Buildroot] [PATCH v7 13/18] support/scripts: update check-host-rpath to use the shell helpers Samuel Martin
2016-03-09 22:58 ` [Buildroot] [PATCH v7 14/18] support/scripts/check-host-rpath: silent find command Samuel Martin
2016-03-10  0:15   ` Arnout Vandecappelle
2016-03-09 22:58 ` [Buildroot] [PATCH v7 15/18] support/scripts/check-host-rpath: also check HOST_DIR/{bin, sbin} Samuel Martin
2016-03-10  0:16   ` Arnout Vandecappelle
2016-03-09 22:58 ` [Buildroot] [PATCH v7 16/18] support/scripts: add check-host-leaks script + all needed helpers Samuel Martin
2016-03-27 22:38   ` Arnout Vandecappelle
2016-03-09 22:58 ` [Buildroot] [PATCH v7 17/18] core: add check-leaks-in-{target, host, staging} targets Samuel Martin
2016-03-09 22:58 ` [Buildroot] [PATCH v7 18/18] docs/manual: document how to debug shell script Samuel Martin
2016-03-10  0:21   ` Arnout Vandecappelle

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=20160310215315.6555ac80@free-electrons.com \
    --to=thomas.petazzoni@free-electrons.com \
    --cc=buildroot@busybox.net \
    /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