1 package ExtUtils::MM_Unix;
8 use ExtUtils::MakeMaker::Config;
9 use File::Basename qw(basename dirname);
14 use ExtUtils::MakeMaker qw($Verbose neatvalue);
16 # If we make $VERSION an our variable parse_version() breaks
17 use vars qw($VERSION);
19 $VERSION = eval $VERSION; ## no critic [BuiltinFunctions::ProhibitStringyEval]
21 require ExtUtils::MM_Any;
22 our @ISA = qw(ExtUtils::MM_Any);
26 $Is{OS2} = $^O eq 'os2';
27 $Is{Win32} = $^O eq 'MSWin32' || $Config{osname} eq 'NetWare';
28 $Is{Dos} = $^O eq 'dos';
29 $Is{VMS} = $^O eq 'VMS';
30 $Is{OSF} = $^O eq 'dec_osf';
31 $Is{IRIX} = $^O eq 'irix';
32 $Is{NetBSD} = $^O eq 'netbsd';
33 $Is{Interix} = $^O eq 'interix';
34 $Is{SunOS4} = $^O eq 'sunos';
35 $Is{Solaris} = $^O eq 'solaris';
36 $Is{SunOS} = $Is{SunOS4} || $Is{Solaris};
37 $Is{BSD} = ($^O =~ /^(?:free|net|open)bsd$/ or
38 grep( $^O eq $_, qw(bsdos interix dragonfly) )
44 # For things like vmsify()
45 require VMS::Filespec;
46 VMS::Filespec->import;
53 ExtUtils::MM_Unix - methods used by ExtUtils::MakeMaker
57 C<require ExtUtils::MM_Unix;>
61 The methods provided by this package are designed to be used in
62 conjunction with ExtUtils::MakeMaker. When MakeMaker writes a
63 Makefile, it creates one or more objects that inherit their methods
64 from a package C<MM>. MM itself doesn't provide any methods, but it
65 ISA ExtUtils::MM_Unix class. The inheritance tree of MM lets operating
66 specific packages take the responsibility for all the methods provided
67 by MM_Unix. We are trying to reduce the number of the necessary
68 overrides by defining rather primitive operations within
71 If you are going to write a platform specific MM package, please try
72 to limit the necessary overrides to primitive methods, and if it is not
73 possible to do so, let's work out how to achieve that gain.
75 If you are overriding any of these methods in your Makefile.PL (in the
76 MY class), please report that to the makemaker mailing list. We are
77 trying to minimize the necessary method overrides and switch to data
78 driven Makefile.PLs wherever possible. In the long run less methods
79 will be overridable via the MY class.
83 The following description of methods is still under
84 development. Please refer to the code for not suitably documented
85 sections and complain loudly to the makemaker@perl.org mailing list.
86 Better yet, provide a patch.
88 Not all of the methods below are overridable in a
89 Makefile.PL. Overridable methods are marked as (o). All methods are
90 overridable by a platform specific MM_*.pm file.
92 Cross-platform methods are being moved into MM_Any. If you can't find
93 something that used to be in here, look in MM_Any.
97 # So we don't have to keep calling the methods over and over again,
98 # we have these globals to cache the values. Faster and shrtr.
99 my $Curdir = __PACKAGE__->curdir;
100 my $Rootdir = __PACKAGE__->rootdir;
101 my $Updir = __PACKAGE__->updir;
110 Simply says that we're Unix.
121 Defines the suffix rules to compile different flavors of C files to
127 # --- Translation Sections ---
130 return '' unless $self->needs_linking();
133 my $command = '$(CCCMD)';
134 my $flags = '$(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE)';
136 if (my $cpp = $Config{cpprun}) {
137 my $cpp_cmd = $self->const_cccmd;
138 $cpp_cmd =~ s/^CCCMD\s*=\s*\$\(CC\)/$cpp/;
141 $cpp_cmd $flags \$*.c > \$*.i
147 $command -S $flags \$*.c
150 $command $flags \$*.c
153 $command $flags \$*.cpp
156 $command $flags \$*.cxx
159 $command $flags \$*.cc
164 $command $flags \$*.C
165 } if !$Is{OS2} and !$Is{Win32} and !$Is{Dos}; #Case-specific
172 Does very much the same as the cflags script in the perl
173 distribution. It doesn't return the whole compiler command line, but
174 initializes all of its parts. The const_cccmd method then actually
175 returns the definition of the CCCMD macro which uses these parts.
182 my($self,$libperl)=@_;
183 return $self->{CFLAGS} if $self->{CFLAGS};
184 return '' unless $self->needs_linking();
186 my($prog, $uc, $perltype, %cflags);
187 $libperl ||= $self->{LIBPERL_A} || "libperl$self->{LIB_EXT}" ;
188 $libperl =~ s/\.\$\(A\)$/$self->{LIB_EXT}/;
190 @cflags{qw(cc ccflags optimize shellflags)}
191 = @Config{qw(cc ccflags optimize shellflags)};
194 $cflags{shellflags} ||= '';
199 DE => '-DDEBUGGING -DEMBED',
200 M => '-DEMBED -DMULTIPLICITY',
201 DM => '-DDEBUGGING -DEMBED -DMULTIPLICITY',
204 if ($libperl =~ /libperl(\w*)\Q$self->{LIB_EXT}/){
207 $uc = ""; # avoid warning
209 $perltype = $map{$uc} ? $map{$uc} : "";
217 ( $name = $self->{NAME} . "_cflags" ) =~ s/:/_/g ;
218 if ($prog = $Config{$name}) {
219 # Expand hints for this extension via the shell
220 print "Processing $name hint:\n" if $Verbose;
221 my(@o)=`cc=\"$cflags{cc}\"
222 ccflags=\"$cflags{ccflags}\"
223 optimize=\"$cflags{optimize}\"
224 perltype=\"$cflags{perltype}\"
225 optdebug=\"$cflags{optdebug}\"
228 echo ccflags=\$ccflags
229 echo optimize=\$optimize
230 echo perltype=\$perltype
231 echo optdebug=\$optdebug
233 foreach my $line (@o){
235 if ($line =~ /(.*?)=\s*(.*)\s*$/){
237 print " $1 = $2\n" if $Verbose;
239 print "Unrecognised result from hint: '$line'\n";
245 $cflags{optimize} = $optdebug;
248 for (qw(ccflags optimize perltype)) {
250 $cflags{$_} =~ s/^\s+//;
251 $cflags{$_} =~ s/\s+/ /g;
252 $cflags{$_} =~ s/\s+$//;
253 $self->{uc $_} ||= $cflags{$_};
256 if ($self->{POLLUTE}) {
257 $self->{CCFLAGS} .= ' -DPERL_POLLUTE ';
261 if ($Config{usemymalloc} and not $Config{bincompat5005}
262 and not $Config{ccflags} =~ /-DPERL_POLLUTE_MALLOC\b/
263 and $self->{PERL_MALLOC_OK}) {
264 $pollute = '$(PERL_MALLOC_DEF)';
267 $self->{CCFLAGS} = quote_paren($self->{CCFLAGS});
268 $self->{OPTIMIZE} = quote_paren($self->{OPTIMIZE});
270 return $self->{CFLAGS} = qq{
271 CCFLAGS = $self->{CCFLAGS}
272 OPTIMIZE = $self->{OPTIMIZE}
273 PERLTYPE = $self->{PERLTYPE}
280 =item const_cccmd (o)
282 Returns the full compiler call for C programs and stores the
283 definition in CONST_CCCMD.
288 my($self,$libperl)=@_;
289 return $self->{CONST_CCCMD} if $self->{CONST_CCCMD};
290 return '' unless $self->needs_linking();
291 return $self->{CONST_CCCMD} =
292 q{CCCMD = $(CC) -c $(PASTHRU_INC) $(INC) \\
293 $(CCFLAGS) $(OPTIMIZE) \\
294 $(PERLTYPE) $(MPOLLUTE) $(DEFINE_VERSION) \\
295 $(XS_DEFINE_VERSION)};
298 =item const_config (o)
300 Defines a couple of constants in the Makefile that are imported from
306 # --- Constants Sections ---
311 # These definitions are from config.sh (via $INC{'Config.pm'}).
312 # They may have been overridden via Makefile.PL or on the command line.
316 foreach my $key (@{$self->{CONFIG}}){
317 # SITE*EXP macros are defined in &constants; avoid duplicates here
318 next if $once_only{$key};
319 $self->{uc $key} = quote_paren($self->{uc $key});
320 push @m, uc($key) , ' = ' , $self->{uc $key}, "\n";
321 $once_only{$key} = 1;
326 =item const_loadlibs (o)
328 Defines EXTRALIBS, LDLOADLIBS, BSLOADLIBS, LD_RUN_PATH. See
329 L<ExtUtils::Liblist> for details.
335 return "" unless $self->needs_linking;
338 # $self->{NAME} might depend on some other libraries:
339 # See ExtUtils::Liblist for details
343 EXTRALIBS LDLOADLIBS BSLOADLIBS
345 next unless defined $self->{$tmp};
346 push @m, "$tmp = $self->{$tmp}\n";
348 # don't set LD_RUN_PATH if empty
352 next unless $self->{$tmp};
353 push @m, "$tmp = $self->{$tmp}\n";
360 my $make_frag = $mm->constants;
362 Prints out macros for lots of constants.
370 $self->{DFSEP} = '$(DIRFILESEP)'; # alias for internal use
374 AR_STATIC_ARGS DIRFILESEP DFSEP
376 VERSION VERSION_MACRO VERSION_SYM DEFINE_VERSION
377 XS_VERSION XS_VERSION_MACRO XS_DEFINE_VERSION
378 INST_ARCHLIB INST_SCRIPT INST_BIN INST_LIB
379 INST_MAN1DIR INST_MAN3DIR
381 INSTALLDIRS INSTALL_BASE DESTDIR PREFIX
382 PERLPREFIX SITEPREFIX VENDORPREFIX
384 (map { ("INSTALL".$_,
386 } $self->installvars),
391 FIRST_MAKEFILE MAKEFILE_OLD MAKE_APERL_FILE
392 PERLMAINCC PERL_SRC PERL_INC
393 PERL FULLPERL ABSPERL
394 PERLRUN FULLPERLRUN ABSPERLRUN
395 PERLRUNINST FULLPERLRUNINST ABSPERLRUNINST
397 PERM_DIR PERM_RW PERM_RWX
401 next unless defined $self->{$macro};
403 # pathnames can have sharp signs in them; escape them so
404 # make doesn't think it is a comment-start character.
405 $self->{$macro} =~ s/#/\\#/g;
406 push @m, "$macro = $self->{$macro}\n";
410 MAKEMAKER = $self->{MAKEMAKER}
411 MM_VERSION = $self->{MM_VERSION}
412 MM_REVISION = $self->{MM_REVISION}
416 # FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle).
417 # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle)
418 # PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar)
419 # DLBASE = Basename part of dynamic library. May be just equal BASEEXT.
424 FULLEXT BASEEXT PARENT_NAME DLBASE VERSION_FROM INC DEFINE OBJECT
425 LDFROM LINKTYPE BOOTDEP
428 next unless defined $self->{$macro};
429 push @m, "$macro = $self->{$macro}\n";
433 # Handy lists of source code files:
434 XS_FILES = ".$self->wraplist(sort keys %{$self->{XS}})."
435 C_FILES = ".$self->wraplist(@{$self->{C}})."
436 O_FILES = ".$self->wraplist(@{$self->{O_FILES}})."
437 H_FILES = ".$self->wraplist(@{$self->{H}})."
438 MAN1PODS = ".$self->wraplist(sort keys %{$self->{MAN1PODS}})."
439 MAN3PODS = ".$self->wraplist(sort keys %{$self->{MAN3PODS}})."
444 # Where is the Config information that we are using/depend on
445 CONFIGDEP = $(PERL_ARCHLIB)$(DFSEP)Config.pm $(PERL_INC)$(DFSEP)config.h
450 # Where to build things
451 INST_LIBDIR = $self->{INST_LIBDIR}
452 INST_ARCHLIBDIR = $self->{INST_ARCHLIBDIR}
454 INST_AUTODIR = $self->{INST_AUTODIR}
455 INST_ARCHAUTODIR = $self->{INST_ARCHAUTODIR}
457 INST_STATIC = $self->{INST_STATIC}
458 INST_DYNAMIC = $self->{INST_DYNAMIC}
459 INST_BOOT = $self->{INST_BOOT}
465 EXPORT_LIST = $self->{EXPORT_LIST}
466 PERL_ARCHIVE = $self->{PERL_ARCHIVE}
467 PERL_ARCHIVE_AFTER = $self->{PERL_ARCHIVE_AFTER}
472 TO_INST_PM = ".$self->wraplist(sort keys %{$self->{PM}})."
474 PM_TO_BLIB = ".$self->wraplist(%{$self->{PM}})."
483 Same as macro for the depend attribute.
488 my($self,%attribs) = @_;
490 while (($key,$val) = each %attribs){
491 last unless defined $key;
492 push @m, "$key : $val\n";
502 Defines the DESTDIR and DEST* variables paralleling the INSTALL*.
510 $self->{DESTDIR} ||= '';
512 # Make DEST variables.
513 foreach my $var ($self->installvars) {
514 my $destvar = 'DESTINSTALL'.$var;
515 $self->{$destvar} ||= '$(DESTDIR)$(INSTALL'.$var.')';
524 Defines a lot of macros for distribution support.
526 macro description default
528 TAR tar command to use tar
529 TARFLAGS flags to pass to TAR cvf
531 ZIP zip command to use zip
532 ZIPFLAGS flags to pass to ZIP -r
534 COMPRESS compression command to gzip --best
536 SUFFIX suffix to put on .gz
539 SHAR shar command to use shar
541 PREOP extra commands to run before
543 POSTOP extra commands to run after
546 TO_UNIX a command to convert linefeeds
547 to Unix style in your archive
549 CI command to checkin your ci -u
550 sources to version control
551 RCS_LABEL command to label your sources rcs -Nv$(VERSION_SYM): -q
554 DIST_CP $how argument to manicopy() best
555 when the distdir is created
557 DIST_DEFAULT default target to use to tardist
558 create a distribution
560 DISTVNAME name of the resulting archive $(DISTNAME)-$(VERSION)
568 $self->{TAR} ||= 'tar';
569 $self->{TARFLAGS} ||= 'cvf';
570 $self->{ZIP} ||= 'zip';
571 $self->{ZIPFLAGS} ||= '-r';
572 $self->{COMPRESS} ||= 'gzip --best';
573 $self->{SUFFIX} ||= '.gz';
574 $self->{SHAR} ||= 'shar';
575 $self->{PREOP} ||= '$(NOECHO) $(NOOP)'; # eg update MANIFEST
576 $self->{POSTOP} ||= '$(NOECHO) $(NOOP)'; # eg remove the distdir
577 $self->{TO_UNIX} ||= '$(NOECHO) $(NOOP)';
579 $self->{CI} ||= 'ci -u';
580 $self->{RCS_LABEL}||= 'rcs -Nv$(VERSION_SYM): -q';
581 $self->{DIST_CP} ||= 'best';
582 $self->{DIST_DEFAULT} ||= 'tardist';
584 ($self->{DISTNAME} = $self->{NAME}) =~ s{::}{-}g unless $self->{DISTNAME};
585 $self->{DISTVNAME} ||= $self->{DISTNAME}.'-'.$self->{VERSION};
591 my $dist_macros = $mm->dist(%overrides);
593 Generates a make fragment defining all the macros initialized in
596 %overrides can be used to override any of the above.
601 my($self, %attribs) = @_;
605 TAR TARFLAGS ZIP ZIPFLAGS COMPRESS SUFFIX SHAR
607 CI RCS_LABEL DIST_CP DIST_DEFAULT
611 my $value = $attribs{$key} || $self->{$key};
612 $make .= "$key = $value\n";
618 =item dist_basics (o)
620 Defines the targets distclean, distcheck, skipcheck, manifest, veryclean.
627 return <<'MAKE_FRAG';
628 distclean :: realclean distcheck
632 $(PERLRUN) "-MExtUtils::Manifest=fullcheck" -e fullcheck
635 $(PERLRUN) "-MExtUtils::Manifest=skipcheck" -e skipcheck
638 $(PERLRUN) "-MExtUtils::Manifest=mkmanifest" -e mkmanifest
640 veryclean : realclean
641 $(RM_F) *~ */*~ *.orig */*.orig *.bak */*.bak *.old */*.old
649 Defines a check in target for RCS.
657 $(PERLRUN) "-MExtUtils::Manifest=maniread" \\
658 -e "@all = keys %{ maniread() };" \\
659 -e "print(qq{Executing $(CI) @all\n}); system(qq{$(CI) @all});" \\
660 -e "print(qq{Executing $(RCS_LABEL) ...\n}); system(qq{$(RCS_LABEL) @all});"
666 my $dist_make_fragment = $MM->dist_core;
668 Puts the targets necessary for 'make dist' together into one make
677 foreach my $target (qw(dist tardist uutardist tarfile zipdist zipfile
680 my $method = $target.'_target';
682 $make_frag .= $self->$method();
691 my $make_frag = $MM->dist_target;
693 Returns the 'dist' target to make an archive for distribution. This
694 target simply checks to make sure the Makefile is up-to-date and
695 depends on $(DIST_DEFAULT).
702 my $date_check = $self->oneliner(<<'CODE', ['-l']);
703 print 'Warning: Makefile possibly out of date with $(VERSION_FROM)'
704 if -e '$(VERSION_FROM)' and -M '$(VERSION_FROM)' < -M '$(FIRST_MAKEFILE)';
707 return sprintf <<'MAKE_FRAG', $date_check;
708 dist : $(DIST_DEFAULT) $(FIRST_MAKEFILE)
713 =item B<tardist_target>
715 my $make_frag = $MM->tardist_target;
717 Returns the 'tardist' target which is simply so 'make tardist' works.
718 The real work is done by the dynamically named tardistfile_target()
719 method, tardist should have that as a dependency.
726 return <<'MAKE_FRAG';
727 tardist : $(DISTVNAME).tar$(SUFFIX)
732 =item B<zipdist_target>
734 my $make_frag = $MM->zipdist_target;
736 Returns the 'zipdist' target which is simply so 'make zipdist' works.
737 The real work is done by the dynamically named zipdistfile_target()
738 method, zipdist should have that as a dependency.
745 return <<'MAKE_FRAG';
746 zipdist : $(DISTVNAME).zip
751 =item B<tarfile_target>
753 my $make_frag = $MM->tarfile_target;
755 The name of this target is the name of the tarball generated by
756 tardist. This target does the actual work of turning the distdir into
764 return <<'MAKE_FRAG';
765 $(DISTVNAME).tar$(SUFFIX) : distdir
768 $(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME)
769 $(RM_RF) $(DISTVNAME)
770 $(COMPRESS) $(DISTVNAME).tar
777 my $make_frag = $MM->zipfile_target;
779 The name of this target is the name of the zip file generated by
780 zipdist. This target does the actual work of turning the distdir into
788 return <<'MAKE_FRAG';
789 $(DISTVNAME).zip : distdir
791 $(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME)
792 $(RM_RF) $(DISTVNAME)
797 =item uutardist_target
799 my $make_frag = $MM->uutardist_target;
801 Converts the tarfile into a uuencoded file
805 sub uutardist_target {
808 return <<'MAKE_FRAG';
809 uutardist : $(DISTVNAME).tar$(SUFFIX)
810 uuencode $(DISTVNAME).tar$(SUFFIX) $(DISTVNAME).tar$(SUFFIX) > $(DISTVNAME).tar$(SUFFIX)_uu
817 my $make_frag = $MM->shdist_target;
819 Converts the distdir into a shell archive.
826 return <<'MAKE_FRAG';
829 $(SHAR) $(DISTVNAME) > $(DISTVNAME).shar
830 $(RM_RF) $(DISTVNAME)
838 Used by some OS' to define DL_FUNCS and DL_VARS and write the *.exp files.
840 Normally just returns an empty string.
851 Defines targets for bootstrap files.
856 my($self, %attribs) = @_;
859 ' unless $self->has_link_code();
861 my $target = $Is{VMS} ? '$(MMS$TARGET)' : '$@';
863 return sprintf <<'MAKE_FRAG', ($target) x 5;
864 BOOTSTRAP = $(BASEEXT).bs
866 # As Mkbootstrap might not write a file (if none is required)
867 # we use touch to prevent make continually trying to remake it.
868 # The DynaLoader only reads a non-empty file.
869 $(BOOTSTRAP) : $(FIRST_MAKEFILE) $(BOOTDEP) $(INST_ARCHAUTODIR)$(DFSEP).exists
870 $(NOECHO) $(ECHO) "Running Mkbootstrap for $(NAME) ($(BSLOADLIBS))"
871 $(NOECHO) $(PERLRUN) \
872 "-MExtUtils::Mkbootstrap" \
873 -e "Mkbootstrap('$(BASEEXT)','$(BSLOADLIBS)');"
874 $(NOECHO) $(TOUCH) %s
875 $(CHMOD) $(PERM_RW) %s
877 $(INST_BOOT) : $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DFSEP).exists
878 $(NOECHO) $(RM_RF) %s
879 - $(CP) $(BOOTSTRAP) %s
880 $(CHMOD) $(PERM_RW) %s
884 =item dynamic_lib (o)
886 Defines how to produce the *.so (or equivalent) files.
891 my($self, %attribs) = @_;
892 return '' unless $self->needs_linking(); #might be because of a subdir
894 return '' unless $self->has_link_code;
896 my($otherldflags) = $attribs{OTHERLDFLAGS} || "";
897 my($inst_dynamic_dep) = $attribs{INST_DYNAMIC_DEP} || "";
898 my($armaybe) = $attribs{ARMAYBE} || $self->{ARMAYBE} || ":";
899 my($ldfrom) = '$(LDFROM)';
900 $armaybe = 'ar' if ($Is{OSF} and $armaybe eq ':');
902 my $ld_opt = $Is{OS2} ? '$(OPTIMIZE) ' : ''; # Useful on other systems too?
903 my $ld_fix = $Is{OS2} ? '|| ( $(RM_F) $@ && sh -c false )' : '';
905 # This section creates the dynamically loadable $(INST_DYNAMIC)
906 # from $(OBJECT) and possibly $(MYEXTLIB).
907 ARMAYBE = '.$armaybe.'
908 OTHERLDFLAGS = '.$ld_opt.$otherldflags.'
909 INST_DYNAMIC_DEP = '.$inst_dynamic_dep.'
910 INST_DYNAMIC_FIX = '.$ld_fix.'
912 $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DFSEP).exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(PERL_ARCHIVE_AFTER) $(INST_DYNAMIC_DEP)
914 if ($armaybe ne ':'){
915 $ldfrom = 'tmp$(LIB_EXT)';
916 push(@m,' $(ARMAYBE) cr '.$ldfrom.' $(OBJECT)'."\n");
917 push(@m,' $(RANLIB) '."$ldfrom\n");
919 $ldfrom = "-all $ldfrom -none" if $Is{OSF};
921 # The IRIX linker doesn't use LD_RUN_PATH
922 my $ldrun = $Is{IRIX} && $self->{LD_RUN_PATH} ?
923 qq{-rpath "$self->{LD_RUN_PATH}"} : '';
925 # For example in AIX the shared objects/libraries from previous builds
926 # linger quite a while in the shared dynalinker cache even when nobody
927 # is using them. This is painful if one for instance tries to restart
928 # a failed build because the link command will fail unnecessarily 'cos
929 # the shared object/library is 'busy'.
933 my $libs = '$(LDLOADLIBS)';
935 if (($Is{NetBSD} || $Is{Interix}) && $Config{'useshrplib'} eq 'true') {
936 # Use nothing on static perl platforms, and to the flags needed
937 # to link against the shared libperl library on shared perl
938 # platforms. We peek at lddlflags to see if we need -Wl,-R
939 # or -R to add paths to the run-time library search path.
940 if ($Config{'lddlflags'} =~ /-Wl,-R/) {
941 $libs .= ' -L$(PERL_INC) -Wl,-R$(INSTALLARCHLIB)/CORE -Wl,-R$(PERL_ARCHLIB)/CORE -lperl';
942 } elsif ($Config{'lddlflags'} =~ /-R/) {
943 $libs .= ' -L$(PERL_INC) -R$(INSTALLARCHLIB)/CORE -R$(PERL_ARCHLIB)/CORE -lperl';
947 my $ld_run_path_shell = "";
948 if ($self->{LD_RUN_PATH} ne "") {
949 $ld_run_path_shell = 'LD_RUN_PATH="$(LD_RUN_PATH)" ';
952 push @m, sprintf <<'MAKE', $ld_run_path_shell, $ldrun, $ldfrom, $libs;
953 %s$(LD) %s $(LDDLFLAGS) %s $(OTHERLDFLAGS) -o $@ $(MYEXTLIB) \
954 $(PERL_ARCHIVE) %s $(PERL_ARCHIVE_AFTER) $(EXPORT_LIST) \
959 $(CHMOD) $(PERM_RWX) $@
967 Deprecated method. Use libscan instead.
972 my($self,$path) = @_;
978 Called by init_others, and calls ext ExtUtils::Liblist. See
979 L<ExtUtils::Liblist> for details.
984 my($self,$libs) = @_;
985 require ExtUtils::Liblist;
986 $self->ext($libs, $Verbose);
991 Finds the executables PERL and FULLPERL
996 my($self, $ver, $names, $dirs, $trace) = @_;
999 print "Looking for perl $ver by these names:
1006 my $stderr_duped = 0;
1010 # >& and lexical filehandles together give 5.6.2 indigestion
1011 if( open(STDERR_COPY, '>&STDERR') ) { ## no critic
1016 find_perl() can't dup STDERR: $!
1017 You might see some garbage while we search for Perl
1022 foreach my $name (@$names){
1023 foreach my $dir (@$dirs){
1024 next unless defined $dir; # $self->{PERL_SRC} may be undefined
1026 if ($self->file_name_is_absolute($name)) { # /foo/bar
1028 } elsif ($self->canonpath($name) eq
1029 $self->canonpath(basename($name))) { # foo
1030 $abs = $self->catfile($dir, $name);
1032 $abs = $self->catfile($Curdir, $name);
1034 print "Checking $abs\n" if ($trace >= 2);
1035 next unless $self->maybe_command($abs);
1036 print "Executing $abs\n" if ($trace >= 2);
1038 my $version_check = qq{$abs -le "require $ver; print qq{VER_OK}"};
1039 $version_check = "$Config{run} $version_check"
1040 if defined $Config{run} and length $Config{run};
1042 # To avoid using the unportable 2>&1 to suppress STDERR,
1043 # we close it before running the command.
1044 # However, thanks to a thread library bug in many BSDs
1045 # ( http://www.freebsd.org/cgi/query-pr.cgi?pr=51535 )
1046 # we cannot use the fancier more portable way in here
1047 # but instead need to use the traditional 2>&1 construct.
1049 $val = `$version_check 2>&1`;
1051 close STDERR if $stderr_duped;
1052 $val = `$version_check`;
1054 # 5.6.2's 3-arg open doesn't work with >&
1055 open STDERR, ">&STDERR_COPY" ## no critic
1059 if ($val =~ /^VER_OK/m) {
1060 print "Using PERL=$abs\n" if $trace;
1062 } elsif ($trace >= 2) {
1063 print "Result: '$val' ".($? >> 8)."\n";
1067 print "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n";
1068 0; # false and not empty
1076 Inserts the sharpbang or equivalent magic number to a set of @files.
1080 sub fixin { # stolen from the pink Camel book, more or less
1081 my ( $self, @files ) = @_;
1083 for my $file (@files) {
1084 my $file_new = "$file.new";
1085 my $file_bak = "$file.bak";
1087 open( my $fixin, '<', $file ) or croak "Can't process '$file': $!";
1089 chomp( my $line = <$fixin> );
1090 next unless $line =~ s/^\s*\#!\s*//; # Not a shbang file.
1092 my $shb = $self->_fixin_replace_shebang( $file, $line );
1093 next unless defined $shb;
1095 open( my $fixout, ">", "$file_new" ) or do {
1096 warn "Can't create new $file: $!\n";
1100 # Print out the new #! line (or equivalent).
1103 print $fixout $shb, <$fixin>;
1107 chmod 0666, $file_bak;
1109 unless ( _rename( $file, $file_bak ) ) {
1110 warn "Can't rename $file to $file_bak: $!";
1113 unless ( _rename( $file_new, $file ) ) {
1114 warn "Can't rename $file_new to $file: $!";
1115 unless ( _rename( $file_bak, $file ) ) {
1116 warn "Can't rename $file_bak back to $file either: $!";
1117 warn "Leaving $file renamed as $file_bak\n";
1124 system("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';
1130 my($old, $new) = @_;
1132 foreach my $file ($old, $new) {
1133 if( $Is{VMS} and basename($file) !~ /\./ ) {
1134 # rename() in 5.8.0 on VMS will not rename a file if it
1135 # does not contain a dot yet it returns success.
1140 return rename($old, $new);
1143 sub _fixin_replace_shebang {
1144 my ( $self, $file, $line ) = @_;
1146 # Now figure out the interpreter name.
1147 my ( $cmd, $arg ) = split ' ', $line, 2;
1150 # Now look (in reverse) for interpreter in absolute PATH (unless perl).
1152 if ( $cmd =~ m{^perl(?:\z|[^a-z])} ) {
1153 if ( $Config{startperl} =~ m,^\#!.*/perl, ) {
1154 $interpreter = $Config{startperl};
1155 $interpreter =~ s,^\#!,,;
1158 $interpreter = $Config{perlpath};
1163 = reverse grep { $self->file_name_is_absolute($_) } $self->path;
1166 foreach my $dir (@absdirs) {
1167 if ( $self->maybe_command($cmd) ) {
1168 warn "Ignoring $interpreter in $file\n"
1169 if $Verbose && $interpreter;
1170 $interpreter = $self->catfile( $dir, $cmd );
1175 # Figure out how to invoke interpreter on this machine.
1177 my ($does_shbang) = $Config{'sharpbang'} =~ /^\s*\#\!/;
1180 print "Changing sharpbang in $file to $interpreter"
1182 # this is probably value-free on DOSISH platforms
1184 $shb .= "$Config{'sharpbang'}$interpreter";
1185 $shb .= ' ' . $arg if defined $arg;
1189 eval 'exec $interpreter $arg -S \$0 \${1+"\$\@"}'
1190 if 0; # not running under some shell
1191 } unless $Is{Win32}; # this won't work on win32, so don't
1194 warn "Can't find $cmd in PATH, $file unchanged"
1203 Writes an empty FORCE: target.
1209 '# Phony target to force checking subdirectories.
1217 Guess the name of this package by examining the working directory's
1218 name. MakeMaker calls this only if the developer has not supplied a
1228 my $name = basename(cwd());
1229 $name =~ s|[\-_][\d\.\-]+\z||; # this is new with MM 5.00, we
1230 # strip minus or underline
1231 # followed by a float or some such
1232 print "Warning: Guessing NAME [$name] from current directory name.\n";
1238 Returns true if C, XS, MYEXTLIB or similar objects exist within this
1239 object that need a compiler. Does not descend into subdirectories as
1240 needs_linking() does.
1246 return $self->{HAS_LINK_CODE} if defined $self->{HAS_LINK_CODE};
1247 if ($self->{OBJECT} or @{$self->{C} || []} or $self->{MYEXTLIB}){
1248 $self->{HAS_LINK_CODE} = 1;
1251 return $self->{HAS_LINK_CODE} = 0;
1257 Scans the directory structure and initializes DIR, XS, XS_FILES,
1258 C, C_FILES, O_FILES, H, H_FILES, PL_FILES, EXE_FILES.
1260 Called by init_main.
1264 sub init_dirscan { # --- File and Directory Lists (.xs .pm .pod etc)
1266 my(%dir, %xs, %c, %h, %pl_files, %pm);
1268 my %ignore = map {( $_ => 1 )} qw(Makefile.PL Build.PL test.pl t);
1270 # ignore the distdir
1271 $Is{VMS} ? $ignore{"$self->{DISTVNAME}.dir"} = 1
1272 : $ignore{$self->{DISTVNAME}} = 1;
1274 @ignore{map lc, keys %ignore} = values %ignore if $Is{VMS};
1276 foreach my $name ($self->lsdir($Curdir)){
1277 next if $name =~ /\#/;
1278 $name = lc($name) if $Is{VMS};
1279 next if $name eq $Curdir or $name eq $Updir or $ignore{$name};
1280 next unless $self->libscan($name);
1282 next if -l $name; # We do not support symlinks at all
1283 next if $self->{NORECURS};
1284 $dir{$name} = $name if (-f $self->catfile($name,"Makefile.PL"));
1285 } elsif ($name =~ /\.xs\z/){
1286 my($c); ($c = $name) =~ s/\.xs\z/.c/;
1289 } elsif ($name =~ /\.c(pp|xx|c)?\z/i){ # .c .C .cpp .cxx .cc
1291 unless $name =~ m/perlmain\.c/; # See MAP_TARGET
1292 } elsif ($name =~ /\.h\z/i){
1294 } elsif ($name =~ /\.PL\z/) {
1295 ($pl_files{$name} = $name) =~ s/\.PL\z// ;
1296 } elsif (($Is{VMS} || $Is{Dos}) && $name =~ /[._]pl$/i) {
1297 # case-insensitive filesystem, one dot per name, so foo.h.PL
1298 # under Unix appears as foo.h_pl under VMS or fooh.pl on Dos
1299 local($/); open(my $pl, '<', $name); my $txt = <$pl>; close $pl;
1300 if ($txt =~ /Extracting \S+ \(with variable substitutions/) {
1301 ($pl_files{$name} = $name) =~ s/[._]pl\z//i ;
1304 $pm{$name} = $self->catfile($self->{INST_LIBDIR},$name);
1306 } elsif ($name =~ /\.(p[ml]|pod)\z/){
1307 $pm{$name} = $self->catfile($self->{INST_LIBDIR},$name);
1311 $self->{PL_FILES} ||= \%pl_files;
1312 $self->{DIR} ||= [sort keys %dir];
1313 $self->{XS} ||= \%xs;
1314 $self->{C} ||= [sort keys %c];
1315 $self->{H} ||= [sort keys %h];
1316 $self->{PM} ||= \%pm;
1318 my @o_files = @{$self->{C}};
1319 $self->{O_FILES} = [grep s/\.c(pp|xx|c)?\z/$self->{OBJ_EXT}/i, @o_files];
1325 Determines if man pages should be generated and initializes MAN1PODS
1326 and MAN3PODS as appropriate.
1333 # Set up names of manual pages to generate from pods
1334 foreach my $man (qw(MAN1 MAN3)) {
1335 if ( $self->{"${man}PODS"}
1336 or $self->{"INSTALL${man}DIR"} =~ /^(none|\s*)$/
1338 $self->{"${man}PODS"} ||= {};
1341 my $init_method = "init_${man}PODS";
1342 $self->$init_method();
1349 my($self, $file) = @_;
1352 if (open( my $fh, '<', $file )) {
1354 if (/^=(?:head\d+|item|pod)\b/) {
1361 # If it doesn't exist yet, we assume, it has pods in it
1371 Initializes MAN1PODS from the list of EXE_FILES.
1378 if ( exists $self->{EXE_FILES} ) {
1379 foreach my $name (@{$self->{EXE_FILES}}) {
1380 next unless $self->_has_pod($name);
1382 $self->{MAN1PODS}->{$name} =
1383 $self->catfile("\$(INST_MAN1DIR)",
1384 basename($name).".\$(MAN1EXT)");
1392 Initializes MAN3PODS from the list of PM files.
1399 my %manifypods = (); # we collect the keys first, i.e. the files
1400 # we have to convert to pod
1402 foreach my $name (keys %{$self->{PM}}) {
1403 if ($name =~ /\.pod\z/ ) {
1404 $manifypods{$name} = $self->{PM}{$name};
1405 } elsif ($name =~ /\.p[ml]\z/ ) {
1406 if( $self->_has_pod($name) ) {
1407 $manifypods{$name} = $self->{PM}{$name};
1412 my $parentlibs_re = join '|', @{$self->{PMLIBPARENTDIRS}};
1414 # Remove "Configure.pm" and similar, if it's not the only pod listed
1415 # To force inclusion, just name it "Configure.pod", or override
1417 foreach my $name (keys %manifypods) {
1418 if ($self->{PERL_CORE} and $name =~ /(config|setup).*\.pm/is) {
1419 delete $manifypods{$name};
1422 my($manpagename) = $name;
1423 $manpagename =~ s/\.p(od|m|l)\z//;
1424 # everything below lib is ok
1425 unless($manpagename =~ s!^\W*($parentlibs_re)\W+!!s) {
1426 $manpagename = $self->catfile(
1427 split(/::/,$self->{PARENT_NAME}),$manpagename
1430 $manpagename = $self->replace_manpage_separator($manpagename);
1431 $self->{MAN3PODS}->{$name} =
1432 $self->catfile("\$(INST_MAN3DIR)", "$manpagename.\$(MAN3EXT)");
1439 Initializes PMLIBDIRS and PM from PMLIBDIRS.
1446 # Some larger extensions often wish to install a number of *.pm/pl
1447 # files into the library in various locations.
1449 # The attribute PMLIBDIRS holds an array reference which lists
1450 # subdirectories which we should search for library files to
1451 # install. PMLIBDIRS defaults to [ 'lib', $self->{BASEEXT} ]. We
1452 # recursively search through the named directories (skipping any
1453 # which don't exist or contain Makefile.PL files).
1455 # For each *.pm or *.pl file found $self->libscan() is called with
1456 # the default installation path in $_[1]. The return value of
1457 # libscan defines the actual installation location. The default
1458 # libscan function simply returns the path. The file is skipped
1459 # if libscan returns false.
1461 # The default installation location passed to libscan in $_[1] is:
1463 # ./*.pm => $(INST_LIBDIR)/*.pm
1464 # ./xyz/... => $(INST_LIBDIR)/xyz/...
1465 # ./lib/... => $(INST_LIB)/...
1467 # In this way the 'lib' directory is seen as the root of the actual
1468 # perl library whereas the others are relative to INST_LIBDIR
1469 # (which includes PARENT_NAME). This is a subtle distinction but one
1470 # that's important for nested modules.
1472 unless( $self->{PMLIBDIRS} ) {
1474 # Avoid logical name vs directory collisions
1475 $self->{PMLIBDIRS} = ['./lib', "./$self->{BASEEXT}"];
1478 $self->{PMLIBDIRS} = ['lib', $self->{BASEEXT}];
1482 #only existing directories that aren't in $dir are allowed
1484 # Avoid $_ wherever possible:
1485 # @{$self->{PMLIBDIRS}} = grep -d && !$dir{$_}, @{$self->{PMLIBDIRS}};
1486 my (@pmlibdirs) = @{$self->{PMLIBDIRS}};
1487 @{$self->{PMLIBDIRS}} = ();
1488 my %dir = map { ($_ => $_) } @{$self->{DIR}};
1489 foreach my $pmlibdir (@pmlibdirs) {
1490 -d $pmlibdir && !$dir{$pmlibdir} && push @{$self->{PMLIBDIRS}}, $pmlibdir;
1493 unless( $self->{PMLIBPARENTDIRS} ) {
1494 @{$self->{PMLIBPARENTDIRS}} = ('lib');
1497 return if $self->{PM} and $self->{ARGS}{PM};
1499 if (@{$self->{PMLIBDIRS}}){
1500 print "Searching PMLIBDIRS: @{$self->{PMLIBDIRS}}\n"
1503 File::Find::find(sub {
1505 unless ($self->libscan($_)){
1506 $File::Find::prune = 1;
1511 return if /~$/; # emacs temp files
1512 return if /,v$/; # RCS files
1513 return if m{\.swp$}; # vim swap files
1515 my $path = $File::Find::name;
1516 my $prefix = $self->{INST_LIBDIR};
1519 my $parentlibs_re = join '|', @{$self->{PMLIBPARENTDIRS}};
1520 $prefix = $self->{INST_LIB}
1521 if ($striplibpath = $path) =~ s{^(\W*)($parentlibs_re)\W}
1524 my($inst) = $self->catfile($prefix,$striplibpath);
1525 local($_) = $inst; # for backwards compatibility
1526 $inst = $self->libscan($inst);
1527 print "libscan($path) => '$inst'\n" if ($Verbose >= 2);
1528 return unless $inst;
1529 $self->{PM}{$path} = $inst;
1530 }, @{$self->{PMLIBDIRS}});
1535 =item init_DIRFILESEP
1537 Using / for Unix. Called by init_main.
1541 sub init_DIRFILESEP {
1544 $self->{DIRFILESEP} = '/';
1550 Initializes AR, AR_STATIC_ARGS, BASEEXT, CONFIG, DISTNAME, DLBASE,
1551 EXE_EXT, FULLEXT, FULLPERL, FULLPERLRUN, FULLPERLRUNINST, INST_*,
1552 INSTALL*, INSTALLDIRS, LIB_EXT, LIBPERL_A, MAP_TARGET, NAME,
1553 OBJ_EXT, PARENT_NAME, PERL, PERL_ARCHLIB, PERL_INC, PERL_LIB,
1554 PERL_SRC, PERLRUN, PERLRUNINST, PREFIX, VERSION,
1555 VERSION_SYM, XS_VERSION.
1562 # --- Initialize Module Name and Paths
1564 # NAME = Foo::Bar::Oracle
1565 # FULLEXT = Foo/Bar/Oracle
1567 # PARENT_NAME = Foo::Bar
1569 ### ($self->{FULLEXT} =
1570 ### $self->{NAME}) =~ s!::!/!g ; #eg. BSD/Foo/Socket
1571 $self->{FULLEXT} = $self->catdir(split /::/, $self->{NAME});
1574 # Copied from DynaLoader:
1576 my(@modparts) = split(/::/,$self->{NAME});
1577 my($modfname) = $modparts[-1];
1579 # Some systems have restrictions on files names for DLL's etc.
1580 # mod2fname returns appropriate file base name (typically truncated)
1581 # It may also edit @modparts if required.
1582 if (defined &DynaLoader::mod2fname) {
1583 $modfname = &DynaLoader::mod2fname(\@modparts);
1586 ($self->{PARENT_NAME}, $self->{BASEEXT}) = $self->{NAME} =~ m!(?:([\w:]+)::)?(\w+)\z! ;
1587 $self->{PARENT_NAME} ||= '';
1589 if (defined &DynaLoader::mod2fname) {
1590 # As of 5.001m, dl_os2 appends '_'
1591 $self->{DLBASE} = $modfname;
1593 $self->{DLBASE} = '$(BASEEXT)';
1597 # --- Initialize PERL_LIB, PERL_SRC
1599 # *Real* information: where did we get these two from? ...
1600 my $inc_config_dir = dirname($INC{'Config.pm'});
1601 my $inc_carp_dir = dirname($INC{'Carp.pm'});
1603 unless ($self->{PERL_SRC}){
1604 foreach my $dir_count (1..8) { # 8 is the VMS limit for nesting
1605 my $dir = $self->catdir(($Updir) x $dir_count);
1607 if (-f $self->catfile($dir,"config_h.SH") &&
1608 -f $self->catfile($dir,"perl.h") &&
1609 -f $self->catfile($dir,"lib","strict.pm")
1611 $self->{PERL_SRC}=$dir ;
1617 warn "PERL_CORE is set but I can't find your PERL_SRC!\n" if
1618 $self->{PERL_CORE} and !$self->{PERL_SRC};
1620 if ($self->{PERL_SRC}){
1621 $self->{PERL_LIB} ||= $self->catdir("$self->{PERL_SRC}","lib");
1623 if (defined $Cross::platform) {
1624 $self->{PERL_ARCHLIB} =
1625 $self->catdir("$self->{PERL_SRC}","xlib",$Cross::platform);
1627 $self->catdir("$self->{PERL_SRC}","xlib",$Cross::platform,
1628 $Is{Win32}?("CORE"):());
1631 $self->{PERL_ARCHLIB} = $self->{PERL_LIB};
1632 $self->{PERL_INC} = ($Is{Win32}) ?
1633 $self->catdir($self->{PERL_LIB},"CORE") : $self->{PERL_SRC};
1636 # catch a situation that has occurred a few times in the past:
1638 -s $self->catfile($self->{PERL_SRC},'cflags')
1642 -s $self->catfile($self->{PERL_SRC},'vmsish.h')
1647 You cannot build extensions below the perl source tree after executing
1648 a 'make clean' in the perl source tree.
1650 To rebuild extensions distributed with the perl source you should
1651 simply Configure (to include those extensions) and then build perl as
1652 normal. After installing perl the source tree can be deleted. It is
1653 not needed for building extensions by running 'perl Makefile.PL'
1654 usually without extra arguments.
1656 It is recommended that you unpack and build additional extensions away
1657 from the perl source tree.
1661 # we should also consider $ENV{PERL5LIB} here
1662 my $old = $self->{PERL_LIB} || $self->{PERL_ARCHLIB} || $self->{PERL_INC};
1663 $self->{PERL_LIB} ||= $Config{privlibexp};
1664 $self->{PERL_ARCHLIB} ||= $Config{archlibexp};
1665 $self->{PERL_INC} = $self->catdir("$self->{PERL_ARCHLIB}","CORE"); # wild guess for now
1668 if (not -f ($perl_h = $self->catfile($self->{PERL_INC},"perl.h"))
1670 # Maybe somebody tries to build an extension with an
1671 # uninstalled Perl outside of Perl build tree
1673 for my $dir (@INC) {
1674 $lib = $dir, last if -e $self->catfile($dir, "Config.pm");
1677 # Win32 puts its header files in /perl/src/lib/CORE.
1678 # Unix leaves them in /perl/src.
1679 my $inc = $Is{Win32} ? $self->catdir($lib, "CORE" )
1681 if (-e $self->catfile($inc, "perl.h")) {
1682 $self->{PERL_LIB} = $lib;
1683 $self->{PERL_ARCHLIB} = $lib;
1684 $self->{PERL_INC} = $inc;
1685 $self->{UNINSTALLED_PERL} = 1;
1687 ... Detected uninstalled Perl. Trying to continue.
1694 # We get SITELIBEXP and SITEARCHEXP directly via
1695 # Get_from_Config. When we are running standard modules, these
1696 # won't matter, we will set INSTALLDIRS to "perl". Otherwise we
1697 # set it to "site". I prefer that INSTALLDIRS be set from outside
1699 $self->{INSTALLDIRS} ||= "site";
1701 $self->{MAN1EXT} ||= $Config{man1ext};
1702 $self->{MAN3EXT} ||= $Config{man3ext};
1704 # Get some stuff out of %Config if we haven't yet done so
1705 print "CONFIG must be an array ref\n"
1706 if ($self->{CONFIG} and ref $self->{CONFIG} ne 'ARRAY');
1707 $self->{CONFIG} = [] unless (ref $self->{CONFIG});
1708 push(@{$self->{CONFIG}}, @ExtUtils::MakeMaker::Get_from_Config);
1709 push(@{$self->{CONFIG}}, 'shellflags') if $Config{shellflags};
1711 foreach my $m (@{$self->{CONFIG}}){
1712 next if $once_only{$m};
1713 print "CONFIG key '$m' does not exist in Config.pm\n"
1714 unless exists $Config{$m};
1715 $self->{uc $m} ||= $Config{$m};
1719 # This is too dangerous:
1720 # if ($^O eq "next") {
1721 # $self->{AR} = "libtool";
1722 # $self->{AR_STATIC_ARGS} = "-o";
1724 # But I leave it as a placeholder
1726 $self->{AR_STATIC_ARGS} ||= "cr";
1728 # These should never be needed
1729 $self->{OBJ_EXT} ||= '.o';
1730 $self->{LIB_EXT} ||= '.a';
1732 $self->{MAP_TARGET} ||= "perl";
1734 $self->{LIBPERL_A} ||= "libperl$self->{LIB_EXT}";
1736 # make a simple check if we find strict
1737 warn "Warning: PERL_LIB ($self->{PERL_LIB}) seems not to be a perl library directory
1738 (strict.pm not found)"
1739 unless -f $self->catfile("$self->{PERL_LIB}","strict.pm") ||
1740 $self->{NAME} eq "ExtUtils::MakeMaker";
1745 Initializes tools to use their common (and faster) Unix commands.
1752 $self->{ECHO} ||= 'echo';
1753 $self->{ECHO_N} ||= 'echo -n';
1754 $self->{RM_F} ||= "rm -f";
1755 $self->{RM_RF} ||= "rm -rf";
1756 $self->{TOUCH} ||= "touch";
1757 $self->{TEST_F} ||= "test -f";
1758 $self->{CP} ||= "cp";
1759 $self->{MV} ||= "mv";
1760 $self->{CHMOD} ||= "chmod";
1761 $self->{FALSE} ||= 'false';
1762 $self->{TRUE} ||= 'true';
1764 $self->{LD} ||= 'ld';
1766 return $self->SUPER::init_tools(@_);
1768 # After SUPER::init_tools so $Config{shell} has a
1769 # chance to get set.
1770 $self->{SHELL} ||= '/bin/sh';
1778 Unix has no need of special linker flags.
1784 $self->{PERL_ARCHIVE} ||= '';
1785 $self->{PERL_ARCHIVE_AFTER} ||= '';
1786 $self->{EXPORT_LIST} ||= '';
1803 # The user who requests an installation directory explicitly
1804 # should not have to tell us an architecture installation directory
1805 # as well. We look if a directory exists that is named after the
1806 # architecture. If not we take it as a sign that it should be the
1807 # same as the requested installation directory. Otherwise we take
1809 for my $libpair ({l=>"privlib", a=>"archlib"},
1810 {l=>"sitelib", a=>"sitearch"},
1811 {l=>"vendorlib", a=>"vendorarch"},
1814 my $lib = "install$libpair->{l}";
1816 my $Arch = uc "install$libpair->{a}";
1817 if( $self->{$Lib} && ! $self->{$Arch} ){
1818 my($ilib) = $Config{$lib};
1820 $self->prefixify($Arch,$ilib,$self->{$Lib});
1822 unless (-d $self->{$Arch}) {
1823 print "Directory $self->{$Arch} not found\n"
1825 $self->{$Arch} = $self->{$Lib};
1827 print "Defaulting $Arch to $self->{$Arch}\n" if $Verbose;
1837 Called by init_main. Sets up ABSPERL, PERL, FULLPERL and all the
1838 *PERLRUN* permutations.
1840 PERL is allowed to be miniperl
1841 FULLPERL must be a complete perl
1843 ABSPERL is PERL converted to an absolute path
1845 *PERLRUN contains everything necessary to run perl, find it's
1848 *PERLRUNINST is *PERLRUN + everything necessary to find the
1849 modules being built.
1857 foreach my $component ($self->{PERL_SRC}, $self->path(),
1860 push @defpath, $component if defined $component;
1863 # Build up a set of file names (not command names).
1864 my $thisperl = $self->canonpath($^X);
1865 $thisperl .= $Config{exe_ext} unless
1866 # VMS might have a file version # at the end
1867 $Is{VMS} ? $thisperl =~ m/$Config{exe_ext}(;\d+)?$/i
1868 : $thisperl =~ m/$Config{exe_ext}$/i;
1870 # We need a relative path to perl when in the core.
1871 $thisperl = $self->abs2rel($thisperl) if $self->{PERL_CORE};
1873 my @perls = ($thisperl);
1874 push @perls, map { "$_$Config{exe_ext}" }
1875 ('perl', 'perl5', "perl$Config{version}");
1877 # miniperl has priority over all but the cannonical perl when in the
1878 # core. Otherwise its a last resort.
1879 my $miniperl = "miniperl$Config{exe_ext}";
1880 if( $self->{PERL_CORE} ) {
1881 splice @perls, 1, 0, $miniperl;
1884 push @perls, $miniperl;
1888 $self->find_perl(5.0, \@perls, \@defpath, $Verbose );
1889 # don't check if perl is executable, maybe they have decided to
1890 # supply switches with perl
1892 # When built for debugging, VMS doesn't create perl.exe but ndbgperl.exe.
1893 my $perl_name = 'perl';
1894 $perl_name = 'ndbgperl' if $Is{VMS} &&
1895 defined $Config{usevmsdebug} && $Config{usevmsdebug} eq 'define';
1897 # XXX This logic is flawed. If "miniperl" is anywhere in the path
1898 # it will get confused. It should be fixed to work only on the filename.
1899 # Define 'FULLPERL' to be a non-miniperl (used in test: target)
1900 ($self->{FULLPERL} = $self->{PERL}) =~ s/miniperl/$perl_name/i
1901 unless $self->{FULLPERL};
1903 # Little hack to get around VMS's find_perl putting "MCR" in front
1905 $self->{ABSPERL} = $self->{PERL};
1906 my $has_mcr = $self->{ABSPERL} =~ s/^MCR\s*//;
1907 if( $self->file_name_is_absolute($self->{ABSPERL}) ) {
1908 $self->{ABSPERL} = '$(PERL)';
1911 $self->{ABSPERL} = $self->rel2abs($self->{ABSPERL});
1913 # Quote the perl command if it contains whitespace
1914 $self->{ABSPERL} = $self->quote_literal($self->{ABSPERL})
1915 if $self->{ABSPERL} =~ /\s/;
1917 $self->{ABSPERL} = 'MCR '.$self->{ABSPERL} if $has_mcr;
1920 # Are we building the core?
1921 $self->{PERL_CORE} = $ENV{PERL_CORE} unless exists $self->{PERL_CORE};
1922 $self->{PERL_CORE} = 0 unless defined $self->{PERL_CORE};
1924 # How do we run perl?
1925 foreach my $perl (qw(PERL FULLPERL ABSPERL)) {
1926 my $run = $perl.'RUN';
1928 $self->{$run} = "\$($perl)";
1930 # Make sure perl can find itself before it's installed.
1931 $self->{$run} .= q{ "-I$(PERL_LIB)" "-I$(PERL_ARCHLIB)"}
1932 if $self->{UNINSTALLED_PERL} || $self->{PERL_CORE};
1934 $self->{$perl.'RUNINST'} =
1935 sprintf q{$(%sRUN) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)"}, $perl;
1944 =item platform_constants
1946 Add MM_Unix_VERSION.
1953 $self->{MM_Unix_VERSION} = $VERSION;
1954 $self->{PERL_MALLOC_DEF} = '-DPERL_EXTMALLOC_DEF -Dmalloc=Perl_malloc '.
1955 '-Dfree=Perl_mfree -Drealloc=Perl_realloc '.
1956 '-Dcalloc=Perl_calloc';
1960 sub platform_constants {
1964 foreach my $macro (qw(MM_Unix_VERSION PERL_MALLOC_DEF))
1966 next unless defined $self->{$macro};
1967 $make_frag .= "$macro = $self->{$macro}\n";
1978 Called by init_main. Initializes PERL_*
1985 $self->{PERM_DIR} = 755 unless defined $self->{PERM_DIR};
1986 $self->{PERM_RW} = 644 unless defined $self->{PERM_RW};
1987 $self->{PERM_RWX} = 755 unless defined $self->{PERM_RWX};
1997 Sets up macros having to do with XS code. Currently just INST_STATIC,
1998 INST_DYNAMIC and INST_BOOT.
2005 if ($self->has_link_code()) {
2006 $self->{INST_STATIC} =
2007 $self->catfile('$(INST_ARCHAUTODIR)', '$(BASEEXT)$(LIB_EXT)');
2008 $self->{INST_DYNAMIC} =
2009 $self->catfile('$(INST_ARCHAUTODIR)', '$(DLBASE).$(DLEXT)');
2010 $self->{INST_BOOT} =
2011 $self->catfile('$(INST_ARCHAUTODIR)', '$(BASEEXT).bs');
2013 $self->{INST_STATIC} = '';
2014 $self->{INST_DYNAMIC} = '';
2015 $self->{INST_BOOT} = '';
2021 Defines the install target.
2026 my($self, %attribs) = @_;
2030 install :: pure_install doc_install
2033 install_perl :: pure_perl_install doc_perl_install
2036 install_site :: pure_site_install doc_site_install
2039 install_vendor :: pure_vendor_install doc_vendor_install
2042 pure_install :: pure_$(INSTALLDIRS)_install
2045 doc_install :: doc_$(INSTALLDIRS)_install
2048 pure__install : pure_site_install
2049 $(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
2051 doc__install : doc_site_install
2052 $(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
2054 pure_perl_install :: all
2055 $(NOECHO) $(MOD_INSTALL) \
2056 read }.$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q{ \
2057 write }.$self->catfile('$(DESTINSTALLARCHLIB)','auto','$(FULLEXT)','.packlist').q{ \
2058 $(INST_LIB) $(DESTINSTALLPRIVLIB) \
2059 $(INST_ARCHLIB) $(DESTINSTALLARCHLIB) \
2060 $(INST_BIN) $(DESTINSTALLBIN) \
2061 $(INST_SCRIPT) $(DESTINSTALLSCRIPT) \
2062 $(INST_MAN1DIR) $(DESTINSTALLMAN1DIR) \
2063 $(INST_MAN3DIR) $(DESTINSTALLMAN3DIR)
2064 $(NOECHO) $(WARN_IF_OLD_PACKLIST) \
2065 }.$self->catdir('$(SITEARCHEXP)','auto','$(FULLEXT)').q{
2068 pure_site_install :: all
2069 $(NOECHO) $(MOD_INSTALL) \
2070 read }.$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q{ \
2071 write }.$self->catfile('$(DESTINSTALLSITEARCH)','auto','$(FULLEXT)','.packlist').q{ \
2072 $(INST_LIB) $(DESTINSTALLSITELIB) \
2073 $(INST_ARCHLIB) $(DESTINSTALLSITEARCH) \
2074 $(INST_BIN) $(DESTINSTALLSITEBIN) \
2075 $(INST_SCRIPT) $(DESTINSTALLSITESCRIPT) \
2076 $(INST_MAN1DIR) $(DESTINSTALLSITEMAN1DIR) \
2077 $(INST_MAN3DIR) $(DESTINSTALLSITEMAN3DIR)
2078 $(NOECHO) $(WARN_IF_OLD_PACKLIST) \
2079 }.$self->catdir('$(PERL_ARCHLIB)','auto','$(FULLEXT)').q{
2081 pure_vendor_install :: all
2082 $(NOECHO) $(MOD_INSTALL) \
2083 read }.$self->catfile('$(VENDORARCHEXP)','auto','$(FULLEXT)','.packlist').q{ \
2084 write }.$self->catfile('$(DESTINSTALLVENDORARCH)','auto','$(FULLEXT)','.packlist').q{ \
2085 $(INST_LIB) $(DESTINSTALLVENDORLIB) \
2086 $(INST_ARCHLIB) $(DESTINSTALLVENDORARCH) \
2087 $(INST_BIN) $(DESTINSTALLVENDORBIN) \
2088 $(INST_SCRIPT) $(DESTINSTALLVENDORSCRIPT) \
2089 $(INST_MAN1DIR) $(DESTINSTALLVENDORMAN1DIR) \
2090 $(INST_MAN3DIR) $(DESTINSTALLVENDORMAN3DIR)
2092 doc_perl_install :: all
2093 $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod
2094 -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB)
2095 -$(NOECHO) $(DOC_INSTALL) \
2096 "Module" "$(NAME)" \
2097 "installed into" "$(INSTALLPRIVLIB)" \
2098 LINKTYPE "$(LINKTYPE)" \
2099 VERSION "$(VERSION)" \
2100 EXE_FILES "$(EXE_FILES)" \
2101 >> }.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{
2103 doc_site_install :: all
2104 $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod
2105 -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB)
2106 -$(NOECHO) $(DOC_INSTALL) \
2107 "Module" "$(NAME)" \
2108 "installed into" "$(INSTALLSITELIB)" \
2109 LINKTYPE "$(LINKTYPE)" \
2110 VERSION "$(VERSION)" \
2111 EXE_FILES "$(EXE_FILES)" \
2112 >> }.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{
2114 doc_vendor_install :: all
2115 $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod
2116 -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB)
2117 -$(NOECHO) $(DOC_INSTALL) \
2118 "Module" "$(NAME)" \
2119 "installed into" "$(INSTALLVENDORLIB)" \
2120 LINKTYPE "$(LINKTYPE)" \
2121 VERSION "$(VERSION)" \
2122 EXE_FILES "$(EXE_FILES)" \
2123 >> }.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{
2128 uninstall :: uninstall_from_$(INSTALLDIRS)dirs
2131 uninstall_from_perldirs ::
2132 $(NOECHO) $(UNINSTALL) }.$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q{
2134 uninstall_from_sitedirs ::
2135 $(NOECHO) $(UNINSTALL) }.$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q{
2137 uninstall_from_vendordirs ::
2138 $(NOECHO) $(UNINSTALL) }.$self->catfile('$(VENDORARCHEXP)','auto','$(FULLEXT)','.packlist').q{
2144 =item installbin (o)
2146 Defines targets to make and to install EXE_FILES.
2153 return "" unless $self->{EXE_FILES} && ref $self->{EXE_FILES} eq "ARRAY";
2154 my @exefiles = @{$self->{EXE_FILES}};
2155 return "" unless @exefiles;
2157 @exefiles = map vmsify($_), @exefiles if $Is{VMS};
2160 for my $from (@exefiles) {
2161 my($path)= $self->catfile('$(INST_SCRIPT)', basename($from));
2163 local($_) = $path; # for backwards compatibility
2164 my $to = $self->libscan($path);
2165 print "libscan($from) => '$to'\n" if ($Verbose >=2);
2167 $to = vmsify($to) if $Is{VMS};
2168 $fromto{$from} = $to;
2170 my @to = values %fromto;
2174 EXE_FILES = @exefiles
2182 # realclean can get rather large.
2183 push @m, map "\t$_\n", $self->split_command('$(RM_F)', @to);
2187 # A target for each exe file.
2188 while (my($from,$to) = each %fromto) {
2189 last unless defined $from;
2191 push @m, sprintf <<'MAKE', $to, $from, $to, $from, $to, $to, $to;
2192 %s : %s $(FIRST_MAKEFILE) $(INST_SCRIPT)$(DFSEP).exists $(INST_BIN)$(DFSEP).exists
2193 $(NOECHO) $(RM_F) %s
2196 -$(NOECHO) $(CHMOD) $(PERM_RWX) %s
2208 Defines the linkext target which in turn defines the LINKTYPE.
2213 my($self, %attribs) = @_;
2214 # LINKTYPE => static or dynamic or ''
2215 my($linktype) = defined $attribs{LINKTYPE} ?
2216 $attribs{LINKTYPE} : '$(LINKTYPE)';
2218 linkext :: $linktype
2225 Takes as arguments a directory name and a regular expression. Returns
2226 all entries in the directory that match the regular expression.
2232 my($dir, $regex) = @_;
2234 my $dh = new DirHandle;
2235 $dh->open($dir || ".") or return ();
2238 @ls = grep(/$regex/, @ls) if $regex;
2244 Simple subroutine to insert the macros defined by the macro attribute
2250 my($self,%attribs) = @_;
2252 while (($key,$val) = each %attribs){
2253 last unless defined $key;
2254 push @m, "$key = $val\n";
2261 Called by staticmake. Defines how to write the Makefile to produce a
2264 By default the Makefile produced includes all the static extensions in
2265 the perl library. (Purified versions of library files, e.g.,
2266 DynaLoader_pure_p1_c0_032.a are automatically ignored to avoid link errors.)
2271 my($self, %attribs) = @_;
2272 my($makefilename, $searchdirs, $static, $extra, $perlinc, $target, $tmp, $libperl) =
2273 @attribs{qw(MAKE DIRS STAT EXTRA INCL TARGET TMP LIBPERL)};
2276 # --- MakeMaker makeaperl section ---
2277 MAP_TARGET = $target
2278 FULLPERL = $self->{FULLPERL}
2280 return join '', @m if $self->{PARENT};
2282 my($dir) = join ":", @{$self->{DIR}};
2284 unless ($self->{MAKEAPERL}) {
2286 $(MAP_TARGET) :: static $(MAKE_APERL_FILE)
2287 $(MAKE) $(USEMAKEFILE) $(MAKE_APERL_FILE) $@
2289 $(MAKE_APERL_FILE) : $(FIRST_MAKEFILE) pm_to_blib
2290 $(NOECHO) $(ECHO) Writing \"$(MAKE_APERL_FILE)\" for this $(MAP_TARGET)
2291 $(NOECHO) $(PERLRUNINST) \
2292 Makefile.PL DIR=}, $dir, q{ \
2293 MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \
2294 MAKEAPERL=1 NORECURS=1 CCCDLFLAGS=};
2300 push @m, " \\\n\t\t$_";
2302 # push @m, map( " \\\n\t\t$_", @ARGV );
2310 my($cccmd, $linkcmd, $lperl);
2313 $cccmd = $self->const_cccmd($libperl);
2314 $cccmd =~ s/^CCCMD\s*=\s*//;
2315 $cccmd =~ s/\$\(INC\)/ "-I$self->{PERL_INC}" /;
2316 $cccmd .= " $Config{cccdlflags}"
2317 if ($Config{useshrplib} eq 'true');
2318 $cccmd =~ s/\(CC\)/\(PERLMAINCC\)/;
2320 # The front matter of the linkcommand...
2321 $linkcmd = join ' ', "\$(CC)",
2322 grep($_, @Config{qw(ldflags ccdlflags)});
2323 $linkcmd =~ s/\s+/ /g;
2324 $linkcmd =~ s,(perl\.exp),\$(PERL_INC)/$1,;
2326 # Which *.a files could we make use of...
2329 File::Find::find(sub {
2330 return unless m/\Q$self->{LIB_EXT}\E$/;
2332 # Skip perl's libraries.
2333 return if m/^libperl/ or m/^perl\Q$self->{LIB_EXT}\E$/;
2335 # Skip purified versions of libraries
2336 # (e.g., DynaLoader_pure_p1_c0_032.a)
2337 return if m/_pure_\w+_\w+_\w+\.\w+$/ and -f "$File::Find::dir/.pure";
2339 if( exists $self->{INCLUDE_EXT} ){
2342 (my $xx = $File::Find::name) =~ s,.*?/auto/,,s;
2346 # Throw away anything not explicitly marked for inclusion.
2347 # DynaLoader is implied.
2348 foreach my $incl ((@{$self->{INCLUDE_EXT}},'DynaLoader')){
2354 return unless $found;
2356 elsif( exists $self->{EXCLUDE_EXT} ){
2357 (my $xx = $File::Find::name) =~ s,.*?/auto/,,s;
2361 # Throw away anything explicitly marked for exclusion
2362 foreach my $excl (@{$self->{EXCLUDE_EXT}}){
2363 return if( $xx eq $excl );
2367 # don't include the installed version of this extension. I
2368 # leave this line here, although it is not necessary anymore:
2369 # I patched minimod.PL instead, so that Miniperl.pm won't
2370 # enclude duplicates
2372 # Once the patch to minimod.PL is in the distribution, I can
2374 return if $File::Find::name =~ m:auto/$self->{FULLEXT}/$self->{BASEEXT}$self->{LIB_EXT}\z:;
2376 $static{cwd() . "/" . $_}++;
2377 }, grep( -d $_, @{$searchdirs || []}) );
2379 # We trust that what has been handed in as argument, will be buildable
2380 $static = [] unless $static;
2381 @static{@{$static}} = (1) x @{$static};
2383 $extra = [] unless $extra && ref $extra eq 'ARRAY';
2384 for (sort keys %static) {
2385 next unless /\Q$self->{LIB_EXT}\E\z/;
2386 $_ = dirname($_) . "/extralibs.ld";
2390 s/^(.*)/"-I$1"/ for @{$perlinc || []};
2395 # MAP_STATIC doesn't look into subdirs yet. Once "all" is made and we
2396 # regenerate the Makefiles, MAP_STATIC and the dependencies for
2397 # extralibs.all are computed correctly
2399 MAP_LINKCMD = $linkcmd
2400 MAP_PERLINC = @{$perlinc || []}
2402 join(" \\\n\t", reverse sort keys %static), "
2404 MAP_PRELIBS = $Config{perllibs} $Config{cryptlib}
2407 if (defined $libperl) {
2408 ($lperl = $libperl) =~ s/\$\(A\)/$self->{LIB_EXT}/;
2410 unless ($libperl && -f $lperl) { # Ilya's code...
2411 my $dir = $self->{PERL_SRC} || "$self->{PERL_ARCHLIB}/CORE";
2412 $dir = "$self->{PERL_ARCHLIB}/.." if $self->{UNINSTALLED_PERL};
2413 $libperl ||= "libperl$self->{LIB_EXT}";
2414 $libperl = "$dir/$libperl";
2415 $lperl ||= "libperl$self->{LIB_EXT}";
2416 $lperl = "$dir/$lperl";
2418 if (! -f $libperl and ! -f $lperl) {
2419 # We did not find a static libperl. Maybe there is a shared one?
2421 $lperl = $libperl = "$dir/$Config{libperl}";
2422 # SUNOS ld does not take the full path to a shared library
2423 $libperl = '' if $Is{SunOS4};
2427 print "Warning: $libperl not found
2428 If you're going to build a static perl binary, make sure perl is installed
2429 otherwise ignore this warning\n"
2430 unless (-f $lperl || defined($self->{PERL_SRC}));
2433 # SUNOS ld does not take the full path to a shared library
2434 my $llibperl = $libperl ? '$(MAP_LIBPERL)' : '-lperl';
2437 MAP_LIBPERL = $libperl
2438 LLIBPERL = $llibperl
2442 $(INST_ARCHAUTODIR)/extralibs.all : $(INST_ARCHAUTODIR)$(DFSEP).exists '.join(" \\\n\t", @$extra).'
2443 $(NOECHO) $(RM_F) $@
2444 $(NOECHO) $(TOUCH) $@
2447 foreach my $catfile (@$extra){
2448 push @m, "\tcat $catfile >> \$\@\n";
2452 \$(MAP_TARGET) :: $tmp/perlmain\$(OBJ_EXT) \$(MAP_LIBPERL) \$(MAP_STATIC) \$(INST_ARCHAUTODIR)/extralibs.all
2453 \$(MAP_LINKCMD) -o \$\@ \$(OPTIMIZE) $tmp/perlmain\$(OBJ_EXT) \$(LDFROM) \$(MAP_STATIC) \$(LLIBPERL) `cat \$(INST_ARCHAUTODIR)/extralibs.all` \$(MAP_PRELIBS)
2454 \$(NOECHO) \$(ECHO) 'To install the new \"\$(MAP_TARGET)\" binary, call'
2455 \$(NOECHO) \$(ECHO) ' \$(MAKE) \$(USEMAKEFILE) $makefilename inst_perl MAP_TARGET=\$(MAP_TARGET)'
2456 \$(NOECHO) \$(ECHO) 'To remove the intermediate files say'
2457 \$(NOECHO) \$(ECHO) ' \$(MAKE) \$(USEMAKEFILE) $makefilename map_clean'
2459 $tmp/perlmain\$(OBJ_EXT): $tmp/perlmain.c
2461 push @m, "\t".$self->cd($tmp, qq[$cccmd "-I\$(PERL_INC)" perlmain.c])."\n";
2464 $tmp/perlmain.c: $makefilename}, q{
2465 $(NOECHO) $(ECHO) Writing $@
2466 $(NOECHO) $(PERL) $(MAP_PERLINC) "-MExtUtils::Miniperl" \\
2467 -e "writemain(grep s#.*/auto/##s, split(q| |, q|$(MAP_STATIC)|))" > $@t && $(MV) $@t $@
2470 push @m, "\t", q{$(NOECHO) $(PERL) $(INSTALLSCRIPT)/fixpmain
2471 } if (defined (&Dos::UseLFN) && Dos::UseLFN()==0);
2476 $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod
2477 -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB)
2478 -$(NOECHO) $(DOC_INSTALL) \
2479 "Perl binary" "$(MAP_TARGET)" \
2480 MAP_STATIC "$(MAP_STATIC)" \
2481 MAP_EXTRA "`cat $(INST_ARCHAUTODIR)/extralibs.all`" \
2482 MAP_LIBPERL "$(MAP_LIBPERL)" \
2483 >> }.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{
2488 inst_perl : pure_inst_perl doc_inst_perl
2490 pure_inst_perl : $(MAP_TARGET)
2491 }.$self->{CP}.q{ $(MAP_TARGET) }.$self->catfile('$(DESTINSTALLBIN)','$(MAP_TARGET)').q{
2496 }.$self->{RM_F}.qq{ $tmp/perlmain\$(OBJ_EXT) $tmp/perlmain.c \$(MAP_TARGET) $makefilename \$(INST_ARCHAUTODIR)/extralibs.all
2504 Defines how to rewrite the Makefile.
2511 # We do not know what target was originally specified so we
2512 # must force a manual rerun to be sure. But as it should only
2513 # happen very rarely it is not a significant problem.
2515 $(OBJECT) : $(FIRST_MAKEFILE)
2517 ' if $self->{OBJECT};
2519 my $newer_than_target = $Is{VMS} ? '$(MMS$SOURCE_LIST)' : '$?';
2520 my $mpl_args = join " ", map qq["$_"], @ARGV;
2522 $m .= sprintf <<'MAKE_FRAG', $newer_than_target, $mpl_args;
2523 # We take a very conservative approach here, but it's worth it.
2524 # We move Makefile to Makefile.old here to avoid gnu make looping.
2525 $(FIRST_MAKEFILE) : Makefile.PL $(CONFIGDEP)
2526 $(NOECHO) $(ECHO) "Makefile out-of-date with respect to %s"
2527 $(NOECHO) $(ECHO) "Cleaning current config before rebuilding Makefile..."
2528 -$(NOECHO) $(RM_F) $(MAKEFILE_OLD)
2529 -$(NOECHO) $(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD)
2530 - $(MAKE) $(USEMAKEFILE) $(MAKEFILE_OLD) clean $(DEV_NULL)
2531 $(PERLRUN) Makefile.PL %s
2532 $(NOECHO) $(ECHO) "==> Your Makefile has been rebuilt. <=="
2533 $(NOECHO) $(ECHO) "==> Please rerun the $(MAKE) command. <=="
2544 Returns true, if the argument is likely to be a command.
2549 my($self,$file) = @_;
2550 return $file if -x $file && ! -d $file;
2555 =item needs_linking (o)
2557 Does this module need linking? Looks into subdirectory objects (see
2558 also has_link_code())
2565 my $caller = (caller(0))[3];
2566 confess("needs_linking called too early") if
2567 $caller =~ /^ExtUtils::MakeMaker::/;
2568 return $self->{NEEDS_LINKING} if defined $self->{NEEDS_LINKING};
2569 if ($self->has_link_code or $self->{MAKEAPERL}){
2570 $self->{NEEDS_LINKING} = 1;
2573 foreach my $child (keys %{$self->{CHILDREN}}) {
2574 if ($self->{CHILDREN}->{$child}->needs_linking) {
2575 $self->{NEEDS_LINKING} = 1;
2579 return $self->{NEEDS_LINKING} = 0;
2583 =item parse_abstract
2585 parse a file and return what you think is the ABSTRACT
2589 sub parse_abstract {
2590 my($self,$parsefile) = @_;
2594 open(my $fh, '<', $parsefile) or die "Could not open '$parsefile': $!";
2596 my $package = $self->{DISTNAME};
2597 $package =~ s/-/::/g;
2599 $inpod = /^=(?!cut)/ ? 1 : /^=cut/ ? 0 : $inpod;
2602 next unless /^($package(?:\.pm)? \s+ -+ \s+)(.*)/x;
2613 my $version = MM->parse_version($file);
2615 Parse a $file and return what $VERSION is set to by the first assignment.
2616 It will return the string "undef" if it can't figure out what $VERSION
2617 is. $VERSION should be for all to see, so C<our $VERSION> or plain $VERSION
2618 are okay, but C<my $VERSION> is not.
2620 C<<package Foo VERSION>> is also checked for. The first version
2621 declaration found is used, but this may change as it differs from how
2624 parse_version() will try to C<use version> before checking for
2625 C<$VERSION> so the following will work.
2627 $VERSION = qv(1.2.3);
2632 my($self,$parsefile) = @_;
2637 open(my $fh, '<', $parsefile) or die "Could not open '$parsefile': $!";
2640 $inpod = /^=(?!cut)/ ? 1 : /^=cut/ ? 0 : $inpod;
2641 next if $inpod || /^\s*#/;
2643 next if /^\s*(if|unless|elsif)/;
2644 if ( m{^ \s* package \s+ \w[\w\:\']* \s+ (v?[0-9._]+) \s* ; }x ) {
2648 elsif ( m{(?<!\\) ([\$*]) (([\w\:\']*) \bVERSION)\b .* =}x ) {
2650 package ExtUtils::MakeMaker::_version;
2653 # Ensure any version() routine which might have leaked
2654 # into this package has been deleted. Interferes with
2669 $result = eval($eval); ## no critic
2670 warn "Could not eval '$eval' in $parsefile: $@" if $@;
2675 last if defined $result;
2679 $result = "undef" unless defined $result;
2686 Defines the string that is passed to recursive make calls in
2696 my($sep) = $Is{VMS} ? ',' : '';
2699 foreach my $key (qw(LIB LIBPERL_A LINKTYPE OPTIMIZE
2700 PREFIX INSTALL_BASE)
2703 next unless defined $self->{$key};
2704 push @pasthru, "$key=\"\$($key)\"";
2707 foreach my $key (qw(DEFINE INC)) {
2708 next unless defined $self->{$key};
2709 push @pasthru, "PASTHRU_$key=\"\$(PASTHRU_$key)\"";
2712 push @m, "\nPASTHRU = ", join ($sep, @pasthru), "\n";
2718 Takes one argument, a file name, and returns the file name, if the
2719 argument is likely to be a perl script. On MM_Unix this is true for
2720 any ordinary, readable file.
2725 my($self,$file) = @_;
2726 return $file if -r $file && -f _;
2730 =item perldepend (o)
2732 Defines the dependency from all *.h files that come with the perl
2741 my $make_config = $self->cd('$(PERL_SRC)', '$(MAKE) lib/Config.pm');
2743 push @m, sprintf <<'MAKE_FRAG', $make_config if $self->{PERL_SRC};
2744 # Check for unpropogated config.sh changes. Should never happen.
2745 # We do NOT just update config.h because that is not sufficient.
2746 # An out of date config.h is not fatal but complains loudly!
2747 $(PERL_INC)/config.h: $(PERL_SRC)/config.sh
2748 -$(NOECHO) $(ECHO) "Warning: $(PERL_INC)/config.h out of date with $(PERL_SRC)/config.sh"; $(FALSE)
2750 $(PERL_ARCHLIB)/Config.pm: $(PERL_SRC)/config.sh
2751 $(NOECHO) $(ECHO) "Warning: $(PERL_ARCHLIB)/Config.pm may be out of date with $(PERL_SRC)/config.sh"
2755 return join "", @m unless $self->needs_linking;
2757 if ($self->{OBJECT}) {
2758 # Need to add an object file dependency on the perl headers.
2759 # this is very important for XS modules in perl.git development.
2760 push @m, $self->_perl_header_files_fragment("/"); # Directory separator between $(PERL_INC)/header.h
2763 push @m, join(" ", values %{$self->{XS}})." : \$(XSUBPPDEPS)\n" if %{$self->{XS}};
2765 return join "\n", @m;
2771 Defines target that copies all files in the hash PM to their
2772 destination and autosplits them. See L<ExtUtils::Install/DESCRIPTION>
2778 my($autodir) = $self->catdir('$(INST_LIB)','auto');
2780 pm_to_blib : $(FIRST_MAKEFILE) $(TO_INST_PM)
2783 # VMS will swallow '' and PM_FILTER is often empty. So use q[]
2784 my $pm_to_blib = $self->oneliner(<<CODE, ['-MExtUtils::Install']);
2785 pm_to_blib({\@ARGV}, '$autodir', q[\$(PM_FILTER)], '\$(PERM_DIR)')
2788 my @cmds = $self->split_command($pm_to_blib, %{$self->{PM}});
2790 $r .= join '', map { "\t\$(NOECHO) $_\n" } @cmds;
2791 $r .= qq{\t\$(NOECHO) \$(TOUCH) pm_to_blib\n};
2796 =item post_constants (o)
2798 Returns an empty string per default. Dedicated to overrides from
2799 within Makefile.PL after all constants have been defined.
2807 =item post_initialize (o)
2809 Returns an empty string per default. Used in Makefile.PLs to add some
2810 chunk of text to the Makefile after the object is initialized.
2814 sub post_initialize {
2820 Returns an empty string. Can be used in Makefile.PLs to write some
2821 text to the Makefile at the end.
2829 # transform dot-separated version string into comma-separated quadruple
2830 # examples: '1.2.3.4.5' => '1,2,3,4'
2831 # '1.2.3' => '1,2,3,0'
2833 my ($self, $string) = @_;
2834 return join ',', ((split /\./, $string), (0) x 4)[0..3];
2839 Defines target that creates a PPD (Perl Package Description) file
2840 for a binary distribution.
2847 my $abstract = $self->{ABSTRACT} || '';
2848 $abstract =~ s/\n/\\n/sg;
2849 $abstract =~ s/</</g;
2850 $abstract =~ s/>/>/g;
2852 my $author = join(', ',@{$self->{AUTHOR} || []});
2853 $author =~ s/</</g;
2854 $author =~ s/>/>/g;
2856 my $ppd_file = '$(DISTNAME).ppd';
2858 my @ppd_cmds = $self->echo(<<'PPD_HTML', $ppd_file, { append => 0, allow_variables => 1 });
2859 <SOFTPKG NAME="$(DISTNAME)" VERSION="$(VERSION)">
2862 my $ppd_xml = sprintf <<'PPD_HTML', $abstract, $author;
2863 <ABSTRACT>%s</ABSTRACT>
2867 $ppd_xml .= " <IMPLEMENTATION>\n";
2868 if ( $self->{MIN_PERL_VERSION} ) {
2869 my $min_perl_version = $self->_ppd_version($self->{MIN_PERL_VERSION});
2870 $ppd_xml .= sprintf <<'PPD_PERLVERS', $min_perl_version;
2871 <PERLCORE VERSION="%s" />
2876 # Don't add "perl" to requires. perl dependencies are
2877 # handles by ARCHITECTURE.
2878 my %prereqs = %{$self->{PREREQ_PM}};
2879 delete $prereqs{perl};
2882 foreach my $prereq (sort keys %prereqs) {
2884 $name .= '::' unless $name =~ /::/;
2885 my $version = $prereqs{$prereq}+0; # force numification
2887 my %attrs = ( NAME => $name );
2888 $attrs{VERSION} = $version if $version;
2889 my $attrs = join " ", map { qq[$_="$attrs{$_}"] } keys %attrs;
2890 $ppd_xml .= qq( <REQUIRE $attrs />\n);
2893 my $archname = $Config{archname};
2895 # archname did not change from 5.6 to 5.8, but those versions may
2896 # not be not binary compatible so now we append the part of the
2897 # version that changes when binary compatibility may change
2898 $archname .= "-$Config{PERL_REVISION}.$Config{PERL_VERSION}";
2900 $ppd_xml .= sprintf <<'PPD_OUT', $archname;
2901 <ARCHITECTURE NAME="%s" />
2904 if ($self->{PPM_INSTALL_SCRIPT}) {
2905 if ($self->{PPM_INSTALL_EXEC}) {
2906 $ppd_xml .= sprintf qq{ <INSTALL EXEC="%s">%s</INSTALL>\n},
2907 $self->{PPM_INSTALL_EXEC}, $self->{PPM_INSTALL_SCRIPT};
2910 $ppd_xml .= sprintf qq{ <INSTALL>%s</INSTALL>\n},
2911 $self->{PPM_INSTALL_SCRIPT};
2915 my ($bin_location) = $self->{BINARY_LOCATION} || '';
2916 $bin_location =~ s/\\/\\\\/g;
2918 $ppd_xml .= sprintf <<'PPD_XML', $bin_location;
2919 <CODEBASE HREF="%s" />
2924 push @ppd_cmds, $self->echo($ppd_xml, $ppd_file, { append => 1 });
2926 return sprintf <<'PPD_OUT', join "\n\t", @ppd_cmds;
2927 # Creates a PPD (Perl Package Description) for a binary distribution.
2936 $MM->prefixify($var, $prefix, $new_prefix, $default);
2938 Using either $MM->{uc $var} || $Config{lc $var}, it will attempt to
2939 replace it's $prefix with a $new_prefix.
2941 Should the $prefix fail to match I<AND> a PREFIX was given as an
2942 argument to WriteMakefile() it will set it to the $new_prefix +
2943 $default. This is for systems whose file layouts don't neatly fit into
2944 our ideas of prefixes.
2946 This is for heuristics which attempt to create directory structures
2947 that mirror those of the installed perl.
2951 $MM->prefixify('installman1dir', '/usr', '/home/foo', 'man/man1');
2953 this will attempt to remove '/usr' from the front of the
2954 $MM->{INSTALLMAN1DIR} path (initializing it to $Config{installman1dir}
2955 if necessary) and replace it with '/home/foo'. If this fails it will
2956 simply use '/home/foo/man/man1'.
2961 my($self,$var,$sprefix,$rprefix,$default) = @_;
2963 my $path = $self->{uc $var} ||
2964 $Config_Override{lc $var} || $Config{lc $var} || '';
2966 $rprefix .= '/' if $sprefix =~ m|/$|;
2968 warn " prefixify $var => $path\n" if $Verbose >= 2;
2969 warn " from $sprefix to $rprefix\n" if $Verbose >= 2;
2971 if( $self->{ARGS}{PREFIX} &&
2972 $path !~ s{^\Q$sprefix\E\b}{$rprefix}s )
2975 warn " cannot prefix, using default.\n" if $Verbose >= 2;
2976 warn " no default!\n" if !$default && $Verbose >= 2;
2978 $path = $self->catdir($rprefix, $default) if $default;
2981 print " now $path\n" if $Verbose >= 2;
2982 return $self->{uc $var} = $path;
2988 Defines targets to run *.PL files.
2994 my $pl_files = $self->{PL_FILES};
2996 return "" unless $pl_files;
2999 foreach my $plfile (sort keys %$pl_files) {
3000 my $list = ref($pl_files->{$plfile})
3001 ? $pl_files->{$plfile}
3002 : [$pl_files->{$plfile}];
3004 foreach my $target (@$list) {
3006 $plfile = vmsify($self->eliminate_macros($plfile));
3007 $target = vmsify($self->eliminate_macros($target));
3010 # Normally a .PL file runs AFTER pm_to_blib so it can have
3011 # blib in its @INC and load the just built modules. BUT if
3012 # the generated module is something in $(TO_INST_PM) which
3013 # pm_to_blib depends on then it can't depend on pm_to_blib
3014 # else we have a dependency loop.
3017 if( defined $self->{PM}{$target} ) {
3019 $perlrun = 'PERLRUN';
3022 $pm_dep = 'pm_to_blib';
3023 $perlrun = 'PERLRUNINST';
3031 $target :: $plfile $pm_dep
3032 \$($perlrun) $plfile $target
3043 Backslashes parentheses C<()> in command line arguments.
3044 Doesn't handle recursive Makefile C<$(...)> constructs,
3045 but handles simple ones.
3051 $arg =~ s{\$\((.+?)\)}{\$\\\\($1\\\\)}g; # protect $(...)
3052 $arg =~ s{(?<!\\)([()])}{\\$1}g; # quote unprotected
3053 $arg =~ s{\$\\\\\((.+?)\\\\\)}{\$($1)}g; # unprotect $(...)
3057 =item replace_manpage_separator
3059 my $man_name = $MM->replace_manpage_separator($file_path);
3061 Takes the name of a package, which may be a nested package, in the
3062 form 'Foo/Bar.pm' and replaces the slash with C<::> or something else
3063 safe for a man page file name. Returns the replacement.
3067 sub replace_manpage_separator {
3068 my($self,$man) = @_;
3080 my($self, $dir, @cmds) = @_;
3082 # No leading tab and no trailing newline makes for easier embedding
3083 my $make_frag = join "\n\t", map { "cd $dir && $_" } @cmds;
3093 my($self, $cmd, $switches) = @_;
3094 $switches = [] unless defined $switches;
3096 # Strip leading and trailing newlines
3100 my @cmds = split /\n/, $cmd;
3101 $cmd = join " \n\t -e ", map $self->quote_literal($_), @cmds;
3102 $cmd = $self->escape_newlines($cmd);
3104 $switches = join ' ', @$switches;
3106 return qq{\$(ABSPERLRUN) $switches -e $cmd --};
3115 my($self, $text, $opts) = @_;
3116 $opts->{allow_variables} = 1 unless defined $opts->{allow_variables};
3118 # Quote single quotes
3119 $text =~ s{'}{'\\''}g;
3121 $text = $opts->{allow_variables}
3122 ? $self->escape_dollarsigns($text) : $self->escape_all_dollarsigns($text);
3128 =item escape_newlines
3132 sub escape_newlines {
3133 my($self, $text) = @_;
3135 $text =~ s{\n}{\\\n}g;
3143 Using POSIX::ARG_MAX. Otherwise falling back to 4096.
3150 if (!defined $self->{_MAX_EXEC_LEN}) {
3151 if (my $arg_max = eval { require POSIX; &POSIX::ARG_MAX }) {
3152 $self->{_MAX_EXEC_LEN} = $arg_max;
3154 else { # POSIX minimum exec size
3155 $self->{_MAX_EXEC_LEN} = 4096;
3159 return $self->{_MAX_EXEC_LEN};
3165 Defines the static target.
3170 # --- Static Loading Sections ---
3174 ## $(INST_PM) has been moved to the all: target.
3175 ## It remains here for awhile to allow for old usage: "make static"
3176 static :: $(FIRST_MAKEFILE) $(INST_STATIC)
3181 =item static_lib (o)
3183 Defines how to produce the *.a (or equivalent) files.
3189 return '' unless $self->has_link_code;
3194 $(INST_STATIC) : $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)$(DFSEP).exists
3198 # If this extension has its own library (eg SDBM_File)
3199 # then copy that to $(INST_STATIC) and add $(OBJECT) into it.
3200 push(@m, <<'MAKE_FRAG') if $self->{MYEXTLIB};
3201 $(CP) $(MYEXTLIB) $@
3205 if (exists $self->{FULL_AR} && -x $self->{FULL_AR}) {
3206 # Prefer the absolute pathed ar if available so that PATH
3207 # doesn't confuse us. Perl itself is built with the full_ar.
3212 push @m, sprintf <<'MAKE_FRAG', $ar;
3213 $(%s) $(AR_STATIC_ARGS) $@ $(OBJECT) && $(RANLIB) $@
3214 $(CHMOD) $(PERM_RWX) $@
3215 $(NOECHO) $(ECHO) "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)/extralibs.ld
3218 # Old mechanism - still available:
3219 push @m, <<'MAKE_FRAG' if $self->{PERL_SRC} && $self->{EXTRALIBS};
3220 $(NOECHO) $(ECHO) "$(EXTRALIBS)" >> $(PERL_SRC)/ext.libs
3226 =item staticmake (o)
3233 my($self, %attribs) = @_;
3236 my(@searchdirs)=($self->{PERL_ARCHLIB}, $self->{SITEARCHEXP}, $self->{INST_ARCHLIB});
3238 # And as it's not yet built, we add the current extension
3239 # but only if it has some C code (or XS code, which implies C code)
3240 if (@{$self->{C}}) {
3241 @static = $self->catfile($self->{INST_ARCHLIB},
3244 "$self->{BASEEXT}$self->{LIB_EXT}"
3248 # Either we determine now, which libraries we will produce in the
3249 # subdirectories or we do it at runtime of the make.
3251 # We could ask all subdir objects, but I cannot imagine, why it
3252 # would be necessary.
3254 # Instead we determine all libraries for the new perl at
3256 my(@perlinc) = ($self->{INST_ARCHLIB}, $self->{INST_LIB}, $self->{PERL_ARCHLIB}, $self->{PERL_LIB});
3258 $self->makeaperl(MAKE => $self->{MAKEFILE},
3259 DIRS => \@searchdirs,
3262 TARGET => $self->{MAP_TARGET},
3264 LIBPERL => $self->{LIBPERL_A}
3270 Helper subroutine for subdirs
3275 my($self, $subdir) = @_;
3277 my $subdir_cmd = $self->cd($subdir,
3278 '$(MAKE) $(USEMAKEFILE) $(FIRST_MAKEFILE) all $(PASTHRU)'
3280 return sprintf <<'EOT', $subdir_cmd;
3290 Defines targets to process subdirectories.
3295 # --- Sub-directory Sections ---
3298 # This method provides a mechanism to automatically deal with
3299 # subdirectories containing further Makefile.PL scripts.
3300 # It calls the subdir_x() method for each subdirectory.
3301 foreach my $dir (@{$self->{DIR}}){
3302 push(@m, $self->subdir_x($dir));
3303 #### print "Including $dir subdirectory\n";
3307 # The default clean, realclean and test targets in this Makefile
3308 # have automatically been given entries for each subdir.
3312 push(@m, "\n# none")
3319 Defines the test targets.
3324 # --- Test and Installation Sections ---
3326 my($self, %attribs) = @_;
3327 my $tests = $attribs{TESTS} || '';
3328 if (!$tests && -d 't') {
3329 $tests = $self->find_tests;
3331 # note: 'test.pl' name is also hardcoded in init_dirscan()
3335 TEST_TYPE=test_\$(LINKTYPE)
3340 testdb :: testdb_\$(LINKTYPE)
3342 test :: \$(TEST_TYPE) subdirs-test
3349 foreach my $dir (@{ $self->{DIR} }) {
3350 my $test = $self->cd($dir, '$(MAKE) test $(PASTHRU)');
3359 push(@m, "\t\$(NOECHO) \$(ECHO) 'No tests defined for \$(NAME) extension.'\n")
3360 unless $tests or -f "test.pl" or @{$self->{DIR}};
3363 push(@m, "test_dynamic :: pure_all\n");
3364 push(@m, $self->test_via_harness('$(FULLPERLRUN)', '$(TEST_FILES)'))
3366 push(@m, $self->test_via_script('$(FULLPERLRUN)', '$(TEST_FILE)'))
3370 push(@m, "testdb_dynamic :: pure_all\n");
3371 push(@m, $self->test_via_script('$(FULLPERLRUN) $(TESTDB_SW)',
3375 # Occasionally we may face this degenerate target:
3376 push @m, "test_ : test_dynamic\n\n";
3378 if ($self->needs_linking()) {
3379 push(@m, "test_static :: pure_all \$(MAP_TARGET)\n");
3380 push(@m, $self->test_via_harness('./$(MAP_TARGET)', '$(TEST_FILES)')) if $tests;
3381 push(@m, $self->test_via_script('./$(MAP_TARGET)', '$(TEST_FILE)')) if -f "test.pl";
3383 push(@m, "testdb_static :: pure_all \$(MAP_TARGET)\n");
3384 push(@m, $self->test_via_script('./$(MAP_TARGET) $(TESTDB_SW)', '$(TEST_FILE)'));
3387 push @m, "test_static :: test_dynamic\n";
3388 push @m, "testdb_static :: testdb_dynamic\n";
3393 =item test_via_harness (override)
3395 For some reason which I forget, Unix machines like to have
3396 PERL_DL_NONLAZY set for tests.
3400 sub test_via_harness {
3401 my($self, $perl, $tests) = @_;
3402 return $self->SUPER::test_via_harness("PERL_DL_NONLAZY=1 $perl", $tests);
3405 =item test_via_script (override)
3407 Again, the PERL_DL_NONLAZY thing.
3411 sub test_via_script {
3412 my($self, $perl, $script) = @_;
3413 return $self->SUPER::test_via_script("PERL_DL_NONLAZY=1 $perl", $script);
3417 =item tool_xsubpp (o)
3419 Determines typemaps, xsubpp version, prototype behaviour.
3425 return "" unless $self->needs_linking;
3428 my @xsubpp_dirs = @INC;
3430 # Make sure we pick up the new xsubpp if we're building perl.
3431 unshift @xsubpp_dirs, $self->{PERL_LIB} if $self->{PERL_CORE};
3433 foreach my $dir (@xsubpp_dirs) {
3434 $xsdir = $self->catdir($dir, 'ExtUtils');
3435 if( -r $self->catfile($xsdir, "xsubpp") ) {
3440 my $tmdir = File::Spec->catdir($self->{PERL_LIB},"ExtUtils");
3441 my(@tmdeps) = $self->catfile($tmdir,'typemap');
3442 if( $self->{TYPEMAPS} ){
3443 foreach my $typemap (@{$self->{TYPEMAPS}}){
3444 if( ! -f $typemap ) {
3445 warn "Typemap $typemap not found.\n";
3448 push(@tmdeps, $typemap);
3452 push(@tmdeps, "typemap") if -f "typemap";
3453 my(@tmargs) = map("-typemap $_", @tmdeps);
3454 if( exists $self->{XSOPT} ){
3455 unshift( @tmargs, $self->{XSOPT} );
3459 $Config{'ldflags'} &&
3460 $Config{'ldflags'} =~ m!/Debug!i &&
3461 (!exists($self->{XSOPT}) || $self->{XSOPT} !~ /linenumbers/)
3464 unshift(@tmargs,'-nolinenumbers');
3468 $self->{XSPROTOARG} = "" unless defined $self->{XSPROTOARG};
3472 XSUBPP = \$(XSUBPPDIR)\$(DFSEP)xsubpp
3473 XSUBPPRUN = \$(PERLRUN) \$(XSUBPP)
3474 XSPROTOARG = $self->{XSPROTOARG}
3475 XSUBPPDEPS = @tmdeps \$(XSUBPP)
3476 XSUBPPARGS = @tmargs
3484 Build man pages, too
3491 return <<'MAKE_EXT';
3492 all :: pure_all manifypods
3497 =item top_targets (o)
3499 Defines the targets all, subdirs, config, and O_FILES
3504 # --- Target Sections ---
3509 push @m, $self->all_target, "\n" unless $self->{SKIPHASH}{'all'};
3512 pure_all :: config pm_to_blib subdirs linkext
3515 subdirs :: $(MYEXTLIB)
3518 config :: $(FIRST_MAKEFILE) blibdirs
3523 $(O_FILES): $(H_FILES)
3524 ' if @{$self->{O_FILES} || []} && @{$self->{H} || []};
3528 perldoc ExtUtils::MakeMaker
3536 Obsolete, deprecated method. Not used since Version 5.21.
3541 # --- perllocal.pod section ---
3542 my($self,$what,$name,@attribs)=@_;
3543 my $time = localtime;
3544 print "=head2 $time: $what C<$name>\n\n=over 4\n\n=item *\n\n";
3545 print join "\n\n=item *\n\n", map("C<$_>",@attribs);
3546 print "\n\n=back\n\n";
3551 Defines the suffix rules to compile XS files to C.
3557 return '' unless $self->needs_linking();
3560 $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $(XSUBPP_EXTRA_ARGS) $*.xs > $*.xsc && $(MV) $*.xsc $*.c
3566 Defines the suffix rules to compile XS files to C++.
3572 return '' unless $self->needs_linking();
3575 $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.xsc && $(MV) $*.xsc $*.cpp
3581 Defines suffix rules to go from XS to object files directly. This is
3582 only intended for broken make implementations.
3586 sub xs_o { # many makes are too dumb to use xs_c then c_o
3588 return '' unless $self->needs_linking();
3591 $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.xsc && $(MV) $*.xsc $*.c
3592 $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.c
3603 L<ExtUtils::MakeMaker>