]> git.donarmstrong.com Git - debhelper.git/blob - Debian/Debhelper/Buildsystem/perl_build.pm
code review, added 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 Debian::Debhelper::Dh_Buildsystem_Bases;
12 use base 'Debian::Debhelper::Dh_Buildsystem_Basic';
13
14 sub DESCRIPTION {
15         "support for building Perl Build.PL based packages (in-source only)"
16 }
17
18 sub is_buildable {
19         my ($self, $action) = @_;
20         my $ret = (-e "Build.PL");
21         if ($action ne "configure") {
22                 $ret &= (-e "Build");
23         }
24         return $ret;
25 }
26
27 sub invoke_impl {
28         my $self=shift;
29         $ENV{MODULEBUILDRC} = "/dev/null";
30         return $self->SUPER::invoke_impl(@_);
31 }
32
33 sub new {
34         my $cls=shift;
35         my $self= $cls->SUPER::new(@_);
36         $self->enforce_in_source_building();
37         return $self;
38 }
39
40 sub configure_impl {
41         my $self=shift;
42         # XXX JEH I think the below comment is inherited from elsewhere;
43         # doesn't really make sense now.
44         $ENV{PERL_MM_USE_DEFAULT}=1; # Module::Build can also use this.
45         doit("perl", "Build.PL", "installdirs=vendor", @_);
46 }
47
48 sub build_impl {
49         my $self=shift;
50         doit("perl", "Build", @_);
51 }
52
53 sub test_impl {
54         my $self=shift;
55         doit(qw/perl Build test/, @_);
56 }
57
58 sub install_impl {
59         my $self=shift;
60         my $destdir=shift;
61         doit("perl", "Build", "install", "destdir=$destdir", "create_packlist=0", @_);
62 }
63
64 sub clean_impl {
65         my $self=shift;
66         doit("perl", "Build", "--allow_mb_mismatch", 1, "distclean", @_);
67 }
68
69 1;