forked from Raku/roast
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfudgeall
executable file
·54 lines (46 loc) · 820 Bytes
/
fudgeall
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/perl
use strict;
use warnings;
my @opts;
while( $_ = $ARGV[0], /^-/ ) {
shift;
last if /^--$/;
push @opts, $_;
}
my $platform = shift;
use Cwd;
my $top = getcwd;
my $fudge;
TOP:
while ($top) {
for ("$top/fudge",
"$top/spec/fudge",
"$top/t/spec/fudge",
"$top/perl6/t/spec/fudge",
"$top/languages/perl6/t/spec/fudge",
) {
if (-f $_) {
$fudge = $_;
last TOP;
}
}
$top =~ s!(.*)/(.*)!!;
}
if (not $fudge) {
for (split(/[:;]/, $ENV{PATH})) {
if (-f "$_/fudge") {
$fudge = "$_/fudge";
last;
}
}
}
print join(' ',
map {
my $pick;
if ( $_ !~ m/\.$platform$/ ) {
my $cmd = "$^X \"$fudge\" @opts $platform $_";
chomp( $pick = `$cmd` );
}
defined $pick ? $pick : ();
} @ARGV
), "\n";