From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-733026-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	by finch.gentoo.org (Postfix) with ESMTP id 0FCFC13838B
	for <garchives@archives.gentoo.org>; Wed, 17 Sep 2014 21:41:40 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 1ED10E0ADA;
	Wed, 17 Sep 2014 21:41:39 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 35AB2E0ABF
	for <gentoo-commits@lists.gentoo.org>; Wed, 17 Sep 2014 21:41:38 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 4C6733402A6
	for <gentoo-commits@lists.gentoo.org>; Wed, 17 Sep 2014 21:41:37 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 01F305D5B
	for <gentoo-commits@lists.gentoo.org>; Wed, 17 Sep 2014 21:41:36 +0000 (UTC)
From: "Mike Frysinger" <vapier@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" <vapier@gentoo.org>
Message-ID: <1406613038.a8d5eab601c99724dec4dae611d1cb316f92318d.vapier@gentoo>
Subject: [gentoo-commits] proj/crossdev:master commit in: wrappers/
X-VCS-Repository: proj/crossdev
X-VCS-Files: wrappers/cross-pkg-config
X-VCS-Directories: wrappers/
X-VCS-Committer: vapier
X-VCS-Committer-Name: Mike Frysinger
X-VCS-Revision: a8d5eab601c99724dec4dae611d1cb316f92318d
X-VCS-Branch: master
Date: Wed, 17 Sep 2014 21:41:36 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: 5fb3806c-d9a2-478c-a85d-d31ec92a7044
X-Archives-Hash: 458b8cf4d7ff7e367b3bfdc4b726a814

commit:     a8d5eab601c99724dec4dae611d1cb316f92318d
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 29 05:50:38 2014 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Tue Jul 29 05:50:38 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/crossdev.git;a=commit;h=a8d5eab6

cross-pkg-config: set up PKG_CONFIG_SYSTEM_LIBRARY_PATH

Rather than hardcode /usr/lib, set PKG_CONFIG_SYSTEM_LIBRARY_PATH to the
right libdir paths.  This should handle lib vs lib64 vs lib correctly.

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 wrappers/cross-pkg-config | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/wrappers/cross-pkg-config b/wrappers/cross-pkg-config
index 859ef05..f928bd0 100755
--- a/wrappers/cross-pkg-config
+++ b/wrappers/cross-pkg-config
@@ -42,6 +42,10 @@ if [ "$1" = "--cross-pkg-config-install" ] ; then
 fi
 
 unset EXTRA_PKG_CONFIG_LIBDIR
