Alien-Build

 view release on metacpan or  search on metacpan

t/alien_base.t  view on Meta::CPAN

use 5.008004;
use Test2::V0 -no_srand => 1;
use lib 'corpus/lib';
use Env qw( @PKG_CONFIG_PATH );
use File::Glob qw( bsd_glob );
use File::chdir;
use Path::Tiny qw( path );
use FFI::CheckLib;
use Text::ParseWords qw( shellwords );
use List::Util qw( first );

my $mock = mock 'FFI::CheckLib' => (
  override => [
    find_lib => sub {
      my %args = @_;
      my @libpath;
      if(ref $args{libpath})
      {
        @libpath = @{ $args{libpath} } if ref $args{libpath};
      }
      elsif(defined $args{libpath})
      {
        @libpath = ($args{libpath});
      }
      if(@libpath)
      {
        my @libs;
        foreach my $libpath (@libpath)
        {
          if($libpath eq '/roger/opt/libbumblebee/lib')
          {
            push @libs, '/roger/opt/libbumblebee/lib/libbumblebee.so';
            next;
          }
          next unless -d $libpath;
          local $CWD = $libpath;
          push @libs, map { path($_)->absolute->stringify } bsd_glob('*.so*');
        }
        return @libs;
      }
      else
      {
        if($args{lib} eq 'foo')
        {
          return ('/usr/lib/libfoo.so', '/usr/lib/libfoo.so.1');
        }
        else
        {
          return;
        }
      }
    },
  ],
);


unshift @PKG_CONFIG_PATH, path('corpus/pkgconfig')->absolute->stringify;

subtest 'AB::MB sys install' => sub {

  require Alien::Foo1;

  my $cflags  = Alien::Foo1->cflags;



( run in 1.572 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )