5 dh_shlibdeps - calculate shared library dependencies
11 use Debian::Debhelper::Dh_Lib;
15 B<dh_shlibdeps> [S<I<debhelper options>>] [B<-L>I<package>] [B<-l>I<directory>] [B<-X>I<item>] [S<B<--> I<params>>]
19 dh_shlibdeps is a debhelper program that is responsible for calculating
20 shared library dependencies for packages.
22 This program is merely a wrapper around L<dpkg-shlibdeps(1)> that calls it
23 once for each package listed in the control file, passing it
24 a list of ELF executables and shared libraries it has found.
30 =item B<-u>I<params>, B<--dpkg-shlibdeps-params=>I<params>
34 Pass "params" to L<dpkg-shlibdeps(1)>.
36 =item B<-X>I<item>, B<--exclude=>I<item>
38 Exclude files that contain "item" anywhere in their filename from being
39 passed to dpkg-shlibdeps. This will make their dependencies be ignored.
40 This may be useful in some situations, but use it with caution. This option
41 may be used more than once to exclude more than one thing.
43 =item B<-l>I<directory>[:directory:directory:..]
45 With recent versions of dpkg-shlibdeps, this option is generally not
48 Before dpkg-shlibdeps is run, LD_LIBRARY_PATH will have added to it the
49 specified directory (or directories -- separate with colons). With recent
50 versions of dpkg-shlibdeps, this is mostly only useful for packages that
51 build multiple flavors of the same library, or other situations where
52 the library is installed into a directory not on the regular library search
55 =item B<-L>I<package>, B<--libpackage=>I<package>
57 With recent versions of dpkg-shlibdeps, this option is generally not
60 Tell dpkg-shlibdeps to use the shlibs file automatically generated by
61 dh_makeshlibs for the named package instead of the shlibs.local file.
67 Suppose that your source package produces libfoo1, libfoo-dev, and
68 libfoo-bin binary packages. libfoo-bin links against libfoo1, and should
69 depend on it. In your rules file, first run dh_makeshlibs, then dh_shlibdeps:
74 This will have the effect of generating automatically a shlibs file for
75 libfoo1, and using that file and the libfoo1 library in the
76 debian/libfoo1/usr/lib directory to calculate shared library dependency
85 # Add to existing paths, if set.
86 push @paths, $ENV{'LD_LIBRARY_PATH'}
87 if exists $ENV{'LD_LIBRARY_PATH'};
88 foreach (split(/:/, $dh{L_PARAMS})) {
89 # Force the path absolute.
97 $dh{L_PARAMS}=join(':', @paths);
100 foreach my $package (@{$dh{DOPACKAGES}}) {
101 my $tmp=tmpdir($package);
102 my $ext=pkgext($package);
107 # Generate a list of ELF binaries in the package, ignoring any
108 # we were told to exclude.
110 if (defined($dh{EXCLUDE_FIND}) && $dh{EXCLUDE_FIND} ne '') {
111 $find_options="! \\( $dh{EXCLUDE_FIND} \\)";
113 foreach my $file (split(/\n/,`find $tmp -path $tmp/usr/lib/debug -prune -or -type f \\( -perm +111 -or -name "*.so*" \\) $find_options -print`)) {
114 # TODO this is slow, optimize. Ie, file can run once on
117 if ($ff=~m/ELF/ && $ff!~/statically linked/) {
118 push @filelist,$file;
124 if (defined $dh{LIBPACKAGE} && length $dh{LIBPACKAGE}) {
125 @opts=("-L".tmpdir($dh{LIBPACKAGE}."/DEBIAN/shlibs"));
128 push @opts, "-tudeb" if is_udeb($package);
130 my $ld_library_path_orig=$ENV{LD_LIBRARY_PATH};
132 $ENV{LD_LIBRARY_PATH}=$dh{L_PARAMS};
133 verbose_print("LD_LIBRARY_PATH=$dh{L_PARAMS}");
136 doit("dpkg-shlibdeps","-Tdebian/${ext}substvars",
137 @opts,@{$dh{U_PARAMS}},@filelist);
140 if (defined $ld_library_path_orig) {
141 $ENV{LD_LIBRARY_PATH}=$ld_library_path_orig;
144 delete $ENV{LD_LIBRARY_PATH};
152 L<debhelper(7)>, L<dpkg-shlibdeps(1)>
154 This program is a part of debhelper.
158 Joey Hess <joeyh@debian.org>