Alien-Base

 view release on metacpan or  search on metacpan

corpus/lib/Alien/Foo2/ConfigData.pm  view on Meta::CPAN

       {
         'alien_version' => undef,
         'ffi_name' => undef,
         'finished_installing' => 1,
         'inline_auto_include' => [],
         'install_type' => 'share',
         'msys' => 0,
         'name' => 'libfoo2',
         'original_prefix' => '/home/user/.cpanm/work/1456299506.4021/Alien-Foo2-0.12/blib/lib/auto/share/dist/Alien-Foo2',
         'pkgconfig' => {
                          '_manual' => bless( {
                                                'keywords' => {
                                                                'Cflags' => '-I${pcfiledir}/lib/libfoo2-3.2.1/include',
                                                                'Libs' => '-L${pcfiledir}/lib -lfoo2',
                                                                'Version' => ''
                                                              },
                                                'package' => 'libfoo2',
                                                'vars' => {
                                                            'pcfiledir' => '/home/user/.cpanm/work/1456299506.4021/Alien-Foo2-0.12/blib/lib/auto/share/dist/Alien-Foo2'
                                                          }
                                              }, 'Alien::Base::PkgConfig' ),
                          'libfoo2' => bless( {
                                               'keywords' => {
                                                               'Cflags' => '-I${includedir}',
                                                               'Description' => 'Library supporting Foreign Function Interfaces',
                                                               'Libs' => '-L${toolexeclibdir} -lfoo2',
                                                               'Name' => 'libfoo2',
                                                               'Version' => '3.2.1'
                                                             },
                                               'package' => 'libfoo2',
                                               'vars' => {
                                                           'exec_prefix' => '${prefix}',

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

package Alien::Base;

use strict;
use warnings;

our $VERSION = '0.042';

use Carp;
use File::ShareDir ();
use File::Spec;
use Scalar::Util qw/blessed/;
use Capture::Tiny 0.17 qw/capture_merged/;
use Text::ParseWords qw/shellwords/;

=encoding UTF-8

=head1 NAME

Alien::Base - Base classes for Alien:: modules

=head1 SYNOPSIS

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


Returns the directory that contains the install root for
the packaged software, if it was built from install (i.e., if
C<install_type> is C<share>).

=cut

sub dist_dir {
  my $class = shift;

  my $dist = blessed $class || $class;
  $dist =~ s/::/-/g;

  my $dist_dir = 
    $class->config('finished_installing') 
      ? File::ShareDir::dist_dir($dist) 
      : $class->config('working_directory');

  croak "Failed to find share dir for dist '$dist'"
    unless defined $dist_dir && -d $dist_dir;

  return $dist_dir;
}

sub new { return bless {}, $_[0] }

sub _flags
{
  my($class, $key) = @_;
  
  my $config = $class->runtime_prop;
  my $flags = $config->{$key};

  my $prefix = $config->{prefix};
  $prefix =~ s{\\}{/}g if $^O =~ /^(MSWin32|msys)$/;

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

    my $pkg = Alien::Base::PkgConfig->new($_);
    $all{$pkg->{package}} = $pkg;
  };
  File::Find::find( $wanted, $self->dist_dir );
    
  croak "No Alien::Base::PkgConfig objects are stored!"
    unless keys %all;
  
  # Run through all pkgconfig objects and ensure that their modules are loaded:
  for my $pkg_obj (values %all) {
    my $perl_module_name = blessed $pkg_obj;
    eval "require $perl_module_name"; 
  }

  return @all{@_} if @_;

  my $manual = delete $all{_manual};

  if (keys %all) {
    return values %all;
  } else {

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

L<Alien::Base::ModuleBuild::API#CONFIG-DATA>.

This is not typically used by L<Alien::Base> and L<alienfile>,
but a compatible interface will be provided.

=cut

# helper method to call Alien::MyLib::ConfigData->config(@_)
sub config {
  my $class = shift;
  $class = blessed $class || $class;

  if(my $ab_config = $class->runtime_prop)
  {
    my $key = shift;
    return $ab_config->{legacy}->{$key};
  }

  my $config = $class . '::ConfigData';
  eval "require $config";
  warn $@ if $@;



( run in 1.141 second using v1.01-cache-2.11-cpan-de7293f3b23 )