#
# Automatically generate shlibs files.
-BEGIN { push @INC, "debian", "/usr/share/debhelper" }
-use Dh_Lib;
+use Debian::Debhelper::Dh_Lib;
init();
foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
$TMP=tmpdir($PACKAGE);
+ my %seen;
+ my $need_ldconfig = 0;
+
doit("rm", "-f", "$TMP/DEBIAN/shlibs");
- open (FIND, "find $TMP -type f -name '*.so.*' |");
+ open (FIND, "find $TMP -xtype f -name '*.so*' |");
while (<FIND>) {
chomp;
- ($library, $major)=m#.*/(.*)\.so\.(\d*)\.?#;
+ $need_ldconfig=1;
+ # The second evil regexp is for db3, whose author should
+ # be shot.
+ if (m#.*/([^/]*)\.so\.(\d*)\.?# || m#.*/([^/]*)-([^\s/]+)\.so$#) {
+ $library = $1;
+ $major = $2;
+ }
if (defined($dh{M_PARAMS}) && $dh{M_PARAMS} ne '') {
$major=$dh{M_PARAMS};
}
$deps="$PACKAGE (>= $dh{VERSION})";
}
}
- if (defined($library) && defined($major) && defined($deps) &&
+ if (defined($library) && defined($major) && defined($deps) &&
$library ne '' && $major ne '' && $deps ne '') {
- complex_doit("echo '$library $major $deps' >>$TMP/DEBIAN/shlibs");
+ # Prevent duplicate lines from entering the file.
+ my $line="$library $major $deps";
+ if (! $seen{$line}) {
+ $seen{$line}=1;
+ complex_doit("echo '$line' >>$TMP/DEBIAN/shlibs");
+ }
}
}
close FIND;
+ # New as of dh_v3.
+ if (! Debian::Debhelper::Dh_Lib::compat(2) &&
+ ! $dh{NOSCRIPTS} && $need_ldconfig) {
+ autoscript($PACKAGE,"postinst","postinst-makeshlibs");
+ autoscript($PACKAGE,"postrm","postrm-makeshlibs");
+ }
+
if (-e "$TMP/DEBIAN/shlibs") {
doit("chmod",644,"$TMP/DEBIAN/shlibs");
- doit("chown","root.root","$TMP/DEBIAN/shlibs");
+ doit("chown","0.0","$TMP/DEBIAN/shlibs");
}
}