version 1.10, 2008/09/16 23:15:03 |
version 1.11, 2008/09/16 23:28:53 |
|
|
#!/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.10 2008/09/16 22:15:03 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 (/\/ld\.so$/) { |
|
$spec = $_; |
|
} |
|
else { |
|
if ( my ($name, $maj, $min) = $_ =~ /lib([^\/]+)\.so\.(\d+)\.(\d+)$/ ) { |
|
$spec = 'l' . $name . '.' . $maj . '.' . $min; |
|
} |
|
} |
|
|
|
next if ! $spec; |
|
next if exists $locs->{$spec}; |
|
|
print " Found spec '$spec'\n" if $opts{v}; |
print " Found spec '$spec'\n" if $opts{v}; |
|
|
if (exists $ld->{$spec}) { |
if (-e $spec) { |
next if exists $locs->{$spec}; |
$locs->{$spec} = $spec; |
|
} |
|
else { |
|
$locs->{$spec} = $ld->{$spec}; |
|
} |
|
|
$locs->{$spec} = $ld->{$spec}; |
if (! $locs->{$spec}) { |
$locs = find_libs($ld->{$spec}, $ld, $locs); |
print STDERR "Couldn't find location for '$_' (file '$file')\n"; |
|
next; |
} else { |
|
warn "Couldn't find location for lib '$_' (file '$file')"; |
|
} |
} |
|
|
|
$locs = find_libs($locs->{$spec}, $ld, $locs); |
|
|
} |
} |
|
|
return $locs; |
return $locs; |