[PATCH] Append CFLAGS and LDFLAGS to their Config.pm counterparts in EU::CBuilder

Niko Tyni ntyni at debian.org
Thu Apr 28 06:18:54 UTC 2011


Since ExtUtils::CBuilder 0.27_04 (bleadperl commit 06e8058f27e4),
CFLAGS and LDFLAGS from the environment have overridden the Config.pm
ccflags and ldflags settings. This can cause binary incompatibilities
between the core Perl and extensions built with EU::CBuilder.

Append to the Config.pm values rather than overriding them.
---
 .../lib/ExtUtils/CBuilder/Base.pm                  |    6 +++-
 dist/ExtUtils-CBuilder/t/04-base.t                 |   25 +++++++++++++++++++-
 2 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm
index b572312..2255c51 100644
--- a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm
+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm
@@ -40,11 +40,13 @@ sub new {
     $self->{config}{$k} = $v unless exists $self->{config}{$k};
   }
   $self->{config}{cc} = $ENV{CC} if defined $ENV{CC};
-  $self->{config}{ccflags} = $ENV{CFLAGS} if defined $ENV{CFLAGS};
+  $self->{config}{ccflags} = join(" ", $self->{config}{ccflags}, $ENV{CFLAGS})
+     if defined $ENV{CFLAGS};
   $self->{config}{cxx} = $ENV{CXX} if defined $ENV{CXX};
   $self->{config}{cxxflags} = $ENV{CXXFLAGS} if defined $ENV{CXXFLAGS};
   $self->{config}{ld} = $ENV{LD} if defined $ENV{LD};
