Package: debhelper
Version: 8.9.7
Severity: wishlist
Tags: patch

Hi there,

Converting a makemaker-based package to dh(1) (from debhelper compat level 3
:), I observed that I couldn't quite get the package down to rules.tiny
because makemaker doesn't look at CFLAGS in the environment.  To get the
buildflags automatically here, we need to pass OPTIMIZE to Makefile.PL on
the commandline.

I believe the attached patch implements this (it checks out in my own
testing locally).  Please consider applying it to debhelper.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
[email protected]                                     [email protected]
>From db8831ff35c27c2ceaba800ab39d5d9abfb1e974 Mon Sep 17 00:00:00 2001
From: Steve Langasek <[email protected]>
Date: Wed, 28 Sep 2011 12:37:42 -0700
Subject: [PATCH] pass dpkg-buildflags to makemaker build system

The standard way to pass build flags to makemaker perl build systems is to
set the OPTIMIZE variable on the commandline; CFLAGS in the environment gets
ignored entirely.  So pass the CFLAGS from the environment to Makefile.PL so
makemaker packages can also benefit from dpkg-buildflags.
---
 Debian/Debhelper/Buildsystem/perl_makemaker.pm |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/Debian/Debhelper/Buildsystem/perl_makemaker.pm 
b/Debian/Debhelper/Buildsystem/perl_makemaker.pm
index 72f8d8c..175085c 100644
--- a/Debian/Debhelper/Buildsystem/perl_makemaker.pm
+++ b/Debian/Debhelper/Buildsystem/perl_makemaker.pm
@@ -39,17 +39,22 @@ sub new {
 
 sub configure {
        my $this=shift;
+       my @flags;
        # If set to a true value then MakeMaker's prompt function will
        # # always return the default without waiting for user input.
        $ENV{PERL_MM_USE_DEFAULT}=1;
        # This prevents  Module::Install from interactive behavior.
        $ENV{PERL_AUTOINSTALL}="--skipdeps";
 
+        if ($ENV{CFLAGS}) {
+                push @flags, "OPTIMIZE=$ENV{CFLAGS}";
+        }
+
        $this->doit_in_sourcedir("perl", "Makefile.PL", "INSTALLDIRS=vendor",
                # if perl_build is not tested first, need to pass packlist
                # option to handle fallthrough case
                (compat(7) ? "create_packlist=0" : ()),
-               @_);
+               @_, @flags);
 }
 
 sub install {
-- 
1.7.5.4

Reply via email to