]> git.donarmstrong.com Git - debhelper.git/blob - Debian/Debhelper/Buildsystem/perl_makemaker.pm
In v8 mode, stop passing packlist=0 in perl_makemaker buildsystem, since perl_build...
[debhelper.git] / Debian / Debhelper / Buildsystem / perl_makemaker.pm
1 # A debhelper build system class for handling Perl MakeMaker 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_makemaker;
8
9 use strict;
10 use base 'Debian::Debhelper::Buildsystem::makefile';
11
12 sub DESCRIPTION {
13         "Perl ExtUtils::MakeMaker (Makefile.PL)"
14 }
15
16 sub check_auto_buildable {
17         my $this=shift;
18         my ($step)=@_;
19
20         # Handles everything if Makefile.PL exists. Otherwise - next class.
21         if (-e $this->get_sourcepath("Makefile.PL")) {
22                 if ($step eq "configure") {
23                         return 1;
24                 }
25                 else {
26                         return $this->SUPER::check_auto_buildable(@_);
27                 }
28         }
29         return 0;
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         # If set to a true value then MakeMaker's prompt function will
42         # # always return the default without waiting for user input.
43         $ENV{PERL_MM_USE_DEFAULT}=1;
44         # This prevents  Module::Install from interactive behavior.
45         $ENV{PERL_AUTOINSTALL}="--skipdeps";
46
47         $this->doit_in_sourcedir("perl", "Makefile.PL", "INSTALLDIRS=vendor",
48                 # if perl_build is not tested first, need to pass packlist
49                 # option to handle fallthrough case
50                 (compat(7) ? "create_packlist=0" : ()),
51                 @_);
52 }
53
54 sub install {
55         my $this=shift;
56         my $destdir=shift;
57
58         # Special case for Makefile.PL that uses
59         # Module::Build::Compat. PREFIX should not be passed
60         # for those; it already installs into /usr by default.
61         my $makefile=$this->get_sourcepath("Makefile");
62         if (system(qq{grep -q "generated automatically by MakeMaker" $makefile}) != 0) {
63                 $this->SUPER::install($destdir, @_);
64         }
65         else {
66                 $this->SUPER::install($destdir, "PREFIX=/usr", @_);
67         }
68 }
69
70 1