[PATCH 1/3] buildperl.pl: add patches to support gcc 3.x and 4.x when compiling Perl 5.6.x

---
 cpan/Devel-PPPort/devel/buildperl.pl |  144 ++++++++++++++++++++++++++++++++++
 1 files changed, 144 insertions(+), 0 deletions(-)

diff --git a/cpan/Devel-PPPort/devel/buildperl.pl b/cpan/Devel-PPPort/devel/buildperl.pl
index 49b7fbb..529c999 100644
--- a/cpan/Devel-PPPort/devel/buildperl.pl
+++ b/cpan/Devel-PPPort/devel/buildperl.pl
@@ -132,6 +132,32 @@ my @patch = (
               [ \&patch_sysv ],
             ],
   },
+  {
+    perl => [
+              '5.6.0',
+            ],
+    subs => [
+              [ \&patch_gcc_56 ],
+              [ \&patch_gcc_560 ],
+            ],
+  },
+  {
+    perl => [
+              '5.6.1',
+            ],
+    subs => [
+              [ \&patch_gcc_56 ],
+              [ \&patch_gcc_561 ],
+            ],
+  },
+  {
+    perl => [
+              '5.6.2',
+            ],
+    subs => [
+              [ \&patch_gcc_562 ],
+            ],
+  },
 );
 
 my(%perl, @perls);
@@ -425,6 +451,124 @@ END
   }
 }
 
+sub patch_gcc_56
+{
+  patch(<<'END');
+--- Configure
++++ Configure
+@@ -3380,6 +3380,18 @@
+ test "X$gfpthkeep" != Xy && gfpth=""
+ EOSC
+ 
++# gcc 3.1 complains about adding -Idirectories that it already knows about,
++# so we will take those off from locincpth.
++case "$gccversion" in
++3*)
++    echo "main(){}">try.c
++    for incdir in `$cc -v -c try.c 2>&1 | \
++       sed '1,/^#include <\.\.\.>/d;/^End of search list/,$d;s/^ //'` ; do
++       locincpth=`echo $locincpth | sed s!$incdir!!`
++    done
++    $rm -f try try.*
++esac
++
+ : What should the include directory be ?
+ echo " "
+ $echo $n "Hmm...  $c"
+
+--- makedepend.SH
++++ makedepend.SH
+@@ -58,6 +58,10 @@ case $PERL_CONFIG_SH in
+ 	;;
+ esac
+ 
++# Avoid localized gcc/cc messages
++LC_ALL=C
++export LC_ALL
++
+ # We need .. when we are in the x2p directory if we are using the
+ # cppstdin wrapper script.
+ # Put .. and . first so that we pick up the present cppstdin, not
+@@ -122,7 +122,7 @@ for file in `$cat .clist`; do
+     *.y) filebase=`basename $file .y` ;;
+     esac
+     case "$file" in
+-    */*) finc="-I`echo $file | sed 's#/[^/]*$##`" ;;
++    */*) finc="-I`echo $file | sed 's#/[^/]*$##'`" ;;
+     *)   finc= ;;
+     esac
+     $echo "Finding dependencies for $filebase$_o."
+END
+}
+
+sub patch_gcc_560
+{
+  patch(<<'END');
+--- makedepend.SH
++++ makedepend.SH
+@@ -136,6 +141,11 @@ for file in `$cat .clist`; do
+     $sed \
+ 	-e '1d' \
+ 	-e '/^#.*/d' \
++	-e '/^#.*/d' \
++	-e '/^#.*/d' \
++	-e '/^#.*/d' \
++	-e '/^#.*/d' \
+ 	-e '/^#.*"-"/d' \
++	-e '/^#.*"\/.*\/"/d' \
+ 	-e 's#\.[0-9][0-9]*\.c#'"$file.c#" \
+ 	-e 's/^[	 ]*#[	 ]*line/#/' \
+END
+}
+
+sub patch_gcc_561
+{
+  patch(<<'END');
+--- makedepend.SH
++++ makedepend.SH
+@@ -159,7 +159,12 @@
+         $sed \
+ 	    -e '1d' \
+ 	    -e '/^#.*/d' \
++	    -e '/^#.*/d' \
++	    -e '/^#.*/d' \
++	    -e '/^#.*/d' \
++	    -e '/^#.*/d' \
+ 	    -e '/^#.*"-"/d' \
++	    -e '/^#.*"\/.*\/"/d' \
+ 	    -e 's#\.[0-9][0-9]*\.c#'"$file.c#" \
+ 	    -e 's/^[	 ]*#[	 ]*line/#/' \
+ 	    -e '/^# *[0-9][0-9]* *[".\/]/!d' \
+END
+}
+
+sub patch_gcc_562
+{
+  patch(<<'END');
+--- makedepend.SH
++++ makedepend.SH
+@@ -126,7 +126,7 @@ for file in `$cat .clist`; do
+     *.y) filebase=`basename $file .y` ;;
+     esac
+     case "$file" in
+-    */*) finc="-I`echo $file | sed 's#/[^/]*$##`" ;;
++    */*) finc="-I`echo $file | sed 's#/[^/]*$##'`" ;;
+     *)   finc= ;;
+     esac
+     $echo "Finding dependencies for $filebase$_o."
+@@ -163,7 +163,9 @@
+ 	    -e '/^#.*/d' \
+ 	    -e '/^#.*/d' \
+ 	    -e '/^#.*/d' \
++	    -e '/^#.*/d' \
+ 	    -e '/^#.*"-"/d' \
++	    -e '/^#.*"\/.*\/"/d' \
+ 	    -e 's#\.[0-9][0-9]*\.c#'"$file.c#" \
+ 	    -e 's/^[	 ]*#[	 ]*line/#/' \
+ 	    -e '/^# *[0-9][0-9]* *[".\/]/!d' \
+END
+}
+
 sub patch
 {
   my($patch) = @_;
-- 
1.6.0.3.517.g759a

0 book 10/29/2009 8:19:33 PM
---
 cpan/Devel-PPPort/devel/buildperl.pl |   63 ++++++++++++++++++++++++++++++++++
 1 files changed, 63 insertions(+), 0 deletions(-)

diff --git a/cpan/Devel-PPPort/devel/buildperl.pl b/cpan/Devel-PPPort/devel/buildperl.pl
index 529c999..c0fbfa8 100644
--- a/cpan/Devel-PPPort/devel/buildperl.pl
+++ b/cpan/Devel-PPPort/devel/buildperl.pl
@@ -158,6 +158,23 @@ my @patch = (
               [ \&patch_gcc_562 ],
             ],
   },
