Debian Codegraph @

README

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