Commit | Line | Data |
e05e23b1 |
1 | package main; |
2 | use vars qw(%att); |
3 | |
4 | # $Id: MakeMaker.pm,v 1.174 1996/02/06 17:03:12 k Exp $ |
5 | |
8e07c86e |
6 | package ExtUtils::MakeMaker::TieAtt; |
7 | # this package will go away again, when we don't have modules around |
8 | # anymore that import %att It ties an empty %att and records in which |
9 | # object this %att was tied. FETCH and STORE return/store-to the |
10 | # appropriate value from %$self |
005c1a0e |
11 | |
8e07c86e |
12 | # the warndirectuse method warns if somebody calls MM->something. It |
13 | # has nothing to do with the tie'd %att. |
005c1a0e |
14 | |
8e07c86e |
15 | $Enough_limit = 5; |
a0d0e21e |
16 | |
8e07c86e |
17 | sub TIEHASH { |
18 | bless { SECRETHASH => $_[1]}; |
005c1a0e |
19 | } |
42793c05 |
20 | |
8e07c86e |
21 | sub FETCH { |
4633a7c4 |
22 | print "Warning (non-fatal): Importing of %att is deprecated [$_[1]] |
8e07c86e |
23 | use \$self instead\n" unless ++$Enough>$Enough_limit; |
24 | print "Further ExtUtils::MakeMaker::TieAtt warnings suppressed\n" if $Enough==$Enough_limit; |
25 | $_[0]->{SECRETHASH}->{$_[1]}; |
1aef975c |
26 | } |
42793c05 |
27 | |
8e07c86e |
28 | sub STORE { |
4633a7c4 |
29 | print "Warning (non-fatal): Importing of %att is deprecated [$_[1]][$_[2]] |
8e07c86e |
30 | use \$self instead\n" unless ++$Enough>$Enough_limit; |
31 | print "Further ExtUtils::MakeMaker::TieAtt warnings suppressed\n" if $Enough==$Enough_limit; |
32 | $_[0]->{SECRETHASH}->{$_[1]} = $_[2]; |
33 | } |
42793c05 |
34 | |
8e07c86e |
35 | sub FIRSTKEY { |
4633a7c4 |
36 | print "Warning (non-fatal): Importing of %att is deprecated [FIRSTKEY] |
8e07c86e |
37 | use \$self instead\n" unless ++$Enough>$Enough_limit; |
38 | print "Further ExtUtils::MakeMaker::TieAtt warnings suppressed\n" if $Enough==$Enough_limit; |
39 | each %{$_[0]->{SECRETHASH}}; |
40 | } |
42793c05 |
41 | |
8e07c86e |
42 | sub NEXTKEY { |
43 | each %{$_[0]->{SECRETHASH}}; |
44 | } |
005c1a0e |
45 | |
8e07c86e |
46 | sub DESTROY { |
47 | } |
005c1a0e |
48 | |
8e07c86e |
49 | sub warndirectuse { |
50 | my($caller) = @_; |
51 | return if $Enough>$Enough_limit; |
4633a7c4 |
52 | print STDOUT "Warning (non-fatal): Direct use of class methods deprecated; use\n"; |
8e07c86e |
53 | my($method) = $caller =~ /.*:(\w+)$/; |
864a5fa8 |
54 | print STDOUT |
8e07c86e |
55 | ' my $self = shift; |
8e07c86e |
56 | $self->MM::', $method, "(); |
57 | instead\n"; |
58 | print "Further ExtUtils::MakeMaker::TieAtt warnings suppressed\n" |
59 | if ++$Enough==$Enough_limit; |
60 | } |
005c1a0e |
61 | |
005c1a0e |
62 | |
42793c05 |
63 | |
005c1a0e |
64 | |
e05e23b1 |
65 | |
66 | |
67 | package ExtUtils::MakeMaker; |
68 | |
69 | $Version = $VERSION = "5.21"; |
70 | $Version_OK = "5.05"; # Makefiles older than $Version_OK will die |
8e07c86e |
71 | # (Will be checked from MakeMaker version 4.13 onwards) |
e05e23b1 |
72 | ($Revision = substr(q$Revision: 1.174 $, 10)) =~ s/\s+$//; |
73 | |
74 | |
005c1a0e |
75 | |
8e07c86e |
76 | use Config; |
77 | use Carp; |
78 | use Cwd; |
79 | require Exporter; |
80 | require ExtUtils::Manifest; |
e05e23b1 |
81 | { |
82 | # Current (5.21) FileHandle doesn't work with miniperl, so we roll our own |
83 | # that's all copy & paste code from FileHandle.pm, version of perl5.002b3 |
84 | package FileHandle; |
85 | use Symbol; |
86 | sub new { |
87 | @_ >= 1 && @_ <= 3 or croak('usage: new FileHandle [FILENAME [,MODE]]'); |
88 | my $class = shift; |
89 | my $fh = gensym; |
90 | if (@_) { |
91 | FileHandle::open($fh, @_) |
92 | or return undef; |
93 | } |
94 | bless $fh, $class; |
95 | } |
96 | sub open { |
97 | @_ >= 2 && @_ <= 4 or croak('usage: $fh->open(FILENAME [,MODE [,PERMS]])'); |
98 | my ($fh, $file) = @_; |
99 | if (@_ > 2) { |
100 | my ($mode, $perms) = @_[2, 3]; |
101 | if ($mode =~ /^\d+$/) { |
102 | defined $perms or $perms = 0666; |
103 | return sysopen($fh, $file, $mode, $perms); |
104 | } |
105 | $file = "./" . $file unless $file =~ m#^/#; |
106 | $file = _open_mode_string($mode) . " $file\0"; |
107 | } |
108 | open($fh, $file); |
109 | } |
110 | sub close { |
111 | @_ == 1 or croak('usage: $fh->close()'); |
112 | close($_[0]); |
113 | } |
114 | } |
115 | |
116 | use vars qw( |
117 | $VERSION $Version_OK $Revision |
118 | $Verbose %MM_Sections |
119 | @MM_Sections %Recognized_Att_Keys @Get_from_Config |
120 | %Prepend_dot_dot %Config @Parent %NORMAL_INC |
121 | $Setup_done |
122 | ); |
8e07c86e |
123 | #use strict qw(refs); |
005c1a0e |
124 | |
8e07c86e |
125 | eval {require DynaLoader;}; # Get mod2fname, if defined. Will fail |
126 | # with miniperl. |
005c1a0e |
127 | |
e05e23b1 |
128 | # |
129 | # Set up the inheritance before we pull in the MM_* packages, because they |
130 | # import variables and functions from here |
131 | # |
132 | @ISA = qw(Exporter); |
133 | @EXPORT = qw(&WriteMakefile &writeMakefile $Verbose &prompt); |
134 | @EXPORT_OK = qw($VERSION &Version_check &help &neatvalue &mkbootstrap &mksymlists |
135 | $Version %att); ## Import of %att is deprecated, please use OO features! |
136 | # $Version in mixed case will go away! |
005c1a0e |
137 | |
e05e23b1 |
138 | # |
139 | # Dummy package MM inherits actual methods from OS-specific |
140 | # default packages. We use this intermediate package so |
141 | # MY::XYZ->func() can call MM->func() and get the proper |
142 | # default routine without having to know under what OS |
143 | # it's running. |
144 | # |
145 | @MM::ISA = qw[ExtUtils::MM_Unix ExtUtils::Liblist ExtUtils::MakeMaker]; |
42793c05 |
146 | |
e05e23b1 |
147 | # |
148 | # Setup dummy package: |
149 | # MY exists for overriding methods to be defined within |
150 | # |
151 | { |
152 | package MY; |
153 | @ISA = qw(MM); |
154 | } |
42793c05 |
155 | |
e05e23b1 |
156 | { |
157 | package MM; |
158 | # From somwhere they will want to inherit DESTROY |
159 | sub DESTROY {} |
160 | } |
42793c05 |
161 | |
e05e23b1 |
162 | # |
163 | # No we can can pull in the friends |
164 | # |
165 | require ExtUtils::MM_Unix; |
166 | if ($Is_VMS = ($Config{osname} eq 'VMS')) { |
0d8023a2 |
167 | require ExtUtils::MM_VMS; |
168 | require VMS::Filespec; |
169 | import VMS::Filespec '&vmsify'; |
170 | } |
e05e23b1 |
171 | if ($Is_OS2 = $Config{osname} =~ m|^os/?2$|i) { |
172 | require ExtUtils::MM_OS2; |
173 | } |
75f92628 |
174 | |
e05e23b1 |
175 | %NORMAL_INC = %INC; |
176 | # package name for the classes into which the first object will be blessed |
177 | $PACKNAME = "PACK000"; |
42793c05 |
178 | |
e05e23b1 |
179 | ##### |
180 | # # # # ##### |
181 | # # # # # |
182 | ##### # # ##### |
183 | # # # # # |
184 | # # # # # # |
185 | ##### #### ##### |
4633a7c4 |
186 | |
864a5fa8 |
187 | |
e05e23b1 |
188 | # |
189 | # MakeMaker serves currently (v 5.20) only for two purposes: |
190 | # Version_Check, and WriteMakefile. For WriteMakefile SelfLoader |
191 | # doesn't buy us anything. But for Version_Check we win with |
192 | # SelfLoader more than a second. |
193 | # |
194 | # The only subroutine we do not SelfLoad is Version_Check because it's |
195 | # called so often. Loading this minimum still requires 1.2 secs on my |
196 | # Indy :-( |
197 | # |
198 | |
199 | sub Version_check { |
200 | my($checkversion) = @_; |
201 | die "Your Makefile was built with ExtUtils::MakeMaker v $checkversion. |
202 | Current Version is $ExtUtils::MakeMaker::VERSION. There have been considerable |
203 | changes in the meantime. |
204 | Please rerun 'perl Makefile.PL' to regenerate the Makefile.\n" |
205 | if $checkversion < $Version_OK; |
206 | printf STDOUT "%s %s %s %s.\n", "Makefile built with ExtUtils::MakeMaker v", |
207 | $checkversion, "Current Version is", $VERSION |
208 | unless $checkversion == $VERSION; |
8e07c86e |
209 | } |
e05e23b1 |
210 | |
211 | # We don't selfload this, because chdir sometimes has problems |
212 | sub eval_in_subdirs { |
213 | my($self) = @_; |
214 | my($dir); |
215 | # print "Starting to wade through directories:\n"; |
216 | # print join "\n", @{$self->{DIR}}, "\n"; |
217 | my $pwd = cwd(); |
218 | |
219 | # As strange things happened twice in the history of MakeMaker to $self->{DIR}, |
220 | # lets be careful, maybe it helps some: |
221 | # my(@copy_of_DIR) = @{$self->{DIR}}; |
222 | # my %copy; |
223 | # @copy{@copy_od_DIR} = (1) x @copy_of_DIR; |
224 | |
225 | # with Tk-9.02 these give me as third directory "1": |
226 | # foreach $dir (@($self->{DIR}){ |
227 | # foreach $dir (@copy_of_DIR){ |
228 | |
229 | # this gives mi as third directory a core dump: |
230 | # while ($dir = shift @copy_of_DIR){ |
231 | |
232 | # this finishes the loop immediately: |
233 | # foreach $dir (keys %copy){ |
234 | # print "Next to come: $dir\n"; |
235 | # chdir $dir or die "Couldn't change to directory $dir: $!"; |
236 | # package main; |
237 | # my $fh = new FileHandle; |
238 | # $fh->open("Makefile.PL") or carp("Couldn't open Makefile.PL in $dir"); |
239 | # my $eval = join "", <$fh>; |
240 | # $fh->close; |
241 | # eval $eval; |
242 | # warn "WARNING from evaluation of $dir/Makefile.PL: $@" if $@; |
243 | # chdir $pwd or die "Couldn't change to directory $pwd: $!"; |
244 | # } |
245 | |
246 | |
247 | # So this did the trick (did it?) |
248 | foreach $dir (@{$self->{DIR}}){ |
249 | # print "Next to come: $dir\n"; |
250 | my($abs) = $self->catdir($pwd,$dir); |
251 | $self->eval_in_x($abs); |
252 | } |
253 | |
254 | chdir $pwd; |
255 | |
256 | # print "Proudly presenting you self->{DIR}:\n"; |
257 | # print join "\n", @{$self->{DIR}}, "\n"; |
258 | |
864a5fa8 |
259 | } |
42793c05 |
260 | |
e05e23b1 |
261 | sub eval_in_x { |
262 | my($self,$dir) = @_; |
263 | package main; |
264 | chdir $dir or carp("Couldn't change to directory $dir: $!"); |
265 | my $fh = new FileHandle; |
266 | $fh->open("Makefile.PL") or carp("Couldn't open Makefile.PL in $dir"); |
267 | my $eval = join "", <$fh>; |
268 | $fh->close; |
269 | eval $eval; |
270 | warn "WARNING from evaluation of $dir/Makefile.PL: $@" if $@; |
271 | } |
272 | |
273 | # use SelfLoader; |
274 | # sub ExtUtils::MakeMaker::full_setup ; |
275 | # sub ExtUtils::MakeMaker::attrib_help ; |
276 | # sub ExtUtils::MakeMaker::writeMakefile ; |
277 | # sub ExtUtils::MakeMaker::WriteMakefile ; |
278 | # sub ExtUtils::MakeMaker::new ; |
279 | # sub ExtUtils::MakeMaker::check_manifest ; |
280 | # sub ExtUtils::MakeMaker::parse_args ; |
281 | # sub ExtUtils::MakeMaker::check_hints ; |
282 | # sub ExtUtils::MakeMaker::mv_all_methods ; |
283 | # sub ExtUtils::MakeMaker::prompt ; |
284 | # sub ExtUtils::MakeMaker::help ; |
285 | # sub ExtUtils::MakeMaker::skipcheck ; |
286 | # sub ExtUtils::MakeMaker::flush ; |
287 | # sub ExtUtils::MakeMaker::mkbootstrap ; |
288 | # sub ExtUtils::MakeMaker::mksymlists ; |
289 | # sub ExtUtils::MakeMaker::neatvalue ; |
290 | # sub ExtUtils::MakeMaker::selfdocument ; |
291 | |
292 | # 1; |
293 | |
294 | # __DATA__ |
295 | |
296 | # |
297 | # We're done with inheritance setup. As we have two frequently called |
298 | # things: Check_Version() and mod_install(), we want to reduce startup |
299 | # time. Only WriteMakefile needs all the power here. |
300 | # |
301 | |
302 | sub full_setup { |
303 | $Verbose ||= 0; |
304 | $^W=1; |
305 | $SIG{__WARN__} = sub { |
306 | $_[0] =~ /^Use of uninitialized value/ && return; |
307 | $_[0] =~ /used only once/ && return; |
308 | $_[0] =~ /^Subroutine\s+[\w:]+\s+redefined/ && return; |
309 | warn @_; |
310 | }; |
311 | |
312 | @MM_Sections = |
313 | qw( |
314 | post_initialize const_config constants const_loadlibs |
315 | const_cccmd tool_autosplit tool_xsubpp tools_other dist macro |
316 | depend post_constants pasthru c_o xs_c xs_o top_targets |
317 | linkext dlsyms dynamic dynamic_bs dynamic_lib static |
318 | static_lib installpm manifypods processPL installbin subdirs |
319 | clean realclean dist_basics dist_core dist_dir dist_test |
320 | dist_ci install force perldepend makefile staticmake test |
321 | postamble selfdocument |
322 | ); # loses section ordering |
323 | |
324 | @MM_Sections{@MM_Sections} = {} x @MM_Sections; |
325 | |
326 | # All sections are valid keys. |
327 | %Recognized_Att_Keys = %MM_Sections; |
328 | |
329 | # we will use all these variables in the Makefile |
330 | @Get_from_Config = |
331 | qw( |
332 | ar cc cccdlflags ccdlflags dlext dlsrc ld lddlflags ldflags libc |
333 | lib_ext obj_ext ranlib sitelibexp sitearchexp so |
334 | ); |
335 | |
336 | my $item; |
337 | foreach $item (split(/\n/,attrib_help())){ |
338 | next unless $item =~ m/^=item\s+(\w+)\s*$/; |
339 | $Recognized_Att_Keys{$1} = $2; |
340 | print "Attribute '$1' => '$2'\n" if ($Verbose >= 2); |
341 | } |
342 | foreach $item (@Get_from_Config) { |
343 | $Recognized_Att_Keys{uc $item} = $Config{$item}; |
344 | print "Attribute '\U$item\E' => '$Config{$item}'\n" |
345 | if ($Verbose >= 2); |
346 | } |
347 | |
348 | # |
349 | # When we pass these through to a Makefile.PL in a subdirectory, we prepend |
350 | # "..", so that all files to be installed end up below ./blib |
351 | # |
352 | %Prepend_dot_dot = |
353 | qw( |
354 | INST_LIB 1 INST_ARCHLIB 1 INST_EXE 1 MAP_TARGET 1 INST_MAN1DIR 1 INST_MAN3DIR 1 |
355 | PERL_SRC 1 PERL 1 FULLPERL 1 |
356 | ); |
357 | |
358 | } |
359 | |
360 | sub attrib_help { |
361 | return $Attrib_Help if $Attrib_Help; |
362 | my $switch = 0; |
363 | my $help = ""; |
364 | my $line; |
365 | while ($line = <DATA>) { |
366 | $switch ||= $line =~ /^=item C\s*$/; |
367 | next unless $switch; |
368 | last if $line =~ /^=cut/; |
369 | $help .= $line; |
370 | } |
371 | # close DATA; |
372 | $Attrib_Help = $help; |
373 | } |
42793c05 |
374 | |
8e07c86e |
375 | sub writeMakefile { |
376 | die <<END; |
232e078e |
377 | |
8e07c86e |
378 | The extension you are trying to build apparently is rather old and |
379 | most probably outdated. We detect that from the fact, that a |
380 | subroutine "writeMakefile" is called, and this subroutine is not |
381 | supported anymore since about October 1994. |
40000a8c |
382 | |
4633a7c4 |
383 | Please contact the author or look into CPAN (details about CPAN can be |
384 | found in the FAQ and at http:/www.perl.com) for a more recent version |
385 | of the extension. If you're really desperate, you can try to change |
386 | the subroutine name from writeMakefile to WriteMakefile and rerun |
387 | 'perl Makefile.PL', but you're most probably left alone, when you do |
388 | so. |
42793c05 |
389 | |
8e07c86e |
390 | The MakeMaker team |
1aef975c |
391 | |
42793c05 |
392 | END |
8e07c86e |
393 | } |
42793c05 |
394 | |
8e07c86e |
395 | sub WriteMakefile { |
396 | Carp::croak "WriteMakefile: Need even number of args" if @_ % 2; |
397 | my %att = @_; |
398 | MM->new(\%att)->flush; |
42793c05 |
399 | } |
400 | |
8e07c86e |
401 | sub new { |
402 | my($class,$self) = @_; |
e05e23b1 |
403 | full_setup() unless $Setup_done++; |
404 | |
8e07c86e |
405 | my($key); |
42793c05 |
406 | |
e05e23b1 |
407 | print STDOUT "MakeMaker (v$VERSION)\n" if $Verbose; |
8e07c86e |
408 | if (-f "MANIFEST" && ! -f "Makefile"){ |
409 | check_manifest(); |
1aef975c |
410 | } |
42793c05 |
411 | |
8e07c86e |
412 | $self = {} unless (defined $self); |
005c1a0e |
413 | |
864a5fa8 |
414 | check_hints($self); |
4633a7c4 |
415 | |
8e07c86e |
416 | my(%initial_att) = %$self; # record initial attributes |
005c1a0e |
417 | |
8e07c86e |
418 | if (defined $self->{CONFIGURE}) { |
419 | if (ref $self->{CONFIGURE} eq 'CODE') { |
420 | $self = { %$self, %{&{$self->{CONFIGURE}}}}; |
005c1a0e |
421 | } else { |
8e07c86e |
422 | croak "Attribute 'CONFIGURE' to WriteMakefile() not a code reference\n"; |
005c1a0e |
423 | } |
424 | } |
a0d0e21e |
425 | |
8e07c86e |
426 | # This is for old Makefiles written pre 5.00, will go away |
427 | if ( Carp::longmess("") =~ /runsubdirpl/s ){ |
e05e23b1 |
428 | #$self->{Correct_relativ_directories}++; |
429 | carp("WARNING: Please rerun 'perl Makefile.PL' to regenerate your Makefiles\n"); |
8e07c86e |
430 | } else { |
431 | $self->{Correct_relativ_directories}=0; |
432 | } |
5d94fbed |
433 | |
8e07c86e |
434 | my $class = ++$PACKNAME; |
435 | { |
436 | # no strict; |
e05e23b1 |
437 | print "Blessing Object into class [$class]\n" if $Verbose>=2; |
8e07c86e |
438 | mv_all_methods("MY",$class); |
439 | bless $self, $class; |
e05e23b1 |
440 | push @Parent, $self; |
8e07c86e |
441 | @{"$class\:\:ISA"} = 'MM'; |
442 | } |
5d94fbed |
443 | |
e05e23b1 |
444 | if (defined $Parent[-2]){ |
445 | $self->{PARENT} = $Parent[-2]; |
8e07c86e |
446 | my $key; |
e05e23b1 |
447 | for $key (keys %Prepend_dot_dot) { |
4633a7c4 |
448 | next unless defined $self->{PARENT}{$key}; |
8e07c86e |
449 | $self->{$key} = $self->{PARENT}{$key}; |
450 | $self->{$key} = $self->catdir("..",$self->{$key}) |
451 | unless $self->{$key} =~ m!^/!; |
452 | } |
453 | $self->{PARENT}->{CHILDREN}->{$class} = $self if $self->{PARENT}; |
454 | } else { |
455 | parse_args($self,@ARGV); |
456 | } |
a0d0e21e |
457 | |
8e07c86e |
458 | $self->{NAME} ||= $self->guess_name; |
a0d0e21e |
459 | |
8e07c86e |
460 | ($self->{NAME_SYM} = $self->{NAME}) =~ s/\W+/_/g; |
a0d0e21e |
461 | |
8e07c86e |
462 | $self->init_main(); |
463 | |
0d8023a2 |
464 | if (! $self->{PERL_SRC} ) { |
465 | my($pthinks) = $INC{'Config.pm'}; |
466 | $pthinks = vmsify($pthinks) if $Is_VMS; |
e05e23b1 |
467 | if ($pthinks ne $self->catfile($Config{archlibexp},'Config.pm')){ |
0d8023a2 |
468 | $pthinks =~ s!/Config\.pm$!!; |
469 | $pthinks =~ s!.*/!!; |
470 | print STDOUT <<END; |
005c1a0e |
471 | Your perl and your Config.pm seem to have different ideas about the architecture |
472 | they are running on. |
8e07c86e |
473 | Perl thinks: [$pthinks] |
e05e23b1 |
474 | Config says: [$Config{archname}] |
005c1a0e |
475 | This may or may not cause problems. Please check your installation of perl if you |
476 | have problems building this extension. |
477 | END |
0d8023a2 |
478 | } |
005c1a0e |
479 | } |
480 | |
8e07c86e |
481 | $self->init_dirscan(); |
482 | $self->init_others(); |
75f92628 |
483 | |
8e07c86e |
484 | push @{$self->{RESULT}}, <<END; |
485 | # This Makefile is for the $self->{NAME} extension to perl. |
486 | # |
e05e23b1 |
487 | # It was generated automatically by MakeMaker version |
488 | # $VERSION (Revision: $Revision) from the contents of |
489 | # Makefile.PL. Don't edit this file, edit Makefile.PL instead. |
8e07c86e |
490 | # |
491 | # ANY CHANGES MADE HERE WILL BE LOST! |
492 | # |
493 | # MakeMaker Parameters: |
494 | END |
a0d0e21e |
495 | |
42793c05 |
496 | foreach $key (sort keys %initial_att){ |
497 | my($v) = neatvalue($initial_att{$key}); |
8e07c86e |
498 | $v =~ s/(CODE|HASH|ARRAY|SCALAR)\([\dxa-f]+\)/$1\(...\)/; |
42793c05 |
499 | $v =~ tr/\n/ /s; |
8e07c86e |
500 | push @{$self->{RESULT}}, "# $key => $v"; |
42793c05 |
501 | } |
a0d0e21e |
502 | |
8e07c86e |
503 | # turn the SKIP array into a SKIPHASH hash |
504 | my (%skip,$skip); |
505 | for $skip (@{$self->{SKIP} || []}) { |
506 | $self->{SKIPHASH}{$skip} = 1; |
507 | } |
42793c05 |
508 | |
8e07c86e |
509 | # We run all the subdirectories now. They don't have much to query |
510 | # from the parent, but the parent has to query them: if they need linking! |
8e07c86e |
511 | unless ($self->{NORECURS}) { |
e05e23b1 |
512 | $self->eval_in_subdirs if @{$self->{DIR}}; |
42793c05 |
513 | } |
a0d0e21e |
514 | |
8e07c86e |
515 | tie %::att, ExtUtils::MakeMaker::TieAtt, $self; |
516 | my $section; |
e05e23b1 |
517 | foreach $section ( @MM_Sections ){ |
518 | print "Processing Makefile '$section' section\n" if ($Verbose >= 2); |
8e07c86e |
519 | my($skipit) = $self->skipcheck($section); |
520 | if ($skipit){ |
521 | push @{$self->{RESULT}}, "\n# --- MakeMaker $section section $skipit."; |
4e68a208 |
522 | } else { |
8e07c86e |
523 | my(%a) = %{$self->{$section} || {}}; |
524 | push @{$self->{RESULT}}, "\n# --- MakeMaker $section section:"; |
e05e23b1 |
525 | push @{$self->{RESULT}}, "# " . join ", ", %a if $Verbose && %a; |
8e07c86e |
526 | push @{$self->{RESULT}}, $self->nicetext($self->$section( %a )); |
e05e23b1 |
527 | } |
232e078e |
528 | } |
8e07c86e |
529 | |
e05e23b1 |
530 | push @{$self->{RESULT}}, "\n# End."; |
531 | pop @Parent; |
8e07c86e |
532 | |
e05e23b1 |
533 | $self; |
232e078e |
534 | } |
535 | |
e05e23b1 |
536 | sub check_manifest { |
537 | print STDOUT "Checking if your kit is complete...\n"; |
538 | $ExtUtils::Manifest::Quiet=$ExtUtils::Manifest::Quiet=1; #avoid warning |
539 | my(@missed)=ExtUtils::Manifest::manicheck(); |
540 | if (@missed){ |
541 | print STDOUT "Warning: the following files are missing in your kit:\n"; |
542 | print "\t", join "\n\t", @missed; |
543 | print STDOUT "\n"; |
544 | print STDOUT "Please inform the author.\n"; |
8e07c86e |
545 | } else { |
e05e23b1 |
546 | print STDOUT "Looks good\n"; |
8e07c86e |
547 | } |
8e07c86e |
548 | } |
549 | |
e05e23b1 |
550 | sub parse_args{ |
551 | my($self, @args) = @_; |
552 | foreach (@args){ |
553 | unless (m/(.*?)=(.*)/){ |
554 | help(),exit 1 if m/^help$/; |
555 | ++$Verbose if m/^verb/; |
556 | next; |
557 | } |
558 | my($name, $value) = ($1, $2); |
559 | if ($value =~ m/^~(\w+)?/){ # tilde with optional username |
560 | $value =~ s [^~(\w*)] |
561 | [$1 ? |
562 | ((getpwnam($1))[7] || "~$1") : |
563 | (getpwuid($>))[7] |
564 | ]ex; |
565 | } |
566 | # This may go away, in mid 1996 |
567 | if ($self->{Correct_relativ_directories}){ |
568 | $value = $self->catdir("..",$value) |
569 | if $Prepend_dot_dot{$name} && ! $value =~ m!^/!; |
570 | } |
571 | $self->{$name} = $value; |
8e07c86e |
572 | } |
e05e23b1 |
573 | # This may go away, in mid 1996 |
574 | delete $self->{Correct_relativ_directories}; |
8e07c86e |
575 | |
e05e23b1 |
576 | # catch old-style 'potential_libs' and inform user how to 'upgrade' |
577 | if (defined $self->{potential_libs}){ |
578 | my($msg)="'potential_libs' => '$self->{potential_libs}' should be"; |
579 | if ($self->{potential_libs}){ |
580 | print STDOUT "$msg changed to:\n\t'LIBS' => ['$self->{potential_libs}']\n"; |
581 | } else { |
582 | print STDOUT "$msg deleted.\n"; |
583 | } |
584 | $self->{LIBS} = [$self->{potential_libs}]; |
585 | delete $self->{potential_libs}; |
8e07c86e |
586 | } |
e05e23b1 |
587 | # catch old-style 'ARMAYBE' and inform user how to 'upgrade' |
588 | if (defined $self->{ARMAYBE}){ |
589 | my($armaybe) = $self->{ARMAYBE}; |
590 | print STDOUT "ARMAYBE => '$armaybe' should be changed to:\n", |
591 | "\t'dynamic_lib' => {ARMAYBE => '$armaybe'}\n"; |
592 | my(%dl) = %{$self->{dynamic_lib} || {}}; |
593 | $self->{dynamic_lib} = { %dl, ARMAYBE => $armaybe}; |
594 | delete $self->{ARMAYBE}; |
8e07c86e |
595 | } |
e05e23b1 |
596 | if (defined $self->{LDTARGET}){ |
597 | print STDOUT "LDTARGET should be changed to LDFROM\n"; |
598 | $self->{LDFROM} = $self->{LDTARGET}; |
599 | delete $self->{LDTARGET}; |
8e07c86e |
600 | } |
e05e23b1 |
601 | # Turn a DIR argument on the command line into an array |
602 | if (defined $self->{DIR} && ref \$self->{DIR} eq 'SCALAR') { |
603 | # So they can choose from the command line, which extensions they want |
604 | # the grep enables them to have some colons too much in case they |
605 | # have to build a list with the shell |
606 | $self->{DIR} = [grep $_, split ":", $self->{DIR}]; |
8e07c86e |
607 | } |
e05e23b1 |
608 | my $mmkey; |
609 | foreach $mmkey (sort keys %$self){ |
610 | print STDOUT " $mmkey => ", neatvalue($self->{$mmkey}), "\n" if $Verbose; |
611 | print STDOUT "'$mmkey' is not a known MakeMaker parameter name.\n" |
612 | unless exists $Recognized_Att_Keys{$mmkey}; |
613 | } |
614 | } |
8e07c86e |
615 | |
e05e23b1 |
616 | sub check_hints { |
617 | my($self) = @_; |
618 | # We allow extension-specific hints files. |
864a5fa8 |
619 | |
e05e23b1 |
620 | return unless -d "hints"; |
8e07c86e |
621 | |
e05e23b1 |
622 | # First we look for the best hintsfile we have |
623 | my(@goodhints); |
624 | my($hint)="$Config{osname}_$Config{osvers}"; |
625 | $hint =~ s/\./_/g; |
626 | $hint =~ s/_$//; |
627 | return unless $hint; |
fed7345c |
628 | |
e05e23b1 |
629 | # Also try without trailing minor version numbers. |
630 | while (1) { |
631 | last if -f "hints/$hint.pl"; # found |
632 | } continue { |
633 | last unless $hint =~ s/_[^_]*$//; # nothing to cut off |
634 | } |
635 | return unless -f "hints/$hint.pl"; # really there |
fed7345c |
636 | |
e05e23b1 |
637 | # execute the hintsfile: |
638 | my $fh = new FileHandle; |
639 | $fh->open("hints/$hint.pl"); |
640 | @goodhints = <$fh>; |
641 | $fh->close; |
642 | print STDOUT "Processing hints file hints/$hint.pl\n"; |
643 | eval join('',@goodhints); |
644 | print STDOUT $@ if $@; |
645 | } |
8e07c86e |
646 | |
e05e23b1 |
647 | sub mv_all_methods { |
648 | my($from,$to) = @_; |
649 | my($method); |
650 | my($symtab) = \%{"${from}::"}; |
651 | # no strict; |
fed7345c |
652 | |
e05e23b1 |
653 | # Here you see the *current* list of methods that are overridable |
654 | # from Makefile.PL via MY:: subroutines. As of VERSION 5.07 I'm |
655 | # still trying to reduce the list to some reasonable minimum -- |
656 | # because I want to make it easier for the user. A.K. |
40000a8c |
657 | |
e05e23b1 |
658 | foreach $method (@MM_Sections, qw[ dir_target |
659 | fileparse fileparse_set_fstype installpm_x libscan makeaperl |
660 | mksymlists needs_linking subdir_x test_via_harness |
661 | test_via_script writedoc ]) { |
fed7345c |
662 | |
e05e23b1 |
663 | # We cannot say "next" here. Nick might call MY->makeaperl |
664 | # which isn't defined right now |
fed7345c |
665 | |
e05e23b1 |
666 | # next unless defined &{"${from}::$method"}; |
fed7345c |
667 | |
e05e23b1 |
668 | *{"${to}::$method"} = \&{"${from}::$method"}; |
8e07c86e |
669 | |
e05e23b1 |
670 | # delete would do, if we were sure, nobody ever called |
671 | # MY->makeaperl directly |
232e078e |
672 | |
e05e23b1 |
673 | # delete $symtab->{$method}; |
fed7345c |
674 | |
e05e23b1 |
675 | # If we delete a method, then it will be undefined and cannot |
676 | # be called. But as long as we have Makefile.PLs that rely on |
677 | # %MY:: being intact, we have to fill the hole with an |
678 | # inheriting method: |
fed7345c |
679 | |
e05e23b1 |
680 | eval "package MY; sub $method {local *$method; shift->MY::$method(\@_); }"; |
5d94fbed |
681 | |
5d94fbed |
682 | } |
683 | |
e05e23b1 |
684 | # We have to clean out %INC also, because the current directory is |
685 | # changed frequently and Graham Barr prefers to get his version |
686 | # out of a History.pl file which is "required" so woudn't get |
687 | # loaded again in another extension requiring a History.pl |
a0d0e21e |
688 | |
e05e23b1 |
689 | my $inc; |
690 | foreach $inc (keys %INC) { |
691 | next if $NORMAL_INC{$inc}; |
692 | #warn "***$inc*** deleted"; |
693 | delete $INC{$inc}; |
8e07c86e |
694 | } |
a0d0e21e |
695 | |
8e07c86e |
696 | } |
697 | |
e05e23b1 |
698 | sub prompt { |
699 | my($mess,$def)=@_; |
700 | BEGIN { $ISA_TTY = -t STDIN && -t STDOUT } |
701 | Carp::confess("prompt function called without an argument") unless defined $mess; |
702 | $def = "" unless defined $def; |
703 | my $dispdef = "[$def] "; |
704 | my $ans; |
705 | if ($ISA_TTY) { |
706 | local $|=1; |
707 | print "$mess $dispdef"; |
708 | chop($ans = <STDIN>); |
8e07c86e |
709 | } |
e05e23b1 |
710 | return $ans if defined $ans; |
711 | return $def; |
42793c05 |
712 | } |
fed7345c |
713 | |
e05e23b1 |
714 | sub help {print &attrib_help, "\n";} |
8e07c86e |
715 | |
e05e23b1 |
716 | sub skipcheck{ |
8e07c86e |
717 | my($self) = shift; |
e05e23b1 |
718 | my($section) = @_; |
719 | if ($section eq 'dynamic') { |
720 | print STDOUT "Warning (non-fatal): Target 'dynamic' depends on targets ", |
721 | "in skipped section 'dynamic_bs'\n" |
722 | if $self->{SKIPHASH}{dynamic_bs} && $Verbose; |
723 | print STDOUT "Warning (non-fatal): Target 'dynamic' depends on targets ", |
724 | "in skipped section 'dynamic_lib'\n" |
725 | if $self->{SKIPHASH}{dynamic_lib} && $Verbose; |
8e07c86e |
726 | } |
e05e23b1 |
727 | if ($section eq 'dynamic_lib') { |
728 | print STDOUT "Warning (non-fatal): Target '\$(INST_DYNAMIC)' depends on ", |
729 | "targets in skipped section 'dynamic_bs'\n" |
730 | if $self->{SKIPHASH}{dynamic_bs} && $Verbose; |
731 | } |
732 | if ($section eq 'static') { |
733 | print STDOUT "Warning (non-fatal): Target 'static' depends on targets ", |
734 | "in skipped section 'static_lib'\n" |
735 | if $self->{SKIPHASH}{static_lib} && $Verbose; |
8e07c86e |
736 | } |
e05e23b1 |
737 | return 'skipped' if $self->{SKIPHASH}{$section}; |
738 | return ''; |
8e07c86e |
739 | } |
740 | |
e05e23b1 |
741 | sub flush { |
742 | my $self = shift; |
743 | my($chunk); |
744 | my $fh = new FileHandle; |
745 | print STDOUT "Writing $self->{MAKEFILE} for $self->{NAME}\n"; |
8e07c86e |
746 | |
e05e23b1 |
747 | unlink($self->{MAKEFILE}, "MakeMaker.tmp", $Is_VMS ? 'Descrip.MMS' : ''); |
748 | $fh->open(">MakeMaker.tmp") or die "Unable to open MakeMaker.tmp: $!"; |
8e07c86e |
749 | |
e05e23b1 |
750 | for $chunk (@{$self->{RESULT}}) { |
751 | print $fh "$chunk\n"; |
8e07c86e |
752 | } |
e05e23b1 |
753 | |
754 | $fh->close; |
755 | my($finalname) = $self->{MAKEFILE}; |
756 | rename("MakeMaker.tmp", $finalname); |
757 | chmod 0644, $finalname unless $Is_VMS; |
758 | system("$Config::Config{eunicefix} $finalname") unless $Config::Config{eunicefix} eq ":"; |
40000a8c |
759 | } |
760 | |
e05e23b1 |
761 | # The following mkbootstrap() is only for installations that are calling |
762 | # the pre-4.1 mkbootstrap() from their old Makefiles. This MakeMaker |
763 | # writes Makefiles, that use ExtUtils::Mkbootstrap directly. |
764 | sub mkbootstrap { |
765 | die <<END; |
766 | !!! Your Makefile has been built such a long time ago, !!! |
767 | !!! that is unlikely to work with current MakeMaker. !!! |
768 | !!! Please rebuild your Makefile !!! |
769 | END |
8e07c86e |
770 | } |
005c1a0e |
771 | |
e05e23b1 |
772 | # Ditto for mksymlists() as of MakeMaker 5.17 |
773 | sub mksymlists { |
774 | die <<END; |
775 | !!! Your Makefile has been built such a long time ago, !!! |
776 | !!! that is unlikely to work with current MakeMaker. !!! |
777 | !!! Please rebuild your Makefile !!! |
778 | END |
4633a7c4 |
779 | } |
780 | |
e05e23b1 |
781 | sub neatvalue { |
782 | my($v) = @_; |
783 | return "undef" unless defined $v; |
784 | my($t) = ref $v; |
785 | return "q[$v]" unless $t; |
786 | if ($t eq 'ARRAY') { |
787 | my(@m, $elem, @neat); |
788 | push @m, "["; |
789 | foreach $elem (@$v) { |
790 | push @neat, "q[$elem]"; |
791 | } |
792 | push @m, join ", ", @neat; |
793 | push @m, "]"; |
794 | return join "", @m; |
795 | } |
796 | return "$v" unless $t eq 'HASH'; |
797 | my(@m, $key, $val); |
798 | push(@m,"$key=>".neatvalue($val)) while (($key,$val) = each %$v); |
799 | return "{ ".join(', ',@m)." }"; |
4e68a208 |
800 | } |
801 | |
e05e23b1 |
802 | sub selfdocument { |
803 | my($self) = @_; |
804 | my(@m); |
805 | if ($Verbose){ |
806 | push @m, "\n# Full list of MakeMaker attribute values:"; |
807 | foreach $key (sort keys %$self){ |
808 | next if $key eq 'RESULT' || $key =~ /^[A-Z][a-z]/; |
809 | my($v) = neatvalue($self->{$key}); |
810 | $v =~ s/(CODE|HASH|ARRAY|SCALAR)\([\dxa-f]+\)/$1\(...\)/; |
811 | $v =~ tr/\n/ /s; |
812 | push @m, "# $key => $v"; |
813 | } |
814 | } |
815 | join "\n", @m; |
816 | } |
4e68a208 |
817 | |
005c1a0e |
818 | package ExtUtils::MakeMaker; |
819 | 1; |
820 | |
e05e23b1 |
821 | # Without selfLoader we need |
822 | __DATA__ |
823 | |
824 | |
825 | # For SelfLoader we need |
826 | # __END__ DATA |
827 | |
005c1a0e |
828 | |
829 | =head1 NAME |
830 | |
831 | ExtUtils::MakeMaker - create an extension Makefile |
832 | |
833 | =head1 SYNOPSIS |
834 | |
835 | C<use ExtUtils::MakeMaker;> |
836 | |
837 | C<WriteMakefile( ATTRIBUTE =E<gt> VALUE [, ...] );> |
838 | |
8e07c86e |
839 | which is really |
840 | |
841 | C<MM-E<gt>new(\%att)-E<gt>flush;> |
842 | |
005c1a0e |
843 | =head1 DESCRIPTION |
844 | |
845 | This utility is designed to write a Makefile for an extension module |
846 | from a Makefile.PL. It is based on the Makefile.SH model provided by |
847 | Andy Dougherty and the perl5-porters. |
848 | |
849 | It splits the task of generating the Makefile into several subroutines |
850 | that can be individually overridden. Each subroutine returns the text |
851 | it wishes to have written to the Makefile. |
852 | |
4633a7c4 |
853 | =head2 Hintsfile support |
854 | |
005c1a0e |
855 | MakeMaker.pm uses the architecture specific information from |
8e07c86e |
856 | Config.pm. In addition it evaluates architecture specific hints files |
857 | in a C<hints/> directory. The hints files are expected to be named |
858 | like their counterparts in C<PERL_SRC/hints>, but with an C<.pl> file |
859 | name extension (eg. C<next_3_2.pl>). They are simply C<eval>ed by |
860 | MakeMaker within the WriteMakefile() subroutine, and can be used to |
861 | execute commands as well as to include special variables. The rules |
862 | which hintsfile is chosen are the same as in Configure. |
863 | |
4633a7c4 |
864 | The hintsfile is eval()ed immediately after the arguments given to |
865 | WriteMakefile are stuffed into a hash reference $self but before this |
866 | reference becomes blessed. So if you want to do the equivalent to |
867 | override or create an attribute you would say something like |
868 | |
869 | $self->{LIBS} = ['-ldbm -lucb -lc']; |
870 | |
8e07c86e |
871 | =head2 What's new in version 5 of MakeMaker |
872 | |
873 | MakeMaker 5 is pure object oriented. This allows us to write an |
874 | unlimited number of Makefiles with a single perl process. 'perl |
875 | Makefile.PL' with MakeMaker 5 goes through all subdirectories |
876 | immediately and evaluates any Makefile.PL found in the next level |
877 | subdirectories. The benefit of this approach comes in useful for both |
878 | single and multi directories extensions. |
879 | |
880 | Multi directory extensions have an immediately visible speed |
881 | advantage, because there's no startup penalty for any single |
882 | subdirectory Makefile. |
883 | |
884 | Single directory packages benefit from the much improved |
885 | needs_linking() method. As the main Makefile knows everything about |
886 | the subdirectories, a needs_linking() method can now query all |
887 | subdirectories if there is any linking involved down in the tree. The |
888 | speedup for PM-only Makefiles seems to be around 1 second on my |
889 | Indy 100 MHz. |
890 | |
891 | =head2 Incompatibilities between MakeMaker 5.00 and 4.23 |
892 | |
893 | There are no incompatibilities in the short term, as all changes are |
894 | accompanied by short-term workarounds that guarantee full backwards |
895 | compatibility. |
896 | |
4633a7c4 |
897 | You are likely to face a few warnings that expose deprecations which |
8e07c86e |
898 | will result in incompatibilities in the long run: |
899 | |
900 | You should not use %att directly anymore. Instead any subroutine you |
901 | override in the MY package will be called by the object method, so you |
902 | can access all object attributes directly via the object in $_[0]. |
903 | |
904 | You should not call the class methos MM->something anymore. Instead |
905 | you should call the superclass. Something like |
906 | |
907 | sub MY::constants { |
908 | my $self = shift; |
8e07c86e |
909 | $self->MM::constants(); |
910 | } |
911 | |
912 | Especially the libscan() and exescan() methods should be altered |
913 | towards OO programming, that means do not expect that $_ to contain |
914 | the path but rather $_[1]. |
915 | |
8e07c86e |
916 | Try to build several extensions simultanously to debug your |
e05e23b1 |
917 | Makefile.PL. You can unpack a bunch of distributed packages within one |
918 | directory and run |
8e07c86e |
919 | |
e05e23b1 |
920 | perl -MExtUtils::MakeMaker -e 'WriteMakefile()' |
8e07c86e |
921 | |
922 | That's actually fun to watch :) |
923 | |
924 | Final suggestion: Try to delete all of your MY:: subroutines and |
925 | watch, if you really still need them. MakeMaker might already do what |
926 | you want without them. That's all about it. |
927 | |
005c1a0e |
928 | |
929 | =head2 Default Makefile Behaviour |
930 | |
931 | The automatically generated Makefile enables the user of the extension |
932 | to invoke |
933 | |
934 | perl Makefile.PL # optionally "perl Makefile.PL verbose" |
935 | make |
8e07c86e |
936 | make test # optionally set TEST_VERBOSE=1 |
937 | make install # See below |
005c1a0e |
938 | |
939 | The Makefile to be produced may be altered by adding arguments of the |
e05e23b1 |
940 | form C<KEY=VALUE>. E.g. |
005c1a0e |
941 | |
e05e23b1 |
942 | perl Makefile.PL PREFIX=/tmp/myperl5 |
005c1a0e |
943 | |
944 | Other interesting targets in the generated Makefile are |
945 | |
946 | make config # to check if the Makefile is up-to-date |
8e07c86e |
947 | make clean # delete local temp files (Makefile gets renamed) |
948 | make realclean # delete derived files (including ./blib) |
e05e23b1 |
949 | make ci # check in all the files in the MANIFEST file |
005c1a0e |
950 | make dist # see below the Distribution Support section |
951 | |
e05e23b1 |
952 | =head2 make test |
953 | |
954 | MakeMaker checks for the existence of a file named "test.pl" in the |
955 | current directory and if it exists it adds commands to the test target |
956 | of the generated Makefile that will execute the script with the proper |
957 | set of perl C<-I> options. |
958 | |
959 | MakeMaker also checks for any files matching glob("t/*.t"). It will |
960 | add commands to the test target of the generated Makefile that execute |
961 | all matching files via the L<Test::Harness> module with the C<-I> |
962 | switches set correctly. |
963 | |
964 | =head2 make install |
005c1a0e |
965 | |
8e07c86e |
966 | make alone puts all relevant files into directories that are named by |
967 | the macros INST_LIB, INST_ARCHLIB, INST_EXE, INST_MAN1DIR, and |
e05e23b1 |
968 | INST_MAN3DIR. All these default to something below ./blib if |
8e07c86e |
969 | you are I<not> building below the perl source directory. If you I<are> |
970 | building below the perl source, INST_LIB and INST_ARCHLIB default to |
4633a7c4 |
971 | ../../lib, and INST_EXE is not defined. |
005c1a0e |
972 | |
e05e23b1 |
973 | The I<install> target of the generated Makefile copies the files found |
974 | below each of the INST_* directories to their INSTALL* |
975 | counterparts. Which counterparts are chosen depends on the setting of |
976 | INSTALLDIRS according to the following table: |
005c1a0e |
977 | |
e05e23b1 |
978 | INSTALLDIRS set to |
979 | perl site |
980 | |
981 | INST_LIB INSTALLPRIVLIB INSTALLSITELIB |
982 | INST_ARCHLIB INSTALLARCHLIB INSTALLSITEARCH |
983 | INST_EXE INSTALLBIN |
984 | INST_MAN1DIR INSTALLMAN1DIR |
985 | INST_MAN3DIR INSTALLMAN3DIR |
005c1a0e |
986 | |
8e07c86e |
987 | The INSTALL... macros in turn default to their %Config |
988 | ($Config{installprivlib}, $Config{installarchlib}, etc.) counterparts. |
005c1a0e |
989 | |
e05e23b1 |
990 | If you don't want to keep the defaults, MakeMaker helps you to |
991 | minimize the typing needed: the usual relationship between |
992 | INSTALLPRIVLIB and INSTALLARCHLIB is determined by Configure at perl |
993 | compilation time. MakeMaker supports the user who sets |
994 | INSTALLPRIVLIB. If INSTALLPRIVLIB is set, but INSTALLARCHLIB not, then |
995 | MakeMaker defaults the latter to be the same subdirectory of |
996 | INSTALLPRIVLIB as Configure decided for the counterparts in %Config , |
997 | otherwise it defaults to INSTALLPRIVLIB. The same relationship holds |
998 | for INSTALLSITELIB and INSTALLSITEARCH. |
005c1a0e |
999 | |
1000 | MakeMaker gives you much more freedom than needed to configure |
1001 | internal variables and get different results. It is worth to mention, |
1002 | that make(1) also lets you configure most of the variables that are |
1003 | used in the Makefile. But in the majority of situations this will not |
1004 | be necessary, and should only be done, if the author of a package |
1005 | recommends it. |
1006 | |
005c1a0e |
1007 | |
8e07c86e |
1008 | =head2 PREFIX attribute |
005c1a0e |
1009 | |
0d8023a2 |
1010 | The PREFIX attribute can be used to set the INSTALL* attributes in one |
1011 | go. The quickest way to install a module in a non-standard place |
005c1a0e |
1012 | |
8e07c86e |
1013 | perl Makefile.PL PREFIX=~ |
005c1a0e |
1014 | |
0d8023a2 |
1015 | This will replace the string specified by $Config{prefix} in all |
1016 | $Config{install*} values. |
005c1a0e |
1017 | |
1018 | Note, that the tilde expansion is done by MakeMaker, not by perl by |
8e07c86e |
1019 | default, nor by make. |
005c1a0e |
1020 | |
005c1a0e |
1021 | If the user has superuser privileges, and is not working on AFS |
1022 | (Andrew File System) or relatives, then the defaults for |
8e07c86e |
1023 | INSTALLPRIVLIB, INSTALLARCHLIB, INSTALLBIN, etc. will be appropriate, |
005c1a0e |
1024 | and this incantation will be the best: |
1025 | |
1026 | perl Makefile.PL; make; make test |
1027 | make install |
1028 | |
8e07c86e |
1029 | make install per default writes some documentation of what has been |
e05e23b1 |
1030 | done into the file C<$(INSTALLARCHLIB)/perllocal.pod>. This feature |
1031 | can be bypassed by calling make pure_install. |
8e07c86e |
1032 | |
1033 | =head2 AFS users |
1034 | |
1035 | will have to specify the installation directories as these most |
1036 | probably have changed since perl itself has been installed. They will |
1037 | have to do this by calling |
1038 | |
e05e23b1 |
1039 | perl Makefile.PL INSTALLSITELIB=/afs/here/today \ |
8e07c86e |
1040 | INSTALLBIN=/afs/there/now INSTALLMAN3DIR=/afs/for/manpages |
1041 | make |
1042 | |
e05e23b1 |
1043 | Be careful to repeat this procedure every time you recompile an |
1044 | extension, unless you are sure the AFS installation directories are |
1045 | still valid. |
005c1a0e |
1046 | |
8e07c86e |
1047 | =head2 Static Linking of a new Perl Binary |
005c1a0e |
1048 | |
1049 | An extension that is built with the above steps is ready to use on |
1050 | systems supporting dynamic loading. On systems that do not support |
1051 | dynamic loading, any newly created extension has to be linked together |
1052 | with the available resources. MakeMaker supports the linking process |
1053 | by creating appropriate targets in the Makefile whenever an extension |
1054 | is built. You can invoke the corresponding section of the makefile with |
1055 | |
1056 | make perl |
1057 | |
1058 | That produces a new perl binary in the current directory with all |
e05e23b1 |
1059 | extensions linked in that can be found in INST_ARCHLIB , SITELIBEXP, |
1060 | and PERL_ARCHLIB. To do that, MakeMaker writes a new Makefile, on |
1061 | UNIX, this is called Makefile.aperl (may be system dependent). If you |
1062 | want to force the creation of a new perl, it is recommended, that you |
1063 | delete this Makefile.aperl, so the directories are searched-through |
1064 | for linkable libraries again. |
005c1a0e |
1065 | |
1066 | The binary can be installed into the directory where perl normally |
1067 | resides on your machine with |
1068 | |
1069 | make inst_perl |
1070 | |
1071 | To produce a perl binary with a different name than C<perl>, either say |
1072 | |
1073 | perl Makefile.PL MAP_TARGET=myperl |
1074 | make myperl |
1075 | make inst_perl |
1076 | |
1077 | or say |
1078 | |
1079 | perl Makefile.PL |
1080 | make myperl MAP_TARGET=myperl |
1081 | make inst_perl MAP_TARGET=myperl |
1082 | |
1083 | In any case you will be prompted with the correct invocation of the |
1084 | C<inst_perl> target that installs the new binary into INSTALLBIN. |
1085 | |
8e07c86e |
1086 | make inst_perl per default writes some documentation of what has been |
1087 | done into the file C<$(INSTALLARCHLIB)/perllocal.pod>. This |
1088 | can be bypassed by calling make pure_inst_perl. |
005c1a0e |
1089 | |
e05e23b1 |
1090 | Warning: the inst_perl: target will most probably overwrite your |
1091 | existing perl binary. Use with care! |
005c1a0e |
1092 | |
8e07c86e |
1093 | Sometimes you might want to build a statically linked perl although |
1094 | your system supports dynamic loading. In this case you may explicitly |
1095 | set the linktype with the invocation of the Makefile.PL or make: |
1096 | |
1097 | perl Makefile.PL LINKTYPE=static # recommended |
1098 | |
1099 | or |
1100 | |
1101 | make LINKTYPE=static # works on most systems |
1102 | |
005c1a0e |
1103 | =head2 Determination of Perl Library and Installation Locations |
1104 | |
1105 | MakeMaker needs to know, or to guess, where certain things are |
e05e23b1 |
1106 | located. Especially INST_LIB and INST_ARCHLIB (where to put the files |
1107 | during the make(1) run), PERL_LIB and PERL_ARCHLIB (where to read |
1108 | existing modules from), and PERL_INC (header files and C<libperl*.*>). |
005c1a0e |
1109 | |
1110 | Extensions may be built either using the contents of the perl source |
e05e23b1 |
1111 | directory tree or from the installed perl library. The recommended way |
1112 | is to build extensions after you have run 'make install' on perl |
1113 | itself. You can do that in any directory on your hard disk that is not |
1114 | below the perl source tree. The support for extensions below the ext |
1115 | directory of the perl distribution is only good for the standard |
1116 | extensions that come with perl. |
005c1a0e |
1117 | |
1118 | If an extension is being built below the C<ext/> directory of the perl |
e05e23b1 |
1119 | source then MakeMaker will set PERL_SRC automatically (e.g., |
1120 | C<../..>). If PERL_SRC is defined and the extension is recognized as |
1121 | a standard extension, then other variables default to the following: |
005c1a0e |
1122 | |
1123 | PERL_INC = PERL_SRC |
1124 | PERL_LIB = PERL_SRC/lib |
1125 | PERL_ARCHLIB = PERL_SRC/lib |
1126 | INST_LIB = PERL_LIB |
1127 | INST_ARCHLIB = PERL_ARCHLIB |
1128 | |
1129 | If an extension is being built away from the perl source then MakeMaker |
1130 | will leave PERL_SRC undefined and default to using the installed copy |
1131 | of the perl library. The other variables default to the following: |
1132 | |
e05e23b1 |
1133 | PERL_INC = $archlibexp/CORE |
1134 | PERL_LIB = $privlibexp |
1135 | PERL_ARCHLIB = $archlibexp |
1136 | INST_LIB = ./blib/lib |
1137 | INST_ARCHLIB = ./blib/arch |
005c1a0e |
1138 | |
1139 | If perl has not yet been installed then PERL_SRC can be defined on the |
1140 | command line as shown in the previous section. |
1141 | |
1142 | =head2 Useful Default Makefile Macros |
1143 | |
1144 | FULLEXT = Pathname for extension directory (eg DBD/Oracle). |
1145 | |
1146 | BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. |
1147 | |
1148 | ROOTEXT = Directory part of FULLEXT with leading slash (eg /DBD) |
1149 | |
005c1a0e |
1150 | INST_LIBDIR = C<$(INST_LIB)$(ROOTEXT)> |
1151 | |
1152 | INST_AUTODIR = C<$(INST_LIB)/auto/$(FULLEXT)> |
1153 | |
1154 | INST_ARCHAUTODIR = C<$(INST_ARCHLIB)/auto/$(FULLEXT)> |
1155 | |
e05e23b1 |
1156 | =head2 Using Attributes and Parameters |
005c1a0e |
1157 | |
1158 | The following attributes can be specified as arguments to WriteMakefile() |
1159 | or as NAME=VALUE pairs on the command line: |
1160 | |
8e07c86e |
1161 | =cut |
005c1a0e |
1162 | |
864a5fa8 |
1163 | # The following "=item C" is used by the attrib_help routine |
8e07c86e |
1164 | # likewise the "=back" below. So be careful when changing it! |
1165 | |
1166 | =over 2 |
1167 | |
864a5fa8 |
1168 | =item C |
8e07c86e |
1169 | |
864a5fa8 |
1170 | Ref to array of *.c file names. Initialised from a directory scan |
1171 | and the values portion of the XS attribute hash. This is not |
1172 | currently used by MakeMaker but may be handy in Makefile.PLs. |
8e07c86e |
1173 | |
864a5fa8 |
1174 | =item CONFIG |
8e07c86e |
1175 | |
864a5fa8 |
1176 | Arrayref. E.g. [qw(archname manext)] defines ARCHNAME & MANEXT from |
1177 | config.sh. MakeMaker will add to CONFIG the following values anyway: |
1178 | ar |
1179 | cc |
1180 | cccdlflags |
1181 | ccdlflags |
1182 | dlext |
1183 | dlsrc |
1184 | ld |
1185 | lddlflags |
1186 | ldflags |
1187 | libc |
1188 | lib_ext |
1189 | obj_ext |
1190 | ranlib |
e05e23b1 |
1191 | sitelibexp |
1192 | sitearchexp |
864a5fa8 |
1193 | so |
8e07c86e |
1194 | |
1195 | =item CONFIGURE |
1196 | |
e05e23b1 |
1197 | CODE reference. The subroutine should return a hash reference. The |
1198 | hash may contain further attributes, e.g. {LIBS => ...}, that have to |
8e07c86e |
1199 | be determined by some evaluation method. |
1200 | |
864a5fa8 |
1201 | =item DEFINE |
8e07c86e |
1202 | |
864a5fa8 |
1203 | Something like C<"-DHAVE_UNISTD_H"> |
8e07c86e |
1204 | |
864a5fa8 |
1205 | =item DIR |
8e07c86e |
1206 | |
864a5fa8 |
1207 | Ref to array of subdirectories containing Makefile.PLs e.g. [ 'sdbm' |
1208 | ] in ext/SDBM_File |
8e07c86e |
1209 | |
864a5fa8 |
1210 | =item DISTNAME |
8e07c86e |
1211 | |
e05e23b1 |
1212 | Your name for distributing the package (by tar file). This defaults to |
864a5fa8 |
1213 | NAME above. |
8e07c86e |
1214 | |
864a5fa8 |
1215 | =item DL_FUNCS |
8e07c86e |
1216 | |
864a5fa8 |
1217 | Hashref of symbol names for routines to be made available as |
1218 | universal symbols. Each key/value pair consists of the package name |
1219 | and an array of routine names in that package. Used only under AIX |
1220 | (export lists) and VMS (linker options) at present. The routine |
1221 | names supplied will be expanded in the same way as XSUB names are |
1222 | expanded by the XS() macro. Defaults to |
8e07c86e |
1223 | |
864a5fa8 |
1224 | {"$(NAME)" => ["boot_$(NAME)" ] } |
8e07c86e |
1225 | |
864a5fa8 |
1226 | e.g. |
8e07c86e |
1227 | |
864a5fa8 |
1228 | {"RPC" => [qw( boot_rpcb rpcb_gettime getnetconfigent )], |
1229 | "NetconfigPtr" => [ 'DESTROY'] } |
8e07c86e |
1230 | |
864a5fa8 |
1231 | =item DL_VARS |
8e07c86e |
1232 | |
864a5fa8 |
1233 | Array of symbol names for variables to be made available as |
1234 | universal symbols. Used only under AIX (export lists) and VMS |
1235 | (linker options) at present. Defaults to []. (e.g. [ qw( |
1236 | Foo_version Foo_numstreams Foo_tree ) ]) |
8e07c86e |
1237 | |
864a5fa8 |
1238 | =item EXE_FILES |
8e07c86e |
1239 | |
864a5fa8 |
1240 | Ref to array of executable files. The files will be copied to the |
1241 | INST_EXE directory. Make realclean will delete them from there |
1242 | again. |
8e07c86e |
1243 | |
864a5fa8 |
1244 | =item FIRST_MAKEFILE |
1245 | |
1246 | The name of the Makefile to be produced. Defaults to the contents of |
1247 | MAKEFILE, but can be overridden. This is used for the second Makefile |
1248 | that will be produced for the MAP_TARGET. |
1249 | |
1250 | =item FULLPERL |
8e07c86e |
1251 | |
864a5fa8 |
1252 | Perl binary able to run this extension. |
1253 | |
1254 | =item H |
1255 | |
1256 | Ref to array of *.h file names. Similar to C. |
1257 | |
1258 | =item INC |
1259 | |
1260 | Include file dirs eg: C<"-I/usr/5include -I/path/to/inc"> |
1261 | |
1262 | =item INSTALLARCHLIB |
1263 | |
e05e23b1 |
1264 | Used by 'make install', which copies files from INST_ARCHLIB to this |
1265 | directory if INSTALLDIRS is set to perl. |
864a5fa8 |
1266 | |
1267 | =item INSTALLBIN |
1268 | |
e05e23b1 |
1269 | Used by 'make install' which copies files from INST_EXE to this |
1270 | directory. |
1271 | |
1272 | =item INSTALLDIRS |
1273 | |
1274 | Determines which of the two sets of installation directories to |
1275 | choose: installprivlib and installarchlib versus installsitelib and |
1276 | installsitearch. The first pair is chosen with INSTALLDIRS=perl, the |
1277 | second with INSTALLDIRS=site. Default is site. |
8e07c86e |
1278 | |
1279 | =item INSTALLMAN1DIR |
1280 | |
864a5fa8 |
1281 | This directory gets the man pages at 'make install' time. Defaults to |
1282 | $Config{installman1dir}. |
1283 | |
8e07c86e |
1284 | =item INSTALLMAN3DIR |
1285 | |
864a5fa8 |
1286 | This directory gets the man pages at 'make install' time. Defaults to |
1287 | $Config{installman3dir}. |
8e07c86e |
1288 | |
864a5fa8 |
1289 | =item INSTALLPRIVLIB |
8e07c86e |
1290 | |
e05e23b1 |
1291 | Used by 'make install', which copies files from INST_LIB to this |
1292 | directory if INSTALLDIRS is set to perl. |
1293 | |
1294 | =item INSTALLSITELIB |
1295 | |
1296 | Used by 'make install', which copies files from INST_LIB to this |
1297 | directory if INSTALLDIRS is set to site (default). |
1298 | |
1299 | =item INSTALLSITEARCH |
1300 | |
1301 | Used by 'make install', which copies files from INST_ARCHLIB to this |
1302 | directory if INSTALLDIRS is set to site (default). |
8e07c86e |
1303 | |
864a5fa8 |
1304 | =item INST_ARCHLIB |
8e07c86e |
1305 | |
864a5fa8 |
1306 | Same as INST_LIB for architecture dependent files. |
8e07c86e |
1307 | |
864a5fa8 |
1308 | =item INST_EXE |
8e07c86e |
1309 | |
864a5fa8 |
1310 | Directory, where executable scripts should be installed during |
e05e23b1 |
1311 | 'make'. Defaults to "./blib/bin", just to have a dummy location during |
1312 | testing. make install will copy the files in INST_EXE to INSTALLBIN. |
8e07c86e |
1313 | |
864a5fa8 |
1314 | =item INST_LIB |
8e07c86e |
1315 | |
864a5fa8 |
1316 | Directory where we put library files of this extension while building |
1317 | it. |
8e07c86e |
1318 | |
864a5fa8 |
1319 | =item INST_MAN1DIR |
8e07c86e |
1320 | |
864a5fa8 |
1321 | Directory to hold the man pages at 'make' time |
8e07c86e |
1322 | |
864a5fa8 |
1323 | =item INST_MAN3DIR |
8e07c86e |
1324 | |
864a5fa8 |
1325 | Directory to hold the man pages at 'make' time |
8e07c86e |
1326 | |
864a5fa8 |
1327 | =item LDFROM |
8e07c86e |
1328 | |
864a5fa8 |
1329 | defaults to "$(OBJECT)" and is used in the ld command to specify |
1330 | what files to link/load from (also see dynamic_lib below for how to |
1331 | specify ld flags) |
8e07c86e |
1332 | |
864a5fa8 |
1333 | =item LIBPERL_A |
8e07c86e |
1334 | |
864a5fa8 |
1335 | The filename of the perllibrary that will be used together with this |
1336 | extension. Defaults to libperl.a. |
8e07c86e |
1337 | |
1338 | =item LIBS |
1339 | |
1340 | An anonymous array of alternative library |
1341 | specifications to be searched for (in order) until |
864a5fa8 |
1342 | at least one library is found. E.g. |
8e07c86e |
1343 | |
1344 | 'LIBS' => ["-lgdbm", "-ldbm -lfoo", "-L/path -ldbm.nfs"] |
1345 | |
1346 | Mind, that any element of the array |
1347 | contains a complete set of arguments for the ld |
1348 | command. So do not specify |
1349 | |
1350 | 'LIBS' => ["-ltcl", "-ltk", "-lX11"] |
1351 | |
1352 | See ODBM_File/Makefile.PL for an example, where an array is needed. If |
1353 | you specify a scalar as in |
1354 | |
1355 | 'LIBS' => "-ltcl -ltk -lX11" |
1356 | |
1357 | MakeMaker will turn it into an array with one element. |
1358 | |
864a5fa8 |
1359 | =item LINKTYPE |
8e07c86e |
1360 | |
e05e23b1 |
1361 | 'static' or 'dynamic' (default unless usedl=undef in |
1362 | config.sh). Should only be used to force static linking (also see |
864a5fa8 |
1363 | linkext below). |
8e07c86e |
1364 | |
864a5fa8 |
1365 | =item MAKEAPERL |
8e07c86e |
1366 | |
864a5fa8 |
1367 | Boolean which tells MakeMaker, that it should include the rules to |
1368 | make a perl. This is handled automatically as a switch by |
1369 | MakeMaker. The user normally does not need it. |
8e07c86e |
1370 | |
864a5fa8 |
1371 | =item MAKEFILE |
8e07c86e |
1372 | |
864a5fa8 |
1373 | The name of the Makefile to be produced. |
8e07c86e |
1374 | |
864a5fa8 |
1375 | =item MAN1PODS |
8e07c86e |
1376 | |
864a5fa8 |
1377 | Hashref of pod-containing files. MakeMaker will default this to all |
1378 | EXE_FILES files that include POD directives. The files listed |
1379 | here will be converted to man pages and installed as was requested |
1380 | at Configure time. |
8e07c86e |
1381 | |
864a5fa8 |
1382 | =item MAN3PODS |
8e07c86e |
1383 | |
864a5fa8 |
1384 | Hashref of .pm and .pod files. MakeMaker will default this to all |
1385 | .pod and any .pm files that include POD directives. The files listed |
1386 | here will be converted to man pages and installed as was requested |
1387 | at Configure time. |
8e07c86e |
1388 | |
864a5fa8 |
1389 | =item MAP_TARGET |
8e07c86e |
1390 | |
864a5fa8 |
1391 | If it is intended, that a new perl binary be produced, this variable |
1392 | may hold a name for that binary. Defaults to perl |
8e07c86e |
1393 | |
864a5fa8 |
1394 | =item MYEXTLIB |
4633a7c4 |
1395 | |
864a5fa8 |
1396 | If the extension links to a library that it builds set this to the |
1397 | name of the library (see SDBM_File) |
4633a7c4 |
1398 | |
864a5fa8 |
1399 | =item NAME |
8e07c86e |
1400 | |
864a5fa8 |
1401 | Perl module name for this extension (DBD::Oracle). This will default |
1402 | to the directory name but should be explicitly defined in the |
1403 | Makefile.PL. |
8e07c86e |
1404 | |
864a5fa8 |
1405 | =item NEEDS_LINKING |
8e07c86e |
1406 | |
864a5fa8 |
1407 | MakeMaker will figure out, if an extension contains linkable code |
1408 | anywhere down the directory tree, and will set this variable |
1409 | accordingly, but you can speed it up a very little bit, if you define |
1410 | this boolean variable yourself. |
8e07c86e |
1411 | |
e05e23b1 |
1412 | =item NOECHO |
1413 | |
1414 | Defaults the C<@>. By setting it to an empty string you can generate a |
1415 | Makefile that echos all commands. Mainly used in debugging MakeMaker |
1416 | itself. |
1417 | |
864a5fa8 |
1418 | =item NORECURS |
8e07c86e |
1419 | |
e05e23b1 |
1420 | Boolean. Attribute to inhibit descending into subdirectories. |
8e07c86e |
1421 | |
864a5fa8 |
1422 | =item OBJECT |
8e07c86e |
1423 | |
864a5fa8 |
1424 | List of object files, defaults to '$(BASEEXT)$(OBJ_EXT)', but can be a long |
1425 | string containing all object files, e.g. "tkpBind.o |
1426 | tkpButton.o tkpCanvas.o" |
8e07c86e |
1427 | |
864a5fa8 |
1428 | =item PERL |
8e07c86e |
1429 | |
864a5fa8 |
1430 | Perl binary for tasks that can be done by miniperl |
8e07c86e |
1431 | |
864a5fa8 |
1432 | =item PERLMAINCC |
005c1a0e |
1433 | |
864a5fa8 |
1434 | The call to the program that is able to compile perlmain.c. Defaults |
1435 | to $(CC). |
005c1a0e |
1436 | |
864a5fa8 |
1437 | =item PERL_ARCHLIB |
005c1a0e |
1438 | |
864a5fa8 |
1439 | Same as above for architecture dependent files |
8e07c86e |
1440 | |
864a5fa8 |
1441 | =item PERL_LIB |
8e07c86e |
1442 | |
864a5fa8 |
1443 | Directory containing the Perl library to use. |
8e07c86e |
1444 | |
864a5fa8 |
1445 | =item PERL_SRC |
8e07c86e |
1446 | |
864a5fa8 |
1447 | Directory containing the Perl source code (use of this should be |
1448 | avoided, it may be undefined) |
8e07c86e |
1449 | |
864a5fa8 |
1450 | =item PL_FILES |
8e07c86e |
1451 | |
864a5fa8 |
1452 | Ref to hash of files to be processed as perl programs. MakeMaker |
1453 | will default to any found *.PL file (except Makefile.PL) being keys |
1454 | and the basename of the file being the value. E.g. |
8e07c86e |
1455 | |
864a5fa8 |
1456 | {'foobar.PL' => 'foobar'} |
8e07c86e |
1457 | |
864a5fa8 |
1458 | The *.PL files are expected to produce output to the target files |
1459 | themselves. |
8e07c86e |
1460 | |
864a5fa8 |
1461 | =item PM |
8e07c86e |
1462 | |
864a5fa8 |
1463 | Hashref of .pm files and *.pl files to be installed. e.g. |
8e07c86e |
1464 | |
864a5fa8 |
1465 | {'name_of_file.pm' => '$(INST_LIBDIR)/install_as.pm'} |
8e07c86e |
1466 | |
864a5fa8 |
1467 | By default this will include *.pm and *.pl. If a lib directory |
1468 | exists and is not listed in DIR (above) then any *.pm and *.pl files |
1469 | it contains will also be included by default. Defining PM in the |
1470 | Makefile.PL will override PMLIBDIRS. |
8e07c86e |
1471 | |
864a5fa8 |
1472 | =item PMLIBDIRS |
8e07c86e |
1473 | |
864a5fa8 |
1474 | Ref to array of subdirectories containing library files. Defaults to |
1475 | [ 'lib', $(BASEEXT) ]. The directories will be scanned and any files |
1476 | they contain will be installed in the corresponding location in the |
1477 | library. A libscan() method can be used to alter the behaviour. |
1478 | Defining PM in the Makefile.PL will override PMLIBDIRS. |
8e07c86e |
1479 | |
864a5fa8 |
1480 | =item PREFIX |
8e07c86e |
1481 | |
864a5fa8 |
1482 | Can be used to set the three INSTALL* attributes in one go (except for |
e05e23b1 |
1483 | probably INSTALLMAN1DIR, if it is not below PREFIX according to |
1484 | %Config). They will have PREFIX as a common directory node and will |
1485 | branch from that node into lib/, lib/ARCHNAME or whatever Configure |
1486 | decided at the build time of your perl (unless you override one of |
1487 | them, of course). |
8e07c86e |
1488 | |
864a5fa8 |
1489 | =item PREREQ |
8e07c86e |
1490 | |
864a5fa8 |
1491 | Placeholder, not yet implemented. Will eventually be a hashref: Names |
1492 | of modules that need to be available to run this extension (e.g. Fcntl |
1493 | for SDBM_File) are the keys of the hash and the desired version is the |
1494 | value. Needs further evaluation, should probably allow to define |
1495 | prerequisites among header files, libraries, perl version, etc. |
8e07c86e |
1496 | |
864a5fa8 |
1497 | =item SKIP |
8e07c86e |
1498 | |
864a5fa8 |
1499 | Arryref. E.g. [qw(name1 name2)] skip (do not write) sections of the |
1500 | Makefile |
8e07c86e |
1501 | |
864a5fa8 |
1502 | =item TYPEMAPS |
8e07c86e |
1503 | |
864a5fa8 |
1504 | Ref to array of typemap file names. Use this when the typemaps are |
1505 | in some directory other than the current directory or when they are |
1506 | not named B<typemap>. The last typemap in the list takes |
1507 | precedence. A typemap in the current directory has highest |
1508 | precedence, even if it isn't listed in TYPEMAPS. The default system |
1509 | typemap has lowest precedence. |
8e07c86e |
1510 | |
864a5fa8 |
1511 | =item VERSION |
8e07c86e |
1512 | |
864a5fa8 |
1513 | Your version number for distributing the package. This defaults to |
1514 | 0.1. |
8e07c86e |
1515 | |
0d8023a2 |
1516 | =item VERSION_FROM |
1517 | |
1518 | Instead of specifying the VERSION in the Makefile.PL you can let |
1519 | MakeMaker parse a file to determine the version number. The parsing |
1520 | routine requires that the file named by VERSION_FROM contains one |
1521 | single line to compute the version number. The first line in the file |
1522 | that contains the regular expression |
1523 | |
1524 | /(\$[\w:]*\bVERSION)\b.*=/ |
1525 | |
1526 | will be evaluated with eval() and the value of the named variable |
1527 | B<after> the eval() will be assigned to the VERSION attribute of the |
1528 | MakeMaker object. The following lines will be parsed o.k.: |
1529 | |
1530 | $VERSION = '1.00'; |
e05e23b1 |
1531 | ( $VERSION ) = '$Revision: 1.174 $ ' =~ /\$Revision:\s+([^\s]+)/; |
0d8023a2 |
1532 | $FOO::VERSION = '1.10'; |
1533 | |
1534 | but these will fail: |
1535 | |
1536 | my $VERSION = '1.01'; |
1537 | local $VERSION = '1.02'; |
1538 | local $FOO::VERSION = '1.30'; |
1539 | |
1540 | The file named in VERSION_FROM is added as a dependency to Makefile to |
1541 | guarantee, that the Makefile contains the correct VERSION macro after |
1542 | a change of the file. |
1543 | |
864a5fa8 |
1544 | =item XS |
8e07c86e |
1545 | |
864a5fa8 |
1546 | Hashref of .xs files. MakeMaker will default this. e.g. |
8e07c86e |
1547 | |
864a5fa8 |
1548 | {'name_of_file.xs' => 'name_of_file.c'} |
8e07c86e |
1549 | |
864a5fa8 |
1550 | The .c files will automatically be included in the list of files |
1551 | deleted by a make clean. |
4633a7c4 |
1552 | |
864a5fa8 |
1553 | =item XSOPT |
8e07c86e |
1554 | |
864a5fa8 |
1555 | String of options to pass to xsubpp. This might include C<-C++> or |
1556 | C<-extern>. Do not include typemaps here; the TYPEMAP parameter exists for |
1557 | that purpose. |
8e07c86e |
1558 | |
864a5fa8 |
1559 | =item XSPROTOARG |
4633a7c4 |
1560 | |
4e68a208 |
1561 | May be set to an empty string, which is identical to C<-prototypes>, or |
864a5fa8 |
1562 | C<-noprototypes>. See the xsubpp documentation for details. MakeMaker |
4e68a208 |
1563 | defaults to the empty string. |
1564 | |
0d8023a2 |
1565 | =item XS_VERSION |
1566 | |
1567 | Your version number for the .xs file of this package. This defaults |
1568 | to the value of the VERSION attribute. |
1569 | |
8e07c86e |
1570 | =back |
1571 | |
1572 | =head2 Additional lowercase attributes |
1573 | |
1574 | can be used to pass parameters to the methods which implement that |
1575 | part of the Makefile. These are not normally required: |
1576 | |
1577 | =over 2 |
1578 | |
864a5fa8 |
1579 | =item clean |
8e07c86e |
1580 | |
864a5fa8 |
1581 | {FILES => "*.xyz foo"} |
1582 | |
c07a80fd |
1583 | =item depend |
1584 | |
1585 | {ANY_TARGET => ANY_DEPENDECY, ...} |
1586 | |
864a5fa8 |
1587 | =item dist |
1588 | |
1589 | {TARFLAGS => 'cvfF', COMPRESS => 'gzip', SUFFIX => 'gz', |
1590 | SHAR => 'shar -m', DIST_CP => 'ln'} |
1591 | |
1592 | If you specify COMPRESS, then SUFFIX should also be altered, as it is |
1593 | needed to tell make the target file of the compression. Setting |
1594 | DIST_CP to ln can be useful, if you need to preserve the timestamps on |
1595 | your files. DIST_CP can take the values 'cp', which copies the file, |
1596 | 'ln', which links the file, and 'best' which copies symbolic links and |
1597 | links the rest. Default is 'best'. |
1598 | |
1599 | =item dynamic_lib |
1600 | |
0d8023a2 |
1601 | {ARMAYBE => 'ar', OTHERLDFLAGS => '...', INST_DYNAMIC_DEP => '...'} |
8e07c86e |
1602 | |
1603 | =item installpm |
1604 | |
1605 | {SPLITLIB => '$(INST_LIB)' (default) or '$(INST_ARCHLIB)'} |
1606 | |
1607 | =item linkext |
1608 | |
1609 | {LINKTYPE => 'static', 'dynamic' or ''} |
1610 | |
864a5fa8 |
1611 | NB: Extensions that have nothing but *.pm files had to say |
8e07c86e |
1612 | |
1613 | {LINKTYPE => ''} |
1614 | |
864a5fa8 |
1615 | with Pre-5.0 MakeMakers. Since version 5.00 of MakeMaker such a line |
1616 | can be deleted safely. MakeMaker recognizes, when there's nothing to |
1617 | be linked. |
8e07c86e |
1618 | |
864a5fa8 |
1619 | =item macro |
8e07c86e |
1620 | |
864a5fa8 |
1621 | {ANY_MACRO => ANY_VALUE, ...} |
8e07c86e |
1622 | |
1623 | =item realclean |
1624 | |
1625 | {FILES => '$(INST_ARCHAUTODIR)/*.xyz'} |
1626 | |
8e07c86e |
1627 | =item tool_autosplit |
1628 | |
1629 | {MAXLEN =E<gt> 8} |
005c1a0e |
1630 | |
1631 | =back |
1632 | |
8e07c86e |
1633 | =cut |
1634 | |
1635 | # bug in pod2html, so leave the =back |
1636 | |
1637 | # Don't delete this cut, MM depends on it! |
1638 | |
005c1a0e |
1639 | =head2 Overriding MakeMaker Methods |
1640 | |
1641 | If you cannot achieve the desired Makefile behaviour by specifying |
1642 | attributes you may define private subroutines in the Makefile.PL. |
1643 | Each subroutines returns the text it wishes to have written to |
1644 | the Makefile. To override a section of the Makefile you can |
1645 | either say: |
1646 | |
1647 | sub MY::c_o { "new literal text" } |
1648 | |
1649 | or you can edit the default by saying something like: |
1650 | |
8e07c86e |
1651 | sub MY::c_o { |
1652 | my $self = shift; |
1653 | local *c_o; |
1654 | $_=$self->MM::c_o; |
1655 | s/old text/new text/; |
1656 | $_; |
1657 | } |
1658 | |
1659 | Both methods above are available for backwards compatibility with |
1660 | older Makefile.PLs. |
005c1a0e |
1661 | |
1662 | If you still need a different solution, try to develop another |
1663 | subroutine, that fits your needs and submit the diffs to |
8e07c86e |
1664 | F<perl5-porters@nicoh.com> or F<comp.lang.perl.misc> as appropriate. |
005c1a0e |
1665 | |
1666 | =head2 Distribution Support |
1667 | |
1668 | For authors of extensions MakeMaker provides several Makefile |
1669 | targets. Most of the support comes from the ExtUtils::Manifest module, |
1670 | where additional documentation can be found. |
1671 | |
1672 | =over 4 |
1673 | |
1674 | =item make distcheck |
8e07c86e |
1675 | |
005c1a0e |
1676 | reports which files are below the build directory but not in the |
1677 | MANIFEST file and vice versa. (See ExtUtils::Manifest::fullcheck() for |
1678 | details) |
1679 | |
4633a7c4 |
1680 | =item make skipcheck |
1681 | |
1682 | reports which files are skipped due to the entries in the |
1683 | C<MANIFEST.SKIP> file (See ExtUtils::Manifest::skipcheck() for |
1684 | details) |
1685 | |
005c1a0e |
1686 | =item make distclean |
8e07c86e |
1687 | |
005c1a0e |
1688 | does a realclean first and then the distcheck. Note that this is not |
1689 | needed to build a new distribution as long as you are sure, that the |
1690 | MANIFEST file is ok. |
1691 | |
1692 | =item make manifest |
8e07c86e |
1693 | |
005c1a0e |
1694 | rewrites the MANIFEST file, adding all remaining files found (See |
1695 | ExtUtils::Manifest::mkmanifest() for details) |
1696 | |
1697 | =item make distdir |
8e07c86e |
1698 | |
005c1a0e |
1699 | Copies all the files that are in the MANIFEST file to a newly created |
1700 | directory with the name C<$(DISTNAME)-$(VERSION)>. If that directory |
1701 | exists, it will be removed first. |
1702 | |
8e07c86e |
1703 | =item make disttest |
1704 | |
1705 | Makes a distdir first, and runs a C<perl Makefile.PL>, a make, and |
4633a7c4 |
1706 | a make test in that directory. |
8e07c86e |
1707 | |
005c1a0e |
1708 | =item make tardist |
8e07c86e |
1709 | |
005c1a0e |
1710 | First does a command $(PREOP) which defaults to a null command. Does a |
1711 | distdir next and runs C<tar> on that directory into a tarfile. Then |
1712 | deletes the distdir. Finishes with a command $(POSTOP) which defaults |
1713 | to a null command. |
1714 | |
1715 | =item make dist |
8e07c86e |
1716 | |
005c1a0e |
1717 | Defaults to $(DIST_DEFAULT) which in turn defaults to tardist. |
1718 | |
1719 | =item make uutardist |
8e07c86e |
1720 | |
005c1a0e |
1721 | Runs a tardist first and uuencodes the tarfile. |
1722 | |
1723 | =item make shdist |
8e07c86e |
1724 | |
005c1a0e |
1725 | First does a command $(PREOP) which defaults to a null command. Does a |
1726 | distdir next and runs C<shar> on that directory into a sharfile. Then |
1727 | deletes the distdir. Finishes with a command $(POSTOP) which defaults |
1728 | to a null command. Note: For shdist to work properly a C<shar> |
1729 | program that can handle directories is mandatory. |
1730 | |
1731 | =item make ci |
8e07c86e |
1732 | |
1733 | Does a $(CI) and a $(RCS_LABEL) on all files in the MANIFEST file. |
1734 | |
1735 | =back |
005c1a0e |
1736 | |
1737 | Customization of the dist targets can be done by specifying a hash |
1738 | reference to the dist attribute of the WriteMakefile call. The |
1739 | following parameters are recognized: |
1740 | |
8e07c86e |
1741 | CI ('ci -u') |
005c1a0e |
1742 | COMPRESS ('compress') |
005c1a0e |
1743 | POSTOP ('@ :') |
8e07c86e |
1744 | PREOP ('@ :') |
1745 | RCS_LABEL ('rcs -q -Nv$(VERSION_SYM):') |
1746 | SHAR ('shar') |
1747 | SUFFIX ('Z') |
1748 | TAR ('tar') |
1749 | TARFLAGS ('cvf') |
005c1a0e |
1750 | |
1751 | An example: |
1752 | |
1753 | WriteMakefile( 'dist' => { COMPRESS=>"gzip", SUFFIX=>"gz" }) |
1754 | |
005c1a0e |
1755 | |
e05e23b1 |
1756 | =head1 AUTHORS |
fed7345c |
1757 | |
1758 | Andy Dougherty F<E<lt>doughera@lafcol.lafayette.eduE<gt>>, Andreas |
8e07c86e |
1759 | KE<ouml>nig F<E<lt>A.Koenig@franz.ww.TU-Berlin.DEE<gt>>, Tim Bunce |
fed7345c |
1760 | F<E<lt>Tim.Bunce@ig.co.ukE<gt>>. VMS support by Charles Bailey |
e05e23b1 |
1761 | F<E<lt>bailey@HMIVAX.HUMGEN.UPENN.EDUE<gt>>. OS/2 support by Ilya |
1762 | Zakharevich F<E<lt>ilya@math.ohio-state.eduE<gt>>. Contact the |
1763 | makemaker mailing list C<mailto:makemaker@franz.ww.tu-berlin.de>, if |
1764 | you have any questions. |
fed7345c |
1765 | |
1766 | =head1 MODIFICATION HISTORY |
1767 | |
8e07c86e |
1768 | For a more complete documentation see the file Changes in the |
1769 | MakeMaker distribution package. |
e50aee73 |
1770 | |
005c1a0e |
1771 | =head1 TODO |
f06db76b |
1772 | |
8e07c86e |
1773 | See the file Todo in the MakeMaker distribution package. |
005c1a0e |
1774 | |
1775 | =cut |