5 dh_makeshlibs - automatically create shlibs file
10 use Debian::Debhelper::Dh_Lib;
14 dh_makeshlibs [debhelper options] [-mmajor] [-V[dependancies]] [-n]
18 dh_makeshlibs is a debhelper program that automatically scans for shared
19 libraries, and generates a shlibs file for the libraries it finds.
21 It also adds a call to ldconfig in the postinst and postrm scripts (in
22 DH_COMPAT=3 mode and above only).
28 =item B<-m>I<major>, B<--major=>I<major>
30 Instead of trying to guess the major number of the library from the
31 filename of the library, use the major number specified after the -m parameter.
33 =item B<-V>, B<-V>I<dependancies>
35 =item B<--version-info>, B<--version-info=>I<dependancies>
37 By default, the shlibs file generated by this program does not make packages
38 depend on any particular version of the package containing the shared
39 library. It may be necessary for you to add some version dependancy
40 information to the shlibs file. If -V is specified with no dependancy
41 information, the current version of the package is plugged into a
42 dependancy that looks like "packagename (>= packageversion)". If -V is specified with
43 parameters, the parameters can be used to specify the exact dependancy
44 information needed (be sure to include the package name).
46 =item B<-n>, B<--noscripts>
48 Do not modify postinst/postrm scripts.
56 Assuming this is a package named libfoobar1, generates a shlibs file that
58 libfoobar 1 libfoobar1
62 Assuming the current version of the package is 1.0-3, generates a shlibs
63 file that looks something like:
64 libfoobar 1 libfoobar1 (>= 1.0-3)
66 dh_makeshlibs -V 'libfoobar1 (>= 1.0)'
68 Generates a shlibs file that looks something like:
69 libfoobar 1 libfoobar1 (>= 1.0)
75 There is no guarantee that the program will get the shlibs file right. For
76 example, it may not correctly guess the major number of your package. In
77 cases like these (and perhaps in general, just to be safe), it is better to
78 create a debian/shlibs file by hand, or force it to use the correct major
79 number by specifying the -m parameter.
85 foreach my $package (@{$dh{DOPACKAGES}}) {
86 my $tmp=tmpdir($package);
89 my $need_ldconfig = 0;
91 doit("rm", "-f", "$tmp/DEBIAN/shlibs");
93 open (FIND, "find $tmp -xtype f -name '*.so*' |");
100 # The second evil regexp is for db3, whose author should
102 if (m#.*/([^/]*)\.so\.(\d*)\.?# || m#.*/([^/]*)-([^\s/]+)\.so$#) {
106 if (defined($dh{M_PARAMS}) && $dh{M_PARAMS} ne '') {
107 $major=$dh{M_PARAMS};
109 if (! -d "$tmp/DEBIAN") {
110 doit("install","-d","$tmp/DEBIAN");
113 if ($dh{V_FLAG_SET}) {
114 if ($dh{V_FLAG} ne '') {
118 # Call isnative becuase it sets $dh{VERSION}
121 $deps="$package (>= $dh{VERSION})";
124 if (defined($library) && defined($major) && defined($deps) &&
125 $library ne '' && $major ne '' && $deps ne '') {
126 # Prevent duplicate lines from entering the file.
127 my $line="$library $major $deps";
128 if (! $seen{$line}) {
130 complex_doit("echo '$line' >>$tmp/DEBIAN/shlibs");
137 if (! compat(2) && ! $dh{NOSCRIPTS} && $need_ldconfig) {
138 autoscript($package,"postinst","postinst-makeshlibs");
139 autoscript($package,"postrm","postrm-makeshlibs");
142 if (-e "$tmp/DEBIAN/shlibs") {
143 doit("chmod",644,"$tmp/DEBIAN/shlibs");
144 doit("chown","0.0","$tmp/DEBIAN/shlibs");
152 This program is a part of debhelper.
156 Joey Hess <joeyh@debian.org>