Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Arnout Vandecappelle <arnout@mind.be>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v2] pkg-infra: add <pkg>_CONFIG_FIXUP to fix *-config files
Date: Fri, 11 Jan 2013 22:33:41 +0100	[thread overview]
Message-ID: <50F08535.509@mind.be> (raw)
In-Reply-To: <1357847559-31530-2-git-send-email-stefan.froberg@petroprogram.com>

On 10/01/13 20:52, Stefan Fr?berg wrote:
> This patch will add<pkg>_CONFIG_FIXUP variable to buildroot infra.
> It's purpose is to inform buildroot that the package in question
> contains some $(STAGING_DIR)/usr/bin/*-config files and that we
> want to automatically fix prefixes of such files.
>
> It is often the case that many packages call these
> files during their configuration step to determine 3rd party
> library package locations and any flags needed to link against them.
>
> For example:
> Some package might try to check the existense and linking flags
> of NSPR package by calling $(STAGING_DIR)/usr/bin/nspr-config --prefix.
> Without this fix, NSPR would return /usr/ as it's prefix which is
> wrong when cross-compiling.
> Correct would be $(STAGING_DIR)/usr.
>
> All packages that have<pkg>_INSTALL_STAGING = YES defined and
> also install some config file(s) into $(STAGING_DIR)/usr/bin must
> hereafter also define<pkg>_CONFIG_FIXUP with the corresponding
> filename(s).
>
> For example:
>
> DIVINE_CONFIG_FIXUP = divine-config
>
> or for multiple files:
>
> IMAGEMAGICK_CONFIG_FIXUP = Magick-config Wand-config
>
> Signed-off-by: Stefan Fr?berg<stefan.froberg@petroprogram.com>
> ---
>   package/pkg-generic.mk |    6 ++++++
>   1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
> index a570ad7..9f6ea7b 100644
> --- a/package/pkg-generic.mk
> +++ b/package/pkg-generic.mk
> @@ -121,6 +121,12 @@ $(BUILD_DIR)/%/.stamp_staging_installed:
>   	@$(call MESSAGE,"Installing to staging directory")
>   	$($(PKG)_INSTALL_STAGING_CMDS)
>   	$(foreach hook,$($(PKG)_POST_INSTALL_STAGING_HOOKS),$(call $(hook))$(sep))
> +	$(Q)if test -n "$($(PKG)_CONFIG_FIXUP)" ; then \
> +		$(call MESSAGE,"Fixing package configuration files") ;\
> +		$(SED) "s,^prefix=.*,prefix=$(STAGING_DIR)/usr,g" \
> +			-e "s,^exec_prefix=.*,exec_prefix=$(STAGING_DIR)/usr,g" \
> +			$(addprefix $(STAGING_DIR)/usr/bin/,$($(PKG)_CONFIG_FIXUP)) ;\
> +	fi

  I just discovered that you can also write:

ifneq ($($(PKG)_CONFIG_FIXUP),)
	@$(call MESSAGE,"Fixing package configuration files")
	$(Q)$(SED) "s,^prefix=.*,prefix=$(STAGING_DIR)/usr,g" \
	  -e "s,^exec_prefix=.*,exec_prefix=$(STAGING_DIR)/usr,g" \
	  $(addprefix $(STAGING_DIR)/usr/bin/,$($(PKG)_CONFIG_FIXUP))
endif

  Yes, you can use make conditions in rule definitions!

  [How I love micro-optimizing Makefiles :-)]

  Regards,
  Arnout

>   	$(Q)touch $@
>
>   # Install to images dir


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

  parent reply	other threads:[~2013-01-11 21:33 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-10 19:52 [Buildroot] [PATCH v2] pkg-infra: add <pkg>_CONFIG_FIXUP to fix *-config files Stefan Fröberg
2013-01-10 19:52 ` Stefan Fröberg
2013-01-10 20:19   ` Thomas Petazzoni
2013-01-10 20:47     ` Yann E. MORIN
2013-01-10 21:15       ` Stefan Fröberg
2013-01-10 21:22         ` Yann E. MORIN
2013-01-10 21:01     ` Stefan Fröberg
2013-01-11 21:33   ` Arnout Vandecappelle [this message]
2013-01-12  1:38     ` Stefan Fröberg
2013-01-17  8:32       ` Arnout Vandecappelle
2013-01-18 12:58         ` Stefan Fröberg
2013-01-18 15:23           ` Thomas Petazzoni
2013-01-18 17:55             ` Stefan Fröberg
2013-01-18 15:51           ` Arnout Vandecappelle
2013-01-18 17:52             ` Stefan Fröberg
2013-01-20 11:36   ` Arnout Vandecappelle
2013-01-20 12:35     ` Samuel Martin
2013-01-20 14:37       ` Stefan Fröberg
2013-01-20 17:27         ` 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=50F08535.509@mind.be \
    --to=arnout@mind.be \
    --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