]> git.donarmstrong.com Git - debhelper.git/blob - Debian/Debhelper/Buildsystem/autotools.pm
Modular object-orientied buildsystem implementation.
[debhelper.git] / Debian / Debhelper / Buildsystem / autotools.pm
1 # A buildsystem plugin for handling autotools based projects
2 #
3 # Copyright: © 2008 Joey Hess
4 #            © 2008-2009 Modestas Vainius
5 # License: GPL-2+
6
7 package Debian::Debhelper::Buildsystem::autotools;
8
9 use strict;
10 use File::Spec;
11 use Debian::Debhelper::Dh_Lib;
12 use base 'Debian::Debhelper::Buildsystem::makefile';
13
14 sub DESCRIPTION {
15         "support for building GNU Autotools based packages"
16 }
17
18 sub is_buildable {
19         my $self=shift;
20         my ($action) = @_;
21         if ($action eq "configure") {
22                 return -x "configure";
23         } else {
24                 return $self->SUPER::is_buildable(@_);
25         }
26 }
27
28 sub configure_impl {
29         my $self=shift;
30
31         # Standard set of options for configure.
32         my @opts;
33         push @opts, "--build=" . dpkg_architecture_value("DEB_BUILD_GNU_TYPE");
34         push @opts, "--prefix=/usr";
35         push @opts, "--includedir=\${prefix}/include";
36         push @opts, "--mandir=\${prefix}/share/man";
37         push @opts, "--infodir=\${prefix}/share/info";
38         push @opts, "--sysconfdir=/etc";
39         push @opts, "--localstatedir=/var";
40         push @opts, "--libexecdir=\${prefix}/lib/" . $self->exec_in_topdir(\&sourcepackage);
41         push @opts, "--disable-maintainer-mode";
42         push @opts, "--disable-dependency-tracking";
43         # Provide --host only if different from --build, as recommended in
44         # autotools-dev README.Debian: When provided (even if equal) autotools
45         # 2.52+ switches to cross-compiling mode.
46         if (dpkg_architecture_value("DEB_BUILD_GNU_TYPE")
47             ne dpkg_architecture_value("DEB_HOST_GNU_TYPE")) {
48                 push @opts, "--host=" . dpkg_architecture_value("DEB_HOST_GNU_TYPE");
49         }
50
51         doit($self->get_toppath("configure"), @opts, @_);
52 }
53
54 1;