Alien-SDL3

 view release on metacpan or  search on metacpan

builder/Alien.pm  view on Meta::CPAN

    use Alien::cmake3;
    use Devel::CheckBin;
    $|++;
    #
    unshift @PATH, Alien::cmake3->bin_dir;
    #
    sub fetch_source {
        my ( $self, $liburl, $outfile ) = @_;
        CORE::state $http //= HTTP::Tiny->new();
        printf 'Downloading %s... ', $liburl unless $self->quiet;
        $outfile->parent->mkpath;
        my $response = $http->mirror( $liburl, $outfile, {} );
        if ( $response->{success} ) {    #ddx $response;
            $self->add_to_cleanup($outfile);
            CORE::say 'okay' unless $self->quiet;
            my $outdir = $outfile->parent->child( $outfile->basename( '.tar.gz', '.zip' ) );
            printf 'Extracting to %s... ', $outdir unless $self->quiet;
            my $ae = Archive::Extract->new( archive => $outfile );
            if ( $ae->extract( to => $outdir ) ) {
                CORE::say 'okay' unless $self->quiet;
                $self->add_to_cleanup( $ae->extract_path );
                return Path::Tiny->new( $ae->extract_path );
            }
            else {
                warn 'Failed to extract ' . $outfile;
            }



( run in 0.475 second using v1.01-cache-2.11-cpan-4d50c553e7e )