]> git.donarmstrong.com Git - debhelper.git/blob - dh_shlibdeps
r415: * dh_shlibdeps -l can handle relative paths now. Patch from Colin Watson
[debhelper.git] / dh_shlibdeps
1 #!/usr/bin/perl -w
2 #
3 # Find dependancies. Simple dpkg-shlibdeps wrapper.
4
5 use Cwd;
6 use Debian::Debhelper::Dh_Lib;
7 init();
8
9 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
10         $TMP=tmpdir($PACKAGE);
11         $EXT=pkgext($PACKAGE);
12
13         my @filelist;
14         my $ff;
15
16         # Generate a list of ELF binaries in the package, ignoring any
17         # we were told to exclude.
18         if (! defined($dh{EXCLUDE_FIND}) || $dh{EXCLUDE_FIND} eq '') {
19                 $find_options="";
20         }
21         else {
22                 $find_options="! \\( $dh{EXCLUDE_FIND} \\)";
23         }
24         foreach $file (split(/\n/,`find $TMP -type f \\( -perm +111 -or -name "*.so*" \\) $find_options`)) {
25                 # TODO: this is slow, optimize. Ie, file can run once on multiple files..
26                 $ff=`file "$file"`;
27                 if ($ff=~m/ELF/ && $ff!~/statically linked/) {
28                         push @filelist,$file;
29                 }
30         }
31
32         if (@filelist) {
33                 if ($dh{L_PARAMS}) {
34                         # Force the path absolute.
35                         unless ($dh{L_PARAMS}=~m:^/:) {
36                                 $dh{L_PARAMS}=getcwd()."/$dh{L_PARAMS}";
37                         }
38                         $ENV{'LD_LIBRARY_PATH'}=$dh{L_PARAMS};
39                         verbose_print("LD_LIBRARY_PATH=$dh{L_PARAMS} \\");
40                 }
41                 doit("dpkg-shlibdeps","-Tdebian/${EXT}substvars",@{$dh{U_PARAMS}},'-dDepends',@filelist);
42         }
43 }