| Filename | /usr/share/perl/5.36/ExtUtils/MakeMaker.pm |
| Statements | Executed 265 statements in 5.82ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 5.45ms | 29.1ms | ExtUtils::MakeMaker::BEGIN@10 |
| 1 | 1 | 1 | 437µs | 580µs | ExtUtils::MakeMaker::BEGIN@11 |
| 1 | 1 | 1 | 134µs | 134µs | ExtUtils::MakeMaker::full_setup |
| 1 | 1 | 1 | 8µs | 14µs | ExtUtils::MakeMaker::BEGIN@665 |
| 1 | 1 | 1 | 8µs | 10µs | ExtUtils::MakeMaker::BEGIN@4 |
| 1 | 1 | 1 | 7µs | 22µs | ExtUtils::MakeMaker::BEGIN@237 |
| 1 | 1 | 1 | 7µs | 9µs | ExtUtils::MakeMaker::BEGIN@1161 |
| 1 | 1 | 1 | 6µs | 24µs | ExtUtils::MakeMaker::BEGIN@978 |
| 1 | 1 | 1 | 6µs | 18µs | ExtUtils::MakeMaker::BEGIN@13 |
| 1 | 1 | 1 | 5µs | 5µs | ExtUtils::MakeMaker::BEGIN@7 |
| 1 | 1 | 1 | 5µs | 9µs | ExtUtils::MakeMaker::BEGIN@1178 |
| 1 | 1 | 1 | 5µs | 28µs | ExtUtils::MakeMaker::BEGIN@12 |
| 1 | 1 | 1 | 3µs | 15µs | ExtUtils::MakeMaker::BEGIN@5 |
| 1 | 1 | 1 | 600ns | 600ns | ExtUtils::MakeMaker::CORE:subst (opcode) |
| 1 | 1 | 1 | 400ns | 400ns | ExtUtils::MakeMaker::__ANON__ (xsub) |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MakeMaker::WriteEmptyMakefile |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MakeMaker::WriteMakefile |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MakeMaker::_MakeMaker_Parameters_section |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MakeMaker::__ANON__[:1175] |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MakeMaker::__ANON__[:472] |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MakeMaker::__ANON__[:527] |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MakeMaker::_convert_compat_attrs |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MakeMaker::_find_magic_vstring |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MakeMaker::_format_att |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MakeMaker::_has_cpan_meta_requirements |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MakeMaker::_installed_file_for_module |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MakeMaker::_is_of_type |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MakeMaker::_parse_line |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MakeMaker::_rename |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MakeMaker::_run_hintfile |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MakeMaker::_shellwords |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MakeMaker::_sprintf562 |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MakeMaker::_unlink |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MakeMaker::_verify_att |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MakeMaker::check_hints |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MakeMaker::check_manifest |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MakeMaker::eval_in_subdirs |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MakeMaker::eval_in_x |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MakeMaker::flush |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MakeMaker::mkbootstrap |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MakeMaker::mksymlists |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MakeMaker::mv_all_methods |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MakeMaker::neatvalue |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MakeMaker::new |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MakeMaker::open_for_writing |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MakeMaker::os_unsupported |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MakeMaker::parse_args |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MakeMaker::prompt |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MakeMaker::selfdocument |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MakeMaker::skipcheck |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MakeMaker::write_file_via_tmp |
| 0 | 0 | 0 | 0s | 0s | MY::__ANON__[:1191] |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | # $Id$ | ||||
| 2 | package ExtUtils::MakeMaker; | ||||
| 3 | |||||
| 4 | 2 | 17µs | 2 | 11µs | # spent 10µs (8+1) within ExtUtils::MakeMaker::BEGIN@4 which was called:
# once (8µs+1µs) by IPC::Cmd::can_run at line 4 # spent 10µs making 1 call to ExtUtils::MakeMaker::BEGIN@4
# spent 1µs making 1 call to strict::import |
| 5 | 2 | 16µs | 2 | 28µs | # spent 15µs (3+13) within ExtUtils::MakeMaker::BEGIN@5 which was called:
# once (3µs+13µs) by IPC::Cmd::can_run at line 5 # spent 15µs making 1 call to ExtUtils::MakeMaker::BEGIN@5
# spent 13µs making 1 call to warnings::import |
| 6 | |||||
| 7 | 1 | 19µs | 1 | 5µs | # spent 5µs within ExtUtils::MakeMaker::BEGIN@7 which was called:
# once (5µs+0s) by IPC::Cmd::can_run at line 7 # spent 5µs making 1 call to ExtUtils::MakeMaker::BEGIN@7 |
| 8 | |||||
| 9 | 1 | 800ns | require Exporter; | ||
| 10 | 2 | 162µs | 2 | 29.2ms | # spent 29.1ms (5.45+23.7) within ExtUtils::MakeMaker::BEGIN@10 which was called:
# once (5.45ms+23.7ms) by IPC::Cmd::can_run at line 10 # spent 29.1ms making 1 call to ExtUtils::MakeMaker::BEGIN@10
# spent 16µs making 1 call to ExtUtils::MakeMaker::Config::import |
| 11 | 2 | 136µs | 2 | 580µs | # spent 580µs (437+143) within ExtUtils::MakeMaker::BEGIN@11 which was called:
# once (437µs+143µs) by IPC::Cmd::can_run at line 11 # spent 580µs making 1 call to ExtUtils::MakeMaker::BEGIN@11
# spent 400ns making 1 call to ExtUtils::MakeMaker::__ANON__ |
| 12 | 2 | 15µs | 2 | 52µs | # spent 28µs (5+24) within ExtUtils::MakeMaker::BEGIN@12 which was called:
# once (5µs+24µs) by IPC::Cmd::can_run at line 12 # spent 28µs making 1 call to ExtUtils::MakeMaker::BEGIN@12
# spent 24µs making 1 call to Exporter::import |
| 13 | 2 | 585µs | 2 | 30µs | # spent 18µs (6+12) within ExtUtils::MakeMaker::BEGIN@13 which was called:
# once (6µs+12µs) by IPC::Cmd::can_run at line 13 # spent 18µs making 1 call to ExtUtils::MakeMaker::BEGIN@13
# spent 12µs making 1 call to Exporter::import |
| 14 | 2 | 107µs | my $CAN_DECODE = eval { require ExtUtils::MakeMaker::Locale; }; # 2 birds, 1 stone | ||
| 15 | 1 | 4µs | 2 | 22µs | eval { ExtUtils::MakeMaker::Locale::reinit('UTF-8') } # spent 21µs making 1 call to Encode::find_encoding
# spent 1µs making 1 call to Encode::Encoding::name |
| 16 | if $CAN_DECODE and Encode::find_encoding('locale')->name eq 'ascii'; | ||||
| 17 | |||||
| 18 | 1 | 300ns | our $Verbose = 0; # exported | ||
| 19 | our @Parent; # needs to be localized | ||||
| 20 | our @Get_from_Config; # referenced by MM_Unix | ||||
| 21 | our @MM_Sections; | ||||
| 22 | our @Overridable; | ||||
| 23 | 1 | 200ns | my @Prepend_parent; | ||
| 24 | my %Recognized_Att_Keys; | ||||
| 25 | our %macro_fsentity; # whether a macro is a filesystem name | ||||
| 26 | our %macro_dep; # whether a macro is a dependency | ||||
| 27 | |||||
| 28 | 1 | 300ns | our $VERSION = '7.64'; | ||
| 29 | 1 | 600ns | $VERSION =~ tr/_//d; | ||
| 30 | |||||
| 31 | # Emulate something resembling CVS $Revision$ | ||||
| 32 | 1 | 3µs | 1 | 600ns | (our $Revision = $VERSION) =~ s{_}{}; # spent 600ns making 1 call to ExtUtils::MakeMaker::CORE:subst |
| 33 | 1 | 2µs | $Revision = int $Revision * 10000; | ||
| 34 | |||||
| 35 | 1 | 300ns | our $Filename = __FILE__; # referenced outside MakeMaker | ||
| 36 | |||||
| 37 | 1 | 6µs | our @ISA = qw(Exporter); | ||
| 38 | 1 | 800ns | our @EXPORT = qw(&WriteMakefile $Verbose &prompt &os_unsupported); | ||
| 39 | 1 | 1µs | our @EXPORT_OK = qw($VERSION &neatvalue &mkbootstrap &mksymlists | ||
| 40 | &WriteEmptyMakefile &open_for_writing &write_file_via_tmp | ||||
| 41 | &_sprintf562); | ||||
| 42 | |||||
| 43 | # These will go away once the last of the Win32 & VMS specific code is | ||||
| 44 | # purged. | ||||
| 45 | 1 | 500ns | my $Is_VMS = $^O eq 'VMS'; | ||
| 46 | 1 | 300ns | my $Is_Win32 = $^O eq 'MSWin32'; | ||
| 47 | 1 | 1µs | our $UNDER_CORE = $ENV{PERL_CORE}; # needs to be our | ||
| 48 | |||||
| 49 | 1 | 1µs | 1 | 134µs | full_setup(); # spent 134µs making 1 call to ExtUtils::MakeMaker::full_setup |
| 50 | |||||
| 51 | 1 | 94µs | require ExtUtils::MM; # Things like CPAN assume loading ExtUtils::MakeMaker | ||
| 52 | # will give them MM. | ||||
| 53 | |||||
| 54 | 1 | 110µs | require ExtUtils::MY; # XXX pre-5.8 versions of ExtUtils::Embed expect | ||
| 55 | # loading ExtUtils::MakeMaker will give them MY. | ||||
| 56 | # This will go when Embed is its own CPAN module. | ||||
| 57 | |||||
| 58 | |||||
| 59 | # 5.6.2 can't do sprintf "%1$s" - this can only do %s | ||||
| 60 | sub _sprintf562 { | ||||
| 61 | my ($format, @args) = @_; | ||||
| 62 | for (my $i = 1; $i <= @args; $i++) { | ||||
| 63 | $format =~ s#%$i\$s#$args[$i-1]#g; | ||||
| 64 | } | ||||
| 65 | $format; | ||||
| 66 | } | ||||
| 67 | |||||
| 68 | sub WriteMakefile { | ||||
| 69 | croak "WriteMakefile: Need even number of args" if @_ % 2; | ||||
| 70 | |||||
| 71 | require ExtUtils::MY; | ||||
| 72 | my %att = @_; | ||||
| 73 | |||||
| 74 | _convert_compat_attrs(\%att); | ||||
| 75 | |||||
| 76 | _verify_att(\%att); | ||||
| 77 | |||||
| 78 | my $mm = MM->new(\%att); | ||||
| 79 | $mm->flush; | ||||
| 80 | |||||
| 81 | return $mm; | ||||
| 82 | } | ||||
| 83 | |||||
| 84 | |||||
| 85 | # Basic signatures of the attributes WriteMakefile takes. Each is the | ||||
| 86 | # reference type. Empty value indicate it takes a non-reference | ||||
| 87 | # scalar. | ||||
| 88 | 1 | 200ns | my %Att_Sigs; | ||
| 89 | 1 | 13µs | my %Special_Sigs = ( | ||
| 90 | AUTHOR => 'ARRAY', | ||||
| 91 | C => 'ARRAY', | ||||
| 92 | CONFIG => 'ARRAY', | ||||
| 93 | CONFIGURE => 'CODE', | ||||
| 94 | DIR => 'ARRAY', | ||||
| 95 | DL_FUNCS => 'HASH', | ||||
| 96 | DL_VARS => 'ARRAY', | ||||
| 97 | EXCLUDE_EXT => 'ARRAY', | ||||
| 98 | EXE_FILES => 'ARRAY', | ||||
| 99 | FUNCLIST => 'ARRAY', | ||||
| 100 | H => 'ARRAY', | ||||
| 101 | IMPORTS => 'HASH', | ||||
| 102 | INCLUDE_EXT => 'ARRAY', | ||||
| 103 | LIBS => ['ARRAY',''], | ||||
| 104 | MAN1PODS => 'HASH', | ||||
| 105 | MAN3PODS => 'HASH', | ||||
| 106 | META_ADD => 'HASH', | ||||
| 107 | META_MERGE => 'HASH', | ||||
| 108 | OBJECT => ['ARRAY', ''], | ||||
| 109 | PL_FILES => 'HASH', | ||||
| 110 | PM => 'HASH', | ||||
| 111 | PMLIBDIRS => 'ARRAY', | ||||
| 112 | PMLIBPARENTDIRS => 'ARRAY', | ||||
| 113 | PREREQ_PM => 'HASH', | ||||
| 114 | BUILD_REQUIRES => 'HASH', | ||||
| 115 | CONFIGURE_REQUIRES => 'HASH', | ||||
| 116 | TEST_REQUIRES => 'HASH', | ||||
| 117 | SKIP => 'ARRAY', | ||||
| 118 | TYPEMAPS => 'ARRAY', | ||||
| 119 | XS => 'HASH', | ||||
| 120 | XSBUILD => 'HASH', | ||||
| 121 | VERSION => ['version',''], | ||||
| 122 | _KEEP_AFTER_FLUSH => '', | ||||
| 123 | |||||
| 124 | clean => 'HASH', | ||||
| 125 | depend => 'HASH', | ||||
| 126 | dist => 'HASH', | ||||
| 127 | dynamic_lib=> 'HASH', | ||||
| 128 | linkext => 'HASH', | ||||
| 129 | macro => 'HASH', | ||||
| 130 | postamble => 'HASH', | ||||
| 131 | realclean => 'HASH', | ||||
| 132 | test => 'HASH', | ||||
| 133 | tool_autosplit => 'HASH', | ||||
| 134 | ); | ||||
| 135 | |||||
| 136 | 1 | 51µs | @Att_Sigs{keys %Recognized_Att_Keys} = ('') x keys %Recognized_Att_Keys; | ||
| 137 | 1 | 6µs | @Att_Sigs{keys %Special_Sigs} = values %Special_Sigs; | ||
| 138 | |||||
| 139 | sub _convert_compat_attrs { #result of running several times should be same | ||||
| 140 | my($att) = @_; | ||||
| 141 | if (exists $att->{AUTHOR}) { | ||||
| 142 | if ($att->{AUTHOR}) { | ||||
| 143 | if (!ref($att->{AUTHOR})) { | ||||
| 144 | my $t = $att->{AUTHOR}; | ||||
| 145 | $att->{AUTHOR} = [$t]; | ||||
| 146 | } | ||||
| 147 | } else { | ||||
| 148 | $att->{AUTHOR} = []; | ||||
| 149 | } | ||||
| 150 | } | ||||
| 151 | } | ||||
| 152 | |||||
| 153 | sub _verify_att { | ||||
| 154 | my($att) = @_; | ||||
| 155 | |||||
| 156 | foreach my $key (sort keys %$att) { | ||||
| 157 | my $val = $att->{$key}; | ||||
| 158 | my $sig = $Att_Sigs{$key}; | ||||
| 159 | unless( defined $sig ) { | ||||
| 160 | warn "WARNING: $key is not a known parameter.\n"; | ||||
| 161 | next; | ||||
| 162 | } | ||||
| 163 | |||||
| 164 | my @sigs = ref $sig ? @$sig : $sig; | ||||
| 165 | my $given = ref $val; | ||||
| 166 | unless( grep { _is_of_type($val, $_) } @sigs ) { | ||||
| 167 | my $takes = join " or ", map { _format_att($_) } @sigs; | ||||
| 168 | |||||
| 169 | my $has = _format_att($given); | ||||
| 170 | warn "WARNING: $key takes a $takes not a $has.\n". | ||||
| 171 | " Please inform the author.\n"; | ||||
| 172 | } | ||||
| 173 | } | ||||
| 174 | } | ||||
| 175 | |||||
| 176 | |||||
| 177 | # Check if a given thing is a reference or instance of $type | ||||
| 178 | sub _is_of_type { | ||||
| 179 | my($thing, $type) = @_; | ||||
| 180 | |||||
| 181 | return 1 if ref $thing eq $type; | ||||
| 182 | |||||
| 183 | local $SIG{__DIE__}; | ||||
| 184 | return 1 if eval{ $thing->isa($type) }; | ||||
| 185 | |||||
| 186 | return 0; | ||||
| 187 | } | ||||
| 188 | |||||
| 189 | |||||
| 190 | sub _format_att { | ||||
| 191 | my $given = shift; | ||||
| 192 | |||||
| 193 | return $given eq '' ? "string/number" | ||||
| 194 | : uc $given eq $given ? "$given reference" | ||||
| 195 | : "$given object" | ||||
| 196 | ; | ||||
| 197 | } | ||||
| 198 | |||||
| 199 | |||||
| 200 | sub prompt ($;$) { ## no critic | ||||
| 201 | my($mess, $def) = @_; | ||||
| 202 | confess("prompt function called without an argument") | ||||
| 203 | unless defined $mess; | ||||
| 204 | |||||
| 205 | my $isa_tty = -t STDIN && (-t STDOUT || !(-f STDOUT || -c STDOUT)) ; | ||||
| 206 | |||||
| 207 | my $dispdef = defined $def ? "[$def] " : " "; | ||||
| 208 | $def = defined $def ? $def : ""; | ||||
| 209 | |||||
| 210 | local $|=1; | ||||
| 211 | local $\; | ||||
| 212 | print "$mess $dispdef"; | ||||
| 213 | |||||
| 214 | my $ans; | ||||
| 215 | if ($ENV{PERL_MM_USE_DEFAULT} || (!$isa_tty && eof STDIN)) { | ||||
| 216 | print "$def\n"; | ||||
| 217 | } | ||||
| 218 | else { | ||||
| 219 | $ans = <STDIN>; | ||||
| 220 | if( defined $ans ) { | ||||
| 221 | $ans =~ s{\015?\012$}{}; | ||||
| 222 | } | ||||
| 223 | else { # user hit ctrl-D | ||||
| 224 | print "\n"; | ||||
| 225 | } | ||||
| 226 | } | ||||
| 227 | |||||
| 228 | return (!defined $ans || $ans eq '') ? $def : $ans; | ||||
| 229 | } | ||||
| 230 | |||||
| 231 | sub os_unsupported { | ||||
| 232 | die "OS unsupported\n"; | ||||
| 233 | } | ||||
| 234 | |||||
| 235 | sub eval_in_subdirs { | ||||
| 236 | my($self) = @_; | ||||
| 237 | 2 | 1.27ms | 2 | 37µs | # spent 22µs (7+15) within ExtUtils::MakeMaker::BEGIN@237 which was called:
# once (7µs+15µs) by IPC::Cmd::can_run at line 237 # spent 22µs making 1 call to ExtUtils::MakeMaker::BEGIN@237
# spent 15µs making 1 call to Exporter::import |
| 238 | my $pwd = cwd() || die "Can't figure out your cwd!"; | ||||
| 239 | |||||
| 240 | local @INC = map eval {abs_path($_) if -e} || $_, @INC; | ||||
| 241 | push @INC, '.'; # '.' has to always be at the end of @INC | ||||
| 242 | |||||
| 243 | foreach my $dir (@{$self->{DIR}}){ | ||||
| 244 | my($abs) = $self->catdir($pwd,$dir); | ||||
| 245 | eval { $self->eval_in_x($abs); }; | ||||
| 246 | last if $@; | ||||
| 247 | } | ||||
| 248 | chdir $pwd; | ||||
| 249 | die $@ if $@; | ||||
| 250 | } | ||||
| 251 | |||||
| 252 | sub eval_in_x { | ||||
| 253 | my($self,$dir) = @_; | ||||
| 254 | chdir $dir or carp("Couldn't change to directory $dir: $!"); | ||||
| 255 | |||||
| 256 | { | ||||
| 257 | package main; | ||||
| 258 | do './Makefile.PL'; | ||||
| 259 | }; | ||||
| 260 | if ($@) { | ||||
| 261 | # if ($@ =~ /prerequisites/) { | ||||
| 262 | # die "MakeMaker WARNING: $@"; | ||||
| 263 | # } else { | ||||
| 264 | # warn "WARNING from evaluation of $dir/Makefile.PL: $@"; | ||||
| 265 | # } | ||||
| 266 | die "ERROR from evaluation of $dir/Makefile.PL: $@"; | ||||
| 267 | } | ||||
| 268 | } | ||||
| 269 | |||||
| 270 | |||||
| 271 | # package name for the classes into which the first object will be blessed | ||||
| 272 | 1 | 300ns | my $PACKNAME = 'PACK000'; | ||
| 273 | |||||
| 274 | # spent 134µs within ExtUtils::MakeMaker::full_setup which was called:
# once (134µs+0s) by IPC::Cmd::can_run at line 49 | ||||
| 275 | 1 | 400ns | $Verbose ||= 0; | ||
| 276 | |||||
| 277 | 1 | 800ns | my @dep_macros = qw/ | ||
| 278 | PERL_INCDEP PERL_ARCHLIBDEP PERL_ARCHIVEDEP | ||||
| 279 | /; | ||||
| 280 | |||||
| 281 | 1 | 5µs | my @fs_macros = qw/ | ||
| 282 | FULLPERL XSUBPPDIR | ||||
| 283 | |||||
| 284 | INST_ARCHLIB INST_SCRIPT INST_BIN INST_LIB INST_MAN1DIR INST_MAN3DIR | ||||
| 285 | INSTALLDIRS | ||||
| 286 | DESTDIR PREFIX INSTALL_BASE | ||||
| 287 | PERLPREFIX SITEPREFIX VENDORPREFIX | ||||
| 288 | INSTALLPRIVLIB INSTALLSITELIB INSTALLVENDORLIB | ||||
| 289 | INSTALLARCHLIB INSTALLSITEARCH INSTALLVENDORARCH | ||||
| 290 | INSTALLBIN INSTALLSITEBIN INSTALLVENDORBIN | ||||
| 291 | INSTALLMAN1DIR INSTALLMAN3DIR | ||||
| 292 | INSTALLSITEMAN1DIR INSTALLSITEMAN3DIR | ||||
| 293 | INSTALLVENDORMAN1DIR INSTALLVENDORMAN3DIR | ||||
| 294 | INSTALLSCRIPT INSTALLSITESCRIPT INSTALLVENDORSCRIPT | ||||
| 295 | PERL_LIB PERL_ARCHLIB | ||||
| 296 | SITELIBEXP SITEARCHEXP | ||||
| 297 | |||||
| 298 | MAKE LIBPERL_A LIB PERL_SRC PERL_INC | ||||
| 299 | PPM_INSTALL_EXEC PPM_UNINSTALL_EXEC | ||||
| 300 | PPM_INSTALL_SCRIPT PPM_UNINSTALL_SCRIPT | ||||
| 301 | /; | ||||
| 302 | |||||
| 303 | 1 | 7µs | my @attrib_help = qw/ | ||
| 304 | |||||
| 305 | AUTHOR ABSTRACT ABSTRACT_FROM BINARY_LOCATION | ||||
| 306 | C CAPI CCFLAGS CONFIG CONFIGURE DEFINE DIR DISTNAME DISTVNAME | ||||
| 307 | DL_FUNCS DL_VARS | ||||
| 308 | EXCLUDE_EXT EXE_FILES FIRST_MAKEFILE | ||||
| 309 | FULLPERLRUN FULLPERLRUNINST | ||||
| 310 | FUNCLIST H IMPORTS | ||||
| 311 | |||||
| 312 | INC INCLUDE_EXT LDFROM LIBS LICENSE | ||||
| 313 | LINKTYPE MAKEAPERL MAKEFILE MAKEFILE_OLD MAN1PODS MAN3PODS MAP_TARGET | ||||
| 314 | META_ADD META_MERGE MIN_PERL_VERSION BUILD_REQUIRES CONFIGURE_REQUIRES | ||||
| 315 | MYEXTLIB NAME NEEDS_LINKING NOECHO NO_META NO_MYMETA NO_PACKLIST NO_PERLLOCAL | ||||
| 316 | NORECURS NO_VC OBJECT OPTIMIZE PERL_MALLOC_OK PERL PERLMAINCC PERLRUN | ||||
| 317 | PERLRUNINST PERL_CORE | ||||
| 318 | PERM_DIR PERM_RW PERM_RWX MAGICXS | ||||
| 319 | PL_FILES PM PM_FILTER PMLIBDIRS PMLIBPARENTDIRS POLLUTE | ||||
| 320 | PREREQ_FATAL PREREQ_PM PREREQ_PRINT PRINT_PREREQ PUREPERL_ONLY | ||||
| 321 | SIGN SKIP TEST_REQUIRES TYPEMAPS UNINST VERSION VERSION_FROM XS | ||||
| 322 | XSBUILD XSMULTI XSOPT XSPROTOARG XS_VERSION | ||||
| 323 | clean depend dist dynamic_lib linkext macro realclean tool_autosplit | ||||
| 324 | |||||
| 325 | MAN1EXT MAN3EXT | ||||
| 326 | |||||
| 327 | MACPERL_SRC MACPERL_LIB MACLIBS_68K MACLIBS_PPC MACLIBS_SC MACLIBS_MRC | ||||
| 328 | MACLIBS_ALL_68K MACLIBS_ALL_PPC MACLIBS_SHARED | ||||
| 329 | /; | ||||
| 330 | 1 | 3µs | push @attrib_help, @fs_macros; | ||
| 331 | 1 | 13µs | @macro_fsentity{@fs_macros, @dep_macros} = (1) x (@fs_macros+@dep_macros); | ||
| 332 | 1 | 900ns | @macro_dep{@dep_macros} = (1) x @dep_macros; | ||
| 333 | |||||
| 334 | # IMPORTS is used under OS/2 and Win32 | ||||
| 335 | |||||
| 336 | # @Overridable is close to @MM_Sections but not identical. The | ||||
| 337 | # order is important. Many subroutines declare macros. These | ||||
| 338 | # depend on each other. Let's try to collect the macros up front, | ||||
| 339 | # then pasthru, then the rules. | ||||
| 340 | |||||
| 341 | # MM_Sections are the sections we have to call explicitly | ||||
| 342 | # in Overridable we have subroutines that are used indirectly | ||||
| 343 | |||||
| 344 | |||||
| 345 | 1 | 4µs | @MM_Sections = | ||
| 346 | qw( | ||||
| 347 | |||||
| 348 | post_initialize const_config constants platform_constants | ||||
| 349 | tool_autosplit tool_xsubpp tools_other | ||||
| 350 | |||||
| 351 | makemakerdflt | ||||
| 352 | |||||
| 353 | dist macro depend cflags const_loadlibs const_cccmd | ||||
| 354 | post_constants | ||||
| 355 | |||||
| 356 | pasthru | ||||
| 357 | |||||
| 358 | special_targets | ||||
| 359 | c_o xs_c xs_o | ||||
| 360 | top_targets blibdirs linkext dlsyms dynamic_bs dynamic | ||||
| 361 | dynamic_lib static static_lib manifypods processPL | ||||
| 362 | installbin subdirs | ||||
| 363 | clean_subdirs clean realclean_subdirs realclean | ||||
| 364 | metafile signature | ||||
| 365 | dist_basics dist_core distdir dist_test dist_ci distmeta distsignature | ||||
| 366 | install force perldepend makefile staticmake test ppd | ||||
| 367 | |||||
| 368 | ); # loses section ordering | ||||
| 369 | |||||
| 370 | 1 | 2µs | @Overridable = @MM_Sections; | ||
| 371 | 1 | 2µs | push @Overridable, qw[ | ||
| 372 | |||||
| 373 | libscan makeaperl needs_linking | ||||
| 374 | subdir_x test_via_harness test_via_script | ||||
| 375 | |||||
| 376 | init_VERSION init_dist init_INST init_INSTALL init_DEST init_dirscan | ||||
| 377 | init_PM init_MANPODS init_xs init_PERL init_DIRFILESEP init_linker | ||||
| 378 | ]; | ||||
| 379 | |||||
| 380 | 1 | 300ns | push @MM_Sections, qw[ | ||
| 381 | |||||
| 382 | pm_to_blib selfdocument | ||||
| 383 | |||||
| 384 | ]; | ||||
| 385 | |||||
| 386 | # Postamble needs to be the last that was always the case | ||||
| 387 | 1 | 100ns | push @MM_Sections, "postamble"; | ||
| 388 | 1 | 100ns | push @Overridable, "postamble"; | ||
| 389 | |||||
| 390 | # All sections are valid keys. | ||||
| 391 | 1 | 14µs | @Recognized_Att_Keys{@MM_Sections} = (1) x @MM_Sections; | ||
| 392 | |||||
| 393 | # we will use all these variables in the Makefile | ||||
| 394 | 1 | 2µs | @Get_from_Config = | ||
| 395 | qw( | ||||
| 396 | ar cc cccdlflags ccdlflags cpprun dlext dlsrc exe_ext full_ar ld | ||||
| 397 | lddlflags ldflags libc lib_ext obj_ext osname osvers ranlib | ||||
| 398 | sitelibexp sitearchexp so | ||||
| 399 | ); | ||||
| 400 | |||||
| 401 | # 5.5.3 doesn't have any concept of vendor libs | ||||
| 402 | 1 | 2µs | push @Get_from_Config, qw( vendorarchexp vendorlibexp ) if "$]" >= 5.006; | ||
| 403 | |||||
| 404 | 1 | 700ns | foreach my $item (@attrib_help){ | ||
| 405 | 151 | 53µs | $Recognized_Att_Keys{$item} = 1; | ||
| 406 | } | ||||
| 407 | 1 | 400ns | foreach my $item (@Get_from_Config) { | ||
| 408 | 23 | 17µs | $Recognized_Att_Keys{uc $item} = $Config{$item}; | ||
| 409 | 23 | 2µs | print "Attribute '\U$item\E' => '$Config{$item}'\n" | ||
| 410 | if ($Verbose >= 2); | ||||
| 411 | } | ||||
| 412 | |||||
| 413 | # | ||||
| 414 | # When we eval a Makefile.PL in a subdirectory, that one will ask | ||||
| 415 | # us (the parent) for the values and will prepend "..", so that | ||||
| 416 | # all files to be installed end up below OUR ./blib | ||||
| 417 | # | ||||
| 418 | 1 | 6µs | @Prepend_parent = qw( | ||
| 419 | INST_BIN INST_LIB INST_ARCHLIB INST_SCRIPT | ||||
| 420 | MAP_TARGET INST_MAN1DIR INST_MAN3DIR PERL_SRC | ||||
| 421 | PERL FULLPERL | ||||
| 422 | ); | ||||
| 423 | } | ||||
| 424 | |||||
| 425 | sub _has_cpan_meta_requirements { | ||||
| 426 | return eval { | ||||
| 427 | require CPAN::Meta::Requirements; | ||||
| 428 | CPAN::Meta::Requirements->VERSION(2.130); | ||||
| 429 | # Make sure vstrings can be handled. Some versions of CMR require B to | ||||
| 430 | # do this, which won't be available in miniperl. | ||||
| 431 | CPAN::Meta::Requirements->new->add_string_requirement('Module' => v1.2); | ||||
| 432 | 1; | ||||
| 433 | }; | ||||
| 434 | } | ||||
| 435 | |||||
| 436 | sub new { | ||||
| 437 | my($class,$self) = @_; | ||||
| 438 | my($key); | ||||
| 439 | |||||
| 440 | _convert_compat_attrs($self) if defined $self && $self; | ||||
| 441 | |||||
| 442 | # Store the original args passed to WriteMakefile() | ||||
| 443 | foreach my $k (keys %$self) { | ||||
| 444 | $self->{ARGS}{$k} = $self->{$k}; | ||||
| 445 | } | ||||
| 446 | |||||
| 447 | $self = {} unless defined $self; | ||||
| 448 | |||||
| 449 | # Temporarily bless it into MM so it can be used as an | ||||
| 450 | # object. It will be blessed into a temp package later. | ||||
| 451 | bless $self, "MM"; | ||||
| 452 | |||||
| 453 | # Cleanup all the module requirement bits | ||||
| 454 | my %key2cmr; | ||||
| 455 | for my $key (qw(PREREQ_PM BUILD_REQUIRES CONFIGURE_REQUIRES TEST_REQUIRES)) { | ||||
| 456 | $self->{$key} ||= {}; | ||||
| 457 | if (_has_cpan_meta_requirements) { | ||||
| 458 | my $cmr = CPAN::Meta::Requirements->from_string_hash( | ||||
| 459 | $self->{$key}, | ||||
| 460 | { | ||||
| 461 | bad_version_hook => sub { | ||||
| 462 | #no warnings 'numeric'; # module doesn't use warnings | ||||
| 463 | my $fallback; | ||||
| 464 | if ( $_[0] =~ m!^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$! ) { | ||||
| 465 | $fallback = sprintf "%f", $_[0]; | ||||
| 466 | } else { | ||||
| 467 | ($fallback) = $_[0] ? ($_[0] =~ /^([0-9.]+)/) : 0; | ||||
| 468 | $fallback += 0; | ||||
| 469 | carp "Unparsable version '$_[0]' for prerequisite $_[1] treated as $fallback"; | ||||
| 470 | } | ||||
| 471 | version->new($fallback); | ||||
| 472 | }, | ||||
| 473 | }, | ||||
| 474 | ); | ||||
| 475 | $self->{$key} = $cmr->as_string_hash; | ||||
| 476 | $key2cmr{$key} = $cmr; | ||||
| 477 | } else { | ||||
| 478 | for my $module (sort keys %{ $self->{$key} }) { | ||||
| 479 | my $version = $self->{$key}->{$module}; | ||||
| 480 | my $fallback = 0; | ||||
| 481 | if (!defined($version) or !length($version)) { | ||||
| 482 | carp "Undefined requirement for $module treated as '0' (CPAN::Meta::Requirements not available)"; | ||||
| 483 | } | ||||
| 484 | elsif ($version =~ /^\d+(?:\.\d+(?:_\d+)*)?$/) { | ||||
| 485 | next; | ||||
| 486 | } | ||||
| 487 | else { | ||||
| 488 | if ( $version =~ m!^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$! ) { | ||||
| 489 | $fallback = sprintf "%f", $version; | ||||
| 490 | } else { | ||||
| 491 | ($fallback) = $version ? ($version =~ /^([0-9.]+)/) : 0; | ||||
| 492 | $fallback += 0; | ||||
| 493 | carp "Unparsable version '$version' for prerequisite $module treated as $fallback (CPAN::Meta::Requirements not available)"; | ||||
| 494 | } | ||||
| 495 | } | ||||
| 496 | $self->{$key}->{$module} = $fallback; | ||||
| 497 | } | ||||
| 498 | } | ||||
| 499 | } | ||||
| 500 | |||||
| 501 | if ("@ARGV" =~ /\bPREREQ_PRINT\b/) { | ||||
| 502 | $self->_PREREQ_PRINT; | ||||
| 503 | } | ||||
| 504 | |||||
| 505 | # PRINT_PREREQ is RedHatism. | ||||
| 506 | if ("@ARGV" =~ /\bPRINT_PREREQ\b/) { | ||||
| 507 | $self->_PRINT_PREREQ; | ||||
| 508 | } | ||||
| 509 | |||||
| 510 | print "MakeMaker (v$VERSION)\n" if $Verbose; | ||||
| 511 | if (-f "MANIFEST" && ! -f "Makefile" && ! $UNDER_CORE){ | ||||
| 512 | check_manifest(); | ||||
| 513 | } | ||||
| 514 | |||||
| 515 | check_hints($self); | ||||
| 516 | |||||
| 517 | if ( $self->{MIN_PERL_VERSION}) { | ||||
| 518 | my $perl_version = $self->{MIN_PERL_VERSION}; | ||||
| 519 | if (ref $perl_version) { | ||||
| 520 | # assume a version object | ||||
| 521 | } | ||||
| 522 | else { | ||||
| 523 | $perl_version = eval { | ||||
| 524 | local $SIG{__WARN__} = sub { | ||||
| 525 | # simulate "use warnings FATAL => 'all'" for vintage perls | ||||
| 526 | die @_; | ||||
| 527 | }; | ||||
| 528 | version->new( $perl_version )->numify; | ||||
| 529 | }; | ||||
| 530 | $perl_version =~ tr/_//d | ||||
| 531 | if defined $perl_version; | ||||
| 532 | } | ||||
| 533 | |||||
| 534 | if (!defined $perl_version) { | ||||
| 535 | # should this be a warning? | ||||
| 536 | die sprintf <<'END', $self->{MIN_PERL_VERSION}; | ||||
| 537 | MakeMaker FATAL: MIN_PERL_VERSION (%s) is not in a recognized format. | ||||
| 538 | Recommended is a quoted numerical value like '5.005' or '5.008001'. | ||||
| 539 | END | ||||
| 540 | } | ||||
| 541 | elsif ($perl_version > "$]") { | ||||
| 542 | my $message = sprintf <<'END', $perl_version, $]; | ||||
| 543 | Perl version %s or higher required. We run %s. | ||||
| 544 | END | ||||
| 545 | if ($self->{PREREQ_FATAL}) { | ||||
| 546 | die "MakeMaker FATAL: $message"; | ||||
| 547 | } | ||||
| 548 | else { | ||||
| 549 | warn "Warning: $message"; | ||||
| 550 | } | ||||
| 551 | } | ||||
| 552 | |||||
| 553 | $self->{MIN_PERL_VERSION} = $perl_version; | ||||
| 554 | } | ||||
| 555 | |||||
| 556 | my %configure_att; # record &{$self->{CONFIGURE}} attributes | ||||
| 557 | my(%initial_att) = %$self; # record initial attributes | ||||
| 558 | |||||
| 559 | my(%unsatisfied) = (); | ||||
| 560 | my %prereq2version; | ||||
| 561 | my $cmr; | ||||
| 562 | if (_has_cpan_meta_requirements) { | ||||
| 563 | $cmr = CPAN::Meta::Requirements->new; | ||||
| 564 | for my $key (qw(PREREQ_PM BUILD_REQUIRES CONFIGURE_REQUIRES TEST_REQUIRES)) { | ||||
| 565 | $cmr->add_requirements($key2cmr{$key}) if $key2cmr{$key}; | ||||
| 566 | } | ||||
| 567 | foreach my $prereq ($cmr->required_modules) { | ||||
| 568 | $prereq2version{$prereq} = $cmr->requirements_for_module($prereq); | ||||
| 569 | } | ||||
| 570 | } else { | ||||
| 571 | for my $key (qw(PREREQ_PM BUILD_REQUIRES CONFIGURE_REQUIRES TEST_REQUIRES)) { | ||||
| 572 | next unless my $module2version = $self->{$key}; | ||||
| 573 | $prereq2version{$_} = $module2version->{$_} for keys %$module2version; | ||||
| 574 | } | ||||
| 575 | } | ||||
| 576 | foreach my $prereq (sort keys %prereq2version) { | ||||
| 577 | my $required_version = $prereq2version{$prereq}; | ||||
| 578 | |||||
| 579 | my $pr_version = 0; | ||||
| 580 | my $installed_file; | ||||
| 581 | |||||
| 582 | if ( $prereq eq 'perl' ) { | ||||
| 583 | if ( defined $required_version && $required_version =~ /^v?[\d_\.]+$/ | ||||
| 584 | || $required_version !~ /^v?[\d_\.]+$/ ) { | ||||
| 585 | require version; | ||||
| 586 | my $normal = eval { version->new( $required_version ) }; | ||||
| 587 | $required_version = $normal if defined $normal; | ||||
| 588 | } | ||||
| 589 | $installed_file = $prereq; | ||||
| 590 | $pr_version = $]; | ||||
| 591 | } | ||||
| 592 | else { | ||||
| 593 | $installed_file = MM->_installed_file_for_module($prereq); | ||||
| 594 | $pr_version = MM->parse_version($installed_file) if $installed_file; | ||||
| 595 | $pr_version = 0 if $pr_version eq 'undef'; | ||||
| 596 | if ( !eval { version->new( $pr_version ); 1 } ) { | ||||
| 597 | #no warnings 'numeric'; # module doesn't use warnings | ||||
| 598 | my $fallback; | ||||
| 599 | if ( $pr_version =~ m!^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$! ) { | ||||
| 600 | $fallback = sprintf '%f', $pr_version; | ||||
| 601 | } else { | ||||
| 602 | ($fallback) = $pr_version ? ($pr_version =~ /^([0-9.]+)/) : 0; | ||||
| 603 | $fallback += 0; | ||||
| 604 | carp "Unparsable version '$pr_version' for installed prerequisite $prereq treated as $fallback"; | ||||
| 605 | } | ||||
| 606 | $pr_version = $fallback; | ||||
| 607 | } | ||||
| 608 | } | ||||
| 609 | |||||
| 610 | # convert X.Y_Z alpha version #s to X.YZ for easier comparisons | ||||
| 611 | $pr_version =~ s/(\d+)\.(\d+)_(\d+)/$1.$2$3/; | ||||
| 612 | |||||
| 613 | if (!$installed_file) { | ||||
| 614 | warn sprintf "Warning: prerequisite %s %s not found.\n", | ||||
| 615 | $prereq, $required_version | ||||
| 616 | unless $self->{PREREQ_FATAL} | ||||
| 617 | or $UNDER_CORE; | ||||
| 618 | |||||
| 619 | $unsatisfied{$prereq} = 'not installed'; | ||||
| 620 | } | ||||
| 621 | elsif ( | ||||
| 622 | $cmr | ||||
| 623 | ? !$cmr->accepts_module($prereq, $pr_version) | ||||
| 624 | : $required_version > $pr_version | ||||
| 625 | ) { | ||||
| 626 | warn sprintf "Warning: prerequisite %s %s not found. We have %s.\n", | ||||
| 627 | $prereq, $required_version, ($pr_version || 'unknown version') | ||||
| 628 | unless $self->{PREREQ_FATAL} | ||||
| 629 | or $UNDER_CORE; | ||||
| 630 | |||||
| 631 | $unsatisfied{$prereq} = $required_version || 'unknown version' ; | ||||
| 632 | } | ||||
| 633 | } | ||||
| 634 | |||||
| 635 | if (%unsatisfied && $self->{PREREQ_FATAL}){ | ||||
| 636 | my $failedprereqs = join "\n", map {" $_ $unsatisfied{$_}"} | ||||
| 637 | sort { lc $a cmp lc $b } keys %unsatisfied; | ||||
| 638 | die <<"END"; | ||||
| 639 | MakeMaker FATAL: prerequisites not found. | ||||
| 640 | $failedprereqs | ||||
| 641 | |||||
| 642 | Please install these modules first and rerun 'perl Makefile.PL'. | ||||
| 643 | END | ||||
| 644 | } | ||||
| 645 | |||||
| 646 | if (defined $self->{CONFIGURE}) { | ||||
| 647 | if (ref $self->{CONFIGURE} eq 'CODE') { | ||||
| 648 | %configure_att = %{&{$self->{CONFIGURE}}}; | ||||
| 649 | _convert_compat_attrs(\%configure_att); | ||||
| 650 | $self = { %$self, %configure_att }; | ||||
| 651 | } else { | ||||
| 652 | croak "Attribute 'CONFIGURE' to WriteMakefile() not a code reference\n"; | ||||
| 653 | } | ||||
| 654 | } | ||||
| 655 | |||||
| 656 | my $newclass = ++$PACKNAME; | ||||
| 657 | local @Parent = @Parent; # Protect against non-local exits | ||||
| 658 | { | ||||
| 659 | print "Blessing Object into class [$newclass]\n" if $Verbose>=2; | ||||
| 660 | mv_all_methods("MY",$newclass); | ||||
| 661 | bless $self, $newclass; | ||||
| 662 | push @Parent, $self; | ||||
| 663 | require ExtUtils::MY; | ||||
| 664 | |||||
| 665 | 2 | 1.32ms | 2 | 20µs | # spent 14µs (8+6) within ExtUtils::MakeMaker::BEGIN@665 which was called:
# once (8µs+6µs) by IPC::Cmd::can_run at line 665 # spent 14µs making 1 call to ExtUtils::MakeMaker::BEGIN@665
# spent 6µs making 1 call to strict::unimport |
| 666 | @{"$newclass\:\:ISA"} = 'MM'; | ||||
| 667 | } | ||||
| 668 | |||||
| 669 | if (defined $Parent[-2]){ | ||||
| 670 | $self->{PARENT} = $Parent[-2]; | ||||
| 671 | for my $key (@Prepend_parent) { | ||||
| 672 | next unless defined $self->{PARENT}{$key}; | ||||
| 673 | |||||
| 674 | # Don't stomp on WriteMakefile() args. | ||||
| 675 | next if defined $self->{ARGS}{$key} and | ||||
| 676 | $self->{ARGS}{$key} eq $self->{$key}; | ||||
| 677 | |||||
| 678 | $self->{$key} = $self->{PARENT}{$key}; | ||||
| 679 | |||||
| 680 | if ($Is_VMS && $key =~ /PERL$/) { | ||||
| 681 | # PERL or FULLPERL will be a command verb or even a | ||||
| 682 | # command with an argument instead of a full file | ||||
| 683 | # specification under VMS. So, don't turn the command | ||||
| 684 | # into a filespec, but do add a level to the path of | ||||
| 685 | # the argument if not already absolute. | ||||
| 686 | my @cmd = split /\s+/, $self->{$key}; | ||||
| 687 | $cmd[1] = $self->catfile('[-]',$cmd[1]) | ||||
| 688 | unless (@cmd < 2) || $self->file_name_is_absolute($cmd[1]); | ||||
| 689 | $self->{$key} = join(' ', @cmd); | ||||
| 690 | } else { | ||||
| 691 | my $value = $self->{$key}; | ||||
| 692 | # not going to test in FS so only stripping start | ||||
| 693 | $value =~ s/"// if $key =~ /PERL$/ and $self->is_make_type('dmake'); | ||||
| 694 | $value =~ s/^"// if $key =~ /PERL$/; | ||||
| 695 | $value = $self->catdir("..", $value) | ||||
| 696 | unless $self->file_name_is_absolute($value); | ||||
| 697 | $value = qq{"$value} if $key =~ /PERL$/; | ||||
| 698 | $self->{$key} = $value; | ||||
| 699 | } | ||||
| 700 | } | ||||
| 701 | if ($self->{PARENT}) { | ||||
| 702 | $self->{PARENT}->{CHILDREN}->{$newclass} = $self; | ||||
| 703 | foreach my $opt (qw(POLLUTE PERL_CORE LINKTYPE AR FULL_AR CC CCFLAGS | ||||
| 704 | OPTIMIZE LD LDDLFLAGS LDFLAGS PERL_ARCHLIB DESTDIR)) { | ||||
| 705 | if (exists $self->{PARENT}->{$opt} | ||||
| 706 | and not exists $self->{$opt}) | ||||
| 707 | { | ||||
| 708 | # inherit, but only if already unspecified | ||||
| 709 | $self->{$opt} = $self->{PARENT}->{$opt}; | ||||
| 710 | } | ||||
| 711 | } | ||||
| 712 | } | ||||
| 713 | my @fm = grep /^FIRST_MAKEFILE=/, @ARGV; | ||||
| 714 | parse_args($self,@fm) if @fm; | ||||
| 715 | } | ||||
| 716 | else { | ||||
| 717 | parse_args($self, _shellwords($ENV{PERL_MM_OPT} || ''),@ARGV); | ||||
| 718 | } | ||||
| 719 | |||||
| 720 | # RT#91540 PREREQ_FATAL not recognized on command line | ||||
| 721 | if (%unsatisfied && $self->{PREREQ_FATAL}){ | ||||
| 722 | my $failedprereqs = join "\n", map {" $_ $unsatisfied{$_}"} | ||||
| 723 | sort { lc $a cmp lc $b } keys %unsatisfied; | ||||
| 724 | die <<"END"; | ||||
| 725 | MakeMaker FATAL: prerequisites not found. | ||||
| 726 | $failedprereqs | ||||
| 727 | |||||
| 728 | Please install these modules first and rerun 'perl Makefile.PL'. | ||||
| 729 | END | ||||
| 730 | } | ||||
| 731 | |||||
| 732 | $self->{NAME} ||= $self->guess_name; | ||||
| 733 | |||||
| 734 | warn "Warning: NAME must be a package name\n" | ||||
| 735 | unless $self->{NAME} =~ m!^[A-Z_a-z][0-9A-Z_a-z]*(?:::[0-9A-Z_a-z]+)*$!; | ||||
| 736 | |||||
| 737 | ($self->{NAME_SYM} = $self->{NAME}) =~ s/\W+/_/g; | ||||
| 738 | |||||
| 739 | $self->init_MAKE; | ||||
| 740 | $self->init_main; | ||||
| 741 | $self->init_VERSION; | ||||
| 742 | $self->init_dist; | ||||
| 743 | $self->init_INST; | ||||
| 744 | $self->init_INSTALL; | ||||
| 745 | $self->init_DEST; | ||||
| 746 | $self->init_dirscan; | ||||
| 747 | $self->init_PM; | ||||
| 748 | $self->init_MANPODS; | ||||
| 749 | $self->init_xs; | ||||
| 750 | $self->init_PERL; | ||||
| 751 | $self->init_DIRFILESEP; | ||||
| 752 | $self->init_linker; | ||||
| 753 | $self->init_ABSTRACT; | ||||
| 754 | |||||
| 755 | $self->arch_check( | ||||
| 756 | $INC{'Config.pm'}, | ||||
| 757 | $self->catfile($Config{'archlibexp'}, "Config.pm") | ||||
| 758 | ); | ||||
| 759 | |||||
| 760 | $self->init_tools(); | ||||
| 761 | $self->init_others(); | ||||
| 762 | $self->init_platform(); | ||||
| 763 | $self->init_PERM(); | ||||
| 764 | my @args = @ARGV; | ||||
| 765 | @args = map { Encode::decode(locale => $_) } @args if $CAN_DECODE; | ||||
| 766 | my($argv) = neatvalue(\@args); | ||||
| 767 | $argv =~ s/^\[/(/; | ||||
| 768 | $argv =~ s/\]$/)/; | ||||
| 769 | |||||
| 770 | push @{$self->{RESULT}}, <<END; | ||||
| 771 | # This Makefile is for the $self->{NAME} extension to perl. | ||||
| 772 | # | ||||
| 773 | # It was generated automatically by MakeMaker version | ||||
| 774 | # $VERSION (Revision: $Revision) from the contents of | ||||
| 775 | # Makefile.PL. Don't edit this file, edit Makefile.PL instead. | ||||
| 776 | # | ||||
| 777 | # ANY CHANGES MADE HERE WILL BE LOST! | ||||
| 778 | # | ||||
| 779 | # MakeMaker ARGV: $argv | ||||
| 780 | # | ||||
| 781 | END | ||||
| 782 | |||||
| 783 | push @{$self->{RESULT}}, $self->_MakeMaker_Parameters_section(\%initial_att); | ||||
| 784 | |||||
| 785 | if (defined $self->{CONFIGURE}) { | ||||
| 786 | push @{$self->{RESULT}}, <<END; | ||||
| 787 | |||||
| 788 | # MakeMaker 'CONFIGURE' Parameters: | ||||
| 789 | END | ||||
| 790 | if (scalar(keys %configure_att) > 0) { | ||||
| 791 | foreach my $key (sort keys %configure_att){ | ||||
| 792 | next if $key eq 'ARGS'; | ||||
| 793 | my($v) = neatvalue($configure_att{$key}); | ||||
| 794 | $v =~ s/(CODE|HASH|ARRAY|SCALAR)\([\dxa-f]+\)/$1\(...\)/; | ||||
| 795 | $v =~ tr/\n/ /s; | ||||
| 796 | push @{$self->{RESULT}}, "# $key => $v"; | ||||
| 797 | } | ||||
| 798 | } | ||||
| 799 | else | ||||
| 800 | { | ||||
| 801 | push @{$self->{RESULT}}, "# no values returned"; | ||||
| 802 | } | ||||
| 803 | undef %configure_att; # free memory | ||||
| 804 | } | ||||
| 805 | |||||
| 806 | # turn the SKIP array into a SKIPHASH hash | ||||
| 807 | for my $skip (@{$self->{SKIP} || []}) { | ||||
| 808 | $self->{SKIPHASH}{$skip} = 1; | ||||
| 809 | } | ||||
| 810 | delete $self->{SKIP}; # free memory | ||||
| 811 | |||||
| 812 | if ($self->{PARENT}) { | ||||
| 813 | for (qw/install dist dist_basics dist_core distdir dist_test dist_ci/) { | ||||
| 814 | $self->{SKIPHASH}{$_} = 1; | ||||
| 815 | } | ||||
| 816 | } | ||||
| 817 | |||||
| 818 | # We run all the subdirectories now. They don't have much to query | ||||
| 819 | # from the parent, but the parent has to query them: if they need linking! | ||||
| 820 | unless ($self->{NORECURS}) { | ||||
| 821 | $self->eval_in_subdirs if @{$self->{DIR}}; | ||||
| 822 | } | ||||
| 823 | |||||
| 824 | foreach my $section ( @MM_Sections ){ | ||||
| 825 | # Support for new foo_target() methods. | ||||
| 826 | my $method = $section; | ||||
| 827 | $method .= '_target' unless $self->can($method); | ||||
| 828 | |||||
| 829 | print "Processing Makefile '$section' section\n" if ($Verbose >= 2); | ||||
| 830 | my($skipit) = $self->skipcheck($section); | ||||
| 831 | if ($skipit){ | ||||
| 832 | push @{$self->{RESULT}}, "\n# --- MakeMaker $section section $skipit."; | ||||
| 833 | } else { | ||||
| 834 | my(%a) = %{$self->{$section} || {}}; | ||||
| 835 | push @{$self->{RESULT}}, "\n# --- MakeMaker $section section:"; | ||||
| 836 | push @{$self->{RESULT}}, "# " . join ", ", %a if $Verbose && %a; | ||||
| 837 | push @{$self->{RESULT}}, $self->maketext_filter( | ||||
| 838 | $self->$method( %a ) | ||||
| 839 | ); | ||||
| 840 | } | ||||
| 841 | } | ||||
| 842 | |||||
| 843 | push @{$self->{RESULT}}, "\n# End."; | ||||
| 844 | |||||
| 845 | $self; | ||||
| 846 | } | ||||
| 847 | |||||
| 848 | sub WriteEmptyMakefile { | ||||
| 849 | croak "WriteEmptyMakefile: Need an even number of args" if @_ % 2; | ||||
| 850 | |||||
| 851 | my %att = @_; | ||||
| 852 | $att{DIR} = [] unless $att{DIR}; # don't recurse by default | ||||
| 853 | my $self = MM->new(\%att); | ||||
| 854 | |||||
| 855 | my $new = $self->{MAKEFILE}; | ||||
| 856 | my $old = $self->{MAKEFILE_OLD}; | ||||
| 857 | if (-f $old) { | ||||
| 858 | _unlink($old) or warn "unlink $old: $!"; | ||||
| 859 | } | ||||
| 860 | if ( -f $new ) { | ||||
| 861 | _rename($new, $old) or warn "rename $new => $old: $!" | ||||
| 862 | } | ||||
| 863 | open my $mfh, '>', $new or die "open $new for write: $!"; | ||||
| 864 | print $mfh <<'EOP'; | ||||
| 865 | all : | ||||
| 866 | |||||
| 867 | manifypods : | ||||
| 868 | |||||
| 869 | subdirs : | ||||
| 870 | |||||
| 871 | dynamic : | ||||
| 872 | |||||
| 873 | static : | ||||
| 874 | |||||
| 875 | clean : | ||||
| 876 | |||||
| 877 | install : | ||||
| 878 | |||||
| 879 | makemakerdflt : | ||||
| 880 | |||||
| 881 | test : | ||||
| 882 | |||||
| 883 | test_dynamic : | ||||
| 884 | |||||
| 885 | test_static : | ||||
| 886 | |||||
| 887 | EOP | ||||
| 888 | close $mfh or die "close $new for write: $!"; | ||||
| 889 | } | ||||
| 890 | |||||
| 891 | |||||
| 892 | =begin private | ||||
| 893 | |||||
| 894 | =head3 _installed_file_for_module | ||||
| 895 | |||||
| 896 | my $file = MM->_installed_file_for_module($module); | ||||
| 897 | |||||
| 898 | Return the first installed .pm $file associated with the $module. The | ||||
| 899 | one which will show up when you C<use $module>. | ||||
| 900 | |||||
| 901 | $module is something like "strict" or "Test::More". | ||||
| 902 | |||||
| 903 | =end private | ||||
| 904 | |||||
| 905 | =cut | ||||
| 906 | |||||
| 907 | sub _installed_file_for_module { | ||||
| 908 | my $class = shift; | ||||
| 909 | my $prereq = shift; | ||||
| 910 | |||||
| 911 | my $file = "$prereq.pm"; | ||||
| 912 | $file =~ s{::}{/}g; | ||||
| 913 | |||||
| 914 | my $path; | ||||
| 915 | for my $dir (@INC) { | ||||
| 916 | my $tmp = File::Spec->catfile($dir, $file); | ||||
| 917 | if ( -r $tmp ) { | ||||
| 918 | $path = $tmp; | ||||
| 919 | last; | ||||
| 920 | } | ||||
| 921 | } | ||||
| 922 | |||||
| 923 | return $path; | ||||
| 924 | } | ||||
| 925 | |||||
| 926 | |||||
| 927 | # Extracted from MakeMaker->new so we can test it | ||||
| 928 | sub _MakeMaker_Parameters_section { | ||||
| 929 | my $self = shift; | ||||
| 930 | my $att = shift; | ||||
| 931 | |||||
| 932 | my @result = <<'END'; | ||||
| 933 | # MakeMaker Parameters: | ||||
| 934 | END | ||||
| 935 | |||||
| 936 | foreach my $key (sort keys %$att){ | ||||
| 937 | next if $key eq 'ARGS'; | ||||
| 938 | my $v; | ||||
| 939 | if ($key eq 'PREREQ_PM') { | ||||
| 940 | # CPAN.pm takes prereqs from this field in 'Makefile' | ||||
| 941 | # and does not know about BUILD_REQUIRES | ||||
| 942 | $v = neatvalue({ | ||||
| 943 | %{ $att->{PREREQ_PM} || {} }, | ||||
| 944 | %{ $att->{BUILD_REQUIRES} || {} }, | ||||
| 945 | %{ $att->{TEST_REQUIRES} || {} }, | ||||
| 946 | }); | ||||
| 947 | } else { | ||||
| 948 | $v = neatvalue($att->{$key}); | ||||
| 949 | } | ||||
| 950 | |||||
| 951 | $v =~ s/(CODE|HASH|ARRAY|SCALAR)\([\dxa-f]+\)/$1\(...\)/; | ||||
| 952 | $v =~ tr/\n/ /s; | ||||
| 953 | push @result, "# $key => $v"; | ||||
| 954 | } | ||||
| 955 | |||||
| 956 | return @result; | ||||
| 957 | } | ||||
| 958 | |||||
| 959 | # _shellwords and _parseline borrowed from Text::ParseWords | ||||
| 960 | sub _shellwords { | ||||
| 961 | my (@lines) = @_; | ||||
| 962 | my @allwords; | ||||
| 963 | |||||
| 964 | foreach my $line (@lines) { | ||||
| 965 | $line =~ s/^\s+//; | ||||
| 966 | my @words = _parse_line('\s+', 0, $line); | ||||
| 967 | pop @words if (@words and !defined $words[-1]); | ||||
| 968 | return() unless (@words || !length($line)); | ||||
| 969 | push(@allwords, @words); | ||||
| 970 | } | ||||
| 971 | return(@allwords); | ||||
| 972 | } | ||||
| 973 | |||||
| 974 | sub _parse_line { | ||||
| 975 | my($delimiter, $keep, $line) = @_; | ||||
| 976 | my($word, @pieces); | ||||
| 977 | |||||
| 978 | 2 | 731µs | 2 | 43µs | # spent 24µs (6+18) within ExtUtils::MakeMaker::BEGIN@978 which was called:
# once (6µs+18µs) by IPC::Cmd::can_run at line 978 # spent 24µs making 1 call to ExtUtils::MakeMaker::BEGIN@978
# spent 18µs making 1 call to warnings::unimport |
| 979 | |||||
| 980 | while (length($line)) { | ||||
| 981 | # This pattern is optimised to be stack conservative on older perls. | ||||
| 982 | # Do not refactor without being careful and testing it on very long strings. | ||||
| 983 | # See Perl bug #42980 for an example of a stack busting input. | ||||
| 984 | $line =~ s/^ | ||||
| 985 | (?: | ||||
| 986 | # double quoted string | ||||
| 987 | (") # $quote | ||||
| 988 | ((?>[^\\"]*(?:\\.[^\\"]*)*))" # $quoted | ||||
| 989 | | # --OR-- | ||||
| 990 | # singe quoted string | ||||
| 991 | (') # $quote | ||||
| 992 | ((?>[^\\']*(?:\\.[^\\']*)*))' # $quoted | ||||
| 993 | | # --OR-- | ||||
| 994 | # unquoted string | ||||
| 995 | ( # $unquoted | ||||
| 996 | (?:\\.|[^\\"'])*? | ||||
| 997 | ) | ||||
| 998 | # followed by | ||||
| 999 | ( # $delim | ||||
| 1000 | \Z(?!\n) # EOL | ||||
| 1001 | | # --OR-- | ||||
| 1002 | (?-x:$delimiter) # delimiter | ||||
| 1003 | | # --OR-- | ||||
| 1004 | (?!^)(?=["']) # a quote | ||||
| 1005 | ) | ||||
| 1006 | )//xs or return; # extended layout | ||||
| 1007 | my ($quote, $quoted, $unquoted, $delim) = (($1 ? ($1,$2) : ($3,$4)), $5, $6); | ||||
| 1008 | |||||
| 1009 | |||||
| 1010 | return() unless( defined($quote) || length($unquoted) || length($delim)); | ||||
| 1011 | |||||
| 1012 | if ($keep) { | ||||
| 1013 | $quoted = "$quote$quoted$quote"; | ||||
| 1014 | } | ||||
| 1015 | else { | ||||
| 1016 | $unquoted =~ s/\\(.)/$1/sg; | ||||
| 1017 | if (defined $quote) { | ||||
| 1018 | $quoted =~ s/\\(.)/$1/sg if ($quote eq '"'); | ||||
| 1019 | #$quoted =~ s/\\([\\'])/$1/g if ( $PERL_SINGLE_QUOTE && $quote eq "'"); | ||||
| 1020 | } | ||||
| 1021 | } | ||||
| 1022 | $word .= substr($line, 0, 0); # leave results tainted | ||||
| 1023 | $word .= defined $quote ? $quoted : $unquoted; | ||||
| 1024 | |||||
| 1025 | if (length($delim)) { | ||||
| 1026 | push(@pieces, $word); | ||||
| 1027 | push(@pieces, $delim) if ($keep eq 'delimiters'); | ||||
| 1028 | undef $word; | ||||
| 1029 | } | ||||
| 1030 | if (!length($line)) { | ||||
| 1031 | push(@pieces, $word); | ||||
| 1032 | } | ||||
| 1033 | } | ||||
| 1034 | return(@pieces); | ||||
| 1035 | } | ||||
| 1036 | |||||
| 1037 | sub check_manifest { | ||||
| 1038 | print STDOUT "Checking if your kit is complete...\n"; | ||||
| 1039 | require ExtUtils::Manifest; | ||||
| 1040 | # avoid warning | ||||
| 1041 | $ExtUtils::Manifest::Quiet = $ExtUtils::Manifest::Quiet = 1; | ||||
| 1042 | my(@missed) = ExtUtils::Manifest::manicheck(); | ||||
| 1043 | if (@missed) { | ||||
| 1044 | print "Warning: the following files are missing in your kit:\n"; | ||||
| 1045 | print "\t", join "\n\t", @missed; | ||||
| 1046 | print "\n"; | ||||
| 1047 | print "Please inform the author.\n"; | ||||
| 1048 | } else { | ||||
| 1049 | print "Looks good\n"; | ||||
| 1050 | } | ||||
| 1051 | } | ||||
| 1052 | |||||
| 1053 | sub parse_args{ | ||||
| 1054 | my($self, @args) = @_; | ||||
| 1055 | @args = map { Encode::decode(locale => $_) } @args if $CAN_DECODE; | ||||
| 1056 | foreach (@args) { | ||||
| 1057 | unless (m/(.*?)=(.*)/) { | ||||
| 1058 | ++$Verbose if m/^verb/; | ||||
| 1059 | next; | ||||
| 1060 | } | ||||
| 1061 | my($name, $value) = ($1, $2); | ||||
| 1062 | if ($value =~ m/^~(\w+)?/) { # tilde with optional username | ||||
| 1063 | $value =~ s [^~(\w*)] | ||||
| 1064 | [$1 ? | ||||
| 1065 | ((getpwnam($1))[7] || "~$1") : | ||||
| 1066 | (getpwuid($>))[7] | ||||
| 1067 | ]ex; | ||||
| 1068 | } | ||||
| 1069 | |||||
| 1070 | # Remember the original args passed it. It will be useful later. | ||||
| 1071 | $self->{ARGS}{uc $name} = $self->{uc $name} = $value; | ||||
| 1072 | } | ||||
| 1073 | |||||
| 1074 | # catch old-style 'potential_libs' and inform user how to 'upgrade' | ||||
| 1075 | if (defined $self->{potential_libs}){ | ||||
| 1076 | my($msg)="'potential_libs' => '$self->{potential_libs}' should be"; | ||||
| 1077 | if ($self->{potential_libs}){ | ||||
| 1078 | print "$msg changed to:\n\t'LIBS' => ['$self->{potential_libs}']\n"; | ||||
| 1079 | } else { | ||||
| 1080 | print "$msg deleted.\n"; | ||||
| 1081 | } | ||||
| 1082 | $self->{LIBS} = [$self->{potential_libs}]; | ||||
| 1083 | delete $self->{potential_libs}; | ||||
| 1084 | } | ||||
| 1085 | # catch old-style 'ARMAYBE' and inform user how to 'upgrade' | ||||
| 1086 | if (defined $self->{ARMAYBE}){ | ||||
| 1087 | my($armaybe) = $self->{ARMAYBE}; | ||||
| 1088 | print "ARMAYBE => '$armaybe' should be changed to:\n", | ||||
| 1089 | "\t'dynamic_lib' => {ARMAYBE => '$armaybe'}\n"; | ||||
| 1090 | my(%dl) = %{$self->{dynamic_lib} || {}}; | ||||
| 1091 | $self->{dynamic_lib} = { %dl, ARMAYBE => $armaybe}; | ||||
| 1092 | delete $self->{ARMAYBE}; | ||||
| 1093 | } | ||||
| 1094 | if (defined $self->{LDTARGET}){ | ||||
| 1095 | print "LDTARGET should be changed to LDFROM\n"; | ||||
| 1096 | $self->{LDFROM} = $self->{LDTARGET}; | ||||
| 1097 | delete $self->{LDTARGET}; | ||||
| 1098 | } | ||||
| 1099 | # Turn a DIR argument on the command line into an array | ||||
| 1100 | if (defined $self->{DIR} && ref \$self->{DIR} eq 'SCALAR') { | ||||
| 1101 | # So they can choose from the command line, which extensions they want | ||||
| 1102 | # the grep enables them to have some colons too much in case they | ||||
| 1103 | # have to build a list with the shell | ||||
| 1104 | $self->{DIR} = [grep $_, split ":", $self->{DIR}]; | ||||
| 1105 | } | ||||
| 1106 | # Turn a INCLUDE_EXT argument on the command line into an array | ||||
| 1107 | if (defined $self->{INCLUDE_EXT} && ref \$self->{INCLUDE_EXT} eq 'SCALAR') { | ||||
| 1108 | $self->{INCLUDE_EXT} = [grep $_, split '\s+', $self->{INCLUDE_EXT}]; | ||||
| 1109 | } | ||||
| 1110 | # Turn a EXCLUDE_EXT argument on the command line into an array | ||||
| 1111 | if (defined $self->{EXCLUDE_EXT} && ref \$self->{EXCLUDE_EXT} eq 'SCALAR') { | ||||
| 1112 | $self->{EXCLUDE_EXT} = [grep $_, split '\s+', $self->{EXCLUDE_EXT}]; | ||||
| 1113 | } | ||||
| 1114 | |||||
| 1115 | foreach my $mmkey (sort keys %$self){ | ||||
| 1116 | next if $mmkey eq 'ARGS'; | ||||
| 1117 | print " $mmkey => ", neatvalue($self->{$mmkey}), "\n" if $Verbose; | ||||
| 1118 | print "'$mmkey' is not a known MakeMaker parameter name.\n" | ||||
| 1119 | unless exists $Recognized_Att_Keys{$mmkey}; | ||||
| 1120 | } | ||||
| 1121 | $| = 1 if $Verbose; | ||||
| 1122 | } | ||||
| 1123 | |||||
| 1124 | sub check_hints { | ||||
| 1125 | my($self) = @_; | ||||
| 1126 | # We allow extension-specific hints files. | ||||
| 1127 | |||||
| 1128 | require File::Spec; | ||||
| 1129 | my $curdir = File::Spec->curdir; | ||||
| 1130 | |||||
| 1131 | my $hint_dir = File::Spec->catdir($curdir, "hints"); | ||||
| 1132 | return unless -d $hint_dir; | ||||
| 1133 | |||||
| 1134 | # First we look for the best hintsfile we have | ||||
| 1135 | my($hint)="${^O}_$Config{osvers}"; | ||||
| 1136 | $hint =~ s/\./_/g; | ||||
| 1137 | $hint =~ s/_$//; | ||||
| 1138 | return unless $hint; | ||||
| 1139 | |||||
| 1140 | # Also try without trailing minor version numbers. | ||||
| 1141 | while (1) { | ||||
| 1142 | last if -f File::Spec->catfile($hint_dir, "$hint.pl"); # found | ||||
| 1143 | } continue { | ||||
| 1144 | last unless $hint =~ s/_[^_]*$//; # nothing to cut off | ||||
| 1145 | } | ||||
| 1146 | my $hint_file = File::Spec->catfile($hint_dir, "$hint.pl"); | ||||
| 1147 | |||||
| 1148 | return unless -f $hint_file; # really there | ||||
| 1149 | |||||
| 1150 | _run_hintfile($self, $hint_file); | ||||
| 1151 | } | ||||
| 1152 | |||||
| 1153 | sub _run_hintfile { | ||||
| 1154 | my ($self, $hint_file) = @_; | ||||
| 1155 | |||||
| 1156 | local($@, $!); | ||||
| 1157 | print "Processing hints file $hint_file\n" if $Verbose; | ||||
| 1158 | |||||
| 1159 | if(open(my $fh, '<', $hint_file)) { | ||||
| 1160 | my $hints_content = do { local $/; <$fh> }; | ||||
| 1161 | 2 | 111µs | 2 | 12µs | # spent 9µs (7+2) within ExtUtils::MakeMaker::BEGIN@1161 which was called:
# once (7µs+2µs) by IPC::Cmd::can_run at line 1161 # spent 9µs making 1 call to ExtUtils::MakeMaker::BEGIN@1161
# spent 2µs making 1 call to strict::unimport |
| 1162 | eval $hints_content; | ||||
| 1163 | warn "Failed to run hint file $hint_file: $@" if $@; | ||||
| 1164 | } | ||||
| 1165 | else { | ||||
| 1166 | warn "Could not open $hint_file for read: $!"; | ||||
| 1167 | } | ||||
| 1168 | } | ||||
| 1169 | |||||
| 1170 | sub mv_all_methods { | ||||
| 1171 | my($from,$to) = @_; | ||||
| 1172 | local $SIG{__WARN__} = sub { | ||||
| 1173 | # can't use 'no warnings redefined', 5.6 only | ||||
| 1174 | warn @_ unless $_[0] =~ /^Subroutine .* redefined/ | ||||
| 1175 | }; | ||||
| 1176 | foreach my $method (@Overridable) { | ||||
| 1177 | next unless defined &{"${from}::$method"}; | ||||
| 1178 | 2 | 871µs | 2 | 13µs | # spent 9µs (5+4) within ExtUtils::MakeMaker::BEGIN@1178 which was called:
# once (5µs+4µs) by IPC::Cmd::can_run at line 1178 # spent 9µs making 1 call to ExtUtils::MakeMaker::BEGIN@1178
# spent 4µs making 1 call to strict::unimport |
| 1179 | *{"${to}::$method"} = \&{"${from}::$method"}; | ||||
| 1180 | |||||
| 1181 | # If we delete a method, then it will be undefined and cannot | ||||
| 1182 | # be called. But as long as we have Makefile.PLs that rely on | ||||
| 1183 | # %MY:: being intact, we have to fill the hole with an | ||||
| 1184 | # inheriting method: | ||||
| 1185 | |||||
| 1186 | { | ||||
| 1187 | package MY; | ||||
| 1188 | my $super = "SUPER::".$method; | ||||
| 1189 | *{$method} = sub { | ||||
| 1190 | shift->$super(@_); | ||||
| 1191 | }; | ||||
| 1192 | } | ||||
| 1193 | } | ||||
| 1194 | } | ||||
| 1195 | |||||
| 1196 | sub skipcheck { | ||||
| 1197 | my($self) = shift; | ||||
| 1198 | my($section) = @_; | ||||
| 1199 | return 'skipped' if $section eq 'metafile' && $UNDER_CORE; | ||||
| 1200 | if ($section eq 'dynamic') { | ||||
| 1201 | print "Warning (non-fatal): Target 'dynamic' depends on targets ", | ||||
| 1202 | "in skipped section 'dynamic_bs'\n" | ||||
| 1203 | if $self->{SKIPHASH}{dynamic_bs} && $Verbose; | ||||
| 1204 | print "Warning (non-fatal): Target 'dynamic' depends on targets ", | ||||
| 1205 | "in skipped section 'dynamic_lib'\n" | ||||
| 1206 | if $self->{SKIPHASH}{dynamic_lib} && $Verbose; | ||||
| 1207 | } | ||||
| 1208 | if ($section eq 'dynamic_lib') { | ||||
| 1209 | print "Warning (non-fatal): Target '\$(INST_DYNAMIC)' depends on ", | ||||
| 1210 | "targets in skipped section 'dynamic_bs'\n" | ||||
| 1211 | if $self->{SKIPHASH}{dynamic_bs} && $Verbose; | ||||
| 1212 | } | ||||
| 1213 | if ($section eq 'static') { | ||||
| 1214 | print "Warning (non-fatal): Target 'static' depends on targets ", | ||||
| 1215 | "in skipped section 'static_lib'\n" | ||||
| 1216 | if $self->{SKIPHASH}{static_lib} && $Verbose; | ||||
| 1217 | } | ||||
| 1218 | return 'skipped' if $self->{SKIPHASH}{$section}; | ||||
| 1219 | return ''; | ||||
| 1220 | } | ||||
| 1221 | |||||
| 1222 | # returns filehandle, dies on fail. :raw so no :crlf | ||||
| 1223 | sub open_for_writing { | ||||
| 1224 | my ($file) = @_; | ||||
| 1225 | open my $fh ,">", $file or die "Unable to open $file: $!"; | ||||
| 1226 | my @layers = ':raw'; | ||||
| 1227 | push @layers, join ' ', ':encoding(locale)' if $CAN_DECODE; | ||||
| 1228 | binmode $fh, join ' ', @layers; | ||||
| 1229 | $fh; | ||||
| 1230 | } | ||||
| 1231 | |||||
| 1232 | sub flush { | ||||
| 1233 | my $self = shift; | ||||
| 1234 | |||||
| 1235 | my $finalname = $self->{MAKEFILE}; | ||||
| 1236 | printf STDOUT "Generating a %s %s\n", $self->make_type, $finalname if $Verbose || !$self->{PARENT}; | ||||
| 1237 | print STDOUT "Writing $finalname for $self->{NAME}\n" if $Verbose || !$self->{PARENT}; | ||||
| 1238 | |||||
| 1239 | unlink($finalname, "MakeMaker.tmp", $Is_VMS ? 'Descrip.MMS' : ()); | ||||
| 1240 | |||||
| 1241 | write_file_via_tmp($finalname, $self->{RESULT}); | ||||
| 1242 | |||||
| 1243 | # Write MYMETA.yml to communicate metadata up to the CPAN clients | ||||
| 1244 | print STDOUT "Writing MYMETA.yml and MYMETA.json\n" | ||||
| 1245 | if !$self->{NO_MYMETA} and $self->write_mymeta( $self->mymeta ); | ||||
| 1246 | |||||
| 1247 | # save memory | ||||
| 1248 | if ($self->{PARENT} && !$self->{_KEEP_AFTER_FLUSH}) { | ||||
| 1249 | my %keep = map { ($_ => 1) } qw(NEEDS_LINKING HAS_LINK_CODE); | ||||
| 1250 | delete $self->{$_} for grep !$keep{$_}, keys %$self; | ||||
| 1251 | } | ||||
| 1252 | |||||
| 1253 | system("$Config::Config{eunicefix} $finalname") | ||||
| 1254 | if $Config::Config{eunicefix} ne ":"; | ||||
| 1255 | |||||
| 1256 | return; | ||||
| 1257 | } | ||||
| 1258 | |||||
| 1259 | sub write_file_via_tmp { | ||||
| 1260 | my ($finalname, $contents) = @_; | ||||
| 1261 | my $fh = open_for_writing("MakeMaker.tmp"); | ||||
| 1262 | die "write_file_via_tmp: 2nd arg must be ref" unless ref $contents; | ||||
| 1263 | for my $chunk (@$contents) { | ||||
| 1264 | my $to_write = $chunk; | ||||
| 1265 | utf8::encode $to_write if !$CAN_DECODE && "$]" > 5.008; | ||||
| 1266 | print $fh "$to_write\n" or die "Can't write to MakeMaker.tmp: $!"; | ||||
| 1267 | } | ||||
| 1268 | close $fh or die "Can't write to MakeMaker.tmp: $!"; | ||||
| 1269 | _rename("MakeMaker.tmp", $finalname) or | ||||
| 1270 | warn "rename MakeMaker.tmp => $finalname: $!"; | ||||
| 1271 | chmod 0644, $finalname if !$Is_VMS; | ||||
| 1272 | return; | ||||
| 1273 | } | ||||
| 1274 | |||||
| 1275 | # This is a rename for OS's where the target must be unlinked first. | ||||
| 1276 | sub _rename { | ||||
| 1277 | my($src, $dest) = @_; | ||||
| 1278 | _unlink($dest); | ||||
| 1279 | return rename $src, $dest; | ||||
| 1280 | } | ||||
| 1281 | |||||
| 1282 | # This is an unlink for OS's where the target must be writable first. | ||||
| 1283 | sub _unlink { | ||||
| 1284 | my @files = @_; | ||||
| 1285 | chmod 0666, @files; | ||||
| 1286 | return unlink @files; | ||||
| 1287 | } | ||||
| 1288 | |||||
| 1289 | |||||
| 1290 | # The following mkbootstrap() is only for installations that are calling | ||||
| 1291 | # the pre-4.1 mkbootstrap() from their old Makefiles. This MakeMaker | ||||
| 1292 | # writes Makefiles, that use ExtUtils::Mkbootstrap directly. | ||||
| 1293 | sub mkbootstrap { | ||||
| 1294 | die <<END; | ||||
| 1295 | !!! Your Makefile has been built such a long time ago, !!! | ||||
| 1296 | !!! that is unlikely to work with current MakeMaker. !!! | ||||
| 1297 | !!! Please rebuild your Makefile !!! | ||||
| 1298 | END | ||||
| 1299 | } | ||||
| 1300 | |||||
| 1301 | # Ditto for mksymlists() as of MakeMaker 5.17 | ||||
| 1302 | sub mksymlists { | ||||
| 1303 | die <<END; | ||||
| 1304 | !!! Your Makefile has been built such a long time ago, !!! | ||||
| 1305 | !!! that is unlikely to work with current MakeMaker. !!! | ||||
| 1306 | !!! Please rebuild your Makefile !!! | ||||
| 1307 | END | ||||
| 1308 | } | ||||
| 1309 | |||||
| 1310 | sub neatvalue { | ||||
| 1311 | my($v) = @_; | ||||
| 1312 | return "undef" unless defined $v; | ||||
| 1313 | my($t) = ref $v; | ||||
| 1314 | return "q[$v]" unless $t; | ||||
| 1315 | if ($t eq 'ARRAY') { | ||||
| 1316 | my(@m, @neat); | ||||
| 1317 | push @m, "["; | ||||
| 1318 | foreach my $elem (@$v) { | ||||
| 1319 | push @neat, "q[$elem]"; | ||||
| 1320 | } | ||||
| 1321 | push @m, join ", ", @neat; | ||||
| 1322 | push @m, "]"; | ||||
| 1323 | return join "", @m; | ||||
| 1324 | } | ||||
| 1325 | return $v unless $t eq 'HASH'; | ||||
| 1326 | my(@m, $key, $val); | ||||
| 1327 | for my $key (sort keys %$v) { | ||||
| 1328 | last unless defined $key; # cautious programming in case (undef,undef) is true | ||||
| 1329 | push @m,"$key=>".neatvalue($v->{$key}); | ||||
| 1330 | } | ||||
| 1331 | return "{ ".join(', ',@m)." }"; | ||||
| 1332 | } | ||||
| 1333 | |||||
| 1334 | sub _find_magic_vstring { | ||||
| 1335 | my $value = shift; | ||||
| 1336 | return $value if $UNDER_CORE; | ||||
| 1337 | my $tvalue = ''; | ||||
| 1338 | require B; | ||||
| 1339 | my $sv = B::svref_2object(\$value); | ||||
| 1340 | my $magic = ref($sv) eq 'B::PVMG' ? $sv->MAGIC : undef; | ||||
| 1341 | while ( $magic ) { | ||||
| 1342 | if ( $magic->TYPE eq 'V' ) { | ||||
| 1343 | $tvalue = $magic->PTR; | ||||
| 1344 | $tvalue =~ s/^v?(.+)$/v$1/; | ||||
| 1345 | last; | ||||
| 1346 | } | ||||
| 1347 | else { | ||||
| 1348 | $magic = $magic->MOREMAGIC; | ||||
| 1349 | } | ||||
| 1350 | } | ||||
| 1351 | return $tvalue; | ||||
| 1352 | } | ||||
| 1353 | |||||
| 1354 | sub selfdocument { | ||||
| 1355 | my($self) = @_; | ||||
| 1356 | my(@m); | ||||
| 1357 | if ($Verbose){ | ||||
| 1358 | push @m, "\n# Full list of MakeMaker attribute values:"; | ||||
| 1359 | foreach my $key (sort keys %$self){ | ||||
| 1360 | next if $key eq 'RESULT' || $key =~ /^[A-Z][a-z]/; | ||||
| 1361 | my($v) = neatvalue($self->{$key}); | ||||
| 1362 | $v =~ s/(CODE|HASH|ARRAY|SCALAR)\([\dxa-f]+\)/$1\(...\)/; | ||||
| 1363 | $v =~ tr/\n/ /s; | ||||
| 1364 | push @m, "# $key => $v"; | ||||
| 1365 | } | ||||
| 1366 | } | ||||
| 1367 | # added here as selfdocument is not overridable | ||||
| 1368 | push @m, <<'EOF'; | ||||
| 1369 | |||||
| 1370 | # here so even if top_targets is overridden, these will still be defined | ||||
| 1371 | # gmake will silently still work if any are .PHONY-ed but nmake won't | ||||
| 1372 | EOF | ||||
| 1373 | push @m, join "\n", map "$_ ::\n\t\$(NOECHO) \$(NOOP)\n", | ||||
| 1374 | # config is so manifypods won't puke if no subdirs | ||||
| 1375 | grep !$self->{SKIPHASH}{$_}, | ||||
| 1376 | qw(static dynamic config); | ||||
| 1377 | join "\n", @m; | ||||
| 1378 | } | ||||
| 1379 | |||||
| 1380 | 1 | 25µs | 1; | ||
| 1381 | |||||
| 1382 | __END__ | ||||
# spent 600ns within ExtUtils::MakeMaker::CORE:subst which was called:
# once (600ns+0s) by IPC::Cmd::can_run at line 32 | |||||
# spent 400ns within ExtUtils::MakeMaker::__ANON__ which was called:
# once (400ns+0s) by ExtUtils::MakeMaker::BEGIN@11 at line 11 |