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