+  {
+    perl => [
+              '5.8.0',
+            ],
+    subs => [
+              [ \&patch_gcc_580 ],
+              [ \&patch_gcc_58x ],
+            ],
+  },
+  {
+    perl => [
+              qr/^5.8.[1-8]/
+            ],
+    subs => [
+              [ \&patch_gcc_58x ],
+            ],
+  },
 );
 
 my(%perl, @perls);
@@ -569,6 +586,52 @@ sub patch_gcc_562
 END
 }
 
+sub patch_gcc_580
+{
+  patch(<<'END');
+--- makedepend.SH
++++ makedepend.SH
+@@ -58,6 +58,11 @@ case $PERL_CONFIG_SH in
+ 	;;
+ esac
+ 
++# Avoid localized gcc messages
++case "$ccname" in
++    gcc) LC_ALL=C ; export LC_ALL ;;
++esac
++
+ # We need .. when we are in the x2p directory if we are using the
+ # cppstdin wrapper script.
+ # Put .. and . first so that we pick up the present cppstdin, not
+END
+}
+
+sub patch_gcc_58x {
+  patch(<<'END');
+--- makedepend.SH
++++ makedepend.SH
+@@ -128,7 +127,7 @@ for file in `$cat .clist`; do
+     *.y) filebase=`basename $file .y` ;;
+     esac
+     case "$file" in
+-    */*) finc="-I`echo $file | sed 's#/[^/]*$##`" ;;
++    */*) finc="-I`echo $file | sed 's#/[^/]*$##'`" ;;
+     *)   finc= ;;
+     esac
+     $echo "Finding dependencies for $filebase$_o."
+@@ -167,7 +166,9 @@ for file in `$cat .clist`; do
+             -e '/^#.*/d' \
+             -e '/^#.*/d' \
+             -e '/^#.*/d' \
++            -e '/^#.*/d' \
+ 	    -e '/^#.*"-"/d' \
++	    -e '/^#.*"\/.*\/"/d' \
+ 	    -e '/: file path prefix .* never used$/d' \
+ 	    -e 's#\.[0-9][0-9]*\.c#'"$file.c#" \
+ 	    -e 's/^[	 ]*#[	 ]*line/#/' \
+END
+}
+
 sub patch
 {
   my($patch) = @_;
-- 
1.6.0.3.517.g759a

0 book 10/29/2009 8:19:34 PM
---
 cpan/Devel-PPPort/devel/buildperl.pl |   56 ++++++++++++++++++++++++++++++++++
 1 files changed, 56 insertions(+), 0 deletions(-)

diff --git a/cpan/Devel-PPPort/devel/buildperl.pl b/cpan/Devel-PPPort/devel/buildperl.pl
index c0fbfa8..ca652d2 100644
--- a/cpan/Devel-PPPort/devel/buildperl.pl
+++ b/cpan/Devel-PPPort/devel/buildperl.pl
@@ -175,6 +175,23 @@ my @patch = (
               [ \&patch_gcc_58x ],
             ],
   },
+  {
+    perl => [
+              qr/^5.9.[0-3]/
+            ],
+    subs => [
+              [ \&patch_gcc_59x ],
+              [ \&patch_gcc_594 ],
+            ],
+  },
+  {
+    perl => [
+              '5.9.4'
+            ],
+    subs => [
+              [ \&patch_gcc_594 ],
+            ],
+  },
 );
 
 my(%perl, @perls);
@@ -632,6 +649,45 @@ sub patch_gcc_58x {
 END
 }
 
+sub patch_gcc_59x {
+  patch(<<'END');
+--- makedepend.SH
++++ makedepend.SH
+@@ -167,6 +167,7 @@ for file in `$cat .clist`; do
+             -e '/^#.*/d' \
+             -e '/^#.*/d' \
+             -e '/^#.*/d' \
++            -e '/^#.*/d' \
+ 	    -e '/^#.*"-"/d' \
+ 	    -e '/: file path prefix .* never used$/d' \
+ 	    -e 's#\.[0-9][0-9]*\.c#'"$file.c#" \
+END
+}
+
+sub patch_gcc_594 {
+  patch(<<'END');
+--- makedepend.SH
++++ makedepend.SH
+@@ -128,7 +128,7 @@ for file in `$cat .clist`; do
+     *.y) filebase=`basename $file .y` ;;
+     esac
+     case "$file" in
+-    */*) finc="-I`echo $file | sed 's#/[^/]*$##`" ;;
++    */*) finc="-I`echo $file | sed 's#/[^/]*$##'`" ;;
+     *)   finc= ;;
+     esac
+     $echo "Finding dependencies for $filebase$_o."
+@@ -169,6 +169,7 @@ for file in `$cat .clist`; do
+             -e '/^#.*/d' \
+             -e '/^#.*/d' \
+ 	    -e '/^#.*"-"/d' \
++	    -e '/^#.*"\/.*\/"/d' \
+ 	    -e '/: file path prefix .* never used$/d' \
+ 	    -e 's#\.[0-9][0-9]*\.c#'"$file.c#" \
+ 	    -e 's/^[	 ]*#[	 ]*line/#/' \
+END
+}
+
 sub patch
 {
   my($patch) = @_;
-- 
1.6.0.3.517.g759a

0 book 10/29/2009 8:19:35 PM
On Thu, Oct 29, 2009 at 09:19:33PM +0100, Philippe Bruhat (BooK) wrote:
> ---
>  cpan/Devel-PPPort/devel/buildperl.pl |  144 ++++++++++++++++++++++++++++++++++
>  1 files changed, 144 insertions(+), 0 deletions(-)
> 

Sorry, next time I'll use the --compose option.

This series of patches adds, er, patches to buildperl.pl, which is part
of Devel::PPPort. It "fixes" Configure and makedepend.SH so that older
perls can be compiled in "modern" environments (gcc 3.x, 4.x).

The patches themselves are a set of minimal changes
that made the make && make install complete on my Ubuntu box.

The patches themselves were obtained by using git diff against the latest
tag that "worked" (typically perl-5.8.9 and perl-5.9.5).

Boring details: http://use.perl.org/~BooK/journal/39818

-- 
 Philippe Bruhat (BooK)

 When you allow legends to rule your life, your world is based on fiction.
                                    (Moral from Groo The Wanderer #99 (Epic))
0 philippe 10/29/2009 8:44:58 PM
On Thu, Oct 29, 2009 at 09:44:58PM +0100, Philippe Bruhat (BooK) wrote:
> On Thu, Oct 29, 2009 at 09:19:33PM +0100, Philippe Bruhat (BooK) wrote:
> > ---
> >  cpan/Devel-PPPort/devel/buildperl.pl |  144 ++++++++++++++++++++++++++++++++++
> >  1 files changed, 144 insertions(+), 0 deletions(-)
> > 
> 
> Sorry, next time I'll use the --compose option.
 
(Just for the future, since Devel::PPPort is dual-life with upstream of
CPAN, we can't take patches until upstream incorporates them. And even
then, we should only be incorporating a new CPAN release.)


-j

0 jesse 11/2/2009 5:16:47 PM
--Sig_/IcMUavuPoT.XAPsogBk0/pQ
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

Hi Philippe,

On 2009-10-29, at 21:44:58 +0100, Philippe Bruhat (BooK) wrote:

> On Thu, Oct 29, 2009 at 09:19:33PM +0100, Philippe Bruhat (BooK) wrote:
> > ---
> >  cpan/Devel-PPPort/devel/buildperl.pl |  144 ++++++++++++++++++++++++++=
++++++++
> >  1 files changed, 144 insertions(+), 0 deletions(-)
> >=20
>=20
> Sorry, next time I'll use the --compose option.
>=20
> This series of patches adds, er, patches to buildperl.pl, which is part
> of Devel::PPPort. It "fixes" Configure and makedepend.SH so that older
> perls can be compiled in "modern" environments (gcc 3.x, 4.x).
>=20
> The patches themselves are a set of minimal changes
> that made the make && make install complete on my Ubuntu box.
>=20
> The patches themselves were obtained by using git diff against the latest
> tag that "worked" (typically perl-5.8.9 and perl-5.9.5).
>=20
> Boring details: http://use.perl.org/~BooK/journal/39818

sorry for the delay.

I've just applied your patches and after having a look at your
journal I trust you that the patches just work. ;)

Note that there was already some logic in buildperl.pl to handle
parts of that  /  problem by actually
patching the makefiles after Configure. While this is certainly
not as clean as patching makedepend.**** avoids shipping lots
patches for all different versions of makedepend.SH.

Shall I wait for more patches?

Cheers,
Marcus

--=20
Kime's Law for the Reward of Meekness:
	Turning the other cheek merely ensures two bruised cheeks.

--Sig_/IcMUavuPoT.XAPsogBk0/pQ
Content-Type: application/pgp-signature; name=signature.asc
Content-Disposition: attachment; filename=signature.asc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (GNU/Linux)

iEYEARECAAYFAkrvRXgACgkQ+WHr1iaAu0ZYhQCfaq1qk0/ciaN+RTIu28VVZ47L
5dQAoKDYc/RzzhSBzAHViqwmUp3giFiw
=FS3Q
-----END PGP SIGNATURE-----

--Sig_/IcMUavuPoT.XAPsogBk0/pQ--
0 mhx 11/2/2009 8:47:45 PM
On Mon, Nov 02, 2009 at 09:47:45PM +0100, Marcus Holland-Moritz wrote:
> 
> > Boring details: http://use.perl.org/~BooK/journal/39818
> 
> sorry for the delay.
> 
> I've just applied your patches and after having a look at your
> journal I trust you that the patches just work. ;)

They do. At least on my Linux box.

> Note that there was already some logic in buildperl.pl to handle
> parts of that  /  problem by actually
> patching the makefiles after Configure.

Ooh. I must admit I don't remember trying to run buildperl.pl without
the modifications. So maybe my patches are obsolete?

Maybe I should run my whole test script again, just to check that it
works without my patches? Or that some of the patches can be removed?

> While this is certainly
> not as clean as patching makedepend.**** avoids shipping lots
> patches for all different versions of makedepend.SH.

Yes, I was a bit bothered that I had to had so many routines to patch
the same file over and over again. In my recent changes, I have tried to
split the makedepend.SH patches so that I could use them more than once.

> Shall I wait for more patches?

Since the journal, I wrote patches for Perl 5.5.x, which I can send in.

-- 
 Philippe Bruhat (BooK)

 There is no solution to a problem of sheer greed.
                                    (Moral from Groo The Wanderer #94 (Epic))
0 philippe 11/2/2009 9:30:20 PM
On Mon, Nov 02, 2009 at 12:16:47PM -0500, jesse wrote:
> 
> (Just for the future, since Devel::PPPort is dual-life with upstream of
> CPAN, we can't take patches until upstream incorporates them. And even
> then, we should only be incorporating a new CPAN release.)
> 

Yes I know. But I was so excited to actually have a non-doc patch I
could send to p5p, that I just sent it. :-)

