2 package ExtUtils::MakeMaker;
9 use ExtUtils::MakeMaker::Config;
13 our $Verbose = 0; # exported
14 our @Parent; # needs to be localized
15 our @Get_from_Config; # referenced by MM_Unix
19 my %Recognized_Att_Keys;
21 our $VERSION = '6.63_02';
22 $VERSION = eval $VERSION;
24 # Emulate something resembling CVS $Revision$
25 (our $Revision = $VERSION) =~ s{_}{};
26 $Revision = int $Revision * 10000;
28 our $Filename = __FILE__; # referenced outside MakeMaker
30 our @ISA = qw(Exporter);
31 our @EXPORT = qw(&WriteMakefile &writeMakefile $Verbose &prompt);
32 our @EXPORT_OK = qw($VERSION &neatvalue &mkbootstrap &mksymlists
35 # These will go away once the last of the Win32 & VMS specific code is
37 my $Is_VMS = $^O eq 'VMS';
38 my $Is_Win32 = $^O eq 'MSWin32';
42 require ExtUtils::MM; # Things like CPAN assume loading ExtUtils::MakeMaker
45 require ExtUtils::MY; # XXX pre-5.8 versions of ExtUtils::Embed expect
46 # loading ExtUtils::MakeMaker will give them MY.
47 # This will go when Embed is its own CPAN module.
51 croak "WriteMakefile: Need even number of args" if @_ % 2;
56 _convert_compat_attrs(\%att);
60 my $mm = MM->new(\%att);
67 # Basic signatures of the attributes WriteMakefile takes. Each is the
68 # reference type. Empty value indicate it takes a non-reference
79 EXCLUDE_EXT => 'ARRAY',
84 INCLUDE_EXT => 'ARRAY',
93 PMLIBPARENTDIRS => 'ARRAY',
95 BUILD_REQUIRES => 'HASH',
96 CONFIGURE_REQUIRES => 'HASH',
100 VERSION => ['version',''],
101 _KEEP_AFTER_FLUSH => '',
106 dynamic_lib=> 'HASH',
112 tool_autosplit => 'HASH',
115 @Att_Sigs{keys %Recognized_Att_Keys} = ('') x keys %Recognized_Att_Keys;
116 @Att_Sigs{keys %Special_Sigs} = values %Special_Sigs;
118 sub _convert_compat_attrs { #result of running several times should be same
120 if (exists $att->{AUTHOR}) {
121 if ($att->{AUTHOR}) {
122 if (!ref($att->{AUTHOR})) {
123 my $t = $att->{AUTHOR};
124 $att->{AUTHOR} = [$t];
135 while( my($key, $val) = each %$att ) {
136 my $sig = $Att_Sigs{$key};
137 unless( defined $sig ) {
138 warn "WARNING: $key is not a known parameter.\n";
142 my @sigs = ref $sig ? @$sig : $sig;
143 my $given = ref $val;
144 unless( grep { _is_of_type($val, $_) } @sigs ) {
145 my $takes = join " or ", map { _format_att($_) } @sigs;
147 my $has = _format_att($given);
148 warn "WARNING: $key takes a $takes not a $has.\n".
149 " Please inform the author.\n";
155 # Check if a given thing is a reference or instance of $type
157 my($thing, $type) = @_;
159 return 1 if ref $thing eq $type;
162 return 1 if eval{ $thing->isa($type) };
171 return $given eq '' ? "string/number"
172 : uc $given eq $given ? "$given reference"
178 sub prompt ($;$) { ## no critic
179 my($mess, $def) = @_;
180 confess("prompt function called without an argument")
181 unless defined $mess;
183 my $isa_tty = -t STDIN && (-t STDOUT || !(-f STDOUT || -c STDOUT)) ;
185 my $dispdef = defined $def ? "[$def] " : " ";
186 $def = defined $def ? $def : "";
190 print "$mess $dispdef";
193 if ($ENV{PERL_MM_USE_DEFAULT} || (!$isa_tty && eof STDIN)) {
201 else { # user hit ctrl-D
206 return (!defined $ans || $ans eq '') ? $def : $ans;
209 sub eval_in_subdirs {
211 use Cwd qw(cwd abs_path);
212 my $pwd = cwd() || die "Can't figure out your cwd!";
214 local @INC = map eval {abs_path($_) if -e} || $_, @INC;
215 push @INC, '.'; # '.' has to always be at the end of @INC
217 foreach my $dir (@{$self->{DIR}}){
218 my($abs) = $self->catdir($pwd,$dir);
219 eval { $self->eval_in_x($abs); };
228 chdir $dir or carp("Couldn't change to directory $dir: $!");
235 # if ($@ =~ /prerequisites/) {
236 # die "MakeMaker WARNING: $@";
238 # warn "WARNING from evaluation of $dir/Makefile.PL: $@";
240 die "ERROR from evaluation of $dir/Makefile.PL: $@";
245 # package name for the classes into which the first object will be blessed
246 my $PACKNAME = 'PACK000';
251 my @attrib_help = qw/
253 AUTHOR ABSTRACT ABSTRACT_FROM BINARY_LOCATION
254 C CAPI CCFLAGS CONFIG CONFIGURE DEFINE DIR DISTNAME DISTVNAME
256 EXCLUDE_EXT EXE_FILES FIRST_MAKEFILE
257 FULLPERL FULLPERLRUN FULLPERLRUNINST
260 INST_ARCHLIB INST_SCRIPT INST_BIN INST_LIB INST_MAN1DIR INST_MAN3DIR
262 DESTDIR PREFIX INSTALL_BASE
263 PERLPREFIX SITEPREFIX VENDORPREFIX
264 INSTALLPRIVLIB INSTALLSITELIB INSTALLVENDORLIB
265 INSTALLARCHLIB INSTALLSITEARCH INSTALLVENDORARCH
266 INSTALLBIN INSTALLSITEBIN INSTALLVENDORBIN
267 INSTALLMAN1DIR INSTALLMAN3DIR
268 INSTALLSITEMAN1DIR INSTALLSITEMAN3DIR
269 INSTALLVENDORMAN1DIR INSTALLVENDORMAN3DIR
270 INSTALLSCRIPT INSTALLSITESCRIPT INSTALLVENDORSCRIPT
271 PERL_LIB PERL_ARCHLIB
272 SITELIBEXP SITEARCHEXP
274 INC INCLUDE_EXT LDFROM LIB LIBPERL_A LIBS LICENSE
275 LINKTYPE MAKE MAKEAPERL MAKEFILE MAKEFILE_OLD MAN1PODS MAN3PODS MAP_TARGET
276 META_ADD META_MERGE MIN_PERL_VERSION BUILD_REQUIRES CONFIGURE_REQUIRES
277 MYEXTLIB NAME NEEDS_LINKING NOECHO NO_META NO_MYMETA NORECURS NO_VC OBJECT
278 OPTIMIZE PERL_MALLOC_OK PERL PERLMAINCC PERLRUN PERLRUNINST PERL_CORE
279 PERL_SRC PERM_DIR PERM_RW PERM_RWX
280 PL_FILES PM PM_FILTER PMLIBDIRS PMLIBPARENTDIRS POLLUTE PPM_INSTALL_EXEC
281 PPM_INSTALL_SCRIPT PREREQ_FATAL PREREQ_PM PREREQ_PRINT PRINT_PREREQ
282 SIGN SKIP TYPEMAPS VERSION VERSION_FROM XS XSOPT XSPROTOARG
283 XS_VERSION clean depend dist dynamic_lib linkext macro realclean
286 MACPERL_SRC MACPERL_LIB MACLIBS_68K MACLIBS_PPC MACLIBS_SC MACLIBS_MRC
287 MACLIBS_ALL_68K MACLIBS_ALL_PPC MACLIBS_SHARED
290 # IMPORTS is used under OS/2 and Win32
292 # @Overridable is close to @MM_Sections but not identical. The
293 # order is important. Many subroutines declare macros. These
294 # depend on each other. Let's try to collect the macros up front,
295 # then pasthru, then the rules.
297 # MM_Sections are the sections we have to call explicitly
298 # in Overridable we have subroutines that are used indirectly
304 post_initialize const_config constants platform_constants
305 tool_autosplit tool_xsubpp tools_other
309 dist macro depend cflags const_loadlibs const_cccmd
316 top_targets blibdirs linkext dlsyms dynamic dynamic_bs
317 dynamic_lib static static_lib manifypods processPL
319 clean_subdirs clean realclean_subdirs realclean
321 dist_basics dist_core distdir dist_test dist_ci distmeta distsignature
322 install force perldepend makefile staticmake test ppd
324 ); # loses section ordering
326 @Overridable = @MM_Sections;
327 push @Overridable, qw[
329 libscan makeaperl needs_linking
330 subdir_x test_via_harness test_via_script
332 init_VERSION init_dist init_INST init_INSTALL init_DEST init_dirscan
333 init_PM init_MANPODS init_xs init_PERL init_DIRFILESEP init_linker
336 push @MM_Sections, qw[
338 pm_to_blib selfdocument
342 # Postamble needs to be the last that was always the case
343 push @MM_Sections, "postamble";
344 push @Overridable, "postamble";
346 # All sections are valid keys.
347 @Recognized_Att_Keys{@MM_Sections} = (1) x @MM_Sections;
349 # we will use all these variables in the Makefile
352 ar cc cccdlflags ccdlflags dlext dlsrc exe_ext full_ar ld
353 lddlflags ldflags libc lib_ext obj_ext osname osvers ranlib
354 sitelibexp sitearchexp so
357 # 5.5.3 doesn't have any concept of vendor libs
358 push @Get_from_Config, qw( vendorarchexp vendorlibexp ) if $] >= 5.006;
360 foreach my $item (@attrib_help){
361 $Recognized_Att_Keys{$item} = 1;
363 foreach my $item (@Get_from_Config) {
364 $Recognized_Att_Keys{uc $item} = $Config{$item};
365 print "Attribute '\U$item\E' => '$Config{$item}'\n"
370 # When we eval a Makefile.PL in a subdirectory, that one will ask
371 # us (the parent) for the values and will prepend "..", so that
372 # all files to be installed end up below OUR ./blib
374 @Prepend_parent = qw(
375 INST_BIN INST_LIB INST_ARCHLIB INST_SCRIPT
376 MAP_TARGET INST_MAN1DIR INST_MAN3DIR PERL_SRC
384 The extension you are trying to build apparently is rather old and
385 most probably outdated. We detect that from the fact, that a
386 subroutine "writeMakefile" is called, and this subroutine is not
387 supported anymore since about October 1994.
389 Please contact the author or look into CPAN (details about CPAN can be
390 found in the FAQ and at http:/www.perl.com) for a more recent version
391 of the extension. If you're really desperate, you can try to change
392 the subroutine name from writeMakefile to WriteMakefile and rerun
393 'perl Makefile.PL', but you're most probably left alone, when you do
402 my($class,$self) = @_;
405 _convert_compat_attrs($self) if defined $self && $self;
407 # Store the original args passed to WriteMakefile()
408 foreach my $k (keys %$self) {
409 $self->{ARGS}{$k} = $self->{$k};
412 $self = {} unless defined $self;
414 # Temporarily bless it into MM so it can be used as an
415 # object. It will be blessed into a temp package later.
418 # Cleanup all the module requirement bits
419 for my $key (qw(PREREQ_PM BUILD_REQUIRES CONFIGURE_REQUIRES)) {
420 $self->{$key} ||= {};
421 $self->clean_versions( $key );
425 if ("@ARGV" =~ /\bPREREQ_PRINT\b/) {
426 $self->_PREREQ_PRINT;
429 # PRINT_PREREQ is RedHatism.
430 if ("@ARGV" =~ /\bPRINT_PREREQ\b/) {
431 $self->_PRINT_PREREQ;
434 print STDOUT "MakeMaker (v$VERSION)\n" if $Verbose;
435 if (-f "MANIFEST" && ! -f "Makefile" && ! $ENV{PERL_CORE}){
441 # Translate X.Y.Z to X.00Y00Z
442 if( defined $self->{MIN_PERL_VERSION} ) {
443 $self->{MIN_PERL_VERSION} =~ s{ ^ (\d+) \. (\d+) \. (\d+) $ }
444 {sprintf "%d.%03d%03d", $1, $2, $3}ex;
447 my $perl_version_ok = eval {
448 local $SIG{__WARN__} = sub {
449 # simulate "use warnings FATAL => 'all'" for vintage perls
452 !$self->{MIN_PERL_VERSION} or $self->{MIN_PERL_VERSION} <= $]
454 if (!$perl_version_ok) {
455 if (!defined $perl_version_ok) {
457 Warning: MIN_PERL_VERSION is not in a recognized format.
458 Recommended is a quoted numerical value like '5.005' or '5.008001'.
461 elsif ($self->{PREREQ_FATAL}) {
462 die sprintf <<"END", $self->{MIN_PERL_VERSION}, $];
463 MakeMaker FATAL: perl version too low for this distribution.
464 Required is %s. We run %s.
469 "Warning: Perl version %s or higher required. We run %s.\n",
470 $self->{MIN_PERL_VERSION}, $];
474 my %configure_att; # record &{$self->{CONFIGURE}} attributes
475 my(%initial_att) = %$self; # record initial attributes
477 my(%unsatisfied) = ();
478 my $prereqs = $self->_all_prereqs;
479 foreach my $prereq (sort keys %$prereqs) {
480 my $required_version = $prereqs->{$prereq};
482 my $installed_file = MM->_installed_file_for_module($prereq);
484 $pr_version = MM->parse_version($installed_file) if $installed_file;
485 $pr_version = 0 if $pr_version eq 'undef';
487 # convert X.Y_Z alpha version #s to X.YZ for easier comparisons
488 $pr_version =~ s/(\d+)\.(\d+)_(\d+)/$1.$2$3/;
490 if (!$installed_file) {
491 warn sprintf "Warning: prerequisite %s %s not found.\n",
492 $prereq, $required_version
493 unless $self->{PREREQ_FATAL}
496 $unsatisfied{$prereq} = 'not installed';
498 elsif ($pr_version < $required_version ){
499 warn sprintf "Warning: prerequisite %s %s not found. We have %s.\n",
500 $prereq, $required_version, ($pr_version || 'unknown version')
501 unless $self->{PREREQ_FATAL}
504 $unsatisfied{$prereq} = $required_version ? $required_version : 'unknown version' ;
508 if (%unsatisfied && $self->{PREREQ_FATAL}){
509 my $failedprereqs = join "\n", map {" $_ $unsatisfied{$_}"}
510 sort { $a cmp $b } keys %unsatisfied;
512 MakeMaker FATAL: prerequisites not found.
515 Please install these modules first and rerun 'perl Makefile.PL'.
519 if (defined $self->{CONFIGURE}) {
520 if (ref $self->{CONFIGURE} eq 'CODE') {
521 %configure_att = %{&{$self->{CONFIGURE}}};
522 _convert_compat_attrs(\%configure_att);
523 $self = { %$self, %configure_att };
525 croak "Attribute 'CONFIGURE' to WriteMakefile() not a code reference\n";
529 # This is for old Makefiles written pre 5.00, will go away
530 if ( Carp::longmess("") =~ /runsubdirpl/s ){
531 carp("WARNING: Please rerun 'perl Makefile.PL' to regenerate your Makefiles\n");
534 my $newclass = ++$PACKNAME;
535 local @Parent = @Parent; # Protect against non-local exits
537 print "Blessing Object into class [$newclass]\n" if $Verbose>=2;
538 mv_all_methods("MY",$newclass);
539 bless $self, $newclass;
541 require ExtUtils::MY;
543 no strict 'refs'; ## no critic;
544 @{"$newclass\:\:ISA"} = 'MM';
547 if (defined $Parent[-2]){
548 $self->{PARENT} = $Parent[-2];
549 for my $key (@Prepend_parent) {
550 next unless defined $self->{PARENT}{$key};
552 # Don't stomp on WriteMakefile() args.
553 next if defined $self->{ARGS}{$key} and
554 $self->{ARGS}{$key} eq $self->{$key};
556 $self->{$key} = $self->{PARENT}{$key};
558 unless ($Is_VMS && $key =~ /PERL$/) {
559 $self->{$key} = $self->catdir("..",$self->{$key})
560 unless $self->file_name_is_absolute($self->{$key});
562 # PERL or FULLPERL will be a command verb or even a
563 # command with an argument instead of a full file
564 # specification under VMS. So, don't turn the command
565 # into a filespec, but do add a level to the path of
566 # the argument if not already absolute.
567 my @cmd = split /\s+/, $self->{$key};
568 $cmd[1] = $self->catfile('[-]',$cmd[1])
569 unless (@cmd < 2) || $self->file_name_is_absolute($cmd[1]);
570 $self->{$key} = join(' ', @cmd);
573 if ($self->{PARENT}) {
574 $self->{PARENT}->{CHILDREN}->{$newclass} = $self;
575 foreach my $opt (qw(POLLUTE PERL_CORE LINKTYPE)) {
576 if (exists $self->{PARENT}->{$opt}
577 and not exists $self->{$opt})
579 # inherit, but only if already unspecified
580 $self->{$opt} = $self->{PARENT}->{$opt};
584 my @fm = grep /^FIRST_MAKEFILE=/, @ARGV;
585 parse_args($self,@fm) if @fm;
587 parse_args($self,split(' ', $ENV{PERL_MM_OPT} || ''),@ARGV);
591 $self->{NAME} ||= $self->guess_name;
593 ($self->{NAME_SYM} = $self->{NAME}) =~ s/\W+/_/g;
607 $self->init_DIRFILESEP;
609 $self->init_ABSTRACT;
613 $self->catfile($Config{'archlibexp'}, "Config.pm")
617 $self->init_others();
618 $self->init_platform();
620 my($argv) = neatvalue(\@ARGV);
624 push @{$self->{RESULT}}, <<END;
625 # This Makefile is for the $self->{NAME} extension to perl.
627 # It was generated automatically by MakeMaker version
628 # $VERSION (Revision: $Revision) from the contents of
629 # Makefile.PL. Don't edit this file, edit Makefile.PL instead.
631 # ANY CHANGES MADE HERE WILL BE LOST!
633 # MakeMaker ARGV: $argv
637 push @{$self->{RESULT}}, $self->_MakeMaker_Parameters_section(\%initial_att);
639 if (defined $self->{CONFIGURE}) {
640 push @{$self->{RESULT}}, <<END;
642 # MakeMaker 'CONFIGURE' Parameters:
644 if (scalar(keys %configure_att) > 0) {
645 foreach my $key (sort keys %configure_att){
646 next if $key eq 'ARGS';
647 my($v) = neatvalue($configure_att{$key});
648 $v =~ s/(CODE|HASH|ARRAY|SCALAR)\([\dxa-f]+\)/$1\(...\)/;
650 push @{$self->{RESULT}}, "# $key => $v";
655 push @{$self->{RESULT}}, "# no values returned";
657 undef %configure_att; # free memory
660 # turn the SKIP array into a SKIPHASH hash
661 for my $skip (@{$self->{SKIP} || []}) {
662 $self->{SKIPHASH}{$skip} = 1;
664 delete $self->{SKIP}; # free memory
666 if ($self->{PARENT}) {
667 for (qw/install dist dist_basics dist_core distdir dist_test dist_ci/) {
668 $self->{SKIPHASH}{$_} = 1;
672 # We run all the subdirectories now. They don't have much to query
673 # from the parent, but the parent has to query them: if they need linking!
674 unless ($self->{NORECURS}) {
675 $self->eval_in_subdirs if @{$self->{DIR}};
678 foreach my $section ( @MM_Sections ){
679 # Support for new foo_target() methods.
680 my $method = $section;
681 $method .= '_target' unless $self->can($method);
683 print "Processing Makefile '$section' section\n" if ($Verbose >= 2);
684 my($skipit) = $self->skipcheck($section);
686 push @{$self->{RESULT}}, "\n# --- MakeMaker $section section $skipit.";
688 my(%a) = %{$self->{$section} || {}};
689 push @{$self->{RESULT}}, "\n# --- MakeMaker $section section:";
690 push @{$self->{RESULT}}, "# " . join ", ", %a if $Verbose && %a;
691 push @{$self->{RESULT}}, $self->maketext_filter(
697 push @{$self->{RESULT}}, "\n# End.";
702 sub WriteEmptyMakefile {
703 croak "WriteEmptyMakefile: Need an even number of args" if @_ % 2;
706 my $self = MM->new(\%att);
708 my $new = $self->{MAKEFILE};
709 my $old = $self->{MAKEFILE_OLD};
711 _unlink($old) or warn "unlink $old: $!";
714 _rename($new, $old) or warn "rename $new => $old: $!"
716 open my $mfh, '>', $new or die "open $new for write: $!";
729 close $mfh or die "close $new for write: $!";
735 =head3 _installed_file_for_module
737 my $file = MM->_installed_file_for_module($module);
739 Return the first installed .pm $file associated with the $module. The
740 one which will show up when you C<use $module>.
742 $module is something like "strict" or "Test::More".
748 sub _installed_file_for_module {
752 my $file = "$prereq.pm";
757 my $tmp = File::Spec->catfile($dir, $file);
768 # Extracted from MakeMaker->new so we can test it
769 sub _MakeMaker_Parameters_section {
773 my @result = <<'END';
774 # MakeMaker Parameters:
777 foreach my $key (sort keys %$att){
778 next if $key eq 'ARGS';
779 my ($v) = neatvalue($att->{$key});
780 if ($key eq 'PREREQ_PM') {
781 # CPAN.pm takes prereqs from this field in 'Makefile'
782 # and does not know about BUILD_REQUIRES
783 $v = neatvalue({ %{ $att->{PREREQ_PM} || {} }, %{ $att->{BUILD_REQUIRES} || {} } });
785 $v = neatvalue($att->{$key});
788 $v =~ s/(CODE|HASH|ARRAY|SCALAR)\([\dxa-f]+\)/$1\(...\)/;
790 push @result, "# $key => $v";
798 print STDOUT "Checking if your kit is complete...\n";
799 require ExtUtils::Manifest;
801 $ExtUtils::Manifest::Quiet = $ExtUtils::Manifest::Quiet = 1;
802 my(@missed) = ExtUtils::Manifest::manicheck();
804 print STDOUT "Warning: the following files are missing in your kit:\n";
805 print "\t", join "\n\t", @missed;
807 print STDOUT "Please inform the author.\n";
809 print STDOUT "Looks good\n";
814 my($self, @args) = @_;
816 unless (m/(.*?)=(.*)/) {
817 ++$Verbose if m/^verb/;
820 my($name, $value) = ($1, $2);
821 if ($value =~ m/^~(\w+)?/) { # tilde with optional username
822 $value =~ s [^~(\w*)]
824 ((getpwnam($1))[7] || "~$1") :
829 # Remember the original args passed it. It will be useful later.
830 $self->{ARGS}{uc $name} = $self->{uc $name} = $value;
833 # catch old-style 'potential_libs' and inform user how to 'upgrade'
834 if (defined $self->{potential_libs}){
835 my($msg)="'potential_libs' => '$self->{potential_libs}' should be";
836 if ($self->{potential_libs}){
837 print STDOUT "$msg changed to:\n\t'LIBS' => ['$self->{potential_libs}']\n";
839 print STDOUT "$msg deleted.\n";
841 $self->{LIBS} = [$self->{potential_libs}];
842 delete $self->{potential_libs};
844 # catch old-style 'ARMAYBE' and inform user how to 'upgrade'
845 if (defined $self->{ARMAYBE}){
846 my($armaybe) = $self->{ARMAYBE};
847 print STDOUT "ARMAYBE => '$armaybe' should be changed to:\n",
848 "\t'dynamic_lib' => {ARMAYBE => '$armaybe'}\n";
849 my(%dl) = %{$self->{dynamic_lib} || {}};
850 $self->{dynamic_lib} = { %dl, ARMAYBE => $armaybe};
851 delete $self->{ARMAYBE};
853 if (defined $self->{LDTARGET}){
854 print STDOUT "LDTARGET should be changed to LDFROM\n";
855 $self->{LDFROM} = $self->{LDTARGET};
856 delete $self->{LDTARGET};
858 # Turn a DIR argument on the command line into an array
859 if (defined $self->{DIR} && ref \$self->{DIR} eq 'SCALAR') {
860 # So they can choose from the command line, which extensions they want
861 # the grep enables them to have some colons too much in case they
862 # have to build a list with the shell
863 $self->{DIR} = [grep $_, split ":", $self->{DIR}];
865 # Turn a INCLUDE_EXT argument on the command line into an array
866 if (defined $self->{INCLUDE_EXT} && ref \$self->{INCLUDE_EXT} eq 'SCALAR') {
867 $self->{INCLUDE_EXT} = [grep $_, split '\s+', $self->{INCLUDE_EXT}];
869 # Turn a EXCLUDE_EXT argument on the command line into an array
870 if (defined $self->{EXCLUDE_EXT} && ref \$self->{EXCLUDE_EXT} eq 'SCALAR') {
871 $self->{EXCLUDE_EXT} = [grep $_, split '\s+', $self->{EXCLUDE_EXT}];
874 foreach my $mmkey (sort keys %$self){
875 next if $mmkey eq 'ARGS';
876 print STDOUT " $mmkey => ", neatvalue($self->{$mmkey}), "\n" if $Verbose;
877 print STDOUT "'$mmkey' is not a known MakeMaker parameter name.\n"
878 unless exists $Recognized_Att_Keys{$mmkey};
885 # We allow extension-specific hints files.
888 my $curdir = File::Spec->curdir;
890 my $hint_dir = File::Spec->catdir($curdir, "hints");
891 return unless -d $hint_dir;
893 # First we look for the best hintsfile we have
894 my($hint)="${^O}_$Config{osvers}";
899 # Also try without trailing minor version numbers.
901 last if -f File::Spec->catfile($hint_dir, "$hint.pl"); # found
903 last unless $hint =~ s/_[^_]*$//; # nothing to cut off
905 my $hint_file = File::Spec->catfile($hint_dir, "$hint.pl");
907 return unless -f $hint_file; # really there
909 _run_hintfile($self, $hint_file);
914 local($self) = shift; # make $self available to the hint file.
915 my($hint_file) = shift;
918 print STDERR "Processing hints file $hint_file\n";
920 # Just in case the ./ isn't on the hint file, which File::Spec can
921 # often strip off, we bung the curdir into @INC
922 local @INC = (File::Spec->curdir, @INC);
923 my $ret = do $hint_file;
924 if( !defined $ret ) {
925 my $error = $@ || $!;
933 # Here you see the *current* list of methods that are overridable
934 # from Makefile.PL via MY:: subroutines. As of VERSION 5.07 I'm
935 # still trying to reduce the list to some reasonable minimum --
936 # because I want to make it easier for the user. A.K.
938 local $SIG{__WARN__} = sub {
939 # can't use 'no warnings redefined', 5.6 only
940 warn @_ unless $_[0] =~ /^Subroutine .* redefined/
942 foreach my $method (@Overridable) {
944 # We cannot say "next" here. Nick might call MY->makeaperl
945 # which isn't defined right now
947 # Above statement was written at 4.23 time when Tk-b8 was
948 # around. As Tk-b9 only builds with 5.002something and MM 5 is
949 # standard, we try to enable the next line again. It was
950 # commented out until MM 5.23
952 next unless defined &{"${from}::$method"};
955 no strict 'refs'; ## no critic
956 *{"${to}::$method"} = \&{"${from}::$method"};
958 # If we delete a method, then it will be undefined and cannot
959 # be called. But as long as we have Makefile.PLs that rely on
960 # %MY:: being intact, we have to fill the hole with an
965 my $super = "SUPER::".$method;
973 # We have to clean out %INC also, because the current directory is
974 # changed frequently and Graham Barr prefers to get his version
975 # out of a History.pl file which is "required" so woudn't get
976 # loaded again in another extension requiring a History.pl
978 # With perl5.002_01 the deletion of entries in %INC caused Tk-b11
979 # to core dump in the middle of a require statement. The required
980 # file was Tk/MMutil.pm. The consequence is, we have to be
981 # extremely careful when we try to give perl a reason to reload a
982 # library with same name. The workaround prefers to drop nothing
983 # from %INC and teach the writers not to use such libraries.
986 # foreach $inc (keys %INC) {
987 # #warn "***$inc*** deleted";
995 if ($section eq 'dynamic') {
996 print STDOUT "Warning (non-fatal): Target 'dynamic' depends on targets ",
997 "in skipped section 'dynamic_bs'\n"
998 if $self->{SKIPHASH}{dynamic_bs} && $Verbose;
999 print STDOUT "Warning (non-fatal): Target 'dynamic' depends on targets ",
1000 "in skipped section 'dynamic_lib'\n"
1001 if $self->{SKIPHASH}{dynamic_lib} && $Verbose;
1003 if ($section eq 'dynamic_lib') {
1004 print STDOUT "Warning (non-fatal): Target '\$(INST_DYNAMIC)' depends on ",
1005 "targets in skipped section 'dynamic_bs'\n"
1006 if $self->{SKIPHASH}{dynamic_bs} && $Verbose;
1008 if ($section eq 'static') {
1009 print STDOUT "Warning (non-fatal): Target 'static' depends on targets ",
1010 "in skipped section 'static_lib'\n"
1011 if $self->{SKIPHASH}{static_lib} && $Verbose;
1013 return 'skipped' if $self->{SKIPHASH}{$section};
1020 my $finalname = $self->{MAKEFILE};
1021 print STDOUT "Writing $finalname for $self->{NAME}\n";
1023 unlink($finalname, "MakeMaker.tmp", $Is_VMS ? 'Descrip.MMS' : ());
1024 open(my $fh,">", "MakeMaker.tmp")
1025 or die "Unable to open MakeMaker.tmp: $!";
1027 for my $chunk (@{$self->{RESULT}}) {
1028 print $fh "$chunk\n"
1029 or die "Can't write to MakeMaker.tmp: $!";
1033 or die "Can't write to MakeMaker.tmp: $!";
1034 _rename("MakeMaker.tmp", $finalname) or
1035 warn "rename MakeMaker.tmp => $finalname: $!";
1036 chmod 0644, $finalname unless $Is_VMS;
1038 unless ($self->{NO_MYMETA}) {
1039 # Write MYMETA.yml to communicate metadata up to the CPAN clients
1040 if ( $self->write_mymeta( $self->mymeta ) ) {;
1041 print STDOUT "Writing MYMETA.yml and MYMETA.json\n";
1045 my %keep = map { ($_ => 1) } qw(NEEDS_LINKING HAS_LINK_CODE);
1046 if ($self->{PARENT} && !$self->{_KEEP_AFTER_FLUSH}) {
1047 foreach (keys %$self) { # safe memory
1048 delete $self->{$_} unless $keep{$_};
1052 system("$Config::Config{eunicefix} $finalname") unless $Config::Config{eunicefix} eq ":";
1055 # This is a rename for OS's where the target must be unlinked first.
1057 my($src, $dest) = @_;
1060 return rename $src, $dest;
1063 # This is an unlink for OS's where the target must be writable first.
1067 return unlink @files;
1071 # The following mkbootstrap() is only for installations that are calling
1072 # the pre-4.1 mkbootstrap() from their old Makefiles. This MakeMaker
1073 # writes Makefiles, that use ExtUtils::Mkbootstrap directly.
1076 !!! Your Makefile has been built such a long time ago, !!!
1077 !!! that is unlikely to work with current MakeMaker. !!!
1078 !!! Please rebuild your Makefile !!!
1082 # Ditto for mksymlists() as of MakeMaker 5.17
1085 !!! Your Makefile has been built such a long time ago, !!!
1086 !!! that is unlikely to work with current MakeMaker. !!!
1087 !!! Please rebuild your Makefile !!!
1093 return "undef" unless defined $v;
1095 return "q[$v]" unless $t;
1096 if ($t eq 'ARRAY') {
1099 foreach my $elem (@$v) {
1100 push @neat, "q[$elem]";
1102 push @m, join ", ", @neat;
1106 return "$v" unless $t eq 'HASH';
1108 while (($key,$val) = each %$v){
1109 last unless defined $key; # cautious programming in case (undef,undef) is true
1110 push(@m,"$key=>".neatvalue($val)) ;
1112 return "{ ".join(', ',@m)." }";
1115 # Look for weird version numbers, warn about them and set them to 0
1116 # before CPAN::Meta chokes.
1117 sub clean_versions {
1118 my($self, $key) = @_;
1120 my $reqs = $self->{$key};
1121 for my $module (keys %$reqs) {
1122 my $version = $reqs->{$module};
1124 if( !defined $version or $version !~ /^[\d_\.]+$/ ) {
1125 carp "Unparsable version '$version' for prerequisite $module";
1126 $reqs->{$module} = 0;
1135 push @m, "\n# Full list of MakeMaker attribute values:";
1136 foreach my $key (sort keys %$self){
1137 next if $key eq 'RESULT' || $key =~ /^[A-Z][a-z]/;
1138 my($v) = neatvalue($self->{$key});
1139 $v =~ s/(CODE|HASH|ARRAY|SCALAR)\([\dxa-f]+\)/$1\(...\)/;
1141 push @m, "# $key => $v";
1153 ExtUtils::MakeMaker - Create a module Makefile
1157 use ExtUtils::MakeMaker;
1159 WriteMakefile( ATTRIBUTE => VALUE [, ...] );
1163 This utility is designed to write a Makefile for an extension module
1164 from a Makefile.PL. It is based on the Makefile.SH model provided by
1165 Andy Dougherty and the perl5-porters.
1167 It splits the task of generating the Makefile into several subroutines
1168 that can be individually overridden. Each subroutine returns the text
1169 it wishes to have written to the Makefile.
1171 MakeMaker is object oriented. Each directory below the current
1172 directory that contains a Makefile.PL is treated as a separate
1173 object. This makes it possible to write an unlimited number of
1174 Makefiles with a single invocation of WriteMakefile().
1176 =head2 How To Write A Makefile.PL
1178 See ExtUtils::MakeMaker::Tutorial.
1180 The long answer is the rest of the manpage :-)
1182 =head2 Default Makefile Behaviour
1184 The generated Makefile enables the user of the extension to invoke
1186 perl Makefile.PL # optionally "perl Makefile.PL verbose"
1188 make test # optionally set TEST_VERBOSE=1
1189 make install # See below
1191 The Makefile to be produced may be altered by adding arguments of the
1192 form C<KEY=VALUE>. E.g.
1194 perl Makefile.PL INSTALL_BASE=~
1196 Other interesting targets in the generated Makefile are
1198 make config # to check if the Makefile is up-to-date
1199 make clean # delete local temp files (Makefile gets renamed)
1200 make realclean # delete derived files (including ./blib)
1201 make ci # check in all the files in the MANIFEST file
1202 make dist # see below the Distribution Support section
1206 MakeMaker checks for the existence of a file named F<test.pl> in the
1207 current directory and if it exists it execute the script with the
1208 proper set of perl C<-I> options.
1210 MakeMaker also checks for any files matching glob("t/*.t"). It will
1211 execute all matching files in alphabetical order via the
1212 L<Test::Harness> module with the C<-I> switches set correctly.
1214 If you'd like to see the raw output of your tests, set the
1215 C<TEST_VERBOSE> variable to true.
1217 make test TEST_VERBOSE=1
1221 A useful variation of the above is the target C<testdb>. It runs the
1222 test under the Perl debugger (see L<perldebug>). If the file
1223 F<test.pl> exists in the current directory, it is used for the test.
1225 If you want to debug some other testfile, set the C<TEST_FILE> variable
1228 make testdb TEST_FILE=t/mytest.t
1230 By default the debugger is called using C<-d> option to perl. If you
1231 want to specify some other option, set the C<TESTDB_SW> variable:
1233 make testdb TESTDB_SW=-Dx
1237 make alone puts all relevant files into directories that are named by
1238 the macros INST_LIB, INST_ARCHLIB, INST_SCRIPT, INST_MAN1DIR and
1239 INST_MAN3DIR. All these default to something below ./blib if you are
1240 I<not> building below the perl source directory. If you I<are>
1241 building below the perl source, INST_LIB and INST_ARCHLIB default to
1242 ../../lib, and INST_SCRIPT is not defined.
1244 The I<install> target of the generated Makefile copies the files found
1245 below each of the INST_* directories to their INSTALL*
1246 counterparts. Which counterparts are chosen depends on the setting of
1247 INSTALLDIRS according to the following table:
1252 PERLPREFIX SITEPREFIX VENDORPREFIX
1253 INST_ARCHLIB INSTALLARCHLIB INSTALLSITEARCH INSTALLVENDORARCH
1254 INST_LIB INSTALLPRIVLIB INSTALLSITELIB INSTALLVENDORLIB
1255 INST_BIN INSTALLBIN INSTALLSITEBIN INSTALLVENDORBIN
1256 INST_SCRIPT INSTALLSCRIPT INSTALLSITESCRIPT INSTALLVENDORSCRIPT
1257 INST_MAN1DIR INSTALLMAN1DIR INSTALLSITEMAN1DIR INSTALLVENDORMAN1DIR
1258 INST_MAN3DIR INSTALLMAN3DIR INSTALLSITEMAN3DIR INSTALLVENDORMAN3DIR
1260 The INSTALL... macros in turn default to their %Config
1261 ($Config{installprivlib}, $Config{installarchlib}, etc.) counterparts.
1263 You can check the values of these variables on your system with
1267 And to check the sequence in which the library directories are
1268 searched by perl, run
1270 perl -le 'print join $/, @INC'
1272 Sometimes older versions of the module you're installing live in other
1273 directories in @INC. Because Perl loads the first version of a module it
1274 finds, not the newest, you might accidentally get one of these older
1275 versions even after installing a brand new version. To delete I<all other
1276 versions of the module you're installing> (not simply older ones) set the
1279 make install UNINST=1
1284 INSTALL_BASE can be passed into Makefile.PL to change where your
1285 module will be installed. INSTALL_BASE is more like what everyone
1286 else calls "prefix" than PREFIX is.
1288 To have everything installed in your home directory, do the following.
1290 # Unix users, INSTALL_BASE=~ works fine
1291 perl Makefile.PL INSTALL_BASE=/path/to/your/home/dir
1293 Like PREFIX, it sets several INSTALL* attributes at once. Unlike
1294 PREFIX it is easy to predict where the module will end up. The
1295 installation pattern looks like this:
1297 INSTALLARCHLIB INSTALL_BASE/lib/perl5/$Config{archname}
1298 INSTALLPRIVLIB INSTALL_BASE/lib/perl5
1299 INSTALLBIN INSTALL_BASE/bin
1300 INSTALLSCRIPT INSTALL_BASE/bin
1301 INSTALLMAN1DIR INSTALL_BASE/man/man1
1302 INSTALLMAN3DIR INSTALL_BASE/man/man3
1304 INSTALL_BASE in MakeMaker and C<--install_base> in Module::Build (as
1305 of 0.28) install to the same location. If you want MakeMaker and
1306 Module::Build to install to the same location simply set INSTALL_BASE
1307 and C<--install_base> to the same location.
1309 INSTALL_BASE was added in 6.31.
1312 =head2 PREFIX and LIB attribute
1314 PREFIX and LIB can be used to set several INSTALL* attributes in one
1315 go. Here's an example for installing into your home directory.
1317 # Unix users, PREFIX=~ works fine
1318 perl Makefile.PL PREFIX=/path/to/your/home/dir
1320 This will install all files in the module under your home directory,
1321 with man pages and libraries going into an appropriate place (usually
1322 ~/man and ~/lib). How the exact location is determined is complicated
1323 and depends on how your Perl was configured. INSTALL_BASE works more
1324 like what other build systems call "prefix" than PREFIX and we
1325 recommend you use that instead.
1327 Another way to specify many INSTALL directories with a single
1330 perl Makefile.PL LIB=~/lib
1332 This will install the module's architecture-independent files into
1333 ~/lib, the architecture-dependent files into ~/lib/$archname.
1335 Note, that in both cases the tilde expansion is done by MakeMaker, not
1336 by perl by default, nor by make.
1338 Conflicts between parameters LIB, PREFIX and the various INSTALL*
1339 arguments are resolved so that:
1345 setting LIB overrides any setting of INSTALLPRIVLIB, INSTALLARCHLIB,
1346 INSTALLSITELIB, INSTALLSITEARCH (and they are not affected by PREFIX);
1350 without LIB, setting PREFIX replaces the initial C<$Config{prefix}>
1351 part of those INSTALL* arguments, even if the latter are explicitly
1352 set (but are set to still start with C<$Config{prefix}>).
1356 If the user has superuser privileges, and is not working on AFS or
1357 relatives, then the defaults for INSTALLPRIVLIB, INSTALLARCHLIB,
1358 INSTALLSCRIPT, etc. will be appropriate, and this incantation will be
1366 make install per default writes some documentation of what has been
1367 done into the file C<$(INSTALLARCHLIB)/perllocal.pod>. This feature
1368 can be bypassed by calling make pure_install.
1372 will have to specify the installation directories as these most
1373 probably have changed since perl itself has been installed. They will
1374 have to do this by calling
1376 perl Makefile.PL INSTALLSITELIB=/afs/here/today \
1377 INSTALLSCRIPT=/afs/there/now INSTALLMAN3DIR=/afs/for/manpages
1380 Be careful to repeat this procedure every time you recompile an
1381 extension, unless you are sure the AFS installation directories are
1384 =head2 Static Linking of a new Perl Binary
1386 An extension that is built with the above steps is ready to use on
1387 systems supporting dynamic loading. On systems that do not support
1388 dynamic loading, any newly created extension has to be linked together
1389 with the available resources. MakeMaker supports the linking process
1390 by creating appropriate targets in the Makefile whenever an extension
1391 is built. You can invoke the corresponding section of the makefile with
1395 That produces a new perl binary in the current directory with all
1396 extensions linked in that can be found in INST_ARCHLIB, SITELIBEXP,
1397 and PERL_ARCHLIB. To do that, MakeMaker writes a new Makefile, on
1398 UNIX, this is called Makefile.aperl (may be system dependent). If you
1399 want to force the creation of a new perl, it is recommended, that you
1400 delete this Makefile.aperl, so the directories are searched-through
1401 for linkable libraries again.
1403 The binary can be installed into the directory where perl normally
1404 resides on your machine with
1408 To produce a perl binary with a different name than C<perl>, either say
1410 perl Makefile.PL MAP_TARGET=myperl
1417 make myperl MAP_TARGET=myperl
1418 make inst_perl MAP_TARGET=myperl
1420 In any case you will be prompted with the correct invocation of the
1421 C<inst_perl> target that installs the new binary into INSTALLBIN.
1423 make inst_perl per default writes some documentation of what has been
1424 done into the file C<$(INSTALLARCHLIB)/perllocal.pod>. This
1425 can be bypassed by calling make pure_inst_perl.
1427 Warning: the inst_perl: target will most probably overwrite your
1428 existing perl binary. Use with care!
1430 Sometimes you might want to build a statically linked perl although
1431 your system supports dynamic loading. In this case you may explicitly
1432 set the linktype with the invocation of the Makefile.PL or make:
1434 perl Makefile.PL LINKTYPE=static # recommended
1438 make LINKTYPE=static # works on most systems
1440 =head2 Determination of Perl Library and Installation Locations
1442 MakeMaker needs to know, or to guess, where certain things are
1443 located. Especially INST_LIB and INST_ARCHLIB (where to put the files
1444 during the make(1) run), PERL_LIB and PERL_ARCHLIB (where to read
1445 existing modules from), and PERL_INC (header files and C<libperl*.*>).
1447 Extensions may be built either using the contents of the perl source
1448 directory tree or from the installed perl library. The recommended way
1449 is to build extensions after you have run 'make install' on perl
1450 itself. You can do that in any directory on your hard disk that is not
1451 below the perl source tree. The support for extensions below the ext
1452 directory of the perl distribution is only good for the standard
1453 extensions that come with perl.
1455 If an extension is being built below the C<ext/> directory of the perl
1456 source then MakeMaker will set PERL_SRC automatically (e.g.,
1457 C<../..>). If PERL_SRC is defined and the extension is recognized as
1458 a standard extension, then other variables default to the following:
1461 PERL_LIB = PERL_SRC/lib
1462 PERL_ARCHLIB = PERL_SRC/lib
1464 INST_ARCHLIB = PERL_ARCHLIB
1466 If an extension is being built away from the perl source then MakeMaker
1467 will leave PERL_SRC undefined and default to using the installed copy
1468 of the perl library. The other variables default to the following:
1470 PERL_INC = $archlibexp/CORE
1471 PERL_LIB = $privlibexp
1472 PERL_ARCHLIB = $archlibexp
1473 INST_LIB = ./blib/lib
1474 INST_ARCHLIB = ./blib/arch
1476 If perl has not yet been installed then PERL_SRC can be defined on the
1477 command line as shown in the previous section.
1480 =head2 Which architecture dependent directory?
1482 If you don't want to keep the defaults for the INSTALL* macros,
1483 MakeMaker helps you to minimize the typing needed: the usual
1484 relationship between INSTALLPRIVLIB and INSTALLARCHLIB is determined
1485 by Configure at perl compilation time. MakeMaker supports the user who
1486 sets INSTALLPRIVLIB. If INSTALLPRIVLIB is set, but INSTALLARCHLIB not,
1487 then MakeMaker defaults the latter to be the same subdirectory of
1488 INSTALLPRIVLIB as Configure decided for the counterparts in %Config ,
1489 otherwise it defaults to INSTALLPRIVLIB. The same relationship holds
1490 for INSTALLSITELIB and INSTALLSITEARCH.
1492 MakeMaker gives you much more freedom than needed to configure
1493 internal variables and get different results. It is worth to mention,
1494 that make(1) also lets you configure most of the variables that are
1495 used in the Makefile. But in the majority of situations this will not
1496 be necessary, and should only be done if the author of a package
1497 recommends it (or you know what you're doing).
1499 =head2 Using Attributes and Parameters
1501 The following attributes may be specified as arguments to WriteMakefile()
1502 or as NAME=VALUE pairs on the command line.
1508 One line description of the module. Will be included in PPD file.
1512 Name of the file that contains the package description. MakeMaker looks
1513 for a line in the POD matching /^($package\s-\s)(.*)/. This is typically
1514 the first line in the "=head1 NAME" section. $2 becomes the abstract.
1518 Array of strings containing name (and email address) of package author(s).
1519 Is used in CPAN Meta files (META.yml or META.json) and PPD
1520 (Perl Package Description) files for PPM (Perl Package Manager).
1522 =item BINARY_LOCATION
1524 Used when creating PPD files for binary packages. It can be set to a
1525 full or relative path or URL to the binary archive for a particular
1526 architecture. For example:
1528 perl Makefile.PL BINARY_LOCATION=x86/Agent.tar.gz
1530 builds a PPD package that references a binary of the C<Agent> package,
1531 located in the C<x86> directory relative to the PPD itself.
1533 =item BUILD_REQUIRES
1535 A hash of modules that are needed to build your module but not run it.
1537 This will go into the C<build_requires> field of your CPAN Meta file.
1538 (F<META.yml> or F<META.json>).
1540 The format is the same as PREREQ_PM.
1544 Ref to array of *.c file names. Initialised from a directory scan
1545 and the values portion of the XS attribute hash. This is not
1546 currently used by MakeMaker but may be handy in Makefile.PLs.
1550 String that will be included in the compiler call command line between
1551 the arguments INC and OPTIMIZE.
1555 Arrayref. E.g. [qw(archname manext)] defines ARCHNAME & MANEXT from
1556 config.sh. MakeMaker will add to CONFIG the following values anyway:
1576 CODE reference. The subroutine should return a hash reference. The
1577 hash may contain further attributes, e.g. {LIBS =E<gt> ...}, that have to
1578 be determined by some evaluation method.
1580 =item CONFIGURE_REQUIRES
1582 A hash of modules that are required to run Makefile.PL itself, but not
1583 to run your distribution.
1585 This will go into the C<configure_requires> field of your CPAN Meta file
1586 (F<META.yml> or F<META.json>)
1588 Defaults to C<<< { "ExtUtils::MakeMaker" => 0 } >>>
1590 The format is the same as PREREQ_PM.
1594 Something like C<"-DHAVE_UNISTD_H">
1598 This is the root directory into which the code will be installed. It
1599 I<prepends itself to the normal prefix>. For example, if your code
1600 would normally go into F</usr/local/lib/perl> you could set DESTDIR=~/tmp/
1601 and installation would go into F<~/tmp/usr/local/lib/perl>.
1603 This is primarily of use for people who repackage Perl modules.
1605 NOTE: Due to the nature of make, it is important that you put the trailing
1606 slash on your DESTDIR. F<~/tmp/> not F<~/tmp>.
1610 Ref to array of subdirectories containing Makefile.PLs e.g. ['sdbm']
1615 A safe filename for the package.
1617 Defaults to NAME above but with :: replaced with -.
1619 For example, Foo::Bar becomes Foo-Bar.
1623 Your name for distributing the package with the version number
1624 included. This is used by 'make dist' to name the resulting archive
1627 Defaults to DISTNAME-VERSION.
1629 For example, version 1.04 of Foo::Bar becomes Foo-Bar-1.04.
1631 On some OS's where . has special meaning VERSION_SYM may be used in
1636 Hashref of symbol names for routines to be made available as universal
1637 symbols. Each key/value pair consists of the package name and an
1638 array of routine names in that package. Used only under AIX, OS/2,
1639 VMS and Win32 at present. The routine names supplied will be expanded
1640 in the same way as XSUB names are expanded by the XS() macro.
1643 {"$(NAME)" => ["boot_$(NAME)" ] }
1647 {"RPC" => [qw( boot_rpcb rpcb_gettime getnetconfigent )],
1648 "NetconfigPtr" => [ 'DESTROY'] }
1650 Please see the L<ExtUtils::Mksymlists> documentation for more information
1651 about the DL_FUNCS, DL_VARS and FUNCLIST attributes.
1655 Array of symbol names for variables to be made available as universal symbols.
1656 Used only under AIX, OS/2, VMS and Win32 at present. Defaults to [].
1657 (e.g. [ qw(Foo_version Foo_numstreams Foo_tree ) ])
1661 Array of extension names to exclude when doing a static build. This
1662 is ignored if INCLUDE_EXT is present. Consult INCLUDE_EXT for more
1663 details. (e.g. [ qw( Socket POSIX ) ] )
1665 This attribute may be most useful when specified as a string on the
1666 command line: perl Makefile.PL EXCLUDE_EXT='Socket Safe'
1670 Ref to array of executable files. The files will be copied to the
1671 INST_SCRIPT directory. Make realclean will delete them from there
1674 If your executables start with something like #!perl or
1675 #!/usr/bin/perl MakeMaker will change this to the path of the perl
1676 'Makefile.PL' was invoked with so the programs will be sure to run
1677 properly even if perl is not in /usr/bin/perl.
1679 =item FIRST_MAKEFILE
1681 The name of the Makefile to be produced. This is used for the second
1682 Makefile that will be produced for the MAP_TARGET.
1684 Defaults to 'Makefile' or 'Descrip.MMS' on VMS.
1686 (Note: we couldn't use MAKEFILE because dmake uses this for something
1691 Perl binary able to run this extension, load XS modules, etc...
1695 Like PERLRUN, except it uses FULLPERL.
1697 =item FULLPERLRUNINST
1699 Like PERLRUNINST, except it uses FULLPERL.
1703 This provides an alternate means to specify function names to be
1704 exported from the extension. Its value is a reference to an
1705 array of function names to be exported by the extension. These
1706 names are passed through unaltered to the linker options file.
1710 Ref to array of *.h file names. Similar to C.
1714 This attribute is used to specify names to be imported into the
1715 extension. Takes a hash ref.
1717 It is only used on OS/2 and Win32.
1721 Include file dirs eg: C<"-I/usr/5include -I/path/to/inc">
1725 Array of extension names to be included when doing a static build.
1726 MakeMaker will normally build with all of the installed extensions when
1727 doing a static build, and that is usually the desired behavior. If
1728 INCLUDE_EXT is present then MakeMaker will build only with those extensions
1729 which are explicitly mentioned. (e.g. [ qw( Socket POSIX ) ])
1731 It is not necessary to mention DynaLoader or the current extension when
1732 filling in INCLUDE_EXT. If the INCLUDE_EXT is mentioned but is empty then
1733 only DynaLoader and the current extension will be included in the build.
1735 This attribute may be most useful when specified as a string on the
1736 command line: perl Makefile.PL INCLUDE_EXT='POSIX Socket Devel::Peek'
1738 =item INSTALLARCHLIB
1740 Used by 'make install', which copies files from INST_ARCHLIB to this
1741 directory if INSTALLDIRS is set to perl.
1745 Directory to install binary files (e.g. tkperl) into if
1750 Determines which of the sets of installation directories to choose:
1751 perl, site or vendor. Defaults to site.
1753 =item INSTALLMAN1DIR
1755 =item INSTALLMAN3DIR
1757 These directories get the man pages at 'make install' time if
1758 INSTALLDIRS=perl. Defaults to $Config{installman*dir}.
1760 If set to 'none', no man pages will be installed.
1762 =item INSTALLPRIVLIB
1764 Used by 'make install', which copies files from INST_LIB to this
1765 directory if INSTALLDIRS is set to perl.
1767 Defaults to $Config{installprivlib}.
1771 Used by 'make install' which copies files from INST_SCRIPT to this
1772 directory if INSTALLDIRS=perl.
1774 =item INSTALLSITEARCH
1776 Used by 'make install', which copies files from INST_ARCHLIB to this
1777 directory if INSTALLDIRS is set to site (default).
1779 =item INSTALLSITEBIN
1781 Used by 'make install', which copies files from INST_BIN to this
1782 directory if INSTALLDIRS is set to site (default).
1784 =item INSTALLSITELIB
1786 Used by 'make install', which copies files from INST_LIB to this
1787 directory if INSTALLDIRS is set to site (default).
1789 =item INSTALLSITEMAN1DIR
1791 =item INSTALLSITEMAN3DIR
1793 These directories get the man pages at 'make install' time if
1794 INSTALLDIRS=site (default). Defaults to
1795 $(SITEPREFIX)/man/man$(MAN*EXT).
1797 If set to 'none', no man pages will be installed.
1799 =item INSTALLSITESCRIPT
1801 Used by 'make install' which copies files from INST_SCRIPT to this
1802 directory if INSTALLDIRS is set to site (default).
1804 =item INSTALLVENDORARCH
1806 Used by 'make install', which copies files from INST_ARCHLIB to this
1807 directory if INSTALLDIRS is set to vendor.
1809 =item INSTALLVENDORBIN
1811 Used by 'make install', which copies files from INST_BIN to this
1812 directory if INSTALLDIRS is set to vendor.
1814 =item INSTALLVENDORLIB
1816 Used by 'make install', which copies files from INST_LIB to this
1817 directory if INSTALLDIRS is set to vendor.
1819 =item INSTALLVENDORMAN1DIR
1821 =item INSTALLVENDORMAN3DIR
1823 These directories get the man pages at 'make install' time if
1824 INSTALLDIRS=vendor. Defaults to $(VENDORPREFIX)/man/man$(MAN*EXT).
1826 If set to 'none', no man pages will be installed.
1828 =item INSTALLVENDORSCRIPT
1830 Used by 'make install' which copies files from INST_SCRIPT to this
1831 directory if INSTALLDIRS is set to vendor.
1835 Same as INST_LIB for architecture dependent files.
1839 Directory to put real binary files during 'make'. These will be copied
1840 to INSTALLBIN during 'make install'
1844 Directory where we put library files of this extension while building
1849 Directory to hold the man pages at 'make' time
1853 Directory to hold the man pages at 'make' time
1857 Directory, where executable files should be installed during
1858 'make'. Defaults to "./blib/script", just to have a dummy location during
1859 testing. make install will copy the files in INST_SCRIPT to
1864 Program to be used to link libraries for dynamic loading.
1866 Defaults to $Config{ld}.
1870 Any special flags that might need to be passed to ld to create a
1871 shared library suitable for dynamic loading. It is up to the makefile
1872 to use it. (See L<Config/lddlflags>)
1874 Defaults to $Config{lddlflags}.
1878 Defaults to "$(OBJECT)" and is used in the ld command to specify
1879 what files to link/load from (also see dynamic_lib below for how to
1884 LIB should only be set at C<perl Makefile.PL> time but is allowed as a
1885 MakeMaker argument. It has the effect of setting both INSTALLPRIVLIB
1886 and INSTALLSITELIB to that value regardless any explicit setting of
1887 those arguments (or of PREFIX). INSTALLARCHLIB and INSTALLSITEARCH
1888 are set to the corresponding architecture subdirectory.
1892 The filename of the perllibrary that will be used together with this
1893 extension. Defaults to libperl.a.
1897 An anonymous array of alternative library
1898 specifications to be searched for (in order) until
1899 at least one library is found. E.g.
1901 'LIBS' => ["-lgdbm", "-ldbm -lfoo", "-L/path -ldbm.nfs"]
1903 Mind, that any element of the array
1904 contains a complete set of arguments for the ld
1905 command. So do not specify
1907 'LIBS' => ["-ltcl", "-ltk", "-lX11"]
1909 See ODBM_File/Makefile.PL for an example, where an array is needed. If
1910 you specify a scalar as in
1912 'LIBS' => "-ltcl -ltk -lX11"
1914 MakeMaker will turn it into an array with one element.
1918 The licensing terms of your distribution. Generally its "perl" for the
1919 same license as Perl itself.
1921 See L<Module::Build::API> for the list of options.
1923 Defaults to "unknown".
1927 'static' or 'dynamic' (default unless usedl=undef in
1928 config.sh). Should only be used to force static linking (also see
1933 Variant of make you intend to run the generated Makefile with. This
1934 parameter lets Makefile.PL know what make quirks to account for when
1935 generating the Makefile.
1937 MakeMaker also honors the MAKE environment variable. This parameter
1940 Currently the only significant values are 'dmake' and 'nmake' for Windows
1943 Defaults to $Config{make}.
1947 Boolean which tells MakeMaker, that it should include the rules to
1948 make a perl. This is handled automatically as a switch by
1949 MakeMaker. The user normally does not need it.
1953 When 'make clean' or similar is run, the $(FIRST_MAKEFILE) will be
1954 backed up at this location.
1956 Defaults to $(FIRST_MAKEFILE).old or $(FIRST_MAKEFILE)_old on VMS.
1960 Hashref of pod-containing files. MakeMaker will default this to all
1961 EXE_FILES files that include POD directives. The files listed
1962 here will be converted to man pages and installed as was requested
1965 This hash should map POD files (or scripts containing POD) to the
1966 man file names under the C<blib/man1/> directory, as in the following
1970 'doc/command.pod' => 'blib/man1/command.1',
1971 'scripts/script.pl' => 'blib/man1/script.1',
1976 Hashref that assigns to *.pm and *.pod files the files into which the
1977 manpages are to be written. MakeMaker parses all *.pod and *.pm files
1978 for POD directives. Files that contain POD will be the default keys of
1979 the MAN3PODS hashref. These will then be converted to man pages during
1980 C<make> and will be installed during C<make install>.
1982 Example similar to MAN1PODS.
1986 If it is intended, that a new perl binary be produced, this variable
1987 may hold a name for that binary. Defaults to perl
1993 A hashrefs of items to add to the CPAN Meta file (F<META.yml> or
1996 They differ in how they behave if they have the same key as the
1997 default metadata. META_ADD will override the default value with its
1998 own. META_MERGE will merge its value with the default.
2000 Unless you want to override the defaults, prefer META_MERGE so as to
2001 get the advantage of any future defaults.
2003 =item MIN_PERL_VERSION
2005 The minimum required version of Perl for this distribution.
2007 Either 5.006001 or 5.6.1 format is acceptable.
2011 If the extension links to a library that it builds set this to the
2012 name of the library (see SDBM_File)
2016 Perl module name for this extension (DBD::Oracle). This will default
2017 to the directory name but should be explicitly defined in the
2022 MakeMaker will figure out if an extension contains linkable code
2023 anywhere down the directory tree, and will set this variable
2024 accordingly, but you can speed it up a very little bit if you define
2025 this boolean variable yourself.
2029 Command so make does not print the literal commands its running.
2031 By setting it to an empty string you can generate a Makefile that
2032 prints all commands. Mainly used in debugging MakeMaker itself.
2038 Boolean. Attribute to inhibit descending into subdirectories.
2042 When true, suppresses the generation and addition to the MANIFEST of
2043 the META.yml and META.json module meta-data files during 'make distdir'.
2049 When true, suppresses the generation of MYMETA.yml and MYMETA.json module
2050 meta-data files during 'perl Makefile.PL'.
2056 In general, any generated Makefile checks for the current version of
2057 MakeMaker and the version the Makefile was built under. If NO_VC is
2058 set, the version check is neglected. Do not write this into your
2059 Makefile.PL, use it interactively instead.
2063 List of object files, defaults to '$(BASEEXT)$(OBJ_EXT)', but can be a long
2064 string containing all object files, e.g. "tkpBind.o
2065 tkpButton.o tkpCanvas.o"
2067 (Where BASEEXT is the last component of NAME, and OBJ_EXT is $Config{obj_ext}.)
2071 Defaults to C<-O>. Set it to C<-g> to turn debugging on. The flag is
2072 passed to subdirectory makes.
2076 Perl binary for tasks that can be done by miniperl
2080 Set only when MakeMaker is building the extensions of the Perl core
2085 The call to the program that is able to compile perlmain.c. Defaults
2090 Same as for PERL_LIB, but for architecture dependent files.
2092 Used only when MakeMaker is building the extensions of the Perl core
2093 distribution (because normally $(PERL_ARCHLIB) is automatically in @INC,
2094 and adding it would get in the way of PERL5LIB).
2098 Directory containing the Perl library to use.
2100 Used only when MakeMaker is building the extensions of the Perl core
2101 distribution (because normally $(PERL_LIB) is automatically in @INC,
2102 and adding it would get in the way of PERL5LIB).
2104 =item PERL_MALLOC_OK
2106 defaults to 0. Should be set to TRUE if the extension can work with
2107 the memory allocation routines substituted by the Perl malloc() subsystem.
2108 This should be applicable to most extensions with exceptions of those
2114 with bugs in memory allocations which are caught by Perl's malloc();
2118 which interact with the memory allocator in other ways than via
2119 malloc(), realloc(), free(), calloc(), sbrk() and brk();
2123 which rely on special alignment which is not provided by Perl's malloc().
2127 B<NOTE.> Negligence to set this flag in I<any one> of loaded extension
2128 nullifies many advantages of Perl's malloc(), such as better usage of
2129 system resources, error detection, memory usage reporting, catchable failure
2130 of memory allocations, etc.
2134 Directory under which core modules are to be installed.
2136 Defaults to $Config{installprefixexp} falling back to
2137 $Config{installprefix}, $Config{prefixexp} or $Config{prefix} should
2138 $Config{installprefixexp} not exist.
2140 Overridden by PREFIX.
2144 Use this instead of $(PERL) when you wish to run perl. It will set up
2145 extra necessary flags for you.
2149 Use this instead of $(PERL) when you wish to run perl to work with
2150 modules. It will add things like -I$(INST_ARCH) and other necessary
2151 flags so perl can see the modules you're about to install.
2155 Directory containing the Perl source code (use of this should be
2156 avoided, it may be undefined)
2160 Desired permission for directories. Defaults to C<755>.
2164 Desired permission for read/writable files. Defaults to C<644>.
2168 Desired permission for executable files. Defaults to C<755>.
2172 MakeMaker can run programs to generate files for you at build time.
2173 By default any file named *.PL (except Makefile.PL and Build.PL) in
2174 the top level directory will be assumed to be a Perl program and run
2175 passing its own basename in as an argument. For example...
2179 This behavior can be overridden by supplying your own set of files to
2180 search. PL_FILES accepts a hash ref, the key being the file to run
2181 and the value is passed in as the first argument when the PL file is run.
2183 PL_FILES => {'bin/foobar.PL' => 'bin/foobar'}
2185 Would run bin/foobar.PL like this:
2187 perl bin/foobar.PL bin/foobar
2189 If multiple files from one program are desired an array ref can be used.
2191 PL_FILES => {'bin/foobar.PL' => [qw(bin/foobar1 bin/foobar2)]}
2193 In this case the program will be run multiple times using each target file.
2195 perl bin/foobar.PL bin/foobar1
2196 perl bin/foobar.PL bin/foobar2
2198 PL files are normally run B<after> pm_to_blib and include INST_LIB and
2199 INST_ARCH in its C<@INC> so the just built modules can be
2200 accessed... unless the PL file is making a module (or anything else in
2201 PM) in which case it is run B<before> pm_to_blib and does not include
2202 INST_LIB and INST_ARCH in its C<@INC>. This apparently odd behavior
2203 is there for backwards compatibility (and its somewhat DWIM).
2208 Hashref of .pm files and *.pl files to be installed. e.g.
2210 {'name_of_file.pm' => '$(INST_LIBDIR)/install_as.pm'}
2212 By default this will include *.pm and *.pl and the files found in
2213 the PMLIBDIRS directories. Defining PM in the
2214 Makefile.PL will override PMLIBDIRS.
2218 Ref to array of subdirectories containing library files. Defaults to
2219 [ 'lib', $(BASEEXT) ]. The directories will be scanned and I<any> files
2220 they contain will be installed in the corresponding location in the
2221 library. A libscan() method can be used to alter the behaviour.
2222 Defining PM in the Makefile.PL will override PMLIBDIRS.
2224 (Where BASEEXT is the last component of NAME.)
2228 A filter program, in the traditional Unix sense (input from stdin, output
2229 to stdout) that is passed on each .pm file during the build (in the
2230 pm_to_blib() phase). It is empty by default, meaning no filtering is done.
2232 Great care is necessary when defining the command if quoting needs to be
2233 done. For instance, you would need to say:
2235 {'PM_FILTER' => 'grep -v \\"^\\#\\"'}
2237 to remove all the leading comments on the fly during the build. The
2238 extra \\ are necessary, unfortunately, because this variable is interpolated
2239 within the context of a Perl program built on the command line, and double
2240 quotes are what is used with the -e switch to build that command line. The
2241 # is escaped for the Makefile, since what is going to be generated will then
2244 PM_FILTER = grep -v \"^\#\"
2246 Without the \\ before the #, we'd have the start of a Makefile comment,
2247 and the macro would be incorrectly defined.
2251 Release 5.005 grandfathered old global symbol names by providing preprocessor
2252 macros for extension source compatibility. As of release 5.6, these
2253 preprocessor definitions are not available by default. The POLLUTE flag
2254 specifies that the old names should still be defined:
2256 perl Makefile.PL POLLUTE=1
2258 Please inform the module author if this is necessary to successfully install
2259 a module under 5.6 or later.
2261 =item PPM_INSTALL_EXEC
2263 Name of the executable used to run C<PPM_INSTALL_SCRIPT> below. (e.g. perl)
2265 =item PPM_INSTALL_SCRIPT
2267 Name of the script that gets executed by the Perl Package Manager after
2268 the installation of a package.
2272 This overrides all the default install locations. Man pages,
2273 libraries, scripts, etc... MakeMaker will try to make an educated
2274 guess about where to place things under the new PREFIX based on your
2275 Config defaults. Failing that, it will fall back to a structure
2276 which should be sensible for your platform.
2278 If you specify LIB or any INSTALL* variables they will not be effected
2283 Bool. If this parameter is true, failing to have the required modules
2284 (or the right versions thereof) will be fatal. C<perl Makefile.PL>
2285 will C<die> instead of simply informing the user of the missing dependencies.
2287 It is I<extremely> rare to have to use C<PREREQ_FATAL>. Its use by module
2288 authors is I<strongly discouraged> and should never be used lightly.
2290 Module installation tools have ways of resolving umet dependencies but
2291 to do that they need a F<Makefile>. Using C<PREREQ_FATAL> breaks this.
2294 Assuming you have good test coverage, your tests should fail with
2295 missing dependencies informing the user more strongly that something
2296 is wrong. You can write a F<t/00compile.t> test which will simply
2297 check that your code compiles and stop "make test" prematurely if it
2298 doesn't. See L<Test::More/BAIL_OUT> for more details.
2303 A hash of modules that are needed to run your module. The keys are
2304 the module names ie. Test::More, and the minimum version is the
2305 value. If the required version number is 0 any version will do.
2307 This will go into the C<requires> field of your CPAN Meta file
2308 (F<META.yml> or F<META.json>).
2311 # Require Test::More at least 0.47
2312 "Test::More" => "0.47",
2314 # Require any version of Acme::Buffy
2320 Bool. If this parameter is true, the prerequisites will be printed to
2321 stdout and MakeMaker will exit. The output format is an evalable hash
2330 If a distribution defines a minimal required perl version, this is
2331 added to the output as an additional line of the form:
2333 $MIN_PERL_VERSION = '5.008001';
2335 If BUILD_REQUIRES is not empty, it will be dumped as $BUILD_REQUIRES hasref.
2339 RedHatism for C<PREREQ_PRINT>. The output format is different, though:
2341 perl(A::B)>=Vers1 perl(C::D)>=Vers2 ...
2343 A minimal required perl version, if present, will look like this:
2345 perl(perl)>=5.008001
2349 Like PERLPREFIX, but only for the site install locations.
2351 Defaults to $Config{siteprefixexp}. Perls prior to 5.6.0 didn't have
2352 an explicit siteprefix in the Config. In those cases
2353 $Config{installprefix} will be used.
2355 Overridable by PREFIX
2359 When true, perform the generation and addition to the MANIFEST of the
2360 SIGNATURE file in the distdir during 'make distdir', via 'cpansign
2363 Note that you need to install the Module::Signature module to
2364 perform this operation.
2370 Arrayref. E.g. [qw(name1 name2)] skip (do not write) sections of the
2371 Makefile. Caution! Do not use the SKIP attribute for the negligible
2372 speedup. It may seriously damage the resulting Makefile. Only use it
2373 if you really need it.
2377 Ref to array of typemap file names. Use this when the typemaps are
2378 in some directory other than the current directory or when they are
2379 not named B<typemap>. The last typemap in the list takes
2380 precedence. A typemap in the current directory has highest
2381 precedence, even if it isn't listed in TYPEMAPS. The default system
2382 typemap has lowest precedence.
2386 Like PERLPREFIX, but only for the vendor install locations.
2388 Defaults to $Config{vendorprefixexp}.
2390 Overridable by PREFIX
2394 If true, make install will be verbose
2398 Your version number for distributing the package. This defaults to
2403 Instead of specifying the VERSION in the Makefile.PL you can let
2404 MakeMaker parse a file to determine the version number. The parsing
2405 routine requires that the file named by VERSION_FROM contains one
2406 single line to compute the version number. The first line in the file
2407 that contains something like a $VERSION assignment or C<package Name
2408 VERSION> will be used. The following lines will be parsed o.k.:
2411 package Foo::Bar 1.23; # 1.23
2412 $VERSION = '1.00'; # 1.00
2413 *VERSION = \'1.01'; # 1.01
2414 ($VERSION) = q$Revision$ =~ /(\d+)/g; # The digits in $Revision$
2415 $FOO::VERSION = '1.10'; # 1.10
2416 *FOO::VERSION = \'1.11'; # 1.11
2418 but these will fail:
2421 my $VERSION = '1.01';
2422 local $VERSION = '1.02';
2423 local $FOO::VERSION = '1.30';
2425 "Version strings" are incompatible should not be used.
2431 L<version> objects are fine. As of MakeMaker 6.35 version.pm will be
2432 automatically loaded, but you must declare the dependency on version.pm.
2433 For compatibility with older MakeMaker you should load on the same line
2434 as $VERSION is declared.
2437 use version; our $VERSION = qv(1.2.3);
2439 (Putting C<my> or C<local> on the preceding line will work o.k.)
2441 The file named in VERSION_FROM is not added as a dependency to
2442 Makefile. This is not really correct, but it would be a major pain
2443 during development to have to rewrite the Makefile for any smallish
2444 change in that file. If you want to make sure that the Makefile
2445 contains the correct VERSION macro after any change of the file, you
2446 would have to do something like
2448 depend => { Makefile => '$(VERSION_FROM)' }
2450 See attribute C<depend> below.
2454 A sanitized VERSION with . replaced by _. For places where . has
2455 special meaning (some filesystems, RCS labels, etc...)
2459 Hashref of .xs files. MakeMaker will default this. e.g.
2461 {'name_of_file.xs' => 'name_of_file.c'}
2463 The .c files will automatically be included in the list of files
2464 deleted by a make clean.
2468 String of options to pass to xsubpp. This might include C<-C++> or
2469 C<-extern>. Do not include typemaps here; the TYPEMAP parameter exists for
2474 May be set to an empty string, which is identical to C<-prototypes>, or
2475 C<-noprototypes>. See the xsubpp documentation for details. MakeMaker
2476 defaults to the empty string.
2480 Your version number for the .xs file of this package. This defaults
2481 to the value of the VERSION attribute.
2485 =head2 Additional lowercase attributes
2487 can be used to pass parameters to the methods which implement that
2488 part of the Makefile. Parameters are specified as a hash ref but are
2489 passed to the method as a hash.
2495 {FILES => "*.xyz foo"}
2499 {ANY_TARGET => ANY_DEPENDENCY, ...}
2501 (ANY_TARGET must not be given a double-colon rule by MakeMaker.)
2505 {TARFLAGS => 'cvfF', COMPRESS => 'gzip', SUFFIX => '.gz',
2506 SHAR => 'shar -m', DIST_CP => 'ln', ZIP => '/bin/zip',
2507 ZIPFLAGS => '-rl', DIST_DEFAULT => 'private tardist' }
2509 If you specify COMPRESS, then SUFFIX should also be altered, as it is
2510 needed to tell make the target file of the compression. Setting
2511 DIST_CP to ln can be useful, if you need to preserve the timestamps on
2512 your files. DIST_CP can take the values 'cp', which copies the file,
2513 'ln', which links the file, and 'best' which copies symbolic links and
2514 links the rest. Default is 'best'.
2518 {ARMAYBE => 'ar', OTHERLDFLAGS => '...', INST_DYNAMIC_DEP => '...'}
2522 {LINKTYPE => 'static', 'dynamic' or ''}
2524 NB: Extensions that have nothing but *.pm files had to say
2528 with Pre-5.0 MakeMakers. Since version 5.00 of MakeMaker such a line
2529 can be deleted safely. MakeMaker recognizes when there's nothing to
2534 {ANY_MACRO => ANY_VALUE, ...}
2538 Anything put here will be passed to MY::postamble() if you have one.
2542 {FILES => '$(INST_ARCHAUTODIR)/*.xyz'}
2548 =item tool_autosplit
2554 =head2 Overriding MakeMaker Methods
2556 If you cannot achieve the desired Makefile behaviour by specifying
2557 attributes you may define private subroutines in the Makefile.PL.
2558 Each subroutine returns the text it wishes to have written to
2559 the Makefile. To override a section of the Makefile you can
2562 sub MY::c_o { "new literal text" }
2564 or you can edit the default by saying something like:
2566 package MY; # so that "SUPER" works right
2568 my $inherited = shift->SUPER::c_o(@_);
2569 $inherited =~ s/old text/new text/;
2573 If you are running experiments with embedding perl as a library into
2574 other applications, you might find MakeMaker is not sufficient. You'd
2575 better have a look at ExtUtils::Embed which is a collection of utilities
2578 If you still need a different solution, try to develop another
2579 subroutine that fits your needs and submit the diffs to
2580 C<makemaker@perl.org>
2582 For a complete description of all MakeMaker methods see
2583 L<ExtUtils::MM_Unix>.
2585 Here is a simple example of how to add a new target to the generated
2589 return <<'MAKE_FRAG';
2590 $(MYEXTLIB): sdbm/Makefile
2591 cd sdbm && $(MAKE) all
2596 =head2 The End Of Cargo Cult Programming
2598 WriteMakefile() now does some basic sanity checks on its parameters to
2599 protect against typos and malformatted values. This means some things
2600 which happened to work in the past will now throw warnings and
2601 possibly produce internal errors.
2603 Some of the most common mistakes:
2607 =item C<< MAN3PODS => ' ' >>
2609 This is commonly used to suppress the creation of man pages. MAN3PODS
2610 takes a hash ref not a string, but the above worked by accident in old
2611 versions of MakeMaker.
2613 The correct code is C<< MAN3PODS => { } >>.
2618 =head2 Hintsfile support
2620 MakeMaker.pm uses the architecture specific information from
2621 Config.pm. In addition it evaluates architecture specific hints files
2622 in a C<hints/> directory. The hints files are expected to be named
2623 like their counterparts in C<PERL_SRC/hints>, but with an C<.pl> file
2624 name extension (eg. C<next_3_2.pl>). They are simply C<eval>ed by
2625 MakeMaker within the WriteMakefile() subroutine, and can be used to
2626 execute commands as well as to include special variables. The rules
2627 which hintsfile is chosen are the same as in Configure.
2629 The hintsfile is eval()ed immediately after the arguments given to
2630 WriteMakefile are stuffed into a hash reference $self but before this
2631 reference becomes blessed. So if you want to do the equivalent to
2632 override or create an attribute you would say something like
2634 $self->{LIBS} = ['-ldbm -lucb -lc'];
2636 =head2 Distribution Support
2638 For authors of extensions MakeMaker provides several Makefile
2639 targets. Most of the support comes from the ExtUtils::Manifest module,
2640 where additional documentation can be found.
2644 =item make distcheck
2646 reports which files are below the build directory but not in the
2647 MANIFEST file and vice versa. (See ExtUtils::Manifest::fullcheck() for
2650 =item make skipcheck
2652 reports which files are skipped due to the entries in the
2653 C<MANIFEST.SKIP> file (See ExtUtils::Manifest::skipcheck() for
2656 =item make distclean
2658 does a realclean first and then the distcheck. Note that this is not
2659 needed to build a new distribution as long as you are sure that the
2660 MANIFEST file is ok.
2664 rewrites the MANIFEST file, adding all remaining files found (See
2665 ExtUtils::Manifest::mkmanifest() for details)
2669 Copies all the files that are in the MANIFEST file to a newly created
2670 directory with the name C<$(DISTNAME)-$(VERSION)>. If that directory
2671 exists, it will be removed first.
2673 Additionally, it will create META.yml and META.json module meta-data file
2674 in the distdir and add this to the distdir's MANIFEST. You can shut this
2675 behavior off with the NO_META flag.
2679 Makes a distdir first, and runs a C<perl Makefile.PL>, a make, and
2680 a make test in that directory.
2684 First does a distdir. Then a command $(PREOP) which defaults to a null
2685 command, followed by $(TO_UNIX), which defaults to a null command under
2686 UNIX, and will convert files in distribution directory to UNIX format
2687 otherwise. Next it runs C<tar> on that directory into a tarfile and
2688 deletes the directory. Finishes with a command $(POSTOP) which
2689 defaults to a null command.
2693 Defaults to $(DIST_DEFAULT) which in turn defaults to tardist.
2695 =item make uutardist
2697 Runs a tardist first and uuencodes the tarfile.
2701 First does a distdir. Then a command $(PREOP) which defaults to a null
2702 command. Next it runs C<shar> on that directory into a sharfile and
2703 deletes the intermediate directory again. Finishes with a command
2704 $(POSTOP) which defaults to a null command. Note: For shdist to work
2705 properly a C<shar> program that can handle directories is mandatory.
2709 First does a distdir. Then a command $(PREOP) which defaults to a null
2710 command. Runs C<$(ZIP) $(ZIPFLAGS)> on that directory into a
2711 zipfile. Then deletes that directory. Finishes with a command
2712 $(POSTOP) which defaults to a null command.
2716 Does a $(CI) and a $(RCS_LABEL) on all files in the MANIFEST file.
2720 Customization of the dist targets can be done by specifying a hash
2721 reference to the dist attribute of the WriteMakefile call. The
2722 following parameters are recognized:
2725 COMPRESS ('gzip --best')
2728 TO_UNIX (depends on the system)
2729 RCS_LABEL ('rcs -q -Nv$(VERSION_SYM):')
2742 COMPRESS => "bzip2",
2748 =head2 Module Meta-Data (META and MYMETA)
2750 Long plaguing users of MakeMaker based modules has been the problem of
2751 getting basic information about the module out of the sources
2752 I<without> running the F<Makefile.PL> and doing a bunch of messy
2753 heuristics on the resulting F<Makefile>. Over the years, it has become
2754 standard to keep this information in one or more CPAN Meta files
2755 distributed with each distribution.
2757 The original format of CPAN Meta files was L<YAML> and the corresponding
2758 file was called F<META.yml>. In 2010, version 2 of the L<CPAN::Meta::Spec>
2759 was released, which mandates JSON format for the metadata in order to
2760 overcome certain compatibility issues between YAML serializers and to
2761 avoid breaking older clients unable to handle a new version of the spec.
2762 The L<CPAN::Meta> library is now standard for accessing old and new-style
2765 If L<CPAN::Meta> is installed, MakeMaker will automatically generate
2766 F<META.json> and F<META.yml> files for you and add them to your F<MANIFEST> as
2767 part of the 'distdir' target (and thus the 'dist' target). This is intended to
2768 seamlessly and rapidly populate CPAN with module meta-data. If you wish to
2769 shut this feature off, set the C<NO_META> C<WriteMakefile()> flag to true.
2771 At the 2008 QA Hackathon in Oslo, Perl module toolchain maintainers agrees
2772 to use the CPAN Meta format to communicate post-configuration requirements
2773 between toolchain components. These files, F<MYMETA.json> and F<MYMETA.yml>,
2774 are generated when F<Makefile.PL> generates a F<Makefile> (if L<CPAN::Meta>
2775 is installed). Clients like L<CPAN> or L<CPANPLUS> will read this
2776 files to see what prerequisites must be fulfilled before building or testing
2777 the distribution. If you with to shut this feature off, set the C<NO_MYMETA>
2778 C<WriteMakeFile()> flag to true.
2780 =head2 Disabling an extension
2782 If some events detected in F<Makefile.PL> imply that there is no way
2783 to create the Module, but this is a normal state of things, then you
2784 can create a F<Makefile> which does nothing, but succeeds on all the
2785 "usual" build targets. To do so, use
2787 use ExtUtils::MakeMaker qw(WriteEmptyMakefile);
2788 WriteEmptyMakefile();
2790 instead of WriteMakefile().
2792 This may be useful if other modules expect this module to be I<built>
2793 OK, as opposed to I<work> OK (say, this system-dependent module builds
2794 in a subdirectory of some other distribution, or is listed as a
2795 dependency in a CPAN::Bundle, but the functionality is supported by
2796 different means on the current architecture).
2798 =head2 Other Handy Functions
2804 my $value = prompt($message);
2805 my $value = prompt($message, $default);
2807 The C<prompt()> function provides an easy way to request user input
2808 used to write a makefile. It displays the $message as a prompt for
2809 input. If a $default is provided it will be used as a default. The
2810 function returns the $value selected by the user.
2812 If C<prompt()> detects that it is not running interactively and there
2813 is nothing on STDIN or if the PERL_MM_USE_DEFAULT environment variable
2814 is set to true, the $default will be used without prompting. This
2815 prevents automated processes from blocking on user input.
2817 If no $default is provided an empty string will be used instead.
2828 Command line options used by C<MakeMaker-E<gt>new()>, and thus by
2829 C<WriteMakefile()>. The string is split on whitespace, and the result
2830 is processed before any actual command line arguments are processed.
2832 =item PERL_MM_USE_DEFAULT
2834 If set to a true value then MakeMaker's prompt function will
2835 always return the default without waiting for user input.
2839 Same as the PERL_CORE parameter. The parameter overrides this.
2845 L<Module::Build> is a pure-Perl alternative to MakeMaker which does
2846 not rely on make or any other external utility. It is easier to
2847 extend to suit your needs.
2849 L<Module::Install> is a wrapper around MakeMaker which adds features
2850 not normally available.
2852 L<ExtUtils::ModuleMaker> and L<Module::Starter> are both modules to
2853 help you setup your distribution.
2855 L<CPAN::Meta> and L<CPAN::Meta::Spec> explain CPAN Meta files in detail.
2859 Andy Dougherty C<doughera@lafayette.edu>, Andreas KE<ouml>nig
2860 C<andreas.koenig@mind.de>, Tim Bunce C<timb@cpan.org>. VMS
2861 support by Charles Bailey C<bailey@newman.upenn.edu>. OS/2 support
2862 by Ilya Zakharevich C<ilya@math.ohio-state.edu>.
2864 Currently maintained by Michael G Schwern C<schwern@pobox.com>
2866 Send patches and ideas to C<makemaker@perl.org>.
2868 Send bug reports via http://rt.cpan.org/. Please send your
2869 generated Makefile along with your report.
2871 For more up-to-date information, see L<http://www.makemaker.org>.
2873 Repository available at L<https://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker>.
2877 This program is free software; you can redistribute it and/or
2878 modify it under the same terms as Perl itself.
2880 See L<http://www.perl.com/perl/misc/Artistic.html>