| 1 | package ExtUtils::Builder::Profile::Perl; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 1 | $ExtUtils::Builder::Profile::Perl::VERSION = '0.038'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use ExtUtils::Builder::Util 0.018 'split_like_shell'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use File::Basename 'dirname'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use File::Spec::Functions qw/catdir/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 4 | ▶ | sub _get_var { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_var: called CC=2 SCAR=8.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 4 | my ($config, $opts, $key) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 4 | ▶ | return delete $opts->{$key} // $config->get($key); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
delete $opts->{$key} // $config->get($key)
MC/DC0%0/2
delete $opts->{$key} // $config->get($key)
delete $opts->{$key}
$config->get($key)
Truth table33%1/3
A // B
A= delete $opts->{$key}B= $config->get($key)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 3 | ▶ | sub _split_var { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_split_var: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 3 | my ($config, $opts, $key) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 3 | ▶ | return delete $opts->{$key} // [ split_like_shell($config->get($key)) ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
delete $opts->{$key} // [split_like_shell($config->get($key))]
MC/DC0%0/1
delete $opts->{$key} // [split_like_shell($config->get($key))]
delete $opts->{$key}
Truth table50%1/2
A
A= delete $opts->{$key}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 1 | ▶ | sub process_compiler { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
process_compiler: called CC=4 SCAR=14.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 1 | my ($class, $compiler, $opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 1 | my $config = delete $opts->{config}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 1 | my $incdir = catdir(_get_var($config, $opts, 'archlibexp'), 'CORE'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 1 | my $os = _get_var($config, $opts, 'osname'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 1 | my $osver = _get_var($config, $opts, 'osvers'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 1 | my ($osmajor) = $osver =~ /^(\d+)/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 1 | ▶ | if ($os eq 'darwin' && $^X eq '/usr/bin/perl' && $osmajor >= 18) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$os eq "darwin" and $^X eq "/usr/bin/perl" and $osmajor >= 18
$os eq "darwin" and $^X eq "/usr/bin/perl"
MC/DC0%0/3
$os eq "darwin" and $^X eq "/usr/bin/perl" and $osmajor >= 18
$os eq "darwin"
$^X eq "/usr/bin/perl"
$osmajor >= 18
Truth table25%1/4
A and B and C
A= $os eq "darwin"B= $^X eq "/usr/bin/perl"C= $osmajor >= 18
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | $compiler->add_argument(value => [ '-iwithsysroot', $incdir ], ranking => $compiler->default_include_ranking + 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 1 | ▶ | $compiler->add_include_dirs([$incdir], ranking => sub { $_[0] + 1 }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 1 | $compiler->add_argument(ranking => 60, value => _split_var($config, $opts, 'ccflags')); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 1 | $compiler->add_argument(ranking => 65, value => _split_var($config, $opts, 'optimize')); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 1 | my $rpath_regex = qr/ ( (?<! \w ) (?: -Wl,-R | -Wl,-rpath | -R\ ? ) \S+ ) /x; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 1 | my %needs_relinking = map { $_ => 1 } qw/MSWin32 cygwin aix VMS/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 1 | ▶ | sub process_linker { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
process_linker: called CC=11 SCAR=40.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 1 | my ($class, $linker, $opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 1 | my $config = delete $opts->{config}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 1 | $linker->add_argument(ranking => 60, value => _split_var($config, $opts, 'ldflags')); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 1 | ▶ | if ($linker->export eq 'some') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | $linker->add_option_filter(sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | my ($self, $from, $to, %opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | $opts{dl_name} //= $opts{module_name} if $opts{module_name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$opts{"dl_name"} //= $opts{"module_name"}
MC/DC0%0/2
$opts{"dl_name"} //= $opts{"module_name"}
$opts{"dl_name"}
$opts{"module_name"}
Truth table0%0/3
A //= B
A= $opts{"dl_name"}B= $opts{"module_name"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | $opts{dl_file} //= do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$opts{"dl_file"} //= do {
(my $short = $opts{"dl_name"}) =~ s/.*:://;
catdir(dirname($to), "$short")
}
MC/DC0%0/2
$opts{"dl_file"} //= do {
(my $short = $opts{"dl_name"}) =~ s/.*:://;
catdir(dirname($to), "$short")
}
$opts{"dl_file"}
do {
(my $short = $opts{"dl_name"}) =~ s/.*:://;
catdir(dirname($to), "$short")
}
Truth table0%0/3
A //= B
A= $opts{"dl_file"}B= do {
(my $short = $opts{"dl_name"}) =~ s/.*:://;
catdir(dirname($to), "$short")
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | (my $short = $opts{dl_name}) =~ s/.*:://; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | catdir(dirname($to), "$short"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | return ($from, $to, %opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 1 | my $os = _get_var($config, $opts, 'osname'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 1 | ▶ | my $needs_libperl = $needs_relinking{$os} || ($os eq 'android' && _get_var($config, $opts, 'useshrplib') eq 'true'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
$needs_relinking{$os} || $os eq 'android' && _get_var($config, $opts, 'useshrplib') eq 'true'
$os eq "android" and _get_var($config, $opts, "useshrplib") eq "true"
MC/DC0%0/3
$needs_relinking{$os} || $os eq 'android' && _get_var($config, $opts, 'useshrplib') eq 'true'
$needs_relinking{$os}
$os eq "android"
_get_var($config, $opts, "useshrplib") eq "true"
Truth table25%1/4
A || B and C
A= $needs_relinking{$os}B= $os eq "android"C= _get_var($config, $opts, "useshrplib") eq "true"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 1 | ▶ | if ($linker->type eq 'executable' or $linker->type eq 'shared-library' or ($linker->type eq 'loadable-object' and $needs_libperl)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
$linker->type eq "executable" or $linker->type eq "shared-library" or $linker->type eq "loadable-object" and $needs_libperl
$linker->type eq "executable" or $linker->type eq "shared-library"
$linker->type eq "loadable-object" and $needs_libperl
MC/DC0%0/4
$linker->type eq "executable" or $linker->type eq "shared-library" or $linker->type eq "loadable-object" and $needs_libperl
$linker->type eq "executable"
$linker->type eq "shared-library"
$linker->type eq "loadable-object"
$needs_libperl
Truth table20%1/5
A or B or C and D
A= $linker->type eq "executable"B= $linker->type eq "shared-library"C= $linker->type eq "loadable-object"D= $needs_libperl
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | my ($libperl, $libext, $so) = map { _get_var($config, $opts, $_) } qw/libperl lib_ext so/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | my ($lib) = $libperl =~ / \A (?:lib)? ( \w* perl \w* ) (?: \. $so | $libext) \b /msx; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | ▶ | $linker->add_libraries([$lib], ranking => sub { $_[0] - 1 }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | my $libdir = catdir(_get_var($config, $opts, 'archlibexp'), 'CORE'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | $linker->add_library_dirs([$libdir]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | $linker->add_argument(ranking => 80, value => _split_var($config, $opts, 'perllibs')); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 1 | ▶ | if ($linker->type eq 'executable') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | ▶ | my $rpath = $opts->{rpath} // [ split_like_shell($config->get('ccdlflags') =~ $rpath_regex) ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$opts->{"rpath"} // [split_like_shell($config->get("ccdlflags") =~ /$rpath_regex/)]
MC/DC0%0/1
$opts->{"rpath"} // [split_like_shell($config->get("ccdlflags") =~ /$rpath_regex/)]
$opts->{"rpath"}
Truth table0%0/2
A
A= $opts->{"rpath"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | ▶ | $linker->add_argument(ranking => 40, value => $rpath) if @{$rpath}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | # ABSTRACT: A profile for compiling and linking against perl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||