]> git.donarmstrong.com Git - debhelper.git/blobdiff - dh_makeshlibs
Fix build system auto-selection breakage.
[debhelper.git] / dh_makeshlibs
index 5a0327905ec2470fdb02746084bd0b3df304b338..03a54f95420d3d990f39ef14c962863730608f18 100755 (executable)
@@ -2,7 +2,7 @@
 
 =head1 NAME
 
-dh_makeshlibs - automatically create shlibs file
+dh_makeshlibs - automatically create shlibs file and call dpkg-gensymbols
 
 =cut
 
@@ -11,7 +11,7 @@ use Debian::Debhelper::Dh_Lib;
 
 =head1 SYNOPSIS
 
-B<dh_makeshlibs> [S<I<debhelper options>>] [B<-m>I<major>] [B<-V>I<[dependancies]>] [B<-n>] [B<-X>I<item>]
+B<dh_makeshlibs> [S<I<debhelper options>>] [B<-m>I<major>] [B<-V>I<[dependencies]>] [B<-n>] [B<-X>I<item>] [S<B<--> I<params>>]
 
 =head1 DESCRIPTION
 
@@ -19,7 +19,21 @@ dh_makeshlibs is a debhelper program that automatically scans for shared
 libraries, and generates a shlibs file for the libraries it finds.
 
 It also adds a call to ldconfig in the postinst and postrm scripts (in
-V3 mode and above only) to any packages which it finds shared libraries in.
+V3 mode and above only) to any packages in which it finds shared libraries.
+
+=head1 FILES
+
+=over 4
+
+=item debian/I<package>.symbols
+
+=item debian/I<package>.symbols.I<arch>
+
+These symbols files, if present, are passed to L<dpkg-gensymbols(1)> to
+be processed and installed. Use the I<arch> specific names if you need
+to provide different symbols files for different architectures.
+
+=back
 
 =head1 OPTIONS
 
@@ -32,19 +46,19 @@ 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.
 
-=item B<-V>, B<-V>I<dependancies>
+=item B<-V>, B<-V>I<dependencies>
 
-=item B<--version-info>, B<--version-info=>I<dependancies>
+=item B<--version-info>, B<--version-info=>I<dependencies>
 
 By default, the shlibs file generated by this program does not make packages
 depend on any particular version of the package containing the shared
 library. It may be necessary for you to add some version dependancy
-information to the shlibs file. If -V is specified with no dependancy
+information to the shlibs file. If -V is specified with no dependency
 information, the current upstream version of the package is plugged into a
-dependancy that looks like "packagename (>= packageversion)". Note that in
-debhelper compatability levels before v4, the debian part of the package
+dependency that looks like "packagename (>= packageversion)". Note that in
+debhelper compatibility levels before v4, the debian part of the package
 version number is also included. If -V is specified with parameters, the
-parameters can be used to specify the exact dependancy information needed
+parameters can be used to specify the exact dependency information needed
 (be sure to include the package name).
 
 Beware of using -V without any parameters; this is a conservative setting
@@ -64,6 +78,15 @@ Do not modify postinst/postrm scripts.
 Exclude files that contain "item" anywhere in their filename or directory 
 from being treated as shared libraries.
 
+=item B<--add-udeb=>I<udeb>
+
+Create an additional line for udebs in the shlibs file and use "udeb" as the
+package name for udebs to depend on instead of the regular library package.
+
+=item B<--> I<params>
+
+Pass "params" to L<dpkg-gensymbols(1)>.
+
 =back
 
 =head1 EXAMPLES
@@ -91,7 +114,12 @@ Generates a shlibs file that looks something like:
 
 =cut
 
-init();
+init(options => {
+       "m=s", => \$dh{M_PARAMS},
+       "major=s" => \$dh{M_PARAMS},
+       "version-info:s" => \$dh{V_FLAG},
+       "add-udeb=s" => \$dh{SHLIBS_UDEB},
+});
 
 foreach my $package (@{$dh{DOPACKAGES}}) {
        next if is_udeb($package);
@@ -111,6 +139,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
        # because only if we can get a library name and a major number from
        # objdump is anything actually added.
        my $exclude='';
+       my @udeb_lines;
        if (defined($dh{EXCLUDE_FIND}) && $dh{EXCLUDE_FIND} ne '') {
                $exclude="! \\( $dh{EXCLUDE_FIND} \\) ";
        }
@@ -146,7 +175,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
                                # as a side effect.
                                isnative($package);
                                my $version = $dh{VERSION};
-                               # Old compatability levels include the
+                               # Old compatibility levels include the
                                # debian revision, while new do not.
                                if (! compat(3)) {
                                        # Remove debian version, if any.
@@ -163,11 +192,22 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
                        if (! $seen{$line}) {
                                $seen{$line}=1;
                                complex_doit("echo '$line' >>$tmp/DEBIAN/shlibs");
+                               if (defined($dh{SHLIBS_UDEB}) && $dh{SHLIBS_UDEB} ne '') {
+                                       my $udeb_deps = $deps;
+                                       $udeb_deps =~ s/\Q$package\E/$dh{SHLIBS_UDEB}/e;
+                                       $line="udeb: "."$library $major $udeb_deps";
+                                       push @udeb_lines, $line;
+                               }
                        }
                }
        }
        close FIND;
 
+       # Write udeb: lines last.
+       foreach (@udeb_lines) {
+               complex_doit("echo '$_' >>$tmp/DEBIAN/shlibs");
+       }
+
        # New as of dh_v3.
        if (! compat(2) && ! $dh{NOSCRIPTS} && $need_ldconfig) {
                autoscript($package,"postinst","postinst-makeshlibs");
@@ -178,6 +218,20 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
                doit("chmod",644,"$tmp/DEBIAN/shlibs");
                doit("chown","0:0","$tmp/DEBIAN/shlibs");
        }
+
+       # dpkg-gensymbols files
+       my $symbols=pkgfile($package, "symbols");
+       if (-e $symbols) {
+               # -I is used rather than using dpkg-gensymbols
+               # own search for symbols files, since that search
+               # is not 100% compatible with debhelper. (For example,
+               # this supports --ignore being used.)
+               doit("dpkg-gensymbols", "-p$package", "-I$symbols",
+                       "-P$tmp", @{$dh{U_PARAMS}});
+               if (-s "$tmp/DEBIAN/symbols" == 0) {
+                       doit("rm", "-f", "$tmp/DEBIAN/symbols");
+               }
+       }
 }
 
 =head1 SEE ALSO