Commit | Line | Data |
a0d0e21e |
1 | package ExtUtils::MakeMaker; |
2 | |
75f92628 |
3 | $Version = 4.01; # Last edited 25th Jan 1995 by Tim Bunce |
a0d0e21e |
4 | |
5 | use Config; |
42793c05 |
6 | use Carp; |
7 | use Cwd; |
8 | |
a0d0e21e |
9 | require Exporter; |
10 | @ISA = qw(Exporter); |
3edbfbe5 |
11 | @EXPORT = qw(&WriteMakefile &mkbootstrap $Verbose); |
12 | @EXPORT_OK = qw($Version %att %skip %Recognized_Att_Keys |
13 | @MM_Sections %MM_Sections |
14 | &help &lsdir); |
a0d0e21e |
15 | |
42793c05 |
16 | $Is_VMS = $Config{'osname'} eq 'VMS'; |
17 | require ExtUtils::MM_VMS if $Is_VMS; |
a0d0e21e |
18 | |
42793c05 |
19 | use strict qw(refs); |
a0d0e21e |
20 | |
42793c05 |
21 | $Version = $Version;# avoid typo warning |
a0d0e21e |
22 | $Verbose = 0; |
a0d0e21e |
23 | $^W=1; |
24 | |
25 | |
42793c05 |
26 | =head1 NAME |
a0d0e21e |
27 | |
42793c05 |
28 | ExtUtils::MakeMaker - create an extension Makefile |
a0d0e21e |
29 | |
42793c05 |
30 | =head1 SYNOPSIS |
a0d0e21e |
31 | |
42793c05 |
32 | use ExtUtils::MakeMaker; |
3edbfbe5 |
33 | |
42793c05 |
34 | WriteMakefile( ATTRIBUTE => VALUE [, ...] ); |
a0d0e21e |
35 | |
42793c05 |
36 | =head1 DESCRIPTION |
37 | |
38 | This utility is designed to write a Makefile for an extension module |
39 | from a Makefile.PL. It is based on the Makefile.SH model provided by |
40 | Andy Dougherty and the perl5-porters. |
41 | |
42 | It splits the task of generating the Makefile into several subroutines |
43 | that can be individually overridden. Each subroutine returns the text |
44 | it wishes to have written to the Makefile. |
45 | |
46 | =head2 Default Makefile Behaviour |
47 | |
3edbfbe5 |
48 | The automatically generated Makefile enables the user of the extension |
49 | to invoke |
50 | |
75f92628 |
51 | perl Makefile.PL |
52 | make |
53 | make test |
54 | make install # May need to invoke as root to write into INST_LIB |
55 | |
56 | The Makefile to be produced may be altered by adding arguments of the |
57 | form C<KEY=VALUE>. If the user wants to have the extension installed |
58 | into a directory different from C<$Config{"installprivlib"}> it can be |
59 | done by specifying |
60 | |
61 | perl Makefile.PL INST_LIB=~/myperllib |
62 | |
63 | Note, that in this example MakeMaker does the tilde expansion for you |
64 | and INST_ARCHLIB is set to either C<INST_LIB/$Config{"osname"}> if |
65 | that directory exists and otherwise to INST_LIB. |
66 | |
67 | Other interesting targets in the generated Makefile are |
68 | |
69 | make config # to check if the Makefile is up-to-date |
70 | make clean # delete local temporary files (Makefile gets renamed) |
71 | make realclean # delete all derived files (including installed files) |
72 | make distclean # produce a gzipped file ready for shipping |
73 | |
74 | The macros in the produced Makefile may be overriden on the command |
75 | line to the make call like: |
76 | |
77 | make INST_LIB=/some/where INST_ARCHLIB=/some/where |
78 | |
79 | Note, that this is a solution provided by C<make> in general, so tilde |
80 | expansion will probably not be available and INST_ARCHLIB will not be |
81 | set automatically when INST_LIB is given as argument. |
3edbfbe5 |
82 | |
83 | (This section is yet to be completed ...) |
42793c05 |
84 | |
85 | =head2 Determination of Perl Library and Installation Locations |
86 | |
87 | MakeMaker needs to know, or to guess, where certain things are located. |
88 | Especially INST_LIB, INST_ARCHLIB, PERL_LIB, PERL_ARCHLIB and PERL_SRC. |
89 | |
75f92628 |
90 | Extensions may be built either using the contents of the perl source |
91 | directory tree or from an installed copy of the perl library. |
92 | |
93 | If an extension is being built below the C<ext/> directory of the perl |
94 | source then MakeMaker will set PERL_SRC automatically (e.g., C<../..>). |
95 | If PERL_SRC is defined then other variables default to the following: |
96 | |
97 | PERL_INC = PERL_SRC |
98 | PERL_LIB = PERL_SRC/lib |
99 | PERL_ARCHLIB = PERL_SRC/lib |
100 | INST_LIB = PERL_LIB |
101 | INST_ARCHLIB = PERL_ARCHLIB |
3edbfbe5 |
102 | |
75f92628 |
103 | If an extension is being built away from the perl source then MakeMaker |
104 | will leave PERL_SRC undefined and default to using the installed copy |
105 | of the perl library. The other variables default to the following: |
42793c05 |
106 | |
75f92628 |
107 | PERL_INC = $archlib/CORE |
108 | PERL_LIB = $privlib |
109 | PERL_ARCHLIB = $archlib |
110 | INST_LIB = ./blib |
111 | INST_ARCHLIB = ./blib |
112 | |
113 | If perl has not yet been installed then PERL_SRC can be defined on the |
114 | command line as shown in the previous section. |
42793c05 |
115 | |
116 | =head2 Useful Default Makefile Macros |
117 | |
118 | FULLEXT = Pathname for extension directory (eg DBD/Oracle). |
119 | |
120 | BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. |
121 | |
122 | ROOTEXT = Directory part of FULLEXT with leading slash (eg /DBD) |
123 | |
3edbfbe5 |
124 | PERL_LIB = Directory where we read the perl library files |
42793c05 |
125 | |
3edbfbe5 |
126 | PERL_ARCHLIB = Same as above for architecture dependent files |
42793c05 |
127 | |
3edbfbe5 |
128 | INST_LIB = Directory where we put library files of this extension |
129 | while building it. If we are building below PERL_SRC/ext |
130 | we default to PERL_SRC/lib, else we default to ./blib. |
42793c05 |
131 | |
3edbfbe5 |
132 | INST_ARCHLIB = Same as above for architecture dependent files |
42793c05 |
133 | |
3edbfbe5 |
134 | INST_LIBDIR = $(INST_LIB)$(ROOTEXT) |
42793c05 |
135 | |
3edbfbe5 |
136 | INST_AUTODIR = $(INST_LIB)/auto/$(FULLEXT) |
137 | |
138 | INST_ARCHAUTODIR = $(INST_ARCHLIB)/auto/$(FULLEXT) |
42793c05 |
139 | |
140 | =head2 Customizing The Generated Makefile |
141 | |
142 | If the Makefile generated does not fit your purpose you can change it |
143 | using the mechanisms described below. |
144 | |
145 | =head2 Using Attributes (and Parameters) |
146 | |
147 | The following attributes can be specified as arguments to WriteMakefile() |
148 | or as NAME=VALUE pairs on the command line: |
149 | |
3edbfbe5 |
150 | This description is not yet documented; you can get at the description |
151 | with the command |
75f92628 |
152 | perl Makefile.PL help (if you already have a basic Makefile.PL) |
153 | or perl -e 'use ExtUtils::MakeMaker qw(&help); &help;' |
42793c05 |
154 | |
155 | =head2 Overriding MakeMaker Methods |
156 | |
157 | If you cannot achieve the desired Makefile behaviour by specifying |
158 | attributes you may define private subroutines in the Makefile.PL. |
159 | Each subroutines returns the text it wishes to have written to |
160 | the Makefile. To override a section of the Makefile you can |
161 | either say: |
162 | |
163 | sub MY::c_o { "new literal text" } |
164 | |
165 | or you can edit the default by saying something like: |
166 | |
167 | sub MY::c_o { $_=MM->c_o; s/old text/new text/; $_ } |
a0d0e21e |
168 | |
42793c05 |
169 | If you still need a different solution, try to develop another |
170 | subroutine, that fits your needs and submit the diffs to |
3edbfbe5 |
171 | perl5-porters@nicoh.com or comp.lang.perl as appropriate. |
42793c05 |
172 | |
173 | |
174 | =head1 AUTHORS |
175 | |
176 | Andy Dougherty <doughera@lafcol.lafayette.edu>, Andreas Koenig |
177 | <k@franz.ww.TU-Berlin.DE>, Tim Bunce <Tim.Bunce@ig.co.uk> |
178 | |
179 | =head1 MODIFICATION HISTORY |
180 | |
3edbfbe5 |
181 | v1, August 1994; by Andreas Koenig. Based on Andy Dougherty's Makefile.SH. |
182 | v2, September 1994 by Tim Bunce. |
183 | v3.0 October 1994 by Tim Bunce. |
184 | v3.1 November 11th 1994 by Tim Bunce. |
185 | v3.2 November 18th 1994 by Tim Bunce. |
186 | v3.3 November 27th 1994 by Andreas Koenig. |
187 | v3.4 December 7th 1994 by Andreas Koenig and Tim Bunce. |
188 | v3.5 December 15th 1994 by Tim Bunce. |
189 | v3.6 December 15th 1994 by Tim Bunce. |
75f92628 |
190 | v3.7 December 30th 1994 By Tim Bunce |
191 | v3.8 January 17th 1995 By Andreas Koenig and Tim Bunce |
3edbfbe5 |
192 | |
193 | - Introduces ./blib as the directory, where the ready-to-use module |
194 | will live for the time of the building process if PERL_SRC/lib is not |
195 | available. ./blib is turned into an absolute pathname and gets passed |
196 | to subdirectories when writing the Makefile. |
197 | |
198 | - INST_ARCHLIB will now be set equal to INST_LIB if we cannot |
199 | determine it with the methods near line 620 (in the intialize |
200 | subroutine). |
201 | |
202 | - Introduced the install subroutine, that calls another make |
203 | recursively with INST_LIB, and INST_ARCHLIB set according to the local |
204 | conventions. |
205 | |
206 | - Since version 3.6 all *.al and *.ix files are installed into |
207 | $installprivlib. In perl5.000 they were installed into |
208 | $installarchlib. Version 3.8 takes precautions to delete old *.{al,ix} |
209 | files that are left over in $installarchlib. Installperl is also |
210 | patched to both delete old *.al and *.ix files, that were put into |
211 | $installarchlib, and to install them properly from now on. |
212 | |
213 | - h2xs is patched by Dean Roehrich to reintroduce the C<-A> option and |
214 | reconsiders the use of the AutoLoader. Also podifies h2xs. |
215 | |
216 | - Patches to {DB_File,Fcntl,GDBM_File,POSIX,Socket}.pm, eliminating |
217 | AutoLoader from @ISA (by Dean Roehrich). |
218 | |
219 | - A patch to AutoSplit.pm makes sure, the target directory of the |
220 | split exists. |
221 | |
222 | - installperl now installs all *.h files into $installarchlib/CORE. |
223 | |
224 | - added a simple help function |
225 | |
226 | - AutoSplit: |
227 | |
228 | Turned two constants into package variables. |
229 | Modified the default for &autosplit to be $CheckModTime=1. |
230 | Added warning and comment if auto dir does not exist. |
231 | Enhanced AutoLoader check (POSIX.pm was not getting AutoSplit!) |
232 | Improved logging if $Verbose>=2. |
233 | |
234 | - MakeMaker: |
235 | |
236 | EXPORT_OK lsdir(), it's very handy. |
237 | Deleted much of the early revision history. |
238 | Changed LDTARGET (bad name) to LDFROM (better, but not great :) |
239 | INST_ARCHLIB for ./blib found via mapping from INST_LIB ./blib |
240 | (this allows error message if INST_ARCHLIB still undefined) |
241 | Added optional regex filter to &lsdir. |
242 | Added cute auto handling of a ./$(BASEEXT)/*.pm directory as |
243 | per recent messages with Nick re ext/nTk/nTk/Text.pm |
244 | Added NOOP, RM_F, RM_RF, TOUCH, CP to %att. |
245 | NOOP is now "" on Unix, "<tab>" caused problems (see makefile section) |
246 | RM_F etc now expanded when Makefile written. |
247 | Old AUTOSPLITLIB definition deleted. |
248 | See new dynamic_lib section for new ARMAYBE handling. |
75f92628 |
249 | install section now uses $(INSTALLPRIVLIB) because on some |
250 | systems INSTALLPRIVLIB != PRIVLIB (ditto for archlib) |
251 | |
252 | v3.9 January 19th 1995 By Tim Bunce |
253 | |
254 | Added ~ processing to parse_args to allow perl Makefile.PL X=~/path. |
255 | Added warning about LDTARGET to LDFROM attribute name change. |
256 | Fallback INST_ARCHLIB is INST_LIB, or INST_LIB/$archname if it exists. |
257 | Tightened up dependency checking of Makefile against config.sh etc. |
258 | INST_STATIC is now INST_ARCHLIBDIR/BASEEXT.a for later make-a-perl. |
259 | AUTOSPLITFILE tidied up (AutoSplit patch included in this version). |
260 | MKPATH now skips inner loop if directory already exists. |
261 | The dynamic_lib section was revised with explicit dec_osf support added. |
262 | Make clean now renames Makefile to Makefile.old (make_ext also patched). |
263 | The large initialize function has been split into smaller pieces. |
264 | Added I_PERL_LIBS to simplify -I paths for PERL_*LIB. |
265 | |
266 | v3.10 January 23rd 1995 By Tim Bunce |
267 | |
268 | miniperl now given preference when defining PERL. This improves the |
269 | reliability of ext/*/Makefile's recreating themselves if needed. |
270 | $(XS), $(C) and $(H) renamed to XS_FILES C_FILES and H_FILES. |
271 | INST_STATIC now INST_ARCHLIBDIR/BASEEXT.a (alongside INST_DYNAMIC). |
272 | Static lib no longer copied back to local directory. |
273 | |
274 | v3.11 January 24th 1995 By Andreas Koenig |
275 | |
276 | DynaLoader.c was not deleted by clean target, now fixed. |
277 | Added PMDIR attribute that allows directories to be named that contain |
278 | only *.p[pl] files to be installed into INST_LIB. Added some documentation. |
279 | |
280 | v4.00 January 24th 1995 By Tim Bunce |
281 | |
282 | Revised some of the documentation. Changed version number to 4.00 to |
283 | avoid problems caused by my earlier poor choice of 3.10! Renamed PMDIR |
284 | to PMLIBDIRS and restructured find code to use inherited MY->libscan. |
285 | Added ability to say: "perl Makefile.PL help" to get help. |
286 | Added ability to say: "perl Makefile.PL verbose" to get debugging. |
287 | Added MakeMaker version number to generated Makefiles. |
42793c05 |
288 | |
289 | =head1 NOTES |
290 | |
291 | MakeMaker development work still to be done: |
292 | |
293 | Needs more complete documentation. |
294 | |
42793c05 |
295 | Add method to take a list of files and wrap it in a Makefile |
296 | compatible way (<space><backslash><newline><tab>). |
297 | |
75f92628 |
298 | Add a html: target when there has been found a general solution to |
299 | installing html files. |
300 | |
42793c05 |
301 | =cut |
302 | |
303 | |
304 | # Setup dummy package: |
305 | # MY exists for overriding methods to be defined within |
306 | unshift(@MY::ISA, qw(MM)); |
307 | |
308 | # Dummy package MM inherits actual methods from OS-specific |
309 | # default packages. We use this intermediate package so |
310 | # MY->func() can call MM->func() and get the proper |
311 | # default routine without having to know under what OS |
312 | # it's running. |
313 | unshift(@MM::ISA, $Is_VMS ? qw(ExtUtils::MM_VMS MM_Unix) : qw(MM_Unix)); |
314 | |
315 | $Attrib_Help = <<'END'; |
316 | NAME: Perl module name for this extension (DBD::Oracle) |
75f92628 |
317 | This will default to the directory name but should |
318 | be explicitly defined in the Makefile.PL. |
42793c05 |
319 | |
320 | DISTNAME: Your name for distributing the package (by tar file) |
321 | This defaults to NAME above. |
322 | |
323 | VERSION: Your version number for distributing the package. |
324 | This defaults to 0.1. |
325 | |
326 | INST_LIB: Perl library directory to install the module into. |
327 | INST_ARCHLIB: Perl architecture-dependent library to install into |
328 | (defaults to INST_LIB) |
329 | |
330 | PERL_LIB: Directory containing the Perl library to use. |
331 | PERL_SRC: Directory containing the Perl source code |
e1666bf5 |
332 | (use of this should be avoided, it may be undefined) |
42793c05 |
333 | |
334 | INC: Include file dirs eg: '-I/usr/5include -I/path/to/inc' |
335 | DEFINE: something like "-DHAVE_UNISTD_H" |
336 | OBJECT: List of object files, defaults to '$(BASEEXT).o', |
337 | but can be a long string containing all object files, |
338 | e.g. "tkpBind.o tkpButton.o tkpCanvas.o" |
339 | MYEXTLIB: If the extension links to a library that it builds |
340 | set this to the name of the library (see SDBM_File) |
341 | |
342 | LIBS: An anonymous array of alternative library specifications |
343 | to be searched for (in order) until at least one library |
344 | is found. |
345 | 'LIBS' => [ "-lgdbm", "-ldbm -lfoo", "-L/path -ldbm.nfs" ] |
346 | Mind, that any element of the array contains a complete |
347 | set of arguments for the ld command. So do not specify |
348 | 'LIBS' => ["-ltcl", "-ltk", "-lX11" ], #wrong |
349 | See ODBM_File/Makefile.PL for an example, where an |
350 | array is needed. If you specify a scalar as in |
351 | 'LIBS' => "-ltcl -ltk -lX11" |
352 | MakeMaker will turn it into an array with one element. |
353 | |
3edbfbe5 |
354 | LDFROM: defaults to "$(OBJECT)" and is used in the ld command |
355 | to specify what files to link/load from |
356 | (also see dynamic_lib below for how to specify ld flags) |
42793c05 |
357 | |
358 | DIR: Ref to array of subdirectories containing Makefile.PLs |
359 | e.g. [ 'sdbm' ] in ext/SDBM_File |
360 | |
75f92628 |
361 | PMLIBDIRS: Ref to array of subdirectories containing library files. |
362 | Defaults to [ 'lib', $(BASEEXT) ]. The directories will |
363 | be scanned and any *.pm and *.pl files they contain will |
364 | be installed in the corresponding location in the library. |
365 | A MY::libscan() function can be used to alter the behaviour. |
366 | Defining PM in the Makefile.PL will override PMLIBDIRS. |
367 | |
42793c05 |
368 | PM: Hashref of .pm files and *.pl files to be installed. |
369 | e.g. { 'name_of_file.pm' => '$(INST_LIBDIR)/install_as.pm' } |
370 | By default this will include *.pm and *.pl. If a lib directory |
371 | exists and is not listed in DIR (above) then any *.pm and |
372 | *.pl files it contains will also be included by default. |
75f92628 |
373 | Defining PM in the Makefile.PL will override PMLIBDIRS. |
42793c05 |
374 | |
375 | XS: Hashref of .xs files. MakeMaker will default this. |
376 | e.g. { 'name_of_file.xs' => 'name_of_file.c' } |
377 | The .c files will automatically be included in the list |
378 | of files deleted by a make clean. |
379 | |
380 | C: Ref to array of *.c file names. Initialised from a directory scan |
381 | and the values portion of the XS attribute hash. This is not |
382 | currently used by MakeMaker but may be handy in Makefile.PLs. |
383 | |
384 | H: Ref to array of *.h file names. Similar to C: above. |
385 | |
386 | LINKTYPE: =>'static' or 'dynamic' (default unless usedl=undef in config.sh) |
387 | Should only be used to force static linking (also see linkext below). |
388 | |
389 | CONFIG: =>[qw(archname manext)] defines ARCHNAME & MANEXT from config.sh |
390 | SKIP: =>[qw(name1 name2)] skip (do not write) sections of the Makefile |
391 | |
392 | PERL: |
393 | FULLPERL: |
394 | |
395 | Additional lowercase attributes can be used to pass parameters to the |
396 | methods which implement that part of the Makefile. These are not |
397 | normally required: |
398 | |
399 | installpm: {SPLITLIB => '$(INST_LIB)' (default) or '$(INST_ARCHLIB)'} |
400 | linkext: {LINKTYPE => 'static', 'dynamic' or ''} |
75f92628 |
401 | dynamic_lib: {ARMAYBE => 'ar', OTHERLDFLAGS => '...'} |
42793c05 |
402 | clean: {FILES => "*.xyz foo"} |
3edbfbe5 |
403 | realclean: {FILES => '$(INST_ARCHAUTODIR)/*.xyz'} |
42793c05 |
404 | distclean: {TARNAME=>'MyTarFile', TARFLAGS=>'cvfF', COMPRESS=>'gzip'} |
405 | tool_autosplit: {MAXLEN => 8} |
406 | END |
407 | |
3edbfbe5 |
408 | sub help {print $Attrib_Help;} |
409 | |
42793c05 |
410 | @MM_Sections_spec = ( |
411 | 'post_initialize' => {}, |
412 | 'constants' => {}, |
413 | 'const_config' => {}, |
414 | 'const_loadlibs' => {}, |
415 | 'const_cccmd' => {}, |
416 | 'tool_autosplit' => {}, |
417 | 'tool_xsubpp' => {}, |
418 | 'tools_other' => {}, |
419 | 'post_constants' => {}, |
420 | 'c_o' => {}, |
421 | 'xs_c' => {}, |
422 | 'xs_o' => {}, |
423 | 'top_targets' => {}, |
424 | 'linkext' => {}, |
425 | 'dynamic' => {}, |
426 | 'dynamic_bs' => {}, |
427 | 'dynamic_lib' => {}, |
428 | 'static' => {}, |
429 | 'static_lib' => {}, |
430 | 'installpm' => {}, |
431 | 'subdirs' => {}, |
432 | 'clean' => {}, |
433 | 'realclean' => {}, |
434 | 'distclean' => {}, |
435 | 'test' => {}, |
436 | 'install' => {}, |
437 | 'force' => {}, |
438 | 'perldepend' => {}, |
439 | 'makefile' => {}, |
440 | 'postamble' => {}, |
441 | ); |
442 | %MM_Sections = @MM_Sections_spec; # looses section ordering |
443 | @MM_Sections = grep(!ref, @MM_Sections_spec); # keeps order |
444 | |
445 | %Recognized_Att_Keys = %MM_Sections; # All sections are valid keys. |
446 | foreach(split(/\n/,$Attrib_Help)){ |
447 | chomp; |
448 | next unless m/^\s*(\w+):\s*(.*)/; |
449 | $Recognized_Att_Keys{$1} = $2; |
450 | print "Attribute '$1' => '$2'\n" if ($Verbose >= 2); |
451 | } |
452 | |
453 | %att = (); |
454 | %skip = (); |
455 | |
456 | sub skipcheck{ |
457 | my($section) = @_; |
458 | return 'skipped' if $skip{$section}; |
459 | return ''; |
460 | } |
461 | |
462 | |
463 | sub WriteMakefile { |
a0d0e21e |
464 | %att = @_; |
465 | local($\)="\n"; |
466 | |
a0d0e21e |
467 | print STDOUT "MakeMaker" if $Verbose; |
a0d0e21e |
468 | |
42793c05 |
469 | parse_args(\%att, @ARGV); |
470 | my(%initial_att) = %att; # record initial attributes |
a0d0e21e |
471 | |
75f92628 |
472 | MY->init_main(); |
a0d0e21e |
473 | |
42793c05 |
474 | print STDOUT "Writing Makefile for $att{NAME}"; |
a0d0e21e |
475 | |
75f92628 |
476 | MY->init_dirscan(); |
477 | MY->init_others(); |
478 | |
42793c05 |
479 | unlink("Makefile", "MakeMaker.tmp", $Is_VMS ? 'Descrip.MMS' : ''); |
480 | open MAKE, ">MakeMaker.tmp" or die "Unable to open MakeMaker.tmp: $!"; |
481 | select MAKE; $|=1; select STDOUT; |
a0d0e21e |
482 | |
42793c05 |
483 | print MAKE "# This Makefile is for the $att{NAME} extension to perl.\n#"; |
75f92628 |
484 | print MAKE "# It was generated automatically by MakeMaker version $Version from the contents"; |
42793c05 |
485 | print MAKE "# of Makefile.PL. Don't edit this file, edit Makefile.PL instead."; |
486 | print MAKE "#\n# ANY CHANGES MADE HERE WILL BE LOST! \n#"; |
487 | print MAKE "# MakeMaker Parameters: "; |
488 | foreach $key (sort keys %initial_att){ |
489 | my($v) = neatvalue($initial_att{$key}); |
490 | $v =~ tr/\n/ /s; |
491 | print MAKE "# $key => $v"; |
492 | } |
a0d0e21e |
493 | |
42793c05 |
494 | # build hash for SKIP to make testing easy |
495 | %skip = map( ($_,1), @{$att{'SKIP'} || []}); |
496 | |
497 | foreach $section ( @MM_Sections ){ |
498 | print "Processing Makefile '$section' section" if ($Verbose >= 2); |
499 | my($skipit) = skipcheck($section); |
500 | if ($skipit){ |
501 | print MAKE "\n# --- MakeMaker $section section $skipit."; |
502 | } else { |
503 | my(%a) = %{$att{$section} || {}}; |
504 | print MAKE "\n# --- MakeMaker $section section:"; |
75f92628 |
505 | print MAKE "# ",%a if $Verbose; |
42793c05 |
506 | print(MAKE MY->nicetext(MY->$section( %a ))); |
507 | } |
508 | } |
a0d0e21e |
509 | |
42793c05 |
510 | if ($Verbose){ |
511 | print MAKE "\n# Full list of MakeMaker attribute values:"; |
512 | foreach $key (sort keys %att){ |
513 | my($v) = neatvalue($att{$key}); |
514 | $v =~ tr/\n/ /s; |
515 | print MAKE "# $key => $v"; |
516 | } |
517 | } |
a0d0e21e |
518 | |
42793c05 |
519 | print MAKE "\n# End."; |
a0d0e21e |
520 | close MAKE; |
42793c05 |
521 | my($finalname) = $Is_VMS ? "Descrip.MMS" : "Makefile"; |
522 | rename("MakeMaker.tmp", $finalname); |
523 | |
524 | chmod 0644, $finalname; |
525 | system("$Config{'eunicefix'} $finalname") unless $Config{'eunicefix'} eq ":"; |
a0d0e21e |
526 | |
527 | 1; |
528 | } |
529 | |
530 | |
531 | sub mkbootstrap{ |
42793c05 |
532 | parse_args(\%att, @ARGV); |
533 | MY->mkbootstrap(@_); |
a0d0e21e |
534 | } |
535 | |
536 | |
42793c05 |
537 | sub parse_args{ |
538 | my($attr, @args) = @_; |
539 | foreach (@args){ |
75f92628 |
540 | unless (m/(.*?)=(.*)/){ |
541 | help(),exit 1 if m/^help$/; |
542 | ++$Verbose if m/^verb/; |
543 | next; |
544 | } |
545 | my($name, $value) = ($1, $2); |
546 | if ($value =~ m/^~(\w+)?/){ # tilde with optional username |
547 | my($home) = ($1) ? (getpwnam($1))[7] : (getpwuid($>))[7]; |
548 | $value =~ s/^~(\w+)?/$home/; |
549 | } |
550 | $$attr{$name} = $value; |
42793c05 |
551 | } |
552 | # catch old-style 'potential_libs' and inform user how to 'upgrade' |
553 | if (defined $$attr{'potential_libs'}){ |
554 | my($msg)="'potential_libs' => '$$attr{potential_libs}' should be"; |
555 | if ($$attr{'potential_libs'}){ |
556 | print STDERR "$msg changed to:\n\t'LIBS' => ['$$attr{potential_libs}']\n"; |
557 | } else { |
558 | print STDERR "$msg deleted.\n"; |
559 | } |
560 | $$attr{LIBS} = [$$attr{'potential_libs'}]; |
561 | delete $$attr{'potential_libs'}; |
562 | } |
563 | # catch old-style 'ARMAYBE' and inform user how to 'upgrade' |
564 | if (defined $$attr{'ARMAYBE'}){ |
565 | my($armaybe) = $$attr{'ARMAYBE'}; |
566 | print STDERR "ARMAYBE => '$armaybe' should be changed to:\n", |
567 | "\t'dynamic_lib' => {ARMAYBE => '$armaybe'}\n"; |
568 | my(%dl) = %{$$attr{'dynamic_lib'} || {}}; |
569 | $$attr{'dynamic_lib'} = { %dl, ARMAYBE => $armaybe}; |
570 | delete $$attr{'ARMAYBE'}; |
571 | } |
75f92628 |
572 | if (defined $$attr{'LDTARGET'}){ |
573 | print STDERR "LDTARGET should be changed to LDFROM\n"; |
574 | $$attr{'LDFROM'} = $$attr{'LDTARGET'}; |
575 | delete $$attr{'LDTARGET'}; |
576 | } |
42793c05 |
577 | foreach(sort keys %{$attr}){ |
578 | print STDOUT " $_ => ".neatvalue($$attr{$_}) if ($Verbose); |
579 | warn "'$_' is not a known MakeMaker parameter name.\n" |
580 | unless exists $Recognized_Att_Keys{$_}; |
581 | } |
a0d0e21e |
582 | } |
583 | |
584 | |
42793c05 |
585 | sub neatvalue{ |
586 | my($v) = @_; |
587 | my($t) = ref $v; |
588 | return "'$v'" unless $t; |
589 | return "[ ".join(', ',map("'$_'",@$v))." ]" if ($t eq 'ARRAY'); |
590 | return "$v" unless $t eq 'HASH'; |
591 | my(@m, $key, $val); |
592 | push(@m,"$key=>".neatvalue($val)) while (($key,$val) = each %$v); |
593 | return "{ ".join(', ',@m)." }"; |
594 | } |
595 | |
596 | |
597 | # ------ Define the MakeMaker default methods in package MM_Unix ------ |
a0d0e21e |
598 | |
42793c05 |
599 | package MM_Unix; |
a0d0e21e |
600 | |
601 | use Config; |
42793c05 |
602 | use Cwd; |
603 | use File::Basename; |
a0d0e21e |
604 | require Exporter; |
605 | |
42793c05 |
606 | Exporter::import('ExtUtils::MakeMaker', |
607 | qw(%att %skip %Recognized_Att_Keys $Verbose)); |
a0d0e21e |
608 | |
42793c05 |
609 | # These attributes cannot be overridden externally |
610 | @Other_Att_Keys{qw(EXTRALIBS BSLOADLIBS LDLOADLIBS)} = (1) x 3; |
a0d0e21e |
611 | |
42793c05 |
612 | if ($Is_VMS = $Config{'osname'} eq 'VMS') { |
613 | require File::VMSspec; |
614 | import File::VMSspec 'vmsify'; |
a0d0e21e |
615 | } |
616 | |
617 | |
75f92628 |
618 | sub init_main { |
42793c05 |
619 | # Find out directory name. This may contain the extension name. |
620 | my($pwd) = fastcwd(); # from Cwd.pm |
621 | |
622 | # --- Initialize PERL_LIB, INST_LIB, PERL_SRC |
623 | |
624 | # *Real* information: where did we get these two from? ... |
625 | $inc_config_dir = dirname($INC{'Config.pm'}); |
626 | $inc_carp_dir = dirname($INC{'Carp.pm'}); |
627 | |
628 | # Typically PERL_* and INST_* will be identical but that need |
629 | # not be the case (e.g., installing into project libraries etc). |
630 | |
631 | # Perl Macro: With source No source |
632 | # PERL_LIB ../../lib /usr/local/lib/perl5 |
633 | # PERL_ARCHLIB ../../lib /usr/local/lib/perl5/sun4-sunos |
e1666bf5 |
634 | # PERL_SRC ../.. (undefined) |
42793c05 |
635 | |
636 | # INST Macro: Locally Publically |
3edbfbe5 |
637 | # INST_LIB ../../lib ./blib |
638 | # INST_ARCHLIB ../../lib ./blib |
42793c05 |
639 | |
640 | unless ($att{PERL_SRC}){ |
a0d0e21e |
641 | foreach(qw(../.. ../../.. ../../../..)){ |
42793c05 |
642 | ($att{PERL_SRC}=$_, last) if -f "$_/config.sh"; |
a0d0e21e |
643 | } |
a0d0e21e |
644 | } |
42793c05 |
645 | unless ($att{PERL_SRC}){ |
e1666bf5 |
646 | warn "Unable to locate perl source.\n"; |
42793c05 |
647 | # we should also consider $ENV{PERL5LIB} here |
648 | $att{PERL_LIB} = $Config{'privlib'} unless $att{PERL_LIB}; |
649 | $att{PERL_ARCHLIB} = $Config{'archlib'} unless $att{PERL_ARCHLIB}; |
e1666bf5 |
650 | $att{PERL_INC} = "$att{PERL_ARCHLIB}/CORE"; # wild guess for now |
651 | die "Try setting PERL_SRC in Makefile.PL or on command line.\n" |
652 | unless (-f "$att{PERL_INC}/perl.h"); |
42793c05 |
653 | } else { |
654 | $att{PERL_LIB} = "$att{PERL_SRC}/lib" unless $att{PERL_LIB}; |
655 | $att{PERL_ARCHLIB} = $att{PERL_LIB}; |
e1666bf5 |
656 | $att{PERL_INC} = $att{PERL_SRC}; |
42793c05 |
657 | } |
658 | |
659 | # INST_LIB typically pre-set if building an extension after |
660 | # perl has been built and installed. Setting INST_LIB allows |
3edbfbe5 |
661 | # you to build directly into privlib and avoid installperl. |
662 | unless ($att{INST_LIB}){ |
663 | if (defined $att{PERL_SRC}) { |
664 | $att{INST_LIB} = $att{PERL_LIB}; |
665 | } else { |
666 | $att{INST_LIB} = "$pwd/blib"; |
667 | } |
668 | } |
42793c05 |
669 | # Try to work out what INST_ARCHLIB should be if not set: |
670 | unless ($att{INST_ARCHLIB}){ |
671 | my(%archmap) = ( |
3edbfbe5 |
672 | "$pwd/blib" => "$pwd/blib", # our private build lib |
42793c05 |
673 | $att{PERL_LIB} => $att{PERL_ARCHLIB}, |
674 | $Config{'privlib'} => $Config{'archlib'}, |
675 | $Config{'installprivlib'} => $Config{'installarchlib'}, |
676 | $inc_carp_dir => $inc_config_dir, |
677 | ); |
678 | $att{INST_ARCHLIB} = $archmap{$att{INST_LIB}}; |
75f92628 |
679 | unless($att{INST_ARCHLIB}){ |
680 | # Oh dear, we'll have to default it and warn the user |
681 | my($archname) = $Config{'archname'}; |
682 | if (-d "$att{INST_LIB}/$archname"){ |
683 | $att{INST_ARCHLIB} = "$att{INST_LIB}/$archname"; |
684 | warn "Defaulting INST_ARCHLIB to INST_LIB/$archname\n"; |
685 | } else { |
686 | $att{INST_ARCHLIB} = $att{INST_LIB}; |
687 | warn "Warning: Defaulting INST_ARCHLIB to INST_LIB ", |
688 | "(not architecture independent).\n"; |
689 | } |
690 | } |
42793c05 |
691 | } |
692 | |
693 | # make a few simple checks |
694 | die "PERL_LIB ($att{PERL_LIB}) is not a perl library directory" |
695 | unless (-f "$att{PERL_LIB}/Exporter.pm"); |
696 | |
697 | # --- Initialize Module Name and Paths |
a0d0e21e |
698 | |
42793c05 |
699 | # NAME = The perl module name for this extension (eg DBD::Oracle). |
700 | # FULLEXT = Pathname for extension directory (eg DBD/Oracle). |
a0d0e21e |
701 | # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. |
42793c05 |
702 | # ROOTEXT = Directory part of FULLEXT with leading /. |
703 | unless($att{NAME}){ # we have to guess our name |
704 | my($name) = $pwd; |
705 | if ($Is_VMS) { |
706 | $name =~ s:.*?([^.\]]+)\]:$1: unless ($name =~ s:.*[.\[]ext\.::); |
707 | ($att{NAME}=$name) =~ s#[.\]]#::#g; |
708 | } else { |
709 | $name =~ s:.*/:: unless ($name =~ s:^.*/ext/::); |
710 | ($att{NAME} =$name) =~ s#/#::#g; |
711 | } |
712 | } |
713 | ($att{FULLEXT} =$att{NAME}) =~ s#::#/#g ; #eg. BSD/Foo/Socket |
714 | ($att{BASEEXT} =$att{NAME}) =~ s#.*::##; #eg. Socket |
715 | ($att{ROOTEXT} =$att{FULLEXT}) =~ s#/?\Q$att{BASEEXT}\E$## ; # eg. /BSD/Foo |
716 | $att{ROOTEXT} = "/$att{ROOTEXT}" if $att{ROOTEXT}; |
717 | $att{ROOTEXT} = "" if $Is_VMS; |
718 | |
719 | ($att{DISTNAME}=$att{NAME}) =~ s#(::)#-#g; |
720 | $att{VERSION} = "0.1" unless $att{VERSION}; |
721 | |
722 | |
723 | # --- Initialize Perl Binary Locations |
724 | |
725 | # Find Perl 5. The only contract here is that both 'PERL' and 'FULLPERL' |
75f92628 |
726 | # will be working versions of perl 5. miniperl has priority over perl |
727 | # for PERL to ensure that $(PERL) is usable while building ./ext/* |
728 | $att{'PERL'} = MY->find_perl(5.0, [ qw(miniperl perl) ], |
42793c05 |
729 | [ $att{PERL_SRC}, split(":", $ENV{PATH}), $Config{'bin'} ], 0 ) |
730 | unless ($att{'PERL'} && -x $att{'PERL'}); |
a0d0e21e |
731 | |
42793c05 |
732 | # Define 'FULLPERL' to be a non-miniperl (used in test: target) |
733 | ($att{'FULLPERL'} = $att{'PERL'}) =~ s/miniperl/perl/ |
734 | unless ($att{'FULLPERL'} && -x $att{'FULLPERL'}); |
a0d0e21e |
735 | |
42793c05 |
736 | if ($Is_VMS) { |
737 | ($att{'PERL'} = 'MCR ' . vmsify($att{'PERL'})) =~ s:.*/::; |
738 | ($att{'FULLPERL'} = 'MCR ' . vmsify($att{'FULLPERL'})) =~ s:.*/::; |
739 | } |
75f92628 |
740 | } |
42793c05 |
741 | |
42793c05 |
742 | |
75f92628 |
743 | sub init_dirscan { # --- File and Directory Lists (.xs .pm etc) |
744 | |
745 | my($name, %dir, %xs, %c, %h, %ignore); |
746 | local(%pm); #the sub in find() has to see this hash |
747 | $ignore{'test.pl'} = 1; |
748 | $ignore{'makefile.pl'} = 1 if $Is_VMS; |
749 | foreach $name (lsdir(".")){ |
750 | next if ($name =~ /^\./ or $ignore{$name}); |
751 | if (-d $name){ |
752 | $dir{$name} = $name if (-f "$name/Makefile.PL"); |
753 | } elsif ($name =~ /\.xs$/){ |
754 | my($c); ($c = $name) =~ s/\.xs$/.c/; |
755 | $xs{$name} = $c; |
756 | $c{$c} = 1; |
757 | } elsif ($name =~ /\.c$/){ |
758 | $c{$name} = 1; |
759 | } elsif ($name =~ /\.h$/){ |
760 | $h{$name} = 1; |
761 | } elsif ($name =~ /\.p[ml]$/){ |
762 | $pm{$name} = "\$(INST_LIBDIR)/$name"; |
3edbfbe5 |
763 | } |
75f92628 |
764 | } |
3edbfbe5 |
765 | |
75f92628 |
766 | # Some larger extensions often wish to install a number of *.pm/pl |
767 | # files into the library in various locations. |
768 | |
769 | # The attribute PMLIBDIRS holds an array reference which lists |
770 | # subdirectories which we should search for library files to |
771 | # install. PMLIBDIRS defaults to [ 'lib', $att{BASEEXT} ]. |
772 | # We recursively search through the named directories (skipping |
773 | # any which don't exist or contain Makefile.PL files). |
774 | |
775 | # For each *.pm or *.pl file found MY->libscan() is called with |
776 | # the default installation path in $_. The return value of libscan |
777 | # defines the actual installation location. |
778 | # The default libscan function simply returns $_. |
779 | # The file is skipped if libscan returns false. |
780 | |
781 | # The default installation location passed to libscan in $_ is: |
782 | # |
783 | # ./*.pm => $(INST_LIBDIR)/*.pm |
784 | # ./xyz/... => $(INST_LIBDIR)/xyz/... |
785 | # ./lib/... => $(INST_LIB)/... |
786 | # |
787 | # In this way the 'lib' directory is seen as the root of the actual |
788 | # perl library whereas the others are relative to INST_LIBDIR |
789 | # (which includes ROOTEXT). This is a subtle distinction but one |
790 | # that's important for nested modules. |
791 | |
792 | $att{PMLIBDIRS} = [ 'lib', $att{BASEEXT} ] unless $att{PMLIBDIRS}; |
793 | |
794 | #only existing directories that aren't in $dir are allowed |
795 | @{$att{PMLIBDIRS}} = grep -d && !$dir{$_}, @{$att{PMLIBDIRS}}; |
796 | |
797 | if (@{$att{PMLIBDIRS}}){ |
798 | print "Searching PMLIBDIRS: @{$att{PMLIBDIRS}}" |
799 | if ($Verbose >= 2); |
800 | use File::Find; # try changing to require ! |
801 | File::Find::find(sub { |
802 | return unless m/\.p[ml]$/; |
803 | my($path, $prefix) = ($File::Find::name, '$(INST_LIBDIR)'); |
804 | $prefix = '$(INST_LIB)' if ($path =~ s:^lib/::); |
805 | local($_) = "$prefix/$path"; |
806 | my($inst) = MY->libscan(); |
807 | print "libscan($path) => '$inst'" if ($Verbose >= 2); |
808 | return unless $inst; |
809 | $pm{$path} = "$inst"; |
810 | }, @{$att{PMLIBDIRS}}); |
42793c05 |
811 | } |
812 | |
75f92628 |
813 | $att{DIR} = [sort keys %dir] unless $att{DIRS}; |
814 | $att{XS} = \%xs unless $att{XS}; |
815 | $att{PM} = \%pm unless $att{PM}; |
816 | $att{C} = [sort keys %c] unless $att{C}; |
817 | $att{H} = [sort keys %h] unless $att{H}; |
818 | } |
819 | |
820 | |
821 | sub libscan { |
822 | $_; |
823 | } |
824 | |
825 | |
826 | sub init_others { # --- Initialize Other Attributes |
42793c05 |
827 | |
828 | for $key (keys(%Recognized_Att_Keys), keys(%Other_Att_Keys)){ |
a0d0e21e |
829 | # avoid warnings for uninitialized vars |
42793c05 |
830 | next if exists $att{$key}; |
831 | $att{$key} = ""; |
a0d0e21e |
832 | } |
833 | |
42793c05 |
834 | # Compute EXTRALIBS, BSLOADLIBS and LDLOADLIBS from $att{'LIBS'} |
835 | # Lets look at $att{LIBS} carefully: It may be an anon array, a string or |
836 | # undefined. In any case we turn it into an anon array: |
837 | $att{LIBS}=[] unless $att{LIBS}; |
838 | $att{LIBS}=[$att{LIBS}] if ref \$att{LIBS} eq SCALAR; |
839 | foreach ( @{$att{'LIBS'}} ){ |
840 | s/^\s*(.*\S)\s*$/$1/; # remove leading and trailing whitespace |
841 | my(@libs) = MY->extliblist($_); |
842 | if ($libs[0] or $libs[1] or $libs[2]){ |
843 | @att{EXTRALIBS, BSLOADLIBS, LDLOADLIBS} = @libs; |
844 | last; |
845 | } |
846 | } |
a0d0e21e |
847 | |
42793c05 |
848 | warn "CONFIG must be an array ref\n" |
849 | if ($att{CONFIG} and ref $att{CONFIG} ne 'ARRAY'); |
850 | $att{CONFIG} = [] unless (ref $att{CONFIG}); |
851 | push(@{$att{CONFIG}}, |
852 | qw( cc libc ldflags lddlflags ccdlflags cccdlflags |
853 | ranlib so dlext dlsrc installprivlib installarchlib |
854 | )); |
855 | push(@{$att{CONFIG}}, 'shellflags') if $Config{'shellflags'}; |
856 | |
857 | if ($Is_VMS) { |
858 | # This will not make other Makefile.PLs portable. Any Makefile.PL |
859 | # which says OBJECT => "foo.o bar.o" will fail on VMS. It might |
860 | # be better to fix the c_o section to produce .o files. |
861 | $att{OBJECT} = '$(BASEEXT).obj' unless $att{OBJECT}; |
862 | $att{OBJECT} =~ s/[^,\s]\s+/, /g; |
863 | $att{OBJECT} =~ s/\n+/, /g; |
864 | } else { |
865 | $att{OBJECT} = '$(BASEEXT).o' unless $att{OBJECT}; |
866 | $att{OBJECT} =~ s/\n+/ \\\n\t/g; |
a0d0e21e |
867 | } |
42793c05 |
868 | $att{BOOTDEP} = (-f "$att{BASEEXT}_BS") ? "$att{BASEEXT}_BS" : ""; |
e1666bf5 |
869 | $att{LD} = ($Config{'ld'} || 'ld') unless $att{LD}; |
3edbfbe5 |
870 | $att{LDFROM} = '$(OBJECT)' unless $att{LDFROM}; |
42793c05 |
871 | $att{LINKTYPE} = ($Config{'usedl'}) ? 'dynamic' : 'static' |
872 | unless $att{LINKTYPE}; |
873 | |
3edbfbe5 |
874 | # These get overridden for VMS and maybe some other systems |
875 | $att{NOOP} = ""; |
876 | $att{RM_F} = "rm -f"; |
877 | $att{RM_RF} = "rm -rf"; |
878 | $att{TOUCH} = "touch"; |
879 | $att{CP} = "cp"; |
75f92628 |
880 | $att{MV} = "mv"; |
a0d0e21e |
881 | } |
882 | |
883 | |
42793c05 |
884 | sub lsdir{ |
3edbfbe5 |
885 | my($dir, $regex) = @_; |
42793c05 |
886 | local(*DIR, @ls); |
887 | opendir(DIR, $_[0] || ".") or die "opendir: $!"; |
888 | @ls = readdir(DIR); |
889 | closedir(DIR); |
3edbfbe5 |
890 | @ls = grep(/$regex/, @ls) if $regex; |
42793c05 |
891 | @ls; |
892 | } |
893 | |
894 | |
895 | sub find_perl{ |
896 | my($self, $ver, $names, $dirs, $trace) = @_; |
897 | my($name, $dir); |
898 | print "Looking for perl $ver by these names: @$names, in these dirs: @$dirs\n" |
899 | if ($trace); |
900 | foreach $dir (@$dirs){ |
3edbfbe5 |
901 | next unless defined $dir; # $att{PERL_SRC} may be undefined |
42793c05 |
902 | foreach $name (@$names){ |
903 | print "checking $dir/$name\n" if ($trace >= 2); |
904 | if ($Is_VMS) { |
905 | $name .= ".exe" unless -x "$dir/$name"; |
906 | } |
907 | next unless -x "$dir/$name"; |
908 | print "executing $dir/$name\n" if ($trace); |
909 | my($out); |
910 | if ($Is_VMS) { |
911 | my($vmscmd) = 'MCR ' . vmsify("$dir/$name"); |
912 | $out = `$vmscmd -e "require $ver; print ""VER_OK\n"""`; |
913 | } else { |
914 | $out = `$dir/$name -e 'require $ver; print "VER_OK\n" ' 2>&1`; |
915 | } |
916 | return "$dir/$name" if $out =~ /VER_OK/; |
a0d0e21e |
917 | } |
918 | } |
42793c05 |
919 | warn "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n"; |
920 | 0; # false and not empty |
a0d0e21e |
921 | } |
922 | |
923 | |
924 | sub post_initialize{ |
925 | ""; |
926 | } |
927 | |
928 | |
929 | sub constants { |
930 | my(@m); |
931 | |
a0d0e21e |
932 | push @m, " |
42793c05 |
933 | NAME = $att{NAME} |
a0d0e21e |
934 | DISTNAME = $att{DISTNAME} |
935 | VERSION = $att{VERSION} |
936 | |
42793c05 |
937 | # In which library should we install this extension? |
938 | # This is typically the same as PERL_LIB. |
939 | # (also see INST_LIBDIR and relationship to ROOTEXT) |
940 | INST_LIB = $att{INST_LIB} |
941 | INST_ARCHLIB = $att{INST_ARCHLIB} |
942 | |
943 | # Perl library to use when building the extension |
944 | PERL_LIB = $att{PERL_LIB} |
945 | PERL_ARCHLIB = $att{PERL_ARCHLIB} |
75f92628 |
946 | "; |
42793c05 |
947 | |
75f92628 |
948 | # Define I_PERL_LIBS to include the required -Ipaths |
949 | # To be cute we only include PERL_ARCHLIB if different |
950 | # To be portable we add quotes for VMS |
951 | my(@i_perl_libs) = qw{-I$(PERL_ARCHLIB) -I$(PERL_LIB)}; |
952 | shift(@i_perl_libs) if ($att{PERL_ARCHLIB} eq $att{PERL_LIB}); |
953 | if ($Is_VMS){ |
954 | push @m, "I_PERL_LIBS = \"".join('" "',@i_perl_libs)."\"\n"; |
955 | } else { |
956 | push @m, "I_PERL_LIBS = ".join(' ',@i_perl_libs)."\n"; |
957 | } |
958 | |
959 | push @m, " |
42793c05 |
960 | # Where is the perl source code located? (Eventually we should |
961 | # be able to build extensions without requiring the perl source |
962 | # but that's a way off yet). |
963 | PERL_SRC = $att{PERL_SRC} |
964 | # Perl header files (will eventually be under PERL_LIB) |
e1666bf5 |
965 | PERL_INC = $att{PERL_INC} |
42793c05 |
966 | # Perl binaries |
967 | PERL = $att{'PERL'} |
968 | FULLPERL = $att{'FULLPERL'} |
75f92628 |
969 | "; |
970 | push @m, " |
42793c05 |
971 | # FULLEXT = Pathname for extension directory (eg DBD/Oracle). |
972 | # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. |
973 | # ROOTEXT = Directory part of FULLEXT with leading slash (eg /DBD) |
974 | FULLEXT = $att{FULLEXT} |
975 | BASEEXT = $att{BASEEXT} |
976 | ROOTEXT = $att{ROOTEXT} |
75f92628 |
977 | "; |
978 | push @m, " |
a0d0e21e |
979 | INC = $att{INC} |
980 | DEFINE = $att{DEFINE} |
981 | OBJECT = $att{OBJECT} |
3edbfbe5 |
982 | LDFROM = $att{LDFROM} |
a0d0e21e |
983 | LINKTYPE = $att{LINKTYPE} |
a0d0e21e |
984 | |
75f92628 |
985 | # Handy lists of source code files: |
986 | XS_FILES= ".join(" \\\n\t", sort keys %{$att{XS}})." |
987 | C_FILES = ".join(" \\\n\t", @{$att{C}})." |
988 | H_FILES = ".join(" \\\n\t", @{$att{H}})." |
a0d0e21e |
989 | |
42793c05 |
990 | .SUFFIXES: .xs |
a0d0e21e |
991 | |
42793c05 |
992 | .PRECIOUS: Makefile |
993 | |
75f92628 |
994 | .PHONY: all config static dynamic test linkext |
42793c05 |
995 | |
996 | # This extension may link to it's own library (see SDBM_File) |
997 | MYEXTLIB = $att{MYEXTLIB} |
998 | |
75f92628 |
999 | # Where is the Config information that we are using/depend on |
1000 | CONFIGDEP = \$(PERL_ARCHLIB)/Config.pm \$(PERL_INC)/config.h |
a0d0e21e |
1001 | "; |
1002 | |
1003 | push @m, ' |
1004 | # Where to put things: |
42793c05 |
1005 | INST_LIBDIR = $(INST_LIB)$(ROOTEXT) |
1006 | INST_ARCHLIBDIR = $(INST_ARCHLIB)$(ROOTEXT) |
1007 | |
3edbfbe5 |
1008 | INST_AUTODIR = $(INST_LIB)/auto/$(FULLEXT) |
1009 | INST_ARCHAUTODIR = $(INST_ARCHLIB)/auto/$(FULLEXT) |
1010 | '; |
42793c05 |
1011 | |
3edbfbe5 |
1012 | push @m, ' |
75f92628 |
1013 | INST_STATIC = $(INST_ARCHAUTODIR)/$(BASEEXT).a |
42793c05 |
1014 | INST_DYNAMIC = $(INST_ARCHAUTODIR)/$(BASEEXT).$(DLEXT) |
75f92628 |
1015 | INST_BOOT = $(INST_ARCHAUTODIR)/$(BASEEXT).bs |
42793c05 |
1016 | INST_PM = '.join(" \\\n\t", sort values %{$att{PM}}).' |
1017 | '; |
1018 | |
1019 | join('',@m); |
1020 | } |
1021 | |
1022 | |
1023 | sub const_cccmd{ |
75f92628 |
1024 | # This is implemented in the same manner as extliblist, |
1025 | # e.g., do both and compare results during the transition period. |
1026 | my($cc,$ccflags,$optimize,$large,$split, $shflags) |
1027 | = @Config{qw(cc ccflags optimize large split shellflags)}; |
1028 | $shflags = '' unless $shflags; |
1029 | my($prog, $old); |
1030 | |
1031 | chop($old = `cd $att{PERL_SRC}; sh $shflags ./cflags $att{BASEEXT}.c 2>/dev/null`) |
e1666bf5 |
1032 | if $att{PERL_SRC}; |
1033 | |
75f92628 |
1034 | if ($prog = $Config{"$att{BASEEXT}_cflags"}) { |
1035 | # Expand hints for this extension via the shell |
1036 | print STDERR "Processing $att{BASEEXT}_cflags hint:\n" if $Verbose; |
1037 | my(@o)=`cc=\"$cc\" |
1038 | ccflags=\"$ccflags\" |
1039 | optimize=\"$optimize\" |
1040 | large=\"$large\" |
1041 | split=\"$split\" |
1042 | eval '$prog' |
1043 | echo cc=\$cc |
1044 | echo ccflags=\$ccflags |
1045 | echo optimize=\$optimize |
1046 | echo large=\$large |
1047 | echo split=\$split |
1048 | `; |
1049 | my(%cflags); |
1050 | foreach $line (@o){ |
1051 | chomp $line; |
1052 | if ($line =~ /(.*?)=\s*(.*)\s*$/){ |
1053 | $cflags{$1} = $2; |
1054 | print STDERR " $1 = $2" if $Verbose; |
1055 | } else { |
1056 | print STDERR "Unrecognised result from hint: '$line'\n"; |
1057 | } |
1058 | } |
1059 | ($cc,$ccflags,$optimize,$large,$split)=@cflags{qw(cc ccflags optimize large split)}; |
1060 | } |
1061 | |
1062 | my($new) = "$cc -c $ccflags $optimize $large $split"; |
1063 | if (defined($old) and $new ne $old) { |
1064 | warn "Warning (non-fatal): cflags evaluation in MakeMaker differs from shell output\n" |
1065 | ." package: $att{NAME}\n" |
1066 | ." old: $old\n" |
1067 | ." new: $new\n" |
1068 | ." Using 'old' set.\n" |
1069 | ."Please notify perl5-porters\@nicoh.com\n"; |
42793c05 |
1070 | } |
75f92628 |
1071 | my($cccmd)=($old) ? $old : $new; |
1072 | "CCCMD = $cccmd\n"; |
42793c05 |
1073 | } |
1074 | |
1075 | |
1076 | # --- Constants Sections --- |
1077 | |
1078 | sub const_config{ |
1079 | my(@m,$m); |
1080 | push(@m,"\n# These definitions are from config.sh (via $INC{'Config.pm'})\n"); |
1081 | my(%once_only); |
1082 | foreach $m (@{$att{'CONFIG'}}){ |
1083 | next if $once_only{$m}; |
1084 | warn "CONFIG key '$m' does not exist in Config.pm\n" |
1085 | unless exists $Config{$m}; |
1086 | push @m, "\U$m\E = $Config{$m}\n"; |
1087 | $once_only{$m} = 1; |
1088 | } |
1089 | join('', @m); |
1090 | } |
1091 | |
1092 | |
1093 | sub const_loadlibs{ |
1094 | " |
1095 | # $att{NAME} might depend on some other libraries: |
1096 | # (These comments may need revising:) |
1097 | # |
1098 | # Dependent libraries can be linked in one of three ways: |
1099 | # |
1100 | # 1. (For static extensions) by the ld command when the perl binary |
1101 | # is linked with the extension library. See EXTRALIBS below. |
1102 | # |
1103 | # 2. (For dynamic extensions) by the ld command when the shared |
1104 | # object is built/linked. See LDLOADLIBS below. |
1105 | # |
1106 | # 3. (For dynamic extensions) by the DynaLoader when the shared |
1107 | # object is loaded. See BSLOADLIBS below. |
1108 | # |
1109 | # EXTRALIBS = List of libraries that need to be linked with when |
1110 | # linking a perl binary which includes this extension |
1111 | # Only those libraries that actually exist are included. |
1112 | # These are written to a file and used when linking perl. |
1113 | # |
1114 | # LDLOADLIBS = List of those libraries which can or must be linked into |
1115 | # the shared library when created using ld. These may be |
1116 | # static or dynamic libraries. |
1117 | # |
1118 | # BSLOADLIBS = List of those libraries that are needed but can be |
1119 | # linked in dynamically at run time on this platform. |
1120 | # SunOS/Solaris does not need this because ld records |
1121 | # the information (from LDLOADLIBS) into the object file. |
1122 | # This list is used to create a .bs (bootstrap) file. |
42793c05 |
1123 | # |
1124 | EXTRALIBS = $att{'EXTRALIBS'} |
1125 | LDLOADLIBS = $att{'LDLOADLIBS'} |
1126 | BSLOADLIBS = $att{'BSLOADLIBS'} |
a0d0e21e |
1127 | "; |
42793c05 |
1128 | } |
a0d0e21e |
1129 | |
a0d0e21e |
1130 | |
42793c05 |
1131 | # --- Tool Sections --- |
a0d0e21e |
1132 | |
42793c05 |
1133 | sub tool_autosplit{ |
1134 | my($self, %attribs) = @_; |
1135 | my($asl) = ""; |
1136 | $asl = "\$AutoSplit::Maxlen=$attribs{MAXLEN};" if $attribs{MAXLEN}; |
1137 | q{ |
42793c05 |
1138 | # Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto |
3edbfbe5 |
1139 | # Remark: the "" around the -I switches are helpful for the VMS support |
75f92628 |
1140 | AUTOSPLITFILE = $(PERL) $(I_PERL_LIBS) -e 'use AutoSplit;}.$asl.q{ autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1) ;' |
42793c05 |
1141 | }; |
1142 | } |
a0d0e21e |
1143 | |
a0d0e21e |
1144 | |
42793c05 |
1145 | sub tool_xsubpp{ |
e1666bf5 |
1146 | my($xsdir) = '$(PERL_LIB)/ExtUtils'; |
1147 | # drop back to old location if xsubpp is not in new location yet |
1148 | $xsdir = '$(PERL_SRC)/ext' unless (-f "$att{PERL_LIB}/ExtUtils/xsubpp"); |
1149 | my(@tmdeps) = ('$(XSUBPPDIR)/typemap'); |
42793c05 |
1150 | push(@tmdeps, "typemap") if -f "typemap"; |
1151 | my(@tmargs) = map("-typemap $_", @tmdeps); |
1152 | " |
e1666bf5 |
1153 | XSUBPPDIR = $xsdir |
1154 | XSUBPP = \$(XSUBPPDIR)/xsubpp |
42793c05 |
1155 | XSUBPPDEPS = @tmdeps |
1156 | XSUBPPARGS = @tmargs |
1157 | "; |
1158 | }; |
a0d0e21e |
1159 | |
a0d0e21e |
1160 | |
42793c05 |
1161 | sub tools_other{ |
e1666bf5 |
1162 | " |
42793c05 |
1163 | SHELL = /bin/sh |
e1666bf5 |
1164 | LD = $att{LD} |
3edbfbe5 |
1165 | TOUCH = $att{TOUCH} |
1166 | CP = $att{CP} |
75f92628 |
1167 | MV = $att{MV} |
3edbfbe5 |
1168 | RM_F = $att{RM_F} |
1169 | RM_RF = $att{RM_RF} |
e1666bf5 |
1170 | ".q{ |
42793c05 |
1171 | # The following is a portable way to say mkdir -p |
75f92628 |
1172 | MKPATH = $(PERL) -wle '$$"="/"; foreach $$p (@ARGV){ next if -d $$p; my(@p); foreach(split(/\//,$$p)){ push(@p,$$_); next if -d "@p/"; print "mkdir @p"; mkdir("@p",0777)||die $$! }} exit 0;' |
42793c05 |
1173 | }; |
a0d0e21e |
1174 | } |
1175 | |
1176 | |
1177 | sub post_constants{ |
1178 | ""; |
1179 | } |
1180 | |
1181 | |
42793c05 |
1182 | # --- Translation Sections --- |
a0d0e21e |
1183 | |
42793c05 |
1184 | sub c_o { |
1185 | ' |
1186 | .c.o: |
1187 | $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $(INC) $*.c |
1188 | '; |
a0d0e21e |
1189 | } |
1190 | |
42793c05 |
1191 | sub xs_c { |
1192 | ' |
1193 | .xs.c: |
1194 | $(PERL) $(XSUBPP) $(XSUBPPARGS) $*.xs >xstmp.c && mv xstmp.c $@ |
1195 | '; |
1196 | } |
a0d0e21e |
1197 | |
42793c05 |
1198 | sub xs_o { # many makes are too dumb to use xs_c then c_o |
a0d0e21e |
1199 | ' |
42793c05 |
1200 | .xs.o: |
1201 | $(PERL) $(XSUBPP) $(XSUBPPARGS) $*.xs >xstmp.c && mv xstmp.c $*.c |
1202 | $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $(INC) $*.c |
a0d0e21e |
1203 | '; |
1204 | } |
1205 | |
1206 | |
42793c05 |
1207 | # --- Target Sections --- |
1208 | |
1209 | sub top_targets{ |
a0d0e21e |
1210 | ' |
42793c05 |
1211 | all :: config linkext $(INST_PM) |
3edbfbe5 |
1212 | '.$att{NOOP}.' |
42793c05 |
1213 | |
1214 | config :: Makefile |
75f92628 |
1215 | @$(MKPATH) $(INST_LIBDIR) $(INST_ARCHAUTODIR) |
a0d0e21e |
1216 | '; |
1217 | } |
1218 | |
42793c05 |
1219 | sub linkext { |
1220 | my($self, %attribs) = @_; |
1221 | # LINKTYPE => static or dynamic |
1222 | my($linktype) = $attribs{LINKTYPE} || '$(LINKTYPE)'; |
1223 | " |
1224 | linkext :: $linktype |
3edbfbe5 |
1225 | $att{NOOP} |
42793c05 |
1226 | "; |
1227 | } |
1228 | |
1229 | |
1230 | # --- Dynamic Loading Sections --- |
a0d0e21e |
1231 | |
1232 | sub dynamic { |
1233 | ' |
42793c05 |
1234 | # $(INST_PM) has been moved to the all: target. |
1235 | # It remains here for awhile to allow for old usage: "make dynamic" |
75f92628 |
1236 | dynamic :: Makefile $(INST_DYNAMIC) $(INST_BOOT) $(INST_PM) |
3edbfbe5 |
1237 | '.$att{NOOP}.' |
42793c05 |
1238 | '; |
1239 | } |
a0d0e21e |
1240 | |
42793c05 |
1241 | sub dynamic_bs { |
1242 | my($self, %attribs) = @_; |
1243 | ' |
1244 | BOOTSTRAP = '."$att{BASEEXT}.bs".' |
a0d0e21e |
1245 | |
42793c05 |
1246 | # As MakeMaker mkbootstrap might not write a file (if none is required) |
1247 | # we use touch to prevent make continually trying to remake it. |
1248 | # The DynaLoader only reads a non-empty file. |
75f92628 |
1249 | $(BOOTSTRAP): Makefile '.$att{BOOTDEP}.' |
1250 | $(PERL) $(I_PERL_LIBS) \ |
3edbfbe5 |
1251 | -e \'use ExtUtils::MakeMaker; &mkbootstrap("$(BSLOADLIBS)");\' \ |
e1666bf5 |
1252 | INST_LIB=$(INST_LIB) INST_ARCHLIB=$(INST_ARCHLIB) PERL_SRC=$(PERL_SRC) NAME=$(NAME) |
3edbfbe5 |
1253 | @$(TOUCH) $(BOOTSTRAP) |
a0d0e21e |
1254 | |
1255 | $(INST_BOOT): $(BOOTSTRAP) |
3edbfbe5 |
1256 | @'.$att{RM_RF}.' $(INST_BOOT) |
1257 | '.$att{CP}.' $(BOOTSTRAP) $(INST_BOOT) |
a0d0e21e |
1258 | '; |
1259 | } |
1260 | |
75f92628 |
1261 | |
42793c05 |
1262 | sub dynamic_lib { |
1263 | my($self, %attribs) = @_; |
1264 | my($otherldflags) = $attribs{OTHERLDFLAGS} || ""; |
1265 | my($armaybe) = $attribs{ARMAYBE} || $att{ARMAYBE} || ":"; |
3edbfbe5 |
1266 | my($ldfrom) = '$(LDFROM)'; |
75f92628 |
1267 | my($osname) = $Config{'osname'}; |
1268 | $armaybe = 'ar' if ($osname eq 'dec_osf' and $armaybe eq ':'); |
3edbfbe5 |
1269 | my(@m); |
1270 | push(@m,' |
75f92628 |
1271 | # This section creates the dynamically loadable $(INST_DYNAMIC) |
1272 | # from $(OBJECT) and possibly $(MYEXTLIB). |
42793c05 |
1273 | ARMAYBE = '.$armaybe.' |
1274 | OTHERLDFLAGS = '.$otherldflags.' |
a0d0e21e |
1275 | |
42793c05 |
1276 | $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) |
3edbfbe5 |
1277 | @$(MKPATH) $(INST_ARCHAUTODIR) |
1278 | '); |
1279 | if ($armaybe ne ':'){ |
1280 | $ldfrom = "tmp.a"; |
1281 | push(@m,' $(ARMAYBE) cr '.$ldfrom.' $(OBJECT)'."\n"); |
1282 | push(@m,' $(RANLIB) '."$ldfrom\n"); |
1283 | } |
75f92628 |
1284 | $ldfrom = "-all $ldfrom -none" if ($osname eq 'dec_osf'); |
1285 | push(@m,' $(LD) -o $@ $(LDDLFLAGS) '.$ldfrom. |
3edbfbe5 |
1286 | ' $(OTHERLDFLAGS) $(MYEXTLIB) $(LDLOADLIBS)'."\n"); |
1287 | join('',@m); |
a0d0e21e |
1288 | } |
1289 | |
1290 | |
42793c05 |
1291 | # --- Static Loading Sections --- |
1292 | |
1293 | sub static { |
a0d0e21e |
1294 | ' |
42793c05 |
1295 | # $(INST_PM) has been moved to the all: target. |
1296 | # It remains here for awhile to allow for old usage: "make static" |
75f92628 |
1297 | static :: Makefile $(INST_STATIC) $(INST_PM) |
3edbfbe5 |
1298 | '.$att{NOOP}.' |
a0d0e21e |
1299 | '; |
1300 | } |
1301 | |
42793c05 |
1302 | sub static_lib{ |
1303 | my(@m); |
1304 | push(@m, <<'END'); |
1305 | $(INST_STATIC): $(OBJECT) $(MYEXTLIB) |
1306 | END |
1307 | # If this extension has it's own library (eg SDBM_File) |
1308 | # then copy that to $(INST_STATIC) and add $(OBJECT) into it. |
3edbfbe5 |
1309 | push(@m, " $att{CP} \$(MYEXTLIB) \$\@\n") if $att{MYEXTLIB}; |
42793c05 |
1310 | |
1311 | push(@m, <<'END'); |
1312 | ar cr $@ $(OBJECT) && $(RANLIB) $@ |
75f92628 |
1313 | @echo "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)/extralibs.ld |
42793c05 |
1314 | END |
e1666bf5 |
1315 | push(@m, <<'END') if $att{PERL_SRC}; |
1316 | @: Old mechanism - still needed: |
75f92628 |
1317 | @echo "$(EXTRALIBS)" >> $(PERL_SRC)/ext.libs |
e1666bf5 |
1318 | END |
42793c05 |
1319 | join('', "\n",@m); |
1320 | } |
1321 | |
a0d0e21e |
1322 | |
1323 | sub installpm { |
42793c05 |
1324 | my($self, %attribs) = @_; |
1325 | # By default .pm files are split into the architecture independent |
1326 | # library. This is a good thing. If a specific module requires that |
1327 | # it's .pm files are split into the architecture specific library |
1328 | # then it should use: installpm => {SPLITLIB=>'$(INST_ARCHLIB)'} |
1329 | # Note that installperl currently interferes with this (Config.pm) |
1330 | # User can disable split by saying: installpm => {SPLITLIB=>''} |
1331 | my($splitlib) = '$(INST_LIB)'; # NOT arch specific by default |
1332 | $splitlib = $attribs{SPLITLIB} if exists $attribs{SPLITLIB}; |
1333 | my(@m, $dist); |
1334 | foreach $dist (sort keys %{$att{PM}}){ |
1335 | my($inst) = $att{PM}->{$dist}; |
1336 | push(@m, "\n# installpm: $dist => $inst, splitlib=$splitlib\n"); |
1337 | push(@m, MY->installpm_x($dist, $inst, $splitlib)); |
1338 | push(@m, "\n"); |
1339 | } |
1340 | join('', @m); |
a0d0e21e |
1341 | } |
1342 | |
42793c05 |
1343 | sub installpm_x { # called by installpm per file |
1344 | my($self, $dist, $inst, $splitlib) = @_; |
1345 | my($instdir) = $inst =~ m|(.*)/|; |
1346 | my(@m); |
1347 | push(@m," |
1348 | $inst: $dist |
3edbfbe5 |
1349 | ".' @'.$att{RM_F}.' $@ |
42793c05 |
1350 | @$(MKPATH) '.$instdir.' |
3edbfbe5 |
1351 | '.$att{CP}.' $? $@ |
42793c05 |
1352 | '); |
1353 | push(@m, "\t\$(AUTOSPLITFILE) \$@ $splitlib/auto\n") |
1354 | if ($splitlib and $inst =~ m/\.pm$/); |
1355 | join('', @m); |
1356 | } |
a0d0e21e |
1357 | |
42793c05 |
1358 | |
1359 | # --- Sub-directory Sections --- |
1360 | |
1361 | sub subdirs { |
1362 | my(@m); |
1363 | # This method provides a mechanism to automatically deal with |
1364 | # subdirectories containing further Makefile.PL scripts. |
1365 | # It calls the subdir_x() method for each subdirectory. |
1366 | foreach(<*/Makefile.PL>){ |
1367 | s:/Makefile\.PL$:: ; |
1368 | print "Including $_ subdirectory" if ($Verbose); |
1369 | push(@m, MY->subdir_x($_)); |
1370 | } |
1371 | if (@m){ |
1372 | unshift(@m, " |
1373 | # The default clean, realclean and test targets in this Makefile |
1374 | # have automatically been given entries for each subdir. |
1375 | |
1376 | all :: subdirs |
1377 | "); |
1378 | } else { |
1379 | push(@m, "\n# none") |
1380 | } |
1381 | join('',@m); |
1382 | } |
1383 | |
1384 | sub runsubdirpl{ # Experimental! See subdir_x section |
1385 | my($self,$subdir) = @_; |
1386 | chdir($subdir) or die "chdir($subdir): $!"; |
1387 | require "Makefile.PL"; |
a0d0e21e |
1388 | } |
1389 | |
42793c05 |
1390 | sub subdir_x { |
1391 | my($self, $subdir) = @_; |
1392 | my(@m); |
1393 | # The intention is that the calling Makefile.PL should define the |
1394 | # $(SUBDIR_MAKEFILE_PL_ARGS) make macro to contain whatever |
1395 | # information needs to be passed down to the other Makefile.PL scripts. |
1396 | # If this does not suit your needs you'll need to write your own |
1397 | # MY::subdir_x() method to override this one. |
1398 | qq{ |
1399 | config :: $subdir/Makefile |
3edbfbe5 |
1400 | cd $subdir ; \$(MAKE) config INST_LIB=\$(INST_LIB) INST_ARCHLIB=\$(INST_ARCHLIB) LINKTYPE=\$(LINKTYPE) |
42793c05 |
1401 | |
1402 | $subdir/Makefile: $subdir/Makefile.PL \$(CONFIGDEP) |
1403 | }.' @echo "Rebuilding $@ ..." |
75f92628 |
1404 | $(PERL) $(I_PERL_LIBS) \\ |
42793c05 |
1405 | -e "use ExtUtils::MakeMaker; MM->runsubdirpl(qw('.$subdir.'))" \\ |
75f92628 |
1406 | INST_LIB=$(INST_LIB) INST_ARCHLIB=$(INST_ARCHLIB) $(SUBDIR_MAKEFILE_PL_ARGS) |
42793c05 |
1407 | @echo "Rebuild of $@ complete." |
1408 | '.qq{ |
1409 | |
1410 | subdirs :: |
1411 | cd $subdir ; \$(MAKE) all LINKTYPE=\$(LINKTYPE) |
1412 | |
1413 | }; |
1414 | } |
1415 | |
1416 | |
1417 | # --- Cleanup and Distribution Sections --- |
1418 | |
1419 | sub clean { |
1420 | my($self, %attribs) = @_; |
1421 | my(@m); |
1422 | push(@m, ' |
1423 | # Delete temporary files but do not touch installed files. We don\'t delete |
1424 | # the Makefile here so a later make realclean still has a makefile to use. |
1425 | |
1426 | clean :: |
1427 | '); |
1428 | # clean subdirectories first |
1429 | push(@m, map("\t-cd $_ && test -f Makefile && \$(MAKE) clean\n",@{$att{DIR}})); |
75f92628 |
1430 | my(@otherfiles) = values %{$att{XS}}; # .c files from *.xs files |
42793c05 |
1431 | push(@otherfiles, $attribs{FILES}) if $attribs{FILES}; |
75f92628 |
1432 | push(@m, " -$att{RM_RF} *~ t/*~ *.o *.a mon.out core so_locations " |
1433 | ."\$(BOOTSTRAP) \$(BASEEXT).bso @otherfiles\n"); |
1434 | # See realclean and ext/utils/make_ext for usage of Makefile.old |
1435 | push(@m, " -$att{MV} Makefile Makefile.old 2>/dev/null\n"); |
42793c05 |
1436 | push(@m, " $attribs{POSTOP}\n") if $attribs{POSTOP}; |
1437 | join("", @m); |
1438 | } |
a0d0e21e |
1439 | |
1440 | sub realclean { |
42793c05 |
1441 | my($self, %attribs) = @_; |
1442 | my(@m); |
1443 | push(@m,' |
1444 | # Delete temporary files (via clean) and also delete installed files |
1445 | realclean purge :: clean |
1446 | '); |
75f92628 |
1447 | # realclean subdirectories first (already cleaned) |
1448 | $sub = "\t-cd %s && test -f %s && \$(MAKE) %s realclean\n"; |
1449 | foreach(@{$att{DIR}}){ |
1450 | push(@m, sprintf($sub,$_,'Makefile.old','-f Makefile.old')); |
1451 | push(@m, sprintf($sub,$_,'Makefile','')); |
1452 | } |
3edbfbe5 |
1453 | push(@m, " $att{RM_RF} \$(INST_AUTODIR) \$(INST_ARCHAUTODIR)\n"); |
75f92628 |
1454 | push(@m, " $att{RM_F} \$(INST_DYNAMIC) \$(INST_BOOT)\n"); |
1455 | push(@m, " $att{RM_F} \$(INST_STATIC) \$(INST_PM)\n"); |
1456 | my(@otherfiles) = qw(Makefile Makefile.old); # Makefiles last |
42793c05 |
1457 | push(@otherfiles, $attribs{FILES}) if $attribs{FILES}; |
3edbfbe5 |
1458 | push(@m, " $att{RM_RF} @otherfiles\n") if @otherfiles; |
42793c05 |
1459 | push(@m, " $attribs{POSTOP}\n") if $attribs{POSTOP}; |
1460 | join("", @m); |
1461 | } |
a0d0e21e |
1462 | |
42793c05 |
1463 | |
1464 | sub distclean { |
1465 | my($self, %attribs) = @_; |
1466 | # VERSION should be sanitised before use as a file name |
1467 | my($tarname) = $attribs{TARNAME} || '$(DISTNAME)-$(VERSION)'; |
1468 | my($tarflags) = $attribs{TARFLAGS} || 'cvf'; |
1469 | my($compress) = $attribs{COMPRESS} || 'compress'; # eg gzip |
1470 | my($preop) = $attribs{PREOP} || '@:'; # e.g., update MANIFEST |
1471 | my($postop) = $attribs{POSTOP} || '@:'; |
1472 | my($mkfiles) = join(' ', map("$_/Makefile", ".", @{$att{DIR}})); |
1473 | " |
1474 | distclean: clean |
1475 | $preop |
3edbfbe5 |
1476 | $att{RM_F} $mkfiles |
42793c05 |
1477 | cd ..; tar $tarflags $tarname.tar \$(BASEEXT) |
1478 | cd ..; $compress $tarname.tar |
1479 | $postop |
1480 | "; |
a0d0e21e |
1481 | } |
1482 | |
1483 | |
42793c05 |
1484 | # --- Test and Installation Sections --- |
1485 | |
a0d0e21e |
1486 | sub test { |
42793c05 |
1487 | my($self, %attribs) = @_; |
1488 | my($tests) = $attribs{TESTS} || (-d "t" ? "t/*.t" : ""); |
1489 | my(@m); |
1490 | push(@m," |
1491 | test :: all |
1492 | "); |
1493 | push(@m, <<"END") if $tests; |
3edbfbe5 |
1494 | \$(FULLPERL) -I\$(INST_ARCHLIB) -I\$(INST_LIB) -I\$(PERL_ARCHLIB) -I\$(PERL_LIB) -e 'use Test::Harness; runtests \@ARGV;' $tests |
42793c05 |
1495 | END |
1496 | push(@m, <<'END') if -f "test.pl"; |
75f92628 |
1497 | $(FULLPERL) -I$(INST_ARCHLIB) -I$(INST_LIB) $(I_PERL_LIBS) test.pl |
42793c05 |
1498 | END |
1499 | push(@m, map("\tcd $_ && test -f Makefile && \$(MAKE) test LINKTYPE=\$(LINKTYPE)\n",@{$att{DIR}})); |
1500 | push(@m, "\t\@echo 'No tests defined for \$(NAME) extension.'\n") unless @m > 1; |
1501 | join("", @m); |
a0d0e21e |
1502 | } |
1503 | |
1504 | |
1505 | sub install { |
3edbfbe5 |
1506 | my($self, %attribs) = @_; |
1507 | my(@m); |
1508 | push(@m, " |
42793c05 |
1509 | install :: all |
3edbfbe5 |
1510 | "); |
1511 | # install subdirectories first |
1512 | push(@m, map("\tcd $_ && test -f Makefile && \$(MAKE) install\n",@{$att{DIR}})); |
1513 | |
75f92628 |
1514 | push(@m, "\t: perl5.000 and MM pre 3.8 autosplit into INST_ARCHLIB, we delete these old files here |
3edbfbe5 |
1515 | $att{RM_F} \$(INSTALLARCHLIB)/auto/\$(FULLEXT)/*.al \$(INSTALLARCHLIB)/auto/\$(FULLEXT)/*.ix |
75f92628 |
1516 | \$(MAKE) INST_LIB=\$(INSTALLPRIVLIB) INST_ARCHLIB=\$(INSTALLARCHLIB) |
3edbfbe5 |
1517 | "); |
a0d0e21e |
1518 | |
3edbfbe5 |
1519 | join("",@m); |
1520 | } |
a0d0e21e |
1521 | |
42793c05 |
1522 | sub force { |
1523 | '# Phony target to force checking subdirectories. |
1524 | FORCE: |
a0d0e21e |
1525 | '; |
1526 | } |
1527 | |
1528 | |
1529 | sub perldepend { |
42793c05 |
1530 | my(@m); |
1531 | push(@m,' |
1532 | PERL_HDRS = $(PERL_INC)/EXTERN.h $(PERL_INC)/INTERN.h \ |
1533 | $(PERL_INC)/XSUB.h $(PERL_INC)/av.h $(PERL_INC)/cop.h \ |
1534 | $(PERL_INC)/cv.h $(PERL_INC)/dosish.h $(PERL_INC)/embed.h \ |
1535 | $(PERL_INC)/form.h $(PERL_INC)/gv.h $(PERL_INC)/handy.h \ |
1536 | $(PERL_INC)/hv.h $(PERL_INC)/keywords.h $(PERL_INC)/mg.h \ |
1537 | $(PERL_INC)/op.h $(PERL_INC)/opcode.h $(PERL_INC)/patchlevel.h \ |
1538 | $(PERL_INC)/perl.h $(PERL_INC)/perly.h $(PERL_INC)/pp.h \ |
1539 | $(PERL_INC)/proto.h $(PERL_INC)/regcomp.h $(PERL_INC)/regexp.h \ |
1540 | $(PERL_INC)/scope.h $(PERL_INC)/sv.h $(PERL_INC)/unixish.h \ |
75f92628 |
1541 | $(PERL_INC)/util.h $(PERL_INC)/config.h |
42793c05 |
1542 | |
1543 | $(OBJECT) : $(PERL_HDRS) |
1544 | '); |
e1666bf5 |
1545 | |
42793c05 |
1546 | push(@m,' |
75f92628 |
1547 | # Check for unpropogated config.sh changes. Should never happen. |
1548 | # We do NOT just update config.h because that is not sufficient. |
1549 | # An out of date config.h is not fatal but complains loudly! |
1550 | $(PERL_INC)/config.h: $(PERL_SRC)/config.sh |
1551 | -@echo "Warning: $(PERL_INC)/config.h out of date with $(PERL_SRC)/config.sh"; false |
1552 | |
1553 | # An out of date Config.pm is fatal. |
1554 | $(PERL_ARCHLIB)/Config.pm: $(PERL_SRC)/config.sh |
1555 | @echo "$(PERL_ARCHLIB)/Config.pm out of date with $(PERL_SRC)/config.sh" |
1556 | @false |
e1666bf5 |
1557 | ') if $att{PERL_SRC}; |
1558 | |
42793c05 |
1559 | push(@m, join(" ", values %{$att{XS}})." : \$(XSUBPPDEPS)\n") |
1560 | if %{$att{XS}}; |
1561 | join("\n",@m); |
1562 | } |
1563 | |
1564 | |
1565 | sub makefile { |
1566 | # We do not know what target was originally specified so we |
75f92628 |
1567 | # must force a manual rerun to be sure. But as it should only |
42793c05 |
1568 | # happen very rarely it is not a significant problem. |
75f92628 |
1569 | ' |
1570 | $(OBJECT) : Makefile |
1571 | |
1572 | # We take a very conservative approach here, but it\'s worth it. |
1573 | # We move Makefile to Makefile.old here to avoid gnu make looping. |
1574 | Makefile: Makefile.PL $(CONFIGDEP) |
1575 | @echo "Makefile out-of-date with respect to $?" |
1576 | @echo "Cleaning current config before rebuilding Makefile..." |
1577 | -@mv Makefile Makefile.old |
1578 | -$(MAKE) -f Makefile.old clean >/dev/null 2>&1 || true |
1579 | $(PERL) $(I_PERL_LIBS) Makefile.PL |
42793c05 |
1580 | @echo "Now you must rerun make."; false |
a0d0e21e |
1581 | '; |
1582 | } |
1583 | |
1584 | |
1585 | sub postamble{ |
1586 | ""; |
1587 | } |
1588 | |
1589 | |
42793c05 |
1590 | # --- Determine libraries to use and how to use them --- |
1591 | |
1592 | sub extliblist{ |
1593 | my($self, $libs) = @_; |
1594 | return ("", "", "") unless $libs; |
1595 | print STDERR "Potential libraries are '$libs':" if $Verbose; |
42793c05 |
1596 | my(@new) = MY->new_extliblist($libs); |
1597 | |
e1666bf5 |
1598 | if ($att{PERL_SRC}){ |
1599 | my(@old) = MY->old_extliblist($libs); |
1600 | my($oldlibs) = join(" : ",@old); |
1601 | my($newlibs) = join(" : ",@new); |
1602 | warn "Warning (non-fatal): $att{NAME} extliblist consistency check failed:\n". |
1603 | " old: $oldlibs\n". |
1604 | " new: $newlibs\n". |
3edbfbe5 |
1605 | "Using 'new' set. Please notify perl5-porters\@nicoh.com.\n" |
e1666bf5 |
1606 | if ("$newlibs" ne "$oldlibs"); |
1607 | } |
42793c05 |
1608 | @new; |
a0d0e21e |
1609 | } |
1610 | |
1611 | |
42793c05 |
1612 | sub old_extliblist { |
1613 | my($self, $potential_libs)=@_; |
1614 | return ("", "", "") unless $potential_libs; |
e1666bf5 |
1615 | die "old_extliblist requires PERL_SRC" unless $att{PERL_SRC}; |
42793c05 |
1616 | |
1617 | my(%attrib, @w); |
1618 | # Now run ext/util/extliblist to discover what *libs definitions |
1619 | # are required for the needs of $potential_libs |
1620 | $ENV{'potential_libs'} = $potential_libs; |
1621 | my(@o)=`. $att{PERL_SRC}/config.sh |
1622 | . $att{PERL_SRC}/ext/util/extliblist; |
1623 | echo EXTRALIBS=\$extralibs |
1624 | echo BSLOADLIBS=\$dynaloadlibs |
1625 | echo LDLOADLIBS=\$statloadlibs |
1626 | `; |
1627 | foreach $line (@o){ |
1628 | chomp $line; |
1629 | if ($line =~ /(.*)\s*=\s*(.*)\s*$/){ |
1630 | $attrib{$1} = $2; |
1631 | print STDERR " $1 = $2" if $Verbose; |
1632 | }else{ |
1633 | push(@w, $line); |
1634 | } |
1635 | } |
1636 | print STDERR "Messages from extliblist:\n", join("\n",@w,'') |
1637 | if @w ; |
1638 | @attrib{qw(EXTRALIBS BSLOADLIBS LDLOADLIBS)}; |
1639 | } |
1640 | |
1641 | |
1642 | sub new_extliblist { |
1643 | my($self, $potential_libs)=@_; |
1644 | return ("", "", "") unless $potential_libs; |
1645 | |
1646 | my($so) = $Config{'so'}; |
1647 | my($libs) = $Config{'libs'}; |
1648 | |
1649 | # compute $extralibs, $bsloadlibs and $ldloadlibs from |
1650 | # $potential_libs |
1651 | # this is a rewrite of Andy Dougherty's extliblist in perl |
1652 | # its home is in <distribution>/ext/util |
1653 | |
1654 | my(@searchpath); # from "-L/path" entries in $potential_libs |
1655 | my(@libpath) = split " ", $Config{'libpth'}; |
1656 | my(@ldloadlibs); |
1657 | my(@bsloadlibs); |
1658 | my(@extralibs); |
1659 | my($fullname); |
1660 | my($pwd) = fastcwd(); # from Cwd.pm |
1661 | |
1662 | foreach $thislib (split ' ', $potential_libs){ |
1663 | |
1664 | # Handle possible linker path arguments. |
1665 | if ($thislib =~ s/^(-[LR])//){ # save path flag type |
1666 | my($ptype) = $1; |
1667 | unless (-d $thislib){ |
1668 | warn "$ptype$thislib ignored, directory does not exist\n" |
1669 | if $Verbose; |
1670 | next; |
1671 | } |
1672 | if ($thislib !~ m|^/|) { |
1673 | warn "Warning: $ptype$thislib changed to $ptype$pwd/$thislib\n"; |
1674 | $thislib = "$pwd/$thislib"; |
1675 | } |
1676 | push(@searchpath, $thislib); |
1677 | push(@extralibs, "$ptype$thislib"); |
1678 | push(@ldloadlibs, "$ptype$thislib"); |
1679 | next; |
1680 | } |
1681 | |
1682 | # Handle possible library arguments. |
1683 | unless ($thislib =~ s/^-l//){ |
1684 | warn "Unrecognized argument in LIBS ignored: '$thislib'\n"; |
1685 | next; |
1686 | } |
1687 | |
1688 | my($found_lib)=0; |
1689 | foreach $thispth (@searchpath, @libpath){ |
1690 | |
1691 | if (@fullname=<${thispth}/lib${thislib}.${so}.[0-9]*>){ |
1692 | $fullname=$fullname[-1]; #ATTN: 10 looses against 9! |
1693 | } elsif (-f ($fullname="$thispth/lib$thislib.$so")){ |
ecfc5424 |
1694 | } elsif (-f ($fullname="$thispth/lib${thislib}_s.a") |
1695 | && ($thislib .= "_s") ){ # we must explicitly ask for _s version |
42793c05 |
1696 | } elsif (-f ($fullname="$thispth/lib$thislib.a")){ |
1697 | } elsif (-f ($fullname="$thispth/Slib$thislib.a")){ |
1698 | } else { |
1699 | warn "$thislib not found in $thispth\n" if $Verbose; |
1700 | next; |
1701 | } |
1702 | warn "'-l$thislib' found at $fullname\n" if $Verbose; |
1703 | $found_lib++; |
1704 | |
1705 | # Now update library lists |
1706 | |
1707 | # what do we know about this library... |
1708 | my $is_dyna = ($fullname !~ /\.a$/); |
e1666bf5 |
1709 | my $in_perl = ($libs =~ /\B-l${thislib}\b/s); |
42793c05 |
1710 | |
1711 | # Do not add it into the list if it is already linked in |
1712 | # with the main perl executable. |
1713 | # We have to special-case the NeXT, because all the math is also in libsys_s |
1714 | unless ( $in_perl || ($Config{'osname'} eq 'next' && $thislib eq 'm') ){ |
1715 | push(@extralibs, "-l$thislib"); |
1716 | } |
1717 | |
1718 | |
1719 | # We might be able to load this archive file dynamically |
1720 | if ( $Config{'dlsrc'} =~ /dl_next|dl_dld/){ |
1721 | # We push -l$thislib instead of $fullname because |
1722 | # it avoids hardwiring a fixed path into the .bs file. |
1723 | # mkbootstrap will automatically add dl_findfile() to |
1724 | # the .bs file if it sees a name in the -l format. |
1725 | # USE THIS LATER: push(@bsloadlibs, "-l$thislib"); # " $fullname"; |
1726 | # USE THIS while checking results against old_extliblist |
1727 | push(@bsloadlibs, "$fullname"); |
1728 | } else { |
1729 | if ($is_dyna){ |
1730 | # For SunOS4, do not add in this shared library if |
1731 | # it is already linked in the main perl executable |
1732 | push(@ldloadlibs, "-l$thislib") |
1733 | unless ($in_perl and $Config{'osname'} eq 'sunos'); |
1734 | } else { |
1735 | push(@ldloadlibs, "-l$thislib"); |
1736 | } |
1737 | } |
1738 | last; # found one here so don't bother looking further |
1739 | } |
1740 | warn "Warning (non-fatal): No library found for -l$thislib\n" unless $found_lib>0; |
1741 | } |
1742 | ("@extralibs", "@bsloadlibs", "@ldloadlibs"); |
1743 | } |
1744 | |
1745 | |
1746 | # --- Write a DynaLoader bootstrap file if required |
a0d0e21e |
1747 | |
1748 | sub mkbootstrap { |
a0d0e21e |
1749 | |
42793c05 |
1750 | =head1 NAME |
1751 | |
1752 | mkbootstrap |
1753 | |
1754 | =head1 DESCRIPTION |
1755 | |
1756 | Make a bootstrap file for use by this system's DynaLoader. |
1757 | It typically gets called from an extension Makefile. |
1758 | |
1759 | There is no .bs file supplied with the extension. Instead a _BS file |
1760 | which has code for the special cases, like posix for berkeley db on the |
1761 | NeXT. |
1762 | |
1763 | This file will get parsed, and produce a maybe empty |
1764 | @DynaLoader::dl_resolve_using array for the current architecture. |
1765 | That will be extended by $BSLOADLIBS, which was computed by Andy's |
1766 | extliblist script. If this array still is empty, we do nothing, else |
1767 | we write a .bs file with an @DynaLoader::dl_resolve_using array, but |
1768 | without any C<if>s, because there is no longer a need to deal with |
1769 | special cases. |
1770 | |
1771 | The _BS file can put some code into the generated .bs file by placing |
1772 | it in $bscode. This is a handy 'escape' mechanism that may prove |
1773 | useful in complex situations. |
1774 | |
1775 | If @DynaLoader::dl_resolve_using contains C<-L*> or C<-l*> entries then |
1776 | mkbootstrap will automatically add a dl_findfile() call to the |
1777 | generated .bs file. |
1778 | |
1779 | =head1 AUTHORS |
1780 | |
1781 | Andreas Koenig <k@otto.ww.TU-Berlin.DE>, Tim Bunce |
1782 | <Tim.Bunce@ig.co.uk>, Andy Dougherty <doughera@lafcol.lafayette.edu> |
1783 | |
1784 | =cut |
1785 | |
1786 | my($self, @bsloadlibs)=@_; |
1787 | |
1788 | @bsloadlibs = grep($_, @bsloadlibs); # strip empty libs |
1789 | |
1790 | print STDERR " bsloadlibs=@bsloadlibs\n" if $Verbose; |
1791 | |
1792 | # We need DynaLoader here because we and/or the *_BS file may |
1793 | # call dl_findfile(). We don't say `use' here because when |
1794 | # first building perl extensions the DynaLoader will not have |
1795 | # been built when MakeMaker gets first used. |
1796 | require DynaLoader; |
1797 | import DynaLoader; |
1798 | |
75f92628 |
1799 | init_main() unless defined $att{'BASEEXT'}; |
a0d0e21e |
1800 | |
1801 | rename "$att{BASEEXT}.bs", "$att{BASEEXT}.bso"; |
1802 | |
1803 | if (-f "$att{BASEEXT}_BS"){ |
1804 | $_ = "$att{BASEEXT}_BS"; |
1805 | package DynaLoader; # execute code as if in DynaLoader |
1806 | local($osname, $dlsrc) = (); # avoid warnings |
42793c05 |
1807 | ($osname, $dlsrc) = @Config::Config{qw(osname dlsrc)}; |
a0d0e21e |
1808 | $bscode = ""; |
1809 | unshift @INC, "."; |
1810 | require $_; |
42793c05 |
1811 | shift @INC; |
a0d0e21e |
1812 | } |
1813 | |
1814 | if ($Config{'dlsrc'} =~ /^dl_dld/){ |
1815 | package DynaLoader; |
1816 | push(@dl_resolve_using, dl_findfile('-lc')); |
1817 | } |
1818 | |
42793c05 |
1819 | my(@all) = (@bsloadlibs, @DynaLoader::dl_resolve_using); |
a0d0e21e |
1820 | my($method) = ''; |
1821 | if (@all){ |
1822 | open BS, ">$att{BASEEXT}.bs" |
1823 | or die "Unable to open $att{BASEEXT}.bs: $!"; |
1824 | print STDOUT "Writing $att{BASEEXT}.bs\n"; |
1825 | print STDOUT " containing: @all" if $Verbose; |
1826 | print BS "# $att{BASEEXT} DynaLoader bootstrap file for $Config{'osname'} architecture.\n"; |
1827 | print BS "# Do not edit this file, changes will be lost.\n"; |
1828 | print BS "# This file was automatically generated by the\n"; |
1829 | print BS "# mkbootstrap routine in ExtUtils/MakeMaker.pm.\n"; |
1830 | print BS "\@DynaLoader::dl_resolve_using = "; |
42793c05 |
1831 | # If @all contains names in the form -lxxx or -Lxxx then it's asking for |
1832 | # runtime library location so we automatically add a call to dl_findfile() |
1833 | if (" @all" =~ m/ -[lLR]/){ |
a0d0e21e |
1834 | print BS " dl_findfile(qw(\n @all\n ));\n"; |
1835 | }else{ |
1836 | print BS " qw(@all);\n"; |
1837 | } |
1838 | # write extra code if *_BS says so |
1839 | print BS $DynaLoader::bscode if $DynaLoader::bscode; |
42793c05 |
1840 | print BS "\n1;\n"; |
a0d0e21e |
1841 | close BS; |
1842 | } |
1843 | |
42793c05 |
1844 | # special handling for systems which needs a list of all global |
1845 | # symbols exported by a modules to be dynamically linked. |
a0d0e21e |
1846 | if ($Config{'dlsrc'} =~ /^dl_aix/){ |
42793c05 |
1847 | my($bootfunc); |
1848 | ($bootfunc = $att{NAME}) =~ s/\W/_/g; |
1849 | open EXP, ">$att{BASEEXT}.exp"; |
1850 | print EXP "#!\nboot_$bootfunc\n"; |
1851 | close EXP; |
a0d0e21e |
1852 | } |
1853 | } |
1854 | |
42793c05 |
1855 | |
1856 | # --- Output postprocessing section --- |
1857 | #nicetext is included to make VMS support easier |
1858 | sub nicetext { # Just return the input - no action needed |
1859 | my($self,$text) = @_; |
1860 | $text; |
1861 | } |
1862 | |
1863 | # the following keeps AutoSplit happy |
a0d0e21e |
1864 | package ExtUtils::MakeMaker; |
1865 | 1; |
1866 | |
1867 | __END__ |