-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalienfile
92 lines (82 loc) · 2.54 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
use alienfile;
use Path::Tiny qw( path );
use Config;
configure {
requires 'Path::Tiny';
};
my $version = $ENV{ALIEN_WASMTIME_VERSION} || 'v0.27.0';
my $arch = 'x86_64';
if($^O eq 'linux')
{
# archname=x86_64-linux-gnu-thread-multi
if($Config{archname} =~ /^(x86_64|aarch64)-linux/ && $Config{ptrsize} == 8)
{
if($1 eq 'aarch64')
{
$arch = 'aarch64';
}
}
else
{
print "Only x86_64 and arm64 are supported on Linux.\n";
print "If we are missing a binary tarball that could work for your platform, please comment here:\n";
print "https://github.com/perlwasm/Alien-wasmtime/issues/2\n";
exit;
}
}
elsif($^O eq 'MSWin32')
{
if($Config{archname} !~ /^MSWin32-x64/ || $Config{ptrsize} != 8)
{
print "Only x86_64 is supported on Windows.\n";
print "If we are missing a binary tarball that could work for your platform, please comment here:\n";
print "https://github.com/perlwasm/Alien-wasmtime/issues/2\n";
exit;
}
}
elsif($^O eq 'darwin')
{
if($Config{myarchname} !~ /^i386-darwin/ || $Config{ptrsize} != 8)
{
print "Only x86_64 is supported on macOS / darwin\n";
print "If we are missing a binary tarball that could work for your platform, please comment here:\n";
print "https://github.com/perlwasm/Alien-wasmtime/issues/2\n";
exit;
}
}
else
{
print "Operating system not supported.\n";
print "If we are missing a binary tarball that could work for your platform, please comment here:\n";
print "https://github.com/perlwasm/Alien-wasmtime/issues/2\n";
exit;
}
probe sub { 'share' };
share {
if($^O eq 'linux')
{
start_url "https://github.com/bytecodealliance/wasmtime/releases/download/$version/wasmtime-$version-$arch-linux-c-api.tar.xz";
plugin 'Download';
plugin Extract => 'tar.xz';
}
elsif($^O eq 'MSWin32')
{
start_url "https://github.com/bytecodealliance/wasmtime/releases/download/$version/wasmtime-$version-$arch-windows-c-api.zip";
plugin 'Download';
plugin Extract => 'zip';
}
elsif($^O eq 'darwin')
{
start_url "https://github.com/bytecodealliance/wasmtime/releases/download/$version/wasmtime-$version-$arch-macos-c-api.tar.xz";
plugin 'Download';
plugin Extract => 'tar.xz';
}
plugin 'Build::Copy';
gather sub {
my($build) = @_;
$build->runtime_prop->{version} = $version;
$build->runtime_prop->{version} =~ s/^v//;
$build->runtime_prop->{cflags} = "-I@{[ $build->runtime_prop->{prefix} ]}/include ";
$build->runtime_prop->{libs} = "-L@{[ $build->runtime_prop->{prefix} ]}/lib -lwasmtime ";
};
};