| 1 | package ExtUtils::CBuilder::Base; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 5 | $ExtUtils::CBuilder::Base::VERSION = '0.280224'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 5 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 5 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 5 | ▶ | use File::Spec; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 5 | ▶ | use File::Basename; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 5 | ▶ | use Cwd (); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 5 | ▶ | use Config; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 5 | ▶ | use Text::ParseWords; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 5 | ▶ | use IPC::Cmd qw(can_run); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 5 | ▶ | use File::Temp qw(tempfile); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | # More details about C/C++ compilers: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | # http://developers.sun.com/sunstudio/documentation/product/compiler.jsp | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | # http://gcc.gnu.org/ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | # http://publib.boulder.ibm.com/infocenter/comphelp/v101v121/index.jsp | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | # http://msdn.microsoft.com/en-us/vstudio/default.aspx | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 5 | my %cc2cxx = ( | |||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | # first line order is important to support wrappers like in pkgsrc | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | cc => [ 'c++', 'CC', 'aCC', 'cxx', ], # Sun Studio, HP ANSI C/C++ Compilers | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | gcc => [ 'g++' ], # GNU Compiler Collection | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | xlc => [ 'xlC' ], # IBM C/C++ Set, xlc without thread-safety | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | xlc_r => [ 'xlC_r' ], # IBM C/C++ Set, xlc with thread-safety | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | cl => [ 'cl' ], # Microsoft Visual Studio | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 20 | ▶ | my $class = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=17 SCAR=34.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 20 | my $self = bless {@_}, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 20 | ▶ | $self->{properties}{perl} = $class->find_perl_interpreter | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | or warn "Warning: Can't locate your perl binary"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 20 | ▶ | while (my ($k,$v) = each %Config) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 25120 | ▶ | $self->{config}{$k} = $v unless exists $self->{config}{$k}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 20 | ▶ | $self->{config}{cc} = $ENV{CC} if defined $ENV{CC}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | $self->{config}{ccflags} = join(" ", $self->{config}{ccflags}, $ENV{CFLAGS}) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 20 | ▶ | if defined $ENV{CFLAGS}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 20 | ▶ | $self->{config}{cxx} = $ENV{CXX} if defined $ENV{CXX}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 20 | ▶ | $self->{config}{cxxflags} = $ENV{CXXFLAGS} if defined $ENV{CXXFLAGS}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 20 | ▶ | $self->{config}{ld} = $ENV{LD} if defined $ENV{LD}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | $self->{config}{ldflags} = join(" ", $self->{config}{ldflags}, $ENV{LDFLAGS}) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 20 | ▶ | if defined $ENV{LDFLAGS}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 20 | ▶ | unless ( exists $self->{config}{cxx} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 20 | my ($ccpath, $ccbase, $ccsfx ) = fileparse($self->{config}{cc}, qr/\.[^.]*/); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 20 | foreach my $cxx (@{$cc2cxx{$ccbase}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | if( can_run( File::Spec->catfile( $ccpath, $cxx, $ccsfx ) ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | $self->{config}{cxx} = File::Spec->catfile( $ccpath, $cxx, $ccsfx ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | ▶ | if( can_run( File::Spec->catfile( $cxx, $ccsfx ) ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | $self->{config}{cxx} = File::Spec->catfile( $cxx, $ccsfx ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | ▶ | if( can_run( $cxx ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | $self->{config}{cxx} = $cxx; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 20 | ▶ | unless ( exists $self->{config}{cxx} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 20 | $self->{config}{cxx} = $self->{config}{cc}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 20 | my $cflags = $self->{config}{ccflags}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 20 | $self->{config}{cxxflags} = '-x c++'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 20 | ▶ | $self->{config}{cxxflags} .= " $cflags" if defined $cflags; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 20 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | sub find_perl_interpreter { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 22 | ▶ | my $perl; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find_perl_interpreter: called CC=3 SCAR=11.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | File::Spec->file_name_is_absolute($perl = $^X) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | or -f ($perl = $Config::Config{perlpath}) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 22 | ▶ | or ($perl = $^X); # XXX how about using IPC::Cmd::can_run here? | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
"File::Spec"->file_name_is_absolute($perl = $^X) or -f ($perl = $Config::Config{"perlpath"})
MC/DC0%0/2
"File::Spec"->file_name_is_absolute($perl = $^X) or -f ($perl = $Config::Config{"perlpath"})
"File::Spec"->file_name_is_absolute($perl = $^X)
-f ($perl = $Config::Config{"perlpath"})
Truth table66%2/3
A or B
A= "File::Spec"->file_name_is_absolute($perl = $^X)B= -f ($perl = $Config::Config{"perlpath"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 22 | return $perl; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | sub add_to_cleanup { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_to_cleanup: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 1 | foreach (@_) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 1 | $self->{files_to_clean}{$_} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | sub cleanup { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 21 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cleanup: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 21 | foreach my $file (keys %{$self->{files_to_clean}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 2 | unlink $file; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | sub get_config { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | ▶ | return %{ $_[0]->{config} }; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_config: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | sub object_file { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 13 | ▶ | my ($self, $filename) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
object_file: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | # File name, minus the suffix | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 13 | (my $file_base = $filename) =~ s/\.[^.]+$//; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 13 | return "$file_base$self->{config}{obj_ext}"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | sub arg_include_dirs { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 12 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
arg_include_dirs: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 12 | return map {"-I$_"} @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 12 | ▶ | sub arg_nolink { '-c' } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
arg_nolink: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | sub arg_object_file { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 12 | ▶ | my ($self, $file) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
arg_object_file: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 12 | return ('-o', $file); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | sub arg_share_object_file { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 6 | ▶ | my ($self, $file) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
arg_share_object_file: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 6 | return ($self->split_like_shell($self->{config}{lddlflags}), '-o', $file); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | sub arg_exec_file { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 2 | ▶ | my ($self, $file) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
arg_exec_file: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 2 | return ('-o', $file); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | sub arg_defines { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 13 | ▶ | my ($self, %args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
arg_defines: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 13 | return map "-D$_=$args{$_}", sort keys %args; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | sub compile { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 12 | ▶ | my ($self, %args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
compile: called CC=10 SCAR=23.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 12 | ▶ | die "Missing 'source' argument to compile()" unless defined $args{source}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 11 | my $cf = $self->{config}; # For convenience | |||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | my $object_file = $args{object_file} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | ? $args{object_file} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 11 | ▶ | : $self->object_file($args{source}); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | my $include_dirs_ref = | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | (exists($args{include_dirs}) && ref($args{include_dirs}) ne "ARRAY") | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | ? [ $args{include_dirs} ] | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 11 | ▶ | : $args{include_dirs}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
exists $args{"include_dirs"} and ref $args{"include_dirs"} ne "ARRAY"
MC/DC100%2/2
exists $args{"include_dirs"} and ref $args{"include_dirs"} ne "ARRAY"
exists $args{"include_dirs"}
ref $args{"include_dirs"} ne "ARRAY"
Truth table100%3/3
A and B
A= exists $args{"include_dirs"}B= ref $args{"include_dirs"} ne "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | my @include_dirs = $self->arg_include_dirs( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 11 | ▶ | @{ $include_dirs_ref || [] }, | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | $self->perl_inc(), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 11 | ▶ | my @defines = $self->arg_defines( %{$args{defines} || {}} ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | my @extra_compiler_flags = | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 11 | $self->split_like_shell($args{extra_compiler_flags}); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 11 | my @cccdlflags = $self->split_like_shell($cf->{cccdlflags}); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 11 | ▶ | my @ccflags = $self->split_like_shell($args{'C++'} ? $cf->{cxxflags} : $cf->{ccflags}); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 11 | my @optimize = $self->split_like_shell($cf->{optimize}); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 11 | my @flags = ( | |||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | @include_dirs, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | @defines, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | @cccdlflags, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | @extra_compiler_flags, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | $self->arg_nolink, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | @ccflags, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | @optimize, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | $self->arg_object_file($object_file), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 11 | ▶ | my @cc = $self->split_like_shell($args{'C++'} ? $cf->{cxx} : $cf->{cc}); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | $self->do_system(@cc, @flags, $args{source}) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 11 | ▶ | or die "error building $object_file from '$args{source}'"; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 8 | return $object_file; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | sub have_compiler { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 8 | ▶ | my ($self, $is_cplusplus) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
have_compiler: called CC=8 SCAR=20.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 8 | ▶ | my $have_compiler_flag = $is_cplusplus ? "have_cxx" : "have_cc"; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 8 | ▶ | my $suffix = $is_cplusplus ? ".cc" : ".c"; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 8 | ▶ | return $self->{$have_compiler_flag} if defined $self->{$have_compiler_flag}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 7 | my $result; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 7 | my $attempts = 3; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | # tmpdir has issues for some people so fall back to current dir | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | # don't clobber existing files (rare, but possible) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 7 | my ( $FH, $tmpfile ) = tempfile( "compilet-XXXXX", SUFFIX => $suffix ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 7 | binmode $FH; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 7 | ▶ | if ( $is_cplusplus ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 3 | print $FH "class Bogus { public: int boot_compilet() { return 1; } };\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 4 | print $FH "int boot_compilet() { return 1; }\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 7 | close $FH; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 7 | my ($obj_file, @lib_files); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 7 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 7 | local $^W = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 7 | local $self->{quiet} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 7 | $obj_file = $self->compile('C++' => $is_cplusplus, source => $tmpfile); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 4 | @lib_files = $self->link(objects => $obj_file, module_name => 'compilet'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 7 | ▶ | $result = $@ ? 0 : 1; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 7 | foreach (grep defined, $tmpfile, $obj_file, @lib_files) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 15 | ▶ | 1 while unlink; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 7 | return $self->{$have_compiler_flag} = $result; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | sub have_cplusplus { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 3 | ▶ | push @_, 1; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
have_cplusplus: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 3 | goto &have_compiler; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | sub lib_file { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 6 | ▶ | my ($self, $dl_file, %args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
lib_file: called CC=4 SCAR=16.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 6 | $dl_file =~ s/\.[^.]+$//; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 6 | $dl_file =~ tr/"//d; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 6 | ▶ | if (defined $args{module_name} and length $args{module_name}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $args{"module_name"} and length $args{"module_name"}
MC/DC0%0/2
defined $args{"module_name"} and length $args{"module_name"}
defined $args{"module_name"}
length $args{"module_name"}
Truth table33%1/3
A and B
A= defined $args{"module_name"}B= length $args{"module_name"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | # Need to create with the same name as DynaLoader will load with. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 6 | require DynaLoader; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 6 | ▶ | if (defined &DynaLoader::mod2fname) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | my $lib = DynaLoader::mod2fname([split /::/, $args{module_name}]); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | my ($dev, $lib_dir, undef) = File::Spec->splitpath($dl_file); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | $dl_file = File::Spec->catpath($dev, $lib_dir, $lib); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 6 | $dl_file .= ".$self->{config}{dlext}"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 6 | return $dl_file; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | sub exe_file { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 1 | ▶ | my ($self, $dl_file) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
exe_file: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 1 | $dl_file =~ s/\.[^.]+$//; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 1 | $dl_file =~ tr/"//d; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 1 | return "$dl_file$self->{config}{_exe}"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 5 | ▶ | sub need_prelink { 0 } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
need_prelink: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 6 | ▶ | sub extra_link_args_after_prelink { return } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
extra_link_args_after_prelink: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | sub prelink { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | ▶ | my ($self, %args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prelink: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | my ($dl_file_out, $mksymlists_args) = _prepare_mksymlists_args(\%args); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | require ExtUtils::Mksymlists; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | # dl. abbrev for dynamic library | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | ExtUtils::Mksymlists::Mksymlists( %{ $mksymlists_args } ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | # Mksymlists will create one of these files | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | return grep -e, map "$dl_file_out.$_", qw(ext def opt); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | sub _prepare_mksymlists_args { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 2 | ▶ | my $args = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_prepare_mksymlists_args: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 2 | ▶ | ($args->{dl_file} = $args->{dl_name}) =~ s/.*::// unless $args->{dl_file}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | my %mksymlists_args = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | DL_VARS => $args->{dl_vars} || [], | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | DL_FUNCS => $args->{dl_funcs} || {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | FUNCLIST => $args->{dl_func_list} || [], | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | IMPORTS => $args->{dl_imports} || {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | NAME => $args->{dl_name}, # Name of the Perl module | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | DLBASE => $args->{dl_base}, # Basename of DLL file | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | FILE => $args->{dl_file}, # Dir + Basename of symlist file | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 2 | ▶ | VERSION => (defined $args->{dl_version} ? $args->{dl_version} : '0.0'), | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%8/8
$args->{'dl_vars'} || []
$args->{'dl_funcs'} || {}
$args->{'dl_func_list'} || []
$args->{'dl_imports'} || {}
MC/DC100%1/1
$args->{'dl_vars'} || []
$args->{'dl_vars'}
MC/DC100%1/1
$args->{'dl_funcs'} || {}
$args->{'dl_funcs'}
MC/DC100%1/1
$args->{'dl_func_list'} || []
$args->{'dl_func_list'}
MC/DC100%1/1
$args->{'dl_imports'} || {}
$args->{'dl_imports'}
Truth table100%2/2
A
A= $args->{'dl_vars'}
Truth table100%2/2
A
A= $args->{'dl_funcs'}
Truth table100%2/2
A
A= $args->{'dl_func_list'}
Truth table100%2/2
A
A= $args->{'dl_imports'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 2 | return ($args->{dl_file}, \%mksymlists_args); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | sub link { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 5 | ▶ | my ($self, %args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
link: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 5 | return $self->_do_link('lib_file', lddl => 1, %args); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | sub link_executable { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 1 | ▶ | my ($self, %args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
link_executable: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 1 | return $self->_do_link('exe_file', lddl => 0, %args); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | sub _do_link { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 6 | ▶ | my ($self, $type, %args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_do_link: called CC=8 SCAR=21.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 6 | my $cf = $self->{config}; # For convenience | |||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 6 | my $objects = delete $args{objects}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 6 | ▶ | $objects = [$objects] unless ref $objects; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 6 | ▶ | my $out = $args{$type} || $self->$type($objects->[0], %args); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$args{$type} || $self->$type($objects->[0], %args)
MC/DC0%0/2
$args{$type} || $self->$type($objects->[0], %args)
$args{$type}
$self->$type($objects->[0], %args)
Truth table33%1/3
A || B
A= $args{$type}B= $self->$type($objects->[0], %args)
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 6 | my @temp_files; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | @temp_files = | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | $self->prelink(%args, dl_name => $args{module_name}) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 6 | ▶ | if $args{lddl} && $self->need_prelink; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$args{"lddl"} and $self->need_prelink
MC/DC0%0/2
$args{"lddl"} and $self->need_prelink
$args{"lddl"}
$self->need_prelink
Truth table66%2/3
A and B
A= $args{"lddl"}B= $self->need_prelink
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | my @linker_flags = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | $self->split_like_shell($args{extra_linker_flags}), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | $self->extra_link_args_after_prelink( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 6 | %args, dl_name => $args{module_name}, prelink_res => \@temp_files | |||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | my @output = $args{lddl} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 6 | ▶ | ? $self->arg_share_object_file($out) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | : $self->arg_exec_file($out); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 6 | my @shrp = $self->split_like_shell($cf->{shrpenv}); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 6 | my @ld = $self->split_like_shell($cf->{ld}); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 6 | ▶ | $self->do_system(@shrp, @ld, @output, @$objects, @linker_flags) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | or die "error building $out from @$objects"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 6 | ▶ | return wantarray ? ($out, @temp_files) : $out; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | sub do_system { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 15 | ▶ | my ($self, @cmd) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
do_system: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 15 | ▶ | print "@cmd\n" if !$self->{quiet}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 15 | return !system(@cmd); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | sub split_like_shell { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 83 | ▶ | my ($self, $string) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
split_like_shell: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 83 | ▶ | return () unless defined($string); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 65 | ▶ | return @$string if UNIVERSAL::isa($string, 'ARRAY'); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 64 | $string =~ s/^\s+|\s+$//g; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 64 | ▶ | return () unless length($string); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | # Text::ParseWords replaces all 'escaped' characters with themselves, which completely | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | # breaks paths under windows. As such, we forcibly replace backwards slashes with forward | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | # slashes on windows. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 58 | ▶ | $string =~ s@\\@/@g if $^O eq 'MSWin32'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 58 | return Text::ParseWords::shellwords($string); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | # if building perl, perl's main source directory | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | sub perl_src { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | # N.B. makemaker actually searches regardless of PERL_CORE, but | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | # only squawks at not finding it if PERL_CORE is set | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 16 | ▶ | return unless $ENV{PERL_CORE}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
perl_src: called CC=6 SCAR=17.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 4 | my $Updir = File::Spec->updir; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 4 | my $dir = File::Spec->curdir; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | # Try up to 5 levels upwards | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 4 | for (0..10) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 34 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
-f "File::Spec"->catfile($dir, "config_h.SH") and -f "File::Spec"->catfile($dir, "perl.h") and -f "File::Spec"->catfile($dir, "lib", "Exporter.pm")
-f "File::Spec"->catfile($dir, "config_h.SH") and -f "File::Spec"->catfile($dir, "perl.h")
MC/DC100%3/3
-f "File::Spec"->catfile($dir, "config_h.SH") and -f "File::Spec"->catfile($dir, "perl.h") and -f "File::Spec"->catfile($dir, "lib", "Exporter.pm")
-f "File::Spec"->catfile($dir, "config_h.SH")
-f "File::Spec"->catfile($dir, "perl.h")
-f "File::Spec"->catfile($dir, "lib", "Exporter.pm")
Truth table100%4/4
A and B and C
A= -f "File::Spec"->catfile($dir, "config_h.SH")B= -f "File::Spec"->catfile($dir, "perl.h")C= -f "File::Spec"->catfile($dir, "lib", "Exporter.pm")
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | -f File::Spec->catfile($dir,"config_h.SH") | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | && | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | -f File::Spec->catfile($dir,"perl.h") | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | && | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | -f File::Spec->catfile($dir,"lib","Exporter.pm") | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 1 | return Cwd::realpath( $dir ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 33 | $dir = File::Spec->catdir($dir, $Updir); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 3 | warn "PERL_CORE is set but I can't find your perl source!\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 3 | return ''; # return empty string if $ENV{PERL_CORE} but can't find dir ??? | |||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | # directory of perl's include files | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | sub perl_inc { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 12 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
perl_inc: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 12 | ▶ | $self->perl_src() || File::Spec->catdir($self->{config}{archlibexp},"CORE"); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | sub DESTROY { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 20 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 20 | local($., $@, $!, $^E, $?); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 20 | $self->cleanup(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 5 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | # vim: ts=2 sw=2 et: | ||||||||||||||||||||||||||||||||||||||||||||||||||