| 1 | package Alien::Build::Plugin::Build::SearchDep; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use 5.008004; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use Alien::Build::Plugin; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use Text::ParseWords qw( shellwords ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | # ABSTRACT: Add dependencies to library and header search path | ||||||||||||||||||||||||||||
| 10 | 2 | our $VERSION = '2.88'; # VERSION | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 2 | has aliens => {}; | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 2 | has public_I => 0; | |||||||||||||||||||||||||||
| 17 | 2 | has public_l => 0; | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | sub init | ||||||||||||||||||||||||||||
| 20 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
init: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||
| 21 | 0 | my($self, $meta) = @_; | |||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 0 | $meta->add_requires('configure' => 'Alien::Build::Plugin::Build::SearchDep' => '0.35'); | |||||||||||||||||||||||||||
| 24 | 0 | $meta->add_requires('share' => 'Env::ShellWords' => 0.01); | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 0 | ▶ | if($self->public_I || $self->public_l) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->public_I or $self->public_l
MC/DC0%0/2
$self->public_I or $self->public_l
$self->public_I
$self->public_l
Truth table0%0/3
A or B
A= $self->public_IB= $self->public_l
| |||||||||||||||||||||||||||||
| 27 | { | ||||||||||||||||||||||||||||
| 28 | 0 | $meta->add_requires('configure' => 'Alien::Build::Plugin::Build::SearchDep' => '0.53'); | |||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 0 | my @aliens; | |||||||||||||||||||||||||||
| 32 | 0 | ▶ | if(ref($self->aliens) eq 'HASH') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 33 | { | ||||||||||||||||||||||||||||
| 34 | 0 | @aliens = keys %{ $self->aliens }; | |||||||||||||||||||||||||||
| 35 | 0 | $meta->add_requires('share' => $_ => $self->aliens->{$_}) for @aliens; | |||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | else | ||||||||||||||||||||||||||||
| 38 | { | ||||||||||||||||||||||||||||
| 39 | 0 | ▶ | @aliens = ref $self->aliens ? @{ $self->aliens } : ($self->aliens); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 40 | 0 | $meta->add_requires('share' => $_ => 0) for @aliens; | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | $meta->around_hook( | ||||||||||||||||||||||||||||
| 44 | 0 | ▶ | build => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 45 | 0 | my($orig, $build) = @_; | |||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 0 | local $ENV{CFLAGS} = $ENV{CFLAGS}; | |||||||||||||||||||||||||||
| 48 | 0 | local $ENV{CXXFLAGS} = $ENV{CXXFLAGS}; | |||||||||||||||||||||||||||
| 49 | 0 | local $ENV{LDFLAGS} = $ENV{LDFLAGS}; | |||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 0 | tie my @CFLAGS, 'Env::ShellWords', 'CFLAGS'; | |||||||||||||||||||||||||||
| 52 | 0 | tie my @CXXFLAGS, 'Env::ShellWords', 'CXXFLAGS'; | |||||||||||||||||||||||||||
| 53 | 0 | tie my @LDFLAGS, 'Env::ShellWords', 'LDFLAGS'; | |||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 0 | my $cflags = $build->install_prop->{plugin_build_searchdep_cflags} = []; | |||||||||||||||||||||||||||
| 56 | 0 | my $ldflags = $build->install_prop->{plugin_build_searchdep_ldflags} = []; | |||||||||||||||||||||||||||
| 57 | 0 | my $libs = $build->install_prop->{plugin_build_searchdep_libs} = []; | |||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 0 | foreach my $other (@aliens) | |||||||||||||||||||||||||||
| 60 | { | ||||||||||||||||||||||||||||
| 61 | 0 | my $other_cflags; | |||||||||||||||||||||||||||
| 62 | my $other_libs; | ||||||||||||||||||||||||||||
| 63 | 0 | ▶ | if($other->install_type('share')) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 64 | { | ||||||||||||||||||||||||||||
| 65 | 0 | $other_cflags = $other->cflags_static; | |||||||||||||||||||||||||||
| 66 | 0 | $other_libs = $other->libs_static; | |||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | else | ||||||||||||||||||||||||||||
| 69 | { | ||||||||||||||||||||||||||||
| 70 | 0 | $other_cflags = $other->cflags; | |||||||||||||||||||||||||||
| 71 | 0 | $other_libs = $other->libs; | |||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||
| 73 | 0 | unshift @$cflags, grep /^-I/, shellwords($other_cflags); | |||||||||||||||||||||||||||
| 74 | 0 | unshift @$ldflags, grep /^-L/, shellwords($other_libs); | |||||||||||||||||||||||||||
| 75 | 0 | unshift @$libs, grep /^-l/, shellwords($other_libs); | |||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | 0 | unshift @CFLAGS, @$cflags; | |||||||||||||||||||||||||||
| 79 | 0 | unshift @CXXFLAGS, @$cflags; | |||||||||||||||||||||||||||
| 80 | 0 | unshift @LDFLAGS, @$ldflags; | |||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | 0 | $orig->($build); | |||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | }, | ||||||||||||||||||||||||||||
| 85 | 0 | ); | |||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | $meta->after_hook( | ||||||||||||||||||||||||||||
| 88 | 0 | ▶ | gather_share => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=10 SCAR=47.0
| |||||||||||||||||||||||||||||
| 89 | 0 | my($build) = @_; | |||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | 0 | ▶ | $build->runtime_prop->{libs} = '' unless defined $build->runtime_prop->{libs}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 92 | 0 | ▶ | $build->runtime_prop->{libs_static} = '' unless defined $build->runtime_prop->{libs_static}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | 0 | ▶ | if($self->public_l) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 95 | { | ||||||||||||||||||||||||||||
| 96 | 0 | $build->runtime_prop->{$_} = join(' ', _space_escape(@{ $build->install_prop->{plugin_build_searchdep_libs} })) . ' ' . $build->runtime_prop->{$_} | |||||||||||||||||||||||||||
| 97 | 0 | for qw( libs libs_static ); | |||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | 0 | $build->runtime_prop->{$_} = join(' ', _space_escape(@{ $build->install_prop->{plugin_build_searchdep_ldflags} })) . ' ' . $build->runtime_prop->{$_} | |||||||||||||||||||||||||||
| 101 | 0 | for qw( libs libs_static ); | |||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | 0 | ▶ | if($self->public_I) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 104 | { | ||||||||||||||||||||||||||||
| 105 | 0 | ▶ | $build->runtime_prop->{cflags} = '' unless defined $build->runtime_prop->{cflags}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 106 | 0 | ▶ | $build->runtime_prop->{cflags_static} = '' unless defined $build->runtime_prop->{cflags_static}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 107 | 0 | $build->runtime_prop->{$_} = join(' ', _space_escape(@{ $build->install_prop->{plugin_build_searchdep_cflags} })) . ' ' . $build->runtime_prop->{$_} | |||||||||||||||||||||||||||
| 108 | 0 | for qw( cflags cflags_static ); | |||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||
| 110 | }, | ||||||||||||||||||||||||||||
| 111 | 0 | ); | |||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | sub _space_escape | ||||||||||||||||||||||||||||
| 115 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
_space_escape: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 116 | map { | ||||||||||||||||||||||||||||
| 117 | 0 | my $str = $_; | |||||||||||||||||||||||||||
| 118 | 0 | $str =~ s{(\s)}{\\$1}g; | |||||||||||||||||||||||||||
| 119 | 0 | $str; | |||||||||||||||||||||||||||
| 120 | } @_; | ||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | 2 | 1; | |||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | __END__ | ||||||||||||||||||||||||||||