X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FExtUtils%2FMakeMaker.pm;h=eac32ace2359229524695c73406e9579b370ccd0;hb=0d3da1c83c7295757745950f76ff9cfcd4d61253;hp=e75f28f6397c3563493fd42cb89a9529a286d7b1;hpb=5b195008ef414ee409beeac174749c7eefef1a28;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/ExtUtils/MakeMaker.pm b/lib/ExtUtils/MakeMaker.pm index e75f28f..eac32ac 100644 --- a/lib/ExtUtils/MakeMaker.pm +++ b/lib/ExtUtils/MakeMaker.pm @@ -2,10 +2,10 @@ BEGIN {require 5.002;} # MakeMaker 5.17 was the last MakeMaker that was compatib package ExtUtils::MakeMaker; -$Version = $VERSION = "5.38"; +$Version = $VERSION = "5.43"; $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.207 $, 10)) =~ s/\s+$//; +($Revision = substr(q$Revision: 1.222 $, 10)) =~ s/\s+$//; @@ -66,11 +66,12 @@ package ExtUtils::Liblist; package ExtUtils::MakeMaker; # -# Now we can can pull in the friends +# Now we can pull in the friends # -$Is_VMS = $^O eq 'VMS'; -$Is_OS2 = $^O =~ m|^os/?2$|i; -$Is_Mac = $^O eq 'MacOS'; +$Is_VMS = $^O eq 'VMS'; +$Is_OS2 = $^O eq 'os2'; +$Is_Mac = $^O eq 'MacOS'; +$Is_Win32 = $^O eq 'MSWin32'; require ExtUtils::MM_Unix; @@ -84,6 +85,9 @@ if ($Is_OS2) { if ($Is_Mac) { require ExtUtils::MM_Mac; } +if ($Is_Win32) { + require ExtUtils::MM_Win32; +} # The SelfLoader would bring a lot of overhead for MakeMaker, because # we know for sure we will use most of the autoloaded functions once @@ -150,7 +154,7 @@ sub ExtUtils::MakeMaker::mksymlists ; sub ExtUtils::MakeMaker::neatvalue ; sub ExtUtils::MakeMaker::selfdocument ; sub ExtUtils::MakeMaker::WriteMakefile ; -sub ExtUtils::MakeMaker::prompt ; +sub ExtUtils::MakeMaker::prompt ($;$) ; 1; @@ -231,23 +235,28 @@ sub full_setup { @Attrib_help = qw/ - C CONFIG CONFIGURE DEFINE DIR DISTNAME DL_FUNCS DL_VARS EXE_FILES - EXCLUDE_EXT INCLUDE_EXT NO_VC FIRST_MAKEFILE FULLPERL H INC - INSTALLARCHLIB INSTALLBIN INSTALLDIRS INSTALLMAN1DIR + CAPI + C CCFLAGS CONFIG CONFIGURE DEFINE DIR DISTNAME DL_FUNCS DL_VARS + EXE_FILES EXCLUDE_EXT INCLUDE_EXT NO_VC FIRST_MAKEFILE FULLPERL H + INC INSTALLARCHLIB INSTALLBIN INSTALLDIRS INSTALLMAN1DIR INSTALLMAN3DIR INSTALLPRIVLIB INSTALLSCRIPT INSTALLSITEARCH INSTALLSITELIB INST_ARCHLIB INST_BIN INST_EXE INST_LIB - INST_MAN1DIR INST_MAN3DIR INST_SCRIPT LDFROM LIBPERL_A LIBS + INST_MAN1DIR INST_MAN3DIR INST_SCRIPT LDFROM LIBPERL_A LIB LIBS LINKTYPE MAKEAPERL MAKEFILE MAN1PODS MAN3PODS MAP_TARGET MYEXTLIB NAME NEEDS_LINKING NOECHO NORECURS OBJECT OPTIMIZE PERL PERLMAINCC - PERL_ARCHLIB PERL_LIB PERL_SRC PL_FILES PM PMLIBDIRS PREFIX + PERL_ARCHLIB PERL_LIB PERL_SRC PERM_RW PERM_RWX + PL_FILES PM PMLIBDIRS PREFIX PREREQ_PM SKIP TYPEMAPS VERSION VERSION_FROM XS XSOPT XSPROTOARG XS_VERSION clean depend dist dynamic_lib linkext macro realclean tool_autosplit - installpm + IMPORTS + installpm /; + # IMPORTS is used under OS/2 + # ^^^ installpm is deprecated, will go about Summer 96 # @Overridable is close to @MM_Sections but not identical. The @@ -278,8 +287,8 @@ sub full_setup { @Overridable = @MM_Sections; push @Overridable, qw[ - dir_target libscan makeaperl needs_linking subdir_x test_via_harness - test_via_script + dir_target libscan makeaperl needs_linking perm_rw perm_rwx + subdir_x test_via_harness test_via_script ]; @@ -299,8 +308,8 @@ sub full_setup { # we will use all these variables in the Makefile @Get_from_Config = qw( - ar cc cccdlflags ccdlflags ccflags dlext dlsrc ld lddlflags ldflags libc - lib_ext obj_ext ranlib sitelibexp sitearchexp so + ar cc cccdlflags ccdlflags dlext dlsrc ld lddlflags ldflags libc + lib_ext obj_ext ranlib sitelibexp sitearchexp so exe_ext ); my $item; @@ -408,10 +417,7 @@ sub ExtUtils::MakeMaker::new { # This is for old Makefiles written pre 5.00, will go away if ( Carp::longmess("") =~ /runsubdirpl/s ){ - #$self->{Correct_relativ_directories}++; Carp::carp("WARNING: Please rerun 'perl Makefile.PL' to regenerate your Makefiles\n"); - } else { - $self->{Correct_relativ_directories}=0; } my $newclass = ++$PACKNAME; @@ -430,8 +436,12 @@ sub ExtUtils::MakeMaker::new { 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}); + unless $self->file_name_is_absolute($self->{$key}) + || ($^O eq 'VMS' and ($key =~ /PERL$/ && $self->{$key} =~ /^[\w\-\$]+$/)); } $self->{PARENT}->{CHILDREN}->{$newclass} = $self if $self->{PARENT}; } else { @@ -445,11 +455,18 @@ sub ExtUtils::MakeMaker::new { $self->init_main(); if (! $self->{PERL_SRC} ) { - my($pthinks) = $INC{'Config.pm'}; + my($pthinks) = $self->canonpath($INC{'Config.pm'}); + my($cthinks) = $self->catfile($Config{'archlibexp'},'Config.pm'); $pthinks = VMS::Filespec::vmsify($pthinks) if $Is_VMS; - if ($pthinks ne $self->catfile($Config{archlibexp},'Config.pm')){ - $pthinks =~ s!/Config\.pm$!!; - $pthinks =~ s!.*/!!; + if ($pthinks ne $cthinks && + !($Is_Win32 and lc($pthinks) eq lc($cthinks))) { + print "Have $pthinks expected $cthinks\n"; + if ($Is_Win32) { + $pthinks =~ s![/\\]Config\.pm$!!i; $pthinks =~ s!.*[/\\]!!; + } + else { + $pthinks =~ s!/Config\.pm$!!; $pthinks =~ s!.*/!!; + } print STDOUT < Makefile' or die "open Makefile for write: $!"; + print MF <<'EOP'; +all: + +clean: + +install: + +makemakerdflt: + +test: + +EOP + close MF or die "close Makefile for write: $!"; +} + sub check_manifest { print STDOUT "Checking if your kit is complete...\n"; require ExtUtils::Manifest; @@ -553,15 +593,8 @@ sub parse_args{ (getpwuid($>))[7] ]ex; } - # This may go away, in mid 1996 - if ($self->{Correct_relativ_directories}){ - $value = $self->catdir("..",$value) - if $Prepend_dot_dot{$name} && ! $self->file_name_is_absolute($value); - } $self->{uc($name)} = $value; } - # This may go away, in mid 1996 - delete $self->{Correct_relativ_directories}; # catch old-style 'potential_libs' and inform user how to 'upgrade' if (defined $self->{potential_libs}){ @@ -858,18 +891,26 @@ Makefiles with a single invocation of WriteMakefile(). =head2 How To Write A Makefile.PL -The short answer is: Don't. Run h2xs(1) before you start thinking -about writing a module. For so called pm-only modules that consist of -C<*.pm> files only, h2xs has the very useful C<-X> switch. This will -generate dummy files of all kinds that are useful for the module -developer. +The short answer is: Don't. + + Always begin with h2xs. + Always begin with h2xs! + ALWAYS BEGIN WITH H2XS! + +even if you're not building around a header file, and even if you +don't have an XS component. + +Run h2xs(1) before you start thinking about writing a module. For so +called pm-only modules that consist of C<*.pm> files only, h2xs has +the C<-X> switch. This will generate dummy files of all kinds that are +useful for the module developer. The medium answer is: use ExtUtils::MakeMaker; WriteMakefile( NAME => "Foo::Bar" ); -The long answer is below. +The long answer is the rest of the manpage :-) =head2 Default Makefile Behaviour @@ -895,7 +936,7 @@ Other interesting targets in the generated Makefile are =head2 make test -MakeMaker checks for the existence of a file named "test.pl" in the +MakeMaker checks for the existence of a file named F in the current directory and if it exists it adds commands to the test target of the generated Makefile that will execute the script with the proper set of perl C<-I> options. @@ -905,6 +946,22 @@ add commands to the test target of the generated Makefile that execute all matching files via the L module with the C<-I> switches set correctly. +=head2 make testdb + +A useful variation of the above is the target C. It runs the +test under the Perl debugger (see L). If the file +F exists in the current directory, it is used for the test. + +If you want to debug some other testfile, set C variable +thusly: + + make testdb TEST_FILE=t/mytest.t + +By default the debugger is called using C<-d> option to perl. If you +want to specify some other option, set C variable: + + make testdb TESTDB_SW=-Dx + =head2 make install make alone puts all relevant files into directories that are named by @@ -934,9 +991,7 @@ The INSTALL... macros in turn default to their %Config You can check the values of these variables on your system with - perl -MConfig -le 'print join $/, map - sprintf("%20s: %s", $_, $Config{$_}), - grep /^install/, keys %Config' + perl '-V:install.*' And to check the sequence in which the library directories are searched by perl, run @@ -944,18 +999,29 @@ searched by perl, run perl -le 'print join $/, @INC' -=head2 PREFIX attribute +=head2 PREFIX and LIB attribute + +PREFIX and LIB can be used to set several INSTALL* attributes in one +go. The quickest way to install a module in a non-standard place might +be + + perl Makefile.PL LIB=~/lib -The PREFIX attribute can be used to set the INSTALL* attributes in one -go. The quickest way to install a module in a non-standard place +This will install the module's architecture-independent files into +~/lib, the architecture-dependent files into ~/lib/$archname/auto. + +Another way to specify many INSTALL directories with a single +parameter is PREFIX. perl Makefile.PL PREFIX=~ This will replace the string specified by $Config{prefix} in all $Config{install*} values. -Note, that the tilde expansion is done by MakeMaker, not by perl by -default, nor by make. +Note, that in both cases the tilde expansion is done by MakeMaker, not +by perl by default, nor by make. Conflicts between parmeters LIB, +PREFIX and the various INSTALL* arguments are resolved so that +XXX If the user has superuser privileges, and is not working on AFS (Andrew File System) or relatives, then the defaults for @@ -1116,6 +1182,11 @@ Ref to array of *.c file names. Initialised from a directory scan and the values portion of the XS attribute hash. This is not currently used by MakeMaker but may be handy in Makefile.PLs. +=item CCFLAGS + +String that will be included in the compiler call command line between +the arguments INC and OPTIMIZE. + =item CONFIG Arrayref. E.g. [qw(archname manext)] defines ARCHNAME & MANEXT from @@ -1140,7 +1211,7 @@ so =item CONFIGURE CODE reference. The subroutine should return a hash reference. The -hash may contain further attributes, e.g. {LIBS => ...}, that have to +hash may contain further attributes, e.g. {LIBS =E ...}, that have to be determined by some evaluation method. =item DEFINE @@ -1216,6 +1287,10 @@ Perl binary able to run this extension. Ref to array of *.h file names. Similar to C. +=item IMPORTS + +IMPORTS is only used on OS/2. + =item INC Include file dirs eg: C<"-I/usr/5include -I/path/to/inc"> @@ -1326,6 +1401,11 @@ specify ld flags) The filename of the perllibrary that will be used together with this extension. Defaults to libperl.a. +=item LIB + +LIB can only be set at C time. It has the effect of +setting both INSTALLPRIVLIB and INSTALLSITELIB to that value regardless any + =item LIBS An anonymous array of alternative library @@ -1443,6 +1523,16 @@ Directory containing the Perl library to use. Directory containing the Perl source code (use of this should be avoided, it may be undefined) +=item PERM_RW + +Desired Permission for read/writable files. Defaults to C<644>. +See also L. + +=item PERM_RWX + +Desired permission for executable files. Defaults to C<755>. +See also L. + =item PL_FILES Ref to hash of files to be processed as perl programs. MakeMaker @@ -1460,15 +1550,14 @@ Hashref of .pm files and *.pl files to be installed. e.g. {'name_of_file.pm' => '$(INST_LIBDIR)/install_as.pm'} -By default this will include *.pm and *.pl. If a lib directory -exists and is not listed in DIR (above) then any *.pm and *.pl files -it contains will also be included by default. Defining PM in the +By default this will include *.pm and *.pl and the files found in +the PMLIBDIRS directories. Defining PM in the Makefile.PL will override PMLIBDIRS. =item PMLIBDIRS Ref to array of subdirectories containing library files. Defaults to -[ 'lib', $(BASEEXT) ]. The directories will be scanned and any files +[ 'lib', $(BASEEXT) ]. The directories will be scanned and I files they contain will be installed in the corresponding location in the library. A libscan() method can be used to alter the behaviour. Defining PM in the Makefile.PL will override PMLIBDIRS. @@ -1518,15 +1607,17 @@ routine requires that the file named by VERSION_FROM contains one single line to compute the version number. The first line in the file that contains the regular expression - /\$(([\w\:\']*)\bVERSION)\b.*\=/ + /([\$*])(([\w\:\']*)\bVERSION)\b.*\=/ will be evaluated with eval() and the value of the named variable B the eval() will be assigned to the VERSION attribute of the MakeMaker object. The following lines will be parsed o.k.: $VERSION = '1.00'; - ( $VERSION ) = '$Revision: 1.207 $ ' =~ /\$Revision:\s+([^\s]+)/; + *VERSION = \'1.01'; + ( $VERSION ) = '$Revision: 1.222 $ ' =~ /\$Revision:\s+([^\s]+)/; $FOO::VERSION = '1.10'; + *FOO::VERSION = \'1.11'; but these will fail: @@ -1534,9 +1625,16 @@ but these will fail: local $VERSION = '1.02'; local $FOO::VERSION = '1.30'; -The file named in VERSION_FROM is added as a dependency to Makefile to -guarantee, that the Makefile contains the correct VERSION macro after -a change of the file. +The file named in VERSION_FROM is not added as a dependency to +Makefile. This is not really correct, but it would be a major pain +during development to have to rewrite the Makefile for any smallish +change in that file. If you want to make sure that the Makefile +contains the correct VERSION macro after any change of the file, you +would have to do something like + + depend => { Makefile => '$(VERSION_FROM)' } + +See attribute C below. =item XS @@ -1647,7 +1745,8 @@ either say: or you can edit the default by saying something like: sub MY::c_o { - my($inherited) = shift->SUPER::c_o(@_); + package MY; # so that "SUPER" works right + my $inherited = shift->SUPER::c_o(@_); $inherited =~ s/old text/new text/; $inherited; } @@ -1793,6 +1892,23 @@ An example: WriteMakefile( 'dist' => { COMPRESS=>"gzip", SUFFIX=>"gz" }) +=head2 Disabling an extension + +If some events detected in F imply that there is no way +to create the Module, but this is a normal state of things, then you +can create a F which does nothing, but succeeds on all the +"usual" build targets. To do so, use + + ExtUtils::MakeMaker::WriteEmptyMakefile(); + +instead of WriteMakefile(). + +This may be useful if other modules expect this module to be I +OK, as opposed to I OK (say, this system-dependent module builds +in a subdirectory of some other distribution, or is listed as a +dependency in a CPAN::Bundle, but the functionality is supported by +different means on the current architecture). + =head1 SEE ALSO ExtUtils::MM_Unix, ExtUtils::Manifest, ExtUtils::testlib, @@ -1800,11 +1916,10 @@ ExtUtils::Install, ExtUtils::embed =head1 AUTHORS -Andy Dougherty Fdoughera@lafcol.lafayette.eduE>, Andreas -KEnig FA.Koenig@franz.ww.TU-Berlin.DEE>, Tim Bunce -FTim.Bunce@ig.co.ukE>. VMS support by Charles Bailey -Fbailey@genetics.upenn.eduE>. OS/2 support by Ilya -Zakharevich Filya@math.ohio-state.eduE>. Contact the +Andy Dougherty >, Andreas KEnig +>, Tim Bunce >. +VMS support by Charles Bailey >. OS/2 +support by Ilya Zakharevich >. Contact the makemaker mailing list C, if you have any questions.