File Coverage

lib/ExtUtils/MakeMaker.pm
Criterion Covered Total %
statement 561 623 90.0
branch 230 352 65.3
condition 68 135 50.3
subroutine 50 51 98.0
pod 4 20 20.0
total 913 1181 77.3


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