Alien-SDL3_image

 view release on metacpan or  search on metacpan

builder/Alien/SDL3_image/Builder.pm  view on Meta::CPAN

        chdir $path->absolute->stringify if -d $path->absolute;
        $sub->();
        chdir $cwd->stringify;
    }

    method step_build_libs() {
        my $pre = cwd->absolute->child( qw[blib arch auto], $meta->name );
        return 0 if -d $pre;
        my $p = $cwd->child('share')->realpath;
        if ( $^O eq 'MSWin32' && $prebuilt ) {
            say 'Using prebuilt SDL3_image...' if $verbose;
            next                               if $config{okay};
            my $store = tempdir()->child('SDL3_image.zip');
            my $okay  = $self->fetch( $archive, $store );
            die 'Failed to fetch SDL3_image binaries' unless $okay;
            if ( $Config{cc} =~ m[gcc]i ) {
                my $platform = $Config{archname} =~ /x64/ ? 'x86_64-w64-mingw32' : 'i686-w64-mingw32';

                #~ $self->add_to_cleanup( $okay->canonpath );
                $okay->child($platform)->visit(
                    sub {

builder/Alien/SDL3_image/Builder.pm  view on Meta::CPAN

                );
            }
            $config{type}    = 'share';
            $config{okay}    = 1;
            $config{version} = $version;
        }
        else {
            require DynaLoader;
            require Alien::cmake3;
            unshift @PATH, Alien::cmake3->bin_dir;
            say 'Looking for SDL3_image library...' if $verbose;
            my ($path) = DynaLoader::dl_findfile('-lSDL3_image');
            if ($path) {
                $config{type} = 'system';
                $config{path} = path($path)->realpath->stringify;
                say 'Library found at ' . $config{path} if $verbose;
            }
            else {
                say 'Building SDL3_image from source...' if $verbose;
                my $store = tempdir()->child( path($archive)->basename );
                my $build = tempdir()->child('build');
                my $okay  = $self->fetch( $archive, $store );
                die 'Failed to download SDL3_image source' unless $okay;

                #~ $self->add_to_cleanup( $okay->canonpath );
                $config{path} = 'share';
                $config{okay} = 0;
                my $cflags = '';
                require Alien::SDL3;

builder/Alien/SDL3_image/Builder.pm  view on Meta::CPAN

        $_ = detildefy($_) for grep {defined} $install_base, $destdir, $prefix, values %{$install_paths};
        $install_paths = ExtUtils::InstallPaths->new( dist_name => $meta->name );
        return;
    }

    method fetch ( $liburl, $outfile ) {
        $http //= HTTP::Tiny->new();
        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;

builder/Alien/SDL3_image/Builder.pm  view on Meta::CPAN

        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');



( run in 1.298 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )