From patchwork Thu Jan 10 19:52:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [v2] pkg-infra: add _CONFIG_FIXUP to fix *-config files From: =?utf-8?q?Stefan_Fr=C3=B6berg?= X-Patchwork-Id: 211141 Message-Id: <1357847559-31530-2-git-send-email-stefan.froberg@petroprogram.com> To: buildroot@busybox.net Cc: thomas.petazzoni@free-electrons.com Date: Thu, 10 Jan 2013 21:52:39 +0200 This patch will add _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 _INSTALL_STAGING = YES defined and also install some config file(s) into $(STAGING_DIR)/usr/bin must hereafter also define _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 Acked-by: Arnout Vandecappelle (Essensium/Mind) --- 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 $(Q)touch $@ # Install to images dir