| Filename | /usr/share/perl/5.36/ExtUtils/MM_Unix.pm |
| Statements | Executed 127 statements in 11.7ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 27 | 1 | 1 | 55µs | 55µs | ExtUtils::MM_Unix::CORE:fteexec (opcode) |
| 27 | 1 | 1 | 32µs | 94µs | ExtUtils::MM_Unix::maybe_command |
| 1 | 1 | 1 | 12µs | 12µs | ExtUtils::MM_Unix::BEGIN@25 |
| 1 | 1 | 1 | 9µs | 29µs | ExtUtils::MM_Unix::BEGIN@2794 |
| 1 | 1 | 1 | 9µs | 25µs | ExtUtils::MM_Unix::BEGIN@1385 |
| 1 | 1 | 1 | 8µs | 11µs | ExtUtils::MM_Unix::BEGIN@5 |
| 1 | 1 | 1 | 7µs | 10µs | ExtUtils::MakeMaker::_version::BEGIN@3021 |
| 1 | 1 | 1 | 7µs | 26µs | ExtUtils::MM_Unix::BEGIN@2985 |
| 2 | 1 | 1 | 6µs | 6µs | ExtUtils::MM_Unix::CORE:ftdir (opcode) |
| 1 | 1 | 1 | 5µs | 87µs | ExtUtils::MM_Unix::BEGIN@14 |
| 1 | 1 | 1 | 5µs | 17µs | ExtUtils::MM_Unix::BEGIN@17 |
| 1 | 1 | 1 | 4µs | 25µs | ExtUtils::MM_Unix::BEGIN@8 |
| 1 | 1 | 1 | 4µs | 14µs | ExtUtils::MakeMaker::_version::BEGIN@3022 |
| 1 | 1 | 1 | 4µs | 16µs | ExtUtils::MM_Unix::BEGIN@10 |
| 1 | 1 | 1 | 3µs | 19µs | ExtUtils::MM_Unix::BEGIN@6 |
| 1 | 1 | 1 | 3µs | 13µs | ExtUtils::MM_Unix::BEGIN@9 |
| 1 | 1 | 1 | 2µs | 2µs | ExtUtils::MM_Unix::BEGIN@47 |
| 2 | 2 | 1 | 400ns | 400ns | ExtUtils::MM_Unix::CORE:match (opcode) |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::__ANON__[:1729] |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::__ANON__[:2796] |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::_find_static_libs |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::_fixin_replace_shebang |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::_has_pod |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::_ppd_version |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::_rename |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::_xs_armaybe |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::_xs_make_bs |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::_xsbuild_replace_macro |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::_xsbuild_value |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::all_target |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::c_o |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::cd |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::cflags |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::const_cccmd |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::const_config |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::const_loadlibs |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::constants |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::dbgoutflag |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::depend |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::dist |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::dist_basics |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::dist_ci |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::dist_core |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::dist_target |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::dlsyms |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::dynamic_bs |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::dynamic_lib |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::escape_newlines |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::exescan |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::extliblist |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::find_perl |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::fixin |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::force |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::get_version |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::guess_name |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::has_link_code |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::init_DEST |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::init_DIRFILESEP |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::init_MAN1PODS |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::init_MAN3PODS |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::init_MANPODS |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::init_PERL |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::init_PERM |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::init_PM |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::init_dirscan |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::init_dist |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::init_lib2arch |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::init_linker |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::init_main |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::init_platform |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::init_tools |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::init_xs |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::install |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::installbin |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::linkext |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::lsdir |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::macro |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::makeaperl |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::makefile |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::max_exec_len |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::needs_linking |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::oneliner |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::os_flavor |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::parse_abstract |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::parse_version |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::pasthru |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::perl_script |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::perldepend |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::platform_constants |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::pm_to_blib |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::ppd |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::prefixify |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::processPL |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::quote_literal |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::quote_paren |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::replace_manpage_separator |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::shdist_target |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::specify_shell |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::static |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::static_lib |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::static_lib_closures |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::static_lib_fixtures |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::static_lib_pure_cmd |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::staticmake |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::subdir_x |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::subdirs |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::tardist_target |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::tarfile_target |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::test |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::test_via_harness |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::test_via_script |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::tool_xsubpp |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::top_targets |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::uutardist_target |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::writedoc |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::xs_c |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::xs_cpp |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::xs_dynamic_lib_macros |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::xs_make_dynamic_lib |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::xs_make_static_lib |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::xs_o |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::xs_obj_opt |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::xs_static_lib_is_xs |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::zipdist_target |
| 0 | 0 | 0 | 0s | 0s | ExtUtils::MM_Unix::zipfile_target |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package ExtUtils::MM_Unix; | ||||
| 2 | |||||
| 3 | 1 | 10µs | require 5.006; | ||
| 4 | |||||
| 5 | 2 | 19µs | 2 | 13µs | # spent 11µs (8+2) within ExtUtils::MM_Unix::BEGIN@5 which was called:
# once (8µs+2µs) by IPC::Cmd::can_run at line 5 # spent 11µs making 1 call to ExtUtils::MM_Unix::BEGIN@5
# spent 2µs making 1 call to strict::import |
| 6 | 2 | 13µs | 2 | 34µs | # spent 19µs (3+15) within ExtUtils::MM_Unix::BEGIN@6 which was called:
# once (3µs+15µs) by IPC::Cmd::can_run at line 6 # spent 19µs making 1 call to ExtUtils::MM_Unix::BEGIN@6
# spent 15µs making 1 call to warnings::import |
| 7 | |||||
| 8 | 2 | 14µs | 2 | 46µs | # spent 25µs (4+21) within ExtUtils::MM_Unix::BEGIN@8 which was called:
# once (4µs+21µs) by IPC::Cmd::can_run at line 8 # spent 25µs making 1 call to ExtUtils::MM_Unix::BEGIN@8
# spent 21µs making 1 call to Exporter::import |
| 9 | 2 | 16µs | 2 | 23µs | # spent 13µs (3+10) within ExtUtils::MM_Unix::BEGIN@9 which was called:
# once (3µs+10µs) by IPC::Cmd::can_run at line 9 # spent 13µs making 1 call to ExtUtils::MM_Unix::BEGIN@9
# spent 10µs making 1 call to ExtUtils::MakeMaker::Config::import |
| 10 | 2 | 22µs | 2 | 27µs | # spent 16µs (4+12) within ExtUtils::MM_Unix::BEGIN@10 which was called:
# once (4µs+12µs) by IPC::Cmd::can_run at line 10 # spent 16µs making 1 call to ExtUtils::MM_Unix::BEGIN@10
# spent 12µs making 1 call to Exporter::import |
| 11 | |||||
| 12 | our %Config_Override; | ||||
| 13 | |||||
| 14 | 2 | 20µs | 2 | 168µs | # spent 87µs (5+81) within ExtUtils::MM_Unix::BEGIN@14 which was called:
# once (5µs+81µs) by IPC::Cmd::can_run at line 14 # spent 87µs making 1 call to ExtUtils::MM_Unix::BEGIN@14
# spent 81µs making 1 call to Exporter::import |
| 15 | |||||
| 16 | # If we make $VERSION an our variable parse_version() breaks | ||||
| 17 | 2 | 154µs | 2 | 30µs | # spent 17µs (5+13) within ExtUtils::MM_Unix::BEGIN@17 which was called:
# once (5µs+13µs) by IPC::Cmd::can_run at line 17 # spent 17µs making 1 call to ExtUtils::MM_Unix::BEGIN@17
# spent 13µs making 1 call to vars::import |
| 18 | 1 | 200ns | $VERSION = '7.64'; | ||
| 19 | 1 | 1µs | $VERSION =~ tr/_//d; | ||
| 20 | |||||
| 21 | 1 | 112µs | require ExtUtils::MM_Any; | ||
| 22 | 1 | 8µs | our @ISA = qw(ExtUtils::MM_Any); | ||
| 23 | |||||
| 24 | 1 | 100ns | my %Is; | ||
| 25 | # spent 12µs (12+400ns) within ExtUtils::MM_Unix::BEGIN@25 which was called:
# once (12µs+400ns) by IPC::Cmd::can_run at line 45 | ||||
| 26 | 1 | 1µs | $Is{OS2} = $^O eq 'os2'; | ||
| 27 | 1 | 800ns | $Is{Win32} = $^O eq 'MSWin32' || $Config{osname} eq 'NetWare'; | ||
| 28 | 1 | 200ns | $Is{Dos} = $^O eq 'dos'; | ||
| 29 | 1 | 300ns | $Is{VMS} = $^O eq 'VMS'; | ||
| 30 | 1 | 200ns | $Is{OSF} = $^O eq 'dec_osf'; | ||
| 31 | 1 | 500ns | $Is{IRIX} = $^O eq 'irix'; | ||
| 32 | 1 | 200ns | $Is{NetBSD} = $^O eq 'netbsd'; | ||
| 33 | 1 | 100ns | $Is{Interix} = $^O eq 'interix'; | ||
| 34 | 1 | 200ns | $Is{SunOS4} = $^O eq 'sunos'; | ||
| 35 | 1 | 200ns | $Is{Solaris} = $^O eq 'solaris'; | ||
| 36 | 1 | 600ns | $Is{SunOS} = $Is{SunOS4} || $Is{Solaris}; | ||
| 37 | 1 | 5µs | 1 | 300ns | $Is{BSD} = ($^O =~ /^(?:free|net|open)bsd$/ or # spent 300ns making 1 call to ExtUtils::MM_Unix::CORE:match |
| 38 | grep( $^O eq $_, qw(bsdos interix dragonfly) ) | ||||
| 39 | ); | ||||
| 40 | 1 | 1µs | 1 | 100ns | $Is{Android} = $^O =~ /android/; # spent 100ns making 1 call to ExtUtils::MM_Unix::CORE:match |
| 41 | 1 | 4µs | if ( $^O eq 'darwin' && $^X eq '/usr/bin/perl' ) { | ||
| 42 | my @osvers = split /\./, $Config{osvers}; | ||||
| 43 | $Is{ApplCor} = ( $osvers[0] >= 18 ); | ||||
| 44 | } | ||||
| 45 | 1 | 54µs | 1 | 12µs | } # spent 12µs making 1 call to ExtUtils::MM_Unix::BEGIN@25 |
| 46 | |||||
| 47 | # spent 2µs within ExtUtils::MM_Unix::BEGIN@47 which was called:
# once (2µs+0s) by IPC::Cmd::can_run at line 53 | ||||
| 48 | 1 | 3µs | if( $Is{VMS} ) { | ||
| 49 | # For things like vmsify() | ||||
| 50 | require VMS::Filespec; | ||||
| 51 | VMS::Filespec->import; | ||||
| 52 | } | ||||
| 53 | 1 | 3.16ms | 1 | 2µs | } # spent 2µs making 1 call to ExtUtils::MM_Unix::BEGIN@47 |
| 54 | |||||
| 55 | |||||
| 56 | =head1 NAME | ||||
| 57 | |||||
| 58 | ExtUtils::MM_Unix - methods used by ExtUtils::MakeMaker | ||||
| 59 | |||||
| 60 | =head1 SYNOPSIS | ||||
| 61 | |||||
| 62 | require ExtUtils::MM_Unix; | ||||
| 63 | |||||
| 64 | =head1 DESCRIPTION | ||||
| 65 | |||||
| 66 | The methods provided by this package are designed to be used in | ||||
| 67 | conjunction with L<ExtUtils::MakeMaker>. When MakeMaker writes a | ||||
| 68 | Makefile, it creates one or more objects that inherit their methods | ||||
| 69 | from a package L<MM|ExtUtils::MM>. MM itself doesn't provide any methods, but | ||||
| 70 | it ISA ExtUtils::MM_Unix class. The inheritance tree of MM lets operating | ||||
| 71 | specific packages take the responsibility for all the methods provided | ||||
| 72 | by MM_Unix. We are trying to reduce the number of the necessary | ||||
| 73 | overrides by defining rather primitive operations within | ||||
| 74 | ExtUtils::MM_Unix. | ||||
| 75 | |||||
| 76 | If you are going to write a platform specific MM package, please try | ||||
| 77 | to limit the necessary overrides to primitive methods, and if it is not | ||||
| 78 | possible to do so, let's work out how to achieve that gain. | ||||
| 79 | |||||
| 80 | If you are overriding any of these methods in your Makefile.PL (in the | ||||
| 81 | MY class), please report that to the makemaker mailing list. We are | ||||
| 82 | trying to minimize the necessary method overrides and switch to data | ||||
| 83 | driven Makefile.PLs wherever possible. In the long run less methods | ||||
| 84 | will be overridable via the MY class. | ||||
| 85 | |||||
| 86 | =head1 METHODS | ||||
| 87 | |||||
| 88 | The following description of methods is still under | ||||
| 89 | development. Please refer to the code for not suitably documented | ||||
| 90 | sections and complain loudly to the makemaker@perl.org mailing list. | ||||
| 91 | Better yet, provide a patch. | ||||
| 92 | |||||
| 93 | Not all of the methods below are overridable in a | ||||
| 94 | Makefile.PL. Overridable methods are marked as (o). All methods are | ||||
| 95 | overridable by a platform specific MM_*.pm file. | ||||
| 96 | |||||
| 97 | Cross-platform methods are being moved into L<MM_Any|ExtUtils::MM_Any>. | ||||
| 98 | If you can't find something that used to be in here, look in MM_Any. | ||||
| 99 | |||||
| 100 | =cut | ||||
| 101 | |||||
| 102 | # So we don't have to keep calling the methods over and over again, | ||||
| 103 | # we have these globals to cache the values. Faster and shrtr. | ||||
| 104 | 1 | 3µs | 1 | 500ns | my $Curdir = __PACKAGE__->curdir; # spent 500ns making 1 call to File::Spec::Unix::curdir |
| 105 | 1 | 3µs | 1 | 1µs | my $Updir = __PACKAGE__->updir; # spent 1µs making 1 call to File::Spec::Unix::updir |
| 106 | |||||
| 107 | |||||
| 108 | =head2 Methods | ||||
| 109 | |||||
| 110 | =over 4 | ||||
| 111 | |||||
| 112 | =item os_flavor | ||||
| 113 | |||||
| 114 | Simply says that we're Unix. | ||||
| 115 | |||||
| 116 | =cut | ||||
| 117 | |||||
| 118 | sub os_flavor { | ||||
| 119 | return('Unix'); | ||||
| 120 | } | ||||
| 121 | |||||
| 122 | |||||
| 123 | =item c_o (o) | ||||
| 124 | |||||
| 125 | Defines the suffix rules to compile different flavors of C files to | ||||
| 126 | object files. | ||||
| 127 | |||||
| 128 | =cut | ||||
| 129 | |||||
| 130 | sub c_o { | ||||
| 131 | # --- Translation Sections --- | ||||
| 132 | |||||
| 133 | my($self) = shift; | ||||
| 134 | return '' unless $self->needs_linking(); | ||||
| 135 | my(@m); | ||||
| 136 | |||||
| 137 | my $command = '$(CCCMD)'; | ||||
| 138 | my $flags = '$(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE)'; | ||||
| 139 | |||||
| 140 | if ( $Is{ApplCor} ) { | ||||
| 141 | $flags =~ s/"-I(\$\(PERL_INC\))"/-iwithsysroot "$1"/; | ||||
| 142 | } | ||||
| 143 | |||||
| 144 | if (my $cpp = $self->{CPPRUN}) { | ||||
| 145 | my $cpp_cmd = $self->const_cccmd; | ||||
| 146 | $cpp_cmd =~ s/^CCCMD\s*=\s*\$\(CC\)/\$(CPPRUN)/; | ||||
| 147 | push @m, qq{ | ||||
| 148 | .c.i: | ||||
| 149 | $cpp_cmd $flags \$*.c > \$*.i | ||||
| 150 | }; | ||||
| 151 | } | ||||
| 152 | |||||
| 153 | my $m_o = $self->{XSMULTI} ? $self->xs_obj_opt('$*.s') : ''; | ||||
| 154 | push @m, sprintf <<'EOF', $command, $flags, $m_o; | ||||
| 155 | |||||
| 156 | .c.s : | ||||
| 157 | %s -S %s $*.c %s | ||||
| 158 | EOF | ||||
| 159 | |||||
| 160 | my @exts = qw(c cpp cxx cc); | ||||
| 161 | push @exts, 'C' if !$Is{OS2} and !$Is{Win32} and !$Is{Dos}; #Case-specific | ||||
| 162 | $m_o = $self->{XSMULTI} ? $self->xs_obj_opt('$*$(OBJ_EXT)') : ''; | ||||
| 163 | my $dbgout = $self->dbgoutflag; | ||||
| 164 | for my $ext (@exts) { | ||||
| 165 | push @m, "\n.$ext\$(OBJ_EXT) :\n\t$command $flags " | ||||
| 166 | .($dbgout?"$dbgout ":'') | ||||
| 167 | ."\$*.$ext" . ( $m_o ? " $m_o" : '' ) . "\n"; | ||||
| 168 | } | ||||
| 169 | return join "", @m; | ||||
| 170 | } | ||||
| 171 | |||||
| 172 | |||||
| 173 | =item xs_obj_opt | ||||
| 174 | |||||
| 175 | Takes the object file as an argument, and returns the portion of compile | ||||
| 176 | command-line that will output to the specified object file. | ||||
| 177 | |||||
| 178 | =cut | ||||
| 179 | |||||
| 180 | sub xs_obj_opt { | ||||
| 181 | my ($self, $output_file) = @_; | ||||
| 182 | "-o $output_file"; | ||||
| 183 | } | ||||
| 184 | |||||
| 185 | =item dbgoutflag | ||||
| 186 | |||||
| 187 | Returns a CC flag that tells the CC to emit a separate debugging symbol file | ||||
| 188 | when compiling an object file. | ||||
| 189 | |||||
| 190 | =cut | ||||
| 191 | |||||
| 192 | sub dbgoutflag { | ||||
| 193 | ''; | ||||
| 194 | } | ||||
| 195 | |||||
| 196 | =item cflags (o) | ||||
| 197 | |||||
| 198 | Does very much the same as the cflags script in the perl | ||||
| 199 | distribution. It doesn't return the whole compiler command line, but | ||||
| 200 | initializes all of its parts. The const_cccmd method then actually | ||||
| 201 | returns the definition of the CCCMD macro which uses these parts. | ||||
| 202 | |||||
| 203 | =cut | ||||
| 204 | |||||
| 205 | #' | ||||
| 206 | |||||
| 207 | sub cflags { | ||||
| 208 | my($self,$libperl)=@_; | ||||
| 209 | return $self->{CFLAGS} if $self->{CFLAGS}; | ||||
| 210 | return '' unless $self->needs_linking(); | ||||
| 211 | |||||
| 212 | my($prog, $uc, $perltype, %cflags); | ||||
| 213 | $libperl ||= $self->{LIBPERL_A} || "libperl$self->{LIB_EXT}" ; | ||||
| 214 | $libperl =~ s/\.\$\(A\)$/$self->{LIB_EXT}/; | ||||
| 215 | |||||
| 216 | @cflags{qw(cc ccflags optimize shellflags)} | ||||
| 217 | = @Config{qw(cc ccflags optimize shellflags)}; | ||||
| 218 | |||||
| 219 | # Perl 5.21.4 adds the (gcc) warning (-Wall ...) and std (-std=c89) | ||||
| 220 | # flags to the %Config, and the modules in the core should be built | ||||
| 221 | # with the warning flags, but NOT the -std=c89 flags (the latter | ||||
| 222 | # would break using any system header files that are strict C99). | ||||
| 223 | my @ccextraflags = qw(ccwarnflags); | ||||
| 224 | if ($ENV{PERL_CORE}) { | ||||
| 225 | for my $x (@ccextraflags) { | ||||
| 226 | if (exists $Config{$x}) { | ||||
| 227 | $cflags{$x} = $Config{$x}; | ||||
| 228 | } | ||||
| 229 | } | ||||
| 230 | } | ||||
| 231 | |||||
| 232 | my($optdebug) = ""; | ||||
| 233 | |||||
| 234 | $cflags{shellflags} ||= ''; | ||||
| 235 | |||||
| 236 | my(%map) = ( | ||||
| 237 | D => '-DDEBUGGING', | ||||
| 238 | E => '-DEMBED', | ||||
| 239 | DE => '-DDEBUGGING -DEMBED', | ||||
| 240 | M => '-DEMBED -DMULTIPLICITY', | ||||
| 241 | DM => '-DDEBUGGING -DEMBED -DMULTIPLICITY', | ||||
| 242 | ); | ||||
| 243 | |||||
| 244 | if ($libperl =~ /libperl(\w*)\Q$self->{LIB_EXT}/){ | ||||
| 245 | $uc = uc($1); | ||||
| 246 | } else { | ||||
| 247 | $uc = ""; # avoid warning | ||||
| 248 | } | ||||
| 249 | $perltype = $map{$uc} ? $map{$uc} : ""; | ||||
| 250 | |||||
| 251 | if ($uc =~ /^D/) { | ||||
| 252 | $optdebug = "-g"; | ||||
| 253 | } | ||||
| 254 | |||||
| 255 | |||||
| 256 | my($name); | ||||
| 257 | ( $name = $self->{NAME} . "_cflags" ) =~ s/:/_/g ; | ||||
| 258 | if ($prog = $Config{$name}) { | ||||
| 259 | # Expand hints for this extension via the shell | ||||
| 260 | print "Processing $name hint:\n" if $Verbose; | ||||
| 261 | my(@o)=`cc=\"$cflags{cc}\" | ||||
| 262 | ccflags=\"$cflags{ccflags}\" | ||||
| 263 | optimize=\"$cflags{optimize}\" | ||||
| 264 | perltype=\"$cflags{perltype}\" | ||||
| 265 | optdebug=\"$cflags{optdebug}\" | ||||
| 266 | eval '$prog' | ||||
| 267 | echo cc=\$cc | ||||
| 268 | echo ccflags=\$ccflags | ||||
| 269 | echo optimize=\$optimize | ||||
| 270 | echo perltype=\$perltype | ||||
| 271 | echo optdebug=\$optdebug | ||||
| 272 | `; | ||||
| 273 | foreach my $line (@o){ | ||||
| 274 | chomp $line; | ||||
| 275 | if ($line =~ /(.*?)=\s*(.*)\s*$/){ | ||||
| 276 | $cflags{$1} = $2; | ||||
| 277 | print " $1 = $2\n" if $Verbose; | ||||
| 278 | } else { | ||||
| 279 | print "Unrecognised result from hint: '$line'\n"; | ||||
| 280 | } | ||||
| 281 | } | ||||
| 282 | } | ||||
| 283 | |||||
| 284 | if ($optdebug) { | ||||
| 285 | $cflags{optimize} = $optdebug; | ||||
| 286 | } | ||||
| 287 | |||||
| 288 | for (qw(ccflags optimize perltype)) { | ||||
| 289 | $cflags{$_} ||= ''; | ||||
| 290 | $cflags{$_} =~ s/^\s+//; | ||||
| 291 | $cflags{$_} =~ s/\s+/ /g; | ||||
| 292 | $cflags{$_} =~ s/\s+$//; | ||||
| 293 | $self->{uc $_} ||= $cflags{$_}; | ||||
| 294 | } | ||||
| 295 | |||||
| 296 | if ($self->{POLLUTE}) { | ||||
| 297 | $self->{CCFLAGS} .= ' -DPERL_POLLUTE '; | ||||
| 298 | } | ||||
| 299 | |||||
| 300 | for my $x (@ccextraflags) { | ||||
| 301 | next unless exists $cflags{$x}; | ||||
| 302 | $self->{CCFLAGS} .= $cflags{$x} =~ m!^\s! ? $cflags{$x} : ' ' . $cflags{$x}; | ||||
| 303 | } | ||||
| 304 | |||||
| 305 | my $pollute = ''; | ||||
| 306 | if ($Config{usemymalloc} and not $Config{bincompat5005} | ||||
| 307 | and not $Config{ccflags} =~ /-DPERL_POLLUTE_MALLOC\b/ | ||||
| 308 | and $self->{PERL_MALLOC_OK}) { | ||||
| 309 | $pollute = '$(PERL_MALLOC_DEF)'; | ||||
| 310 | } | ||||
| 311 | |||||
| 312 | return $self->{CFLAGS} = qq{ | ||||
| 313 | CCFLAGS = $self->{CCFLAGS} | ||||
| 314 | OPTIMIZE = $self->{OPTIMIZE} | ||||
| 315 | PERLTYPE = $self->{PERLTYPE} | ||||
| 316 | MPOLLUTE = $pollute | ||||
| 317 | }; | ||||
| 318 | |||||
| 319 | } | ||||
| 320 | |||||
| 321 | |||||
| 322 | =item const_cccmd (o) | ||||
| 323 | |||||
| 324 | Returns the full compiler call for C programs and stores the | ||||
| 325 | definition in CONST_CCCMD. | ||||
| 326 | |||||
| 327 | =cut | ||||
| 328 | |||||
| 329 | sub const_cccmd { | ||||
| 330 | my($self,$libperl)=@_; | ||||
| 331 | return $self->{CONST_CCCMD} if $self->{CONST_CCCMD}; | ||||
| 332 | return '' unless $self->needs_linking(); | ||||
| 333 | return $self->{CONST_CCCMD} = | ||||
| 334 | q{CCCMD = $(CC) -c $(PASTHRU_INC) $(INC) \\ | ||||
| 335 | $(CCFLAGS) $(OPTIMIZE) \\ | ||||
| 336 | $(PERLTYPE) $(MPOLLUTE) $(DEFINE_VERSION) \\ | ||||
| 337 | $(XS_DEFINE_VERSION)}; | ||||
| 338 | } | ||||
| 339 | |||||
| 340 | =item const_config (o) | ||||
| 341 | |||||
| 342 | Sets SHELL if needed, then defines a couple of constants in the Makefile | ||||
| 343 | that are imported from %Config. | ||||
| 344 | |||||
| 345 | =cut | ||||
| 346 | |||||
| 347 | sub const_config { | ||||
| 348 | # --- Constants Sections --- | ||||
| 349 | |||||
| 350 | my($self) = shift; | ||||
| 351 | my @m = $self->specify_shell(); # Usually returns empty string | ||||
| 352 | push @m, <<"END"; | ||||
| 353 | |||||
| 354 | # These definitions are from config.sh (via $INC{'Config.pm'}). | ||||
| 355 | # They may have been overridden via Makefile.PL or on the command line. | ||||
| 356 | END | ||||
| 357 | |||||
| 358 | my(%once_only); | ||||
| 359 | foreach my $key (@{$self->{CONFIG}}){ | ||||
| 360 | # SITE*EXP macros are defined in &constants; avoid duplicates here | ||||
| 361 | next if $once_only{$key}; | ||||
| 362 | push @m, uc($key) , ' = ' , $self->{uc $key}, "\n"; | ||||
| 363 | $once_only{$key} = 1; | ||||
| 364 | } | ||||
| 365 | join('', @m); | ||||
| 366 | } | ||||
| 367 | |||||
| 368 | =item const_loadlibs (o) | ||||
| 369 | |||||
| 370 | Defines EXTRALIBS, LDLOADLIBS, BSLOADLIBS, LD_RUN_PATH. See | ||||
| 371 | L<ExtUtils::Liblist> for details. | ||||
| 372 | |||||
| 373 | =cut | ||||
| 374 | |||||
| 375 | sub const_loadlibs { | ||||
| 376 | my($self) = shift; | ||||
| 377 | return "" unless $self->needs_linking; | ||||
| 378 | my @m; | ||||
| 379 | push @m, qq{ | ||||
| 380 | # $self->{NAME} might depend on some other libraries: | ||||
| 381 | # See ExtUtils::Liblist for details | ||||
| 382 | # | ||||
| 383 | }; | ||||
| 384 | for my $tmp (qw/ | ||||
| 385 | EXTRALIBS LDLOADLIBS BSLOADLIBS | ||||
| 386 | /) { | ||||
| 387 | next unless defined $self->{$tmp}; | ||||
| 388 | push @m, "$tmp = $self->{$tmp}\n"; | ||||
| 389 | } | ||||
| 390 | # don't set LD_RUN_PATH if empty | ||||
| 391 | for my $tmp (qw/ | ||||
| 392 | LD_RUN_PATH | ||||
| 393 | /) { | ||||
| 394 | next unless $self->{$tmp}; | ||||
| 395 | push @m, "$tmp = $self->{$tmp}\n"; | ||||
| 396 | } | ||||
| 397 | return join "", @m; | ||||
| 398 | } | ||||
| 399 | |||||
| 400 | =item constants (o) | ||||
| 401 | |||||
| 402 | my $make_frag = $mm->constants; | ||||
| 403 | |||||
| 404 | Prints out macros for lots of constants. | ||||
| 405 | |||||
| 406 | =cut | ||||
| 407 | |||||
| 408 | sub constants { | ||||
| 409 | my($self) = @_; | ||||
| 410 | my @m = (); | ||||
| 411 | |||||
| 412 | $self->{DFSEP} = '$(DIRFILESEP)'; # alias for internal use | ||||
| 413 | |||||
| 414 | for my $macro (qw( | ||||
| 415 | |||||
| 416 | AR_STATIC_ARGS DIRFILESEP DFSEP | ||||
| 417 | NAME NAME_SYM | ||||
| 418 | VERSION VERSION_MACRO VERSION_SYM DEFINE_VERSION | ||||
| 419 | XS_VERSION XS_VERSION_MACRO XS_DEFINE_VERSION | ||||
| 420 | INST_ARCHLIB INST_SCRIPT INST_BIN INST_LIB | ||||
| 421 | INST_MAN1DIR INST_MAN3DIR | ||||
| 422 | MAN1EXT MAN3EXT | ||||
| 423 | MAN1SECTION MAN3SECTION | ||||
| 424 | INSTALLDIRS INSTALL_BASE DESTDIR PREFIX | ||||
| 425 | PERLPREFIX SITEPREFIX VENDORPREFIX | ||||
| 426 | ), | ||||
| 427 | (map { ("INSTALL".$_, | ||||
| 428 | "DESTINSTALL".$_) | ||||
| 429 | } $self->installvars), | ||||
| 430 | qw( | ||||
| 431 | PERL_LIB | ||||
| 432 | PERL_ARCHLIB PERL_ARCHLIBDEP | ||||
| 433 | LIBPERL_A MYEXTLIB | ||||
| 434 | FIRST_MAKEFILE MAKEFILE_OLD MAKE_APERL_FILE | ||||
| 435 | PERLMAINCC PERL_SRC PERL_INC PERL_INCDEP | ||||
| 436 | PERL FULLPERL ABSPERL | ||||
| 437 | PERLRUN FULLPERLRUN ABSPERLRUN | ||||
| 438 | PERLRUNINST FULLPERLRUNINST ABSPERLRUNINST | ||||
| 439 | PERL_CORE | ||||
| 440 | PERM_DIR PERM_RW PERM_RWX | ||||
| 441 | |||||
| 442 | ) ) | ||||
| 443 | { | ||||
| 444 | next unless defined $self->{$macro}; | ||||
| 445 | |||||
| 446 | # pathnames can have sharp signs in them; escape them so | ||||
| 447 | # make doesn't think it is a comment-start character. | ||||
| 448 | $self->{$macro} =~ s/#/\\#/g; | ||||
| 449 | $self->{$macro} = $self->quote_dep($self->{$macro}) | ||||
| 450 | if $ExtUtils::MakeMaker::macro_dep{$macro}; | ||||
| 451 | push @m, "$macro = $self->{$macro}\n"; | ||||
| 452 | } | ||||
| 453 | |||||
| 454 | push @m, qq{ | ||||
| 455 | MAKEMAKER = $self->{MAKEMAKER} | ||||
| 456 | MM_VERSION = $self->{MM_VERSION} | ||||
| 457 | MM_REVISION = $self->{MM_REVISION} | ||||
| 458 | }; | ||||
| 459 | |||||
| 460 | push @m, q{ | ||||
| 461 | # FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle). | ||||
| 462 | # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle) | ||||
| 463 | # PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar) | ||||
| 464 | # DLBASE = Basename part of dynamic library. May be just equal BASEEXT. | ||||
| 465 | }; | ||||
| 466 | |||||
| 467 | for my $macro (qw/ | ||||
| 468 | MAKE | ||||
| 469 | FULLEXT BASEEXT PARENT_NAME DLBASE VERSION_FROM INC DEFINE OBJECT | ||||
| 470 | LDFROM LINKTYPE BOOTDEP | ||||
| 471 | / ) | ||||
| 472 | { | ||||
| 473 | next unless defined $self->{$macro}; | ||||
| 474 | push @m, "$macro = $self->{$macro}\n"; | ||||
| 475 | } | ||||
| 476 | |||||
| 477 | push @m, " | ||||
| 478 | # Handy lists of source code files: | ||||
| 479 | XS_FILES = ".$self->wraplist(sort keys %{$self->{XS}})." | ||||
| 480 | C_FILES = ".$self->wraplist(sort @{$self->{C}})." | ||||
| 481 | O_FILES = ".$self->wraplist(sort @{$self->{O_FILES}})." | ||||
| 482 | H_FILES = ".$self->wraplist(sort @{$self->{H}})." | ||||
| 483 | MAN1PODS = ".$self->wraplist(sort keys %{$self->{MAN1PODS}})." | ||||
| 484 | MAN3PODS = ".$self->wraplist(sort keys %{$self->{MAN3PODS}})." | ||||
| 485 | "; | ||||
| 486 | |||||
| 487 | push @m, q{ | ||||
| 488 | SDKROOT := $(shell xcrun --show-sdk-path) | ||||
| 489 | PERL_SYSROOT = $(SDKROOT) | ||||
| 490 | } if $Is{ApplCor} && $self->{'PERL_INC'} =~ m!^/System/Library/Perl/!; | ||||
| 491 | |||||
| 492 | push @m, q{ | ||||
| 493 | # Where is the Config information that we are using/depend on | ||||
| 494 | CONFIGDEP = $(PERL_ARCHLIBDEP)$(DFSEP)Config.pm $(PERL_SYSROOT)$(PERL_INCDEP)$(DFSEP)config.h | ||||
| 495 | } if $Is{ApplCor}; | ||||
| 496 | |||||
| 497 | push @m, q{ | ||||
| 498 | # Where is the Config information that we are using/depend on | ||||
| 499 | CONFIGDEP = $(PERL_ARCHLIBDEP)$(DFSEP)Config.pm $(PERL_INCDEP)$(DFSEP)config.h | ||||
| 500 | } if -e $self->catfile( $self->{PERL_INC}, 'config.h' ) && !$Is{ApplCor}; | ||||
| 501 | |||||
| 502 | push @m, qq{ | ||||
| 503 | # Where to build things | ||||
| 504 | INST_LIBDIR = $self->{INST_LIBDIR} | ||||
| 505 | INST_ARCHLIBDIR = $self->{INST_ARCHLIBDIR} | ||||
| 506 | |||||
| 507 | INST_AUTODIR = $self->{INST_AUTODIR} | ||||
| 508 | INST_ARCHAUTODIR = $self->{INST_ARCHAUTODIR} | ||||
| 509 | |||||
| 510 | INST_STATIC = $self->{INST_STATIC} | ||||
| 511 | INST_DYNAMIC = $self->{INST_DYNAMIC} | ||||
| 512 | INST_BOOT = $self->{INST_BOOT} | ||||
| 513 | }; | ||||
| 514 | |||||
| 515 | push @m, qq{ | ||||
| 516 | # Extra linker info | ||||
| 517 | EXPORT_LIST = $self->{EXPORT_LIST} | ||||
| 518 | PERL_ARCHIVE = $self->{PERL_ARCHIVE} | ||||
| 519 | PERL_ARCHIVEDEP = $self->{PERL_ARCHIVEDEP} | ||||
| 520 | PERL_ARCHIVE_AFTER = $self->{PERL_ARCHIVE_AFTER} | ||||
| 521 | }; | ||||
| 522 | |||||
| 523 | push @m, " | ||||
| 524 | |||||
| 525 | TO_INST_PM = ".$self->wraplist(map $self->quote_dep($_), sort keys %{$self->{PM}})."\n"; | ||||
| 526 | |||||
| 527 | join('',@m); | ||||
| 528 | } | ||||
| 529 | |||||
| 530 | |||||
| 531 | =item depend (o) | ||||
| 532 | |||||
| 533 | Same as macro for the depend attribute. | ||||
| 534 | |||||
| 535 | =cut | ||||
| 536 | |||||
| 537 | sub depend { | ||||
| 538 | my($self,%attribs) = @_; | ||||
| 539 | my(@m,$key,$val); | ||||
| 540 | for my $key (sort keys %attribs){ | ||||
| 541 | my $val = $attribs{$key}; | ||||
| 542 | next unless defined $key and defined $val; | ||||
| 543 | push @m, "$key : $val\n"; | ||||
| 544 | } | ||||
| 545 | join "", @m; | ||||
| 546 | } | ||||
| 547 | |||||
| 548 | |||||
| 549 | =item init_DEST | ||||
| 550 | |||||
| 551 | $mm->init_DEST | ||||
| 552 | |||||
| 553 | Defines the DESTDIR and DEST* variables paralleling the INSTALL*. | ||||
| 554 | |||||
| 555 | =cut | ||||
| 556 | |||||
| 557 | sub init_DEST { | ||||
| 558 | my $self = shift; | ||||
| 559 | |||||
| 560 | # Initialize DESTDIR | ||||
| 561 | $self->{DESTDIR} ||= ''; | ||||
| 562 | |||||
| 563 | # Make DEST variables. | ||||
| 564 | foreach my $var ($self->installvars) { | ||||
| 565 | my $destvar = 'DESTINSTALL'.$var; | ||||
| 566 | $self->{$destvar} ||= '$(DESTDIR)$(INSTALL'.$var.')'; | ||||
| 567 | } | ||||
| 568 | } | ||||
| 569 | |||||
| 570 | |||||
| 571 | =item init_dist | ||||
| 572 | |||||
| 573 | $mm->init_dist; | ||||
| 574 | |||||
| 575 | Defines a lot of macros for distribution support. | ||||
| 576 | |||||
| 577 | macro description default | ||||
| 578 | |||||
| 579 | TAR tar command to use tar | ||||
| 580 | TARFLAGS flags to pass to TAR cvf | ||||
| 581 | |||||
| 582 | ZIP zip command to use zip | ||||
| 583 | ZIPFLAGS flags to pass to ZIP -r | ||||
| 584 | |||||
| 585 | COMPRESS compression command to gzip --best | ||||
| 586 | use for tarfiles | ||||
| 587 | SUFFIX suffix to put on .gz | ||||
| 588 | compressed files | ||||
| 589 | |||||
| 590 | SHAR shar command to use shar | ||||
| 591 | |||||
| 592 | PREOP extra commands to run before | ||||
| 593 | making the archive | ||||
| 594 | POSTOP extra commands to run after | ||||
| 595 | making the archive | ||||
| 596 | |||||
| 597 | TO_UNIX a command to convert linefeeds | ||||
| 598 | to Unix style in your archive | ||||
| 599 | |||||
| 600 | CI command to checkin your ci -u | ||||
| 601 | sources to version control | ||||
| 602 | RCS_LABEL command to label your sources rcs -Nv$(VERSION_SYM): -q | ||||
| 603 | just after CI is run | ||||
| 604 | |||||
| 605 | DIST_CP $how argument to manicopy() best | ||||
| 606 | when the distdir is created | ||||
| 607 | |||||
| 608 | DIST_DEFAULT default target to use to tardist | ||||
| 609 | create a distribution | ||||
| 610 | |||||
| 611 | DISTVNAME name of the resulting archive $(DISTNAME)-$(VERSION) | ||||
| 612 | (minus suffixes) | ||||
| 613 | |||||
| 614 | =cut | ||||
| 615 | |||||
| 616 | sub init_dist { | ||||
| 617 | my $self = shift; | ||||
| 618 | |||||
| 619 | $self->{TAR} ||= 'tar'; | ||||
| 620 | $self->{TARFLAGS} ||= 'cvf'; | ||||
| 621 | $self->{ZIP} ||= 'zip'; | ||||
| 622 | $self->{ZIPFLAGS} ||= '-r'; | ||||
| 623 | $self->{COMPRESS} ||= 'gzip --best'; | ||||
| 624 | $self->{SUFFIX} ||= '.gz'; | ||||
| 625 | $self->{SHAR} ||= 'shar'; | ||||
| 626 | $self->{PREOP} ||= '$(NOECHO) $(NOOP)'; # eg update MANIFEST | ||||
| 627 | $self->{POSTOP} ||= '$(NOECHO) $(NOOP)'; # eg remove the distdir | ||||
| 628 | $self->{TO_UNIX} ||= '$(NOECHO) $(NOOP)'; | ||||
| 629 | |||||
| 630 | $self->{CI} ||= 'ci -u'; | ||||
| 631 | $self->{RCS_LABEL}||= 'rcs -Nv$(VERSION_SYM): -q'; | ||||
| 632 | $self->{DIST_CP} ||= 'best'; | ||||
| 633 | $self->{DIST_DEFAULT} ||= 'tardist'; | ||||
| 634 | |||||
| 635 | ($self->{DISTNAME} = $self->{NAME}) =~ s{::}{-}g unless $self->{DISTNAME}; | ||||
| 636 | $self->{DISTVNAME} ||= $self->{DISTNAME}.'-'.$self->{VERSION}; | ||||
| 637 | } | ||||
| 638 | |||||
| 639 | =item dist (o) | ||||
| 640 | |||||
| 641 | my $dist_macros = $mm->dist(%overrides); | ||||
| 642 | |||||
| 643 | Generates a make fragment defining all the macros initialized in | ||||
| 644 | init_dist. | ||||
| 645 | |||||
| 646 | %overrides can be used to override any of the above. | ||||
| 647 | |||||
| 648 | =cut | ||||
| 649 | |||||
| 650 | sub dist { | ||||
| 651 | my($self, %attribs) = @_; | ||||
| 652 | |||||
| 653 | my $make = ''; | ||||
| 654 | if ( $attribs{SUFFIX} && $attribs{SUFFIX} !~ m!^\.! ) { | ||||
| 655 | $attribs{SUFFIX} = '.' . $attribs{SUFFIX}; | ||||
| 656 | } | ||||
| 657 | foreach my $key (qw( | ||||
| 658 | TAR TARFLAGS ZIP ZIPFLAGS COMPRESS SUFFIX SHAR | ||||
| 659 | PREOP POSTOP TO_UNIX | ||||
| 660 | CI RCS_LABEL DIST_CP DIST_DEFAULT | ||||
| 661 | DISTNAME DISTVNAME | ||||
| 662 | )) | ||||
| 663 | { | ||||
| 664 | my $value = $attribs{$key} || $self->{$key}; | ||||
| 665 | $make .= "$key = $value\n"; | ||||
| 666 | } | ||||
| 667 | |||||
| 668 | return $make; | ||||
| 669 | } | ||||
| 670 | |||||
| 671 | =item dist_basics (o) | ||||
| 672 | |||||
| 673 | Defines the targets distclean, distcheck, skipcheck, manifest, veryclean. | ||||
| 674 | |||||
| 675 | =cut | ||||
| 676 | |||||
| 677 | sub dist_basics { | ||||
| 678 | my($self) = shift; | ||||
| 679 | |||||
| 680 | return <<'MAKE_FRAG'; | ||||
| 681 | distclean :: realclean distcheck | ||||
| 682 | $(NOECHO) $(NOOP) | ||||
| 683 | |||||
| 684 | distcheck : | ||||
| 685 | $(PERLRUN) "-MExtUtils::Manifest=fullcheck" -e fullcheck | ||||
| 686 | |||||
| 687 | skipcheck : | ||||
| 688 | $(PERLRUN) "-MExtUtils::Manifest=skipcheck" -e skipcheck | ||||
| 689 | |||||
| 690 | manifest : | ||||
| 691 | $(PERLRUN) "-MExtUtils::Manifest=mkmanifest" -e mkmanifest | ||||
| 692 | |||||
| 693 | veryclean : realclean | ||||
| 694 | $(RM_F) *~ */*~ *.orig */*.orig *.bak */*.bak *.old */*.old | ||||
| 695 | |||||
| 696 | MAKE_FRAG | ||||
| 697 | |||||
| 698 | } | ||||
| 699 | |||||
| 700 | =item dist_ci (o) | ||||
| 701 | |||||
| 702 | Defines a check in target for RCS. | ||||
| 703 | |||||
| 704 | =cut | ||||
| 705 | |||||
| 706 | sub dist_ci { | ||||
| 707 | my($self) = shift; | ||||
| 708 | return sprintf "ci :\n\t%s\n", $self->oneliner(<<'EOF', [qw(-MExtUtils::Manifest=maniread)]); | ||||
| 709 | @all = sort keys %{ maniread() }; | ||||
| 710 | print(qq{Executing $(CI) @all\n}); | ||||
| 711 | system(qq{$(CI) @all}) == 0 or die $!; | ||||
| 712 | print(qq{Executing $(RCS_LABEL) ...\n}); | ||||
| 713 | system(qq{$(RCS_LABEL) @all}) == 0 or die $!; | ||||
| 714 | EOF | ||||
| 715 | } | ||||
| 716 | |||||
| 717 | =item dist_core (o) | ||||
| 718 | |||||
| 719 | my $dist_make_fragment = $MM->dist_core; | ||||
| 720 | |||||
| 721 | Puts the targets necessary for 'make dist' together into one make | ||||
| 722 | fragment. | ||||
| 723 | |||||
| 724 | =cut | ||||
| 725 | |||||
| 726 | sub dist_core { | ||||
| 727 | my($self) = shift; | ||||
| 728 | |||||
| 729 | my $make_frag = ''; | ||||
| 730 | foreach my $target (qw(dist tardist uutardist tarfile zipdist zipfile | ||||
| 731 | shdist)) | ||||
| 732 | { | ||||
| 733 | my $method = $target.'_target'; | ||||
| 734 | $make_frag .= "\n"; | ||||
| 735 | $make_frag .= $self->$method(); | ||||
| 736 | } | ||||
| 737 | |||||
| 738 | return $make_frag; | ||||
| 739 | } | ||||
| 740 | |||||
| 741 | |||||
| 742 | =item B<dist_target> | ||||
| 743 | |||||
| 744 | my $make_frag = $MM->dist_target; | ||||
| 745 | |||||
| 746 | Returns the 'dist' target to make an archive for distribution. This | ||||
| 747 | target simply checks to make sure the Makefile is up-to-date and | ||||
| 748 | depends on $(DIST_DEFAULT). | ||||
| 749 | |||||
| 750 | =cut | ||||
| 751 | |||||
| 752 | sub dist_target { | ||||
| 753 | my($self) = shift; | ||||
| 754 | |||||
| 755 | my $date_check = $self->oneliner(<<'CODE', ['-l']); | ||||
| 756 | print 'Warning: Makefile possibly out of date with $(VERSION_FROM)' | ||||
| 757 | if -e '$(VERSION_FROM)' and -M '$(VERSION_FROM)' < -M '$(FIRST_MAKEFILE)'; | ||||
| 758 | CODE | ||||
| 759 | |||||
| 760 | return sprintf <<'MAKE_FRAG', $date_check; | ||||
| 761 | dist : $(DIST_DEFAULT) $(FIRST_MAKEFILE) | ||||
| 762 | $(NOECHO) %s | ||||
| 763 | MAKE_FRAG | ||||
| 764 | } | ||||
| 765 | |||||
| 766 | =item B<tardist_target> | ||||
| 767 | |||||
| 768 | my $make_frag = $MM->tardist_target; | ||||
| 769 | |||||
| 770 | Returns the 'tardist' target which is simply so 'make tardist' works. | ||||
| 771 | The real work is done by the dynamically named tardistfile_target() | ||||
| 772 | method, tardist should have that as a dependency. | ||||
| 773 | |||||
| 774 | =cut | ||||
| 775 | |||||
| 776 | sub tardist_target { | ||||
| 777 | my($self) = shift; | ||||
| 778 | |||||
| 779 | return <<'MAKE_FRAG'; | ||||
| 780 | tardist : $(DISTVNAME).tar$(SUFFIX) | ||||
| 781 | $(NOECHO) $(NOOP) | ||||
| 782 | MAKE_FRAG | ||||
| 783 | } | ||||
| 784 | |||||
| 785 | =item B<zipdist_target> | ||||
| 786 | |||||
| 787 | my $make_frag = $MM->zipdist_target; | ||||
| 788 | |||||
| 789 | Returns the 'zipdist' target which is simply so 'make zipdist' works. | ||||
| 790 | The real work is done by the dynamically named zipdistfile_target() | ||||
| 791 | method, zipdist should have that as a dependency. | ||||
| 792 | |||||
| 793 | =cut | ||||
| 794 | |||||
| 795 | sub zipdist_target { | ||||
| 796 | my($self) = shift; | ||||
| 797 | |||||
| 798 | return <<'MAKE_FRAG'; | ||||
| 799 | zipdist : $(DISTVNAME).zip | ||||
| 800 | $(NOECHO) $(NOOP) | ||||
| 801 | MAKE_FRAG | ||||
| 802 | } | ||||
| 803 | |||||
| 804 | =item B<tarfile_target> | ||||
| 805 | |||||
| 806 | my $make_frag = $MM->tarfile_target; | ||||
| 807 | |||||
| 808 | The name of this target is the name of the tarball generated by | ||||
| 809 | tardist. This target does the actual work of turning the distdir into | ||||
| 810 | a tarball. | ||||
| 811 | |||||
| 812 | =cut | ||||
| 813 | |||||
| 814 | sub tarfile_target { | ||||
| 815 | my($self) = shift; | ||||
| 816 | |||||
| 817 | return <<'MAKE_FRAG'; | ||||
| 818 | $(DISTVNAME).tar$(SUFFIX) : distdir | ||||
| 819 | $(PREOP) | ||||
| 820 | $(TO_UNIX) | ||||
| 821 | $(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME) | ||||
| 822 | $(RM_RF) $(DISTVNAME) | ||||
| 823 | $(COMPRESS) $(DISTVNAME).tar | ||||
| 824 | $(NOECHO) $(ECHO) 'Created $(DISTVNAME).tar$(SUFFIX)' | ||||
| 825 | $(POSTOP) | ||||
| 826 | MAKE_FRAG | ||||
| 827 | } | ||||
| 828 | |||||
| 829 | =item zipfile_target | ||||
| 830 | |||||
| 831 | my $make_frag = $MM->zipfile_target; | ||||
| 832 | |||||
| 833 | The name of this target is the name of the zip file generated by | ||||
| 834 | zipdist. This target does the actual work of turning the distdir into | ||||
| 835 | a zip file. | ||||
| 836 | |||||
| 837 | =cut | ||||
| 838 | |||||
| 839 | sub zipfile_target { | ||||
| 840 | my($self) = shift; | ||||
| 841 | |||||
| 842 | return <<'MAKE_FRAG'; | ||||
| 843 | $(DISTVNAME).zip : distdir | ||||
| 844 | $(PREOP) | ||||
| 845 | $(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME) | ||||
| 846 | $(RM_RF) $(DISTVNAME) | ||||
| 847 | $(NOECHO) $(ECHO) 'Created $(DISTVNAME).zip' | ||||
| 848 | $(POSTOP) | ||||
| 849 | MAKE_FRAG | ||||
| 850 | } | ||||
| 851 | |||||
| 852 | =item uutardist_target | ||||
| 853 | |||||
| 854 | my $make_frag = $MM->uutardist_target; | ||||
| 855 | |||||
| 856 | Converts the tarfile into a uuencoded file | ||||
| 857 | |||||
| 858 | =cut | ||||
| 859 | |||||
| 860 | sub uutardist_target { | ||||
| 861 | my($self) = shift; | ||||
| 862 | |||||
| 863 | return <<'MAKE_FRAG'; | ||||
| 864 | uutardist : $(DISTVNAME).tar$(SUFFIX) | ||||
| 865 | uuencode $(DISTVNAME).tar$(SUFFIX) $(DISTVNAME).tar$(SUFFIX) > $(DISTVNAME).tar$(SUFFIX)_uu | ||||
| 866 | $(NOECHO) $(ECHO) 'Created $(DISTVNAME).tar$(SUFFIX)_uu' | ||||
| 867 | MAKE_FRAG | ||||
| 868 | } | ||||
| 869 | |||||
| 870 | |||||
| 871 | =item shdist_target | ||||
| 872 | |||||
| 873 | my $make_frag = $MM->shdist_target; | ||||
| 874 | |||||
| 875 | Converts the distdir into a shell archive. | ||||
| 876 | |||||
| 877 | =cut | ||||
| 878 | |||||
| 879 | sub shdist_target { | ||||
| 880 | my($self) = shift; | ||||
| 881 | |||||
| 882 | return <<'MAKE_FRAG'; | ||||
| 883 | shdist : distdir | ||||
| 884 | $(PREOP) | ||||
| 885 | $(SHAR) $(DISTVNAME) > $(DISTVNAME).shar | ||||
| 886 | $(RM_RF) $(DISTVNAME) | ||||
| 887 | $(NOECHO) $(ECHO) 'Created $(DISTVNAME).shar' | ||||
| 888 | $(POSTOP) | ||||
| 889 | MAKE_FRAG | ||||
| 890 | } | ||||
| 891 | |||||
| 892 | |||||
| 893 | =item dlsyms (o) | ||||
| 894 | |||||
| 895 | Used by some OS' to define DL_FUNCS and DL_VARS and write the *.exp files. | ||||
| 896 | |||||
| 897 | Normally just returns an empty string. | ||||
| 898 | |||||
| 899 | =cut | ||||
| 900 | |||||
| 901 | sub dlsyms { | ||||
| 902 | return ''; | ||||
| 903 | } | ||||
| 904 | |||||
| 905 | |||||
| 906 | =item dynamic_bs (o) | ||||
| 907 | |||||
| 908 | Defines targets for bootstrap files. | ||||
| 909 | |||||
| 910 | =cut | ||||
| 911 | |||||
| 912 | sub dynamic_bs { | ||||
| 913 | my($self, %attribs) = @_; | ||||
| 914 | return "\nBOOTSTRAP =\n" unless $self->has_link_code(); | ||||
| 915 | my @exts; | ||||
| 916 | if ($self->{XSMULTI}) { | ||||
| 917 | @exts = $self->_xs_list_basenames; | ||||
| 918 | } else { | ||||
| 919 | @exts = '$(BASEEXT)'; | ||||
| 920 | } | ||||
| 921 | return join "\n", | ||||
| 922 | "BOOTSTRAP = @{[map { qq{$_.bs} } @exts]}\n", | ||||
| 923 | map { $self->_xs_make_bs($_) } @exts; | ||||
| 924 | } | ||||
| 925 | |||||
| 926 | sub _xs_make_bs { | ||||
| 927 | my ($self, $basename) = @_; | ||||
| 928 | my ($v, $d, $f) = File::Spec->splitpath($basename); | ||||
| 929 | my @d = File::Spec->splitdir($d); | ||||
| 930 | shift @d if $self->{XSMULTI} and $d[0] eq 'lib'; | ||||
| 931 | my $instdir = $self->catdir('$(INST_ARCHLIB)', 'auto', @d, $f); | ||||
| 932 | $instdir = '$(INST_ARCHAUTODIR)' if $basename eq '$(BASEEXT)'; | ||||
| 933 | my $instfile = $self->catfile($instdir, "$f.bs"); | ||||
| 934 | my $exists = "$instdir\$(DFSEP).exists"; # match blibdirs_target | ||||
| 935 | # 1 2 3 | ||||
| 936 | return _sprintf562 <<'MAKE_FRAG', $basename, $instfile, $exists; | ||||
| 937 | # As Mkbootstrap might not write a file (if none is required) | ||||
| 938 | # we use touch to prevent make continually trying to remake it. | ||||
| 939 | # The DynaLoader only reads a non-empty file. | ||||
| 940 | %1$s.bs : $(FIRST_MAKEFILE) $(BOOTDEP) | ||||
| 941 | $(NOECHO) $(ECHO) "Running Mkbootstrap for %1$s ($(BSLOADLIBS))" | ||||
| 942 | $(NOECHO) $(PERLRUN) \ | ||||
| 943 | "-MExtUtils::Mkbootstrap" \ | ||||
| 944 | -e "Mkbootstrap('%1$s','$(BSLOADLIBS)');" | ||||
| 945 | $(NOECHO) $(TOUCH) "%1$s.bs" | ||||
| 946 | $(CHMOD) $(PERM_RW) "%1$s.bs" | ||||
| 947 | |||||
| 948 | %2$s : %1$s.bs %3$s | ||||
| 949 | $(NOECHO) $(RM_RF) %2$s | ||||
| 950 | - $(CP_NONEMPTY) %1$s.bs %2$s $(PERM_RW) | ||||
| 951 | MAKE_FRAG | ||||
| 952 | } | ||||
| 953 | |||||
| 954 | =item dynamic_lib (o) | ||||
| 955 | |||||
| 956 | Defines how to produce the *.so (or equivalent) files. | ||||
| 957 | |||||
| 958 | =cut | ||||
| 959 | |||||
| 960 | sub dynamic_lib { | ||||
| 961 | my($self, %attribs) = @_; | ||||
| 962 | return '' unless $self->needs_linking(); #might be because of a subdir | ||||
| 963 | return '' unless $self->has_link_code; | ||||
| 964 | my @m = $self->xs_dynamic_lib_macros(\%attribs); | ||||
| 965 | my @libs; | ||||
| 966 | my $dlsyms_ext = eval { $self->xs_dlsyms_ext }; | ||||
| 967 | if ($self->{XSMULTI}) { | ||||
| 968 | my @exts = $self->_xs_list_basenames; | ||||
| 969 | for my $ext (@exts) { | ||||
| 970 | my ($v, $d, $f) = File::Spec->splitpath($ext); | ||||
| 971 | my @d = File::Spec->splitdir($d); | ||||
| 972 | shift @d if $d[0] eq 'lib'; | ||||
| 973 | pop @d if $d[$#d] eq ''; | ||||
| 974 | my $instdir = $self->catdir('$(INST_ARCHLIB)', 'auto', @d, $f); | ||||
| 975 | |||||
| 976 | # Dynamic library names may need special handling. | ||||
| 977 | eval { require DynaLoader }; | ||||
| 978 | if (defined &DynaLoader::mod2fname) { | ||||
| 979 | $f = &DynaLoader::mod2fname([@d, $f]); | ||||
| 980 | } | ||||
| 981 | |||||
| 982 | my $instfile = $self->catfile($instdir, "$f.\$(DLEXT)"); | ||||
| 983 | my $objfile = $self->_xsbuild_value('xs', $ext, 'OBJECT'); | ||||
| 984 | $objfile = "$ext\$(OBJ_EXT)" unless defined $objfile; | ||||
| 985 | my $ldfrom = $self->_xsbuild_value('xs', $ext, 'LDFROM'); | ||||
| 986 | $ldfrom = $objfile unless defined $ldfrom; | ||||
| 987 | my $exportlist = "$ext.def"; | ||||
| 988 | my @libchunk = ($objfile, $instfile, $instdir, $ldfrom, $exportlist); | ||||
| 989 | push @libchunk, $dlsyms_ext ? $ext.$dlsyms_ext : undef; | ||||
| 990 | push @libs, \@libchunk; | ||||
| 991 | } | ||||
| 992 | } else { | ||||
| 993 | my @libchunk = qw($(OBJECT) $(INST_DYNAMIC) $(INST_ARCHAUTODIR) $(LDFROM) $(EXPORT_LIST)); | ||||
| 994 | push @libchunk, $dlsyms_ext ? '$(BASEEXT)'.$dlsyms_ext : undef; | ||||
| 995 | @libs = (\@libchunk); | ||||
| 996 | } | ||||
| 997 | push @m, map { $self->xs_make_dynamic_lib(\%attribs, @$_); } @libs; | ||||
| 998 | |||||
| 999 | return join("\n",@m); | ||||
| 1000 | } | ||||
| 1001 | |||||
| 1002 | =item xs_dynamic_lib_macros | ||||
| 1003 | |||||
| 1004 | Defines the macros for the C<dynamic_lib> section. | ||||
| 1005 | |||||
| 1006 | =cut | ||||
| 1007 | |||||
| 1008 | sub xs_dynamic_lib_macros { | ||||
| 1009 | my ($self, $attribs) = @_; | ||||
| 1010 | my $otherldflags = $attribs->{OTHERLDFLAGS} || ""; | ||||
| 1011 | my $inst_dynamic_dep = $attribs->{INST_DYNAMIC_DEP} || ""; | ||||
| 1012 | my $armaybe = $self->_xs_armaybe($attribs); | ||||
| 1013 | my $ld_opt = $Is{OS2} ? '$(OPTIMIZE) ' : ''; # Useful on other systems too? | ||||
| 1014 | my $ld_fix = $Is{OS2} ? '|| ( $(RM_F) $@ && sh -c false )' : ''; | ||||
| 1015 | sprintf <<'EOF', $armaybe, $ld_opt.$otherldflags, $inst_dynamic_dep, $ld_fix; | ||||
| 1016 | # This section creates the dynamically loadable objects from relevant | ||||
| 1017 | # objects and possibly $(MYEXTLIB). | ||||
| 1018 | ARMAYBE = %s | ||||
| 1019 | OTHERLDFLAGS = %s | ||||
| 1020 | INST_DYNAMIC_DEP = %s | ||||
| 1021 | INST_DYNAMIC_FIX = %s | ||||
| 1022 | EOF | ||||
| 1023 | } | ||||
| 1024 | |||||
| 1025 | sub _xs_armaybe { | ||||
| 1026 | my ($self, $attribs) = @_; | ||||
| 1027 | my $armaybe = $attribs->{ARMAYBE} || $self->{ARMAYBE} || ":"; | ||||
| 1028 | $armaybe = 'ar' if ($Is{OSF} and $armaybe eq ':'); | ||||
| 1029 | $armaybe; | ||||
| 1030 | } | ||||
| 1031 | |||||
| 1032 | =item xs_make_dynamic_lib | ||||
| 1033 | |||||
| 1034 | Defines the recipes for the C<dynamic_lib> section. | ||||
| 1035 | |||||
| 1036 | =cut | ||||
| 1037 | |||||
| 1038 | sub xs_make_dynamic_lib { | ||||
| 1039 | my ($self, $attribs, $object, $to, $todir, $ldfrom, $exportlist, $dlsyms) = @_; | ||||
| 1040 | $exportlist = '' if $exportlist ne '$(EXPORT_LIST)'; | ||||
| 1041 | my $armaybe = $self->_xs_armaybe($attribs); | ||||
| 1042 | my @m = sprintf '%s : %s $(MYEXTLIB) %s$(DFSEP).exists %s $(PERL_ARCHIVEDEP) $(PERL_ARCHIVE_AFTER) $(INST_DYNAMIC_DEP) %s'."\n", $to, $object, $todir, $exportlist, ($dlsyms || ''); | ||||
| 1043 | my $dlsyms_arg = $self->xs_dlsyms_arg($dlsyms); | ||||
| 1044 | if ($armaybe ne ':'){ | ||||
| 1045 | $ldfrom = 'tmp$(LIB_EXT)'; | ||||
| 1046 | push(@m," \$(ARMAYBE) cr $ldfrom $object\n"); | ||||
| 1047 | push(@m," \$(RANLIB) $ldfrom\n"); | ||||
| 1048 | } | ||||
| 1049 | $ldfrom = "-all $ldfrom -none" if $Is{OSF}; | ||||
| 1050 | |||||
| 1051 | my $ldrun = ''; | ||||
| 1052 | # The IRIX linker doesn't use LD_RUN_PATH | ||||
| 1053 | if ( $self->{LD_RUN_PATH} ) { | ||||
| 1054 | if ( $Is{IRIX} ) { | ||||
| 1055 | $ldrun = qq{-rpath "$self->{LD_RUN_PATH}"}; | ||||
| 1056 | } | ||||
| 1057 | elsif ( $^O eq 'darwin' ) { | ||||
| 1058 | # both clang and gcc support -Wl,-rpath, but only clang supports | ||||
| 1059 | # -rpath so by using -Wl,-rpath we avoid having to check for the | ||||
| 1060 | # type of compiler | ||||
| 1061 | $ldrun = qq{-Wl,-rpath,"$self->{LD_RUN_PATH}"}; | ||||
| 1062 | } | ||||
| 1063 | } | ||||
| 1064 | |||||
| 1065 | # For example in AIX the shared objects/libraries from previous builds | ||||
| 1066 | # linger quite a while in the shared dynalinker cache even when nobody | ||||
| 1067 | # is using them. This is painful if one for instance tries to restart | ||||
| 1068 | # a failed build because the link command will fail unnecessarily 'cos | ||||
| 1069 | # the shared object/library is 'busy'. | ||||
| 1070 | push(@m," \$(RM_F) \$\@\n"); | ||||
| 1071 | |||||
| 1072 | my $libs = '$(LDLOADLIBS)'; | ||||
| 1073 | if (($Is{NetBSD} || $Is{Interix} || $Is{Android}) && $Config{'useshrplib'} eq 'true') { | ||||
| 1074 | # Use nothing on static perl platforms, and to the flags needed | ||||
| 1075 | # to link against the shared libperl library on shared perl | ||||
| 1076 | # platforms. We peek at lddlflags to see if we need -Wl,-R | ||||
| 1077 | # or -R to add paths to the run-time library search path. | ||||
| 1078 | if ($Config{'lddlflags'} =~ /-Wl,-R/) { | ||||
| 1079 | $libs .= ' "-L$(PERL_INC)" "-Wl,-R$(INSTALLARCHLIB)/CORE" "-Wl,-R$(PERL_ARCHLIB)/CORE" -lperl'; | ||||
| 1080 | } elsif ($Config{'lddlflags'} =~ /-R/) { | ||||
| 1081 | $libs .= ' "-L$(PERL_INC)" "-R$(INSTALLARCHLIB)/CORE" "-R$(PERL_ARCHLIB)/CORE" -lperl'; | ||||
| 1082 | } elsif ( $Is{Android} ) { | ||||
| 1083 | # The Android linker will not recognize symbols from | ||||
| 1084 | # libperl unless the module explicitly depends on it. | ||||
| 1085 | $libs .= ' "-L$(PERL_INC)" -lperl'; | ||||
| 1086 | } | ||||
| 1087 | } | ||||
| 1088 | |||||
| 1089 | my $ld_run_path_shell = ""; | ||||
| 1090 | if ($self->{LD_RUN_PATH} ne "") { | ||||
| 1091 | $ld_run_path_shell = 'LD_RUN_PATH="$(LD_RUN_PATH)" '; | ||||
| 1092 | } | ||||
| 1093 | |||||
| 1094 | push @m, sprintf <<'MAKE', $ld_run_path_shell, $ldrun, $dlsyms_arg, $ldfrom, $self->xs_obj_opt('$@'), $libs, $exportlist; | ||||
| 1095 | %s$(LD) %s $(LDDLFLAGS) %s %s $(OTHERLDFLAGS) %s $(MYEXTLIB) \ | ||||
| 1096 | $(PERL_ARCHIVE) %s $(PERL_ARCHIVE_AFTER) %s \ | ||||
| 1097 | $(INST_DYNAMIC_FIX) | ||||
| 1098 | $(CHMOD) $(PERM_RWX) $@ | ||||
| 1099 | MAKE | ||||
| 1100 | join '', @m; | ||||
| 1101 | } | ||||
| 1102 | |||||
| 1103 | =item exescan | ||||
| 1104 | |||||
| 1105 | Deprecated method. Use libscan instead. | ||||
| 1106 | |||||
| 1107 | =cut | ||||
| 1108 | |||||
| 1109 | sub exescan { | ||||
| 1110 | my($self,$path) = @_; | ||||
| 1111 | $path; | ||||
| 1112 | } | ||||
| 1113 | |||||
| 1114 | =item extliblist | ||||
| 1115 | |||||
| 1116 | Called by init_others, and calls ext ExtUtils::Liblist. See | ||||
| 1117 | L<ExtUtils::Liblist> for details. | ||||
| 1118 | |||||
| 1119 | =cut | ||||
| 1120 | |||||
| 1121 | sub extliblist { | ||||
| 1122 | my($self,$libs) = @_; | ||||
| 1123 | require ExtUtils::Liblist; | ||||
| 1124 | $self->ext($libs, $Verbose); | ||||
| 1125 | } | ||||
| 1126 | |||||
| 1127 | =item find_perl | ||||
| 1128 | |||||
| 1129 | Finds the executables PERL and FULLPERL | ||||
| 1130 | |||||
| 1131 | =cut | ||||
| 1132 | |||||
| 1133 | sub find_perl { | ||||
| 1134 | my($self, $ver, $names, $dirs, $trace) = @_; | ||||
| 1135 | if ($trace >= 2){ | ||||
| 1136 | print "Looking for perl $ver by these names: | ||||
| 1137 | @$names | ||||
| 1138 | in these dirs: | ||||
| 1139 | @$dirs | ||||
| 1140 | "; | ||||
| 1141 | } | ||||
| 1142 | |||||
| 1143 | my $stderr_duped = 0; | ||||
| 1144 | local *STDERR_COPY; | ||||
| 1145 | |||||
| 1146 | unless ($Is{BSD}) { | ||||
| 1147 | # >& and lexical filehandles together give 5.6.2 indigestion | ||||
| 1148 | if( open(STDERR_COPY, '>&STDERR') ) { ## no critic | ||||
| 1149 | $stderr_duped = 1; | ||||
| 1150 | } | ||||
| 1151 | else { | ||||
| 1152 | warn <<WARNING; | ||||
| 1153 | find_perl() can't dup STDERR: $! | ||||
| 1154 | You might see some garbage while we search for Perl | ||||
| 1155 | WARNING | ||||
| 1156 | } | ||||
| 1157 | } | ||||
| 1158 | |||||
| 1159 | foreach my $name (@$names){ | ||||
| 1160 | my ($abs, $use_dir); | ||||
| 1161 | if ($self->file_name_is_absolute($name)) { # /foo/bar | ||||
| 1162 | $abs = $name; | ||||
| 1163 | } elsif ($self->canonpath($name) eq | ||||
| 1164 | $self->canonpath(basename($name))) { # foo | ||||
| 1165 | $use_dir = 1; | ||||
| 1166 | } else { # foo/bar | ||||
| 1167 | $abs = $self->catfile($Curdir, $name); | ||||
| 1168 | } | ||||
| 1169 | foreach my $dir ($use_dir ? @$dirs : 1){ | ||||
| 1170 | next unless defined $dir; # $self->{PERL_SRC} may be undefined | ||||
| 1171 | |||||
| 1172 | $abs = $self->catfile($dir, $name) | ||||
| 1173 | if $use_dir; | ||||
| 1174 | |||||
| 1175 | print "Checking $abs\n" if ($trace >= 2); | ||||
| 1176 | next unless $self->maybe_command($abs); | ||||
| 1177 | print "Executing $abs\n" if ($trace >= 2); | ||||
| 1178 | |||||
| 1179 | my $val; | ||||
| 1180 | my $version_check = qq{"$abs" -le "require $ver; print qq{VER_OK}"}; | ||||
| 1181 | |||||
| 1182 | # To avoid using the unportable 2>&1 to suppress STDERR, | ||||
| 1183 | # we close it before running the command. | ||||
| 1184 | # However, thanks to a thread library bug in many BSDs | ||||
| 1185 | # ( http://www.freebsd.org/cgi/query-pr.cgi?pr=51535 ) | ||||
| 1186 | # we cannot use the fancier more portable way in here | ||||
| 1187 | # but instead need to use the traditional 2>&1 construct. | ||||
| 1188 | if ($Is{BSD}) { | ||||
| 1189 | $val = `$version_check 2>&1`; | ||||
| 1190 | } else { | ||||
| 1191 | close STDERR if $stderr_duped; | ||||
| 1192 | $val = `$version_check`; | ||||
| 1193 | |||||
| 1194 | # 5.6.2's 3-arg open doesn't work with >& | ||||
| 1195 | open STDERR, ">&STDERR_COPY" ## no critic | ||||
| 1196 | if $stderr_duped; | ||||
| 1197 | } | ||||
| 1198 | |||||
| 1199 | if ($val =~ /^VER_OK/m) { | ||||
| 1200 | print "Using PERL=$abs\n" if $trace; | ||||
| 1201 | return $abs; | ||||
| 1202 | } elsif ($trace >= 2) { | ||||
| 1203 | print "Result: '$val' ".($? >> 8)."\n"; | ||||
| 1204 | } | ||||
| 1205 | } | ||||
| 1206 | } | ||||
| 1207 | print "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n"; | ||||
| 1208 | 0; # false and not empty | ||||
| 1209 | } | ||||
| 1210 | |||||
| 1211 | |||||
| 1212 | =item fixin | ||||
| 1213 | |||||
| 1214 | $mm->fixin(@files); | ||||
| 1215 | |||||
| 1216 | Inserts the sharpbang or equivalent magic number to a set of @files. | ||||
| 1217 | |||||
| 1218 | =cut | ||||
| 1219 | |||||
| 1220 | sub fixin { # stolen from the pink Camel book, more or less | ||||
| 1221 | my ( $self, @files ) = @_; | ||||
| 1222 | |||||
| 1223 | for my $file (@files) { | ||||
| 1224 | my $file_new = "$file.new"; | ||||
| 1225 | my $file_bak = "$file.bak"; | ||||
| 1226 | |||||
| 1227 | open( my $fixin, '<', $file ) or croak "Can't process '$file': $!"; | ||||
| 1228 | local $/ = "\n"; | ||||
| 1229 | chomp( my $line = <$fixin> ); | ||||
| 1230 | next unless $line =~ s/^\s*\#!\s*//; # Not a shebang file. | ||||
| 1231 | |||||
| 1232 | my $shb = $self->_fixin_replace_shebang( $file, $line ); | ||||
| 1233 | next unless defined $shb; | ||||
| 1234 | |||||
| 1235 | open( my $fixout, ">", "$file_new" ) or do { | ||||
| 1236 | warn "Can't create new $file: $!\n"; | ||||
| 1237 | next; | ||||
| 1238 | }; | ||||
| 1239 | |||||
| 1240 | # Print out the new #! line (or equivalent). | ||||
| 1241 | local $\; | ||||
| 1242 | local $/; | ||||
| 1243 | print $fixout $shb, <$fixin>; | ||||
| 1244 | close $fixin; | ||||
| 1245 | close $fixout; | ||||
| 1246 | |||||
| 1247 | chmod 0666, $file_bak; | ||||
| 1248 | unlink $file_bak; | ||||
| 1249 | unless ( _rename( $file, $file_bak ) ) { | ||||
| 1250 | warn "Can't rename $file to $file_bak: $!"; | ||||
| 1251 | next; | ||||
| 1252 | } | ||||
| 1253 | unless ( _rename( $file_new, $file ) ) { | ||||
| 1254 | warn "Can't rename $file_new to $file: $!"; | ||||
| 1255 | unless ( _rename( $file_bak, $file ) ) { | ||||
| 1256 | warn "Can't rename $file_bak back to $file either: $!"; | ||||
| 1257 | warn "Leaving $file renamed as $file_bak\n"; | ||||
| 1258 | } | ||||
| 1259 | next; | ||||
| 1260 | } | ||||
| 1261 | unlink $file_bak; | ||||
| 1262 | } | ||||
| 1263 | continue { | ||||
| 1264 | system("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':'; | ||||
| 1265 | } | ||||
| 1266 | } | ||||
| 1267 | |||||
| 1268 | |||||
| 1269 | sub _rename { | ||||
| 1270 | my($old, $new) = @_; | ||||
| 1271 | |||||
| 1272 | foreach my $file ($old, $new) { | ||||
| 1273 | if( $Is{VMS} and basename($file) !~ /\./ ) { | ||||
| 1274 | # rename() in 5.8.0 on VMS will not rename a file if it | ||||
| 1275 | # does not contain a dot yet it returns success. | ||||
| 1276 | $file = "$file."; | ||||
| 1277 | } | ||||
| 1278 | } | ||||
| 1279 | |||||
| 1280 | return rename($old, $new); | ||||
| 1281 | } | ||||
| 1282 | |||||
| 1283 | sub _fixin_replace_shebang { | ||||
| 1284 | my ( $self, $file, $line ) = @_; | ||||
| 1285 | |||||
| 1286 | # Now figure out the interpreter name. | ||||
| 1287 | my ( $origcmd, $arg ) = split ' ', $line, 2; | ||||
| 1288 | (my $cmd = $origcmd) =~ s!^.*/!!; | ||||
| 1289 | |||||
| 1290 | # Now look (in reverse) for interpreter in absolute PATH (unless perl). | ||||
| 1291 | my $interpreter; | ||||
| 1292 | if ( defined $ENV{PERL_MM_SHEBANG} && $ENV{PERL_MM_SHEBANG} eq "relocatable" ) { | ||||
| 1293 | $interpreter = "/usr/bin/env perl"; | ||||
| 1294 | } | ||||
| 1295 | elsif ( $cmd =~ m{^perl(?:\z|[^a-z])} ) { | ||||
| 1296 | if ( $Config{startperl} =~ m,^\#!.*/perl, ) { | ||||
| 1297 | $interpreter = $Config{startperl}; | ||||
| 1298 | $interpreter =~ s,^\#!,,; | ||||
| 1299 | } | ||||
| 1300 | else { | ||||
| 1301 | $interpreter = $Config{perlpath}; | ||||
| 1302 | } | ||||
| 1303 | } | ||||
| 1304 | else { | ||||
| 1305 | my (@absdirs) | ||||
| 1306 | = reverse grep { $self->file_name_is_absolute($_) } $self->path; | ||||
| 1307 | $interpreter = ''; | ||||
| 1308 | |||||
| 1309 | foreach my $dir (@absdirs) { | ||||
| 1310 | my $maybefile = $self->catfile($dir,$cmd); | ||||
| 1311 | if ( $self->maybe_command($maybefile) ) { | ||||
| 1312 | warn "Ignoring $interpreter in $file\n" | ||||
| 1313 | if $Verbose && $interpreter; | ||||
| 1314 | $interpreter = $maybefile; | ||||
| 1315 | } | ||||
| 1316 | } | ||||
| 1317 | |||||
| 1318 | # If the shebang is absolute and exists in PATH, but was not | ||||
| 1319 | # the first one found, leave it alone if it's actually the | ||||
| 1320 | # same file as first one. This avoids packages built on | ||||
| 1321 | # merged-/usr systems with /usr/bin before /bin in the path | ||||
| 1322 | # breaking when installed on systems without merged /usr | ||||
| 1323 | if ($origcmd ne $interpreter and $self->file_name_is_absolute($origcmd)) { | ||||
| 1324 | my $origdir = dirname($origcmd); | ||||
| 1325 | if ($self->maybe_command($origcmd) && grep { $_ eq $origdir } @absdirs) { | ||||
| 1326 | my ($odev, $oino) = stat $origcmd; | ||||
| 1327 | my ($idev, $iino) = stat $interpreter; | ||||
| 1328 | if ($odev == $idev && $oino eq $iino) { | ||||
| 1329 | warn "$origcmd is the same as $interpreter, leaving alone" | ||||
| 1330 | if $Verbose; | ||||
| 1331 | $interpreter = $origcmd; | ||||
| 1332 | } | ||||
| 1333 | } | ||||
| 1334 | } | ||||
| 1335 | } | ||||
| 1336 | |||||
| 1337 | # Figure out how to invoke interpreter on this machine. | ||||
| 1338 | |||||
| 1339 | my ($does_shbang) = $Config{'sharpbang'} =~ /^\s*\#\!/; | ||||
| 1340 | my ($shb) = ""; | ||||
| 1341 | if ($interpreter) { | ||||
| 1342 | print "Changing sharpbang in $file to $interpreter" | ||||
| 1343 | if $Verbose; | ||||
| 1344 | # this is probably value-free on DOSISH platforms | ||||
| 1345 | if ($does_shbang) { | ||||
| 1346 | $shb .= "$Config{'sharpbang'}$interpreter"; | ||||
| 1347 | $shb .= ' ' . $arg if defined $arg; | ||||
| 1348 | $shb .= "\n"; | ||||
| 1349 | } | ||||
| 1350 | } | ||||
| 1351 | else { | ||||
| 1352 | warn "Can't find $cmd in PATH, $file unchanged" | ||||
| 1353 | if $Verbose; | ||||
| 1354 | return; | ||||
| 1355 | } | ||||
| 1356 | return $shb | ||||
| 1357 | } | ||||
| 1358 | |||||
| 1359 | =item force (o) | ||||
| 1360 | |||||
| 1361 | Writes an empty FORCE: target. | ||||
| 1362 | |||||
| 1363 | =cut | ||||
| 1364 | |||||
| 1365 | sub force { | ||||
| 1366 | my($self) = shift; | ||||
| 1367 | '# Phony target to force checking subdirectories. | ||||
| 1368 | FORCE : | ||||
| 1369 | $(NOECHO) $(NOOP) | ||||
| 1370 | '; | ||||
| 1371 | } | ||||
| 1372 | |||||
| 1373 | =item guess_name | ||||
| 1374 | |||||
| 1375 | Guess the name of this package by examining the working directory's | ||||
| 1376 | name. MakeMaker calls this only if the developer has not supplied a | ||||
| 1377 | NAME attribute. | ||||
| 1378 | |||||
| 1379 | =cut | ||||
| 1380 | |||||
| 1381 | # '; | ||||
| 1382 | |||||
| 1383 | sub guess_name { | ||||
| 1384 | my($self) = @_; | ||||
| 1385 | 2 | 4.26ms | 2 | 41µs | # spent 25µs (9+16) within ExtUtils::MM_Unix::BEGIN@1385 which was called:
# once (9µs+16µs) by IPC::Cmd::can_run at line 1385 # spent 25µs making 1 call to ExtUtils::MM_Unix::BEGIN@1385
# spent 16µs making 1 call to Exporter::import |
| 1386 | my $name = basename(cwd()); | ||||
| 1387 | $name =~ s|[\-_][\d\.\-]+\z||; # this is new with MM 5.00, we | ||||
| 1388 | # strip minus or underline | ||||
| 1389 | # followed by a float or some such | ||||
| 1390 | print "Warning: Guessing NAME [$name] from current directory name.\n"; | ||||
| 1391 | $name; | ||||
| 1392 | } | ||||
| 1393 | |||||
| 1394 | =item has_link_code | ||||
| 1395 | |||||
| 1396 | Returns true if C, XS, MYEXTLIB or similar objects exist within this | ||||
| 1397 | object that need a compiler. Does not descend into subdirectories as | ||||
| 1398 | needs_linking() does. | ||||
| 1399 | |||||
| 1400 | =cut | ||||
| 1401 | |||||
| 1402 | sub has_link_code { | ||||
| 1403 | my($self) = shift; | ||||
| 1404 | return $self->{HAS_LINK_CODE} if defined $self->{HAS_LINK_CODE}; | ||||
| 1405 | if ($self->{OBJECT} or @{$self->{C} || []} or $self->{MYEXTLIB}){ | ||||
| 1406 | $self->{HAS_LINK_CODE} = 1; | ||||
| 1407 | return 1; | ||||
| 1408 | } | ||||
| 1409 | return $self->{HAS_LINK_CODE} = 0; | ||||
| 1410 | } | ||||
| 1411 | |||||
| 1412 | |||||
| 1413 | =item init_dirscan | ||||
| 1414 | |||||
| 1415 | Scans the directory structure and initializes DIR, XS, XS_FILES, | ||||
| 1416 | C, C_FILES, O_FILES, H, H_FILES, PL_FILES, EXE_FILES. | ||||
| 1417 | |||||
| 1418 | Called by init_main. | ||||
| 1419 | |||||
| 1420 | =cut | ||||
| 1421 | |||||
| 1422 | sub init_dirscan { # --- File and Directory Lists (.xs .pm .pod etc) | ||||
| 1423 | my($self) = @_; | ||||
| 1424 | my(%dir, %xs, %c, %o, %h, %pl_files, %pm); | ||||
| 1425 | |||||
| 1426 | my %ignore = map {( $_ => 1 )} qw(Makefile.PL Build.PL test.pl t); | ||||
| 1427 | |||||
| 1428 | # ignore the distdir | ||||
| 1429 | $Is{VMS} ? $ignore{"$self->{DISTVNAME}.dir"} = 1 | ||||
| 1430 | : $ignore{$self->{DISTVNAME}} = 1; | ||||
| 1431 | |||||
| 1432 | my $distprefix = $Is{VMS} ? qr/^\Q$self->{DISTNAME}\E-v?[\d\.]+\.dir$/i | ||||
| 1433 | : qr/^\Q$self->{DISTNAME}\E-v?[\d\.]+$/; | ||||
| 1434 | |||||
| 1435 | @ignore{map lc, keys %ignore} = values %ignore if $Is{VMS}; | ||||
| 1436 | |||||
| 1437 | if ( defined $self->{XS} and !defined $self->{C} ) { | ||||
| 1438 | my @c_files = grep { m/\.c(pp|xx)?\z/i } values %{$self->{XS}}; | ||||
| 1439 | my @o_files = grep { m/(?:.(?:o(?:bj)?)|\$\(OBJ_EXT\))\z/i } values %{$self->{XS}}; | ||||
| 1440 | %c = map { $_ => 1 } @c_files; | ||||
| 1441 | %o = map { $_ => 1 } @o_files; | ||||
| 1442 | } | ||||
| 1443 | |||||
| 1444 | foreach my $name ($self->lsdir($Curdir)){ | ||||
| 1445 | next if $name =~ /\#/; | ||||
| 1446 | next if $name =~ $distprefix && -d $name; | ||||
| 1447 | $name = lc($name) if $Is{VMS}; | ||||
| 1448 | next if $name eq $Curdir or $name eq $Updir or $ignore{$name}; | ||||
| 1449 | next unless $self->libscan($name); | ||||
| 1450 | if (-d $name){ | ||||
| 1451 | next if -l $name; # We do not support symlinks at all | ||||
| 1452 | next if $self->{NORECURS}; | ||||
| 1453 | $dir{$name} = $name if (-f $self->catfile($name,"Makefile.PL")); | ||||
| 1454 | } elsif ($name =~ /\.xs\z/){ | ||||
| 1455 | my($c); ($c = $name) =~ s/\.xs\z/.c/; | ||||
| 1456 | $xs{$name} = $c; | ||||
| 1457 | $c{$c} = 1; | ||||
| 1458 | } elsif ($name =~ /\.c(pp|xx|c)?\z/i){ # .c .C .cpp .cxx .cc | ||||
| 1459 | $c{$name} = 1 | ||||
| 1460 | unless $name =~ m/perlmain\.c/; # See MAP_TARGET | ||||
| 1461 | } elsif ($name =~ /\.h\z/i){ | ||||
| 1462 | $h{$name} = 1; | ||||
| 1463 | } elsif ($name =~ /\.PL\z/) { | ||||
| 1464 | ($pl_files{$name} = $name) =~ s/\.PL\z// ; | ||||
| 1465 | } elsif (($Is{VMS} || $Is{Dos}) && $name =~ /[._]pl$/i) { | ||||
| 1466 | # case-insensitive filesystem, one dot per name, so foo.h.PL | ||||
| 1467 | # under Unix appears as foo.h_pl under VMS or fooh.pl on Dos | ||||
| 1468 | local($/); open(my $pl, '<', $name); my $txt = <$pl>; close $pl; | ||||
| 1469 | if ($txt =~ /Extracting \S+ \(with variable substitutions/) { | ||||
| 1470 | ($pl_files{$name} = $name) =~ s/[._]pl\z//i ; | ||||
| 1471 | } | ||||
| 1472 | else { | ||||
| 1473 | $pm{$name} = $self->catfile($self->{INST_LIBDIR},$name); | ||||
| 1474 | } | ||||
| 1475 | } elsif ($name =~ /\.(p[ml]|pod)\z/){ | ||||
| 1476 | $pm{$name} = $self->catfile($self->{INST_LIBDIR},$name); | ||||
| 1477 | } | ||||
| 1478 | } | ||||
| 1479 | |||||
| 1480 | $self->{PL_FILES} ||= \%pl_files; | ||||
| 1481 | $self->{DIR} ||= [sort keys %dir]; | ||||
| 1482 | $self->{XS} ||= \%xs; | ||||
| 1483 | $self->{C} ||= [sort keys %c]; | ||||
| 1484 | $self->{H} ||= [sort keys %h]; | ||||
| 1485 | $self->{PM} ||= \%pm; | ||||
| 1486 | |||||
| 1487 | my @o_files = @{$self->{C}}; | ||||
| 1488 | %o = (%o, map { $_ => 1 } grep s/\.c(pp|xx|c)?\z/$self->{OBJ_EXT}/i, @o_files); | ||||
| 1489 | $self->{O_FILES} = [sort keys %o]; | ||||
| 1490 | } | ||||
| 1491 | |||||
| 1492 | |||||
| 1493 | =item init_MANPODS | ||||
| 1494 | |||||
| 1495 | Determines if man pages should be generated and initializes MAN1PODS | ||||
| 1496 | and MAN3PODS as appropriate. | ||||
| 1497 | |||||
| 1498 | =cut | ||||
| 1499 | |||||
| 1500 | sub init_MANPODS { | ||||
| 1501 | my $self = shift; | ||||
| 1502 | |||||
| 1503 | # Set up names of manual pages to generate from pods | ||||
| 1504 | foreach my $man (qw(MAN1 MAN3)) { | ||||
| 1505 | if ( $self->{"${man}PODS"} | ||||
| 1506 | or $self->{"INSTALL${man}DIR"} =~ /^(none|\s*)$/ | ||||
| 1507 | ) { | ||||
| 1508 | $self->{"${man}PODS"} ||= {}; | ||||
| 1509 | } | ||||
| 1510 | else { | ||||
| 1511 | my $init_method = "init_${man}PODS"; | ||||
| 1512 | $self->$init_method(); | ||||
| 1513 | } | ||||
| 1514 | } | ||||
| 1515 | |||||
| 1516 | # logic similar to picking man${num}ext in perl's Configure script | ||||
| 1517 | foreach my $num (1,3) { | ||||
| 1518 | my $installdirs = uc $self->{INSTALLDIRS}; | ||||
| 1519 | $installdirs = '' if $installdirs eq 'PERL'; | ||||
| 1520 | my @mandirs = File::Spec->splitdir( $self->_expand_macros( | ||||
| 1521 | $self->{ "INSTALL${installdirs}MAN${num}DIR" } ) ); | ||||
| 1522 | my $mandir = pop @mandirs; | ||||
| 1523 | my $section = $num; | ||||
| 1524 | |||||
| 1525 | foreach ($num, "${num}p", "${num}pm", qw< l n o C L >, "L$num") { | ||||
| 1526 | if ( $mandir =~ /^(?:man|cat)$_$/ ) { | ||||
| 1527 | $section = $_; | ||||
| 1528 | last; | ||||
| 1529 | } | ||||
| 1530 | } | ||||
| 1531 | |||||
| 1532 | $self->{"MAN${num}SECTION"} = $section; | ||||
| 1533 | } | ||||
| 1534 | } | ||||
| 1535 | |||||
| 1536 | |||||
| 1537 | sub _has_pod { | ||||
| 1538 | my($self, $file) = @_; | ||||
| 1539 | |||||
| 1540 | my($ispod)=0; | ||||
| 1541 | if (open( my $fh, '<', $file )) { | ||||
| 1542 | while (<$fh>) { | ||||
| 1543 | if (/^=(?:head\d+|item|pod)\b/) { | ||||
| 1544 | $ispod=1; | ||||
| 1545 | last; | ||||
| 1546 | } | ||||
| 1547 | } | ||||
| 1548 | close $fh; | ||||
| 1549 | } else { | ||||
| 1550 | # If it doesn't exist yet, we assume, it has pods in it | ||||
| 1551 | $ispod = 1; | ||||
| 1552 | } | ||||
| 1553 | |||||
| 1554 | return $ispod; | ||||
| 1555 | } | ||||
| 1556 | |||||
| 1557 | |||||
| 1558 | =item init_MAN1PODS | ||||
| 1559 | |||||
| 1560 | Initializes MAN1PODS from the list of EXE_FILES. | ||||
| 1561 | |||||
| 1562 | =cut | ||||
| 1563 | |||||
| 1564 | sub init_MAN1PODS { | ||||
| 1565 | my($self) = @_; | ||||
| 1566 | |||||
| 1567 | if ( exists $self->{EXE_FILES} ) { | ||||
| 1568 | foreach my $name (@{$self->{EXE_FILES}}) { | ||||
| 1569 | next unless $self->_has_pod($name); | ||||
| 1570 | |||||
| 1571 | $self->{MAN1PODS}->{$name} = | ||||
| 1572 | $self->catfile("\$(INST_MAN1DIR)", | ||||
| 1573 | basename($name).".\$(MAN1EXT)"); | ||||
| 1574 | } | ||||
| 1575 | } | ||||
| 1576 | } | ||||
| 1577 | |||||
| 1578 | |||||
| 1579 | =item init_MAN3PODS | ||||
| 1580 | |||||
| 1581 | Initializes MAN3PODS from the list of PM files. | ||||
| 1582 | |||||
| 1583 | =cut | ||||
| 1584 | |||||
| 1585 | sub init_MAN3PODS { | ||||
| 1586 | my $self = shift; | ||||
| 1587 | |||||
| 1588 | my %manifypods = (); # we collect the keys first, i.e. the files | ||||
| 1589 | # we have to convert to pod | ||||
| 1590 | |||||
| 1591 | foreach my $name (keys %{$self->{PM}}) { | ||||
| 1592 | if ($name =~ /\.pod\z/ ) { | ||||
| 1593 | $manifypods{$name} = $self->{PM}{$name}; | ||||
| 1594 | } elsif ($name =~ /\.p[ml]\z/ ) { | ||||
| 1595 | if( $self->_has_pod($name) ) { | ||||
| 1596 | $manifypods{$name} = $self->{PM}{$name}; | ||||
| 1597 | } | ||||
| 1598 | } | ||||
| 1599 | } | ||||
| 1600 | |||||
| 1601 | my $parentlibs_re = join '|', @{$self->{PMLIBPARENTDIRS}}; | ||||
| 1602 | |||||
| 1603 | # Remove "Configure.pm" and similar, if it's not the only pod listed | ||||
| 1604 | # To force inclusion, just name it "Configure.pod", or override | ||||
| 1605 | # MAN3PODS | ||||
| 1606 | foreach my $name (keys %manifypods) { | ||||
| 1607 | if ( | ||||
| 1608 | ($self->{PERL_CORE} and $name =~ /(config|setup).*\.pm/is) or | ||||
| 1609 | ( $name =~ m/^README\.pod$/i ) # don't manify top-level README.pod | ||||
| 1610 | ) { | ||||
| 1611 | delete $manifypods{$name}; | ||||
| 1612 | next; | ||||
| 1613 | } | ||||
| 1614 | my($manpagename) = $name; | ||||
| 1615 | $manpagename =~ s/\.p(od|m|l)\z//; | ||||
| 1616 | # everything below lib is ok | ||||
| 1617 | unless($manpagename =~ s!^\W*($parentlibs_re)\W+!!s) { | ||||
| 1618 | $manpagename = $self->catfile( | ||||
| 1619 | split(/::/,$self->{PARENT_NAME}),$manpagename | ||||
| 1620 | ); | ||||
| 1621 | } | ||||
| 1622 | $manpagename = $self->replace_manpage_separator($manpagename); | ||||
| 1623 | $self->{MAN3PODS}->{$name} = | ||||
| 1624 | $self->catfile("\$(INST_MAN3DIR)", "$manpagename.\$(MAN3EXT)"); | ||||
| 1625 | } | ||||
| 1626 | } | ||||
| 1627 | |||||
| 1628 | |||||
| 1629 | =item init_PM | ||||
| 1630 | |||||
| 1631 | Initializes PMLIBDIRS and PM from PMLIBDIRS. | ||||
| 1632 | |||||
| 1633 | =cut | ||||
| 1634 | |||||
| 1635 | sub init_PM { | ||||
| 1636 | my $self = shift; | ||||
| 1637 | |||||
| 1638 | # Some larger extensions often wish to install a number of *.pm/pl | ||||
| 1639 | # files into the library in various locations. | ||||
| 1640 | |||||
| 1641 | # The attribute PMLIBDIRS holds an array reference which lists | ||||
| 1642 | # subdirectories which we should search for library files to | ||||
| 1643 | # install. PMLIBDIRS defaults to [ 'lib', $self->{BASEEXT} ]. We | ||||
| 1644 | # recursively search through the named directories (skipping any | ||||
| 1645 | # which don't exist or contain Makefile.PL files). | ||||
| 1646 | |||||
| 1647 | # For each *.pm or *.pl file found $self->libscan() is called with | ||||
| 1648 | # the default installation path in $_[1]. The return value of | ||||
| 1649 | # libscan defines the actual installation location. The default | ||||
| 1650 | # libscan function simply returns the path. The file is skipped | ||||
| 1651 | # if libscan returns false. | ||||
| 1652 | |||||
| 1653 | # The default installation location passed to libscan in $_[1] is: | ||||
| 1654 | # | ||||
| 1655 | # ./*.pm => $(INST_LIBDIR)/*.pm | ||||
| 1656 | # ./xyz/... => $(INST_LIBDIR)/xyz/... | ||||
| 1657 | # ./lib/... => $(INST_LIB)/... | ||||
| 1658 | # | ||||
| 1659 | # In this way the 'lib' directory is seen as the root of the actual | ||||
| 1660 | # perl library whereas the others are relative to INST_LIBDIR | ||||
| 1661 | # (which includes PARENT_NAME). This is a subtle distinction but one | ||||
| 1662 | # that's important for nested modules. | ||||
| 1663 | |||||
| 1664 | unless( $self->{PMLIBDIRS} ) { | ||||
| 1665 | if( $Is{VMS} ) { | ||||
| 1666 | # Avoid logical name vs directory collisions | ||||
| 1667 | $self->{PMLIBDIRS} = ['./lib', "./$self->{BASEEXT}"]; | ||||
| 1668 | } | ||||
| 1669 | else { | ||||
| 1670 | $self->{PMLIBDIRS} = ['lib', $self->{BASEEXT}]; | ||||
| 1671 | } | ||||
| 1672 | } | ||||
| 1673 | |||||
| 1674 | #only existing directories that aren't in $dir are allowed | ||||
| 1675 | |||||
| 1676 | # Avoid $_ wherever possible: | ||||
| 1677 | # @{$self->{PMLIBDIRS}} = grep -d && !$dir{$_}, @{$self->{PMLIBDIRS}}; | ||||
| 1678 | my (@pmlibdirs) = @{$self->{PMLIBDIRS}}; | ||||
| 1679 | @{$self->{PMLIBDIRS}} = (); | ||||
| 1680 | my %dir = map { ($_ => $_) } @{$self->{DIR}}; | ||||
| 1681 | foreach my $pmlibdir (@pmlibdirs) { | ||||
| 1682 | -d $pmlibdir && !$dir{$pmlibdir} && push @{$self->{PMLIBDIRS}}, $pmlibdir; | ||||
| 1683 | } | ||||
| 1684 | |||||
| 1685 | unless( $self->{PMLIBPARENTDIRS} ) { | ||||
| 1686 | @{$self->{PMLIBPARENTDIRS}} = ('lib'); | ||||
| 1687 | } | ||||
| 1688 | |||||
| 1689 | return if $self->{PM} and $self->{ARGS}{PM}; | ||||
| 1690 | |||||
| 1691 | if (@{$self->{PMLIBDIRS}}){ | ||||
| 1692 | print "Searching PMLIBDIRS: @{$self->{PMLIBDIRS}}\n" | ||||
| 1693 | if ($Verbose >= 2); | ||||
| 1694 | require File::Find; | ||||
| 1695 | File::Find::find(sub { | ||||
| 1696 | if (-d $_){ | ||||
| 1697 | unless ($self->libscan($_)){ | ||||
| 1698 | $File::Find::prune = 1; | ||||
| 1699 | } | ||||
| 1700 | return; | ||||
| 1701 | } | ||||
| 1702 | return if /\#/; | ||||
| 1703 | return if /~$/; # emacs temp files | ||||
| 1704 | return if /,v$/; # RCS files | ||||
| 1705 | return if m{\.swp$}; # vim swap files | ||||
| 1706 | |||||
| 1707 | my $path = $File::Find::name; | ||||
| 1708 | my $prefix = $self->{INST_LIBDIR}; | ||||
| 1709 | my $striplibpath; | ||||
| 1710 | |||||
| 1711 | my $parentlibs_re = join '|', @{$self->{PMLIBPARENTDIRS}}; | ||||
| 1712 | $prefix = $self->{INST_LIB} | ||||
| 1713 | if ($striplibpath = $path) =~ s{^(\W*)($parentlibs_re)\W} | ||||
| 1714 | {$1}i; | ||||
| 1715 | |||||
| 1716 | my($inst) = $self->catfile($prefix,$striplibpath); | ||||
| 1717 | local($_) = $inst; # for backwards compatibility | ||||
| 1718 | $inst = $self->libscan($inst); | ||||
| 1719 | print "libscan($path) => '$inst'\n" if ($Verbose >= 2); | ||||
| 1720 | return unless $inst; | ||||
| 1721 | if ($self->{XSMULTI} and $inst =~ /\.xs\z/) { | ||||
| 1722 | my($base); ($base = $path) =~ s/\.xs\z//; | ||||
| 1723 | $self->{XS}{$path} = "$base.c"; | ||||
| 1724 | push @{$self->{C}}, "$base.c"; | ||||
| 1725 | push @{$self->{O_FILES}}, "$base$self->{OBJ_EXT}"; | ||||
| 1726 | } else { | ||||
| 1727 | $self->{PM}{$path} = $inst; | ||||
| 1728 | } | ||||
| 1729 | }, @{$self->{PMLIBDIRS}}); | ||||
| 1730 | } | ||||
| 1731 | } | ||||
| 1732 | |||||
| 1733 | |||||
| 1734 | =item init_DIRFILESEP | ||||
| 1735 | |||||
| 1736 | Using / for Unix. Called by init_main. | ||||
| 1737 | |||||
| 1738 | =cut | ||||
| 1739 | |||||
| 1740 | sub init_DIRFILESEP { | ||||
| 1741 | my($self) = shift; | ||||
| 1742 | |||||
| 1743 | $self->{DIRFILESEP} = '/'; | ||||
| 1744 | } | ||||
| 1745 | |||||
| 1746 | |||||
| 1747 | =item init_main | ||||
| 1748 | |||||
| 1749 | Initializes AR, AR_STATIC_ARGS, BASEEXT, CONFIG, DISTNAME, DLBASE, | ||||
| 1750 | EXE_EXT, FULLEXT, FULLPERL, FULLPERLRUN, FULLPERLRUNINST, INST_*, | ||||
| 1751 | INSTALL*, INSTALLDIRS, LIB_EXT, LIBPERL_A, MAP_TARGET, NAME, | ||||
| 1752 | OBJ_EXT, PARENT_NAME, PERL, PERL_ARCHLIB, PERL_INC, PERL_LIB, | ||||
| 1753 | PERL_SRC, PERLRUN, PERLRUNINST, PREFIX, VERSION, | ||||
| 1754 | VERSION_SYM, XS_VERSION. | ||||
| 1755 | |||||
| 1756 | =cut | ||||
| 1757 | |||||
| 1758 | sub init_main { | ||||
| 1759 | my($self) = @_; | ||||
| 1760 | |||||
| 1761 | # --- Initialize Module Name and Paths | ||||
| 1762 | |||||
| 1763 | # NAME = Foo::Bar::Oracle | ||||
| 1764 | # FULLEXT = Foo/Bar/Oracle | ||||
| 1765 | # BASEEXT = Oracle | ||||
| 1766 | # PARENT_NAME = Foo::Bar | ||||
| 1767 | ### Only UNIX: | ||||
| 1768 | ### ($self->{FULLEXT} = | ||||
| 1769 | ### $self->{NAME}) =~ s!::!/!g ; #eg. BSD/Foo/Socket | ||||
| 1770 | $self->{FULLEXT} = $self->catdir(split /::/, $self->{NAME}); | ||||
| 1771 | |||||
| 1772 | |||||
| 1773 | # Copied from DynaLoader: | ||||
| 1774 | |||||
| 1775 | my(@modparts) = split(/::/,$self->{NAME}); | ||||
| 1776 | my($modfname) = $modparts[-1]; | ||||
| 1777 | |||||
| 1778 | # Some systems have restrictions on files names for DLL's etc. | ||||
| 1779 | # mod2fname returns appropriate file base name (typically truncated) | ||||
| 1780 | # It may also edit @modparts if required. | ||||
| 1781 | # We require DynaLoader to make sure that mod2fname is loaded | ||||
| 1782 | eval { require DynaLoader }; | ||||
| 1783 | if (defined &DynaLoader::mod2fname) { | ||||
| 1784 | $modfname = &DynaLoader::mod2fname(\@modparts); | ||||
| 1785 | } | ||||
| 1786 | |||||
| 1787 | ($self->{PARENT_NAME}, $self->{BASEEXT}) = $self->{NAME} =~ m!(?:([\w:]+)::)?(\w+)\z! ; | ||||
| 1788 | $self->{PARENT_NAME} ||= ''; | ||||
| 1789 | |||||
| 1790 | if (defined &DynaLoader::mod2fname) { | ||||
| 1791 | # As of 5.001m, dl_os2 appends '_' | ||||
| 1792 | $self->{DLBASE} = $modfname; | ||||
| 1793 | } else { | ||||
| 1794 | $self->{DLBASE} = '$(BASEEXT)'; | ||||
| 1795 | } | ||||
| 1796 | |||||
| 1797 | |||||
| 1798 | # --- Initialize PERL_LIB, PERL_SRC | ||||
| 1799 | |||||
| 1800 | # *Real* information: where did we get these two from? ... | ||||
| 1801 | my $inc_config_dir = dirname($INC{'Config.pm'}); | ||||
| 1802 | my $inc_carp_dir = dirname($INC{'Carp.pm'}); | ||||
| 1803 | |||||
| 1804 | unless ($self->{PERL_SRC}){ | ||||
| 1805 | foreach my $dir_count (1..8) { # 8 is the VMS limit for nesting | ||||
| 1806 | my $dir = $self->catdir(($Updir) x $dir_count); | ||||
| 1807 | |||||
| 1808 | if (-f $self->catfile($dir,"config_h.SH") && | ||||
| 1809 | -f $self->catfile($dir,"perl.h") && | ||||
| 1810 | -f $self->catfile($dir,"lib","strict.pm") | ||||
| 1811 | ) { | ||||
| 1812 | $self->{PERL_SRC}=$dir ; | ||||
| 1813 | last; | ||||
| 1814 | } | ||||
| 1815 | } | ||||
| 1816 | } | ||||
| 1817 | |||||
| 1818 | warn "PERL_CORE is set but I can't find your PERL_SRC!\n" if | ||||
| 1819 | $self->{PERL_CORE} and !$self->{PERL_SRC}; | ||||
| 1820 | |||||
| 1821 | if ($self->{PERL_SRC}){ | ||||
| 1822 | $self->{PERL_LIB} ||= $self->catdir("$self->{PERL_SRC}","lib"); | ||||
| 1823 | |||||
| 1824 | $self->{PERL_ARCHLIB} = $self->{PERL_LIB}; | ||||
| 1825 | $self->{PERL_INC} = ($Is{Win32}) ? | ||||
| 1826 | $self->catdir($self->{PERL_LIB},"CORE") : $self->{PERL_SRC}; | ||||
| 1827 | |||||
| 1828 | # catch a situation that has occurred a few times in the past: | ||||
| 1829 | unless ( | ||||
| 1830 | -s $self->catfile($self->{PERL_SRC},'cflags') | ||||
| 1831 | or | ||||
| 1832 | $Is{VMS} | ||||
| 1833 | && | ||||
| 1834 | -s $self->catfile($self->{PERL_SRC},'vmsish.h') | ||||
| 1835 | or | ||||
| 1836 | $Is{Win32} | ||||
| 1837 | ){ | ||||
| 1838 | warn qq{ | ||||
| 1839 | You cannot build extensions below the perl source tree after executing | ||||
| 1840 | a 'make clean' in the perl source tree. | ||||
| 1841 | |||||
| 1842 | To rebuild extensions distributed with the perl source you should | ||||
| 1843 | simply Configure (to include those extensions) and then build perl as | ||||
| 1844 | normal. After installing perl the source tree can be deleted. It is | ||||
| 1845 | not needed for building extensions by running 'perl Makefile.PL' | ||||
| 1846 | usually without extra arguments. | ||||
| 1847 | |||||
| 1848 | It is recommended that you unpack and build additional extensions away | ||||
| 1849 | from the perl source tree. | ||||
| 1850 | }; | ||||
| 1851 | } | ||||
| 1852 | } else { | ||||
| 1853 | # we should also consider $ENV{PERL5LIB} here | ||||
| 1854 | my $old = $self->{PERL_LIB} || $self->{PERL_ARCHLIB} || $self->{PERL_INC}; | ||||
| 1855 | $self->{PERL_LIB} ||= $Config{privlibexp}; | ||||
| 1856 | $self->{PERL_ARCHLIB} ||= $Config{archlibexp}; | ||||
| 1857 | $self->{PERL_INC} = $self->catdir("$self->{PERL_ARCHLIB}","CORE"); # wild guess for now | ||||
| 1858 | my $perl_h; | ||||
| 1859 | |||||
| 1860 | if (not -f ($perl_h = $self->catfile($self->{PERL_INC},"perl.h")) | ||||
| 1861 | and not $old){ | ||||
| 1862 | # Maybe somebody tries to build an extension with an | ||||
| 1863 | # uninstalled Perl outside of Perl build tree | ||||
| 1864 | my $lib; | ||||
| 1865 | for my $dir (@INC) { | ||||
| 1866 | $lib = $dir, last if -e $self->catfile($dir, "Config.pm"); | ||||
| 1867 | } | ||||
| 1868 | if ($lib) { | ||||
| 1869 | # Win32 puts its header files in /perl/src/lib/CORE. | ||||
| 1870 | # Unix leaves them in /perl/src. | ||||
| 1871 | my $inc = $Is{Win32} ? $self->catdir($lib, "CORE" ) | ||||
| 1872 | : dirname $lib; | ||||
| 1873 | if (-e $self->catfile($inc, "perl.h")) { | ||||
| 1874 | $self->{PERL_LIB} = $lib; | ||||
| 1875 | $self->{PERL_ARCHLIB} = $lib; | ||||
| 1876 | $self->{PERL_INC} = $inc; | ||||
| 1877 | $self->{UNINSTALLED_PERL} = 1; | ||||
| 1878 | print <<EOP; | ||||
| 1879 | ... Detected uninstalled Perl. Trying to continue. | ||||
| 1880 | EOP | ||||
| 1881 | } | ||||
| 1882 | } | ||||
| 1883 | } | ||||
| 1884 | } | ||||
| 1885 | |||||
| 1886 | if ($Is{Android}) { | ||||
| 1887 | # Android fun times! | ||||
| 1888 | # ../../perl -I../../lib -MFile::Glob -e1 works | ||||
| 1889 | # ../../../perl -I../../../lib -MFile::Glob -e1 fails to find | ||||
| 1890 | # the .so for File::Glob. | ||||
| 1891 | # This always affects core perl, but may also affect an installed | ||||
| 1892 | # perl built with -Duserelocatableinc. | ||||
| 1893 | $self->{PERL_LIB} = File::Spec->rel2abs($self->{PERL_LIB}); | ||||
| 1894 | $self->{PERL_ARCHLIB} = File::Spec->rel2abs($self->{PERL_ARCHLIB}); | ||||
| 1895 | } | ||||
| 1896 | $self->{PERL_INCDEP} = $self->{PERL_INC}; | ||||
| 1897 | $self->{PERL_ARCHLIBDEP} = $self->{PERL_ARCHLIB}; | ||||
| 1898 | |||||
| 1899 | # We get SITELIBEXP and SITEARCHEXP directly via | ||||
| 1900 | # Get_from_Config. When we are running standard modules, these | ||||
| 1901 | # won't matter, we will set INSTALLDIRS to "perl". Otherwise we | ||||
| 1902 | # set it to "site". I prefer that INSTALLDIRS be set from outside | ||||
| 1903 | # MakeMaker. | ||||
| 1904 | $self->{INSTALLDIRS} ||= "site"; | ||||
| 1905 | |||||
| 1906 | $self->{MAN1EXT} ||= $Config{man1ext}; | ||||
| 1907 | $self->{MAN3EXT} ||= $Config{man3ext}; | ||||
| 1908 | |||||
| 1909 | # Get some stuff out of %Config if we haven't yet done so | ||||
| 1910 | print "CONFIG must be an array ref\n" | ||||
| 1911 | if ($self->{CONFIG} and ref $self->{CONFIG} ne 'ARRAY'); | ||||
| 1912 | $self->{CONFIG} = [] unless (ref $self->{CONFIG}); | ||||
| 1913 | push(@{$self->{CONFIG}}, @ExtUtils::MakeMaker::Get_from_Config); | ||||
| 1914 | push(@{$self->{CONFIG}}, 'shellflags') if $Config{shellflags}; | ||||
| 1915 | my(%once_only); | ||||
| 1916 | foreach my $m (@{$self->{CONFIG}}){ | ||||
| 1917 | next if $once_only{$m}; | ||||
| 1918 | print "CONFIG key '$m' does not exist in Config.pm\n" | ||||
| 1919 | unless exists $Config{$m}; | ||||
| 1920 | $self->{uc $m} ||= $Config{$m}; | ||||
| 1921 | $once_only{$m} = 1; | ||||
| 1922 | } | ||||
| 1923 | |||||
| 1924 | # This is too dangerous: | ||||
| 1925 | # if ($^O eq "next") { | ||||
| 1926 | # $self->{AR} = "libtool"; | ||||
| 1927 | # $self->{AR_STATIC_ARGS} = "-o"; | ||||
| 1928 | # } | ||||
| 1929 | # But I leave it as a placeholder | ||||
| 1930 | |||||
| 1931 | $self->{AR_STATIC_ARGS} ||= "cr"; | ||||
| 1932 | |||||
| 1933 | # These should never be needed | ||||
| 1934 | $self->{OBJ_EXT} ||= '.o'; | ||||
| 1935 | $self->{LIB_EXT} ||= '.a'; | ||||
| 1936 | |||||
| 1937 | $self->{MAP_TARGET} ||= "perl"; | ||||
| 1938 | |||||
| 1939 | $self->{LIBPERL_A} ||= "libperl$self->{LIB_EXT}"; | ||||
| 1940 | |||||
| 1941 | # make a simple check if we find strict | ||||
| 1942 | warn "Warning: PERL_LIB ($self->{PERL_LIB}) seems not to be a perl library directory | ||||
| 1943 | (strict.pm not found)" | ||||
| 1944 | unless -f $self->catfile("$self->{PERL_LIB}","strict.pm") || | ||||
| 1945 | $self->{NAME} eq "ExtUtils::MakeMaker"; | ||||
| 1946 | } | ||||
| 1947 | |||||
| 1948 | =item init_tools | ||||
| 1949 | |||||
| 1950 | Initializes tools to use their common (and faster) Unix commands. | ||||
| 1951 | |||||
| 1952 | =cut | ||||
| 1953 | |||||
| 1954 | sub init_tools { | ||||
| 1955 | my $self = shift; | ||||
| 1956 | |||||
| 1957 | $self->{ECHO} ||= 'echo'; | ||||
| 1958 | $self->{ECHO_N} ||= 'echo -n'; | ||||
| 1959 | $self->{RM_F} ||= "rm -f"; | ||||
| 1960 | $self->{RM_RF} ||= "rm -rf"; | ||||
| 1961 | $self->{TOUCH} ||= "touch"; | ||||
| 1962 | $self->{TEST_F} ||= "test -f"; | ||||
| 1963 | $self->{TEST_S} ||= "test -s"; | ||||
| 1964 | $self->{CP} ||= "cp"; | ||||
| 1965 | $self->{MV} ||= "mv"; | ||||
| 1966 | $self->{CHMOD} ||= "chmod"; | ||||
| 1967 | $self->{FALSE} ||= 'false'; | ||||
| 1968 | $self->{TRUE} ||= 'true'; | ||||
| 1969 | |||||
| 1970 | $self->{LD} ||= 'ld'; | ||||
| 1971 | |||||
| 1972 | return $self->SUPER::init_tools(@_); | ||||
| 1973 | |||||
| 1974 | # After SUPER::init_tools so $Config{shell} has a | ||||
| 1975 | # chance to get set. | ||||
| 1976 | $self->{SHELL} ||= '/bin/sh'; | ||||
| 1977 | |||||
| 1978 | return; | ||||
| 1979 | } | ||||
| 1980 | |||||
| 1981 | |||||
| 1982 | =item init_linker | ||||
| 1983 | |||||
| 1984 | Unix has no need of special linker flags. | ||||
| 1985 | |||||
| 1986 | =cut | ||||
| 1987 | |||||
| 1988 | sub init_linker { | ||||
| 1989 | my($self) = shift; | ||||
| 1990 | $self->{PERL_ARCHIVE} ||= ''; | ||||
| 1991 | $self->{PERL_ARCHIVEDEP} ||= ''; | ||||
| 1992 | $self->{PERL_ARCHIVE_AFTER} ||= ''; | ||||
| 1993 | $self->{EXPORT_LIST} ||= ''; | ||||
| 1994 | } | ||||
| 1995 | |||||
| 1996 | |||||
| 1997 | =begin _protected | ||||
| 1998 | |||||
| 1999 | =item init_lib2arch | ||||
| 2000 | |||||
| 2001 | $mm->init_lib2arch | ||||
| 2002 | |||||
| 2003 | =end _protected | ||||
| 2004 | |||||
| 2005 | =cut | ||||
| 2006 | |||||
| 2007 | sub init_lib2arch { | ||||
| 2008 | my($self) = shift; | ||||
| 2009 | |||||
| 2010 | # The user who requests an installation directory explicitly | ||||
| 2011 | # should not have to tell us an architecture installation directory | ||||
| 2012 | # as well. We look if a directory exists that is named after the | ||||
| 2013 | # architecture. If not we take it as a sign that it should be the | ||||
| 2014 | # same as the requested installation directory. Otherwise we take | ||||
| 2015 | # the found one. | ||||
| 2016 | for my $libpair ({l=>"privlib", a=>"archlib"}, | ||||
| 2017 | {l=>"sitelib", a=>"sitearch"}, | ||||
| 2018 | {l=>"vendorlib", a=>"vendorarch"}, | ||||
| 2019 | ) | ||||
| 2020 | { | ||||
| 2021 | my $lib = "install$libpair->{l}"; | ||||
| 2022 | my $Lib = uc $lib; | ||||
| 2023 | my $Arch = uc "install$libpair->{a}"; | ||||
| 2024 | if( $self->{$Lib} && ! $self->{$Arch} ){ | ||||
| 2025 | my($ilib) = $Config{$lib}; | ||||
| 2026 | |||||
| 2027 | $self->prefixify($Arch,$ilib,$self->{$Lib}); | ||||
| 2028 | |||||
| 2029 | unless (-d $self->{$Arch}) { | ||||
| 2030 | print "Directory $self->{$Arch} not found\n" | ||||
| 2031 | if $Verbose; | ||||
| 2032 | $self->{$Arch} = $self->{$Lib}; | ||||
| 2033 | } | ||||
| 2034 | print "Defaulting $Arch to $self->{$Arch}\n" if $Verbose; | ||||
| 2035 | } | ||||
| 2036 | } | ||||
| 2037 | } | ||||
| 2038 | |||||
| 2039 | |||||
| 2040 | =item init_PERL | ||||
| 2041 | |||||
| 2042 | $mm->init_PERL; | ||||
| 2043 | |||||
| 2044 | Called by init_main. Sets up ABSPERL, PERL, FULLPERL and all the | ||||
| 2045 | *PERLRUN* permutations. | ||||
| 2046 | |||||
| 2047 | PERL is allowed to be miniperl | ||||
| 2048 | FULLPERL must be a complete perl | ||||
| 2049 | |||||
| 2050 | ABSPERL is PERL converted to an absolute path | ||||
| 2051 | |||||
| 2052 | *PERLRUN contains everything necessary to run perl, find it's | ||||
| 2053 | libraries, etc... | ||||
| 2054 | |||||
| 2055 | *PERLRUNINST is *PERLRUN + everything necessary to find the | ||||
| 2056 | modules being built. | ||||
| 2057 | |||||
| 2058 | =cut | ||||
| 2059 | |||||
| 2060 | sub init_PERL { | ||||
| 2061 | my($self) = shift; | ||||
| 2062 | |||||
| 2063 | my @defpath = (); | ||||
| 2064 | foreach my $component ($self->{PERL_SRC}, $self->path(), | ||||
| 2065 | $Config{binexp}) | ||||
| 2066 | { | ||||
| 2067 | push @defpath, $component if defined $component; | ||||
| 2068 | } | ||||
| 2069 | |||||
| 2070 | # Build up a set of file names (not command names). | ||||
| 2071 | my $thisperl = $self->canonpath($^X); | ||||
| 2072 | $thisperl .= $Config{exe_ext} unless | ||||
| 2073 | $Is{VMS} ? $thisperl =~ m/$Config{exe_ext}(;\d+)?$/i | ||||
| 2074 | |||||
| 2075 | : $thisperl =~ m/$Config{exe_ext}$/i; | ||||
| 2076 | |||||
| 2077 | # We need a relative path to perl when in the core. | ||||
| 2078 | $thisperl = $self->abs2rel($thisperl) if $self->{PERL_CORE}; | ||||
| 2079 | |||||
| 2080 | my @perls = ($thisperl); | ||||
| 2081 | push @perls, map { "$_$Config{exe_ext}" } | ||||
| 2082 | ("perl$Config{version}", 'perl5', 'perl'); | ||||
| 2083 | |||||
| 2084 | # miniperl has priority over all but the canonical perl when in the | ||||
| 2085 | # core. Otherwise its a last resort. | ||||
| 2086 | my $miniperl = "miniperl$Config{exe_ext}"; | ||||
| 2087 | if( $self->{PERL_CORE} ) { | ||||
| 2088 | splice @perls, 1, 0, $miniperl; | ||||
| 2089 | } | ||||
| 2090 | else { | ||||
| 2091 | push @perls, $miniperl; | ||||
| 2092 | } | ||||
| 2093 | |||||
| 2094 | $self->{PERL} ||= | ||||
| 2095 | $self->find_perl(5.0, \@perls, \@defpath, $Verbose ); | ||||
| 2096 | |||||
| 2097 | my $perl = $self->{PERL}; | ||||
| 2098 | $perl =~ s/^"//; | ||||
| 2099 | my $has_mcr = $perl =~ s/^MCR\s*//; | ||||
| 2100 | my $perlflags = ''; | ||||
| 2101 | my $stripped_perl; | ||||
| 2102 | while ($perl) { | ||||
| 2103 | ($stripped_perl = $perl) =~ s/"$//; | ||||
| 2104 | last if -x $stripped_perl; | ||||
| 2105 | last unless $perl =~ s/(\s+\S+)$//; | ||||
| 2106 | $perlflags = $1.$perlflags; | ||||
| 2107 | } | ||||
| 2108 | $self->{PERL} = $stripped_perl; | ||||
| 2109 | $self->{PERL} = 'MCR '.$self->{PERL} if $has_mcr || $Is{VMS}; | ||||
| 2110 | |||||
| 2111 | # When built for debugging, VMS doesn't create perl.exe but ndbgperl.exe. | ||||
| 2112 | my $perl_name = 'perl'; | ||||
| 2113 | $perl_name = 'ndbgperl' if $Is{VMS} && | ||||
| 2114 | defined $Config{usevmsdebug} && $Config{usevmsdebug} eq 'define'; | ||||
| 2115 | |||||
| 2116 | # XXX This logic is flawed. If "miniperl" is anywhere in the path | ||||
| 2117 | # it will get confused. It should be fixed to work only on the filename. | ||||
| 2118 | # Define 'FULLPERL' to be a non-miniperl (used in test: target) | ||||
| 2119 | unless ($self->{FULLPERL}) { | ||||
| 2120 | ($self->{FULLPERL} = $self->{PERL}) =~ s/\Q$miniperl\E$/$perl_name$Config{exe_ext}/i; | ||||
| 2121 | $self->{FULLPERL} = qq{"$self->{FULLPERL}"}.$perlflags; | ||||
| 2122 | } | ||||
| 2123 | # Can't have an image name with quotes, and findperl will have | ||||
| 2124 | # already escaped spaces. | ||||
| 2125 | $self->{FULLPERL} =~ tr/"//d if $Is{VMS}; | ||||
| 2126 | |||||
| 2127 | # `dmake` can fail for image (aka, executable) names which start with double-quotes | ||||
| 2128 | # * push quote inward by at least one character (or the drive prefix, if present) | ||||
| 2129 | # * including any initial directory separator preserves the `file_name_is_absolute` property | ||||
| 2130 | $self->{FULLPERL} =~ s/^"(\S(:\\|:)?)/$1"/ if $self->is_make_type('dmake'); | ||||
| 2131 | |||||
| 2132 | # Little hack to get around VMS's find_perl putting "MCR" in front | ||||
| 2133 | # sometimes. | ||||
| 2134 | $self->{ABSPERL} = $self->{PERL}; | ||||
| 2135 | $has_mcr = $self->{ABSPERL} =~ s/^MCR\s*//; | ||||
| 2136 | if( $self->file_name_is_absolute($self->{ABSPERL}) ) { | ||||
| 2137 | $self->{ABSPERL} = '$(PERL)'; | ||||
| 2138 | } | ||||
| 2139 | else { | ||||
| 2140 | $self->{ABSPERL} = $self->rel2abs($self->{ABSPERL}); | ||||
| 2141 | |||||
| 2142 | # Quote the perl command if it contains whitespace | ||||
| 2143 | $self->{ABSPERL} = $self->quote_literal($self->{ABSPERL}) | ||||
| 2144 | if $self->{ABSPERL} =~ /\s/; | ||||
| 2145 | |||||
| 2146 | $self->{ABSPERL} = 'MCR '.$self->{ABSPERL} if $has_mcr; | ||||
| 2147 | } | ||||
| 2148 | $self->{PERL} = qq{"$self->{PERL}"}.$perlflags; | ||||
| 2149 | |||||
| 2150 | # Can't have an image name with quotes, and findperl will have | ||||
| 2151 | # already escaped spaces. | ||||
| 2152 | $self->{PERL} =~ tr/"//d if $Is{VMS}; | ||||
| 2153 | |||||
| 2154 | # `dmake` can fail for image (aka, executable) names which start with double-quotes | ||||
| 2155 | # * push quote inward by at least one character (or the drive prefix, if present) | ||||
| 2156 | # * including any initial directory separator preserves the `file_name_is_absolute` property | ||||
| 2157 | $self->{PERL} =~ s/^"(\S(:\\|:)?)/$1"/ if $self->is_make_type('dmake'); | ||||
| 2158 | |||||
| 2159 | # Are we building the core? | ||||
| 2160 | $self->{PERL_CORE} = $ENV{PERL_CORE} unless exists $self->{PERL_CORE}; | ||||
| 2161 | $self->{PERL_CORE} = 0 unless defined $self->{PERL_CORE}; | ||||
| 2162 | |||||
| 2163 | # Make sure perl can find itself before it's installed. | ||||
| 2164 | my $lib_paths = $self->{UNINSTALLED_PERL} || $self->{PERL_CORE} | ||||
| 2165 | ? ( $self->{PERL_ARCHLIB} && $self->{PERL_LIB} && $self->{PERL_ARCHLIB} ne $self->{PERL_LIB} ) ? | ||||
| 2166 | q{ "-I$(PERL_LIB)" "-I$(PERL_ARCHLIB)"} : q{ "-I$(PERL_LIB)"} | ||||
| 2167 | : undef; | ||||
| 2168 | my $inst_lib_paths = $self->{INST_ARCHLIB} ne $self->{INST_LIB} | ||||
| 2169 | ? 'RUN)'.$perlflags.' "-I$(INST_ARCHLIB)" "-I$(INST_LIB)"' | ||||
| 2170 | : 'RUN)'.$perlflags.' "-I$(INST_LIB)"'; | ||||
| 2171 | # How do we run perl? | ||||
| 2172 | foreach my $perl (qw(PERL FULLPERL ABSPERL)) { | ||||
| 2173 | my $run = $perl.'RUN'; | ||||
| 2174 | |||||
| 2175 | $self->{$run} = qq{\$($perl)}; | ||||
| 2176 | $self->{$run} .= $lib_paths if $lib_paths; | ||||
| 2177 | |||||
| 2178 | $self->{$perl.'RUNINST'} = '$('.$perl.$inst_lib_paths; | ||||
| 2179 | } | ||||
| 2180 | |||||
| 2181 | return 1; | ||||
| 2182 | } | ||||
| 2183 | |||||
| 2184 | |||||
| 2185 | =item init_platform | ||||
| 2186 | |||||
| 2187 | =item platform_constants | ||||
| 2188 | |||||
| 2189 | Add MM_Unix_VERSION. | ||||
| 2190 | |||||
| 2191 | =cut | ||||
| 2192 | |||||
| 2193 | sub init_platform { | ||||
| 2194 | my($self) = shift; | ||||
| 2195 | |||||
| 2196 | $self->{MM_Unix_VERSION} = $VERSION; | ||||
| 2197 | $self->{PERL_MALLOC_DEF} = '-DPERL_EXTMALLOC_DEF -Dmalloc=Perl_malloc '. | ||||
| 2198 | '-Dfree=Perl_mfree -Drealloc=Perl_realloc '. | ||||
| 2199 | '-Dcalloc=Perl_calloc'; | ||||
| 2200 | |||||
| 2201 | } | ||||
| 2202 | |||||
| 2203 | sub platform_constants { | ||||
| 2204 | my($self) = shift; | ||||
| 2205 | my $make_frag = ''; | ||||
| 2206 | |||||
| 2207 | foreach my $macro (qw(MM_Unix_VERSION PERL_MALLOC_DEF)) | ||||
| 2208 | { | ||||
| 2209 | next unless defined $self->{$macro}; | ||||
| 2210 | $make_frag .= "$macro = $self->{$macro}\n"; | ||||
| 2211 | } | ||||
| 2212 | |||||
| 2213 | return $make_frag; | ||||
| 2214 | } | ||||
| 2215 | |||||
| 2216 | |||||
| 2217 | =item init_PERM | ||||
| 2218 | |||||
| 2219 | $mm->init_PERM | ||||
| 2220 | |||||
| 2221 | Called by init_main. Initializes PERL_* | ||||
| 2222 | |||||
| 2223 | =cut | ||||
| 2224 | |||||
| 2225 | sub init_PERM { | ||||
| 2226 | my($self) = shift; | ||||
| 2227 | |||||
| 2228 | $self->{PERM_DIR} = 755 unless defined $self->{PERM_DIR}; | ||||
| 2229 | $self->{PERM_RW} = 644 unless defined $self->{PERM_RW}; | ||||
| 2230 | $self->{PERM_RWX} = 755 unless defined $self->{PERM_RWX}; | ||||
| 2231 | |||||
| 2232 | return 1; | ||||
| 2233 | } | ||||
| 2234 | |||||
| 2235 | |||||
| 2236 | =item init_xs | ||||
| 2237 | |||||
| 2238 | $mm->init_xs | ||||
| 2239 | |||||
| 2240 | Sets up macros having to do with XS code. Currently just INST_STATIC, | ||||
| 2241 | INST_DYNAMIC and INST_BOOT. | ||||
| 2242 | |||||
| 2243 | =cut | ||||
| 2244 | |||||
| 2245 | sub init_xs { | ||||
| 2246 | my $self = shift; | ||||
| 2247 | |||||
| 2248 | if ($self->has_link_code()) { | ||||
| 2249 | $self->{INST_STATIC} = | ||||
| 2250 | $self->catfile('$(INST_ARCHAUTODIR)', '$(BASEEXT)$(LIB_EXT)'); | ||||
| 2251 | $self->{INST_DYNAMIC} = | ||||
| 2252 | $self->catfile('$(INST_ARCHAUTODIR)', '$(DLBASE).$(DLEXT)'); | ||||
| 2253 | $self->{INST_BOOT} = | ||||
| 2254 | $self->catfile('$(INST_ARCHAUTODIR)', '$(BASEEXT).bs'); | ||||
| 2255 | if ($self->{XSMULTI}) { | ||||
| 2256 | my @exts = $self->_xs_list_basenames; | ||||
| 2257 | my (@statics, @dynamics, @boots); | ||||
| 2258 | for my $ext (@exts) { | ||||
| 2259 | my ($v, $d, $f) = File::Spec->splitpath($ext); | ||||
| 2260 | my @d = File::Spec->splitdir($d); | ||||
| 2261 | shift @d if defined $d[0] and $d[0] eq 'lib'; | ||||
| 2262 | pop @d if $d[$#d] eq ''; | ||||
| 2263 | my $instdir = $self->catdir('$(INST_ARCHLIB)', 'auto', @d, $f); | ||||
| 2264 | my $instfile = $self->catfile($instdir, $f); | ||||
| 2265 | push @statics, "$instfile\$(LIB_EXT)"; | ||||
| 2266 | |||||
| 2267 | # Dynamic library names may need special handling. | ||||
| 2268 | my $dynfile = $instfile; | ||||
| 2269 | eval { require DynaLoader }; | ||||
| 2270 | if (defined &DynaLoader::mod2fname) { | ||||
| 2271 | $dynfile = $self->catfile($instdir, &DynaLoader::mod2fname([@d, $f])); | ||||
| 2272 | } | ||||
| 2273 | |||||
| 2274 | push @dynamics, "$dynfile.\$(DLEXT)"; | ||||
| 2275 | push @boots, "$instfile.bs"; | ||||
| 2276 | } | ||||
| 2277 | $self->{INST_STATIC} = join ' ', @statics; | ||||
| 2278 | $self->{INST_DYNAMIC} = join ' ', @dynamics; | ||||
| 2279 | $self->{INST_BOOT} = join ' ', @boots; | ||||
| 2280 | } | ||||
| 2281 | } else { | ||||
| 2282 | $self->{INST_STATIC} = ''; | ||||
| 2283 | $self->{INST_DYNAMIC} = ''; | ||||
| 2284 | $self->{INST_BOOT} = ''; | ||||
| 2285 | } | ||||
| 2286 | } | ||||
| 2287 | |||||
| 2288 | =item install (o) | ||||
| 2289 | |||||
| 2290 | Defines the install target. | ||||
| 2291 | |||||
| 2292 | =cut | ||||
| 2293 | |||||
| 2294 | sub install { | ||||
| 2295 | my($self, %attribs) = @_; | ||||
| 2296 | my(@m); | ||||
| 2297 | |||||
| 2298 | push @m, q{ | ||||
| 2299 | install :: pure_install doc_install | ||||
| 2300 | $(NOECHO) $(NOOP) | ||||
| 2301 | |||||
| 2302 | install_perl :: pure_perl_install doc_perl_install | ||||
| 2303 | $(NOECHO) $(NOOP) | ||||
| 2304 | |||||
| 2305 | install_site :: pure_site_install doc_site_install | ||||
| 2306 | $(NOECHO) $(NOOP) | ||||
| 2307 | |||||
| 2308 | install_vendor :: pure_vendor_install doc_vendor_install | ||||
| 2309 | $(NOECHO) $(NOOP) | ||||
| 2310 | |||||
| 2311 | pure_install :: pure_$(INSTALLDIRS)_install | ||||
| 2312 | $(NOECHO) $(NOOP) | ||||
| 2313 | |||||
| 2314 | doc_install :: doc_$(INSTALLDIRS)_install | ||||
| 2315 | $(NOECHO) $(NOOP) | ||||
| 2316 | |||||
| 2317 | pure__install : pure_site_install | ||||
| 2318 | $(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site | ||||
| 2319 | |||||
| 2320 | doc__install : doc_site_install | ||||
| 2321 | $(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site | ||||
| 2322 | |||||
| 2323 | pure_perl_install :: all | ||||
| 2324 | $(NOECHO) umask 022; $(MOD_INSTALL) \ | ||||
| 2325 | }; | ||||
| 2326 | |||||
| 2327 | push @m, | ||||
| 2328 | q{ "$(INST_LIB)" "$(DESTINSTALLPRIVLIB)" \ | ||||
| 2329 | "$(INST_ARCHLIB)" "$(DESTINSTALLARCHLIB)" \ | ||||
| 2330 | "$(INST_BIN)" "$(DESTINSTALLBIN)" \ | ||||
| 2331 | "$(INST_SCRIPT)" "$(DESTINSTALLSCRIPT)" \ | ||||
| 2332 | "$(INST_MAN1DIR)" "$(DESTINSTALLMAN1DIR)" \ | ||||
| 2333 | "$(INST_MAN3DIR)" "$(DESTINSTALLMAN3DIR)" | ||||
| 2334 | $(NOECHO) $(WARN_IF_OLD_PACKLIST) \ | ||||
| 2335 | "}.$self->catdir('$(SITEARCHEXP)','auto','$(FULLEXT)').q{" | ||||
| 2336 | |||||
| 2337 | |||||
| 2338 | pure_site_install :: all | ||||
| 2339 | $(NOECHO) umask 02; $(MOD_INSTALL) \ | ||||
| 2340 | }; | ||||
| 2341 | push @m, | ||||
| 2342 | q{ read "}.$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q{" \ | ||||
| 2343 | write "}.$self->catfile('$(DESTINSTALLSITEARCH)','auto','$(FULLEXT)','.packlist').q{" \ | ||||
| 2344 | } unless $self->{NO_PACKLIST}; | ||||
| 2345 | |||||
| 2346 | push @m, | ||||
| 2347 | q{ "$(INST_LIB)" "$(DESTINSTALLSITELIB)" \ | ||||
| 2348 | "$(INST_ARCHLIB)" "$(DESTINSTALLSITEARCH)" \ | ||||
| 2349 | "$(INST_BIN)" "$(DESTINSTALLSITEBIN)" \ | ||||
| 2350 | "$(INST_SCRIPT)" "$(DESTINSTALLSITESCRIPT)" \ | ||||
| 2351 | "$(INST_MAN1DIR)" "$(DESTINSTALLSITEMAN1DIR)" \ | ||||
| 2352 | "$(INST_MAN3DIR)" "$(DESTINSTALLSITEMAN3DIR)" | ||||
| 2353 | $(NOECHO) $(WARN_IF_OLD_PACKLIST) \ | ||||
| 2354 | "}.$self->catdir('$(PERL_ARCHLIB)','auto','$(FULLEXT)').q{" | ||||
| 2355 | |||||
| 2356 | pure_vendor_install :: all | ||||
| 2357 | $(NOECHO) umask 022; $(MOD_INSTALL) \ | ||||
| 2358 | }; | ||||
| 2359 | |||||
| 2360 | push @m, | ||||
| 2361 | q{ "$(INST_LIB)" "$(DESTINSTALLVENDORLIB)" \ | ||||
| 2362 | "$(INST_ARCHLIB)" "$(DESTINSTALLVENDORARCH)" \ | ||||
| 2363 | "$(INST_BIN)" "$(DESTINSTALLVENDORBIN)" \ | ||||
| 2364 | "$(INST_SCRIPT)" "$(DESTINSTALLVENDORSCRIPT)" \ | ||||
| 2365 | "$(INST_MAN1DIR)" "$(DESTINSTALLVENDORMAN1DIR)" \ | ||||
| 2366 | "$(INST_MAN3DIR)" "$(DESTINSTALLVENDORMAN3DIR)" | ||||
| 2367 | |||||
| 2368 | }; | ||||
| 2369 | |||||
| 2370 | push @m, q{ | ||||
| 2371 | doc_perl_install :: all | ||||
| 2372 | $(NOECHO) $(NOOP) | ||||
| 2373 | |||||
| 2374 | doc_site_install :: all | ||||
| 2375 | $(NOECHO) $(NOOP) | ||||
| 2376 | |||||
| 2377 | doc_vendor_install :: all | ||||
| 2378 | $(NOECHO) $(NOOP) | ||||
| 2379 | |||||
| 2380 | } if $self->{NO_PERLLOCAL}; | ||||
| 2381 | |||||
| 2382 | push @m, q{ | ||||
| 2383 | doc_perl_install :: all | ||||
| 2384 | |||||
| 2385 | doc_site_install :: all | ||||
| 2386 | $(NOECHO) $(ECHO) Appending installation info to "$(DESTINSTALLSITEARCH)/perllocal.pod" | ||||
| 2387 | -$(NOECHO) umask 02; $(MKPATH) "$(DESTINSTALLSITEARCH)" | ||||
| 2388 | -$(NOECHO) umask 02; $(DOC_INSTALL) \ | ||||
| 2389 | "Module" "$(NAME)" \ | ||||
| 2390 | "installed into" "$(INSTALLSITELIB)" \ | ||||
| 2391 | LINKTYPE "$(LINKTYPE)" \ | ||||
| 2392 | VERSION "$(VERSION)" \ | ||||
| 2393 | EXE_FILES "$(EXE_FILES)" \ | ||||
| 2394 | >> "}.$self->catfile('$(DESTINSTALLSITEARCH)','perllocal.pod').q{" | ||||
| 2395 | |||||
| 2396 | doc_vendor_install :: all | ||||
| 2397 | |||||
| 2398 | } unless $self->{NO_PERLLOCAL}; | ||||
| 2399 | |||||
| 2400 | push @m, q{ | ||||
| 2401 | uninstall :: uninstall_from_$(INSTALLDIRS)dirs | ||||
| 2402 | $(NOECHO) $(NOOP) | ||||
| 2403 | |||||
| 2404 | uninstall_from_perldirs :: | ||||
| 2405 | |||||
| 2406 | uninstall_from_sitedirs :: | ||||
| 2407 | $(NOECHO) $(UNINSTALL) "}.$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q{" | ||||
| 2408 | |||||
| 2409 | uninstall_from_vendordirs :: | ||||
| 2410 | }; | ||||
| 2411 | |||||
| 2412 | join("",@m); | ||||
| 2413 | } | ||||
| 2414 | |||||
| 2415 | =item installbin (o) | ||||
| 2416 | |||||
| 2417 | Defines targets to make and to install EXE_FILES. | ||||
| 2418 | |||||
| 2419 | =cut | ||||
| 2420 | |||||
| 2421 | sub installbin { | ||||
| 2422 | my($self) = shift; | ||||
| 2423 | |||||
| 2424 | return "" unless $self->{EXE_FILES} && ref $self->{EXE_FILES} eq "ARRAY"; | ||||
| 2425 | my @exefiles = sort @{$self->{EXE_FILES}}; | ||||
| 2426 | return "" unless @exefiles; | ||||
| 2427 | |||||
| 2428 | @exefiles = map vmsify($_), @exefiles if $Is{VMS}; | ||||
| 2429 | |||||
| 2430 | my %fromto; | ||||
| 2431 | for my $from (@exefiles) { | ||||
| 2432 | my($path)= $self->catfile('$(INST_SCRIPT)', basename($from)); | ||||
| 2433 | |||||
| 2434 | local($_) = $path; # for backwards compatibility | ||||
| 2435 | my $to = $self->libscan($path); | ||||
| 2436 | print "libscan($from) => '$to'\n" if ($Verbose >=2); | ||||
| 2437 | |||||
| 2438 | $to = vmsify($to) if $Is{VMS}; | ||||
| 2439 | $fromto{$from} = $to; | ||||
| 2440 | } | ||||
| 2441 | my @to = sort values %fromto; | ||||
| 2442 | |||||
| 2443 | my @m; | ||||
| 2444 | push(@m, qq{ | ||||
| 2445 | EXE_FILES = @exefiles | ||||
| 2446 | |||||
| 2447 | pure_all :: @to | ||||
| 2448 | \$(NOECHO) \$(NOOP) | ||||
| 2449 | |||||
| 2450 | realclean :: | ||||
| 2451 | }); | ||||
| 2452 | |||||
| 2453 | # realclean can get rather large. | ||||
| 2454 | push @m, map "\t$_\n", $self->split_command('$(RM_F)', @to); | ||||
| 2455 | push @m, "\n"; | ||||
| 2456 | |||||
| 2457 | # A target for each exe file. | ||||
| 2458 | my @froms = sort keys %fromto; | ||||
| 2459 | for my $from (@froms) { | ||||
| 2460 | # 1 2 | ||||
| 2461 | push @m, _sprintf562 <<'MAKE', $from, $fromto{$from}; | ||||
| 2462 | %2$s : %1$s $(FIRST_MAKEFILE) $(INST_SCRIPT)$(DFSEP).exists $(INST_BIN)$(DFSEP).exists | ||||
| 2463 | $(NOECHO) $(RM_F) %2$s | ||||
| 2464 | $(CP) %1$s %2$s | ||||
| 2465 | $(FIXIN) %2$s | ||||
| 2466 | -$(NOECHO) $(CHMOD) $(PERM_RWX) %2$s | ||||
| 2467 | |||||
| 2468 | MAKE | ||||
| 2469 | |||||
| 2470 | } | ||||
| 2471 | |||||
| 2472 | join "", @m; | ||||
| 2473 | } | ||||
| 2474 | |||||
| 2475 | =item linkext (o) | ||||
| 2476 | |||||
| 2477 | Defines the linkext target which in turn defines the LINKTYPE. | ||||
| 2478 | |||||
| 2479 | =cut | ||||
| 2480 | |||||
| 2481 | # LINKTYPE => static or dynamic or '' | ||||
| 2482 | sub linkext { | ||||
| 2483 | my($self, %attribs) = @_; | ||||
| 2484 | my $linktype = $attribs{LINKTYPE}; | ||||
| 2485 | $linktype = $self->{LINKTYPE} unless defined $linktype; | ||||
| 2486 | if (defined $linktype and $linktype eq '') { | ||||
| 2487 | warn "Warning: LINKTYPE set to '', no longer necessary\n"; | ||||
| 2488 | } | ||||
| 2489 | $linktype = '$(LINKTYPE)' unless defined $linktype; | ||||
| 2490 | " | ||||
| 2491 | linkext :: $linktype | ||||
| 2492 | \$(NOECHO) \$(NOOP) | ||||
| 2493 | "; | ||||
| 2494 | } | ||||
| 2495 | |||||
| 2496 | =item lsdir | ||||
| 2497 | |||||
| 2498 | Takes as arguments a directory name and a regular expression. Returns | ||||
| 2499 | all entries in the directory that match the regular expression. | ||||
| 2500 | |||||
| 2501 | =cut | ||||
| 2502 | |||||
| 2503 | sub lsdir { | ||||
| 2504 | # $self | ||||
| 2505 | my(undef, $dir, $regex) = @_; | ||||
| 2506 | opendir(my $dh, defined($dir) ? $dir : ".") | ||||
| 2507 | or return; | ||||
| 2508 | my @ls = readdir $dh; | ||||
| 2509 | closedir $dh; | ||||
| 2510 | @ls = grep(/$regex/, @ls) if defined $regex; | ||||
| 2511 | @ls; | ||||
| 2512 | } | ||||
| 2513 | |||||
| 2514 | =item macro (o) | ||||
| 2515 | |||||
| 2516 | Simple subroutine to insert the macros defined by the macro attribute | ||||
| 2517 | into the Makefile. | ||||
| 2518 | |||||
| 2519 | =cut | ||||
| 2520 | |||||
| 2521 | sub macro { | ||||
| 2522 | my($self,%attribs) = @_; | ||||
| 2523 | my @m; | ||||
| 2524 | foreach my $key (sort keys %attribs) { | ||||
| 2525 | my $val = $attribs{$key}; | ||||
| 2526 | push @m, "$key = $val\n"; | ||||
| 2527 | } | ||||
| 2528 | join "", @m; | ||||
| 2529 | } | ||||
| 2530 | |||||
| 2531 | =item makeaperl (o) | ||||
| 2532 | |||||
| 2533 | Called by staticmake. Defines how to write the Makefile to produce a | ||||
| 2534 | static new perl. | ||||
| 2535 | |||||
| 2536 | By default the Makefile produced includes all the static extensions in | ||||
| 2537 | the perl library. (Purified versions of library files, e.g., | ||||
| 2538 | DynaLoader_pure_p1_c0_032.a are automatically ignored to avoid link errors.) | ||||
| 2539 | |||||
| 2540 | =cut | ||||
| 2541 | |||||
| 2542 | sub makeaperl { | ||||
| 2543 | my($self, %attribs) = @_; | ||||
| 2544 | my($makefilename, $searchdirs, $static, $extra, $perlinc, $target, $tmp, $libperl) = | ||||
| 2545 | @attribs{qw(MAKE DIRS STAT EXTRA INCL TARGET TMP LIBPERL)}; | ||||
| 2546 | s/^(.*)/"-I$1"/ for @{$perlinc || []}; | ||||
| 2547 | my(@m); | ||||
| 2548 | push @m, " | ||||
| 2549 | # --- MakeMaker makeaperl section --- | ||||
| 2550 | MAP_TARGET = $target | ||||
| 2551 | FULLPERL = $self->{FULLPERL} | ||||
| 2552 | MAP_PERLINC = @{$perlinc || []} | ||||
| 2553 | "; | ||||
| 2554 | return join '', @m if $self->{PARENT}; | ||||
| 2555 | |||||
| 2556 | my($dir) = join ":", @{$self->{DIR}}; | ||||
| 2557 | |||||
| 2558 | unless ($self->{MAKEAPERL}) { | ||||
| 2559 | push @m, q{ | ||||
| 2560 | $(MAP_TARGET) :: $(MAKE_APERL_FILE) | ||||
| 2561 | $(MAKE) $(USEMAKEFILE) $(MAKE_APERL_FILE) $@ | ||||
| 2562 | |||||
| 2563 | $(MAKE_APERL_FILE) : static $(FIRST_MAKEFILE) pm_to_blib | ||||
| 2564 | $(NOECHO) $(ECHO) Writing \"$(MAKE_APERL_FILE)\" for this $(MAP_TARGET) | ||||
| 2565 | $(NOECHO) $(PERLRUNINST) \ | ||||
| 2566 | Makefile.PL DIR="}, $dir, q{" \ | ||||
| 2567 | MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \ | ||||
| 2568 | MAKEAPERL=1 NORECURS=1 CCCDLFLAGS=}; | ||||
| 2569 | |||||
| 2570 | foreach (@ARGV){ | ||||
| 2571 | my $arg = $_; # avoid lvalue aliasing | ||||
| 2572 | if ( $arg =~ /(^.*?=)(.*['\s].*)/ ) { | ||||
| 2573 | $arg = $1 . $self->quote_literal($2); | ||||
| 2574 | } | ||||
| 2575 | push @m, " \\\n\t\t$arg"; | ||||
| 2576 | } | ||||
| 2577 | push @m, "\n"; | ||||
| 2578 | |||||
| 2579 | return join '', @m; | ||||
| 2580 | } | ||||
| 2581 | |||||
| 2582 | my $cccmd = $self->const_cccmd($libperl); | ||||
| 2583 | $cccmd =~ s/^CCCMD\s*=\s*//; | ||||
| 2584 | $cccmd =~ s/\$\(INC\)/ "-I$self->{PERL_INC}" /; | ||||
| 2585 | $cccmd .= " $Config{cccdlflags}" | ||||
| 2586 | if ($Config{useshrplib} eq 'true'); | ||||
| 2587 | $cccmd =~ s/\(CC\)/\(PERLMAINCC\)/; | ||||
| 2588 | |||||
| 2589 | # The front matter of the linkcommand... | ||||
| 2590 | my $linkcmd = join ' ', "\$(CC)", | ||||
| 2591 | grep($_, @Config{qw(ldflags ccdlflags)}); | ||||
| 2592 | $linkcmd =~ s/\s+/ /g; | ||||
| 2593 | $linkcmd =~ s,(perl\.exp),\$(PERL_INC)/$1,; | ||||
| 2594 | |||||
| 2595 | # Which *.a files could we make use of... | ||||
| 2596 | my $staticlib21 = $self->_find_static_libs($searchdirs); | ||||
| 2597 | # We trust that what has been handed in as argument, will be buildable | ||||
| 2598 | $static = [] unless $static; | ||||
| 2599 | @$staticlib21{@{$static}} = (1) x @{$static}; | ||||
| 2600 | |||||
| 2601 | $extra = [] unless $extra && ref $extra eq 'ARRAY'; | ||||
| 2602 | for (sort keys %$staticlib21) { | ||||
| 2603 | next unless /\Q$self->{LIB_EXT}\E\z/; | ||||
| 2604 | $_ = dirname($_) . "/extralibs.ld"; | ||||
| 2605 | push @$extra, $_; | ||||
| 2606 | } | ||||
| 2607 | |||||
| 2608 | s/^(.*)/"-I$1"/ for @{$perlinc || []}; | ||||
| 2609 | |||||
| 2610 | $target ||= "perl"; | ||||
| 2611 | $tmp ||= "."; | ||||
| 2612 | |||||
| 2613 | # MAP_STATIC doesn't look into subdirs yet. Once "all" is made and we | ||||
| 2614 | # regenerate the Makefiles, MAP_STATIC and the dependencies for | ||||
| 2615 | # extralibs.all are computed correctly | ||||
| 2616 | my @map_static = reverse sort keys %$staticlib21; | ||||
| 2617 | push @m, " | ||||
| 2618 | MAP_LINKCMD = $linkcmd | ||||
| 2619 | MAP_STATIC = ", join(" \\\n\t", map { qq{"$_"} } @map_static), " | ||||
| 2620 | MAP_STATICDEP = ", join(' ', map { $self->quote_dep($_) } @map_static), " | ||||
| 2621 | |||||
| 2622 | MAP_PRELIBS = $Config{perllibs} $Config{cryptlib} | ||||
| 2623 | "; | ||||
| 2624 | |||||
| 2625 | my $lperl; | ||||
| 2626 | if (defined $libperl) { | ||||
| 2627 | ($lperl = $libperl) =~ s/\$\(A\)/$self->{LIB_EXT}/; | ||||
| 2628 | } | ||||
| 2629 | unless ($libperl && -f $lperl) { # Ilya's code... | ||||
| 2630 | my $dir = $self->{PERL_SRC} || "$self->{PERL_ARCHLIB}/../.."; | ||||
| 2631 | $dir = "$self->{PERL_ARCHLIB}/.." if $self->{UNINSTALLED_PERL}; | ||||
| 2632 | $libperl ||= "libperl$self->{LIB_EXT}"; | ||||
| 2633 | $libperl = "$dir/$libperl"; | ||||
| 2634 | $lperl ||= "libperl$self->{LIB_EXT}"; | ||||
| 2635 | $lperl = "$dir/$lperl"; | ||||
| 2636 | |||||
| 2637 | if (! -f $libperl and ! -f $lperl) { | ||||
| 2638 | # We did not find a static libperl. Maybe there is a shared one? | ||||
| 2639 | if ($Is{SunOS}) { | ||||
| 2640 | $lperl = $libperl = "$dir/$Config{libperl}"; | ||||
| 2641 | # SUNOS ld does not take the full path to a shared library | ||||
| 2642 | $libperl = '' if $Is{SunOS4}; | ||||
| 2643 | } | ||||
| 2644 | } | ||||
| 2645 | |||||
| 2646 | print <<EOF unless -f $lperl || defined($self->{PERL_SRC}); | ||||
| 2647 | Warning: $libperl not found | ||||
| 2648 | If you're going to build a static perl binary, make sure perl is installed | ||||
| 2649 | otherwise ignore this warning | ||||
| 2650 | EOF | ||||
| 2651 | } | ||||
| 2652 | |||||
| 2653 | # SUNOS ld does not take the full path to a shared library | ||||
| 2654 | my $llibperl = $libperl ? '$(MAP_LIBPERL)' : '-lperl'; | ||||
| 2655 | my $libperl_dep = $self->quote_dep($libperl); | ||||
| 2656 | |||||
| 2657 | push @m, " | ||||
| 2658 | MAP_LIBPERL = $libperl | ||||
| 2659 | MAP_LIBPERLDEP = $libperl_dep | ||||
| 2660 | LLIBPERL = $llibperl | ||||
| 2661 | "; | ||||
| 2662 | |||||
| 2663 | push @m, ' | ||||
| 2664 | $(INST_ARCHAUTODIR)/extralibs.all : $(INST_ARCHAUTODIR)$(DFSEP).exists '.join(" \\\n\t", @$extra).' | ||||
| 2665 | $(NOECHO) $(RM_F) $@ | ||||
| 2666 | $(NOECHO) $(TOUCH) $@ | ||||
| 2667 | '; | ||||
| 2668 | |||||
| 2669 | foreach my $catfile (@$extra){ | ||||
| 2670 | push @m, "\tcat $catfile >> \$\@\n"; | ||||
| 2671 | } | ||||
| 2672 | |||||
| 2673 | my $ldfrom = $self->{XSMULTI} ? '' : '$(LDFROM)'; | ||||
| 2674 | # 1 2 3 4 | ||||
| 2675 | push @m, _sprintf562 <<'EOF', $tmp, $ldfrom, $self->xs_obj_opt('$@'), $makefilename; | ||||
| 2676 | $(MAP_TARGET) :: %1$s/perlmain$(OBJ_EXT) $(MAP_LIBPERLDEP) $(MAP_STATICDEP) $(INST_ARCHAUTODIR)/extralibs.all | ||||
| 2677 | $(MAP_LINKCMD) %2$s $(OPTIMIZE) %1$s/perlmain$(OBJ_EXT) %3$s $(MAP_STATIC) "$(LLIBPERL)" `cat $(INST_ARCHAUTODIR)/extralibs.all` $(MAP_PRELIBS) | ||||
| 2678 | $(NOECHO) $(ECHO) "To install the new '$(MAP_TARGET)' binary, call" | ||||
| 2679 | $(NOECHO) $(ECHO) " $(MAKE) $(USEMAKEFILE) %4$s inst_perl MAP_TARGET=$(MAP_TARGET)" | ||||
| 2680 | $(NOECHO) $(ECHO) " $(MAKE) $(USEMAKEFILE) %4$s map_clean" | ||||
| 2681 | |||||
| 2682 | %1$s/perlmain\$(OBJ_EXT): %1$s/perlmain.c | ||||
| 2683 | EOF | ||||
| 2684 | push @m, "\t".$self->cd($tmp, qq[$cccmd "-I\$(PERL_INC)" perlmain.c])."\n"; | ||||
| 2685 | |||||
| 2686 | my $maybe_DynaLoader = $Config{usedl} ? 'q(DynaLoader)' : ''; | ||||
| 2687 | push @m, _sprintf562 <<'EOF', $tmp, $makefilename, $maybe_DynaLoader; | ||||
| 2688 | |||||
| 2689 | %1$s/perlmain.c: %2$s | ||||
| 2690 | $(NOECHO) $(ECHO) Writing $@ | ||||
| 2691 | $(NOECHO) $(PERL) $(MAP_PERLINC) "-MExtUtils::Miniperl" \ | ||||
| 2692 | -e "writemain(grep(s#.*/auto/##s, @ARGV), %3$s)" $(MAP_STATIC) > $@t | ||||
| 2693 | $(MV) $@t $@ | ||||
| 2694 | |||||
| 2695 | EOF | ||||
| 2696 | push @m, "\t", q{$(NOECHO) $(PERL) "$(INSTALLSCRIPT)/fixpmain" | ||||
| 2697 | } if (defined (&Dos::UseLFN) && Dos::UseLFN()==0); | ||||
| 2698 | |||||
| 2699 | |||||
| 2700 | push @m, q{ | ||||
| 2701 | doc_inst_perl : | ||||
| 2702 | $(NOECHO) $(ECHO) Appending installation info to "$(DESTINSTALLARCHLIB)/perllocal.pod" | ||||
| 2703 | -$(NOECHO) $(MKPATH) "$(DESTINSTALLARCHLIB)" | ||||
| 2704 | -$(NOECHO) $(DOC_INSTALL) \ | ||||
| 2705 | "Perl binary" "$(MAP_TARGET)" \ | ||||
| 2706 | MAP_STATIC "$(MAP_STATIC)" \ | ||||
| 2707 | MAP_EXTRA "`cat $(INST_ARCHAUTODIR)/extralibs.all`" \ | ||||
| 2708 | MAP_LIBPERL "$(MAP_LIBPERL)" \ | ||||
| 2709 | >> "}.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{" | ||||
| 2710 | |||||
| 2711 | }; | ||||
| 2712 | |||||
| 2713 | push @m, q{ | ||||
| 2714 | inst_perl : pure_inst_perl doc_inst_perl | ||||
| 2715 | |||||
| 2716 | pure_inst_perl : $(MAP_TARGET) | ||||
| 2717 | }.$self->{CP}.q{ $(MAP_TARGET) "}.$self->catfile('$(DESTINSTALLBIN)','$(MAP_TARGET)').q{" | ||||
| 2718 | |||||
| 2719 | clean :: map_clean | ||||
| 2720 | |||||
| 2721 | map_clean : | ||||
| 2722 | }.$self->{RM_F}.qq{ $tmp/perlmain\$(OBJ_EXT) $tmp/perlmain.c \$(MAP_TARGET) $makefilename \$(INST_ARCHAUTODIR)/extralibs.all | ||||
| 2723 | }; | ||||
| 2724 | |||||
| 2725 | join '', @m; | ||||
| 2726 | } | ||||
| 2727 | |||||
| 2728 | # utility method | ||||
| 2729 | sub _find_static_libs { | ||||
| 2730 | my ($self, $searchdirs) = @_; | ||||
| 2731 | # don't use File::Spec here because on Win32 F::F still uses "/" | ||||
| 2732 | my $installed_version = join('/', | ||||
| 2733 | 'auto', $self->{FULLEXT}, "$self->{BASEEXT}$self->{LIB_EXT}" | ||||
| 2734 | ); | ||||
| 2735 | my %staticlib21; | ||||
| 2736 | require File::Find; | ||||
| 2737 | File::Find::find(sub { | ||||
| 2738 | if ($File::Find::name =~ m{/auto/share\z}) { | ||||
| 2739 | # in a subdir of auto/share, prune because e.g. | ||||
| 2740 | # Alien::pkgconfig uses File::ShareDir to put .a files | ||||
| 2741 | # there. do not want | ||||
| 2742 | $File::Find::prune = 1; | ||||
| 2743 | return; | ||||
| 2744 | } | ||||
| 2745 | |||||
| 2746 | return unless m/\Q$self->{LIB_EXT}\E$/; | ||||
| 2747 | |||||
| 2748 | return unless -f 'extralibs.ld'; # this checks is a "proper" XS installation | ||||
| 2749 | |||||
| 2750 | # Skip perl's libraries. | ||||
| 2751 | return if m/^libperl/ or m/^perl\Q$self->{LIB_EXT}\E$/; | ||||
| 2752 | |||||
| 2753 | # Skip purified versions of libraries | ||||
| 2754 | # (e.g., DynaLoader_pure_p1_c0_032.a) | ||||
| 2755 | return if m/_pure_\w+_\w+_\w+\.\w+$/ and -f "$File::Find::dir/.pure"; | ||||
| 2756 | |||||
| 2757 | if( exists $self->{INCLUDE_EXT} ){ | ||||
| 2758 | my $found = 0; | ||||
| 2759 | |||||
| 2760 | (my $xx = $File::Find::name) =~ s,.*?/auto/,,s; | ||||
| 2761 | $xx =~ s,/?$_,,; | ||||
| 2762 | $xx =~ s,/,::,g; | ||||
| 2763 | |||||
| 2764 | # Throw away anything not explicitly marked for inclusion. | ||||
| 2765 | # DynaLoader is implied. | ||||
| 2766 | foreach my $incl ((@{$self->{INCLUDE_EXT}},'DynaLoader')){ | ||||
| 2767 | if( $xx eq $incl ){ | ||||
| 2768 | $found++; | ||||
| 2769 | last; | ||||
| 2770 | } | ||||
| 2771 | } | ||||
| 2772 | return unless $found; | ||||
| 2773 | } | ||||
| 2774 | elsif( exists $self->{EXCLUDE_EXT} ){ | ||||
| 2775 | (my $xx = $File::Find::name) =~ s,.*?/auto/,,s; | ||||
| 2776 | $xx =~ s,/?$_,,; | ||||
| 2777 | $xx =~ s,/,::,g; | ||||
| 2778 | |||||
| 2779 | # Throw away anything explicitly marked for exclusion | ||||
| 2780 | foreach my $excl (@{$self->{EXCLUDE_EXT}}){ | ||||
| 2781 | return if( $xx eq $excl ); | ||||
| 2782 | } | ||||
| 2783 | } | ||||
| 2784 | |||||
| 2785 | # don't include the installed version of this extension. I | ||||
| 2786 | # leave this line here, although it is not necessary anymore: | ||||
| 2787 | # I patched minimod.PL instead, so that Miniperl.pm won't | ||||
| 2788 | # include duplicates | ||||
| 2789 | |||||
| 2790 | # Once the patch to minimod.PL is in the distribution, I can | ||||
| 2791 | # drop it | ||||
| 2792 | return if $File::Find::name =~ m:\Q$installed_version\E\z:; | ||||
| 2793 | return if !$self->xs_static_lib_is_xs($_); | ||||
| 2794 | 2 | 698µs | 2 | 48µs | # spent 29µs (9+20) within ExtUtils::MM_Unix::BEGIN@2794 which was called:
# once (9µs+20µs) by IPC::Cmd::can_run at line 2794 # spent 29µs making 1 call to ExtUtils::MM_Unix::BEGIN@2794
# spent 20µs making 1 call to Exporter::import |
| 2795 | $staticlib21{cwd() . "/" . $_}++; | ||||
| 2796 | }, grep( -d $_, map { $self->catdir($_, 'auto') } @{$searchdirs || []}) ); | ||||
| 2797 | return \%staticlib21; | ||||
| 2798 | } | ||||
| 2799 | |||||
| 2800 | =item xs_static_lib_is_xs (o) | ||||
| 2801 | |||||
| 2802 | Called by a utility method of makeaperl. Checks whether a given file | ||||
| 2803 | is an XS library by seeing whether it defines any symbols starting | ||||
| 2804 | with C<boot_> (with an optional leading underscore - needed on MacOS). | ||||
| 2805 | |||||
| 2806 | =cut | ||||
| 2807 | |||||
| 2808 | sub xs_static_lib_is_xs { | ||||
| 2809 | my ($self, $libfile) = @_; | ||||
| 2810 | my $devnull = File::Spec->devnull; | ||||
| 2811 | return `nm $libfile 2>$devnull` =~ /\b_?boot_/; | ||||
| 2812 | } | ||||
| 2813 | |||||
| 2814 | =item makefile (o) | ||||
| 2815 | |||||
| 2816 | Defines how to rewrite the Makefile. | ||||
| 2817 | |||||
| 2818 | =cut | ||||
| 2819 | |||||
| 2820 | sub makefile { | ||||
| 2821 | my($self) = shift; | ||||
| 2822 | my $m; | ||||
| 2823 | # We do not know what target was originally specified so we | ||||
| 2824 | # must force a manual rerun to be sure. But as it should only | ||||
| 2825 | # happen very rarely it is not a significant problem. | ||||
| 2826 | $m = ' | ||||
| 2827 | $(OBJECT) : $(FIRST_MAKEFILE) | ||||
| 2828 | |||||
| 2829 | ' if $self->{OBJECT}; | ||||
| 2830 | |||||
| 2831 | my $newer_than_target = $Is{VMS} ? '$(MMS$SOURCE_LIST)' : '$?'; | ||||
| 2832 | my $mpl_args = join " ", map qq["$_"], @ARGV; | ||||
| 2833 | my $cross = ''; | ||||
| 2834 | if (defined $::Cross::platform) { | ||||
| 2835 | # Inherited from win32/buildext.pl | ||||
| 2836 | $cross = "-MCross=$::Cross::platform "; | ||||
| 2837 | } | ||||
| 2838 | $m .= sprintf <<'MAKE_FRAG', $newer_than_target, $cross, $mpl_args; | ||||
| 2839 | # We take a very conservative approach here, but it's worth it. | ||||
| 2840 | # We move Makefile to Makefile.old here to avoid gnu make looping. | ||||
| 2841 | $(FIRST_MAKEFILE) : Makefile.PL $(CONFIGDEP) | ||||
| 2842 | $(NOECHO) $(ECHO) "Makefile out-of-date with respect to %s" | ||||
| 2843 | $(NOECHO) $(ECHO) "Cleaning current config before rebuilding Makefile..." | ||||
| 2844 | -$(NOECHO) $(RM_F) $(MAKEFILE_OLD) | ||||
| 2845 | -$(NOECHO) $(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD) | ||||
| 2846 | - $(MAKE) $(USEMAKEFILE) $(MAKEFILE_OLD) clean $(DEV_NULL) | ||||
| 2847 | $(PERLRUN) %sMakefile.PL %s | ||||
| 2848 | $(NOECHO) $(ECHO) "==> Your Makefile has been rebuilt. <==" | ||||
| 2849 | $(NOECHO) $(ECHO) "==> Please rerun the $(MAKE) command. <==" | ||||
| 2850 | $(FALSE) | ||||
| 2851 | |||||
| 2852 | MAKE_FRAG | ||||
| 2853 | |||||
| 2854 | return $m; | ||||
| 2855 | } | ||||
| 2856 | |||||
| 2857 | |||||
| 2858 | =item maybe_command | ||||
| 2859 | |||||
| 2860 | Returns true, if the argument is likely to be a command. | ||||
| 2861 | |||||
| 2862 | =cut | ||||
| 2863 | |||||
| 2864 | # spent 94µs (32+61) within ExtUtils::MM_Unix::maybe_command which was called 27 times, avg 3µs/call:
# 27 times (32µs+61µs) by IPC::Cmd::can_run at line 250 of IPC/Cmd.pm, avg 3µs/call | ||||
| 2865 | 27 | 4µs | my($self,$file) = @_; | ||
| 2866 | 27 | 84µs | 29 | 61µs | return $file if -x $file && ! -d $file; # spent 55µs making 27 calls to ExtUtils::MM_Unix::CORE:fteexec, avg 2µs/call
# spent 6µs making 2 calls to ExtUtils::MM_Unix::CORE:ftdir, avg 3µs/call |
| 2867 | 25 | 15µs | return; | ||
| 2868 | } | ||||
| 2869 | |||||
| 2870 | |||||
| 2871 | =item needs_linking (o) | ||||
| 2872 | |||||
| 2873 | Does this module need linking? Looks into subdirectory objects (see | ||||
| 2874 | also has_link_code()) | ||||
| 2875 | |||||
| 2876 | =cut | ||||
| 2877 | |||||
| 2878 | sub needs_linking { | ||||
| 2879 | my($self) = shift; | ||||
| 2880 | |||||
| 2881 | my $caller = (caller(0))[3]; | ||||
| 2882 | confess("needs_linking called too early") if | ||||
| 2883 | $caller =~ /^ExtUtils::MakeMaker::/; | ||||
| 2884 | return $self->{NEEDS_LINKING} if defined $self->{NEEDS_LINKING}; | ||||
| 2885 | if ($self->has_link_code or $self->{MAKEAPERL}){ | ||||
| 2886 | $self->{NEEDS_LINKING} = 1; | ||||
| 2887 | return 1; | ||||
| 2888 | } | ||||
| 2889 | foreach my $child (keys %{$self->{CHILDREN}}) { | ||||
| 2890 | if ($self->{CHILDREN}->{$child}->needs_linking) { | ||||
| 2891 | $self->{NEEDS_LINKING} = 1; | ||||
| 2892 | return 1; | ||||
| 2893 | } | ||||
| 2894 | } | ||||
| 2895 | return $self->{NEEDS_LINKING} = 0; | ||||
| 2896 | } | ||||
| 2897 | |||||
| 2898 | |||||
| 2899 | =item parse_abstract | ||||
| 2900 | |||||
| 2901 | parse a file and return what you think is the ABSTRACT | ||||
| 2902 | |||||
| 2903 | =cut | ||||
| 2904 | |||||
| 2905 | sub parse_abstract { | ||||
| 2906 | my($self,$parsefile) = @_; | ||||
| 2907 | my $result; | ||||
| 2908 | |||||
| 2909 | local $/ = "\n"; | ||||
| 2910 | open(my $fh, '<', $parsefile) or die "Could not open '$parsefile': $!"; | ||||
| 2911 | binmode $fh; | ||||
| 2912 | my $inpod = 0; | ||||
| 2913 | my $pod_encoding; | ||||
| 2914 | my $package = $self->{DISTNAME}; | ||||
| 2915 | $package =~ s/-/::/g; | ||||
| 2916 | while (<$fh>) { | ||||
| 2917 | $inpod = /^=(?!cut)/ ? 1 : /^=cut/ ? 0 : $inpod; | ||||
| 2918 | next if !$inpod; | ||||
| 2919 | s#\r*\n\z##; # handle CRLF input | ||||
| 2920 | |||||
| 2921 | if ( /^=encoding\s*(.*)$/i ) { | ||||
| 2922 | $pod_encoding = $1; | ||||
| 2923 | } | ||||
| 2924 | |||||
| 2925 | if ( /^($package(?:\.pm)? \s+ -+ \s+)(.*)/x ) { | ||||
| 2926 | $result = $2; | ||||
| 2927 | next; | ||||
| 2928 | } | ||||
| 2929 | next unless $result; | ||||
| 2930 | |||||
| 2931 | if ( $result && ( /^\s*$/ || /^\=/ ) ) { | ||||
| 2932 | last; | ||||
| 2933 | } | ||||
| 2934 | $result = join ' ', $result, $_; | ||||
| 2935 | } | ||||
| 2936 | close $fh; | ||||
| 2937 | |||||
| 2938 | if ( $pod_encoding and !( "$]" < 5.008 or !$Config{useperlio} ) ) { | ||||
| 2939 | # Have to wrap in an eval{} for when running under PERL_CORE | ||||
| 2940 | # Encode isn't available during build phase and parsing | ||||
| 2941 | # ABSTRACT isn't important there | ||||
| 2942 | eval { | ||||
| 2943 | require Encode; | ||||
| 2944 | $result = Encode::decode($pod_encoding, $result); | ||||
| 2945 | } | ||||
| 2946 | } | ||||
| 2947 | |||||
| 2948 | return $result; | ||||
| 2949 | } | ||||
| 2950 | |||||
| 2951 | =item parse_version | ||||
| 2952 | |||||
| 2953 | my $version = MM->parse_version($file); | ||||
| 2954 | |||||
| 2955 | Parse a $file and return what $VERSION is set to by the first assignment. | ||||
| 2956 | It will return the string "undef" if it can't figure out what $VERSION | ||||
| 2957 | is. $VERSION should be for all to see, so C<our $VERSION> or plain $VERSION | ||||
| 2958 | are okay, but C<my $VERSION> is not. | ||||
| 2959 | |||||
| 2960 | C<package Foo VERSION> is also checked for. The first version | ||||
| 2961 | declaration found is used, but this may change as it differs from how | ||||
| 2962 | Perl does it. | ||||
| 2963 | |||||
| 2964 | parse_version() will try to C<use version> before checking for | ||||
| 2965 | C<$VERSION> so the following will work. | ||||
| 2966 | |||||
| 2967 | $VERSION = qv(1.2.3); | ||||
| 2968 | |||||
| 2969 | =cut | ||||
| 2970 | |||||
| 2971 | sub parse_version { | ||||
| 2972 | my($self,$parsefile) = @_; | ||||
| 2973 | my $result; | ||||
| 2974 | |||||
| 2975 | local $/ = "\n"; | ||||
| 2976 | local $_; | ||||
| 2977 | open(my $fh, '<', $parsefile) or die "Could not open '$parsefile': $!"; | ||||
| 2978 | my $inpod = 0; | ||||
| 2979 | while (<$fh>) { | ||||
| 2980 | $inpod = /^=(?!cut)/ ? 1 : /^=cut/ ? 0 : $inpod; | ||||
| 2981 | next if $inpod || /^\s*#/; | ||||
| 2982 | chop; | ||||
| 2983 | next if /^\s*(if|unless|elsif)/; | ||||
| 2984 | if ( m{^ \s* package \s+ \w[\w\:\']* \s+ (v?[0-9._]+) \s* (;|\{) }x ) { | ||||
| 2985 | 2 | 214µs | 2 | 45µs | # spent 26µs (7+19) within ExtUtils::MM_Unix::BEGIN@2985 which was called:
# once (7µs+19µs) by IPC::Cmd::can_run at line 2985 # spent 26µs making 1 call to ExtUtils::MM_Unix::BEGIN@2985
# spent 19µs making 1 call to warnings::unimport |
| 2986 | $result = $1; | ||||
| 2987 | } | ||||
| 2988 | elsif ( m{(?<!\\) ([\$*]) (([\w\:\']*) \bVERSION)\b .* (?<![<>=!])\=[^=]}x ) { | ||||
| 2989 | $result = $self->get_version($parsefile, $1, $2); | ||||
| 2990 | } | ||||
| 2991 | else { | ||||
| 2992 | next; | ||||
| 2993 | } | ||||
| 2994 | last if defined $result; | ||||
| 2995 | } | ||||
| 2996 | close $fh; | ||||
| 2997 | |||||
| 2998 | if ( defined $result && $result !~ /^v?[\d_\.]+$/ ) { | ||||
| 2999 | require version; | ||||
| 3000 | my $normal = eval { version->new( $result ) }; | ||||
| 3001 | $result = $normal if defined $normal; | ||||
| 3002 | } | ||||
| 3003 | if ( defined $result ) { | ||||
| 3004 | $result = "undef" unless $result =~ m!^v?[\d_\.]+$! | ||||
| 3005 | or eval { version->parse( $result ) }; | ||||
| 3006 | } | ||||
| 3007 | $result = "undef" unless defined $result; | ||||
| 3008 | return $result; | ||||
| 3009 | } | ||||
| 3010 | |||||
| 3011 | sub get_version { | ||||
| 3012 | my ($self, $parsefile, $sigil, $name) = @_; | ||||
| 3013 | my $line = $_; # from the while() loop in parse_version | ||||
| 3014 | { | ||||
| 3015 | package ExtUtils::MakeMaker::_version; | ||||
| 3016 | undef *version; # in case of unexpected version() sub | ||||
| 3017 | eval { | ||||
| 3018 | require version; | ||||
| 3019 | version::->import; | ||||
| 3020 | }; | ||||
| 3021 | 2 | 21µs | 2 | 12µs | # spent 10µs (7+3) within ExtUtils::MakeMaker::_version::BEGIN@3021 which was called:
# once (7µs+3µs) by IPC::Cmd::can_run at line 3021 # spent 10µs making 1 call to ExtUtils::MakeMaker::_version::BEGIN@3021
# spent 2µs making 1 call to strict::unimport |
| 3022 | 2 | 2.76ms | 2 | 23µs | # spent 14µs (4+9) within ExtUtils::MakeMaker::_version::BEGIN@3022 which was called:
# once (4µs+9µs) by IPC::Cmd::can_run at line 3022 # spent 14µs making 1 call to ExtUtils::MakeMaker::_version::BEGIN@3022
# spent 9µs making 1 call to warnings::unimport |
| 3023 | local *{$name}; | ||||
| 3024 | $line = $1 if $line =~ m{^(.+)}s; | ||||
| 3025 | eval($line); ## no critic | ||||
| 3026 | return ${$name}; | ||||
| 3027 | } | ||||
| 3028 | } | ||||
| 3029 | |||||
| 3030 | =item pasthru (o) | ||||
| 3031 | |||||
| 3032 | Defines the string that is passed to recursive make calls in | ||||
| 3033 | subdirectories. The variables like C<PASTHRU_DEFINE> are used in each | ||||
| 3034 | level, and passed downwards on the command-line with e.g. the value of | ||||
| 3035 | that level's DEFINE. Example: | ||||
| 3036 | |||||
| 3037 | # Level 0 has DEFINE = -Dfunky | ||||
| 3038 | # This code will define level 0's PASTHRU=PASTHRU_DEFINE="$(DEFINE) | ||||
| 3039 | # $(PASTHRU_DEFINE)" | ||||
| 3040 | # Level 0's $(CCCMD) will include macros $(DEFINE) and $(PASTHRU_DEFINE) | ||||
| 3041 | # So will level 1's, so when level 1 compiles, it will get right values | ||||
| 3042 | # And so ad infinitum | ||||
| 3043 | |||||
| 3044 | =cut | ||||
| 3045 | |||||
| 3046 | sub pasthru { | ||||
| 3047 | my($self) = shift; | ||||
| 3048 | my(@m); | ||||
| 3049 | |||||
| 3050 | my(@pasthru); | ||||
| 3051 | my($sep) = $Is{VMS} ? ',' : ''; | ||||
| 3052 | $sep .= "\\\n\t"; | ||||
| 3053 | |||||
| 3054 | foreach my $key (qw(LIB LIBPERL_A LINKTYPE OPTIMIZE LD | ||||
| 3055 | PREFIX INSTALL_BASE) | ||||
| 3056 | ) | ||||
| 3057 | { | ||||
| 3058 | next unless defined $self->{$key}; | ||||
| 3059 | push @pasthru, "$key=\"\$($key)\""; | ||||
| 3060 | } | ||||
| 3061 | |||||
| 3062 | foreach my $key (qw(DEFINE INC)) { | ||||
| 3063 | # default to the make var | ||||
| 3064 | my $val = qq{\$($key)}; | ||||
| 3065 | # expand within perl if given since need to use quote_literal | ||||
| 3066 | # since INC might include space-protecting ""! | ||||
| 3067 | chomp($val = $self->{$key}) if defined $self->{$key}; | ||||
| 3068 | $val .= " \$(PASTHRU_$key)"; | ||||
| 3069 | my $quoted = $self->quote_literal($val); | ||||
| 3070 | push @pasthru, qq{PASTHRU_$key=$quoted}; | ||||
| 3071 | } | ||||
| 3072 | |||||
| 3073 | push @m, "\nPASTHRU = ", join ($sep, @pasthru), "\n"; | ||||
| 3074 | join "", @m; | ||||
| 3075 | } | ||||
| 3076 | |||||
| 3077 | =item perl_script | ||||
| 3078 | |||||
| 3079 | Takes one argument, a file name, and returns the file name, if the | ||||
| 3080 | argument is likely to be a perl script. On MM_Unix this is true for | ||||
| 3081 | any ordinary, readable file. | ||||
| 3082 | |||||
| 3083 | =cut | ||||
| 3084 | |||||
| 3085 | sub perl_script { | ||||
| 3086 | my($self,$file) = @_; | ||||
| 3087 | return $file if -r $file && -f _; | ||||
| 3088 | return; | ||||
| 3089 | } | ||||
| 3090 | |||||
| 3091 | =item perldepend (o) | ||||
| 3092 | |||||
| 3093 | Defines the dependency from all *.h files that come with the perl | ||||
| 3094 | distribution. | ||||
| 3095 | |||||
| 3096 | =cut | ||||
| 3097 | |||||
| 3098 | sub perldepend { | ||||
| 3099 | my($self) = shift; | ||||
| 3100 | my(@m); | ||||
| 3101 | |||||
| 3102 | my $make_config = $self->cd('$(PERL_SRC)', '$(MAKE) lib/Config.pm'); | ||||
| 3103 | |||||
| 3104 | push @m, sprintf <<'MAKE_FRAG', $make_config if $self->{PERL_SRC}; | ||||
| 3105 | # Check for unpropogated config.sh changes. Should never happen. | ||||
| 3106 | # We do NOT just update config.h because that is not sufficient. | ||||
| 3107 | # An out of date config.h is not fatal but complains loudly! | ||||
| 3108 | $(PERL_INCDEP)/config.h: $(PERL_SRC)/config.sh | ||||
| 3109 | -$(NOECHO) $(ECHO) "Warning: $(PERL_INC)/config.h out of date with $(PERL_SRC)/config.sh"; $(FALSE) | ||||
| 3110 | |||||
| 3111 | $(PERL_ARCHLIB)/Config.pm: $(PERL_SRC)/config.sh | ||||
| 3112 | $(NOECHO) $(ECHO) "Warning: $(PERL_ARCHLIB)/Config.pm may be out of date with $(PERL_SRC)/config.sh" | ||||
| 3113 | %s | ||||
| 3114 | MAKE_FRAG | ||||
| 3115 | |||||
| 3116 | return join "", @m unless $self->needs_linking; | ||||
| 3117 | |||||
| 3118 | if ($self->{OBJECT}) { | ||||
| 3119 | # Need to add an object file dependency on the perl headers. | ||||
| 3120 | # this is very important for XS modules in perl.git development. | ||||
| 3121 | push @m, $self->_perl_header_files_fragment("/"); # Directory separator between $(PERL_INC)/header.h | ||||
| 3122 | } | ||||
| 3123 | |||||
| 3124 | push @m, join(" ", sort values %{$self->{XS}})." : \$(XSUBPPDEPS)\n" if %{$self->{XS}}; | ||||
| 3125 | |||||
| 3126 | return join "\n", @m; | ||||
| 3127 | } | ||||
| 3128 | |||||
| 3129 | |||||
| 3130 | =item pm_to_blib | ||||
| 3131 | |||||
| 3132 | Defines target that copies all files in the hash PM to their | ||||
| 3133 | destination and autosplits them. See L<ExtUtils::Install/DESCRIPTION> | ||||
| 3134 | |||||
| 3135 | =cut | ||||
| 3136 | |||||
| 3137 | sub pm_to_blib { | ||||
| 3138 | my $self = shift; | ||||
| 3139 | my($autodir) = $self->catdir('$(INST_LIB)','auto'); | ||||
| 3140 | my $r = q{ | ||||
| 3141 | pm_to_blib : $(FIRST_MAKEFILE) $(TO_INST_PM) | ||||
| 3142 | }; | ||||
| 3143 | |||||
| 3144 | # VMS will swallow '' and PM_FILTER is often empty. So use q[] | ||||
| 3145 | my $pm_to_blib = $self->oneliner(<<CODE, ['-MExtUtils::Install']); | ||||
| 3146 | pm_to_blib({\@ARGV}, '$autodir', q[\$(PM_FILTER)], '\$(PERM_DIR)') | ||||
| 3147 | CODE | ||||
| 3148 | |||||
| 3149 | my @cmds = $self->split_command($pm_to_blib, | ||||
| 3150 | map { ($self->quote_literal($_) => $self->quote_literal($self->{PM}->{$_})) } sort keys %{$self->{PM}}); | ||||
| 3151 | |||||
| 3152 | $r .= join '', map { "\t\$(NOECHO) $_\n" } @cmds; | ||||
| 3153 | $r .= qq{\t\$(NOECHO) \$(TOUCH) pm_to_blib\n}; | ||||
| 3154 | |||||
| 3155 | return $r; | ||||
| 3156 | } | ||||
| 3157 | |||||
| 3158 | # transform dot-separated version string into comma-separated quadruple | ||||
| 3159 | # examples: '1.2.3.4.5' => '1,2,3,4' | ||||
| 3160 | # '1.2.3' => '1,2,3,0' | ||||
| 3161 | sub _ppd_version { | ||||
| 3162 | my ($self, $string) = @_; | ||||
| 3163 | return join ',', ((split /\./, $string), (0) x 4)[0..3]; | ||||
| 3164 | } | ||||
| 3165 | |||||
| 3166 | =item ppd | ||||
| 3167 | |||||
| 3168 | Defines target that creates a PPD (Perl Package Description) file | ||||
| 3169 | for a binary distribution. | ||||
| 3170 | |||||
| 3171 | =cut | ||||
| 3172 | |||||
| 3173 | sub ppd { | ||||
| 3174 | my($self) = @_; | ||||
| 3175 | |||||
| 3176 | my $abstract = $self->{ABSTRACT} || ''; | ||||
| 3177 | $abstract =~ s/\n/\\n/sg; | ||||
| 3178 | $abstract =~ s/</</g; | ||||
| 3179 | $abstract =~ s/>/>/g; | ||||
| 3180 | |||||
| 3181 | my $author = join(', ',@{ ref $self->{AUTHOR} eq 'ARRAY' ? $self->{AUTHOR} : [ $self->{AUTHOR} || '']}); | ||||
| 3182 | $author =~ s/</</g; | ||||
| 3183 | $author =~ s/>/>/g; | ||||
| 3184 | |||||
| 3185 | my $ppd_file = "$self->{DISTNAME}.ppd"; | ||||
| 3186 | |||||
| 3187 | my @ppd_chunks = qq(<SOFTPKG NAME="$self->{DISTNAME}" VERSION="$self->{VERSION}">\n); | ||||
| 3188 | |||||
| 3189 | push @ppd_chunks, sprintf <<'PPD_HTML', $abstract, $author; | ||||
| 3190 | <ABSTRACT>%s</ABSTRACT> | ||||
| 3191 | <AUTHOR>%s</AUTHOR> | ||||
| 3192 | PPD_HTML | ||||
| 3193 | |||||
| 3194 | push @ppd_chunks, " <IMPLEMENTATION>\n"; | ||||
| 3195 | if ( $self->{MIN_PERL_VERSION} ) { | ||||
| 3196 | my $min_perl_version = $self->_ppd_version($self->{MIN_PERL_VERSION}); | ||||
| 3197 | push @ppd_chunks, sprintf <<'PPD_PERLVERS', $min_perl_version; | ||||
| 3198 | <PERLCORE VERSION="%s" /> | ||||
| 3199 | PPD_PERLVERS | ||||
| 3200 | |||||
| 3201 | } | ||||
| 3202 | |||||
| 3203 | # Don't add "perl" to requires. perl dependencies are | ||||
| 3204 | # handles by ARCHITECTURE. | ||||
| 3205 | my %prereqs = %{$self->{PREREQ_PM}}; | ||||
| 3206 | delete $prereqs{perl}; | ||||
| 3207 | |||||
| 3208 | # Build up REQUIRE | ||||
| 3209 | foreach my $prereq (sort keys %prereqs) { | ||||
| 3210 | my $name = $prereq; | ||||
| 3211 | $name .= '::' unless $name =~ /::/; | ||||
| 3212 | my $version = $prereqs{$prereq}; | ||||
| 3213 | |||||
| 3214 | my %attrs = ( NAME => $name ); | ||||
| 3215 | $attrs{VERSION} = $version if $version; | ||||
| 3216 | my $attrs = join " ", map { qq[$_="$attrs{$_}"] } sort keys %attrs; | ||||
| 3217 | push @ppd_chunks, qq( <REQUIRE $attrs />\n); | ||||
| 3218 | } | ||||
| 3219 | |||||
| 3220 | my $archname = $Config{archname}; | ||||
| 3221 | |||||
| 3222 | # archname did not change from 5.6 to 5.8, but those versions may | ||||
| 3223 | # not be not binary compatible so now we append the part of the | ||||
| 3224 | # version that changes when binary compatibility may change | ||||
| 3225 | if ("$]" >= 5.008) { | ||||
| 3226 | $archname .= "-$Config{api_revision}.$Config{api_version}"; | ||||
| 3227 | } | ||||
| 3228 | push @ppd_chunks, sprintf <<'PPD_OUT', $archname; | ||||
| 3229 | <ARCHITECTURE NAME="%s" /> | ||||
| 3230 | PPD_OUT | ||||
| 3231 | |||||
| 3232 | if ($self->{PPM_INSTALL_SCRIPT}) { | ||||
| 3233 | if ($self->{PPM_INSTALL_EXEC}) { | ||||
| 3234 | push @ppd_chunks, sprintf qq{ <INSTALL EXEC="%s">%s</INSTALL>\n}, | ||||
| 3235 | $self->{PPM_INSTALL_EXEC}, $self->{PPM_INSTALL_SCRIPT}; | ||||
| 3236 | } | ||||
| 3237 | else { | ||||
| 3238 | push @ppd_chunks, sprintf qq{ <INSTALL>%s</INSTALL>\n}, | ||||
| 3239 | $self->{PPM_INSTALL_SCRIPT}; | ||||
| 3240 | } | ||||
| 3241 | } | ||||
| 3242 | |||||
| 3243 | if ($self->{PPM_UNINSTALL_SCRIPT}) { | ||||
| 3244 | if ($self->{PPM_UNINSTALL_EXEC}) { | ||||
| 3245 | push @ppd_chunks, sprintf qq{ <UNINSTALL EXEC="%s">%s</UNINSTALL>\n}, | ||||
| 3246 | $self->{PPM_UNINSTALL_EXEC}, $self->{PPM_UNINSTALL_SCRIPT}; | ||||
| 3247 | } | ||||
| 3248 | else { | ||||
| 3249 | push @ppd_chunks, sprintf qq{ <UNINSTALL>%s</UNINSTALL>\n}, | ||||
| 3250 | $self->{PPM_UNINSTALL_SCRIPT}; | ||||
| 3251 | } | ||||
| 3252 | } | ||||
| 3253 | |||||
| 3254 | my ($bin_location) = $self->{BINARY_LOCATION} || ''; | ||||
| 3255 | $bin_location =~ s/\\/\\\\/g; | ||||
| 3256 | |||||
| 3257 | push @ppd_chunks, sprintf <<'PPD_XML', $bin_location; | ||||
| 3258 | <CODEBASE HREF="%s" /> | ||||
| 3259 | </IMPLEMENTATION> | ||||
| 3260 | </SOFTPKG> | ||||
| 3261 | PPD_XML | ||||
| 3262 | |||||
| 3263 | my @ppd_cmds = $self->stashmeta(join('', @ppd_chunks), $ppd_file); | ||||
| 3264 | |||||
| 3265 | return sprintf <<'PPD_OUT', join "\n\t", @ppd_cmds; | ||||
| 3266 | # Creates a PPD (Perl Package Description) for a binary distribution. | ||||
| 3267 | ppd : | ||||
| 3268 | %s | ||||
| 3269 | PPD_OUT | ||||
| 3270 | |||||
| 3271 | } | ||||
| 3272 | |||||
| 3273 | =item prefixify | ||||
| 3274 | |||||
| 3275 | $MM->prefixify($var, $prefix, $new_prefix, $default); | ||||
| 3276 | |||||
| 3277 | Using either $MM->{uc $var} || $Config{lc $var}, it will attempt to | ||||
| 3278 | replace it's $prefix with a $new_prefix. | ||||
| 3279 | |||||
| 3280 | Should the $prefix fail to match I<AND> a PREFIX was given as an | ||||
| 3281 | argument to WriteMakefile() it will set it to the $new_prefix + | ||||
| 3282 | $default. This is for systems whose file layouts don't neatly fit into | ||||
| 3283 | our ideas of prefixes. | ||||
| 3284 | |||||
| 3285 | This is for heuristics which attempt to create directory structures | ||||
| 3286 | that mirror those of the installed perl. | ||||
| 3287 | |||||
| 3288 | For example: | ||||
| 3289 | |||||
| 3290 | $MM->prefixify('installman1dir', '/usr', '/home/foo', 'man/man1'); | ||||
| 3291 | |||||
| 3292 | this will attempt to remove '/usr' from the front of the | ||||
| 3293 | $MM->{INSTALLMAN1DIR} path (initializing it to $Config{installman1dir} | ||||
| 3294 | if necessary) and replace it with '/home/foo'. If this fails it will | ||||
| 3295 | simply use '/home/foo/man/man1'. | ||||
| 3296 | |||||
| 3297 | =cut | ||||
| 3298 | |||||
| 3299 | sub prefixify { | ||||
| 3300 | my($self,$var,$sprefix,$rprefix,$default) = @_; | ||||
| 3301 | |||||
| 3302 | my $path = $self->{uc $var} || | ||||
| 3303 | $Config_Override{lc $var} || $Config{lc $var} || ''; | ||||
| 3304 | |||||
| 3305 | $rprefix .= '/' if $sprefix =~ m|/$|; | ||||
| 3306 | |||||
| 3307 | warn " prefixify $var => $path\n" if $Verbose >= 2; | ||||
| 3308 | warn " from $sprefix to $rprefix\n" if $Verbose >= 2; | ||||
| 3309 | |||||
| 3310 | if( $self->{ARGS}{PREFIX} && | ||||
| 3311 | $path !~ s{^\Q$sprefix\E\b}{$rprefix}s ) | ||||
| 3312 | { | ||||
| 3313 | |||||
| 3314 | warn " cannot prefix, using default.\n" if $Verbose >= 2; | ||||
| 3315 | warn " no default!\n" if !$default && $Verbose >= 2; | ||||
| 3316 | |||||
| 3317 | $path = $self->catdir($rprefix, $default) if $default; | ||||
| 3318 | } | ||||
| 3319 | |||||
| 3320 | print " now $path\n" if $Verbose >= 2; | ||||
| 3321 | return $self->{uc $var} = $path; | ||||
| 3322 | } | ||||
| 3323 | |||||
| 3324 | |||||
| 3325 | =item processPL (o) | ||||
| 3326 | |||||
| 3327 | Defines targets to run *.PL files. | ||||
| 3328 | |||||
| 3329 | =cut | ||||
| 3330 | |||||
| 3331 | sub processPL { | ||||
| 3332 | my $self = shift; | ||||
| 3333 | my $pl_files = $self->{PL_FILES}; | ||||
| 3334 | |||||
| 3335 | return "" unless $pl_files; | ||||
| 3336 | |||||
| 3337 | my $m = ''; | ||||
| 3338 | foreach my $plfile (sort keys %$pl_files) { | ||||
| 3339 | my $targets = $pl_files->{$plfile}; | ||||
| 3340 | my $list = | ||||
| 3341 | ref($targets) eq 'HASH' ? [ sort keys %$targets ] : | ||||
| 3342 | ref($targets) eq 'ARRAY' ? $pl_files->{$plfile} : | ||||
| 3343 | [$pl_files->{$plfile}]; | ||||
| 3344 | |||||
| 3345 | foreach my $target (@$list) { | ||||
| 3346 | if( $Is{VMS} ) { | ||||
| 3347 | $plfile = vmsify($self->eliminate_macros($plfile)); | ||||
| 3348 | $target = vmsify($self->eliminate_macros($target)); | ||||
| 3349 | } | ||||
| 3350 | |||||
| 3351 | # Normally a .PL file runs AFTER pm_to_blib so it can have | ||||
| 3352 | # blib in its @INC and load the just built modules. BUT if | ||||
| 3353 | # the generated module is something in $(TO_INST_PM) which | ||||
| 3354 | # pm_to_blib depends on then it can't depend on pm_to_blib | ||||
| 3355 | # else we have a dependency loop. | ||||
| 3356 | my $pm_dep; | ||||
| 3357 | my $perlrun; | ||||
| 3358 | if( defined $self->{PM}{$target} ) { | ||||
| 3359 | $pm_dep = ''; | ||||
| 3360 | $perlrun = 'PERLRUN'; | ||||
| 3361 | } | ||||
| 3362 | else { | ||||
| 3363 | $pm_dep = 'pm_to_blib'; | ||||
| 3364 | $perlrun = 'PERLRUNINST'; | ||||
| 3365 | } | ||||
| 3366 | |||||
| 3367 | my $extra_inputs = ''; | ||||
| 3368 | if( ref($targets) eq 'HASH' ) { | ||||
| 3369 | my $inputs = ref($targets->{$target}) | ||||
| 3370 | ? $targets->{$target} | ||||
| 3371 | : [$targets->{$target}]; | ||||
| 3372 | |||||
| 3373 | for my $input (@$inputs) { | ||||
| 3374 | if( $Is{VMS} ) { | ||||
| 3375 | $input = vmsify($self->eliminate_macros($input)); | ||||
| 3376 | } | ||||
| 3377 | $extra_inputs .= ' '.$input; | ||||
| 3378 | } | ||||
| 3379 | } | ||||
| 3380 | |||||
| 3381 | $m .= <<MAKE_FRAG; | ||||
| 3382 | |||||
| 3383 | pure_all :: $target | ||||
| 3384 | \$(NOECHO) \$(NOOP) | ||||
| 3385 | |||||
| 3386 | $target :: $plfile $pm_dep $extra_inputs | ||||
| 3387 | \$($perlrun) $plfile $target $extra_inputs | ||||
| 3388 | MAKE_FRAG | ||||
| 3389 | |||||
| 3390 | } | ||||
| 3391 | } | ||||
| 3392 | |||||
| 3393 | return $m; | ||||
| 3394 | } | ||||
| 3395 | |||||
| 3396 | =item specify_shell | ||||
| 3397 | |||||
| 3398 | Specify SHELL if needed - not done on Unix. | ||||
| 3399 | |||||
| 3400 | =cut | ||||
| 3401 | |||||
| 3402 | sub specify_shell { | ||||
| 3403 | return ''; | ||||
| 3404 | } | ||||
| 3405 | |||||
| 3406 | =item quote_paren | ||||
| 3407 | |||||
| 3408 | Backslashes parentheses C<()> in command line arguments. | ||||
| 3409 | Doesn't handle recursive Makefile C<$(...)> constructs, | ||||
| 3410 | but handles simple ones. | ||||
| 3411 | |||||
| 3412 | =cut | ||||
| 3413 | |||||
| 3414 | sub quote_paren { | ||||
| 3415 | my $arg = shift; | ||||
| 3416 | $arg =~ s{\$\((.+?)\)}{\$\\\\($1\\\\)}g; # protect $(...) | ||||
| 3417 | $arg =~ s{(?<!\\)([()])}{\\$1}g; # quote unprotected | ||||
| 3418 | $arg =~ s{\$\\\\\((.+?)\\\\\)}{\$($1)}g; # unprotect $(...) | ||||
| 3419 | return $arg; | ||||
| 3420 | } | ||||
| 3421 | |||||
| 3422 | =item replace_manpage_separator | ||||
| 3423 | |||||
| 3424 | my $man_name = $MM->replace_manpage_separator($file_path); | ||||
| 3425 | |||||
| 3426 | Takes the name of a package, which may be a nested package, in the | ||||
| 3427 | form 'Foo/Bar.pm' and replaces the slash with C<::> or something else | ||||
| 3428 | safe for a man page file name. Returns the replacement. | ||||
| 3429 | |||||
| 3430 | =cut | ||||
| 3431 | |||||
| 3432 | sub replace_manpage_separator { | ||||
| 3433 | my($self,$man) = @_; | ||||
| 3434 | |||||
| 3435 | $man =~ s,/+,::,g; | ||||
| 3436 | return $man; | ||||
| 3437 | } | ||||
| 3438 | |||||
| 3439 | |||||
| 3440 | =item cd | ||||
| 3441 | |||||
| 3442 | =cut | ||||
| 3443 | |||||
| 3444 | sub cd { | ||||
| 3445 | my($self, $dir, @cmds) = @_; | ||||
| 3446 | |||||
| 3447 | # No leading tab and no trailing newline makes for easier embedding | ||||
| 3448 | my $make_frag = join "\n\t", map { "cd $dir && $_" } @cmds; | ||||
| 3449 | |||||
| 3450 | return $make_frag; | ||||
| 3451 | } | ||||
| 3452 | |||||
| 3453 | =item oneliner | ||||
| 3454 | |||||
| 3455 | =cut | ||||
| 3456 | |||||
| 3457 | sub oneliner { | ||||
| 3458 | my($self, $cmd, $switches) = @_; | ||||
| 3459 | $switches = [] unless defined $switches; | ||||
| 3460 | |||||
| 3461 | # Strip leading and trailing newlines | ||||
| 3462 | $cmd =~ s{^\n+}{}; | ||||
| 3463 | $cmd =~ s{\n+$}{}; | ||||
| 3464 | |||||
| 3465 | my @cmds = split /\n/, $cmd; | ||||
| 3466 | $cmd = join " \n\t -e ", map $self->quote_literal($_), @cmds; | ||||
| 3467 | $cmd = $self->escape_newlines($cmd); | ||||
| 3468 | |||||
| 3469 | $switches = join ' ', @$switches; | ||||
| 3470 | |||||
| 3471 | return qq{\$(ABSPERLRUN) $switches -e $cmd --}; | ||||
| 3472 | } | ||||
| 3473 | |||||
| 3474 | |||||
| 3475 | =item quote_literal | ||||
| 3476 | |||||
| 3477 | Quotes macro literal value suitable for being used on a command line so | ||||
| 3478 | that when expanded by make, will be received by command as given to | ||||
| 3479 | this method: | ||||
| 3480 | |||||
| 3481 | my $quoted = $mm->quote_literal(q{it isn't}); | ||||
| 3482 | # returns: | ||||
| 3483 | # 'it isn'\''t' | ||||
| 3484 | print MAKEFILE "target:\n\techo $quoted\n"; | ||||
| 3485 | # when run "make target", will output: | ||||
| 3486 | # it isn't | ||||
| 3487 | |||||
| 3488 | =cut | ||||
| 3489 | |||||
| 3490 | sub quote_literal { | ||||
| 3491 | my($self, $text, $opts) = @_; | ||||
| 3492 | $opts->{allow_variables} = 1 unless defined $opts->{allow_variables}; | ||||
| 3493 | |||||
| 3494 | # Quote single quotes | ||||
| 3495 | $text =~ s{'}{'\\''}g; | ||||
| 3496 | |||||
| 3497 | $text = $opts->{allow_variables} | ||||
| 3498 | ? $self->escape_dollarsigns($text) : $self->escape_all_dollarsigns($text); | ||||
| 3499 | |||||
| 3500 | return "'$text'"; | ||||
| 3501 | } | ||||
| 3502 | |||||
| 3503 | |||||
| 3504 | =item escape_newlines | ||||
| 3505 | |||||
| 3506 | =cut | ||||
| 3507 | |||||
| 3508 | sub escape_newlines { | ||||
| 3509 | my($self, $text) = @_; | ||||
| 3510 | |||||
| 3511 | $text =~ s{\n}{\\\n}g; | ||||
| 3512 | |||||
| 3513 | return $text; | ||||
| 3514 | } | ||||
| 3515 | |||||
| 3516 | |||||
| 3517 | =item max_exec_len | ||||
| 3518 | |||||
| 3519 | Using L<POSIX>::ARG_MAX. Otherwise falling back to 4096. | ||||
| 3520 | |||||
| 3521 | =cut | ||||
| 3522 | |||||
| 3523 | sub max_exec_len { | ||||
| 3524 | my $self = shift; | ||||
| 3525 | |||||
| 3526 | if (!defined $self->{_MAX_EXEC_LEN}) { | ||||
| 3527 | if (my $arg_max = eval { require POSIX; &POSIX::ARG_MAX }) { | ||||
| 3528 | $self->{_MAX_EXEC_LEN} = $arg_max; | ||||
| 3529 | } | ||||
| 3530 | else { # POSIX minimum exec size | ||||
| 3531 | $self->{_MAX_EXEC_LEN} = 4096; | ||||
| 3532 | } | ||||
| 3533 | } | ||||
| 3534 | |||||
| 3535 | return $self->{_MAX_EXEC_LEN}; | ||||
| 3536 | } | ||||
| 3537 | |||||
| 3538 | |||||
| 3539 | =item static (o) | ||||
| 3540 | |||||
| 3541 | Defines the static target. | ||||
| 3542 | |||||
| 3543 | =cut | ||||
| 3544 | |||||
| 3545 | sub static { | ||||
| 3546 | # --- Static Loading Sections --- | ||||
| 3547 | |||||
| 3548 | my($self) = shift; | ||||
| 3549 | ' | ||||
| 3550 | ## $(INST_PM) has been moved to the all: target. | ||||
| 3551 | ## It remains here for awhile to allow for old usage: "make static" | ||||
| 3552 | static :: $(FIRST_MAKEFILE) $(INST_STATIC) | ||||
| 3553 | $(NOECHO) $(NOOP) | ||||
| 3554 | '; | ||||
| 3555 | } | ||||
| 3556 | |||||
| 3557 | sub static_lib { | ||||
| 3558 | my($self) = @_; | ||||
| 3559 | return '' unless $self->has_link_code; | ||||
| 3560 | my(@m); | ||||
| 3561 | my @libs; | ||||
| 3562 | if ($self->{XSMULTI}) { | ||||
| 3563 | for my $ext ($self->_xs_list_basenames) { | ||||
| 3564 | my ($v, $d, $f) = File::Spec->splitpath($ext); | ||||
| 3565 | my @d = File::Spec->splitdir($d); | ||||
| 3566 | shift @d if $d[0] eq 'lib'; | ||||
| 3567 | my $instdir = $self->catdir('$(INST_ARCHLIB)', 'auto', @d, $f); | ||||
| 3568 | my $instfile = $self->catfile($instdir, "$f\$(LIB_EXT)"); | ||||
| 3569 | my $objfile = "$ext\$(OBJ_EXT)"; | ||||
| 3570 | push @libs, [ $objfile, $instfile, $instdir ]; | ||||
| 3571 | } | ||||
| 3572 | } else { | ||||
| 3573 | @libs = ([ qw($(OBJECT) $(INST_STATIC) $(INST_ARCHAUTODIR)) ]); | ||||
| 3574 | } | ||||
| 3575 | push @m, map { $self->xs_make_static_lib(@$_); } @libs; | ||||
| 3576 | join "\n", @m; | ||||
| 3577 | } | ||||
| 3578 | |||||
| 3579 | =item xs_make_static_lib | ||||
| 3580 | |||||
| 3581 | Defines the recipes for the C<static_lib> section. | ||||
| 3582 | |||||
| 3583 | =cut | ||||
| 3584 | |||||
| 3585 | sub xs_make_static_lib { | ||||
| 3586 | my ($self, $from, $to, $todir) = @_; | ||||
| 3587 | my @m = sprintf '%s: %s $(MYEXTLIB) %s$(DFSEP).exists'."\n", $to, $from, $todir; | ||||
| 3588 | push @m, "\t\$(RM_F) \"\$\@\"\n"; | ||||
| 3589 | push @m, $self->static_lib_fixtures; | ||||
| 3590 | push @m, $self->static_lib_pure_cmd($from); | ||||
| 3591 | push @m, "\t\$(CHMOD) \$(PERM_RWX) \$\@\n"; | ||||
| 3592 | push @m, $self->static_lib_closures($todir); | ||||
| 3593 | join '', @m; | ||||
| 3594 | } | ||||
| 3595 | |||||
| 3596 | =item static_lib_closures | ||||
| 3597 | |||||
| 3598 | Records C<$(EXTRALIBS)> in F<extralibs.ld> and F<$(PERL_SRC)/ext.libs>. | ||||
| 3599 | |||||
| 3600 | =cut | ||||
| 3601 | |||||
| 3602 | sub static_lib_closures { | ||||
| 3603 | my ($self, $todir) = @_; | ||||
| 3604 | my @m = sprintf <<'MAKE_FRAG', $todir; | ||||
| 3605 | $(NOECHO) $(ECHO) "$(EXTRALIBS)" > %s$(DFSEP)extralibs.ld | ||||
| 3606 | MAKE_FRAG | ||||
| 3607 | # Old mechanism - still available: | ||||
| 3608 | push @m, <<'MAKE_FRAG' if $self->{PERL_SRC} && $self->{EXTRALIBS}; | ||||
| 3609 | $(NOECHO) $(ECHO) "$(EXTRALIBS)" >> $(PERL_SRC)$(DFSEP)ext.libs | ||||
| 3610 | MAKE_FRAG | ||||
| 3611 | @m; | ||||
| 3612 | } | ||||
| 3613 | |||||
| 3614 | =item static_lib_fixtures | ||||
| 3615 | |||||
| 3616 | Handles copying C<$(MYEXTLIB)> as starter for final static library that | ||||
| 3617 | then gets added to. | ||||
| 3618 | |||||
| 3619 | =cut | ||||
| 3620 | |||||
| 3621 | sub static_lib_fixtures { | ||||
| 3622 | my ($self) = @_; | ||||
| 3623 | # If this extension has its own library (eg SDBM_File) | ||||
| 3624 | # then copy that to $(INST_STATIC) and add $(OBJECT) into it. | ||||
| 3625 | return unless $self->{MYEXTLIB}; | ||||
| 3626 | "\t\$(CP) \$(MYEXTLIB) \"\$\@\"\n"; | ||||
| 3627 | } | ||||
| 3628 | |||||
| 3629 | =item static_lib_pure_cmd | ||||
| 3630 | |||||
| 3631 | Defines how to run the archive utility. | ||||
| 3632 | |||||
| 3633 | =cut | ||||
| 3634 | |||||
| 3635 | sub static_lib_pure_cmd { | ||||
| 3636 | my ($self, $from) = @_; | ||||
| 3637 | my $ar; | ||||
| 3638 | if (exists $self->{FULL_AR} && -x $self->{FULL_AR}) { | ||||
| 3639 | # Prefer the absolute pathed ar if available so that PATH | ||||
| 3640 | # doesn't confuse us. Perl itself is built with the full_ar. | ||||
| 3641 | $ar = 'FULL_AR'; | ||||
| 3642 | } else { | ||||
| 3643 | $ar = 'AR'; | ||||
| 3644 | } | ||||
| 3645 | sprintf <<'MAKE_FRAG', $ar, $from; | ||||
| 3646 | $(%s) $(AR_STATIC_ARGS) "$@" %s | ||||
| 3647 | $(RANLIB) "$@" | ||||
| 3648 | MAKE_FRAG | ||||
| 3649 | } | ||||
| 3650 | |||||
| 3651 | =item staticmake (o) | ||||
| 3652 | |||||
| 3653 | Calls makeaperl. | ||||
| 3654 | |||||
| 3655 | =cut | ||||
| 3656 | |||||
| 3657 | sub staticmake { | ||||
| 3658 | my($self, %attribs) = @_; | ||||
| 3659 | my(@static); | ||||
| 3660 | |||||
| 3661 | my(@searchdirs)=($self->{PERL_ARCHLIB}, $self->{SITEARCHEXP}, $self->{INST_ARCHLIB}); | ||||
| 3662 | |||||
| 3663 | # And as it's not yet built, we add the current extension | ||||
| 3664 | # but only if it has some C code (or XS code, which implies C code) | ||||
| 3665 | if (@{$self->{C}}) { | ||||
| 3666 | @static = $self->catfile($self->{INST_ARCHLIB}, | ||||
| 3667 | "auto", | ||||
| 3668 | $self->{FULLEXT}, | ||||
| 3669 | "$self->{BASEEXT}$self->{LIB_EXT}" | ||||
| 3670 | ); | ||||
| 3671 | } | ||||
| 3672 | |||||
| 3673 | # Either we determine now, which libraries we will produce in the | ||||
| 3674 | # subdirectories or we do it at runtime of the make. | ||||
| 3675 | |||||
| 3676 | # We could ask all subdir objects, but I cannot imagine, why it | ||||
| 3677 | # would be necessary. | ||||
| 3678 | |||||
| 3679 | # Instead we determine all libraries for the new perl at | ||||
| 3680 | # runtime. | ||||
| 3681 | my(@perlinc) = ($self->{INST_ARCHLIB}, $self->{INST_LIB}, $self->{PERL_ARCHLIB}, $self->{PERL_LIB}); | ||||
| 3682 | |||||
| 3683 | $self->makeaperl(MAKE => $self->{MAKEFILE}, | ||||
| 3684 | DIRS => \@searchdirs, | ||||
| 3685 | STAT => \@static, | ||||
| 3686 | INCL => \@perlinc, | ||||
| 3687 | TARGET => $self->{MAP_TARGET}, | ||||
| 3688 | TMP => "", | ||||
| 3689 | LIBPERL => $self->{LIBPERL_A} | ||||
| 3690 | ); | ||||
| 3691 | } | ||||
| 3692 | |||||
| 3693 | =item subdir_x (o) | ||||
| 3694 | |||||
| 3695 | Helper subroutine for subdirs | ||||
| 3696 | |||||
| 3697 | =cut | ||||
| 3698 | |||||
| 3699 | sub subdir_x { | ||||
| 3700 | my($self, $subdir) = @_; | ||||
| 3701 | |||||
| 3702 | my $subdir_cmd = $self->cd($subdir, | ||||
| 3703 | '$(MAKE) $(USEMAKEFILE) $(FIRST_MAKEFILE) all $(PASTHRU)' | ||||
| 3704 | ); | ||||
| 3705 | return sprintf <<'EOT', $subdir_cmd; | ||||
| 3706 | |||||
| 3707 | subdirs :: | ||||
| 3708 | $(NOECHO) %s | ||||
| 3709 | EOT | ||||
| 3710 | |||||
| 3711 | } | ||||
| 3712 | |||||
| 3713 | =item subdirs (o) | ||||
| 3714 | |||||
| 3715 | Defines targets to process subdirectories. | ||||
| 3716 | |||||
| 3717 | =cut | ||||
| 3718 | |||||
| 3719 | sub subdirs { | ||||
| 3720 | # --- Sub-directory Sections --- | ||||
| 3721 | my($self) = shift; | ||||
| 3722 | my(@m); | ||||
| 3723 | # This method provides a mechanism to automatically deal with | ||||
| 3724 | # subdirectories containing further Makefile.PL scripts. | ||||
| 3725 | # It calls the subdir_x() method for each subdirectory. | ||||
| 3726 | foreach my $dir (@{$self->{DIR}}){ | ||||
| 3727 | push @m, $self->subdir_x($dir); | ||||
| 3728 | #### print "Including $dir subdirectory\n"; | ||||
| 3729 | } | ||||
| 3730 | if (@m){ | ||||
| 3731 | unshift @m, <<'EOF'; | ||||
| 3732 | |||||
| 3733 | # The default clean, realclean and test targets in this Makefile | ||||
| 3734 | # have automatically been given entries for each subdir. | ||||
| 3735 | |||||
| 3736 | EOF | ||||
| 3737 | } else { | ||||
| 3738 | push(@m, "\n# none") | ||||
| 3739 | } | ||||
| 3740 | join('',@m); | ||||
| 3741 | } | ||||
| 3742 | |||||
| 3743 | =item test (o) | ||||
| 3744 | |||||
| 3745 | Defines the test targets. | ||||
| 3746 | |||||
| 3747 | =cut | ||||
| 3748 | |||||
| 3749 | sub test { | ||||
| 3750 | my($self, %attribs) = @_; | ||||
| 3751 | my $tests = $attribs{TESTS} || ''; | ||||
| 3752 | if (!$tests && -d 't' && defined $attribs{RECURSIVE_TEST_FILES}) { | ||||
| 3753 | $tests = $self->find_tests_recursive; | ||||
| 3754 | } | ||||
| 3755 | elsif (!$tests && -d 't') { | ||||
| 3756 | $tests = $self->find_tests; | ||||
| 3757 | } | ||||
| 3758 | # have to do this because nmake is broken | ||||
| 3759 | $tests =~ s!/!\\!g if $self->is_make_type('nmake'); | ||||
| 3760 | # note: 'test.pl' name is also hardcoded in init_dirscan() | ||||
| 3761 | my @m; | ||||
| 3762 | my $default_testtype = $Config{usedl} ? 'dynamic' : 'static'; | ||||
| 3763 | push @m, <<EOF; | ||||
| 3764 | TEST_VERBOSE=0 | ||||
| 3765 | TEST_TYPE=test_\$(LINKTYPE) | ||||
| 3766 | TEST_FILE = test.pl | ||||
| 3767 | TEST_FILES = $tests | ||||
| 3768 | TESTDB_SW = -d | ||||
| 3769 | |||||
| 3770 | testdb :: testdb_\$(LINKTYPE) | ||||
| 3771 | \$(NOECHO) \$(NOOP) | ||||
| 3772 | |||||
| 3773 | test :: \$(TEST_TYPE) | ||||
| 3774 | \$(NOECHO) \$(NOOP) | ||||
| 3775 | |||||
| 3776 | # Occasionally we may face this degenerate target: | ||||
| 3777 | test_ : test_$default_testtype | ||||
| 3778 | \$(NOECHO) \$(NOOP) | ||||
| 3779 | |||||
| 3780 | EOF | ||||
| 3781 | |||||
| 3782 | for my $linktype (qw(dynamic static)) { | ||||
| 3783 | my $directdeps = join ' ', grep !$self->{SKIPHASH}{$_}, $linktype, "pure_all"; # no depend on a linktype if SKIPped | ||||
| 3784 | push @m, "subdirs-test_$linktype :: $directdeps\n"; | ||||
| 3785 | foreach my $dir (@{ $self->{DIR} }) { | ||||
| 3786 | my $test = $self->cd($dir, "\$(MAKE) test_$linktype \$(PASTHRU)"); | ||||
| 3787 | push @m, "\t\$(NOECHO) $test\n"; | ||||
| 3788 | } | ||||
| 3789 | push @m, "\n"; | ||||
| 3790 | if ($tests or -f "test.pl") { | ||||
| 3791 | for my $testspec ([ '', '' ], [ 'db', ' $(TESTDB_SW)' ]) { | ||||
| 3792 | my ($db, $switch) = @$testspec; | ||||
| 3793 | my ($command, $deps); | ||||
| 3794 | # if testdb, build all but don't test all | ||||
| 3795 | $deps = $db eq 'db' ? $directdeps : "subdirs-test_$linktype"; | ||||
| 3796 | if ($linktype eq 'static' and $self->needs_linking) { | ||||
| 3797 | my $target = File::Spec->rel2abs('$(MAP_TARGET)'); | ||||
| 3798 | $command = qq{"$target" \$(MAP_PERLINC)}; | ||||
| 3799 | $deps .= ' $(MAP_TARGET)'; | ||||
| 3800 | } else { | ||||
| 3801 | $command = '$(FULLPERLRUN)' . $switch; | ||||
| 3802 | } | ||||
| 3803 | push @m, "test${db}_$linktype :: $deps\n"; | ||||
| 3804 | if ($db eq 'db') { | ||||
| 3805 | push @m, $self->test_via_script($command, '$(TEST_FILE)') | ||||
| 3806 | } else { | ||||
| 3807 | push @m, $self->test_via_script($command, '$(TEST_FILE)') | ||||
| 3808 | if -f "test.pl"; | ||||
| 3809 | push @m, $self->test_via_harness($command, '$(TEST_FILES)') | ||||
| 3810 | if $tests; | ||||
| 3811 | } | ||||
| 3812 | push @m, "\n"; | ||||
| 3813 | } | ||||
| 3814 | } else { | ||||
| 3815 | push @m, _sprintf562 <<'EOF', $linktype; | ||||
| 3816 | testdb_%1$s test_%1$s :: subdirs-test_%1$s | ||||
| 3817 | $(NOECHO) $(ECHO) 'No tests defined for $(NAME) extension.' | ||||
| 3818 | |||||
| 3819 | EOF | ||||
| 3820 | } | ||||
| 3821 | } | ||||
| 3822 | |||||
| 3823 | join "", @m; | ||||
| 3824 | } | ||||
| 3825 | |||||
| 3826 | =item test_via_harness (override) | ||||
| 3827 | |||||
| 3828 | For some reason which I forget, Unix machines like to have | ||||
| 3829 | PERL_DL_NONLAZY set for tests. | ||||
| 3830 | |||||
| 3831 | =cut | ||||
| 3832 | |||||
| 3833 | sub test_via_harness { | ||||
| 3834 | my($self, $perl, $tests) = @_; | ||||
| 3835 | return $self->SUPER::test_via_harness("PERL_DL_NONLAZY=1 $perl", $tests); | ||||
| 3836 | } | ||||
| 3837 | |||||
| 3838 | =item test_via_script (override) | ||||
| 3839 | |||||
| 3840 | Again, the PERL_DL_NONLAZY thing. | ||||
| 3841 | |||||
| 3842 | =cut | ||||
| 3843 | |||||
| 3844 | sub test_via_script { | ||||
| 3845 | my($self, $perl, $script) = @_; | ||||
| 3846 | return $self->SUPER::test_via_script("PERL_DL_NONLAZY=1 $perl", $script); | ||||
| 3847 | } | ||||
| 3848 | |||||
| 3849 | |||||
| 3850 | =item tool_xsubpp (o) | ||||
| 3851 | |||||
| 3852 | Determines typemaps, xsubpp version, prototype behaviour. | ||||
| 3853 | |||||
| 3854 | =cut | ||||
| 3855 | |||||
| 3856 | sub tool_xsubpp { | ||||
| 3857 | my($self) = shift; | ||||
| 3858 | return "" unless $self->needs_linking; | ||||
| 3859 | |||||
| 3860 | my $xsdir; | ||||
| 3861 | my @xsubpp_dirs = @INC; | ||||
| 3862 | |||||
| 3863 | # Make sure we pick up the new xsubpp if we're building perl. | ||||
| 3864 | unshift @xsubpp_dirs, $self->{PERL_LIB} if $self->{PERL_CORE}; | ||||
| 3865 | |||||
| 3866 | my $foundxsubpp = 0; | ||||
| 3867 | foreach my $dir (@xsubpp_dirs) { | ||||
| 3868 | $xsdir = $self->catdir($dir, 'ExtUtils'); | ||||
| 3869 | if( -r $self->catfile($xsdir, "xsubpp") ) { | ||||
| 3870 | $foundxsubpp = 1; | ||||
| 3871 | last; | ||||
| 3872 | } | ||||
| 3873 | } | ||||
| 3874 | die "ExtUtils::MM_Unix::tool_xsubpp : Can't find xsubpp" if !$foundxsubpp; | ||||
| 3875 | |||||
| 3876 | my $tmdir = $self->catdir($self->{PERL_LIB},"ExtUtils"); | ||||
| 3877 | my(@tmdeps) = $self->catfile($tmdir,'typemap'); | ||||
| 3878 | if( $self->{TYPEMAPS} ){ | ||||
| 3879 | foreach my $typemap (@{$self->{TYPEMAPS}}){ | ||||
| 3880 | if( ! -f $typemap ) { | ||||
| 3881 | warn "Typemap $typemap not found.\n"; | ||||
| 3882 | } | ||||
| 3883 | else { | ||||
| 3884 | $typemap = vmsify($typemap) if $Is{VMS}; | ||||
| 3885 | push(@tmdeps, $typemap); | ||||
| 3886 | } | ||||
| 3887 | } | ||||
| 3888 | } | ||||
| 3889 | push(@tmdeps, "typemap") if -f "typemap"; | ||||
| 3890 | # absolutised because with deep-located typemaps, eg "lib/XS/typemap", | ||||
| 3891 | # if xsubpp is called from top level with | ||||
| 3892 | # $(XSUBPP) ... -typemap "lib/XS/typemap" "lib/XS/Test.xs" | ||||
| 3893 | # it says: | ||||
| 3894 | # Can't find lib/XS/type map in (fulldir)/lib/XS | ||||
| 3895 | # because ExtUtils::ParseXS::process_file chdir's to .xs file's | ||||
| 3896 | # location. This is the only way to get all specified typemaps used, | ||||
| 3897 | # wherever located. | ||||
| 3898 | my @tmargs = map { '-typemap '.$self->quote_literal(File::Spec->rel2abs($_)) } @tmdeps; | ||||
| 3899 | $_ = $self->quote_dep($_) for @tmdeps; | ||||
| 3900 | if( exists $self->{XSOPT} ){ | ||||
| 3901 | unshift( @tmargs, $self->{XSOPT} ); | ||||
| 3902 | } | ||||
| 3903 | |||||
| 3904 | if ($Is{VMS} && | ||||
| 3905 | $Config{'ldflags'} && | ||||
| 3906 | $Config{'ldflags'} =~ m!/Debug!i && | ||||
| 3907 | (!exists($self->{XSOPT}) || $self->{XSOPT} !~ /linenumbers/) | ||||
| 3908 | ) | ||||
| 3909 | { | ||||
| 3910 | unshift(@tmargs,'-nolinenumbers'); | ||||
| 3911 | } | ||||
| 3912 | |||||
| 3913 | |||||
| 3914 | $self->{XSPROTOARG} = "" unless defined $self->{XSPROTOARG}; | ||||
| 3915 | my $xsdirdep = $self->quote_dep($xsdir); | ||||
| 3916 | # -dep for use when dependency not command | ||||
| 3917 | |||||
| 3918 | return qq{ | ||||
| 3919 | XSUBPPDIR = $xsdir | ||||
| 3920 | XSUBPP = "\$(XSUBPPDIR)\$(DFSEP)xsubpp" | ||||
| 3921 | XSUBPPRUN = \$(PERLRUN) \$(XSUBPP) | ||||
| 3922 | XSPROTOARG = $self->{XSPROTOARG} | ||||
| 3923 | XSUBPPDEPS = @tmdeps $xsdirdep\$(DFSEP)xsubpp | ||||
| 3924 | XSUBPPARGS = @tmargs | ||||
| 3925 | XSUBPP_EXTRA_ARGS = | ||||
| 3926 | }; | ||||
| 3927 | } | ||||
| 3928 | |||||
| 3929 | |||||
| 3930 | =item all_target | ||||
| 3931 | |||||
| 3932 | Build man pages, too | ||||
| 3933 | |||||
| 3934 | =cut | ||||
| 3935 | |||||
| 3936 | sub all_target { | ||||
| 3937 | my $self = shift; | ||||
| 3938 | |||||
| 3939 | return <<'MAKE_EXT'; | ||||
| 3940 | all :: pure_all manifypods | ||||
| 3941 | $(NOECHO) $(NOOP) | ||||
| 3942 | MAKE_EXT | ||||
| 3943 | } | ||||
| 3944 | |||||
| 3945 | =item top_targets (o) | ||||
| 3946 | |||||
| 3947 | Defines the targets all, subdirs, config, and O_FILES | ||||
| 3948 | |||||
| 3949 | =cut | ||||
| 3950 | |||||
| 3951 | sub top_targets { | ||||
| 3952 | # --- Target Sections --- | ||||
| 3953 | |||||
| 3954 | my($self) = shift; | ||||
| 3955 | my(@m); | ||||
| 3956 | |||||
| 3957 | push @m, $self->all_target, "\n" unless $self->{SKIPHASH}{'all'}; | ||||
| 3958 | |||||
| 3959 | push @m, sprintf <<'EOF'; | ||||
| 3960 | pure_all :: config pm_to_blib subdirs linkext | ||||
| 3961 | $(NOECHO) $(NOOP) | ||||
| 3962 | |||||
| 3963 | subdirs :: $(MYEXTLIB) | ||||
| 3964 | $(NOECHO) $(NOOP) | ||||
| 3965 | |||||
| 3966 | config :: $(FIRST_MAKEFILE) blibdirs | ||||
| 3967 | $(NOECHO) $(NOOP) | ||||
| 3968 | EOF | ||||
| 3969 | |||||
| 3970 | push @m, ' | ||||
| 3971 | $(O_FILES) : $(H_FILES) | ||||
| 3972 | ' if @{$self->{O_FILES} || []} && @{$self->{H} || []}; | ||||
| 3973 | |||||
| 3974 | push @m, q{ | ||||
| 3975 | help : | ||||
| 3976 | perldoc ExtUtils::MakeMaker | ||||
| 3977 | }; | ||||
| 3978 | |||||
| 3979 | join('',@m); | ||||
| 3980 | } | ||||
| 3981 | |||||
| 3982 | =item writedoc | ||||
| 3983 | |||||
| 3984 | Obsolete, deprecated method. Not used since Version 5.21. | ||||
| 3985 | |||||
| 3986 | =cut | ||||
| 3987 | |||||
| 3988 | sub writedoc { | ||||
| 3989 | # --- perllocal.pod section --- | ||||
| 3990 | my($self,$what,$name,@attribs)=@_; | ||||
| 3991 | my $time = gmtime($ENV{SOURCE_DATE_EPOCH} || time); | ||||
| 3992 | print "=head2 $time: $what C<$name>\n\n=over 4\n\n=item *\n\n"; | ||||
| 3993 | print join "\n\n=item *\n\n", map("C<$_>",@attribs); | ||||
| 3994 | print "\n\n=back\n\n"; | ||||
| 3995 | } | ||||
| 3996 | |||||
| 3997 | =item xs_c (o) | ||||
| 3998 | |||||
| 3999 | Defines the suffix rules to compile XS files to C. | ||||
| 4000 | |||||
| 4001 | =cut | ||||
| 4002 | |||||
| 4003 | sub xs_c { | ||||
| 4004 | my($self) = shift; | ||||
| 4005 | return '' unless $self->needs_linking(); | ||||
| 4006 | ' | ||||
| 4007 | .xs.c: | ||||
| 4008 | $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $(XSUBPP_EXTRA_ARGS) $*.xs > $*.xsc | ||||
| 4009 | $(MV) $*.xsc $*.c | ||||
| 4010 | '; | ||||
| 4011 | } | ||||
| 4012 | |||||
| 4013 | =item xs_cpp (o) | ||||
| 4014 | |||||
| 4015 | Defines the suffix rules to compile XS files to C++. | ||||
| 4016 | |||||
| 4017 | =cut | ||||
| 4018 | |||||
| 4019 | sub xs_cpp { | ||||
| 4020 | my($self) = shift; | ||||
| 4021 | return '' unless $self->needs_linking(); | ||||
| 4022 | ' | ||||
| 4023 | .xs.cpp: | ||||
| 4024 | $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.xsc | ||||
| 4025 | $(MV) $*.xsc $*.cpp | ||||
| 4026 | '; | ||||
| 4027 | } | ||||
| 4028 | |||||
| 4029 | =item xs_o (o) | ||||
| 4030 | |||||
| 4031 | Defines suffix rules to go from XS to object files directly. This was | ||||
| 4032 | originally only intended for broken make implementations, but is now | ||||
| 4033 | necessary for per-XS file under C<XSMULTI>, since each XS file might | ||||
| 4034 | have an individual C<$(VERSION)>. | ||||
| 4035 | |||||
| 4036 | =cut | ||||
| 4037 | |||||
| 4038 | sub xs_o { | ||||
| 4039 | my ($self) = @_; | ||||
| 4040 | return '' unless $self->needs_linking(); | ||||
| 4041 | my $m_o = $self->{XSMULTI} ? $self->xs_obj_opt('$*$(OBJ_EXT)') : ''; | ||||
| 4042 | my $dbgout = $self->dbgoutflag; | ||||
| 4043 | $dbgout = $dbgout ? "$dbgout " : ''; | ||||
| 4044 | my $frag = ''; | ||||
| 4045 | # dmake makes noise about ambiguous rule | ||||
| 4046 | $frag .= sprintf <<'EOF', $dbgout, $m_o unless $self->is_make_type('dmake'); | ||||
| 4047 | .xs$(OBJ_EXT) : | ||||
| 4048 | $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.xsc | ||||
| 4049 | $(MV) $*.xsc $*.c | ||||
| 4050 | $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) %s$*.c %s | ||||
| 4051 | EOF | ||||
| 4052 | if ($self->{XSMULTI}) { | ||||
| 4053 | for my $ext ($self->_xs_list_basenames) { | ||||
| 4054 | my $pmfile = "$ext.pm"; | ||||
| 4055 | croak "$ext.xs has no matching $pmfile: $!" unless -f $pmfile; | ||||
| 4056 | my $version = $self->parse_version($pmfile); | ||||
| 4057 | my $cccmd = $self->{CONST_CCCMD}; | ||||
| 4058 | $cccmd =~ s/^\s*CCCMD\s*=\s*//; | ||||
| 4059 | $cccmd =~ s/\$\(DEFINE_VERSION\)/-DVERSION=\\"$version\\"/; | ||||
| 4060 | $cccmd =~ s/\$\(XS_DEFINE_VERSION\)/-DXS_VERSION=\\"$version\\"/; | ||||
| 4061 | $self->_xsbuild_replace_macro($cccmd, 'xs', $ext, 'INC'); | ||||
| 4062 | my $define = '$(DEFINE)'; | ||||
| 4063 | $self->_xsbuild_replace_macro($define, 'xs', $ext, 'DEFINE'); | ||||
| 4064 | # 1 2 3 4 5 | ||||
| 4065 | $frag .= _sprintf562 <<'EOF', $ext, $cccmd, $m_o, $define, $dbgout; | ||||
| 4066 | |||||
| 4067 | %1$s$(OBJ_EXT): %1$s.xs | ||||
| 4068 | $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.xsc | ||||
| 4069 | $(MV) $*.xsc $*.c | ||||
| 4070 | %2$s $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) %4$s %5$s$*.c %3$s | ||||
| 4071 | EOF | ||||
| 4072 | } | ||||
| 4073 | } | ||||
| 4074 | $frag =~ s/"-I(\$\(PERL_INC\))"/-iwithsysroot "$1"/sg if $Is{ApplCor}; | ||||
| 4075 | $frag; | ||||
| 4076 | } | ||||
| 4077 | |||||
| 4078 | # param gets modified | ||||
| 4079 | sub _xsbuild_replace_macro { | ||||
| 4080 | my ($self, undef, $xstype, $ext, $varname) = @_; | ||||
| 4081 | my $value = $self->_xsbuild_value($xstype, $ext, $varname); | ||||
| 4082 | return unless defined $value; | ||||
| 4083 | $_[1] =~ s/\$\($varname\)/$value/; | ||||
| 4084 | } | ||||
| 4085 | |||||
| 4086 | sub _xsbuild_value { | ||||
| 4087 | my ($self, $xstype, $ext, $varname) = @_; | ||||
| 4088 | return $self->{XSBUILD}{$xstype}{$ext}{$varname} | ||||
| 4089 | if $self->{XSBUILD}{$xstype}{$ext}{$varname}; | ||||
| 4090 | return $self->{XSBUILD}{$xstype}{all}{$varname} | ||||
| 4091 | if $self->{XSBUILD}{$xstype}{all}{$varname}; | ||||
| 4092 | (); | ||||
| 4093 | } | ||||
| 4094 | |||||
| 4095 | 1 | 5µs | 1; | ||
| 4096 | |||||
| 4097 | =back | ||||
| 4098 | |||||
| 4099 | =head1 SEE ALSO | ||||
| 4100 | |||||
| 4101 | L<ExtUtils::MakeMaker> | ||||
| 4102 | |||||
| 4103 | =cut | ||||
| 4104 | |||||
| 4105 | __END__ | ||||
# spent 6µs within ExtUtils::MM_Unix::CORE:ftdir which was called 2 times, avg 3µs/call:
# 2 times (6µs+0s) by ExtUtils::MM_Unix::maybe_command at line 2866, avg 3µs/call | |||||
# spent 55µs within ExtUtils::MM_Unix::CORE:fteexec which was called 27 times, avg 2µs/call:
# 27 times (55µs+0s) by ExtUtils::MM_Unix::maybe_command at line 2866, avg 2µs/call | |||||
sub ExtUtils::MM_Unix::CORE:match; # opcode |