Bug#439979: extra setting for Architecture:all pkgconfig data

2008-03-28 Thread Raphael Hertzog
On Tue, 01 Jan 2008, Neil Williams wrote:
 The full setting for PKG_CONFIG_LIBDIR is:
 
 $ENV{PKG_CONFIG_LIBDIR}=/usr/$(DEB_HOST_GNU_TYPE)/lib/pkgconfig/:/usr/share/pkgconfig/;
 
 Adding /usr/share/ allows the few Architecture: all packages that
 contain pkgconfig data to be located during cross builds. (e.g.
 gnome-mime-data).

Please review the attached patch. I hope it does what you want.
If it works for you, then I'll integrate it for the next dpkg.

Having the opinion of Frank and Guillem would be nice too.

I believe it's worthwhile to try to get those changes for lenny. 

I have no definitive opinion on this particular patch, but it's important
to have a sane cross-compilation toolchain and if that helps Neil, then
I'm ok for it.

Cheers,
-- 
Raphaël Hertzog

Le best-seller français mis à jour pour Debian Etch :
http://www.ouaza.com/livre/admin-debian/
From 3479e24e7559b0f97ad7bf1076d83d9ef69f1ea4 Mon Sep 17 00:00:00 2001
From: Raphael Hertzog [EMAIL PROTECTED]
Date: Fri, 28 Mar 2008 14:29:36 +0100
Subject: [PATCH] Ease cross-compilation by giving a default value to PKG_CONFIG_LIBDIR

* scripts/dpkg-buildpackage.pl: If the user request a cross-compilation,
then define PKG_CONFIG_LIBDIR so that it will look in directories
specidic to the target architecture.
* man/dpkg-buildpackage.1: Document this change and also the -t option.
---
 man/dpkg-buildpackage.1  |   11 +++
 scripts/dpkg-buildpackage.pl |   11 +++
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/man/dpkg-buildpackage.1 b/man/dpkg-buildpackage.1
index f831d9f..422d7e9 100644
--- a/man/dpkg-buildpackage.1
+++ b/man/dpkg-buildpackage.1
@@ -46,6 +46,17 @@ Forces the exclusion of the original source and includes only the diff.
 Specify the Debian architecture we build for. The architecture of the
 machine we build on is determined automatically, and is also the default
 for the host machine.
+
+If the host architecture differs from the build architecture (as is the
+case for a cross-compilation), and if the environment variable
+\fBPKG_CONFIG_LIBDIR\fP is not set, then it is set to a value suitable for
+cross-compilation
+(/usr/\fIgnu-system-type\fP/lib/pkgconfig/:/usr/share/pkgconfig).
+.TP
+.BI \-t gnu-system-type
+Specify the GNU system type we build for. It can be used in place
+of \-a or as a complement to override the default GNU system type
+of the target Debian architecture.
 .TP
 .BI \-j jobs
 Number of jobs allowed to be run simultaneously, equivalent to the
diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl
index 6e1dc0e..0624a56 100755
--- a/scripts/dpkg-buildpackage.pl
+++ b/scripts/dpkg-buildpackage.pl
@@ -14,6 +14,7 @@ use Dpkg::BuildOptions;
 use Dpkg::Compression;
 use Dpkg::Version qw(check_version);
 use Dpkg::Changelog qw(parse_changelog);
+use Dpkg::Arch qw(get_build_arch debarch_to_gnutriplet);
 
 textdomain(dpkg-dev);
 
@@ -308,6 +309,16 @@ while ($_ = $arch_env) {
 }
 close $arch_env or subprocerr('dpkg-architecture');
 
+# In case of cross-compilation, give sensible default search path
+# for some widely used tools
+$targetgnusystem = debarch_to_gnutriplet($targetarch) if $targetarch;
+if ($targetgnusystem and
+($targetgnusystem ne debarch_to_gnutriplet(get_build_arch(
+{
+   $ENV{PKG_CONFIG_LIBDIR} ||= /usr/$targetgnusystem/lib/pkgconfig/: .
+   /usr/share/pkgconfig/;
+}
+
 my $arch;
 unless ($sourceonly) {
 $arch = mustsetvar($ENV{'DEB_HOST_ARCH'}, _g('host architecture'));
-- 
1.5.4.4



Bug#439979: extra setting for Architecture:all pkgconfig data

2008-03-28 Thread Neil Williams
On Fri, 2008-03-28 at 14:43 +0100, Raphael Hertzog wrote:
 On Tue, 01 Jan 2008, Neil Williams wrote:
  The full setting for PKG_CONFIG_LIBDIR is:
  
  $ENV{PKG_CONFIG_LIBDIR}=/usr/$(DEB_HOST_GNU_TYPE)/lib/pkgconfig/:/usr/share/pkgconfig/;
  
  Adding /usr/share/ allows the few Architecture: all packages that
  contain pkgconfig data to be located during cross builds. (e.g.
  gnome-mime-data).
 
 Please review the attached patch. I hope it does what you want.
 If it works for you, then I'll integrate it for the next dpkg.

It works perfectly, thanks Raphael.

I've been testing it on a variety of existing Emdebian packages and it
works exactly as requested.

 Having the opinion of Frank and Guillem would be nice too.
 
 I believe it's worthwhile to try to get those changes for lenny. 

Closing this and #453267 would provide sane cross-building support
native to dpkg in Lenny and that is fantastic news. It may not sound
like a big event to the rest of Debian, but IMHO this warrants being
listed as one of the major improvements between Etch and Lenny for
anyone interested in embedded development.

 I have no definitive opinion on this particular patch, but it's important
 to have a sane cross-compilation toolchain and if that helps Neil, then
 I'm ok for it.

I may be the one filing the bugs but there are lots of other people who
want to use Debian as their platform-of-choice when developing embedded
software.

Thanks for committing this improvement to dpkg!

-- 


Neil Williams
=
http://www.data-freedom.org/
http://www.nosoftwarepatents.com/
http://www.linux.codehelp.co.uk/




signature.asc
Description: This is a digitally signed message part


Bug#439979: extra setting for Architecture:all pkgconfig data

2008-01-01 Thread Neil Williams
The full setting for PKG_CONFIG_LIBDIR is:

$ENV{PKG_CONFIG_LIBDIR}=/usr/$(DEB_HOST_GNU_TYPE)/lib/pkgconfig/:/usr/share/pkgconfig/;

Adding /usr/share/ allows the few Architecture: all packages that
contain pkgconfig data to be located during cross builds. (e.g.
gnome-mime-data).

-- 

Neil Williams
=
http://www.data-freedom.org/
http://www.nosoftwarepatents.com/
http://www.linux.codehelp.co.uk/


pgpY6CEFJ1uNo.pgp
Description: PGP signature