From 5885b55f5f524db13d10ec8e20e9a4ea6192e902 Mon Sep 17 00:00:00 2001 From: Raphael Hertzog 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. --- ChangeLog | 7 +++++++ debian/changelog | 3 +++ man/dpkg-buildpackage.1 | 11 +++++++++++ scripts/dpkg-buildpackage.pl | 11 +++++++++++ 4 files changed, 32 insertions(+) diff --git a/ChangeLog b/ChangeLog index 23efe633..99c5124d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-03-29 Raphael Hertzog + + * 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. + 2008-03-28 Raphael Hertzog * scripts/dpkg-buildpackage.pl: LDFLAGS now defaults to an empty diff --git a/debian/changelog b/debian/changelog index 76c7d4fb..cc0bad44 100644 --- a/debian/changelog +++ b/debian/changelog @@ -122,6 +122,9 @@ dpkg (1.14.17) UNRELEASED; urgency=low * Change default value of LDFLAGS (set by dpkg-buildpackage) to '' instead of '-Wl,-Bsymbolic-functions'. It's safer at this point of the release cycle. + * dpkg-buildpackage will set PKG_CONFIG_LIBDIR (but not override an existing + value) in case of cross-compilation so that pkgconfig finds .pc files + in the directory specific to the target architecture. Closes: #439979 [ Frank Lichtenheld ] * Add a warning in dpkg-buildpackage if the build-dependencies are not diff --git a/man/dpkg-buildpackage.1 b/man/dpkg-buildpackage.1 index f831d9ff..422d7e98 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 d0141b46..1b331401 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')); -- 2.39.5