]> git.donarmstrong.com Git - debhelper.git/blob - Debian/Debhelper/Buildsystem/perl_build.pm
debhelper modular buildsystems (try 3).
[debhelper.git] / Debian / Debhelper / Buildsystem / perl_build.pm
1 # A buildsystem plugin for handling Perl Build 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_build;
8
9 use strict;
10 use Debian::Debhelper::Dh_Lib;
11 use base 'Debian::Debhelper::Dh_Buildsystem';
12
13 sub DESCRIPTION {
14         "support for building Perl Build.PL based packages (in-source only)"
15 }
16
17 sub check_auto_buildable {
18         my ($self, $action) = @_;
19
20         # Handles everything
21         my $ret = -e "Build.PL";
22         # XXX JEH what happens here if they run dh_auto_build,
23         # forgetting dh_auto_configure? I think it will just
24         # think it's not auto buildable and, assuming no other buildsystems
25         # succeed, silently do nothing. Perhaps it would be better, then,
26         # to omit the test below. Then, it would try to run ./Build
27         # which doesn't exist, which should result in a semi-useful error.
28         # XXX MDX Agreed. But it would not be fully backwards compatible
29         #         (see comment in autotools.mk why). Your call.
30         if ($action ne "configure") {
31                 $ret &&= -e "Build";
32         }
33         return $ret;
34 }
35
36 sub do_perl {
37         my $self=shift;
38         $ENV{MODULEBUILDRC} = "/dev/null";
39         doit("perl", @_);
40 }
41
42 sub new {
43         my $cls=shift;
44         my $self= $cls->SUPER::new(@_);
45         $self->enforce_in_source_building();
46         return $self;
47 }
48
49 sub configure {
50         my $self=shift;
51         $ENV{PERL_MM_USE_DEFAULT}=1;
52         $self->do_perl("Build.PL", "installdirs=vendor", @_);
53 }
54
55 sub build {
56         my $self=shift;
57         $self->do_perl("Build", @_);
58 }
59
60 sub test {
61         my $self=shift;
62         $self->do_perl("Build", "test", @_);
63 }
64
65 sub install {
66         my $self=shift;
67         my $destdir=shift;
68         $self->do_perl("Build", "install", "destdir=$destdir", "create_packlist=0", @_);
69 }
70
71 sub clean {
72         my $self=shift;
73         $self->do_perl("Build", "--allow_mb_mismatch", 1, "distclean", @_);
74 }
75
76 1;