version 1.7, 2008/04/22 21:08:41 |
version 1.10, 2008/09/16 23:15:03 |
|
|
#!/usr/bin/perl |
#!/usr/bin/perl |
# $RedRiver: find_depends,v 1.6 2007/05/16 19:55:42 andrew Exp $ |
# $RedRiver: find_depends,v 1.9 2008/05/05 19:02:57 andrew Exp $ |
use strict; |
use strict; |
use warnings; |
use warnings; |
|
|
|
|
my @libs = search_file($file); |
my @libs = search_file($file); |
foreach (@libs) { |
foreach (@libs) { |
my ($name, $maj, $min) = $_ =~ /lib([^\/]+)\.so\.(\d+)\.(\d+)$/; |
my ($name, $maj, $min) = $_ =~ /lib([^\/]+)\.so\.(\d+)\.(\d+)$/; |
|
next if ! $name; |
my $spec = 'l' . $name . '.' . $maj . '.' . $min; |
my $spec = 'l' . $name . '.' . $maj . '.' . $min; |
|
print " Found spec '$spec'\n" if $opts{v}; |
|
|
if (exists $ld->{$spec}) { |
if (exists $ld->{$spec}) { |
next if exists $locs->{$spec}; |
next if exists $locs->{$spec}; |
|
|
$locs->{$spec} = $ld->{$spec}; |
$locs->{$spec} = $ld->{$spec}; |
|
$locs = find_libs($ld->{$spec}, $ld, $locs); |
$locs = find_libs($locs->{$spec}, $ld, $locs); |
|
|
|
} else { |
} else { |
warn "Couldn't find location for lib '$_' (file '$file')"; |
warn "Couldn't find location for lib '$_' (file '$file')"; |
|
|
open my $libs, '-|', '/usr/bin/ldd', $file or die "Couldn't open ldd '$file': $!"; |
open my $libs, '-|', '/usr/bin/ldd', $file or die "Couldn't open ldd '$file': $!"; |
while (<$libs>) { |
while (<$libs>) { |
chomp; |
chomp; |
my $spec = substr $_, 56; |
my ($spec) = (split(/\s+/, $_))[7]; |
|
next if ! $spec; |
next if $spec !~ m{^/}xms; |
next if $spec !~ m{^/}xms; |
push @libs, $spec; |
push @libs, $spec; |
} |
} |