]> git.donarmstrong.com Git - debhelper.git/blob - Debian/Debhelper/Buildsystem/autoconf.pm
cute tail display of config.log, to include a header
[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 use strict;
10 use Debian::Debhelper::Dh_Lib qw(dpkg_architecture_value sourcepackage);
11 use base 'Debian::Debhelper::Buildsystem::makefile';
12
13 sub DESCRIPTION {
14         "GNU Autoconf (configure)"
15 }
16
17 sub check_auto_buildable {
18         my $this=shift;
19         my ($step)=@_;
20
21         # Handle configure; the rest - next class
22         if ($step eq "configure") {
23                 return -x $this->get_sourcepath("configure");
24         }
25         return 0;
26 }
27
28 sub configure {
29         my $this=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/" . 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)
45         # autoconf 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         $this->mkdir_builddir();
52         eval {
53                 $this->doit_in_builddir($this->get_source_rel2builddir("configure"), @opts, @_);
54         };
55         if ($@) {
56                 if (-e $this->get_buildpath("config.log")) {
57                         $this->doit_in_builddir("tail -v -n +0 config.log");
58                 }
59                 die $@;
60         }
61 }
62
63 1