]> git.donarmstrong.com Git - debhelper.git/blob - Debian/Debhelper/Buildsystem/perl_makemaker.pm
Update dh_auto documentation.
[debhelper.git] / Debian / Debhelper / Buildsystem / perl_makemaker.pm
1 # A debhelper build system class for handling Perl MakeMaker based projects.
2 #
3 # Copyright: © 2008-2009 Joey Hess
4 #            © 2008-2009 Modestas Vainius
5 # License: GPL-2+
6
7 package Debian::Debhelper::Buildsystem::perl_makemaker;
8
9 =head1 NAME
10
11 B<perl_makemaker> - Perl ExtUtils::MakeMaker (Makefile.PL)
12
13 =head1 SYNOPSIS
14
15 B<dh_auto_*> [B<--buildsystem>=I<perl_makemaker>] ...
16
17 =head1 DESCRIPTION
18
19 Perl ExtUtils::MakeMaker utility is designed to write a Makefile for an
20 extension module from a Makefile.PL (at configure step). The rest of build
21 process is handled by C<make>. Typically, ExtUtils::MakeMaker build system can
22 be identified by presence of the F<Makefile.PL> script in the source directory.
23
24 =head1 DH_AUTO NOTES
25
26 Out of source tree building is not supported.
27
28 =head1 BUILD PROCESS
29
30 =cut
31
32 use strict;
33 use base 'Debian::Debhelper::Buildsystem::makefile';
34
35 sub DESCRIPTION {
36         "Perl ExtUtils::MakeMaker (Makefile.PL)"
37 }
38
39 sub check_auto_buildable {
40         my $this=shift;
41         my ($step)=@_;
42
43         # Handles everything if Makefile.PL exists. Otherwise - next class.
44         if (-e $this->get_sourcepath("Makefile.PL")) {
45                 if ($step eq "install" || $step eq "configure") {
46                         return 1;
47                 }
48                 else {
49                         # This is backwards compatible (with << 7.3) until build, test and
50                         # clean steps are not reimplemented in the backwards compatibility
51                         # breaking way. However, this is absolutely necessary for
52                         # enforce_in_source_building() to work in corner cases in build,
53                         # test and clean steps as the next class (makefile) does not
54                         # enforce it.
55                         return $this->SUPER::check_auto_buildable(@_);
56                 }
57         }
58         return 0;
59 }
60
61 sub new {
62         my $class=shift;
63         my $this=$class->SUPER::new(@_);
64         $this->enforce_in_source_building();
65         return $this;
66 }
67
68 =head2 Configure step
69
70 =over
71
72 =item I<Behaviour>
73
74 Execute C<Makefile.PL> script passing C<INSTALLDIRS=vendor> and
75 C<create_packlist=0> parameters. Environment variables C<PERL_MM_USE_DEFAULT=1>
76 and C<PERL_AUTOINSTALL=--skipdeps> are exported before running the script.
77
78 =item I<Auto-selection>
79
80 If F<Makefile.PL> file exists but F<configure> does not exist in the source
81 directory.
82
83 =back
84
85 =cut
86 sub configure {
87         my $this=shift;
88         # If set to a true value then MakeMaker's prompt function will
89         # # always return the default without waiting for user input.
90         $ENV{PERL_MM_USE_DEFAULT}=1;
91         # This prevents  Module::Install from interactive behavior.
92         $ENV{PERL_AUTOINSTALL}="--skipdeps";
93
94         $this->doit_in_sourcedir("perl", "Makefile.PL", "INSTALLDIRS=vendor",
95             "create_packlist=0",
96             @_);
97 }
98
99 =head2 Build step
100
101 =over 4
102
103 =item I<Behaviour>
104
105 Execute C<make> in the build directory. See I<makefile> build system
106 documentation for more information.
107
108 =item I<Auto-selection>
109
110 Both F<Makefile.PL> and F<Makefile> exist in the source directory.
111
112 =back
113
114 =head2 Test step
115
116 =over 4
117
118 =item I<Behaviour>
119
120 Execute C<make test> in the source directory. See I<makefile> build system
121 documentation for more information.
122
123 =item I<Auto-selection>
124
125 Both F<Makefile.PL> and F<Makefile> exist in the source directory.
126
127 =back
128
129 =cut
130
131 =head2 Install step
132
133 =over 4
134
135 =item I<Behaviour>
136
137 Execute C<make install DESTDIR=$destdir PREFIX=/usr> in the source directory
138 with $destdir set to the appropriate temporary installation directory. See
139 I<makefile> build system documentation for more information.
140
141 =item I<Auto-selection>
142
143 Both F<Makefile.PL> and F<Makefile> exist in the source directory.
144
145 =back
146
147 =cut
148 sub install {
149         my $this=shift;
150         my $destdir=shift;
151         $this->SUPER::install($destdir, "PREFIX=/usr", @_);
152 }
153
154 =head2 Clean step
155
156 =over 4
157
158 =item I<Behaviour>
159
160 Execute C<make distclean> in the source directory. See I<makefile> build system
161 documentation for more information.
162
163 =item I<Auto-selection>
164
165 Both F<Makefile.PL> and F<Makefile> exist in the source directory.
166
167 =back
168
169 =head1 SEE ALSO
170
171 L<dh_auto_makefile(7)>
172
173 L<dh_auto(7)>
174
175 =head1 AUTHORS
176
177  Joey Hess <joeyh@debian.org>
178  Modestas Vainius <modestas@vainius.eu>
179
180 =cut
181
182 1;