]> git.donarmstrong.com Git - debhelper.git/blob - dh_makeshlibs
r388: * Ok, I tihnk we have a db3 fix that will really work now.
[debhelper.git] / dh_makeshlibs
1 #!/usr/bin/perl -w
2 #
3 # Automatically generate shlibs files.
4
5 use Debian::Debhelper::Dh_Lib;
6 init();
7
8 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
9         $TMP=tmpdir($PACKAGE);
10
11         my %seen;
12
13         doit("rm", "-f", "$TMP/DEBIAN/shlibs");
14
15         open (FIND, "find $TMP -xtype f -name '*.so.*' |");
16         while (<FIND>) {
17                 chomp;
18                 # The second evil regexp is for db3, whose author should
19                 # be shot.
20                 if (m#.*/(.*)\.so\.(\d*)\.?# || m#.*/(.*)-(\S+)\.so$#) {
21                         $library = $1;
22                         $major = $2;
23                 }
24                 if (defined($dh{M_PARAMS}) && $dh{M_PARAMS} ne '') {
25                         $major=$dh{M_PARAMS};
26                 }
27                 if (! -d "$TMP/DEBIAN") {
28                         doit("install","-d","$TMP/DEBIAN");
29                 }
30                 $deps=$PACKAGE;
31                 if ($dh{V_FLAG_SET}) {
32                         if ($dh{V_FLAG} ne '') {
33                                 $deps=$dh{V_FLAG};
34                         }       
35                         else {
36                                 # Call isnative becuase it sets $dh{VERSION}
37                                 # as a side effect.
38                                 isnative($PACKAGE);
39                                 $deps="$PACKAGE (>= $dh{VERSION})";
40                         }
41                 }
42                 if (defined($library) && defined($major) && defined($deps) &&
43                     $library ne '' && $major ne '' && $deps ne '') {
44                         # Prevent duplicate lines from entering the file.
45                         my $line="$library $major $deps";
46                         if (! $seen{$line}) {
47                                 $seen{$line}=1;
48                                 complex_doit("echo '$line' >>$TMP/DEBIAN/shlibs");
49                         }
50                 }
51         }
52         close FIND;
53
54         if (-e "$TMP/DEBIAN/shlibs") {
55                 doit("chmod",644,"$TMP/DEBIAN/shlibs");
56                 doit("chown","0.0","$TMP/DEBIAN/shlibs");
57         }
58 }