]> git.donarmstrong.com Git - debhelper.git/blob - Debian/Debhelper/Buildsystem/autoconf.pm
Merge branch 'master' into buildsystems
[debhelper.git] / Debian / Debhelper / Buildsystem / autoconf.pm
1 # A debhelper build system class for handling Autoconf based projects
2 #
3 # Copyright: © 2008 Joey Hess
4 #            © 2008-2009 Modestas Vainius
5 # License: GPL-2+
6
7 package Debian::Debhelper::Buildsystem::autoconf;
8
9 =head1 NAME
10
11 B<autoconf> - GNU Autoconf (configure)
12
13 =head1 SYNOPSIS
14
15 B<dh_auto_*> [B<--buildsystem>=I<autoconf>] ...
16
17 =head1 DESCRIPTION
18
19 GNU Autoconf is a popular cross-platform build system. Autoconf F<configure>
20 script prepares the source for building and generates necessary F<Makefile>s
21 and other temporary files in the build directory. Then a standard set of
22 make targets needs to be executed in the build directory to complete source
23 build process. GNU Autoconf build system can be typically identified by
24 presence of the F<configure> script in the source directory.
25
26 =head1 DH_AUTO NOTES
27
28 Both in source (default) and out of source tree building modes are supported.
29 However, please note that some original source packages might not be compatible
30 with out of source tree building mode of Autoconf and hence build process may
31 fail later even if the I<configure> step succeeds. 
32
33 =head1 BUILD PROCESS
34
35 =cut
36
37 use strict;
38 use Debian::Debhelper::Dh_Lib qw(dpkg_architecture_value sourcepackage);
39 use base 'Debian::Debhelper::Buildsystem::makefile';
40
41 sub DESCRIPTION {
42         "GNU Autoconf (configure)"
43 }
44
45 sub check_auto_buildable {
46         my $this=shift;
47         my ($step)=@_;
48
49         # Handle configure; the rest - next class
50         if ($step eq "configure") {
51                 return -x $this->get_sourcepath("configure");
52         }
53         return 0;
54 }
55
56 =head2 Configure step
57
58 =over 4
59
60 =item I<Behaviour>
61
62 Execute F<configure> from the source directory with working directory set to
63 the build directory. A set of standard arguments are passed to the F<configure>
64 script:
65
66  --build=`dpkg_architecture -qDEB_BUILD_GNU_TYPE`
67  --prefix=/usr
68  --includedir=${prefix}/include
69  --mandir=${prefix}/share/man
70  --infodir=${prefix}/share/info
71  --sysconfdir=/etc
72  --localstatedir=/var
73  --libexecdir=${prefix}/lib/$name_of_debian_source_package
74  --disable-maintainer-mode
75  --disable-dependency-tracking
76  --host=`dpkg_architecture -qDEB_HOST_GNU_TYPE` (if different from --build)
77
78 =item I<Auto-selection>
79
80 If executable file F<configure> exists in the source directory.
81
82 =back
83
84 =cut
85 sub configure {
86         my $this=shift;
87
88         # Standard set of options for configure.
89         my @opts;
90         push @opts, "--build=" . dpkg_architecture_value("DEB_BUILD_GNU_TYPE");
91         push @opts, "--prefix=/usr";
92         push @opts, "--includedir=\${prefix}/include";
93         push @opts, "--mandir=\${prefix}/share/man";
94         push @opts, "--infodir=\${prefix}/share/info";
95         push @opts, "--sysconfdir=/etc";
96         push @opts, "--localstatedir=/var";
97         push @opts, "--libexecdir=\${prefix}/lib/" . sourcepackage();
98         push @opts, "--disable-maintainer-mode";
99         push @opts, "--disable-dependency-tracking";
100         # Provide --host only if different from --build, as recommended in
101         # autotools-dev README.Debian: When provided (even if equal)
102         # autoconf 2.52+ switches to cross-compiling mode.
103         if (dpkg_architecture_value("DEB_BUILD_GNU_TYPE")
104             ne dpkg_architecture_value("DEB_HOST_GNU_TYPE")) {
105                 push @opts, "--host=" . dpkg_architecture_value("DEB_HOST_GNU_TYPE");
106         }
107
108         $this->mkdir_builddir();
109         $this->doit_in_builddir($this->get_source_rel2builddir("configure"), @opts, @_);
110 }
111
112 =head2 Build step
113
114 =over 4
115
116 =item I<Behaviour>
117
118 Execute C<make> in the build directory. See I<makefile> build system
119 documentation for more information.
120
121 =item I<Auto-selection>
122
123 It is normal for the I<makefile> build system to be auto-selected at this step.
124
125 =back
126
127 =head2 Test step
128
129 =over 4
130
131 =item I<Behaviour>
132
133 Execute either C<make test> or C<make check> in the build directory. See
134 I<makefile> build system documentation for more information.
135
136 =item I<Auto-selection>
137
138 It is normal for the I<makefile> build system to be auto-selected at this step.
139
140 =back
141
142 =head2 Install step
143
144 =over 4
145
146 =item I<Behaviour>
147
148 Execute C<make install DESTDIR=$destdir> in the build directory with $destdir
149 set to the appropriate temporary installation directory. See I<makefile> build
150 system documentation for more information.
151
152 =item I<Auto-selection>
153
154 It is normal for the I<makefile> build system to be auto-selected at this step.
155
156 =back
157
158 =head2 Clean step
159
160 =over 4
161
162 =item I<Behaviour>
163
164 Remove the build directory if building out of source tree or execute C<make
165 distclean> if building in source. See I<makefile> build system documentation
166 for more information.
167
168 =item I<Auto-selection>
169
170 It is normal for the I<makefile> build system to be auto-selected at this step.
171
172 =back
173
174 =head1 SEE ALSO
175
176 L<dh_auto_makefile(7)>
177
178 L<dh_auto(7)>
179
180 =head1 AUTHORS
181
182  Joey Hess <joeyh@debian.org>
183  Modestas Vainius <modestas@vainius.eu>
184
185 =cut
186
187 1;