]> err.no Git - dpkg/commitdiff
dpkg-shlibdeps: add cross-compilation support
authorRaphael Hertzog <hertzog@debian.org>
Thu, 27 Mar 2008 21:46:34 +0000 (22:46 +0100)
committerRaphael Hertzog <hertzog@debian.org>
Thu, 27 Mar 2008 21:46:34 +0000 (22:46 +0100)
* scripts/Dpkg/Shlibs.pm: Support cross-compilation by adding
directories containing libraries for the architecture that is
being crossbuilt.

ChangeLog
debian/changelog
scripts/Dpkg/Shlibs.pm

index 692794fd4d571a1afc794efa60cc675e925ef118..407103819ba9db96c69e0b37c9a4c34085c0e23a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-03-27  Raphael Hertzog  <hertzog@debian.org>
+
+       * scripts/Dpkg/Shlibs.pm: Support cross-compilation by adding
+       directories containing libraries for the architecture that is
+       being crossbuilt.
+
 2008-03-27  Raphael Hertzog  <hertzog@debian.org>
             Frank Lichtenheld  <djpig@debian.org>
             Joey Hess  <joeyh@debian.org>
index f41ac700f87a308d398f0222b73f3dac6156b2cc..86708ebe1f12de22ce04c070ba8440eebf0fd945 100644 (file)
@@ -116,6 +116,9 @@ dpkg (1.14.17) UNRELEASED; urgency=low
       respectively.
   * dpkg-source has a new --no-check option. It disables GPG check and
     checksums checks. Closes: #220758
+  * dpkg-shlibdeps is now able to look into directories containing libraries
+    used by cross-built binaries provided that the right environment variable
+    are set. Closes: #453267
 
   [ Frank Lichtenheld ]
   * Add a warning in dpkg-buildpackage if the build-dependencies are not
index 633be70a815261d095f27049dafe00b0bc5da0b3..af26e48388c070b19290a8dffb747832378bea74 100644 (file)
@@ -28,11 +28,37 @@ use Dpkg::Gettext;
 use Dpkg::ErrorHandling qw(syserr);
 use Dpkg::Shlibs::Objdump;
 use Dpkg::Path qw(resolve_symlink canonpath);
+use Dpkg::Arch qw(debarch_to_gnutriplet get_build_arch get_host_arch);
 
 use constant DEFAULT_LIBRARY_PATH =>
     qw(/lib /usr/lib /lib32 /usr/lib32 /lib64 /usr/lib64
        /emul/ia32-linux/lib /emul/ia32-linux/usr/lib);
-our @librarypaths = (DEFAULT_LIBRARY_PATH);
+
+# Adjust set of directories to consider when we're in a situation of a
+# cross-build or a build of a cross-compiler
+my @crosslibrarypaths;
+my $crossprefix;
+# Detect cross compiler builds
+if ($ENV{GCC_TARGET}) {
+    $crossprefix = debarch_to_gnutriplet($ENV{GCC_TARGET});
+}
+if ($ENV{DEB_TARGET_GNU_TYPE} and
+    ($ENV{DEB_TARGET_GNU_TYPE} ne $ENV{DEB_BUILD_GNU_TYPE}))
+{
+    $crossprefix = $ENV{DEB_TARGET_GNU_TYPE};
+}
+# host for normal cross builds.
+if (get_build_arch() ne get_host_arch()) {
+    $crossprefix = debarch_to_gnutriplet(get_host_arch());
+}
+# Define list of directories containing crossbuilt libraries
+if ($crossprefix) {
+    push @crosslibrarypaths, "/$crossprefix/lib", "/usr/$crossprefix/lib",
+            "/$crossprefix/lib32", "/usr/$crossprefix/lib32",
+            "/$crossprefix/lib64", "/usr/$crossprefix/lib64";
+}
+
+our @librarypaths = (DEFAULT_LIBRARY_PATH, @crosslibrarypaths);
 
 # Update library paths with LD_LIBRARY_PATH
 if ($ENV{LD_LIBRARY_PATH}) {