Commit | Line | Data |
---|---|---|
1e44e2bf | 1 | package ExtUtils::MM_Unix; |
2 | ||
f4ae0f5e | 3 | # $Id: MM_Unix.pm,v 1.14 1996/02/29 07:59:10 k Exp $ |
4 | ||
5 | # Loading Time cumulated | |
6 | require Exporter; # 0.28 0.28 | |
7 | use Config; # 0.37 0.38 | |
8 | use File::Basename qw(basename dirname fileparse); # 0.47 0.48 | |
9 | use DirHandle; # 0.37 0.58 | |
10 | # use FileHandle (); # 1.28 !!!! 1.46 | |
11 | ||
12 | # And another benchmark. I have deleted MakeMaker completely from the perl installation | |
13 | # and deleted blib and pm_to_blib, the timestamp file. | |
14 | ||
15 | # MM_Unix with Selfloader: | |
16 | # perl Makefile.PL 4.34s user 0.57s system 84% cpu 5.844 total | |
17 | # make 14.77s user 3.16s system 78% cpu 22.698 total | |
18 | ||
19 | # MM_Unix with my own autoloader | |
20 | # perl Makefile.PL 3.82s user 0.55s system 73% cpu 5.920 total | |
21 | # make 14.70s user 3.27s system 82% cpu 21.714 total | |
22 | ||
23 | ||
1e44e2bf | 24 | |
25 | Exporter::import('ExtUtils::MakeMaker', | |
26 | qw( $Verbose &neatvalue)); | |
27 | ||
f4ae0f5e | 28 | $Is_OS2 = $^O eq 'os2'; |
29 | $Is_VMS = $^O eq 'VMS'; | |
1e44e2bf | 30 | |
31 | =head1 NAME | |
32 | ||
33 | ExtUtils::MM_Unix - methods used by ExtUtils::MakeMaker | |
34 | ||
35 | =head1 SYNOPSIS | |
36 | ||
37 | C<require ExtUtils::MM_Unix;> | |
38 | ||
39 | =head1 DESCRIPTION | |
40 | ||
41 | The methods provided by this package are designed to be used in | |
42 | conjunction with ExtUtils::MakeMaker. When MakeMaker writes a | |
43 | Makefile, it creates one or more objects that inherit their methods | |
44 | from a package C<MM>. MM itself doesn't provide any methods, but it | |
45 | ISA ExtUtils::MM_Unix class. The inheritance tree of MM lets operating | |
46 | specific packages take the responsibility for all the methods provided | |
47 | by MM_Unix. We are trying to reduce the number of the necessary | |
48 | overrides by defining rather primitive operations within | |
49 | ExtUtils::MM_Unix. | |
50 | ||
51 | If you are going to write a platform specific MM package, please try | |
52 | to limit the necessary overrides to primitiv methods, and if it is not | |
53 | possible to do so, let's work it out how to achieve that gain. | |
54 | ||
f4ae0f5e | 55 | If you are overriding any of these methods in your Makefile.PL (in the |
56 | MY class), please report that to the makemaker mailing list. We are | |
57 | trying to minimize the necessary method overrides and switch to data | |
58 | driven Makefile.PLs wherever possible. In the long run less methods | |
59 | will be overridable via the MY class. | |
60 | ||
1e44e2bf | 61 | =head1 METHODS |
62 | ||
63 | The following description of methods is still under | |
64 | development. Please refer to the code for not suitably documented | |
65 | sections and complain loudly to the makemaker mailing list. | |
66 | ||
f4ae0f5e | 67 | Not all of the methos below are overridable in a |
68 | Makefile.PL. Overridable methods are marked as (o). All methods are | |
69 | overridable by a platform specific MM_*.pm file (See | |
70 | L<ExtUtils::MM_VMS>) and L<ExtUtils::MM_OS2>). | |
71 | ||
1e44e2bf | 72 | =head2 Preloaded methods |
73 | ||
74 | =over 2 | |
75 | ||
76 | =item catdir | |
77 | ||
78 | Concatenate two or more directory names to form a complete path ending | |
79 | with a directory | |
80 | ||
81 | =cut | |
82 | ||
83 | # '; | |
84 | ||
85 | sub catdir { | |
86 | shift; | |
a5f75d66 | 87 | my $result = join('/',@_); |
f4ae0f5e | 88 | $result =~ s:/(\./)+:/:g; |
1e44e2bf | 89 | $result =~ s:/+:/:g; |
f4ae0f5e | 90 | $result =~ s:/$::; |
1e44e2bf | 91 | $result; |
92 | } | |
93 | ||
94 | =item catfile | |
95 | ||
96 | Concatenate two or more directory names and a filename to form a | |
97 | complete path ending with a filename | |
98 | ||
99 | =cut | |
100 | ||
101 | sub catfile { | |
102 | shift; | |
103 | my $result = join('/',@_); | |
f4ae0f5e | 104 | $result =~ s:/(\./)+:/:g; |
1e44e2bf | 105 | $result =~ s:/+:/:g; |
106 | $result; | |
107 | } | |
108 | ||
f4ae0f5e | 109 | sub ExtUtils::MM_Unix::guess_name ; |
110 | sub ExtUtils::MM_Unix::init_main ; | |
111 | sub ExtUtils::MM_Unix::init_dirscan ; | |
112 | sub ExtUtils::MM_Unix::init_others ; | |
113 | sub ExtUtils::MM_Unix::find_perl ; | |
114 | sub ExtUtils::MM_Unix::post_initialize ; | |
115 | sub ExtUtils::MM_Unix::const_config ; | |
116 | sub ExtUtils::MM_Unix::constants ; | |
117 | sub ExtUtils::MM_Unix::const_loadlibs ; | |
118 | sub ExtUtils::MM_Unix::const_cccmd ; | |
119 | sub ExtUtils::MM_Unix::tool_autosplit ; | |
120 | sub ExtUtils::MM_Unix::tool_xsubpp ; | |
121 | sub ExtUtils::MM_Unix::xsubpp_version ; | |
122 | sub ExtUtils::MM_Unix::tools_other ; | |
123 | sub ExtUtils::MM_Unix::dist ; | |
124 | sub ExtUtils::MM_Unix::macro ; | |
125 | sub ExtUtils::MM_Unix::depend ; | |
126 | sub ExtUtils::MM_Unix::post_constants ; | |
127 | sub ExtUtils::MM_Unix::pasthru ; | |
128 | sub ExtUtils::MM_Unix::c_o ; | |
129 | sub ExtUtils::MM_Unix::xs_c ; | |
130 | sub ExtUtils::MM_Unix::xs_o ; | |
131 | sub ExtUtils::MM_Unix::top_targets ; | |
132 | sub ExtUtils::MM_Unix::linkext ; | |
133 | sub ExtUtils::MM_Unix::dlsyms ; | |
134 | sub ExtUtils::MM_Unix::dynamic ; | |
135 | sub ExtUtils::MM_Unix::dynamic_bs ; | |
136 | sub ExtUtils::MM_Unix::dynamic_lib ; | |
137 | sub ExtUtils::MM_Unix::static ; | |
138 | sub ExtUtils::MM_Unix::static_lib ; | |
139 | #sub ExtUtils::MM_Unix::installpm ; | |
140 | #sub ExtUtils::MM_Unix::installpm_x ; | |
141 | sub ExtUtils::MM_Unix::pm_to_blib ; | |
142 | sub ExtUtils::MM_Unix::manifypods ; | |
143 | sub ExtUtils::MM_Unix::processPL ; | |
144 | sub ExtUtils::MM_Unix::installbin ; | |
145 | sub ExtUtils::MM_Unix::subdirs ; | |
146 | sub ExtUtils::MM_Unix::subdir_x ; | |
147 | sub ExtUtils::MM_Unix::clean ; | |
148 | sub ExtUtils::MM_Unix::realclean ; | |
149 | sub ExtUtils::MM_Unix::dist_basics ; | |
150 | sub ExtUtils::MM_Unix::dist_core ; | |
151 | sub ExtUtils::MM_Unix::dist_dir ; | |
152 | sub ExtUtils::MM_Unix::dist_test ; | |
153 | sub ExtUtils::MM_Unix::dist_ci ; | |
154 | sub ExtUtils::MM_Unix::install ; | |
155 | sub ExtUtils::MM_Unix::force ; | |
156 | sub ExtUtils::MM_Unix::perldepend ; | |
157 | sub ExtUtils::MM_Unix::makefile ; | |
158 | sub ExtUtils::MM_Unix::staticmake ; | |
159 | sub ExtUtils::MM_Unix::test ; | |
160 | sub ExtUtils::MM_Unix::test_via_harness ; | |
161 | sub ExtUtils::MM_Unix::test_via_script ; | |
162 | sub ExtUtils::MM_Unix::postamble ; | |
163 | sub ExtUtils::MM_Unix::makeaperl ; | |
164 | sub ExtUtils::MM_Unix::extliblist ; | |
165 | sub ExtUtils::MM_Unix::dir_target ; | |
166 | sub ExtUtils::MM_Unix::needs_linking ; | |
167 | sub ExtUtils::MM_Unix::has_link_code ; | |
168 | sub ExtUtils::MM_Unix::writedoc ; | |
169 | sub ExtUtils::MM_Unix::perl_script ; | |
170 | sub ExtUtils::MM_Unix::maybe_command ; | |
171 | sub ExtUtils::MM_Unix::maybe_command_in_dirs ; | |
172 | sub ExtUtils::MM_Unix::prefixify ; | |
173 | sub ExtUtils::MM_Unix::file_name_is_absolute ; | |
174 | sub ExtUtils::MM_Unix::replace_manpage_separator ; | |
175 | sub ExtUtils::MM_Unix::path ; | |
176 | sub ExtUtils::MM_Unix::lsdir ; | |
177 | sub ExtUtils::MM_Unix::exescan ; | |
178 | sub ExtUtils::MM_Unix::libscan ; | |
179 | sub ExtUtils::MM_Unix::nicetext ; | |
180 | ||
181 | package ExtUtils::MM_Unix; | |
182 | ||
183 | use SelfLoader; | |
184 | #sub AUTOLOAD { | |
185 | # my $code; | |
186 | # if (defined fileno(DATA)) { | |
187 | # while (<DATA>) { | |
188 | # last if /^__END__/; | |
189 | # $code .= $_; | |
190 | # } | |
191 | # close DATA; | |
192 | # eval $code; | |
193 | # if ($@) { | |
194 | # $@ =~ s/ at .*\n//; | |
195 | # Carp::croak $@; | |
196 | # } | |
197 | # } else { | |
198 | # warn "AUTOLOAD called unexpectedly for $AUTOLOAD"; | |
199 | # } | |
200 | # defined(&$AUTOLOAD) or die "Myloader inconsistency error"; | |
201 | # goto &$AUTOLOAD; | |
202 | #} | |
203 | ||
204 | ||
205 | ||
206 | 1; | |
207 | __DATA__ | |
208 | ||
209 | =head2 SelfLoaded methods | |
210 | ||
1e44e2bf | 211 | =item nicetext |
212 | ||
213 | misnamed method (will have to be changed). The MM_Unix method just | |
214 | returns the argument without further processing. | |
215 | ||
216 | On VMS used to insure that colons marking targets are preceded by | |
217 | space - most Unix Makes don't need this, but it's necessary under VMS | |
218 | to distinguish the target delimiter from a colon appearing as part of | |
f4ae0f5e | 219 | a filespec. |
1e44e2bf | 220 | |
221 | =cut | |
222 | ||
223 | sub nicetext { | |
224 | my($self,$text) = @_; | |
225 | unless (ref $self){ | |
226 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
227 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
228 | } | |
229 | $text; | |
230 | } | |
231 | ||
f4ae0f5e | 232 | =item libscan (o) |
1e44e2bf | 233 | |
234 | Takes a path to a file that is found by init_dirscan and returns false | |
235 | if we don't want to include this file in the library. Mainly used to | |
236 | exclude RCS, CVS, and SCCS directories from installation. | |
237 | ||
238 | =cut | |
239 | ||
240 | # '; | |
241 | ||
242 | sub libscan { | |
243 | my($self,$path) = @_; | |
244 | return '' if $path =~ m:/(RCS|CVS|SCCS)/: ; | |
245 | $path; | |
246 | } | |
247 | ||
248 | =item exescan | |
249 | ||
250 | Deprecated method. Use libscan instead. | |
251 | ||
252 | =cut | |
253 | ||
254 | sub exescan { | |
255 | my($self,$path) = @_; | |
256 | $path; | |
257 | } | |
258 | ||
259 | =item lsdir | |
260 | ||
261 | Takes as arguments a directory name and a regular expression. Returns | |
262 | all entries in the directory that match the regular expression. | |
263 | ||
264 | =cut | |
265 | ||
266 | sub lsdir { | |
267 | my($self) = shift; | |
268 | my($dir, $regex) = @_; | |
269 | my(@ls); | |
270 | my $dh = new DirHandle; | |
271 | $dh->open($dir || ".") or return (); | |
272 | @ls = $dh->read; | |
273 | $dh->close; | |
274 | @ls = grep(/$regex/, @ls) if $regex; | |
275 | @ls; | |
276 | } | |
277 | ||
278 | =item path | |
279 | ||
280 | Takes no argument, returns the environment variable PATH as an array. | |
281 | ||
282 | =cut | |
283 | ||
284 | sub path { | |
285 | my($self) = @_; | |
f4ae0f5e | 286 | my $path_sep = $Is_OS2 ? ";" : ":"; |
1e44e2bf | 287 | my $path = $ENV{PATH}; |
288 | $path =~ s:\\:/:g if $Is_OS2; | |
289 | my @path = split $path_sep, $path; | |
290 | } | |
291 | ||
292 | =item replace_manpage_separator | |
293 | ||
294 | Takes the name of a package, which may be a nested package, in the | |
295 | form Foo/Bar and replaces the slash with C<::>. Returns the replacement. | |
296 | ||
297 | =cut | |
298 | ||
299 | sub replace_manpage_separator { | |
300 | my($self,$man) = @_; | |
301 | $man =~ s,/+,::,g; | |
302 | $man; | |
303 | } | |
304 | ||
305 | =item file_name_is_absolute | |
306 | ||
307 | Takes as argument a path and returns true, it it is an absolute path. | |
308 | ||
309 | =cut | |
310 | ||
311 | sub file_name_is_absolute { | |
312 | my($self,$file) = @_; | |
313 | $file =~ m:^/: ; | |
314 | } | |
315 | ||
316 | =item prefixify | |
317 | ||
318 | Check a path variable in $self from %Config, if it contains a prefix, | |
f4ae0f5e | 319 | and replace it with another one. |
1e44e2bf | 320 | |
321 | Takes as arguments an attribute name, a search prefix and a | |
322 | replacement prefix. Changes the attribute in the object. | |
323 | ||
324 | =cut | |
325 | ||
326 | sub prefixify { | |
327 | my($self,$var,$sprefix,$rprefix) = @_; | |
328 | $self->{uc $var} ||= $Config{lc $var}; | |
329 | $self->{uc $var} = VMS::Filespec::unixpath($self->{uc $var}) if $Is_VMS; | |
330 | $self->{uc $var} =~ s/\Q$sprefix\E/$rprefix/; | |
331 | } | |
332 | ||
333 | =item maybe_command_in_dirs | |
334 | ||
335 | method under development. Not yet used. Ask Ilya :-) | |
336 | ||
337 | =cut | |
338 | ||
339 | sub maybe_command_in_dirs { # $ver is optional argument if looking for perl | |
340 | # Ilya's suggestion. Not yet used, want to understand it first, but at least the code is here | |
341 | my($self, $names, $dirs, $trace, $ver) = @_; | |
342 | my($name, $dir); | |
343 | foreach $dir (@$dirs){ | |
344 | next unless defined $dir; # $self->{PERL_SRC} may be undefined | |
345 | foreach $name (@$names){ | |
346 | my($abs,$tryabs); | |
347 | if ($self->file_name_is_absolute($name)) { | |
348 | $abs = $name; | |
349 | } elsif ($name =~ m|/|) { | |
350 | $abs = $self->catfile(".", $name); # not absolute | |
351 | } else { | |
352 | $abs = $self->catfile($dir, $name); | |
353 | } | |
354 | print "Checking $abs for $name\n" if ($trace >= 2); | |
355 | next unless $tryabs = $self->maybe_command($abs); | |
356 | print "Substituting $tryabs instead of $abs\n" | |
357 | if ($trace >= 2 and $tryabs ne $abs); | |
358 | $abs = $tryabs; | |
359 | if (defined $ver) { | |
360 | print "Executing $abs\n" if ($trace >= 2); | |
361 | if (`$abs -e 'require $ver; print "VER_OK\n" ' 2>&1` =~ /VER_OK/) { | |
362 | print "Using PERL=$abs\n" if $trace; | |
363 | return $abs; | |
364 | } | |
365 | } else { # Do not look for perl | |
366 | return $abs; | |
367 | } | |
368 | } | |
369 | } | |
370 | } | |
371 | ||
372 | =item maybe_command | |
373 | ||
374 | Returns true, if the argument is likely to be a command. | |
375 | ||
376 | =cut | |
377 | ||
378 | sub maybe_command { | |
379 | my($self,$file) = @_; | |
380 | return $file if -x $file && ! -d $file; | |
381 | return; | |
382 | } | |
383 | ||
384 | =item perl_script | |
385 | ||
f4ae0f5e | 386 | Returns true, if the argument is likely to be a perl script. On |
1e44e2bf | 387 | MM_Unix this is true for any ordinary, readable file. |
388 | ||
389 | =cut | |
390 | ||
391 | sub perl_script { | |
392 | my($self,$file) = @_; | |
393 | return 1 if -r $file && ! -d $file; | |
394 | return; | |
395 | } | |
396 | ||
1e44e2bf | 397 | =item guess_name |
398 | ||
399 | Guess the name of this package by examining the working directory's | |
400 | name. MakeMaker calls this only if the developer has not supplied a | |
401 | NAME attribute. | |
402 | ||
403 | =cut | |
404 | ||
405 | # '; | |
406 | ||
407 | sub guess_name { | |
408 | my($self) = @_; | |
f4ae0f5e | 409 | use Cwd 'cwd'; |
410 | my $name = cwd(); | |
1e44e2bf | 411 | $name =~ s:.*/:: unless ($name =~ s:^.*/ext/::); |
412 | $name =~ s#/#::#g; | |
413 | $name =~ s#[\-_][\d.\-]+$##; # this is new with MM 5.00 | |
414 | $name; | |
415 | } | |
416 | ||
417 | =item init_main | |
418 | ||
f4ae0f5e | 419 | Initializes NAME, FULLEXT, BASEEXT, ROOTEXT, DLBASE, PERL_SRC, |
420 | PERL_LIB, PERL_ARCHLIB, PERL_INC, INSTALLDIRS, INST_*, INSTALL*, | |
421 | PREFIX, CONFIG, AR, AR_STATIC_ARGS, LD, OBJ_EXT, LIB_EXT, MAP_TARGET, | |
422 | LIBPERL_A, VERSION_FROM, VERSION, DISTNAME, VERSION_SYM. | |
1e44e2bf | 423 | |
424 | =cut | |
425 | ||
426 | sub init_main { | |
427 | my($self) = @_; | |
428 | unless (ref $self){ | |
429 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
430 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
431 | } | |
432 | ||
433 | # --- Initialize Module Name and Paths | |
434 | ||
435 | # NAME = The perl module name for this extension (eg DBD::Oracle). | |
436 | # FULLEXT = Pathname for extension directory (eg DBD/Oracle). | |
437 | # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. | |
438 | # ROOTEXT = Directory part of FULLEXT with leading /. | |
439 | ($self->{FULLEXT} = | |
440 | $self->{NAME}) =~ s!::!/!g ; #eg. BSD/Foo/Socket | |
441 | ||
442 | # Copied from DynaLoader: | |
443 | ||
444 | my(@modparts) = split(/::/,$self->{NAME}); | |
445 | my($modfname) = $modparts[-1]; | |
446 | ||
447 | # Some systems have restrictions on files names for DLL's etc. | |
448 | # mod2fname returns appropriate file base name (typically truncated) | |
449 | # It may also edit @modparts if required. | |
450 | if (defined &DynaLoader::mod2fname) { | |
451 | $modfname = &DynaLoader::mod2fname(\@modparts); | |
452 | } elsif ($Is_OS2) { # Need manual correction if run with miniperl:-( | |
453 | $modfname = substr($modfname, 0, 7) . '_'; | |
454 | } | |
455 | ||
456 | ||
457 | ($self->{BASEEXT} = | |
458 | $self->{NAME}) =~ s!.*::!! ; #eg. Socket | |
459 | ||
460 | if (defined &DynaLoader::mod2fname or $Is_OS2) { | |
461 | # As of 5.001m, dl_os2 appends '_' | |
462 | $self->{DLBASE} = $modfname; #eg. Socket_ | |
463 | } else { | |
464 | $self->{DLBASE} = '$(BASEEXT)'; | |
465 | } | |
466 | ||
467 | ($self->{ROOTEXT} = | |
468 | $self->{FULLEXT}) =~ s#/?\Q$self->{BASEEXT}\E$## ; #eg. /BSD/Foo | |
469 | ||
470 | $self->{ROOTEXT} = ($Is_VMS ? '' : '/') . $self->{ROOTEXT} if $self->{ROOTEXT}; | |
471 | ||
472 | ||
473 | # --- Initialize PERL_LIB, INST_LIB, PERL_SRC | |
474 | ||
475 | # *Real* information: where did we get these two from? ... | |
476 | my $inc_config_dir = dirname($INC{'Config.pm'}); | |
477 | my $inc_carp_dir = dirname($INC{'Carp.pm'}); | |
478 | ||
479 | unless ($self->{PERL_SRC}){ | |
480 | my($dir); | |
481 | foreach $dir (qw(.. ../.. ../../..)){ | |
482 | if ( -f "$dir/config.sh" | |
483 | && -f "$dir/perl.h" | |
484 | && -f "$dir/lib/Exporter.pm") { | |
485 | $self->{PERL_SRC}=$dir ; | |
486 | last; | |
487 | } | |
488 | } | |
489 | } | |
490 | if ($self->{PERL_SRC}){ | |
491 | $self->{PERL_LIB} ||= $self->catdir("$self->{PERL_SRC}","lib"); | |
492 | $self->{PERL_ARCHLIB} = $self->{PERL_LIB}; | |
493 | $self->{PERL_INC} = $self->{PERL_SRC}; | |
494 | # catch a situation that has occurred a few times in the past: | |
f4ae0f5e | 495 | warn <<EOM unless (-s $self->catfile($self->{PERL_SRC},'cflags') or $Is_VMS && -s $self->catfile($self->{PERL_SRC},'perlshr_attr.opt')); |
1e44e2bf | 496 | You cannot build extensions below the perl source tree after executing |
497 | a 'make clean' in the perl source tree. | |
498 | ||
499 | To rebuild extensions distributed with the perl source you should | |
500 | simply Configure (to include those extensions) and then build perl as | |
501 | normal. After installing perl the source tree can be deleted. It is | |
502 | not needed for building extensions by running 'perl Makefile.PL' | |
503 | usually without extra arguments. | |
504 | ||
505 | It is recommended that you unpack and build additional extensions away | |
506 | from the perl source tree. | |
507 | EOM | |
508 | } else { | |
509 | # we should also consider $ENV{PERL5LIB} here | |
510 | $self->{PERL_LIB} ||= $Config::Config{privlibexp}; | |
511 | $self->{PERL_ARCHLIB} ||= $Config::Config{archlibexp}; | |
512 | $self->{PERL_INC} = $self->catdir("$self->{PERL_ARCHLIB}","CORE"); # wild guess for now | |
513 | my $perl_h; | |
514 | die <<EOM unless (-f ($perl_h = $self->catfile($self->{PERL_INC},"perl.h"))); | |
515 | Error: Unable to locate installed Perl libraries or Perl source code. | |
516 | ||
517 | It is recommended that you install perl in a standard location before | |
518 | building extensions. You can say: | |
519 | ||
520 | $^X Makefile.PL PERL_SRC=/path/to/perl/source/directory | |
521 | ||
522 | if you have not yet installed perl but still want to build this | |
523 | extension now. | |
524 | (You get this message, because MakeMaker could not find "$perl_h") | |
525 | EOM | |
526 | ||
527 | # print STDOUT "Using header files found in $self->{PERL_INC}\n" | |
528 | # if $Verbose && $self->needs_linking(); | |
529 | ||
530 | } | |
531 | ||
532 | # We get SITELIBEXP and SITEARCHEXP directly via | |
533 | # Get_from_Config. When we are running standard modules, these | |
534 | # won't matter, we will set INSTALLDIRS to "perl". Otherwise we | |
535 | # set it to "site". I prefer that INSTALLDIRS be set from outside | |
536 | # MakeMaker. | |
537 | $self->{INSTALLDIRS} ||= "site"; | |
538 | ||
539 | # INST_LIB typically pre-set if building an extension after | |
540 | # perl has been built and installed. Setting INST_LIB allows | |
541 | # you to build directly into, say $Config::Config{privlibexp}. | |
542 | unless ($self->{INST_LIB}){ | |
543 | ||
544 | ||
545 | ##### XXXXX We have to change this nonsense | |
546 | ||
547 | if (defined $self->{PERL_SRC} and $self->{INSTALLDIRS} eq "perl") { | |
548 | $self->{INST_LIB} = $self->{INST_ARCHLIB} = $self->{PERL_LIB}; | |
549 | } else { | |
550 | $self->{INST_LIB} = $self->catdir(".","blib","lib"); | |
551 | } | |
552 | } | |
553 | $self->{INST_ARCHLIB} ||= $self->catdir(".","blib","arch"); | |
554 | $self->{INST_EXE} ||= $self->catdir('.','blib','bin'); | |
555 | ||
556 | # The user who requests an installation directory explicitly | |
557 | # should not have to tell us a architecture installation directory | |
558 | # as well We look if a directory exists that is named after the | |
559 | # architecture. If not we take it as a sign that it should be the | |
560 | # same as the requested installation directory. Otherwise we take | |
561 | # the found one. | |
562 | # We do the same thing twice: for privlib/archlib and for sitelib/sitearch | |
563 | my($libpair); | |
564 | for $libpair ({l=>"privlib", a=>"archlib"}, {l=>"sitelib", a=>"sitearch"}) { | |
565 | my $lib = "install$libpair->{l}"; | |
566 | my $Lib = uc $lib; | |
567 | my $Arch = uc "install$libpair->{a}"; | |
568 | if( $self->{$Lib} && ! $self->{$Arch} ){ | |
569 | my($ilib) = $Config{$lib}; | |
570 | $ilib = VMS::Filespec::unixify($ilib) if $Is_VMS; | |
571 | ||
572 | $self->prefixify($Arch,$ilib,$self->{$Lib}); | |
573 | ||
574 | unless (-d $self->{$Arch}) { | |
575 | print STDOUT "Directory $self->{$Arch} not found, thusly\n" if $Verbose; | |
576 | $self->{$Arch} = $self->{$Lib}; | |
577 | } | |
578 | print STDOUT "Defaulting $Arch to $self->{$Arch}\n" if $Verbose; | |
579 | } | |
580 | } | |
581 | ||
582 | # we have to look at the relation between $Config{prefix} and the | |
583 | # requested values. We're going to set the $Config{prefix} part of | |
584 | # all the installation path variables to literally $(PREFIX), so | |
585 | # the user can still say make PREFIX=foo | |
586 | my($prefix) = $Config{'prefix'}; | |
587 | $prefix = VMS::Filespec::unixify($prefix) if $Is_VMS; | |
588 | unless ($self->{PREFIX}){ | |
589 | $self->{PREFIX} = $prefix; | |
590 | } | |
591 | my($install_variable); | |
592 | for $install_variable (qw/INSTALLPRIVLIB INSTALLARCHLIB INSTALLBIN INSTALLMAN1DIR | |
593 | INSTALLMAN3DIR INSTALLSITELIB INSTALLSITEARCH/) { | |
594 | $self->prefixify($install_variable,$prefix,q[$(PREFIX)]); | |
595 | } | |
596 | ||
597 | ||
598 | # Now we head at the manpages. Maybe they DO NOT want manpages | |
599 | # installed | |
600 | $self->{INSTALLMAN1DIR} = $Config::Config{installman1dir} | |
601 | unless defined $self->{INSTALLMAN1DIR}; | |
602 | unless (defined $self->{INST_MAN1DIR}){ | |
603 | if ($self->{INSTALLMAN1DIR} =~ /^(none|\s*)$/){ | |
604 | $self->{INST_MAN1DIR} = $self->{INSTALLMAN1DIR}; | |
605 | } else { | |
606 | $self->{INST_MAN1DIR} = $self->catdir('.','blib','man1'); | |
607 | } | |
608 | } | |
609 | $self->{MAN1EXT} ||= $Config::Config{man1ext}; | |
610 | ||
611 | $self->{INSTALLMAN3DIR} = $Config::Config{installman3dir} | |
612 | unless defined $self->{INSTALLMAN3DIR}; | |
613 | unless (defined $self->{INST_MAN3DIR}){ | |
614 | if ($self->{INSTALLMAN3DIR} =~ /^(none|\s*)$/){ | |
615 | $self->{INST_MAN3DIR} = $self->{INSTALLMAN3DIR}; | |
616 | } else { | |
617 | $self->{INST_MAN3DIR} = $self->catdir('.','blib','man3'); | |
618 | } | |
619 | } | |
620 | $self->{MAN3EXT} ||= $Config::Config{man3ext}; | |
621 | ||
622 | ||
623 | # Get some stuff out of %Config if we haven't yet done so | |
624 | print STDOUT "CONFIG must be an array ref\n" | |
625 | if ($self->{CONFIG} and ref $self->{CONFIG} ne 'ARRAY'); | |
626 | $self->{CONFIG} = [] unless (ref $self->{CONFIG}); | |
627 | push(@{$self->{CONFIG}}, @ExtUtils::MakeMaker::Get_from_Config); | |
628 | push(@{$self->{CONFIG}}, 'shellflags') if $Config::Config{shellflags}; | |
629 | my(%once_only,$m); | |
630 | foreach $m (@{$self->{CONFIG}}){ | |
631 | next if $once_only{$m}; | |
632 | print STDOUT "CONFIG key '$m' does not exist in Config.pm\n" | |
633 | unless exists $Config::Config{$m}; | |
634 | $self->{uc $m} ||= $Config::Config{$m}; | |
635 | $once_only{$m} = 1; | |
636 | } | |
637 | ||
638 | # This is too dangerous: | |
f4ae0f5e | 639 | # if ($^O eq "next") { |
1e44e2bf | 640 | # $self->{AR} = "libtool"; |
641 | # $self->{AR_STATIC_ARGS} = "-o"; | |
642 | # } | |
643 | # But I leave it as a placeholder | |
644 | ||
645 | $self->{AR_STATIC_ARGS} ||= "cr"; | |
646 | ||
647 | # These should never be needed | |
648 | $self->{LD} ||= 'ld'; | |
649 | $self->{OBJ_EXT} ||= '.o'; | |
650 | $self->{LIB_EXT} ||= '.a'; | |
651 | ||
652 | $self->{MAP_TARGET} ||= "perl"; | |
653 | ||
654 | $self->{LIBPERL_A} ||= "libperl$self->{LIB_EXT}"; | |
655 | ||
656 | # make a simple check if we find Exporter | |
657 | warn "Warning: PERL_LIB ($self->{PERL_LIB}) seems not to be a perl library directory | |
658 | (Exporter.pm not found)" | |
f4ae0f5e | 659 | unless -f $self->catfile("$self->{PERL_LIB}","Exporter.pm") || |
660 | $self->{NAME} eq "ExtUtils::MakeMaker"; | |
1e44e2bf | 661 | |
662 | # Determine VERSION and VERSION_FROM | |
663 | ($self->{DISTNAME}=$self->{NAME}) =~ s#(::)#-#g unless $self->{DISTNAME}; | |
664 | if ($self->{VERSION_FROM}){ | |
f4ae0f5e | 665 | # use FileHandle (); |
666 | # my $fh = new FileHandle; | |
667 | local *FH; | |
668 | # $fh->open($self->{VERSION_FROM}) or die "Could not open '$self->{VERSION_FROM}' (attribute VERSION_FROM): $!"; | |
669 | open(FH,$self->{VERSION_FROM}) or | |
670 | die "Could not open '$self->{VERSION_FROM}' (attribute VERSION_FROM): $!"; | |
671 | # while (<$fh>) { | |
672 | while (<FH>) { | |
1e44e2bf | 673 | chop; |
674 | next unless /\$([\w:]*\bVERSION)\b.*=/; | |
675 | local $ExtUtils::MakeMaker::module_version_variable = $1; | |
676 | my($eval) = "$_;"; | |
677 | eval $eval; | |
678 | die "Could not eval '$eval': $@" if $@; | |
679 | if ($self->{VERSION} = $ {$ExtUtils::MakeMaker::module_version_variable}){ | |
680 | print "$self->{NAME} VERSION is $self->{VERSION} (from $self->{VERSION_FROM})\n" if $Verbose; | |
681 | } else { | |
682 | # XXX this should probably croak | |
683 | print "WARNING: Setting VERSION via file '$self->{VERSION_FROM}' failed\n"; | |
684 | } | |
685 | last; | |
686 | } | |
f4ae0f5e | 687 | # close $fh; |
688 | close FH; | |
1e44e2bf | 689 | } |
690 | ||
691 | # if your FOO.pm says | |
f4ae0f5e | 692 | # $VERSION = substr(q$Revision: 1.14 $, 10); |
1e44e2bf | 693 | # then MM says something like |
694 | # -DXS_VERSION=\"n.nn \" | |
695 | if ($self->{VERSION}) { | |
696 | $self->{VERSION} =~ s/^\s+//; | |
697 | $self->{VERSION} =~ s/\s+$//; | |
698 | } | |
699 | ||
700 | $self->{VERSION} = "0.10" unless $self->{VERSION}; | |
701 | ($self->{VERSION_SYM} = $self->{VERSION}) =~ s/\W/_/g; | |
702 | ||
703 | ||
704 | # Graham Barr and Paul Marquess had some ideas how to ensure | |
705 | # version compatibility between the *.pm file and the | |
706 | # corresponding *.xs file. The bottomline was, that we need an | |
707 | # XS_VERSION macro that defaults to VERSION: | |
708 | $self->{XS_VERSION} ||= $self->{VERSION}; | |
709 | ||
710 | # --- Initialize Perl Binary Locations | |
711 | ||
712 | # Find Perl 5. The only contract here is that both 'PERL' and 'FULLPERL' | |
713 | # will be working versions of perl 5. miniperl has priority over perl | |
714 | # for PERL to ensure that $(PERL) is usable while building ./ext/* | |
715 | my ($component,@defpath); | |
716 | foreach $component ($self->{PERL_SRC}, $self->path(), $Config::Config{binexp}) { | |
717 | push @defpath, $component if defined $component; | |
718 | } | |
719 | $self->{PERL} = | |
720 | $self->find_perl(5.0, [ $^X, 'miniperl','perl','perl5',"perl$]" ], | |
721 | \@defpath, $Verbose ) unless ($self->{PERL}); | |
722 | # don't check if perl is executable, maybe they have decided to | |
723 | # supply switches with perl | |
724 | ||
725 | # Define 'FULLPERL' to be a non-miniperl (used in test: target) | |
726 | ($self->{FULLPERL} = $self->{PERL}) =~ s/miniperl/perl/i | |
727 | unless ($self->{FULLPERL}); | |
728 | } | |
729 | ||
730 | =item init_dirscan | |
731 | ||
f4ae0f5e | 732 | Initializes DIR, XS, PM, C, O_FILES, H, PL_FILES, MAN*PODS, EXE_FILES. |
1e44e2bf | 733 | |
734 | =cut | |
735 | ||
736 | sub init_dirscan { # --- File and Directory Lists (.xs .pm .pod etc) | |
737 | my($self) = @_; | |
738 | unless (ref $self){ | |
739 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
740 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
741 | } | |
742 | my($name, %dir, %xs, %c, %h, %ignore, %pl_files, %manifypods); | |
743 | local(%pm); #the sub in find() has to see this hash | |
744 | $ignore{'test.pl'} = 1; | |
745 | $ignore{'makefile.pl'} = 1 if $Is_VMS; | |
746 | foreach $name ($self->lsdir(".")){ | |
747 | next if ($name =~ /^\./ or $ignore{$name}); | |
748 | next unless $self->libscan($name); | |
749 | if (-d $name){ | |
750 | $dir{$name} = $name if (-f "$name/Makefile.PL"); | |
751 | } elsif ($name =~ /\.xs$/){ | |
752 | my($c); ($c = $name) =~ s/\.xs$/.c/; | |
753 | $xs{$name} = $c; | |
754 | $c{$c} = 1; | |
a5f75d66 | 755 | } elsif ($name =~ /\.c(pp|xx|c)?$/i){ # .c .C .cpp .cxx .cc |
1e44e2bf | 756 | $c{$name} = 1 |
757 | unless $name =~ m/perlmain\.c/; # See MAP_TARGET | |
758 | } elsif ($name =~ /\.h$/i){ | |
759 | $h{$name} = 1; | |
760 | } elsif ($name =~ /\.(p[ml]|pod)$/){ | |
761 | $pm{$name} = $self->catfile('$(INST_LIBDIR)',$name); | |
762 | } elsif ($name =~ /\.PL$/ && $name ne "Makefile.PL") { | |
763 | ($pl_files{$name} = $name) =~ s/\.PL$// ; | |
764 | } elsif ($Is_VMS && $name =~ /\.pl$/ && $name ne 'makefile.pl' && | |
765 | $name ne 'test.pl') { # case-insensitive filesystem | |
766 | ($pl_files{$name} = $name) =~ s/\.pl$// ; | |
767 | } | |
768 | } | |
769 | ||
770 | # Some larger extensions often wish to install a number of *.pm/pl | |
771 | # files into the library in various locations. | |
772 | ||
773 | # The attribute PMLIBDIRS holds an array reference which lists | |
774 | # subdirectories which we should search for library files to | |
775 | # install. PMLIBDIRS defaults to [ 'lib', $self->{BASEEXT} ]. We | |
776 | # recursively search through the named directories (skipping any | |
777 | # which don't exist or contain Makefile.PL files). | |
778 | ||
779 | # For each *.pm or *.pl file found $self->libscan() is called with | |
780 | # the default installation path in $_[1]. The return value of | |
781 | # libscan defines the actual installation location. The default | |
782 | # libscan function simply returns the path. The file is skipped | |
783 | # if libscan returns false. | |
784 | ||
785 | # The default installation location passed to libscan in $_[1] is: | |
786 | # | |
787 | # ./*.pm => $(INST_LIBDIR)/*.pm | |
788 | # ./xyz/... => $(INST_LIBDIR)/xyz/... | |
789 | # ./lib/... => $(INST_LIB)/... | |
790 | # | |
791 | # In this way the 'lib' directory is seen as the root of the actual | |
792 | # perl library whereas the others are relative to INST_LIBDIR | |
793 | # (which includes ROOTEXT). This is a subtle distinction but one | |
794 | # that's important for nested modules. | |
795 | ||
796 | $self->{PMLIBDIRS} = ['lib', $self->{BASEEXT}] | |
797 | unless $self->{PMLIBDIRS}; | |
798 | ||
799 | #only existing directories that aren't in $dir are allowed | |
800 | ||
801 | # Avoid $_ wherever possible: | |
802 | # @{$self->{PMLIBDIRS}} = grep -d && !$dir{$_}, @{$self->{PMLIBDIRS}}; | |
803 | my (@pmlibdirs) = @{$self->{PMLIBDIRS}}; | |
804 | my ($pmlibdir); | |
805 | @{$self->{PMLIBDIRS}} = (); | |
806 | foreach $pmlibdir (@pmlibdirs) { | |
807 | -d $pmlibdir && !$dir{$pmlibdir} && push @{$self->{PMLIBDIRS}}, $pmlibdir; | |
808 | } | |
809 | ||
810 | if (@{$self->{PMLIBDIRS}}){ | |
811 | print "Searching PMLIBDIRS: @{$self->{PMLIBDIRS}}\n" | |
812 | if ($Verbose >= 2); | |
f4ae0f5e | 813 | require File::Find; |
1e44e2bf | 814 | File::Find::find(sub { |
815 | if (-d $_){ | |
816 | if ($_ eq "CVS" || $_ eq "RCS"){ | |
817 | $File::Find::prune = 1; | |
818 | } | |
819 | return; | |
820 | } | |
821 | my($path, $prefix) = ($File::Find::name, '$(INST_LIBDIR)'); | |
822 | my($striplibpath,$striplibname); | |
823 | $prefix = '$(INST_LIB)' if (($striplibpath = $path) =~ s:^(\W*)lib\W:$1:); | |
824 | ($striplibname,$striplibpath) = fileparse($striplibpath); | |
825 | my($inst) = $self->catfile($prefix,$striplibpath,$striplibname); | |
826 | local($_) = $inst; # for backwards compatibility | |
827 | $inst = $self->libscan($inst); | |
828 | print "libscan($path) => '$inst'\n" if ($Verbose >= 2); | |
829 | return unless $inst; | |
830 | $pm{$path} = $inst; | |
831 | }, @{$self->{PMLIBDIRS}}); | |
832 | } | |
833 | ||
834 | $self->{DIR} = [sort keys %dir] unless $self->{DIR}; | |
835 | $self->{XS} = \%xs unless $self->{XS}; | |
836 | $self->{PM} = \%pm unless $self->{PM}; | |
837 | $self->{C} = [sort keys %c] unless $self->{C}; | |
838 | my(@o_files) = @{$self->{C}}; | |
a5f75d66 | 839 | $self->{O_FILES} = [grep s/\.c(pp|xx|c)?$/$self->{OBJ_EXT}/i, @o_files] ; |
1e44e2bf | 840 | $self->{H} = [sort keys %h] unless $self->{H}; |
841 | $self->{PL_FILES} = \%pl_files unless $self->{PL_FILES}; | |
842 | ||
843 | # Set up names of manual pages to generate from pods | |
844 | if ($self->{MAN1PODS}) { | |
845 | } elsif ( $self->{INST_MAN1DIR} =~ /^(none|\s*)$/ ) { | |
846 | $self->{MAN1PODS} = {}; | |
847 | } else { | |
848 | my %manifypods = (); | |
849 | if ( exists $self->{EXE_FILES} ) { | |
850 | foreach $name (@{$self->{EXE_FILES}}) { | |
f4ae0f5e | 851 | # use FileHandle (); |
852 | # my $fh = new FileHandle; | |
853 | local *FH; | |
1e44e2bf | 854 | my($ispod)=0; |
855 | # one day test, if $/ can be set to '' safely (is the bug fixed that was in 5.001m?) | |
f4ae0f5e | 856 | # if ($fh->open("<$name")) { |
857 | if (open(FH,"<$name")) { | |
1e44e2bf | 858 | my $testpodline; |
f4ae0f5e | 859 | # while ($testpodline = <$fh>) { |
860 | while ($testpodline = <FH>) { | |
1e44e2bf | 861 | if($testpodline =~ /^=head1\s+\w+/) { |
862 | $ispod=1; | |
863 | last; | |
864 | } | |
865 | } | |
f4ae0f5e | 866 | # $fh->close; |
867 | close FH; | |
1e44e2bf | 868 | } else { |
869 | # If it doesn't exist yet, we assume, it has pods in it | |
870 | $ispod = 1; | |
871 | } | |
872 | if( $ispod ) { | |
873 | $manifypods{$name} = $self->catfile('$(INST_MAN1DIR)',basename($name).'.$(MAN1EXT)'); | |
874 | } | |
875 | } | |
876 | } | |
877 | $self->{MAN1PODS} = \%manifypods; | |
878 | } | |
879 | if ($self->{MAN3PODS}) { | |
880 | } elsif ( $self->{INST_MAN3DIR} =~ /^(none|\s*)$/ ) { | |
881 | $self->{MAN3PODS} = {}; | |
882 | } else { | |
883 | my %manifypods = (); # we collect the keys first, i.e. the files | |
884 | # we have to convert to pod | |
885 | foreach $name (keys %{$self->{PM}}) { | |
886 | if ($name =~ /\.pod$/ ) { | |
887 | $manifypods{$name} = $self->{PM}{$name}; | |
888 | } elsif ($name =~ /\.p[ml]$/ ) { | |
f4ae0f5e | 889 | # use FileHandle (); |
890 | # my $fh = new FileHandle; | |
891 | local *FH; | |
1e44e2bf | 892 | my($ispod)=0; |
f4ae0f5e | 893 | # $fh->open("<$name"); |
894 | open(FH,"<$name"); | |
1e44e2bf | 895 | my $testpodline; |
f4ae0f5e | 896 | # while ($testpodline = <$fh>) { |
897 | while ($testpodline = <FH>) { | |
1e44e2bf | 898 | if($testpodline =~ /^=head1\s+\w+/) { |
899 | $ispod=1; | |
900 | last; | |
901 | } | |
902 | #Speculation on the future (K.A., not A.K. :) | |
903 | #if(/^=don't\S+install/) { $ispod=0; last} | |
904 | } | |
f4ae0f5e | 905 | # $fh->close; |
906 | close FH; | |
1e44e2bf | 907 | |
908 | if( $ispod ) { | |
909 | $manifypods{$name} = $self->{PM}{$name}; | |
910 | } | |
911 | } | |
912 | } | |
913 | ||
914 | # Remove "Configure.pm" and similar, if it's not the only pod listed | |
915 | # To force inclusion, just name it "Configure.pod", or override MAN3PODS | |
916 | foreach $name (keys %manifypods) { | |
917 | if ($name =~ /(config|setup).*\.pm/i) { | |
918 | delete $manifypods{$name}; | |
919 | next; | |
920 | } | |
921 | my($manpagename) = $name; | |
922 | unless ($manpagename =~ s!^(\W*)lib\W!$1!) { | |
923 | $manpagename = $self->catfile($self->{ROOTEXT},$manpagename); | |
924 | } | |
925 | $manpagename =~ s/\.p(od|m|l)$//; | |
926 | # Strip leading slashes | |
927 | $manpagename =~ s!^/+!!; | |
928 | # Turn other slashes into colons | |
929 | # $manpagename =~ s,/+,::,g; | |
930 | $manpagename = $self->replace_manpage_separator($manpagename); | |
931 | $manifypods{$name} = $self->catfile("\$(INST_MAN3DIR)","$manpagename.\$(MAN3EXT)"); | |
932 | } | |
933 | $self->{MAN3PODS} = \%manifypods; | |
934 | } | |
935 | } | |
936 | ||
937 | =item init_others | |
938 | ||
f4ae0f5e | 939 | Initializes EXTRALIBS, BSLOADLIBS, LDLOADLIBS, LIBS, LD_RUN_PATH, |
940 | OBJECT, BOOTDEP, PERLMAINCC, LDFROM, LINKTYPE, NOOP, FIRST_MAKEFILE, | |
941 | MAKEFILE, NOECHO, RM_F, RM_RF, TOUCH, CP, MV, CHMOD, UMASK_NULL | |
1e44e2bf | 942 | |
943 | =cut | |
944 | ||
945 | sub init_others { # --- Initialize Other Attributes | |
946 | my($self) = shift; | |
947 | unless (ref $self){ | |
948 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
949 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
950 | } | |
951 | ||
952 | # Compute EXTRALIBS, BSLOADLIBS and LDLOADLIBS from $self->{LIBS} | |
953 | # Lets look at $self->{LIBS} carefully: It may be an anon array, a string or | |
954 | # undefined. In any case we turn it into an anon array: | |
955 | ||
956 | # May check $Config{libs} too, thus not empty. | |
957 | $self->{LIBS}=[''] unless $self->{LIBS}; | |
958 | ||
959 | $self->{LIBS}=[$self->{LIBS}] if ref \$self->{LIBS} eq SCALAR; | |
960 | $self->{LD_RUN_PATH} = ""; | |
961 | my($libs); | |
962 | foreach $libs ( @{$self->{LIBS}} ){ | |
963 | $libs =~ s/^\s*(.*\S)\s*$/$1/; # remove leading and trailing whitespace | |
964 | my(@libs) = $self->extliblist($libs); | |
965 | if ($libs[0] or $libs[1] or $libs[2]){ | |
966 | # LD_RUN_PATH now computed by ExtUtils::Liblist | |
967 | ($self->{EXTRALIBS}, $self->{BSLOADLIBS}, $self->{LDLOADLIBS}, $self->{LD_RUN_PATH}) = @libs; | |
968 | last; | |
969 | } | |
970 | } | |
971 | ||
f4ae0f5e | 972 | if ( $self->{OBJECT} ) { |
973 | $self->{OBJECT} =~ s!\.o(bj)?\b!\$(OBJ_EXT)!g; | |
974 | } | |
975 | else { | |
1e44e2bf | 976 | # init_dirscan should have found out, if we have C files |
977 | $self->{OBJECT} = ""; | |
978 | $self->{OBJECT} = '$(BASEEXT)$(OBJ_EXT)' if @{$self->{C}||[]}; | |
979 | } | |
980 | $self->{OBJECT} =~ s/\n+/ \\\n\t/g; | |
981 | $self->{BOOTDEP} = (-f "$self->{BASEEXT}_BS") ? "$self->{BASEEXT}_BS" : ""; | |
982 | $self->{PERLMAINCC} ||= '$(CC)'; | |
983 | $self->{LDFROM} = '$(OBJECT)' unless $self->{LDFROM}; | |
984 | ||
985 | # Sanity check: don't define LINKTYPE = dynamic if we're skipping | |
986 | # the 'dynamic' section of MM. We don't have this problem with | |
987 | # 'static', since we either must use it (%Config says we can't | |
988 | # use dynamic loading) or the caller asked for it explicitly. | |
989 | if (!$self->{LINKTYPE}) { | |
f4ae0f5e | 990 | $self->{LINKTYPE} = $self->{SKIPHASH}{'dynamic'} |
1e44e2bf | 991 | ? 'static' |
992 | : ($Config::Config{usedl} ? 'dynamic' : 'static'); | |
993 | }; | |
994 | ||
995 | # These get overridden for VMS and maybe some other systems | |
f4ae0f5e | 996 | $self->{NOOP} ||= "sh -c true"; |
1e44e2bf | 997 | $self->{FIRST_MAKEFILE} ||= "Makefile"; |
998 | $self->{MAKEFILE} ||= $self->{FIRST_MAKEFILE}; | |
999 | $self->{MAKE_APERL_FILE} ||= "Makefile.aperl"; | |
1000 | $self->{NOECHO} = '@' unless defined $self->{NOECHO}; | |
1001 | $self->{RM_F} ||= "rm -f"; | |
1002 | $self->{RM_RF} ||= "rm -rf"; | |
1003 | $self->{TOUCH} ||= "touch"; | |
1004 | $self->{CP} ||= "cp"; | |
1005 | $self->{MV} ||= "mv"; | |
1006 | $self->{CHMOD} ||= "chmod"; | |
1007 | $self->{UMASK_NULL} ||= "umask 0"; | |
1008 | } | |
1009 | ||
f4ae0f5e | 1010 | =item extliblist |
1e44e2bf | 1011 | |
f4ae0f5e | 1012 | Called by init_others, and calls ext ExtUtils::Liblist. See |
1013 | L<ExtUtils::Liblist> for details. | |
1e44e2bf | 1014 | |
f4ae0f5e | 1015 | =cut |
1016 | ||
1017 | sub extliblist { | |
1018 | my($self,$libs) = @_; | |
1019 | unless (ref $self){ | |
1020 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
1021 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
1022 | } | |
1023 | require ExtUtils::Liblist; | |
1024 | $self->ext($libs, $Verbose); | |
1025 | } | |
1026 | ||
1027 | =item find_perl | |
1028 | ||
1029 | Finds the executables PERL and FULLPERL | |
1e44e2bf | 1030 | |
1031 | =cut | |
1032 | ||
1033 | sub find_perl { | |
1034 | my($self, $ver, $names, $dirs, $trace) = @_; | |
1035 | unless (ref $self){ | |
1036 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
1037 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
1038 | } | |
1039 | my($name, $dir); | |
1040 | if ($trace >= 2){ | |
1041 | print "Looking for perl $ver by these names: | |
1042 | @$names | |
1043 | in these dirs: | |
1044 | @$dirs | |
1045 | "; | |
1046 | } | |
1047 | foreach $dir (@$dirs){ | |
1048 | next unless defined $dir; # $self->{PERL_SRC} may be undefined | |
1049 | foreach $name (@$names){ | |
1050 | my $abs; | |
1051 | if ($self->file_name_is_absolute($name)) { | |
1052 | $abs = $name; | |
1053 | } elsif (($name =~ m|/|) && ($name !~ m|^\.{1,2}/|)) { | |
1054 | # name is a path that does not begin with dot or dotdot | |
1055 | $abs = $self->catfile(".", $name); | |
1056 | } else { | |
1057 | $abs = $self->catfile($dir, $name); | |
1058 | } | |
1059 | print "Checking $abs\n" if ($trace >= 2); | |
1060 | next unless $self->maybe_command($abs); | |
1061 | print "Executing $abs\n" if ($trace >= 2); | |
1062 | if (`$abs -e 'require $ver; print "VER_OK\n" ' 2>&1` =~ /VER_OK/) { | |
1063 | print "Using PERL=$abs\n" if $trace; | |
1064 | return $abs; | |
1065 | } | |
1066 | } | |
1067 | } | |
1068 | print STDOUT "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n"; | |
1069 | 0; # false and not empty | |
1070 | } | |
1071 | ||
1072 | =head2 Methods to actually produce chunks of text for the Makefile | |
1073 | ||
1074 | The methods here are called in the order specified by | |
1075 | @ExtUtils::MakeMaker::MM_Sections. This manpage reflects the order as | |
1076 | well as possible. Some methods call each other, so in doubt refer to | |
1077 | the code. | |
1078 | ||
f4ae0f5e | 1079 | =item post_initialize (o) |
1e44e2bf | 1080 | |
1081 | Returns an ampty string per default. Used in Makefile.PLs to add some | |
1082 | chunk of text to the Makefile after the object is initialized. | |
1083 | ||
1084 | =cut | |
1085 | ||
1086 | sub post_initialize { | |
1087 | my($self) = shift; | |
1088 | unless (ref $self){ | |
1089 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
1090 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
1091 | } | |
1092 | ""; | |
1093 | } | |
1094 | ||
f4ae0f5e | 1095 | =item const_config (o) |
1e44e2bf | 1096 | |
f4ae0f5e | 1097 | Defines a couple of constants in the Makefile that are inported from |
1098 | %Config. | |
1e44e2bf | 1099 | |
1100 | =cut | |
1101 | ||
1102 | sub const_config { | |
1103 | # --- Constants Sections --- | |
1104 | ||
1105 | my($self) = shift; | |
1106 | unless (ref $self){ | |
1107 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
1108 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
1109 | } | |
1110 | my(@m,$m); | |
1111 | push(@m,"\n# These definitions are from config.sh (via $INC{'Config.pm'})\n"); | |
1112 | push(@m,"\n# They may have been overridden via Makefile.PL or on the command line\n"); | |
1113 | my(%once_only); | |
1114 | foreach $m (@{$self->{CONFIG}}){ | |
a5f75d66 | 1115 | # SITE*EXP macros are defined in &constants; avoid duplicates here |
f4ae0f5e | 1116 | next if $once_only{$m} or $m eq 'sitelibexp' or $m eq 'sitearchexp'; |
1e44e2bf | 1117 | push @m, "\U$m\E = ".$self->{uc $m}."\n"; |
1118 | $once_only{$m} = 1; | |
1119 | } | |
1120 | join('', @m); | |
1121 | } | |
1122 | ||
f4ae0f5e | 1123 | =item constants (o) |
1e44e2bf | 1124 | |
f4ae0f5e | 1125 | Initializes lots of constants and .SUFFIXES and .PHONY |
1e44e2bf | 1126 | |
1127 | =cut | |
1128 | ||
1129 | sub constants { | |
1130 | my($self) = @_; | |
1131 | unless (ref $self){ | |
1132 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
1133 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
1134 | } | |
1135 | my(@m,$tmp); | |
1136 | ||
1137 | for $tmp (qw/ | |
1138 | AR_STATIC_ARGS NAME DISTNAME NAME_SYM VERSION VERSION_SYM XS_VERSION | |
1139 | INST_LIB INST_ARCHLIB INST_EXE PREFIX INSTALLDIRS INSTALLPRIVLIB | |
1140 | INSTALLARCHLIB INSTALLSITELIB INSTALLSITEARCH INSTALLBIN PERL_LIB | |
1141 | PERL_ARCHLIB SITELIBEXP SITEARCHEXP LIBPERL_A MYEXTLIB | |
1142 | FIRST_MAKEFILE MAKE_APERL_FILE PERLMAINCC PERL_SRC PERL_INC PERL FULLPERL | |
1143 | / ) { | |
1144 | next unless defined $self->{$tmp}; | |
1145 | push @m, "$tmp = $self->{$tmp}\n"; | |
1146 | } | |
1147 | ||
1148 | push @m, qq{ | |
1149 | VERSION_MACRO = VERSION | |
1150 | DEFINE_VERSION = -D\$(VERSION_MACRO)=\\\"\$(VERSION)\\\" | |
1151 | XS_VERSION_MACRO = XS_VERSION | |
1152 | XS_DEFINE_VERSION = -D\$(XS_VERSION_MACRO)=\\\"\$(XS_VERSION)\\\" | |
1153 | }; | |
1154 | ||
1155 | push @m, qq{ | |
1156 | MAKEMAKER = \$(PERL_LIB)/ExtUtils/MakeMaker.pm | |
1157 | MM_VERSION = $ExtUtils::MakeMaker::VERSION | |
1e44e2bf | 1158 | }; |
1159 | ||
1160 | push @m, q{ | |
1161 | # FULLEXT = Pathname for extension directory (eg DBD/Oracle). | |
1162 | # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. | |
1163 | # ROOTEXT = Directory part of FULLEXT with leading slash (eg /DBD) | |
1164 | # DLBASE = Basename part of dynamic library. May be just equal BASEEXT. | |
1165 | }; | |
1166 | ||
1167 | for $tmp (qw/ | |
f4ae0f5e | 1168 | FULLEXT BASEEXT ROOTEXT DLBASE VERSION_FROM INC DEFINE OBJECT |
1e44e2bf | 1169 | LDFROM LINKTYPE |
1170 | / ) { | |
1171 | next unless defined $self->{$tmp}; | |
1172 | push @m, "$tmp = $self->{$tmp}\n"; | |
1173 | } | |
1174 | ||
1175 | push @m, " | |
1176 | # Handy lists of source code files: | |
1177 | XS_FILES= ".join(" \\\n\t", sort keys %{$self->{XS}})." | |
1178 | C_FILES = ".join(" \\\n\t", @{$self->{C}})." | |
1179 | O_FILES = ".join(" \\\n\t", @{$self->{O_FILES}})." | |
1180 | H_FILES = ".join(" \\\n\t", @{$self->{H}})." | |
1181 | MAN1PODS = ".join(" \\\n\t", sort keys %{$self->{MAN1PODS}})." | |
1182 | MAN3PODS = ".join(" \\\n\t", sort keys %{$self->{MAN3PODS}})." | |
1183 | "; | |
1184 | ||
1185 | for $tmp (qw/ | |
1186 | INST_MAN1DIR INSTALLMAN1DIR MAN1EXT INST_MAN3DIR INSTALLMAN3DIR MAN3EXT | |
1187 | /) { | |
1188 | next unless defined $self->{$tmp}; | |
1189 | push @m, "$tmp = $self->{$tmp}\n"; | |
1190 | } | |
1191 | ||
1192 | push @m, " | |
1193 | # work around a famous dec-osf make(1) feature(?): | |
1194 | makemakerdflt: all | |
1195 | ||
a5f75d66 | 1196 | .SUFFIXES: .xs .c .C .cpp .cxx .cc \$(OBJ_EXT) |
1e44e2bf | 1197 | |
1198 | # Nick wanted to get rid of .PRECIOUS. I don't remember why. I seem to recall, that | |
1199 | # some make implementations will delete the Makefile when we rebuild it. Because | |
1200 | # we call false(1) when we rebuild it. So make(1) is not completely wrong when it | |
1201 | # does so. Our milage may vary. | |
1202 | # .PRECIOUS: Makefile # seems to be not necessary anymore | |
1203 | ||
1204 | .PHONY: all config static dynamic test linkext manifest | |
1205 | ||
1206 | # Where is the Config information that we are using/depend on | |
f4ae0f5e | 1207 | CONFIGDEP = \$(PERL_ARCHLIB)/Config.pm \$(PERL_INC)/config.h |
1e44e2bf | 1208 | "; |
1209 | ||
1210 | push @m, ' | |
1211 | # Where to put things: | |
1212 | INST_LIBDIR = $(INST_LIB)$(ROOTEXT) | |
1213 | INST_ARCHLIBDIR = $(INST_ARCHLIB)$(ROOTEXT) | |
1214 | ||
1215 | INST_AUTODIR = $(INST_LIB)/auto/$(FULLEXT) | |
1216 | INST_ARCHAUTODIR = $(INST_ARCHLIB)/auto/$(FULLEXT) | |
1217 | '; | |
1218 | ||
1219 | if ($self->has_link_code()) { | |
1220 | push @m, ' | |
1221 | INST_STATIC = $(INST_ARCHAUTODIR)/$(BASEEXT)$(LIB_EXT) | |
1222 | INST_DYNAMIC = $(INST_ARCHAUTODIR)/$(DLBASE).$(DLEXT) | |
1223 | INST_BOOT = $(INST_ARCHAUTODIR)/$(BASEEXT).bs | |
1224 | '; | |
1225 | } else { | |
1226 | push @m, ' | |
1227 | INST_STATIC = | |
1228 | INST_DYNAMIC = | |
1229 | INST_BOOT = | |
1230 | '; | |
1231 | } | |
1232 | ||
1233 | if ($Is_OS2) { | |
1234 | $tmp = "$self->{BASEEXT}.def"; | |
1235 | } else { | |
1236 | $tmp = ""; | |
1237 | } | |
1238 | push @m, " | |
1239 | EXPORT_LIST = $tmp | |
1240 | "; | |
1241 | ||
1242 | if ($Is_OS2) { | |
1243 | $tmp = "\$(PERL_INC)/libperl.lib"; | |
1244 | } else { | |
1245 | $tmp = ""; | |
1246 | } | |
1247 | push @m, " | |
1248 | PERL_ARCHIVE = $tmp | |
1249 | "; | |
1250 | ||
f4ae0f5e | 1251 | # push @m, q{ |
1252 | #INST_PM = }.join(" \\\n\t", sort values %{$self->{PM}}).q{ | |
1253 | # | |
1254 | #PM_TO_BLIB = }.join(" \\\n\t", %{$self->{PM}}).q{ | |
1255 | #}; | |
1256 | ||
1257 | push @m, q{ | |
1258 | TO_INST_PM = }.join(" \\\n\t", sort keys %{$self->{PM}}).q{ | |
1259 | ||
1260 | PM_TO_BLIB = }.join(" \\\n\t", %{$self->{PM}}).q{ | |
1261 | }; | |
1e44e2bf | 1262 | |
1263 | join('',@m); | |
1264 | } | |
1265 | ||
1266 | =item const_loadlibs | |
1267 | ||
f4ae0f5e | 1268 | Defines EXTRALIBS, LDLOADLIBS, BSLOADLIBS, LD_RUN_PATH. See |
1269 | L<ExtUtils::Liblist> for details. | |
1e44e2bf | 1270 | |
1271 | =cut | |
1272 | ||
1273 | sub const_loadlibs { | |
1274 | my($self) = shift; | |
1275 | unless (ref $self){ | |
1276 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
1277 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
1278 | } | |
1279 | return "" unless $self->needs_linking; | |
f4ae0f5e | 1280 | my @m; |
1281 | push @m, qq{ | |
1e44e2bf | 1282 | # $self->{NAME} might depend on some other libraries: |
f4ae0f5e | 1283 | # See ExtUtils::Liblist for details |
1e44e2bf | 1284 | # |
f4ae0f5e | 1285 | }; |
1286 | my($tmp); | |
1287 | for $tmp (qw/ | |
1288 | EXTRALIBS LDLOADLIBS BSLOADLIBS LD_RUN_PATH | |
1289 | /) { | |
1290 | next unless defined $self->{$tmp}; | |
1291 | push @m, "$tmp = $self->{$tmp}\n"; | |
1292 | } | |
1293 | return join "", @m; | |
1e44e2bf | 1294 | } |
1295 | ||
f4ae0f5e | 1296 | =item cflags |
1e44e2bf | 1297 | |
f4ae0f5e | 1298 | Does very much the same as the cflags script in the perl |
1299 | distribution. It doesn't return the whole compiler command line, but | |
1300 | initializes all of its parts. The const_cccmd method then actually | |
1301 | returns the definition of the CCCMD macro which uses these parts. | |
1e44e2bf | 1302 | |
1303 | =cut | |
1304 | ||
f4ae0f5e | 1305 | #' |
1306 | ||
1307 | sub cflags { | |
1e44e2bf | 1308 | my($self,$libperl)=@_; |
f4ae0f5e | 1309 | return $self->{CFLAGS} if $self->{CFLAGS}; |
1e44e2bf | 1310 | return '' unless $self->needs_linking(); |
f4ae0f5e | 1311 | |
1312 | my($prog, $uc, $perltype, %cflags); | |
1313 | $libperl ||= $self->{LIBPERL_A} || "libperl$self->{LIB_EXT}" ; | |
1e44e2bf | 1314 | $libperl =~ s/\.\$\(A\)$/$self->{LIB_EXT}/; |
f4ae0f5e | 1315 | |
1316 | @cflags{qw(cc ccflags optimize large split shellflags)} | |
1e44e2bf | 1317 | = @Config{qw(cc ccflags optimize large split shellflags)}; |
1318 | my($optdebug) = ""; | |
1319 | ||
f4ae0f5e | 1320 | $cflags{shellflags} ||= ''; |
1e44e2bf | 1321 | |
1322 | my(%map) = ( | |
1323 | D => '-DDEBUGGING', | |
1324 | E => '-DEMBED', | |
1325 | DE => '-DDEBUGGING -DEMBED', | |
1326 | M => '-DEMBED -DMULTIPLICITY', | |
1327 | DM => '-DDEBUGGING -DEMBED -DMULTIPLICITY', | |
1328 | ); | |
1329 | ||
1330 | if ($libperl =~ /libperl(\w*)\Q$self->{LIB_EXT}/){ | |
1331 | $uc = uc($1); | |
1332 | } else { | |
1333 | $uc = ""; # avoid warning | |
1334 | } | |
1335 | $perltype = $map{$uc} ? $map{$uc} : ""; | |
1336 | ||
1337 | if ($uc =~ /^D/) { | |
1338 | $optdebug = "-g"; | |
1339 | } | |
1340 | ||
1341 | ||
1342 | my($name); | |
1343 | ( $name = $self->{NAME} . "_cflags" ) =~ s/:/_/g ; | |
1344 | if ($prog = $Config::Config{$name}) { | |
1345 | # Expand hints for this extension via the shell | |
1346 | print STDOUT "Processing $name hint:\n" if $Verbose; | |
f4ae0f5e | 1347 | my(@o)=`cc=\"$cflags{cc}\" |
1348 | ccflags=\"$cflags{ccflags}\" | |
1349 | optimize=\"$cflags{optimize}\" | |
1350 | perltype=\"$cflags{perltype}\" | |
1351 | optdebug=\"$cflags{optdebug}\" | |
1352 | large=\"$cflags{large}\" | |
1353 | split=\"$cflags{'split'}\" | |
1354 | eval '$cflags{prog}' | |
1355 | echo cc=\$cflags{cc} | |
1356 | echo ccflags=\$cflags{ccflags} | |
1357 | echo optimize=\$cflags{optimize} | |
1358 | echo perltype=\$cflags{perltype} | |
1359 | echo optdebug=\$cflags{optdebug} | |
1360 | echo large=\$cflags{large} | |
1361 | echo split=\$cflags{'split'} | |
1e44e2bf | 1362 | `; |
f4ae0f5e | 1363 | my($line); |
1e44e2bf | 1364 | foreach $line (@o){ |
1365 | chomp $line; | |
1366 | if ($line =~ /(.*?)=\s*(.*)\s*$/){ | |
1367 | $cflags{$1} = $2; | |
1368 | print STDOUT " $1 = $2\n" if $Verbose; | |
1369 | } else { | |
1370 | print STDOUT "Unrecognised result from hint: '$line'\n"; | |
1371 | } | |
1372 | } | |
1e44e2bf | 1373 | } |
1374 | ||
1375 | if ($optdebug) { | |
f4ae0f5e | 1376 | $cflags{optimize} = $optdebug; |
1e44e2bf | 1377 | } |
1378 | ||
f4ae0f5e | 1379 | for (qw(ccflags optimize perltype large split)) { |
1380 | $cflags{$_} =~ s/^\s+//; | |
1381 | $cflags{$_} =~ s/\s+/ /g; | |
1382 | $cflags{$_} =~ s/\s+$//; | |
1383 | $self->{uc $_} ||= $cflags{$_} | |
1384 | } | |
1385 | ||
1386 | return $self->{CFLAGS} = qq{ | |
1387 | CCFLAGS = $self->{CCFLAGS} | |
1388 | OPTIMIZE = $self->{OPTIMIZE} | |
1389 | PERLTYPE = $self->{PERLTYPE} | |
1390 | LARGE = $self->{LARGE} | |
1391 | SPLIT = $self->{SPLIT} | |
1392 | }; | |
1e44e2bf | 1393 | |
1e44e2bf | 1394 | } |
1395 | ||
1e44e2bf | 1396 | |
1397 | ||
f4ae0f5e | 1398 | =item const_cccmd |
1399 | ||
1400 | Returns the full compiler call for C programs and stores the | |
1401 | definition in CONST_CCCMD. | |
1402 | ||
1403 | =cut | |
1404 | ||
1405 | sub const_cccmd { | |
1406 | my($self,$libperl)=@_; | |
1407 | unless (ref $self){ | |
1408 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
1409 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
1410 | } | |
1411 | return $self->{CONST_CCCMD} if $self->{CONST_CCCMD}; | |
1412 | return '' unless $self->needs_linking(); | |
1413 | return $self->{CONST_CCCMD} = | |
1414 | q{CCCMD = $(CC) -c $(INC) $(CCFLAGS) $(OPTIMIZE) \\ | |
1415 | $(PERLTYPE) $(LARGE) $(SPLIT) $(DEFINE_VERSION) \\ | |
1416 | $(XS_DEFINE_VERSION)}; | |
1417 | } | |
1418 | ||
1419 | =item pm_to_blib | |
1420 | ||
1421 | Defines target that copies all files in the hash PM to their | |
1422 | destination and autosplits them. See L<ExtUtils::Install/pm_to_blib> | |
1423 | ||
1424 | =cut | |
1425 | ||
1426 | sub pm_to_blib { | |
1427 | my $self = shift; | |
1428 | my($autodir) = $self->catdir('$(INST_LIB)','auto'); | |
1429 | return q{ | |
1430 | pm_to_blib: $(TO_INST_PM) | |
1431 | }.$self->{NOECHO}.q{$(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" \ | |
1432 | "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -MExtUtils::Install \ | |
1433 | -e 'pm_to_blib({@ARGV},"}.$autodir.q{")' $(PM_TO_BLIB) | |
1434 | }.$self->{NOECHO}.q{$(TOUCH) $@ | |
1435 | }; | |
1436 | } | |
1437 | ||
1438 | =item tool_autosplit (o) | |
1439 | ||
1440 | Defines a simple perl call that runs autosplit. May be deprecated by | |
1441 | pm_to_blib soon. | |
1e44e2bf | 1442 | |
1443 | =cut | |
1444 | ||
1445 | sub tool_autosplit { | |
1446 | # --- Tool Sections --- | |
1447 | ||
1448 | my($self, %attribs) = @_; | |
1449 | unless (ref $self){ | |
1450 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
1451 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
1452 | } | |
1453 | my($asl) = ""; | |
1454 | $asl = "\$AutoSplit::Maxlen=$attribs{MAXLEN};" if $attribs{MAXLEN}; | |
1455 | q{ | |
1456 | # Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto | |
1457 | AUTOSPLITFILE = $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e 'use AutoSplit;}.$asl.q{autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1) ;' | |
1458 | }; | |
1459 | } | |
1460 | ||
f4ae0f5e | 1461 | =item tool_xsubpp (o) |
1e44e2bf | 1462 | |
f4ae0f5e | 1463 | Determines typemaps, xsubpp version, prototype behaviour. |
1e44e2bf | 1464 | |
1465 | =cut | |
1466 | ||
1467 | sub tool_xsubpp { | |
1468 | my($self) = shift; | |
1469 | unless (ref $self){ | |
1470 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
1471 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
1472 | } | |
f4ae0f5e | 1473 | my($xsdir) = $self->catdir($self->{PERL_LIB},"ExtUtils"); |
1474 | my(@tmdeps) = $self->catdir('$(XSUBPPDIR)','typemap'); | |
1e44e2bf | 1475 | if( $self->{TYPEMAPS} ){ |
1476 | my $typemap; | |
1477 | foreach $typemap (@{$self->{TYPEMAPS}}){ | |
1478 | if( ! -f $typemap ){ | |
1479 | warn "Typemap $typemap not found.\n"; | |
1480 | } | |
1481 | else{ | |
1482 | push(@tmdeps, $typemap); | |
1483 | } | |
1484 | } | |
1485 | } | |
1486 | push(@tmdeps, "typemap") if -f "typemap"; | |
1487 | my(@tmargs) = map("-typemap $_", @tmdeps); | |
1488 | if( exists $self->{XSOPT} ){ | |
1489 | unshift( @tmargs, $self->{XSOPT} ); | |
1490 | } | |
1491 | ||
f4ae0f5e | 1492 | |
1e44e2bf | 1493 | my $xsubpp_version = $self->xsubpp_version("$xsdir/xsubpp"); |
1494 | ||
1495 | # What are the correct thresholds for version 1 && 2 Paul? | |
1496 | if ( $xsubpp_version > 1.923 ){ | |
1497 | $self->{XSPROTOARG} = "" unless defined $self->{XSPROTOARG}; | |
1498 | } else { | |
1499 | if (defined $self->{XSPROTOARG} && $self->{XSPROTOARG} =~ /\-prototypes/) { | |
1500 | print STDOUT qq{Warning: This extension wants to pass the switch "-prototypes" to xsubpp. | |
1501 | Your version of xsubpp is $xsubpp_version and cannot handle this. | |
1502 | Please upgrade to a more recent version of xsubpp. | |
1503 | }; | |
1504 | } else { | |
1505 | $self->{XSPROTOARG} = ""; | |
1506 | } | |
1507 | } | |
1508 | ||
f4ae0f5e | 1509 | return qq{ |
1e44e2bf | 1510 | XSUBPPDIR = $xsdir |
1511 | XSUBPP = \$(XSUBPPDIR)/xsubpp | |
1512 | XSPROTOARG = $self->{XSPROTOARG} | |
1513 | XSUBPPDEPS = @tmdeps | |
1514 | XSUBPPARGS = @tmargs | |
f4ae0f5e | 1515 | }; |
1e44e2bf | 1516 | }; |
1517 | ||
1518 | sub xsubpp_version | |
1519 | { | |
1520 | my($self,$xsubpp) = @_; | |
f4ae0f5e | 1521 | return $Xsubpp_Version if defined $Xsubpp_Version; # global variable |
1522 | ||
1e44e2bf | 1523 | my ($version) ; |
1524 | ||
1525 | # try to figure out the version number of the xsubpp on the system | |
1526 | ||
1527 | # first try the -v flag, introduced in 1.921 & 2.000a2 | |
1528 | ||
f4ae0f5e | 1529 | my $command = "$self->{PERL} -I$self->{PERL_LIB} $xsubpp -v 2>&1"; |
1e44e2bf | 1530 | print "Running $command\n" if $Verbose >= 2; |
1531 | $version = `$command` ; | |
1532 | warn "Running '$command' exits with status " . ($?>>8) if $?; | |
1533 | chop $version ; | |
1534 | ||
f4ae0f5e | 1535 | return $Xsubpp_Version = $1 if $version =~ /^xsubpp version (.*)/ ; |
1e44e2bf | 1536 | |
1537 | # nope, then try something else | |
1538 | ||
1539 | my $counter = '000'; | |
1540 | my ($file) = 'temp' ; | |
1541 | $counter++ while -e "$file$counter"; # don't overwrite anything | |
1542 | $file .= $counter; | |
1543 | ||
1544 | open(F, ">$file") or die "Cannot open file '$file': $!\n" ; | |
1545 | print F <<EOM ; | |
1546 | MODULE = fred PACKAGE = fred | |
1547 | ||
1548 | int | |
1549 | fred(a) | |
1550 | int a; | |
1551 | EOM | |
1552 | ||
1553 | close F ; | |
1554 | ||
1555 | $command = "$self->{PERL} $xsubpp $file 2>&1"; | |
1556 | print "Running $command\n" if $Verbose >= 2; | |
1557 | my $text = `$command` ; | |
1558 | warn "Running '$command' exits with status " . ($?>>8) if $?; | |
1559 | unlink $file ; | |
1560 | ||
1561 | # gets 1.2 -> 1.92 and 2.000a1 | |
f4ae0f5e | 1562 | return $Xsubpp_Version = $1 if $text =~ /automatically by xsubpp version ([\S]+)\s*/ ; |
1e44e2bf | 1563 | |
1564 | # it is either 1.0 or 1.1 | |
f4ae0f5e | 1565 | return $Xsubpp_Version = 1.1 if $text =~ /^Warning: ignored semicolon/ ; |
1e44e2bf | 1566 | |
1567 | # none of the above, so 1.0 | |
f4ae0f5e | 1568 | return $Xsubpp_Version = "1.0" ; |
1e44e2bf | 1569 | } |
1570 | ||
f4ae0f5e | 1571 | =item tools_other (o) |
1e44e2bf | 1572 | |
f4ae0f5e | 1573 | Defines SHELL, LD, TOUCH, CP, MV, RM_F, RM_RF, CHMOD, UMASK_NULL in |
1574 | the Makefile. Also defines the perl programs MKPATH, | |
1575 | WARN_IF_OLD_PACKLIST, MOD_INSTALL. DOC_INSTALL, and UNINSTALL. | |
1e44e2bf | 1576 | |
1577 | =cut | |
1578 | ||
1579 | sub tools_other { | |
1580 | my($self) = shift; | |
1581 | unless (ref $self){ | |
1582 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
1583 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
1584 | } | |
f4ae0f5e | 1585 | my @m; |
1586 | push @m, qq{ | |
1e44e2bf | 1587 | SHELL = /bin/sh |
1588 | LD = $self->{LD} | |
1589 | TOUCH = $self->{TOUCH} | |
1590 | CP = $self->{CP} | |
1591 | MV = $self->{MV} | |
1592 | RM_F = $self->{RM_F} | |
1593 | RM_RF = $self->{RM_RF} | |
1594 | CHMOD = $self->{CHMOD} | |
1595 | UMASK_NULL = $self->{UMASK_NULL} | |
f4ae0f5e | 1596 | }; |
1597 | ||
1598 | push @m, q{ | |
1e44e2bf | 1599 | # The following is a portable way to say mkdir -p |
1600 | # To see which directories are created, change the if 0 to if 1 | |
1601 | MKPATH = $(PERL) -wle '$$"="/"; foreach $$p (@ARGV){' \\ | |
1602 | -e 'next if -d $$p; my(@p); foreach(split(/\//,$$p)){' \\ | |
1603 | -e 'push(@p,$$_); next if -d "@p/"; print "mkdir @p" if 0;' \\ | |
1604 | -e 'mkdir("@p",0777)||die $$! } } exit 0;' | |
1605 | ||
1606 | # This helps us to minimize the effect of the .exists files A yet | |
1607 | # better solution would be to have a stable file in the perl | |
1608 | # distribution with a timestamp of zero. But this solution doesn't | |
1609 | # need any changes to the core distribution and works with older perls | |
1610 | EQUALIZE_TIMESTAMP = $(PERL) -we 'open F, ">$$ARGV[1]"; close F;' \\ | |
1611 | -e 'utime ((stat("$$ARGV[0]"))[8,9], $$ARGV[1])' | |
f4ae0f5e | 1612 | }; |
1e44e2bf | 1613 | |
f4ae0f5e | 1614 | return join "", @m if $self->{PARENT}; |
1615 | ||
1616 | push @m, q{ | |
1e44e2bf | 1617 | # Here we warn users that an old packlist file was found somewhere, |
1618 | # and that they should call some uninstall routine | |
1619 | WARN_IF_OLD_PACKLIST = $(PERL) -we 'exit unless -f $$ARGV[0];' \\ | |
1620 | -e 'print "WARNING: I have found an old package in\n";' \\ | |
1621 | -e 'print "\t$$ARGV[0].\n";' \\ | |
1622 | -e 'print "Please make sure the two installations are not conflicting\n";' | |
1623 | ||
f4ae0f5e | 1624 | MOD_INSTALL = $(PERL) -I$(INST_LIB) -I$(PERL_LIB) -MExtUtils::Install \ |
1e44e2bf | 1625 | -e 'install({@ARGV},1);' |
1626 | ||
1627 | DOC_INSTALL = $(PERL) -e '$$\="\n\n";print "=head3 ", scalar(localtime), ": C<", shift, ">";' \ | |
1628 | -e 'print "=over 4";' \ | |
1629 | -e 'while ($$key = shift and $$val = shift){print "=item *";print "C<$$key: $$val>";}' \ | |
1630 | -e 'print "=back";' | |
1631 | ||
1632 | UNINSTALL = $(PERL) -MExtUtils::Install \ | |
1633 | -e 'uninstall($$ARGV[0],1);' | |
1634 | ||
1635 | }; | |
1e44e2bf | 1636 | |
f4ae0f5e | 1637 | return join "", @m; |
1638 | } | |
1e44e2bf | 1639 | |
f4ae0f5e | 1640 | =item dist (o) |
1e44e2bf | 1641 | |
f4ae0f5e | 1642 | Defines a lot of macros for distribution support. |
1e44e2bf | 1643 | |
1644 | =cut | |
1645 | ||
1646 | sub dist { | |
1647 | my($self, %attribs) = @_; | |
1648 | unless (ref $self){ | |
1649 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
1650 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
1651 | } | |
f4ae0f5e | 1652 | |
1e44e2bf | 1653 | my(@m); |
1654 | # VERSION should be sanitised before use as a file name | |
1655 | my($name) = $attribs{NAME} || '$(DISTVNAME)'; | |
1656 | my($tar) = $attribs{TAR} || 'tar'; # eg /usr/bin/gnutar | |
1657 | my($tarflags) = $attribs{TARFLAGS} || 'cvf'; | |
f4ae0f5e | 1658 | my($zip) = $attribs{ZIP} || 'zip'; # eg pkzip Yuck! |
1659 | my($zipflags) = $attribs{ZIPFLAGS} || '-r'; | |
1e44e2bf | 1660 | my($compress) = $attribs{COMPRESS} || 'compress'; # eg gzip |
f4ae0f5e | 1661 | my($suffix) = $attribs{SUFFIX} || '.Z'; # eg .gz |
1e44e2bf | 1662 | my($shar) = $attribs{SHAR} || 'shar'; # eg "shar --gzip" |
f4ae0f5e | 1663 | my($preop) = $attribs{PREOP} || "$self->{NOECHO}\$(NOOP)"; # eg update MANIFEST |
1664 | my($postop) = $attribs{POSTOP} || "$self->{NOECHO}\$(NOOP)"; # eg remove the distdir | |
1e44e2bf | 1665 | my($ci) = $attribs{CI} || 'ci -u'; |
1666 | my($rcs_label)= $attribs{RCS_LABEL}|| 'rcs -Nv$(VERSION_SYM): -q'; | |
1667 | my($dist_cp) = $attribs{DIST_CP} || 'best'; | |
1668 | my($dist_default) = $attribs{DIST_DEFAULT} || 'tardist'; | |
1669 | ||
1670 | push @m, " | |
f4ae0f5e | 1671 | DISTVNAME = \$(DISTNAME)-\$(VERSION_SYM) |
1e44e2bf | 1672 | TAR = $tar |
1673 | TARFLAGS = $tarflags | |
f4ae0f5e | 1674 | ZIP = $zip |
1675 | ZIPFLAGS = $zipflags | |
1e44e2bf | 1676 | COMPRESS = $compress |
1677 | SUFFIX = $suffix | |
1678 | SHAR = $shar | |
1679 | PREOP = $preop | |
1680 | POSTOP = $postop | |
1681 | CI = $ci | |
1682 | RCS_LABEL = $rcs_label | |
1683 | DIST_CP = $dist_cp | |
1684 | DIST_DEFAULT = $dist_default | |
1685 | "; | |
1686 | join "", @m; | |
1687 | } | |
1688 | ||
f4ae0f5e | 1689 | =item macro (o) |
1e44e2bf | 1690 | |
f4ae0f5e | 1691 | Simple subroutine to insert the macros defined by the macro attribute |
1692 | into the Makefile. | |
1e44e2bf | 1693 | |
1694 | =cut | |
1695 | ||
1696 | sub macro { | |
1697 | my($self,%attribs) = @_; | |
1698 | unless (ref $self){ | |
1699 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
1700 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
1701 | } | |
1702 | my(@m,$key,$val); | |
1703 | while (($key,$val) = each %attribs){ | |
f4ae0f5e | 1704 | last unless defined $key; |
1e44e2bf | 1705 | push @m, "$key = $val\n"; |
1706 | } | |
1707 | join "", @m; | |
1708 | } | |
1709 | ||
f4ae0f5e | 1710 | =item depend (o) |
1e44e2bf | 1711 | |
f4ae0f5e | 1712 | Same as macro for the depend attribute. |
1e44e2bf | 1713 | |
1714 | =cut | |
1715 | ||
1716 | sub depend { | |
1717 | my($self,%attribs) = @_; | |
1718 | unless (ref $self){ | |
1719 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
1720 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
1721 | } | |
1722 | my(@m,$key,$val); | |
1723 | while (($key,$val) = each %attribs){ | |
f4ae0f5e | 1724 | last unless defined $key; |
1725 | push @m, "$key : $val\n\t$self->{NOECHO}\$(NOOP)\n\n"; | |
1e44e2bf | 1726 | } |
1727 | join "", @m; | |
1728 | } | |
1729 | ||
f4ae0f5e | 1730 | =item post_constants (o) |
1e44e2bf | 1731 | |
f4ae0f5e | 1732 | Returns an empty string per default. Dedicated to overrides from |
1733 | within Makefile.PL after all constants have been defined. | |
1e44e2bf | 1734 | |
1735 | =cut | |
1736 | ||
1737 | sub post_constants{ | |
1738 | my($self) = shift; | |
1739 | unless (ref $self){ | |
1740 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
1741 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
1742 | } | |
1743 | ""; | |
1744 | } | |
1745 | ||
f4ae0f5e | 1746 | =item pasthru (o) |
1e44e2bf | 1747 | |
f4ae0f5e | 1748 | Defines the string that is passed to recursive make calls in |
1749 | subdirectories. | |
1e44e2bf | 1750 | |
1751 | =cut | |
1752 | ||
1753 | sub pasthru { | |
1754 | my($self) = shift; | |
1755 | unless (ref $self){ | |
1756 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
1757 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
1758 | } | |
1759 | my(@m,$key); | |
1760 | ||
1761 | my(@pasthru); | |
1762 | ||
f4ae0f5e | 1763 | # We don't have to pass thru the install thingies anymore: make |
1764 | # install is run in base directory only: | |
1765 | ||
1766 | # foreach $key (qw(INSTALLPRIVLIB INSTALLARCHLIB INSTALLBIN | |
1767 | # INSTALLMAN1DIR INSTALLMAN3DIR LIBPERL_A | |
1768 | # LINKTYPE PREFIX INSTALLSITELIB | |
1769 | # INSTALLSITEARCH INSTALLDIRS)){ | |
1770 | ||
1771 | foreach $key (qw(LIBPERL_A LINKTYPE PREFIX OPTIMIZE)){ | |
1e44e2bf | 1772 | push @pasthru, "$key=\"\$($key)\""; |
1773 | } | |
1774 | ||
1775 | push @m, "\nPASTHRU = ", join ("\\\n\t", @pasthru), "\n"; | |
1776 | join "", @m; | |
1777 | } | |
1778 | ||
f4ae0f5e | 1779 | =item c_o (o) |
1e44e2bf | 1780 | |
f4ae0f5e | 1781 | Defines the suffix rules to compile different flavors of C files to |
1782 | object files. | |
1e44e2bf | 1783 | |
1784 | =cut | |
1785 | ||
1786 | sub c_o { | |
1787 | # --- Translation Sections --- | |
1788 | ||
1789 | my($self) = shift; | |
1790 | unless (ref $self){ | |
1791 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
1792 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
1793 | } | |
1794 | return '' unless $self->needs_linking(); | |
1795 | my(@m); | |
1796 | push @m, ' | |
1797 | .c$(OBJ_EXT): | |
1798 | $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.c | |
1799 | ||
1800 | .C$(OBJ_EXT): | |
1801 | $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.C | |
a5f75d66 AD |
1802 | |
1803 | .cpp$(OBJ_EXT): | |
1804 | $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.cpp | |
1805 | ||
1806 | .cxx$(OBJ_EXT): | |
1807 | $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.cxx | |
1808 | ||
1809 | .cc$(OBJ_EXT): | |
1810 | $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.cc | |
1e44e2bf | 1811 | '; |
1812 | join "", @m; | |
1813 | } | |
1814 | ||
f4ae0f5e | 1815 | =item xs_c (o) |
1e44e2bf | 1816 | |
f4ae0f5e | 1817 | Defines the suffix rules to compile XS files to C. |
1e44e2bf | 1818 | |
1819 | =cut | |
1820 | ||
1821 | sub xs_c { | |
1822 | my($self) = shift; | |
1823 | unless (ref $self){ | |
1824 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
1825 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
1826 | } | |
1827 | return '' unless $self->needs_linking(); | |
1828 | ' | |
1829 | .xs.c: | |
1830 | $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs >$*.tc && mv $*.tc $@ | |
1831 | '; | |
1832 | } | |
1833 | ||
f4ae0f5e | 1834 | =item xs_o (o) |
1e44e2bf | 1835 | |
f4ae0f5e | 1836 | Defines suffix rules to go from XS to object files directly. This is |
1837 | only intended for broken make implementations. | |
1e44e2bf | 1838 | |
1839 | =cut | |
1840 | ||
1841 | sub xs_o { # many makes are too dumb to use xs_c then c_o | |
1842 | my($self) = shift; | |
1843 | unless (ref $self){ | |
1844 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
1845 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
1846 | } | |
1847 | return '' unless $self->needs_linking(); | |
1848 | ' | |
1849 | .xs$(OBJ_EXT): | |
1850 | $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs >xstmp.c && mv xstmp.c $*.c | |
1851 | $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.c | |
1852 | '; | |
1853 | } | |
1854 | ||
f4ae0f5e | 1855 | =item top_targets (o) |
1e44e2bf | 1856 | |
f4ae0f5e | 1857 | Defines the targets all, subdirs, config, and O_FILES |
1e44e2bf | 1858 | |
1859 | =cut | |
1860 | ||
1861 | sub top_targets { | |
1862 | # --- Target Sections --- | |
1863 | ||
1864 | my($self) = shift; | |
1865 | unless (ref $self){ | |
1866 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
1867 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
1868 | } | |
1869 | my(@m); | |
1870 | push @m, ' | |
f4ae0f5e | 1871 | #all :: config $(INST_PM) subdirs linkext manifypods |
1e44e2bf | 1872 | |
f4ae0f5e | 1873 | all :: pure_all manifypods |
1874 | '.$self->{NOECHO}.'$(NOOP) | |
1875 | ||
1876 | pure_all :: config pm_to_blib subdirs linkext | |
1877 | '.$self->{NOECHO}.'$(NOOP) | |
1e44e2bf | 1878 | |
f4ae0f5e | 1879 | subdirs :: $(MYEXTLIB) |
1880 | '.$self->{NOECHO}.'$(NOOP) | |
1e44e2bf | 1881 | |
1882 | config :: '.$self->{MAKEFILE}.' $(INST_LIBDIR)/.exists | |
f4ae0f5e | 1883 | '.$self->{NOECHO}.'$(NOOP) |
1e44e2bf | 1884 | |
1885 | config :: $(INST_ARCHAUTODIR)/.exists | |
f4ae0f5e | 1886 | '.$self->{NOECHO}.'$(NOOP) |
1e44e2bf | 1887 | |
1888 | config :: $(INST_AUTODIR)/.exists | |
f4ae0f5e | 1889 | '.$self->{NOECHO}.'$(NOOP) |
1e44e2bf | 1890 | '; |
1891 | ||
f4ae0f5e | 1892 | push @m, qq{ |
1e44e2bf | 1893 | config :: Version_check |
f4ae0f5e | 1894 | $self->{NOECHO}\$(NOOP) |
1e44e2bf | 1895 | |
f4ae0f5e | 1896 | } unless $self->{PARENT} or ($self->{PERL_SRC} && $self->{INSTALLDIRS} eq "perl") or $self->{NO_VC}; |
1e44e2bf | 1897 | |
1898 | push @m, $self->dir_target(qw[$(INST_AUTODIR) $(INST_LIBDIR) $(INST_ARCHAUTODIR)]); | |
1899 | ||
1900 | if (%{$self->{MAN1PODS}}) { | |
f4ae0f5e | 1901 | push @m, qq[ |
1902 | config :: \$(INST_MAN1DIR)/.exists | |
1903 | $self->{NOECHO}\$(NOOP) | |
1e44e2bf | 1904 | |
1905 | ]; | |
1906 | push @m, $self->dir_target(qw[$(INST_MAN1DIR)]); | |
1907 | } | |
1908 | if (%{$self->{MAN3PODS}}) { | |
f4ae0f5e | 1909 | push @m, qq[ |
1910 | config :: \$(INST_MAN3DIR)/.exists | |
1911 | $self->{NOECHO}\$(NOOP) | |
1e44e2bf | 1912 | |
1913 | ]; | |
1914 | push @m, $self->dir_target(qw[$(INST_MAN3DIR)]); | |
1915 | } | |
1916 | ||
1917 | push @m, ' | |
1918 | $(O_FILES): $(H_FILES) | |
1919 | ' if @{$self->{O_FILES} || []} && @{$self->{H} || []}; | |
1920 | ||
1921 | push @m, q{ | |
1922 | help: | |
1923 | perldoc ExtUtils::MakeMaker | |
1924 | }; | |
1925 | ||
1926 | push @m, q{ | |
1927 | Version_check: | |
1928 | }.$self->{NOECHO}.q{$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) \ | |
1929 | -MExtUtils::MakeMaker=Version_check \ | |
1930 | -e 'Version_check("$(MM_VERSION)")' | |
1931 | }; | |
1932 | ||
1933 | join('',@m); | |
1934 | } | |
1935 | ||
f4ae0f5e | 1936 | =item linkext (o) |
1e44e2bf | 1937 | |
f4ae0f5e | 1938 | Defines the linkext target which in turn defines the LINKTYPE. |
1e44e2bf | 1939 | |
1940 | =cut | |
1941 | ||
1942 | sub linkext { | |
1943 | my($self, %attribs) = @_; | |
1944 | unless (ref $self){ | |
1945 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
1946 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
1947 | } | |
1948 | # LINKTYPE => static or dynamic or '' | |
1949 | my($linktype) = defined $attribs{LINKTYPE} ? | |
1950 | $attribs{LINKTYPE} : '$(LINKTYPE)'; | |
1951 | " | |
1952 | linkext :: $linktype | |
f4ae0f5e | 1953 | $self->{NOECHO}\$(NOOP) |
1e44e2bf | 1954 | "; |
1955 | } | |
1956 | ||
f4ae0f5e | 1957 | =item dlsyms (o) |
1e44e2bf | 1958 | |
f4ae0f5e | 1959 | Used by AIX and VMS to define DL_FUNCS and DL_VARS and write the *.exp |
1960 | files. | |
1e44e2bf | 1961 | |
1962 | =cut | |
1963 | ||
1964 | sub dlsyms { | |
1965 | my($self,%attribs) = @_; | |
1966 | unless (ref $self){ | |
1967 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
1968 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
1969 | } | |
1970 | ||
f4ae0f5e | 1971 | return '' unless ($^O eq 'aix' && $self->needs_linking() ); |
1e44e2bf | 1972 | |
1973 | my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {}; | |
1974 | my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || []; | |
1975 | my(@m); | |
1976 | ||
1977 | push(@m," | |
1978 | dynamic :: $self->{BASEEXT}.exp | |
1979 | ||
1980 | ") unless $self->{SKIPHASH}{'dynamic'}; # dynamic and static are subs, so... | |
1981 | ||
1982 | push(@m," | |
1983 | static :: $self->{BASEEXT}.exp | |
1984 | ||
1985 | ") unless $self->{SKIPHASH}{'static'}; # we avoid a warning if we tick them | |
1986 | ||
1987 | push(@m," | |
1988 | $self->{BASEEXT}.exp: Makefile.PL | |
1989 | ",' $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e \'use ExtUtils::Mksymlists; \\ | |
1990 | Mksymlists("NAME" => "',$self->{NAME},'", "DL_FUNCS" => ', | |
1991 | neatvalue($funcs),', "DL_VARS" => ', neatvalue($vars), ');\' | |
1992 | '); | |
1993 | ||
1994 | join('',@m); | |
1995 | } | |
1996 | ||
f4ae0f5e | 1997 | =item dynamic (o) |
1e44e2bf | 1998 | |
f4ae0f5e | 1999 | Defines the dynamic target. |
1e44e2bf | 2000 | |
2001 | =cut | |
2002 | ||
2003 | sub dynamic { | |
2004 | # --- Dynamic Loading Sections --- | |
2005 | ||
2006 | my($self) = shift; | |
2007 | unless (ref $self){ | |
2008 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
2009 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
2010 | } | |
2011 | ' | |
f4ae0f5e | 2012 | ## $(INST_PM) has been moved to the all: target. |
2013 | ## It remains here for awhile to allow for old usage: "make dynamic" | |
2014 | #dynamic :: '.$self->{MAKEFILE}.' $(INST_DYNAMIC) $(INST_BOOT) $(INST_PM) | |
2015 | dynamic :: '.$self->{MAKEFILE}.' $(INST_DYNAMIC) $(INST_BOOT) | |
2016 | '.$self->{NOECHO}.'$(NOOP) | |
1e44e2bf | 2017 | '; |
2018 | } | |
2019 | ||
f4ae0f5e | 2020 | =item dynamic_bs (o) |
1e44e2bf | 2021 | |
f4ae0f5e | 2022 | Defines targets for bootstrap files. |
1e44e2bf | 2023 | |
2024 | =cut | |
2025 | ||
2026 | sub dynamic_bs { | |
2027 | my($self, %attribs) = @_; | |
2028 | unless (ref $self){ | |
2029 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
2030 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
2031 | } | |
2032 | return ' | |
2033 | BOOTSTRAP = | |
2034 | ' unless $self->has_link_code(); | |
2035 | ||
2036 | return ' | |
2037 | BOOTSTRAP = '."$self->{BASEEXT}.bs".' | |
2038 | ||
2039 | # As Mkbootstrap might not write a file (if none is required) | |
2040 | # we use touch to prevent make continually trying to remake it. | |
2041 | # The DynaLoader only reads a non-empty file. | |
2042 | $(BOOTSTRAP): '."$self->{MAKEFILE} $self->{BOOTDEP}".' $(INST_ARCHAUTODIR)/.exists | |
2043 | '.$self->{NOECHO}.'echo "Running Mkbootstrap for $(NAME) ($(BSLOADLIBS))" | |
2044 | '.$self->{NOECHO}.'$(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" \ | |
2045 | -e \'use ExtUtils::Mkbootstrap;\' \ | |
2046 | -e \'Mkbootstrap("$(BASEEXT)","$(BSLOADLIBS)");\' | |
2047 | '.$self->{NOECHO}.'$(TOUCH) $(BOOTSTRAP) | |
2048 | $(CHMOD) 644 $@ | |
2049 | ||
2050 | $(INST_BOOT): $(BOOTSTRAP) $(INST_ARCHAUTODIR)/.exists | |
2051 | '."$self->{NOECHO}$self->{RM_RF}".' $(INST_BOOT) | |
2052 | -'.$self->{CP}.' $(BOOTSTRAP) $(INST_BOOT) | |
2053 | $(CHMOD) 644 $@ | |
2054 | '; | |
2055 | } | |
2056 | ||
f4ae0f5e | 2057 | =item dynamic_lib (o) |
1e44e2bf | 2058 | |
f4ae0f5e | 2059 | Defines how to produce the *.so (or equivalent) files. |
1e44e2bf | 2060 | |
2061 | =cut | |
2062 | ||
2063 | sub dynamic_lib { | |
2064 | my($self, %attribs) = @_; | |
2065 | unless (ref $self){ | |
2066 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
2067 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
2068 | } | |
2069 | return '' unless $self->needs_linking(); #might be because of a subdir | |
2070 | ||
2071 | return '' unless $self->has_link_code; | |
2072 | ||
2073 | my($otherldflags) = $attribs{OTHERLDFLAGS} || ""; | |
2074 | my($inst_dynamic_dep) = $attribs{INST_DYNAMIC_DEP} || ""; | |
2075 | my($armaybe) = $attribs{ARMAYBE} || $self->{ARMAYBE} || ":"; | |
2076 | my($ldfrom) = '$(LDFROM)'; | |
f4ae0f5e | 2077 | $armaybe = 'ar' if ($^O eq 'dec_osf' and $armaybe eq ':'); |
1e44e2bf | 2078 | my(@m); |
2079 | push(@m,' | |
2080 | # This section creates the dynamically loadable $(INST_DYNAMIC) | |
2081 | # from $(OBJECT) and possibly $(MYEXTLIB). | |
2082 | ARMAYBE = '.$armaybe.' | |
2083 | OTHERLDFLAGS = '.$otherldflags.' | |
2084 | INST_DYNAMIC_DEP = '.$inst_dynamic_dep.' | |
2085 | ||
2086 | $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)/.exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP) | |
2087 | '); | |
2088 | if ($armaybe ne ':'){ | |
2089 | $ldfrom = 'tmp$(LIB_EXT)'; | |
2090 | push(@m,' $(ARMAYBE) cr '.$ldfrom.' $(OBJECT)'."\n"); | |
2091 | push(@m,' $(RANLIB) '."$ldfrom\n"); | |
2092 | } | |
f4ae0f5e | 2093 | $ldfrom = "-all $ldfrom -none" if ($^O eq 'dec_osf'); |
1e44e2bf | 2094 | push(@m,' LD_RUN_PATH="$(LD_RUN_PATH)" $(LD) -o $@ $(LDDLFLAGS) '.$ldfrom. |
2095 | ' $(OTHERLDFLAGS) $(MYEXTLIB) $(LDLOADLIBS) $(EXPORT_LIST) $(PERL_ARCHIVE)'); | |
2096 | push @m, ' | |
2097 | $(CHMOD) 755 $@ | |
2098 | '; | |
2099 | ||
2100 | push @m, $self->dir_target('$(INST_ARCHAUTODIR)'); | |
2101 | join('',@m); | |
2102 | } | |
2103 | ||
f4ae0f5e | 2104 | =item static (o) |
1e44e2bf | 2105 | |
f4ae0f5e | 2106 | Defines the static target. |
1e44e2bf | 2107 | |
2108 | =cut | |
2109 | ||
2110 | sub static { | |
2111 | # --- Static Loading Sections --- | |
2112 | ||
2113 | my($self) = shift; | |
2114 | unless (ref $self){ | |
2115 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
2116 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
2117 | } | |
2118 | ' | |
f4ae0f5e | 2119 | ## $(INST_PM) has been moved to the all: target. |
2120 | ## It remains here for awhile to allow for old usage: "make static" | |
2121 | #static :: '.$self->{MAKEFILE}.' $(INST_STATIC) $(INST_PM) | |
2122 | static :: '.$self->{MAKEFILE}.' $(INST_STATIC) | |
2123 | '.$self->{NOECHO}.'$(NOOP) | |
1e44e2bf | 2124 | '; |
2125 | } | |
2126 | ||
f4ae0f5e | 2127 | =item static_lib (o) |
1e44e2bf | 2128 | |
f4ae0f5e | 2129 | Defines how to produce the *.a (or equivalent) files. |
1e44e2bf | 2130 | |
2131 | =cut | |
2132 | ||
2133 | sub static_lib { | |
2134 | my($self) = @_; | |
2135 | unless (ref $self){ | |
2136 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
2137 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
2138 | } | |
2139 | # Come to think of it, if there are subdirs with linkcode, we still have no INST_STATIC | |
2140 | # return '' unless $self->needs_linking(); #might be because of a subdir | |
2141 | ||
2142 | return '' unless $self->has_link_code; | |
2143 | ||
2144 | my(@m); | |
2145 | push(@m, <<'END'); | |
2146 | $(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)/.exists | |
2147 | END | |
2148 | # If this extension has it's own library (eg SDBM_File) | |
2149 | # then copy that to $(INST_STATIC) and add $(OBJECT) into it. | |
2150 | push(@m, "\t$self->{CP} \$(MYEXTLIB) \$\@\n") if $self->{MYEXTLIB}; | |
2151 | ||
2152 | push @m, | |
2153 | q{ $(AR) $(AR_STATIC_ARGS) $@ $(OBJECT) && $(RANLIB) $@ | |
2154 | }.$self->{NOECHO}.q{echo "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)/extralibs.ld | |
2155 | $(CHMOD) 755 $@ | |
2156 | }; | |
2157 | ||
2158 | # Old mechanism - still available: | |
2159 | ||
2160 | push @m, "\t$self->{NOECHO}".q{echo "$(EXTRALIBS)" >> $(PERL_SRC)/ext.libs}."\n\n" | |
2161 | if $self->{PERL_SRC}; | |
2162 | ||
2163 | push @m, $self->dir_target('$(INST_ARCHAUTODIR)'); | |
2164 | join('', "\n",@m); | |
2165 | } | |
2166 | ||
f4ae0f5e | 2167 | # =item installpm |
2168 | # | |
2169 | # Cares for copying and autosplitting the files in PM (which may be more | |
2170 | # than just *.pm files) into the INST_* directories. | |
2171 | # | |
2172 | # =cut | |
2173 | # | |
2174 | # sub installpm { | |
2175 | # my($self, %attribs) = @_; | |
2176 | # unless (ref $self){ | |
2177 | # ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
2178 | # $self = $ExtUtils::MakeMaker::Parent[-1]; | |
2179 | # } | |
2180 | # # By default .pm files are split into the architecture independent | |
2181 | # # library. This is a good thing. If a specific module requires that | |
2182 | # # its .pm files are split into the architecture specific library | |
2183 | # # then it should use: installpm => {SPLITLIB=>'$(INST_ARCHLIB)'} | |
2184 | # # Note that installperl currently interferes with this (Config.pm) | |
2185 | # # User can disable split by saying: installpm => {SPLITLIB=>''} | |
2186 | # my($splitlib) = '$(INST_LIB)'; # NOT arch specific by default | |
2187 | # $splitlib = $attribs{SPLITLIB} if exists $attribs{SPLITLIB}; | |
2188 | # my(@m, $dist); | |
2189 | # push @m, "inst_pm :: \$(INST_PM)\n\n"; | |
2190 | # foreach $dist (sort keys %{$self->{PM}}){ | |
2191 | # my($inst) = $self->{PM}->{$dist}; | |
2192 | # push(@m, "\n# installpm: $dist => $inst, splitlib=$splitlib\n"); | |
2193 | # push(@m, $self->installpm_x($dist, $inst, $splitlib)); | |
2194 | # push(@m, "\n"); | |
2195 | # } | |
2196 | # join('', @m); | |
2197 | # } | |
2198 | # | |
2199 | # =item installpm_x | |
2200 | # | |
2201 | # Helper subroutine to installpm. | |
2202 | # | |
2203 | # =cut | |
2204 | # | |
2205 | # sub installpm_x { # called by installpm per file | |
2206 | # my($self, $dist, $inst, $splitlib) = @_; | |
2207 | # unless (ref $self){ | |
2208 | # ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
2209 | # $self = $ExtUtils::MakeMaker::Parent[-1]; | |
2210 | # } | |
2211 | # if ($inst =~ m,[:\#],){ | |
2212 | # warn "Warning: 'make' would have problems processing this file: '$inst', SKIPPED\n"; | |
2213 | # return ''; | |
2214 | # } | |
2215 | # my($instdir) = $inst =~ m|(.*)/|; | |
2216 | # my(@m); | |
2217 | # push(@m," | |
2218 | # $inst: $dist $self->{FIRST_MAKEFILE} $instdir/.exists \$(INST_ARCHAUTODIR)/.exists | |
2219 | # $self->{NOECHO}$self->{RM_F}".' $@ | |
2220 | # $(UMASK_NULL) && '."$self->{CP} $dist".' $@ | |
2221 | # '); | |
2222 | # push(@m, "\t$self->{NOECHO}\$(AUTOSPLITFILE) \$@ $splitlib/auto\n") | |
2223 | # if ($splitlib and $inst =~ m/\.pm$/); | |
2224 | # | |
2225 | # push @m, $self->dir_target($instdir); | |
2226 | # join('', @m); | |
2227 | # } | |
1e44e2bf | 2228 | |
f4ae0f5e | 2229 | =item manifypods (o) |
1e44e2bf | 2230 | |
f4ae0f5e | 2231 | Defines targets and routines to translate the pods into manpages and |
2232 | put them into the INST_* directories. | |
1e44e2bf | 2233 | |
2234 | =cut | |
2235 | ||
2236 | sub manifypods { | |
2237 | my($self, %attribs) = @_; | |
2238 | unless (ref $self){ | |
2239 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
2240 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
2241 | } | |
2242 | return "\nmanifypods :\n" unless %{$self->{MAN3PODS}}; | |
2243 | my($dist); | |
2244 | my($pod2man_exe); | |
2245 | if (defined $self->{PERL_SRC}) { | |
2246 | $pod2man_exe = $self->catfile($self->{PERL_SRC},'pod','pod2man'); | |
2247 | } else { | |
2248 | $pod2man_exe = $self->catfile($Config{bin},'pod2man'); | |
2249 | } | |
2250 | unless ($self->perl_script($pod2man_exe)) { | |
2251 | # No pod2man but some MAN3PODS to be installed | |
2252 | print <<END; | |
2253 | ||
2254 | Warning: I could not locate your pod2man program. Please make sure, | |
2255 | your pod2man program is in your PATH before you execute 'make' | |
2256 | ||
2257 | END | |
2258 | $pod2man_exe = "-S pod2man"; | |
2259 | } | |
2260 | my(@m); | |
2261 | push @m, | |
2262 | qq[POD2MAN_EXE = $pod2man_exe\n], | |
2263 | q[POD2MAN = $(PERL) -we '%m=@ARGV;for (keys %m){' \\ | |
2264 | -e 'next if -e $$m{$$_} && -M $$m{$$_} < -M $$_ && -M $$m{$$_} < -M "].$self->{MAKEFILE}.q[";' \\ | |
2265 | -e 'print "Manifying $$m{$$_}\n";' \\ | |
2266 | -e 'system("$$^X \\"-I$(PERL_ARCHLIB)\\" \\"-I$(PERL_LIB)\\" $(POD2MAN_EXE) $$_>$$m{$$_}")==0 or warn "Couldn\\047t install $$m{$$_}\n";' \\ | |
2267 | -e 'chmod 0644, $$m{$$_} or warn "chmod 644 $$m{$$_}: $$!\n";}' | |
2268 | ]; | |
2269 | push @m, "\nmanifypods : "; | |
2270 | push @m, join " \\\n\t", keys %{$self->{MAN1PODS}}, keys %{$self->{MAN3PODS}}; | |
2271 | ||
2272 | push(@m,"\n"); | |
2273 | if (%{$self->{MAN1PODS}} || %{$self->{MAN3PODS}}) { | |
2274 | push @m, "\t$self->{NOECHO}\$(POD2MAN) \\\n\t"; | |
2275 | push @m, join " \\\n\t", %{$self->{MAN1PODS}}, %{$self->{MAN3PODS}}; | |
2276 | } | |
2277 | join('', @m); | |
2278 | } | |
2279 | ||
f4ae0f5e | 2280 | =item processPL (o) |
1e44e2bf | 2281 | |
f4ae0f5e | 2282 | Defines targets to run *.PL files. |
1e44e2bf | 2283 | |
2284 | =cut | |
2285 | ||
2286 | sub processPL { | |
2287 | my($self) = shift; | |
2288 | unless (ref $self){ | |
2289 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
2290 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
2291 | } | |
2292 | return "" unless $self->{PL_FILES}; | |
2293 | my(@m, $plfile); | |
2294 | foreach $plfile (sort keys %{$self->{PL_FILES}}) { | |
2295 | push @m, " | |
2296 | all :: $self->{PL_FILES}->{$plfile} | |
2297 | ||
2298 | $self->{PL_FILES}->{$plfile} :: $plfile | |
2299 | \$(PERL) -I\$(INST_ARCHLIB) -I\$(INST_LIB) -I\$(PERL_ARCHLIB) -I\$(PERL_LIB) $plfile | |
2300 | "; | |
2301 | } | |
2302 | join "", @m; | |
2303 | } | |
2304 | ||
f4ae0f5e | 2305 | =item installbin (o) |
1e44e2bf | 2306 | |
f4ae0f5e | 2307 | Defines targets to install EXE_FILES. |
1e44e2bf | 2308 | |
2309 | =cut | |
2310 | ||
2311 | sub installbin { | |
2312 | my($self) = shift; | |
2313 | return "" unless $self->{EXE_FILES} && ref $self->{EXE_FILES} eq "ARRAY"; | |
2314 | return "" unless @{$self->{EXE_FILES}}; | |
2315 | my(@m, $from, $to, %fromto, @to); | |
2316 | push @m, $self->dir_target(qw[$(INST_EXE)]); | |
2317 | for $from (@{$self->{EXE_FILES}}) { | |
2318 | my($path)= '$(INST_EXE)/' . basename($from); | |
2319 | local($_) = $path; # for backwards compatibility | |
2320 | $to = $self->libscan($path); | |
2321 | print "libscan($from) => '$to'\n" if ($Verbose >=2); | |
2322 | $fromto{$from}=$to; | |
2323 | } | |
2324 | @to = values %fromto; | |
2325 | push(@m, " | |
2326 | EXE_FILES = @{$self->{EXE_FILES}} | |
2327 | ||
2328 | all :: @to | |
2329 | ||
2330 | realclean :: | |
2331 | $self->{RM_F} @to | |
2332 | "); | |
2333 | ||
2334 | while (($from,$to) = each %fromto) { | |
f4ae0f5e | 2335 | last unless defined $from; |
1e44e2bf | 2336 | my $todir = dirname($to); |
2337 | push @m, " | |
2338 | $to: $from $self->{MAKEFILE} $todir/.exists | |
f4ae0f5e | 2339 | $self->{NOECHO}$self->{RM_F} $to |
1e44e2bf | 2340 | $self->{CP} $from $to |
2341 | "; | |
2342 | } | |
2343 | join "", @m; | |
2344 | } | |
2345 | ||
f4ae0f5e | 2346 | =item subdirs (o) |
1e44e2bf | 2347 | |
f4ae0f5e | 2348 | Defines targets to process subdirectories. |
1e44e2bf | 2349 | |
2350 | =cut | |
2351 | ||
2352 | sub subdirs { | |
2353 | # --- Sub-directory Sections --- | |
2354 | my($self) = shift; | |
2355 | unless (ref $self){ | |
2356 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
2357 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
2358 | } | |
2359 | my(@m,$dir); | |
2360 | # This method provides a mechanism to automatically deal with | |
2361 | # subdirectories containing further Makefile.PL scripts. | |
2362 | # It calls the subdir_x() method for each subdirectory. | |
2363 | foreach $dir (@{$self->{DIR}}){ | |
2364 | push(@m, $self->subdir_x($dir)); | |
2365 | #### print "Including $dir subdirectory\n"; | |
2366 | } | |
2367 | if (@m){ | |
2368 | unshift(@m, " | |
2369 | # The default clean, realclean and test targets in this Makefile | |
2370 | # have automatically been given entries for each subdir. | |
2371 | ||
2372 | "); | |
2373 | } else { | |
2374 | push(@m, "\n# none") | |
2375 | } | |
2376 | join('',@m); | |
2377 | } | |
2378 | ||
f4ae0f5e | 2379 | =item subdir_x (o) |
1e44e2bf | 2380 | |
f4ae0f5e | 2381 | Helper subroutine for subdirs |
1e44e2bf | 2382 | |
2383 | =cut | |
2384 | ||
2385 | sub subdir_x { | |
2386 | my($self, $subdir) = @_; | |
2387 | unless (ref $self){ | |
2388 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
2389 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
2390 | } | |
2391 | my(@m); | |
2392 | qq{ | |
2393 | ||
2394 | subdirs :: | |
2395 | $self->{NOECHO}-cd $subdir && \$(MAKE) all \$(PASTHRU) | |
2396 | ||
2397 | }; | |
2398 | } | |
2399 | ||
f4ae0f5e | 2400 | =item clean (o) |
1e44e2bf | 2401 | |
f4ae0f5e | 2402 | Defines the clean target. |
1e44e2bf | 2403 | |
2404 | =cut | |
2405 | ||
2406 | sub clean { | |
2407 | # --- Cleanup and Distribution Sections --- | |
2408 | ||
2409 | my($self, %attribs) = @_; | |
2410 | unless (ref $self){ | |
2411 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
2412 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
2413 | } | |
2414 | my(@m,$dir); | |
2415 | push(@m, ' | |
2416 | # Delete temporary files but do not touch installed files. We don\'t delete | |
2417 | # the Makefile here so a later make realclean still has a makefile to use. | |
2418 | ||
2419 | clean :: | |
2420 | '); | |
2421 | # clean subdirectories first | |
2422 | for $dir (@{$self->{DIR}}) { | |
2423 | push @m, "\t-cd $dir && test -f $self->{MAKEFILE} && \$(MAKE) clean\n"; | |
2424 | } | |
2425 | ||
2426 | my(@otherfiles) = values %{$self->{XS}}; # .c files from *.xs files | |
2427 | push(@otherfiles, $attribs{FILES}) if $attribs{FILES}; | |
2428 | push(@otherfiles, qw[./blib $(MAKE_APERL_FILE) $(INST_ARCHAUTODIR)/extralibs.all | |
f4ae0f5e | 2429 | perlmain.c mon.out core so_locations pm_to_blib |
2430 | *~ */*~ */*/*~ *$(OBJ_EXT) *$(LIB_EXT) perl.exe | |
2431 | $(BOOTSTRAP) $(BASEEXT).bso $(BASEEXT).def | |
2432 | $(BASEEXT).exp | |
1e44e2bf | 2433 | ]); |
2434 | push @m, "\t-$self->{RM_RF} @otherfiles\n"; | |
2435 | # See realclean and ext/utils/make_ext for usage of Makefile.old | |
2436 | push(@m, | |
2437 | "\t-$self->{MV} $self->{MAKEFILE} $self->{MAKEFILE}.old 2>/dev/null\n"); | |
2438 | push(@m, | |
2439 | "\t$attribs{POSTOP}\n") if $attribs{POSTOP}; | |
2440 | join("", @m); | |
2441 | } | |
2442 | ||
f4ae0f5e | 2443 | =item realclean (o) |
1e44e2bf | 2444 | |
f4ae0f5e | 2445 | Defines the realclean target. |
1e44e2bf | 2446 | |
2447 | =cut | |
2448 | ||
2449 | sub realclean { | |
2450 | my($self, %attribs) = @_; | |
2451 | unless (ref $self){ | |
2452 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
2453 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
2454 | } | |
2455 | my(@m); | |
2456 | push(@m,' | |
2457 | # Delete temporary files (via clean) and also delete installed files | |
2458 | realclean purge :: clean | |
2459 | '); | |
2460 | # realclean subdirectories first (already cleaned) | |
2461 | my $sub = "\t-cd %s && test -f %s && \$(MAKE) %s realclean\n"; | |
2462 | foreach(@{$self->{DIR}}){ | |
2463 | push(@m, sprintf($sub,$_,"$self->{MAKEFILE}.old","-f $self->{MAKEFILE}.old")); | |
2464 | push(@m, sprintf($sub,$_,"$self->{MAKEFILE}",'')); | |
2465 | } | |
2466 | push(@m, " $self->{RM_RF} \$(INST_AUTODIR) \$(INST_ARCHAUTODIR)\n"); | |
2467 | push(@m, " $self->{RM_F} \$(INST_DYNAMIC) \$(INST_BOOT)\n"); | |
f4ae0f5e | 2468 | # push(@m, " $self->{RM_F} \$(INST_STATIC) \$(INST_PM)\n"); |
2469 | push(@m, " $self->{RM_F} \$(INST_STATIC)\n"); | |
1e44e2bf | 2470 | my(@otherfiles) = ($self->{MAKEFILE}, |
2471 | "$self->{MAKEFILE}.old"); # Makefiles last | |
2472 | push(@otherfiles, $attribs{FILES}) if $attribs{FILES}; | |
2473 | push(@m, " $self->{RM_RF} @otherfiles\n") if @otherfiles; | |
2474 | push(@m, " $attribs{POSTOP}\n") if $attribs{POSTOP}; | |
2475 | join("", @m); | |
2476 | } | |
2477 | ||
f4ae0f5e | 2478 | =item dist_basics (o) |
1e44e2bf | 2479 | |
f4ae0f5e | 2480 | Defines the targets distclean, distcheck, skipcheck, manifest. |
1e44e2bf | 2481 | |
2482 | =cut | |
2483 | ||
2484 | sub dist_basics { | |
2485 | my($self) = shift; | |
2486 | unless (ref $self){ | |
2487 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
2488 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
2489 | } | |
2490 | my @m; | |
2491 | push @m, q{ | |
2492 | distclean :: realclean distcheck | |
2493 | }; | |
2494 | ||
2495 | push @m, q{ | |
2496 | distcheck : | |
2497 | $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "&fullcheck";' \\ | |
2498 | -e 'fullcheck();' | |
2499 | }; | |
2500 | ||
2501 | push @m, q{ | |
2502 | skipcheck : | |
2503 | $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "&skipcheck";' \\ | |
2504 | -e 'skipcheck();' | |
2505 | }; | |
2506 | ||
2507 | push @m, q{ | |
2508 | manifest : | |
2509 | $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "&mkmanifest";' \\ | |
2510 | -e 'mkmanifest();' | |
2511 | }; | |
2512 | join "", @m; | |
2513 | } | |
2514 | ||
f4ae0f5e | 2515 | =item dist_core (o) |
1e44e2bf | 2516 | |
f4ae0f5e | 2517 | Defeines the targets dist, tardist, zipdist, uutardist, shdist |
1e44e2bf | 2518 | |
2519 | =cut | |
2520 | ||
2521 | sub dist_core { | |
2522 | my($self) = shift; | |
2523 | unless (ref $self){ | |
2524 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
2525 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
2526 | } | |
2527 | my @m; | |
2528 | push @m, q{ | |
2529 | dist : $(DIST_DEFAULT) | |
f4ae0f5e | 2530 | }.$self->{NOECHO}.q{$(PERL) -le 'print "Warning: Makefile possibly out of date with $$vf" if ' \ |
2531 | -e '-e ($$vf="$(VERSION_FROM)") and -M $$vf < -M "}.$self->{MAKEFILE}.q{";' | |
1e44e2bf | 2532 | |
f4ae0f5e | 2533 | tardist : $(DISTVNAME).tar$(SUFFIX) |
1e44e2bf | 2534 | |
f4ae0f5e | 2535 | zipdist : $(DISTVNAME).zip |
2536 | ||
2537 | $(DISTVNAME).tar$(SUFFIX) : distdir | |
1e44e2bf | 2538 | $(PREOP) |
2539 | $(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME) | |
2540 | $(RM_RF) $(DISTVNAME) | |
2541 | $(COMPRESS) $(DISTVNAME).tar | |
2542 | $(POSTOP) | |
2543 | ||
f4ae0f5e | 2544 | $(DISTVNAME).zip : distdir |
2545 | $(PREOP) | |
2546 | $(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME) | |
2547 | $(POSTOP) | |
2548 | ||
2549 | uutardist : $(DISTVNAME).tar$(SUFFIX) | |
2550 | uuencode $(DISTVNAME).tar$(SUFFIX) \\ | |
2551 | $(DISTVNAME).tar$(SUFFIX) > \\ | |
2552 | $(DISTVNAME).tar$(SUFFIX)_uu | |
1e44e2bf | 2553 | |
2554 | shdist : distdir | |
2555 | $(PREOP) | |
2556 | $(SHAR) $(DISTVNAME) > $(DISTVNAME).shar | |
2557 | $(RM_RF) $(DISTVNAME) | |
2558 | $(POSTOP) | |
2559 | }; | |
2560 | join "", @m; | |
2561 | } | |
2562 | ||
f4ae0f5e | 2563 | =item dist_dir (o) |
1e44e2bf | 2564 | |
f4ae0f5e | 2565 | Defines the scratch directory target that will hold the distribution |
2566 | before tar-ing (or shar-ing). | |
1e44e2bf | 2567 | |
2568 | =cut | |
2569 | ||
2570 | sub dist_dir { | |
2571 | my($self) = shift; | |
2572 | unless (ref $self){ | |
2573 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
2574 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
2575 | } | |
2576 | my @m; | |
2577 | push @m, q{ | |
2578 | distdir : | |
2579 | $(RM_RF) $(DISTVNAME) | |
2580 | $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "/mani/";' \\ | |
2581 | -e 'manicopy(maniread(),"$(DISTVNAME)", "$(DIST_CP)");' | |
2582 | }; | |
2583 | join "", @m; | |
2584 | } | |
2585 | ||
f4ae0f5e | 2586 | =item dist_test (o) |
1e44e2bf | 2587 | |
f4ae0f5e | 2588 | Defines a target that produces the distribution in the |
2589 | scratchdirectory, and runs 'perl Makefile.PL; make ;make test' in that | |
2590 | subdirectory. | |
1e44e2bf | 2591 | |
2592 | =cut | |
2593 | ||
2594 | sub dist_test { | |
2595 | my($self) = shift; | |
2596 | unless (ref $self){ | |
2597 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
2598 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
2599 | } | |
2600 | my @m; | |
2601 | push @m, q{ | |
2602 | disttest : distdir | |
2603 | cd $(DISTVNAME) && $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) Makefile.PL | |
2604 | cd $(DISTVNAME) && $(MAKE) | |
2605 | cd $(DISTVNAME) && $(MAKE) test | |
2606 | }; | |
2607 | join "", @m; | |
2608 | } | |
2609 | ||
f4ae0f5e | 2610 | =item dist_ci (o) |
1e44e2bf | 2611 | |
f4ae0f5e | 2612 | Defines a check in target for RCS. |
1e44e2bf | 2613 | |
2614 | =cut | |
2615 | ||
2616 | sub dist_ci { | |
2617 | my($self) = shift; | |
2618 | unless (ref $self){ | |
2619 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
2620 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
2621 | } | |
2622 | my @m; | |
2623 | push @m, q{ | |
2624 | ci : | |
2625 | $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "&maniread";' \\ | |
2626 | -e '@all = keys %{ maniread() };' \\ | |
2627 | -e 'print("Executing $(CI) @all\n"); system("$(CI) @all");' \\ | |
2628 | -e 'print("Executing $(RCS_LABEL) ...\n"); system("$(RCS_LABEL) @all");' | |
2629 | }; | |
2630 | join "", @m; | |
2631 | } | |
2632 | ||
f4ae0f5e | 2633 | =item install (o) |
1e44e2bf | 2634 | |
f4ae0f5e | 2635 | Defines the install target. |
1e44e2bf | 2636 | |
2637 | =cut | |
2638 | ||
2639 | sub install { | |
2640 | my($self, %attribs) = @_; | |
2641 | unless (ref $self){ | |
2642 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
2643 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
2644 | } | |
2645 | my(@m); | |
2646 | ||
2647 | push @m, q{ | |
2648 | install :: all pure_install doc_install | |
2649 | ||
a5f75d66 | 2650 | install_perl :: all pure_perl_install doc_perl_install |
1e44e2bf | 2651 | |
a5f75d66 | 2652 | install_site :: all pure_site_install doc_site_install |
1e44e2bf | 2653 | |
2654 | install_ :: install_site | |
2655 | @echo INSTALLDIRS not defined, defaulting to INSTALLDIRS=site | |
2656 | ||
2657 | pure_install :: pure_$(INSTALLDIRS)_install | |
2658 | ||
2659 | doc_install :: doc_$(INSTALLDIRS)_install | |
2660 | }.$self->{NOECHO}.q{echo Appending installation info to $(INSTALLARCHLIB)/perllocal.pod | |
2661 | ||
2662 | pure__install : pure_site_install | |
2663 | @echo INSTALLDIRS not defined, defaulting to INSTALLDIRS=site | |
2664 | ||
2665 | doc__install : doc_site_install | |
2666 | @echo INSTALLDIRS not defined, defaulting to INSTALLDIRS=site | |
2667 | ||
2668 | pure_perl_install :: | |
2669 | }.$self->{NOECHO}.q{$(MOD_INSTALL) \ | |
2670 | read }.$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q{ \ | |
2671 | write }.$self->catfile('$(INSTALLARCHLIB)','auto','$(FULLEXT)','.packlist').q{ \ | |
2672 | $(INST_LIB) $(INSTALLPRIVLIB) \ | |
2673 | $(INST_ARCHLIB) $(INSTALLARCHLIB) \ | |
2674 | $(INST_EXE) $(INSTALLBIN) \ | |
2675 | $(INST_MAN1DIR) $(INSTALLMAN1DIR) \ | |
2676 | $(INST_MAN3DIR) $(INSTALLMAN3DIR) | |
2677 | }.$self->{NOECHO}.q{$(WARN_IF_OLD_PACKLIST) \ | |
2678 | }.$self->catdir('$(SITEARCHEXP)','auto','$(FULLEXT)').q{ | |
2679 | ||
2680 | ||
2681 | pure_site_install :: | |
2682 | }.$self->{NOECHO}.q{$(MOD_INSTALL) \ | |
2683 | read }.$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q{ \ | |
2684 | write }.$self->catfile('$(INSTALLSITEARCH)','auto','$(FULLEXT)','.packlist').q{ \ | |
2685 | $(INST_LIB) $(INSTALLSITELIB) \ | |
2686 | $(INST_ARCHLIB) $(INSTALLSITEARCH) \ | |
2687 | $(INST_EXE) $(INSTALLBIN) \ | |
2688 | $(INST_MAN1DIR) $(INSTALLMAN1DIR) \ | |
2689 | $(INST_MAN3DIR) $(INSTALLMAN3DIR) | |
2690 | }.$self->{NOECHO}.q{$(WARN_IF_OLD_PACKLIST) \ | |
2691 | }.$self->catdir('$(PERL_ARCHLIB)','auto','$(FULLEXT)').q{ | |
2692 | ||
2693 | doc_perl_install :: | |
2694 | }.$self->{NOECHO}.q{$(DOC_INSTALL) \ | |
2695 | "$(NAME)" \ | |
2696 | "installed into" "$(INSTALLPRIVLIB)" \ | |
2697 | LINKTYPE "$(LINKTYPE)" \ | |
2698 | VERSION "$(VERSION)" \ | |
2699 | EXE_FILES "$(EXE_FILES)" \ | |
2700 | >> }.$self->catfile('$(INSTALLARCHLIB)','perllocal.pod').q{ | |
2701 | ||
2702 | doc_site_install :: | |
2703 | }.$self->{NOECHO}.q{$(DOC_INSTALL) \ | |
2704 | "Module $(NAME)" \ | |
2705 | "installed into" "$(INSTALLSITELIB)" \ | |
2706 | LINKTYPE "$(LINKTYPE)" \ | |
2707 | VERSION "$(VERSION)" \ | |
2708 | EXE_FILES "$(EXE_FILES)" \ | |
2709 | >> }.$self->catfile('$(INSTALLARCHLIB)','perllocal.pod').q{ | |
2710 | ||
2711 | }; | |
2712 | ||
2713 | push @m, q{ | |
2714 | uninstall :: uninstall_from_$(INSTALLDIRS)dirs | |
2715 | ||
2716 | uninstall_from_perldirs :: | |
2717 | }.$self->{NOECHO}. | |
2718 | q{$(UNINSTALL) }.$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q{ | |
2719 | ||
2720 | uninstall_from_sitedirs :: | |
2721 | }.$self->{NOECHO}. | |
2722 | q{$(UNINSTALL) }.$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q{ | |
2723 | }; | |
2724 | ||
2725 | join("",@m); | |
2726 | } | |
2727 | ||
f4ae0f5e | 2728 | =item force (o) |
1e44e2bf | 2729 | |
f4ae0f5e | 2730 | Just writes FORCE: |
1e44e2bf | 2731 | |
2732 | =cut | |
2733 | ||
2734 | sub force { | |
2735 | my($self) = shift; | |
2736 | unless (ref $self){ | |
2737 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
2738 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
2739 | } | |
2740 | '# Phony target to force checking subdirectories. | |
2741 | FORCE: | |
2742 | '; | |
2743 | } | |
2744 | ||
f4ae0f5e | 2745 | =item perldepend (o) |
1e44e2bf | 2746 | |
f4ae0f5e | 2747 | Defines the dependency from all *.h files that come with the perl |
2748 | distribution. | |
1e44e2bf | 2749 | |
2750 | =cut | |
2751 | ||
2752 | sub perldepend { | |
2753 | my($self) = shift; | |
2754 | unless (ref $self){ | |
2755 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
2756 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
2757 | } | |
2758 | my(@m); | |
2759 | push(@m,' | |
2760 | PERL_HDRS = $(PERL_INC)/EXTERN.h $(PERL_INC)/INTERN.h \ | |
2761 | $(PERL_INC)/XSUB.h $(PERL_INC)/av.h $(PERL_INC)/cop.h \ | |
2762 | $(PERL_INC)/cv.h $(PERL_INC)/dosish.h $(PERL_INC)/embed.h \ | |
2763 | $(PERL_INC)/form.h $(PERL_INC)/gv.h $(PERL_INC)/handy.h \ | |
2764 | $(PERL_INC)/hv.h $(PERL_INC)/keywords.h $(PERL_INC)/mg.h \ | |
2765 | $(PERL_INC)/op.h $(PERL_INC)/opcode.h $(PERL_INC)/patchlevel.h \ | |
2766 | $(PERL_INC)/perl.h $(PERL_INC)/perly.h $(PERL_INC)/pp.h \ | |
2767 | $(PERL_INC)/proto.h $(PERL_INC)/regcomp.h $(PERL_INC)/regexp.h \ | |
2768 | $(PERL_INC)/scope.h $(PERL_INC)/sv.h $(PERL_INC)/unixish.h \ | |
2769 | $(PERL_INC)/util.h $(PERL_INC)/config.h | |
2770 | ||
2771 | '); | |
2772 | ||
2773 | push @m, ' | |
2774 | $(OBJECT) : $(PERL_HDRS) | |
2775 | ' if $self->{OBJECT}; | |
2776 | ||
2777 | push(@m,' | |
2778 | # Check for unpropogated config.sh changes. Should never happen. | |
2779 | # We do NOT just update config.h because that is not sufficient. | |
2780 | # An out of date config.h is not fatal but complains loudly! | |
2781 | $(PERL_INC)/config.h: $(PERL_SRC)/config.sh | |
2782 | -'.$self->{NOECHO}.'echo "Warning: $(PERL_INC)/config.h out of date with $(PERL_SRC)/config.sh"; false | |
2783 | ||
2784 | $(PERL_ARCHLIB)/Config.pm: $(PERL_SRC)/config.sh | |
2785 | '.$self->{NOECHO}.'echo "Warning: $(PERL_ARCHLIB)/Config.pm may be out of date with $(PERL_SRC)/config.sh" | |
2786 | cd $(PERL_SRC) && $(MAKE) lib/Config.pm | |
2787 | ') if $self->{PERL_SRC}; | |
2788 | ||
2789 | push(@m, join(" ", values %{$self->{XS}})." : \$(XSUBPPDEPS)\n") | |
2790 | if %{$self->{XS}}; | |
2791 | join("\n",@m); | |
2792 | } | |
2793 | ||
f4ae0f5e | 2794 | =item makefile (o) |
1e44e2bf | 2795 | |
f4ae0f5e | 2796 | Defines how to rewrite the Makefile. |
1e44e2bf | 2797 | |
2798 | =cut | |
2799 | ||
2800 | sub makefile { | |
2801 | my($self) = shift; | |
2802 | unless (ref $self){ | |
2803 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
2804 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
2805 | } | |
2806 | my @m; | |
2807 | # We do not know what target was originally specified so we | |
2808 | # must force a manual rerun to be sure. But as it should only | |
2809 | # happen very rarely it is not a significant problem. | |
2810 | push @m, ' | |
2811 | $(OBJECT) : $(FIRST_MAKEFILE) | |
2812 | ' if $self->{OBJECT}; | |
2813 | ||
f4ae0f5e | 2814 | push @m, q{ |
1e44e2bf | 2815 | # We take a very conservative approach here, but it\'s worth it. |
2816 | # We move Makefile to Makefile.old here to avoid gnu make looping. | |
f4ae0f5e | 2817 | }.$self->{MAKEFILE}.q{ : Makefile.PL $(CONFIGDEP) |
2818 | }.$self->{NOECHO}.q{echo "Makefile out-of-date with respect to $?" | |
2819 | }.$self->{NOECHO}.q{echo "Cleaning current config before rebuilding Makefile..." | |
2820 | -}.$self->{NOECHO}.q{mv }."$self->{MAKEFILE} $self->{MAKEFILE}.old".q{ | |
2821 | -$(MAKE) -f }.$self->{MAKEFILE}.q{.old clean >/dev/null 2>&1 || true | |
2822 | $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" Makefile.PL }.join(" ",map(qq["$_"],@ARGV)).q{ | |
2823 | }.$self->{NOECHO}.q{echo ">>> Your Makefile has been rebuilt. <<<" | |
2824 | }.$self->{NOECHO}.q{echo ">>> Please rerun the make command. <<<"; false | |
2825 | ||
2826 | # To change behavior to :: would be nice, but would break Tk b9.02 | |
2827 | # so you find such a warning below the dist target. | |
2828 | #}.$self->{MAKEFILE}.q{ :: $(VERSION_FROM) | |
2829 | # }.$self->{NOECHO}.q{echo "Warning: Makefile possibly out of date with $(VERSION_FROM)" | |
2830 | }; | |
1e44e2bf | 2831 | |
2832 | join "", @m; | |
2833 | } | |
2834 | ||
f4ae0f5e | 2835 | =item staticmake (o) |
1e44e2bf | 2836 | |
f4ae0f5e | 2837 | Calls makeaperl. |
1e44e2bf | 2838 | |
2839 | =cut | |
2840 | ||
2841 | sub staticmake { | |
2842 | my($self, %attribs) = @_; | |
2843 | unless (ref $self){ | |
2844 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
2845 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
2846 | } | |
2847 | my(@static); | |
2848 | ||
2849 | my(@searchdirs)=($self->{PERL_ARCHLIB}, $self->{SITEARCHEXP}, $self->{INST_ARCHLIB}); | |
2850 | ||
2851 | # And as it's not yet built, we add the current extension | |
2852 | # but only if it has some C code (or XS code, which implies C code) | |
2853 | if (@{$self->{C}}) { | |
f4ae0f5e | 2854 | @static = $self->catfile($self->{INST_ARCHLIB}, |
2855 | "auto", | |
2856 | $self->{FULLEXT}, | |
2857 | "$self->{BASEEXT}$self->{LIB_EXT}" | |
2858 | ); | |
1e44e2bf | 2859 | } |
2860 | ||
2861 | # Either we determine now, which libraries we will produce in the | |
2862 | # subdirectories or we do it at runtime of the make. | |
2863 | ||
2864 | # We could ask all subdir objects, but I cannot imagine, why it | |
2865 | # would be necessary. | |
2866 | ||
2867 | # Instead we determine all libraries for the new perl at | |
2868 | # runtime. | |
2869 | my(@perlinc) = ($self->{INST_ARCHLIB}, $self->{INST_LIB}, $self->{PERL_ARCHLIB}, $self->{PERL_LIB}); | |
2870 | ||
2871 | $self->makeaperl(MAKE => $self->{MAKEFILE}, | |
2872 | DIRS => \@searchdirs, | |
2873 | STAT => \@static, | |
2874 | INCL => \@perlinc, | |
2875 | TARGET => $self->{MAP_TARGET}, | |
2876 | TMP => "", | |
2877 | LIBPERL => $self->{LIBPERL_A} | |
2878 | ); | |
2879 | } | |
2880 | ||
f4ae0f5e | 2881 | =item test (o) |
1e44e2bf | 2882 | |
f4ae0f5e | 2883 | Defines the test targets. |
1e44e2bf | 2884 | |
2885 | =cut | |
2886 | ||
2887 | sub test { | |
2888 | # --- Test and Installation Sections --- | |
2889 | ||
2890 | my($self, %attribs) = @_; | |
2891 | unless (ref $self){ | |
2892 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
2893 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
2894 | } | |
2895 | my($tests) = $attribs{TESTS} || (-d "t" ? "t/*.t" : ""); | |
2896 | my(@m); | |
2897 | push(@m," | |
2898 | TEST_VERBOSE=0 | |
2899 | TEST_TYPE=test_\$(LINKTYPE) | |
2900 | ||
2901 | test :: \$(TEST_TYPE) | |
f4ae0f5e | 2902 | testdb :: testdb_\$(LINKTYPE) |
1e44e2bf | 2903 | "); |
2904 | push(@m, map("\t$self->{NOECHO}cd $_ && test -f $self->{MAKEFILE} && \$(MAKE) test \$(PASTHRU)\n", | |
2905 | @{$self->{DIR}})); | |
2906 | push(@m, "\t$self->{NOECHO}echo 'No tests defined for \$(NAME) extension.'\n") | |
2907 | unless $tests or -f "test.pl" or @{$self->{DIR}}; | |
2908 | push(@m, "\n"); | |
2909 | ||
f4ae0f5e | 2910 | push(@m, "test_dynamic :: pure_all\n"); |
1e44e2bf | 2911 | push(@m, $self->test_via_harness('$(FULLPERL)', $tests)) if $tests; |
2912 | push(@m, $self->test_via_script('$(FULLPERL)', 'test.pl')) if -f "test.pl"; | |
2913 | push(@m, "\n"); | |
2914 | ||
f4ae0f5e | 2915 | if (-f "test.pl") { |
2916 | push(@m, "testdb_dynamic :: pure_all\n"); | |
2917 | push(@m, $self->test_via_script('$(FULLPERL) -d', 'test.pl')); | |
2918 | push(@m, "\n"); | |
2919 | } | |
2920 | ||
1e44e2bf | 2921 | # Occasionally we may face this degenerate target: |
2922 | push @m, "test_ : test_dynamic\n\n"; | |
2923 | ||
2924 | if ($self->needs_linking()) { | |
f4ae0f5e | 2925 | push(@m, "test_static :: pure_all \$(MAP_TARGET)\n"); |
1e44e2bf | 2926 | push(@m, $self->test_via_harness('./$(MAP_TARGET)', $tests)) if $tests; |
2927 | push(@m, $self->test_via_script('./$(MAP_TARGET)', 'test.pl')) if -f "test.pl"; | |
2928 | push(@m, "\n"); | |
f4ae0f5e | 2929 | if (-f "test.pl") { |
2930 | push(@m, "testdb_static :: pure_all \$(MAP_TARGET)\n"); | |
2931 | push(@m, $self->test_via_script('./$(MAP_TARGET) -d', 'test.pl')); | |
2932 | push(@m, "\n"); | |
2933 | } | |
1e44e2bf | 2934 | } else { |
2935 | push @m, "test_static :: test_dynamic\n"; | |
f4ae0f5e | 2936 | push @m, "testdb_static :: testdb_dynamic\n"; |
1e44e2bf | 2937 | } |
2938 | join("", @m); | |
2939 | } | |
2940 | ||
f4ae0f5e | 2941 | =item test_via_harness (o) |
1e44e2bf | 2942 | |
f4ae0f5e | 2943 | Helper method to write the test targets |
1e44e2bf | 2944 | |
2945 | =cut | |
2946 | ||
2947 | sub test_via_harness { | |
2948 | my($self, $perl, $tests) = @_; | |
2949 | unless (ref $self){ | |
2950 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
2951 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
2952 | } | |
2953 | "\tPERL_DL_NONLAZY=1 $perl".q! -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use Test::Harness qw(&runtests $$verbose); $$verbose=$(TEST_VERBOSE); runtests @ARGV;' !."$tests\n"; | |
2954 | } | |
2955 | ||
f4ae0f5e | 2956 | =item test_via_script (o) |
1e44e2bf | 2957 | |
f4ae0f5e | 2958 | Other helper method for test. |
1e44e2bf | 2959 | |
2960 | =cut | |
2961 | ||
2962 | sub test_via_script { | |
2963 | my($self, $perl, $script) = @_; | |
2964 | unless (ref $self){ | |
2965 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
2966 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
2967 | } | |
2968 | qq{\tPERL_DL_NONLAZY=1 $perl}.q{ -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) }.qq{$script | |
2969 | }; | |
2970 | } | |
2971 | ||
f4ae0f5e | 2972 | =item postamble (o) |
1e44e2bf | 2973 | |
2974 | Returns an empty string. Can be used in Makefile.PLs to write some | |
2975 | text to the Makefile at the end. | |
2976 | ||
2977 | =cut | |
2978 | ||
2979 | sub postamble { | |
2980 | my($self) = shift; | |
2981 | unless (ref $self){ | |
2982 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
2983 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
2984 | } | |
2985 | ""; | |
2986 | } | |
2987 | ||
f4ae0f5e | 2988 | =item makeaperl (o) |
1e44e2bf | 2989 | |
f4ae0f5e | 2990 | Called by staticmake. Defines how to write the Makefile to produce a |
2991 | static new perl. | |
1e44e2bf | 2992 | |
2993 | =cut | |
2994 | ||
2995 | sub makeaperl { | |
2996 | my($self, %attribs) = @_; | |
2997 | unless (ref $self){ | |
2998 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
2999 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
3000 | } | |
3001 | my($makefilename, $searchdirs, $static, $extra, $perlinc, $target, $tmp, $libperl) = | |
3002 | @attribs{qw(MAKE DIRS STAT EXTRA INCL TARGET TMP LIBPERL)}; | |
3003 | my(@m); | |
3004 | push @m, " | |
3005 | # --- MakeMaker makeaperl section --- | |
3006 | MAP_TARGET = $target | |
3007 | FULLPERL = $self->{FULLPERL} | |
3008 | "; | |
3009 | return join '', @m if $self->{PARENT}; | |
3010 | ||
3011 | my($dir) = join ":", @{$self->{DIR}}; | |
3012 | ||
3013 | unless ($self->{MAKEAPERL}) { | |
3014 | push @m, q{ | |
3015 | $(MAP_TARGET) :: $(MAKE_APERL_FILE) | |
3016 | $(MAKE) -f $(MAKE_APERL_FILE) static $@ | |
3017 | ||
3018 | $(MAKE_APERL_FILE) : $(FIRST_MAKEFILE) | |
3019 | }.$self->{NOECHO}.q{echo Writing \"$(MAKE_APERL_FILE)\" for this $(MAP_TARGET) | |
3020 | }.$self->{NOECHO}.q{$(PERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) \ | |
3021 | Makefile.PL DIR=}, $dir, q{ \ | |
3022 | MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \ | |
3023 | MAKEAPERL=1 NORECURS=1 CCCDLFLAGS=}; | |
3024 | ||
3025 | push @m, map( " \\\n\t\t$_", @ARGV ); | |
3026 | push @m, "\n"; | |
3027 | ||
3028 | return join '', @m; | |
3029 | } | |
3030 | ||
3031 | ||
3032 | ||
3033 | my($cccmd, $linkcmd, $lperl); | |
3034 | ||
3035 | ||
3036 | $cccmd = $self->const_cccmd($libperl); | |
3037 | $cccmd =~ s/^CCCMD\s*=\s*//; | |
3038 | $cccmd =~ s/\$\(INC\)/ -I$self->{PERL_INC} /; | |
3039 | $cccmd .= " $Config::Config{cccdlflags}" if ($Config::Config{d_shrplib}); | |
1e44e2bf | 3040 | $cccmd =~ s/\(CC\)/\(PERLMAINCC\)/; |
3041 | ||
3042 | # The front matter of the linkcommand... | |
3043 | $linkcmd = join ' ', "\$(CC)", | |
3044 | grep($_, @Config{qw(large split ldflags ccdlflags)}); | |
3045 | $linkcmd =~ s/\s+/ /g; | |
3046 | ||
3047 | # Which *.a files could we make use of... | |
3048 | local(%static); | |
f4ae0f5e | 3049 | require File::Find; |
1e44e2bf | 3050 | File::Find::find(sub { |
3051 | return unless m/\Q$self->{LIB_EXT}\E$/; | |
3052 | return if m/^libperl/; | |
3053 | # don't include the installed version of this extension. I | |
3054 | # leave this line here, although it is not necessary anymore: | |
3055 | # I patched minimod.PL instead, so that Miniperl.pm won't | |
3056 | # enclude duplicates | |
3057 | ||
3058 | # Once the patch to minimod.PL is in the distribution, I can | |
3059 | # drop it | |
3060 | return if $File::Find::name =~ m:auto/$self->{FULLEXT}/$self->{BASEEXT}$self->{LIB_EXT}$:; | |
f4ae0f5e | 3061 | use Cwd 'cwd'; |
3062 | $static{cwd() . "/" . $_}++; | |
1e44e2bf | 3063 | }, grep( -d $_, @{$searchdirs || []}) ); |
3064 | ||
3065 | # We trust that what has been handed in as argument, will be buildable | |
3066 | $static = [] unless $static; | |
3067 | @static{@{$static}} = (1) x @{$static}; | |
3068 | ||
3069 | $extra = [] unless $extra && ref $extra eq 'ARRAY'; | |
3070 | for (sort keys %static) { | |
3071 | next unless /\Q$self->{LIB_EXT}\E$/; | |
3072 | $_ = dirname($_) . "/extralibs.ld"; | |
3073 | push @$extra, $_; | |
3074 | } | |
3075 | ||
3076 | grep(s/^/-I/, @{$perlinc || []}); | |
3077 | ||
3078 | $target = "perl" unless $target; | |
3079 | $tmp = "." unless $tmp; | |
3080 | ||
3081 | # MAP_STATIC doesn't look into subdirs yet. Once "all" is made and we | |
3082 | # regenerate the Makefiles, MAP_STATIC and the dependencies for | |
3083 | # extralibs.all are computed correctly | |
3084 | push @m, " | |
3085 | MAP_LINKCMD = $linkcmd | |
3086 | MAP_PERLINC = @{$perlinc || []} | |
3087 | MAP_STATIC = ", | |
3088 | join(" \\\n\t", reverse sort keys %static), " | |
3089 | ||
3090 | MAP_PRELIBS = $Config::Config{libs} $Config::Config{cryptlib} | |
3091 | "; | |
3092 | ||
3093 | if (defined $libperl) { | |
3094 | ($lperl = $libperl) =~ s/\$\(A\)/$self->{LIB_EXT}/; | |
3095 | } | |
3096 | unless ($libperl && -f $lperl) { # Ilya's code... | |
3097 | my $dir = $self->{PERL_SRC} || "$self->{PERL_ARCHLIB}/CORE"; | |
3098 | $libperl ||= "libperl$self->{LIB_EXT}"; | |
3099 | $libperl = "$dir/$libperl"; | |
3100 | $lperl ||= "libperl$self->{LIB_EXT}"; | |
3101 | $lperl = "$dir/$lperl"; | |
3102 | print STDOUT "Warning: $libperl not found | |
3103 | If you're going to build a static perl binary, make sure perl is installed | |
3104 | otherwise ignore this warning\n" | |
3105 | unless (-f $lperl || defined($self->{PERL_SRC})); | |
3106 | } | |
3107 | ||
3108 | push @m, " | |
3109 | MAP_LIBPERL = $libperl | |
3110 | "; | |
3111 | ||
3112 | push @m, " | |
3113 | \$(INST_ARCHAUTODIR)/extralibs.all: \$(INST_ARCHAUTODIR)/.exists ".join(" \\\n\t", @$extra)." | |
3114 | $self->{NOECHO}$self->{RM_F} \$\@ | |
3115 | $self->{NOECHO}\$(TOUCH) \$\@ | |
3116 | "; | |
3117 | ||
3118 | my $catfile; | |
3119 | foreach $catfile (@$extra){ | |
3120 | push @m, "\tcat $catfile >> \$\@\n"; | |
3121 | } | |
3122 | ||
3123 | push @m, " | |
3124 | \$(MAP_TARGET) :: $tmp/perlmain\$(OBJ_EXT) \$(MAP_LIBPERL) \$(MAP_STATIC) \$(INST_ARCHAUTODIR)/extralibs.all | |
3125 | \$(MAP_LINKCMD) -o \$\@ $tmp/perlmain\$(OBJ_EXT) \$(MAP_LIBPERL) \$(MAP_STATIC) `cat \$(INST_ARCHAUTODIR)/extralibs.all` \$(MAP_PRELIBS) | |
3126 | $self->{NOECHO}echo 'To install the new \"\$(MAP_TARGET)\" binary, call' | |
3127 | $self->{NOECHO}echo ' make -f $makefilename inst_perl MAP_TARGET=\$(MAP_TARGET)' | |
3128 | $self->{NOECHO}echo 'To remove the intermediate files say' | |
3129 | $self->{NOECHO}echo ' make -f $makefilename map_clean' | |
3130 | ||
3131 | $tmp/perlmain\$(OBJ_EXT): $tmp/perlmain.c | |
3132 | "; | |
3133 | push @m, "\tcd $tmp && $cccmd -I\$(PERL_INC) perlmain.c\n"; | |
3134 | ||
3135 | push @m, qq{ | |
3136 | $tmp/perlmain.c: $makefilename}, q{ | |
3137 | }.$self->{NOECHO}.q{echo Writing $@ | |
3138 | }.$self->{NOECHO}.q{$(PERL) $(MAP_PERLINC) -e 'use ExtUtils::Miniperl; \\ | |
3139 | writemain(grep s#.*/auto/##, qw|$(MAP_STATIC)|)' > $@.tmp && mv $@.tmp $@ | |
3140 | ||
3141 | }; | |
3142 | ||
3143 | push @m, q{ | |
3144 | doc_inst_perl: | |
3145 | }.$self->{NOECHO}.q{echo Appending installation info to $(INSTALLARCHLIB)/perllocal.pod | |
3146 | }.$self->{NOECHO}.q{$(DOC_INSTALL) \ | |
3147 | "Perl binary $(MAP_TARGET)" \ | |
3148 | MAP_STATIC "$(MAP_STATIC)" \ | |
3149 | MAP_EXTRA "`cat $(INST_ARCHAUTODIR)/extralibs.all`" \ | |
3150 | MAP_LIBPERL "$(MAP_LIBPERL)" \ | |
3151 | >> }.$self->catfile('$(INSTALLARCHLIB)','perllocal.pod').q{ | |
3152 | ||
3153 | }; | |
3154 | ||
3155 | push @m, qq{ | |
3156 | inst_perl: pure_inst_perl doc_inst_perl | |
3157 | ||
3158 | pure_inst_perl: \$(MAP_TARGET) | |
3159 | $self->{CP} \$(MAP_TARGET) \$(INSTALLBIN)/\$(MAP_TARGET) | |
3160 | ||
3161 | clean :: map_clean | |
3162 | ||
3163 | map_clean : | |
3164 | $self->{RM_F} $tmp/perlmain\$(OBJ_EXT) $tmp/perlmain.c \$(MAP_TARGET) $makefilename \$(INST_ARCHAUTODIR)/extralibs.all | |
3165 | }; | |
3166 | ||
3167 | join '', @m; | |
3168 | } | |
3169 | ||
f4ae0f5e | 3170 | =item dir_target (o) |
1e44e2bf | 3171 | |
3172 | Takes an array of directories that need to exist and returns a | |
3173 | Makefile entry for a .exists file in these directories. Returns | |
3174 | nothing, if the entry has already been processed. We're helpless | |
3175 | though, if the same directory comes as $(FOO) _and_ as "bar". Both of | |
3176 | them get an entry, that's why we use "::". | |
3177 | ||
3178 | =cut | |
3179 | ||
3180 | sub dir_target { | |
3181 | # --- Make-Directories section (internal method) --- | |
3182 | # dir_target(@array) returns a Makefile entry for the file .exists in each | |
3183 | # named directory. Returns nothing, if the entry has already been processed. | |
3184 | # We're helpless though, if the same directory comes as $(FOO) _and_ as "bar". | |
3185 | # Both of them get an entry, that's why we use "::". I chose '$(PERL)' as the | |
3186 | # prerequisite, because there has to be one, something that doesn't change | |
3187 | # too often :) | |
3188 | ||
3189 | my($self,@dirs) = @_; | |
3190 | unless (ref $self){ | |
3191 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
3192 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
3193 | } | |
3194 | my(@m,$dir); | |
3195 | foreach $dir (@dirs) { | |
f4ae0f5e | 3196 | my($src) = $self->catfile($self->{PERL_INC},'perl.h'); |
3197 | my($targ) = $self->catfile($dir,'.exists'); | |
3198 | my($targdir) = $targ; # Necessary because catfile may have | |
3199 | $targdir =~ s:/?.exists$::; # adapted syntax of $dir to target OS | |
3200 | next if $self->{DIR_TARGET}{$self}{$targdir}++; | |
1e44e2bf | 3201 | push @m, qq{ |
f4ae0f5e | 3202 | $targ :: $src |
3203 | $self->{NOECHO}\$(MKPATH) $targdir | |
3204 | $self->{NOECHO}\$(EQUALIZE_TIMESTAMP) $src $targ | |
1e44e2bf | 3205 | }; |
f4ae0f5e | 3206 | push(@m,qq{ |
3207 | -$self->{NOECHO}\$(CHMOD) 755 $targdir | |
3208 | }) unless $Is_VMS; | |
1e44e2bf | 3209 | } |
3210 | join "", @m; | |
3211 | } | |
3212 | ||
f4ae0f5e | 3213 | =item needs_linking (o) |
1e44e2bf | 3214 | |
3215 | Does this module need linking? Looks into subdirectory objects (see | |
3216 | also has_link_code()) | |
3217 | ||
3218 | =cut | |
3219 | ||
3220 | sub needs_linking { | |
3221 | my($self) = shift; | |
3222 | my($child,$caller); | |
3223 | $caller = (caller(0))[3]; | |
3224 | unless (ref $self){ | |
3225 | ExtUtils::MakeMaker::TieAtt::warndirectuse($caller); | |
3226 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
3227 | } | |
3228 | Carp::confess("Needs_linking called too early") if $caller =~ /^ExtUtils::MakeMaker::/; | |
3229 | return $self->{NEEDS_LINKING} if defined $self->{NEEDS_LINKING}; | |
3230 | if ($self->has_link_code or $self->{MAKEAPERL}){ | |
3231 | $self->{NEEDS_LINKING} = 1; | |
3232 | return 1; | |
3233 | } | |
3234 | foreach $child (keys %{$self->{CHILDREN}}) { | |
3235 | if ($self->{CHILDREN}->{$child}->needs_linking) { | |
3236 | $self->{NEEDS_LINKING} = 1; | |
3237 | return 1; | |
3238 | } | |
3239 | } | |
3240 | return $self->{NEEDS_LINKING} = 0; | |
3241 | } | |
3242 | ||
3243 | =item has_link_code | |
3244 | ||
3245 | Returns true if C, XS, MYEXTLIB or similar objects exist within this | |
3246 | object that need a compiler. Does not descend into subdirectories as | |
3247 | needs_linking() does. | |
3248 | ||
3249 | =cut | |
3250 | ||
3251 | sub has_link_code { | |
3252 | my($self) = shift; | |
3253 | return $self->{HAS_LINK_CODE} if defined $self->{HAS_LINK_CODE}; | |
3254 | if ($self->{OBJECT} or @{$self->{C} || []} or $self->{MYEXTLIB}){ | |
3255 | $self->{HAS_LINK_CODE} = 1; | |
3256 | return 1; | |
3257 | } | |
3258 | return $self->{HAS_LINK_CODE} = 0; | |
3259 | } | |
3260 | ||
3261 | =item writedoc | |
3262 | ||
f4ae0f5e | 3263 | Obsolete, depecated method. Not used since Version 5.21. |
1e44e2bf | 3264 | |
3265 | =cut | |
3266 | ||
3267 | sub writedoc { | |
3268 | # --- perllocal.pod section --- | |
3269 | my($self,$what,$name,@attribs)=@_; | |
3270 | unless (ref $self){ | |
3271 | ExtUtils::MakeMaker::TieAtt::warndirectuse((caller(0))[3]); | |
3272 | $self = $ExtUtils::MakeMaker::Parent[-1]; | |
3273 | } | |
3274 | my $time = localtime; | |
3275 | print "=head2 $time: $what C<$name>\n\n=over 4\n\n=item *\n\n"; | |
3276 | print join "\n\n=item *\n\n", map("C<$_>",@attribs); | |
3277 | print "\n\n=back\n\n"; | |
3278 | } | |
3279 | ||
f4ae0f5e | 3280 | 1; |
3281 | ||
3282 | ||
1e44e2bf | 3283 | =head1 SEE ALSO |
3284 | ||
3285 | L<ExtUtils::MakeMaker> | |
3286 | ||
3287 | =cut | |
3288 | ||
f4ae0f5e | 3289 | __END__ |