about summary refs log tree commit diff
path: root/pkgs/development/interpreters/perl
diff options
context:
space:
mode:
authorWilliam A. Kennington III <william@wkennington.com>2015-06-12 13:54:15 -0700
committerWilliam A. Kennington III <william@wkennington.com>2015-06-12 13:54:46 -0700
commit4c536065b7f1b349472689a51dc423c2efb2ed88 (patch)
treee1bb300cec7633bdc77d4bd0865b313504afa003 /pkgs/development/interpreters/perl
parent86f9f5d128306a37649cf13a687b231df18a03ca (diff)
downloadnixlib-4c536065b7f1b349472689a51dc423c2efb2ed88.tar
nixlib-4c536065b7f1b349472689a51dc423c2efb2ed88.tar.gz
nixlib-4c536065b7f1b349472689a51dc423c2efb2ed88.tar.bz2
nixlib-4c536065b7f1b349472689a51dc423c2efb2ed88.tar.lz
nixlib-4c536065b7f1b349472689a51dc423c2efb2ed88.tar.xz
nixlib-4c536065b7f1b349472689a51dc423c2efb2ed88.tar.zst
nixlib-4c536065b7f1b349472689a51dc423c2efb2ed88.zip
perl: Add gcc5 compat patch
Diffstat (limited to 'pkgs/development/interpreters/perl')
-rw-r--r--pkgs/development/interpreters/perl/5.20/default.nix2
-rw-r--r--pkgs/development/interpreters/perl/5.20/perl-5.20.2-gcc5_fixes-1.patch127
2 files changed, 129 insertions, 0 deletions
diff --git a/pkgs/development/interpreters/perl/5.20/default.nix b/pkgs/development/interpreters/perl/5.20/default.nix
index 053f9730f45d..700616dd4ebf 100644
--- a/pkgs/development/interpreters/perl/5.20/default.nix
+++ b/pkgs/development/interpreters/perl/5.20/default.nix
@@ -31,6 +31,8 @@ stdenv.mkDerivation rec {
   patches =
     [ # Do not look in /usr etc. for dependencies.
       ./no-sys-dirs.patch
+      # Remove in 5.20.3
+      ./perl-5.20.2-gcc5_fixes-1.patch
     ]
     ++ optional stdenv.isSunOS ./ld-shared.patch
     ++ stdenv.lib.optional stdenv.isDarwin [ ./cpp-precomp.patch ./no-libutil.patch ];
diff --git a/pkgs/development/interpreters/perl/5.20/perl-5.20.2-gcc5_fixes-1.patch b/pkgs/development/interpreters/perl/5.20/perl-5.20.2-gcc5_fixes-1.patch
new file mode 100644
index 000000000000..21f3ca8d7a54
--- /dev/null
+++ b/pkgs/development/interpreters/perl/5.20/perl-5.20.2-gcc5_fixes-1.patch
@@ -0,0 +1,127 @@
+Submitted By: Ken Moffat <ken at linuxfromscratch dot org>
+Date: 2015-04-17
+Initial Package Version: 5.20.2
+Upstream Status: Committed
+Origin: Petr Pisař and Tony Cook
+Description: Fixes Errno.pm and h2ph with gcc-5.
+
+1. cherry-picked because the change to $version will not apply, from
+commit 816b056ffb99ae54642320e20dc30a59fd1effef
+Author: Petr Písař <ppisar@redhat.com>
+Date:   Wed Feb 11 15:46:37 2015 +0100
+
+    Fix Errno.pm generation for gcc-5.0
+    
+    gcc-5.0 -E interleaves now line numbers with expended macros, so that
+    the generated errno.c will be preprocessed to
+    
+    EBFONT => [[
+               59
+                    ]]
+    
+    which is hard to parse in in line-based reader.
+    
+    So use -P option with gcc >= 5.0. Global -P usage would break makedepend,
+    global -ftrack-macro-expansion=0 would break lib/h2ph.t.
+    
+    RT#123784
+
+diff --git a/ext/Errno/Errno_pm.PL b/ext/Errno/Errno_pm.PL
+index 3dadfce..c6bfa06 100644
+--- a/ext/Errno/Errno_pm.PL
++++ b/ext/Errno/Errno_pm.PL
+@@ -215,20 +215,31 @@ sub write_errno_pm {
+     {	# BeOS (support now removed) did not enter this block
+     # invoke CPP and read the output
+ 
++	my $inhibit_linemarkers = '';
++	if ($Config{gccversion} =~ /\A(\d+)\./ and $1 >= 5) {
++	    # GCC 5.0 interleaves expanded macros with line numbers breaking
++	    # each line into multiple lines. RT#123784
++	    $inhibit_linemarkers = ' -P';
++	}
++
+ 	if ($^O eq 'VMS') {
+-	    my $cpp = "$Config{cppstdin} $Config{cppflags} $Config{cppminus}";
++	    my $cpp = "$Config{cppstdin} $Config{cppflags}" .
++		$inhibit_linemarkers . " $Config{cppminus}";
+ 	    $cpp =~ s/sys\$input//i;
+ 	    open(CPPO,"$cpp  errno.c |") or
+ 		die "Cannot exec $Config{cppstdin}";
+ 	} elsif ($IsMSWin32 || $^O eq 'NetWare') {
+-	    open(CPPO,"$Config{cpprun} $Config{cppflags} errno.c |") or
+-		die "Cannot run '$Config{cpprun} $Config{cppflags} errno.c'";
++	    my $cpp = "$Config{cpprun} $Config{cppflags}" .
++		$inhibit_linemarkers;
++	    open(CPPO,"$cpp errno.c |") or
++		die "Cannot run '$cpp errno.c'";
+ 	} elsif ($IsSymbian) {
+-            my $cpp = "gcc -E -I$ENV{SDK}\\epoc32\\include\\libc -";
++            my $cpp = "gcc -E -I$ENV{SDK}\\epoc32\\include\\libc" .
++		$inhibit_linemarkers ." -";
+ 	    open(CPPO,"$cpp < errno.c |")
+ 		or die "Cannot exec $cpp";
+         } else {
+-	    my $cpp = default_cpp();
++	    my $cpp = default_cpp() . $inhibit_linemarkers;
+ 	    open(CPPO,"$cpp < errno.c |")
+ 		or die "Cannot exec $cpp";
+ 	}
+
+commit 3bea78d24634e630b610f59957e7a019205a67b2
+Author: Tony Cook <tony@develop-help.com>
+Date:   Mon Feb 16 15:57:00 2015 +1100
+
+    h2ph: correct handling of hex constants for the preamble
+    
+    Previously they were treated as identifiers resulting in code
+    generated like C< &0xFFF >.
+    
+    We also try to prevent compile-time warnings from large hex integers,
+    the user isn't responsible for the generated code, so we delay those
+    warnings to run-time.
+
+diff --git a/utils/h2ph.PL b/utils/h2ph.PL
+index 9a8b14d..d082f22 100644
+--- a/utils/h2ph.PL
++++ b/utils/h2ph.PL
+@@ -769,7 +769,7 @@ sub inc_dirs
+ sub build_preamble_if_necessary
+ {
+     # Increment $VERSION every time this function is modified:
+-    my $VERSION     = 3;
++    my $VERSION     = 4;
+     my $preamble    = "$Dest_dir/_h2ph_pre.ph";
+ 
+     # Can we skip building the preamble file?
+@@ -788,6 +788,11 @@ sub build_preamble_if_necessary
+ 
+     open  PREAMBLE, ">$preamble" or die "Cannot open $preamble:  $!";
+ 	print PREAMBLE "# This file was created by h2ph version $VERSION\n";
++        # Prevent non-portable hex constants from warning.
++        #
++        # We still produce an overflow warning if we can't represent
++        # a hex constant as an integer.
++        print PREAMBLE "no warnings qw(portable);\n";
+ 
+ 	foreach (sort keys %define) {
+ 	    if ($opt_D) {
+@@ -814,6 +819,18 @@ DEFINE
+ 		# integer:
+ 		print PREAMBLE
+ 		    "unless (defined &$_) { sub $_() { $1 } }\n\n";
++            } elsif ($define{$_} =~ /^([+-]?0x[\da-f]+)U?L{0,2}$/i) {
++                # hex integer
++                # Special cased, since perl warns on hex integers
++                # that can't be represented in a UV.
++                #
++                # This way we get the warning at time of use, so the user
++                # only gets the warning if they happen to use this
++                # platform-specific definition.
++                my $code = $1;
++                $code = "hex('$code')" if length $code > 10;
++                print PREAMBLE
++                    "unless (defined &$_) { sub $_() { $code } }\n\n";
+ 	    } elsif ($define{$_} =~ /^\w+$/) {
+ 		my $def = $define{$_};
+ 		if ($isatype{$def}) {