Alien-SDL2

 view release on metacpan or  search on metacpan

inc/My/Builder.pm  view on Meta::CPAN

package My::Builder;

use strict;
use warnings;
use base 'Module::Build';

use lib "inc";
use My::Utility qw(find_SDL2_dir find_file sed_inplace get_dlext);
use File::Spec::Functions qw(catdir catfile splitpath catpath rel2abs abs2rel);
use File::Path qw(make_path remove_tree);
use File::Copy qw(cp);
use File::Fetch;
use File::Find;
use File::ShareDir;
use Archive::Extract;
use Digest::SHA qw(sha1_hex);
use Text::Patch;
use Config;
use IPC::Run3;

$SIG{__WARN__} = sub {
	my $thing =  join('', @_);
	$thing    =~ s|(://.+:).+(\@.+)|$1******$2|;
	warn $thing;
	return 1;
};

sub ACTION_build {
  my $self = shift;
  # as we want to wipe 'sharedir' during 'Build clean' we has
  # to recreate 'sharedir' at this point if it does not exist

  my $bp = $self->notes('build_params');
  die "###ERROR### Cannot continue build_params not defined" unless defined($bp);

  printf("Build option used:\n\t%s\n", $bp->{title} || 'n.a.');

  mkdir 'sharedir' unless(-d 'sharedir');
  $self->add_to_cleanup('sharedir');
  $self->SUPER::ACTION_build;
}

sub ACTION_install
{
 my $self = shift;
 my $sharedir = '';

 $sharedir = eval {File::ShareDir::dist_dir('Alien-SDL2')} || '';

 if ( -d $sharedir )
 {
   print "Removing the old $sharedir \n";
   remove_tree($sharedir);
   make_path($sharedir);
 }

 $self->SUPER::ACTION_install;
}

sub ACTION_code {
  my $self = shift;

  my $bp = $self->notes('build_params');
  die "###ERROR### Cannot continue build_params not defined" unless defined($bp);

  # check marker
  if (! $self->check_build_done_marker) {



( run in 0.715 second using v1.01-cache-2.11-cpan-677af5a14d3 )