+if [ -z "${CHOST}" ] ; then
+	CHOST=${0##*/}
+	CHOST=${CHOST%-pkg-config}
+fi
 if [ -z "${SYSROOT}" ] ; then
 	if [ "@CROSS_PKG_CONFIG_INSTALLED@" = "installed" ] ; then
 		# Manual install
@@ -55,8 +59,6 @@ if [ -z "${SYSROOT}" ] ; then
 		EXTRA_PKG_CONFIG_LIBDIR=${UCLINUX_PKG_CONFIG_LIBDIR}
 	else
 		# /usr/<target>
-		CHOST=${0##*/}
-		CHOST=${CHOST%-pkg-config}
 		SYSROOT="/usr/${CHOST}"
 		if [ -z "${CHOST}" ] || [ ! -d "${SYSROOT}" ] ; then
 			error "Need \$ROOT or \$STAGEDIR set first"
@@ -75,9 +77,25 @@ unset PKG_CONFIG_ALLOW_SYSTEM_CFLAGS
 unset PKG_CONFIG_ALLOW_SYSTEM_LIBS
 
 #
+# Try and figure out the appropriate libdir for this target.
+# This logic matches Gentoo's get_libdir which uses $ABI.
+#
+: ${ABI:=${DEFAULT_ABI:-default}}
+var="LIBDIR_${ABI}"
+libdir=${!var}
+if [ -z "${libdir}" ] ; then
+	# Fall back to probing the compiler.
+	libc=$(realpath $(${CC:-${CHOST}-gcc} ${CFLAGS} ${LDFLAGS} -print-file-name=libc.so))
+	# Chopping the basename isn't exactly correct, but it's good enough for now.
+	libdir=$(basename "${libc%/*}")
+fi
+: ${libdir:=lib}
+export PKG_CONFIG_SYSTEM_LIBRARY_PATH="/usr/${libdir}:/${libdir}"
+
+#
 # Set the pkg-config search paths to our staging directory.
 #
-export PKG_CONFIG_LIBDIR="${SYSROOT}/usr/lib/pkgconfig:${SYSROOT}/usr/share/pkgconfig"
+export PKG_CONFIG_LIBDIR="${SYSROOT}/usr/${libdir}/pkgconfig:${SYSROOT}/usr/share/pkgconfig"
 if [ -n "${EXTRA_PKG_CONFIG_LIBDIR}" ] ; then
 	PKG_CONFIG_LIBDIR="${EXTRA_PKG_CONFIG_LIBDIR}:${PKG_CONFIG_LIBDIR}"
 fi


From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-716162-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	by finch.gentoo.org (Postfix) with ESMTP id CE3901391DB
	for <garchives@archives.gentoo.org>; Tue, 29 Jul 2014 06:07:07 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 899A8E0CEC;
	Tue, 29 Jul 2014 06:07:06 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 022E7E0CEC
	for <gentoo-commits@lists.gentoo.org>; Tue, 29 Jul 2014 06:07:05 +0000 (UTC)
Received: from spoonbill.gentoo.org (spoonbill.gentoo.org [81.93.255.5])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 04BB1340141
	for <gentoo-commits@lists.gentoo.org>; Tue, 29 Jul 2014 06:07:05 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by spoonbill.gentoo.org (Postfix) with ESMTP id 3F91818BF4
	for <gentoo-commits@lists.gentoo.org>; Tue, 29 Jul 2014 06:07:03 +0000 (UTC)
From: "Mike Frysinger" <vapier@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" <vapier@gentoo.org>
Message-ID: <1406613038.a8d5eab601c99724dec4dae611d1cb316f92318d.vapier@gentoo>
Subject: [gentoo-commits] proj/crossdev:master commit in: wrappers/
X-VCS-Repository: proj/crossdev
X-VCS-Files: wrappers/cross-pkg-config
X-VCS-Directories: wrappers/
X-VCS-Committer: vapier
X-VCS-Committer-Name: Mike Frysinger
X-VCS-Revision: a8d5eab601c99724dec4dae611d1cb316f92318d
X-VCS-Branch: master
Date: Tue, 29 Jul 2014 06:07:03 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: 88d49839-04df-48e5-8bcc-68d7345ced53
X-Archives-Hash: 5b0fb799cb014b53b25eab9309cb76c0
Message-ID: <20140729060703.SmFb7p1VkXdJKllh3_z7u2gfLnN_gCCT6zih8Jc7igU@z>

commit:     a8d5eab601c99724dec4dae611d1cb316f92318d
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 29 05:50:38 2014 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Tue Jul 29 05:50:38 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/crossdev.git;a=commit;h=a8d5eab6

cross-pkg-config: set up PKG_CONFIG_SYSTEM_LIBRARY_PATH

Rather than hardcode /usr/lib, set PKG_CONFIG_SYSTEM_LIBRARY_PATH to the
right libdir paths.  This should handle lib vs lib64 vs lib correctly.

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 wrappers/cross-pkg-config | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/wrappers/cross-pkg-config b/wrappers/cross-pkg-config
index 859ef05..f928bd0 100755
--- a/wrappers/cross-pkg-config
+++ b/wrappers/cross-pkg-config
@@ -42,6 +42,10 @@ if [ "$1" = "--cross-pkg-config-install" ] ; then
 fi
 
 unset EXTRA_PKG_CONFIG_LIBDIR
+if [ -z "${CHOST}" ] ; then
+	CHOST=${0##*/}
+	CHOST=${CHOST%-pkg-config}
+fi
 if [ -z "${SYSROOT}" ] ; then
 	if [ "@CROSS_PKG_CONFIG_INSTALLED@" = "installed" ] ; then
 		# Manual install
@@ -55,8 +59,6 @@ if [ -z "${SYSROOT}" ] ; then
 		EXTRA_PKG_CONFIG_LIBDIR=${UCLINUX_PKG_CONFIG_LIBDIR}
 	else
 		# /usr/<target>
-		CHOST=${0##*/}
-		CHOST=${CHOST%-pkg-config}
 		SYSROOT="/usr/${CHOST}"
 		if [ -z "${CHOST}" ] || [ ! -d "${SYSROOT}" ] ; then
 			error "Need \$ROOT or \$STAGEDIR set first"
@@ -75,9 +77,25 @@ unset PKG_CONFIG_ALLOW_SYSTEM_CFLAGS
 unset PKG_CONFIG_ALLOW_SYSTEM_LIBS
 
 #
+# Try and figure out the appropriate libdir for this target.
+# This logic matches Gentoo's get_libdir which uses $ABI.
+#
+: ${ABI:=${DEFAULT_ABI:-default}}
+var="LIBDIR_${ABI}"
+libdir=${!var}
+if [ -z "${libdir}" ] ; then
+	# Fall back to probing the compiler.
+	libc=$(realpath $(${CC:-${CHOST}-gcc} ${CFLAGS} ${LDFLAGS} -print-file-name=libc.so))
+	# Chopping the basename isn't exactly correct, but it's good enough for now.
+	libdir=$(basename "${libc%/*}")
+fi
+: ${libdir:=lib}
+export PKG_CONFIG_SYSTEM_LIBRARY_PATH="/usr/${libdir}:/${libdir}"
+
+#
 # Set the pkg-config search paths to our staging directory.
 #
-export PKG_CONFIG_LIBDIR="${SYSROOT}/usr/lib/pkgconfig:${SYSROOT}/usr/share/pkgconfig"
+export PKG_CONFIG_LIBDIR="${SYSROOT}/usr/${libdir}/pkgconfig:${SYSROOT}/usr/share/pkgconfig"
 if [ -n "${EXTRA_PKG_CONFIG_LIBDIR}" ] ; then
 	PKG_CONFIG_LIBDIR="${EXTRA_PKG_CONFIG_LIBDIR}:${PKG_CONFIG_LIBDIR}"
 fi