Alien-SDL3_image
view release on metacpan or search on metacpan
builder/Alien/SDL3_image/Builder.pm view on Meta::CPAN
printf 'Downloading %s... ', $liburl if $verbose;
$outfile->parent->mkpath;
my $response = $http->mirror( $liburl, $outfile, {} );
say $response->{reason} if $verbose;
if ( $response->{success} ) { #ddx $response;
#~ $self->add_to_cleanup($outfile);
my $outdir = $outfile->parent->child( $outfile->basename( '.tar.gz', '.zip' ) );
printf 'Extracting %s to %s... ', $outfile, $outdir if $verbose;
require Archive::Extract;
my $ae = Archive::Extract->new( archive => $outfile );
if ( $ae->extract( to => $outdir ) ) {
say 'done' if $verbose;
#~ $self->add_to_cleanup( $ae->extract_path );
return path( $ae->extract_path );
}
else {
croak 'Failed to extract ' . $outfile;
}
}
else {
croak 'Failed to download ' . $liburl;
}
return 0;
}
method Build(@args) {
my $method = $self->can( 'step_' . $action );
$method // die "No such action '$action'\n";
exit $method->($self);
}
method Build_PL() {
say sprintf 'Creating new Build script for %s %s', $meta->name, $meta->version;
$self->write_file( 'Build', sprintf <<'', $^X, __PACKAGE__, __PACKAGE__ );
#!%s
use lib 'builder';
use %s;
use Getopt::Long qw[GetOptionsFromArray];
my %%opts = ( @ARGV && $ARGV[0] =~ /\A\w+\z/ ? ( action => shift @ARGV ) : () );
GetOptionsFromArray \@ARGV, \%%opts, qw[install_base=s install_path=s%% installdirs=s destdir=s prefix=s config=s%% uninst:1 verbose:1 dry_run:1 jobs=i prebuilt:1];
%s->new(%%opts)->Build();
make_executable('Build');
my @env = defined $ENV{PERL_MB_OPT} ? split_like_shell( $ENV{PERL_MB_OPT} ) : ();
$self->write_file( '_build_params', encode_json( [ \@env, \@ARGV ] ) );
if ( my $dynamic = $meta->custom('x_dynamic_prereqs') ) {
my %meta = ( %{ $meta->as_struct }, dynamic_config => 0 );
$self->get_arguments( \@env, \@ARGV );
require CPAN::Requirements::Dynamic;
my $dynamic_parser = CPAN::Requirements::Dynamic->new();
my $prereq = $dynamic_parser->evaluate($dynamic);
$meta{prereqs} = $meta->effective_prereqs->with_merged_prereqs($prereq)->as_string_hash;
$meta = CPAN::Meta->new( \%meta );
}
$meta->save(@$_) for ['MYMETA.json'];
}
sub find ( $pattern, $base ) {
$base = path($base) unless builtin::blessed $base;
my $blah = $base->visit(
sub ( $path, $state ) {
$state->{$path} = $path if -f $path && $path =~ $pattern;
#~ return \0 if keys %$state == 10;
},
{ recurse => 1 }
);
values %$blah;
}
};
1;
( run in 1.404 second using v1.01-cache-2.11-cpan-39bf76dae61 )