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)
73 There is no guarantee that the program will get the shlibs file right. For
74 example, it may not correctly guess the major number of your package. In
75 cases like these (and perhaps in general, just to be safe), it is better to
76 create a debian/shlibs file by hand, or force it to use the correct major
77 number by specifying the -m parameter.
83 foreach my $package (@{$dh{DOPACKAGES}}) {
84 my $tmp=tmpdir($package);
87 my $need_ldconfig = 0;
89 doit("rm", "-f", "$tmp/DEBIAN/shlibs");
91 open (FIND, "find $tmp -xtype f -name '*.so*' |");
98 # The second evil regexp is for db3, whose author should
100 if (m#.*/([^/]*)\.so\.(\d*)\.?# || m#.*/([^/]*)-([^\s/]+)\.so$#) {
104 if (defined($dh{M_PARAMS}) && $dh{M_PARAMS} ne '') {
105 $major=$dh{M_PARAMS};
107 if (! -d "$tmp/DEBIAN") {
108 doit("install","-d","$tmp/DEBIAN");
111 if ($dh{V_FLAG_SET}) {
112 if ($dh{V_FLAG} ne '') {
116 # Call isnative becuase it sets $dh{VERSION}
119 $deps="$package (>= $dh{VERSION})";
122 if (defined($library) && defined($major) && defined($deps) &&
123 $library ne '' && $major ne '' && $deps ne '') {
124 # Prevent duplicate lines from entering the file.
125 my $line="$library $major $deps";
126 if (! $seen{$line}) {
128 complex_doit("echo '$line' >>$tmp/DEBIAN/shlibs");
135 if (! compat(2) && ! $dh{NOSCRIPTS} && $need_ldconfig) {
136 autoscript($package,"postinst","postinst-makeshlibs");
137 autoscript($package,"postrm","postrm-makeshlibs");
140 if (-e "$tmp/DEBIAN/shlibs") {
141 doit("chmod",644,"$tmp/DEBIAN/shlibs");
142 doit("chown","0.0","$tmp/DEBIAN/shlibs");
150 This program is a part of debhelper.
154 Joey Hess <joeyh@debian.org>