1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
use 5.008004;
use Test2::V0 -no_srand => 1;
use Test::Alien::Build;
use Alien::Build::Plugin::PkgConfig::MakeStatic;
use Capture::Tiny qw( capture_merged );
skip_all 'test requires PkgConfig.pm'
unless eval { require PkgConfig; PkgConfig->VERSION(0.14026) };
subtest 'recursive' => sub {
my $build = alienfile q{
use alienfile;
use Path::Tiny qw( path );
plugin 'Test::Mock',
probe => 'share',
download => 1,
extract => 1;
plugin 'PkgConfig::MakeStatic';
plugin 'PkgConfig::PP' => 'foo1';
share {
build sub {
my($build) = @_;
my $dir = path($build->install_prop->{prefix}, 'lib', 'pkgconfig');
$dir->mkpath;
path($dir, 'foo1.pc')->spew(
"libdir=/foo/bar\n" .
"Cflags: -I/baz/include\n" .
"Cflags.private: -DUSE_STATIC=1\n" .
"Libs: -L\${libdir} -lxml2\n" .
"Libs.private: -lpthread -lz -liconv -lm\n"
);
path($dir, 'bar1.pc')->spew(
"libdir=/foo/bar\n" .
"Libs: -L\${libdir} -lfoo2\n" .
"Libs.private: -lbar -lbaz\n"
);
};
};
};
note capture_merged {
$build->download;
$build->build;
();
};
like $build->runtime_prop->{libs}, qr{-L/foo/bar -lxml2 -lpthread -lz -liconv -lm};
};
done_testing;
|