1Module::Build(3pm) Perl Programmers Reference Guide Module::Build(3pm)
2
3
4
6 Module::Build - Build and install Perl modules
7
9 Standard process for building & installing modules:
10
11 perl Build.PL
12 ./Build
13 ./Build test
14 ./Build install
15
16 Or, if you're on a platform (like DOS or Windows) that doesn't require
17 the "./" notation, you can do this:
18
19 perl Build.PL
20 Build
21 Build test
22 Build install
23
25 "Module::Build" is a system for building, testing, and installing Perl
26 modules. It is meant to be an alternative to "ExtUtils::MakeMaker".
27 Developers may alter the behavior of the module through subclassing in
28 a much more straightforward way than with "MakeMaker". It also does
29 not require a "make" on your system - most of the "Module::Build" code
30 is pure-perl and written in a very cross-platform way. In fact, you
31 don't even need a shell, so even platforms like MacOS (traditional) can
32 use it fairly easily. Its only prerequisites are modules that are
33 included with perl 5.6.0, and it works fine on perl 5.005 if you can
34 install a few additional modules.
35
36 See "MOTIVATIONS" for more comparisons between "ExtUtils::MakeMaker"
37 and "Module::Build".
38
39 To install "Module::Build", and any other module that uses
40 "Module::Build" for its installation process, do the following:
41
42 perl Build.PL # 'Build.PL' script creates the 'Build' script
43 ./Build # Need ./ to ensure we're using this "Build" script
44 ./Build test # and not another one that happens to be in the PATH
45 ./Build install
46
47 This illustrates initial configuration and the running of three
48 'actions'. In this case the actions run are 'build' (the default
49 action), 'test', and 'install'. Other actions defined so far include:
50
51 <action_list>
52
53 You can run the 'help' action for a complete list of actions.
54
56 The documentation for "Module::Build" is broken up into three sections:
57
58 General Usage (Module::Build)
59 This is the document you are currently reading. It describes basic
60 usage and background information. Its main purpose is to assist
61 the user who wants to learn how to invoke and control
62 "Module::Build" scripts at the command line.
63
64 Authoring Reference (Module::Build::Authoring)
65 This document describes the structure and organization of
66 "Module::Build", and the relevant concepts needed by authors who
67 are writing Build.PL scripts for a distribution or controlling
68 "Module::Build" processes programmatically.
69
70 API Reference (Module::Build::API)
71 This is a reference to the "Module::Build" API.
72
73 Cookbook (Module::Build::Cookbook)
74 This document demonstrates how to accomplish many common tasks. It
75 covers general command line usage and authoring of Build.PL
76 scripts. Includes working examples.
77
79 There are some general principles at work here. First, each task when
80 building a module is called an "action". These actions are listed
81 above; they correspond to the building, testing, installing, packaging,
82 etc., tasks.
83
84 Second, arguments are processed in a very systematic way. Arguments
85 are always key=value pairs. They may be specified at "perl Build.PL"
86 time (i.e. "perl Build.PL destdir=/my/secret/place"), in which case
87 their values last for the lifetime of the "Build" script. They may
88 also be specified when executing a particular action (i.e. "Build test
89 verbose=1"), in which case their values last only for the lifetime of
90 that command. Per-action command line parameters take precedence over
91 parameters specified at "perl Build.PL" time.
92
93 The build process also relies heavily on the "Config.pm" module. If
94 the user wishes to override any of the values in "Config.pm", she may
95 specify them like so:
96
97 perl Build.PL --config cc=gcc --config ld=gcc
98
99 The following build actions are provided by default.
100
101 build
102 [version 0.01]
103
104 If you run the "Build" script without any arguments, it runs the
105 "build" action, which in turn runs the "code" and "docs" actions.
106
107 This is analogous to the "MakeMaker" make all target.
108
109 clean
110 [version 0.01]
111
112 This action will clean up any files that the build process may have
113 created, including the "blib/" directory (but not including the
114 "_build/" directory and the "Build" script itself).
115
116 code
117 [version 0.20]
118
119 This action builds your code base.
120
121 By default it just creates a "blib/" directory and copies any ".pm"
122 and ".pod" files from your "lib/" directory into the "blib/"
123 directory. It also compiles any ".xs" files from "lib/" and places
124 them in "blib/". Of course, you need a working C compiler
125 (probably the same one that built perl itself) for the compilation
126 to work properly.
127
128 The "code" action also runs any ".PL" files in your lib/ directory.
129 Typically these create other files, named the same but without the
130 ".PL" ending. For example, a file lib/Foo/Bar.pm.PL could create
131 the file lib/Foo/Bar.pm. The ".PL" files are processed first, so
132 any ".pm" files (or other kinds that we deal with) will get copied
133 correctly.
134
135 config_data
136 [version 0.26]
137
138 ...
139
140 diff
141 [version 0.14]
142
143 This action will compare the files about to be installed with their
144 installed counterparts. For .pm and .pod files, a diff will be
145 shown (this currently requires a 'diff' program to be in your
146 PATH). For other files like compiled binary files, we simply
147 report whether they differ.
148
149 A "flags" parameter may be passed to the action, which will be
150 passed to the 'diff' program. Consult your 'diff' documentation
151 for the parameters it will accept - a good one is "-u":
152
153 ./Build diff flags=-u
154
155 dist
156 [version 0.02]
157
158 This action is helpful for module authors who want to package up
159 their module for source distribution through a medium like CPAN.
160 It will create a tarball of the files listed in MANIFEST and
161 compress the tarball using GZIP compression.
162
163 By default, this action will use the "Archive::Tar" module.
164 However, you can force it to use binary "tar" and "gzip"
165 executables by supplying an explicit "tar" (and optional "gzip")
166 parameter:
167
168 ./Build dist --tar C:\path\to\tar.exe --gzip C:\path\to\zip.exe
169
170 distcheck
171 [version 0.05]
172
173 Reports which files are in the build directory but not in the
174 MANIFEST file, and vice versa. (See manifest for details.)
175
176 distclean
177 [version 0.05]
178
179 Performs the 'realclean' action and then the 'distcheck' action.
180
181 distdir
182 [version 0.05]
183
184 Creates a "distribution directory" named "$dist_name-$dist_version"
185 (if that directory already exists, it will be removed first), then
186 copies all the files listed in the MANIFEST file to that directory.
187 This directory is what the distribution tarball is created from.
188
189 distmeta
190 [version 0.21]
191
192 Creates the META.yml file that describes the distribution.
193
194 META.yml is a file containing various bits of metadata about the
195 distribution. The metadata includes the distribution name,
196 version, abstract, prerequisites, license, and various other data
197 about the distribution. This file is created as META.yml in YAML
198 format. It is recommended that the "YAML::Tiny" module be
199 installed to create it. If the "YAML::Tiny" module is not
200 installed, an internal module supplied with Module::Build will be
201 used to write the META.yml file, and this will most likely be fine.
202
203 META.yml file must also be listed in MANIFEST - if it's not, a
204 warning will be issued.
205
206 The current version of the META.yml specification can be found at
207 http://module-build.sourceforge.net/META-spec-current.html
208 <http://module-build.sourceforge.net/META-spec-current.html>
209
210 distsign
211 [version 0.16]
212
213 Uses "Module::Signature" to create a SIGNATURE file for your
214 distribution, and adds the SIGNATURE file to the distribution's
215 MANIFEST.
216
217 disttest
218 [version 0.05]
219
220 Performs the 'distdir' action, then switches into that directory
221 and runs a "perl Build.PL", followed by the 'build' and 'test'
222 actions in that directory.
223
224 docs
225 [version 0.20]
226
227 This will generate documentation (e.g. Unix man pages and HTML
228 documents) for any installable items under blib/ that contain POD.
229 If there are no "bindoc" or "libdoc" installation targets defined
230 (as will be the case on systems that don't support Unix manpages)
231 no action is taken for manpages. If there are no "binhtml" or
232 "libhtml" installation targets defined no action is taken for HTML
233 documents.
234
235 fakeinstall
236 [version 0.02]
237
238 This is just like the "install" action, but it won't actually do
239 anything, it will just report what it would have done if you had
240 actually run the "install" action.
241
242 help
243 [version 0.03]
244
245 This action will simply print out a message that is meant to help
246 you use the build process. It will show you a list of available
247 build actions too.
248
249 With an optional argument specifying an action name (e.g. "Build
250 help test"), the 'help' action will show you any POD documentation
251 it can find for that action.
252
253 html
254 [version 0.26]
255
256 This will generate HTML documentation for any binary or library
257 files under blib/ that contain POD. The HTML documentation will
258 only be installed if the install paths can be determined from
259 values in "Config.pm". You can also supply or override install
260 paths on the command line by specifying "install_path" values for
261 the "binhtml" and/or "libhtml" installation targets.
262
263 install
264 [version 0.01]
265
266 This action will use "ExtUtils::Install" to install the files from
267 "blib/" into the system. See "INSTALL PATHS" for details about how
268 Module::Build determines where to install things, and how to
269 influence this process.
270
271 If you want the installation process to look around in @INC for
272 other versions of the stuff you're installing and try to delete it,
273 you can use the "uninst" parameter, which tells "ExtUtils::Install"
274 to do so:
275
276 ./Build install uninst=1
277
278 This can be a good idea, as it helps prevent multiple versions of a
279 module from being present on your system, which can be a confusing
280 situation indeed.
281
282 installdeps
283 [version 0.36]
284
285 This action will use the "cpan_client" parameter as a command to
286 install missing prerequisites. You will be prompted whether to
287 install optional dependencies.
288
289 The "cpan_client" option defaults to 'cpan' but can be set as an
290 option or in .modulebuildrc. It must be a shell command that takes
291 a list of modules to install as arguments (e.g. 'cpanp -i' for
292 CPANPLUS). If the program part is a relative path (e.g. 'cpan' or
293 'cpanp'), it will be located relative to the perl program that
294 executed Build.PL.
295
296 /opt/perl/5.8.9/bin/perl Build.PL
297 ./Build installdeps --cpan_client 'cpanp -i'
298 # installs to 5.8.9
299
300 manifest
301 [version 0.05]
302
303 This is an action intended for use by module authors, not people
304 installing modules. It will bring the MANIFEST up to date with the
305 files currently present in the distribution. You may use a
306 MANIFEST.SKIP file to exclude certain files or directories from
307 inclusion in the MANIFEST. MANIFEST.SKIP should contain a bunch of
308 regular expressions, one per line. If a file in the distribution
309 directory matches any of the regular expressions, it won't be
310 included in the MANIFEST.
311
312 The following is a reasonable MANIFEST.SKIP starting point, you can
313 add your own stuff to it:
314
315 ^_build
316 ^Build$
317 ^blib
318 ~$
319 \.bak$
320 ^MANIFEST\.SKIP$
321 CVS
322
323 See the distcheck and skipcheck actions if you want to find out
324 what the "manifest" action would do, without actually doing
325 anything.
326
327 manpages
328 [version 0.28]
329
330 This will generate man pages for any binary or library files under
331 blib/ that contain POD. The man pages will only be installed if
332 the install paths can be determined from values in "Config.pm".
333 You can also supply or override install paths by specifying there
334 values on the command line with the "bindoc" and "libdoc"
335 installation targets.
336
337 pardist
338 [version 0.2806]
339
340 Generates a PAR binary distribution for use with PAR or PAR::Dist.
341
342 It requires that the PAR::Dist module (version 0.17 and up) is
343 installed on your system.
344
345 ppd [version 0.20]
346
347 Build a PPD file for your distribution.
348
349 This action takes an optional argument "codebase" which is used in
350 the generated PPD file to specify the (usually relative) URL of the
351 distribution. By default, this value is the distribution name
352 without any path information.
353
354 Example:
355
356 ./Build ppd --codebase "MSWin32-x86-multi-thread/Module-Build-0.21.tar.gz"
357
358 ppmdist
359 [version 0.23]
360
361 Generates a PPM binary distribution and a PPD description file.
362 This action also invokes the "ppd" action, so it can accept the
363 same "codebase" argument described under that action.
364
365 This uses the same mechanism as the "dist" action to tar & zip its
366 output, so you can supply "tar" and/or "gzip" parameters to affect
367 the result.
368
369 prereq_data
370 [version 0.32]
371
372 This action prints out a Perl data structure of all prerequisites
373 and the versions required. The output can be loaded again using
374 "eval()". This can be useful for external tools that wish to query
375 a Build script for prerequisites.
376
377 prereq_report
378 [version 0.28]
379
380 This action prints out a list of all prerequisites, the versions
381 required, and the versions actually installed. This can be useful
382 for reviewing the configuration of your system prior to a build, or
383 when compiling data to send for a bug report.
384
385 pure_install
386 [version 0.28]
387
388 This action is identical to the "install" action. In the future,
389 though, when "install" starts writing to the file
390 $(INSTALLARCHLIB)/perllocal.pod, "pure_install" won't, and that
391 will be the only difference between them.
392
393 realclean
394 [version 0.01]
395
396 This action is just like the "clean" action, but also removes the
397 "_build" directory and the "Build" script. If you run the
398 "realclean" action, you are essentially starting over, so you will
399 have to re-create the "Build" script again.
400
401 retest
402 [version 0.2806]
403
404 This is just like the "test" action, but doesn't actually build the
405 distribution first, and doesn't add blib/ to the load path, and
406 therefore will test against a previously installed version of the
407 distribution. This can be used to verify that a certain installed
408 distribution still works, or to see whether newer versions of a
409 distribution still pass the old regression tests, and so on.
410
411 skipcheck
412 [version 0.05]
413
414 Reports which files are skipped due to the entries in the
415 MANIFEST.SKIP file (See manifest for details)
416
417 test
418 [version 0.01]
419
420 This will use "Test::Harness" or "TAP::Harness" to run any
421 regression tests and report their results. Tests can be defined in
422 the standard places: a file called "test.pl" in the top-level
423 directory, or several files ending with ".t" in a "t/" directory.
424
425 If you want tests to be 'verbose', i.e. show details of test
426 execution rather than just summary information, pass the argument
427 "verbose=1".
428
429 If you want to run tests under the perl debugger, pass the argument
430 "debugger=1".
431
432 If you want to have Module::Build find test files with different
433 file name extensions, pass the "test_file_exts" argument with an
434 array of extensions, such as "[qw( .t .s .z )]".
435
436 If you want test to be run by "TAP::Harness", rather than
437 "Test::Harness", pass the argument "tap_harness_args" as an array
438 reference of arguments to pass to the TAP::Harness constructor.
439
440 In addition, if a file called "visual.pl" exists in the top-level
441 directory, this file will be executed as a Perl script and its
442 output will be shown to the user. This is a good place to put
443 speed tests or other tests that don't use the "Test::Harness"
444 format for output.
445
446 To override the choice of tests to run, you may pass a "test_files"
447 argument whose value is a whitespace-separated list of test scripts
448 to run. This is especially useful in development, when you only
449 want to run a single test to see whether you've squashed a certain
450 bug yet:
451
452 ./Build test --test_files t/something_failing.t
453
454 You may also pass several "test_files" arguments separately:
455
456 ./Build test --test_files t/one.t --test_files t/two.t
457
458 or use a "glob()"-style pattern:
459
460 ./Build test --test_files 't/01-*.t'
461
462 testall
463 [version 0.2807]
464
465 [Note: the 'testall' action and the code snippets below are
466 currently in alpha stage, see
467 "/www.nntp.perl.org/group/perl.module.build/2007/03/msg584.html""
468 in "http: ]
469
470 Runs the "test" action plus each of the "test$type" actions defined
471 by the keys of the "test_types" parameter.
472
473 Currently, you need to define the ACTION_test$type method yourself
474 and enumerate them in the test_types parameter.
475
476 my $mb = Module::Build->subclass(
477 code => q(
478 sub ACTION_testspecial { shift->generic_test(type => 'special'); }
479 sub ACTION_testauthor { shift->generic_test(type => 'author'); }
480 )
481 )->new(
482 ...
483 test_types => {
484 special => '.st',
485 author => ['.at', '.pt' ],
486 },
487 ...
488
489 testcover
490 [version 0.26]
491
492 Runs the "test" action using "Devel::Cover", generating a code-
493 coverage report showing which parts of the code were actually
494 exercised during the tests.
495
496 To pass options to "Devel::Cover", set the $DEVEL_COVER_OPTIONS
497 environment variable:
498
499 DEVEL_COVER_OPTIONS=-ignore,Build ./Build testcover
500
501 testdb
502 [version 0.05]
503
504 This is a synonym for the 'test' action with the "debugger=1"
505 argument.
506
507 testpod
508 [version 0.25]
509
510 This checks all the files described in the "docs" action and
511 produces "Test::Harness"-style output. If you are a module author,
512 this is useful to run before creating a new release.
513
514 testpodcoverage
515 [version 0.28]
516
517 This checks the pod coverage of the distribution and produces
518 "Test::Harness"-style output. If you are a module author, this is
519 useful to run before creating a new release.
520
521 versioninstall
522 [version 0.16]
523
524 ** Note: since "only.pm" is so new, and since we just recently
525 added support for it here too, this feature is to be considered
526 experimental. **
527
528 If you have the "only.pm" module installed on your system, you can
529 use this action to install a module into the version-specific
530 library trees. This means that you can have several versions of
531 the same module installed and "use" a specific one like this:
532
533 use only MyModule => 0.55;
534
535 To override the default installation libraries in "only::config",
536 specify the "versionlib" parameter when you run the "Build.PL"
537 script:
538
539 perl Build.PL --versionlib /my/version/place/
540
541 To override which version the module is installed as, specify the
542 "versionlib" parameter when you run the "Build.PL" script:
543
544 perl Build.PL --version 0.50
545
546 See the "only.pm" documentation for more information on version-
547 specific installs.
548
550 Command Line Options
551 The following options can be used during any invocation of "Build.PL"
552 or the Build script, during any action. For information on other
553 options specific to an action, see the documentation for the respective
554 action.
555
556 NOTE: There is some preliminary support for options to use the more
557 familiar long option style. Most options can be preceded with the "--"
558 long option prefix, and the underscores changed to dashes (e.g.
559 "--use-rcfile"). Additionally, the argument to boolean options is
560 optional, and boolean options can be negated by prefixing them with
561 "no" or "no-" (e.g. "--noverbose" or "--no-verbose").
562
563 quiet
564 Suppress informative messages on output.
565
566 verbose
567 Display extra information about the Build on output.
568
569 cpan_client
570 Sets the "cpan_client" command for use with the "installdeps"
571 action. See "installdeps" for more details.
572
573 use_rcfile
574 Load the ~/.modulebuildrc option file. This option can be set to
575 false to prevent the custom resource file from being loaded.
576
577 allow_mb_mismatch
578 Suppresses the check upon startup that the version of Module::Build
579 we're now running under is the same version that was initially
580 invoked when building the distribution (i.e. when the "Build.PL"
581 script was first run). As of 0.3601, a mismatch results in a
582 warning instead of a fatal error, so this option effectively just
583 suppresses the warning.
584
585 debug
586 Prints Module::Build debugging information to STDOUT, such as a
587 trace of executed build actions.
588
589 Default Options File (.modulebuildrc)
590 [version 0.28]
591
592 When Module::Build starts up, it will look first for a file,
593 $ENV{HOME}/.modulebuildrc. If it's not found there, it will look in
594 the the .modulebuildrc file in the directories referred to by the
595 environment variables "HOMEDRIVE" + "HOMEDIR", "USERPROFILE",
596 "APPDATA", "WINDIR", "SYS$LOGIN". If the file exists, the options
597 specified there will be used as defaults, as if they were typed on the
598 command line. The defaults can be overridden by specifying new values
599 on the command line.
600
601 The action name must come at the beginning of the line, followed by any
602 amount of whitespace and then the options. Options are given the same
603 as they would be on the command line. They can be separated by any
604 amount of whitespace, including newlines, as long there is whitespace
605 at the beginning of each continued line. Anything following a hash
606 mark ("#") is considered a comment, and is stripped before parsing. If
607 more than one line begins with the same action name, those lines are
608 merged into one set of options.
609
610 Besides the regular actions, there are two special pseudo-actions: the
611 key "*" (asterisk) denotes any global options that should be applied to
612 all actions, and the key 'Build_PL' specifies options to be applied
613 when you invoke "perl Build.PL".
614
615 * verbose=1 # global options
616 diff flags=-u
617 install --install_base /home/ken
618 --install_path html=/home/ken/docs/html
619 installdeps --cpan_client 'cpanp -i'
620
621 If you wish to locate your resource file in a different location, you
622 can set the environment variable "MODULEBUILDRC" to the complete
623 absolute path of the file containing your options.
624
625 Environment variables
626 MODULEBUILDRC
627 [version 0.28]
628
629 Specifies an alternate location for a default options file as
630 described above.
631
632 PERL_MB_OPT
633 [version 0.36]
634
635 Command line options that are applied to Build.PL or any Build
636 action. The string is split as the shell would (e.g. whitespace)
637 and the result is prepended to any actual command-line arguments.
638
640 [version 0.19]
641
642 When you invoke Module::Build's "build" action, it needs to figure out
643 where to install things. The nutshell version of how this works is
644 that default installation locations are determined from Config.pm, and
645 they may be overridden by using the "install_path" parameter. An
646 "install_base" parameter lets you specify an alternative installation
647 root like /home/foo, and a "destdir" lets you specify a temporary
648 installation directory like /tmp/install in case you want to create
649 bundled-up installable packages.
650
651 Natively, Module::Build provides default installation locations for the
652 following types of installable items:
653
654 lib Usually pure-Perl module files ending in .pm.
655
656 arch
657 "Architecture-dependent" module files, usually produced by
658 compiling XS, Inline, or similar code.
659
660 script
661 Programs written in pure Perl. In order to improve reuse, try to
662 make these as small as possible - put the code into modules
663 whenever possible.
664
665 bin "Architecture-dependent" executable programs, i.e. compiled C code
666 or something. Pretty rare to see this in a perl distribution, but
667 it happens.
668
669 bindoc
670 Documentation for the stuff in "script" and "bin". Usually
671 generated from the POD in those files. Under Unix, these are
672 manual pages belonging to the 'man1' category.
673
674 libdoc
675 Documentation for the stuff in "lib" and "arch". This is usually
676 generated from the POD in .pm files. Under Unix, these are manual
677 pages belonging to the 'man3' category.
678
679 binhtml
680 This is the same as "bindoc" above, but applies to HTML documents.
681
682 libhtml
683 This is the same as "bindoc" above, but applies to HTML documents.
684
685 Four other parameters let you control various aspects of how
686 installation paths are determined:
687
688 installdirs
689 The default destinations for these installable things come from
690 entries in your system's "Config.pm". You can select from three
691 different sets of default locations by setting the "installdirs"
692 parameter as follows:
693
694 'installdirs' set to:
695 core site vendor
696
697 uses the following defaults from Config.pm:
698
699 lib => installprivlib installsitelib installvendorlib
700 arch => installarchlib installsitearch installvendorarch
701 script => installscript installsitebin installvendorbin
702 bin => installbin installsitebin installvendorbin
703 bindoc => installman1dir installsiteman1dir installvendorman1dir
704 libdoc => installman3dir installsiteman3dir installvendorman3dir
705 binhtml => installhtml1dir installsitehtml1dir installvendorhtml1dir [*]
706 libhtml => installhtml3dir installsitehtml3dir installvendorhtml3dir [*]
707
708 * Under some OS (eg. MSWin32) the destination for HTML documents is
709 determined by the C<Config.pm> entry C<installhtmldir>.
710
711 The default value of "installdirs" is "site". If you're creating
712 vendor distributions of module packages, you may want to do
713 something like this:
714
715 perl Build.PL --installdirs vendor
716
717 or
718
719 ./Build install --installdirs vendor
720
721 If you're installing an updated version of a module that was
722 included with perl itself (i.e. a "core module"), then you may set
723 "installdirs" to "core" to overwrite the module in its present
724 location.
725
726 (Note that the 'script' line is different from "MakeMaker" -
727 unfortunately there's no such thing as "installsitescript" or
728 "installvendorscript" entry in "Config.pm", so we use the
729 "installsitebin" and "installvendorbin" entries to at least get the
730 general location right. In the future, if "Config.pm" adds some
731 more appropriate entries, we'll start using those.)
732
733 install_path
734 Once the defaults have been set, you can override them.
735
736 On the command line, that would look like this:
737
738 perl Build.PL --install_path lib=/foo/lib --install_path arch=/foo/lib/arch
739
740 or this:
741
742 ./Build install --install_path lib=/foo/lib --install_path arch=/foo/lib/arch
743
744 install_base
745 You can also set the whole bunch of installation paths by supplying
746 the "install_base" parameter to point to a directory on your
747 system. For instance, if you set "install_base" to "/home/ken" on
748 a Linux system, you'll install as follows:
749
750 lib => /home/ken/lib/perl5
751 arch => /home/ken/lib/perl5/i386-linux
752 script => /home/ken/bin
753 bin => /home/ken/bin
754 bindoc => /home/ken/man/man1
755 libdoc => /home/ken/man/man3
756 binhtml => /home/ken/html
757 libhtml => /home/ken/html
758
759 Note that this is different from how "MakeMaker"'s "PREFIX"
760 parameter works. "install_base" just gives you a default layout
761 under the directory you specify, which may have little to do with
762 the "installdirs=site" layout.
763
764 The exact layout under the directory you specify may vary by system
765 - we try to do the "sensible" thing on each platform.
766
767 destdir
768 If you want to install everything into a temporary directory first
769 (for instance, if you want to create a directory tree that a
770 package manager like "rpm" or "dpkg" could create a package from),
771 you can use the "destdir" parameter:
772
773 perl Build.PL --destdir /tmp/foo
774
775 or
776
777 ./Build install --destdir /tmp/foo
778
779 This will effectively install to "/tmp/foo/$sitelib",
780 "/tmp/foo/$sitearch", and the like, except that it will use
781 "File::Spec" to make the pathnames work correctly on whatever
782 platform you're installing on.
783
784 prefix
785 Provided for compatibility with "ExtUtils::MakeMaker"'s PREFIX
786 argument. "prefix" should be used when you wish Module::Build to
787 install your modules, documentation and scripts in the same place
788 "ExtUtils::MakeMaker" does.
789
790 The following are equivalent.
791
792 perl Build.PL --prefix /tmp/foo
793 perl Makefile.PL PREFIX=/tmp/foo
794
795 Because of the very complex nature of the prefixification logic,
796 the behavior of PREFIX in "MakeMaker" has changed subtly over time.
797 Module::Build's --prefix logic is equivalent to the PREFIX logic
798 found in "ExtUtils::MakeMaker" 6.30.
799
800 If you do not need to retain compatibility with
801 "ExtUtils::MakeMaker" or are starting a fresh Perl installation we
802 recommend you use "install_base" instead (and "INSTALL_BASE" in
803 "ExtUtils::MakeMaker"). See "Instaling in the same location as
804 ExtUtils::MakeMaker" in Module::Build::Cookbook for further
805 information.
806
808 There are several reasons I wanted to start over, and not just fix what
809 I didn't like about "MakeMaker":
810
811 · I don't like the core idea of "MakeMaker", namely that "make"
812 should be involved in the build process. Here are my reasons:
813
814 + When a person is installing a Perl module, what can you assume
815 about their environment? Can you assume they have "make"? No,
816 but you can assume they have some version of Perl.
817
818 + When a person is writing a Perl module for intended
819 distribution, can you assume that they know how to build a
820 Makefile, so they can customize their build process? No, but
821 you can assume they know Perl, and could customize that way.
822
823 For years, these things have been a barrier to people getting the
824 build/install process to do what they want.
825
826 · There are several architectural decisions in "MakeMaker" that make
827 it very difficult to customize its behavior. For instance, when
828 using "MakeMaker" you do "use ExtUtils::MakeMaker", but the object
829 created in "WriteMakefile()" is actually blessed into a package
830 name that's created on the fly, so you can't simply subclass
831 "ExtUtils::MakeMaker". There is a workaround "MY" package that
832 lets you override certain "MakeMaker" methods, but only certain
833 explicitly preselected (by "MakeMaker") methods can be overridden.
834 Also, the method of customization is very crude: you have to modify
835 a string containing the Makefile text for the particular target.
836 Since these strings aren't documented, and can't be documented
837 (they take on different values depending on the platform, version
838 of perl, version of "MakeMaker", etc.), you have no guarantee that
839 your modifications will work on someone else's machine or after an
840 upgrade of "MakeMaker" or perl.
841
842 · It is risky to make major changes to "MakeMaker", since it does so
843 many things, is so important, and generally works. "Module::Build"
844 is an entirely separate package so that I can work on it all I
845 want, without worrying about backward compatibility.
846
847 · Finally, Perl is said to be a language for system administration.
848 Could it really be the case that Perl isn't up to the task of
849 building and installing software? Even if that software is a bunch
850 of stupid little ".pm" files that just need to be copied from one
851 place to another? My sense was that we could design a system to
852 accomplish this in a flexible, extensible, and friendly manner. Or
853 die trying.
854
856 The current method of relying on time stamps to determine whether a
857 derived file is out of date isn't likely to scale well, since it
858 requires tracing all dependencies backward, it runs into problems on
859 NFS, and it's just generally flimsy. It would be better to use an MD5
860 signature or the like, if available. See "cons" for an example.
861
862 - append to perllocal.pod
863 - add a 'plugin' functionality
864
866 Ken Williams <kwilliams@cpan.org>
867
868 Development questions, bug reports, and patches should be sent to the
869 Module-Build mailing list at <module-build@perl.org>.
870
871 Bug reports are also welcome at
872 <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Module-Build>.
873
874 The latest development version is available from the Subversion
875 repository at <https://svn.perl.org/modules/Module-Build/trunk/>
876
878 Copyright (c) 2001-2006 Ken Williams. All rights reserved.
879
880 This library is free software; you can redistribute it and/or modify it
881 under the same terms as Perl itself.
882
884 perl(1), Module::Build::Cookbook, Module::Build::Authoring,
885 Module::Build::API, ExtUtils::MakeMaker, YAML::Tiny
886
887 META.yml Specification:
888 http://module-build.sourceforge.net/META-spec-current.html
889 <http://module-build.sourceforge.net/META-spec-current.html>
890
891 <http://www.dsmit.com/cons/>
892
893 <http://search.cpan.org/dist/PerlBuildSystem/>
894
895
896
897perl v5.12.4 2011-06-07 Module::Build(3pm)