⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mm_unix.pm

📁 UNIX下perl实现代码
💻 PM
📖 第 1 页 / 共 5 页
字号:
dist : $(DIST_DEFAULT)	}.$self->{NOECHO}.q{$(PERL) -le 'print "Warning: Makefile possibly out of date with $$vf" if ' \	    -e '-e ($$vf="$(VERSION_FROM)") and -M $$vf < -M "}.$self->{MAKEFILE}.q{";'tardist : $(DISTVNAME).tar$(SUFFIX)zipdist : $(DISTVNAME).zip$(DISTVNAME).tar$(SUFFIX) : distdir	$(PREOP)	$(TO_UNIX)	$(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME)	$(RM_RF) $(DISTVNAME)	$(COMPRESS) $(DISTVNAME).tar	$(POSTOP)$(DISTVNAME).zip : distdir	$(PREOP)	$(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME)	$(RM_RF) $(DISTVNAME)	$(POSTOP)uutardist : $(DISTVNAME).tar$(SUFFIX)	uuencode $(DISTVNAME).tar$(SUFFIX) \\		$(DISTVNAME).tar$(SUFFIX) > \\		$(DISTVNAME).tar$(SUFFIX)_uushdist : distdir	$(PREOP)	$(SHAR) $(DISTVNAME) > $(DISTVNAME).shar	$(RM_RF) $(DISTVNAME)	$(POSTOP)};    join "", @m;}=item dist_dir (o)Defines the scratch directory target that will hold the distributionbefore tar-ing (or shar-ing).=cutsub dist_dir {    my($self) = shift;    my @m;    push @m, q{distdir :	$(RM_RF) $(DISTVNAME)	$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Manifest=manicopy,maniread \\		-e "manicopy(maniread(),'$(DISTVNAME)', '$(DIST_CP)');"};    join "", @m;}=item dist_test (o)Defines a target that produces the distribution in thescratchdirectory, and runs 'perl Makefile.PL; make ;make test' in thatsubdirectory.=cutsub dist_test {    my($self) = shift;    my @m;    push @m, q{disttest : distdir	cd $(DISTVNAME) && $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) Makefile.PL	cd $(DISTVNAME) && $(MAKE)	cd $(DISTVNAME) && $(MAKE) test};    join "", @m;}=item dlsyms (o)Used by AIX and VMS to define DL_FUNCS and DL_VARS and write the *.expfiles.=cutsub dlsyms {    my($self,%attribs) = @_;    return '' unless ($^O eq 'aix' && $self->needs_linking() );    my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {};    my($vars)  = $attribs{DL_VARS} || $self->{DL_VARS} || [];    my($funclist)  = $attribs{FUNCLIST} || $self->{FUNCLIST} || [];    my(@m);    push(@m,"dynamic :: $self->{BASEEXT}.exp") unless $self->{SKIPHASH}{'dynamic'}; # dynamic and static are subs, so...    push(@m,"static :: $self->{BASEEXT}.exp") unless $self->{SKIPHASH}{'static'};  # we avoid a warning if we tick them    push(@m,"$self->{BASEEXT}.exp: Makefile.PL",'	$(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e \'use ExtUtils::Mksymlists; \\	Mksymlists("NAME" => "',$self->{NAME},'", "DL_FUNCS" => ',	neatvalue($funcs), ', "FUNCLIST" => ', neatvalue($funclist),	', "DL_VARS" => ', neatvalue($vars), ');\'');    join('',@m);}=item dynamic (o)Defines the dynamic target.=cutsub dynamic {# --- Dynamic Loading Sections ---    my($self) = shift;    '## $(INST_PM) has been moved to the all: target.## It remains here for awhile to allow for old usage: "make dynamic"#dynamic :: '.$self->{MAKEFILE}.' $(INST_DYNAMIC) $(INST_BOOT) $(INST_PM)dynamic :: '.$self->{MAKEFILE}.' $(INST_DYNAMIC) $(INST_BOOT)	'.$self->{NOECHO}.'$(NOOP)';}=item dynamic_bs (o)Defines targets for bootstrap files.=cutsub dynamic_bs {    my($self, %attribs) = @_;    return 'BOOTSTRAP =' unless $self->has_link_code();    return 'BOOTSTRAP = '."$self->{BASEEXT}.bs".'# As Mkbootstrap might not write a file (if none is required)# we use touch to prevent make continually trying to remake it.# The DynaLoader only reads a non-empty file.$(BOOTSTRAP): '."$self->{MAKEFILE} $self->{BOOTDEP}".' $(INST_ARCHAUTODIR)/.exists	'.$self->{NOECHO}.'echo "Running Mkbootstrap for $(NAME) ($(BSLOADLIBS))"	'.$self->{NOECHO}.'$(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" \		-MExtUtils::Mkbootstrap \		-e "Mkbootstrap(\'$(BASEEXT)\',\'$(BSLOADLIBS)\');"	'.$self->{NOECHO}.'$(TOUCH) $(BOOTSTRAP)	$(CHMOD) $(PERM_RW) $@$(INST_BOOT): $(BOOTSTRAP) $(INST_ARCHAUTODIR)/.exists	'."$self->{NOECHO}$self->{RM_RF}".' $(INST_BOOT)	-'.$self->{CP}.' $(BOOTSTRAP) $(INST_BOOT)	$(CHMOD) $(PERM_RW) $@';}=item dynamic_lib (o)Defines how to produce the *.so (or equivalent) files.=cutsub dynamic_lib {    my($self, %attribs) = @_;    return '' unless $self->needs_linking(); #might be because of a subdir    return '' unless $self->has_link_code;    my($otherldflags) = $attribs{OTHERLDFLAGS} || "";    my($inst_dynamic_dep) = $attribs{INST_DYNAMIC_DEP} || "";    my($armaybe) = $attribs{ARMAYBE} || $self->{ARMAYBE} || ":";    my($ldfrom) = '$(LDFROM)';    $armaybe = 'ar' if ($^O eq 'dec_osf' and $armaybe eq ':');    my(@m);    push(@m,'# This section creates the dynamically loadable $(INST_DYNAMIC)# from $(OBJECT) and possibly $(MYEXTLIB).ARMAYBE = '.$armaybe.'OTHERLDFLAGS = '.$otherldflags.'INST_DYNAMIC_DEP = '.$inst_dynamic_dep.'$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)/.exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(PERL_ARCHIVE_AFTER) $(INST_DYNAMIC_DEP)');    if ($armaybe ne ':'){	$ldfrom = 'tmp$(LIB_EXT)';	push(@m,'	$(ARMAYBE) cr '.$ldfrom.' $(OBJECT)'."\n");	push(@m,'	$(RANLIB) '."$ldfrom\n");    }    $ldfrom = "-all $ldfrom -none" if ($^O eq 'dec_osf');    # The IRIX linker doesn't use LD_RUN_PATH    my $ldrun = qq{-rpath "$self->{LD_RUN_PATH}"}	if ($^O eq 'irix' && $self->{LD_RUN_PATH});    # For example in AIX the shared objects/libraries from previous builds    # linger quite a while in the shared dynalinker cache even when nobody    # is using them.  This is painful if one for instance tries to restart    # a failed build because the link command will fail unnecessarily 'cos    # the shared object/library is 'busy'.    push(@m,'	$(RM_F) $@');    push(@m,'	LD_RUN_PATH="$(LD_RUN_PATH)" $(LD) '.$ldrun.' $(LDDLFLAGS) '.$ldfrom.		' $(OTHERLDFLAGS) -o $@ $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) $(PERL_ARCHIVE_AFTER) $(EXPORT_LIST)');    push @m, '	$(CHMOD) $(PERM_RWX) $@';    push @m, $self->dir_target('$(INST_ARCHAUTODIR)');    join('',@m);}=item exescanDeprecated method. Use libscan instead.=cutsub exescan {    my($self,$path) = @_;    $path;}=item extliblistCalled by init_others, and calls ext ExtUtils::Liblist. SeeL<ExtUtils::Liblist> for details.=cutsub extliblist {    my($self,$libs) = @_;    require ExtUtils::Liblist;    $self->ext($libs, $Verbose);}=item file_name_is_absoluteTakes as argument a path and returns true, if it is an absolute path.=cutsub file_name_is_absolute {    my($self,$file) = @_;    if ($Is_Dos){        $file =~ m{^([a-z]:)?[\\/]}is ;    }    else {        $file =~ m:^/:s ;    }}=item find_perlFinds the executables PERL and FULLPERL=cutsub find_perl {    my($self, $ver, $names, $dirs, $trace) = @_;    my($name, $dir);    if ($trace >= 2){	print "Looking for perl $ver by these names:@$namesin these dirs:@$dirs";    }    foreach $name (@$names){	foreach $dir (@$dirs){	    next unless defined $dir; # $self->{PERL_SRC} may be undefined	    my ($abs, $val);	    if ($self->file_name_is_absolute($name)) { # /foo/bar		$abs = $name;	    } elsif ($self->canonpath($name) eq $self->canonpath(basename($name))) { # foo		$abs = $self->catfile($dir, $name);	    } else { # foo/bar		$abs = $self->canonpath($self->catfile($self->curdir, $name));	    }	    print "Checking $abs\n" if ($trace >= 2);	    next unless $self->maybe_command($abs);	    print "Executing $abs\n" if ($trace >= 2);	    $val = `$abs -e 'require $ver; print "VER_OK\n" ' 2>&1`;	    if ($val =~ /VER_OK/) {	        print "Using PERL=$abs\n" if $trace;	        return $abs;	    } elsif ($trace >= 2) {		print "Result: `$val'\n";	    }	}    }    print STDOUT "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n";    0; # false and not empty}=back=head2 Methods to actually produce chunks of text for the MakefileThe methods here are called for each MakeMaker object in the orderspecified by @ExtUtils::MakeMaker::MM_Sections.=over 2=item fixinInserts the sharpbang or equivalent magic number to a script=cutsub fixin { # stolen from the pink Camel book, more or less    my($self,@files) = @_;    my($does_shbang) = $Config::Config{'sharpbang'} =~ /^\s*\#\!/;    my($file,$interpreter);    for $file (@files) {	local(*FIXIN);	local(*FIXOUT);	open(FIXIN, $file) or Carp::croak "Can't process '$file': $!";	local $/ = "\n";	chomp(my $line = <FIXIN>);	next unless $line =~ s/^\s*\#!\s*//;     # Not a shbang file.	# Now figure out the interpreter name.	my($cmd,$arg) = split ' ', $line, 2;	$cmd =~ s!^.*/!!;	# Now look (in reverse) for interpreter in absolute PATH (unless perl).	if ($cmd eq "perl") {            if ($Config{startperl} =~ m,^\#!.*/perl,) {                $interpreter = $Config{startperl};                $interpreter =~ s,^\#!,,;            } else {                $interpreter = $Config{perlpath};            }	} else {	    my(@absdirs) = reverse grep {$self->file_name_is_absolute} $self->path;	    $interpreter = '';	    my($dir);	    foreach $dir (@absdirs) {		if ($self->maybe_command($cmd)) {		    warn "Ignoring $interpreter in $file\n" if $Verbose && $interpreter;		    $interpreter = $self->catfile($dir,$cmd);		}	    }	}	# Figure out how to invoke interpreter on this machine.	my($shb) = "";	if ($interpreter) {	    print STDOUT "Changing sharpbang in $file to $interpreter" if $Verbose;	    # this is probably value-free on DOSISH platforms	    if ($does_shbang) {		$shb .= "$Config{'sharpbang'}$interpreter";		$shb .= ' ' . $arg if defined $arg;		$shb .= "\n";	    }	    $shb .= qq{eval 'exec $interpreter $arg -S \$0 \${1+"\$\@"}'    if 0; # not running under some shell} unless $Is_Win32; # this won't work on win32, so don't	} else {	    warn "Can't find $cmd in PATH, $file unchanged"		if $Verbose;	    next;	}	unless ( open(FIXOUT,">$file.new") ) {	    warn "Can't create new $file: $!\n";	    next;	}	my($dev,$ino,$mode) = stat FIXIN;		# Print out the new #! line (or equivalent).	local $\;	undef $/;	print FIXOUT $shb, <FIXIN>;	close FIXIN;	close FIXOUT;	# can't rename/chmod open files on some DOSISH platforms	# If they override perm_rwx, we won't notice it during fixin,	# because fixin is run through a new instance of MakeMaker.	# That is why we must run another CHMOD later.	$mode = oct($self->perm_rwx) unless $dev;	chmod $mode, $file;	unless ( rename($file, "$file.bak") ) {		    warn "Can't rename $file to $file.bak: $!";	    next;	}	unless ( rename("$file.new", $file) ) {		    warn "Can't rename $file.new to $file: $!";	    unless ( rename("$file.bak", $file) ) {	        warn "Can't rename $file.bak back to $file either: $!";		warn "Leaving $file renamed as $file.bak\n";	    }	    next;	}	unlink "$file.bak";    } continue {	close(FIXIN) if fileno(FIXIN);	chmod oct($self->perm_rwx), $file or	  die "Can't reset permissions for $file: $!\n";	system("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';;    }}=item force (o)Just writes FORCE:=cutsub force {    my($self) = shift;    '# Phony target to force checking subdirectories.FORCE:	'.$self->{NOECHO}.'$(NOOP)';}=item guess_nameGuess the name of this package by examining the working directory'sname. MakeMaker calls this only if the developer has not supplied aNAME attribute.=cut# ';

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -