Package: perl
Version: 5.10.1-15
Severity: important
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch natty

Ubuntu recently switched to GCC 4.5, and we quickly found that Perl
failed to build with it.  Here's the build log:

  
http://launchpadlibrarian.net/57494704/buildlog_ubuntu-natty-i386.perl_5.10.1-15ubuntu1_FAILEDTOBUILD.txt.gz

It ends as follows:

  # Verify that the headers are usable
  for ph in `< /build/buildd/perl-5.10.1/debian/headers sed -e 's/\.h$/.ph/'`; 
do \
                  if [ ! -f 
/build/buildd/perl-5.10.1/debian/tmp/usr/lib/perl/5.10/$ph ]; then \
                          echo "$ph: missing"; else \
                  /build/buildd/perl-5.10.1/perl.static -I 
/build/buildd/perl-5.10.1/debian/tmp/usr/lib/perl/5.10 -I 
/build/buildd/perl-5.10.1/debian/tmp/usr/share/perl/5.10 -e \
                          "print '"$ph": '; require '"$ph"'; print \"ok\n\";" \
                                  || exit 1; \
                  fi; \
          done
  Illegal declaration of subroutine main::__INT16_C at 
/build/buildd/perl-5.10.1/debian/tmp/usr/lib/perl/5.10/_h2ph_pre.ph line 162.
  Compilation failed in require at 
/build/buildd/perl-5.10.1/debian/tmp/usr/lib/perl/5.10/asm/termios.ph line 1.
  Compilation failed in require at -e line 1.
  asm/termios.ph: make: *** [install-stamp] Error 1

I hunted around a bit and tracked down
http://perl5.git.perl.org/perl.git/commit/8d66b3f930dc6d88b524d103e304308ae73a46e7,
which fixes this problem (although the commit message is uninformative).
Attached please find a patch to incorporate this.

Thanks,

-- 
Colin Watson                                       [cjwat...@ubuntu.com]
  * Apply upstream patch from Robin Barker
    (http://perl5.git.perl.org/perl.git/commit/8d66b3f930dc6d88b524d103e304308ae73a46e7)
    to fix h2ph header generation with GCC 4.5.

diff -Nru perl-5.10.1/debian/patches/fixes/h2ph-gcc-4.5.diff perl-5.10.1/debian/patches/fixes/h2ph-gcc-4.5.diff
--- perl-5.10.1/debian/patches/fixes/h2ph-gcc-4.5.diff	1970-01-01 01:00:00.000000000 +0100
+++ perl-5.10.1/debian/patches/fixes/h2ph-gcc-4.5.diff	2010-10-12 15:07:33.000000000 +0100
@@ -0,0 +1,96 @@
+Author: Robin Barker <rmbar...@cpan.org>
+Subject: Fix h2ph and test
+ Needed to build with GCC 4.5.
+Origin: upstream, http://perl5.git.perl.org/perl.git/commit/8d66b3f930dc6d88b524d103e304308ae73a46e7
+
+Index: b/lib/h2ph.t
+===================================================================
+--- a/lib/h2ph.t
++++ b/lib/h2ph.t
+@@ -18,7 +18,7 @@
+     exit 0;
+ }
+ 
+-plan(4);
++plan(5);
+ 
+ # quickly compare two text files
+ sub txt_compare {
+@@ -41,8 +41,16 @@
+                    stderr => 1 );
+ like( $result, qr/syntax OK$/, "output compiles");
+ 
++$result = runperl( progfile => '_h2ph_pre.ph',
++                   switches => ['-c'],
++                   stderr => 1 );
++like( $result, qr/syntax OK$/, "preamble compiles");
++
+ $result = runperl( switches => ["-w"], 
+-                   prog => '$SIG{__WARN__} = sub { die $_[0] }; require q(lib/h2ph.pht);');
++                   stderr => 1,
++                   prog => <<'PROG' );
++$SIG{__WARN__} = sub { die $_[0] }; require q(lib/h2ph.pht);
++PROG
+ is( $result, '', "output free of warnings" );
+ 
+ # cleanup
+Index: b/utils/h2ph.PL
+===================================================================
+--- a/utils/h2ph.PL
++++ b/utils/h2ph.PL
+@@ -401,7 +401,10 @@
+ exit $Exit;
+ 
+ sub expr {
+-    $new = '"(assembly code)"' and return if /\b__asm__\b/; # freak out.
++    if (/\b__asm__\b/) {	# freak out
++	$new = '"(assembly code)"';
++	return
++    }
+     my $joined_args;
+     if(keys(%curargs)) {
+ 	$joined_args = join('|', keys(%curargs));
+@@ -764,7 +767,7 @@
+ sub build_preamble_if_necessary
+ {
+     # Increment $VERSION every time this function is modified:
+-    my $VERSION     = 2;
++    my $VERSION     = 3;
+     my $preamble    = "$Dest_dir/_h2ph_pre.ph";
+ 
+     # Can we skip building the preamble file?
+@@ -792,7 +795,16 @@
+ 		# parenthesized value:  d=(v)
+ 		$define{$_} = $1;
+ 	    }
+-	    if ($define{$_} =~ /^([+-]?(\d+)?\.\d+([eE][+-]?\d+)?)[FL]?$/) {
++	    if (/^(\w+)\((\w)\)$/) {
++		my($macro, $arg) = ($1, $2);
++		my $def = $define{$_};
++		$def =~ s/$arg/\$\{$arg\}/g;
++		print PREAMBLE <<DEFINE;
++unless (defined &$macro) { sub $macro(\$) { my (\$$arg) = \...@_; \"$def\" } }
++
++DEFINE
++	    } elsif
++		($define{$_} =~ /^([+-]?(\d+)?\.\d+([eE][+-]?\d+)?)[FL]?$/) {
+ 		# float:
+ 		print PREAMBLE
+ 		    "unless (defined &$_) { sub $_() { $1 } }\n\n";
+@@ -801,8 +813,14 @@
+ 		print PREAMBLE
+ 		    "unless (defined &$_) { sub $_() { $1 } }\n\n";
+ 	    } elsif ($define{$_} =~ /^\w+$/) {
+-		print PREAMBLE
+-		    "unless (defined &$_) { sub $_() { &$define{$_} } }\n\n";
++		my $def = $define{$_};
++		if ($isatype{$def}) {
++		  print PREAMBLE
++		    "unless (defined &$_) { sub $_() { \"$def\" } }\n\n";
++		} else {
++		  print PREAMBLE
++		    "unless (defined &$_) { sub $_() { &$def } }\n\n";
++	        }
+ 	    } else {
+ 		print PREAMBLE
+ 		    "unless (defined &$_) { sub $_() { \"",
diff -Nru perl-5.10.1/debian/patches/series perl-5.10.1/debian/patches/series
--- perl-5.10.1/debian/patches/series	2010-10-06 19:46:31.000000000 +0100
+++ perl-5.10.1/debian/patches/series	2010-10-12 15:05:43.000000000 +0100
@@ -44,4 +44,5 @@
 fixes/fcgi-test.diff -p1
 fixes/hurd-ccflags.diff -p1
 debian/squelch-locale-warnings.diff -p1
+fixes/h2ph-gcc-4.5.diff
 patchlevel -p1

Reply via email to