Allow packages to find arch-independent data normally located in
/usr/share in the staging area using pkgconfig.

Change the default configure args to use ${prefix} and ${exec_prefix}
(with expansion deferred) rather than $(CONFIGURE_PREFIX). This allows
the pkg-config wrapper used in the host staging area
(tools/pkg-config/files/pkg-config) to fully override the location of
the package by setting only $prefix and $exec_prefix, as long as the
pkgconfig files define paths in terms of those variables.

Signed-off-by: Andy Leiserson <a...@leiserson.org>
---
The problem at issue appears when building rygel (to follow shortly)
without the build dependencies installed on the host.

--- a/include/package.mk
+++ b/include/package.mk
@@ -58,7 +58,7 @@
  CONFIG_SITE:=$(INCLUDE_DIR)/site/$(REAL_GNU_TARGET_NAME)
  CUR_MAKEFILE:=$(filter-out Makefile,$(firstword $(MAKEFILE_LIST)))
  SUBMAKE:=$(NO_TRACE_MAKE) $(if $(CUR_MAKEFILE),-f $(CUR_MAKEFILE))
-PKG_CONFIG_PATH=$(STAGING_DIR)/usr/lib/pkgconfig
+PKG_CONFIG_PATH=$(STAGING_DIR)/usr/lib/pkgconfig:$(STAGING_DIR)/usr/share/pkgconfig
  unexport QUIET
  
  ifeq ($(DUMP)$(filter prereq clean refresh update,$(MAKECMDGOALS)),)
--- a/include/package-defaults.mk
+++ b/include/package-defaults.mk
@@ -63,6 +63,9 @@
  
  EXTRA_CXXFLAGS = $(EXTRA_CFLAGS)
  
+# Two levels of escaping are required to preserve $prefix and $exec_prefix
+# through to autoconf because package Makefiles do $(eval $(call BuildPackage))
+
  CONFIGURE_PREFIX:=/usr
  CONFIGURE_ARGS = \
                --target=$(GNU_TARGET_NAME) \
@@ -72,14 +75,14 @@
                --program-suffix="" \
                --prefix=$(CONFIGURE_PREFIX) \
                --exec-prefix=$(CONFIGURE_PREFIX) \
-               --bindir=$(CONFIGURE_PREFIX)/bin \
-               --sbindir=$(CONFIGURE_PREFIX)/sbin \
-               --libexecdir=$(CONFIGURE_PREFIX)/lib \
+               --bindir='$$$${exec_prefix}/bin' \
+               --sbindir='$$$${exec_prefix}/sbin' \
+               --libexecdir='$$$${exec_prefix}/lib' \
                --sysconfdir=/etc \
-               --datadir=$(CONFIGURE_PREFIX)/share \
+               --datadir='$$$${prefix}/share' \
                --localstatedir=/var \
-               --mandir=$(CONFIGURE_PREFIX)/man \
-               --infodir=$(CONFIGURE_PREFIX)/info \
+               --mandir='$$$${prefix}/man' \
+               --infodir='$$$${prefix}/info' \
                $(DISABLE_NLS) \
                $(DISABLE_LARGEFILE) \
                $(DISABLE_IPV6)
--- a/include/host-build.mk
+++ b/include/host-build.mk
@@ -119,7 +119,7 @@
  define Host/Exports/Default
    $(1) : export ACLOCAL_INCLUDE=$$(foreach p,$$(wildcard 
$$(STAGING_DIR_HOST)/share/aclocal $$(STAGING_DIR_HOST)/share/aclocal-*),-I 
$$(p))
    $(1) : export STAGING_PREFIX=$$(STAGING_DIR_HOST)
-  $(1) : export PKG_CONFIG_PATH=$$(STAGING_DIR_HOST)/lib/pkgconfig
+  $(1) : export 
PKG_CONFIG_PATH=$$(STAGING_DIR_HOST)/lib/pkgconfig:$$(STAGING_DIR_HOST)/share/pkgconfig
    $(1) : export PKG_CONFIG_LIBDIR=$$(STAGING_DIR_HOST)/lib/pkgconfig
  endef
  Host/Exports=$(Host/Exports/Default)
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to