📄 makemaker.pm
字号:
BEGIN {require 5.002;} # MakeMaker 5.17 was the last MakeMaker that was compatible with perl5.001mpackage ExtUtils::MakeMaker;$VERSION = "5.45";$Version_OK = "5.17"; # Makefiles older than $Version_OK will die # (Will be checked from MakeMaker version 4.13 onwards)($Revision = substr(q$Revision: 1.222 $, 10)) =~ s/\s+$//;require Exporter;use Config;use Carp ();#use FileHandle ();use vars qw( @ISA @EXPORT @EXPORT_OK $AUTOLOAD $ISA_TTY $Is_Mac $Is_OS2 $Is_VMS $Revision $VERSION $Verbose $Version_OK %Config %Keep_after_flush %MM_Sections %Prepend_dot_dot %Recognized_Att_Keys @Get_from_Config @MM_Sections @Overridable @Parent );# use strict;# &DynaLoader::mod2fname should be available to miniperl, thus # should be a pseudo-builtin (cmp. os2.c).#eval {require DynaLoader;};## Set up the inheritance before we pull in the MM_* packages, because they# import variables and functions from here#@ISA = qw(Exporter);@EXPORT = qw(&WriteMakefile &writeMakefile $Verbose &prompt);@EXPORT_OK = qw($VERSION &Version_check &neatvalue &mkbootstrap &mksymlists);## Dummy package MM inherits actual methods from OS-specific# default packages. We use this intermediate package so# MY::XYZ->func() can call MM->func() and get the proper# default routine without having to know under what OS# it's running.#@MM::ISA = qw[ExtUtils::MM_Unix ExtUtils::Liblist::Kid ExtUtils::MakeMaker];## Setup dummy package:# MY exists for overriding methods to be defined within#{ package MY; @MY::ISA = qw(MM);### sub AUTOLOAD { use Devel::Symdump; print Devel::Symdump->rnew->as_string; Carp::confess "hey why? $AUTOLOAD" } package MM; sub DESTROY {}}# "predeclare the package: we only load it via AUTOLOAD# but we have already mentioned it in @ISApackage ExtUtils::Liblist::Kid;package ExtUtils::MakeMaker;## Now we can pull in the friends#$Is_VMS = $^O eq 'VMS';$Is_OS2 = $^O eq 'os2';$Is_Mac = $^O eq 'MacOS';$Is_Win32 = $^O eq 'MSWin32';$Is_Cygwin= $^O eq 'cygwin';$Is_Msys = $^O eq 'msys';require ExtUtils::MM_Unix;if ($Is_VMS) { require ExtUtils::MM_VMS; require VMS::Filespec; # is a noop as long as we require it within MM_VMS}if ($Is_OS2) { require ExtUtils::MM_OS2;}if ($Is_Mac) { require ExtUtils::MM_MacOS;}if ($Is_Win32) { require ExtUtils::MM_Win32;}if ($Is_Cygwin) { require ExtUtils::MM_Cygwin;}if ($Is_Msys) { require ExtUtils::MM_Msys;}full_setup();# The use of the Version_check target has been dropped between perl# 5.5.63 and 5.5.64. We must keep the subroutine for a while so that# old Makefiles can satisfy the Version_check target.sub Version_check { my($checkversion) = @_; die "Your Makefile was built with ExtUtils::MakeMaker v $checkversion.Current Version is $ExtUtils::MakeMaker::VERSION. There have been considerablechanges in the meantime.Please rerun 'perl Makefile.PL' to regenerate the Makefile.\n" if $checkversion < $Version_OK; printf STDOUT "%s %s %s %s.\n", "Makefile built with ExtUtils::MakeMaker v", $checkversion, "Current Version is", $VERSION unless $checkversion == $VERSION;}sub warnhandler { $_[0] =~ /^Use of uninitialized value/ && return; $_[0] =~ /used only once/ && return; $_[0] =~ /^Subroutine\s+[\w:]+\s+redefined/ && return; warn @_;}sub WriteMakefile { Carp::croak "WriteMakefile: Need even number of args" if @_ % 2; local $SIG{__WARN__} = \&warnhandler; my %att = @_; MM->new(\%att)->flush;}sub prompt ($;$) { my($mess,$def)=@_; $ISA_TTY = -t STDIN && (-t STDOUT || !(-f STDOUT || -c STDOUT)) ; # Pipe? Carp::confess("prompt function called without an argument") unless defined $mess; my $dispdef = defined $def ? "[$def] " : " "; $def = defined $def ? $def : ""; my $ans; local $|=1; print "$mess $dispdef"; if ($ISA_TTY) { chomp($ans = <STDIN>); } else { print "$def\n"; } return ($ans ne '') ? $ans : $def;}sub eval_in_subdirs { my($self) = @_; my($dir); use Cwd 'cwd'; my $pwd = cwd(); foreach $dir (@{$self->{DIR}}){ my($abs) = $self->catdir($pwd,$dir); $self->eval_in_x($abs); } chdir $pwd;}sub eval_in_x { my($self,$dir) = @_; package main; chdir $dir or Carp::carp("Couldn't change to directory $dir: $!");# use FileHandle ();# my $fh = new FileHandle;# $fh->open("Makefile.PL") or Carp::carp("Couldn't open Makefile.PL in $dir"); local *FH; open(FH,"Makefile.PL") or Carp::carp("Couldn't open Makefile.PL in $dir");# my $eval = join "", <$fh>; my $eval = join "", <FH>;# $fh->close; close FH; eval $eval; if ($@) {# if ($@ =~ /prerequisites/) {# die "MakeMaker WARNING: $@";# } else {# warn "WARNING from evaluation of $dir/Makefile.PL: $@";# } warn "WARNING from evaluation of $dir/Makefile.PL: $@"; }}sub full_setup { $Verbose ||= 0; # package name for the classes into which the first object will be blessed $PACKNAME = "PACK000"; @Attrib_help = qw/ AUTHOR ABSTRACT ABSTRACT_FROM BINARY_LOCATION C CAPI CCFLAGS CONFIG CONFIGURE DEFINE DIR DISTNAME DL_FUNCS DL_VARS EXCLUDE_EXT EXE_FILES FIRST_MAKEFILE FULLPERL FUNCLIST H HTMLLIBPODS HTMLSCRIPTPODS IMPORTS INC INCLUDE_EXT INSTALLARCHLIB INSTALLBIN INSTALLDIRS INSTALLHTMLPRIVLIBDIR INSTALLHTMLSCRIPTDIR INSTALLHTMLSITELIBDIR INSTALLMAN1DIR INSTALLMAN3DIR INSTALLPRIVLIB INSTALLSCRIPT INSTALLSITEARCH INSTALLSITELIB INST_ARCHLIB INST_BIN INST_EXE INST_LIB INST_HTMLLIBDIR INST_HTMLSCRIPTDIR INST_MAN1DIR INST_MAN3DIR INST_SCRIPT LDFROM LIB LIBPERL_A LIBS LINKTYPE MAKEAPERL MAKEFILE MAN1PODS MAN3PODS MAP_TARGET MYEXTLIB PERL_MALLOC_OK NAME NEEDS_LINKING NOECHO NORECURS NO_VC OBJECT OPTIMIZE PERL PERLMAINCC PERL_ARCHLIB PERL_LIB PERL_SRC PERM_RW PERM_RWX PL_FILES PM PM_FILTER PMLIBDIRS POLLUTE PPM_INSTALL_EXEC PPM_INSTALL_SCRIPT PREFIX PREREQ_PM SKIP TYPEMAPS VERSION VERSION_FROM XS XSOPT XSPROTOARG XS_VERSION clean depend dist dynamic_lib linkext macro realclean tool_autosplit MACPERL_SRC MACPERL_LIB MACLIBS_68K MACLIBS_PPC MACLIBS_SC MACLIBS_MRC MACLIBS_ALL_68K MACLIBS_ALL_PPC MACLIBS_SHARED /; # IMPORTS is used under OS/2 and Win32 # @Overridable is close to @MM_Sections but not identical. The # order is important. Many subroutines declare macros. These # depend on each other. Let's try to collect the macros up front, # then pasthru, then the rules. # MM_Sections are the sections we have to call explicitly # in Overridable we have subroutines that are used indirectly @MM_Sections = qw( post_initialize const_config constants tool_autosplit tool_xsubpp tools_other dist macro depend cflags const_loadlibs const_cccmd post_constants pasthru c_o xs_c xs_o top_targets linkext dlsyms dynamic dynamic_bs dynamic_lib static static_lib htmlifypods manifypods processPL installbin subdirs clean realclean dist_basics dist_core dist_dir dist_test dist_ci install force perldepend makefile staticmake test ppd ); # loses section ordering @Overridable = @MM_Sections; push @Overridable, qw[ dir_target libscan makeaperl needs_linking perm_rw perm_rwx subdir_x test_via_harness test_via_script ]; push @MM_Sections, qw[ pm_to_blib selfdocument ]; # Postamble needs to be the last that was always the case push @MM_Sections, "postamble"; push @Overridable, "postamble"; # All sections are valid keys. @Recognized_Att_Keys{@MM_Sections} = (1) x @MM_Sections; # we will use all these variables in the Makefile @Get_from_Config = qw( ar cc cccdlflags ccdlflags dlext dlsrc ld lddlflags ldflags libc lib_ext obj_ext osname osvers ranlib sitelibexp sitearchexp so exe_ext full_ar ); my $item; foreach $item (@Attrib_help){ $Recognized_Att_Keys{$item} = 1; } foreach $item (@Get_from_Config) { $Recognized_Att_Keys{uc $item} = $Config{$item}; print "Attribute '\U$item\E' => '$Config{$item}'\n" if ($Verbose >= 2); } # # When we eval a Makefile.PL in a subdirectory, that one will ask # us (the parent) for the values and will prepend "..", so that # all files to be installed end up below OUR ./blib # %Prepend_dot_dot = qw( INST_BIN 1 INST_EXE 1 INST_LIB 1 INST_ARCHLIB 1 INST_SCRIPT 1 MAP_TARGET 1 INST_HTMLLIBDIR 1 INST_HTMLSCRIPTDIR 1 INST_MAN1DIR 1 INST_MAN3DIR 1 PERL_SRC 1 PERL 1 FULLPERL 1 ); my @keep = qw/ NEEDS_LINKING HAS_LINK_CODE /; @Keep_after_flush{@keep} = (1) x @keep;}sub writeMakefile { die <<END;The extension you are trying to build apparently is rather old andmost probably outdated. We detect that from the fact, that asubroutine "writeMakefile" is called, and this subroutine is notsupported anymore since about October 1994.Please contact the author or look into CPAN (details about CPAN can befound in the FAQ and at http:/www.perl.com) for a more recent versionof the extension. If you're really desperate, you can try to changethe subroutine name from writeMakefile to WriteMakefile and rerun'perl Makefile.PL', but you're most probably left alone, when you doso.The MakeMaker teamEND}sub ExtUtils::MakeMaker::new { my($class,$self) = @_; my($key); print STDOUT "MakeMaker (v$VERSION)\n" if $Verbose; if (-f "MANIFEST" && ! -f "Makefile"){ check_manifest(); } $self = {} unless (defined $self); check_hints($self); my(%initial_att) = %$self; # record initial attributes my($prereq); foreach $prereq (sort keys %{$self->{PREREQ_PM}}) { my $eval = "require $prereq"; eval $eval; if ($@) { warn "Warning: prerequisite $prereq failed to load: $@"; } elsif ($prereq->VERSION < $self->{PREREQ_PM}->{$prereq} ){ warn "Warning: prerequisite $prereq $self->{PREREQ_PM}->{$prereq} not found";# Why is/was this 'delete' here? We need PREREQ_PM later to make PPDs.# } else {# delete $self->{PREREQ_PM}{$prereq}; } }# if (@unsatisfied){# unless (defined $ExtUtils::MakeMaker::useCPAN) {# print qq{MakeMaker WARNING: prerequisites not found (@unsatisfied)# Please install these modules first and rerun 'perl Makefile.PL'.\n};# if ($ExtUtils::MakeMaker::hasCPAN) {# $ExtUtils::MakeMaker::useCPAN = prompt(qq{Should I try to use the CPAN module to fetch them for you?},"yes");# } else {# print qq{Hint: You may want to install the CPAN module to autofetch the needed modules\n};# $ExtUtils::MakeMaker::useCPAN=0;# }# }# if ($ExtUtils::MakeMaker::useCPAN) {# require CPAN;# CPAN->import(@unsatisfied);# } else {# die qq{prerequisites not found (@unsatisfied)};# }# warn qq{WARNING: prerequisites not found (@unsatisfied)};# } if (defined $self->{CONFIGURE}) { if (ref $self->{CONFIGURE} eq 'CODE') { $self = { %$self, %{&{$self->{CONFIGURE}}}}; } else { Carp::croak "Attribute 'CONFIGURE' to WriteMakefile() not a code reference\n"; } } # This is for old Makefiles written pre 5.00, will go away if ( Carp::longmess("") =~ /runsubdirpl/s ){ Carp::carp("WARNING: Please rerun 'perl Makefile.PL' to regenerate your Makefiles\n"); } my $newclass = ++$PACKNAME; local @Parent = @Parent; # Protect against non-local exits {# no strict; print "Blessing Object into class [$newclass]\n" if $Verbose>=2; mv_all_methods("MY",$newclass); bless $self, $newclass; push @Parent, $self; @{"$newclass\:\:ISA"} = 'MM'; } if (defined $Parent[-2]){ $self->{PARENT} = $Parent[-2]; my $key; for $key (keys %Prepend_dot_dot) { next unless defined $self->{PARENT}{$key}; $self->{$key} = $self->{PARENT}{$key}; # PERL and FULLPERL may be command verbs instead of full # file specifications under VMS. If so, don't turn them # into a filespec. $self->{$key} = $self->catdir("..",$self->{$key}) unless $self->file_name_is_absolute($self->{$key}) || ($^O eq 'VMS' and ($key =~ /PERL$/ && $self->{$key} =~ /^[\w\-\$]+$/)); } if ($self->{PARENT}) { $self->{PARENT}->{CHILDREN}->{$newclass} = $self; foreach my $opt (qw(CAPI POLLUTE)) { if (exists $self->{PARENT}->{$opt} and not exists $self->{$opt}) { # inherit, but only if already unspecified $self->{$opt} = $self->{PARENT}->{$opt}; } } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -