]> git.donarmstrong.com Git - debhelper.git/blob - Debian/Debhelper/Buildsystem/perl_build.pm
more comments
[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         # 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         if ($action ne "configure") {
29                 $ret &&= -e "Build";
30         }
31         return $ret;
32 }
33
34 sub do_perl {
35         my $self=shift;
36         $ENV{MODULEBUILDRC} = "/dev/null";
37         doit("perl", @_);
38 }
39
40 sub new {
41         my $cls=shift;
42         my $self= $cls->SUPER::new(@_);
43         $self->enforce_in_source_building();
44         return $self;
45 }
46
47 sub configure {
48         my $self=shift;
49         $ENV{PERL_MM_USE_DEFAULT}=1;
50         $self->do_perl("Build.PL", "installdirs=vendor", @_);
51 }
52
53 sub build {
54         my $self=shift;
55         $self->do_perl("Build", @_);
56 }
57
58 sub test {
59         my $self=shift;
60         $self->do_perl("Build", "test", @_);
61 }
62
63 sub install {
64         my $self=shift;
65         my $destdir=shift;
66         $self->do_perl("Build", "install", "destdir=$destdir", "create_packlist=0", @_);
67 }
68
69 sub clean {
70         my $self=shift;
71         $self->do_perl("Build", "--allow_mb_mismatch", 1, "distclean", @_);
72 }
73
74 1;