multilib: always use pkg-config in sane-config (#707910)

This commit is contained in:
Nils Philippsen 2011-09-16 14:42:00 +02:00
parent a1208f5b4e
commit 2d822e91b0
2 changed files with 65 additions and 80 deletions

View File

@ -1,67 +1,62 @@
From 867c994d6cb1b750cdaa7589de8d60f24e0738d0 Mon Sep 17 00:00:00 2001
From 62b327a3a6a289ef3b89d6cfe239a9008a0303c3 Mon Sep 17 00:00:00 2001
From: Nils Philippsen <nils@redhat.com>
Date: Tue, 15 Mar 2011 14:42:07 +0100
Date: Fri, 16 Sep 2011 12:23:57 +0200
Subject: [PATCH] patch: pkgconfig
Squashed commit of the following:
commit 7101c2b317274a25bb7d0cc459047b16318cb110
commit 8232a5fdf931da4b1adfade313c17c9cd118790d
Author: Nils Philippsen <nils@redhat.com>
Date: Tue Mar 15 14:41:37 2011 +0100
Date: Fri Sep 16 12:18:06 2011 +0200
use pkg-config in sane-config, make it multilib-aware
use pkg-config in sane-config
As we require pkg-config anyway, simply let sane-config use it to make
it compatible with multilib systems. Previously, sane-config contained
paths which were different on e.g. x86_64 and i386 which made the 64 and
32 bit versions conflict if installed in parallel.
---
tools/sane-config.in | 69 +++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 54 insertions(+), 15 deletions(-)
tools/sane-config.in | 49 +++++++------------------------------------------
1 files changed, 7 insertions(+), 42 deletions(-)
diff --git a/tools/sane-config.in b/tools/sane-config.in
index 22c02b5..efa9169 100644
index 22c02b5..1fae2e5 100644
--- a/tools/sane-config.in
+++ b/tools/sane-config.in
@@ -19,7 +19,7 @@ pkglibdir="@pkglibdir@"
includedir="@includedir@"
mandir="@mandir@"
infodir="@infodir@"
-libdir="@libdir@"
+#libdir=
localstatedir="@localstatedir@"
sysconfdir="@sysconfdir@"
datarootdir="@datarootdir@"
@@ -33,6 +33,33 @@ srcdir="@srcdir@"
top_srcdir="@top_srcdir@"
cflags=
@@ -7,31 +7,10 @@
PACKAGE="@PACKAGE@"
scriptname="sane-config"
-LINKER_RPATH="@LINKER_RPATH@"
-
prefix="@prefix@"
exec_prefix="@exec_prefix@"
-LDFLAGS="@LDFLAGS@ @GPHOTO2_LDFLAGS@"
-LIBS="@LIBS@ @DL_LIBS@ @LIBV4L_LIBS@ @MATH_LIB@ @TIFF_LIBS@ @JPEG_LIBS@ @GPHOTO2_LIBS@ @SOCKET_LIBS@ @AVAHI_LIBS@ @USB_LIBS@ @SCSI_LIBS@ @RESMGR_LIBS@"
-pkgincludedir="@pkgincludedir@"
-pkglibdir="@pkglibdir@"
-includedir="@includedir@"
-mandir="@mandir@"
-infodir="@infodir@"
-libdir="@libdir@"
-localstatedir="@localstatedir@"
-sysconfdir="@sysconfdir@"
-datarootdir="@datarootdir@"
-datadir="@datadir@"
-libexecdir="@libexecdir@"
-sbindir="@sbindir@"
-bindir="@bindir@"
-#${prefix}
-#exec_prefix_set=no
-srcdir="@srcdir@"
-top_srcdir="@top_srcdir@"
-cflags=
+pkgconfig_package=sane-backends
+use_pkgconfig=0
+if test -x "@bindir@/pkg-config" && "@bindir@/pkg-config" --exists "$pkgconfig_package"; then
+ use_pkgconfig=1
+else
+ libdir=
+ if kernel="`uname -s 2>/dev/null`"; then
+ case "$kernel" in
+ Linux)
+ if hw="`uname -i 2>/dev/null`"; then
+ case "$hw" in
+ ia64)
+ # Linux/ia64 uses /usr/lib
+ ;;
+ *64|s390x)
+ libdir="@exec_prefix@/lib64"
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ fi
+ if test "x$libdir" = "x"; then
+ libdir="@exec_prefix@/lib"
+ fi
+fi
+
usage ()
{
echo "Usage: " 1>&2
@@ -60,7 +87,7 @@ if test $# -gt 0; then
@@ -60,7 +39,7 @@ if test $# -gt 0; then
if test $# -eq 1; then
usage
elif test $# -eq 2; then
@ -70,30 +65,21 @@ index 22c02b5..efa9169 100644
--cflags)
echo "Usage: $0 --cflags"
echo " Print C compiler flags for compiling code that uses SANE."
@@ -86,26 +113,38 @@ if test $# -gt 0; then
@@ -85,33 +64,19 @@ if test $# -gt 0; then
exit 1
;;
--ldflags)
-
- if test -z "$LINKER_RPATH"; then
- echo "-L${libdir} @LDFLAGS@"
+ if test "x$use_pkgconfig" = "x0"; then
+ if test -z "$LINKER_RPATH"; then
+ echo "-L${libdir} @LDFLAGS@"
+ else
+ echo "-L${libdir} @LDFLAGS@ ${LINKER_RPATH}${libdir}"
+ fi
else
- else
- echo "-L${libdir} @LDFLAGS@ ${LINKER_RPATH}${libdir}"
+ pkg-config --libs-only-L "$pkgconfig_package"
fi
- fi
+ pkg-config --libs-only-L "$pkgconfig_package"
;;
--libs)
- echo "-lsane ${LIBS}"
+ if test "x$use_pkgconfig" = "x0"; then
+ echo "-lsane ${LIBS}"
+ else
+ pkg-config --libs "$pkgconfig_package"
+ fi
+ pkg-config --libs "$pkgconfig_package"
;;
--cflags)
- unique_cflags=
@ -103,25 +89,21 @@ index 22c02b5..efa9169 100644
- for i in $cflags; do
- if test "${i}" != "-I${includedir}"; then
- unique_cflags="${unique_cflags} $i"
+ if test "x$use_pkgconfig" = "x0"; then
+ unique_cflags=
+ if test "${includedir}" != "/usr/include"; then
+ unique_cflags="${unique_cflags} -I${includedir}"
fi
- fi
- done
- echo ${unique_cflags}
+ for i in $cflags; do
+ if test "${i}" != "-I${includedir}"; then
+ unique_cflags="${unique_cflags} $i"
+ fi
+ done
+ echo ${unique_cflags}
+ else
+ pkg-config --cflags "$pkgconfig_package"
+ fi
+ pkg-config --cflags "$pkgconfig_package"
;;
--prefix)
echo ${prefix}
- echo ${prefix}
+ echo "${prefix}"
;;
--exec-prefix)
- echo ${exec_prefix}
+ echo "${exec_prefix}"
;;
*)
usage
--
1.7.4
1.7.6.1

View File

@ -187,6 +187,9 @@ rm -rf %{buildroot}
%{_libdir}/sane/*gphoto2.so.*
%changelog
* Fri Sep 16 2011 Nils Philippsen <nils@redhat.com> - 1.0.22-4
- multilib: always use pkg-config in sane-config (#707910)
* Thu Sep 15 2011 Nils Philippsen <nils@redhat.com> - 1.0.22-4
- allow installing the libraries without the drivers (#736310): split off
drivers into -drivers-scanners, rename -libs-gphoto2 to -drivers-cameras