-- 
 Philippe Bruhat (BooK)

 True friends are friends to the end... and even after that.
                                    (Moral from Groo The Wanderer #53 (Epic))
0 philippe 11/2/2009 9:31:29 PM
--Sig_/DzDGJzYEFTJCt/miW/2j2VO
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

Hi Philippe,

On 2009-11-02, at 22:30:20 +0100, Philippe Bruhat (BooK) wrote:

> On Mon, Nov 02, 2009 at 09:47:45PM +0100, Marcus Holland-Moritz wrote:
> >=20
> > > Boring details: http://use.perl.org/~BooK/journal/39818
> >=20
> > sorry for the delay.
> >=20
> > I've just applied your patches and after having a look at your
> > journal I trust you that the patches just work. ;)
>=20
> They do. At least on my Linux box.
>=20
> > Note that there was already some logic in buildperl.pl to handle
> > parts of that  /  problem by actually
> > patching the makefiles after Configure.
>=20
> Ooh. I must admit I don't remember trying to run buildperl.pl without
> the modifications. So maybe my patches are obsolete?
>=20
> Maybe I should run my whole test script again, just to check that it
> works without my patches? Or that some of the patches can be removed?

It would be nice if you could test without. I *think* your patches
that fix the quoting issue have to be applied anyway. But the
 /  stuff can probably be addressed in
build_and_install() by adding more cases to the sed call.

> > While this is certainly
> > not as clean as patching makedepend.**** avoids shipping lots
> > patches for all different versions of makedepend.SH.
>=20
> Yes, I was a bit bothered that I had to had so many routines to patch
> the same file over and over again. In my recent changes, I have tried to
> split the makedepend.SH patches so that I could use them more than once.
>=20
> > Shall I wait for more patches?
>=20
> Since the journal, I wrote patches for Perl 5.5.x, which I can send in.

Yes, feel free to send :)

I can't promise to make a new release very soon, though.

Cheers,
Marcus

--Sig_/DzDGJzYEFTJCt/miW/2j2VO
Content-Type: application/pgp-signature; name=signature.asc
Content-Disposition: attachment; filename=signature.asc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (GNU/Linux)

iEYEARECAAYFAkrvUfEACgkQ+WHr1iaAu0YPLwCfUhyEC5Sb4E9WRsBeIhPDMdMw
TjgAni5qfZNB2VSFE9oP6vQJbrD4xRDb
=l3cd
-----END PGP SIGNATURE-----

--Sig_/DzDGJzYEFTJCt/miW/2j2VO--
0 mhx 11/2/2009 9:41:05 PM
On Mon, Nov 02, 2009 at 10:41:05PM +0100, Marcus Holland-Moritz wrote:
> > 
> > > Note that there was already some logic in buildperl.pl to handle
> > > parts of that  /  problem by actually
> > > patching the makefiles after Configure.
> > 
> > Ooh. I must admit I don't remember trying to run buildperl.pl without
> > the modifications. So maybe my patches are obsolete?
> > 
> > Maybe I should run my whole test script again, just to check that it
> > works without my patches? Or that some of the patches can be removed?
> 
> It would be nice if you could test without.

