Alien-MSYS
view release on metacpan or search on metacpan
my($build) = @_;
$build->log("GET @{[ meta->prop->{start_url} ]}");
my $mingw_get_index_url = do {
my $ret = $build->decode($build->fetch);
my($first) = grep { $_->{filename} =~ /mingw-get-.*?-([0-9]{8})-([0-9]+)/ } @{ $ret->{list} };
die 'unable to find the correct directory for mingw-get' unless $first;
$first->{url};
};
$build->log("GET $mingw_get_index_url");
my $mingw_get_url = do {
my $ret = $build->decode($build->fetch($mingw_get_index_url));
my($first) = grep { $_->{filename} =~ /mingw-get-.*?-bin.zip/ } @{ $ret->{list} };
$first->{url};
};
$build->log("GET $mingw_get_url");
{
my $ret = $build->fetch($mingw_get_url);
if(defined $ret->{content})
{
path($ret->{filename})->spew_raw($ret->{content});
}
elsif(defined $ret->{path})
{
my $from = path($ret->{path});
my $to = $ret->{filename};
if($ret->{tmp})
{
$from->move($to);
}
else
{
$from->copy($to);
}
}
else
{
die 'get did not return a file';
}
};
};
meta->around_hook(
build => sub {
my $orig = shift;
use Env qw( @PATH );
local $ENV{PATH} = $ENV{PATH};
unshift @PATH, path('./bin')->absolute->stringify;
foreach my $dll (grep { $_->basename =~ /\.dll$/ } path('libexec/mingw-get')->children)
{
eval { chmod 0755, $dll };
}
$orig->(@_);
},
);
build [
'mingw-get install msys', # sh.exe, etc.
'mingw-get install msys-m4', # m4.exe
'mingw-get install msys-perl', # perl.exe
'mingw-get install msys-coreutils-ext', # readlink.exe, etc.
'mingw-get install msys-mktemp', # mktemp.exe
sub {
my($build) = @_;
$build->log("checking for @exes_to_check ...");
foreach my $exe (map { "msys/1.0/bin/$_" } @exes_to_check)
{
unless(-f $exe)
{
die "not found: $exe";
}
}
$build->log("remove package cache, and man pages");
# remove var/cache/mingw-get/packages/*
unlink $_ for bsd_glob('var/cache/mingw-get/packages/*');
# remove msys/1.0/share/{doc,man}
eval { path('msys/1.0/share/doc')->remove_tree };
eval { path('msys/1.0/share/man')->remove_tree };
$build->log("moving to @{[ $build->install_prop->{stage} ]}");
if($^O eq 'cygwin')
{
$build->system('mv * %{.install.stage}');
}
elsif($^O eq 'MSWin32')
{
my $stage = path($build->install_prop->{stage})->canonpath;
$build->system("xcopy . $stage /E");
}
else
{
die "huh?";
}
$build->log("checking for @exes_to_check ...");
foreach my $exe (map { "@{[ $build->install_prop->{stage} ]}/msys/1.0/bin/$_" } @exes_to_check)
{
unless(-f $exe)
{
die "not found: $exe";
}
}
},
];
( run in 0.320 second using v1.01-cache-2.11-cpan-02777c243ea )