Gentoo Archives: gentoo-commits

From: Mike Frysinger <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/crossdev:master commit in: wrappers/
Date: Tue, 29 Jul 2014 06:07:07
Message-Id: 1406613038.a8d5eab601c99724dec4dae611d1cb316f92318d.vapier@gentoo
1 commit: a8d5eab601c99724dec4dae611d1cb316f92318d
2 Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jul 29 05:50:38 2014 +0000
4 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
5 CommitDate: Tue Jul 29 05:50:38 2014 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/crossdev.git;a=commit;h=a8d5eab6
7
8 cross-pkg-config: set up PKG_CONFIG_SYSTEM_LIBRARY_PATH
9
10 Rather than hardcode /usr/lib, set PKG_CONFIG_SYSTEM_LIBRARY_PATH to the
11 right libdir paths. This should handle lib vs lib64 vs lib correctly.
12
13 Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
14
15 ---
16 wrappers/cross-pkg-config | 24 +++++++++++++++++++++---
17 1 file changed, 21 insertions(+), 3 deletions(-)
18
19 diff --git a/wrappers/cross-pkg-config b/wrappers/cross-pkg-config
20 index 859ef05..f928bd0 100755
21 --- a/wrappers/cross-pkg-config
22 +++ b/wrappers/cross-pkg-config
23 @@ -42,6 +42,10 @@ if [ "$1" = "--cross-pkg-config-install" ] ; then
24 fi
25
26 unset EXTRA_PKG_CONFIG_LIBDIR
27 +if [ -z "${CHOST}" ] ; then
28 + CHOST=${0##*/}
29 + CHOST=${CHOST%-pkg-config}
30 +fi
31 if [ -z "${SYSROOT}" ] ; then
32 if [ "@CROSS_PKG_CONFIG_INSTALLED@" = "installed" ] ; then
33 # Manual install
34 @@ -55,8 +59,6 @@ if [ -z "${SYSROOT}" ] ; then
35 EXTRA_PKG_CONFIG_LIBDIR=${UCLINUX_PKG_CONFIG_LIBDIR}
36 else
37 # /usr/<target>
38 - CHOST=${0##*/}
39 - CHOST=${CHOST%-pkg-config}
40 SYSROOT="/usr/${CHOST}"
41 if [ -z "${CHOST}" ] || [ ! -d "${SYSROOT}" ] ; then
42 error "Need \$ROOT or \$STAGEDIR set first"
43 @@ -75,9 +77,25 @@ unset PKG_CONFIG_ALLOW_SYSTEM_CFLAGS
44 unset PKG_CONFIG_ALLOW_SYSTEM_LIBS
45
46 #
47 +# Try and figure out the appropriate libdir for this target.
48 +# This logic matches Gentoo's get_libdir which uses $ABI.
49 +#
50 +: ${ABI:=${DEFAULT_ABI:-default}}
51 +var="LIBDIR_${ABI}"
52 +libdir=${!var}
53 +if [ -z "${libdir}" ] ; then
54 + # Fall back to probing the compiler.
55 + libc=$(realpath $(${CC:-${CHOST}-gcc} ${CFLAGS} ${LDFLAGS} -print-file-name=libc.so))
56 + # Chopping the basename isn't exactly correct, but it's good enough for now.
57 + libdir=$(basename "${libc%/*}")
58 +fi
59 +: ${libdir:=lib}
60 +export PKG_CONFIG_SYSTEM_LIBRARY_PATH="/usr/${libdir}:/${libdir}"
61 +
62 +#
63 # Set the pkg-config search paths to our staging directory.
64 #
65 -export PKG_CONFIG_LIBDIR="${SYSROOT}/usr/lib/pkgconfig:${SYSROOT}/usr/share/pkgconfig"
66 +export PKG_CONFIG_LIBDIR="${SYSROOT}/usr/${libdir}/pkgconfig:${SYSROOT}/usr/share/pkgconfig"
67 if [ -n "${EXTRA_PKG_CONFIG_LIBDIR}" ] ; then
68 PKG_CONFIG_LIBDIR="${EXTRA_PKG_CONFIG_LIBDIR}:${PKG_CONFIG_LIBDIR}"
69 fi