From: Raphael Hertzog Date: Thu, 27 Mar 2008 21:46:34 +0000 (+0100) Subject: dpkg-shlibdeps: add cross-compilation support X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=626dda6f55bb7fb025be6a7c276651df884ac8a1;p=dpkg dpkg-shlibdeps: add cross-compilation support * scripts/Dpkg/Shlibs.pm: Support cross-compilation by adding directories containing libraries for the architecture that is being crossbuilt. --- diff --git a/ChangeLog b/ChangeLog index 692794fd..40710381 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-03-27 Raphael Hertzog + + * scripts/Dpkg/Shlibs.pm: Support cross-compilation by adding + directories containing libraries for the architecture that is + being crossbuilt. + 2008-03-27 Raphael Hertzog Frank Lichtenheld Joey Hess diff --git a/debian/changelog b/debian/changelog index f41ac700..86708ebe 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 diff --git a/scripts/Dpkg/Shlibs.pm b/scripts/Dpkg/Shlibs.pm index 633be70a..af26e483 100644 --- a/scripts/Dpkg/Shlibs.pm +++ b/scripts/Dpkg/Shlibs.pm @@ -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}) {