version 1.10, 2008/09/16 23:15:03 |
version 1.12, 2008/09/16 23:38:04 |
|
|
#!/usr/bin/perl |
#!/usr/bin/perl |
# $RedRiver: find_depends,v 1.9 2008/05/05 19:02:57 andrew Exp $ |
# $RedRiver: find_depends,v 1.11 2008/09/16 22:28:53 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 $spec; |
next if ! $name; |
|
my $spec = 'l' . $name . '.' . $maj . '.' . $min; |
if ($_ eq $file) { |
print " Found spec '$spec'\n" if $opts{v}; |
# We don't want to include the file we are looking in |
|
next; |
|
} |
|
elsif ( my ($name, $maj, $min) = $_ =~ /lib([^\/]+)\.so\.(\d+)\.(\d+)$/ ) { |
|
$spec = 'l' . $name . '.' . $maj . '.' . $min; |
|
if ($ld->{$spec}) { |
|
$locs->{$spec} = $ld->{$spec}; |
|
} |
|
} |
|
elsif (-e $_) { |
|
$spec = $_; |
|
$locs->{$spec} = $spec; |
|
} |
|
else { |
|
next; |
|
} |
|
|
if (exists $ld->{$spec}) { |
if (! $locs->{$spec}) { |
next if exists $locs->{$spec}; |
print STDERR "Couldn't find location for '$_' (file '$file')\n"; |
|
next; |
|
} |
|
|
$locs->{$spec} = $ld->{$spec}; |
print " Found '$spec' => '$locs->{$spec}'\n" if $opts{v}; |
$locs = find_libs($ld->{$spec}, $ld, $locs); |
|
|
$locs = find_libs($locs->{$spec}, $ld, $locs); |
|
|
} else { |
|
warn "Couldn't find location for lib '$_' (file '$file')"; |
|
} |
|
} |
} |
|
|
return $locs; |
return $locs; |