| 1 | package Alien::Base::Wrapper; | ||||||||||||||||||||||||||||
| 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.006; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use Config; | ||||||||||||||||||||||||||
|
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 | # NOTE: Although this module is now distributed with Alien-Build, | ||||||||||||||||||||||||||||
| 10 | # it should have NO non-perl-core dependencies for all Perls | ||||||||||||||||||||||||||||
| 11 | # 5.6.0-5.30.1 (as of this writing, and any Perl more recent). | ||||||||||||||||||||||||||||
| 12 | # You should be able to extract this module from the rest of | ||||||||||||||||||||||||||||
| 13 | # Alien-Build and use it by itself. (There is a dzil plugin | ||||||||||||||||||||||||||||
| 14 | # for this [AlienBase::Wrapper::Bundle] | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | # ABSTRACT: Compiler and linker wrapper for Alien | ||||||||||||||||||||||||||||
| 17 | 2 | our $VERSION = '2.88'; # VERSION | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | sub _version_parts | ||||||||||||||||||||||||||||
| 21 | 16 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
_version_parts: called CC=4 SCAR=14.0
| |||||||||||||||||||||||||||||
| 22 | 16 | my($version) = @_; | |||||||||||||||||||||||||||
| 23 | 16 | ▶ | $version = '0' unless defined $version; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | # dotted-decimal style, e.g. 1.2.3 or v1.2.3: compare each part | ||||||||||||||||||||||||||||
| 26 | # separately, as integers. | ||||||||||||||||||||||||||||
| 27 | 16 | ▶ | if($version =~ /^v?[0-9]+(\.[0-9]+){2,}$/) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 28 | { | ||||||||||||||||||||||||||||
| 29 | 3 | $version =~ s/^v//; | |||||||||||||||||||||||||||
| 30 | 3 | return [ split /\./, $version ]; | |||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | # plain decimal style, e.g. 1.00 or 6.52: compare numerically as | ||||||||||||||||||||||||||||
| 34 | # a single number, so that (say) 6.6 is newer than 6.52. | ||||||||||||||||||||||||||||
| 35 | 13 | my($number) = $version =~ /^([0-9]+(?:\.[0-9]+)?)/; | |||||||||||||||||||||||||||
| 36 | 13 | ▶ | $number = 0 unless defined $number; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 37 | 13 | return [ $number ]; | |||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | sub _version_cmp | ||||||||||||||||||||||||||||
| 41 | 8 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
_version_cmp: called CC=6 SCAR=18.2
| |||||||||||||||||||||||||||||
| 42 | 8 | my($v1, $v2) = @_; | |||||||||||||||||||||||||||
| 43 | 8 | my $p1 = _version_parts($v1); | |||||||||||||||||||||||||||
| 44 | 8 | my $p2 = _version_parts($v2); | |||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 8 | ▶ | for my $i (0 .. (@$p1 > @$p2 ? $#$p1 : $#$p2)) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 47 | { | ||||||||||||||||||||||||||||
| 48 | 10 | ▶ | my $n1 = defined $p1->[$i] ? $p1->[$i] : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 49 | 10 | ▶ | my $n2 = defined $p2->[$i] ? $p2->[$i] : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 50 | 10 | my $cmp = $n1 <=> $n2; | |||||||||||||||||||||||||||
| 51 | 10 | ▶ | return $cmp if $cmp; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 0 | return 0; | |||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | # returns whichever of the two version numbers is newer (either may | ||||||||||||||||||||||||||||
| 58 | # be undef, in which case the other, possibly also undef, is returned). | ||||||||||||||||||||||||||||
| 59 | sub _version_max | ||||||||||||||||||||||||||||
| 60 | 24 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
_version_max: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||
| 61 | 24 | my($v1, $v2) = @_; | |||||||||||||||||||||||||||
| 62 | 24 | ▶ | return $v2 unless defined $v1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 63 | 9 | ▶ | return $v1 unless defined $v2; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 64 | 8 | ▶ | return _version_cmp($v1, $v2) >= 0 ? $v1 : $v2; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | sub _join | ||||||||||||||||||||||||||||
| 68 | 68 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
_join: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 69 | join ' ', | ||||||||||||||||||||||||||||
| 70 | map { | ||||||||||||||||||||||||||||
| 71 | 68 | my $x = $_; | |||||||||||||||||||||||||||
| 72 | 106 | $x =~ s/(\s)/\\$1/g; | |||||||||||||||||||||||||||
| 73 | 106 | $x; | |||||||||||||||||||||||||||
| 74 | } @_; | ||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | sub new | ||||||||||||||||||||||||||||
| 78 | 16 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=18 SCAR=28.9
Pod
documented
| |||||||||||||||||||||||||||||
| 79 | 16 | my($class, @aliens) = @_; | |||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | 16 | my $export = 1; | |||||||||||||||||||||||||||
| 82 | 16 | my $writemakefile = 0; | |||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | 16 | my @cflags_I; | |||||||||||||||||||||||||||
| 85 | my @cflags_other; | ||||||||||||||||||||||||||||
| 86 | 16 | my @ldflags_L; | |||||||||||||||||||||||||||
| 87 | 16 | my @ldflags_l; | |||||||||||||||||||||||||||
| 88 | 16 | my @ldflags_other; | |||||||||||||||||||||||||||
| 89 | 16 | my %requires = ( | |||||||||||||||||||||||||||
| 90 | 'ExtUtils::MakeMaker' => '6.52', | ||||||||||||||||||||||||||||
| 91 | 'Alien::Base::Wrapper' => '1.97', | ||||||||||||||||||||||||||||
| 92 | ); | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | 16 | foreach my $alien (@aliens) | |||||||||||||||||||||||||||
| 95 | { | ||||||||||||||||||||||||||||
| 96 | 13 | ▶ | if($alien eq '!export') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 97 | { | ||||||||||||||||||||||||||||
| 98 | 1 | $export = 0; | |||||||||||||||||||||||||||
| 99 | 1 | next; | |||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||
| 101 | 12 | ▶ | if($alien eq 'WriteMakefile') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 102 | { | ||||||||||||||||||||||||||||
| 103 | 1 | $writemakefile = 1; | |||||||||||||||||||||||||||
| 104 | 1 | next; | |||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||
| 106 | 11 | my $version = 0; | |||||||||||||||||||||||||||
| 107 | 11 | ▶ | if($alien =~ s/=(.*)$//) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 108 | { | ||||||||||||||||||||||||||||
| 109 | 3 | $version = $1; | |||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||
| 111 | 11 | ▶ | $alien = "Alien::$alien" unless $alien =~ /::/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 112 | 11 | $requires{$alien} = $version; | |||||||||||||||||||||||||||
| 113 | 11 | my $alien_pm = $alien . '.pm'; | |||||||||||||||||||||||||||
| 114 | 11 | $alien_pm =~ s/::/\//g; | |||||||||||||||||||||||||||
| 115 | 11 | ▶ | require $alien_pm unless eval { $alien->can('cflags') } && eval { $alien->can('libs') }; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
eval {
do {
$alien->can("cflags")
}
} and eval {
do {
$alien->can("libs")
}
}
MC/DC0%0/2
eval {
do {
$alien->can("cflags")
}
} and eval {
do {
$alien->can("libs")
}
}
eval {
do {
$alien->can("cflags")
}
}
eval {
do {
$alien->can("libs")
}
}
Truth table33%1/3
A and B
A= eval {
do {
$alien->can("cflags")
}
}B= eval {
do {
$alien->can("libs")
}
}
| |||||||||||||||||||||||||||||
| 116 | 11 | my $cflags; | |||||||||||||||||||||||||||
| 117 | my $libs; | ||||||||||||||||||||||||||||
| 118 | 11 | ▶ | if($alien->install_type eq 'share' && $alien->can('cflags_static')) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$alien->install_type eq "share" and $alien->can("cflags_static")
MC/DC100%2/2
$alien->install_type eq "share" and $alien->can("cflags_static")
$alien->install_type eq "share"
$alien->can("cflags_static")
Truth table100%3/3
A and B
A= $alien->install_type eq "share"B= $alien->can("cflags_static")
| |||||||||||||||||||||||||||||
| 119 | { | ||||||||||||||||||||||||||||
| 120 | 1 | $cflags = $alien->cflags_static; | |||||||||||||||||||||||||||
| 121 | 1 | $libs = $alien->libs_static; | |||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||
| 123 | else | ||||||||||||||||||||||||||||
| 124 | { | ||||||||||||||||||||||||||||
| 125 | 10 | $cflags = $alien->cflags; | |||||||||||||||||||||||||||
| 126 | 10 | $libs = $alien->libs; | |||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||
| 129 | 11 | ▶ | $cflags = '' unless defined $cflags; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 130 | 11 | ▶ | $libs = '' unless defined $libs; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | 11 | push @cflags_I, grep /^-I/, shellwords $cflags; | |||||||||||||||||||||||||||
| 133 | 11 | push @cflags_other, grep !/^-I/, shellwords $cflags; | |||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | 11 | push @ldflags_L, grep /^-L/, shellwords $libs; | |||||||||||||||||||||||||||
| 136 | 11 | push @ldflags_l, grep /^-l/, shellwords $libs; | |||||||||||||||||||||||||||
| 137 | 11 | push @ldflags_other, grep !/^-[Ll]/, shellwords $libs; | |||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||
| 140 | 16 | my @cflags_define = grep /^-D/, @cflags_other; | |||||||||||||||||||||||||||
| 141 | 16 | my @cflags_other2 = grep !/^-D/, @cflags_other; | |||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | 16 | my @mm; | |||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | 16 | ▶ | push @mm, INC => _join @cflags_I if @cflags_I; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 146 | 16 | ▶ | push @mm, CCFLAGS => _join(@cflags_other2) . " $Config{ccflags}" if @cflags_other2; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 147 | 16 | ▶ | push @mm, DEFINE => _join(@cflags_define) if @cflags_define; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | # TODO: handle spaces in -L paths | ||||||||||||||||||||||||||||
| 150 | 16 | push @mm, LIBS => ["@ldflags_L @ldflags_l"]; | |||||||||||||||||||||||||||
| 151 | 16 | my @ldflags = (@ldflags_L, @ldflags_other); | |||||||||||||||||||||||||||
| 152 | 16 | ▶ | push @mm, LDDLFLAGS => _join(@ldflags) . " $Config{lddlflags}" if @ldflags; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 153 | 16 | ▶ | push @mm, LDFLAGS => _join(@ldflags) . " $Config{ldflags}" if @ldflags; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | 16 | my @mb; | |||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||
| 157 | 16 | push @mb, extra_compiler_flags => _join(@cflags_I, @cflags_other); | |||||||||||||||||||||||||||
| 158 | 16 | push @mb, extra_linker_flags => _join(@ldflags_l); | |||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | 16 | ▶ | if(@ldflags) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 161 | { | ||||||||||||||||||||||||||||
| 162 | 6 | push @mb, config => { | |||||||||||||||||||||||||||
| 163 | lddlflags => _join(@ldflags) . " $Config{lddlflags}", | ||||||||||||||||||||||||||||
| 164 | ldflags => _join(@ldflags) . " $Config{ldflags}", | ||||||||||||||||||||||||||||
| 165 | }, | ||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||
| 168 | bless { | ||||||||||||||||||||||||||||
| 169 | 16 | cflags_I => \@cflags_I, | |||||||||||||||||||||||||||
| 170 | cflags_other => \@cflags_other, | ||||||||||||||||||||||||||||
| 171 | ldflags_L => \@ldflags_L, | ||||||||||||||||||||||||||||
| 172 | ldflags_l => \@ldflags_l, | ||||||||||||||||||||||||||||
| 173 | ldflags_other => \@ldflags_other, | ||||||||||||||||||||||||||||
| 174 | mm => \@mm, | ||||||||||||||||||||||||||||
| 175 | mb => \@mb, | ||||||||||||||||||||||||||||
| 176 | _export => $export, | ||||||||||||||||||||||||||||
| 177 | _writemakefile => $writemakefile, | ||||||||||||||||||||||||||||
| 178 | requires => \%requires, | ||||||||||||||||||||||||||||
| 179 | }, $class; | ||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | 2 | my $default_abw = __PACKAGE__->new; | |||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | # for testing only | ||||||||||||||||||||||||||||
| 185 | 4 | ▶ | sub _reset { __PACKAGE__->new } | ||||||||||||||||||||||||||
|
Subroutine
_reset: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | sub _myexec | ||||||||||||||||||||||||||||
| 189 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
_myexec: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||
| 190 | 0 | my @command = @_; | |||||||||||||||||||||||||||
| 191 | 0 | ▶ | if($^O eq 'MSWin32') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 192 | { | ||||||||||||||||||||||||||||
| 193 | # To handle weird quoting on MSWin32 | ||||||||||||||||||||||||||||
| 194 | # this logic needs to be improved. | ||||||||||||||||||||||||||||
| 195 | 0 | my $command = "@command"; | |||||||||||||||||||||||||||
| 196 | 0 | $command =~ s{"}{\\"}g; | |||||||||||||||||||||||||||
| 197 | 0 | system $command; | |||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||
| 199 | 0 | ▶ | if($? == -1 ) | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 200 | { | ||||||||||||||||||||||||||||
| 201 | 0 | die "failed to execute: $!\n"; | |||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||
| 203 | elsif($? & 127) | ||||||||||||||||||||||||||||
| 204 | { | ||||||||||||||||||||||||||||
| 205 | 0 | die "child died with signal @{[ $? & 128 ]}"; | |||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||
| 207 | else | ||||||||||||||||||||||||||||
| 208 | { | ||||||||||||||||||||||||||||
| 209 | 0 | exit($? >> 8); | |||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||
| 212 | else | ||||||||||||||||||||||||||||
| 213 | { | ||||||||||||||||||||||||||||
| 214 | 0 | exec @command; | |||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||
| 218 | sub cc | ||||||||||||||||||||||||||||
| 219 | 4 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
cc: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 220 | my @command = ( | ||||||||||||||||||||||||||||
| 221 | shellwords($Config{cc}), | ||||||||||||||||||||||||||||
| 222 | 4 | @{ $default_abw->{cflags_I} }, | |||||||||||||||||||||||||||
| 223 | 4 | @{ $default_abw->{cflags_other} }, | |||||||||||||||||||||||||||
| 224 | @ARGV, | ||||||||||||||||||||||||||||
| 225 | ); | ||||||||||||||||||||||||||||
| 226 | 4 | ▶ | print "@command\n" unless $ENV{ALIEN_BASE_WRAPPER_QUIET}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 227 | 4 | _myexec @command; | |||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||
| 231 | sub ld | ||||||||||||||||||||||||||||
| 232 | 4 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
ld: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 233 | my @command = ( | ||||||||||||||||||||||||||||
| 234 | shellwords($Config{ld}), | ||||||||||||||||||||||||||||
| 235 | 4 | @{ $default_abw->{ldflags_L} }, | |||||||||||||||||||||||||||
| 236 | 4 | @{ $default_abw->{ldflags_other} }, | |||||||||||||||||||||||||||
| 237 | @ARGV, | ||||||||||||||||||||||||||||
| 238 | 4 | @{ $default_abw->{ldflags_l} }, | |||||||||||||||||||||||||||
| 239 | ); | ||||||||||||||||||||||||||||
| 240 | 4 | ▶ | print "@command\n" unless $ENV{ALIEN_BASE_WRAPPER_QUIET}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 241 | 4 | _myexec @command; | |||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||
| 245 | sub mm_args | ||||||||||||||||||||||||||||
| 246 | 1 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
mm_args: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||
| 247 | 1 | ▶ | my $self = ref $_[0] ? shift : $default_abw; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 248 | 1 | @{ $self->{mm} }; | |||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||
| 252 | sub mm_args2 | ||||||||||||||||||||||||||||
| 253 | 4 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
mm_args2: called CC=6 SCAR=18.0
Pod
documented
| |||||||||||||||||||||||||||||
| 254 | 4 | my $self = shift; | |||||||||||||||||||||||||||
| 255 | 4 | ▶ | $self = $default_abw unless ref $self; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 256 | 4 | my %args = @_; | |||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||
| 258 | 4 | my @mm = @{ $self->{mm} }; | |||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||
| 260 | 4 | ▶ | while(@mm) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 261 | { | ||||||||||||||||||||||||||||
| 262 | 20 | my $key = shift @mm; | |||||||||||||||||||||||||||
| 263 | 20 | my $value = shift @mm; | |||||||||||||||||||||||||||
| 264 | 20 | ▶ | if(defined $args{$key}) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 265 | { | ||||||||||||||||||||||||||||
| 266 | 3 | ▶ | if($args{$key} eq 'LIBS') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 267 | { | ||||||||||||||||||||||||||||
| 268 | 0 | require Carp; | |||||||||||||||||||||||||||
| 269 | # Todo: support this maybe? | ||||||||||||||||||||||||||||
| 270 | 0 | Carp::croak("please do not specify your own LIBS key with mm_args2"); | |||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||
| 272 | else | ||||||||||||||||||||||||||||
| 273 | { | ||||||||||||||||||||||||||||
| 274 | 3 | $args{$key} = join ' ', $value, $args{$key}; | |||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||
| 277 | else | ||||||||||||||||||||||||||||
| 278 | { | ||||||||||||||||||||||||||||
| 279 | 17 | $args{$key} = $value; | |||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||
| 283 | 4 | foreach my $module (keys %{ $self->{requires} }) | |||||||||||||||||||||||||||
| 284 | { | ||||||||||||||||||||||||||||
| 285 | $args{CONFIGURE_REQUIRES}->{$module} = _version_max( | ||||||||||||||||||||||||||||
| 286 | $args{CONFIGURE_REQUIRES}->{$module}, | ||||||||||||||||||||||||||||
| 287 | 16 | $self->{requires}->{$module}, | |||||||||||||||||||||||||||
| 288 | ); | ||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||
| 291 | 4 | %args; | |||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||
| 295 | sub checklib_args2 | ||||||||||||||||||||||||||||
| 296 | 3 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
checklib_args2: called CC=15 SCAR=29.1
Pod
documented
| |||||||||||||||||||||||||||||
| 297 | 3 | my $self = shift; | |||||||||||||||||||||||||||
| 298 | 3 | ▶ | $self = $default_abw unless ref $self; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 299 | 3 | my %args = @_; | |||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||
| 301 | 3 | ▶ | if(defined $args{LIBS} || defined $args{INC}) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $args{"LIBS"} or defined $args{"INC"}
MC/DC100%2/2
defined $args{"LIBS"} or defined $args{"INC"}
defined $args{"LIBS"}
defined $args{"INC"}
Truth table100%3/3
A or B
A= defined $args{"LIBS"}B= defined $args{"INC"}
| |||||||||||||||||||||||||||||
| 302 | { | ||||||||||||||||||||||||||||
| 303 | 2 | require Carp; | |||||||||||||||||||||||||||
| 304 | 2 | Carp::croak("please do not specify your own LIBS or INC key with checklib_args2"); | |||||||||||||||||||||||||||
| 305 | } | ||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||
| 307 | 1 | ▶ | if(@{ $self->{cflags_I} }) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 308 | { | ||||||||||||||||||||||||||||
| 309 | 0 | ▶ | my @old = defined $args{incpath} ? (ref $args{incpath} ? @{ $args{incpath} } : ($args{incpath})) : (); | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 310 | 1 | my @new = map { (my $x = $_) =~ s/^-I//; $x } @{ $self->{cflags_I} }; | |||||||||||||||||||||||||||
| 311 | 1 | $args{incpath} = [ @new, @old ]; | |||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||
| 314 | 1 | ▶ | if(@{ $self->{cflags_other} }) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 315 | { | ||||||||||||||||||||||||||||
| 316 | 1 | ▶ | $args{ccflags} = join ' ', @{ $self->{cflags_other} }, (defined $args{ccflags} ? $args{ccflags} : ()); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||
| 319 | 1 | ▶ | if(@{ $self->{ldflags_L} }) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 320 | { | ||||||||||||||||||||||||||||
| 321 | 0 | ▶ | my @old = defined $args{libpath} ? (ref $args{libpath} ? @{ $args{libpath} } : ($args{libpath})) : (); | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 322 | 1 | my @new = map { (my $x = $_) =~ s/^-L//; $x } @{ $self->{ldflags_L} }; | |||||||||||||||||||||||||||
| 323 | 1 | $args{libpath} = [ @new, @old ]; | |||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||
| 326 | 0 | ▶ | if(@{ $self->{ldflags_l} } || @{ $self->{ldflags_other} }) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@{$self->{"ldflags_l"};} or @{$self->{"ldflags_other"};}
MC/DC0%0/2
@{$self->{"ldflags_l"};} or @{$self->{"ldflags_other"};}
@{$self->{"ldflags_l"};}
@{$self->{"ldflags_other"};}
Truth table33%1/3
A or B
A= @{$self->{"ldflags_l"};}B= @{$self->{"ldflags_other"};}
| |||||||||||||||||||||||||||||
| 327 | { | ||||||||||||||||||||||||||||
| 328 | 1 | ▶ | $args{ldflags} = join ' ', @{ $self->{ldflags_l} }, @{ $self->{ldflags_other} }, (defined $args{ldflags} ? $args{ldflags} : ()); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||
| 331 | 1 | %args; | |||||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||
| 335 | sub mb_args | ||||||||||||||||||||||||||||
| 336 | 1 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
mb_args: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||
| 337 | 1 | ▶ | my $self = ref $_[0] ? shift : $default_abw; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 338 | 1 | @{ $self->{mb} }; | |||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||
| 341 | sub import | ||||||||||||||||||||||||||||
| 342 | 6 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
import: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 343 | 6 | shift; | |||||||||||||||||||||||||||
| 344 | 6 | my $abw = $default_abw = __PACKAGE__->new(@_); | |||||||||||||||||||||||||||
| 345 | 6 | ▶ | if($abw->_export) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 346 | { | ||||||||||||||||||||||||||||
| 347 | 6 | my $caller = caller; | |||||||||||||||||||||||||||
| 348 | 2 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 349 | 6 | *{"${caller}::cc"} = \&cc; | |||||||||||||||||||||||||||
| 350 | 6 | *{"${caller}::ld"} = \&ld; | |||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||
| 352 | 6 | ▶ | if($abw->_writemakefile) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 353 | { | ||||||||||||||||||||||||||||
| 354 | 1 | my $caller = caller; | |||||||||||||||||||||||||||
| 355 | 2 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 356 | 1 | *{"${caller}::WriteMakefile"} = \&WriteMakefile; | |||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||
| 358 | } | ||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||
| 361 | sub WriteMakefile | ||||||||||||||||||||||||||||
| 362 | 2 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
WriteMakefile: called CC=5 SCAR=16.8
Pod
documented
| |||||||||||||||||||||||||||||
| 363 | 2 | my %args = @_; | |||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||
| 365 | 2 | require ExtUtils::MakeMaker; | |||||||||||||||||||||||||||
| 366 | 2 | ExtUtils::MakeMaker->VERSION('6.52'); | |||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||
| 368 | 2 | my @aliens; | |||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||
| 370 | 2 | ▶ | if(my $reqs = delete $args{alien_requires}) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 371 | { | ||||||||||||||||||||||||||||
| 372 | 2 | ▶ | if(ref $reqs eq 'HASH') | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 373 | { | ||||||||||||||||||||||||||||
| 374 | @aliens = map { | ||||||||||||||||||||||||||||
| 375 | 1 | my $module = $_; | |||||||||||||||||||||||||||
| 376 | 2 | my $version = $reqs->{$module}; | |||||||||||||||||||||||||||
| 377 | 2 | ▶ | $version ? "$module=$version" : "$module"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 378 | } sort keys %$reqs; | ||||||||||||||||||||||||||||
| 379 | } | ||||||||||||||||||||||||||||
| 380 | elsif(ref $reqs eq 'ARRAY') | ||||||||||||||||||||||||||||
| 381 | { | ||||||||||||||||||||||||||||
| 382 | 1 | @aliens = @$reqs; | |||||||||||||||||||||||||||
| 383 | } | ||||||||||||||||||||||||||||
| 384 | else | ||||||||||||||||||||||||||||
| 385 | { | ||||||||||||||||||||||||||||
| 386 | 0 | require Carp; | |||||||||||||||||||||||||||
| 387 | 0 | Carp::croak("aliens_require must be either a hash or array reference"); | |||||||||||||||||||||||||||
| 388 | } | ||||||||||||||||||||||||||||
| 389 | } | ||||||||||||||||||||||||||||
| 390 | else | ||||||||||||||||||||||||||||
| 391 | { | ||||||||||||||||||||||||||||
| 392 | 0 | require Carp; | |||||||||||||||||||||||||||
| 393 | 0 | Carp::croak("You are using Alien::Base::Wrapper::WriteMakefile, but didn't specify any alien requirements"); | |||||||||||||||||||||||||||
| 394 | } | ||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||
| 396 | 2 | ExtUtils::MakeMaker::WriteMakefile( | |||||||||||||||||||||||||||
| 397 | Alien::Base::Wrapper->new(@aliens)->mm_args2(%args), | ||||||||||||||||||||||||||||
| 398 | ); | ||||||||||||||||||||||||||||
| 399 | } | ||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||
| 401 | 8 | ▶ | sub _export { shift->{_export} } | ||||||||||||||||||||||||||
|
Subroutine
_export: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 402 | 6 | ▶ | sub _writemakefile { shift->{_writemakefile} } | ||||||||||||||||||||||||||
|
Subroutine
_writemakefile: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||
| 404 | 2 | 1; | |||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||
| 406 | __END__ | ||||||||||||||||||||||||||||