]> git.donarmstrong.com Git - debhelper.git/blob - Debian/Debhelper/Buildsystem/perl_makemaker.pm
debhelper modular buildsystems (try 3).
[debhelper.git] / Debian / Debhelper / Buildsystem / perl_makemaker.pm
1 # A buildsystem plugin 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 use strict;
10 use Debian::Debhelper::Dh_Lib;
11 use base 'Debian::Debhelper::Buildsystem::makefile';
12
13 sub DESCRIPTION {
14         "support for building Perl MakeMaker based packages (in-source only)"
15 }
16
17 sub check_auto_buildable {
18         my $self=shift;
19         my ($action)=@_;
20
21         # Handles configure, install; the rest - next class
22         if ($action eq "install") {
23                 return -e "Makefile.PL";
24         }
25         # XXX JEH why test for configure here? If building or cleaning, and
26         # a Makefile.PL exists, we know this class can handle those
27         # actions -- it does so by inheriting from the makefile class.
28         # XXX MDX Yes. But that's again different behaviour from current
29         #         (see comment in autotools.mk). Your call.
30         elsif ($action eq "configure") {
31                 return -e "Makefile.PL";
32         }
33         else {
34                 return 0;
35         }
36 }
37
38 sub new {
39         my $cls=shift;
40         my $self=$cls->SUPER::new(@_);
41         $self->enforce_in_source_building();
42         return $self;
43 }
44
45 sub configure {
46         my $self=shift;
47         # If set to a true value then MakeMaker's prompt function will
48         # # always return the default without waiting for user input.
49         $ENV{PERL_MM_USE_DEFAULT}=1;
50         doit("perl", "Makefile.PL", "INSTALLDIRS=vendor", @_);
51 }
52
53 sub install {
54         my $self=shift;
55         my $destdir=shift;
56         $self->SUPER::install($destdir, "PREFIX=/usr", @_);
57 }
58
59 1;