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

📄 mm_unix.pm

📁 MSYS在windows下模拟了一个类unix的终端
💻 PM
📖 第 1 页 / 共 5 页
字号:
package ExtUtils::MM_Unix;use Exporter ();use Config;use File::Basename qw(basename dirname fileparse);use DirHandle;use strict;use vars qw($VERSION $Is_Mac $Is_OS2 $Is_VMS $Is_Win32 $Is_Dos $Is_PERL_OBJECT	    $Verbose %pm %static $Xsubpp_Version);$VERSION = substr q$Revision: 1.12603 $, 10;# $Id: MM_Unix.pm,v 1.126 1998/06/28 21:32:49 k Exp k $Exporter::import('ExtUtils::MakeMaker', qw($Verbose &neatvalue));$Is_OS2 = $^O eq 'os2';$Is_Mac = $^O eq 'MacOS';$Is_Win32 = $^O eq 'MSWin32';$Is_Dos = $^O eq 'dos';$Is_PERL_OBJECT = $Config{'ccflags'} =~ /-DPERL_OBJECT/;if ($Is_VMS = $^O eq 'VMS') {    require VMS::Filespec;    import VMS::Filespec qw( &vmsify );}=head1 NAMEExtUtils::MM_Unix - methods used by ExtUtils::MakeMaker=head1 SYNOPSISC<require ExtUtils::MM_Unix;>=head1 DESCRIPTIONThe methods provided by this package are designed to be used inconjunction with ExtUtils::MakeMaker. When MakeMaker writes aMakefile, it creates one or more objects that inherit their methodsfrom a package C<MM>. MM itself doesn't provide any methods, but itISA ExtUtils::MM_Unix class. The inheritance tree of MM lets operatingspecific packages take the responsibility for all the methods providedby MM_Unix. We are trying to reduce the number of the necessaryoverrides by defining rather primitive operations withinExtUtils::MM_Unix.If you are going to write a platform specific MM package, please tryto limit the necessary overrides to primitive methods, and if it is notpossible to do so, let's work out how to achieve that gain.If you are overriding any of these methods in your Makefile.PL (in theMY class), please report that to the makemaker mailing list. We aretrying to minimize the necessary method overrides and switch to datadriven Makefile.PLs wherever possible. In the long run less methodswill be overridable via the MY class.=head1 METHODSThe following description of methods is still underdevelopment. Please refer to the code for not suitably documentedsections and complain loudly to the makemaker mailing list.Not all of the methods below are overridable in aMakefile.PL. Overridable methods are marked as (o). All methods areoverridable by a platform specific MM_*.pm file (SeeL<ExtUtils::MM_VMS>) and L<ExtUtils::MM_OS2>).=head2 Preloaded methods=over 2=item canonpathNo physical check on the filesystem, but a logical cleanup of apath. On UNIX eliminated successive slashes and successive "/.".=cutsub canonpath {    my($self,$path) = @_;    my $node = '';    if ( $^O eq 'qnx' && $path =~ s|^(//\d+)/|/|s ) {      $node = $1;    }    $path =~ s|(?<=[^/])/+|/|g ;                   # xx////xx  -> xx/xx    $path =~ s|(/\.)+/|/|g ;                       # xx/././xx -> xx/xx    $path =~ s|^(\./)+||s unless $path eq "./";    # ./xx      -> xx    $path =~ s|(?<=[^/])/\z|| ;                    # xx/       -> xx    "$node$path";}=item catdirConcatenate two or more directory names to form a complete path endingwith a directory. But remove the trailing slash from the resultingstring, because it doesn't look good, isn't necessary and confusesOS2. Of course, if this is the root directory, don't cut off thetrailing slash :-)=cut# ';sub catdir {    my $self = shift @_;    my @args = @_;    for (@args) {	# append a slash to each argument unless it has one there	$_ .= "/" if $_ eq '' or substr($_,-1) ne "/";    }    $self->canonpath(join('', @args));}=item catfileConcatenate one or more directory names and a filename to form acomplete path ending with a filename=cutsub catfile {    my $self = shift @_;    my $file = pop @_;    return $self->canonpath($file) unless @_;    my $dir = $self->catdir(@_);    for ($dir) {	$_ .= "/" unless substr($_,length($_)-1,1) eq "/";    }    return $self->canonpath($dir.$file);}=item curdirReturns a string representing of the current directory.  "." on UNIX.=cutsub curdir {    return "." ;}=item rootdirReturns a string representing of the root directory.  "/" on UNIX.=cutsub rootdir {    return "/";}=item updirReturns a string representing of the parent directory.  ".." on UNIX.=cutsub updir {    return "..";}sub ExtUtils::MM_Unix::c_o ;sub ExtUtils::MM_Unix::clean ;sub ExtUtils::MM_Unix::const_cccmd ;sub ExtUtils::MM_Unix::const_config ;sub ExtUtils::MM_Unix::const_loadlibs ;sub ExtUtils::MM_Unix::constants ;sub ExtUtils::MM_Unix::depend ;sub ExtUtils::MM_Unix::dir_target ;sub ExtUtils::MM_Unix::dist ;sub ExtUtils::MM_Unix::dist_basics ;sub ExtUtils::MM_Unix::dist_ci ;sub ExtUtils::MM_Unix::dist_core ;sub ExtUtils::MM_Unix::dist_dir ;sub ExtUtils::MM_Unix::dist_test ;sub ExtUtils::MM_Unix::dlsyms ;sub ExtUtils::MM_Unix::dynamic ;sub ExtUtils::MM_Unix::dynamic_bs ;sub ExtUtils::MM_Unix::dynamic_lib ;sub ExtUtils::MM_Unix::exescan ;sub ExtUtils::MM_Unix::export_list ;sub ExtUtils::MM_Unix::extliblist ;sub ExtUtils::MM_Unix::file_name_is_absolute ;sub ExtUtils::MM_Unix::find_perl ;sub ExtUtils::MM_Unix::fixin ;sub ExtUtils::MM_Unix::force ;sub ExtUtils::MM_Unix::guess_name ;sub ExtUtils::MM_Unix::has_link_code ;sub ExtUtils::MM_Unix::htmlifypods ;sub ExtUtils::MM_Unix::init_dirscan ;sub ExtUtils::MM_Unix::init_main ;sub ExtUtils::MM_Unix::init_others ;sub ExtUtils::MM_Unix::install ;sub ExtUtils::MM_Unix::installbin ;sub ExtUtils::MM_Unix::libscan ;sub ExtUtils::MM_Unix::linkext ;sub ExtUtils::MM_Unix::lsdir ;sub ExtUtils::MM_Unix::macro ;sub ExtUtils::MM_Unix::makeaperl ;sub ExtUtils::MM_Unix::makefile ;sub ExtUtils::MM_Unix::manifypods ;sub ExtUtils::MM_Unix::maybe_command ;sub ExtUtils::MM_Unix::maybe_command_in_dirs ;sub ExtUtils::MM_Unix::needs_linking ;sub ExtUtils::MM_Unix::nicetext ;sub ExtUtils::MM_Unix::parse_version ;sub ExtUtils::MM_Unix::pasthru ;sub ExtUtils::MM_Unix::path ;sub ExtUtils::MM_Unix::perl_archive;sub ExtUtils::MM_Unix::perl_archive_after;sub ExtUtils::MM_Unix::perl_script ;sub ExtUtils::MM_Unix::perldepend ;sub ExtUtils::MM_Unix::pm_to_blib ;sub ExtUtils::MM_Unix::post_constants ;sub ExtUtils::MM_Unix::post_initialize ;sub ExtUtils::MM_Unix::postamble ;sub ExtUtils::MM_Unix::ppd ;sub ExtUtils::MM_Unix::prefixify ;sub ExtUtils::MM_Unix::processPL ;sub ExtUtils::MM_Unix::realclean ;sub ExtUtils::MM_Unix::replace_manpage_separator ;sub ExtUtils::MM_Unix::static ;sub ExtUtils::MM_Unix::static_lib ;sub ExtUtils::MM_Unix::staticmake ;sub ExtUtils::MM_Unix::subdir_x ;sub ExtUtils::MM_Unix::subdirs ;sub ExtUtils::MM_Unix::test ;sub ExtUtils::MM_Unix::test_via_harness ;sub ExtUtils::MM_Unix::test_via_script ;sub ExtUtils::MM_Unix::tool_autosplit ;sub ExtUtils::MM_Unix::tool_xsubpp ;sub ExtUtils::MM_Unix::tools_other ;sub ExtUtils::MM_Unix::top_targets ;sub ExtUtils::MM_Unix::writedoc ;sub ExtUtils::MM_Unix::xs_c ;sub ExtUtils::MM_Unix::xs_cpp ;sub ExtUtils::MM_Unix::xs_o ;sub ExtUtils::MM_Unix::xsubpp_version ;package ExtUtils::MM_Unix;use SelfLoader;1;__DATA__=back=head2 SelfLoaded methods=over 2=item c_o (o)Defines the suffix rules to compile different flavors of C files toobject files.=cutsub c_o {# --- Translation Sections ---    my($self) = shift;    return '' unless $self->needs_linking();    my(@m);    push @m, '.c$(OBJ_EXT):	$(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.c';    push @m, '.C$(OBJ_EXT):	$(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.C' if $^O ne 'os2' and $^O ne 'MSWin32' and $^O ne 'dos'; #Case-specific    push @m, '.cpp$(OBJ_EXT):	$(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.cpp.cxx$(OBJ_EXT):	$(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.cxx.cc$(OBJ_EXT):	$(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.cc';    join "", @m;}=item cflags (o)Does very much the same as the cflags script in the perldistribution. It doesn't return the whole compiler command line, butinitializes all of its parts. The const_cccmd method then actuallyreturns the definition of the CCCMD macro which uses these parts.=cut#'sub cflags {    my($self,$libperl)=@_;    return $self->{CFLAGS} if $self->{CFLAGS};    return '' unless $self->needs_linking();    my($prog, $uc, $perltype, %cflags);    $libperl ||= $self->{LIBPERL_A} || "libperl$self->{LIB_EXT}" ;    $libperl =~ s/\.\$\(A\)$/$self->{LIB_EXT}/;    @cflags{qw(cc ccflags optimize shellflags)}	= @Config{qw(cc ccflags optimize shellflags)};    my($optdebug) = "";    $cflags{shellflags} ||= '';    my(%map) =  (		D =>   '-DDEBUGGING',		E =>   '-DEMBED',		DE =>  '-DDEBUGGING -DEMBED',		M =>   '-DEMBED -DMULTIPLICITY',		DM =>  '-DDEBUGGING -DEMBED -DMULTIPLICITY',		);    if ($libperl =~ /libperl(\w*)\Q$self->{LIB_EXT}/){	$uc = uc($1);    } else {	$uc = ""; # avoid warning    }    $perltype = $map{$uc} ? $map{$uc} : "";    if ($uc =~ /^D/) {	$optdebug = "-g";    }    my($name);    ( $name = $self->{NAME} . "_cflags" ) =~ s/:/_/g ;    if ($prog = $Config::Config{$name}) {	# Expand hints for this extension via the shell	print STDOUT "Processing $name hint:\n" if $Verbose;	my(@o)=`cc=\"$cflags{cc}\"	  ccflags=\"$cflags{ccflags}\"	  optimize=\"$cflags{optimize}\"	  perltype=\"$cflags{perltype}\"	  optdebug=\"$cflags{optdebug}\"	  eval '$prog'	  echo cc=\$cc	  echo ccflags=\$ccflags	  echo optimize=\$optimize	  echo perltype=\$perltype	  echo optdebug=\$optdebug	  `;	my($line);	foreach $line (@o){	    chomp $line;	    if ($line =~ /(.*?)=\s*(.*)\s*$/){		$cflags{$1} = $2;		print STDOUT "	$1 = $2\n" if $Verbose;	    } else {		print STDOUT "Unrecognised result from hint: '$line'\n";	    }	}    }    if ($optdebug) {	$cflags{optimize} = $optdebug;    }    for (qw(ccflags optimize perltype)) {	$cflags{$_} =~ s/^\s+//;	$cflags{$_} =~ s/\s+/ /g;	$cflags{$_} =~ s/\s+$//;	$self->{uc $_} ||= $cflags{$_}    }    if ($Is_PERL_OBJECT) {        $self->{CCFLAGS} =~ s/-DPERL_OBJECT(\b|$)/-DPERL_CAPI/g;        if ($Is_Win32) { 	    if ($Config{'cc'} =~ /^cl/i) {		# Turn off C++ mode of the MSC compiler		$self->{CCFLAGS} =~ s/-TP(\s|$)//g;		$self->{OPTIMIZE} =~ s/-TP(\s|$)//g;	    }	    elsif ($Config{'cc'} =~ /^bcc32/i) {		# Turn off C++ mode of the Borland compiler		$self->{CCFLAGS} =~ s/-P(\s|$)//g;		$self->{OPTIMIZE} =~ s/-P(\s|$)//g;	    }	    elsif ($Config{'cc'} =~ /^gcc/i) {		# Turn off C++ mode of the GCC compiler		$self->{CCFLAGS} =~ s/-xc\+\+(\s|$)//g;		$self->{OPTIMIZE} =~ s/-xc\+\+(\s|$)//g;	    }        }    }    if ($self->{POLLUTE}) {	$self->{CCFLAGS} .= ' -DPERL_POLLUTE ';    }    my $pollute = '';    if ($Config{usemymalloc} and not $Config{bincompat5005}	and not $Config{ccflags} =~ /-DPERL_POLLUTE_MALLOC\b/	and $self->{PERL_MALLOC_OK}) {	$pollute = '$(PERL_MALLOC_DEF)';    }    return $self->{CFLAGS} = qq{CCFLAGS = $self->{CCFLAGS}OPTIMIZE = $self->{OPTIMIZE}PERLTYPE = $self->{PERLTYPE}MPOLLUTE = $pollute};}=item clean (o)Defines the clean target.=cutsub clean {# --- Cleanup and Distribution Sections ---    my($self, %attribs) = @_;    my(@m,$dir);    push(@m, '# Delete temporary files but do not touch installed files. We don\'t delete# the Makefile here so a later make realclean still has a makefile to use.clean ::');    # clean subdirectories first    for $dir (@{$self->{DIR}}) {	if ($Is_Win32  &&  Win32::IsWin95()) {	    push @m, <<EOT;	cd $dir	\$(TEST_F) $self->{MAKEFILE}	\$(MAKE) clean

⌨️ 快捷键说明

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