]> git.donarmstrong.com Git - debhelper.git/blob - Debian/Debhelper/Buildsystem/perl_build.pm
Modular object-orientied buildsystem implementation (try 2).
[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_Basic';
12
13 sub DESCRIPTION {
14         "support for building Perl Build.PL based packages (in-source only)"
15 }
16
17 sub is_auto_buildable {
18         my ($self, $action) = @_;
19
20         # Handles everything
21         my $ret = -e "Build.PL";
22         if ($action ne "configure") {
23                 $ret &&= -e "Build";
24         }
25         return $ret;
26 }
27
28 sub do_perl {
29         my $self=shift;
30         $ENV{MODULEBUILDRC} = "/dev/null";
31         doit("perl", @_);
32 }
33
34 sub new {
35         my $cls=shift;
36         my $self= $cls->SUPER::new(@_);
37         $self->enforce_in_source_building();
38         return $self;
39 }
40
41 sub configure {
42         my $self=shift;
43         $ENV{PERL_MM_USE_DEFAULT}=1;
44         $self->do_perl("Build.PL", "installdirs=vendor", @_);
45 }
46
47 sub build {
48         my $self=shift;
49         $self->do_perl("Build", @_);
50 }
51
52 sub test {
53         my $self=shift;
54         $self->do_perl("Build", "test", @_);
55 }
56
57 sub install {
58         my $self=shift;
59         my $destdir=shift;
60         $self->do_perl("Build", "install", "destdir=$destdir", "create_packlist=0", @_);
61 }
62
63 sub clean {
64         my $self=shift;
65         $self->do_perl("Build", "--allow_mb_mismatch", 1, "distclean", @_);
66 }
67
68 1;