summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorsten Veller <tove@gentoo.org>2009-06-15 20:49:58 +0200
committerTorsten Veller <tove@gentoo.org>2009-06-15 20:49:58 +0200
commitde3d2580929fac484f95c88126c68fb68eb7fe56 (patch)
tree8241108d532f28bbd138ebff7a5333c1f0f6fbe0 /dev-lang
parentAdd an alternatives version of perl-5.8.8 (diff)
downloadperl-overlay-de3d2580929fac484f95c88126c68fb68eb7fe56.tar.gz
perl-overlay-de3d2580929fac484f95c88126c68fb68eb7fe56.tar.bz2
perl-overlay-de3d2580929fac484f95c88126c68fb68eb7fe56.zip
Add an alternatives version of perl-5.8.8
Diffstat (limited to 'dev-lang')
-rw-r--r--dev-lang/perl/files/perl-5.8.7-MakeMaker-RUNPATH.patch21
-rw-r--r--dev-lang/perl/files/perl-5.8.8-CAN-2005-0448-rmtree-2.patch280
-rw-r--r--dev-lang/perl/files/perl-5.8.8-CAN-2005-0448-rmtree.patch263
-rw-r--r--dev-lang/perl/files/perl-5.8.8-CVE-2008-1927.patch256
-rw-r--r--dev-lang/perl/files/perl-5.8.8-USE_MM_LD_RUN_PATH.patch111
-rw-r--r--dev-lang/perl/files/perl-5.8.8-asm-page-h-compile-failure.patch12
-rw-r--r--dev-lang/perl/files/perl-5.8.8-cplusplus.patch22
-rw-r--r--dev-lang/perl/files/perl-5.8.8-dragonfly-clean.patch170
-rw-r--r--dev-lang/perl/files/perl-5.8.8-fbsdhints.patch57
-rw-r--r--dev-lang/perl/files/perl-5.8.8-fix_file_path_chdir.patch72
-rw-r--r--dev-lang/perl/files/perl-5.8.8-gcc42-command-line.patch11
-rw-r--r--dev-lang/perl/files/perl-5.8.8-lib32.patch76
-rw-r--r--dev-lang/perl/files/perl-5.8.8-lib64.patch76
-rw-r--r--dev-lang/perl/files/perl-5.8.8-libbits.patch96
-rw-r--r--dev-lang/perl/files/perl-5.8.8-links.patch86
-rw-r--r--dev-lang/perl/files/perl-5.8.8-makedepend-syntax.patch11
-rw-r--r--dev-lang/perl/files/perl-5.8.8-perlcc.patch11
-rw-r--r--dev-lang/perl/files/perl-5.8.8-reorder-INC.patch93
-rw-r--r--dev-lang/perl/files/perl-5.8.8-utf8-boundary.patch57
-rw-r--r--dev-lang/perl/files/perl-fix_h2ph_include_quote.patch61
-rw-r--r--dev-lang/perl/files/perl-h2ph-ansi-header.patch11
-rw-r--r--dev-lang/perl/files/perl-hppa-pa7200-configure.patch11
-rw-r--r--dev-lang/perl/files/perl-noksh.patch16
-rw-r--r--dev-lang/perl/files/perl-perldoc-emptydirs.patch10
-rw-r--r--dev-lang/perl/files/perl-picdl.patch13
-rw-r--r--dev-lang/perl/files/perl-prelink-lpthread.patch11
-rw-r--r--dev-lang/perl/files/perl-regexp-nossp.patch11
-rw-r--r--dev-lang/perl/perl-5.8.8-r10.ebuild692
28 files changed, 2617 insertions, 0 deletions
diff --git a/dev-lang/perl/files/perl-5.8.7-MakeMaker-RUNPATH.patch b/dev-lang/perl/files/perl-5.8.7-MakeMaker-RUNPATH.patch
new file mode 100644
index 000000000..c442defa5
--- /dev/null
+++ b/dev-lang/perl/files/perl-5.8.7-MakeMaker-RUNPATH.patch
@@ -0,0 +1,21 @@
+Bug #105054.
+
+We do not want the build root in the linked perl module's RUNPATH, so strip
+paths containing PORTAGE_TMPDIR if its set.
+
+--- perl-5.8.7/lib/ExtUtils/MM_Unix.pm 2005-09-10 14:06:59.000000000 +0200
++++ perl-5.8.7.az/lib/ExtUtils/MM_Unix.pm 2005-09-10 15:25:52.000000000 +0200
+@@ -1915,6 +1915,13 @@
+ # LD_RUN_PATH now computed by ExtUtils::Liblist
+ ($self->{EXTRALIBS}, $self->{BSLOADLIBS},
+ $self->{LDLOADLIBS}, $self->{LD_RUN_PATH}) = @libs;
++ # We do not want the build root in RPATH
++ if (exists $ENV{PORTAGE_TMPDIR}) {
++ # If we have PORTAGE_TMPDIR set, strip that, as just testing for
++ # /usr and /opt might not be sufficient
++ $self->{LD_RUN_PATH} = join ':', grep !/^\Q$ENV{PORTAGE_TMPDIR}/,
++ split /:/, $self->{LD_RUN_PATH};
++ }
+ last;
+ }
+ }
diff --git a/dev-lang/perl/files/perl-5.8.8-CAN-2005-0448-rmtree-2.patch b/dev-lang/perl/files/perl-5.8.8-CAN-2005-0448-rmtree-2.patch
new file mode 100644
index 000000000..d29fc2522
--- /dev/null
+++ b/dev-lang/perl/files/perl-5.8.8-CAN-2005-0448-rmtree-2.patch
@@ -0,0 +1,280 @@
+SECURITY [CAN-2005-0448]:
+
+Rewrite File::Path::rmtree to avoid race condition which allows an
+attacker with write permission on directories in the tree being
+removed to make files setuid or to remove arbitrary files (see
+http://bugs.debian.org/286905 and http://bugs.debian.org/286922).
+
+Revised for 5.8.8-7etch6 to avoid failure when rmtree removes the
+current directory.
+
+diff --git a/lib/File/Path.pm b/lib/File/Path.pm
+index 2e41ff3..fd32b96 100644
+--- a/lib/File/Path.pm
++++ b/lib/File/Path.pm
+@@ -72,33 +72,17 @@ or C<unlink> to remove it, or that it's skipping it.
+
+ =item *
+
+-a boolean value, which if TRUE will cause C<rmtree> to
+-skip any files to which you do not have delete access
+-(if running under VMS) or write access (if running
+-under another OS). This will change in the future when
+-a criterion for 'delete permission' under OSs other
+-than VMS is settled. (defaults to FALSE)
++a boolean value, which if FALSE (the default for non-root users) will
++cause C<rmtree> to adjust the mode of directories (if required) prior
++to attempting to remove the contents. Note that on interruption or
++failure of C<rmtree>, directories may be left with more permissive
++modes for the owner.
+
+ =back
+
+ It returns the number of files successfully deleted. Symlinks are
+ simply deleted and not followed.
+
+-B<NOTE:> There are race conditions internal to the implementation of
+-C<rmtree> making it unsafe to use on directory trees which may be
+-altered or moved while C<rmtree> is running, and in particular on any
+-directory trees with any path components or subdirectories potentially
+-writable by untrusted users.
+-
+-Additionally, if the third parameter is not TRUE and C<rmtree> is
+-interrupted, it may leave files and directories with permissions altered
+-to allow deletion (and older versions of this module would even set
+-files and directories to world-read/writable!)
+-
+-Note also that the occurrence of errors in C<rmtree> can be determined I<only>
+-by trapping diagnostic messages using C<$SIG{__WARN__}>; it is not apparent
+-from the return value.
+-
+ =head1 DIAGNOSTICS
+
+ =over 4
+@@ -172,111 +156,127 @@ sub mkpath {
+ @created;
+ }
+
+-sub rmtree {
+- my($roots, $verbose, $safe) = @_;
+- my(@files);
+- my($count) = 0;
+- $verbose ||= 0;
+- $safe ||= 0;
++sub _rmtree;
++sub _rmtree
++{
++ my ($path, $prefix, $up, $up_dev, $up_ino, $verbose, $safe) = @_;
++ my $up_name = $up eq '..' ? 'parent' : 'initial';
++
++ my ($dev, $ino) = lstat $path or return 0;
++ unless (-d _)
++ {
++ print "unlink $prefix$path\n" if $verbose;
++ unless (unlink $path)
++ {
++ carp "Can't remove file $prefix$path ($!)";
++ return 0;
++ }
+
+- if ( defined($roots) && length($roots) ) {
+- $roots = [$roots] unless ref $roots;
++ return 1;
+ }
+- else {
+- carp "No root path(s) specified\n";
+- return 0;
++
++ unless (chdir $path)
++ {
++ carp "Can't chdir to $prefix$path ($!)";
++ return 0;
+ }
+
+- my($root);
+- foreach $root (@{$roots}) {
+- if ($Is_MacOS) {
+- $root = ":$root" if $root !~ /:/;
+- $root =~ s#([^:])\z#$1:#;
+- } else {
+- $root =~ s#/\z##;
+- }
+- (undef, undef, my $rp) = lstat $root or next;
+- $rp &= 07777; # don't forget setuid, setgid, sticky bits
+- if ( -d _ ) {
+- # notabene: 0700 is for making readable in the first place,
+- # it's also intended to change it to writable in case we have
+- # to recurse in which case we are better than rm -rf for
+- # subtrees with strange permissions
+- chmod($rp | 0700, ($Is_VMS ? VMS::Filespec::fileify($root) : $root))
+- or carp "Can't make directory $root read+writeable: $!"
+- unless $safe;
+-
+- if (opendir my $d, $root) {
+- no strict 'refs';
+- if (!defined ${"\cTAINT"} or ${"\cTAINT"}) {
+- # Blindly untaint dir names
+- @files = map { /^(.*)$/s ; $1 } readdir $d;
+- } else {
+- @files = readdir $d;
+- }
+- closedir $d;
+- }
+- else {
+- carp "Can't read $root: $!";
+- @files = ();
+- }
++ # avoid a race condition where a directory may be replaced by a
++ # symlink between the lstat and the chdir
++ my ($new_dev, $new_ino, $perm) = stat '.';
++ unless ("$new_dev:$new_ino" eq "$dev:$ino")
++ {
++ croak "Directory $prefix$path changed before chdir, aborting";
++ }
+
+- # Deleting large numbers of files from VMS Files-11 filesystems
+- # is faster if done in reverse ASCIIbetical order
+- @files = reverse @files if $Is_VMS;
+- ($root = VMS::Filespec::unixify($root)) =~ s#\.dir\z## if $Is_VMS;
+- if ($Is_MacOS) {
+- @files = map("$root$_", @files);
+- } else {
+- @files = map("$root/$_", grep $_!~/^\.{1,2}\z/s,@files);
+- }
+- $count += rmtree(\@files,$verbose,$safe);
+- if ($safe &&
+- ($Is_VMS ? !&VMS::Filespec::candelete($root) : !-w $root)) {
+- print "skipped $root\n" if $verbose;
+- next;
+- }
+- chmod $rp | 0700, $root
+- or carp "Can't make directory $root writeable: $!"
+- if $force_writeable;
+- print "rmdir $root\n" if $verbose;
+- if (rmdir $root) {
+- ++$count;
+- }
+- else {
+- carp "Can't remove directory $root: $!";
+- chmod($rp, ($Is_VMS ? VMS::Filespec::fileify($root) : $root))
+- or carp("and can't restore permissions to "
+- . sprintf("0%o",$rp) . "\n");
+- }
+- }
+- else {
+- if ($safe &&
+- ($Is_VMS ? !&VMS::Filespec::candelete($root)
+- : !(-l $root || -w $root)))
+- {
+- print "skipped $root\n" if $verbose;
+- next;
+- }
+- chmod $rp | 0600, $root
+- or carp "Can't make file $root writeable: $!"
+- if $force_writeable;
+- print "unlink $root\n" if $verbose;
+- # delete all versions under VMS
+- for (;;) {
+- unless (unlink $root) {
+- carp "Can't unlink file $root: $!";
+- if ($force_writeable) {
+- chmod $rp, $root
+- or carp("and can't restore permissions to "
+- . sprintf("0%o",$rp) . "\n");
+- }
+- last;
+- }
+- ++$count;
+- last unless $Is_VMS && lstat $root;
+- }
++ $perm &= 07777;
++ my $nperm = $perm | 0700;
++ unless ($safe or $nperm == $perm or chmod $nperm, '.')
++ {
++ carp "Can't make directory $prefix$path read+writeable ($!)";
++ $nperm = $perm;
++ }
++
++ my $count = 0;
++ if (opendir my $dir, '.')
++ {
++ my $entry;
++ while (defined ($entry = readdir $dir))
++ {
++ next if $entry =~ /^\.\.?$/;
++ $entry =~ /^(.*)$/s; $entry = $1; # untaint
++ $count += _rmtree $entry, "$prefix$path/", '..', $dev, $ino,
++ $verbose, $safe;
+ }
++
++ closedir $dir;
++ }
++
++ # restore directory permissions if required (in case the rmdir
++ # below fails) now, while we're still in the directory and may do
++ # so without a race via '.'
++ unless ($nperm == $perm or chmod $perm, '.')
++ {
++ carp "Can't restore permissions on directory $prefix$path ($!)";
++ }
++
++ # don't leave the caller in an unexpected directory
++ unless (chdir $up)
++ {
++ croak "Can't return to $up_name directory from $prefix$path ($!)";
++ }
++
++ # ensure that a chdir .. didn't take us somewhere other than
++ # where we expected (see CVE-2002-0435)
++ unless (($new_dev, $new_ino) = stat '.'
++ and "$new_dev:$new_ino" eq "$up_dev:$up_ino")
++ {
++ croak "\u$up_name directory changed since entering $prefix$path";
++ }
++
++ print "rmdir $prefix$path\n" if $verbose;
++ if (rmdir $path)
++ {
++ $count++;
++ }
++ else
++ {
++ carp "Can't remove directory $prefix$path ($!)";
++ }
++
++ return $count;
++}
++
++sub rmtree
++{
++ my ($p, $verbose, $safe) = @_;
++ $p = [] unless defined $p and length $p;
++ $p = [ $p ] unless ref $p;
++ my @paths = grep defined && length, @$p;
++
++ # default to "unsafe" for non-root (will chmod dirs)
++ $safe = $> ? 0 : 1 unless defined $safe;
++
++ unless (@paths)
++ {
++ carp "No root path(s) specified";
++ return;
++ }
++
++ opendir my $oldpwd, '.' or do {
++ carp "Can't fetch initial working directory";
++ return;
++ };
++
++ my ($dev, $ino) = stat '.' or do {
++ carp "Can't stat initial working directory";
++ return;
++ };
++
++ my $count = 0;
++ for my $path (@paths)
++ {
++ $count += _rmtree $path, '', $oldpwd, $dev, $ino, $verbose, $safe;
+ }
+
+ $count;
diff --git a/dev-lang/perl/files/perl-5.8.8-CAN-2005-0448-rmtree.patch b/dev-lang/perl/files/perl-5.8.8-CAN-2005-0448-rmtree.patch
new file mode 100644
index 000000000..0bee3e107
--- /dev/null
+++ b/dev-lang/perl/files/perl-5.8.8-CAN-2005-0448-rmtree.patch
@@ -0,0 +1,263 @@
+--- lib/File/Path.pm.old 2005-06-28 17:22:21.000000000 -0400
++++ lib/File/Path.pm 2005-06-28 17:32:32.000000000 -0400
+@@ -26,9 +26,11 @@ to a list of paths to create,
+
+ =item *
+
+-a boolean value, which if TRUE will cause C<mkpath>
+-to print the name of each directory as it is created
+-(defaults to FALSE), and
++a boolean value, which if FALSE (the default for non-root users) will
++cause C<rmtree> to adjust the mode of directories (if required) prior
++to attempting to remove the contents. Note that on interruption or
++failure of C<rmtree>, directories may be left with more permissi
++modes for the owner.
+
+ =item *
+
+@@ -124,6 +126,7 @@ use File::Basename ();
+ use Exporter ();
+ use strict;
+ use warnings;
++use Cwd 'getcwd';
+
+ our $VERSION = "1.07";
+ our @ISA = qw( Exporter );
+@@ -172,111 +175,133 @@ sub mkpath {
+ @created;
+ }
+
+-sub rmtree {
+- my($roots, $verbose, $safe) = @_;
+- my(@files);
+- my($count) = 0;
+- $verbose ||= 0;
+- $safe ||= 0;
+-
+- if ( defined($roots) && length($roots) ) {
+- $roots = [$roots] unless ref $roots;
+- }
+- else {
+- carp "No root path(s) specified\n";
+- return 0;
+- }
+-
+- my($root);
+- foreach $root (@{$roots}) {
+- if ($Is_MacOS) {
+- $root = ":$root" if $root !~ /:/;
+- $root =~ s#([^:])\z#$1:#;
+- } else {
+- $root =~ s#/\z##;
+- }
+- (undef, undef, my $rp) = lstat $root or next;
+- $rp &= 07777; # don't forget setuid, setgid, sticky bits
+- if ( -d _ ) {
+- # notabene: 0700 is for making readable in the first place,
+- # it's also intended to change it to writable in case we have
+- # to recurse in which case we are better than rm -rf for
+- # subtrees with strange permissions
+- chmod($rp | 0700, ($Is_VMS ? VMS::Filespec::fileify($root) : $root))
+- or carp "Can't make directory $root read+writeable: $!"
+- unless $safe;
+-
+- if (opendir my $d, $root) {
+- no strict 'refs';
+- if (!defined ${"\cTAINT"} or ${"\cTAINT"}) {
+- # Blindly untaint dir names
+- @files = map { /^(.*)$/s ; $1 } readdir $d;
+- } else {
+- @files = readdir $d;
+- }
+- closedir $d;
+- }
+- else {
+- carp "Can't read $root: $!";
+- @files = ();
+- }
++sub _rmtree;
++sub _rmtree
++{
++
++ my ($path, $prefix, $up, $up_dev, $up_ino, $verbose, $safe) = @_;
++
++ my ($dev, $ino) = lstat $path or do {
++ carp "Can't stat $prefix$path ($!)" unless $!{ENOENT};
++ return 0;
++ };
++
++ unless (-d _)
++ {
++ print "unlink $prefix$path\n" if $verbose;
++ unless (unlink $path)
++ {
++ carp "Can't remove file $prefix$path ($!)";
++ return 0;
++ }
++ return 1;
++ }
+
+- # Deleting large numbers of files from VMS Files-11 filesystems
+- # is faster if done in reverse ASCIIbetical order
+- @files = reverse @files if $Is_VMS;
+- ($root = VMS::Filespec::unixify($root)) =~ s#\.dir\z## if $Is_VMS;
+- if ($Is_MacOS) {
+- @files = map("$root$_", @files);
+- } else {
+- @files = map("$root/$_", grep $_!~/^\.{1,2}\z/s,@files);
+- }
+- $count += rmtree(\@files,$verbose,$safe);
+- if ($safe &&
+- ($Is_VMS ? !&VMS::Filespec::candelete($root) : !-w $root)) {
+- print "skipped $root\n" if $verbose;
+- next;
+- }
+- chmod $rp | 0700, $root
+- or carp "Can't make directory $root writeable: $!"
+- if $force_writeable;
+- print "rmdir $root\n" if $verbose;
+- if (rmdir $root) {
+- ++$count;
+- }
+- else {
+- carp "Can't remove directory $root: $!";
+- chmod($rp, ($Is_VMS ? VMS::Filespec::fileify($root) : $root))
+- or carp("and can't restore permissions to "
+- . sprintf("0%o",$rp) . "\n");
+- }
+- }
+- else {
+- if ($safe &&
+- ($Is_VMS ? !&VMS::Filespec::candelete($root)
+- : !(-l $root || -w $root)))
+- {
+- print "skipped $root\n" if $verbose;
+- next;
+- }
+- chmod $rp | 0600, $root
+- or carp "Can't make file $root writeable: $!"
+- if $force_writeable;
+- print "unlink $root\n" if $verbose;
+- # delete all versions under VMS
+- for (;;) {
+- unless (unlink $root) {
+- carp "Can't unlink file $root: $!";
+- if ($force_writeable) {
+- chmod $rp, $root
+- or carp("and can't restore permissions to "
+- . sprintf("0%o",$rp) . "\n");
+- }
+- last;
+- }
+- ++$count;
+- last unless $Is_VMS && lstat $root;
+- }
+- }
++ unless (chdir $path)
++ {
++ carp "Can't chdir to $prefix$path ($!)";
++ return 0;
++ }
++
++ # avoid a race condition where a directory may be replaced by a
++ # symlink between the lstat and the chdir
++ my ($new_dev, $new_ino, $perm) = stat '.';
++ unless ("$new_dev:$new_ino" eq "$dev:$ino")
++ {
++ croak "Directory $prefix$path changed before chdir, aborting";
++ }
++
++ $perm &= 07777;
++ my $nperm = $perm | 0700;
++ unless ($safe or $nperm == $perm or chmod $nperm, '.')
++ {
++ carp "Can't make directory $prefix$path read+writeable ($!)";
++ $nperm = $perm;
++ }
++
++ my $count = 0;
++ if (opendir my $dir, '.')
++ {
++ my $entry;
++ while (defined ($entry = readdir $dir))
++ {
++ next if $entry =~ /^\.\.?$/;
++ $entry =~ /^(.*)$/s; $entry = $1; # untaint
++ $count += _rmtree $entry, "$prefix$path/", '..', $dev, $ino,
++ $verbose, $safe;
++ }
++
++ closedir $dir;
++ }
++
++ # restore directory permissions if required (in case the rmdir
++ # below fails) now, while we're still in the directory and may do
++ # so without a race via '.'
++ unless ($nperm == $perm or chmod $perm, '.')
++ {
++ carp "Can't restore permissions on directory $prefix$path ($!)";
++ }
++
++ # don't leave the caller in an unexpected directory
++ unless (chdir $up)
++ {
++ croak "Can't return to $up from $prefix$path ($!)";
++ }
++
++ # ensure that a chdir .. didn't take us somewhere other than
++ # where we expected (see CVE-2002-0435)
++ unless (($new_dev, $new_ino) = stat '.'
++ and "$new_dev:$new_ino" eq "$up_dev:$up_ino")
++ {
++ croak "Previous directory $up changed since entering $prefix$path";
++ }
++
++ print "rmdir $prefix$path\n" if $verbose;
++ if (rmdir $path)
++ {
++ $count++;
++ }
++ else
++ {
++ carp "Can't remove directory $prefix$path ($!)";
++ }
++
++ return $count;
++}
++
++sub rmtree
++{
++ my ($p, $verbose, $safe) = @_;
++ $p = [] unless defined $p and length $p;
++ $p = [ $p ] unless ref $p;
++ my @paths = grep defined && length, @$p;
++
++ # default to "unsafe" for non-root (will chmod dirs)
++ $safe = $> ? 0 : 1 unless defined $safe;
++
++ unless (@paths)
++ {
++ carp "No root path(s) specified";
++ return;
++ }
++
++ my $oldpwd = getcwd or do {
++ carp "Can't fetch initial working directory";
++ return;
++ };
++
++ my ($dev, $ino) = stat '.' or do {
++ carp "Can't stat initial working directory";
++ return;
++ };
++
++ # untaint
++ for ($oldpwd) { /^(.*)$/s; $_ = $1 }
++
++ my $count = 0;
++ for my $path (@paths)
++ {
++ $count += _rmtree $path, '', $oldpwd, $dev, $ino, $verbose, $safe;
+ }
+
+ $count;
diff --git a/dev-lang/perl/files/perl-5.8.8-CVE-2008-1927.patch b/dev-lang/perl/files/perl-5.8.8-CVE-2008-1927.patch
new file mode 100644
index 000000000..470005804
--- /dev/null
+++ b/dev-lang/perl/files/perl-5.8.8-CVE-2008-1927.patch
@@ -0,0 +1,256 @@
+Fix a double free / segfault with utf8 regexps
+Debian #454792
+[rt.cpan.org #48156]
+[rt.cpan.org #40641]
+upstream change 29204
+
+UTF8_ALLOW_DEFAULT definition in utf8.h picked from upstream change 27688
+
+diff --git a/embed.fnc b/embed.fnc
+index edfbc0e..26524c7 100644
+--- a/embed.fnc
++++ b/embed.fnc
+@@ -1168,6 +1168,7 @@ Es |void |reguni |NN const struct RExC_state_t *state|UV uv|NN char *s|NN STRLE
+ Es |regnode*|regclass |NN struct RExC_state_t *state
+ ERs |I32 |regcurly |NN const char *
+ Es |regnode*|reg_node |NN struct RExC_state_t *state|U8 op
++Es |UV |reg_recode |const char value|NULLOK SV **encp
+ Es |regnode*|regpiece |NN struct RExC_state_t *state|NN I32 *flagp
+ Es |void |reginsert |NN struct RExC_state_t *state|U8 op|NN regnode *opnd
+ Es |void |regoptail |NN struct RExC_state_t *state|NN regnode *p|NN regnode *val
+diff --git a/embed.h b/embed.h
+index 2b38fd5..372b04f 100644
+--- a/embed.h
++++ b/embed.h
+@@ -1234,6 +1234,7 @@
+ #define regclass S_regclass
+ #define regcurly S_regcurly
+ #define reg_node S_reg_node
++#define reg_recode S_reg_recode
+ #define regpiece S_regpiece
+ #define reginsert S_reginsert
+ #define regoptail S_regoptail
+@@ -3277,6 +3278,7 @@
+ #define regclass(a) S_regclass(aTHX_ a)
+ #define regcurly(a) S_regcurly(aTHX_ a)
+ #define reg_node(a,b) S_reg_node(aTHX_ a,b)
++#define reg_recode(a,b) S_reg_recode(aTHX_ a,b)
+ #define regpiece(a,b) S_regpiece(aTHX_ a,b)
+ #define reginsert(a,b,c) S_reginsert(aTHX_ a,b,c)
+ #define regoptail(a,b,c) S_regoptail(aTHX_ a,b,c)
+diff --git a/pod/perldiag.pod b/pod/perldiag.pod
+index 9b3134c..7d95216 100644
+--- a/pod/perldiag.pod
++++ b/pod/perldiag.pod
+@@ -1900,6 +1900,15 @@ recognized by Perl or by a user-supplied handler. See L<attributes>.
+ (W printf) Perl does not understand the given format conversion. See
+ L<perlfunc/sprintf>.
+
++=item Invalid escape in the specified encoding in regex; marked by <-- HERE in m/%s/
++
++(W regexp) The numeric escape (for example C<\xHH>) of value < 256
++didn't correspond to a single character through the conversion
++from the encoding specified by the encoding pragma.
++The escape was replaced with REPLACEMENT CHARACTER (U+FFFD) instead.
++The <-- HERE shows in the regular expression about where the
++escape was discovered.
++
+ =item Invalid [] range "%s" in regex; marked by <-- HERE in m/%s/
+
+ (F) The range specified in a character class had a minimum character
+diff --git a/proto.h b/proto.h
+index 6d185dd..ef6c0cf 100644
+--- a/proto.h
++++ b/proto.h
+@@ -1748,6 +1748,7 @@ STATIC I32 S_regcurly(pTHX_ const char *)
+ __attribute__warn_unused_result__;
+
+ STATIC regnode* S_reg_node(pTHX_ struct RExC_state_t *state, U8 op);
++STATIC UV S_reg_recode(pTHX_ const char value, SV **encp);
+ STATIC regnode* S_regpiece(pTHX_ struct RExC_state_t *state, I32 *flagp);
+ STATIC void S_reginsert(pTHX_ struct RExC_state_t *state, U8 op, regnode *opnd);
+ STATIC void S_regoptail(pTHX_ struct RExC_state_t *state, regnode *p, regnode *val);
+diff --git a/regcomp.c b/regcomp.c
+index 928cf39..98d48dd 100644
+--- a/regcomp.c
++++ b/regcomp.c
+@@ -2791,6 +2791,39 @@ S_regpiece(pTHX_ RExC_state_t *pRExC_state, I32 *flagp)
+ }
+
+ /*
++ * reg_recode
++ *
++ * It returns the code point in utf8 for the value in *encp.
++ * value: a code value in the source encoding
++ * encp: a pointer to an Encode object
++ *
++ * If the result from Encode is not a single character,
++ * it returns U+FFFD (Replacement character) and sets *encp to NULL.
++ */
++STATIC UV
++S_reg_recode(pTHX_ const char value, SV **encp)
++{
++ STRLEN numlen = 1;
++ SV * const sv = sv_2mortal(newSVpvn(&value, numlen));
++ const char * const s = encp && *encp ? sv_recode_to_utf8(sv, *encp)
++ : SvPVX(sv);
++ const STRLEN newlen = SvCUR(sv);
++ UV uv = UNICODE_REPLACEMENT;
++
++ if (newlen)
++ uv = SvUTF8(sv)
++ ? utf8n_to_uvchr((U8*)s, newlen, &numlen, UTF8_ALLOW_DEFAULT)
++ : *(U8*)s;
++
++ if (!newlen || numlen != newlen) {
++ uv = UNICODE_REPLACEMENT;
++ if (encp)
++ *encp = NULL;
++ }
++ return uv;
++}
++
++/*
+ - regatom - the lowest level
+ *
+ * Optimization: gobbles an entire sequence of ordinary characters so that
+@@ -3182,6 +3215,8 @@ tryagain:
+ ender = grok_hex(p, &numlen, &flags, NULL);
+ p += numlen;
+ }
++ if (PL_encoding && ender < 0x100)
++ goto recode_encoding;
+ break;
+ case 'c':
+ p++;
+@@ -3201,6 +3236,17 @@ tryagain:
+ --p;
+ goto loopdone;
+ }
++ if (PL_encoding && ender < 0x100)
++ goto recode_encoding;
++ break;
++ recode_encoding:
++ {
++ SV* enc = PL_encoding;
++ ender = reg_recode((const char)(U8)ender, &enc);
++ if (!enc && SIZE_ONLY && ckWARN(WARN_REGEXP))
++ vWARN(p, "Invalid escape in the specified encoding");
++ RExC_utf8 = 1;
++ }
+ break;
+ case '\0':
+ if (p >= RExC_end)
+@@ -3331,32 +3377,6 @@ tryagain:
+ break;
+ }
+
+- /* If the encoding pragma is in effect recode the text of
+- * any EXACT-kind nodes. */
+- if (PL_encoding && PL_regkind[(U8)OP(ret)] == EXACT) {
+- STRLEN oldlen = STR_LEN(ret);
+- SV *sv = sv_2mortal(newSVpvn(STRING(ret), oldlen));
+-
+- if (RExC_utf8)
+- SvUTF8_on(sv);
+- if (sv_utf8_downgrade(sv, TRUE)) {
+- const char * const s = sv_recode_to_utf8(sv, PL_encoding);
+- const STRLEN newlen = SvCUR(sv);
+-
+- if (SvUTF8(sv))
+- RExC_utf8 = 1;
+- if (!SIZE_ONLY) {
+- DEBUG_r(PerlIO_printf(Perl_debug_log, "recode %*s to %*s\n",
+- (int)oldlen, STRING(ret),
+- (int)newlen, s));
+- Copy(s, STRING(ret), newlen, char);
+- STR_LEN(ret) += newlen - oldlen;
+- RExC_emit += STR_SZ(newlen) - STR_SZ(oldlen);
+- } else
+- RExC_size += STR_SZ(newlen) - STR_SZ(oldlen);
+- }
+- }
+-
+ return(ret);
+ }
+
+@@ -3734,6 +3754,8 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state)
+ value = grok_hex(RExC_parse, &numlen, &flags, NULL);
+ RExC_parse += numlen;
+ }
++ if (PL_encoding && value < 0x100)
++ goto recode_encoding;
+ break;
+ case 'c':
+ value = UCHARAT(RExC_parse++);
+@@ -3741,13 +3763,24 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state)
+ break;
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+- {
+- I32 flags = 0;
+- numlen = 3;
+- value = grok_oct(--RExC_parse, &numlen, &flags, NULL);
+- RExC_parse += numlen;
+- break;
+- }
++ {
++ I32 flags = 0;
++ numlen = 3;
++ value = grok_oct(--RExC_parse, &numlen, &flags, NULL);
++ RExC_parse += numlen;
++ if (PL_encoding && value < 0x100)
++ goto recode_encoding;
++ break;
++ }
++ recode_encoding:
++ {
++ SV* enc = PL_encoding;
++ value = reg_recode((const char)(U8)value, &enc);
++ if (!enc && SIZE_ONLY && ckWARN(WARN_REGEXP))
++ vWARN(RExC_parse,
++ "Invalid escape in the specified encoding");
++ break;
++ }
+ default:
+ if (!SIZE_ONLY && isALPHA(value) && ckWARN(WARN_REGEXP))
+ vWARN2(RExC_parse,
+diff --git a/t/uni/tr_utf8.t b/t/uni/tr_utf8.t
+index 606a84a..354156a 100755
+--- a/t/uni/tr_utf8.t
++++ b/t/uni/tr_utf8.t
+@@ -31,7 +31,7 @@ BEGIN {
+ }
+
+ use strict;
+-use Test::More tests => 7;
++use Test::More tests => 8;
+
+ use encoding 'utf8';
+
+@@ -67,4 +67,12 @@ is($str, $hiragana, "s/// # hiragana -> katakana");
+ $line =~ tr/bcdeghijklmnprstvwxyz$02578/בצדעגהיײקלמנפּרסטװשכיזשױתײחא/;
+ is($line, "aבצדעfגהיײקלמנoפqּרסuטװשכיזש1ױ34ת6ײח9", "[perl #16843]");
+ }
++
++{
++ # [perl #40641]
++ my $str = qq/Gebääääääääääääääääääääude/;
++ my $reg = qr/Gebääääääääääääääääääääude/;
++ ok($str =~ /$reg/, "[perl #40641]");
++}
++
+ __END__
+diff --git a/utf8.h b/utf8.h
+index 6d63897..3800866 100644
+--- a/utf8.h
++++ b/utf8.h
+@@ -198,6 +198,8 @@ encoded character.
+ UTF8_ALLOW_SURROGATE|UTF8_ALLOW_FFFF)
+ #define UTF8_ALLOW_ANY 0x00FF
+ #define UTF8_CHECK_ONLY 0x0200
++#define UTF8_ALLOW_DEFAULT (ckWARN(WARN_UTF8) ? 0 : \
++ UTF8_ALLOW_ANYUV)
+
+ #define UNICODE_SURROGATE_FIRST 0xD800
+ #define UNICODE_SURROGATE_LAST 0xDFFF
diff --git a/dev-lang/perl/files/perl-5.8.8-USE_MM_LD_RUN_PATH.patch b/dev-lang/perl/files/perl-5.8.8-USE_MM_LD_RUN_PATH.patch
new file mode 100644
index 000000000..edcfc6a41
--- /dev/null
+++ b/dev-lang/perl/files/perl-5.8.8-USE_MM_LD_RUN_PATH.patch
@@ -0,0 +1,111 @@
+diff -Naurp perl-5.8.8-orig/lib/ExtUtils/Liblist.pm perl-5.8.8/lib/ExtUtils/Liblist.pm
+--- perl-5.8.8-orig/lib/ExtUtils/Liblist.pm 2003-04-07 14:58:17.000000000 -0400
++++ perl-5.8.8/lib/ExtUtils/Liblist.pm 2006-02-07 09:57:04.000000000 -0500
+@@ -87,6 +87,11 @@ libraries. LD_RUN_PATH is a colon separ
+ in LDLOADLIBS. It is passed as an environment variable to the process
+ that links the shared library.
+
++The Red Hat extension: This generation of LD_RUN_PATH is disabled by default.
++To use the generated LD_RUN_PATH for all links, set the USE_MM_LD_RUN_PATH
++MakeMaker object attribute / argument, (or set the $USE_MM_LD_RUN_PATH
++environment variable).
++
+ =head2 BSLOADLIBS
+
+ List of those libraries that are needed but can be linked in
+diff -Naurp perl-5.8.8-orig/lib/ExtUtils/MM_Unix.pm perl-5.8.8/lib/ExtUtils/MM_Unix.pm
+--- perl-5.8.8-orig/lib/ExtUtils/MM_Unix.pm 2005-05-21 05:42:56.000000000 -0400
++++ perl-5.8.8/lib/ExtUtils/MM_Unix.pm 2006-02-07 09:56:08.000000000 -0500
+@@ -941,7 +941,7 @@ $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $
+ }
+
+ my $ld_run_path_shell = "";
+- if ($self->{LD_RUN_PATH} ne "") {
++ if (($self->{LD_RUN_PATH} ne "") && ($self->{USE_MM_LD_RUN_PATH})) {
+ $ld_run_path_shell = 'LD_RUN_PATH="$(LD_RUN_PATH)" ';
+ }
+
+diff -Naurp perl-5.8.8-orig/lib/ExtUtils/MakeMaker.pm perl-5.8.8/lib/ExtUtils/MakeMaker.pm
+--- perl-5.8.8-orig/lib/ExtUtils/MakeMaker.pm 2005-10-21 10:11:04.000000000 -0400
++++ perl-5.8.8/lib/ExtUtils/MakeMaker.pm 2006-02-07 09:55:03.000000000 -0500
+@@ -233,7 +233,7 @@ sub full_setup {
+ PERL_SRC PERM_RW PERM_RWX
+ PL_FILES PM PM_FILTER PMLIBDIRS POLLUTE PPM_INSTALL_EXEC
+ PPM_INSTALL_SCRIPT PREREQ_FATAL PREREQ_PM PREREQ_PRINT PRINT_PREREQ
+- SIGN SKIP TYPEMAPS VERSION VERSION_FROM XS XSOPT XSPROTOARG
++ SKIP TYPEMAPS USE_MM_LD_RUN_PATH VERSION VERSION_FROM XS XSOPT XSPROTOARG
+ XS_VERSION clean depend dist dynamic_lib linkext macro realclean
+ tool_autosplit
+
+@@ -371,6 +371,26 @@ sub new {
+ exit 0;
+ }
+
++ # USE_MM_LD_RUN_PATH - borrowed from RedHat to disable automatic RPATH generation
++ if ( ( ! $self->{USE_MM_LD_RUN_PATH} )
++ &&( ("@ARGV" =~ /\bUSE_MM_LD_RUN_PATH(=([01]))?\b/)
++ ||( exists( $ENV{USE_MM_LD_RUN_PATH} )
++ &&( $ENV{USE_MM_LD_RUN_PATH} =~ /([01])?$/ )
++ )
++ )
++ )
++ {
++ my $v = $1;
++ if( $v )
++ {
++ $v = ($v=~/=([01])$/)[0];
++ }else
++ {
++ $v = 1;
++ };
++ $self->{USE_MM_LD_RUN_PATH}=$v;
++ };
++
+ print STDOUT "MakeMaker (v$VERSION)\n" if $Verbose;
+ if (-f "MANIFEST" && ! -f "Makefile"){
+ check_manifest();
+@@ -2057,6 +2077,44 @@ precedence. A typemap in the current di
+ precedence, even if it isn't listed in TYPEMAPS. The default system
+ typemap has lowest precedence.
+
++=item USE_MM_LD_RUN_PATH
++
++boolean
++This feature is borrowed from Red Hat to deal with RPATH issues.
++Please see bug 81745 - http://bugs.gentoo.org/81745 - for more
++information.
++
++The Red Hat perl MakeMaker distribution differs from the standard
++upstream release in that it disables use of the MakeMaker generated
++LD_RUN_PATH by default, UNLESS this attribute is specified , or the
++USE_MM_LD_RUN_PATH environment variable is set during the MakeMaker run.
++
++The upstream MakeMaker will set the ld(1) environment variable LD_RUN_PATH
++to the concatenation of every -L ld(1) option directory in which a -l ld(1)
++option library is found, which is used as the ld(1) -rpath option if none
++is specified. This means that, if your application builds shared libraries
++and your MakeMaker application links to them, that the absolute paths of the
++libraries in the build tree will be inserted into the RPATH header of all
++MakeMaker generated binaries, and that such binaries will be unable to link
++to these libraries if they do not still reside in the build tree directories
++(unlikely) or in the system library directories (/lib or /usr/lib), regardless
++of any LD_LIBRARY_PATH setting. So if you specified -L../mylib -lmylib , and
++your 'libmylib.so' gets installed into /some_directory_other_than_usr_lib,
++your MakeMaker application will be unable to link to it, even if LD_LIBRARY_PATH
++is set to include /some_directory_other_than_usr_lib, because RPATH overrides
++LD_LIBRARY_PATH.
++
++So for Red Hat MakeMaker builds LD_RUN_PATH is NOT generated by default for
++every link. You can still use explicit -rpath ld options or the LD_RUN_PATH
++environment variable during the build to generate an RPATH for the binaries.
++
++You can set the USE_MM_LD_RUN_PATH attribute to 1 on the MakeMaker command
++line or in the WriteMakefile arguments to enable generation of LD_RUN_PATH
++for every link command.
++
++USE_MM_LD_RUN_PATH will default to 1 (LD_RUN_PATH will be used) IF the
++$USE_MM_LD_RUN_PATH environment variable is set during a MakeMaker run.
++
+ =item VENDORPREFIX
+
+ Like PERLPREFIX, but only for the vendor install locations.
diff --git a/dev-lang/perl/files/perl-5.8.8-asm-page-h-compile-failure.patch b/dev-lang/perl/files/perl-5.8.8-asm-page-h-compile-failure.patch
new file mode 100644
index 000000000..325caafc8
--- /dev/null
+++ b/dev-lang/perl/files/perl-5.8.8-asm-page-h-compile-failure.patch
@@ -0,0 +1,12 @@
+--- perl-5.8.8/ext/IPC/SysV/SysV.xs.no_asm_page_h 2001-06-30 14:46:07.000000000 -0400
++++ perl-5.8.8/ext/IPC/SysV/SysV.xs 2006-06-02 17:37:22.000000000 -0400
+@@ -3,9 +3,6 @@
+ #include "XSUB.h"
+
+ #include <sys/types.h>
+-#ifdef __linux__
+-# include <asm/page.h>
+-#endif
+ #if defined(HAS_MSG) || defined(HAS_SEM) || defined(HAS_SHM)
+ #ifndef HAS_SEM
+ # include <sys/ipc.h>
diff --git a/dev-lang/perl/files/perl-5.8.8-cplusplus.patch b/dev-lang/perl/files/perl-5.8.8-cplusplus.patch
new file mode 100644
index 000000000..064bda422
--- /dev/null
+++ b/dev-lang/perl/files/perl-5.8.8-cplusplus.patch
@@ -0,0 +1,22 @@
+--- perl.h.orig 2006-03-29 08:53:46.000000000 -0500
++++ perl.h 2006-03-29 08:54:19.000000000 -0500
+@@ -159,7 +159,7 @@ struct perl_thread;
+ #endif
+
+ #ifndef PERL_UNUSED_DECL
+-# ifdef HASATTRIBUTE_UNUSED
++# if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
+ # define PERL_UNUSED_DECL __attribute__unused__
+ # else
+ # define PERL_UNUSED_DECL
+--- XSUB.h.orig 2006-03-29 08:54:24.000000000 -0500
++++ XSUB.h 2006-03-29 08:54:48.000000000 -0500
+@@ -91,7 +91,7 @@ handled automatically by C<xsubpp>.
+ #if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
+ # define XS(name) __declspec(dllexport) void name(pTHX_ CV* cv)
+ #else
+-# ifdef HASATTRIBUTE_UNUSED
++# if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
+ # define XS(name) void name(pTHX_ CV* cv __attribute__unused__)
+ # else
+ # define XS(name) void name(pTHX_ CV* cv)
diff --git a/dev-lang/perl/files/perl-5.8.8-dragonfly-clean.patch b/dev-lang/perl/files/perl-5.8.8-dragonfly-clean.patch
new file mode 100644
index 000000000..52f32bf5e
--- /dev/null
+++ b/dev-lang/perl/files/perl-5.8.8-dragonfly-clean.patch
@@ -0,0 +1,170 @@
+Index: perl-5.8.8/Configure
+===================================================================
+--- perl-5.8.8.orig/Configure 2006-01-08 14:51:03 +0000
++++ perl-5.8.8/Configure 2006-02-14 13:41:41 +0000
+@@ -3130,6 +3130,8 @@
+ dgux) osname=dgux
+ osvers="$3"
+ ;;
++ dragonfly) osname=dragonfly
++ osvers="$3" ;;
+ dynixptx*) osname=dynixptx
+ osvers=`echo "$4"|sed 's/^v//'`
+ ;;
+@@ -7889,7 +7891,7 @@
+ solaris)
+ xxx="-R $shrpdir"
+ ;;
+- freebsd|netbsd|openbsd|interix)
++ freebsd|netbsd|openbsd|dragonfly|interix)
+ xxx="-Wl,-R$shrpdir"
+ ;;
+ bsdos|linux|irix*|dec_osf|gnu*)
+Index: perl-5.8.8/Makefile.SH
+===================================================================
+--- perl-5.8.8.orig/Makefile.SH 2006-01-24 12:49:44 +0000
++++ perl-5.8.8/Makefile.SH 2006-02-14 13:46:57 +0000
+@@ -73,7 +73,7 @@
+ sunos*)
+ linklibperl="-lperl"
+ ;;
+- netbsd*|freebsd[234]*|openbsd*)
++ netbsd*|freebsd[234]*|openbsd*|dragonfly*)
+ linklibperl="-L. -lperl"
+ ;;
+ interix*)
+@@ -990,6 +990,10 @@
+ n_dummy $(nonxs_ext): miniperl$(EXE_EXT) preplibrary $(DYNALOADER) FORCE
+ @$(LDLIBPTH) sh ext/util/make_ext nonxs $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
+
++.PHONY: printconfig
++printconfig:
++ @eval `$(LDLIBPTH) ./perl -Ilib -V:$(CONFIGVAR)`; echo $$$(CONFIGVAR)
++
+ .PHONY: clean _tidy _mopup _cleaner1 _cleaner2 \
+ realclean _realcleaner clobber _clobber \
+ distclean veryclean _verycleaner
+Index: perl-5.8.8/hints/dragonfly.sh
+===================================================================
+--- perl-5.8.8.orig/hints/dragonfly.sh 1970-01-01 00:00:00 +0000
++++ perl-5.8.8/hints/dragonfly.sh 2006-02-14 13:15:04 +0000
+@@ -0,0 +1,118 @@
++# hints/dragonfly.sh
++#
++# This file is mostly copied from hints/freebsd.sh with the OS version
++# information taken out and only the FreeBSD-4 information intact.
++# Please check with Todd Willey <xtoddx@gmail.com> before making
++# modifications to this file.
++
++case "$osvers" in
++*) usevfork='true'
++ case "$usemymalloc" in
++ "") usemymalloc='n'
++ ;;
++ esac
++ libswanted=`echo $libswanted | sed 's/ malloc / /'`
++ ;;
++esac
++
++# Dynamic Loading flags have not changed much, so they are separated
++# out here to avoid duplicating them everywhere.
++case "$osvers" in
++*)
++ objformat=`/usr/bin/objformat`
++ if [ x$objformat = xelf ]; then
++ libpth="/usr/lib /usr/local/lib"
++ glibpth="/usr/lib /usr/local/lib"
++ ldflags="-Wl,-E "
++ lddlflags="-shared "
++ else
++ if [ -e /usr/lib/aout ]; then
++ libpth="/usr/lib/aout /usr/local/lib /usr/lib"
++ glibpth="/usr/lib/aout /usr/local/lib /usr/lib"
++ fi
++ lddlflags='-Bshareable'
++ fi
++ cccdlflags='-DPIC -fPIC'
++ ;;
++esac
++
++case "$osvers" in
++*)
++ ccflags="${ccflags} -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H"
++ if /usr/bin/file -L /usr/lib/libc.so | /usr/bin/grep -vq "not stripped" ; then
++ usenm=false
++ fi
++ ;;
++esac
++
++cat <<'EOM' >&4
++
++Some users have reported that Configure halts when testing for
++the O_NONBLOCK symbol with a syntax error. This is apparently a
++sh error. Rerunning Configure with ksh apparently fixes the
++problem. Try
++ ksh Configure [your options]
++
++EOM
++
++# From: Anton Berezin <tobez@plab.ku.dk>
++# To: perl5-porters@perl.org
++# Subject: [PATCH 5.005_54] Configure - hints/freebsd.sh signal handler type
++# Date: 30 Nov 1998 19:46:24 +0100
++# Message-ID: <864srhhvcv.fsf@lion.plab.ku.dk>
++
++signal_t='void'
++d_voidsig='define'
++
++# This script UU/usethreads.cbu will get 'called-back' by Configure
++# after it has prompted the user for whether to use threads.
++cat > UU/usethreads.cbu <<'EOCBU'
++case "$usethreads" in
++$define|true|[yY]*)
++ lc_r=`/sbin/ldconfig -r|grep ':-lc_r'|awk '{print $NF}'|sed -n '$p'`
++ case "$osvers" in
++ *)
++ if [ ! -r "$lc_r" ]; then
++ cat <<EOM >&4
++POSIX threads should be supported by FreeBSD $osvers --
++but your system is missing the shared libc_r.
++(/sbin/ldconfig -r doesn't find any).
++
++Consider using the latest STABLE release.
++EOM
++ exit 1
++ fi
++ case "$osvers" in
++ *) ldflags="-pthread $ldflags"
++ ;;
++ esac
++ # Both in 4.x and 5.x gethostbyaddr_r exists but
++ # it is "Temporary function, not threadsafe"...
++ # Presumably earlier it didn't even exist.
++ d_gethostbyaddr_r="undef"
++ d_gethostbyaddr_r_proto="0"
++ ;;
++
++ esac
++
++ set `echo X "$libswanted "| sed -e 's/ c / c_r /'`
++ shift
++ libswanted="$*"
++ # Configure will probably pick the wrong libc to use for nm scan.
++ # The safest quick-fix is just to not use nm at all...
++ usenm=false
++
++ unset lc_r
++
++ # Even with the malloc mutexes the Perl malloc does not
++ # seem to be threadsafe in FreeBSD?
++ case "$usemymalloc" in
++ '') usemymalloc=n ;;
++ esac
++esac
++EOCBU
++
++# malloc wrap works
++case "$usemallocwrap" in
++'') usemallocwrap='define' ;;
++esac
+
diff --git a/dev-lang/perl/files/perl-5.8.8-fbsdhints.patch b/dev-lang/perl/files/perl-5.8.8-fbsdhints.patch
new file mode 100644
index 000000000..7dc1a65b9
--- /dev/null
+++ b/dev-lang/perl/files/perl-5.8.8-fbsdhints.patch
@@ -0,0 +1,57 @@
+Index: perl-5.8.8/hints/freebsd.sh
+===================================================================
+--- perl-5.8.8.orig/hints/freebsd.sh
++++ perl-5.8.8/hints/freebsd.sh
+@@ -88,6 +88,8 @@ case "$osvers" in
+ esac
+ libswanted=`echo $libswanted | sed 's/ malloc / /'`
+ libswanted=`echo $libswanted | sed 's/ bind / /'`
++ libswanted=`echo $libswanted | sed 's/ dl / /'`
++ libswanted=`echo $libswanted | sed 's/ c / /'`
+ # iconv gone in Perl 5.8.1, but if someone compiles 5.8.0 or earlier.
+ libswanted=`echo $libswanted | sed 's/ iconv / /'`
+ d_setregid='define'
+@@ -102,6 +104,10 @@ case "$osvers" in
+ ;;
+ esac
+ libswanted=`echo $libswanted | sed 's/ malloc / /'`
++ libswanted=`echo $libswanted | sed 's/ bind / /'`
++ libswanted=`echo $libswanted | sed 's/ dl / /'`
++ libswanted=`echo $libswanted | sed 's/ iconv / /'`
++ libswanted=`echo $libswanted | sed 's/ c / /'`
+ ;;
+ esac
+
+@@ -116,17 +122,17 @@ case "$osvers" in
+
+ *)
+ objformat=`/usr/bin/objformat`
+- if [ x$objformat = xelf ]; then
+- libpth="/usr/lib /usr/local/lib"
+- glibpth="/usr/lib /usr/local/lib"
+- ldflags="-Wl,-E "
+- lddlflags="-shared "
+- else
++ if [ x$objformat = xaout ]; then
+ if [ -e /usr/lib/aout ]; then
+ libpth="/usr/lib/aout /usr/local/lib /usr/lib"
+ glibpth="/usr/lib/aout /usr/local/lib /usr/lib"
+ fi
+ lddlflags='-Bshareable'
++ else
++ libpth="/usr/lib /usr/local/lib"
++ glibpth="/usr/lib /usr/local/lib"
++ ldflags="-Wl,-E"
++ lddlflags="-shared "
+ fi
+ cccdlflags='-DPIC -fPIC'
+ ;;
+@@ -137,7 +143,7 @@ case "$osvers" in
+
+ *)
+ ccflags="${ccflags} -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H"
+- if /usr/bin/file -L /usr/lib/libc.so | /usr/bin/grep -vq "not stripped" ; then
++ if /usr/bin/file -L /usr/lib/libc.so | grep -vq "not stripped" ; then
+ usenm=false
+ fi
+ ;;
diff --git a/dev-lang/perl/files/perl-5.8.8-fix_file_path_chdir.patch b/dev-lang/perl/files/perl-5.8.8-fix_file_path_chdir.patch
new file mode 100644
index 000000000..c75aa8936
--- /dev/null
+++ b/dev-lang/perl/files/perl-5.8.8-fix_file_path_chdir.patch
@@ -0,0 +1,72 @@
+ExtUtils/Command.pm (among other things) expects to be able to destroy
+a strangely-permissioned testdir. This is a backport of the chdir/chmod
+work performed in File::Path released in Perl 5.10.0.
+
+--- perl-5.8.7.orig/lib/File/Path.pm 2008-12-05 13:23:32.000000000 -0800
++++ perl-5.8.7/lib/File/Path.pm 2008-12-05 13:33:13.000000000 -0800
+@@ -162,7 +162,7 @@
+ {
+ my ($path, $prefix, $up, $up_dev, $up_ino, $verbose, $safe) = @_;
+
+- my ($dev, $ino) = lstat $path or return 0;
++ my ($dev, $ino, $perm) = lstat $path or return 0;
+ unless (-d _)
+ {
+ print "unlink $prefix$path\n" if $verbose;
+@@ -175,15 +175,25 @@
+ return 1;
+ }
+
+- unless (chdir $path)
+- {
++ if (!chdir($path)) {
++ # see if we can escalate privileges to get in
++ # (e.g. funny protection mask such as -w- instead of rwx)
++ $perm &= 07777;
++ my $nperm = $perm | 0700;
++ if (!($safe or $nperm == $perm or chmod($nperm, $path))) {
++ carp "cannot make $prefix$path read-write-exec";
++ return 0;
++ }
++ elsif (!chdir($path)) {
+ carp "Can't chdir to $prefix$path ($!)";
+ return 0;
++ }
+ }
+
+ # avoid a race condition where a directory may be replaced by a
+ # symlink between the lstat and the chdir
+- my ($new_dev, $new_ino, $perm) = stat '.';
++ my ($new_dev, $new_ino);
++ ($new_dev, $new_ino, $perm) = stat '.';
+ unless ("$new_dev:$new_ino" eq "$dev:$ino")
+ {
+ croak "Directory $prefix$path changed before chdir, aborting";
+--- perl-5.8.8.orig/lib/ExtUtils/t/Command.t
++++ perl-5.8.8/lib/ExtUtils/t/Command.t
+@@ -23,7 +23,7 @@
+ }
+
+ BEGIN {
+- use Test::More tests => 38;
++ use Test::More tests => 39;
+ use File::Spec;
+ }
+
+@@ -148,7 +148,7 @@
+ $^O eq 'NetWare' || $^O eq 'dos' || $^O eq 'cygwin' ||
+ $^O eq 'MacOS'
+ ) {
+- skip( "different file permission semantics on $^O", 4);
++ skip( "different file permission semantics on $^O", 5);
+ }
+
+ @ARGV = ('testdir');
+@@ -178,6 +178,7 @@
+
+ @ARGV = ('testdir');
+ rm_rf;
++ ok( ! -e 'testdir', 'rm_rf can delete a read-only dir' );
+ }
+
+
diff --git a/dev-lang/perl/files/perl-5.8.8-gcc42-command-line.patch b/dev-lang/perl/files/perl-5.8.8-gcc42-command-line.patch
new file mode 100644
index 000000000..6904136c7
--- /dev/null
+++ b/dev-lang/perl/files/perl-5.8.8-gcc42-command-line.patch
@@ -0,0 +1,11 @@
+diff -Naur perl-5.8.8-orig/makedepend.SH perl-5.8.8/makedepend.SH
+--- perl-5.8.8-orig/makedepend.SH 2006-10-01 20:05:40.000000000 -0600
++++ perl-5.8.8/makedepend.SH 2006-10-01 20:07:03.000000000 -0600
+@@ -167,6 +167,7 @@
+ -e '/^#.*<builtin>/d' \
+ -e '/^#.*<built-in>/d' \
+ -e '/^#.*<command line>/d' \
++ -e '/^#.*<command-line>/d' \
+ -e '/^#.*"-"/d' \
+ -e '/: file path prefix .* never used$/d' \
+ -e 's#\.[0-9][0-9]*\.c#'"$file.c#" \
diff --git a/dev-lang/perl/files/perl-5.8.8-lib32.patch b/dev-lang/perl/files/perl-5.8.8-lib32.patch
new file mode 100644
index 000000000..88d5049ba
--- /dev/null
+++ b/dev-lang/perl/files/perl-5.8.8-lib32.patch
@@ -0,0 +1,76 @@
+--- a/Configure
++++ b/Configure
+@@ -1255,12 +1255,12 @@ libnames=''
+ : change the next line if compiling for Xenix/286 on Xenix/386
+ xlibpth='/usr/lib/386 /lib/386'
+ : Possible local library directories to search.
+-loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
+-loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
++loclibpth="/usr/local/lib32 /opt/local/lib32 /usr/gnu/lib32"
++loclibpth="$loclibpth /opt/gnu/lib32 /usr/GNU/lib32 /opt/GNU/lib32"
+
+ : general looking path for locating libraries
+-glibpth="/lib /usr/lib $xlibpth"
+-glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
++glibpth="/lib32 /usr/lib32 $xlibpth"
++glibpth="$glibpth /usr/ccs/lib32 /usr/ucblib /usr/local/lib32"
+ test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
+ test -f /shlib/libc.so && glibpth="/shlib $glibpth"
+
+@@ -5945,8 +5945,8 @@ fi
+ : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
+ case "$installstyle" in
+ '') case "$prefix" in
+- *perl*) dflt='lib';;
+- *) dflt='lib/perl5' ;;
++ *perl*) dflt='lib32';;
++ *) dflt='lib32/perl5' ;;
+ esac
+ ;;
+ *) dflt="$installstyle" ;;
+@@ -5962,8 +5962,8 @@ installstyle=$dflt
+ : /opt/perl/lib/perl5... would be redundant.
+ : The default "style" setting is made in installstyle.U
+ case "$installstyle" in
+-*lib/perl5*) set dflt privlib lib/$package/$version ;;
+-*) set dflt privlib lib/$version ;;
++*lib32/perl5*) set dflt privlib lib32/$package/$version ;;
++*) set dflt privlib lib32/$version ;;
+ esac
+ eval $prefixit
+ $cat <<EOM
+@@ -6465,8 +6465,8 @@ siteprefixexp="$ansexp"
+ prog=`echo $package | $sed 's/-*[0-9.]*$//'`
+ case "$sitelib" in
+ '') case "$installstyle" in
+- *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
+- *) dflt=$siteprefix/lib/site_$prog/$version ;;
++ *lib32/perl5*) dflt=$siteprefix/lib32/$package/site_$prog/$version ;;
++ *) dflt=$siteprefix/lib32/site_$prog/$version ;;
+ esac
+ ;;
+ *) dflt="$sitelib"
+@@ -6592,8 +6592,8 @@ case "$vendorprefix" in
+ '')
+ prog=`echo $package | $sed 's/-*[0-9.]*$//'`
+ case "$installstyle" in
+- *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
+- *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
++ *lib32/perl5*) dflt=$vendorprefix/lib32/$package/vendor_$prog/$version ;;
++ *) dflt=$vendorprefix/lib32/vendor_$prog/$version ;;
+ esac
+ ;;
+ *) dflt="$vendorlib"
+@@ -10550,9 +10550,9 @@ else
+ else
+ for net in net socket
+ do
+- if test -f /usr/lib/lib$net$_a; then
+- ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
+- $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
++ if test -f /usr/lib32/lib$net$_a; then
++ ( ($nm $nm_opt /usr/lib32/lib$net$_a | eval $nm_extract) || \
++ $ar t /usr/lib32/lib$net$_a) 2>/dev/null >> libc.list
+ if $contains socket libc.list >/dev/null 2>&1; then
+ d_socket="$define"
+ socketlib="-l$net"
diff --git a/dev-lang/perl/files/perl-5.8.8-lib64.patch b/dev-lang/perl/files/perl-5.8.8-lib64.patch
new file mode 100644
index 000000000..4cc3aeeea
--- /dev/null
+++ b/dev-lang/perl/files/perl-5.8.8-lib64.patch
@@ -0,0 +1,76 @@
+--- a/Configure
++++ b/Configure
+@@ -1255,12 +1255,12 @@ libnames=''
+ : change the next line if compiling for Xenix/286 on Xenix/386
+ xlibpth='/usr/lib/386 /lib/386'
+ : Possible local library directories to search.
+-loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
+-loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
++loclibpth="/usr/local/lib64 /opt/local/lib64 /usr/gnu/lib64"
++loclibpth="$loclibpth /opt/gnu/lib64 /usr/GNU/lib64 /opt/GNU/lib64"
+
+ : general looking path for locating libraries
+-glibpth="/lib /usr/lib $xlibpth"
+-glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
++glibpth="/lib64 /usr/lib64 $xlibpth"
++glibpth="$glibpth /usr/ccs/lib64 /usr/ucblib /usr/local/lib64"
+ test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
+ test -f /shlib/libc.so && glibpth="/shlib $glibpth"
+
+@@ -5945,8 +5945,8 @@ fi
+ : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
+ case "$installstyle" in
+ '') case "$prefix" in
+- *perl*) dflt='lib';;
+- *) dflt='lib/perl5' ;;
++ *perl*) dflt='lib64';;
++ *) dflt='lib64/perl5' ;;
+ esac
+ ;;
+ *) dflt="$installstyle" ;;
+@@ -5962,8 +5962,8 @@ installstyle=$dflt
+ : /opt/perl/lib/perl5... would be redundant.
+ : The default "style" setting is made in installstyle.U
+ case "$installstyle" in
+-*lib/perl5*) set dflt privlib lib/$package/$version ;;
+-*) set dflt privlib lib/$version ;;
++*lib64/perl5*) set dflt privlib lib64/$package/$version ;;
++*) set dflt privlib lib64/$version ;;
+ esac
+ eval $prefixit
+ $cat <<EOM
+@@ -6465,8 +6465,8 @@ siteprefixexp="$ansexp"
+ prog=`echo $package | $sed 's/-*[0-9.]*$//'`
+ case "$sitelib" in
+ '') case "$installstyle" in
+- *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
+- *) dflt=$siteprefix/lib/site_$prog/$version ;;
++ *lib64/perl5*) dflt=$siteprefix/lib64/$package/site_$prog/$version ;;
++ *) dflt=$siteprefix/lib64/site_$prog/$version ;;
+ esac
+ ;;
+ *) dflt="$sitelib"
+@@ -6592,8 +6592,8 @@ case "$vendorprefix" in
+ '')
+ prog=`echo $package | $sed 's/-*[0-9.]*$//'`
+ case "$installstyle" in
+- *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
+- *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
++ *lib64/perl5*) dflt=$vendorprefix/lib64/$package/vendor_$prog/$version ;;
++ *) dflt=$vendorprefix/lib64/vendor_$prog/$version ;;
+ esac
+ ;;
+ *) dflt="$vendorlib"
+@@ -10550,9 +10550,9 @@ else
+ else
+ for net in net socket
+ do
+- if test -f /usr/lib/lib$net$_a; then
+- ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
+- $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
++ if test -f /usr/lib64/lib$net$_a; then
++ ( ($nm $nm_opt /usr/lib64/lib$net$_a | eval $nm_extract) || \
++ $ar t /usr/lib64/lib$net$_a) 2>/dev/null >> libc.list
+ if $contains socket libc.list >/dev/null 2>&1; then
+ d_socket="$define"
+ socketlib="-l$net"
diff --git a/dev-lang/perl/files/perl-5.8.8-libbits.patch b/dev-lang/perl/files/perl-5.8.8-libbits.patch
new file mode 100644
index 000000000..963434d65
--- /dev/null
+++ b/dev-lang/perl/files/perl-5.8.8-libbits.patch
@@ -0,0 +1,96 @@
+--- Configure.orig 2006-02-03 16:15:00.000000000 -0500
++++ Configure 2006-02-03 16:25:04.000000000 -0500
+@@ -1256,17 +1256,24 @@ locincpth="$locincpth /opt/gnu/include /
+ : no include file wanted by default
+ inclwanted=''
+
++: determine libdir name
++: Should be */lib32 on x86-64, sparc64, ppc64
++case ${BITS} in
++ 32) lib='lib32';; 64) lib='lib64';;
++ *) lib='lib';;
++esac
++
+ groupstype=''
+ libnames=''
+ : change the next line if compiling for Xenix/286 on Xenix/386
+ xlibpth='/usr/lib/386 /lib/386'
+ : Possible local library directories to search.
+-loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
+-loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
++loclibpth="/usr/local/$lib /opt/local/$lib /usr/gnu/$lib"
++loclibpth="$loclibpth /opt/gnu/$lib /usr/GNU/$lib /opt/GNU/$lib"
+
+ : general looking path for locating libraries
+-glibpth="/lib /usr/lib $xlibpth"
+-glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
++glibpth="/$lib /usr/$lib $xlibpth"
++glibpth="$glibpth /usr/ccs/$lib /usr/ucblib /usr/local/$lib"
+ test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
+ test -f /shlib/libc.so && glibpth="/shlib $glibpth"
+
+@@ -5951,8 +5958,8 @@ fi
+ : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
+ case "$installstyle" in
+ '') case "$prefix" in
+- *perl*) dflt='lib';;
+- *) dflt='lib/perl5' ;;
++ *perl*) dflt='lib32';;
++ *) dflt='lib32/perl5' ;;
+ esac
+ ;;
+ *) dflt="$installstyle" ;;
+@@ -5968,8 +5975,8 @@ installstyle=$dflt
+ : /opt/perl/lib/perl5... would be redundant.
+ : The default "style" setting is made in installstyle.U
+ case "$installstyle" in
+-*lib/perl5*) set dflt privlib lib/$package/$version ;;
+-*) set dflt privlib lib/$version ;;
++*${lib}/perl5*) set dflt privlib ${lib}/$package/$version ;;
++*) set dflt privlib ${lib}/$version ;;
+ esac
+ eval $prefixit
+ $cat <<EOM
+@@ -6471,8 +6478,8 @@ siteprefixexp="$ansexp"
+ prog=`echo $package | $sed 's/-*[0-9.]*$//'`
+ case "$sitelib" in
+ '') case "$installstyle" in
+- *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
+- *) dflt=$siteprefix/lib/site_$prog/$version ;;
++ *${lib}/perl5*) dflt=$siteprefix/${lib}/$package/site_$prog/$version ;;
++ *) dflt=$siteprefix/${lib}/site_$prog/$version ;;
+ esac
+ ;;
+ *) dflt="$sitelib"
+@@ -6598,8 +6605,8 @@ case "$vendorprefix" in
+ '')
+ prog=`echo $package | $sed 's/-*[0-9.]*$//'`
+ case "$installstyle" in
+- *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
+- *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
++ *${lib}/perl5*) dflt=$vendorprefix/${lib}/$package/vendor_$prog/$version ;;
++ *) dflt=$vendorprefix/${lib}/vendor_$prog/$version ;;
+ esac
+ ;;
+ *) dflt="$vendorlib"
+@@ -10556,9 +10563,9 @@ else
+ else
+ for net in net socket
+ do
+- if test -f /usr/lib/lib$net$_a; then
+- ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
+- $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
++ if test -f /usr/$lib/lib$net$_a; then
++ ( ($nm $nm_opt /usr/$lib/lib$net$_a | eval $nm_extract) || \
++ $ar t /usr/$lib/lib$net$_a) 2>/dev/null >> libc.list
+ if $contains socket libc.list >/dev/null 2>&1; then
+ d_socket="$define"
+ socketlib="-l$net"
+@@ -21677,6 +21684,7 @@ ldflags='$ldflags'
+ ldflags_uselargefiles='$ldflags_uselargefiles'
+ ldlibpthname='$ldlibpthname'
+ less='$less'
++lib='$lib'
+ lib_ext='$lib_ext'
+ libc='$libc'
+ libperl='$libperl'
diff --git a/dev-lang/perl/files/perl-5.8.8-links.patch b/dev-lang/perl/files/perl-5.8.8-links.patch
new file mode 100644
index 000000000..22e74b3a6
--- /dev/null
+++ b/dev-lang/perl/files/perl-5.8.8-links.patch
@@ -0,0 +1,86 @@
+--- lib/CPAN/FirstTime.pm.orig 2006-02-06 07:50:13.000000000 -0500
++++ lib/CPAN/FirstTime.pm 2006-02-06 07:50:28.000000000 -0500
+@@ -292,7 +292,7 @@ by ENTER.
+ my(@path) = split /$Config{'path_sep'}/, $ENV{'PATH'};
+ local $^W = $old_warn;
+ my $progname;
+- for $progname (qw/gzip tar unzip make lynx wget ncftpget ncftp ftp gpg/){
++ for $progname (qw/gzip tar unzip make links lynx wget ncftpget ncftp ftp gpg/){
+ if ($^O eq 'MacOS') {
+ $CPAN::Config->{$progname} = 'not_here';
+ next;
+--- lib/CPAN.pm.orig 2006-02-06 07:54:43.000000000 -0500
++++ lib/CPAN.pm 2006-02-06 07:52:59.000000000 -0500
+@@ -2604,7 +2604,7 @@ sub hosthard {
+
+ $self->debug("localizing funkyftpwise[$url]") if $CPAN::DEBUG;
+ my($f,$funkyftp);
+- for $f ('lynx','ncftpget','ncftp','wget') {
++ for $f ('links','lynx','ncftpget','ncftp','wget') {
+ next unless exists $CPAN::Config->{$f};
+ $funkyftp = $CPAN::Config->{$f};
+ next unless defined $funkyftp;
+@@ -2613,7 +2613,7 @@ sub hosthard {
+ ($asl_ungz = $aslocal) =~ s/\.gz//;
+ $asl_gz = "$asl_ungz.gz";
+ my($src_switch) = "";
+- if ($f eq "lynx"){
++ if (($f eq "lynx")||($f eq "links")){
+ $src_switch = " -source";
+ } elsif ($f eq "ncftp"){
+ $src_switch = " -c";
+@@ -2637,10 +2637,14 @@ Trying with "$funkyftp$src_switch" to ge
+ my($wstatus);
+ if (($wstatus = system($system)) == 0
+ &&
+- ($f eq "lynx" ?
++ (($f eq "lynx" ?
+ -s $asl_ungz # lynx returns 0 when it fails somewhere
+ : 1
+- )
++ )||
++ ($f eq "links" ?
++ -s $asl_ungz # links returns 0 when it fails somewhere
++ : 1
++ ))
+ ) {
+ if (-s $aslocal) {
+ # Looks good
+@@ -2695,7 +2699,7 @@ returned status $estatus (wstat $wstatus
+ });
+ }
+ return if $CPAN::Signal;
+- } # lynx,ncftpget,ncftp
++ } # links,lynx,ncftpget,ncftp
+ } # host
+ }
+
+@@ -6022,7 +6026,7 @@ stalled.
+
+ The CPAN module is designed to automate the make and install of perl
+ modules and extensions. It includes some primitive searching capabilities and
+-knows how to use Net::FTP or LWP (or lynx or an external ftp client)
++knows how to use Net::FTP or LWP (or lynx or links or an external ftp client)
+ to fetch the raw data from the net.
+
+ Modules are fetched from one or more of the mirrored CPAN
+@@ -6975,16 +6979,18 @@ or
+
+ =back
+
+-=head2 Configuring lynx or ncftp for going through a firewall
++=head2 Configuring links or lynx or ncftp for going through a firewall
+
+ If you can go through your firewall with e.g. lynx, presumably with a
+ command such as
+
+ /usr/local/bin/lynx -pscott:tiger
++ /usr/local/bin/links -pscott:tiger
+
+ then you would configure CPAN.pm with the command
+
+ o conf lynx "/usr/local/bin/lynx -pscott:tiger"
++ o conf links "/usr/local/bin/links -pscott:tiger"
+
+ That's all. Similarly for ncftp or ftp, you would configure something
+ like
diff --git a/dev-lang/perl/files/perl-5.8.8-makedepend-syntax.patch b/dev-lang/perl/files/perl-5.8.8-makedepend-syntax.patch
new file mode 100644
index 000000000..147d49937
--- /dev/null
+++ b/dev-lang/perl/files/perl-5.8.8-makedepend-syntax.patch
@@ -0,0 +1,11 @@
+--- perl-5.8.8/makedepend.SH
++++ perl-5.8.8/makedepend.SH
+@@ -128,7 +128,7 @@
+ *.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."
diff --git a/dev-lang/perl/files/perl-5.8.8-perlcc.patch b/dev-lang/perl/files/perl-5.8.8-perlcc.patch
new file mode 100644
index 000000000..5c4b7787c
--- /dev/null
+++ b/dev-lang/perl/files/perl-5.8.8-perlcc.patch
@@ -0,0 +1,11 @@
+--- perl-5.8.8/ext/B/B/C.pm.orig 2007-06-07 21:12:04.000000000 +0300
++++ perl-5.8.8/ext/B/B/C.pm 2007-06-07 21:12:21.000000000 +0300
+@@ -647,7 +647,7 @@
+ return $sym if defined $sym;
+ my $val= $sv->NVX;
+ $val .= '.00' if $val =~ /^-?\d+$/;
+- $xpvnvsect->add(sprintf("0, 0, 0, %d, %s", $sv->IVX, $val));
++ $xpvnvsect->add(sprintf("0, 0, 0, %d, %s", $sv->NVX, $val));
+ $svsect->add(sprintf("&xpvnv_list[%d], %lu, 0x%x",
+ $xpvnvsect->index, $sv->REFCNT , $sv->FLAGS));
+ return savesym($sv, sprintf("&sv_list[%d]", $svsect->index));
diff --git a/dev-lang/perl/files/perl-5.8.8-reorder-INC.patch b/dev-lang/perl/files/perl-5.8.8-reorder-INC.patch
new file mode 100644
index 000000000..11c56929c
--- /dev/null
+++ b/dev-lang/perl/files/perl-5.8.8-reorder-INC.patch
@@ -0,0 +1,93 @@
+--- perl.c.orig 2006-01-24 09:57:33.000000000 -0500
++++ perl.c 2006-01-24 10:03:15.000000000 -0500
+@@ -4777,9 +4777,9 @@ S_init_perllib(pTHX)
+ incpush(APPLLIB_EXP, TRUE, TRUE, TRUE);
+ #endif
+
+-#ifdef ARCHLIB_EXP
+- incpush(ARCHLIB_EXP, FALSE, FALSE, TRUE);
+-#endif
++ /* for configuration where /usr is mounted ro (CPAN::Config, Net::Config) */
++ incpush("/etc/perl", FALSE, FALSE, TRUE);
++
+ #ifdef MACOS_TRADITIONAL
+ {
+ Stat_t tmpstatbuf;
+@@ -4806,51 +4806,58 @@ S_init_perllib(pTHX)
+ #endif
+ #if defined(WIN32)
+ incpush(PRIVLIB_EXP, TRUE, FALSE, TRUE);
+-#else
+- incpush(PRIVLIB_EXP, FALSE, FALSE, TRUE);
+ #endif
+
+-#ifdef SITEARCH_EXP
+- /* sitearch is always relative to sitelib on Windows for
++#ifdef PERL_VENDORARCH_EXP
++ /* vendorarch is always relative to vendorlib on Windows for
+ * DLL-based path intuition to work correctly */
+ # if !defined(WIN32)
+- incpush(SITEARCH_EXP, FALSE, FALSE, TRUE);
++ incpush(PERL_VENDORARCH_EXP, FALSE, FALSE, TRUE);
+ # endif
+ #endif
+
+-#ifdef SITELIB_EXP
++#ifdef PERL_VENDORLIB_EXP
+ # if defined(WIN32)
+- /* this picks up sitearch as well */
+- incpush(SITELIB_EXP, TRUE, FALSE, TRUE);
++ incpush(PERL_VENDORLIB_EXP, TRUE, FALSE, TRUE); /* this picks up vendorarch as well */
+ # else
+- incpush(SITELIB_EXP, FALSE, FALSE, TRUE);
++ incpush(PERL_VENDORLIB_EXP, FALSE, FALSE, TRUE);
+ # endif
+ #endif
+
+-#ifdef SITELIB_STEM /* Search for version-specific dirs below here */
+- incpush(SITELIB_STEM, FALSE, TRUE, TRUE);
++#ifdef PERL_VENDORLIB_STEM /* Search for version-specific dirs below here */
++ incpush(PERL_VENDORLIB_STEM, FALSE, TRUE, TRUE);
+ #endif
+
+-#ifdef PERL_VENDORARCH_EXP
+- /* vendorarch is always relative to vendorlib on Windows for
++#ifdef SITEARCH_EXP
++ /* sitearch is always relative to sitelib on Windows for
+ * DLL-based path intuition to work correctly */
+ # if !defined(WIN32)
+- incpush(PERL_VENDORARCH_EXP, FALSE, FALSE, TRUE);
++ incpush(SITEARCH_EXP, FALSE, FALSE, TRUE);
+ # endif
+ #endif
+
+-#ifdef PERL_VENDORLIB_EXP
++#ifdef SITELIB_EXP
+ # if defined(WIN32)
+- incpush(PERL_VENDORLIB_EXP, TRUE, FALSE, TRUE); /* this picks up vendorarch as well */
++ /* this picks up sitearch as well */
++ incpush(SITELIB_EXP, TRUE, FALSE, TRUE);
+ # else
+- incpush(PERL_VENDORLIB_EXP, FALSE, FALSE, TRUE);
++ incpush(SITELIB_EXP, FALSE, FALSE, TRUE);
+ # endif
+ #endif
+
+-#ifdef PERL_VENDORLIB_STEM /* Search for version-specific dirs below here */
+- incpush(PERL_VENDORLIB_STEM, FALSE, TRUE, TRUE);
++#ifdef SITELIB_STEM /* Search for version-specific dirs below here */
++ incpush(SITELIB_STEM, FALSE, TRUE, TRUE);
+ #endif
+
++ incpush(ARCHLIB_EXP, FALSE, FALSE, TRUE);
++ incpush(PRIVLIB_EXP, FALSE, FALSE, TRUE);
++
++ /* Non-versioned site directory for local modules and for
++ compatability with the previous packages' site dirs */
++
++ incpush("/usr/local/lib/site_perl", TRUE, FALSE, TRUE);
++
++
+ #ifdef PERL_OTHERLIBDIRS
+ incpush(PERL_OTHERLIBDIRS, TRUE, TRUE, TRUE);
+ #endif
diff --git a/dev-lang/perl/files/perl-5.8.8-utf8-boundary.patch b/dev-lang/perl/files/perl-5.8.8-utf8-boundary.patch
new file mode 100644
index 000000000..d0efa3f1c
--- /dev/null
+++ b/dev-lang/perl/files/perl-5.8.8-utf8-boundary.patch
@@ -0,0 +1,57 @@
+--- regcomp.c 2006-01-08 12:59:27.000000000 -0800
++++ regcomp.c 2007-10-05 12:07:55.000000000 -0700
+@@ -135,7 +135,8 @@
+ I32 extralen;
+ I32 seen_zerolen;
+ I32 seen_evals;
+- I32 utf8;
++ I32 utf8; /* pattern is utf8 or not */
++ I32 orig_utf8; /* pattern was originally utf8 */
+ #if ADD_TO_REGEXEC
+ char *starttry; /* -Dr: where regtry was called. */
+ #define RExC_starttry (pRExC_state->starttry)
+@@ -161,6 +162,7 @@
+ #define RExC_seen_zerolen (pRExC_state->seen_zerolen)
+ #define RExC_seen_evals (pRExC_state->seen_evals)
+ #define RExC_utf8 (pRExC_state->utf8)
++#define RExC_orig_utf8 (pRExC_state->orig_utf8)
+
+ #define ISMULT1(c) ((c) == '*' || (c) == '+' || (c) == '?')
+ #define ISMULT2(s) ((*s) == '*' || (*s) == '+' || (*s) == '?' || \
+@@ -1749,15 +1751,17 @@
+ if (exp == NULL)
+ FAIL("NULL regexp argument");
+
+- RExC_utf8 = pm->op_pmdynflags & PMdf_CMP_UTF8;
++ RExC_orig_utf8 = RExC_utf8 = pm->op_pmdynflags & PMdf_CMP_UTF8;
+
+- RExC_precomp = exp;
+ DEBUG_r({
+ if (!PL_colorset) reginitcolors();
+ PerlIO_printf(Perl_debug_log, "%sCompiling REx%s `%s%*s%s'\n",
+ PL_colors[4],PL_colors[5],PL_colors[0],
+- (int)(xend - exp), RExC_precomp, PL_colors[1]);
++ (int)(xend - exp), exp, PL_colors[1]);
+ });
++
++redo_first_pass:
++ RExC_precomp = exp;
+ RExC_flags = pm->op_pmflags;
+ RExC_sawback = 0;
+
+@@ -1783,6 +1787,17 @@
+ RExC_precomp = Nullch;
+ return(NULL);
+ }
++ if (RExC_utf8 && !RExC_orig_utf8) {
++ STRLEN len = xend-exp;
++ DEBUG_r(PerlIO_printf(Perl_debug_log,
++ "UTF8 mismatch! Converting to utf8 for resizing and compile\n"));
++ exp = (char*)Perl_bytes_to_utf8(aTHX_ (U8*)exp, &len);
++ xend = exp + len;
++ RExC_orig_utf8 = RExC_utf8;
++ SAVEFREEPV(exp);
++ goto redo_first_pass;
++ }
++
+
diff --git a/dev-lang/perl/files/perl-fix_h2ph_include_quote.patch b/dev-lang/perl/files/perl-fix_h2ph_include_quote.patch
new file mode 100644
index 000000000..a71fbe6e2
--- /dev/null
+++ b/dev-lang/perl/files/perl-fix_h2ph_include_quote.patch
@@ -0,0 +1,61 @@
+Subject: Fix h2ph with double-quote-delimited #include directives.
+
+Allow the quote mark delimiter also for those #include directives chased with "h2ph -a".
+
+Debian bug #479762.
+
+Also add the directory prefix of the current file when the quote syntax is
+used; 'require' will only look in @INC, not the current directory.
+
+Upstream change 33835.
+--- a/utils/h2ph.PL
++++ b/utils/h2ph.PL
+@@ -85,7 +85,7 @@ sub reindent($) {
+ }
+
+ my ($t, $tab, %curargs, $new, $eval_index, $dir, $name, $args, $outfile);
+-my ($incl, $incl_type, $next);
++my ($incl, $incl_type, $incl_quote, $next);
+ while (defined (my $file = next_file())) {
+ if (-l $file and -d $file) {
+ link_if_possible($file) if ($opt_l);
+@@ -186,9 +186,10 @@ while (defined (my $file = next_file())) {
+ print OUT $t,"unless(defined(\&$name)) {\n sub $name () {\t",$new,";}\n}\n";
+ }
+ }
+- } elsif (/^(include|import|include_next)\s*[<\"](.*)[>\"]/) {
++ } elsif (/^(include|import|include_next)\s*([<\"])(.*)[>\"]/) {
+ $incl_type = $1;
+- $incl = $2;
++ $incl_quote = $2;
++ $incl = $3;
+ if (($incl_type eq 'include_next') ||
+ ($opt_e && exists($bad_file{$incl}))) {
+ $incl =~ s/\.h$/.ph/;
+@@ -221,6 +222,10 @@ while (defined (my $file = next_file())) {
+ "warn(\$\@) if \$\@;\n");
+ } else {
+ $incl =~ s/\.h$/.ph/;
++ # copy the prefix in the quote syntax (#include "x.h") case
++ if ($incl !~ m|/| && $incl_quote eq q{"} && $file =~ m|^(.*)/|) {
++ $incl = "$1/$incl";
++ }
+ print OUT $t,"require '$incl';\n";
+ }
+ } elsif (/^ifdef\s+(\w+)/) {
+@@ -724,8 +729,13 @@ sub queue_includes_from
+ $line .= <HEADER>;
+ }
+
+- if ($line =~ /^#\s*include\s+<(.*?)>/) {
+- push(@ARGV, $1) unless $Is_converted{$1};
++ if ($line =~ /^#\s*include\s+([<"])(.*?)[>"]/) {
++ my ($delimiter, $new_file) = ($1, $2);
++ # copy the prefix in the quote syntax (#include "x.h") case
++ if ($delimiter eq q{"} && $file =~ m|^(.*)/|) {
++ $new_file = "$1/$new_file";
++ }
++ push(@ARGV, $new_file) unless $Is_converted{$new_file};
+ }
+ }
+ close HEADER;
diff --git a/dev-lang/perl/files/perl-h2ph-ansi-header.patch b/dev-lang/perl/files/perl-h2ph-ansi-header.patch
new file mode 100644
index 000000000..c7f0d7246
--- /dev/null
+++ b/dev-lang/perl/files/perl-h2ph-ansi-header.patch
@@ -0,0 +1,11 @@
+--- perl-5.8.0-RC2/utils/h2ph_patched.pix 2002-06-24 12:52:31.000000000 +0200
++++ perl-5.8.0-RC2/utils/h2ph_patched 2002-06-24 12:54:32.000000000 +0200
+@@ -39,6 +39,8 @@
+ my ($t, $tab, %curargs, $new, $eval_index, $dir, $name, $args, $outfile);
+ my ($incl, $next);
+ while (defined (my $file = next_file())) {
++ next if $file eq 'machine/ansi.h';
++
+ if (-l $file and -d $file) {
+ link_if_possible($file) if ($opt_l);
+ next;
diff --git a/dev-lang/perl/files/perl-hppa-pa7200-configure.patch b/dev-lang/perl/files/perl-hppa-pa7200-configure.patch
new file mode 100644
index 000000000..396209af1
--- /dev/null
+++ b/dev-lang/perl/files/perl-hppa-pa7200-configure.patch
@@ -0,0 +1,11 @@
+--- Configure.orig 2006-06-02 13:14:22.000000000 -0500
++++ Configure 2006-06-02 13:07:03.000000000 -0500
+@@ -2967,7 +2967,7 @@
+ : Try to determine whether config.sh was made on this system
+ case "$config_sh" in
+ '')
+-myuname=`$uname -a 2>/dev/null`
++myuname=`$uname -a | $sed -e "s/'//" 2>/dev/null`
+ $test -z "$myuname" && myuname=`hostname 2>/dev/null`
+ # tr '[A-Z]' '[a-z]' would not work in EBCDIC
+ # because the A-Z/a-z are not consecutive.
diff --git a/dev-lang/perl/files/perl-noksh.patch b/dev-lang/perl/files/perl-noksh.patch
new file mode 100644
index 000000000..4c33b3e71
--- /dev/null
+++ b/dev-lang/perl/files/perl-noksh.patch
@@ -0,0 +1,16 @@
+diff -burN perl-5.8.4.orig/Configure perl-5.8.4/Configure
+--- perl-5.8.4.orig/Configure 2004-04-01 05:48:18.000000000 -0800
++++ perl-5.8.4/Configure 2004-06-09 12:02:54.694172368 -0700
+@@ -164,6 +164,12 @@
+ ;;
+ esac
+
++# 2004.06.09 rac
++# having $newsh persist as ksh here is bad news if ksh doesn't really
++# exist. this causes us to toss away a perfectly good working test in
++# bash in favour of more exotic external options. see bug 42665.
++test -x "${newsh}" || unset newsh
++
+ : if needed set CDPATH to a harmless value that is not chatty
+ : avoid bash 2.02 problems with empty CDPATH.
+ case "$CDPATH" in
diff --git a/dev-lang/perl/files/perl-perldoc-emptydirs.patch b/dev-lang/perl/files/perl-perldoc-emptydirs.patch
new file mode 100644
index 000000000..650248c50
--- /dev/null
+++ b/dev-lang/perl/files/perl-perldoc-emptydirs.patch
@@ -0,0 +1,10 @@
+--- lib/Pod/Perldoc.pm.orig 2003-10-22 13:02:15.000000000 -0700
++++ lib/Pod/Perldoc.pm 2003-10-22 13:02:36.000000000 -0700
+@@ -1513,6 +1513,7 @@
+ $self->{'target'} = (splitdir $s)[-1]; # XXX: why not use File::Basename?
+ for ($i=0; $i<@dirs; $i++) {
+ $dir = $dirs[$i];
++ next unless -d $dir;
+ ($dir = VMS::Filespec::unixpath($dir)) =~ s!/\z!! if IS_VMS;
+ if ( (! $self->opt_m && ( $ret = $self->check_file($dir,"$s.pod")))
+ or ( $ret = $self->check_file($dir,"$s.pm"))
diff --git a/dev-lang/perl/files/perl-picdl.patch b/dev-lang/perl/files/perl-picdl.patch
new file mode 100644
index 000000000..f69a6800c
--- /dev/null
+++ b/dev-lang/perl/files/perl-picdl.patch
@@ -0,0 +1,13 @@
+--- Makefile.SH.orig 2003-11-29 01:16:15.000000000 -0800
++++ Makefile.SH 2003-11-29 01:16:52.000000000 -0800
+@@ -129,8 +129,8 @@
+
+ ;;
+
+-*) pldlflags=''
+- static_target='static'
++*) pldlflags="$cccdlflags"
++ static_target='static_pic'
+ ;;
+ esac
+
diff --git a/dev-lang/perl/files/perl-prelink-lpthread.patch b/dev-lang/perl/files/perl-prelink-lpthread.patch
new file mode 100644
index 000000000..d38497e0a
--- /dev/null
+++ b/dev-lang/perl/files/perl-prelink-lpthread.patch
@@ -0,0 +1,11 @@
+--- hints/linux.sh.orig 2003-02-14 18:11:50.000000000 -0800
++++ hints/linux.sh 2003-02-14 18:12:01.000000000 -0800
+@@ -43,7 +43,7 @@
+ # 'kaffe' has a /usr/lib/libnet.so which is not at all relevent for perl.
+ set `echo X "$libswanted "| sed -e 's/ bsd / /' -e 's/ net / /'`
+ shift
+-libswanted="$*"
++libswanted="pthread $*"
+
+ # If you have glibc, then report the version for ./myconfig bug reporting.
+ # (Configure doesn't need to know the specific version since it just uses
diff --git a/dev-lang/perl/files/perl-regexp-nossp.patch b/dev-lang/perl/files/perl-regexp-nossp.patch
new file mode 100644
index 000000000..d0357cd50
--- /dev/null
+++ b/dev-lang/perl/files/perl-regexp-nossp.patch
@@ -0,0 +1,11 @@
+--- cflags.SH.orig 2005-07-03 23:39:10.000000000 -0400
++++ cflags.SH 2005-07-03 23:39:47.000000000 -0400
+@@ -165,6 +165,8 @@
+ esac
+
+ : Can we perhaps use $ansi2knr here
++ [ "x$file" = xregcomp ] && export ccflags="${ccflags} -fno-stack-protector"
++ [ "x$file" = xregexec ] && export ccflags="${ccflags} -fno-stack-protector"
+ echo "$cc -c -DPERL_CORE $ccflags $optimize $warn"
+ eval "$also "'"$cc -DPERL_CORE -c $ccflags $optimize $warn"'
+
diff --git a/dev-lang/perl/perl-5.8.8-r10.ebuild b/dev-lang/perl/perl-5.8.8-r10.ebuild
new file mode 100644
index 000000000..2ce109f83
--- /dev/null
+++ b/dev-lang/perl/perl-5.8.8-r10.ebuild
@@ -0,0 +1,692 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/perl/perl-5.8.8-r7.ebuild,v 1.2 2009/05/29 13:26:28 tove Exp $
+
+inherit eutils alternatives flag-o-matic toolchain-funcs multilib
+
+# The slot of this binary compat version of libperl.so
+PERLSLOT="1"
+
+SHORT_PV="${PV%.*}"
+MY_P="perl-${PV/_rc/-RC}"
+MY_PV="${PV%_rc*}"
+DESCRIPTION="Larry Wall's Practical Extraction and Report Language"
+S="${WORKDIR}/${MY_P}"
+SRC_URI="mirror://cpan/src/${MY_P}.tar.bz2"
+HOMEPAGE="http://www.perl.org/"
+LIBPERL="libperl$(get_libname ${PERLSLOT}.${SHORT_PV})"
+
+LICENSE="|| ( Artistic GPL-2 )"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="berkdb debug doc gdbm ithreads perlsuid build elibc_FreeBSD"
+PERL_OLDVERSEN="5.8.0 5.8.2 5.8.4 5.8.5 5.8.6 5.8.7"
+
+DEPEND="berkdb? ( sys-libs/db )
+ gdbm? ( >=sys-libs/gdbm-1.8.3 )
+ >=sys-devel/libperl-${PV}-r1
+ elibc_FreeBSD? ( sys-freebsd/freebsd-mk-defs )
+ <sys-devel/libperl-5.9
+ !<perl-core/File-Spec-0.87
+ !<perl-core/Test-Simple-0.47-r1"
+
+RDEPEND="~sys-devel/libperl-${PV}
+ berkdb? ( sys-libs/db )
+ gdbm? ( >=sys-libs/gdbm-1.8.3 )
+ build? (
+ !perl-core/Test-Harness
+ !perl-core/PodParser
+ !dev-perl/Locale-gettext
+ )"
+
+PDEPEND=">=app-admin/perl-cleaner-1.03"
+
+pkg_setup() {
+ # I think this should rather be displayed if you *have* 'ithreads'
+ # in USE if it could break things ...
+ if use ithreads
+ then
+ ewarn "PLEASE NOTE: You are compiling ${MY_P} with"
+ ewarn "interpreter-level threading enabled."
+ ewarn "Threading is not supported by all applications "
+ ewarn "that compile against perl. You use threading at "
+ ewarn "your own discretion. "
+ epause 5
+ fi
+
+ if [[ ! -f "${ROOT}/usr/$(get_libdir)/${LIBPERL}" ]]
+ then
+ # Make sure we have libperl installed ...
+ eerror "Cannot find ${ROOT}/usr/$(get_libdir)/${LIBPERL}! Make sure that you"
+ eerror "have sys-libs/libperl installed properly ..."
+ die "Cannot find ${ROOT}/usr/$(get_libdir)/${LIBPERL}!"
+ fi
+}
+
+src_unpack() {
+ unpack ${A}
+
+ # Get -lpthread linked before -lc. This is needed
+ # when using glibc >= 2.3, or else runtime signal
+ # handling breaks. Fixes bug #14380.
+ # <rac@gentoo.org> (14 Feb 2003)
+ # reinstated to try to avoid sdl segfaults 03.10.02
+ cd "${S}"; epatch "${FILESDIR}"/${PN}-prelink-lpthread.patch
+
+ # Patch perldoc to not abort when it attempts to search
+ # nonexistent directories; fixes bug #16589.
+ # <rac@gentoo.org> (28 Feb 2003)
+
+ cd "${S}"; epatch "${FILESDIR}"/${PN}-perldoc-emptydirs.patch
+
+ # this lays the groundwork for solving the issue of what happens
+ # when people (or ebuilds) install different versiosn of modules
+ # that are in the core, by rearranging the @INC directory to look
+ # site -> vendor -> core.
+ cd "${S}"; epatch "${FILESDIR}"/${P}-reorder-INC.patch
+
+ # some well-intentioned stuff in http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&selm=Pine.SOL.4.10.10205231231200.5399-100000%40maxwell.phys.lafayette.edu
+ # attempts to avoid bringing cccdlflags to bear on static
+ # extensions (like DynaLoader). i believe this is
+ # counterproductive on a Gentoo system which has both a shared
+ # and static libperl, so effectively revert this here.
+ cd "${S}"; epatch "${FILESDIR}"/${PN}-picdl.patch
+
+ # Configure makes an unwarranted assumption that /bin/ksh is a
+ # good shell. This patch makes it revert to using /bin/sh unless
+ # /bin/ksh really is executable. Should fix bug 42665.
+ # rac 2004.06.09
+ cd "${S}"; epatch "${FILESDIR}"/${PN}-noksh.patch
+
+ # makedepend.SH contains a syntax error which is ignored by bash but causes
+ # dash to abort
+ epatch "${FILESDIR}"/${P}-makedepend-syntax.patch
+
+ # We do not want the build root in the linked perl module's RUNPATH, so
+ # strip paths containing PORTAGE_TMPDIR if its set. This is for the
+ # MakeMaker module, bug #105054.
+ epatch "${FILESDIR}"/${PN}-5.8.7-MakeMaker-RUNPATH.patch
+
+ # Starting and hopefully ending with 5.8.7 we observe stack
+ # corruption with the regexp handling in perls DynaLoader code
+ # with ssp enabled. This become fatal during compile time so we
+ # temporally disable ssp on two regexp files till upstream has a
+ # chance to work it out. Bug #97452
+ [[ -n $(test-flags -fno-stack-protector) ]] && \
+ epatch "${FILESDIR}"/${PN}-regexp-nossp.patch
+
+ # On PA7200, uname -a contains a single quote and we need to
+ # filter it otherwise configure fails. See #125535.
+ epatch "${FILESDIR}"/perl-hppa-pa7200-configure.patch
+
+ case "$(get_libdir)" in
+ lib64) cd "${S}" && epatch "${FILESDIR}"/${P}-lib64.patch;;
+ lib32) cd "${S}" && epatch "${FILESDIR}"/${P}-lib32.patch;;
+ lib) true;;
+ *) die "Something's wrong with your libdir, don't know how to treat it.";;
+ esac
+
+ [[ ${CHOST} == *-dragonfly* ]] && cd "${S}" && epatch "${FILESDIR}"/${P}-dragonfly-clean.patch
+ [[ ${CHOST} == *-freebsd* ]] && cd "${S}" && epatch "${FILESDIR}"/${P}-fbsdhints.patch
+ cd "${S}"; epatch "${FILESDIR}"/${P}-USE_MM_LD_RUN_PATH.patch
+ cd "${S}"; epatch "${FILESDIR}"/${P}-links.patch
+ # c++ patch - should address swig related items
+ cd "${S}"; epatch "${FILESDIR}"/${P}-cplusplus.patch
+
+ epatch "${FILESDIR}"/${P}-gcc42-command-line.patch
+
+ # Newer linux-headers don't include asm/page.h. Fix this.
+ # Patch from bug 168312, thanks Peter!
+ has_version '>sys-kernel/linux-headers-2.6.20' && epatch "${FILESDIR}"/${P}-asm-page-h-compile-failure.patch
+
+ # Also add the directory prefix of the current file when the quote syntax is
+ # used; 'require' will only look in @INC, not the current directory.
+ epatch "${FILESDIR}"/${PN}-fix_h2ph_include_quote.patch
+
+ # perlcc fix patch - bug #181229
+ epatch "${FILESDIR}"/${P}-perlcc.patch
+
+ # patch to fix bug #198196
+ # UTF/Regular expressions boundary error (CVE-2007-5116)
+ epatch "${FILESDIR}"/${P}-utf8-boundary.patch
+
+ # patch to fix bug #219203
+ epatch "${FILESDIR}"/${P}-CVE-2008-1927.patch
+
+ epatch "${FILESDIR}"/${P}-CAN-2005-0448-rmtree-2.patch
+ epatch "${FILESDIR}"/${P}-fix_file_path_chdir.patch
+}
+
+myconf() {
+ # the myconf array is declared in src_configure
+ myconf=( "${myconf[@]}" "$@" )
+}
+
+src_configure() {
+ declare -a myconf
+
+ # some arches and -O do not mix :)
+ use arm && replace-flags -O? -O1
+ use ppc && replace-flags -O? -O1
+ use ia64 && replace-flags -O? -O1
+ # Perl has problems compiling with -Os in your flags with glibc
+ use elibc_uclibc || replace-flags "-Os" "-O2"
+ ( gcc-specs-ssp && use ia64 ) && append-flags -fno-stack-protector
+ # This flag makes compiling crash in interesting ways
+ filter-flags -malign-double
+ # Fixes bug #97645
+ use ppc && filter-flags -mpowerpc-gpopt
+ # Fixes bug #143895 on gcc-4.1.1
+ filter-flags "-fsched2-use-superblocks"
+
+ export LC_ALL="C"
+
+ case ${CHOST} in
+ *-freebsd*) osname="freebsd" ;;
+ *-dragonfly*) osname="dragonfly" ;;
+ *-netbsd*) osname="netbsd" ;;
+ *-openbsd*) osname="openbsd" ;;
+ *-darwin*) osname="darwin" ;;
+
+ *) osname="linux" ;;
+ esac
+
+ if use ithreads
+ then
+ einfo "using ithreads"
+ mythreading="-multi"
+ myconf -Dusethreads
+ myarch=${CHOST}
+ myarch="${myarch%%-*}-${osname}-thread"
+ else
+ myarch=${CHOST}
+ myarch="${myarch%%-*}-${osname}"
+ fi
+
+ local inclist=$(for v in $PERL_OLDVERSEN; do echo -n "$v $v/$myarch$mythreading "; done)
+
+ # allow either gdbm to provide ndbm (in <gdbm/ndbm.h>) or db1
+
+ myndbm='U'
+ mygdbm='U'
+ mydb='U'
+
+ if use gdbm
+ then
+ mygdbm='D'
+ myndbm='D'
+ fi
+ if use berkdb
+ then
+ mydb='D'
+ has_version '=sys-libs/db-1*' && myndbm='D'
+ fi
+
+ myconf "-${myndbm}i_ndbm" "-${mygdbm}i_gdbm" "-${mydb}i_db"
+
+ if use mips
+ then
+ # this is needed because gcc 3.3-compiled kernels will hang
+ # the machine trying to run this test - check with `Kumba
+ # <rac@gentoo.org> 2003.06.26
+ myconf -Dd_u32align
+ fi
+
+ if use perlsuid
+ then
+ myconf -Dd_dosuid
+ ewarn "You have enabled Perl's suid compile. Please"
+ ewarn "read http://search.cpan.org/~nwclark/perl-5.8.8/INSTALL#suidperl"
+ epause 3
+ fi
+
+ if use debug
+ then
+ CFLAGS="${CFLAGS} -g"
+ myconf -DDEBUGGING
+ fi
+
+ if use sparc
+ then
+ myconf -Ud_longdbl
+ fi
+
+ if use alpha && "$(tc-getCC)" == "ccc"
+ then
+ ewarn "Perl will not be built with berkdb support, use gcc if you needed it..."
+ myconf -Ui_db -Ui_ndbm
+ fi
+
+ [[ -n "${ABI}" ]] && myconf "-Dusrinc=$(get_ml_incdir)"
+
+ [[ ${ELIBC} == "FreeBSD" ]] && myconf "-Dlibc=/usr/$(get_libdir)/libc.a"
+
+ if [[ $(get_libdir) != "lib" ]] ; then
+ # We need to use " and not ', as the written config.sh use ' ...
+ myconf "-Dlibpth=/usr/local/$(get_libdir) /$(get_libdir) /usr/$(get_libdir)"
+ fi
+
+ sh Configure -des \
+ -Darchname="${myarch}" \
+ -Dcccdlflags='-fPIC' \
+ -Dccdlflags='-rdynamic' \
+ -Dcc="$(tc-getCC)" \
+ -Dprefix='/usr' \
+ -Dvendorprefix='/usr' \
+ -Dsiteprefix='/usr' \
+ -Dlocincpth=' ' \
+ -Doptimize="${CFLAGS}" \
+ -Duselargefiles \
+ -Dd_semctl_semun \
+ -Dscriptdir=/usr/bin \
+ -Dman1dir=/usr/share/man/man1 \
+ -Dman3dir=/usr/share/man/man3 \
+ -Dinstallman1dir=/usr/share/man/man1 \
+ -Dinstallman3dir=/usr/share/man/man3 \
+ -Dman1ext='1' \
+ -Dman3ext='3pm' \
+ -Dinc_version_list="$inclist" \
+ -Dcf_by='Gentoo' \
+ -Ud_csh \
+ -Dusenm \
+ "${myconf[@]}" || die "Unable to configure"
+}
+
+src_compile() {
+
+ # would like to bracket this with a test for the existence of a
+ # dotfile, but can't clean it automatically now.
+
+ src_configure
+
+ emake -j1 || die "Unable to make"
+}
+
+src_test() {
+ use elibc_uclibc && export MAKEOPTS="${MAKEOPTS} -j1"
+ emake -i test CCDLFLAGS= || die "test failed"
+}
+
+src_install() {
+
+ export LC_ALL="C"
+
+ # Need to do this, else apps do not link to dynamic version of
+ # the library ...
+ local coredir="/usr/$(get_libdir)/perl5/${MY_PV}/${myarch}${mythreading}/CORE"
+ dodir ${coredir}
+ dosym ../../../../../$(get_libdir)/${LIBPERL} ${coredir}/${LIBPERL}
+ dosym ../../../../../$(get_libdir)/${LIBPERL} ${coredir}/libperl$(get_libname ${PERLSLOT})
+ dosym ../../../../../$(get_libdir)/${LIBPERL} ${coredir}/libperl$(get_libname)
+
+ # Fix for "stupid" modules and programs
+ dodir /usr/$(get_libdir)/perl5/site_perl/${MY_PV}/${myarch}${mythreading}
+
+ local installtarget=install
+ if use build ; then
+ installtarget=install.perl
+ fi
+ make DESTDIR="${D}" ${installtarget} || die "Unable to make ${installtarget}"
+
+ rm "${D}"/usr/bin/perl
+ ln -s perl${MY_PV} "${D}"/usr/bin/perl
+
+ cp -f utils/h2ph utils/h2ph_patched
+ epatch "${FILESDIR}"/${PN}-h2ph-ansi-header.patch
+
+ LD_LIBRARY_PATH=. ./perl -Ilib utils/h2ph_patched \
+ -a -d "${D}"/usr/$(get_libdir)/perl5/${MY_PV}/${myarch}${mythreading} <<EOF
+asm/termios.h
+syscall.h
+syslimits.h
+syslog.h
+sys/ioctl.h
+sys/socket.h
+sys/time.h
+wait.h
+EOF
+
+ # This is to fix a missing c flag for backwards compat
+ for i in `find "${D}"/usr/$(get_libdir)/perl5 -iname "Config.pm"`;do
+ sed -e "s:ccflags=':ccflags='-DPERL5 :" \
+ -e "s:cppflags=':cppflags='-DPERL5 :" \
+ ${i} > ${i}.new &&\
+ mv ${i}.new ${i} || die "Sed failed"
+ done
+
+ # A poor fix for the miniperl issues
+ dosed 's:./miniperl:/usr/bin/perl:' /usr/$(get_libdir)/perl5/${MY_PV}/ExtUtils/xsubpp
+ fperms 0444 /usr/$(get_libdir)/perl5/${MY_PV}/ExtUtils/xsubpp
+ dosed 's:./miniperl:/usr/bin/perl:' /usr/bin/xsubpp
+ fperms 0755 /usr/bin/xsubpp
+
+ # This removes ${D} from Config.pm and .packlist
+ for i in `find "${D}" -iname "Config.pm"` `find "${D}" -iname ".packlist"`;do
+ einfo "Removing ${D} from ${i}..."
+ sed -e "s:${D}::" ${i} > ${i}.new &&\
+ mv ${i}.new ${i} || die "Sed failed"
+ done
+
+ # Note: find out from psm why we would need/want this.
+ # ( use berkdb && has_version '=sys-libs/db-1*' ) ||
+ # find ${D} -name "*NDBM*" | xargs rm -f
+
+ dodoc Changes* Artistic Copying README Todo* AUTHORS
+
+ if use doc
+ then
+ # HTML Documentation
+ # We expect errors, warnings, and such with the following.
+
+ dodir /usr/share/doc/${PF}/html
+ ./perl installhtml \
+ --podroot='.' \
+ --podpath='lib:ext:pod:vms' \
+ --recurse \
+ --htmldir="${D}/usr/share/doc/${PF}/html" \
+ --libpods='perlfunc:perlguts:perlvar:perlrun:perlop'
+ fi
+ cd `find "${D}" -name Path.pm|sed -e 's/Path.pm//'`
+ # CAN patch in bug 79685
+ #epatch "${FILESDIR}"/${P}-CAN-2005-0448-rmtree-2.patch
+
+ dual_scripts
+
+ if use build ; then
+ src_remove_extra_files
+ fi
+}
+
+dual_scripts() {
+ # Remove those items we PDPEND on
+ # - perl-core/CPAN
+ src_remove_dual_scripts 1.76_02 cpan
+ # - perl-core/Encode
+ src_remove_dual_scripts 2.12 enc2xs piconv
+ # - perl-core/ExtUtils-MakeMaker
+ src_remove_dual_scripts 6.30 instmodsh
+ # - perl-core/PodParser
+ src_remove_dual_scripts 1.32 pod2usage podchecker podselect
+ # - perl-core/Test-Harness
+ src_remove_dual_scripts 2.56 prove
+}
+
+src_remove_dual_scripts() {
+ local i ver ff
+ ver="$1"
+ shift
+ if has "${EBUILD_PHASE:-none}" "postinst" "postrm" ;then
+ for i in "$@" ; do
+ ff=`echo ${ROOT}/usr/share/man/man1/${i}-${ver}-${P}.1*`
+ ff=${ff##*.1}
+ alternatives_auto_makesym "/usr/bin/${i}" "/usr/bin/${i}-*"
+ alternatives_auto_makesym "/usr/share/man/man1/${i}.1${ff}" "/usr/share/man/man1/${i}-*"
+ done
+ else
+ for i in "$@" ; do
+ mv "${D}"/usr/bin/${i}{,-${ver}-${P}} || die
+ mv "${D}"/usr/share/man/man1/${i}{.1,-${ver}-${P}.1} || \
+ echo "/usr/share/man/man1/${i}.1 does not exist!"
+ done
+ fi
+}
+
+src_remove_extra_files() {
+ local prefix="./usr" # ./ is important
+ local bindir="${prefix}/bin"
+ local perlroot="${prefix}/$(get_libdir)/perl5" # perl installs per-arch dirs
+ local prV="${perlroot}/${MY_PV}"
+ # myarch and mythreading are defined inside src_configure()
+ local prVA="${prV}/${myarch}${mythreading}"
+
+ # I made this list from the Mandr*, Debian and ex-Connectiva perl-base list
+ # Then, I added several files to get GNU autotools running
+ # FIXME: should this be in a separated file to be sourced?
+ local MINIMAL_PERL_INSTALL="
+ ${bindir}/h2ph
+ ${bindir}/perl
+ ${bindir}/perl${MY_PV}
+ ${bindir}/pod2man
+ ${prV}/attributes.pm
+ ${prV}/AutoLoader.pm
+ ${prV}/autouse.pm
+ ${prV}/base.pm
+ ${prV}/bigint.pm
+ ${prV}/bignum.pm
+ ${prV}/bigrat.pm
+ ${prV}/blib.pm
+ ${prV}/bytes_heavy.pl
+ ${prV}/bytes.pm
+ ${prV}/Carp/Heavy.pm
+ ${prV}/Carp.pm
+ ${prV}/charnames.pm
+ ${prV}/Class/Struct.pm
+ ${prV}/constant.pm
+ ${prV}/diagnostics.pm
+ ${prV}/DirHandle.pm
+ ${prV}/Exporter/Heavy.pm
+ ${prV}/Exporter.pm
+ ${prV}/ExtUtils/Command.pm
+ ${prV}/ExtUtils/Constant.pm
+ ${prV}/ExtUtils/Embed.pm
+ ${prV}/ExtUtils/Installed.pm
+ ${prV}/ExtUtils/Install.pm
+ ${prV}/ExtUtils/Liblist.pm
+ ${prV}/ExtUtils/MakeMaker.pm
+ ${prV}/ExtUtils/Manifest.pm
+ ${prV}/ExtUtils/Mkbootstrap.pm
+ ${prV}/ExtUtils/Mksymlists.pm
+ ${prV}/ExtUtils/MM_Any.pm
+ ${prV}/ExtUtils/MM_MacOS.pm
+ ${prV}/ExtUtils/MM.pm
+ ${prV}/ExtUtils/MM_Unix.pm
+ ${prV}/ExtUtils/MY.pm
+ ${prV}/ExtUtils/Packlist.pm
+ ${prV}/ExtUtils/testlib.pm
+ ${prV}/ExtUtils/Miniperl.pm
+ ${prV}/ExtUtils/Command/MM.pm
+ ${prV}/ExtUtils/Constant/Base.pm
+ ${prV}/ExtUtils/Constant/Utils.pm
+ ${prV}/ExtUtils/Constant/XS.pm
+ ${prV}/ExtUtils/Liblist/Kid.pm
+ ${prV}/ExtUtils/MakeMaker/bytes.pm
+ ${prV}/ExtUtils/MakeMaker/vmsish.pm
+ ${prV}/fields.pm
+ ${prV}/File/Basename.pm
+ ${prV}/File/Compare.pm
+ ${prV}/File/Copy.pm
+ ${prV}/File/Find.pm
+ ${prV}/FileHandle.pm
+ ${prV}/File/Path.pm
+ ${prV}/File/Spec.pm
+ ${prV}/File/Spec/Unix.pm
+ ${prV}/File/stat.pm
+ ${prV}/filetest.pm
+ ${prVA}/attrs.pm
+ ${prVA}/auto/attrs
+ ${prVA}/auto/Cwd/Cwd$(get_libname)
+ ${prVA}/auto/Data/Dumper/Dumper$(get_libname)
+ ${prVA}/auto/DynaLoader/dl_findfile.al
+ ${prVA}/auto/Fcntl/Fcntl$(get_libname)
+ ${prVA}/auto/File/Glob/Glob$(get_libname)
+ ${prVA}/auto/IO/IO$(get_libname)
+ ${prVA}/auto/POSIX/autosplit.ix
+ ${prVA}/auto/POSIX/fstat.al
+ ${prVA}/auto/POSIX/load_imports.al
+ ${prVA}/auto/POSIX/POSIX.bs
+ ${prVA}/auto/POSIX/POSIX$(get_libname)
+ ${prVA}/auto/POSIX/assert.al
+ ${prVA}/auto/POSIX/stat.al
+ ${prVA}/auto/POSIX/tmpfile.al
+ ${prVA}/auto/re/re$(get_libname)
+ ${prVA}/auto/Socket/Socket$(get_libname)
+ ${prVA}/auto/Storable/autosplit.ix
+ ${prVA}/auto/Storable/_retrieve.al
+ ${prVA}/auto/Storable/retrieve.al
+ ${prVA}/auto/Storable/Storable$(get_libname)
+ ${prVA}/auto/Storable/_store.al
+ ${prVA}/auto/Storable/store.al
+ ${prVA}/B/Deparse.pm
+ ${prVA}/B.pm
+ ${prVA}/Config.pm
+ ${prVA}/Config_heavy.pl
+ ${prVA}/CORE/libperl$(get_libname)
+ ${prVA}/Cwd.pm
+ ${prVA}/Data/Dumper.pm
+ ${prVA}/DynaLoader.pm
+ ${prVA}/encoding.pm
+ ${prVA}/Errno.pm
+ ${prVA}/Fcntl.pm
+ ${prVA}/File/Glob.pm
+ ${prVA}/_h2ph_pre.ph
+ ${prVA}/IO/File.pm
+ ${prVA}/IO/Handle.pm
+ ${prVA}/IO/Pipe.pm
+ ${prVA}/IO.pm
+ ${prVA}/IO/Seekable.pm
+ ${prVA}/IO/Select.pm
+ ${prVA}/IO/Socket.pm
+ ${prVA}/lib.pm
+ ${prVA}/NDBM_File.pm
+ ${prVA}/ops.pm
+ ${prVA}/POSIX.pm
+ ${prVA}/re.pm
+ ${prVA}/Socket.pm
+ ${prVA}/Storable.pm
+ ${prVA}/threads
+ ${prVA}/threads.pm
+ ${prVA}/XSLoader.pm
+ ${prV}/Getopt/Long.pm
+ ${prV}/Getopt/Std.pm
+ ${prV}/if.pm
+ ${prV}/integer.pm
+ ${prV}/IO/Socket/INET.pm
+ ${prV}/IO/Socket/UNIX.pm
+ ${prV}/IPC/Open2.pm
+ ${prV}/IPC/Open3.pm
+ ${prV}/less.pm
+ ${prV}/List/Util.pm
+ ${prV}/locale.pm
+ ${prV}/open.pm
+ ${prV}/overload.pm
+ ${prV}/Pod/InputObjects.pm
+ ${prV}/Pod/Man.pm
+ ${prV}/Pod/ParseLink.pm
+ ${prV}/Pod/Parser.pm
+ ${prV}/Pod/Select.pm
+ ${prV}/Pod/Text.pm
+ ${prV}/Pod/Usage.pm
+ ${prV}/PerlIO.pm
+ ${prV}/Scalar/Util.pm
+ ${prV}/SelectSaver.pm
+ ${prV}/sigtrap.pm
+ ${prV}/sort.pm
+ ${prV}/stat.pl
+ ${prV}/strict.pm
+ ${prV}/subs.pm
+ ${prV}/Symbol.pm
+ ${prV}/Text/ParseWords.pm
+ ${prV}/Text/Tabs.pm
+ ${prV}/Text/Wrap.pm
+ ${prV}/Time/Local.pm
+ ${prV}/unicore/Canonical.pl
+ ${prV}/unicore/Exact.pl
+ ${prV}/unicore/lib/gc_sc/Digit.pl
+ ${prV}/unicore/lib/gc_sc/Word.pl
+ ${prV}/unicore/PVA.pl
+ ${prV}/unicore/To/Fold.pl
+ ${prV}/unicore/To/Lower.pl
+ ${prV}/unicore/To/Upper.pl
+ ${prV}/utf8_heavy.pl
+ ${prV}/utf8.pm
+ ${prV}/vars.pm
+ ${prV}/vmsish.pm
+ ${prV}/warnings
+ ${prV}/warnings.pm
+ ${prV}/warnings/register.pm"
+
+ if use perlsuid ; then
+ MINIMAL_PERL_INSTALL="${MINIMAL_PERL_INSTALL}
+ ${bindir}/suidperl
+ ${bindir}/sperl${MY_PV}"
+ fi
+
+ pushd "${D}" > /dev/null
+ # Remove cruft
+ einfo "Removing files that are not in the minimal install"
+ echo "${MINIMAL_PERL_INSTALL}"
+ for f in $(find . -type f); do
+ has ${f} ${MINIMAL_PERL_INSTALL} || rm -f ${f}
+ done
+ # Remove empty directories
+ find . -depth -type d | xargs -r rmdir &> /dev/null
+ popd > /dev/null
+}
+
+pkg_postinst() {
+ dual_scripts
+
+ INC=$(perl -e 'for $line (@INC) { next if $line eq "."; next if $line =~ m/'${MY_PV}'|etc|local|perl$/; print "$line\n" }')
+ if [[ "${ROOT}" = "/" ]]
+ then
+ ebegin "Removing old .ph files"
+ for DIR in $INC; do
+ if [[ -d "${ROOT}"/$DIR ]]; then
+ for file in $(find "${ROOT}"/$DIR -name "*.ph" -type f); do
+ rm "${ROOT}"/$file
+ einfo "<< $file"
+ done
+ fi
+ done
+ # Silently remove the now empty dirs
+ for DIR in $INC; do
+ if [[ -d "${ROOT}"/$DIR ]]; then
+ find "${ROOT}"/$DIR -depth -type d | xargs -r rmdir &> /dev/null
+ fi
+ done
+ ebegin "Generating ConfigLocal.pm (ignore any error)"
+ enc2xs -C
+ ebegin "Converting C header files to the corresponding Perl format"
+ cd /usr/include;
+ h2ph *
+ h2ph -r sys/* arpa/* netinet/* bits/* security/* asm/* gnu/* linux/* gentoo*
+ cd /usr/include/linux
+ h2ph *
+ fi
+
+# This has been moved into a function because rumor has it that a future release
+# of portage will allow us to check what version was just removed - which means
+# we will be able to invoke this only as needed :)
+ # Tried doing this via -z, but $INC is too big...
+ if [[ "${INC}x" != "x" ]]; then
+ cleaner_msg
+ epause 5
+ fi
+}
+
+pkg_postrm() {
+ dual_scripts
+}
+
+cleaner_msg() {
+ eerror "You have had multiple versions of perl. It is recommended"
+ eerror "that you run perl-cleaner now. perl-cleaner will"
+ eerror "assist with this transition. This script is capable"
+ eerror "of cleaning out old .ph files, rebuilding modules for "
+ eerror "your new version of perl, as well as re-emerging"
+ eerror "applications that compiled against your old libperl$(get_libname)"
+ eerror
+ eerror "PLEASE DO NOT INTERRUPT THE RUNNING OF THIS SCRIPT."
+ eerror "Part of the rebuilding of applications compiled against "
+ eerror "your old libperl involves temporarily unmerging"
+ eerror "them - interruptions could leave you with unmerged"
+ eerror "packages before they can be remerged."
+ eerror ""
+ eerror "If you have run perl-cleaner and a package still gives"
+ eerror "you trouble, and re-emerging it fails to correct"
+ eerror "the problem, please check http://bugs.gentoo.org/"
+ eerror "for more information or to report a bug."
+ eerror ""
+ eerror ""
+
+}