]> git.donarmstrong.com Git - debhelper.git/blobdiff - dh_makeshlibs
Add support for multiarch.
[debhelper.git] / dh_makeshlibs
index 29d3f4d3e53481ae5c16cdecdbfc8113c1525227..5d6f869cb1442cd901a496743c1863a3929d51f7 100755 (executable)
@@ -41,7 +41,7 @@ to provide different symbols files for different architectures.
 
 =item B<-m>I<major>, B<--major=>I<major>
 
-Instead of trying to guess the major number of the library with /postobjdump,
+Instead of trying to guess the major number of the library with objdump,
 use the major number specified after the -m parameter. This is much less
 useful than it used to be, back in the bad old days when this program
 looked at library filenames rather than using objdump.
@@ -121,12 +121,8 @@ init(options => {
        "add-udeb=s" => \$dh{SHLIBS_UDEB},
 });
 
-my $od = "objdump";
-# cross-compiling?
-if (dpkg_architecture_value("DEB_BUILD_GNU_TYPE")
-    ne dpkg_architecture_value("DEB_HOST_GNU_TYPE")) {
-       $od=dpkg_architecture_value("DEB_HOST_GNU_TYPE") . "-objdump";
-}
+my $objdump=cross_command("objdump");
+my $multiarch=dpkg_architecture_value("DEB_HOST_MULTIARCH");
 
 foreach my $package (@{$dh{DOPACKAGES}}) {
        next if is_udeb($package);
@@ -135,6 +131,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 
        my %seen;
        my $need_ldconfig = 0;
+       my $is_multiarch = 0;
 
        doit("rm", "-f", "$tmp/DEBIAN/shlibs");
 
@@ -153,13 +150,16 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
        while (<FIND>) {
                my ($library, $major);
                push @lib_files, $_;
-               my $objdump=`$od -p $_`;
-               if ($objdump=~m/\s+SONAME\s+(.+)\.so\.(.+)/) {
+               if ($multiarch ne '' && $_ =~ m,/$multiarch/,) {
+                       $is_multiarch=1;
+               }
+               my $ret=`$objdump -p $_`;
+               if ($ret=~m/\s+SONAME\s+(.+)\.so\.(.+)/) {
                        # proper soname format
                        $library=$1;
                        $major=$2;
                }
-               elsif ($objdump=~m/\s+SONAME\s+(.+)-(.+)\.so/) {
+               elsif ($ret=~m/\s+SONAME\s+(.+)-(.+)\.so/) {
                        # idiotic crap soname format
                        $library=$1;
                        $major=$2;
@@ -245,6 +245,9 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
                        doit("rm", "-f", "$tmp/DEBIAN/symbols");
                }
        }
+       if ($is_multiarch) {
+               addsubstvar($package, "misc:Pre-Depends", "multiarch-support");
+       }
 }
 
 =head1 SEE ALSO