I just did. None of the following compiles:

> I *think* your patches
> that fix the quoting issue have to be applied anyway.

Indeed, the error I see is usually:

    ./makedepend: 1: Syntax error: Unterminated quoted string

> But the
>  /  stuff can probably be addressed in
> build_and_install() by adding more cases to the sed call.

OK. So I'll refine my changes by adding the quoting patch and ensuring
the sed call does everything that's needed.

Should I send a patch against blead, or against the latest release on
CPAN or against some other repository?

-- 
 Philippe Bruhat (BooK)

 When it is time for voting-      /     In the West or in the East-
 Why must we always settle for-   /     The man we hate the least?
                                (Intro poem to Groo The Wanderer #108 (Epic))
0 philippe 11/2/2009 10:26:24 PM
--Sig_/gFoMq.CJUQSp7N87Ra0tIGt
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

Hi Philippe,

On 2009-11-02, at 23:26:24 +0100, Philippe Bruhat (BooK) wrote:

> On Mon, Nov 02, 2009 at 10:41:05PM +0100, Marcus Holland-Moritz wrote:
> > >=20
> > > > Note that there was already some logic in buildperl.pl to handle
> > > > parts of that  /  problem by actually
> > > > patching the makefiles after Configure.
> > >=20
> > > Ooh. I must admit I don't remember trying to run buildperl.pl without
> > > the modifications. So maybe my patches are obsolete?
> > >=20
> > > Maybe I should run my whole test script again, just to check that it
> > > works without my patches? Or that some of the patches can be removed?
> >=20
> > It would be nice if you could test without.
>=20
> I just did. None of the following compiles:
>=20
> > I *think* your patches
> > that fix the quoting issue have to be applied anyway.
>=20
> Indeed, the error I see is usually:
>=20
>     ./makedepend: 1: Syntax error: Unterminated quoted string
>=20
> > But the
> >  /  stuff can probably be addressed in
> > build_and_install() by adding more cases to the sed call.
>=20
> OK. So I'll refine my changes by adding the quoting patch and ensuring
> the sed call does everything that's needed.

Very good, thanks! :)

> Should I send a patch against blead, or against the latest release on
> CPAN or against some other repository?

Blead and CPAN should be identical, so either one is fine.

Cheers,
Marcus

--=20
Peace, n.:
	In international affairs, a period of cheating between two
	periods of fighting.
		-- Ambrose Bierce, "The Devil's Dictionary"

--Sig_/gFoMq.CJUQSp7N87Ra0tIGt
Content-Type: application/pgp-signature; name=signature.asc
Content-Disposition: attachment; filename=signature.asc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (GNU/Linux)

iEUEARECAAYFAkrvXWkACgkQ+WHr1iaAu0ZqsQCdE1ZrTM+m5P2OnAUivlzLNfRv
Yk0Al1tEihcsoVRt/KvDTfa1mAMzGuY=
=+N9q
-----END PGP SIGNATURE-----

--Sig_/gFoMq.CJUQSp7N87Ra0tIGt--
0 mhx 11/2/2009 10:29:55 PM
On Mon, Nov 02, 2009 at 11:26:24PM +0100, Philippe Bruhat (BooK) wrote:
> > 
> > It would be nice if you could test without.
> 
> I just did. None of the following compiles:

Oops. I sent the email before the end of my script...

Anyway, as expected, none of the following compiles with the buildperl.pl
on blead:
5.005 5.005_01 5.005_02 5.005_03 5.005_04 5.6.0 5.6.1 5.6.2 5.8.0 5.8.1
5.8.2 5.8.3 5.8.4 5.8.5 5.8.6 5.8.7 5.8.8 5.9.0 5.9.1 5.9.2 5.9.3 5.9.4

-- 
 Philippe Bruhat (BooK)

 In war, the only winners are those who sell the weapons.
                                                 (Moral from Groo #3 (Image))
0 philippe 11/2/2009 10:37:25 PM
Reply:

(Thread closed)