-  $self->{config}{ldflags} = $ENV{LDFLAGS} if defined $ENV{LDFLAGS};
+  $self->{config}{ldflags} = join(" ", $self->{config}{ldflags}, $ENV{LDFLAGS})
+     if defined $ENV{LDFLAGS};
 
   unless ( exists $self->{config}{cxx} ) {
     my ($ccpath, $ccbase, $ccsfx ) = fileparse($self->{config}{cc}, qr/\.[^.]*/);
diff --git a/dist/ExtUtils-CBuilder/t/04-base.t b/dist/ExtUtils-CBuilder/t/04-base.t
index c3bf6b5..1bb15aa 100644
--- a/dist/ExtUtils-CBuilder/t/04-base.t
+++ b/dist/ExtUtils-CBuilder/t/04-base.t
@@ -1,7 +1,7 @@
 #! perl -w
 
 use strict;
-use Test::More tests => 50;
+use Test::More tests => 64;
 use Config;
 use Cwd;
 use File::Path qw( mkpath );
@@ -326,6 +326,29 @@ is_deeply( $mksymlists_args,
     "_prepare_mksymlists_args(): got expected arguments for Mksymlists",
 );
 
+my %testvars = (
+    CFLAGS  => 'ccflags',
+    LDFLAGS => 'ldflags',
+);
+
+while (my ($VAR, $var) = each %testvars) {
+    local $ENV{$VAR};
+    $base = ExtUtils::CBuilder::Base->new( quiet => 1 );
+    ok( $base, "ExtUtils::CBuilder::Base->new() returned true value" );
+    isa_ok( $base, 'ExtUtils::CBuilder::Base' );
+    like($base->{config}{$var}, qr/\Q$Config{$var}/,
+        "honours $var from Config.pm");
+
+    $ENV{$VAR} = "-foo -bar";
+    $base = ExtUtils::CBuilder::Base->new( quiet => 1 );
+    ok( $base, "ExtUtils::CBuilder::Base->new() returned true value" );
+    isa_ok( $base, 'ExtUtils::CBuilder::Base' );
+    like($base->{config}{$var}, qr/\Q$ENV{$VAR}/,
+        "honours $VAR from the environment");
+    like($base->{config}{$var}, qr/\Q$Config{$var}/,
+        "doesn't override $var from Config.pm with $VAR from the environment");
+}
+
 #####
 
 for ($source_file, $object_file, $lib_file) {
-- 
1.7.4.4


--lrZ03NoBR/3+SXJZ--



------------=_1304193089-25387-0
Content-Type: message/rfc822
Content-Disposition: inline
Content-Transfer-Encoding: 7bit

Received: (at 624460-close) by bugs.debian.org; 30 Apr 2011 19:48:09 +0000
X-Spam-Checker-Version: SpamAssassin 3.3.1-bugs.debian.org_2005_01_02
	(2010-03-16) on busoni.debian.org
X-Spam-Level: 
X-Spam-Status: No, score=-9.2 required=4.0 tests=BAYES_00,FVGT_m_MULTI_ODD,
	HAS_BUG_NUMBER,IMPRONONCABLE_2,MURPHY_DRUGS_REL8,MURPHY_WRONG_WORD1,
	MURPHY_WRONG_WORD2,PGPSIGNATURE,URIBL_CNKR autolearn=ham
	version=3.3.1-bugs.debian.org_2005_01_02
X-Spam-Bayes: score:0.0000 Tokens: new, 39; hammy, 151; neutral, 106; spammy,
	0. spammytokens: hammytokens:0.000-+--HX-Debian:DAK,
	0.000-+--H*rp:D*ftp-master.debian.org, 0.000-+--HX-DAK:process-upload,
	0.000-+--H*MI:franck, 0.000-+--H*RU:128.148.34.3
Return-path: <envelope at ftp-master.debian.org>
Received: from franck.debian.org ([128.148.34.3])
	from C=NA,ST=NA,L=Ankh Morpork,O=Debian SMTP,OU=Debian SMTP CA,CN=franck.debian.org,EMAIL=hostmaster at franck.debian.org (verified)
	by busoni.debian.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.72)
	(envelope-from <envelope at ftp-master.debian.org>)
	id 1QGG9B-0006J5-3C
	for 624460-close at bugs.debian.org; Sat, 30 Apr 2011 19:48:09 +0000
Received: from dak by franck.debian.org with local (Exim 4.72)
	(envelope-from <envelope at ftp-master.debian.org>)
	id 1QGG9A-0002xV-5f; Sat, 30 Apr 2011 19:48:08 +0000
Date: Sat, 30 Apr 2011 19:48:08 +0000
Message-Id: <E1QGG9A-0002xV-5f at franck.debian.org>
From: Dominic Hargreaves <dom at earth.li>
To: 624460-close at bugs.debian.org
X-DAK: dak process-upload
X-Debian: DAK
X-Debian-Package: libextutils-cbuilder-perl
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Subject: Bug#624460: fixed in libextutils-cbuilder-perl 0.280202-2
Sender: Archive Administrator <dak at franck.debian.org>

Source: libextutils-cbuilder-perl
Source-Version: 0.280202-2

We believe that the bug you reported is fixed in the latest version of
libextutils-cbuilder-perl, which is due to be installed in the Debian FTP archive:

libextutils-cbuilder-perl_0.280202-2.debian.tar.gz
  to main/libe/libextutils-cbuilder-perl/libextutils-cbuilder-perl_0.280202-2.debian.tar.gz
libextutils-cbuilder-perl_0.280202-2.dsc
  to main/libe/libextutils-cbuilder-perl/libextutils-cbuilder-perl_0.280202-2.dsc
libextutils-cbuilder-perl_0.280202-2_all.deb
  to main/libe/libextutils-cbuilder-perl/libextutils-cbuilder-perl_0.280202-2_all.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 624460 at bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Dominic Hargreaves <dom at earth.li> (supplier of updated libextutils-cbuilder-perl package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster at debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.8
Date: Sat, 30 Apr 2011 20:38:51 +0100
Source: libextutils-cbuilder-perl
Binary: libextutils-cbuilder-perl
Architecture: source all
Version: 0.280202-2
Distribution: unstable
Urgency: low
Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
Changed-By: Dominic Hargreaves <dom at earth.li>
Description: 
 libextutils-cbuilder-perl - module to compile and link C code for Perl modules
Closes: 624460
Changes: 
 libextutils-cbuilder-perl (0.280202-2) unstable; urgency=low
 .
   * Add patch to append CFLAGS and LDFLAGS to their Config.pm
     counterparts rather than overriding them (Closes: #624460)
   * Update Standards-Version (no changes)
Checksums-Sha1: 
 951d3718031b60890bf91d40f8cb36955302169e 1610 libextutils-cbuilder-perl_0.280202-2.dsc
 6734e0f0e1fddd9118051f1343cfe68604fa944f 4827 libextutils-cbuilder-perl_0.280202-2.debian.tar.gz
 584e1c2b4821c4ad154c071ac7661c16ca8f5a30 34434 libextutils-cbuilder-perl_0.280202-2_all.deb
Checksums-Sha256: 
 519910f2c9314e39b6cdce3bb7c215f18872df09b0ac46b3c5acbfdb5a2392ea 1610 libextutils-cbuilder-perl_0.280202-2.dsc
 368beeb7ddf0cca3081f14f29110499650e95385a6163a281c1152d4e469f1c1 4827 libextutils-cbuilder-perl_0.280202-2.debian.tar.gz
 63cbb688672a87913bbf4814fbc37686dc2f2c479c020b1dbd9fbb34f0c031ba 34434 libextutils-cbuilder-perl_0.280202-2_all.deb
Files: 
 9735e6628b0e165a463ed5d0c9be67f0 1610 perl optional libextutils-cbuilder-perl_0.280202-2.dsc
 201ca47a23a069b9d95c35d59a5f5a6b 4827 perl optional libextutils-cbuilder-perl_0.280202-2.debian.tar.gz
 256cbde26ef06c015765b36da3e3a2c1 34434 perl optional libextutils-cbuilder-perl_0.280202-2_all.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iD8DBQFNvGYCYzuFKFF44qURAqSEAJ4nbpu39ttD6WyP0egTj8HUGmz/JgCg78Fy
za1ckTESM4xCfMPNx/F1EtY=
=vtxA
-----END PGP SIGNATURE-----



------------=_1304193089-25387-0--



More information about the pkg-perl-maintainers mailing list