Alien-Base-ModuleBuild

 view release on metacpan or  search on metacpan

lib/Alien/Base/ModuleBuild.pm  view on Meta::CPAN

    for keys %default_repository_class;

  my $self = $class->SUPER::new(%args);

  ## Recheck Force System
  if(!defined($ENV{ALIEN_INSTALL_TYPE}) && !defined($ENV{ALIEN_FORCE}) && defined($self->alien_install_type)) {
    if   ($self->alien_install_type eq 'share' ) { $Force = 1; $ForceSystem = 0; }
    elsif($self->alien_install_type eq 'system') { $Force = 0; $ForceSystem = 1; }
  }

  $self->config_data("Force" => $Force);
  $self->config_data("ForceSystem" => $ForceSystem);

  $self->alien_helper->{pkg_config} = 'Alien::Base::PkgConfig->pkg_config_command'
    unless defined $self->alien_helper->{pkg_config};

  my $ab_version = eval {
    require Alien::Base;
    Alien::Base->VERSION;
  };
  $ab_version ||= 0;

  # setup additional temporary directories, and yes we have to add File::ShareDir manually
  if($ab_version < 0.77) {
    $self->_add_prereq( 'requires', 'File::ShareDir', '1.00' );
  }

  # this just gets passed from the Build.PL to the config so that it can
  # be used by the auto_include method
  $self->config_data( 'inline_auto_include' => $self->alien_inline_auto_include );

  if($Force || !$self->alien_check_installed_version) {
    if (any { /(?<!\%)\%c/ } map { ref($_) ? @{$_} : $_ } @{ $self->alien_build_commands }) {
      $self->config_data( 'autoconf' => 1 );
    }

    if ($^O eq 'MSWin32' && ($self->config_data( 'autoconf') || $self->alien_msys)) {
      $self->_add_prereq( 'build_requires', 'Alien::MSYS', '0' );
      $self->config_data( 'msys' => 1 );
    } else {
      $self->config_data( 'msys' => 0 );
    }

    foreach my $tool (keys %{ $self->alien_bin_requires  }) {
      my $version = $self->alien_bin_requires->{$tool};
      if($tool eq 'Alien::CMake' && $version < 0.07) {
        $version = '0.07';
      }
      $self->_add_prereq( 'build_requires', $tool, $version );
    }

    my @repos = ref $args{alien_repository} eq 'ARRAY'
      ? @{ $args{alien_repository} }
      : ( $args{alien_repository} );

    foreach my $repo (@repos)
    {
      next unless defined $repo;
      if(($repo->{protocol}||'') eq 'https')
      {
        $self->_add_prereq( 'build_requires', 'IO::Socket::SSL', '1.56' );
        $self->_add_prereq( 'build_requires', 'Net::SSLeay',     '1.49' );
      }
    }

  }


  # force newest for all automated testing
  #TODO (this probably should be checked for "input needed" rather than blindly assigned)
  if ($ENV{AUTOMATED_TESTING}) {
    $self->alien_selection_method('newest');
  }

  $self->config_data( 'finished_installing' => 0 );

  if(any { /(?<!\%)\%p/ } map { ref($_) ? @{$_} : $_ } @{ $self->alien_build_commands }) {
    carp "%p is deprecated, See https://metacpan.org/pod/Alien::Base::ModuleBuild::API#p";
  }

  return $self;
}

sub alien_init_temp_dir {
  my $self = shift;
  my $temp_dir = $self->alien_temp_dir;
  my $share_dir = $self->alien_share_dir;

  # make sure we are in base_dir
  local $CWD = $self->base_dir;

  unless ( -d $temp_dir ) {
    mkdir $temp_dir or croak "Could not create temporary directory $temp_dir";
  }
  $self->add_to_cleanup( $temp_dir );

  unless ( -d $share_dir ) {
    mkdir $share_dir or croak "Could not create temporary directory $share_dir";
  }
  $self->add_to_cleanup( $share_dir );

  # add share dir to share dir list
  my $share_dirs = $self->share_dir;
  unshift @{ $share_dirs->{dist} }, $share_dir;
  $self->share_dir( $share_dirs );
  {
    local $CWD = $share_dir;
    open my $fh, '>', 'README' or die "Could not open README for writing (in directory $share_dir)\n";
    print $fh <<'END';
This README file is autogenerated by Alien::Base.

Currently it exists for testing purposes, but it might eventually contain information about the file(s) installed.
END
  }
}

####################
#  ACTION methods  #
####################

sub ACTION_alien_fakebuild {



( run in 0.972 second using v1.01-cache-2.11-cpan-efa8479b9fe )