filter pkgconfig output to force it do use our staging_dir and not
authorEric Andersen <andersen@codepoet.org>
Sun, 14 Jan 2007 03:48:13 +0000 (03:48 -0000)
committerEric Andersen <andersen@codepoet.org>
Sun, 14 Jan 2007 03:48:13 +0000 (03:48 -0000)
try to use the system libraries as it is inclined to do

package/Makefile.in
package/pkgconfig/pkgconfig-filter.sh [new file with mode: 0755]
package/pkgconfig/pkgconfig.mk

index 1e10e4c1b5de5239aa7882424cb499a4a9abce6d..aca3e4b07aa4365140ae575c1a857fe76873a183 100644 (file)
@@ -88,7 +88,11 @@ TARGET_CONFIGURE_OPTS=PATH=$(TARGET_PATH) \
                CPP=$(TARGET_CROSS)cpp \
                RANLIB=$(TARGET_CROSS)ranlib \
                STRIP=$(TARGET_CROSS)strip \
-               OBJCOPY=$(TARGET_CROSS)objcopy
+               OBJCOPY=$(TARGET_CROSS)objcopy \
+               CC_FOR_BUILD="$(HOSTCC)" \
+               PKG_CONFIG_SYSROOT=$(STAGING_DIR) \
+               PKG_CONFIG=$(STAGING_DIR)/usr/bin/pkg-config
+
 
 ifeq ($(BR2_ENABLE_LOCALE),y)
 DISABLE_NLS:=
diff --git a/package/pkgconfig/pkgconfig-filter.sh b/package/pkgconfig/pkgconfig-filter.sh
new file mode 100755 (executable)
index 0000000..8769bfd
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/bash
+# filter the output from pkg-config (renamed as pkg-config.real)
+# and ensures PKG_CONFIG_SYSROOT is prepended to all paths
+
+CMD=$0
+
+if [ ! "$PKG_CONFIG_SYSROOT" ]; then
+       echo "pkg-config-filter: missing \$PKG_CONFIG_SYSROOT environment variable"
+       exit 2
+fi
+
+export PKG_CONFIG_LIBDIR
+export PKG_CONFIG_PATH
+
+if $CMD.real $* |
+       sed -e "s~\-L/*$PKG_CONFIG_SYSROOT/*~-L=/~g; s~\-I/*$PKG_CONFIG_SYSROOT/*~-I=/~g;" |
+       sed -e "s~\-L/~-L=/~g; s~\-I/~-I=/~g;" |
+       sed -e "s~\-L\=~-L$PKG_CONFIG_SYSROOT~g; s~\-I\=~-I$PKG_CONFIG_SYSROOT~g;"
+then
+       echo "PKG_CONFIG_LIBDIR=$PKG_CONFIG_LIBDIR" >&2
+       echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >&2
+       echo "OKAY" >&2;
+       exit 0;
+else
+       echo "pkg-config failed!" >&2
+       exit 1
+fi
index 682241a7ed6ff540bc854f91aaf8003eac3b0025..c86f78e54b8f6a14b38348129b657fcc8364db02 100644 (file)
@@ -28,6 +28,7 @@ $(PKGCONFIG_DIR)/.configured: $(PKGCONFIG_DIR)/.unpacked
                --exec-prefix=/usr \
                --bindir=/usr/bin \
                --sbindir=/usr/sbin \
+               --libdir=/lib \
                --libexecdir=/usr/lib \
                --sysconfdir=/etc \
                --datadir=/usr/share \
@@ -45,6 +46,9 @@ $(PKGCONFIG_DIR)/$(PKGCONFIG_BINARY): $(PKGCONFIG_DIR)/.configured
 
 $(STAGING_DIR)/$(PKGCONFIG_TARGET_BINARY): $(PKGCONFIG_DIR)/$(PKGCONFIG_BINARY)
        $(MAKE) DESTDIR=$(STAGING_DIR) -C $(PKGCONFIG_DIR) install
+       mv $(STAGING_DIR)/usr/bin/pkg-config $(STAGING_DIR)/usr/bin/pkg-config.real
+       cp package/pkgconfig/pkgconfig-filter.sh $(STAGING_DIR)/usr/bin/pkg-config
+       mkdir -p $(STAGING_DIR)/lib/pkgconfig
        rm -rf $(STAGING_DIR)/share/locale $(STAGING_DIR)/usr/info \
                $(STAGING_DIR)/usr/man $(STAGING_DIR)/usr/share/doc