summaryrefslogtreecommitdiff
path: root/debian/patches/debian
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/debian')
-rw-r--r--debian/patches/debian/configure-regen.diff32
-rw-r--r--debian/patches/debian/cpan-missing-site-dirs.diff60
-rw-r--r--debian/patches/debian/cpan_definstalldirs.diff34
-rw-r--r--debian/patches/debian/db_file_ver.diff31
-rw-r--r--debian/patches/debian/deprecate-with-apt.diff47
-rw-r--r--debian/patches/debian/disable-stack-check.diff62
-rw-r--r--debian/patches/debian/doc_info.diff33
-rw-r--r--debian/patches/debian/enc2xs_inc.diff67
-rw-r--r--debian/patches/debian/errno_ver.diff41
-rw-r--r--debian/patches/debian/extutils_set_libperl_path.diff23
-rw-r--r--debian/patches/debian/fakeroot.diff39
-rw-r--r--debian/patches/debian/find_html2text.diff33
-rw-r--r--debian/patches/debian/hppa_op_optimize_workaround.diff32
-rw-r--r--debian/patches/debian/hppa_opmini_optimize_workaround.diff26
-rw-r--r--debian/patches/debian/hurd-softupdates.diff24
-rw-r--r--debian/patches/debian/installman-utf8.diff26
-rw-r--r--debian/patches/debian/instmodsh_doc.diff25
-rw-r--r--debian/patches/debian/kfreebsd-softupdates.diff27
-rw-r--r--debian/patches/debian/ld_run_path.diff21
-rw-r--r--debian/patches/debian/libnet_config_path.diff35
-rw-r--r--debian/patches/debian/libperl_embed_doc.diff23
-rw-r--r--debian/patches/debian/makemaker-manext.diff29
-rw-r--r--debian/patches/debian/makemaker-pasthru.diff28
-rw-r--r--debian/patches/debian/mod_paths.diff98
-rw-r--r--debian/patches/debian/no_packlist_perllocal.diff90
-rw-r--r--debian/patches/debian/patchlevel.diff27
-rw-r--r--debian/patches/debian/perl5db-x-terminal-emulator.patch26
-rw-r--r--debian/patches/debian/perlbug-editor.diff22
-rw-r--r--debian/patches/debian/perldoc-pager.diff26
-rw-r--r--debian/patches/debian/perlivp.diff36
-rw-r--r--debian/patches/debian/prune_libs.diff42
-rw-r--r--debian/patches/debian/sh4_op_optimize_workaround.diff29
-rw-r--r--debian/patches/debian/squelch-locale-warnings.diff51
-rw-r--r--debian/patches/debian/writable_site_dirs.diff33
34 files changed, 1278 insertions, 0 deletions
diff --git a/debian/patches/debian/configure-regen.diff b/debian/patches/debian/configure-regen.diff
new file mode 100644
index 0000000..b910221
--- /dev/null
+++ b/debian/patches/debian/configure-regen.diff
@@ -0,0 +1,32 @@
+From: Niko Tyni <ntyni@debian.org>
+Date: Sat, 14 Oct 2017 17:47:09 +0300
+Subject: Regenerate Configure et al. after probe unit changes
+
+Bug-Debian: https://bugs.debian.org/762638
+---
+ Configure | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/Configure b/Configure
+index 684a9c0..c83ca50 100755
+--- a/Configure
++++ b/Configure
+@@ -1487,8 +1487,7 @@ archname=''
+ usereentrant='undef'
+ : List of libraries we want.
+ : If anyone needs extra -lxxx, put those in a hint file.
+-libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
+-libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
++libswanted='gdbm gdbm_compat db dl m c crypt'
+ : We probably want to search /usr/shlib before most other libraries.
+ : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
+ glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
+@@ -23840,7 +23839,7 @@ sunos*X4*)
+ ;;
+ *) case "$usedl" in
+ $define|true|[yY]*)
+- set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
++ set X `echo " $libs " | sed -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldb @ @'`
+ shift
+ perllibs="$*"
+ ;;
diff --git a/debian/patches/debian/cpan-missing-site-dirs.diff b/debian/patches/debian/cpan-missing-site-dirs.diff
new file mode 100644
index 0000000..ec024c6
--- /dev/null
+++ b/debian/patches/debian/cpan-missing-site-dirs.diff
@@ -0,0 +1,60 @@
+From: Niko Tyni <ntyni@debian.org>
+Date: Tue, 16 Oct 2012 23:07:56 +0300
+Subject: Fix CPAN::FirstTime defaults with nonexisting site dirs if a parent
+ is writable
+
+The site directories do not exist on a typical Debian system. The build
+systems will create them when necessary, so there's no need for a prompt
+suggesting local::lib if the first existing parent directory is writable.
+
+Also, writability of the core directories is not interesting as we
+explicitly tell CPAN not to touch those with INSTALLDIRS=site.
+
+Bug-Debian: http://bugs.debian.org/688842
+---
+ cpan/CPAN/lib/CPAN/FirstTime.pm | 31 +++++++++++++++++++++++++++----
+ 1 file changed, 27 insertions(+), 4 deletions(-)
+
+diff --git a/cpan/CPAN/lib/CPAN/FirstTime.pm b/cpan/CPAN/lib/CPAN/FirstTime.pm
+index cdf1dc2..bdb7899 100644
+--- a/cpan/CPAN/lib/CPAN/FirstTime.pm
++++ b/cpan/CPAN/lib/CPAN/FirstTime.pm
+@@ -2067,11 +2067,34 @@ sub _print_urllist {
+ };
+ }
+
++# Debian modification: return true if this directory
++# or the first existing one upwards is writable
++sub _can_write_to_this_or_parent {
++ my ($dir) = @_;
++ my @parts = File::Spec->splitdir($dir);
++ while (@parts) {
++ my $cur = File::Spec->catdir(@parts);
++ return 1 if -w $cur;
++ return 0 if -e _;
++ pop @parts;
++ }
++ return 0;
++}
++
++# Debian specific modification: the site directories don't necessarily
++# exist on the system, but the build systems create them when necessary,
++# so return true if the first existing directory upwards is writable
++#
++# Furthermore, on Debian, only test the site directories
++# (installsite*, expanded to /usr/local/{share,lib}/perl),
++# not the core ones
++# (install*lib, expanded to /usr/{share,lib}/perl).
++# We pass INSTALLDIRS=site by default to keep CPAN from touching
++# the core directories.
++
+ sub _can_write_to_libdirs {
+- return -w $Config{installprivlib}
+- && -w $Config{installarchlib}
+- && -w $Config{installsitelib}
+- && -w $Config{installsitearch}
++ return _can_write_to_this_or_parent($Config{installsitelib})
++ && _can_write_to_this_or_parent($Config{installsitearch})
+ }
+
+ sub _using_installbase {
diff --git a/debian/patches/debian/cpan_definstalldirs.diff b/debian/patches/debian/cpan_definstalldirs.diff
new file mode 100644
index 0000000..d6ce61a
--- /dev/null
+++ b/debian/patches/debian/cpan_definstalldirs.diff
@@ -0,0 +1,34 @@
+From: Brendan O'Dea <bod@debian.org>
+Date: Tue, 8 Mar 2005 19:30:38 +1100
+Subject: Provide a sensible INSTALLDIRS default for modules installed from
+ CPAN.
+
+Some modules which are included in core set INSTALLDIRS => 'perl'
+explicitly in Makefile.PL or Build.PL. This makes sense for the normal @INC
+ordering, but not ours.
+---
+ cpan/CPAN/lib/CPAN/FirstTime.pm | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/cpan/CPAN/lib/CPAN/FirstTime.pm b/cpan/CPAN/lib/CPAN/FirstTime.pm
+index 49fa8ab..cdf1dc2 100644
+--- a/cpan/CPAN/lib/CPAN/FirstTime.pm
++++ b/cpan/CPAN/lib/CPAN/FirstTime.pm
+@@ -1033,7 +1033,7 @@ sub init {
+ my_prompt_loop(prefer_installer => 'MB', $matcher, 'MB|EUMM|RAND');
+
+ if (!$matcher or 'makepl_arg make_arg' =~ /$matcher/) {
+- my_dflt_prompt(makepl_arg => "", $matcher);
++ my_dflt_prompt(makepl_arg => "INSTALLDIRS=site", $matcher);
+ my_dflt_prompt(make_arg => "", $matcher);
+ if ( $CPAN::Config->{makepl_arg} =~ /LIBS=|INC=/ ) {
+ $CPAN::Frontend->mywarn(
+@@ -1065,7 +1065,7 @@ sub init {
+ my_dflt_prompt(make_install_arg => $CPAN::Config->{make_arg} || "",
+ $matcher);
+
+- my_dflt_prompt(mbuildpl_arg => "", $matcher);
++ my_dflt_prompt(mbuildpl_arg => "--installdirs site", $matcher);
+ my_dflt_prompt(mbuild_arg => "", $matcher);
+
+ if (exists $CPAN::HandleConfig::keys{mbuild_install_build_command}
diff --git a/debian/patches/debian/db_file_ver.diff b/debian/patches/debian/db_file_ver.diff
new file mode 100644
index 0000000..4a1fd6c
--- /dev/null
+++ b/debian/patches/debian/db_file_ver.diff
@@ -0,0 +1,31 @@
+From: Brendan O'Dea <bod@debian.org>
+Date: Fri, 16 Dec 2005 01:32:14 +1100
+Subject: Remove overly restrictive DB_File version check.
+
+Bug-Debian: http://bugs.debian.org/340047
+
+Package dependencies ensure the correct library is linked at run-time.
+---
+ cpan/DB_File/version.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/cpan/DB_File/version.c b/cpan/DB_File/version.c
+index e01f6f6..544e6ee 100644
+--- a/cpan/DB_File/version.c
++++ b/cpan/DB_File/version.c
+@@ -48,6 +48,7 @@ __getBerkeleyDBInfo()
+
+ (void)db_version(&Major, &Minor, &Patch) ;
+
++#ifndef DEBIAN
+ /* Check that the versions of db.h and libdb.a are the same */
+ if (Major != DB_VERSION_MAJOR || Minor != DB_VERSION_MINOR )
+ /* || Patch != DB_VERSION_PATCH) */
+@@ -55,6 +56,7 @@ __getBerkeleyDBInfo()
+ croak("\nDB_File was build with libdb version %d.%d.%d,\nbut you are attempting to run it with libdb version %d.%d.%d\n",
+ DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
+ Major, Minor, Patch) ;
++#endif /* DEBIAN */
+
+ /* check that libdb is recent enough -- we need 2.3.4 or greater */
+ if (Major == 2 && (Minor < 3 || (Minor == 3 && Patch < 4)))
diff --git a/debian/patches/debian/deprecate-with-apt.diff b/debian/patches/debian/deprecate-with-apt.diff
new file mode 100644
index 0000000..4867d55
--- /dev/null
+++ b/debian/patches/debian/deprecate-with-apt.diff
@@ -0,0 +1,47 @@
+From: Dominic Hargreaves <dom@earth.li>
+Date: Mon, 17 May 2010 13:23:07 +0300
+Subject: Point users to Debian packages of deprecated core modules
+
+Bug-Debian: http://bugs.debian.org/747628
+---
+ lib/deprecate.pm | 18 +++++++++++++++++-
+ 1 file changed, 17 insertions(+), 1 deletion(-)
+
+diff --git a/lib/deprecate.pm b/lib/deprecate.pm
+index 995322c..057632d 100644
+--- a/lib/deprecate.pm
++++ b/lib/deprecate.pm
+@@ -7,6 +7,16 @@ our $VERSION = 0.04;
+ our %Config;
+ unless (%Config) { require Config; *Config = \%Config::Config; }
+
++# Debian-specific change: recommend the separate Debian packages of
++# deprecated modules where available
++
++our %DEBIAN_PACKAGES = (
++ 'B::Debug' => 'libb-debug-perl',
++ 'Locale::Codes' => 'liblocale-codes-perl',
++ 'Locale::Country' => 'liblocale-codes-perl',
++ 'Locale::Language' => 'liblocale-codes-perl',
++);
++
+ # This isn't a public API. It's internal to code maintained by the perl-porters
+ # If you would like it to be a public API, please send a patch with
+ # documentation and tests. Until then, it may change without warning.
+@@ -58,9 +68,15 @@ EOM
+ if (defined $callers_bitmask
+ && (vec($callers_bitmask, $warnings::Offsets{deprecated}, 1)
+ || vec($callers_bitmask, $warnings::Offsets{all}, 1))) {
+- warn <<"EOM";
++ if (my $deb = $DEBIAN_PACKAGES{$package}) {
++ warn <<"EOM";
++$package will be removed from the Perl core distribution in the next major release. Please install the separate $deb package. It is being used at $call_file, line $call_line.
++EOM
++ } else {
++ warn <<"EOM";
+ $package will be removed from the Perl core distribution in the next major release. Please install it from CPAN. It is being used at $call_file, line $call_line.
+ EOM
++ }
+ }
+ }
+ }
diff --git a/debian/patches/debian/disable-stack-check.diff b/debian/patches/debian/disable-stack-check.diff
new file mode 100644
index 0000000..c5bd2f7
--- /dev/null
+++ b/debian/patches/debian/disable-stack-check.diff
@@ -0,0 +1,62 @@
+From: Niko Tyni <ntyni@debian.org>
+Date: Mon, 16 Jul 2018 10:12:37 +0300
+Subject: Disable debugperl stack extension checks for binary compatibility
+ with perl
+
+When an XS module is built without -DDEBUGGING but the interpreter is,
+the debugging stack high-water mark checking on the interpreter side
+doesn't work properly. This makes /usr/bin/debugperl less useful than
+it could be as it can no longer use many XS module packages.
+
+Patch the check away for now. We hope upstream will provide a Configure
+option for this in the future.
+
+Bug: https://rt.perl.org/Ticket/Display.html?id=133327
+Bug-Debian: https://bugs.debian.org/902779
+---
+ dump.c | 3 +++
+ pp_hot.c | 3 +++
+ 2 files changed, 6 insertions(+)
+
+diff --git a/dump.c b/dump.c
+index 9de1941..cf78366 100644
+--- a/dump.c
++++ b/dump.c
+@@ -2501,6 +2501,8 @@ Perl_runops_debug(pTHX)
+ ++PL_op_exec_cnt[PL_op->op_type];
+ #endif
+ #if defined DEBUGGING && !defined DEBUGGING_RE_ONLY
++/* disabled on Debian due to https://bugs.debian.org/902779 */
++#ifndef DEBIAN
+ if (PL_curstackinfo->si_stack_hwm < PL_stack_sp - PL_stack_base)
+ Perl_croak_nocontext(
+ "panic: previous op failed to extend arg stack: "
+@@ -2508,6 +2510,7 @@ Perl_runops_debug(pTHX)
+ PL_stack_base, PL_stack_sp,
+ PL_stack_base + PL_curstackinfo->si_stack_hwm);
+ PL_curstackinfo->si_stack_hwm = PL_stack_sp - PL_stack_base;
++#endif
+ #endif
+ if (PL_debug) {
+ ENTER;
+diff --git a/pp_hot.c b/pp_hot.c
+index 7d5ffc0..7d15ca6 100644
+--- a/pp_hot.c
++++ b/pp_hot.c
+@@ -5237,6 +5237,8 @@ PP(pp_entersub)
+ CvXSUB(cv)(aTHX_ cv);
+
+ #if defined DEBUGGING && !defined DEBUGGING_RE_ONLY
++/* disabled on Debian due to https://bugs.debian.org/902779 */
++#ifndef DEBIAN
+ /* This duplicates the check done in runops_debug(), but provides more
+ * information in the common case of the fault being with an XSUB.
+ *
+@@ -5250,6 +5252,7 @@ PP(pp_entersub)
+ HvNAME(GvSTASH(CvGV(cv))), GvNAME(CvGV(cv)), CvFILE(cv),
+ PL_stack_base, PL_stack_sp,
+ PL_stack_base + PL_curstackinfo->si_stack_hwm);
++#endif
+ #endif
+ /* Enforce some sanity in scalar context. */
+ if (is_scalar) {
diff --git a/debian/patches/debian/doc_info.diff b/debian/patches/debian/doc_info.diff
new file mode 100644
index 0000000..c003ffb
--- /dev/null
+++ b/debian/patches/debian/doc_info.diff
@@ -0,0 +1,33 @@
+From: Brendan O'Dea <bod@debian.org>
+Date: Fri, 18 Mar 2005 22:22:25 +1100
+Subject: Replace generic man(1) instructions with Debian-specific
+ information.
+
+Indicate that the user needs to install the perl-doc package.
+---
+ pod/perl.pod | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/pod/perl.pod b/pod/perl.pod
+index 3f3fbe4..403e1aa 100644
+--- a/pod/perl.pod
++++ b/pod/perl.pod
+@@ -299,8 +299,16 @@ aux h2ph h2xs perlbug pl2pm pod2html pod2man splain xsubpp
+
+ =for buildtoc __END__
+
+-On a Unix-like system, these documentation files will usually also be
+-available as manpages for use with the F<man> program.
++On Debian systems, you need to install the B<perl-doc> package which
++contains the majority of the standard Perl documentation and the
++F<perldoc> program.
++
++Extensive additional documentation for Perl modules is available, both
++those distributed with Perl and third-party modules which are packaged
++or locally installed.
++
++You should be able to view Perl's documentation with your man(1)
++program or perldoc(1).
+
+ Some documentation is not available as man pages, so if a
+ cross-reference is not found by man, try it with L<perldoc>. Perldoc can
diff --git a/debian/patches/debian/enc2xs_inc.diff b/debian/patches/debian/enc2xs_inc.diff
new file mode 100644
index 0000000..0b2fc42
--- /dev/null
+++ b/debian/patches/debian/enc2xs_inc.diff
@@ -0,0 +1,67 @@
+From: Brendan O'Dea <bod@debian.org>
+Date: Tue, 8 Mar 2005 19:30:38 +1100
+Subject: Tweak enc2xs to follow symlinks and ignore missing @INC directories.
+
+Bug-Debian: http://bugs.debian.org/290336
+
+- ignore missing directories,
+- follow symlinks (/usr/share/perl/5.8 -> 5.8.4).
+- filter "." out when running "enc2xs -C", it's unnecessary and causes
+ issues with follow => 1 (see #603686 and [rt.cpan.org #64585])
+---
+ cpan/Encode/bin/enc2xs | 8 ++++----
+ t/porting/customized.t | 3 +++
+ 2 files changed, 7 insertions(+), 4 deletions(-)
+
+diff --git a/cpan/Encode/bin/enc2xs b/cpan/Encode/bin/enc2xs
+index 619b64b..050c863 100644
+--- a/cpan/Encode/bin/enc2xs
++++ b/cpan/Encode/bin/enc2xs
+@@ -1013,11 +1013,11 @@ use vars qw(
+ sub find_e2x{
+ eval { require File::Find; };
+ my (@inc, %e2x_dir);
+- for my $inc (@INC){
++ for my $inc (grep -d, @INC){
+ push @inc, $inc unless $inc eq '.'; #skip current dir
+ }
+ File::Find::find(
+- sub {
++ { wanted => sub {
+ my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
+ $atime,$mtime,$ctime,$blksize,$blocks)
+ = lstat($_) or return;
+@@ -1027,7 +1027,7 @@ sub find_e2x{
+ $e2x_dir{$File::Find::dir} ||= $mtime;
+ }
+ return;
+- }, @inc);
++ }, follow => 1}, @inc);
+ warn join("\n", keys %e2x_dir), "\n";
+ for my $d (sort {$e2x_dir{$a} <=> $e2x_dir{$b}} keys %e2x_dir){
+ $_E2X = $d;
+@@ -1091,7 +1091,7 @@ sub make_configlocal_pm {
+ $LocalMod{$enc} ||= $mod;
+ }
+ };
+- File::Find::find({wanted => $wanted}, @INC);
++ File::Find::find({wanted => $wanted, follow => 1}, grep -d && !/^\./, @INC);
+ $_ModLines = "";
+ for my $enc ( sort keys %LocalMod ) {
+ $_ModLines .=
+diff --git a/t/porting/customized.t b/t/porting/customized.t
+index d425e5b..d906a82 100644
+--- a/t/porting/customized.t
++++ b/t/porting/customized.t
+@@ -108,8 +108,11 @@ foreach my $module ( sort keys %Modules ) {
+ print $data_fh join(' ', $module, $file, $id), "\n";
+ next;
+ }
++SKIP: {
++ skip("$file modified for Debian", 1) if $file eq 'cpan/Encode/bin/enc2xs';
+ my $should_be = $customised{ $module }->{ $file };
+ is( $id, $should_be, "SHA for $file matches stashed SHA" );
++}
+ }
+ }
+
diff --git a/debian/patches/debian/errno_ver.diff b/debian/patches/debian/errno_ver.diff
new file mode 100644
index 0000000..71ce86d
--- /dev/null
+++ b/debian/patches/debian/errno_ver.diff
@@ -0,0 +1,41 @@
+From: Brendan O'Dea <bod@debian.org>
+Date: Fri, 16 Dec 2005 01:32:14 +1100
+Subject: Remove Errno version check due to upgrade problems with long-running
+ processes.
+
+Bug-Debian: http://bugs.debian.org/343351
+
+Remove version check which can cause problems for long running
+processes embedding perl when upgrading to a newer version,
+compatible, but built on a different machine.
+---
+ ext/Errno/Errno_pm.PL | 16 ----------------
+ 1 file changed, 16 deletions(-)
+
+diff --git a/ext/Errno/Errno_pm.PL b/ext/Errno/Errno_pm.PL
+index 84fd151..9d1454c 100644
+--- a/ext/Errno/Errno_pm.PL
++++ b/ext/Errno/Errno_pm.PL
+@@ -292,22 +292,6 @@ package Errno;
+ require Exporter;
+ use strict;
+
+-EDQ
+-
+- # Errno only needs Config to make sure it hasn't changed platforms.
+- # If someone set $ENV{PERL_BUILD_EXPAND_CONFIG_VARS} at build time,
+- # they've already declared perl doesn't need to worry about this risk.
+- if(!$ENV{'PERL_BUILD_EXPAND_CONFIG_VARS'}) {
+- print <<"CONFIG_CHECK_END";
+-use Config;
+-"\$Config{'archname'}-\$Config{'osvers'}" eq
+-"$archname-$Config{'osvers'}" or
+- die "Errno architecture ($archname-$Config{'osvers'}) does not match executable architecture (\$Config{'archname'}-\$Config{'osvers'})";
+-
+-CONFIG_CHECK_END
+-}
+-
+- print <<"EDQ";
+ our \$VERSION = "$VERSION";
+ \$VERSION = eval \$VERSION;
+ our \@ISA = 'Exporter';
diff --git a/debian/patches/debian/extutils_set_libperl_path.diff b/debian/patches/debian/extutils_set_libperl_path.diff
new file mode 100644
index 0000000..006d6fd
--- /dev/null
+++ b/debian/patches/debian/extutils_set_libperl_path.diff
@@ -0,0 +1,23 @@
+From: Niko Tyni <ntyni@debian.org>
+Date: Sat, 10 May 2014 23:34:14 +0300
+Subject: EU:MM: set location of libperl.a under /usr/lib
+
+The Debian packaging moves libperl.a a couple of levels up from the
+CORE directory to match other static libraries.
+---
+ cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
+index dbb8651..780e390 100644
+--- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
++++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
+@@ -2564,7 +2564,7 @@ MAP_PRELIBS = $Config{perllibs} $Config{cryptlib}
+ ($lperl = $libperl) =~ s/\$\(A\)/$self->{LIB_EXT}/;
+ }
+ unless ($libperl && -f $lperl) { # Ilya's code...
+- my $dir = $self->{PERL_SRC} || "$self->{PERL_ARCHLIB}/CORE";
++ my $dir = $self->{PERL_SRC} || "$self->{PERL_ARCHLIB}/../..";
+ $dir = "$self->{PERL_ARCHLIB}/.." if $self->{UNINSTALLED_PERL};
+ $libperl ||= "libperl$self->{LIB_EXT}";
+ $libperl = "$dir/$libperl";
diff --git a/debian/patches/debian/fakeroot.diff b/debian/patches/debian/fakeroot.diff
new file mode 100644
index 0000000..01cfd11
--- /dev/null
+++ b/debian/patches/debian/fakeroot.diff
@@ -0,0 +1,39 @@
+From: Brendan O'Dea <bod@debian.org>
+Date: Fri, 18 Mar 2005 22:22:25 +1100
+Subject: Postpone LD_LIBRARY_PATH evaluation to the binary targets.
+
+Modify the setting of LD_LIBRARY_PATH to append pre-existing values at the
+time the rule is evaluated rather than when the Makefile is created.
+
+This is required when building packages with dpkg-buildpackage and fakeroot,
+since fakeroot (which now sets LD_LIBRARY_PATH) is not used for the "build"
+rule where the Makefile is created, but is for the clean/binary* targets.
+---
+ Makefile.SH | 7 ++-----
+ 1 file changed, 2 insertions(+), 5 deletions(-)
+
+diff --git a/Makefile.SH b/Makefile.SH
+index 5777970..f8adb85 100755
+--- a/Makefile.SH
++++ b/Makefile.SH
+@@ -48,10 +48,7 @@ case "$useshrplib" in
+ true)
+ # Prefix all runs of 'miniperl' and 'perl' with
+ # $ldlibpth so that ./perl finds *this* shared libperl.
+- case "$LD_LIBRARY_PATH" in
+- '') ldlibpth="LD_LIBRARY_PATH=` quote "$pwd" `" ;;
+- *) ldlibpth="LD_LIBRARY_PATH=` quote "$pwd" `:` quote "$LD_LIBRARY_PATH" `" ;;
+- esac
++ ldlibpth="LD_LIBRARY_PATH=` quote "$pwd" `"'$${LD_LIBRARY_PATH:+:}$$LD_LIBRARY_PATH'
+
+ pldlflags="$cccdlflags"
+ static_ldflags=''
+@@ -130,7 +127,7 @@ true)
+ ;;
+ esac
+ case "$ldlibpthname" in
+- '') ;;
++ ''|LD_LIBRARY_PATH) ;;
+ *)
+ case "$osname" in
+ os2)
diff --git a/debian/patches/debian/find_html2text.diff b/debian/patches/debian/find_html2text.diff
new file mode 100644
index 0000000..cc87c43
--- /dev/null
+++ b/debian/patches/debian/find_html2text.diff
@@ -0,0 +1,33 @@
+From: Andreas Marschke <andreas.marschke@googlemail.com>
+Date: Sat, 17 Sep 2011 11:38:42 +0100
+Subject: Configure CPAN::Distribution with correct name of html2text
+
+Bug-Debian: http://bugs.debian.org/640479
+
+If you use cpan from Debian you usually wind up trying to read online
+documentation through it. Unfortunately cpan can't find the
+html2text.pl script even though it is installed using the Debian
+package 'html2text'.
+
+Please see the attached patch for a quick fix of this issue.
+
+[Maintainer's note: html2text in Debian is not the same implementation
+as the html2text.pl which is expected, but should provide similar
+functionality].
+---
+ cpan/CPAN/lib/CPAN/Distribution.pm | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/cpan/CPAN/lib/CPAN/Distribution.pm b/cpan/CPAN/lib/CPAN/Distribution.pm
+index 717c9aa..6342955 100644
+--- a/cpan/CPAN/lib/CPAN/Distribution.pm
++++ b/cpan/CPAN/lib/CPAN/Distribution.pm
+@@ -4187,7 +4187,7 @@ sub _display_url {
+ if $CPAN::DEBUG;
+
+ # should we define it in the config instead?
+- my $html_converter = "html2text.pl";
++ my $html_converter = "html2text";
+
+ my $web_browser = $CPAN::Config->{'lynx'} || undef;
+ my $web_browser_out = $web_browser
diff --git a/debian/patches/debian/hppa_op_optimize_workaround.diff b/debian/patches/debian/hppa_op_optimize_workaround.diff
new file mode 100644
index 0000000..518a6a1
--- /dev/null
+++ b/debian/patches/debian/hppa_op_optimize_workaround.diff
@@ -0,0 +1,32 @@
+From: Niko Tyni <ntyni@debian.org>
+Date: Sun, 25 Sep 2016 09:59:22 +0200
+Subject: Temporarily lower the optimization of op.c on hppa due to gcc-6
+ problems
+
+This fixes a crash in ext/XS-APItest/t/customop.t
+
+It's currently unclear if the problem is with the code or the
+gcc-6 optimizer.
+
+Bug-Debian: https://bugs.debian.org/838613
+---
+ cflags.SH | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/cflags.SH b/cflags.SH
+index e60742f..3e4526f 100755
+--- a/cflags.SH
++++ b/cflags.SH
+@@ -497,6 +497,12 @@ for file do
+ # or customize here
+
+ case "$file" in
++ op) : work around http://bugs.debian.org/838613
++ case $archname in
++ hppa-*)
++ optimize="$optimize -O0";;
++ esac;;
++
+ regcomp) : work around http://bugs.debian.org/754054
+ case $archname in
+ mips-*|mipsel-*)
diff --git a/debian/patches/debian/hppa_opmini_optimize_workaround.diff b/debian/patches/debian/hppa_opmini_optimize_workaround.diff
new file mode 100644
index 0000000..8e0efb7
--- /dev/null
+++ b/debian/patches/debian/hppa_opmini_optimize_workaround.diff
@@ -0,0 +1,26 @@
+From: Niko Tyni <ntyni@debian.org>
+Date: Sat, 29 Jul 2017 23:30:20 +0300
+Subject: Lower the optimization level of opmini.c on hppa
+
+This further amends debian/hppa_op_optimize_workaround.diff to affect
+miniperl too.
+
+Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81538
+Bug-Debian: https://bugs.debian.org/869122
+---
+ cflags.SH | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/cflags.SH b/cflags.SH
+index 3e4526f..c8231e6 100755
+--- a/cflags.SH
++++ b/cflags.SH
+@@ -497,7 +497,7 @@ for file do
+ # or customize here
+
+ case "$file" in
+- op) : work around http://bugs.debian.org/838613
++ op|opmini) : work around http://bugs.debian.org/838613 and 869122
+ case $archname in
+ hppa-*)
+ optimize="$optimize -O0";;
diff --git a/debian/patches/debian/hurd-softupdates.diff b/debian/patches/debian/hurd-softupdates.diff
new file mode 100644
index 0000000..b13cd57
--- /dev/null
+++ b/debian/patches/debian/hurd-softupdates.diff
@@ -0,0 +1,24 @@
+From: Niko Tyni <ntyni@debian.org>
+Date: Thu, 28 Apr 2016 16:31:39 +0300
+Subject: Fix t/op/stat.t failures on hurd
+
+We already do this on GNU/kFreeBSD, and GNU/Hurd seems to need same
+treatment.
+
+Bug-Debian: https://bugs.debian.org/822735
+---
+ t/op/stat.t | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/t/op/stat.t b/t/op/stat.t
+index 2e75fec..19a6615 100644
+--- a/t/op/stat.t
++++ b/t/op/stat.t
+@@ -102,6 +102,7 @@ print FOO "Now is the time for all good men to come to.\n";
+ close(FOO);
+
+ stat($tmpfile) if $^O =~ /^gnukfreebsd/; # Work around Debian Bug#796798
++stat($tmpfile) if $^O eq 'gnu'; # Work around Debian Bug#822735
+ sleep 2;
+
+ my $has_link = 1;
diff --git a/debian/patches/debian/installman-utf8.diff b/debian/patches/debian/installman-utf8.diff
new file mode 100644
index 0000000..2da23b7
--- /dev/null
+++ b/debian/patches/debian/installman-utf8.diff
@@ -0,0 +1,26 @@
+From: Niko Tyni <ntyni@debian.org>
+Date: Sat, 19 Nov 2016 21:30:46 +0200
+Subject: Generate man pages with UTF-8 characters
+
+This fixes totally incorrectly rendered manual pages like
+perlunicook and perltw.
+
+TODO: should probably be a Configure option for proper upstreaming.
+
+Bug-Debian: https://bugs.debian.org/840211
+---
+ installman | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/installman b/installman
+index 0154be4..fff0ff0 100755
+--- a/installman
++++ b/installman
+@@ -161,6 +161,7 @@ sub pod2man {
+ $manpage = "${mandir}/${manpage}.${manext}";
+
+ my $parser = Pod::Man->new( section => $manext,
++ utf8 => 1,
+ official=> 1,
+ center => 'Perl Programmers Reference Guide'
+ );
diff --git a/debian/patches/debian/instmodsh_doc.diff b/debian/patches/debian/instmodsh_doc.diff
new file mode 100644
index 0000000..00ffbd3
--- /dev/null
+++ b/debian/patches/debian/instmodsh_doc.diff
@@ -0,0 +1,25 @@
+From: Brendan O'Dea <bod@debian.org>
+Date: Tue, 8 Mar 2005 19:30:38 +1100
+Subject: Debian policy doesn't install .packlist files for core or vendor.
+
+---
+ cpan/ExtUtils-MakeMaker/bin/instmodsh | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/cpan/ExtUtils-MakeMaker/bin/instmodsh b/cpan/ExtUtils-MakeMaker/bin/instmodsh
+index ab0f9d1..b3b109f 100644
+--- a/cpan/ExtUtils-MakeMaker/bin/instmodsh
++++ b/cpan/ExtUtils-MakeMaker/bin/instmodsh
+@@ -19,9 +19,11 @@ instmodsh - A shell to examine installed modules
+
+ =head1 DESCRIPTION
+
+-A little interface to ExtUtils::Installed to examine installed modules,
++A little interface to ExtUtils::Installed to examine locally* installed modules,
+ validate your packlists and even create a tarball from an installed module.
+
++*On Debian system, B<core> and B<vendor> modules are managed by C<dpkg>.
++
+ =head1 SEE ALSO
+
+ ExtUtils::Installed
diff --git a/debian/patches/debian/kfreebsd-softupdates.diff b/debian/patches/debian/kfreebsd-softupdates.diff
new file mode 100644
index 0000000..2edf4be
--- /dev/null
+++ b/debian/patches/debian/kfreebsd-softupdates.diff
@@ -0,0 +1,27 @@
+From: Steven Chamberlain <steven@pyro.eu.org>
+Date: Thu, 17 Dec 2015 02:15:58 +0000
+Subject: Work around Debian Bug#796798
+
+kFreeBSD 10 (possibly only with softupdates enabled) may defer
+calculating the mtime for more than 2 seconds. Work around this
+with a stat() call to calculate the mtime immediately.
+
+(Modified to only stat() on kfreebsd by Niko Tyni)
+
+Bug-Debian: https://bugs.debian.org/796798
+---
+ t/op/stat.t | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/t/op/stat.t b/t/op/stat.t
+index e0ce03b..2e75fec 100644
+--- a/t/op/stat.t
++++ b/t/op/stat.t
+@@ -101,6 +101,7 @@ sleep 3 if $funky_FAT_timestamps;
+ print FOO "Now is the time for all good men to come to.\n";
+ close(FOO);
+
++stat($tmpfile) if $^O =~ /^gnukfreebsd/; # Work around Debian Bug#796798
+ sleep 2;
+
+ my $has_link = 1;
diff --git a/debian/patches/debian/ld_run_path.diff b/debian/patches/debian/ld_run_path.diff
new file mode 100644
index 0000000..40b4f70
--- /dev/null
+++ b/debian/patches/debian/ld_run_path.diff
@@ -0,0 +1,21 @@
+From: Brendan O'Dea <bod@debian.org>
+Date: Fri, 18 Mar 2005 22:22:25 +1100
+Subject: Remove standard libs from LD_RUN_PATH as per Debian policy.
+
+---
+ cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm
+index a6da855..fb849b2 100644
+--- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm
++++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm
+@@ -62,6 +62,8 @@ sub _unix_os2_ext {
+ $potential_libs =~ s/(^|\s)(-(?:weak_|reexport_|lazy_)?framework)\s+(\S+)/$1-Wl,$2 -Wl,$3/g;
+ $potential_libs =~ s/(^|\s)(-F)\s*(\S+)/$1-Wl,$2 -Wl,$3/g;
+ }
++ # Debian-specific: don't use LD_RUN_PATH for standard dirs
++ $ld_run_path_seen{$_}++ for @libpath;
+
+ foreach my $thislib ( split ' ', $potential_libs ) {
+ my ( $custom_name ) = '';
diff --git a/debian/patches/debian/libnet_config_path.diff b/debian/patches/debian/libnet_config_path.diff
new file mode 100644
index 0000000..3d9a1e1
--- /dev/null
+++ b/debian/patches/debian/libnet_config_path.diff
@@ -0,0 +1,35 @@
+From: Brendan O'Dea <bod@debian.org>
+Date: Tue, 8 Mar 2005 19:30:38 +1100
+Subject: Set location of libnet.cfg to /etc/perl/Net as /usr may not be
+ writable.
+
+---
+ cpan/libnet/lib/Net/Config.pm | 7 +++----
+ 1 file changed, 3 insertions(+), 4 deletions(-)
+
+diff --git a/cpan/libnet/lib/Net/Config.pm b/cpan/libnet/lib/Net/Config.pm
+index 4f822a4..4b39781 100644
+--- a/cpan/libnet/lib/Net/Config.pm
++++ b/cpan/libnet/lib/Net/Config.pm
+@@ -72,9 +72,8 @@ my %nc = (
+ TRY_INTERNET_CONFIG
+ }
+
+-my $file = __FILE__;
++my $file = '/etc/perl/Net/libnet.cfg';
+ my $ref;
+-$file =~ s/Config.pm/libnet.cfg/;
+ if (-f $file) {
+ $ref = eval { local $SIG{__DIE__}; do $file };
+ if (ref($ref) eq 'HASH') {
+@@ -146,8 +145,8 @@ Net::Config - Local configuration data for libnet
+ C<Net::Config> holds configuration data for the modules in the libnet
+ distribution. During installation you will be asked for these values.
+
+-The configuration data is held globally in a file in the perl installation
+-tree, but a user may override any of these values by providing their own. This
++The configuration data is held globally in C</etc/perl/Net/libnet.cfg>,
++but a user may override any of these values by providing their own. This
+ can be done by having a C<.libnetrc> file in their home directory. This file
+ should return a reference to a HASH containing the keys described below.
+ For example
diff --git a/debian/patches/debian/libperl_embed_doc.diff b/debian/patches/debian/libperl_embed_doc.diff
new file mode 100644
index 0000000..6be7ade
--- /dev/null
+++ b/debian/patches/debian/libperl_embed_doc.diff
@@ -0,0 +1,23 @@
+From: Brendan O'Dea <bod@debian.org>
+Date: Tue, 8 Mar 2005 19:30:38 +1100
+Subject: Note that libperl-dev package is required for embedded linking
+
+Bug-Debian: http://bugs.debian.org/186778
+---
+ lib/ExtUtils/Embed.pm | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/lib/ExtUtils/Embed.pm b/lib/ExtUtils/Embed.pm
+index e75e41f..985c353 100644
+--- a/lib/ExtUtils/Embed.pm
++++ b/lib/ExtUtils/Embed.pm
+@@ -293,6 +293,9 @@ and extensions in your C/C++ applications.
+ Typically, an application F<Makefile> will invoke C<ExtUtils::Embed>
+ functions while building your application.
+
++Note that on Debian systems the B<libperl-dev> package is required for
++compiling applications which embed an interpreter.
++
+ =head1 @EXPORT
+
+ C<ExtUtils::Embed> exports the following functions:
diff --git a/debian/patches/debian/makemaker-manext.diff b/debian/patches/debian/makemaker-manext.diff
new file mode 100644
index 0000000..e9f6bcb
--- /dev/null
+++ b/debian/patches/debian/makemaker-manext.diff
@@ -0,0 +1,29 @@
+From: Niko Tyni <ntyni@debian.org>
+Date: Wed, 1 Jul 2015 22:23:53 +0300
+Subject: Make EU::MakeMaker honour MANnEXT settings in generated manpage
+ headers
+
+This was inherited from early changes by Brendan O'Dea, previously
+(accidentally) in debian/prefix_changes.diff and before that in
+debian/extutils_hacks.diff
+
+Bug-Debian: https://bugs.debian.org/247370
+---
+ cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Any.pm | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Any.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Any.pm
+index 1a3893c..8bb0ef2 100644
+--- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Any.pm
++++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Any.pm
+@@ -1090,8 +1090,8 @@ END
+ my @man_cmds;
+ foreach my $section (qw(1 3)) {
+ my $pods = $self->{"MAN${section}PODS"};
+- my $p2m = sprintf <<'CMD', $section, $] > 5.008 ? " -u" : "";
+- $(NOECHO) $(POD2MAN) --section=%s --perm_rw=$(PERM_RW)%s
++ my $p2m = sprintf <<CMD, $] > 5.008 ? " -u" : "";
++ \$(NOECHO) \$(POD2MAN) --section=\$(MAN${section}EXT) --perm_rw=\$(PERM_RW)%s
+ CMD
+ push @man_cmds, $self->split_command($p2m, map {($_,$pods->{$_})} sort keys %$pods);
+ }
diff --git a/debian/patches/debian/makemaker-pasthru.diff b/debian/patches/debian/makemaker-pasthru.diff
new file mode 100644
index 0000000..c240441
--- /dev/null
+++ b/debian/patches/debian/makemaker-pasthru.diff
@@ -0,0 +1,28 @@
+From: Niko Tyni <ntyni@debian.org>
+Date: Sun, 24 Aug 2014 12:56:11 -0700
+Subject: Pass LD settings through to subdirectories
+
+[rt.cpan.org #28632] fixed most issues with passing LD down to
+subdirectory Makefile.PL files. However, there are some distributions
+(including Wx, Par::Packer, and Verilog-Perl) that explicitly set
+LD. Those still can't be overridden from the command line. Adding LD to
+the PASTHRU list fixes this.
+
+Bug-Debian: https://bugs.debian.org/758471
+---
+ cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
+index 4977baa..bb41b27 100644
+--- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
++++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
+@@ -2955,7 +2955,7 @@ sub pasthru {
+ my($sep) = $Is{VMS} ? ',' : '';
+ $sep .= "\\\n\t";
+
+- foreach my $key (qw(LIB LIBPERL_A LINKTYPE OPTIMIZE
++ foreach my $key (qw(LIB LIBPERL_A LINKTYPE OPTIMIZE LD
+ PREFIX INSTALL_BASE)
+ )
+ {
diff --git a/debian/patches/debian/mod_paths.diff b/debian/patches/debian/mod_paths.diff
new file mode 100644
index 0000000..e32356f
--- /dev/null
+++ b/debian/patches/debian/mod_paths.diff
@@ -0,0 +1,98 @@
+From: Brendan O'Dea <bod@debian.org>
+Date: Fri, 18 Mar 2005 22:22:25 +1100
+Subject: Tweak @INC ordering for Debian
+
+Our order is:
+
+ etc (for config files)
+ site (5.8.1)
+ vendor (all)
+ core (5.8.1)
+ site (version-indep)
+ site (pre-5.8.1)
+
+The rationale being that an admin (via site), or module packager
+(vendor) can chose to shadow core modules when there is a newer
+version than is included in core.
+
+(later updates by Niko Tyni)
+---
+ perl.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 58 insertions(+)
+
+diff --git a/perl.c b/perl.c
+index f2de479..52ad1fd 100644
+--- a/perl.c
++++ b/perl.c
+@@ -4697,6 +4697,10 @@ S_init_perllib(pTHX)
+ SITEARCH, SITELIB, VENDORARCH, VENDORLIB, ARCHLIB and PRIVLIB
+ */
+ INCPUSH_APPLLIB_EXP
++#ifdef DEBIAN
++ /* for configuration where /usr is mounted ro (CPAN::Config, Net::Config) */
++ S_incpush_use_sep(aTHX_ STR_WITH_LEN("/etc/perl"), 0x0);
++#endif
+ INCPUSH_SITEARCH_EXP
+ INCPUSH_SITELIB_EXP
+ INCPUSH_PERL_VENDORARCH_EXP
+@@ -4708,6 +4712,60 @@ S_init_perllib(pTHX)
+ INCPUSH_APPLLIB_OLD_EXP
+ INCPUSH_SITELIB_STEM
+ INCPUSH_PERL_VENDORLIB_STEM
++
++#ifdef DEBIAN
++ /* Non-versioned site directory for local modules and for
++ compatability with the previous packages' site dirs */
++ S_incpush_use_sep(aTHX_ STR_WITH_LEN("/usr/local/lib/site_perl"),
++ INCPUSH_ADD_SUB_DIRS);
++
++#ifdef PERL_INC_VERSION_LIST
++ {
++ struct stat s;
++
++ /* add small buffer in case old versions are longer than the
++ current version */
++ char sitearch[sizeof(SITEARCH_EXP)+16] = SITEARCH_EXP;
++ char sitelib[sizeof(SITELIB_EXP)+16] = SITELIB_EXP;
++ char const *vers[] = { PERL_INC_VERSION_LIST };
++ char const **p;
++
++ char *arch_vers = strrchr(sitearch, '/');
++ char *lib_vers = strrchr(sitelib, '/');
++
++ if (arch_vers && isdigit(*++arch_vers))
++ *arch_vers = 0;
++ else
++ arch_vers = 0;
++
++ if (lib_vers && isdigit(*++lib_vers))
++ *lib_vers = 0;
++ else
++ lib_vers = 0;
++
++ /* there is some duplication here as incpush does something
++ similar internally, but required as sitearch is not a
++ subdirectory of sitelib */
++ for (p = vers; *p; p++)
++ {
++ if (arch_vers && !strchr(*p, '/')) /* skip arch-specific subdirs */
++ {
++ my_snprintf(arch_vers, 16, "%s", *p);
++ if (PerlLIO_stat(sitearch, &s) >= 0 && S_ISDIR(s.st_mode))
++ S_incpush_use_sep(aTHX_ sitearch, strlen(sitearch), 0x0);
++ }
++
++ if (lib_vers && !strchr(*p, '/')) /* skip arch-specific subdirs */
++ {
++ my_snprintf(lib_vers, 16, "%s", *p);
++ if (PerlLIO_stat(sitelib, &s) >= 0 && S_ISDIR(s.st_mode))
++ S_incpush_use_sep(aTHX_ sitelib, strlen(sitelib), 0x0);
++ }
++ }
++ }
++#endif
++#endif
++
+ INCPUSH_PERL_OTHERLIBDIRS_ARCHONLY
+
+ #endif /* !PERL_IS_MINIPERL */
diff --git a/debian/patches/debian/no_packlist_perllocal.diff b/debian/patches/debian/no_packlist_perllocal.diff
new file mode 100644
index 0000000..8c7b11a
--- /dev/null
+++ b/debian/patches/debian/no_packlist_perllocal.diff
@@ -0,0 +1,90 @@
+From: Brendan O'Dea <bod@debian.org>
+Date: Tue, 8 Mar 2005 19:30:38 +1100
+Subject: Don't install .packlist or perllocal.pod for perl or vendor
+
+---
+ cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm | 35 +++----------------------
+ 1 file changed, 3 insertions(+), 32 deletions(-)
+
+diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
+index 780e390..4977baa 100644
+--- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
++++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
+@@ -2232,11 +2232,6 @@ pure_perl_install :: all
+ $(NOECHO) umask 022; $(MOD_INSTALL) \
+ };
+
+- push @m,
+-q{ read "}.$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q{" \
+- write "}.$self->catfile('$(DESTINSTALLARCHLIB)','auto','$(FULLEXT)','.packlist').q{" \
+-} unless $self->{NO_PACKLIST};
+-
+ push @m,
+ q{ "$(INST_LIB)" "$(DESTINSTALLPRIVLIB)" \
+ "$(INST_ARCHLIB)" "$(DESTINSTALLARCHLIB)" \
+@@ -2269,10 +2264,6 @@ q{ "$(INST_LIB)" "$(DESTINSTALLSITELIB)" \
+ pure_vendor_install :: all
+ $(NOECHO) umask 022; $(MOD_INSTALL) \
+ };
+- push @m,
+-q{ read "}.$self->catfile('$(VENDORARCHEXP)','auto','$(FULLEXT)','.packlist').q{" \
+- write "}.$self->catfile('$(DESTINSTALLVENDORARCH)','auto','$(FULLEXT)','.packlist').q{" \
+-} unless $self->{NO_PACKLIST};
+
+ push @m,
+ q{ "$(INST_LIB)" "$(DESTINSTALLVENDORLIB)" \
+@@ -2298,37 +2289,19 @@ doc_vendor_install :: all
+
+ push @m, q{
+ doc_perl_install :: all
+- $(NOECHO) $(ECHO) Appending installation info to "$(DESTINSTALLARCHLIB)/perllocal.pod"
+- -$(NOECHO) umask 022; $(MKPATH) "$(DESTINSTALLARCHLIB)"
+- -$(NOECHO) umask 022; $(DOC_INSTALL) \
+- "Module" "$(NAME)" \
+- "installed into" "$(INSTALLPRIVLIB)" \
+- LINKTYPE "$(LINKTYPE)" \
+- VERSION "$(VERSION)" \
+- EXE_FILES "$(EXE_FILES)" \
+- >> "}.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{"
+
+ doc_site_install :: all
+- $(NOECHO) $(ECHO) Appending installation info to "$(DESTINSTALLARCHLIB)/perllocal.pod"
+- -$(NOECHO) umask 02; $(MKPATH) "$(DESTINSTALLARCHLIB)"
++ $(NOECHO) $(ECHO) Appending installation info to "$(DESTINSTALLSITEARCH)/perllocal.pod"
++ -$(NOECHO) umask 02; $(MKPATH) "$(DESTINSTALLSITEARCH)"
+ -$(NOECHO) umask 02; $(DOC_INSTALL) \
+ "Module" "$(NAME)" \
+ "installed into" "$(INSTALLSITELIB)" \
+ LINKTYPE "$(LINKTYPE)" \
+ VERSION "$(VERSION)" \
+ EXE_FILES "$(EXE_FILES)" \
+- >> "}.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{"
++ >> "}.$self->catfile('$(DESTINSTALLSITEARCH)','perllocal.pod').q{"
+
+ doc_vendor_install :: all
+- $(NOECHO) $(ECHO) Appending installation info to "$(DESTINSTALLARCHLIB)/perllocal.pod"
+- -$(NOECHO) umask 022; $(MKPATH) "$(DESTINSTALLARCHLIB)"
+- -$(NOECHO) umask 022; $(DOC_INSTALL) \
+- "Module" "$(NAME)" \
+- "installed into" "$(INSTALLVENDORLIB)" \
+- LINKTYPE "$(LINKTYPE)" \
+- VERSION "$(VERSION)" \
+- EXE_FILES "$(EXE_FILES)" \
+- >> "}.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{"
+
+ } unless $self->{NO_PERLLOCAL};
+
+@@ -2337,13 +2310,11 @@ uninstall :: uninstall_from_$(INSTALLDIRS)dirs
+ $(NOECHO) $(NOOP)
+
+ uninstall_from_perldirs ::
+- $(NOECHO) $(UNINSTALL) "}.$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q{"
+
+ uninstall_from_sitedirs ::
+ $(NOECHO) $(UNINSTALL) "}.$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q{"
+
+ uninstall_from_vendordirs ::
+- $(NOECHO) $(UNINSTALL) "}.$self->catfile('$(VENDORARCHEXP)','auto','$(FULLEXT)','.packlist').q{"
+ };
+
+ join("",@m);
diff --git a/debian/patches/debian/patchlevel.diff b/debian/patches/debian/patchlevel.diff
new file mode 100644
index 0000000..2b9cb3d
--- /dev/null
+++ b/debian/patches/debian/patchlevel.diff
@@ -0,0 +1,27 @@
+From: Niko Tyni <ntyni@debian.org>
+Date: Sun, 15 May 2011 19:35:58 +0300
+Subject: List packaged patches in patchlevel.h
+
+Origin: vendor
+Bug-Debian: http://bugs.debian.org/567489
+
+The list of packaged patches is in patchlevel-debian.h, which is generated
+from the debian/patches/ directory when building the package.
+---
+ patchlevel.h | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/patchlevel.h b/patchlevel.h
+index acafc2b..814b30d 100644
+--- a/patchlevel.h
++++ b/patchlevel.h
+@@ -137,6 +137,9 @@ static const char * const local_patches[] = {
+ ,"uncommitted-changes"
+ #endif
+ PERL_GIT_UNPUSHED_COMMITS /* do not remove this line */
++#ifdef DEBIAN
++#include "patchlevel-debian.h"
++#endif
+ ,NULL
+ };
+
diff --git a/debian/patches/debian/perl5db-x-terminal-emulator.patch b/debian/patches/debian/perl5db-x-terminal-emulator.patch
new file mode 100644
index 0000000..0d43a33
--- /dev/null
+++ b/debian/patches/debian/perl5db-x-terminal-emulator.patch
@@ -0,0 +1,26 @@
+From: Dominic Hargreaves <dom@earth.li>
+Date: Sat, 14 Apr 2012 11:34:05 +0100
+Subject: Invoke x-terminal-emulator rather than xterm in perl5db.pl
+
+In Debian systems, xterm might not exist or might not be the preferred
+terminal emulator. Use x-terminal-emulator instead
+
+Bug-Debian: http://bugs.debian.org/668490
+Forwarded: not-needed
+---
+ lib/perl5db.pl | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/perl5db.pl b/lib/perl5db.pl
+index e8a29da..1855c87 100644
+--- a/lib/perl5db.pl
++++ b/lib/perl5db.pl
+@@ -6985,7 +6985,7 @@ properly set up.
+ sub xterm_get_fork_TTY {
+ ( my $name = $0 ) =~ s,^.*[/\\],,s;
+ open XT,
+-qq[3>&1 xterm -title "Daughter Perl debugger $pids $name" -e sh -c 'tty 1>&3;\
++qq[3>&1 x-terminal-emulator -T "Daughter Perl debugger $pids $name" -e sh -c 'tty 1>&3;\
+ sleep 10000000' |];
+
+ # Get the output from 'tty' and clean it up a little.
diff --git a/debian/patches/debian/perlbug-editor.diff b/debian/patches/debian/perlbug-editor.diff
new file mode 100644
index 0000000..3909e00
--- /dev/null
+++ b/debian/patches/debian/perlbug-editor.diff
@@ -0,0 +1,22 @@
+From: Niko Tyni <ntyni@debian.org>
+Date: Sun, 24 Feb 2019 10:15:49 +0200
+Subject: Use "editor" as the default perlbug editor, as per Debian policy
+
+Bug-Debian: https://bugs.debian.org/922609
+---
+ utils/perlbug.PL | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/utils/perlbug.PL b/utils/perlbug.PL
+index d1eb1e0..4555d04 100644
+--- a/utils/perlbug.PL
++++ b/utils/perlbug.PL
+@@ -272,7 +272,7 @@ sub Init {
+ $ed = $opt{e} || $ENV{VISUAL} || $ENV{EDITOR} || $ENV{EDIT}
+ || ($Is_VMS && "edit/tpu")
+ || ($Is_MSWin32 && "notepad")
+- || "vi";
++ || "editor";
+
+ # Not OK - provide build failure template by finessing OK report
+ if ($opt{n}) {
diff --git a/debian/patches/debian/perldoc-pager.diff b/debian/patches/debian/perldoc-pager.diff
new file mode 100644
index 0000000..8ae92cb
--- /dev/null
+++ b/debian/patches/debian/perldoc-pager.diff
@@ -0,0 +1,26 @@
+From: Niko Tyni <ntyni@debian.org>
+Date: Fri, 13 Oct 2017 11:59:34 +0300
+Subject: Fix perldoc terminal escapes when sensible-pager is less
+
+This is a temporary fix while upstream is reworking the
+pager handling.
+
+Bug: https://rt.cpan.org/Public/Bug/Display.html?id=120229
+Bug-Debian: https://bugs.debian.org/870340
+---
+ cpan/Pod-Perldoc/lib/Pod/Perldoc/ToTerm.pm | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/cpan/Pod-Perldoc/lib/Pod/Perldoc/ToTerm.pm b/cpan/Pod-Perldoc/lib/Pod/Perldoc/ToTerm.pm
+index 9501d63..a5aedf6 100644
+--- a/cpan/Pod-Perldoc/lib/Pod/Perldoc/ToTerm.pm
++++ b/cpan/Pod-Perldoc/lib/Pod/Perldoc/ToTerm.pm
+@@ -32,7 +32,7 @@ sub pager_configuration {
+ # do not modify anything on Windows or DOS
+ return if ( $perldoc->is_mswin32 || $perldoc->is_dos );
+
+- if ( $pager =~ /less/ ) {
++ if ( $pager =~ /sensible-pager|less/ ) {
+ $self->_maybe_modify_environment('LESS');
+ }
+ elsif ( $pager =~ /more/ ) {
diff --git a/debian/patches/debian/perlivp.diff b/debian/patches/debian/perlivp.diff
new file mode 100644
index 0000000..682f3e4
--- /dev/null
+++ b/debian/patches/debian/perlivp.diff
@@ -0,0 +1,36 @@
+From: Niko Tyni <ntyni@debian.org>
+Date: Fri, 9 Jan 2009 18:54:47 +0200
+Subject: Make perlivp skip include directories in /usr/local
+
+Bug-Debian: http://bugs.debian.org/510895
+
+On Sat, Jan 10, 2009 at 12:37:18AM +1100, Brendan O'Dea wrote:
+> On Wed, Jan 7, 2009 at 12:21 AM, Niko Tyni <ntyni@debian.org> wrote:
+
+> > We could create the directories in a postinst script, but I'm not sure
+> > I see the point. They will be created automatically when installing
+> > CPAN modules.
+>
+> The directories are intentionally not created, as this way they are
+> excluded from the search path at start-up, saving a bunch of wasted
+> stats at use/require time in the common case that the user has not
+> installed any local packages. As Niko points out, they will be
+> created as required.
+
+Signed-off-by: Niko Tyni <ntyni@debian.org>
+---
+ utils/perlivp.PL | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/utils/perlivp.PL b/utils/perlivp.PL
+index 50d187a..bd8091c 100644
+--- a/utils/perlivp.PL
++++ b/utils/perlivp.PL
+@@ -155,6 +155,7 @@ my $INC_total = 0;
+ my $INC_there = 0;
+ foreach (@INC) {
+ next if $_ eq '.'; # skip -d test here
++ next if m|/usr/local|; # not shipped on Debian
+ if (-d $_) {
+ print "## Perl \@INC directory '$_' exists.\n" if $opt{'v'};
+ $INC_there++;
diff --git a/debian/patches/debian/prune_libs.diff b/debian/patches/debian/prune_libs.diff
new file mode 100644
index 0000000..2ef92a2
--- /dev/null
+++ b/debian/patches/debian/prune_libs.diff
@@ -0,0 +1,42 @@
+From: Brendan O'Dea <bod@debian.org>
+Date: Fri, 18 Mar 2005 22:22:25 +1100
+Subject: Prune the list of libraries wanted to what we actually need.
+
+Bug-Debian: http://bugs.debian.org/128355
+
+We want to keep the dependencies on perl-base as small as possible,
+and some of the original list may be present on buildds (see Bug#128355).
+
+(Backported to metaconfig unit probes by Niko Tyni)
+---
+ regen-configure/U/modified/Myinit.U | 3 +--
+ regen-configure/U/perl/End.U | 2 +-
+ 2 files changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/regen-configure/U/modified/Myinit.U b/regen-configure/U/modified/Myinit.U
+index 0e3155a..e1d58c2 100644
+--- a/regen-configure/U/modified/Myinit.U
++++ b/regen-configure/U/modified/Myinit.U
+@@ -32,8 +32,7 @@
+ ?X: Put crypt here, even though I should really fix d_crypt.U to look
+ ?X: for it correctly, including possible shared library versions.
+ : If anyone needs extra -lxxx, put those in a hint file.
+-libswanted="cl pthread socket bind inet nsl ndbm gdbm dbm db malloc dl ld"
+-libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
++libswanted='gdbm gdbm_compat db dl m c crypt'
+ : We probably want to search /usr/shlib before most other libraries.
+ : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
+ glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
+diff --git a/regen-configure/U/perl/End.U b/regen-configure/U/perl/End.U
+index 3520714..9716623 100644
+--- a/regen-configure/U/perl/End.U
++++ b/regen-configure/U/perl/End.U
+@@ -37,7 +37,7 @@ sunos*X4*)
+ ;;
+ *) case "$usedl" in
+ $define|true|[yY]*)
+- set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
++ set X `echo " $libs " | sed -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldb @ @'`
+ shift
+ perllibs="$*"
+ ;;
diff --git a/debian/patches/debian/sh4_op_optimize_workaround.diff b/debian/patches/debian/sh4_op_optimize_workaround.diff
new file mode 100644
index 0000000..7038a31
--- /dev/null
+++ b/debian/patches/debian/sh4_op_optimize_workaround.diff
@@ -0,0 +1,29 @@
+From: Niko Tyni <ntyni@debian.org>
+Date: Sat, 29 Jul 2017 23:32:51 +0300
+Subject: Also lower the optimization level of op.c and opmini.c on sh4
+
+This amends
+ debian/hppa_op_optimize_workaround.diff
+ debian/hppa_opmini_optimize_workaround.diff
+
+Bug-Debian: https://bugs.debian.org/869373
+---
+ cflags.SH | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/cflags.SH b/cflags.SH
+index c8231e6..3bb0c3e 100755
+--- a/cflags.SH
++++ b/cflags.SH
+@@ -497,9 +497,9 @@ for file do
+ # or customize here
+
+ case "$file" in
+- op|opmini) : work around http://bugs.debian.org/838613 and 869122
++ op|opmini) : work around http://bugs.debian.org/838613 869122 869373
+ case $archname in
+- hppa-*)
++ hppa-*|sh4-*)
+ optimize="$optimize -O0";;
+ esac;;
+
diff --git a/debian/patches/debian/squelch-locale-warnings.diff b/debian/patches/debian/squelch-locale-warnings.diff
new file mode 100644
index 0000000..5a47318
--- /dev/null
+++ b/debian/patches/debian/squelch-locale-warnings.diff
@@ -0,0 +1,51 @@
+From: Niko Tyni <ntyni@debian.org>
+Date: Sun, 3 Oct 2010 21:36:17 +0300
+Subject: Squelch locale warnings in Debian package maintainer scripts
+
+Bug-Debian: http://bugs.debian.org/508764
+
+The system locales are rather frequently out of sync with the C library
+during package upgrades, causing a huge amount of useless Perl locale
+warnings. Squelch them when running package maintainer scripts, detected
+by the DPKG_RUNNING_VERSION environment variable.
+
+Any real locale problem will show up after the system upgrade too, and
+the warning will be triggered normally again at that point.
+---
+ locale.c | 3 +++
+ pod/perllocale.pod | 8 ++++++++
+ 2 files changed, 11 insertions(+)
+
+diff --git a/locale.c b/locale.c
+index 87e11d6..8f5a3b4 100644
+--- a/locale.c
++++ b/locale.c
+@@ -3247,6 +3247,9 @@ Perl_init_i18nl10n(pTHX_ int printwarn)
+
+ const bool locwarn = (printwarn > 1
+ || ( printwarn
++ &&
++ /* Debian specific change - see http://bugs.debian.org/508764 */
++ ( ! PerlEnv_getenv("DPKG_RUNNING_VERSION"))
+ && ( ! bad_lang_use_once
+ || (
+ /* disallow with "" or "0" */
+diff --git a/pod/perllocale.pod b/pod/perllocale.pod
+index df2db5c..f621919 100644
+--- a/pod/perllocale.pod
++++ b/pod/perllocale.pod
+@@ -1297,6 +1297,14 @@ B<NOTE>: C<PERL_BADLANG> only gives you a way to hide the warning message.
+ The message tells about some problem in your system's locale support,
+ and you should investigate what the problem is.
+
++=item DPKG_RUNNING_VERSION
++
++On Debian systems, if the DPKG_RUNNING_VERSION environment variable is
++set (to any value), the locale failure warnings will be suppressed just
++like with a zero PERL_BADLANG setting. This is done to avoid floods
++of spurious warnings during system upgrades.
++See L<http://bugs.debian.org/508764>.
++
+ =back
+
+ The following environment variables are not specific to Perl: They are
diff --git a/debian/patches/debian/writable_site_dirs.diff b/debian/patches/debian/writable_site_dirs.diff
new file mode 100644
index 0000000..fb6b18b
--- /dev/null
+++ b/debian/patches/debian/writable_site_dirs.diff
@@ -0,0 +1,33 @@
+From: Brendan O'Dea <bod@debian.org>
+Date: Tue, 8 Mar 2005 19:30:38 +1100
+Subject: Set umask approproately for site install directories
+
+Policy requires group writable site directories
+---
+ cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
+index 274e35c..dbb8651 100644
+--- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
++++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
+@@ -2249,7 +2249,7 @@ q{ "$(INST_LIB)" "$(DESTINSTALLPRIVLIB)" \
+
+
+ pure_site_install :: all
+- $(NOECHO) umask 022; $(MOD_INSTALL) \
++ $(NOECHO) umask 02; $(MOD_INSTALL) \
+ };
+ push @m,
+ q{ read "}.$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q{" \
+@@ -2310,8 +2310,8 @@ doc_perl_install :: all
+
+ doc_site_install :: all
+ $(NOECHO) $(ECHO) Appending installation info to "$(DESTINSTALLARCHLIB)/perllocal.pod"
+- -$(NOECHO) umask 022; $(MKPATH) "$(DESTINSTALLARCHLIB)"
+- -$(NOECHO) umask 022; $(DOC_INSTALL) \
++ -$(NOECHO) umask 02; $(MKPATH) "$(DESTINSTALLARCHLIB)"
++ -$(NOECHO) umask 02; $(DOC_INSTALL) \
+ "Module" "$(NAME)" \
+ "installed into" "$(INSTALLSITELIB)" \
+ LINKTYPE "$(LINKTYPE)" \