Alien-7zip
view release on metacpan or search on metacpan
use alienfile;
# NOTE: you can set ALIEN_7ZIP_SHARE_PREFER to either:
#
# - "auto": try binary install if possible (default)
# - "source": try from-source install only
# - "binary": try from-binary install only
# NOTE
# - 7zip provides the '7zz' binary on Unix-likes and the '7z.exe' binary on
# Windows.
# - p7zip is a fork which provides the '7z' binary on Unix-likes.
plugin 'Probe::CommandLine' => (
command => $_,
match => qr/7-Zip (?:\Q(z) \E)?([0-9\.]+)/,
version => qr/7-Zip (?:\Q(z) \E)?([0-9\.]+)/,
) for qw( 7z.exe 7zz );
sub can_source {
return 1;
}
my $prefix_bin_name = $prefix->child('bin', $bin_name);
$prefix_bin_name->parent->mkpath;
File::Copy::Recursive::fcopy($output->child($bin_name), $prefix_bin_name);
}
];
after build => sub {
my($build) = @_;
$build->runtime_prop->{'style'} = 'source';
if( $^O ne 'MSWin32' ) {
# on Unix-likes (linux, darwin)
$build->runtime_prop->{command} = '7zz';
} else {
# TODO not yet implemented
$build->runtime_prop->{command} = '7z.exe';
}
};
}
use Config;
# normalise architecture name
my $bin_dir = $cwd->child('bin');
$bin_dir->mkpath;
# Move 7zz|7zzs into bin/ (if exist)
File::Copy::Recursive::rmove( "$_", $bin_dir ) for $cwd->children( qr/^(7zz|7zzs)$/ );
};
plugin 'Build::Copy';
after build => sub {
my($build) = @_;
$build->runtime_prop->{'style'} = 'binary';
# on Unix-likes (linux, darwin)
$build->runtime_prop->{command} = '7zz';
};
}
}
sub _fix_share_version {
meta->around_hook(
prefer => sub {
my $orig = shift;
my $build = shift;
( run in 0.735 second using v1.01-cache-2.11-cpan-df04353d9ac )