summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/perl/perl-5.14.3/debian/fixes/extutils-cbuilder-cflags.diff
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/perl/perl-5.14.3/debian/fixes/extutils-cbuilder-cflags.diff')
-rw-r--r--meta/recipes-devtools/perl/perl-5.14.3/debian/fixes/extutils-cbuilder-cflags.diff87
1 files changed, 87 insertions, 0 deletions
diff --git a/meta/recipes-devtools/perl/perl-5.14.3/debian/fixes/extutils-cbuilder-cflags.diff b/meta/recipes-devtools/perl/perl-5.14.3/debian/fixes/extutils-cbuilder-cflags.diff
new file mode 100644
index 0000000..f9a3c6b
--- /dev/null
+++ b/meta/recipes-devtools/perl/perl-5.14.3/debian/fixes/extutils-cbuilder-cflags.diff
@@ -0,0 +1,87 @@
1Upstream-Status:Inappropriate [debian patches]
2From 0c91624f1f9ec46a6f13cad3031b706213233479 Mon Sep 17 00:00:00 2001
3From: Niko Tyni <ntyni@debian.org>
4Date: Thu, 28 Apr 2011 09:18:54 +0300
5Subject: Append CFLAGS and LDFLAGS to their Config.pm counterparts in
6 EU::CBuilder
7
8Bug: http://rt.perl.org/rt3//Public/Bug/Display.html?id=89478
9Bug-Debian: http://bugs.debian.org/624460
10Origin: upstream, http://perl5.git.perl.org/perl.git/commitdiff/011e8fb476b5fb27c9aa613360d918aa0b798b3d
11
12Since ExtUtils::CBuilder 0.27_04 (bleadperl commit 06e8058f27e4),
13CFLAGS and LDFLAGS from the environment have overridden the Config.pm
14ccflags and ldflags settings. This can cause binary incompatibilities
15between the core Perl and extensions built with EU::CBuilder.
16
17Append to the Config.pm values rather than overriding them.
18
19Patch-Name: fixes/extutils-cbuilder-cflags.diff
20---
21 .../lib/ExtUtils/CBuilder/Base.pm | 6 +++-
22 dist/ExtUtils-CBuilder/t/04-base.t | 25 +++++++++++++++++++-
23 2 files changed, 28 insertions(+), 3 deletions(-)
24
25diff --git a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm
26index b572312..2255c51 100644
27--- a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm
28+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm
29@@ -40,11 +40,13 @@ sub new {
30 $self->{config}{$k} = $v unless exists $self->{config}{$k};
31 }
32 $self->{config}{cc} = $ENV{CC} if defined $ENV{CC};
33- $self->{config}{ccflags} = $ENV{CFLAGS} if defined $ENV{CFLAGS};
34+ $self->{config}{ccflags} = join(" ", $self->{config}{ccflags}, $ENV{CFLAGS})
35+ if defined $ENV{CFLAGS};
36 $self->{config}{cxx} = $ENV{CXX} if defined $ENV{CXX};
37 $self->{config}{cxxflags} = $ENV{CXXFLAGS} if defined $ENV{CXXFLAGS};
38 $self->{config}{ld} = $ENV{LD} if defined $ENV{LD};
39- $self->{config}{ldflags} = $ENV{LDFLAGS} if defined $ENV{LDFLAGS};
40+ $self->{config}{ldflags} = join(" ", $self->{config}{ldflags}, $ENV{LDFLAGS})
41+ if defined $ENV{LDFLAGS};
42
43 unless ( exists $self->{config}{cxx} ) {
44 my ($ccpath, $ccbase, $ccsfx ) = fileparse($self->{config}{cc}, qr/\.[^.]*/);
45diff --git a/dist/ExtUtils-CBuilder/t/04-base.t b/dist/ExtUtils-CBuilder/t/04-base.t
46index db0ef98..49819a1 100644
47--- a/dist/ExtUtils-CBuilder/t/04-base.t
48+++ b/dist/ExtUtils-CBuilder/t/04-base.t
49@@ -1,7 +1,7 @@
50 #! perl -w
51
52 use strict;
53-use Test::More tests => 50;
54+use Test::More tests => 64;
55 use Config;
56 use Cwd;
57 use File::Path qw( mkpath );
58@@ -328,6 +328,29 @@ is_deeply( $mksymlists_args,
59 "_prepare_mksymlists_args(): got expected arguments for Mksymlists",
60 );
61
62+my %testvars = (
63+ CFLAGS => 'ccflags',
64+ LDFLAGS => 'ldflags',
65+);
66+
67+while (my ($VAR, $var) = each %testvars) {
68+ local $ENV{$VAR};
69+ $base = ExtUtils::CBuilder::Base->new( quiet => 1 );
70+ ok( $base, "ExtUtils::CBuilder::Base->new() returned true value" );
71+ isa_ok( $base, 'ExtUtils::CBuilder::Base' );
72+ like($base->{config}{$var}, qr/\Q$Config{$var}/,
73+ "honours $var from Config.pm");
74+
75+ $ENV{$VAR} = "-foo -bar";
76+ $base = ExtUtils::CBuilder::Base->new( quiet => 1 );
77+ ok( $base, "ExtUtils::CBuilder::Base->new() returned true value" );
78+ isa_ok( $base, 'ExtUtils::CBuilder::Base' );
79+ like($base->{config}{$var}, qr/\Q$ENV{$VAR}/,
80+ "honours $VAR from the environment");
81+ like($base->{config}{$var}, qr/\Q$Config{$var}/,
82+ "doesn't override $var from Config.pm with $VAR from the environment");
83+}
84+
85 #####
86
87 for ($source_file, $object_file, $lib_file) {