1 # A debhelper build system class for handling Perl MakeMaker based projects.
3 # Copyright: © 2008-2009 Joey Hess
4 # © 2008-2009 Modestas Vainius
7 package Debian::Debhelper::Buildsystem::perl_makemaker;
10 use Debian::Debhelper::Dh_Lib qw(compat);
11 use base 'Debian::Debhelper::Buildsystem::makefile';
15 "Perl ExtUtils::MakeMaker (Makefile.PL)"
18 sub check_auto_buildable {
22 # Handles everything if Makefile.PL exists. Otherwise - next class.
23 if (-e $this->get_sourcepath("Makefile.PL")) {
24 if ($step eq "configure") {
28 return $this->SUPER::check_auto_buildable(@_);
36 my $this=$class->SUPER::new(@_);
37 $this->enforce_in_source_building();
44 # If set to a true value then MakeMaker's prompt function will
45 # # always return the default without waiting for user input.
46 $ENV{PERL_MM_USE_DEFAULT}=1;
47 # This prevents Module::Install from interactive behavior.
48 $ENV{PERL_AUTOINSTALL}="--skipdeps";
50 if ($ENV{CFLAGS} && ! compat(8)) {
51 push @flags, "OPTIMIZE=$ENV{CFLAGS} $ENV{CPPFLAGS}";
53 if ($ENV{LDFLAGS} && ! compat(8)) {
54 push @flags, "LD=$Config{ld} $ENV{CFLAGS} $ENV{LDFLAGS}";
57 $this->doit_in_sourcedir("perl", "Makefile.PL", "INSTALLDIRS=vendor",
58 # if perl_build is not tested first, need to pass packlist
59 # option to handle fallthrough case
60 (compat(7) ? "create_packlist=0" : ()),
68 # Special case for Makefile.PL that uses
69 # Module::Build::Compat. PREFIX should not be passed
70 # for those; it already installs into /usr by default.
71 my $makefile=$this->get_sourcepath("Makefile");
72 if (system(qq{grep -q "generated automatically by MakeMaker" $makefile}) != 0) {
73 $this->SUPER::install($destdir, @_);
76 $this->SUPER::install($destdir, "PREFIX=/usr", @_);