Przeglądaj źródła

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.
Raphael Hertzog 18 lat temu
rodzic
commit
5885b55f5f
4 zmienionych plików z 32 dodań i 0 usunięć
  1. 7 0
      ChangeLog
  2. 3 0
      debian/changelog
  3. 11 0
      man/dpkg-buildpackage.1
  4. 11 0
      scripts/dpkg-buildpackage.pl

+ 7 - 0
ChangeLog

@@ -1,3 +1,10 @@
+2008-03-29  Raphael Hertzog  <hertzog@debian.org>
+
+	* 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  <hertzog@debian.org>
 
 	* scripts/dpkg-buildpackage.pl: LDFLAGS now defaults to an empty

+ 3 - 0
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

+ 11 - 0
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

+ 11 - 0
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'));