mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 23:33:24 +00:00
Tabify win-ldd.pl - subsurface coding style
Signed-off-by: Thiago Macieira <thiago@macieira.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
336acb3e18
commit
4a213bba41
1 changed files with 59 additions and 59 deletions
|
@ -6,55 +6,55 @@ my @searchdirs;
|
||||||
my @systemdirs = (qr|^c:/windows|i, qr|^c:/winnt|i, qr|/c/windows|i, qr|/c/winnt|);
|
my @systemdirs = (qr|^c:/windows|i, qr|^c:/winnt|i, qr|/c/windows|i, qr|/c/winnt|);
|
||||||
|
|
||||||
sub addDependenciesFor($) {
|
sub addDependenciesFor($) {
|
||||||
open OBJDUMP, "-|", $objdump, "-p", $_[0] or die;
|
open OBJDUMP, "-|", $objdump, "-p", $_[0] or die;
|
||||||
while (<OBJDUMP>) {
|
while (<OBJDUMP>) {
|
||||||
last if /^The Import Tables/;
|
last if /^The Import Tables/;
|
||||||
}
|
}
|
||||||
while (<OBJDUMP>) {
|
while (<OBJDUMP>) {
|
||||||
next unless /DLL Name: (.*)/;
|
next unless /DLL Name: (.*)/;
|
||||||
$deploy{$1} = 0 unless defined($deploy{$1});
|
$deploy{$1} = 0 unless defined($deploy{$1});
|
||||||
last if /^\w/;
|
last if /^\w/;
|
||||||
}
|
}
|
||||||
close OBJDUMP;
|
close OBJDUMP;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub findMissingDependencies {
|
sub findMissingDependencies {
|
||||||
for my $name (keys %deploy) {
|
for my $name (keys %deploy) {
|
||||||
next if $deploy{$name};
|
next if $deploy{$name};
|
||||||
my $path;
|
my $path;
|
||||||
for my $dir (@searchdirs) {
|
for my $dir (@searchdirs) {
|
||||||
my $fpath = "$dir/$name";
|
my $fpath = "$dir/$name";
|
||||||
my $lcfpath = "$dir/" . lc($name);
|
my $lcfpath = "$dir/" . lc($name);
|
||||||
if (-e $fpath) {
|
if (-e $fpath) {
|
||||||
$path = $fpath;
|
$path = $fpath;
|
||||||
} elsif (-e $lcfpath) {
|
} elsif (-e $lcfpath) {
|
||||||
$path = $lcfpath;
|
$path = $lcfpath;
|
||||||
} else {
|
} else {
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
addDependenciesFor($path);
|
addDependenciesFor($path);
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
|
|
||||||
$path = "/missing/file" unless $path;
|
$path = "/missing/file" unless $path;
|
||||||
$deploy{$name} = $path;
|
$deploy{$name} = $path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (@ARGV) {
|
for (@ARGV) {
|
||||||
s/^-L//;
|
s/^-L//;
|
||||||
next if /^-/;
|
next if /^-/;
|
||||||
if (-d $_) {
|
if (-d $_) {
|
||||||
push @searchdirs, $_;
|
push @searchdirs, $_;
|
||||||
} elsif (-f $_) {
|
} elsif (-f $_) {
|
||||||
# Add $_'s path to the search list too
|
# Add $_'s path to the search list too
|
||||||
my $dirname = $_;
|
my $dirname = $_;
|
||||||
$dirname =~ s,/[^/]+$,,;
|
$dirname =~ s,/[^/]+$,,;
|
||||||
push @searchdirs, $dirname;
|
push @searchdirs, $dirname;
|
||||||
|
|
||||||
$deploy{$_} = $_;
|
$deploy{$_} = $_;
|
||||||
addDependenciesFor($_);
|
addDependenciesFor($_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Append PATH to @searchdirs
|
# Append PATH to @searchdirs
|
||||||
|
@ -62,29 +62,29 @@ for (@ARGV) {
|
||||||
|
|
||||||
# Remove system dirs from @searchdirs
|
# Remove system dirs from @searchdirs
|
||||||
@searchdirs = grep {
|
@searchdirs = grep {
|
||||||
my $sys = 0;
|
my $sys = 0;
|
||||||
for my $rx (@systemdirs) {
|
for my $rx (@systemdirs) {
|
||||||
if ($_ =~ $rx) {
|
if ($_ =~ $rx) {
|
||||||
$sys = 1;
|
$sys = 1;
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
!$sys;
|
!$sys;
|
||||||
} @searchdirs;
|
} @searchdirs;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
findMissingDependencies();
|
findMissingDependencies();
|
||||||
|
|
||||||
my $i = 0;
|
my $i = 0;
|
||||||
while (my ($name, $path) = each(%deploy)) {
|
while (my ($name, $path) = each(%deploy)) {
|
||||||
next if $path;
|
next if $path;
|
||||||
++$i;
|
++$i;
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
last if $i == 0;
|
last if $i == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (sort values %deploy) {
|
for (sort values %deploy) {
|
||||||
next if $_ eq "/missing/file";
|
next if $_ eq "/missing/file";
|
||||||
print "$_\n";
|
print "$_\n";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue