| 1 | 1 | ▶ | use alienfile; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 2 | 1 | ▶ | use Capture::Tiny qw( capture ); | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 3 | 1 | ▶ | use Config; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 4 | |||||||||||||||
| 5 | 1 | ▶ | configure { requires 'Capture::Tiny' }; | ||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||
| 6 | |||||||||||||||
| 7 | 1 | plugin 'Probe::CommandLine' => ( | |||||||||||||
| 8 | command => 'nasm', | ||||||||||||||
| 9 | args => ['-v'], | ||||||||||||||
| 10 | match => qr/NASM version/, | ||||||||||||||
| 11 | ); | ||||||||||||||
| 12 | |||||||||||||||
| 13 | 1 | plugin 'Probe::CommandLine' => ( | |||||||||||||
| 14 | command => 'ndisasm', | ||||||||||||||
| 15 | args => ['-v'], | ||||||||||||||
| 16 | match_stderr => qr/NDISASM version/, | ||||||||||||||
| 17 | secondary => 1, | ||||||||||||||
| 18 | ); | ||||||||||||||
| 19 | |||||||||||||||
| 20 | 1 | ▶ | share { | ||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=14.1
| |||||||||||||||
| 21 | |||||||||||||||
| 22 | 1 | requires 'Path::Tiny'; | |||||||||||||
| 23 | 1 | plugin 'Fetch::HTTPTiny' => 'https://www.nasm.us/pub/nasm/releasebuilds'; | |||||||||||||
| 24 | 1 | plugin 'Decode::Mojo' => (); | |||||||||||||
| 25 | 1 | plugin 'Prefer::SortVersions' => (); | |||||||||||||
| 26 | |||||||||||||||
| 27 | 0 | ▶ | download sub { | ||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||||
| 28 | 0 | my($build) = @_; | |||||||||||||
| 29 | |||||||||||||||
| 30 | 0 | my $res = $build->decode($build->fetch('https://www.nasm.us/pub/nasm/releasebuilds')); | |||||||||||||
| 31 | |||||||||||||||
| 32 | 0 | $res->{list} = [grep { $_->{filename} =~ /^[0-9\.]+$/ } @{ $res->{list} }]; | |||||||||||||
| 33 | |||||||||||||||
| 34 | 0 | $res = $build->prefer($res); | |||||||||||||
| 35 | |||||||||||||||
| 36 | die "unable to find first level candidate" | ||||||||||||||
| 37 | 0 | ▶ | unless @{ $res->{list} } > 0; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 38 | |||||||||||||||
| 39 | 0 | my $url; | |||||||||||||
| 40 | my $regex; | ||||||||||||||
| 41 | |||||||||||||||
| 42 | 0 | ▶ | if($^O eq 'MSWin32') | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 43 | { | ||||||||||||||
| 44 | 0 | ▶ | my $bits = $Config{ptrsize} == 4 ? '32' : '64'; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 45 | 0 | $url = $res->{list}->[0]->{url} . "/win$bits"; | |||||||||||||
| 46 | 0 | $regex = qr/^nasm-[0-9\.]+-win$bits\.zip$/; | |||||||||||||
| 47 | } | ||||||||||||||
| 48 | else | ||||||||||||||
| 49 | { | ||||||||||||||
| 50 | 0 | $url = $res->{list}->[0]->{url}; | |||||||||||||
| 51 | 0 | $regex = qr/^nasm-[0-9\.]+\.tar\.gz$/; | |||||||||||||
| 52 | } | ||||||||||||||
| 53 | |||||||||||||||
| 54 | 0 | $res = $build->decode($build->fetch($url)); | |||||||||||||
| 55 | |||||||||||||||
| 56 | 0 | $res->{list} = [grep { $_->{filename} =~ $regex } @{ $res->{list} }]; | |||||||||||||
| 57 | |||||||||||||||
| 58 | 0 | $res = $build->prefer($res); | |||||||||||||
| 59 | |||||||||||||||
| 60 | die "unable to find second level candidate" | ||||||||||||||
| 61 | 0 | ▶ | unless @{ $res->{list} } > 0; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 62 | |||||||||||||||
| 63 | 0 | $res = $build->fetch($res->{list}->[0]->{url}); | |||||||||||||
| 64 | 0 | Path::Tiny->new($res->{filename})->spew_raw($res->{content}); | |||||||||||||
| 65 | 0 | $build->runtime_prop->{command} = 'nasm'; | |||||||||||||
| 66 | 1 | }; | |||||||||||||
| 67 | |||||||||||||||
| 68 | 1 | ▶ | if($^O eq 'MSWin32') | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 69 | { | ||||||||||||||
| 70 | 0 | requires 'Path::Tiny'; | |||||||||||||
| 71 | 0 | plugin 'Extract' => 'zip'; | |||||||||||||
| 72 | 0 | ▶ | build sub { | ||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||
| 73 | 0 | my($build) = @_; | |||||||||||||
| 74 | 0 | my $dest = Path::Tiny->new($build->install_prop->{prefix})->child('bin'); | |||||||||||||
| 75 | 0 | $dest->mkpath; | |||||||||||||
| 76 | 0 | foreach my $exe (qw( nasm.exe ndisasm.exe )) | |||||||||||||
| 77 | { | ||||||||||||||
| 78 | 0 | Path::Tiny->new($exe)->copy($dest->child($exe)); | |||||||||||||
| 79 | } | ||||||||||||||
| 80 | 0 | }; | |||||||||||||
| 81 | } | ||||||||||||||
| 82 | else | ||||||||||||||
| 83 | { | ||||||||||||||
| 84 | 1 | plugin 'Extract' => 'tar.gz'; | |||||||||||||
| 85 | 1 | plugin 'Build::MSYS' => (); | |||||||||||||
| 86 | |||||||||||||||
| 87 | 1 | build [ | |||||||||||||
| 88 | 'sh configure --prefix=%{alien.install.prefix}', | ||||||||||||||
| 89 | '%{gmake}', | ||||||||||||||
| 90 | '%{gmake} install', | ||||||||||||||
| 91 | ]; | ||||||||||||||
| 92 | } | ||||||||||||||
| 93 | 1 | }; | |||||||||||||
| 94 | |||||||||||||||
| 95 | 0 | ▶ | gather sub { | ||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||
| 96 | 0 | my($build) = @_; | |||||||||||||
| 97 | 0 | ▶ | my($stdout,$stderr) = capture { | ||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||
| 98 | 0 | system('nasm', '-v'); | |||||||||||||
| 99 | 0 | }; | |||||||||||||
| 100 | 0 | my $version = 'unknown'; | |||||||||||||
| 101 | 0 | ▶ | if($stdout =~ /NASM version ([0-9\.]+)/) | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 102 | 0 | { $version = $1 } | |||||||||||||
| 103 | elsif($stderr =~ /NASM version ([0-9\.]+)/) | ||||||||||||||
| 104 | 0 | { $version = $1 } | |||||||||||||
| 105 | 0 | $build->runtime_prop->{version} = $version; | |||||||||||||
| 106 | 1 | }; | |||||||||||||
| 107 | |||||||||||||||