File Coverage

lib/ExtUtils/MakeMaker.pm
Criterion Covered Total %
statement 560 621 90.1
branch 230 352 65.3
condition 69 138 50.0
subroutine 49 50 98.0
pod 4 20 20.0
total 912 1181 77.2


line stmt bran cond sub pod time code
1             # $Id$
2             package ExtUtils::MakeMaker;
3              
4 52     52   393929 use strict;
  52         322  
  52         1684  
5 52     52   272 use warnings;
  52         1757  
  52         3318  
6              
7 52     52   2304 BEGIN {require 5.006;}
8              
9             require Exporter;
10 52     52   10354 use ExtUtils::MakeMaker::Config;
  52         138  
  52         457  
11 52     52   24400 use ExtUtils::MakeMaker::version; # ensure we always have our fake version.pm
  52         157  
  52         1750  
12 52     52   369 use Carp;
  52         105  
  52         4621  
13 52     52   369 use File::Path;
  52         349  
  52         71453  
14             my $CAN_DECODE = eval { require ExtUtils::MakeMaker::Locale; }; # 2 birds, 1 stone
15             eval { ExtUtils::MakeMaker::Locale::reinit('UTF-8') }
16             if $CAN_DECODE and Encode::find_encoding('locale')->name eq 'ascii';
17              
18             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             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             our $VERSION = '7.66';
29             $VERSION =~ tr/_//d;
30              
31             # Emulate something resembling CVS $Revision$
32             (our $Revision = $VERSION) =~ s{_}{};
33             $Revision = int $Revision * 10000;
34              
35             our $Filename = __FILE__; # referenced outside MakeMaker
36              
37             our @ISA = qw(Exporter);
38             our @EXPORT = qw(&WriteMakefile $Verbose &prompt &os_unsupported);
39             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             my $Is_VMS = $^O eq 'VMS';
46             my $Is_Win32 = $^O eq 'MSWin32';
47             our $UNDER_CORE = $ENV{PERL_CORE}; # needs to be our
48              
49             full_setup();
50              
51             require ExtUtils::MM; # Things like CPAN assume loading ExtUtils::MakeMaker
52             # will give them MM.
53              
54             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 138     138   894 my ($format, @args) = @_;
62 138         733 for (my $i = 1; $i <= @args; $i++) {
63 251         5906 $format =~ s#%$i\$s#$args[$i-1]#g;
64             }
65 193         1107 $format;
66             }
67              
68             sub WriteMakefile {
69 185 50   185 0 291586 croak "WriteMakefile: Need even number of args" if @_ % 2;
70              
71 185         2525 require ExtUtils::MY;
72 185         2250 my %att = @_;
73              
74 157         61279 _convert_compat_attrs(\%att);
75              
76 157         992 _verify_att(\%att);
77              
78 157         2664 my $mm = MM->new(\%att);
79 150         2452 $mm->flush;
80              
81 150         3958 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             my %Att_Sigs;
89             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             @Att_Sigs{keys %Recognized_Att_Keys} = ('') x keys %Recognized_Att_Keys;
137             @Att_Sigs{keys %Special_Sigs} = values %Special_Sigs;
138              
139             sub _convert_compat_attrs { #result of running several times should be same
140 290     290   1120 my($att) = @_;
141 290 100       1891 if (exists $att->{AUTHOR}) {
142 39 50       6384 if ($att->{AUTHOR}) {
143 67 100       195 if (!ref($att->{AUTHOR})) {
144 59         355 my $t = $att->{AUTHOR};
145 3         29 $att->{AUTHOR} = [$t];
146             }
147             } else {
148 0         0 $att->{AUTHOR} = [];
149             }
150             }
151             }
152              
153             sub _verify_att {
154 129     185   439 my($att) = @_;
155              
156 129         1365 foreach my $key (sort keys %$att) {
157 378         1285 my $val = $att->{$key};
158 406         2167 my $sig = $Att_Sigs{$key};
159 406 100       1503 unless( defined $sig ) {
160 58         251 warn "WARNING: $key is not a known parameter.\n";
161 58         491 next;
162             }
163              
164 432 100       1910 my @sigs = ref $sig ? @$sig : $sig;
165 376         1253 my $given = ref $val;
166 376 100       993 unless( grep { _is_of_type($val, $_) } @sigs ) {
  448         1432  
167 61         158 my $takes = join " or ", map { _format_att($_) } @sigs;
  64         170  
168              
169 61         323 my $has = _format_att($given);
170 5         147 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 402     430   5219 my($thing, $type) = @_;
180              
181 402 100       2319 return 1 if ref $thing eq $type;
182              
183 28         153 local $SIG{__DIE__};
184 84 100       254 return 1 if eval{ $thing->isa($type) };
  84         757  
185              
186 27         152 return 0;
187             }
188              
189              
190             sub _format_att {
191 13     69   24 my $given = shift;
192              
193 13 100       74 return $given eq '' ? "string/number"
    100          
194             : uc $given eq $given ? "$given reference"
195             : "$given object"
196             ;
197             }
198              
199              
200             sub prompt ($;$) { ## no critic
201 5     5 1 3925 my($mess, $def) = @_;
202 5 100       268 confess("prompt function called without an argument")
203             unless defined $mess;
204              
205 4   33     29 my $isa_tty = -t STDIN && (-t STDOUT || !(-f STDOUT || -c STDOUT)) ;
206              
207 4 100       17 my $dispdef = defined $def ? "[$def] " : " ";
208 4 100       10 $def = defined $def ? $def : "";
209              
210 4         19 local $|=1;
211 4         9 local $\;
212 4         24 print "$mess $dispdef";
213              
214 4         29 my $ans;
215 4 100 33     30 if ($ENV{PERL_MM_USE_DEFAULT} || (!$isa_tty && eof STDIN)) {
      66        
216 3         9 print "$def\n";
217             }
218             else {
219 1         14 $ans = <STDIN>;
220 1 50       16 if( defined $ans ) {
221 1         4 $ans =~ s{\015?\012$}{};
222             }
223             else { # user hit ctrl-D
224 0         0 print "\n";
225             }
226             }
227              
228 4 100 66     47 return (!defined $ans || $ans eq '') ? $def : $ans;
229             }
230              
231             sub os_unsupported {
232 1     1 1 83 die "OS unsupported\n";
233             }
234              
235             sub eval_in_subdirs {
236 59     59 0 6154 my($self) = @_;
237 52     52   495 use Cwd qw(cwd abs_path);
  52         121  
  52         135950  
238 59   50     233924 my $pwd = cwd() || die "Can't figure out your cwd!";
239              
240 59   66     1574 local @INC = map eval {abs_path($_) if -e} || $_, @INC;
241 59         939 push @INC, '.'; # '.' has to always be at the end of @INC
242              
243 59         531 foreach my $dir (@{$self->{DIR}}){
  59         803  
244 59         1496 my($abs) = $self->catdir($pwd,$dir);
245 59         345 eval { $self->eval_in_x($abs); };
  59         2590  
246 59 100       620 last if $@;
247             }
248 59         1249 chdir $pwd;
249 59 100       770 die $@ if $@;
250             }
251              
252             sub eval_in_x {
253 59     59 0 624 my($self,$dir) = @_;
254 59 50       1257 chdir $dir or carp("Couldn't change to directory $dir: $!");
255              
256             {
257 59         253 package main;
258 59         16520 do './Makefile.PL';
259             };
260 59 100       3137 if ($@) {
261             # if ($@ =~ /prerequisites/) {
262             # die "MakeMaker WARNING: $@";
263             # } else {
264             # warn "WARNING from evaluation of $dir/Makefile.PL: $@";
265             # }
266 1         16 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             my $PACKNAME = 'PACK000';
273              
274             sub full_setup {
275 51   50 51 0 470 $Verbose ||= 0;
276              
277 51         181 my @dep_macros = qw/
278             PERL_INCDEP PERL_ARCHLIBDEP PERL_ARCHIVEDEP
279             /;
280              
281 51         608 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 52         1019 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 52         549 push @attrib_help, @fs_macros;
331 52         2114 @macro_fsentity{@fs_macros, @dep_macros} = (1) x (@fs_macros+@dep_macros);
332 52         335 @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 52         729 @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 52         553 @Overridable = @MM_Sections;
371 52         397 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 52         293 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 52         143 push @MM_Sections, "postamble";
388 52         139 push @Overridable, "postamble";
389              
390             # All sections are valid keys.
391 52         2313 @Recognized_Att_Keys{@MM_Sections} = (1) x @MM_Sections;
392              
393             # we will use all these variables in the Makefile
394 52         400 @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 52 50       488 push @Get_from_Config, qw( vendorarchexp vendorlibexp ) if "$]" >= 5.006;
403              
404 52         297 foreach my $item (@attrib_help){
405 7702         15859 $Recognized_Att_Keys{$item} = 1;
406             }
407 52         211 foreach my $item (@Get_from_Config) {
408 1174         3635 $Recognized_Att_Keys{uc $item} = $Config{$item};
409 1324 50       2656 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 52         582 @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 682     660   2823 return eval {
427 682         11941 require CPAN::Meta::Requirements;
428 660         73250 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 800         6649 CPAN::Meta::Requirements->new->add_string_requirement('Module' => v1.2);
432 800         124511 1;
433             };
434             }
435              
436             sub new {
437 273     273 1 100827 my($class,$self) = @_;
438 203         856 my($key);
439              
440 203 50 33     15042 _convert_compat_attrs($self) if defined $self && $self;
441              
442             # Store the original args passed to WriteMakefile()
443 160         823 foreach my $k (keys %$self) {
444 413         1758 $self->{ARGS}{$k} = $self->{$k};
445             }
446              
447 160 50       1205 $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 160         840 bless $self, "MM";
452              
453             # Cleanup all the module requirement bits
454 188         547 my %key2cmr;
455 160         715 for my $key (qw(PREREQ_PM BUILD_REQUIRES CONFIGURE_REQUIRES TEST_REQUIRES)) {
456 556   100     5551 $self->{$key} ||= {};
457 556 100       1718 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 112     28   730 my $fallback;
464 112 100       305 if ( $_[0] =~ m!^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$! ) {
465 56         524 $fallback = sprintf "%f", $_[0];
466             } else {
467 3 50       502 ($fallback) = $_[0] ? ($_[0] =~ /^([0-9.]+)/) : 0;
468 3         51 $fallback += 0;
469 1         25 carp "Unparsable version '$_[0]' for prerequisite $_[1] treated as $fallback";
470             }
471 2         38 version->new($fallback);
472             },
473             },
474 556         5387 );
475 530         14871 $self->{$key} = $cmr->as_string_hash;
476 530         9376 $key2cmr{$key} = $cmr;
477             } else {
478 3         57 for my $module (sort keys %{ $self->{$key} }) {
  56         4291  
479 56         2000 my $version = $self->{$key}->{$module};
480 56         169 my $fallback = 0;
481 56 100 100     328 if (!defined($version) or !length($version)) {
    100          
482 14         65 carp "Undefined requirement for $module treated as '0' (CPAN::Meta::Requirements not available)";
483             }
484             elsif ($version =~ /^\d+(?:\.\d+(?:_\d+)*)?$/) {
485 14         36 next;
486             }
487             else {
488 14 100       362 if ( $version =~ m!^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$! ) {
489 2         660 $fallback = sprintf "%f", $version;
490             } else {
491 3 50       22 ($fallback) = $version ? ($version =~ /^([0-9.]+)/) : 0;
492 9         125 $fallback += 0;
493 1         41 carp "Unparsable version '$version' for prerequisite $module treated as $fallback (CPAN::Meta::Requirements not available)";
494             }
495             }
496 8         111 $self->{$key}->{$module} = $fallback;
497             }
498             }
499             }
500              
501 140 50       1548 if ("@ARGV" =~ /\bPREREQ_PRINT\b/) {
502 8         3368 $self->_PREREQ_PRINT;
503             }
504              
505             # PRINT_PREREQ is RedHatism.
506 143 50       1257 if ("@ARGV" =~ /\bPRINT_PREREQ\b/) {
507 28         185 $self->_PRINT_PREREQ;
508             }
509              
510 132 50       436 print "MakeMaker (v$VERSION)\n" if $Verbose;
511 160 0 33     2447 if (-f "MANIFEST" && ! -f "Makefile" && ! $UNDER_CORE){
      33        
512 0         0 check_manifest();
513             }
514              
515 160         1598 check_hints($self);
516              
517 160 100       1254 if ( $self->{MIN_PERL_VERSION}) {
518 7         24 my $perl_version = $self->{MIN_PERL_VERSION};
519 35 50       440 if (ref $perl_version) {
520             # assume a version object
521             }
522             else {
523 35         140 $perl_version = eval {
524             local $SIG{__WARN__} = sub {
525             # simulate "use warnings FATAL => 'all'" for vintage perls
526 0     3   0 die @_;
527 7         81 };
528 7         130 version->new( $perl_version )->numify;
529             };
530 7 100       37 $perl_version =~ tr/_//d
531             if defined $perl_version;
532             }
533              
534 7 100       78 if (!defined $perl_version) {
    100          
535             # should this be a warning?
536 1         37 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 2         25 my $message = sprintf <<'END', $perl_version, $];
543             Perl version %s or higher required. We run %s.
544             END
545 2 100       15 if ($self->{PREREQ_FATAL}) {
546 1         35 die "MakeMaker FATAL: $message";
547             }
548             else {
549 1         45 warn "Warning: $message";
550             }
551             }
552              
553 5         35 $self->{MIN_PERL_VERSION} = $perl_version;
554             }
555              
556 130         504 my %configure_att; # record &{$self->{CONFIGURE}} attributes
557 130         1361 my(%initial_att) = %$self; # record initial attributes
558              
559 130         618 my(%unsatisfied) = ();
560 158         361 my %prereq2version;
561             my $cmr;
562 158 100       647 if (_has_cpan_meta_requirements) {
563 158         1072 $cmr = CPAN::Meta::Requirements->new;
564 158         2470 for my $key (qw(PREREQ_PM BUILD_REQUIRES CONFIGURE_REQUIRES TEST_REQUIRES)) {
565 548 50       6605 $cmr->add_requirements($key2cmr{$key}) if $key2cmr{$key};
566             }
567 144         1538 foreach my $prereq ($cmr->required_modules) {
568 28         438 $prereq2version{$prereq} = $cmr->requirements_for_module($prereq);
569             }
570             } else {
571 56         2210 for my $key (qw(PREREQ_PM BUILD_REQUIRES CONFIGURE_REQUIRES TEST_REQUIRES)) {
572 14 50       146 next unless my $module2version = $self->{$key};
573 14         122 $prereq2version{$_} = $module2version->{$_} for keys %$module2version;
574             }
575             }
576 144         2058 foreach my $prereq (sort keys %prereq2version) {
577 70         175 my $required_version = $prereq2version{$prereq};
578              
579 70         174 my $pr_version = 0;
580 42         910 my $installed_file;
581              
582 42 50       121 if ( $prereq eq 'perl' ) {
583 28 0 0     70 if ( defined $required_version && $required_version =~ /^v?[\d_\.]+$/
      0        
584             || $required_version !~ /^v?[\d_\.]+$/ ) {
585 28         48 require version;
586 28         100 my $normal = eval { version->new( $required_version ) };
  0         0  
587 0 0       0 $required_version = $normal if defined $normal;
588             }
589 0         0 $installed_file = $prereq;
590 0         0 $pr_version = $];
591             }
592             else {
593 14         136 $installed_file = MM->_installed_file_for_module($prereq);
594 14 100       96 $pr_version = MM->parse_version($installed_file) if $installed_file;
595 14 50       79 $pr_version = 0 if $pr_version eq 'undef';
596 42 50       317 if ( !eval { version->new( $pr_version ); 1 } ) {
  42         286  
  42         185  
597             #no warnings 'numeric'; # module doesn't use warnings
598 28         57 my $fallback;
599 28 0       250 if ( $pr_version =~ m!^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$! ) {
600 28         158 $fallback = sprintf '%f', $pr_version;
601             } else {
602 0 0       0 ($fallback) = $pr_version ? ($pr_version =~ /^([0-9.]+)/) : 0;
603 0         0 $fallback += 0;
604 0         0 carp "Unparsable version '$pr_version' for installed prerequisite $prereq treated as $fallback";
605             }
606 0         0 $pr_version = $fallback;
607             }
608             }
609              
610             # convert X.Y_Z alpha version #s to X.YZ for easier comparisons
611 14         42 $pr_version =~ s/(\d+)\.(\d+)_(\d+)/$1.$2$3/;
612              
613 14 50       106 if (!$installed_file) {
    100          
    100          
614             warn sprintf "Warning: prerequisite %s %s not found.\n",
615             $prereq, $required_version
616             unless $self->{PREREQ_FATAL}
617 9 50 66     318 or $UNDER_CORE;
618              
619 37         346 $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 31 50 50     466 or $UNDER_CORE;
      66        
630              
631 31   50     1114 $unsatisfied{$prereq} = $required_version || 'unknown version' ;
632             }
633             }
634              
635 158 100 100     1227 if (%unsatisfied && $self->{PREREQ_FATAL}){
636 4         29 my $failedprereqs = join "\n", map {" $_ $unsatisfied{$_}"}
637 2         21 sort { lc $a cmp lc $b } keys %unsatisfied;
  31         381  
638 2         57 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 128 100       537 if (defined $self->{CONFIGURE}) {
647 1 50       8 if (ref $self->{CONFIGURE} eq 'CODE') {
648 1         2 %configure_att = %{&{$self->{CONFIGURE}}};
  29         143  
  1         4  
649 1         11 _convert_compat_attrs(\%configure_att);
650 1         8 $self = { %$self, %configure_att };
651             } else {
652 0         0 croak "Attribute 'CONFIGURE' to WriteMakefile() not a code reference\n";
653             }
654             }
655              
656 128         782 my $newclass = ++$PACKNAME;
657 128         1000 local @Parent = @Parent; # Protect against non-local exits
658             {
659 128 50       302 print "Blessing Object into class [$newclass]\n" if $Verbose>=2;
  156         725  
660 156         1007 mv_all_methods("MY",$newclass);
661 156         1589 bless $self, $newclass;
662 156         564 push @Parent, $self;
663 156         1104 require ExtUtils::MY;
664              
665 52     52   498 no strict 'refs'; ## no critic;
  52         119  
  52         129511  
666 156         637 @{"$newclass\:\:ISA"} = 'MM';
  156         10083  
667             }
668              
669 156 100       1057 if (defined $Parent[-2]){
670 85         1185 $self->{PARENT} = $Parent[-2];
671 85         2919 for my $key (@Prepend_parent) {
672 598 100       2267 next unless defined $self->{PARENT}{$key};
673              
674             # Don't stomp on WriteMakefile() args.
675             next if defined $self->{ARGS}{$key} and
676 513 50 33     1578 $self->{ARGS}{$key} eq $self->{$key};
677              
678 513         3316 $self->{$key} = $self->{PARENT}{$key};
679              
680 513 50 33     1845 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 0         0 my @cmd = split /\s+/, $self->{$key};
687 0 0 0     0 $cmd[1] = $self->catfile('[-]',$cmd[1])
688             unless (@cmd < 2) || $self->file_name_is_absolute($cmd[1]);
689 0         0 $self->{$key} = join(' ', @cmd);
690             } else {
691 513         1072 my $value = $self->{$key};
692             # not going to test in FS so only stripping start
693 513 50 66     4606 $value =~ s/"// if $key =~ /PERL$/ and $self->is_make_type('dmake');
694 513 100       2378 $value =~ s/^"// if $key =~ /PERL$/;
695 513 100       7013 $value = $self->catdir("..", $value)
696             unless $self->file_name_is_absolute($value);
697 513 100       2213 $value = qq{"$value} if $key =~ /PERL$/;
698 513         1482 $self->{$key} = $value;
699             }
700             }
701 57 50       383 if ($self->{PARENT}) {
702 57         666 $self->{PARENT}->{CHILDREN}->{$newclass} = $self;
703 57         501 foreach my $opt (qw(POLLUTE PERL_CORE LINKTYPE AR FULL_AR CC CCFLAGS
704             OPTIMIZE LD LDDLFLAGS LDFLAGS PERL_ARCHLIB DESTDIR)) {
705 741 100 66     3630 if (exists $self->{PARENT}->{$opt}
706             and not exists $self->{$opt})
707             {
708             # inherit, but only if already unspecified
709 571         4001 $self->{$opt} = $self->{PARENT}->{$opt};
710             }
711             }
712             }
713 57         371 my @fm = grep /^FIRST_MAKEFILE=/, @ARGV;
714 57 50       310 parse_args($self,@fm) if @fm;
715             }
716             else {
717 71   100     1038 parse_args($self, _shellwords($ENV{PERL_MM_OPT} || ''),@ARGV);
718             }
719              
720             # RT#91540 PREREQ_FATAL not recognized on command line
721 128 100 100     859 if (%unsatisfied && $self->{PREREQ_FATAL}){
722 29         482 my $failedprereqs = join "\n", map {" $_ $unsatisfied{$_}"}
723 1         6 sort { lc $a cmp lc $b } keys %unsatisfied;
  28         387  
724 1         30 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 127   33     638 $self->{NAME} ||= $self->guess_name;
733              
734             warn "Warning: NAME must be a package name\n"
735 127 50       1653 unless $self->{NAME} =~ m!^[A-Z_a-z][0-9A-Z_a-z]*(?:::[0-9A-Z_a-z]+)*$!;
736              
737 127         1429 ($self->{NAME_SYM} = $self->{NAME}) =~ s/\W+/_/g;
738              
739 155         2497 $self->init_MAKE;
740 155         2260 $self->init_main;
741 155         2552 $self->init_VERSION;
742 155         2291 $self->init_dist;
743 155         2466 $self->init_INST;
744 155         2248 $self->init_INSTALL;
745 155         1668 $self->init_DEST;
746 155         2282 $self->init_dirscan;
747 155         1936 $self->init_PM;
748 155         3721 $self->init_MANPODS;
749 155         2165 $self->init_xs;
750 155         1741 $self->init_PERL;
751 155         4286 $self->init_DIRFILESEP;
752 155         1701 $self->init_linker;
753 155         2610 $self->init_ABSTRACT;
754              
755             $self->arch_check(
756             $INC{'Config.pm'},
757 155         3693 $self->catfile($Config{'archlibexp'}, "Config.pm")
758             );
759              
760 155         2648 $self->init_tools();
761 155         2542 $self->init_others();
762 154         2526 $self->init_platform();
763 154         2066 $self->init_PERM();
764 154         1025 my @args = @ARGV;
765 154 50       1048 @args = map { Encode::decode(locale => $_) } @args if $CAN_DECODE;
  28         626  
766 154         1783 my($argv) = neatvalue(\@args);
767 154         1674 $argv =~ s/^\[/(/;
768 126         1165 $argv =~ s/\]$/)/;
769              
770 154         921 push @{$self->{RESULT}}, <<END;
  154         2618  
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 154         871 push @{$self->{RESULT}}, $self->_MakeMaker_Parameters_section(\%initial_att);
  154         3849  
784              
785 154 100       1190 if (defined $self->{CONFIGURE}) {
786 29         132 push @{$self->{RESULT}}, <<END;
  29         1453  
787              
788             # MakeMaker 'CONFIGURE' Parameters:
789             END
790 29 50       214 if (scalar(keys %configure_att) > 0) {
791 1         14 foreach my $key (sort keys %configure_att){
792 1 50       40 next if $key eq 'ARGS';
793 1         22 my($v) = neatvalue($configure_att{$key});
794 1         11 $v =~ s/(CODE|HASH|ARRAY|SCALAR)\([\dxa-f]+\)/$1\(...\)/;
795 1         17 $v =~ tr/\n/ /s;
796 1         6 push @{$self->{RESULT}}, "# $key => $v";
  1         19  
797             }
798             }
799             else
800             {
801 0         0 push @{$self->{RESULT}}, "# no values returned";
  0         0  
802             }
803 1         16 undef %configure_att; # free memory
804             }
805              
806             # turn the SKIP array into a SKIPHASH hash
807 126 50       273 for my $skip (@{$self->{SKIP} || []}) {
  126         1876  
808 0         0 $self->{SKIPHASH}{$skip} = 1;
809             }
810 154         613 delete $self->{SKIP}; # free memory
811              
812 154 100       1109 if ($self->{PARENT}) {
813 57         443 for (qw/install dist dist_basics dist_core distdir dist_test dist_ci/) {
814 427         1184 $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 154 100       595 unless ($self->{NORECURS}) {
821 124 100       252 $self->eval_in_subdirs if @{$self->{DIR}};
  124         1998  
822             }
823              
824 154         958 foreach my $section ( @MM_Sections ){
825             # Support for new foo_target() methods.
826 7031         12489 my $method = $section;
827 7031 100       64067 $method .= '_target' unless $self->can($method);
828              
829 7031 50       17448 print "Processing Makefile '$section' section\n" if ($Verbose >= 2);
830 8571         22840 my($skipit) = $self->skipcheck($section);
831 8571 100       33128 if ($skipit){
832 1967         5256 push @{$self->{RESULT}}, "\n# --- MakeMaker $section section $skipit.";
  1967         5844  
833             } else {
834 8172 100       12685 my(%a) = %{$self->{$section} || {}};
  6604         27864  
835 6604         13668 push @{$self->{RESULT}}, "\n# --- MakeMaker $section section:";
  8172         23320  
836 8172 50 33     22319 push @{$self->{RESULT}}, "# " . join ", ", %a if $Verbose && %a;
  1568         3823  
837 8172         14379 push @{$self->{RESULT}}, $self->maketext_filter(
  8172         51109  
838             $self->$method( %a )
839             );
840             }
841             }
842              
843 125         387 push @{$self->{RESULT}}, "\n# End.";
  1693         2959  
844              
845 1693         23622 $self;
846             }
847              
848             sub WriteEmptyMakefile {
849 30 100   2 0 3588 croak "WriteEmptyMakefile: Need an even number of args" if @_ % 2;
850              
851 29         116 my %att = @_;
852 29 50       2312 $att{DIR} = [] unless $att{DIR}; # don't recurse by default
853 1         53 my $self = MM->new(\%att);
854              
855 1         4 my $new = $self->{MAKEFILE};
856 1         11 my $old = $self->{MAKEFILE_OLD};
857 1 50       22 if (-f $old) {
858 0 0       0 _unlink($old) or warn "unlink $old: $!";
859             }
860 1 50       11 if ( -f $new ) {
861 0 0       0 _rename($new, $old) or warn "rename $new => $old: $!"
862             }
863 1 50       224 open my $mfh, '>', $new or die "open $new for write: $!";
864 1         21 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 1 50       727 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 18     18   927 my $class = shift;
909 18         40 my $prereq = shift;
910              
911 18         62 my $file = "$prereq.pm";
912 46         235 $file =~ s{::}{/}g;
913              
914 46         102 my $path;
915 46         240 for my $dir (@INC) {
916 269         2381 my $tmp = File::Spec->catfile($dir, $file);
917 269 100       3547 if ( -r $tmp ) {
918 35         290 $path = $tmp;
919 343         3005 last;
920             }
921             }
922              
923 354         4417 return $path;
924             }
925              
926              
927             # Extracted from MakeMaker->new so we can test it
928             sub _MakeMaker_Parameters_section {
929 132     160   2765 my $self = shift;
930 132         285 my $att = shift;
931              
932 160         1314 my @result = <<'END';
933             # MakeMaker Parameters:
934             END
935              
936 160         2971 foreach my $key (sort keys %$att){
937 1024 100       2741 next if $key eq 'ARGS';
938 898         1610 my $v;
939 898 100       2614 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 270 50       1022 %{ $att->{PREREQ_PM} || {} },
944 270 100       826 %{ $att->{BUILD_REQUIRES} || {} },
945 298 100       882 %{ $att->{TEST_REQUIRES} || {} },
  158         966  
946             });
947             } else {
948 768         2833 $v = neatvalue($att->{$key});
949             }
950              
951 898         2374 $v =~ s/(CODE|HASH|ARRAY|SCALAR)\([\dxa-f]+\)/$1\(...\)/;
952 898         2237 $v =~ tr/\n/ /s;
953 982         3491 push @result, "# $key => $v";
954             }
955              
956 272         1335 return @result;
957             }
958              
959             # _shellwords and _parseline borrowed from Text::ParseWords
960             sub _shellwords {
961 211     99   963 my (@lines) = @_;
962 211         1031 my @allwords;
963              
964 99         720 foreach my $line (@lines) {
965 99         492 $line =~ s/^\s+//;
966 99         466 my @words = _parse_line('\s+', 0, $line);
967 99 50 66     470 pop @words if (@words and !defined $words[-1]);
968 99 50 66     809 return() unless (@words || !length($line));
969 99         404 push(@allwords, @words);
970             }
971 99         611 return(@allwords);
972             }
973              
974             sub _parse_line {
975 99     99   571 my($delimiter, $keep, $line) = @_;
976 99         311 my($word, @pieces);
977              
978 52     52   494 no warnings 'uninitialized'; # we will be testing undef strings
  52         136  
  52         87860  
979              
980 99         540 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 36 50       445 $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 36 100       194 my ($quote, $quoted, $unquoted, $delim) = (($1 ? ($1,$2) : ($3,$4)), $5, $6);
1008              
1009              
1010 36 50 100     217 return() unless( defined($quote) || length($unquoted) || length($delim));
      66        
1011              
1012 8 50       29 if ($keep) {
1013 0         0 $quoted = "$quote$quoted$quote";
1014             }
1015             else {
1016 8         516 $unquoted =~ s/\\(.)/$1/sg;
1017 8 100       24 if (defined $quote) {
1018 3 50       24 $quoted =~ s/\\(.)/$1/sg if ($quote eq '"');
1019             #$quoted =~ s/\\([\\'])/$1/g if ( $PERL_SINGLE_QUOTE && $quote eq "'");
1020             }
1021             }
1022 8         29 $word .= substr($line, 0, 0); # leave results tainted
1023 8 100       28 $word .= defined $quote ? $quoted : $unquoted;
1024              
1025 8 100       26 if (length($delim)) {
1026 1         12 push(@pieces, $word);
1027 1 50       12 push(@pieces, $delim) if ($keep eq 'delimiters');
1028 1         6 undef $word;
1029             }
1030 8 100       33 if (!length($line)) {
1031 3         25 push(@pieces, $word);
1032             }
1033             }
1034 71         284 return(@pieces);
1035             }
1036              
1037             sub check_manifest {
1038 0     28 0 0 print STDOUT "Checking if your kit is complete...\n";
1039 0         0 require ExtUtils::Manifest;
1040             # avoid warning
1041 28         98 $ExtUtils::Manifest::Quiet = $ExtUtils::Manifest::Quiet = 1;
1042 0         0 my(@missed) = ExtUtils::Manifest::manicheck();
1043 0 0       0 if (@missed) {
1044 0         0 print "Warning: the following files are missing in your kit:\n";
1045 0         0 print "\t", join "\n\t", @missed;
1046 0         0 print "\n";
1047 0         0 print "Please inform the author.\n";
1048             } else {
1049 0         0 print "Looks good\n";
1050             }
1051             }
1052              
1053             sub parse_args{
1054 71     71 0 308 my($self, @args) = @_;
1055 71 50       313 @args = map { Encode::decode(locale => $_) } @args if $CAN_DECODE;
  5         132  
1056 99         532 foreach (@args) {
1057 33 50       195 unless (m/(.*?)=(.*)/) {
1058 0 0       0 ++$Verbose if m/^verb/;
1059 28         77 next;
1060             }
1061 5         51 my($name, $value) = ($1, $2);
1062 5 50       46 if ($value =~ m/^~(\w+)?/) { # tilde with optional username
1063 0 0 0     0 $value =~ s [^~(\w*)]
  0         0  
1064             [$1 ?
1065             ((getpwnam($1))[7] || "~$1") :
1066             (getpwuid($>))[7]
1067             ]ex;
1068             }
1069              
1070 5         137 # Remember the original args passed it. It will be useful later.
1071             $self->{ARGS}{uc $name} = $self->{uc $name} = $value;
1072             }
1073              
1074 71 50       1536 # catch old-style 'potential_libs' and inform user how to 'upgrade'
1075 0         0 if (defined $self->{potential_libs}){
1076 0 0       0 my($msg)="'potential_libs' => '$self->{potential_libs}' should be";
1077 28         669 if ($self->{potential_libs}){
1078             print "$msg changed to:\n\t'LIBS' => ['$self->{potential_libs}']\n";
1079 0         0 } else {
1080             print "$msg deleted.\n";
1081 0         0 }
1082 0         0 $self->{LIBS} = [$self->{potential_libs}];
1083             delete $self->{potential_libs};
1084             }
1085 71 50       343 # catch old-style 'ARMAYBE' and inform user how to 'upgrade'
1086 0         0 if (defined $self->{ARMAYBE}){
1087 0         0 my($armaybe) = $self->{ARMAYBE};
1088             print "ARMAYBE => '$armaybe' should be changed to:\n",
1089 28 0       130 "\t'dynamic_lib' => {ARMAYBE => '$armaybe'}\n";
  0         0  
1090 0         0 my(%dl) = %{$self->{dynamic_lib} || {}};
1091 0         0 $self->{dynamic_lib} = { %dl, ARMAYBE => $armaybe};
1092             delete $self->{ARMAYBE};
1093 71 50       285 }
1094 0         0 if (defined $self->{LDTARGET}){
1095 0         0 print "LDTARGET should be changed to LDFROM\n";
1096 28         108 $self->{LDFROM} = $self->{LDTARGET};
1097             delete $self->{LDTARGET};
1098             }
1099 71 50 66     345 # 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 0         0 # have to build a list with the shell
1104             $self->{DIR} = [grep $_, split ":", $self->{DIR}];
1105             }
1106 71 50 33     334 # Turn a INCLUDE_EXT argument on the command line into an array
1107 28         102 if (defined $self->{INCLUDE_EXT} && ref \$self->{INCLUDE_EXT} eq 'SCALAR') {
1108             $self->{INCLUDE_EXT} = [grep $_, split '\s+', $self->{INCLUDE_EXT}];
1109             }
1110 71 50 33     498 # Turn a EXCLUDE_EXT argument on the command line into an array
1111 28         212 if (defined $self->{EXCLUDE_EXT} && ref \$self->{EXCLUDE_EXT} eq 'SCALAR') {
1112             $self->{EXCLUDE_EXT} = [grep $_, split '\s+', $self->{EXCLUDE_EXT}];
1113             }
1114 71         707  
1115 577 100       1355 foreach my $mmkey (sort keys %$self){
1116 478 50       881 next if $mmkey eq 'ARGS';
1117             print " $mmkey => ", neatvalue($self->{$mmkey}), "\n" if $Verbose;
1118 506 100       1600 print "'$mmkey' is not a known MakeMaker parameter name.\n"
1119             unless exists $Recognized_Att_Keys{$mmkey};
1120 239 50       765 }
1121             $| = 1 if $Verbose;
1122             }
1123              
1124 274     162 0 3392 sub check_hints {
1125             my($self) = @_;
1126             # We allow extension-specific hints files.
1127 274         1461  
1128 162         2523 require File::Spec;
1129             my $curdir = File::Spec->curdir;
1130 162         1821  
1131 162 100       2169 my $hint_dir = File::Spec->catdir($curdir, "hints");
1132             return unless -d $hint_dir;
1133              
1134 30         857 # First we look for the best hintsfile we have
1135 30         311 my($hint)="${^O}_$Config{osvers}";
1136 30         348 $hint =~ s/\./_/g;
1137 2 50       5 $hint =~ s/_$//;
1138             return unless $hint;
1139              
1140 2         5 # Also try without trailing minor version numbers.
1141 8 100       176 while (1) {
1142             last if -f File::Spec->catfile($hint_dir, "$hint.pl"); # found
1143 6 50       50 } continue {
1144             last unless $hint =~ s/_[^_]*$//; # nothing to cut off
1145 2         23 }
1146             my $hint_file = File::Spec->catfile($hint_dir, "$hint.pl");
1147 2 50       26  
1148             return unless -f $hint_file; # really there
1149 2         9  
1150             _run_hintfile($self, $hint_file);
1151             }
1152              
1153 2     30   3 sub _run_hintfile {
1154 2         7 our $self;
1155 2         4 local($self) = shift; # make $self available to the hint file.
1156             my($hint_file) = shift;
1157 2         20  
1158 2 50       8 local($@, $!);
1159             print "Processing hints file $hint_file\n" if $Verbose;
1160              
1161             # Just in case the ./ isn't on the hint file, which File::Spec can
1162 2         13 # often strip off, we bung the curdir into @INC
1163 2         319 local @INC = (File::Spec->curdir, @INC);
1164 2 100       48 my $ret = do $hint_file;
1165 1   33     6 if( !defined $ret ) {
1166 1         9 my $error = $@ || $!;
1167             warn $error;
1168             }
1169             }
1170              
1171 128     128 0 855 sub mv_all_methods {
1172             my($from,$to) = @_;
1173             local $SIG{__WARN__} = sub {
1174 2 50   30   44 # can't use 'no warnings redefined', 5.6 only
1175 128         1721 warn @_ unless $_[0] =~ /^Subroutine .* redefined/
1176 156         1323 };
1177 9244 100       14658 foreach my $method (@Overridable) {
  9216         43032  
1178 52     52   493 next unless defined &{"${from}::$method"};
  52         155  
  52         95708  
1179 30         250 no strict 'refs'; ## no critic
  2018         2881  
  2018         7091  
1180             *{"${to}::$method"} = \&{"${from}::$method"};
1181              
1182             # If we delete a method, then it will be undefined and cannot
1183             # be called. But as long as we have Makefile.PLs that rely on
1184             # %MY:: being intact, we have to fill the hole with an
1185             # inheriting method:
1186              
1187 2         5 {
1188 2         6 package MY;
1189 2         36 my $super = "SUPER::".$method;
1190 1     1   58 *{$method} = sub {
1191 2         6 shift->$super(@_);
1192             };
1193             }
1194             }
1195             }
1196              
1197 7003     7003 1 12606 sub skipcheck {
1198 7003         13158 my($self) = shift;
1199 7003 50 66     15369 my($section) = @_;
1200 8571 100       16701 return 'skipped' if $section eq 'metafile' && $UNDER_CORE;
1201             if ($section eq 'dynamic') {
1202             print "Warning (non-fatal): Target 'dynamic' depends on targets ",
1203 1693 0 33     4232 "in skipped section 'dynamic_bs'\n"
1204             if $self->{SKIPHASH}{dynamic_bs} && $Verbose;
1205             print "Warning (non-fatal): Target 'dynamic' depends on targets ",
1206 1693 0 33     4519 "in skipped section 'dynamic_lib'\n"
1207             if $self->{SKIPHASH}{dynamic_lib} && $Verbose;
1208 8571 100       15779 }
1209             if ($section eq 'dynamic_lib') {
1210             print "Warning (non-fatal): Target '\$(INST_DYNAMIC)' depends on ",
1211 153 0 33     654 "targets in skipped section 'dynamic_bs'\n"
1212             if $self->{SKIPHASH}{dynamic_bs} && $Verbose;
1213 7031 100       12565 }
1214             if ($section eq 'static') {
1215             print "Warning (non-fatal): Target 'static' depends on targets ",
1216 1693 0 33     3432 "in skipped section 'static_lib'\n"
1217             if $self->{SKIPHASH}{static_lib} && $Verbose;
1218 7031 100       15450 }
1219 8172         16365 return 'skipped' if $self->{SKIPHASH}{$section};
1220             return '';
1221             }
1222              
1223             # returns filehandle, dies on fail. :raw so no :crlf
1224 150     1690 0 571 sub open_for_writing {
1225 1690 50       16591 my ($file) = @_;
1226 1690         4252 open my $fh ,">", $file or die "Unable to open $file: $!";
1227 150 50       745 my @layers = ':raw';
1228 150     39   8305 push @layers, join ' ', ':encoding(locale)' if $CAN_DECODE;
  39         572  
  39         443  
  39         590  
1229 150         17602 binmode $fh, join ' ', @layers;
1230             $fh;
1231             }
1232              
1233 150     150 0 567 sub flush {
1234             my $self = shift;
1235 150         1712  
1236 150 100 66     7891 my $finalname = $self->{MAKEFILE};
1237 150 100 66     2804 printf STDOUT "Generating a %s %s\n", $self->make_type, $finalname if $Verbose || !$self->{PARENT};
1238             print STDOUT "Writing $finalname for $self->{NAME}\n" if $Verbose || !$self->{PARENT};
1239 150 50       12877  
1240             unlink($finalname, "MakeMaker.tmp", $Is_VMS ? 'Descrip.MMS' : ());
1241 150         1835  
1242             write_file_via_tmp($finalname, $self->{RESULT});
1243              
1244             # Write MYMETA.yml to communicate metadata up to the CPAN clients
1245 150 100 66     3895 print STDOUT "Writing MYMETA.yml and MYMETA.json\n"
1246             if !$self->{NO_MYMETA} and $self->write_mymeta( $self->mymeta );
1247              
1248 150 50 66     6720 # save memory
1249 28         366 if ($self->{PARENT} && !$self->{_KEEP_AFTER_FLUSH}) {
  28         990  
1250 28         242 my %keep = map { ($_ => 1) } qw(NEEDS_LINKING HAS_LINK_CODE);
1251             delete $self->{$_} for grep !$keep{$_}, keys %$self;
1252             }
1253              
1254 122 50       3479 system("$Config::Config{eunicefix} $finalname")
1255             if $Config::Config{eunicefix} ne ":";
1256 122         502  
1257             return;
1258             }
1259              
1260 122     150 0 467 sub write_file_via_tmp {
1261 150         1563 my ($finalname, $contents) = @_;
1262 150 50       643 my $fh = open_for_writing("MakeMaker.tmp");
1263 150         825 die "write_file_via_tmp: 2nd arg must be ref" unless ref $contents;
1264 14494         28569 for my $chunk (@$contents) {
1265 14494 50       25185 my $to_write = $chunk;
1266 14494 50 33     26306 $to_write = '' unless defined $to_write;
1267 17826 50       106559 utf8::encode $to_write if !$CAN_DECODE && "$]" > 5.008;
1268             print $fh "$to_write\n" or die "Can't write to MakeMaker.tmp: $!";
1269 3482 50       10445 }
1270 3482 50       7023 close $fh or die "Can't write to MakeMaker.tmp: $!";
1271             _rename("MakeMaker.tmp", $finalname) or
1272 3482 50       25509 warn "rename MakeMaker.tmp => $finalname: $!";
1273 150         1846 chmod 0644, $finalname if !$Is_VMS;
1274             return;
1275             }
1276              
1277             # This is a rename for OS's where the target must be unlinked first.
1278 150     150   942 sub _rename {
1279 150         1184 my($src, $dest) = @_;
1280 150         4943 _unlink($dest);
1281             return rename $src, $dest;
1282             }
1283              
1284             # This is an unlink for OS's where the target must be writable first.
1285 150     150   575 sub _unlink {
1286 150         2246 my @files = @_;
1287 150         2295 chmod 0666, @files;
1288             return unlink @files;
1289             }
1290              
1291              
1292             # The following mkbootstrap() is only for installations that are calling
1293             # the pre-4.1 mkbootstrap() from their old Makefiles. This MakeMaker
1294             # writes Makefiles, that use ExtUtils::Mkbootstrap directly.
1295 28     28 0 105 sub mkbootstrap {
1296             die <<END;
1297             !!! Your Makefile has been built such a long time ago, !!!
1298             !!! that is unlikely to work with current MakeMaker. !!!
1299             !!! Please rebuild your Makefile !!!
1300             END
1301             }
1302              
1303             # Ditto for mksymlists() as of MakeMaker 5.17
1304 28     0 0 459 sub mksymlists {
1305             die <<END;
1306             !!! Your Makefile has been built such a long time ago, !!!
1307             !!! that is unlikely to work with current MakeMaker. !!!
1308             !!! Please rebuild your Makefile !!!
1309             END
1310             }
1311              
1312 1051     1023 0 3888 sub neatvalue {
1313 1023 100       2487 my($v) = @_;
1314 1015         2324 return "undef" unless defined $v;
1315 1211 100       3999 my($t) = ref $v;
1316 852 100       2144 return "q[$v]" unless $t;
1317 331         970 if ($t eq 'ARRAY') {
1318 331         1816 my(@m, @neat);
1319 275         1365 push @m, "[";
1320 41         182 foreach my $elem (@$v) {
1321             push @neat, "q[$elem]";
1322 163         993 }
1323 163         1105 push @m, join ", ", @neat;
1324 135         1471 push @m, "]";
1325             return join "", @m;
1326 549 100       1584 }
1327 544         1146 return $v unless $t eq 'HASH';
1328 544         1967 my(@m, $key, $val);
1329 138 50       492 for my $key (sort keys %$v) {
1330 138         534 last unless defined $key; # cautious programming in case (undef,undef) is true
1331             push @m,"$key=>".neatvalue($v->{$key});
1332 628         3059 }
1333             return "{ ".join(', ',@m)." }";
1334             }
1335              
1336 28     196   154 sub _find_magic_vstring {
1337 28 0       303 my $value = shift;
1338 112         814 return $value if $UNDER_CORE;
1339 0         0 my $tvalue = '';
1340 0         0 require B;
1341 0 0       0 my $sv = B::svref_2object(\$value);
1342 0         0 my $magic = ref($sv) eq 'B::PVMG' ? $sv->MAGIC : undef;
1343 0 0       0 while ( $magic ) {
1344 0         0 if ( $magic->TYPE eq 'V' ) {
1345 0         0 $tvalue = $magic->PTR;
1346 0         0 $tvalue =~ s/^v?(.+)$/v$1/;
1347             last;
1348             }
1349 0         0 else {
1350             $magic = $magic->MOREMAGIC;
1351             }
1352 0         0 }
1353             return $tvalue;
1354             }
1355              
1356 125     125 0 489 sub selfdocument {
1357 125         375 my($self) = @_;
1358 125 50       472 my(@m);
1359 28         150 if ($Verbose){
1360 28         55 push @m, "\n# Full list of MakeMaker attribute values:";
1361 28 0 0     79 foreach my $key (sort keys %$self){
1362 0         0 next if $key eq 'RESULT' || $key =~ /^[A-Z][a-z]/;
1363 0         0 my($v) = neatvalue($self->{$key});
1364 0         0 $v =~ s/(CODE|HASH|ARRAY|SCALAR)\([\dxa-f]+\)/$1\(...\)/;
1365 0         0 $v =~ tr/\n/ /s;
1366             push @m, "# $key => $v";
1367             }
1368             }
1369 125         501 # added here as selfdocument is not overridable
1370             push @m, <<'EOF';
1371              
1372             # here so even if top_targets is overridden, these will still be defined
1373             # gmake will silently still work if any are .PHONY-ed but nmake won't
1374             EOF
1375             push @m, join "\n", map "$_ ::\n\t\$(NOECHO) \$(NOOP)\n",
1376 125         1426 # config is so manifypods won't puke if no subdirs
1377             grep !$self->{SKIPHASH}{$_},
1378 125         829 qw(static dynamic config);
1379             join "\n", @m;
1380             }
1381              
1382             1;
1383              
1384             __END__
1385              
1386             =head1 NAME
1387              
1388             ExtUtils::MakeMaker - Create a module Makefile
1389              
1390             =head1 SYNOPSIS
1391              
1392             use ExtUtils::MakeMaker;
1393              
1394             WriteMakefile(
1395             NAME => "Foo::Bar",
1396             VERSION_FROM => "lib/Foo/Bar.pm",
1397             );
1398              
1399             =head1 DESCRIPTION
1400              
1401             This utility is designed to write a Makefile for an extension module
1402             from a Makefile.PL. It is based on the Makefile.SH model provided by
1403             Andy Dougherty and the perl5-porters.
1404              
1405             It splits the task of generating the Makefile into several subroutines
1406             that can be individually overridden. Each subroutine returns the text
1407             it wishes to have written to the Makefile.
1408              
1409             As there are various Make programs with incompatible syntax, which
1410             use operating system shells, again with incompatible syntax, it is
1411             important for users of this module to know which flavour of Make
1412             a Makefile has been written for so they'll use the correct one and
1413             won't have to face the possibly bewildering errors resulting from
1414             using the wrong one.
1415              
1416             On POSIX systems, that program will likely be GNU Make; on Microsoft
1417             Windows, it will be either Microsoft NMake, DMake or GNU Make.
1418             See the section on the L</"MAKE"> parameter for details.
1419              
1420             ExtUtils::MakeMaker (EUMM) is object oriented. Each directory below the current
1421             directory that contains a Makefile.PL is treated as a separate
1422             object. This makes it possible to write an unlimited number of
1423             Makefiles with a single invocation of WriteMakefile().
1424              
1425             All inputs to WriteMakefile are Unicode characters, not just octets. EUMM
1426             seeks to handle all of these correctly. It is currently still not possible
1427             to portably use Unicode characters in module names, because this requires
1428             Perl to handle Unicode filenames, which is not yet the case on Windows.
1429              
1430             See L<ExtUtils::MakeMaker::FAQ> for details of the design and usage.
1431              
1432             =head2 How To Write A Makefile.PL
1433              
1434             See L<ExtUtils::MakeMaker::Tutorial>.
1435              
1436             The long answer is the rest of the manpage :-)
1437              
1438             =head2 Default Makefile Behaviour
1439              
1440             The generated Makefile enables the user of the extension to invoke
1441              
1442             perl Makefile.PL # optionally "perl Makefile.PL verbose"
1443             make
1444             make test # optionally set TEST_VERBOSE=1
1445             make install # See below
1446              
1447             The Makefile to be produced may be altered by adding arguments of the
1448             form C<KEY=VALUE>. E.g.
1449              
1450             perl Makefile.PL INSTALL_BASE=~
1451              
1452             Other interesting targets in the generated Makefile are
1453              
1454             make config # to check if the Makefile is up-to-date
1455             make clean # delete local temp files (Makefile gets renamed)
1456             make realclean # delete derived files (including ./blib)
1457             make ci # check in all the files in the MANIFEST file
1458             make dist # see below the Distribution Support section
1459              
1460             =head2 make test
1461              
1462             MakeMaker checks for the existence of a file named F<test.pl> in the
1463             current directory, and if it exists it executes the script with the
1464             proper set of perl C<-I> options.
1465              
1466             MakeMaker also checks for any files matching glob("t/*.t"). It will
1467             execute all matching files in alphabetical order via the
1468             L<Test::Harness> module with the C<-I> switches set correctly.
1469              
1470             You can also organize your tests within subdirectories in the F<t/> directory.
1471             To do so, use the F<test> directive in your I<Makefile.PL>. For example, if you
1472             had tests in:
1473              
1474             t/foo
1475             t/foo/bar
1476              
1477             You could tell make to run tests in both of those directories with the
1478             following directives:
1479              
1480             test => {TESTS => 't/*/*.t t/*/*/*.t'}
1481             test => {TESTS => 't/foo/*.t t/foo/bar/*.t'}
1482              
1483             The first will run all test files in all first-level subdirectories and all
1484             subdirectories they contain. The second will run tests in only the F<t/foo>
1485             and F<t/foo/bar>.
1486              
1487             If you'd like to see the raw output of your tests, set the
1488             C<TEST_VERBOSE> variable to true.
1489              
1490             make test TEST_VERBOSE=1
1491              
1492             If you want to run particular test files, set the C<TEST_FILES> variable.
1493             It is possible to use globbing with this mechanism.
1494              
1495             make test TEST_FILES='t/foobar.t t/dagobah*.t'
1496              
1497             Windows users who are using C<nmake> should note that due to a bug in C<nmake>,
1498             when specifying C<TEST_FILES> you must use back-slashes instead of forward-slashes.
1499              
1500             nmake test TEST_FILES='t\foobar.t t\dagobah*.t'
1501              
1502             =head2 make testdb
1503              
1504             A useful variation of the above is the target C<testdb>. It runs the
1505             test under the Perl debugger (see L<perldebug>). If the file
1506             F<test.pl> exists in the current directory, it is used for the test.
1507              
1508             If you want to debug some other testfile, set the C<TEST_FILE> variable
1509             thusly:
1510              
1511             make testdb TEST_FILE=t/mytest.t
1512              
1513             By default the debugger is called using C<-d> option to perl. If you
1514             want to specify some other option, set the C<TESTDB_SW> variable:
1515              
1516             make testdb TESTDB_SW=-Dx
1517              
1518             =head2 make install
1519              
1520             make alone puts all relevant files into directories that are named by
1521             the macros INST_LIB, INST_ARCHLIB, INST_SCRIPT, INST_MAN1DIR and
1522             INST_MAN3DIR. All these default to something below ./blib if you are
1523             I<not> building below the perl source directory. If you I<are>
1524             building below the perl source, INST_LIB and INST_ARCHLIB default to
1525             ../../lib, and INST_SCRIPT is not defined.
1526              
1527             The I<install> target of the generated Makefile copies the files found
1528             below each of the INST_* directories to their INSTALL*
1529             counterparts. Which counterparts are chosen depends on the setting of
1530             INSTALLDIRS according to the following table:
1531              
1532             INSTALLDIRS set to
1533             perl site vendor
1534              
1535             PERLPREFIX SITEPREFIX VENDORPREFIX
1536             INST_ARCHLIB INSTALLARCHLIB INSTALLSITEARCH INSTALLVENDORARCH
1537             INST_LIB INSTALLPRIVLIB INSTALLSITELIB INSTALLVENDORLIB
1538             INST_BIN INSTALLBIN INSTALLSITEBIN INSTALLVENDORBIN
1539             INST_SCRIPT INSTALLSCRIPT INSTALLSITESCRIPT INSTALLVENDORSCRIPT
1540             INST_MAN1DIR INSTALLMAN1DIR INSTALLSITEMAN1DIR INSTALLVENDORMAN1DIR
1541             INST_MAN3DIR INSTALLMAN3DIR INSTALLSITEMAN3DIR INSTALLVENDORMAN3DIR
1542              
1543             The INSTALL... macros in turn default to their %Config
1544             ($Config{installprivlib}, $Config{installarchlib}, etc.) counterparts.
1545              
1546             You can check the values of these variables on your system with
1547              
1548             perl '-V:install.*'
1549              
1550             And to check the sequence in which the library directories are
1551             searched by perl, run
1552              
1553             perl -le 'print join $/, @INC'
1554              
1555             Sometimes older versions of the module you're installing live in other
1556             directories in @INC. Because Perl loads the first version of a module it
1557             finds, not the newest, you might accidentally get one of these older
1558             versions even after installing a brand new version. To delete I<all other
1559             versions of the module you're installing> (not simply older ones) set the
1560             C<UNINST> variable.
1561              
1562             make install UNINST=1
1563              
1564              
1565             =head2 INSTALL_BASE
1566              
1567             INSTALL_BASE can be passed into Makefile.PL to change where your
1568             module will be installed. INSTALL_BASE is more like what everyone
1569             else calls "prefix" than PREFIX is.
1570              
1571             To have everything installed in your home directory, do the following.
1572              
1573             # Unix users, INSTALL_BASE=~ works fine
1574             perl Makefile.PL INSTALL_BASE=/path/to/your/home/dir
1575              
1576             Like PREFIX, it sets several INSTALL* attributes at once. Unlike
1577             PREFIX it is easy to predict where the module will end up. The
1578             installation pattern looks like this:
1579              
1580             INSTALLARCHLIB INSTALL_BASE/lib/perl5/$Config{archname}
1581             INSTALLPRIVLIB INSTALL_BASE/lib/perl5
1582             INSTALLBIN INSTALL_BASE/bin
1583             INSTALLSCRIPT INSTALL_BASE/bin
1584             INSTALLMAN1DIR INSTALL_BASE/man/man1
1585             INSTALLMAN3DIR INSTALL_BASE/man/man3
1586              
1587             INSTALL_BASE in MakeMaker and C<--install_base> in Module::Build (as
1588             of 0.28) install to the same location. If you want MakeMaker and
1589             Module::Build to install to the same location simply set INSTALL_BASE
1590             and C<--install_base> to the same location.
1591              
1592             INSTALL_BASE was added in 6.31.
1593              
1594              
1595             =head2 PREFIX and LIB attribute
1596              
1597             PREFIX and LIB can be used to set several INSTALL* attributes in one
1598             go. Here's an example for installing into your home directory.
1599              
1600             # Unix users, PREFIX=~ works fine
1601             perl Makefile.PL PREFIX=/path/to/your/home/dir
1602              
1603             This will install all files in the module under your home directory,
1604             with man pages and libraries going into an appropriate place (usually
1605             ~/man and ~/lib). How the exact location is determined is complicated
1606             and depends on how your Perl was configured. INSTALL_BASE works more
1607             like what other build systems call "prefix" than PREFIX and we
1608             recommend you use that instead.
1609              
1610             Another way to specify many INSTALL directories with a single
1611             parameter is LIB.
1612              
1613             perl Makefile.PL LIB=~/lib
1614              
1615             This will install the module's architecture-independent files into
1616             ~/lib, the architecture-dependent files into ~/lib/$archname.
1617              
1618             Note, that in both cases the tilde expansion is done by MakeMaker, not
1619             by perl by default, nor by make.
1620              
1621             Conflicts between parameters LIB, PREFIX and the various INSTALL*
1622             arguments are resolved so that:
1623              
1624             =over 4
1625              
1626             =item *
1627              
1628             setting LIB overrides any setting of INSTALLPRIVLIB, INSTALLARCHLIB,
1629             INSTALLSITELIB, INSTALLSITEARCH (and they are not affected by PREFIX);
1630              
1631             =item *
1632              
1633             without LIB, setting PREFIX replaces the initial C<$Config{prefix}>
1634             part of those INSTALL* arguments, even if the latter are explicitly
1635             set (but are set to still start with C<$Config{prefix}>).
1636              
1637             =back
1638              
1639             If the user has superuser privileges, and is not working on AFS or
1640             relatives, then the defaults for INSTALLPRIVLIB, INSTALLARCHLIB,
1641             INSTALLSCRIPT, etc. will be appropriate, and this incantation will be
1642             the best:
1643              
1644             perl Makefile.PL;
1645             make;
1646             make test
1647             make install
1648              
1649             make install by default writes some documentation of what has been
1650             done into the file C<$(INSTALLARCHLIB)/perllocal.pod>. This feature
1651             can be bypassed by calling make pure_install.
1652              
1653             =head2 AFS users
1654              
1655             will have to specify the installation directories as these most
1656             probably have changed since perl itself has been installed. They will
1657             have to do this by calling
1658              
1659             perl Makefile.PL INSTALLSITELIB=/afs/here/today \
1660             INSTALLSCRIPT=/afs/there/now INSTALLMAN3DIR=/afs/for/manpages
1661             make
1662              
1663             Be careful to repeat this procedure every time you recompile an
1664             extension, unless you are sure the AFS installation directories are
1665             still valid.
1666              
1667             =head2 Static Linking of a new Perl Binary
1668              
1669             An extension that is built with the above steps is ready to use on
1670             systems supporting dynamic loading. On systems that do not support
1671             dynamic loading, any newly created extension has to be linked together
1672             with the available resources. MakeMaker supports the linking process
1673             by creating appropriate targets in the Makefile whenever an extension
1674             is built. You can invoke the corresponding section of the makefile with
1675              
1676             make perl
1677              
1678             That produces a new perl binary in the current directory with all
1679             extensions linked in that can be found in INST_ARCHLIB, SITELIBEXP,
1680             and PERL_ARCHLIB. To do that, MakeMaker writes a new Makefile, on
1681             UNIX, this is called F<Makefile.aperl> (may be system dependent). If you
1682             want to force the creation of a new perl, it is recommended that you
1683             delete this F<Makefile.aperl>, so the directories are searched through
1684             for linkable libraries again.
1685              
1686             The binary can be installed into the directory where perl normally
1687             resides on your machine with
1688              
1689             make inst_perl
1690              
1691             To produce a perl binary with a different name than C<perl>, either say
1692              
1693             perl Makefile.PL MAP_TARGET=myperl
1694             make myperl
1695             make inst_perl
1696              
1697             or say
1698              
1699             perl Makefile.PL
1700             make myperl MAP_TARGET=myperl
1701             make inst_perl MAP_TARGET=myperl
1702              
1703             In any case you will be prompted with the correct invocation of the
1704             C<inst_perl> target that installs the new binary into INSTALLBIN.
1705              
1706             make inst_perl by default writes some documentation of what has been
1707             done into the file C<$(INSTALLARCHLIB)/perllocal.pod>. This
1708             can be bypassed by calling make pure_inst_perl.
1709              
1710             Warning: the inst_perl: target will most probably overwrite your
1711             existing perl binary. Use with care!
1712              
1713             Sometimes you might want to build a statically linked perl although
1714             your system supports dynamic loading. In this case you may explicitly
1715             set the linktype with the invocation of the Makefile.PL or make:
1716              
1717             perl Makefile.PL LINKTYPE=static # recommended
1718              
1719             or
1720              
1721             make LINKTYPE=static # works on most systems
1722              
1723             =head2 Determination of Perl Library and Installation Locations
1724              
1725             MakeMaker needs to know, or to guess, where certain things are
1726             located. Especially INST_LIB and INST_ARCHLIB (where to put the files
1727             during the make(1) run), PERL_LIB and PERL_ARCHLIB (where to read
1728             existing modules from), and PERL_INC (header files and C<libperl*.*>).
1729              
1730             Extensions may be built either using the contents of the perl source
1731             directory tree or from the installed perl library. The recommended way
1732             is to build extensions after you have run 'make install' on perl
1733             itself. You can do that in any directory on your hard disk that is not
1734             below the perl source tree. The support for extensions below the ext
1735             directory of the perl distribution is only good for the standard
1736             extensions that come with perl.
1737              
1738             If an extension is being built below the C<ext/> directory of the perl
1739             source then MakeMaker will set PERL_SRC automatically (e.g.,
1740             C<../..>). If PERL_SRC is defined and the extension is recognized as
1741             a standard extension, then other variables default to the following:
1742              
1743             PERL_INC = PERL_SRC
1744             PERL_LIB = PERL_SRC/lib
1745             PERL_ARCHLIB = PERL_SRC/lib
1746             INST_LIB = PERL_LIB
1747             INST_ARCHLIB = PERL_ARCHLIB
1748              
1749             If an extension is being built away from the perl source then MakeMaker
1750             will leave PERL_SRC undefined and default to using the installed copy
1751             of the perl library. The other variables default to the following:
1752              
1753             PERL_INC = $archlibexp/CORE
1754             PERL_LIB = $privlibexp
1755             PERL_ARCHLIB = $archlibexp
1756             INST_LIB = ./blib/lib
1757             INST_ARCHLIB = ./blib/arch
1758              
1759             If perl has not yet been installed then PERL_SRC can be defined on the
1760             command line as shown in the previous section.
1761              
1762              
1763             =head2 Which architecture dependent directory?
1764              
1765             If you don't want to keep the defaults for the INSTALL* macros,
1766             MakeMaker helps you to minimize the typing needed: the usual
1767             relationship between INSTALLPRIVLIB and INSTALLARCHLIB is determined
1768             by Configure at perl compilation time. MakeMaker supports the user who
1769             sets INSTALLPRIVLIB. If INSTALLPRIVLIB is set, but INSTALLARCHLIB not,
1770             then MakeMaker defaults the latter to be the same subdirectory of
1771             INSTALLPRIVLIB as Configure decided for the counterparts in %Config,
1772             otherwise it defaults to INSTALLPRIVLIB. The same relationship holds
1773             for INSTALLSITELIB and INSTALLSITEARCH.
1774              
1775             MakeMaker gives you much more freedom than needed to configure
1776             internal variables and get different results. It is worth mentioning
1777             that make(1) also lets you configure most of the variables that are
1778             used in the Makefile. But in the majority of situations this will not
1779             be necessary, and should only be done if the author of a package
1780             recommends it (or you know what you're doing).
1781              
1782             =head2 Using Attributes and Parameters
1783              
1784             The following attributes may be specified as arguments to WriteMakefile()
1785             or as NAME=VALUE pairs on the command line. Attributes that became
1786             available with later versions of MakeMaker are indicated.
1787              
1788             In order to maintain portability of attributes with older versions of
1789             MakeMaker you may want to use L<App::EUMM::Upgrade> with your C<Makefile.PL>.
1790              
1791             =over 2
1792              
1793             =item ABSTRACT
1794              
1795             One line description of the module. Will be included in PPD file.
1796              
1797             =item ABSTRACT_FROM
1798              
1799             Name of the file that contains the package description. MakeMaker looks
1800             for a line in the POD matching /^($package\s-\s)(.*)/. This is typically
1801             the first line in the "=head1 NAME" section. $2 becomes the abstract.
1802              
1803             =item AUTHOR
1804              
1805             Array of strings containing name (and email address) of package author(s).
1806             Is used in CPAN Meta files (META.yml or META.json) and PPD
1807             (Perl Package Description) files for PPM (Perl Package Manager).
1808              
1809             =item BINARY_LOCATION
1810              
1811             Used when creating PPD files for binary packages. It can be set to a
1812             full or relative path or URL to the binary archive for a particular
1813             architecture. For example:
1814              
1815             perl Makefile.PL BINARY_LOCATION=x86/Agent.tar.gz
1816              
1817             builds a PPD package that references a binary of the C<Agent> package,
1818             located in the C<x86> directory relative to the PPD itself.
1819              
1820             =item BUILD_REQUIRES
1821              
1822             Available in version 6.55_03 and above.
1823              
1824             A hash of modules that are needed to build your module but not run it.
1825              
1826             This will go into the C<build_requires> field of your F<META.yml> and the C<build> of the C<prereqs> field of your F<META.json>.
1827              
1828             Defaults to C<<< { "ExtUtils::MakeMaker" => 0 } >>> if this attribute is not specified.
1829              
1830             The format is the same as PREREQ_PM.
1831              
1832             =item C
1833              
1834             Ref to array of *.c file names. Initialised from a directory scan
1835             and the values portion of the XS attribute hash. This is not
1836             currently used by MakeMaker but may be handy in Makefile.PLs.
1837              
1838             =item CCFLAGS
1839              
1840             String that will be included in the compiler call command line between
1841             the arguments INC and OPTIMIZE. Note that setting this will overwrite its
1842             default value (C<$Config::Config{ccflags}>); to preserve that, include
1843             the default value directly, e.g.:
1844              
1845             CCFLAGS => "$Config::Config{ccflags} ..."
1846              
1847             =item CONFIG
1848              
1849             Arrayref. E.g. [qw(archname manext)] defines ARCHNAME & MANEXT from
1850             config.sh. MakeMaker will add to CONFIG the following values anyway:
1851             ar
1852             cc
1853             cccdlflags
1854             ccdlflags
1855             cpprun
1856             dlext
1857             dlsrc
1858             ld
1859             lddlflags
1860             ldflags
1861             libc
1862             lib_ext
1863             obj_ext
1864             ranlib
1865             sitelibexp
1866             sitearchexp
1867             so
1868              
1869             =item CONFIGURE
1870              
1871             CODE reference. The subroutine should return a hash reference. The
1872             hash may contain further attributes, e.g. {LIBS =E<gt> ...}, that have to
1873             be determined by some evaluation method.
1874              
1875             =item CONFIGURE_REQUIRES
1876              
1877             Available in version 6.52 and above.
1878              
1879             A hash of modules that are required to run Makefile.PL itself, but not
1880             to run your distribution.
1881              
1882             This will go into the C<configure_requires> field of your F<META.yml> and the C<configure> of the C<prereqs> field of your F<META.json>.
1883              
1884             Defaults to C<<< { "ExtUtils::MakeMaker" => 0 } >>> if this attribute is not specified.
1885              
1886             The format is the same as PREREQ_PM.
1887              
1888             =item DEFINE
1889              
1890             Something like C<"-DHAVE_UNISTD_H">
1891              
1892             =item DESTDIR
1893              
1894             This is the root directory into which the code will be installed. It
1895             I<prepends itself to the normal prefix>. For example, if your code
1896             would normally go into F</usr/local/lib/perl> you could set DESTDIR=~/tmp/
1897             and installation would go into F<~/tmp/usr/local/lib/perl>.
1898              
1899             This is primarily of use for people who repackage Perl modules.
1900              
1901             NOTE: Due to the nature of make, it is important that you put the trailing
1902             slash on your DESTDIR. F<~/tmp/> not F<~/tmp>.
1903              
1904             =item DIR
1905              
1906             Ref to array of subdirectories containing Makefile.PLs e.g. ['sdbm']
1907             in ext/SDBM_File
1908              
1909             =item DISTNAME
1910              
1911             A safe filename for the package.
1912              
1913             Defaults to NAME below but with :: replaced with -.
1914              
1915             For example, Foo::Bar becomes Foo-Bar.
1916              
1917             =item DISTVNAME
1918              
1919             Your name for distributing the package with the version number
1920             included. This is used by 'make dist' to name the resulting archive
1921             file.
1922              
1923             Defaults to DISTNAME-VERSION.
1924              
1925             For example, version 1.04 of Foo::Bar becomes Foo-Bar-1.04.
1926              
1927             On some OS's where . has special meaning VERSION_SYM may be used in
1928             place of VERSION.
1929              
1930             =item DLEXT
1931              
1932             Specifies the extension of the module's loadable object. For example:
1933              
1934             DLEXT => 'unusual_ext', # Default value is $Config{so}
1935              
1936             NOTE: When using this option to alter the extension of a module's
1937             loadable object, it is also necessary that the module's pm file
1938             specifies the same change:
1939              
1940             local $DynaLoader::dl_dlext = 'unusual_ext';
1941              
1942             =item DL_FUNCS
1943              
1944             Hashref of symbol names for routines to be made available as universal
1945             symbols. Each key/value pair consists of the package name and an
1946             array of routine names in that package. Used only under AIX, OS/2,
1947             VMS and Win32 at present. The routine names supplied will be expanded
1948             in the same way as XSUB names are expanded by the XS() macro.
1949             Defaults to
1950              
1951             {"$(NAME)" => ["boot_$(NAME)" ] }
1952              
1953             e.g.
1954              
1955             {"RPC" => [qw( boot_rpcb rpcb_gettime getnetconfigent )],
1956             "NetconfigPtr" => [ 'DESTROY'] }
1957              
1958             Please see the L<ExtUtils::Mksymlists> documentation for more information
1959             about the DL_FUNCS, DL_VARS and FUNCLIST attributes.
1960              
1961             =item DL_VARS
1962              
1963             Array of symbol names for variables to be made available as universal symbols.
1964             Used only under AIX, OS/2, VMS and Win32 at present. Defaults to [].
1965             (e.g. [ qw(Foo_version Foo_numstreams Foo_tree ) ])
1966              
1967             =item EXCLUDE_EXT
1968              
1969             Array of extension names to exclude when doing a static build. This
1970             is ignored if INCLUDE_EXT is present. Consult INCLUDE_EXT for more
1971             details. (e.g. [ qw( Socket POSIX ) ] )
1972              
1973             This attribute may be most useful when specified as a string on the
1974             command line: perl Makefile.PL EXCLUDE_EXT='Socket Safe'
1975              
1976             =item EXE_FILES
1977              
1978             Ref to array of executable files. The files will be copied to the
1979             INST_SCRIPT directory. Make realclean will delete them from there
1980             again.
1981              
1982             If your executables start with something like #!perl or
1983             #!/usr/bin/perl MakeMaker will change this to the path of the perl
1984             'Makefile.PL' was invoked with so the programs will be sure to run
1985             properly even if perl is not in /usr/bin/perl.
1986              
1987             =item FIRST_MAKEFILE
1988              
1989             The name of the Makefile to be produced. This is used for the second
1990             Makefile that will be produced for the MAP_TARGET.
1991              
1992             Defaults to 'Makefile' or 'Descrip.MMS' on VMS.
1993              
1994             (Note: we couldn't use MAKEFILE because dmake uses this for something
1995             else).
1996              
1997             =item FULLPERL
1998              
1999             Perl binary able to run this extension, load XS modules, etc...
2000              
2001             =item FULLPERLRUN
2002              
2003             Like PERLRUN, except it uses FULLPERL.
2004              
2005             =item FULLPERLRUNINST
2006              
2007             Like PERLRUNINST, except it uses FULLPERL.
2008              
2009             =item FUNCLIST
2010              
2011             This provides an alternate means to specify function names to be
2012             exported from the extension. Its value is a reference to an
2013             array of function names to be exported by the extension. These
2014             names are passed through unaltered to the linker options file.
2015              
2016             =item H
2017              
2018             Ref to array of *.h file names. Similar to C.
2019              
2020             =item IMPORTS
2021              
2022             This attribute is used to specify names to be imported into the
2023             extension. Takes a hash ref.
2024              
2025             It is only used on OS/2 and Win32.
2026              
2027             =item INC
2028              
2029             Include file dirs eg: C<"-I/usr/5include -I/path/to/inc">
2030              
2031             =item INCLUDE_EXT
2032              
2033             Array of extension names to be included when doing a static build.
2034             MakeMaker will normally build with all of the installed extensions when
2035             doing a static build, and that is usually the desired behavior. If
2036             INCLUDE_EXT is present then MakeMaker will build only with those extensions
2037             which are explicitly mentioned. (e.g. [ qw( Socket POSIX ) ])
2038              
2039             It is not necessary to mention DynaLoader or the current extension when
2040             filling in INCLUDE_EXT. If the INCLUDE_EXT is mentioned but is empty then
2041             only DynaLoader and the current extension will be included in the build.
2042              
2043             This attribute may be most useful when specified as a string on the
2044             command line: perl Makefile.PL INCLUDE_EXT='POSIX Socket Devel::Peek'
2045              
2046             =item INSTALLARCHLIB
2047              
2048             Used by 'make install', which copies files from INST_ARCHLIB to this
2049             directory if INSTALLDIRS is set to perl.
2050              
2051             =item INSTALLBIN
2052              
2053             Directory to install binary files (e.g. tkperl) into if
2054             INSTALLDIRS=perl.
2055              
2056             =item INSTALLDIRS
2057              
2058             Determines which of the sets of installation directories to choose:
2059             perl, site or vendor. Defaults to site.
2060              
2061             =item INSTALLMAN1DIR
2062              
2063             =item INSTALLMAN3DIR
2064              
2065             These directories get the man pages at 'make install' time if
2066             INSTALLDIRS=perl. Defaults to $Config{installman*dir}.
2067              
2068             If set to 'none', no man pages will be installed.
2069              
2070             =item INSTALLPRIVLIB
2071              
2072             Used by 'make install', which copies files from INST_LIB to this
2073             directory if INSTALLDIRS is set to perl.
2074              
2075             Defaults to $Config{installprivlib}.
2076              
2077             =item INSTALLSCRIPT
2078              
2079             Available in version 6.30_02 and above.
2080              
2081             Used by 'make install' which copies files from INST_SCRIPT to this
2082             directory if INSTALLDIRS=perl.
2083              
2084             =item INSTALLSITEARCH
2085              
2086             Used by 'make install', which copies files from INST_ARCHLIB to this
2087             directory if INSTALLDIRS is set to site (default).
2088              
2089             =item INSTALLSITEBIN
2090              
2091             Used by 'make install', which copies files from INST_BIN to this
2092             directory if INSTALLDIRS is set to site (default).
2093              
2094             =item INSTALLSITELIB
2095              
2096             Used by 'make install', which copies files from INST_LIB to this
2097             directory if INSTALLDIRS is set to site (default).
2098              
2099             =item INSTALLSITEMAN1DIR
2100              
2101             =item INSTALLSITEMAN3DIR
2102              
2103             These directories get the man pages at 'make install' time if
2104             INSTALLDIRS=site (default). Defaults to
2105             $(SITEPREFIX)/man/man$(MAN*EXT).
2106              
2107             If set to 'none', no man pages will be installed.
2108              
2109             =item INSTALLSITESCRIPT
2110              
2111             Used by 'make install' which copies files from INST_SCRIPT to this
2112             directory if INSTALLDIRS is set to site (default).
2113              
2114             =item INSTALLVENDORARCH
2115              
2116             Used by 'make install', which copies files from INST_ARCHLIB to this
2117             directory if INSTALLDIRS is set to vendor. Note that if you do not set
2118             this, the value of INSTALLVENDORLIB will be used, which is probably not
2119             what you want.
2120              
2121             =item INSTALLVENDORBIN
2122              
2123             Used by 'make install', which copies files from INST_BIN to this
2124             directory if INSTALLDIRS is set to vendor.
2125              
2126             =item INSTALLVENDORLIB
2127              
2128             Used by 'make install', which copies files from INST_LIB to this
2129             directory if INSTALLDIRS is set to vendor.
2130              
2131             =item INSTALLVENDORMAN1DIR
2132              
2133             =item INSTALLVENDORMAN3DIR
2134              
2135             These directories get the man pages at 'make install' time if
2136             INSTALLDIRS=vendor. Defaults to $(VENDORPREFIX)/man/man$(MAN*EXT).
2137              
2138             If set to 'none', no man pages will be installed.
2139              
2140             =item INSTALLVENDORSCRIPT
2141              
2142             Available in version 6.30_02 and above.
2143              
2144             Used by 'make install' which copies files from INST_SCRIPT to this
2145             directory if INSTALLDIRS is set to vendor.
2146              
2147             =item INST_ARCHLIB
2148              
2149             Same as INST_LIB for architecture dependent files.
2150              
2151             =item INST_BIN
2152              
2153             Directory to put real binary files during 'make'. These will be copied
2154             to INSTALLBIN during 'make install'
2155              
2156             =item INST_LIB
2157              
2158             Directory where we put library files of this extension while building
2159             it.
2160              
2161             =item INST_MAN1DIR
2162              
2163             Directory to hold the man pages at 'make' time
2164              
2165             =item INST_MAN3DIR
2166              
2167             Directory to hold the man pages at 'make' time
2168              
2169             =item INST_SCRIPT
2170              
2171             Directory where executable files should be installed during
2172             'make'. Defaults to "./blib/script", just to have a dummy location during
2173             testing. make install will copy the files in INST_SCRIPT to
2174             INSTALLSCRIPT.
2175              
2176             =item LD
2177              
2178             Program to be used to link libraries for dynamic loading.
2179              
2180             Defaults to $Config{ld}.
2181              
2182             =item LDDLFLAGS
2183              
2184             Any special flags that might need to be passed to ld to create a
2185             shared library suitable for dynamic loading. It is up to the makefile
2186             to use it. (See L<Config/lddlflags>)
2187              
2188             Defaults to $Config{lddlflags}.
2189              
2190             =item LDFROM
2191              
2192             Defaults to "$(OBJECT)" and is used in the ld command to specify
2193             what files to link/load from (also see dynamic_lib below for how to
2194             specify ld flags)
2195              
2196             =item LIB
2197              
2198             LIB should only be set at C<perl Makefile.PL> time but is allowed as a
2199             MakeMaker argument. It has the effect of setting both INSTALLPRIVLIB
2200             and INSTALLSITELIB to that value regardless any explicit setting of
2201             those arguments (or of PREFIX). INSTALLARCHLIB and INSTALLSITEARCH
2202             are set to the corresponding architecture subdirectory.
2203              
2204             =item LIBPERL_A
2205              
2206             The filename of the perllibrary that will be used together with this
2207             extension. Defaults to libperl.a.
2208              
2209             =item LIBS
2210              
2211             An anonymous array of alternative library
2212             specifications to be searched for (in order) until
2213             at least one library is found. E.g.
2214              
2215             'LIBS' => ["-lgdbm", "-ldbm -lfoo", "-L/path -ldbm.nfs"]
2216              
2217             Mind, that any element of the array
2218             contains a complete set of arguments for the ld
2219             command. So do not specify
2220              
2221             'LIBS' => ["-ltcl", "-ltk", "-lX11"]
2222              
2223             See ODBM_File/Makefile.PL for an example, where an array is needed. If
2224             you specify a scalar as in
2225              
2226             'LIBS' => "-ltcl -ltk -lX11"
2227              
2228             MakeMaker will turn it into an array with one element.
2229              
2230             =item LICENSE
2231              
2232             Available in version 6.31 and above.
2233              
2234             The licensing terms of your distribution. Generally it's "perl_5" for the
2235             same license as Perl itself.
2236              
2237             See L<CPAN::Meta::Spec> for the list of options.
2238              
2239             Defaults to "unknown".
2240              
2241             =item LINKTYPE
2242              
2243             'static' or 'dynamic' (default unless usedl=undef in
2244             config.sh). Should only be used to force static linking (also see
2245             linkext below).
2246              
2247             =item MAGICXS
2248              
2249             Available in version 6.8305 and above.
2250              
2251             When this is set to C<1>, C<OBJECT> will be automagically derived from
2252             C<O_FILES>.
2253              
2254             =item MAKE
2255              
2256             Available in version 6.30_01 and above.
2257              
2258             Variant of make you intend to run the generated Makefile with. This
2259             parameter lets Makefile.PL know what make quirks to account for when
2260             generating the Makefile.
2261              
2262             MakeMaker also honors the MAKE environment variable. This parameter
2263             takes precedence.
2264              
2265             Currently the only significant values are 'dmake' and 'nmake' for Windows
2266             users, instructing MakeMaker to generate a Makefile in the flavour of
2267             DMake ("Dennis Vadura's Make") or Microsoft NMake respectively.
2268              
2269             Defaults to $Config{make}, which may go looking for a Make program
2270             in your environment.
2271              
2272             How are you supposed to know what flavour of Make a Makefile has
2273             been generated for if you didn't specify a value explicitly? Search
2274             the generated Makefile for the definition of the MAKE variable,
2275             which is used to recursively invoke the Make utility. That will tell
2276             you what Make you're supposed to invoke the Makefile with.
2277              
2278             =item MAKEAPERL
2279              
2280             Boolean which tells MakeMaker that it should include the rules to
2281             make a perl. This is handled automatically as a switch by
2282             MakeMaker. The user normally does not need it.
2283              
2284             =item MAKEFILE_OLD
2285              
2286             When 'make clean' or similar is run, the $(FIRST_MAKEFILE) will be
2287             backed up at this location.
2288              
2289             Defaults to $(FIRST_MAKEFILE).old or $(FIRST_MAKEFILE)_old on VMS.
2290              
2291             =item MAN1PODS
2292              
2293             Hashref of pod-containing files. MakeMaker will default this to all
2294             EXE_FILES files that include POD directives. The files listed
2295             here will be converted to man pages and installed as was requested
2296             at Configure time.
2297              
2298             This hash should map POD files (or scripts containing POD) to the
2299             man file names under the C<blib/man1/> directory, as in the following
2300             example:
2301              
2302             MAN1PODS => {
2303             'doc/command.pod' => 'blib/man1/command.1',
2304             'scripts/script.pl' => 'blib/man1/script.1',
2305             }
2306              
2307             =item MAN3PODS
2308              
2309             Hashref that assigns to *.pm and *.pod files the files into which the
2310             manpages are to be written. MakeMaker parses all *.pod and *.pm files
2311             for POD directives. Files that contain POD will be the default keys of
2312             the MAN3PODS hashref. These will then be converted to man pages during
2313             C<make> and will be installed during C<make install>.
2314              
2315             Example similar to MAN1PODS.
2316              
2317             =item MAP_TARGET
2318              
2319             If it is intended that a new perl binary be produced, this variable
2320             may hold a name for that binary. Defaults to perl
2321              
2322             =item META_ADD
2323              
2324             =item META_MERGE
2325              
2326             Available in version 6.46 and above.
2327              
2328             A hashref of items to add to the CPAN Meta file (F<META.yml> or
2329             F<META.json>).
2330              
2331             They differ in how they behave if they have the same key as the
2332             default metadata. META_ADD will override the default value with its
2333             own. META_MERGE will merge its value with the default.
2334              
2335             Unless you want to override the defaults, prefer META_MERGE so as to
2336             get the advantage of any future defaults.
2337              
2338             Where prereqs are concerned, if META_MERGE is used, prerequisites are merged
2339             with their counterpart C<WriteMakefile()> argument
2340             (PREREQ_PM is merged into {prereqs}{runtime}{requires},
2341             BUILD_REQUIRES into C<{prereqs}{build}{requires}>,
2342             CONFIGURE_REQUIRES into C<{prereqs}{configure}{requires}>,
2343             and TEST_REQUIRES into C<{prereqs}{test}{requires})>.
2344             When prereqs are specified with META_ADD, the only prerequisites added to the
2345             file come from the metadata, not C<WriteMakefile()> arguments.
2346              
2347             Note that these configuration options are only used for generating F<META.yml>
2348             and F<META.json> -- they are NOT used for F<MYMETA.yml> and F<MYMETA.json>.
2349             Therefore data in these fields should NOT be used for dynamic (user-side)
2350             configuration.
2351              
2352             By default CPAN Meta specification C<1.4> is used. In order to use
2353             CPAN Meta specification C<2.0>, indicate with C<meta-spec> the version
2354             you want to use.
2355              
2356             META_MERGE => {
2357              
2358             "meta-spec" => { version => 2 },
2359              
2360             resources => {
2361              
2362             repository => {
2363             type => 'git',
2364             url => 'git://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker.git',
2365             web => 'https://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker',
2366             },
2367              
2368             },
2369              
2370             },
2371              
2372             =item MIN_PERL_VERSION
2373              
2374             Available in version 6.48 and above.
2375              
2376             The minimum required version of Perl for this distribution.
2377              
2378             Either the 5.006001 or the 5.6.1 format is acceptable.
2379              
2380             =item MYEXTLIB
2381              
2382             If the extension links to a library that it builds, set this to the
2383             name of the library (see SDBM_File)
2384              
2385             =item NAME
2386              
2387             The package representing the distribution. For example, C<Test::More>
2388             or C<ExtUtils::MakeMaker>. It will be used to derive information about
2389             the distribution such as the L</DISTNAME>, installation locations
2390             within the Perl library and where XS files will be looked for by
2391             default (see L</XS>).
2392              
2393             C<NAME> I<must> be a valid Perl package name and it I<must> have an
2394             associated C<.pm> file. For example, C<Foo::Bar> is a valid C<NAME>
2395             and there must exist F<Foo/Bar.pm>. Any XS code should be in
2396             F<Bar.xs> unless stated otherwise.
2397              
2398             Your distribution B<must> have a C<NAME>.
2399              
2400             =item NEEDS_LINKING
2401              
2402             MakeMaker will figure out if an extension contains linkable code
2403             anywhere down the directory tree, and will set this variable
2404             accordingly, but you can speed it up a very little bit if you define
2405             this boolean variable yourself.
2406              
2407             =item NOECHO
2408              
2409             Command so make does not print the literal commands it's running.
2410              
2411             By setting it to an empty string you can generate a Makefile that
2412             prints all commands. Mainly used in debugging MakeMaker itself.
2413              
2414             Defaults to C<@>.
2415              
2416             =item NORECURS
2417              
2418             Boolean. Attribute to inhibit descending into subdirectories.
2419              
2420             =item NO_META
2421              
2422             When true, suppresses the generation and addition to the MANIFEST of
2423             the META.yml and META.json module meta-data files during 'make distdir'.
2424              
2425             Defaults to false.
2426              
2427             =item NO_MYMETA
2428              
2429             Available in version 6.57_02 and above.
2430              
2431             When true, suppresses the generation of MYMETA.yml and MYMETA.json module
2432             meta-data files during 'perl Makefile.PL'.
2433              
2434             Defaults to false.
2435              
2436             =item NO_PACKLIST
2437              
2438             Available in version 6.7501 and above.
2439              
2440             When true, suppresses the writing of C<packlist> files for installs.
2441              
2442             Defaults to false.
2443              
2444             =item NO_PERLLOCAL
2445              
2446             Available in version 6.7501 and above.
2447              
2448             When true, suppresses the appending of installations to C<perllocal>.
2449              
2450             Defaults to false.
2451              
2452             =item NO_VC
2453              
2454             In general, any generated Makefile checks for the current version of
2455             MakeMaker and the version the Makefile was built under. If NO_VC is
2456             set, the version check is neglected. Do not write this into your
2457             Makefile.PL, use it interactively instead.
2458              
2459             =item OBJECT
2460              
2461             List of object files, defaults to '$(BASEEXT)$(OBJ_EXT)', but can be a long
2462             string or an array containing all object files, e.g. "tkpBind.o
2463             tkpButton.o tkpCanvas.o" or ["tkpBind.o", "tkpButton.o", "tkpCanvas.o"]
2464              
2465             (Where BASEEXT is the last component of NAME, and OBJ_EXT is $Config{obj_ext}.)
2466              
2467             =item OPTIMIZE
2468              
2469             Defaults to C<-O>. Set it to C<-g> to turn debugging on. The flag is
2470             passed to subdirectory makes.
2471              
2472             =item PERL
2473              
2474             Perl binary for tasks that can be done by miniperl. If it contains
2475             spaces or other shell metacharacters, it needs to be quoted in a way
2476             that protects them, since this value is intended to be inserted in a
2477             shell command line in the Makefile. E.g.:
2478              
2479             # Perl executable lives in "C:/Program Files/Perl/bin"
2480             # Normally you don't need to set this yourself!
2481             $ perl Makefile.PL PERL='"C:/Program Files/Perl/bin/perl.exe" -w'
2482              
2483             =item PERL_CORE
2484              
2485             Set only when MakeMaker is building the extensions of the Perl core
2486             distribution.
2487              
2488             =item PERLMAINCC
2489              
2490             The call to the program that is able to compile perlmain.c. Defaults
2491             to $(CC).
2492              
2493             =item PERL_ARCHLIB
2494              
2495             Same as for PERL_LIB, but for architecture dependent files.
2496              
2497             Used only when MakeMaker is building the extensions of the Perl core
2498             distribution (because normally $(PERL_ARCHLIB) is automatically in @INC,
2499             and adding it would get in the way of PERL5LIB).
2500              
2501             =item PERL_LIB
2502              
2503             Directory containing the Perl library to use.
2504              
2505             Used only when MakeMaker is building the extensions of the Perl core
2506             distribution (because normally $(PERL_LIB) is automatically in @INC,
2507             and adding it would get in the way of PERL5LIB).
2508              
2509             =item PERL_MALLOC_OK
2510              
2511             defaults to 0. Should be set to TRUE if the extension can work with
2512             the memory allocation routines substituted by the Perl malloc() subsystem.
2513             This should be applicable to most extensions with exceptions of those
2514              
2515             =over 4
2516              
2517             =item *
2518              
2519             with bugs in memory allocations which are caught by Perl's malloc();
2520              
2521             =item *
2522              
2523             which interact with the memory allocator in other ways than via
2524             malloc(), realloc(), free(), calloc(), sbrk() and brk();
2525              
2526             =item *
2527              
2528             which rely on special alignment which is not provided by Perl's malloc().
2529              
2530             =back
2531              
2532             B<NOTE.> Neglecting to set this flag in I<any one> of the loaded extension
2533             nullifies many advantages of Perl's malloc(), such as better usage of
2534             system resources, error detection, memory usage reporting, catchable failure
2535             of memory allocations, etc.
2536              
2537             =item PERLPREFIX
2538              
2539             Directory under which core modules are to be installed.
2540              
2541             Defaults to $Config{installprefixexp}, falling back to
2542             $Config{installprefix}, $Config{prefixexp} or $Config{prefix} should
2543             $Config{installprefixexp} not exist.
2544              
2545             Overridden by PREFIX.
2546              
2547             =item PERLRUN
2548              
2549             Use this instead of $(PERL) when you wish to run perl. It will set up
2550             extra necessary flags for you.
2551              
2552             =item PERLRUNINST
2553              
2554             Use this instead of $(PERL) when you wish to run perl to work with
2555             modules. It will add things like -I$(INST_ARCH) and other necessary
2556             flags so perl can see the modules you're about to install.
2557              
2558             =item PERL_SRC
2559              
2560             Directory containing the Perl source code (use of this should be
2561             avoided, it may be undefined)
2562              
2563             =item PERM_DIR
2564              
2565             Available in version 6.51_01 and above.
2566              
2567             Desired permission for directories. Defaults to C<755>.
2568              
2569             =item PERM_RW
2570              
2571             Desired permission for read/writable files. Defaults to C<644>.
2572              
2573             =item PERM_RWX
2574              
2575             Desired permission for executable files. Defaults to C<755>.
2576              
2577             =item PL_FILES
2578              
2579             MakeMaker can run programs to generate files for you at build time.
2580             By default any file named *.PL (except Makefile.PL and Build.PL) in
2581             the top level directory will be assumed to be a Perl program and run
2582             passing its own basename in as an argument. This basename is actually a build
2583             target, and there is an intention, but not a requirement, that the *.PL file
2584             make the file passed to to as an argument. For example...
2585              
2586             perl foo.PL foo
2587              
2588             This behavior can be overridden by supplying your own set of files to
2589             search. PL_FILES accepts a hash ref, the key being the file to run
2590             and the value is passed in as the first argument when the PL file is run.
2591              
2592             PL_FILES => {'bin/foobar.PL' => 'bin/foobar'}
2593              
2594             PL_FILES => {'foo.PL' => 'foo.c'}
2595              
2596             Would run bin/foobar.PL like this:
2597              
2598             perl bin/foobar.PL bin/foobar
2599              
2600             If multiple files from one program are desired an array ref can be used.
2601              
2602             PL_FILES => {'bin/foobar.PL' => [qw(bin/foobar1 bin/foobar2)]}
2603              
2604             In this case the program will be run multiple times using each target file.
2605              
2606             perl bin/foobar.PL bin/foobar1
2607             perl bin/foobar.PL bin/foobar2
2608              
2609             If an output file depends on extra input files beside the script itself,
2610             a hash ref can be used in version 7.36 and above:
2611              
2612             PL_FILES => { 'foo.PL' => {
2613             'foo.out' => 'foo.in',
2614             'bar.out' => [qw(bar1.in bar2.in)],
2615             }
2616              
2617             In this case the extra input files will be passed to the program after
2618             the target file:
2619              
2620             perl foo.PL foo.out foo.in
2621             perl foo.PL bar.out bar1.in bar2.in
2622              
2623             PL files are normally run B<after> pm_to_blib and include INST_LIB and
2624             INST_ARCH in their C<@INC>, so the just built modules can be
2625             accessed... unless the PL file is making a module (or anything else in
2626             PM) in which case it is run B<before> pm_to_blib and does not include
2627             INST_LIB and INST_ARCH in its C<@INC>. This apparently odd behavior
2628             is there for backwards compatibility (and it's somewhat DWIM). The argument
2629             passed to the .PL is set up as a target to build in the Makefile. In other
2630             sections such as C<postamble> you can specify a dependency on the
2631             filename/argument that the .PL is supposed (or will have, now that that is
2632             is a dependency) to generate. Note the file to be generated will still be
2633             generated and the .PL will still run even without an explicit dependency created
2634             by you, since the C<all> target still depends on running all eligible to run.PL
2635             files.
2636              
2637             =item PM
2638              
2639             Hashref of .pm files and *.pl files to be installed. e.g.
2640              
2641             {'name_of_file.pm' => '$(INST_LIB)/install_as.pm'}
2642              
2643             By default this will include *.pm and *.pl and the files found in
2644             the PMLIBDIRS directories. Defining PM in the
2645             Makefile.PL will override PMLIBDIRS.
2646              
2647             =item PMLIBDIRS
2648              
2649             Ref to array of subdirectories containing library files. Defaults to
2650             [ 'lib', $(BASEEXT) ]. The directories will be scanned and I<any> files
2651             they contain will be installed in the corresponding location in the
2652             library. A libscan() method can be used to alter the behaviour.
2653             Defining PM in the Makefile.PL will override PMLIBDIRS.
2654              
2655             (Where BASEEXT is the last component of NAME.)
2656              
2657             =item PM_FILTER
2658              
2659             A filter program, in the traditional Unix sense (input from stdin, output
2660             to stdout) that is passed on each .pm file during the build (in the
2661             pm_to_blib() phase). It is empty by default, meaning no filtering is done.
2662             You could use:
2663              
2664             PM_FILTER => 'perl -ne "print unless /^\\#/"',
2665              
2666             to remove all the leading comments on the fly during the build. In order
2667             to be as portable as possible, please consider using a Perl one-liner
2668             rather than Unix (or other) utilities, as above. The # is escaped for
2669             the Makefile, since what is going to be generated will then be:
2670              
2671             PM_FILTER = perl -ne "print unless /^\#/"
2672              
2673             Without the \ before the #, we'd have the start of a Makefile comment,
2674             and the macro would be incorrectly defined.
2675              
2676             You will almost certainly be better off using the C<PL_FILES> system,
2677             instead. See above, or the L<ExtUtils::MakeMaker::FAQ> entry.
2678              
2679             =item POLLUTE
2680              
2681             Prior to 5.6 various interpreter variables were available without a C<PL_>
2682             prefix, eg. C<PL_undef> was available as C<undef>. As of release 5.6, these
2683             are only defined if the POLLUTE flag is enabled:
2684              
2685             perl Makefile.PL POLLUTE=1
2686              
2687             Please inform the module author if this is necessary to successfully install
2688             a module under 5.6 or later.
2689              
2690             =item PPM_INSTALL_EXEC
2691              
2692             Name of the executable used to run C<PPM_INSTALL_SCRIPT> below. (e.g. perl)
2693              
2694             =item PPM_INSTALL_SCRIPT
2695              
2696             Name of the script that gets executed by the Perl Package Manager after
2697             the installation of a package.
2698              
2699             =item PPM_UNINSTALL_EXEC
2700              
2701             Available in version 6.8502 and above.
2702              
2703             Name of the executable used to run C<PPM_UNINSTALL_SCRIPT> below. (e.g. perl)
2704              
2705             =item PPM_UNINSTALL_SCRIPT
2706              
2707             Available in version 6.8502 and above.
2708              
2709             Name of the script that gets executed by the Perl Package Manager before
2710             the removal of a package.
2711              
2712             =item PREFIX
2713              
2714             This overrides all the default install locations. Man pages,
2715             libraries, scripts, etc... MakeMaker will try to make an educated
2716             guess about where to place things under the new PREFIX based on your
2717             Config defaults. Failing that, it will fall back to a structure
2718             which should be sensible for your platform.
2719              
2720             If you specify LIB or any INSTALL* variables they will not be affected
2721             by the PREFIX.
2722              
2723             =item PREREQ_FATAL
2724              
2725             Bool. If this parameter is true, failing to have the required modules
2726             (or the right versions thereof) will be fatal. C<perl Makefile.PL>
2727             will C<die> instead of simply informing the user of the missing dependencies.
2728              
2729             It is I<extremely> rare to have to use C<PREREQ_FATAL>. Its use by module
2730             authors is I<strongly discouraged> and should never be used lightly.
2731              
2732             For dependencies that are required in order to run C<Makefile.PL>,
2733             see C<CONFIGURE_REQUIRES>.
2734              
2735             Module installation tools have ways of resolving unmet dependencies but
2736             to do that they need a F<Makefile>. Using C<PREREQ_FATAL> breaks this.
2737             That's bad.
2738              
2739             Assuming you have good test coverage, your tests should fail with
2740             missing dependencies informing the user more strongly that something
2741             is wrong. You can write a F<t/00compile.t> test which will simply
2742             check that your code compiles and stop "make test" prematurely if it
2743             doesn't. See L<Test::More/BAIL_OUT> for more details.
2744              
2745              
2746             =item PREREQ_PM
2747              
2748             A hash of modules that are needed to run your module. The keys are
2749             the module names ie. Test::More, and the minimum version is the
2750             value. If the required version number is 0 any version will do.
2751             The versions given may be a Perl v-string (see L<version>) or a range
2752             (see L<CPAN::Meta::Requirements>).
2753              
2754             This will go into the C<requires> field of your F<META.yml> and the
2755             C<runtime> of the C<prereqs> field of your F<META.json>.
2756              
2757             PREREQ_PM => {
2758             # Require Test::More at least 0.47
2759             "Test::More" => "0.47",
2760              
2761             # Require any version of Acme::Buffy
2762             "Acme::Buffy" => 0,
2763             }
2764              
2765             =item PREREQ_PRINT
2766              
2767             Bool. If this parameter is true, the prerequisites will be printed to
2768             stdout and MakeMaker will exit. The output format is an evalable hash
2769             ref.
2770              
2771             $PREREQ_PM = {
2772             'A::B' => Vers1,
2773             'C::D' => Vers2,
2774             ...
2775             };
2776              
2777             If a distribution defines a minimal required perl version, this is
2778             added to the output as an additional line of the form:
2779              
2780             $MIN_PERL_VERSION = '5.008001';
2781              
2782             If BUILD_REQUIRES is not empty, it will be dumped as $BUILD_REQUIRES hashref.
2783              
2784             =item PRINT_PREREQ
2785              
2786             RedHatism for C<PREREQ_PRINT>. The output format is different, though:
2787              
2788             perl(A::B)>=Vers1 perl(C::D)>=Vers2 ...
2789              
2790             A minimal required perl version, if present, will look like this:
2791              
2792             perl(perl)>=5.008001
2793              
2794             =item SITEPREFIX
2795              
2796             Like PERLPREFIX, but only for the site install locations.
2797              
2798             Defaults to $Config{siteprefixexp}. Perls prior to 5.6.0 didn't have
2799             an explicit siteprefix in the Config. In those cases
2800             $Config{installprefix} will be used.
2801              
2802             Overridable by PREFIX
2803              
2804             =item SIGN
2805              
2806             Available in version 6.18 and above.
2807              
2808             When true, perform the generation and addition to the MANIFEST of the
2809             SIGNATURE file in the distdir during 'make distdir', via 'cpansign
2810             -s'.
2811              
2812             Note that you need to install the Module::Signature module to
2813             perform this operation.
2814              
2815             Defaults to false.
2816              
2817             =item SKIP
2818              
2819             Arrayref. E.g. [qw(name1 name2)] skip (do not write) sections of the
2820             Makefile. Caution! Do not use the SKIP attribute for the negligible
2821             speedup. It may seriously damage the resulting Makefile. Only use it
2822             if you really need it.
2823              
2824             =item TEST_REQUIRES
2825              
2826             Available in version 6.64 and above.
2827              
2828             A hash of modules that are needed to test your module but not run or
2829             build it.
2830              
2831             This will go into the C<build_requires> field of your F<META.yml> and the C<test> of the C<prereqs> field of your F<META.json>.
2832              
2833             The format is the same as PREREQ_PM.
2834              
2835             =item TYPEMAPS
2836              
2837             Ref to array of typemap file names. Use this when the typemaps are
2838             in some directory other than the current directory or when they are
2839             not named B<typemap>. The last typemap in the list takes
2840             precedence. A typemap in the current directory has highest
2841             precedence, even if it isn't listed in TYPEMAPS. The default system
2842             typemap has lowest precedence.
2843              
2844             =item VENDORPREFIX
2845              
2846             Like PERLPREFIX, but only for the vendor install locations.
2847              
2848             Defaults to $Config{vendorprefixexp}.
2849              
2850             Overridable by PREFIX
2851              
2852             =item VERBINST
2853              
2854             If true, make install will be verbose
2855              
2856             =item VERSION
2857              
2858             Your version number for distributing the package. This defaults to
2859             0.1.
2860              
2861             =item VERSION_FROM
2862              
2863             Instead of specifying the VERSION in the Makefile.PL you can let
2864             MakeMaker parse a file to determine the version number. The parsing
2865             routine requires that the file named by VERSION_FROM contains one
2866             single line to compute the version number. The first line in the file
2867             that contains something like a $VERSION assignment or C<package Name
2868             VERSION> will be used. The following lines will be parsed o.k.:
2869              
2870             # Good
2871             package Foo::Bar 1.23; # 1.23
2872             $VERSION = '1.00'; # 1.00
2873             *VERSION = \'1.01'; # 1.01
2874             ($VERSION) = q$Revision$ =~ /(\d+)/g; # The digits in $Revision$
2875             $FOO::VERSION = '1.10'; # 1.10
2876             *FOO::VERSION = \'1.11'; # 1.11
2877              
2878             but these will fail:
2879              
2880             # Bad
2881             my $VERSION = '1.01';
2882             local $VERSION = '1.02';
2883             local $FOO::VERSION = '1.30';
2884              
2885             (Putting C<my> or C<local> on the preceding line will work o.k.)
2886              
2887             "Version strings" are incompatible and should not be used.
2888              
2889             # Bad
2890             $VERSION = 1.2.3;
2891             $VERSION = v1.2.3;
2892              
2893             L<version> objects are fine. As of MakeMaker 6.35 version.pm will be
2894             automatically loaded, but you must declare the dependency on version.pm.
2895             For compatibility with older MakeMaker you should load on the same line
2896             as $VERSION is declared.
2897              
2898             # All on one line
2899             use version; our $VERSION = qv(1.2.3);
2900              
2901             The file named in VERSION_FROM is not added as a dependency to
2902             Makefile. This is not really correct, but it would be a major pain
2903             during development to have to rewrite the Makefile for any smallish
2904             change in that file. If you want to make sure that the Makefile
2905             contains the correct VERSION macro after any change of the file, you
2906             would have to do something like
2907              
2908             depend => { Makefile => '$(VERSION_FROM)' }
2909              
2910             See attribute C<depend> below.
2911              
2912             =item VERSION_SYM
2913              
2914             A sanitized VERSION with . replaced by _. For places where . has
2915             special meaning (some filesystems, RCS labels, etc...)
2916              
2917             =item XS
2918              
2919             Hashref of .xs files. MakeMaker will default this. e.g.
2920              
2921             {'name_of_file.xs' => 'name_of_file.c'}
2922              
2923             The .c files will automatically be included in the list of files
2924             deleted by a make clean.
2925              
2926             =item XSBUILD
2927              
2928             Available in version 7.12 and above.
2929              
2930             Hashref with options controlling the operation of C<XSMULTI>:
2931              
2932             {
2933             xs => {
2934             all => {
2935             # options applying to all .xs files for this distribution
2936             },
2937             'lib/Class/Name/File' => { # specifically for this file
2938             DEFINE => '-Dfunktastic', # defines for only this file
2939             INC => "-I$funkyliblocation", # include flags for only this file
2940             # OBJECT => 'lib/Class/Name/File$(OBJ_EXT)', # default
2941             LDFROM => "lib/Class/Name/File\$(OBJ_EXT) $otherfile\$(OBJ_EXT)", # what's linked
2942             },
2943             },
2944             }
2945              
2946             Note C<xs> is the file-extension. More possibilities may arise in the
2947             future. Note that object names are specified without their XS extension.
2948              
2949             C<LDFROM> defaults to the same as C<OBJECT>. C<OBJECT> defaults to,
2950             for C<XSMULTI>, just the XS filename with the extension replaced with
2951             the compiler-specific object-file extension.
2952              
2953             The distinction between C<OBJECT> and C<LDFROM>: C<OBJECT> is the make
2954             target, so make will try to build it. However, C<LDFROM> is what will
2955             actually be linked together to make the shared object or static library
2956             (SO/SL), so if you override it, make sure it includes what you want to
2957             make the final SO/SL, almost certainly including the XS basename with
2958             C<$(OBJ_EXT)> appended.
2959              
2960             =item XSMULTI
2961              
2962             Available in version 7.12 and above.
2963              
2964             When this is set to C<1>, multiple XS files may be placed under F<lib/>
2965             next to their corresponding C<*.pm> files (this is essential for compiling
2966             with the correct C<VERSION> values). This feature should be considered
2967             experimental, and details of it may change.
2968              
2969             This feature was inspired by, and small portions of code copied from,
2970             L<ExtUtils::MakeMaker::BigHelper>. Hopefully this feature will render
2971             that module mainly obsolete.
2972              
2973             =item XSOPT
2974              
2975             String of options to pass to xsubpp. This might include C<-C++> or
2976             C<-extern>. Do not include typemaps here; the TYPEMAP parameter exists for
2977             that purpose.
2978              
2979             =item XSPROTOARG
2980              
2981             May be set to C<-prototypes>, C<-noprototypes> or the empty string. The
2982             empty string is equivalent to the xsubpp default, or C<-noprototypes>.
2983             See the xsubpp documentation for details. MakeMaker
2984             defaults to the empty string.
2985              
2986             =item XS_VERSION
2987              
2988             Your version number for the .xs file of this package. This defaults
2989             to the value of the VERSION attribute.
2990              
2991             =back
2992              
2993             =head2 Additional lowercase attributes
2994              
2995             can be used to pass parameters to the methods which implement that
2996             part of the Makefile. Parameters are specified as a hash ref but are
2997             passed to the method as a hash.
2998              
2999             =over 2
3000              
3001             =item clean
3002              
3003             {FILES => "*.xyz foo"}
3004              
3005             =item depend
3006              
3007             {ANY_TARGET => ANY_DEPENDENCY, ...}
3008              
3009             (ANY_TARGET must not be given a double-colon rule by MakeMaker.)
3010              
3011             =item dist
3012              
3013             {TARFLAGS => 'cvfF', COMPRESS => 'gzip', SUFFIX => '.gz',
3014             SHAR => 'shar -m', DIST_CP => 'ln', ZIP => '/bin/zip',
3015             ZIPFLAGS => '-rl', DIST_DEFAULT => 'private tardist' }
3016              
3017             If you specify COMPRESS, then SUFFIX should also be altered, as it is
3018             needed to tell make the target file of the compression. Setting
3019             DIST_CP to ln can be useful, if you need to preserve the timestamps on
3020             your files. DIST_CP can take the values 'cp', which copies the file,
3021             'ln', which links the file, and 'best' which copies symbolic links and
3022             links the rest. Default is 'best'.
3023              
3024             =item dynamic_lib
3025              
3026             {ARMAYBE => 'ar', OTHERLDFLAGS => '...', INST_DYNAMIC_DEP => '...'}
3027              
3028             =item linkext
3029              
3030             {LINKTYPE => 'static', 'dynamic' or ''}
3031              
3032             NB: Extensions that have nothing but *.pm files had to say
3033              
3034             {LINKTYPE => ''}
3035              
3036             with Pre-5.0 MakeMakers. Since version 5.00 of MakeMaker such a line
3037             can be deleted safely. MakeMaker recognizes when there's nothing to
3038             be linked.
3039              
3040             =item macro
3041              
3042             {ANY_MACRO => ANY_VALUE, ...}
3043              
3044             =item postamble
3045              
3046             Anything put here will be passed to
3047             L<MY::postamble()|ExtUtils::MM_Any/postamble (o)> if you have one.
3048              
3049             =item realclean
3050              
3051             {FILES => '$(INST_ARCHAUTODIR)/*.xyz'}
3052              
3053             =item test
3054              
3055             Specify the targets for testing.
3056              
3057             {TESTS => 't/*.t'}
3058              
3059             C<RECURSIVE_TEST_FILES> can be used to include all directories
3060             recursively under C<t> that contain C<.t> files. It will be ignored if
3061             you provide your own C<TESTS> attribute, defaults to false.
3062              
3063             {RECURSIVE_TEST_FILES=>1}
3064              
3065             This is supported since 6.76
3066              
3067             =item tool_autosplit
3068              
3069             {MAXLEN => 8}
3070              
3071             =back
3072              
3073             =head2 Overriding MakeMaker Methods
3074              
3075             If you cannot achieve the desired Makefile behaviour by specifying
3076             attributes you may define private subroutines in the Makefile.PL.
3077             Each subroutine returns the text it wishes to have written to
3078             the Makefile. To override a section of the Makefile you can
3079             either say:
3080              
3081             sub MY::c_o { "new literal text" }
3082              
3083             or you can edit the default by saying something like:
3084              
3085             package MY; # so that "SUPER" works right
3086             sub c_o {
3087             my $inherited = shift->SUPER::c_o(@_);
3088             $inherited =~ s/old text/new text/;
3089             $inherited;
3090             }
3091              
3092             If you are running experiments with embedding perl as a library into
3093             other applications, you might find MakeMaker is not sufficient. You'd
3094             better have a look at L<ExtUtils::Embed> which is a collection of utilities
3095             for embedding.
3096              
3097             If you still need a different solution, try to develop another
3098             subroutine that fits your needs and submit the diffs to
3099             C<makemaker@perl.org>
3100              
3101             For a complete description of all MakeMaker methods see
3102             L<ExtUtils::MM_Unix>.
3103              
3104             Here is a simple example of how to add a new target to the generated
3105             Makefile:
3106              
3107             sub MY::postamble {
3108             return <<'MAKE_FRAG';
3109             $(MYEXTLIB): sdbm/Makefile
3110             cd sdbm && $(MAKE) all
3111              
3112             MAKE_FRAG
3113             }
3114              
3115             =head2 The End Of Cargo Cult Programming
3116              
3117             WriteMakefile() now does some basic sanity checks on its parameters to
3118             protect against typos and malformatted values. This means some things
3119             which happened to work in the past will now throw warnings and
3120             possibly produce internal errors.
3121              
3122             Some of the most common mistakes:
3123              
3124             =over 2
3125              
3126             =item C<< MAN3PODS => ' ' >>
3127              
3128             This is commonly used to suppress the creation of man pages. MAN3PODS
3129             takes a hash ref not a string, but the above worked by accident in old
3130             versions of MakeMaker.
3131              
3132             The correct code is C<< MAN3PODS => { } >>.
3133              
3134             =back
3135              
3136              
3137             =head2 Hintsfile support
3138              
3139             MakeMaker.pm uses the architecture-specific information from
3140             Config.pm. In addition it evaluates architecture specific hints files
3141             in a C<hints/> directory. The hints files are expected to be named
3142             like their counterparts in C<PERL_SRC/hints>, but with an C<.pl> file
3143             name extension (eg. C<next_3_2.pl>). They are simply C<eval>ed by
3144             MakeMaker within the WriteMakefile() subroutine, and can be used to
3145             execute commands as well as to include special variables. The rules
3146             which hintsfile is chosen are the same as in Configure.
3147              
3148             The hintsfile is eval()ed immediately after the arguments given to
3149             WriteMakefile are stuffed into a hash reference $self but before this
3150             reference becomes blessed. So if you want to do the equivalent to
3151             override or create an attribute you would say something like
3152              
3153             $self->{LIBS} = ['-ldbm -lucb -lc'];
3154              
3155             =head2 Distribution Support
3156              
3157             For authors of extensions MakeMaker provides several Makefile
3158             targets. Most of the support comes from the L<ExtUtils::Manifest> module,
3159             where additional documentation can be found.
3160              
3161             =over 4
3162              
3163             =item make distcheck
3164              
3165             reports which files are below the build directory but not in the
3166             MANIFEST file and vice versa. (See L<ExtUtils::Manifest/fullcheck> for
3167             details)
3168              
3169             =item make skipcheck
3170              
3171             reports which files are skipped due to the entries in the
3172             C<MANIFEST.SKIP> file (See L<ExtUtils::Manifest/skipcheck> for
3173             details)
3174              
3175             =item make distclean
3176              
3177             does a realclean first and then the distcheck. Note that this is not
3178             needed to build a new distribution as long as you are sure that the
3179             MANIFEST file is ok.
3180              
3181             =item make veryclean
3182              
3183             does a realclean first and then removes backup files such as C<*~>,
3184             C<*.bak>, C<*.old> and C<*.orig>
3185              
3186             =item make manifest
3187              
3188             rewrites the MANIFEST file, adding all remaining files found (See
3189             L<ExtUtils::Manifest/mkmanifest> for details)
3190              
3191             =item make distdir
3192              
3193             Copies all the files that are in the MANIFEST file to a newly created
3194             directory with the name C<$(DISTNAME)-$(VERSION)>. If that directory
3195             exists, it will be removed first.
3196              
3197             Additionally, it will create META.yml and META.json module meta-data file
3198             in the distdir and add this to the distdir's MANIFEST. You can shut this
3199             behavior off with the NO_META flag.
3200              
3201             =item make disttest
3202              
3203             Makes a distdir first, and runs a C<perl Makefile.PL>, a make, and
3204             a make test in that directory.
3205              
3206             =item make tardist
3207              
3208             First does a distdir. Then a command $(PREOP) which defaults to a null
3209             command, followed by $(TO_UNIX), which defaults to a null command under
3210             UNIX, and will convert files in distribution directory to UNIX format
3211             otherwise. Next it runs C<tar> on that directory into a tarfile and
3212             deletes the directory. Finishes with a command $(POSTOP) which
3213             defaults to a null command.
3214              
3215             =item make dist
3216              
3217             Defaults to $(DIST_DEFAULT) which in turn defaults to tardist.
3218              
3219             =item make uutardist
3220              
3221             Runs a tardist first and uuencodes the tarfile.
3222              
3223             =item make shdist
3224              
3225             First does a distdir. Then a command $(PREOP) which defaults to a null
3226             command. Next it runs C<shar> on that directory into a sharfile and
3227             deletes the intermediate directory again. Finishes with a command
3228             $(POSTOP) which defaults to a null command. Note: For shdist to work
3229             properly a C<shar> program that can handle directories is mandatory.
3230              
3231             =item make zipdist
3232              
3233             First does a distdir. Then a command $(PREOP) which defaults to a null
3234             command. Runs C<$(ZIP) $(ZIPFLAGS)> on that directory into a
3235             zipfile. Then deletes that directory. Finishes with a command
3236             $(POSTOP) which defaults to a null command.
3237              
3238             =item make ci
3239              
3240             Does a $(CI) and a $(RCS_LABEL) on all files in the MANIFEST file.
3241              
3242             =back
3243              
3244             Customization of the dist targets can be done by specifying a hash
3245             reference to the dist attribute of the WriteMakefile call. The
3246             following parameters are recognized:
3247              
3248             CI ('ci -u')
3249             COMPRESS ('gzip --best')
3250             POSTOP ('@ :')
3251             PREOP ('@ :')
3252             TO_UNIX (depends on the system)
3253             RCS_LABEL ('rcs -q -Nv$(VERSION_SYM):')
3254             SHAR ('shar')
3255             SUFFIX ('.gz')
3256             TAR ('tar')
3257             TARFLAGS ('cvf')
3258             ZIP ('zip')
3259             ZIPFLAGS ('-r')
3260              
3261             An example:
3262              
3263             WriteMakefile(
3264             ...other options...
3265             dist => {
3266             COMPRESS => "bzip2",
3267             SUFFIX => ".bz2"
3268             }
3269             );
3270              
3271              
3272             =head2 Module Meta-Data (META and MYMETA)
3273              
3274             Long plaguing users of MakeMaker based modules has been the problem of
3275             getting basic information about the module out of the sources
3276             I<without> running the F<Makefile.PL> and doing a bunch of messy
3277             heuristics on the resulting F<Makefile>. Over the years, it has become
3278             standard to keep this information in one or more CPAN Meta files
3279             distributed with each distribution.
3280              
3281             The original format of CPAN Meta files was L<YAML> and the corresponding
3282             file was called F<META.yml>. In 2010, version 2 of the L<CPAN::Meta::Spec>
3283             was released, which mandates JSON format for the metadata in order to
3284             overcome certain compatibility issues between YAML serializers and to
3285             avoid breaking older clients unable to handle a new version of the spec.
3286             The L<CPAN::Meta> library is now standard for accessing old and new-style
3287             Meta files.
3288              
3289             If L<CPAN::Meta> is installed, MakeMaker will automatically generate
3290             F<META.json> and F<META.yml> files for you and add them to your F<MANIFEST> as
3291             part of the 'distdir' target (and thus the 'dist' target). This is intended to
3292             seamlessly and rapidly populate CPAN with module meta-data. If you wish to
3293             shut this feature off, set the C<NO_META> C<WriteMakefile()> flag to true.
3294              
3295             At the 2008 QA Hackathon in Oslo, Perl module toolchain maintainers agreed
3296             to use the CPAN Meta format to communicate post-configuration requirements
3297             between toolchain components. These files, F<MYMETA.json> and F<MYMETA.yml>,
3298             are generated when F<Makefile.PL> generates a F<Makefile> (if L<CPAN::Meta>
3299             is installed). Clients like L<CPAN> or L<CPANPLUS> will read these
3300             files to see what prerequisites must be fulfilled before building or testing
3301             the distribution. If you wish to shut this feature off, set the C<NO_MYMETA>
3302             C<WriteMakefile()> flag to true.
3303              
3304             =head2 Disabling an extension
3305              
3306             If some events detected in F<Makefile.PL> imply that there is no way
3307             to create the Module, but this is a normal state of things, then you
3308             can create a F<Makefile> which does nothing, but succeeds on all the
3309             "usual" build targets. To do so, use
3310              
3311             use ExtUtils::MakeMaker qw(WriteEmptyMakefile);
3312             WriteEmptyMakefile();
3313              
3314             instead of WriteMakefile().
3315              
3316             This may be useful if other modules expect this module to be I<built>
3317             OK, as opposed to I<work> OK (say, this system-dependent module builds
3318             in a subdirectory of some other distribution, or is listed as a
3319             dependency in a CPAN::Bundle, but the functionality is supported by
3320             different means on the current architecture).
3321              
3322             =head2 Other Handy Functions
3323              
3324             =over 4
3325              
3326             =item prompt
3327              
3328             my $value = prompt($message);
3329             my $value = prompt($message, $default);
3330              
3331             The C<prompt()> function provides an easy way to request user input
3332             used to write a makefile. It displays the $message as a prompt for
3333             input. If a $default is provided it will be used as a default. The
3334             function returns the $value selected by the user.
3335              
3336             If C<prompt()> detects that it is not running interactively and there
3337             is nothing on STDIN or if the PERL_MM_USE_DEFAULT environment variable
3338             is set to true, the $default will be used without prompting. This
3339             prevents automated processes from blocking on user input.
3340              
3341             If no $default is provided an empty string will be used instead.
3342              
3343             =item os_unsupported
3344              
3345             os_unsupported();
3346             os_unsupported if $^O eq 'MSWin32';
3347              
3348             The C<os_unsupported()> function provides a way to correctly exit your
3349             C<Makefile.PL> before calling C<WriteMakefile>. It is essentially a
3350             C<die> with the message "OS unsupported".
3351              
3352             This is supported since 7.26
3353              
3354             =back
3355              
3356             =head2 Supported versions of Perl
3357              
3358             Please note that while this module works on Perl 5.6, it is no longer
3359             being routinely tested on 5.6 - the earliest Perl version being routinely
3360             tested, and expressly supported, is 5.8.1. However, patches to repair
3361             any breakage on 5.6 are still being accepted.
3362              
3363             =head1 ENVIRONMENT
3364              
3365             =over 4
3366              
3367             =item PERL_MM_OPT
3368              
3369             Command line options used by C<MakeMaker-E<gt>new()>, and thus by
3370             C<WriteMakefile()>. The string is split as the shell would, and the result
3371             is processed before any actual command line arguments are processed.
3372              
3373             PERL_MM_OPT='CCFLAGS="-Wl,-rpath -Wl,/foo/bar/lib" LIBS="-lwibble -lwobble"'
3374              
3375             =item PERL_MM_USE_DEFAULT
3376              
3377             If set to a true value then MakeMaker's prompt function will
3378             always return the default without waiting for user input.
3379              
3380             =item PERL_CORE
3381              
3382             Same as the PERL_CORE parameter. The parameter overrides this.
3383              
3384             =back
3385              
3386             =head1 SEE ALSO
3387              
3388             L<Module::Build> is a pure-Perl alternative to MakeMaker which does
3389             not rely on make or any other external utility. It may be easier to
3390             extend to suit your needs.
3391              
3392             L<Module::Build::Tiny> is a minimal pure-Perl alternative to MakeMaker
3393             that follows the Build.PL protocol of Module::Build but without its
3394             complexity and cruft, implementing only the installation of the module
3395             and leaving authoring to L<mbtiny> or other authoring tools.
3396              
3397             L<Module::Install> is a (now discouraged) wrapper around MakeMaker which
3398             adds features not normally available.
3399              
3400             L<ExtUtils::ModuleMaker> and L<Module::Starter> are both modules to
3401             help you setup your distribution.
3402              
3403             L<CPAN::Meta> and L<CPAN::Meta::Spec> explain CPAN Meta files in detail.
3404              
3405             L<File::ShareDir::Install> makes it easy to install static, sometimes
3406             also referred to as 'shared' files. L<File::ShareDir> helps accessing
3407             the shared files after installation. L<Test::File::ShareDir> helps when
3408             writing tests to use the shared files both before and after installation.
3409              
3410             L<Dist::Zilla> is an authoring tool which allows great customization and
3411             extensibility of the author experience, relying on the existing install
3412             tools like ExtUtils::MakeMaker only for installation.
3413              
3414             L<Dist::Milla> is a Dist::Zilla bundle that greatly simplifies common
3415             usage.
3416              
3417             L<Minilla> is a minimal authoring tool that does the same things as
3418             Dist::Milla without the overhead of Dist::Zilla.
3419              
3420             =head1 AUTHORS
3421              
3422             Andy Dougherty C<doughera@lafayette.edu>, Andreas KE<ouml>nig
3423             C<andreas.koenig@mind.de>, Tim Bunce C<timb@cpan.org>. VMS
3424             support by Charles Bailey C<bailey@newman.upenn.edu>. OS/2 support
3425             by Ilya Zakharevich C<ilya@math.ohio-state.edu>.
3426              
3427             Currently maintained by Michael G Schwern C<schwern@pobox.com>
3428              
3429             Send patches and ideas to C<makemaker@perl.org>.
3430              
3431             Send bug reports via http://rt.cpan.org/. Please send your
3432             generated Makefile along with your report.
3433              
3434             For more up-to-date information, see L<https://metacpan.org/release/ExtUtils-MakeMaker>.
3435              
3436             Repository available at L<https://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker>.
3437              
3438             =head1 LICENSE
3439              
3440             This program is free software; you can redistribute it and/or
3441             modify it under the same terms as Perl itself.
3442              
3443             See L<http://www.perl.com/perl/misc/Artistic.html>
3444              
3445              
3446             =cut