-
Notifications
You must be signed in to change notification settings - Fork 0
/
alienfile
41 lines (35 loc) · 1.39 KB
/
alienfile
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
use alienfile;
plugin 'Probe::CommandLine' => (
command => 'node',
args => [ '--version' ],
match => qr/^v([0-9\.]+)$/,
version => qr/^v([0-9\.]+)$/,
);
share {
# Only supports binary style for now.
# Will require Python for source install.
start_url 'https://nodejs.org/en/download/';
my $node_qr_prefix = qr/node-v([0-9\.]+)/;
my $src_qr = qr/$node_qr_prefix\.tar\.gz/;
my %os_arch_mapping = (
"MSWin32:x86" => { name => 'win-x86', format => 'zip' },
"MSWin32:x86_64" => { name => 'win-x64', format => 'zip' },
"darwin:x86_64" => { name => 'darwin-x64', format => 'tar.gz' },
"darwin:aarch64" => { name => 'darwin-arm64', format => 'tar.gz' },
"linux:x86_64" => { name => 'linux-x64', format => 'tar.xz' },
#"linux:" => { name => 'linux-armv7l', format => 'tar.xz' },
"linux:aarch64" => { name => 'linux-arm64', format => 'tar.xz' },
);
my $os_arch = join ":", ( $^O, meta->prop->{platform}{cpu}{arch}{name} );
die "No binary available for platform $os_arch" unless exists $os_arch_mapping{$os_arch};
plugin Download => (
filter => qr/${node_qr_prefix}-\Q@{[ $os_arch_mapping{$os_arch}{name} ]}\E\.\Q@{[ $os_arch_mapping{$os_arch}{format} ]}\E/,
version => qr/([0-9\.]+)/,
);
plugin Extract => $os_arch_mapping{$os_arch}{format};
plugin 'Build::Copy';
gather sub {
my ($build) = @_;
$build->runtime_prop->{'style'} = 'binary';
};
}