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