]> git.donarmstrong.com Git - debhelper.git/blob - Debian/Debhelper/Buildsystem/perl_build.pm
merge
[debhelper.git] / Debian / Debhelper / Buildsystem / perl_build.pm
1 # A build system class 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 base 'Debian::Debhelper::Buildsystem';
11
12 sub DESCRIPTION {
13         "Perl Module::Build (Build.PL)"
14 }
15
16 sub check_auto_buildable {
17         my ($this, $step) = @_;
18
19         # Handles everything
20         my $ret = -e $this->get_sourcepath("Build.PL");
21         if ($step ne "configure") {
22                 $ret &&= -e $this->get_sourcepath("Build");
23         }
24         return $ret ? 1 : 0;
25 }
26
27 sub do_perl {
28         my $this=shift;
29         $this->doit_in_sourcedir("perl", @_);
30 }
31
32 sub new {
33         my $class=shift;
34         my $this= $class->SUPER::new(@_);
35         $this->enforce_in_source_building();
36         return $this;
37 }
38
39 sub configure {
40         my $this=shift;
41         $ENV{PERL_MM_USE_DEFAULT}=1;
42         $this->do_perl("Build.PL", "installdirs=vendor", @_);
43 }
44
45 sub build {
46         my $this=shift;
47         $this->do_perl("Build", @_);
48 }
49
50 sub test {
51         my $this=shift;
52         $this->do_perl("Build", "test", @_);
53 }
54
55 sub install {
56         my $this=shift;
57         my $destdir=shift;
58         $this->do_perl("Build", "install", "destdir=$destdir", "create_packlist=0", @_);
59 }
60
61 sub clean {
62         my $this=shift;
63         if (-e $this->get_sourcepath("Build")) {
64                 $this->do_perl("Build", "--allow_mb_mismatch", 1, "distclean", @_);
65         }
66 }
67
68 1