Merge branch 'devel-patchperl'

This commit is contained in:
Peter Martini 2015-05-02 15:15:00 -04:00
commit fa0cd9695d
35 changed files with 5031 additions and 124 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
perl-*.bz2
downloads

View file

@ -0,0 +1,451 @@
From 6b092e22ef86b15caf724deed2619c330461c3ea Mon Sep 17 00:00:00 2001
From: Peter Martini <PeterCMartini@GMail.com>
Date: Wed, 15 Apr 2015 22:35:56 -0400
Subject: [PATCH] tmp
---
hints/linux.sh | 182 +++++++++++++++++++++++++++++++++++++++++++++------------
hv.c | 26 ++-------
patchlevel.h | 1 +
perl.c | 2 +-
perlio.c | 6 ++
t/op/hash.t | 20 ++++++-
6 files changed, 175 insertions(+), 62 deletions(-)
diff --git a/hints/linux.sh b/hints/linux.sh
index ac264c3..fb5a46e 100644
--- a/hints/linux.sh
+++ b/hints/linux.sh
@@ -13,11 +13,14 @@
# Updated Thu May 30 10:50:22 EDT 1996 by <doughera@lafayette.edu>
# Updated Fri Jun 21 11:07:54 EDT 1996
-# NDBM support for ELF renabled by <kjahds@kjahds.com>
+# NDBM support for ELF re-enabled by <kjahds@kjahds.com>
# No version of Linux supports setuid scripts.
d_suidsafe='undef'
+# No version of Linux needs libutil for perl.
+i_libutil='undef'
+
# Debian and Red Hat, and perhaps other vendors, provide both runtime and
# development packages for some libraries. The runtime packages contain shared
# libraries with version information in their names (e.g., libgdbm.so.1.7.3);
@@ -36,7 +39,7 @@ d_suidsafe='undef'
# SuSE Linux can be used as cross-compilation host for Cray XT4 Catamount/Qk.
if test -d /opt/xt-pe
then
- case "`cc -V 2>&1`" in
+ case "`${cc:-cc} -V 2>&1`" in
*catamount*) . hints/catamount.sh; return ;;
esac
fi
@@ -54,15 +57,11 @@ set `echo X "$libswanted "| sed -e 's/ bsd / /' -e 's/ net / /' -e 's/ bind / /'
shift
libswanted="$*"
-# 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
-# gcc to load the library for all tests.)
-# We don't use __GLIBC__ and __GLIBC_MINOR__ because they
-# are insufficiently precise to distinguish things like
-# libc-2.0.6 and libc-2.0.7.
-if test -L /lib/libc.so.6; then
- libc=`ls -l /lib/libc.so.6 | awk '{print $NF}'`
- libc=/lib/$libc
+# Debian 4.0 puts ndbm in the -lgdbm_compat library.
+echo $libs
+if echo " $libswanted " | grep -q ' gdbm '; then
+ # Only add if gdbm is in libswanted.
+ libswanted="$libswanted gdbm_compat"
fi
# Configure may fail to find lstat() since it's a static/inline
@@ -81,15 +80,23 @@ case "$usemymalloc" in
'') usemymalloc='n' ;;
esac
+uname_minus_m="`$run uname -m 2>/dev/null`"
+uname_minus_m="${uname_minus_m:-"$targetarch"}"
+
# Check if we're about to use Intel's ICC compiler
case "`${cc:-cc} -V 2>&1`" in
*"Intel(R) C++ Compiler"*|*"Intel(R) C Compiler"*)
+ # record the version, formats:
+ # icc (ICC) 10.1 20080801
+ # icpc (ICC) 10.1 20080801
+ # followed by a copyright on the second line
+ ccversion=`${cc:-cc} --version | sed -n -e 's/^icp\?c \((ICC) \)\?//p'`
# This is needed for Configure's prototype checks to work correctly
# The -mp flag is needed to pass various floating point related tests
# The -no-gcc flag is needed otherwise, icc pretends (poorly) to be gcc
ccflags="-we147 -mp -no-gcc $ccflags"
# Prevent relocation errors on 64bits arch
- case "`uname -m`" in
+ case "$uname_minus_m" in
*ia64*|*x86_64*)
cccdlflags='-fPIC'
;;
@@ -123,7 +130,7 @@ case "$optimize" in
# use -O2 by default ; -O3 doesn't seem to bring significant benefits with gcc
'')
optimize='-O2'
- case "`uname -m`" in
+ case "$uname_minus_m" in
ppc*)
# on ppc, it seems that gcc (at least gcc 3.3.2) isn't happy
# with -O2 ; so downgrade to -O1.
@@ -143,6 +150,77 @@ case "$optimize" in
;;
esac
+# Ubuntu 11.04 (and later, presumably) doesn't keep most libraries
+# (such as -lm) in /lib or /usr/lib. So we have to ask gcc to tell us
+# where to look. We don't want gcc's own libraries, however, so we
+# filter those out.
+# This could be conditional on Unbuntu, but other distributions may
+# follow suit, and this scheme seems to work even on rather old gcc's.
+# This unconditionally uses gcc because even if the user is using another
+# compiler, we still need to find the math library and friends, and I don't
+# know how other compilers will cope with that situation.
+# Morever, if the user has their own gcc earlier in $PATH than the system gcc,
+# we don't want its libraries. So we try to prefer the system gcc
+# Still, as an escape hatch, allow Configure command line overrides to
+# plibpth to bypass this check.
+if [ -x /usr/bin/gcc ] ; then
+ gcc=/usr/bin/gcc
+else
+ gcc=gcc
+fi
+
+case "$plibpth" in
+'') plibpth=`LANG=C LC_ALL=C $gcc $ccflags $ldflags -print-search-dirs | grep libraries |
+ cut -f2- -d= | tr ':' $trnl | grep -v 'gcc' | sed -e 's:/$::'`
+ set X $plibpth # Collapse all entries on one line
+ shift
+ plibpth="$*"
+ ;;
+esac
+
+# libquadmath is sometimes installed as gcc internal library,
+# so contrary to our usual policy of *not* looking at gcc internal
+# directories we now *do* look at them, in case they contain
+# the quadmath library.
+# XXX This may apply to other gcc internal libraries, if such exist.
+# XXX This could be at Configure level, but then the $gcc is messy.
+case "$usequadmath" in
+"$define")
+ for d in `LANG=C LC_ALL=C $gcc $ccflags $ldflags -print-search-dirs | grep libraries | cut -f2- -d= | tr ':' $trnl | grep 'gcc' | sed -e 's:/$::'`
+ do
+ case `ls $d/*libquadmath*$so* 2>/dev/null` in
+ $d/*libquadmath*$so*) xlibpth="$xlibpth $d" ;;
+ esac
+ done
+ ;;
+esac
+
+case "$libc" in
+'')
+# 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
+# gcc to load the library for all tests.)
+# We don't use __GLIBC__ and __GLIBC_MINOR__ because they
+# are insufficiently precise to distinguish things like
+# libc-2.0.6 and libc-2.0.7.
+ for p in $plibpth
+ do
+ for trylib in libc.so.6 libc.so
+ do
+ if $test -e $p/$trylib; then
+ libc=`ls -l $p/$trylib | awk '{print $NF}'`
+ if $test "X$libc" != X; then
+ break
+ fi
+ fi
+ done
+ if $test "X$libc" != X; then
+ break
+ fi
+ done
+ ;;
+esac
+
# Are we using ELF? Thanks to Kenneth Albanowski <kjahds@kjahds.com>
# for this test.
cat >try.c <<'EOM'
@@ -163,7 +241,7 @@ main() {
exit(0); /* succeed (yes, it's ELF) */
}
EOM
-if ${cc:-gcc} try.c >/dev/null 2>&1 && $run ./a.out; then
+if ${cc:-gcc} $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
cat <<'EOM' >&4
You appear to have ELF support. I'll try to use it for dynamic loading.
@@ -229,7 +307,7 @@ fi
rm -f try.c a.out
-if /bin/sh -c exit; then
+if ${sh:-/bin/sh} -c exit; then
echo ''
echo 'You appear to have a working bash. Good.'
else
@@ -296,7 +374,7 @@ fi
#'osfmach3ppc') ccdlflags='-Wl,-E' ;;
#esac
-case "`uname -m`" in
+case "$uname_minus_m" in
sparc*)
case "$cccdlflags" in
*-fpic*) cccdlflags="`echo $cccdlflags|sed 's/-fpic/-fPIC/'`" ;;
@@ -311,24 +389,62 @@ esac
# version of -lgdbm which is a bad idea. So if we have 'nm'
# make sure it can read the file
# NI-S 2003/08/07
-if [ -r /usr/lib/libndbm.so -a -x /usr/bin/nm ] ; then
- if /usr/bin/nm /usr/lib/libndbm.so >/dev/null 2>&1 ; then
- echo 'Your shared -lndbm seems to be a real library.'
- else
- echo 'Your shared -lndbm is not a real library.'
- set `echo X "$libswanted "| sed -e 's/ ndbm / /'`
- shift
- libswanted="$*"
- fi
-fi
+case "$nm" in
+ '') ;;
+ *)
+ for p in $plibpth
+ do
+ if $test -r $p/libndbm.so; then
+ if $nm $p/libndbm.so >/dev/null 2>&1 ; then
+ echo 'Your shared -lndbm seems to be a real library.'
+ _libndbm_real=1
+ break
+ fi
+ fi
+ done
+ if $test "X$_libndbm_real" = X; then
+ echo 'Your shared -lndbm is not a real library.'
+ set `echo X "$libswanted "| sed -e 's/ ndbm / /'`
+ shift
+ libswanted="$*"
+ fi
+ ;;
+esac
+# Linux on Synology.
+if [ -f /etc/synoinfo.conf -a -d /usr/syno ]; then
+ # Tested on Synology DS213 and DS413
+ # OS version info in /etc.defaults/VERSION
+ # http://forum.synology.com/wiki/index.php/What_kind_of_CPU_does_my_NAS_have
+ # Synology DS213 running DSM 4.3-3810-0 (2013-11-06)
+ # CPU model Marvell Kirkwood mv6282 ARMv5te
+ # Linux 2.6.32.12 #3810 Wed Nov 6 05:13:41 CST 2013 armv5tel GNU/Linux
+ # Synology DS413 running DSM 4.3-3810-0 (2013-11-06)
+ # CPU model Freescale QorIQ P1022 ppc (e500v2)
+ # linux 2.6.32.12 #3810 ppc GNU/Linux
+ # All development stuff installed with ipkg is in /opt
+ if [ "$LANG" = "" -o "$LANG" = "C" ]; then
+ echo 'Your LANG is safe'
+ else
+ echo 'Please set $LANG to "C". All other $LANG settings will cause havoc' >&4
+ LANG=C
+ fi
+ echo 'Setting up to use /opt/*' >&4
+ locincpth="/opt/include $locincpth"
+ libpth="/opt/lib $libpth"
+ libspth="/opt/lib $libspth"
+ loclibpth="/opt/lib $loclibpth"
+ # POSIX will not link without the pthread lib
+ libswanted="$libswanted pthread"
+ echo "$libswanted" >&4
+fi
# 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]*)
- ccflags="-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS $ccflags"
+ ccflags="-D_REENTRANT -D_GNU_SOURCE $ccflags"
if echo $libswanted | grep -v pthread >/dev/null
then
set `echo X "$libswanted "| sed -e 's/ c / pthread c /'`
@@ -375,16 +491,6 @@ $define|true|[yY]*)
;;
esac
-# If we are using g++ we must use nm and force ourselves to use
-# the /usr/lib/libc.a (resetting the libc below to an empty string
-# makes Configure to look for the right one) because the symbol
-# scanning tricks of Configure will crash and burn horribly.
-case "$cc" in
-*g++*) usenm=true
- libc=''
- ;;
-esac
-
# If using g++, the Configure scan for dlopen() and (especially)
# dlerror() might fail, easier just to forcibly hint them in.
case "$cc" in
@@ -408,7 +514,7 @@ then
DBLIB="$DBDIR/libdb.so"
if [ -f $DBLIB ]
then
- if nm -u $DBLIB | grep pthread >/dev/null
+ if ${nm:-nm} -u $DBLIB 2>/dev/null | grep pthread >/dev/null
then
if ldd $DBLIB | grep pthread >/dev/null
then
diff --git a/hv.c b/hv.c
index 030db74..0d15a40 100644
--- a/hv.c
+++ b/hv.c
@@ -31,7 +31,8 @@ holds the key and hash value.
#define PERL_HASH_INTERNAL_ACCESS
#include "perl.h"
-#define HV_MAX_LENGTH_BEFORE_SPLIT 14
+#define HV_MAX_LENGTH_BEFORE_REHASH 14
+#define SHOULD_DO_HSPLIT(xhv) ((xhv)->xhv_keys > (xhv)->xhv_max) /* HvTOTALKEYS(hv) > HvMAX(hv) */
STATIC void
S_more_he(pTHX)
@@ -705,23 +706,8 @@ Perl_hv_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
xhv->xhv_keys++; /* HvTOTALKEYS(hv)++ */
if (!counter) { /* initial entry? */
xhv->xhv_fill++; /* HvFILL(hv)++ */
- } else if (xhv->xhv_keys > (IV)xhv->xhv_max) {
+ } else if ( SHOULD_DO_HSPLIT(xhv) ) {
hsplit(hv);
- } else if(!HvREHASH(hv)) {
- U32 n_links = 1;
-
- while ((counter = HeNEXT(counter)))
- n_links++;
-
- if (n_links > HV_MAX_LENGTH_BEFORE_SPLIT) {
- /* Use only the old HvKEYS(hv) > HvMAX(hv) condition to limit
- bucket splits on a rehashed hash, as we're not going to
- split it again, and if someone is lucky (evil) enough to
- get all the keys in one list they could exhaust our memory
- as we repeatedly double the number of buckets on every
- entry. Linear search feels a less worse thing to do. */
- hsplit(hv);
- }
}
}
@@ -1048,7 +1034,7 @@ S_hsplit(pTHX_ HV *hv)
/* Pick your policy for "hashing isn't working" here: */
- if (longest_chain <= HV_MAX_LENGTH_BEFORE_SPLIT /* split worked? */
+ if (longest_chain <= HV_MAX_LENGTH_BEFORE_REHASH /* split worked? */
|| HvREHASH(hv)) {
return;
}
@@ -1966,8 +1952,8 @@ S_share_hek_flags(pTHX_ const char *str, I32 len, register U32 hash, int flags)
xhv->xhv_keys++; /* HvTOTALKEYS(hv)++ */
if (!next) { /* initial entry? */
xhv->xhv_fill++; /* HvFILL(hv)++ */
- } else if (xhv->xhv_keys > (IV)xhv->xhv_max /* HvKEYS(hv) > HvMAX(hv) */) {
- hsplit(PL_strtab);
+ } else if ( SHOULD_DO_HSPLIT(xhv) ) {
+ hsplit(PL_strtab);
}
}
diff --git a/patchlevel.h b/patchlevel.h
index 82f11ed..9d98556 100644
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -121,6 +121,7 @@ hunk.
#if !defined(PERL_PATCHLEVEL_H_IMPLICIT) && !defined(LOCAL_PATCH_COUNT)
static const char *local_patches[] = {
NULL
+ ,"Devel::PatchPerl 1.32"
,NULL
};
diff --git a/perl.c b/perl.c
index 82e5538..b9e02fe 100644
--- a/perl.c
+++ b/perl.c
@@ -3758,7 +3758,7 @@ S_open_script(pTHX_ const char *scriptname, bool dosearch, SV *sv,
# ifdef VMS
cpp_discard_flag = "";
# else
- cpp_discard_flag = "-C";
+ cpp_discard_flag = "-C -ffreestanding";
# endif
# ifdef OS2
diff --git a/perlio.c b/perlio.c
index 7c5b76a..b54b9b1 100644
--- a/perlio.c
+++ b/perlio.c
@@ -2323,6 +2323,12 @@ PerlIO_init(pTHX)
{
/* MUTEX_INIT(&PL_perlio_mutex) is done in PERL_SYS_INIT3(). */
PERL_UNUSED_CONTEXT;
+ /*
+ * No, for backwards compatibility (before PERL_SYS_INIT3 changed to be
+ * defined as a separate function call), we need to call
+ * MUTEX_INIT(&PL_perlio_mutex) (via the PERLIO_INIT macro).
+ */
+ PERLIO_INIT;
}
void
diff --git a/t/op/hash.t b/t/op/hash.t
index 9bde518..45eb782 100755
--- a/t/op/hash.t
+++ b/t/op/hash.t
@@ -39,22 +39,36 @@ use constant THRESHOLD => 14;
use constant START => "a";
# some initial hash data
-my %h2 = map {$_ => 1} 'a'..'cc';
+my %h2;
+my $counter= "a";
+$h2{$counter++}++ while $counter ne 'cd';
ok (!Internals::HvREHASH(%h2),
"starting with pre-populated non-pathological hash (rehash flag if off)");
my @keys = get_keys(\%h2);
+my $buckets= buckets(\%h2);
$h2{$_}++ for @keys;
+$h2{$counter++}++ while buckets(\%h2) == $buckets; # force a split
ok (Internals::HvREHASH(%h2),
- scalar(@keys) . " colliding into the same bucket keys are triggering rehash");
+ scalar(@keys) . " colliding into the same bucket keys are triggering rehash after split");
+
+# returns the number of buckets in a hash
+sub buckets {
+ my $hr = shift;
+ my $keys_buckets= scalar(%$hr);
+ if ($keys_buckets=~m!/([0-9]+)\z!) {
+ return 0+$1;
+ } else {
+ return 8;
+ }
+}
sub get_keys {
my $hr = shift;
# the minimum of bits required to mount the attack on a hash
my $min_bits = log(THRESHOLD)/log(2);
-
# if the hash has already been populated with a significant amount
# of entries the number of mask bits can be higher
my $keys = scalar keys %$hr;
--
1.9.1

View file

@ -0,0 +1,29 @@
FROM buildpack-deps
MAINTAINER Peter Martini <PeterCMartini@GMail.com>
RUN apt-get update \
&& apt-get install -y curl procps \
&& rm -fr /var/lib/apt/lists/*
RUN mkdir /usr/src/perl
COPY DevelPatchPerl.patch /usr/src/perl/
WORKDIR /usr/src/perl
RUN curl -SL https://cpan.metacpan.org/authors/id/N/NW/NWCLARK/perl-5.8.9.tar.bz2 -o perl-5.8.9.tar.bz2 \
&& echo '19843b5a7585cf35d96c07dbcd419bbdd5813617 *perl-5.8.9.tar.bz2' | sha1sum -c - \
&& tar --strip-components=1 -xjf perl-5.8.9.tar.bz2 -C /usr/src/perl \
&& rm perl-5.8.9.tar.bz2 \
&& cat DevelPatchPerl.patch | patch -p1 \
&& ./Configure -Dusethreads -Duse64bitall -A ccflags=-fwrapv -des \
&& make -j$(nproc) \
&& make test_harness \
&& make install \
&& cd /usr/src \
&& curl -LO https://raw.githubusercontent.com/miyagawa/cpanminus/master/cpanm \
&& chmod +x cpanm \
&& ./cpanm App::cpanminus \
&& rm -fr ./cpanm /root/.cpanm /usr/src/perl
WORKDIR /root
CMD ["perl5.8.9","-de0"]

View file

@ -0,0 +1,451 @@
From 6b092e22ef86b15caf724deed2619c330461c3ea Mon Sep 17 00:00:00 2001
From: Peter Martini <PeterCMartini@GMail.com>
Date: Wed, 15 Apr 2015 22:35:56 -0400
Subject: [PATCH] tmp
---
hints/linux.sh | 182 +++++++++++++++++++++++++++++++++++++++++++++------------
hv.c | 26 ++-------
patchlevel.h | 1 +
perl.c | 2 +-
perlio.c | 6 ++
t/op/hash.t | 20 ++++++-
6 files changed, 175 insertions(+), 62 deletions(-)
diff --git a/hints/linux.sh b/hints/linux.sh
index ac264c3..fb5a46e 100644
--- a/hints/linux.sh
+++ b/hints/linux.sh
@@ -13,11 +13,14 @@
# Updated Thu May 30 10:50:22 EDT 1996 by <doughera@lafayette.edu>
# Updated Fri Jun 21 11:07:54 EDT 1996
-# NDBM support for ELF renabled by <kjahds@kjahds.com>
+# NDBM support for ELF re-enabled by <kjahds@kjahds.com>
# No version of Linux supports setuid scripts.
d_suidsafe='undef'
+# No version of Linux needs libutil for perl.
+i_libutil='undef'
+
# Debian and Red Hat, and perhaps other vendors, provide both runtime and
# development packages for some libraries. The runtime packages contain shared
# libraries with version information in their names (e.g., libgdbm.so.1.7.3);
@@ -36,7 +39,7 @@ d_suidsafe='undef'
# SuSE Linux can be used as cross-compilation host for Cray XT4 Catamount/Qk.
if test -d /opt/xt-pe
then
- case "`cc -V 2>&1`" in
+ case "`${cc:-cc} -V 2>&1`" in
*catamount*) . hints/catamount.sh; return ;;
esac
fi
@@ -54,15 +57,11 @@ set `echo X "$libswanted "| sed -e 's/ bsd / /' -e 's/ net / /' -e 's/ bind / /'
shift
libswanted="$*"
-# 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
-# gcc to load the library for all tests.)
-# We don't use __GLIBC__ and __GLIBC_MINOR__ because they
-# are insufficiently precise to distinguish things like
-# libc-2.0.6 and libc-2.0.7.
-if test -L /lib/libc.so.6; then
- libc=`ls -l /lib/libc.so.6 | awk '{print $NF}'`
- libc=/lib/$libc
+# Debian 4.0 puts ndbm in the -lgdbm_compat library.
+echo $libs
+if echo " $libswanted " | grep -q ' gdbm '; then
+ # Only add if gdbm is in libswanted.
+ libswanted="$libswanted gdbm_compat"
fi
# Configure may fail to find lstat() since it's a static/inline
@@ -81,15 +80,23 @@ case "$usemymalloc" in
'') usemymalloc='n' ;;
esac
+uname_minus_m="`$run uname -m 2>/dev/null`"
+uname_minus_m="${uname_minus_m:-"$targetarch"}"
+
# Check if we're about to use Intel's ICC compiler
case "`${cc:-cc} -V 2>&1`" in
*"Intel(R) C++ Compiler"*|*"Intel(R) C Compiler"*)
+ # record the version, formats:
+ # icc (ICC) 10.1 20080801
+ # icpc (ICC) 10.1 20080801
+ # followed by a copyright on the second line
+ ccversion=`${cc:-cc} --version | sed -n -e 's/^icp\?c \((ICC) \)\?//p'`
# This is needed for Configure's prototype checks to work correctly
# The -mp flag is needed to pass various floating point related tests
# The -no-gcc flag is needed otherwise, icc pretends (poorly) to be gcc
ccflags="-we147 -mp -no-gcc $ccflags"
# Prevent relocation errors on 64bits arch
- case "`uname -m`" in
+ case "$uname_minus_m" in
*ia64*|*x86_64*)
cccdlflags='-fPIC'
;;
@@ -123,7 +130,7 @@ case "$optimize" in
# use -O2 by default ; -O3 doesn't seem to bring significant benefits with gcc
'')
optimize='-O2'
- case "`uname -m`" in
+ case "$uname_minus_m" in
ppc*)
# on ppc, it seems that gcc (at least gcc 3.3.2) isn't happy
# with -O2 ; so downgrade to -O1.
@@ -143,6 +150,77 @@ case "$optimize" in
;;
esac
+# Ubuntu 11.04 (and later, presumably) doesn't keep most libraries
+# (such as -lm) in /lib or /usr/lib. So we have to ask gcc to tell us
+# where to look. We don't want gcc's own libraries, however, so we
+# filter those out.
+# This could be conditional on Unbuntu, but other distributions may
+# follow suit, and this scheme seems to work even on rather old gcc's.
+# This unconditionally uses gcc because even if the user is using another
+# compiler, we still need to find the math library and friends, and I don't
+# know how other compilers will cope with that situation.
+# Morever, if the user has their own gcc earlier in $PATH than the system gcc,
+# we don't want its libraries. So we try to prefer the system gcc
+# Still, as an escape hatch, allow Configure command line overrides to
+# plibpth to bypass this check.
+if [ -x /usr/bin/gcc ] ; then
+ gcc=/usr/bin/gcc
+else
+ gcc=gcc
+fi
+
+case "$plibpth" in
+'') plibpth=`LANG=C LC_ALL=C $gcc $ccflags $ldflags -print-search-dirs | grep libraries |
+ cut -f2- -d= | tr ':' $trnl | grep -v 'gcc' | sed -e 's:/$::'`
+ set X $plibpth # Collapse all entries on one line
+ shift
+ plibpth="$*"
+ ;;
+esac
+
+# libquadmath is sometimes installed as gcc internal library,
+# so contrary to our usual policy of *not* looking at gcc internal
+# directories we now *do* look at them, in case they contain
+# the quadmath library.
+# XXX This may apply to other gcc internal libraries, if such exist.
+# XXX This could be at Configure level, but then the $gcc is messy.
+case "$usequadmath" in
+"$define")
+ for d in `LANG=C LC_ALL=C $gcc $ccflags $ldflags -print-search-dirs | grep libraries | cut -f2- -d= | tr ':' $trnl | grep 'gcc' | sed -e 's:/$::'`
+ do
+ case `ls $d/*libquadmath*$so* 2>/dev/null` in
+ $d/*libquadmath*$so*) xlibpth="$xlibpth $d" ;;
+ esac
+ done
+ ;;
+esac
+
+case "$libc" in
+'')
+# 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
+# gcc to load the library for all tests.)
+# We don't use __GLIBC__ and __GLIBC_MINOR__ because they
+# are insufficiently precise to distinguish things like
+# libc-2.0.6 and libc-2.0.7.
+ for p in $plibpth
+ do
+ for trylib in libc.so.6 libc.so
+ do
+ if $test -e $p/$trylib; then
+ libc=`ls -l $p/$trylib | awk '{print $NF}'`
+ if $test "X$libc" != X; then
+ break
+ fi
+ fi
+ done
+ if $test "X$libc" != X; then
+ break
+ fi
+ done
+ ;;
+esac
+
# Are we using ELF? Thanks to Kenneth Albanowski <kjahds@kjahds.com>
# for this test.
cat >try.c <<'EOM'
@@ -163,7 +241,7 @@ main() {
exit(0); /* succeed (yes, it's ELF) */
}
EOM
-if ${cc:-gcc} try.c >/dev/null 2>&1 && $run ./a.out; then
+if ${cc:-gcc} $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
cat <<'EOM' >&4
You appear to have ELF support. I'll try to use it for dynamic loading.
@@ -229,7 +307,7 @@ fi
rm -f try.c a.out
-if /bin/sh -c exit; then
+if ${sh:-/bin/sh} -c exit; then
echo ''
echo 'You appear to have a working bash. Good.'
else
@@ -296,7 +374,7 @@ fi
#'osfmach3ppc') ccdlflags='-Wl,-E' ;;
#esac
-case "`uname -m`" in
+case "$uname_minus_m" in
sparc*)
case "$cccdlflags" in
*-fpic*) cccdlflags="`echo $cccdlflags|sed 's/-fpic/-fPIC/'`" ;;
@@ -311,24 +389,62 @@ esac
# version of -lgdbm which is a bad idea. So if we have 'nm'
# make sure it can read the file
# NI-S 2003/08/07
-if [ -r /usr/lib/libndbm.so -a -x /usr/bin/nm ] ; then
- if /usr/bin/nm /usr/lib/libndbm.so >/dev/null 2>&1 ; then
- echo 'Your shared -lndbm seems to be a real library.'
- else
- echo 'Your shared -lndbm is not a real library.'
- set `echo X "$libswanted "| sed -e 's/ ndbm / /'`
- shift
- libswanted="$*"
- fi
-fi
+case "$nm" in
+ '') ;;
+ *)
+ for p in $plibpth
+ do
+ if $test -r $p/libndbm.so; then
+ if $nm $p/libndbm.so >/dev/null 2>&1 ; then
+ echo 'Your shared -lndbm seems to be a real library.'
+ _libndbm_real=1
+ break
+ fi
+ fi
+ done
+ if $test "X$_libndbm_real" = X; then
+ echo 'Your shared -lndbm is not a real library.'
+ set `echo X "$libswanted "| sed -e 's/ ndbm / /'`
+ shift
+ libswanted="$*"
+ fi
+ ;;
+esac
+# Linux on Synology.
+if [ -f /etc/synoinfo.conf -a -d /usr/syno ]; then
+ # Tested on Synology DS213 and DS413
+ # OS version info in /etc.defaults/VERSION
+ # http://forum.synology.com/wiki/index.php/What_kind_of_CPU_does_my_NAS_have
+ # Synology DS213 running DSM 4.3-3810-0 (2013-11-06)
+ # CPU model Marvell Kirkwood mv6282 ARMv5te
+ # Linux 2.6.32.12 #3810 Wed Nov 6 05:13:41 CST 2013 armv5tel GNU/Linux
+ # Synology DS413 running DSM 4.3-3810-0 (2013-11-06)
+ # CPU model Freescale QorIQ P1022 ppc (e500v2)
+ # linux 2.6.32.12 #3810 ppc GNU/Linux
+ # All development stuff installed with ipkg is in /opt
+ if [ "$LANG" = "" -o "$LANG" = "C" ]; then
+ echo 'Your LANG is safe'
+ else
+ echo 'Please set $LANG to "C". All other $LANG settings will cause havoc' >&4
+ LANG=C
+ fi
+ echo 'Setting up to use /opt/*' >&4
+ locincpth="/opt/include $locincpth"
+ libpth="/opt/lib $libpth"
+ libspth="/opt/lib $libspth"
+ loclibpth="/opt/lib $loclibpth"
+ # POSIX will not link without the pthread lib
+ libswanted="$libswanted pthread"
+ echo "$libswanted" >&4
+fi
# 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]*)
- ccflags="-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS $ccflags"
+ ccflags="-D_REENTRANT -D_GNU_SOURCE $ccflags"
if echo $libswanted | grep -v pthread >/dev/null
then
set `echo X "$libswanted "| sed -e 's/ c / pthread c /'`
@@ -375,16 +491,6 @@ $define|true|[yY]*)
;;
esac
-# If we are using g++ we must use nm and force ourselves to use
-# the /usr/lib/libc.a (resetting the libc below to an empty string
-# makes Configure to look for the right one) because the symbol
-# scanning tricks of Configure will crash and burn horribly.
-case "$cc" in
-*g++*) usenm=true
- libc=''
- ;;
-esac
-
# If using g++, the Configure scan for dlopen() and (especially)
# dlerror() might fail, easier just to forcibly hint them in.
case "$cc" in
@@ -408,7 +514,7 @@ then
DBLIB="$DBDIR/libdb.so"
if [ -f $DBLIB ]
then
- if nm -u $DBLIB | grep pthread >/dev/null
+ if ${nm:-nm} -u $DBLIB 2>/dev/null | grep pthread >/dev/null
then
if ldd $DBLIB | grep pthread >/dev/null
then
diff --git a/hv.c b/hv.c
index 030db74..0d15a40 100644
--- a/hv.c
+++ b/hv.c
@@ -31,7 +31,8 @@ holds the key and hash value.
#define PERL_HASH_INTERNAL_ACCESS
#include "perl.h"
-#define HV_MAX_LENGTH_BEFORE_SPLIT 14
+#define HV_MAX_LENGTH_BEFORE_REHASH 14
+#define SHOULD_DO_HSPLIT(xhv) ((xhv)->xhv_keys > (xhv)->xhv_max) /* HvTOTALKEYS(hv) > HvMAX(hv) */
STATIC void
S_more_he(pTHX)
@@ -705,23 +706,8 @@ Perl_hv_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
xhv->xhv_keys++; /* HvTOTALKEYS(hv)++ */
if (!counter) { /* initial entry? */
xhv->xhv_fill++; /* HvFILL(hv)++ */
- } else if (xhv->xhv_keys > (IV)xhv->xhv_max) {
+ } else if ( SHOULD_DO_HSPLIT(xhv) ) {
hsplit(hv);
- } else if(!HvREHASH(hv)) {
- U32 n_links = 1;
-
- while ((counter = HeNEXT(counter)))
- n_links++;
-
- if (n_links > HV_MAX_LENGTH_BEFORE_SPLIT) {
- /* Use only the old HvKEYS(hv) > HvMAX(hv) condition to limit
- bucket splits on a rehashed hash, as we're not going to
- split it again, and if someone is lucky (evil) enough to
- get all the keys in one list they could exhaust our memory
- as we repeatedly double the number of buckets on every
- entry. Linear search feels a less worse thing to do. */
- hsplit(hv);
- }
}
}
@@ -1048,7 +1034,7 @@ S_hsplit(pTHX_ HV *hv)
/* Pick your policy for "hashing isn't working" here: */
- if (longest_chain <= HV_MAX_LENGTH_BEFORE_SPLIT /* split worked? */
+ if (longest_chain <= HV_MAX_LENGTH_BEFORE_REHASH /* split worked? */
|| HvREHASH(hv)) {
return;
}
@@ -1966,8 +1952,8 @@ S_share_hek_flags(pTHX_ const char *str, I32 len, register U32 hash, int flags)
xhv->xhv_keys++; /* HvTOTALKEYS(hv)++ */
if (!next) { /* initial entry? */
xhv->xhv_fill++; /* HvFILL(hv)++ */
- } else if (xhv->xhv_keys > (IV)xhv->xhv_max /* HvKEYS(hv) > HvMAX(hv) */) {
- hsplit(PL_strtab);
+ } else if ( SHOULD_DO_HSPLIT(xhv) ) {
+ hsplit(PL_strtab);
}
}
diff --git a/patchlevel.h b/patchlevel.h
index 82f11ed..9d98556 100644
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -121,6 +121,7 @@ hunk.
#if !defined(PERL_PATCHLEVEL_H_IMPLICIT) && !defined(LOCAL_PATCH_COUNT)
static const char *local_patches[] = {
NULL
+ ,"Devel::PatchPerl 1.32"
,NULL
};
diff --git a/perl.c b/perl.c
index 82e5538..b9e02fe 100644
--- a/perl.c
+++ b/perl.c
@@ -3758,7 +3758,7 @@ S_open_script(pTHX_ const char *scriptname, bool dosearch, SV *sv,
# ifdef VMS
cpp_discard_flag = "";
# else
- cpp_discard_flag = "-C";
+ cpp_discard_flag = "-C -ffreestanding";
# endif
# ifdef OS2
diff --git a/perlio.c b/perlio.c
index 7c5b76a..b54b9b1 100644
--- a/perlio.c
+++ b/perlio.c
@@ -2323,6 +2323,12 @@ PerlIO_init(pTHX)
{
/* MUTEX_INIT(&PL_perlio_mutex) is done in PERL_SYS_INIT3(). */
PERL_UNUSED_CONTEXT;
+ /*
+ * No, for backwards compatibility (before PERL_SYS_INIT3 changed to be
+ * defined as a separate function call), we need to call
+ * MUTEX_INIT(&PL_perlio_mutex) (via the PERLIO_INIT macro).
+ */
+ PERLIO_INIT;
}
void
diff --git a/t/op/hash.t b/t/op/hash.t
index 9bde518..45eb782 100755
--- a/t/op/hash.t
+++ b/t/op/hash.t
@@ -39,22 +39,36 @@ use constant THRESHOLD => 14;
use constant START => "a";
# some initial hash data
-my %h2 = map {$_ => 1} 'a'..'cc';
+my %h2;
+my $counter= "a";
+$h2{$counter++}++ while $counter ne 'cd';
ok (!Internals::HvREHASH(%h2),
"starting with pre-populated non-pathological hash (rehash flag if off)");
my @keys = get_keys(\%h2);
+my $buckets= buckets(\%h2);
$h2{$_}++ for @keys;
+$h2{$counter++}++ while buckets(\%h2) == $buckets; # force a split
ok (Internals::HvREHASH(%h2),
- scalar(@keys) . " colliding into the same bucket keys are triggering rehash");
+ scalar(@keys) . " colliding into the same bucket keys are triggering rehash after split");
+
+# returns the number of buckets in a hash
+sub buckets {
+ my $hr = shift;
+ my $keys_buckets= scalar(%$hr);
+ if ($keys_buckets=~m!/([0-9]+)\z!) {
+ return 0+$1;
+ } else {
+ return 8;
+ }
+}
sub get_keys {
my $hr = shift;
# the minimum of bits required to mount the attack on a hash
my $min_bits = log(THRESHOLD)/log(2);
-
# if the hash has already been populated with a significant amount
# of entries the number of mask bits can be higher
my $keys = scalar keys %$hr;
--
1.9.1

View file

@ -0,0 +1,29 @@
FROM buildpack-deps
MAINTAINER Peter Martini <PeterCMartini@GMail.com>
RUN apt-get update \
&& apt-get install -y curl procps \
&& rm -fr /var/lib/apt/lists/*
RUN mkdir /usr/src/perl
COPY DevelPatchPerl.patch /usr/src/perl/
WORKDIR /usr/src/perl
RUN curl -SL https://cpan.metacpan.org/authors/id/N/NW/NWCLARK/perl-5.8.9.tar.bz2 -o perl-5.8.9.tar.bz2 \
&& echo '19843b5a7585cf35d96c07dbcd419bbdd5813617 *perl-5.8.9.tar.bz2' | sha1sum -c - \
&& tar --strip-components=1 -xjf perl-5.8.9.tar.bz2 -C /usr/src/perl \
&& rm perl-5.8.9.tar.bz2 \
&& cat DevelPatchPerl.patch | patch -p1 \
&& ./Configure -Duse64bitall -A ccflags=-fwrapv -des \
&& make -j$(nproc) \
&& make test_harness \
&& make install \
&& cd /usr/src \
&& curl -LO https://raw.githubusercontent.com/miyagawa/cpanminus/master/cpanm \
&& chmod +x cpanm \
&& ./cpanm App::cpanminus \
&& rm -fr ./cpanm /root/.cpanm /usr/src/perl
WORKDIR /root
CMD ["perl5.8.9","-de0"]

View file

@ -0,0 +1,539 @@
From c943b5fe69a7cf689217131f90470090ce8e02b8 Mon Sep 17 00:00:00 2001
From: Peter Martini <PeterCMartini@GMail.com>
Date: Wed, 15 Apr 2015 22:36:00 -0400
Subject: [PATCH] tmp
---
ext/Hash-Util-FieldHash/t/10_hash.t | 18 +++-
ext/ODBM_File/hints/linux.pl | 6 +-
hints/linux.sh | 189 +++++++++++++++++++++++++++---------
hv.c | 26 ++---
lib/Archive/Tar/t/02_methods.t | 14 +++
make_ext.pl | 4 +
patchlevel.h | 1 +
perl.c | 2 +-
t/op/hash.t | 20 +++-
9 files changed, 205 insertions(+), 75 deletions(-)
mode change 100755 => 100644 t/op/hash.t
diff --git a/ext/Hash-Util-FieldHash/t/10_hash.t b/ext/Hash-Util-FieldHash/t/10_hash.t
index 29c2f4d..c266b6a 100755
--- a/ext/Hash-Util-FieldHash/t/10_hash.t
+++ b/ext/Hash-Util-FieldHash/t/10_hash.t
@@ -46,15 +46,29 @@ use constant START => "a";
# some initial hash data
fieldhash my %h2;
-%h2 = map {$_ => 1} 'a'..'cc';
+my $counter= "a";
+$h2{$counter++}++ while $counter ne 'cd';
ok (!Internals::HvREHASH(%h2),
"starting with pre-populated non-pathological hash (rehash flag if off)");
my @keys = get_keys(\%h2);
+my $buckets= buckets(\%h2);
$h2{$_}++ for @keys;
+$h2{$counter++}++ while buckets(\%h2) == $buckets; # force a split
ok (Internals::HvREHASH(%h2),
- scalar(@keys) . " colliding into the same bucket keys are triggering rehash");
+ scalar(@keys) . " colliding into the same bucket keys are triggering rehash after split");
+
+# returns the number of buckets in a hash
+sub buckets {
+ my $hr = shift;
+ my $keys_buckets= scalar(%$hr);
+ if ($keys_buckets=~m!/([0-9]+)\z!) {
+ return 0+$1;
+ } else {
+ return 8;
+ }
+}
sub get_keys {
my $hr = shift;
diff --git a/ext/ODBM_File/hints/linux.pl b/ext/ODBM_File/hints/linux.pl
index f8ca492..204bba0 100644
--- a/ext/ODBM_File/hints/linux.pl
+++ b/ext/ODBM_File/hints/linux.pl
@@ -1,8 +1,8 @@
# uses GDBM dbm compatibility feature - at least on SuSE 8.0
$self->{LIBS} = ['-lgdbm'];
-# Debian/Ubuntu have /usr/lib/libgdbm_compat.so.3* but not this file,
+# Debian/Ubuntu have libgdbm_compat.so but not this file,
# so linking may fail
-if (-e '/usr/lib/libgdbm_compat.so' or -e '/usr/lib64/libgdbm_compat.so') {
- $self->{LIBS}->[0] .= ' -lgdbm_compat';
+foreach (split / /, $Config{libpth}) {
+ $self->{LIBS}->[0] .= ' -lgdbm_compat' if -e $_.'/libgdbm_compat.so';
}
diff --git a/hints/linux.sh b/hints/linux.sh
index c88f157..fb5a46e 100644
--- a/hints/linux.sh
+++ b/hints/linux.sh
@@ -13,11 +13,14 @@
# Updated Thu May 30 10:50:22 EDT 1996 by <doughera@lafayette.edu>
# Updated Fri Jun 21 11:07:54 EDT 1996
-# NDBM support for ELF renabled by <kjahds@kjahds.com>
+# NDBM support for ELF re-enabled by <kjahds@kjahds.com>
# No version of Linux supports setuid scripts.
d_suidsafe='undef'
+# No version of Linux needs libutil for perl.
+i_libutil='undef'
+
# Debian and Red Hat, and perhaps other vendors, provide both runtime and
# development packages for some libraries. The runtime packages contain shared
# libraries with version information in their names (e.g., libgdbm.so.1.7.3);
@@ -36,7 +39,7 @@ d_suidsafe='undef'
# SuSE Linux can be used as cross-compilation host for Cray XT4 Catamount/Qk.
if test -d /opt/xt-pe
then
- case "`cc -V 2>&1`" in
+ case "`${cc:-cc} -V 2>&1`" in
*catamount*) . hints/catamount.sh; return ;;
esac
fi
@@ -55,17 +58,10 @@ shift
libswanted="$*"
# Debian 4.0 puts ndbm in the -lgdbm_compat library.
-libswanted="$libswanted gdbm_compat"
-
-# 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
-# gcc to load the library for all tests.)
-# We don't use __GLIBC__ and __GLIBC_MINOR__ because they
-# are insufficiently precise to distinguish things like
-# libc-2.0.6 and libc-2.0.7.
-if test -L /lib/libc.so.6; then
- libc=`ls -l /lib/libc.so.6 | awk '{print $NF}'`
- libc=/lib/$libc
+echo $libs
+if echo " $libswanted " | grep -q ' gdbm '; then
+ # Only add if gdbm is in libswanted.
+ libswanted="$libswanted gdbm_compat"
fi
# Configure may fail to find lstat() since it's a static/inline
@@ -84,15 +80,23 @@ case "$usemymalloc" in
'') usemymalloc='n' ;;
esac
+uname_minus_m="`$run uname -m 2>/dev/null`"
+uname_minus_m="${uname_minus_m:-"$targetarch"}"
+
# Check if we're about to use Intel's ICC compiler
case "`${cc:-cc} -V 2>&1`" in
*"Intel(R) C++ Compiler"*|*"Intel(R) C Compiler"*)
+ # record the version, formats:
+ # icc (ICC) 10.1 20080801
+ # icpc (ICC) 10.1 20080801
+ # followed by a copyright on the second line
+ ccversion=`${cc:-cc} --version | sed -n -e 's/^icp\?c \((ICC) \)\?//p'`
# This is needed for Configure's prototype checks to work correctly
# The -mp flag is needed to pass various floating point related tests
# The -no-gcc flag is needed otherwise, icc pretends (poorly) to be gcc
ccflags="-we147 -mp -no-gcc $ccflags"
# Prevent relocation errors on 64bits arch
- case "`uname -m`" in
+ case "$uname_minus_m" in
*ia64*|*x86_64*)
cccdlflags='-fPIC'
;;
@@ -126,7 +130,7 @@ case "$optimize" in
# use -O2 by default ; -O3 doesn't seem to bring significant benefits with gcc
'')
optimize='-O2'
- case "`uname -m`" in
+ case "$uname_minus_m" in
ppc*)
# on ppc, it seems that gcc (at least gcc 3.3.2) isn't happy
# with -O2 ; so downgrade to -O1.
@@ -146,6 +150,77 @@ case "$optimize" in
;;
esac
+# Ubuntu 11.04 (and later, presumably) doesn't keep most libraries
+# (such as -lm) in /lib or /usr/lib. So we have to ask gcc to tell us
+# where to look. We don't want gcc's own libraries, however, so we
+# filter those out.
+# This could be conditional on Unbuntu, but other distributions may
+# follow suit, and this scheme seems to work even on rather old gcc's.
+# This unconditionally uses gcc because even if the user is using another
+# compiler, we still need to find the math library and friends, and I don't
+# know how other compilers will cope with that situation.
+# Morever, if the user has their own gcc earlier in $PATH than the system gcc,
+# we don't want its libraries. So we try to prefer the system gcc
+# Still, as an escape hatch, allow Configure command line overrides to
+# plibpth to bypass this check.
+if [ -x /usr/bin/gcc ] ; then
+ gcc=/usr/bin/gcc
+else
+ gcc=gcc
+fi
+
+case "$plibpth" in
+'') plibpth=`LANG=C LC_ALL=C $gcc $ccflags $ldflags -print-search-dirs | grep libraries |
+ cut -f2- -d= | tr ':' $trnl | grep -v 'gcc' | sed -e 's:/$::'`
+ set X $plibpth # Collapse all entries on one line
+ shift
+ plibpth="$*"
+ ;;
+esac
+
+# libquadmath is sometimes installed as gcc internal library,
+# so contrary to our usual policy of *not* looking at gcc internal
+# directories we now *do* look at them, in case they contain
+# the quadmath library.
+# XXX This may apply to other gcc internal libraries, if such exist.
+# XXX This could be at Configure level, but then the $gcc is messy.
+case "$usequadmath" in
+"$define")
+ for d in `LANG=C LC_ALL=C $gcc $ccflags $ldflags -print-search-dirs | grep libraries | cut -f2- -d= | tr ':' $trnl | grep 'gcc' | sed -e 's:/$::'`
+ do
+ case `ls $d/*libquadmath*$so* 2>/dev/null` in
+ $d/*libquadmath*$so*) xlibpth="$xlibpth $d" ;;
+ esac
+ done
+ ;;
+esac
+
+case "$libc" in
+'')
+# 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
+# gcc to load the library for all tests.)
+# We don't use __GLIBC__ and __GLIBC_MINOR__ because they
+# are insufficiently precise to distinguish things like
+# libc-2.0.6 and libc-2.0.7.
+ for p in $plibpth
+ do
+ for trylib in libc.so.6 libc.so
+ do
+ if $test -e $p/$trylib; then
+ libc=`ls -l $p/$trylib | awk '{print $NF}'`
+ if $test "X$libc" != X; then
+ break
+ fi
+ fi
+ done
+ if $test "X$libc" != X; then
+ break
+ fi
+ done
+ ;;
+esac
+
# Are we using ELF? Thanks to Kenneth Albanowski <kjahds@kjahds.com>
# for this test.
cat >try.c <<'EOM'
@@ -166,7 +241,7 @@ main() {
exit(0); /* succeed (yes, it's ELF) */
}
EOM
-if ${cc:-gcc} try.c >/dev/null 2>&1 && $run ./a.out; then
+if ${cc:-gcc} $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
cat <<'EOM' >&4
You appear to have ELF support. I'll try to use it for dynamic loading.
@@ -232,7 +307,7 @@ fi
rm -f try.c a.out
-if /bin/sh -c exit; then
+if ${sh:-/bin/sh} -c exit; then
echo ''
echo 'You appear to have a working bash. Good.'
else
@@ -299,7 +374,7 @@ fi
#'osfmach3ppc') ccdlflags='-Wl,-E' ;;
#esac
-case "`uname -m`" in
+case "$uname_minus_m" in
sparc*)
case "$cccdlflags" in
*-fpic*) cccdlflags="`echo $cccdlflags|sed 's/-fpic/-fPIC/'`" ;;
@@ -314,30 +389,62 @@ esac
# version of -lgdbm which is a bad idea. So if we have 'nm'
# make sure it can read the file
# NI-S 2003/08/07
-if [ -r /usr/lib/libndbm.so -a -x /usr/bin/nm ] ; then
- if /usr/bin/nm /usr/lib/libndbm.so >/dev/null 2>&1 ; then
- echo 'Your shared -lndbm seems to be a real library.'
- else
- echo 'Your shared -lndbm is not a real library.'
- set `echo X "$libswanted "| sed -e 's/ ndbm / /'`
- shift
- libswanted="$*"
- fi
-fi
+case "$nm" in
+ '') ;;
+ *)
+ for p in $plibpth
+ do
+ if $test -r $p/libndbm.so; then
+ if $nm $p/libndbm.so >/dev/null 2>&1 ; then
+ echo 'Your shared -lndbm seems to be a real library.'
+ _libndbm_real=1
+ break
+ fi
+ fi
+ done
+ if $test "X$_libndbm_real" = X; then
+ echo 'Your shared -lndbm is not a real library.'
+ set `echo X "$libswanted "| sed -e 's/ ndbm / /'`
+ shift
+ libswanted="$*"
+ fi
+ ;;
+esac
+# Linux on Synology.
+if [ -f /etc/synoinfo.conf -a -d /usr/syno ]; then
+ # Tested on Synology DS213 and DS413
+ # OS version info in /etc.defaults/VERSION
+ # http://forum.synology.com/wiki/index.php/What_kind_of_CPU_does_my_NAS_have
+ # Synology DS213 running DSM 4.3-3810-0 (2013-11-06)
+ # CPU model Marvell Kirkwood mv6282 ARMv5te
+ # Linux 2.6.32.12 #3810 Wed Nov 6 05:13:41 CST 2013 armv5tel GNU/Linux
+ # Synology DS413 running DSM 4.3-3810-0 (2013-11-06)
+ # CPU model Freescale QorIQ P1022 ppc (e500v2)
+ # linux 2.6.32.12 #3810 ppc GNU/Linux
+ # All development stuff installed with ipkg is in /opt
+ if [ "$LANG" = "" -o "$LANG" = "C" ]; then
+ echo 'Your LANG is safe'
+ else
+ echo 'Please set $LANG to "C". All other $LANG settings will cause havoc' >&4
+ LANG=C
+ fi
+ echo 'Setting up to use /opt/*' >&4
+ locincpth="/opt/include $locincpth"
+ libpth="/opt/lib $libpth"
+ libspth="/opt/lib $libspth"
+ loclibpth="/opt/lib $loclibpth"
+ # POSIX will not link without the pthread lib
+ libswanted="$libswanted pthread"
+ echo "$libswanted" >&4
+fi
# 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'
-if getconf GNU_LIBPTHREAD_VERSION | grep NPTL >/dev/null 2>/dev/null
-then
- threadshavepids=""
-else
- threadshavepids="-DTHREADS_HAVE_PIDS"
-fi
case "$usethreads" in
$define|true|[yY]*)
- ccflags="-D_REENTRANT -D_GNU_SOURCE $threadshavepids $ccflags"
+ ccflags="-D_REENTRANT -D_GNU_SOURCE $ccflags"
if echo $libswanted | grep -v pthread >/dev/null
then
set `echo X "$libswanted "| sed -e 's/ c / pthread c /'`
@@ -384,16 +491,6 @@ $define|true|[yY]*)
;;
esac
-# If we are using g++ we must use nm and force ourselves to use
-# the /usr/lib/libc.a (resetting the libc below to an empty string
-# makes Configure to look for the right one) because the symbol
-# scanning tricks of Configure will crash and burn horribly.
-case "$cc" in
-*g++*) usenm=true
- libc=''
- ;;
-esac
-
# If using g++, the Configure scan for dlopen() and (especially)
# dlerror() might fail, easier just to forcibly hint them in.
case "$cc" in
@@ -417,7 +514,7 @@ then
DBLIB="$DBDIR/libdb.so"
if [ -f $DBLIB ]
then
- if nm -u $DBLIB | grep pthread >/dev/null
+ if ${nm:-nm} -u $DBLIB 2>/dev/null | grep pthread >/dev/null
then
if ldd $DBLIB | grep pthread >/dev/null
then
diff --git a/hv.c b/hv.c
index 5d0f2f8..6bfedd5 100644
--- a/hv.c
+++ b/hv.c
@@ -35,7 +35,8 @@ holds the key and hash value.
#define PERL_HASH_INTERNAL_ACCESS
#include "perl.h"
-#define HV_MAX_LENGTH_BEFORE_SPLIT 14
+#define HV_MAX_LENGTH_BEFORE_REHASH 14
+#define SHOULD_DO_HSPLIT(xhv) ((xhv)->xhv_keys > (xhv)->xhv_max) /* HvTOTALKEYS(hv) > HvMAX(hv) */
static const char S_strtab_error[]
= "Cannot modify shared string table in hv_%s";
@@ -818,23 +819,8 @@ Perl_hv_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
xhv->xhv_keys++; /* HvTOTALKEYS(hv)++ */
if (!counter) { /* initial entry? */
xhv->xhv_fill++; /* HvFILL(hv)++ */
- } else if (xhv->xhv_keys > (IV)xhv->xhv_max) {
+ } else if ( SHOULD_DO_HSPLIT(xhv) ) {
hsplit(hv);
- } else if(!HvREHASH(hv)) {
- U32 n_links = 1;
-
- while ((counter = HeNEXT(counter)))
- n_links++;
-
- if (n_links > HV_MAX_LENGTH_BEFORE_SPLIT) {
- /* Use only the old HvKEYS(hv) > HvMAX(hv) condition to limit
- bucket splits on a rehashed hash, as we're not going to
- split it again, and if someone is lucky (evil) enough to
- get all the keys in one list they could exhaust our memory
- as we repeatedly double the number of buckets on every
- entry. Linear search feels a less worse thing to do. */
- hsplit(hv);
- }
}
}
@@ -1180,7 +1166,7 @@ S_hsplit(pTHX_ HV *hv)
/* Pick your policy for "hashing isn't working" here: */
- if (longest_chain <= HV_MAX_LENGTH_BEFORE_SPLIT /* split worked? */
+ if (longest_chain <= HV_MAX_LENGTH_BEFORE_REHASH /* split worked? */
|| HvREHASH(hv)) {
return;
}
@@ -2506,8 +2492,8 @@ S_share_hek_flags(pTHX_ const char *str, I32 len, register U32 hash, int flags)
xhv->xhv_keys++; /* HvTOTALKEYS(hv)++ */
if (!next) { /* initial entry? */
xhv->xhv_fill++; /* HvFILL(hv)++ */
- } else if (xhv->xhv_keys > (IV)xhv->xhv_max /* HvKEYS(hv) > HvMAX(hv) */) {
- hsplit(PL_strtab);
+ } else if ( SHOULD_DO_HSPLIT(xhv) ) {
+ hsplit(PL_strtab);
}
}
diff --git a/lib/Archive/Tar/t/02_methods.t b/lib/Archive/Tar/t/02_methods.t
index e400dda..e25e31a 100755
--- a/lib/Archive/Tar/t/02_methods.t
+++ b/lib/Archive/Tar/t/02_methods.t
@@ -70,6 +70,20 @@ my $LONG_FILE = qq[directory/really-really-really-really-really-really-really-re
my $TOO_LONG = ($^O eq 'MSWin32' or $^O eq 'cygwin' or $^O eq 'VMS')
&& length( cwd(). $LONG_FILE ) > 247;
+if(!$TOO_LONG) {
+ my $alt = File::Spec->catfile( cwd(), $LONG_FILE);
+ eval 'mkpath([$alt]);';
+ if($@)
+ {
+ $TOO_LONG = 1;
+ }
+ else
+ {
+ $@ = '';
+ my $base = File::Spec->catfile( cwd(), 'directory');
+ rmtree $base;
+ }
+}
### warn if we are going to skip long file names
if ($TOO_LONG) {
diag("No long filename support - long filename extraction disabled") if ! $ENV{PERL_CORE};
diff --git a/make_ext.pl b/make_ext.pl
index 22a97eb..6eac035 100644
--- a/make_ext.pl
+++ b/make_ext.pl
@@ -274,6 +274,10 @@ WriteMakefile(
EOM
close $fh or die "Can't close Makefile.PL: $!";
}
+ eval {
+ my $ftime = time - 4;
+ utime $ftime, $ftime, 'Makefile.PL';
+ };
print "\nRunning Makefile.PL in $ext_dir\n";
# Presumably this can be simplified
diff --git a/patchlevel.h b/patchlevel.h
index 4442407..5169551 100644
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -131,6 +131,7 @@ static const char * const local_patches[] = {
NULL
PERL_GIT_UNPUSHED_COMMITS /* do not remove this line */
PERL_GIT_UNCOMMITTED_CHANGES /* do not remove this line */
+ ,"Devel::PatchPerl 1.32"
,NULL
};
diff --git a/perl.c b/perl.c
index 94f2b13..5f30040 100644
--- a/perl.c
+++ b/perl.c
@@ -3745,7 +3745,7 @@ S_open_script(pTHX_ const char *scriptname, bool dosearch, SV *sv,
# ifdef VMS
cpp_discard_flag = "";
# else
- cpp_discard_flag = "-C";
+ cpp_discard_flag = "-C -ffreestanding";
# endif
# ifdef OS2
diff --git a/t/op/hash.t b/t/op/hash.t
old mode 100755
new mode 100644
index 9bde518..45eb782
--- a/t/op/hash.t
+++ b/t/op/hash.t
@@ -39,22 +39,36 @@ use constant THRESHOLD => 14;
use constant START => "a";
# some initial hash data
-my %h2 = map {$_ => 1} 'a'..'cc';
+my %h2;
+my $counter= "a";
+$h2{$counter++}++ while $counter ne 'cd';
ok (!Internals::HvREHASH(%h2),
"starting with pre-populated non-pathological hash (rehash flag if off)");
my @keys = get_keys(\%h2);
+my $buckets= buckets(\%h2);
$h2{$_}++ for @keys;
+$h2{$counter++}++ while buckets(\%h2) == $buckets; # force a split
ok (Internals::HvREHASH(%h2),
- scalar(@keys) . " colliding into the same bucket keys are triggering rehash");
+ scalar(@keys) . " colliding into the same bucket keys are triggering rehash after split");
+
+# returns the number of buckets in a hash
+sub buckets {
+ my $hr = shift;
+ my $keys_buckets= scalar(%$hr);
+ if ($keys_buckets=~m!/([0-9]+)\z!) {
+ return 0+$1;
+ } else {
+ return 8;
+ }
+}
sub get_keys {
my $hr = shift;
# the minimum of bits required to mount the attack on a hash
my $min_bits = log(THRESHOLD)/log(2);
-
# if the hash has already been populated with a significant amount
# of entries the number of mask bits can be higher
my $keys = scalar keys %$hr;
--
1.9.1

View file

@ -0,0 +1,29 @@
FROM buildpack-deps
MAINTAINER Peter Martini <PeterCMartini@GMail.com>
RUN apt-get update \
&& apt-get install -y curl procps \
&& rm -fr /var/lib/apt/lists/*
RUN mkdir /usr/src/perl
COPY DevelPatchPerl.patch /usr/src/perl/
WORKDIR /usr/src/perl
RUN curl -SL https://cpan.metacpan.org/authors/id/D/DA/DAPM/perl-5.10.1.tar.bz2 -o perl-5.10.1.tar.bz2 \
&& echo '98b762b5cd4fb76dd354dfa5ba0d21bc2acacaf2 *perl-5.10.1.tar.bz2' | sha1sum -c - \
&& tar --strip-components=1 -xjf perl-5.10.1.tar.bz2 -C /usr/src/perl \
&& rm perl-5.10.1.tar.bz2 \
&& cat DevelPatchPerl.patch | patch -p1 \
&& ./Configure -Dusethreads -Duse64bitall -A ccflags=-fwrapv -des \
&& make -j$(nproc) \
&& make test_harness \
&& make install \
&& cd /usr/src \
&& curl -LO https://raw.githubusercontent.com/miyagawa/cpanminus/master/cpanm \
&& chmod +x cpanm \
&& ./cpanm App::cpanminus \
&& rm -fr ./cpanm /root/.cpanm /usr/src/perl
WORKDIR /root
CMD ["perl5.10.1","-de0"]

View file

@ -0,0 +1,539 @@
From c943b5fe69a7cf689217131f90470090ce8e02b8 Mon Sep 17 00:00:00 2001
From: Peter Martini <PeterCMartini@GMail.com>
Date: Wed, 15 Apr 2015 22:36:00 -0400
Subject: [PATCH] tmp
---
ext/Hash-Util-FieldHash/t/10_hash.t | 18 +++-
ext/ODBM_File/hints/linux.pl | 6 +-
hints/linux.sh | 189 +++++++++++++++++++++++++++---------
hv.c | 26 ++---
lib/Archive/Tar/t/02_methods.t | 14 +++
make_ext.pl | 4 +
patchlevel.h | 1 +
perl.c | 2 +-
t/op/hash.t | 20 +++-
9 files changed, 205 insertions(+), 75 deletions(-)
mode change 100755 => 100644 t/op/hash.t
diff --git a/ext/Hash-Util-FieldHash/t/10_hash.t b/ext/Hash-Util-FieldHash/t/10_hash.t
index 29c2f4d..c266b6a 100755
--- a/ext/Hash-Util-FieldHash/t/10_hash.t
+++ b/ext/Hash-Util-FieldHash/t/10_hash.t
@@ -46,15 +46,29 @@ use constant START => "a";
# some initial hash data
fieldhash my %h2;
-%h2 = map {$_ => 1} 'a'..'cc';
+my $counter= "a";
+$h2{$counter++}++ while $counter ne 'cd';
ok (!Internals::HvREHASH(%h2),
"starting with pre-populated non-pathological hash (rehash flag if off)");
my @keys = get_keys(\%h2);
+my $buckets= buckets(\%h2);
$h2{$_}++ for @keys;
+$h2{$counter++}++ while buckets(\%h2) == $buckets; # force a split
ok (Internals::HvREHASH(%h2),
- scalar(@keys) . " colliding into the same bucket keys are triggering rehash");
+ scalar(@keys) . " colliding into the same bucket keys are triggering rehash after split");
+
+# returns the number of buckets in a hash
+sub buckets {
+ my $hr = shift;
+ my $keys_buckets= scalar(%$hr);
+ if ($keys_buckets=~m!/([0-9]+)\z!) {
+ return 0+$1;
+ } else {
+ return 8;
+ }
+}
sub get_keys {
my $hr = shift;
diff --git a/ext/ODBM_File/hints/linux.pl b/ext/ODBM_File/hints/linux.pl
index f8ca492..204bba0 100644
--- a/ext/ODBM_File/hints/linux.pl
+++ b/ext/ODBM_File/hints/linux.pl
@@ -1,8 +1,8 @@
# uses GDBM dbm compatibility feature - at least on SuSE 8.0
$self->{LIBS} = ['-lgdbm'];
-# Debian/Ubuntu have /usr/lib/libgdbm_compat.so.3* but not this file,
+# Debian/Ubuntu have libgdbm_compat.so but not this file,
# so linking may fail
-if (-e '/usr/lib/libgdbm_compat.so' or -e '/usr/lib64/libgdbm_compat.so') {
- $self->{LIBS}->[0] .= ' -lgdbm_compat';
+foreach (split / /, $Config{libpth}) {
+ $self->{LIBS}->[0] .= ' -lgdbm_compat' if -e $_.'/libgdbm_compat.so';
}
diff --git a/hints/linux.sh b/hints/linux.sh
index c88f157..fb5a46e 100644
--- a/hints/linux.sh
+++ b/hints/linux.sh
@@ -13,11 +13,14 @@
# Updated Thu May 30 10:50:22 EDT 1996 by <doughera@lafayette.edu>
# Updated Fri Jun 21 11:07:54 EDT 1996
-# NDBM support for ELF renabled by <kjahds@kjahds.com>
+# NDBM support for ELF re-enabled by <kjahds@kjahds.com>
# No version of Linux supports setuid scripts.
d_suidsafe='undef'
+# No version of Linux needs libutil for perl.
+i_libutil='undef'
+
# Debian and Red Hat, and perhaps other vendors, provide both runtime and
# development packages for some libraries. The runtime packages contain shared
# libraries with version information in their names (e.g., libgdbm.so.1.7.3);
@@ -36,7 +39,7 @@ d_suidsafe='undef'
# SuSE Linux can be used as cross-compilation host for Cray XT4 Catamount/Qk.
if test -d /opt/xt-pe
then
- case "`cc -V 2>&1`" in
+ case "`${cc:-cc} -V 2>&1`" in
*catamount*) . hints/catamount.sh; return ;;
esac
fi
@@ -55,17 +58,10 @@ shift
libswanted="$*"
# Debian 4.0 puts ndbm in the -lgdbm_compat library.
-libswanted="$libswanted gdbm_compat"
-
-# 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
-# gcc to load the library for all tests.)
-# We don't use __GLIBC__ and __GLIBC_MINOR__ because they
-# are insufficiently precise to distinguish things like
-# libc-2.0.6 and libc-2.0.7.
-if test -L /lib/libc.so.6; then
- libc=`ls -l /lib/libc.so.6 | awk '{print $NF}'`
- libc=/lib/$libc
+echo $libs
+if echo " $libswanted " | grep -q ' gdbm '; then
+ # Only add if gdbm is in libswanted.
+ libswanted="$libswanted gdbm_compat"
fi
# Configure may fail to find lstat() since it's a static/inline
@@ -84,15 +80,23 @@ case "$usemymalloc" in
'') usemymalloc='n' ;;
esac
+uname_minus_m="`$run uname -m 2>/dev/null`"
+uname_minus_m="${uname_minus_m:-"$targetarch"}"
+
# Check if we're about to use Intel's ICC compiler
case "`${cc:-cc} -V 2>&1`" in
*"Intel(R) C++ Compiler"*|*"Intel(R) C Compiler"*)
+ # record the version, formats:
+ # icc (ICC) 10.1 20080801
+ # icpc (ICC) 10.1 20080801
+ # followed by a copyright on the second line
+ ccversion=`${cc:-cc} --version | sed -n -e 's/^icp\?c \((ICC) \)\?//p'`
# This is needed for Configure's prototype checks to work correctly
# The -mp flag is needed to pass various floating point related tests
# The -no-gcc flag is needed otherwise, icc pretends (poorly) to be gcc
ccflags="-we147 -mp -no-gcc $ccflags"
# Prevent relocation errors on 64bits arch
- case "`uname -m`" in
+ case "$uname_minus_m" in
*ia64*|*x86_64*)
cccdlflags='-fPIC'
;;
@@ -126,7 +130,7 @@ case "$optimize" in
# use -O2 by default ; -O3 doesn't seem to bring significant benefits with gcc
'')
optimize='-O2'
- case "`uname -m`" in
+ case "$uname_minus_m" in
ppc*)
# on ppc, it seems that gcc (at least gcc 3.3.2) isn't happy
# with -O2 ; so downgrade to -O1.
@@ -146,6 +150,77 @@ case "$optimize" in
;;
esac
+# Ubuntu 11.04 (and later, presumably) doesn't keep most libraries
+# (such as -lm) in /lib or /usr/lib. So we have to ask gcc to tell us
+# where to look. We don't want gcc's own libraries, however, so we
+# filter those out.
+# This could be conditional on Unbuntu, but other distributions may
+# follow suit, and this scheme seems to work even on rather old gcc's.
+# This unconditionally uses gcc because even if the user is using another
+# compiler, we still need to find the math library and friends, and I don't
+# know how other compilers will cope with that situation.
+# Morever, if the user has their own gcc earlier in $PATH than the system gcc,
+# we don't want its libraries. So we try to prefer the system gcc
+# Still, as an escape hatch, allow Configure command line overrides to
+# plibpth to bypass this check.
+if [ -x /usr/bin/gcc ] ; then
+ gcc=/usr/bin/gcc
+else
+ gcc=gcc
+fi
+
+case "$plibpth" in
+'') plibpth=`LANG=C LC_ALL=C $gcc $ccflags $ldflags -print-search-dirs | grep libraries |
+ cut -f2- -d= | tr ':' $trnl | grep -v 'gcc' | sed -e 's:/$::'`
+ set X $plibpth # Collapse all entries on one line
+ shift
+ plibpth="$*"
+ ;;
+esac
+
+# libquadmath is sometimes installed as gcc internal library,
+# so contrary to our usual policy of *not* looking at gcc internal
+# directories we now *do* look at them, in case they contain
+# the quadmath library.
+# XXX This may apply to other gcc internal libraries, if such exist.
+# XXX This could be at Configure level, but then the $gcc is messy.
+case "$usequadmath" in
+"$define")
+ for d in `LANG=C LC_ALL=C $gcc $ccflags $ldflags -print-search-dirs | grep libraries | cut -f2- -d= | tr ':' $trnl | grep 'gcc' | sed -e 's:/$::'`
+ do
+ case `ls $d/*libquadmath*$so* 2>/dev/null` in
+ $d/*libquadmath*$so*) xlibpth="$xlibpth $d" ;;
+ esac
+ done
+ ;;
+esac
+
+case "$libc" in
+'')
+# 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
+# gcc to load the library for all tests.)
+# We don't use __GLIBC__ and __GLIBC_MINOR__ because they
+# are insufficiently precise to distinguish things like
+# libc-2.0.6 and libc-2.0.7.
+ for p in $plibpth
+ do
+ for trylib in libc.so.6 libc.so
+ do
+ if $test -e $p/$trylib; then
+ libc=`ls -l $p/$trylib | awk '{print $NF}'`
+ if $test "X$libc" != X; then
+ break
+ fi
+ fi
+ done
+ if $test "X$libc" != X; then
+ break
+ fi
+ done
+ ;;
+esac
+
# Are we using ELF? Thanks to Kenneth Albanowski <kjahds@kjahds.com>
# for this test.
cat >try.c <<'EOM'
@@ -166,7 +241,7 @@ main() {
exit(0); /* succeed (yes, it's ELF) */
}
EOM
-if ${cc:-gcc} try.c >/dev/null 2>&1 && $run ./a.out; then
+if ${cc:-gcc} $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
cat <<'EOM' >&4
You appear to have ELF support. I'll try to use it for dynamic loading.
@@ -232,7 +307,7 @@ fi
rm -f try.c a.out
-if /bin/sh -c exit; then
+if ${sh:-/bin/sh} -c exit; then
echo ''
echo 'You appear to have a working bash. Good.'
else
@@ -299,7 +374,7 @@ fi
#'osfmach3ppc') ccdlflags='-Wl,-E' ;;
#esac
-case "`uname -m`" in
+case "$uname_minus_m" in
sparc*)
case "$cccdlflags" in
*-fpic*) cccdlflags="`echo $cccdlflags|sed 's/-fpic/-fPIC/'`" ;;
@@ -314,30 +389,62 @@ esac
# version of -lgdbm which is a bad idea. So if we have 'nm'
# make sure it can read the file
# NI-S 2003/08/07
-if [ -r /usr/lib/libndbm.so -a -x /usr/bin/nm ] ; then
- if /usr/bin/nm /usr/lib/libndbm.so >/dev/null 2>&1 ; then
- echo 'Your shared -lndbm seems to be a real library.'
- else
- echo 'Your shared -lndbm is not a real library.'
- set `echo X "$libswanted "| sed -e 's/ ndbm / /'`
- shift
- libswanted="$*"
- fi
-fi
+case "$nm" in
+ '') ;;
+ *)
+ for p in $plibpth
+ do
+ if $test -r $p/libndbm.so; then
+ if $nm $p/libndbm.so >/dev/null 2>&1 ; then
+ echo 'Your shared -lndbm seems to be a real library.'
+ _libndbm_real=1
+ break
+ fi
+ fi
+ done
+ if $test "X$_libndbm_real" = X; then
+ echo 'Your shared -lndbm is not a real library.'
+ set `echo X "$libswanted "| sed -e 's/ ndbm / /'`
+ shift
+ libswanted="$*"
+ fi
+ ;;
+esac
+# Linux on Synology.
+if [ -f /etc/synoinfo.conf -a -d /usr/syno ]; then
+ # Tested on Synology DS213 and DS413
+ # OS version info in /etc.defaults/VERSION
+ # http://forum.synology.com/wiki/index.php/What_kind_of_CPU_does_my_NAS_have
+ # Synology DS213 running DSM 4.3-3810-0 (2013-11-06)
+ # CPU model Marvell Kirkwood mv6282 ARMv5te
+ # Linux 2.6.32.12 #3810 Wed Nov 6 05:13:41 CST 2013 armv5tel GNU/Linux
+ # Synology DS413 running DSM 4.3-3810-0 (2013-11-06)
+ # CPU model Freescale QorIQ P1022 ppc (e500v2)
+ # linux 2.6.32.12 #3810 ppc GNU/Linux
+ # All development stuff installed with ipkg is in /opt
+ if [ "$LANG" = "" -o "$LANG" = "C" ]; then
+ echo 'Your LANG is safe'
+ else
+ echo 'Please set $LANG to "C". All other $LANG settings will cause havoc' >&4
+ LANG=C
+ fi
+ echo 'Setting up to use /opt/*' >&4
+ locincpth="/opt/include $locincpth"
+ libpth="/opt/lib $libpth"
+ libspth="/opt/lib $libspth"
+ loclibpth="/opt/lib $loclibpth"
+ # POSIX will not link without the pthread lib
+ libswanted="$libswanted pthread"
+ echo "$libswanted" >&4
+fi
# 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'
-if getconf GNU_LIBPTHREAD_VERSION | grep NPTL >/dev/null 2>/dev/null
-then
- threadshavepids=""
-else
- threadshavepids="-DTHREADS_HAVE_PIDS"
-fi
case "$usethreads" in
$define|true|[yY]*)
- ccflags="-D_REENTRANT -D_GNU_SOURCE $threadshavepids $ccflags"
+ ccflags="-D_REENTRANT -D_GNU_SOURCE $ccflags"
if echo $libswanted | grep -v pthread >/dev/null
then
set `echo X "$libswanted "| sed -e 's/ c / pthread c /'`
@@ -384,16 +491,6 @@ $define|true|[yY]*)
;;
esac
-# If we are using g++ we must use nm and force ourselves to use
-# the /usr/lib/libc.a (resetting the libc below to an empty string
-# makes Configure to look for the right one) because the symbol
-# scanning tricks of Configure will crash and burn horribly.
-case "$cc" in
-*g++*) usenm=true
- libc=''
- ;;
-esac
-
# If using g++, the Configure scan for dlopen() and (especially)
# dlerror() might fail, easier just to forcibly hint them in.
case "$cc" in
@@ -417,7 +514,7 @@ then
DBLIB="$DBDIR/libdb.so"
if [ -f $DBLIB ]
then
- if nm -u $DBLIB | grep pthread >/dev/null
+ if ${nm:-nm} -u $DBLIB 2>/dev/null | grep pthread >/dev/null
then
if ldd $DBLIB | grep pthread >/dev/null
then
diff --git a/hv.c b/hv.c
index 5d0f2f8..6bfedd5 100644
--- a/hv.c
+++ b/hv.c
@@ -35,7 +35,8 @@ holds the key and hash value.
#define PERL_HASH_INTERNAL_ACCESS
#include "perl.h"
-#define HV_MAX_LENGTH_BEFORE_SPLIT 14
+#define HV_MAX_LENGTH_BEFORE_REHASH 14
+#define SHOULD_DO_HSPLIT(xhv) ((xhv)->xhv_keys > (xhv)->xhv_max) /* HvTOTALKEYS(hv) > HvMAX(hv) */
static const char S_strtab_error[]
= "Cannot modify shared string table in hv_%s";
@@ -818,23 +819,8 @@ Perl_hv_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
xhv->xhv_keys++; /* HvTOTALKEYS(hv)++ */
if (!counter) { /* initial entry? */
xhv->xhv_fill++; /* HvFILL(hv)++ */
- } else if (xhv->xhv_keys > (IV)xhv->xhv_max) {
+ } else if ( SHOULD_DO_HSPLIT(xhv) ) {
hsplit(hv);
- } else if(!HvREHASH(hv)) {
- U32 n_links = 1;
-
- while ((counter = HeNEXT(counter)))
- n_links++;
-
- if (n_links > HV_MAX_LENGTH_BEFORE_SPLIT) {
- /* Use only the old HvKEYS(hv) > HvMAX(hv) condition to limit
- bucket splits on a rehashed hash, as we're not going to
- split it again, and if someone is lucky (evil) enough to
- get all the keys in one list they could exhaust our memory
- as we repeatedly double the number of buckets on every
- entry. Linear search feels a less worse thing to do. */
- hsplit(hv);
- }
}
}
@@ -1180,7 +1166,7 @@ S_hsplit(pTHX_ HV *hv)
/* Pick your policy for "hashing isn't working" here: */
- if (longest_chain <= HV_MAX_LENGTH_BEFORE_SPLIT /* split worked? */
+ if (longest_chain <= HV_MAX_LENGTH_BEFORE_REHASH /* split worked? */
|| HvREHASH(hv)) {
return;
}
@@ -2506,8 +2492,8 @@ S_share_hek_flags(pTHX_ const char *str, I32 len, register U32 hash, int flags)
xhv->xhv_keys++; /* HvTOTALKEYS(hv)++ */
if (!next) { /* initial entry? */
xhv->xhv_fill++; /* HvFILL(hv)++ */
- } else if (xhv->xhv_keys > (IV)xhv->xhv_max /* HvKEYS(hv) > HvMAX(hv) */) {
- hsplit(PL_strtab);
+ } else if ( SHOULD_DO_HSPLIT(xhv) ) {
+ hsplit(PL_strtab);
}
}
diff --git a/lib/Archive/Tar/t/02_methods.t b/lib/Archive/Tar/t/02_methods.t
index e400dda..e25e31a 100755
--- a/lib/Archive/Tar/t/02_methods.t
+++ b/lib/Archive/Tar/t/02_methods.t
@@ -70,6 +70,20 @@ my $LONG_FILE = qq[directory/really-really-really-really-really-really-really-re
my $TOO_LONG = ($^O eq 'MSWin32' or $^O eq 'cygwin' or $^O eq 'VMS')
&& length( cwd(). $LONG_FILE ) > 247;
+if(!$TOO_LONG) {
+ my $alt = File::Spec->catfile( cwd(), $LONG_FILE);
+ eval 'mkpath([$alt]);';
+ if($@)
+ {
+ $TOO_LONG = 1;
+ }
+ else
+ {
+ $@ = '';
+ my $base = File::Spec->catfile( cwd(), 'directory');
+ rmtree $base;
+ }
+}
### warn if we are going to skip long file names
if ($TOO_LONG) {
diag("No long filename support - long filename extraction disabled") if ! $ENV{PERL_CORE};
diff --git a/make_ext.pl b/make_ext.pl
index 22a97eb..6eac035 100644
--- a/make_ext.pl
+++ b/make_ext.pl
@@ -274,6 +274,10 @@ WriteMakefile(
EOM
close $fh or die "Can't close Makefile.PL: $!";
}
+ eval {
+ my $ftime = time - 4;
+ utime $ftime, $ftime, 'Makefile.PL';
+ };
print "\nRunning Makefile.PL in $ext_dir\n";
# Presumably this can be simplified
diff --git a/patchlevel.h b/patchlevel.h
index 4442407..5169551 100644
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -131,6 +131,7 @@ static const char * const local_patches[] = {
NULL
PERL_GIT_UNPUSHED_COMMITS /* do not remove this line */
PERL_GIT_UNCOMMITTED_CHANGES /* do not remove this line */
+ ,"Devel::PatchPerl 1.32"
,NULL
};
diff --git a/perl.c b/perl.c
index 94f2b13..5f30040 100644
--- a/perl.c
+++ b/perl.c
@@ -3745,7 +3745,7 @@ S_open_script(pTHX_ const char *scriptname, bool dosearch, SV *sv,
# ifdef VMS
cpp_discard_flag = "";
# else
- cpp_discard_flag = "-C";
+ cpp_discard_flag = "-C -ffreestanding";
# endif
# ifdef OS2
diff --git a/t/op/hash.t b/t/op/hash.t
old mode 100755
new mode 100644
index 9bde518..45eb782
--- a/t/op/hash.t
+++ b/t/op/hash.t
@@ -39,22 +39,36 @@ use constant THRESHOLD => 14;
use constant START => "a";
# some initial hash data
-my %h2 = map {$_ => 1} 'a'..'cc';
+my %h2;
+my $counter= "a";
+$h2{$counter++}++ while $counter ne 'cd';
ok (!Internals::HvREHASH(%h2),
"starting with pre-populated non-pathological hash (rehash flag if off)");
my @keys = get_keys(\%h2);
+my $buckets= buckets(\%h2);
$h2{$_}++ for @keys;
+$h2{$counter++}++ while buckets(\%h2) == $buckets; # force a split
ok (Internals::HvREHASH(%h2),
- scalar(@keys) . " colliding into the same bucket keys are triggering rehash");
+ scalar(@keys) . " colliding into the same bucket keys are triggering rehash after split");
+
+# returns the number of buckets in a hash
+sub buckets {
+ my $hr = shift;
+ my $keys_buckets= scalar(%$hr);
+ if ($keys_buckets=~m!/([0-9]+)\z!) {
+ return 0+$1;
+ } else {
+ return 8;
+ }
+}
sub get_keys {
my $hr = shift;
# the minimum of bits required to mount the attack on a hash
my $min_bits = log(THRESHOLD)/log(2);
-
# if the hash has already been populated with a significant amount
# of entries the number of mask bits can be higher
my $keys = scalar keys %$hr;
--
1.9.1

View file

@ -0,0 +1,29 @@
FROM buildpack-deps
MAINTAINER Peter Martini <PeterCMartini@GMail.com>
RUN apt-get update \
&& apt-get install -y curl procps \
&& rm -fr /var/lib/apt/lists/*
RUN mkdir /usr/src/perl
COPY DevelPatchPerl.patch /usr/src/perl/
WORKDIR /usr/src/perl
RUN curl -SL https://cpan.metacpan.org/authors/id/D/DA/DAPM/perl-5.10.1.tar.bz2 -o perl-5.10.1.tar.bz2 \
&& echo '98b762b5cd4fb76dd354dfa5ba0d21bc2acacaf2 *perl-5.10.1.tar.bz2' | sha1sum -c - \
&& tar --strip-components=1 -xjf perl-5.10.1.tar.bz2 -C /usr/src/perl \
&& rm perl-5.10.1.tar.bz2 \
&& cat DevelPatchPerl.patch | patch -p1 \
&& ./Configure -Duse64bitall -A ccflags=-fwrapv -des \
&& make -j$(nproc) \
&& make test_harness \
&& make install \
&& cd /usr/src \
&& curl -LO https://raw.githubusercontent.com/miyagawa/cpanminus/master/cpanm \
&& chmod +x cpanm \
&& ./cpanm App::cpanminus \
&& rm -fr ./cpanm /root/.cpanm /usr/src/perl
WORKDIR /root
CMD ["perl5.10.1","-de0"]

View file

@ -0,0 +1,511 @@
From 145264f14350f778df5efed47ec74d463ad8c941 Mon Sep 17 00:00:00 2001
From: Peter Martini <PeterCMartini@GMail.com>
Date: Wed, 15 Apr 2015 22:36:04 -0400
Subject: [PATCH] tmp
---
cpan/Archive-Tar/t/02_methods.t | 14 +++
ext/Hash-Util-FieldHash/t/10_hash.t | 18 +++-
ext/ODBM_File/hints/linux.pl | 6 +-
hints/linux.sh | 166 ++++++++++++++++++++++++++----------
hv.c | 26 ++----
make_ext.pl | 4 +
patchlevel.h | 1 +
t/op/hash.t | 20 ++++-
8 files changed, 180 insertions(+), 75 deletions(-)
mode change 100755 => 100644 t/op/hash.t
diff --git a/cpan/Archive-Tar/t/02_methods.t b/cpan/Archive-Tar/t/02_methods.t
index e400dda..e25e31a 100755
--- a/cpan/Archive-Tar/t/02_methods.t
+++ b/cpan/Archive-Tar/t/02_methods.t
@@ -70,6 +70,20 @@ my $LONG_FILE = qq[directory/really-really-really-really-really-really-really-re
my $TOO_LONG = ($^O eq 'MSWin32' or $^O eq 'cygwin' or $^O eq 'VMS')
&& length( cwd(). $LONG_FILE ) > 247;
+if(!$TOO_LONG) {
+ my $alt = File::Spec->catfile( cwd(), $LONG_FILE);
+ eval 'mkpath([$alt]);';
+ if($@)
+ {
+ $TOO_LONG = 1;
+ }
+ else
+ {
+ $@ = '';
+ my $base = File::Spec->catfile( cwd(), 'directory');
+ rmtree $base;
+ }
+}
### warn if we are going to skip long file names
if ($TOO_LONG) {
diag("No long filename support - long filename extraction disabled") if ! $ENV{PERL_CORE};
diff --git a/ext/Hash-Util-FieldHash/t/10_hash.t b/ext/Hash-Util-FieldHash/t/10_hash.t
index 2cfb4e8..d58f053 100755
--- a/ext/Hash-Util-FieldHash/t/10_hash.t
+++ b/ext/Hash-Util-FieldHash/t/10_hash.t
@@ -38,15 +38,29 @@ use constant START => "a";
# some initial hash data
fieldhash my %h2;
-%h2 = map {$_ => 1} 'a'..'cc';
+my $counter= "a";
+$h2{$counter++}++ while $counter ne 'cd';
ok (!Internals::HvREHASH(%h2),
"starting with pre-populated non-pathological hash (rehash flag if off)");
my @keys = get_keys(\%h2);
+my $buckets= buckets(\%h2);
$h2{$_}++ for @keys;
+$h2{$counter++}++ while buckets(\%h2) == $buckets; # force a split
ok (Internals::HvREHASH(%h2),
- scalar(@keys) . " colliding into the same bucket keys are triggering rehash");
+ scalar(@keys) . " colliding into the same bucket keys are triggering rehash after split");
+
+# returns the number of buckets in a hash
+sub buckets {
+ my $hr = shift;
+ my $keys_buckets= scalar(%$hr);
+ if ($keys_buckets=~m!/([0-9]+)\z!) {
+ return 0+$1;
+ } else {
+ return 8;
+ }
+}
sub get_keys {
my $hr = shift;
diff --git a/ext/ODBM_File/hints/linux.pl b/ext/ODBM_File/hints/linux.pl
index f8ca492..204bba0 100644
--- a/ext/ODBM_File/hints/linux.pl
+++ b/ext/ODBM_File/hints/linux.pl
@@ -1,8 +1,8 @@
# uses GDBM dbm compatibility feature - at least on SuSE 8.0
$self->{LIBS} = ['-lgdbm'];
-# Debian/Ubuntu have /usr/lib/libgdbm_compat.so.3* but not this file,
+# Debian/Ubuntu have libgdbm_compat.so but not this file,
# so linking may fail
-if (-e '/usr/lib/libgdbm_compat.so' or -e '/usr/lib64/libgdbm_compat.so') {
- $self->{LIBS}->[0] .= ' -lgdbm_compat';
+foreach (split / /, $Config{libpth}) {
+ $self->{LIBS}->[0] .= ' -lgdbm_compat' if -e $_.'/libgdbm_compat.so';
}
diff --git a/hints/linux.sh b/hints/linux.sh
index 0519eca..fb5a46e 100644
--- a/hints/linux.sh
+++ b/hints/linux.sh
@@ -13,11 +13,14 @@
# Updated Thu May 30 10:50:22 EDT 1996 by <doughera@lafayette.edu>
# Updated Fri Jun 21 11:07:54 EDT 1996
-# NDBM support for ELF renabled by <kjahds@kjahds.com>
+# NDBM support for ELF re-enabled by <kjahds@kjahds.com>
# No version of Linux supports setuid scripts.
d_suidsafe='undef'
+# No version of Linux needs libutil for perl.
+i_libutil='undef'
+
# Debian and Red Hat, and perhaps other vendors, provide both runtime and
# development packages for some libraries. The runtime packages contain shared
# libraries with version information in their names (e.g., libgdbm.so.1.7.3);
@@ -36,7 +39,7 @@ d_suidsafe='undef'
# SuSE Linux can be used as cross-compilation host for Cray XT4 Catamount/Qk.
if test -d /opt/xt-pe
then
- case "`cc -V 2>&1`" in
+ case "`${cc:-cc} -V 2>&1`" in
*catamount*) . hints/catamount.sh; return ;;
esac
fi
@@ -55,17 +58,10 @@ shift
libswanted="$*"
# Debian 4.0 puts ndbm in the -lgdbm_compat library.
-libswanted="$libswanted gdbm_compat"
-
-# 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
-# gcc to load the library for all tests.)
-# We don't use __GLIBC__ and __GLIBC_MINOR__ because they
-# are insufficiently precise to distinguish things like
-# libc-2.0.6 and libc-2.0.7.
-if test -L /lib/libc.so.6; then
- libc=`ls -l /lib/libc.so.6 | awk '{print $NF}'`
- libc=/lib/$libc
+echo $libs
+if echo " $libswanted " | grep -q ' gdbm '; then
+ # Only add if gdbm is in libswanted.
+ libswanted="$libswanted gdbm_compat"
fi
# Configure may fail to find lstat() since it's a static/inline
@@ -84,6 +80,9 @@ case "$usemymalloc" in
'') usemymalloc='n' ;;
esac
+uname_minus_m="`$run uname -m 2>/dev/null`"
+uname_minus_m="${uname_minus_m:-"$targetarch"}"
+
# Check if we're about to use Intel's ICC compiler
case "`${cc:-cc} -V 2>&1`" in
*"Intel(R) C++ Compiler"*|*"Intel(R) C Compiler"*)
@@ -97,7 +96,7 @@ case "`${cc:-cc} -V 2>&1`" in
# The -no-gcc flag is needed otherwise, icc pretends (poorly) to be gcc
ccflags="-we147 -mp -no-gcc $ccflags"
# Prevent relocation errors on 64bits arch
- case "`uname -m`" in
+ case "$uname_minus_m" in
*ia64*|*x86_64*)
cccdlflags='-fPIC'
;;
@@ -131,7 +130,7 @@ case "$optimize" in
# use -O2 by default ; -O3 doesn't seem to bring significant benefits with gcc
'')
optimize='-O2'
- case "`uname -m`" in
+ case "$uname_minus_m" in
ppc*)
# on ppc, it seems that gcc (at least gcc 3.3.2) isn't happy
# with -O2 ; so downgrade to -O1.
@@ -160,10 +159,18 @@ esac
# This unconditionally uses gcc because even if the user is using another
# compiler, we still need to find the math library and friends, and I don't
# know how other compilers will cope with that situation.
+# Morever, if the user has their own gcc earlier in $PATH than the system gcc,
+# we don't want its libraries. So we try to prefer the system gcc
# Still, as an escape hatch, allow Configure command line overrides to
# plibpth to bypass this check.
+if [ -x /usr/bin/gcc ] ; then
+ gcc=/usr/bin/gcc
+else
+ gcc=gcc
+fi
+
case "$plibpth" in
-'') plibpth=`gcc -print-search-dirs | grep libraries |
+'') plibpth=`LANG=C LC_ALL=C $gcc $ccflags $ldflags -print-search-dirs | grep libraries |
cut -f2- -d= | tr ':' $trnl | grep -v 'gcc' | sed -e 's:/$::'`
set X $plibpth # Collapse all entries on one line
shift
@@ -171,6 +178,49 @@ case "$plibpth" in
;;
esac
+# libquadmath is sometimes installed as gcc internal library,
+# so contrary to our usual policy of *not* looking at gcc internal
+# directories we now *do* look at them, in case they contain
+# the quadmath library.
+# XXX This may apply to other gcc internal libraries, if such exist.
+# XXX This could be at Configure level, but then the $gcc is messy.
+case "$usequadmath" in
+"$define")
+ for d in `LANG=C LC_ALL=C $gcc $ccflags $ldflags -print-search-dirs | grep libraries | cut -f2- -d= | tr ':' $trnl | grep 'gcc' | sed -e 's:/$::'`
+ do
+ case `ls $d/*libquadmath*$so* 2>/dev/null` in
+ $d/*libquadmath*$so*) xlibpth="$xlibpth $d" ;;
+ esac
+ done
+ ;;
+esac
+
+case "$libc" in
+'')
+# 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
+# gcc to load the library for all tests.)
+# We don't use __GLIBC__ and __GLIBC_MINOR__ because they
+# are insufficiently precise to distinguish things like
+# libc-2.0.6 and libc-2.0.7.
+ for p in $plibpth
+ do
+ for trylib in libc.so.6 libc.so
+ do
+ if $test -e $p/$trylib; then
+ libc=`ls -l $p/$trylib | awk '{print $NF}'`
+ if $test "X$libc" != X; then
+ break
+ fi
+ fi
+ done
+ if $test "X$libc" != X; then
+ break
+ fi
+ done
+ ;;
+esac
+
# Are we using ELF? Thanks to Kenneth Albanowski <kjahds@kjahds.com>
# for this test.
cat >try.c <<'EOM'
@@ -191,7 +241,7 @@ main() {
exit(0); /* succeed (yes, it's ELF) */
}
EOM
-if ${cc:-gcc} try.c >/dev/null 2>&1 && $run ./a.out; then
+if ${cc:-gcc} $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
cat <<'EOM' >&4
You appear to have ELF support. I'll try to use it for dynamic loading.
@@ -257,7 +307,7 @@ fi
rm -f try.c a.out
-if /bin/sh -c exit; then
+if ${sh:-/bin/sh} -c exit; then
echo ''
echo 'You appear to have a working bash. Good.'
else
@@ -324,7 +374,7 @@ fi
#'osfmach3ppc') ccdlflags='-Wl,-E' ;;
#esac
-case "`uname -m`" in
+case "$uname_minus_m" in
sparc*)
case "$cccdlflags" in
*-fpic*) cccdlflags="`echo $cccdlflags|sed 's/-fpic/-fPIC/'`" ;;
@@ -339,30 +389,62 @@ esac
# version of -lgdbm which is a bad idea. So if we have 'nm'
# make sure it can read the file
# NI-S 2003/08/07
-if [ -r /usr/lib/libndbm.so -a -x /usr/bin/nm ] ; then
- if /usr/bin/nm /usr/lib/libndbm.so >/dev/null 2>&1 ; then
- echo 'Your shared -lndbm seems to be a real library.'
- else
- echo 'Your shared -lndbm is not a real library.'
- set `echo X "$libswanted "| sed -e 's/ ndbm / /'`
- shift
- libswanted="$*"
- fi
-fi
+case "$nm" in
+ '') ;;
+ *)
+ for p in $plibpth
+ do
+ if $test -r $p/libndbm.so; then
+ if $nm $p/libndbm.so >/dev/null 2>&1 ; then
+ echo 'Your shared -lndbm seems to be a real library.'
+ _libndbm_real=1
+ break
+ fi
+ fi
+ done
+ if $test "X$_libndbm_real" = X; then
+ echo 'Your shared -lndbm is not a real library.'
+ set `echo X "$libswanted "| sed -e 's/ ndbm / /'`
+ shift
+ libswanted="$*"
+ fi
+ ;;
+esac
+# Linux on Synology.
+if [ -f /etc/synoinfo.conf -a -d /usr/syno ]; then
+ # Tested on Synology DS213 and DS413
+ # OS version info in /etc.defaults/VERSION
+ # http://forum.synology.com/wiki/index.php/What_kind_of_CPU_does_my_NAS_have
+ # Synology DS213 running DSM 4.3-3810-0 (2013-11-06)
+ # CPU model Marvell Kirkwood mv6282 ARMv5te
+ # Linux 2.6.32.12 #3810 Wed Nov 6 05:13:41 CST 2013 armv5tel GNU/Linux
+ # Synology DS413 running DSM 4.3-3810-0 (2013-11-06)
+ # CPU model Freescale QorIQ P1022 ppc (e500v2)
+ # linux 2.6.32.12 #3810 ppc GNU/Linux
+ # All development stuff installed with ipkg is in /opt
+ if [ "$LANG" = "" -o "$LANG" = "C" ]; then
+ echo 'Your LANG is safe'
+ else
+ echo 'Please set $LANG to "C". All other $LANG settings will cause havoc' >&4
+ LANG=C
+ fi
+ echo 'Setting up to use /opt/*' >&4
+ locincpth="/opt/include $locincpth"
+ libpth="/opt/lib $libpth"
+ libspth="/opt/lib $libspth"
+ loclibpth="/opt/lib $loclibpth"
+ # POSIX will not link without the pthread lib
+ libswanted="$libswanted pthread"
+ echo "$libswanted" >&4
+fi
# 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'
-if getconf GNU_LIBPTHREAD_VERSION | grep NPTL >/dev/null 2>/dev/null
-then
- threadshavepids=""
-else
- threadshavepids="-DTHREADS_HAVE_PIDS"
-fi
case "$usethreads" in
$define|true|[yY]*)
- ccflags="-D_REENTRANT -D_GNU_SOURCE $threadshavepids $ccflags"
+ ccflags="-D_REENTRANT -D_GNU_SOURCE $ccflags"
if echo $libswanted | grep -v pthread >/dev/null
then
set `echo X "$libswanted "| sed -e 's/ c / pthread c /'`
@@ -409,16 +491,6 @@ $define|true|[yY]*)
;;
esac
-# If we are using g++ we must use nm and force ourselves to use
-# the /usr/lib/libc.a (resetting the libc below to an empty string
-# makes Configure to look for the right one) because the symbol
-# scanning tricks of Configure will crash and burn horribly.
-case "$cc" in
-*g++*) usenm=true
- libc=''
- ;;
-esac
-
# If using g++, the Configure scan for dlopen() and (especially)
# dlerror() might fail, easier just to forcibly hint them in.
case "$cc" in
@@ -442,7 +514,7 @@ then
DBLIB="$DBDIR/libdb.so"
if [ -f $DBLIB ]
then
- if nm -u $DBLIB | grep pthread >/dev/null
+ if ${nm:-nm} -u $DBLIB 2>/dev/null | grep pthread >/dev/null
then
if ldd $DBLIB | grep pthread >/dev/null
then
diff --git a/hv.c b/hv.c
index 89c6456..8659678 100644
--- a/hv.c
+++ b/hv.c
@@ -35,7 +35,8 @@ holds the key and hash value.
#define PERL_HASH_INTERNAL_ACCESS
#include "perl.h"
-#define HV_MAX_LENGTH_BEFORE_SPLIT 14
+#define HV_MAX_LENGTH_BEFORE_REHASH 14
+#define SHOULD_DO_HSPLIT(xhv) ((xhv)->xhv_keys > (xhv)->xhv_max) /* HvTOTALKEYS(hv) > HvMAX(hv) */
static const char S_strtab_error[]
= "Cannot modify shared string table in hv_%s";
@@ -818,23 +819,8 @@ Perl_hv_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
xhv->xhv_keys++; /* HvTOTALKEYS(hv)++ */
if (!counter) { /* initial entry? */
xhv->xhv_fill++; /* HvFILL(hv)++ */
- } else if (xhv->xhv_keys > (IV)xhv->xhv_max) {
+ } else if ( SHOULD_DO_HSPLIT(xhv) ) {
hsplit(hv);
- } else if(!HvREHASH(hv)) {
- U32 n_links = 1;
-
- while ((counter = HeNEXT(counter)))
- n_links++;
-
- if (n_links > HV_MAX_LENGTH_BEFORE_SPLIT) {
- /* Use only the old HvKEYS(hv) > HvMAX(hv) condition to limit
- bucket splits on a rehashed hash, as we're not going to
- split it again, and if someone is lucky (evil) enough to
- get all the keys in one list they could exhaust our memory
- as we repeatedly double the number of buckets on every
- entry. Linear search feels a less worse thing to do. */
- hsplit(hv);
- }
}
}
@@ -1180,7 +1166,7 @@ S_hsplit(pTHX_ HV *hv)
/* Pick your policy for "hashing isn't working" here: */
- if (longest_chain <= HV_MAX_LENGTH_BEFORE_SPLIT /* split worked? */
+ if (longest_chain <= HV_MAX_LENGTH_BEFORE_REHASH /* split worked? */
|| HvREHASH(hv)) {
return;
}
@@ -2551,8 +2537,8 @@ S_share_hek_flags(pTHX_ const char *str, I32 len, register U32 hash, int flags)
xhv->xhv_keys++; /* HvTOTALKEYS(hv)++ */
if (!next) { /* initial entry? */
xhv->xhv_fill++; /* HvFILL(hv)++ */
- } else if (xhv->xhv_keys > (IV)xhv->xhv_max /* HvKEYS(hv) > HvMAX(hv) */) {
- hsplit(PL_strtab);
+ } else if ( SHOULD_DO_HSPLIT(xhv) ) {
+ hsplit(PL_strtab);
}
}
diff --git a/make_ext.pl b/make_ext.pl
index de26d84..52b0492 100644
--- a/make_ext.pl
+++ b/make_ext.pl
@@ -363,6 +363,10 @@ WriteMakefile(
EOM
close $fh or die "Can't close Makefile.PL: $!";
}
+ eval {
+ my $ftime = time - 4;
+ utime $ftime, $ftime, 'Makefile.PL';
+ };
print "\nRunning Makefile.PL in $ext_dir\n";
# Presumably this can be simplified
diff --git a/patchlevel.h b/patchlevel.h
index f1a12bd..61bf49d 100644
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -131,6 +131,7 @@ static const char * const local_patches[] = {
,"uncommitted-changes"
#endif
PERL_GIT_UNPUSHED_COMMITS /* do not remove this line */
+ ,"Devel::PatchPerl 1.32"
,NULL
};
diff --git a/t/op/hash.t b/t/op/hash.t
old mode 100755
new mode 100644
index 9bde518..45eb782
--- a/t/op/hash.t
+++ b/t/op/hash.t
@@ -39,22 +39,36 @@ use constant THRESHOLD => 14;
use constant START => "a";
# some initial hash data
-my %h2 = map {$_ => 1} 'a'..'cc';
+my %h2;
+my $counter= "a";
+$h2{$counter++}++ while $counter ne 'cd';
ok (!Internals::HvREHASH(%h2),
"starting with pre-populated non-pathological hash (rehash flag if off)");
my @keys = get_keys(\%h2);
+my $buckets= buckets(\%h2);
$h2{$_}++ for @keys;
+$h2{$counter++}++ while buckets(\%h2) == $buckets; # force a split
ok (Internals::HvREHASH(%h2),
- scalar(@keys) . " colliding into the same bucket keys are triggering rehash");
+ scalar(@keys) . " colliding into the same bucket keys are triggering rehash after split");
+
+# returns the number of buckets in a hash
+sub buckets {
+ my $hr = shift;
+ my $keys_buckets= scalar(%$hr);
+ if ($keys_buckets=~m!/([0-9]+)\z!) {
+ return 0+$1;
+ } else {
+ return 8;
+ }
+}
sub get_keys {
my $hr = shift;
# the minimum of bits required to mount the attack on a hash
my $min_bits = log(THRESHOLD)/log(2);
-
# if the hash has already been populated with a significant amount
# of entries the number of mask bits can be higher
my $keys = scalar keys %$hr;
--
1.9.1

View file

@ -0,0 +1,29 @@
FROM buildpack-deps
MAINTAINER Peter Martini <PeterCMartini@GMail.com>
RUN apt-get update \
&& apt-get install -y curl procps \
&& rm -fr /var/lib/apt/lists/*
RUN mkdir /usr/src/perl
COPY DevelPatchPerl.patch /usr/src/perl/
WORKDIR /usr/src/perl
RUN curl -SL https://cpan.metacpan.org/authors/id/D/DO/DOM/perl-5.12.5.tar.bz2 -o perl-5.12.5.tar.bz2 \
&& echo '812139ceef512eb8458af29ffbf46d78ef26c12a *perl-5.12.5.tar.bz2' | sha1sum -c - \
&& tar --strip-components=1 -xjf perl-5.12.5.tar.bz2 -C /usr/src/perl \
&& rm perl-5.12.5.tar.bz2 \
&& cat DevelPatchPerl.patch | patch -p1 \
&& ./Configure -Dusethreads -Duse64bitall -A ccflags=-fwrapv -des \
&& make -j$(nproc) \
&& make test_harness \
&& make install \
&& cd /usr/src \
&& curl -LO https://raw.githubusercontent.com/miyagawa/cpanminus/master/cpanm \
&& chmod +x cpanm \
&& ./cpanm App::cpanminus \
&& rm -fr ./cpanm /root/.cpanm /usr/src/perl
WORKDIR /root
CMD ["perl5.12.5","-de0"]

View file

@ -0,0 +1,511 @@
From 145264f14350f778df5efed47ec74d463ad8c941 Mon Sep 17 00:00:00 2001
From: Peter Martini <PeterCMartini@GMail.com>
Date: Wed, 15 Apr 2015 22:36:04 -0400
Subject: [PATCH] tmp
---
cpan/Archive-Tar/t/02_methods.t | 14 +++
ext/Hash-Util-FieldHash/t/10_hash.t | 18 +++-
ext/ODBM_File/hints/linux.pl | 6 +-
hints/linux.sh | 166 ++++++++++++++++++++++++++----------
hv.c | 26 ++----
make_ext.pl | 4 +
patchlevel.h | 1 +
t/op/hash.t | 20 ++++-
8 files changed, 180 insertions(+), 75 deletions(-)
mode change 100755 => 100644 t/op/hash.t
diff --git a/cpan/Archive-Tar/t/02_methods.t b/cpan/Archive-Tar/t/02_methods.t
index e400dda..e25e31a 100755
--- a/cpan/Archive-Tar/t/02_methods.t
+++ b/cpan/Archive-Tar/t/02_methods.t
@@ -70,6 +70,20 @@ my $LONG_FILE = qq[directory/really-really-really-really-really-really-really-re
my $TOO_LONG = ($^O eq 'MSWin32' or $^O eq 'cygwin' or $^O eq 'VMS')
&& length( cwd(). $LONG_FILE ) > 247;
+if(!$TOO_LONG) {
+ my $alt = File::Spec->catfile( cwd(), $LONG_FILE);
+ eval 'mkpath([$alt]);';
+ if($@)
+ {
+ $TOO_LONG = 1;
+ }
+ else
+ {
+ $@ = '';
+ my $base = File::Spec->catfile( cwd(), 'directory');
+ rmtree $base;
+ }
+}
### warn if we are going to skip long file names
if ($TOO_LONG) {
diag("No long filename support - long filename extraction disabled") if ! $ENV{PERL_CORE};
diff --git a/ext/Hash-Util-FieldHash/t/10_hash.t b/ext/Hash-Util-FieldHash/t/10_hash.t
index 2cfb4e8..d58f053 100755
--- a/ext/Hash-Util-FieldHash/t/10_hash.t
+++ b/ext/Hash-Util-FieldHash/t/10_hash.t
@@ -38,15 +38,29 @@ use constant START => "a";
# some initial hash data
fieldhash my %h2;
-%h2 = map {$_ => 1} 'a'..'cc';
+my $counter= "a";
+$h2{$counter++}++ while $counter ne 'cd';
ok (!Internals::HvREHASH(%h2),
"starting with pre-populated non-pathological hash (rehash flag if off)");
my @keys = get_keys(\%h2);
+my $buckets= buckets(\%h2);
$h2{$_}++ for @keys;
+$h2{$counter++}++ while buckets(\%h2) == $buckets; # force a split
ok (Internals::HvREHASH(%h2),
- scalar(@keys) . " colliding into the same bucket keys are triggering rehash");
+ scalar(@keys) . " colliding into the same bucket keys are triggering rehash after split");
+
+# returns the number of buckets in a hash
+sub buckets {
+ my $hr = shift;
+ my $keys_buckets= scalar(%$hr);
+ if ($keys_buckets=~m!/([0-9]+)\z!) {
+ return 0+$1;
+ } else {
+ return 8;
+ }
+}
sub get_keys {
my $hr = shift;
diff --git a/ext/ODBM_File/hints/linux.pl b/ext/ODBM_File/hints/linux.pl
index f8ca492..204bba0 100644
--- a/ext/ODBM_File/hints/linux.pl
+++ b/ext/ODBM_File/hints/linux.pl
@@ -1,8 +1,8 @@
# uses GDBM dbm compatibility feature - at least on SuSE 8.0
$self->{LIBS} = ['-lgdbm'];
-# Debian/Ubuntu have /usr/lib/libgdbm_compat.so.3* but not this file,
+# Debian/Ubuntu have libgdbm_compat.so but not this file,
# so linking may fail
-if (-e '/usr/lib/libgdbm_compat.so' or -e '/usr/lib64/libgdbm_compat.so') {
- $self->{LIBS}->[0] .= ' -lgdbm_compat';
+foreach (split / /, $Config{libpth}) {
+ $self->{LIBS}->[0] .= ' -lgdbm_compat' if -e $_.'/libgdbm_compat.so';
}
diff --git a/hints/linux.sh b/hints/linux.sh
index 0519eca..fb5a46e 100644
--- a/hints/linux.sh
+++ b/hints/linux.sh
@@ -13,11 +13,14 @@
# Updated Thu May 30 10:50:22 EDT 1996 by <doughera@lafayette.edu>
# Updated Fri Jun 21 11:07:54 EDT 1996
-# NDBM support for ELF renabled by <kjahds@kjahds.com>
+# NDBM support for ELF re-enabled by <kjahds@kjahds.com>
# No version of Linux supports setuid scripts.
d_suidsafe='undef'
+# No version of Linux needs libutil for perl.
+i_libutil='undef'
+
# Debian and Red Hat, and perhaps other vendors, provide both runtime and
# development packages for some libraries. The runtime packages contain shared
# libraries with version information in their names (e.g., libgdbm.so.1.7.3);
@@ -36,7 +39,7 @@ d_suidsafe='undef'
# SuSE Linux can be used as cross-compilation host for Cray XT4 Catamount/Qk.
if test -d /opt/xt-pe
then
- case "`cc -V 2>&1`" in
+ case "`${cc:-cc} -V 2>&1`" in
*catamount*) . hints/catamount.sh; return ;;
esac
fi
@@ -55,17 +58,10 @@ shift
libswanted="$*"
# Debian 4.0 puts ndbm in the -lgdbm_compat library.
-libswanted="$libswanted gdbm_compat"
-
-# 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
-# gcc to load the library for all tests.)
-# We don't use __GLIBC__ and __GLIBC_MINOR__ because they
-# are insufficiently precise to distinguish things like
-# libc-2.0.6 and libc-2.0.7.
-if test -L /lib/libc.so.6; then
- libc=`ls -l /lib/libc.so.6 | awk '{print $NF}'`
- libc=/lib/$libc
+echo $libs
+if echo " $libswanted " | grep -q ' gdbm '; then
+ # Only add if gdbm is in libswanted.
+ libswanted="$libswanted gdbm_compat"
fi
# Configure may fail to find lstat() since it's a static/inline
@@ -84,6 +80,9 @@ case "$usemymalloc" in
'') usemymalloc='n' ;;
esac
+uname_minus_m="`$run uname -m 2>/dev/null`"
+uname_minus_m="${uname_minus_m:-"$targetarch"}"
+
# Check if we're about to use Intel's ICC compiler
case "`${cc:-cc} -V 2>&1`" in
*"Intel(R) C++ Compiler"*|*"Intel(R) C Compiler"*)
@@ -97,7 +96,7 @@ case "`${cc:-cc} -V 2>&1`" in
# The -no-gcc flag is needed otherwise, icc pretends (poorly) to be gcc
ccflags="-we147 -mp -no-gcc $ccflags"
# Prevent relocation errors on 64bits arch
- case "`uname -m`" in
+ case "$uname_minus_m" in
*ia64*|*x86_64*)
cccdlflags='-fPIC'
;;
@@ -131,7 +130,7 @@ case "$optimize" in
# use -O2 by default ; -O3 doesn't seem to bring significant benefits with gcc
'')
optimize='-O2'
- case "`uname -m`" in
+ case "$uname_minus_m" in
ppc*)
# on ppc, it seems that gcc (at least gcc 3.3.2) isn't happy
# with -O2 ; so downgrade to -O1.
@@ -160,10 +159,18 @@ esac
# This unconditionally uses gcc because even if the user is using another
# compiler, we still need to find the math library and friends, and I don't
# know how other compilers will cope with that situation.
+# Morever, if the user has their own gcc earlier in $PATH than the system gcc,
+# we don't want its libraries. So we try to prefer the system gcc
# Still, as an escape hatch, allow Configure command line overrides to
# plibpth to bypass this check.
+if [ -x /usr/bin/gcc ] ; then
+ gcc=/usr/bin/gcc
+else
+ gcc=gcc
+fi
+
case "$plibpth" in
-'') plibpth=`gcc -print-search-dirs | grep libraries |
+'') plibpth=`LANG=C LC_ALL=C $gcc $ccflags $ldflags -print-search-dirs | grep libraries |
cut -f2- -d= | tr ':' $trnl | grep -v 'gcc' | sed -e 's:/$::'`
set X $plibpth # Collapse all entries on one line
shift
@@ -171,6 +178,49 @@ case "$plibpth" in
;;
esac
+# libquadmath is sometimes installed as gcc internal library,
+# so contrary to our usual policy of *not* looking at gcc internal
+# directories we now *do* look at them, in case they contain
+# the quadmath library.
+# XXX This may apply to other gcc internal libraries, if such exist.
+# XXX This could be at Configure level, but then the $gcc is messy.
+case "$usequadmath" in
+"$define")
+ for d in `LANG=C LC_ALL=C $gcc $ccflags $ldflags -print-search-dirs | grep libraries | cut -f2- -d= | tr ':' $trnl | grep 'gcc' | sed -e 's:/$::'`
+ do
+ case `ls $d/*libquadmath*$so* 2>/dev/null` in
+ $d/*libquadmath*$so*) xlibpth="$xlibpth $d" ;;
+ esac
+ done
+ ;;
+esac
+
+case "$libc" in
+'')
+# 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
+# gcc to load the library for all tests.)
+# We don't use __GLIBC__ and __GLIBC_MINOR__ because they
+# are insufficiently precise to distinguish things like
+# libc-2.0.6 and libc-2.0.7.
+ for p in $plibpth
+ do
+ for trylib in libc.so.6 libc.so
+ do
+ if $test -e $p/$trylib; then
+ libc=`ls -l $p/$trylib | awk '{print $NF}'`
+ if $test "X$libc" != X; then
+ break
+ fi
+ fi
+ done
+ if $test "X$libc" != X; then
+ break
+ fi
+ done
+ ;;
+esac
+
# Are we using ELF? Thanks to Kenneth Albanowski <kjahds@kjahds.com>
# for this test.
cat >try.c <<'EOM'
@@ -191,7 +241,7 @@ main() {
exit(0); /* succeed (yes, it's ELF) */
}
EOM
-if ${cc:-gcc} try.c >/dev/null 2>&1 && $run ./a.out; then
+if ${cc:-gcc} $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
cat <<'EOM' >&4
You appear to have ELF support. I'll try to use it for dynamic loading.
@@ -257,7 +307,7 @@ fi
rm -f try.c a.out
-if /bin/sh -c exit; then
+if ${sh:-/bin/sh} -c exit; then
echo ''
echo 'You appear to have a working bash. Good.'
else
@@ -324,7 +374,7 @@ fi
#'osfmach3ppc') ccdlflags='-Wl,-E' ;;
#esac
-case "`uname -m`" in
+case "$uname_minus_m" in
sparc*)
case "$cccdlflags" in
*-fpic*) cccdlflags="`echo $cccdlflags|sed 's/-fpic/-fPIC/'`" ;;
@@ -339,30 +389,62 @@ esac
# version of -lgdbm which is a bad idea. So if we have 'nm'
# make sure it can read the file
# NI-S 2003/08/07
-if [ -r /usr/lib/libndbm.so -a -x /usr/bin/nm ] ; then
- if /usr/bin/nm /usr/lib/libndbm.so >/dev/null 2>&1 ; then
- echo 'Your shared -lndbm seems to be a real library.'
- else
- echo 'Your shared -lndbm is not a real library.'
- set `echo X "$libswanted "| sed -e 's/ ndbm / /'`
- shift
- libswanted="$*"
- fi
-fi
+case "$nm" in
+ '') ;;
+ *)
+ for p in $plibpth
+ do
+ if $test -r $p/libndbm.so; then
+ if $nm $p/libndbm.so >/dev/null 2>&1 ; then
+ echo 'Your shared -lndbm seems to be a real library.'
+ _libndbm_real=1
+ break
+ fi
+ fi
+ done
+ if $test "X$_libndbm_real" = X; then
+ echo 'Your shared -lndbm is not a real library.'
+ set `echo X "$libswanted "| sed -e 's/ ndbm / /'`
+ shift
+ libswanted="$*"
+ fi
+ ;;
+esac
+# Linux on Synology.
+if [ -f /etc/synoinfo.conf -a -d /usr/syno ]; then
+ # Tested on Synology DS213 and DS413
+ # OS version info in /etc.defaults/VERSION
+ # http://forum.synology.com/wiki/index.php/What_kind_of_CPU_does_my_NAS_have
+ # Synology DS213 running DSM 4.3-3810-0 (2013-11-06)
+ # CPU model Marvell Kirkwood mv6282 ARMv5te
+ # Linux 2.6.32.12 #3810 Wed Nov 6 05:13:41 CST 2013 armv5tel GNU/Linux
+ # Synology DS413 running DSM 4.3-3810-0 (2013-11-06)
+ # CPU model Freescale QorIQ P1022 ppc (e500v2)
+ # linux 2.6.32.12 #3810 ppc GNU/Linux
+ # All development stuff installed with ipkg is in /opt
+ if [ "$LANG" = "" -o "$LANG" = "C" ]; then
+ echo 'Your LANG is safe'
+ else
+ echo 'Please set $LANG to "C". All other $LANG settings will cause havoc' >&4
+ LANG=C
+ fi
+ echo 'Setting up to use /opt/*' >&4
+ locincpth="/opt/include $locincpth"
+ libpth="/opt/lib $libpth"
+ libspth="/opt/lib $libspth"
+ loclibpth="/opt/lib $loclibpth"
+ # POSIX will not link without the pthread lib
+ libswanted="$libswanted pthread"
+ echo "$libswanted" >&4
+fi
# 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'
-if getconf GNU_LIBPTHREAD_VERSION | grep NPTL >/dev/null 2>/dev/null
-then
- threadshavepids=""
-else
- threadshavepids="-DTHREADS_HAVE_PIDS"
-fi
case "$usethreads" in
$define|true|[yY]*)
- ccflags="-D_REENTRANT -D_GNU_SOURCE $threadshavepids $ccflags"
+ ccflags="-D_REENTRANT -D_GNU_SOURCE $ccflags"
if echo $libswanted | grep -v pthread >/dev/null
then
set `echo X "$libswanted "| sed -e 's/ c / pthread c /'`
@@ -409,16 +491,6 @@ $define|true|[yY]*)
;;
esac
-# If we are using g++ we must use nm and force ourselves to use
-# the /usr/lib/libc.a (resetting the libc below to an empty string
-# makes Configure to look for the right one) because the symbol
-# scanning tricks of Configure will crash and burn horribly.
-case "$cc" in
-*g++*) usenm=true
- libc=''
- ;;
-esac
-
# If using g++, the Configure scan for dlopen() and (especially)
# dlerror() might fail, easier just to forcibly hint them in.
case "$cc" in
@@ -442,7 +514,7 @@ then
DBLIB="$DBDIR/libdb.so"
if [ -f $DBLIB ]
then
- if nm -u $DBLIB | grep pthread >/dev/null
+ if ${nm:-nm} -u $DBLIB 2>/dev/null | grep pthread >/dev/null
then
if ldd $DBLIB | grep pthread >/dev/null
then
diff --git a/hv.c b/hv.c
index 89c6456..8659678 100644
--- a/hv.c
+++ b/hv.c
@@ -35,7 +35,8 @@ holds the key and hash value.
#define PERL_HASH_INTERNAL_ACCESS
#include "perl.h"
-#define HV_MAX_LENGTH_BEFORE_SPLIT 14
+#define HV_MAX_LENGTH_BEFORE_REHASH 14
+#define SHOULD_DO_HSPLIT(xhv) ((xhv)->xhv_keys > (xhv)->xhv_max) /* HvTOTALKEYS(hv) > HvMAX(hv) */
static const char S_strtab_error[]
= "Cannot modify shared string table in hv_%s";
@@ -818,23 +819,8 @@ Perl_hv_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
xhv->xhv_keys++; /* HvTOTALKEYS(hv)++ */
if (!counter) { /* initial entry? */
xhv->xhv_fill++; /* HvFILL(hv)++ */
- } else if (xhv->xhv_keys > (IV)xhv->xhv_max) {
+ } else if ( SHOULD_DO_HSPLIT(xhv) ) {
hsplit(hv);
- } else if(!HvREHASH(hv)) {
- U32 n_links = 1;
-
- while ((counter = HeNEXT(counter)))
- n_links++;
-
- if (n_links > HV_MAX_LENGTH_BEFORE_SPLIT) {
- /* Use only the old HvKEYS(hv) > HvMAX(hv) condition to limit
- bucket splits on a rehashed hash, as we're not going to
- split it again, and if someone is lucky (evil) enough to
- get all the keys in one list they could exhaust our memory
- as we repeatedly double the number of buckets on every
- entry. Linear search feels a less worse thing to do. */
- hsplit(hv);
- }
}
}
@@ -1180,7 +1166,7 @@ S_hsplit(pTHX_ HV *hv)
/* Pick your policy for "hashing isn't working" here: */
- if (longest_chain <= HV_MAX_LENGTH_BEFORE_SPLIT /* split worked? */
+ if (longest_chain <= HV_MAX_LENGTH_BEFORE_REHASH /* split worked? */
|| HvREHASH(hv)) {
return;
}
@@ -2551,8 +2537,8 @@ S_share_hek_flags(pTHX_ const char *str, I32 len, register U32 hash, int flags)
xhv->xhv_keys++; /* HvTOTALKEYS(hv)++ */
if (!next) { /* initial entry? */
xhv->xhv_fill++; /* HvFILL(hv)++ */
- } else if (xhv->xhv_keys > (IV)xhv->xhv_max /* HvKEYS(hv) > HvMAX(hv) */) {
- hsplit(PL_strtab);
+ } else if ( SHOULD_DO_HSPLIT(xhv) ) {
+ hsplit(PL_strtab);
}
}
diff --git a/make_ext.pl b/make_ext.pl
index de26d84..52b0492 100644
--- a/make_ext.pl
+++ b/make_ext.pl
@@ -363,6 +363,10 @@ WriteMakefile(
EOM
close $fh or die "Can't close Makefile.PL: $!";
}
+ eval {
+ my $ftime = time - 4;
+ utime $ftime, $ftime, 'Makefile.PL';
+ };
print "\nRunning Makefile.PL in $ext_dir\n";
# Presumably this can be simplified
diff --git a/patchlevel.h b/patchlevel.h
index f1a12bd..61bf49d 100644
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -131,6 +131,7 @@ static const char * const local_patches[] = {
,"uncommitted-changes"
#endif
PERL_GIT_UNPUSHED_COMMITS /* do not remove this line */
+ ,"Devel::PatchPerl 1.32"
,NULL
};
diff --git a/t/op/hash.t b/t/op/hash.t
old mode 100755
new mode 100644
index 9bde518..45eb782
--- a/t/op/hash.t
+++ b/t/op/hash.t
@@ -39,22 +39,36 @@ use constant THRESHOLD => 14;
use constant START => "a";
# some initial hash data
-my %h2 = map {$_ => 1} 'a'..'cc';
+my %h2;
+my $counter= "a";
+$h2{$counter++}++ while $counter ne 'cd';
ok (!Internals::HvREHASH(%h2),
"starting with pre-populated non-pathological hash (rehash flag if off)");
my @keys = get_keys(\%h2);
+my $buckets= buckets(\%h2);
$h2{$_}++ for @keys;
+$h2{$counter++}++ while buckets(\%h2) == $buckets; # force a split
ok (Internals::HvREHASH(%h2),
- scalar(@keys) . " colliding into the same bucket keys are triggering rehash");
+ scalar(@keys) . " colliding into the same bucket keys are triggering rehash after split");
+
+# returns the number of buckets in a hash
+sub buckets {
+ my $hr = shift;
+ my $keys_buckets= scalar(%$hr);
+ if ($keys_buckets=~m!/([0-9]+)\z!) {
+ return 0+$1;
+ } else {
+ return 8;
+ }
+}
sub get_keys {
my $hr = shift;
# the minimum of bits required to mount the attack on a hash
my $min_bits = log(THRESHOLD)/log(2);
-
# if the hash has already been populated with a significant amount
# of entries the number of mask bits can be higher
my $keys = scalar keys %$hr;
--
1.9.1

View file

@ -0,0 +1,29 @@
FROM buildpack-deps
MAINTAINER Peter Martini <PeterCMartini@GMail.com>
RUN apt-get update \
&& apt-get install -y curl procps \
&& rm -fr /var/lib/apt/lists/*
RUN mkdir /usr/src/perl
COPY DevelPatchPerl.patch /usr/src/perl/
WORKDIR /usr/src/perl
RUN curl -SL https://cpan.metacpan.org/authors/id/D/DO/DOM/perl-5.12.5.tar.bz2 -o perl-5.12.5.tar.bz2 \
&& echo '812139ceef512eb8458af29ffbf46d78ef26c12a *perl-5.12.5.tar.bz2' | sha1sum -c - \
&& tar --strip-components=1 -xjf perl-5.12.5.tar.bz2 -C /usr/src/perl \
&& rm perl-5.12.5.tar.bz2 \
&& cat DevelPatchPerl.patch | patch -p1 \
&& ./Configure -Duse64bitall -A ccflags=-fwrapv -des \
&& make -j$(nproc) \
&& make test_harness \
&& make install \
&& cd /usr/src \
&& curl -LO https://raw.githubusercontent.com/miyagawa/cpanminus/master/cpanm \
&& chmod +x cpanm \
&& ./cpanm App::cpanminus \
&& rm -fr ./cpanm /root/.cpanm /usr/src/perl
WORKDIR /root
CMD ["perl5.12.5","-de0"]

View file

@ -0,0 +1,277 @@
diff --git a/hints/linux.sh b/hints/linux.sh
index d0ac9fa..956adfc 100644
--- a/hints/linux.sh
+++ b/hints/linux.sh
@@ -39,7 +39,7 @@ i_libutil='undef'
# SuSE Linux can be used as cross-compilation host for Cray XT4 Catamount/Qk.
if test -d /opt/xt-pe
then
- case "`cc -V 2>&1`" in
+ case "`${cc:-cc} -V 2>&1`" in
*catamount*) . hints/catamount.sh; return ;;
esac
fi
@@ -58,17 +58,10 @@ shift
libswanted="$*"
# Debian 4.0 puts ndbm in the -lgdbm_compat library.
-libswanted="$libswanted gdbm_compat"
-
-# 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
-# gcc to load the library for all tests.)
-# We don't use __GLIBC__ and __GLIBC_MINOR__ because they
-# are insufficiently precise to distinguish things like
-# libc-2.0.6 and libc-2.0.7.
-if test -L /lib/libc.so.6; then
- libc=`ls -l /lib/libc.so.6 | awk '{print $NF}'`
- libc=/lib/$libc
+echo $libs
+if echo " $libswanted " | grep -q ' gdbm '; then
+ # Only add if gdbm is in libswanted.
+ libswanted="$libswanted gdbm_compat"
fi
# Configure may fail to find lstat() since it's a static/inline
@@ -87,6 +80,9 @@ case "$usemymalloc" in
'') usemymalloc='n' ;;
esac
+uname_minus_m="`$run uname -m 2>/dev/null`"
+uname_minus_m="${uname_minus_m:-"$targetarch"}"
+
# Check if we're about to use Intel's ICC compiler
case "`${cc:-cc} -V 2>&1`" in
*"Intel(R) C++ Compiler"*|*"Intel(R) C Compiler"*)
@@ -100,7 +96,7 @@ case "`${cc:-cc} -V 2>&1`" in
# The -no-gcc flag is needed otherwise, icc pretends (poorly) to be gcc
ccflags="-we147 -mp -no-gcc $ccflags"
# Prevent relocation errors on 64bits arch
- case "`uname -m`" in
+ case "$uname_minus_m" in
*ia64*|*x86_64*)
cccdlflags='-fPIC'
;;
@@ -134,7 +130,7 @@ case "$optimize" in
# use -O2 by default ; -O3 doesn't seem to bring significant benefits with gcc
'')
optimize='-O2'
- case "`uname -m`" in
+ case "$uname_minus_m" in
ppc*)
# on ppc, it seems that gcc (at least gcc 3.3.2) isn't happy
# with -O2 ; so downgrade to -O1.
@@ -174,7 +170,7 @@ else
fi
case "$plibpth" in
-'') plibpth=`$gcc -print-search-dirs | grep libraries |
+'') plibpth=`LANG=C LC_ALL=C $gcc $ccflags $ldflags -print-search-dirs | grep libraries |
cut -f2- -d= | tr ':' $trnl | grep -v 'gcc' | sed -e 's:/$::'`
set X $plibpth # Collapse all entries on one line
shift
@@ -182,6 +178,32 @@ case "$plibpth" in
;;
esac
+case "$libc" in
+'')
+# 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
+# gcc to load the library for all tests.)
+# We don't use __GLIBC__ and __GLIBC_MINOR__ because they
+# are insufficiently precise to distinguish things like
+# libc-2.0.6 and libc-2.0.7.
+ for p in $plibpth
+ do
+ for trylib in libc.so.6 libc.so
+ do
+ if $test -e $p/$trylib; then
+ libc=`ls -l $p/$trylib | awk '{print $NF}'`
+ if $test "X$libc" != X; then
+ break
+ fi
+ fi
+ done
+ if $test "X$libc" != X; then
+ break
+ fi
+ done
+ ;;
+esac
+
# Are we using ELF? Thanks to Kenneth Albanowski <kjahds@kjahds.com>
# for this test.
cat >try.c <<'EOM'
@@ -202,7 +224,7 @@ main() {
exit(0); /* succeed (yes, it's ELF) */
}
EOM
-if ${cc:-gcc} try.c >/dev/null 2>&1 && $run ./a.out; then
+if ${cc:-gcc} $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
cat <<'EOM' >&4
You appear to have ELF support. I'll try to use it for dynamic loading.
@@ -268,7 +290,7 @@ fi
rm -f try.c a.out
-if /bin/sh -c exit; then
+if ${sh:-/bin/sh} -c exit; then
echo ''
echo 'You appear to have a working bash. Good.'
else
@@ -335,7 +357,7 @@ fi
#'osfmach3ppc') ccdlflags='-Wl,-E' ;;
#esac
-case "`uname -m`" in
+case "$uname_minus_m" in
sparc*)
case "$cccdlflags" in
*-fpic*) cccdlflags="`echo $cccdlflags|sed 's/-fpic/-fPIC/'`" ;;
@@ -350,30 +372,62 @@ esac
# version of -lgdbm which is a bad idea. So if we have 'nm'
# make sure it can read the file
# NI-S 2003/08/07
-if [ -r /usr/lib/libndbm.so -a -x /usr/bin/nm ] ; then
- if /usr/bin/nm /usr/lib/libndbm.so >/dev/null 2>&1 ; then
- echo 'Your shared -lndbm seems to be a real library.'
- else
- echo 'Your shared -lndbm is not a real library.'
- set `echo X "$libswanted "| sed -e 's/ ndbm / /'`
- shift
- libswanted="$*"
- fi
-fi
+case "$nm" in
+ '') ;;
+ *)
+ for p in $plibpth
+ do
+ if $test -r $p/libndbm.so; then
+ if $nm $p/libndbm.so >/dev/null 2>&1 ; then
+ echo 'Your shared -lndbm seems to be a real library.'
+ _libndbm_real=1
+ break
+ fi
+ fi
+ done
+ if $test "X$_libndbm_real" = X; then
+ echo 'Your shared -lndbm is not a real library.'
+ set `echo X "$libswanted "| sed -e 's/ ndbm / /'`
+ shift
+ libswanted="$*"
+ fi
+ ;;
+esac
+# Linux on Synology.
+if [ -f /etc/synoinfo.conf -a -d /usr/syno ]; then
+ # Tested on Synology DS213 and DS413
+ # OS version info in /etc.defaults/VERSION
+ # http://forum.synology.com/wiki/index.php/What_kind_of_CPU_does_my_NAS_have
+ # Synology DS213 running DSM 4.3-3810-0 (2013-11-06)
+ # CPU model Marvell Kirkwood mv6282 ARMv5te
+ # Linux 2.6.32.12 #3810 Wed Nov 6 05:13:41 CST 2013 armv5tel GNU/Linux
+ # Synology DS413 running DSM 4.3-3810-0 (2013-11-06)
+ # CPU model Freescale QorIQ P1022 ppc (e500v2)
+ # linux 2.6.32.12 #3810 ppc GNU/Linux
+ # All development stuff installed with ipkg is in /opt
+ if [ "$LANG" = "" -o "$LANG" = "C" ]; then
+ echo 'Your LANG is safe'
+ else
+ echo 'Please set $LANG to "C". All other $LANG settings will cause havoc' >&4
+ LANG=C
+ fi
+ echo 'Setting up to use /opt/*' >&4
+ locincpth="/opt/include $locincpth"
+ libpth="/opt/lib $libpth"
+ libspth="/opt/lib $libspth"
+ loclibpth="/opt/lib $loclibpth"
+ # POSIX will not link without the pthread lib
+ libswanted="$libswanted pthread"
+ echo "$libswanted" >&4
+fi
# 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'
-if getconf GNU_LIBPTHREAD_VERSION | grep NPTL >/dev/null 2>/dev/null
-then
- threadshavepids=""
-else
- threadshavepids="-DTHREADS_HAVE_PIDS"
-fi
case "$usethreads" in
$define|true|[yY]*)
- ccflags="-D_REENTRANT -D_GNU_SOURCE $threadshavepids $ccflags"
+ ccflags="-D_REENTRANT -D_GNU_SOURCE $ccflags"
if echo $libswanted | grep -v pthread >/dev/null
then
set `echo X "$libswanted "| sed -e 's/ c / pthread c /'`
@@ -420,16 +474,6 @@ $define|true|[yY]*)
;;
esac
-# If we are using g++ we must use nm and force ourselves to use
-# the /usr/lib/libc.a (resetting the libc below to an empty string
-# makes Configure to look for the right one) because the symbol
-# scanning tricks of Configure will crash and burn horribly.
-case "$cc" in
-*g++*) usenm=true
- libc=''
- ;;
-esac
-
# If using g++, the Configure scan for dlopen() and (especially)
# dlerror() might fail, easier just to forcibly hint them in.
case "$cc" in
@@ -453,7 +497,7 @@ then
DBLIB="$DBDIR/libdb.so"
if [ -f $DBLIB ]
then
- if nm -u $DBLIB | grep pthread >/dev/null
+ if ${nm:-nm} -u $DBLIB | grep pthread >/dev/null
then
if ldd $DBLIB | grep pthread >/dev/null
then
diff --git a/make_ext.pl b/make_ext.pl
index 13a15b4..a564bb3 100644
--- a/make_ext.pl
+++ b/make_ext.pl
@@ -377,6 +377,10 @@ WriteMakefile(
EOM
close $fh or die "Can't close Makefile.PL: $!";
}
+ eval {
+ my $ftime = time - 4;
+ utime $ftime, $ftime, 'Makefile.PL';
+ };
print "\nRunning Makefile.PL in $ext_dir\n";
# Presumably this can be simplified
diff --git a/Configure b/Configure
index a780b81..3ae16ca 100755
--- a/Configure
+++ b/Configure
@@ -21633,15 +21633,16 @@ $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $r
EOSH
chmod +x Cppsym.try
$eunicefix Cppsym.try
-./Cppsym < Cppsym.know > Cppsym.true
+./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
: Add in any linux cpp "predefined macros":
case "$osname::$gccversion" in
*linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
tHdrH=_tmpHdr
rm -f $tHdrH'.h' $tHdrH
touch $tHdrH'.h'
+ # Filter out macro arguments, such as Linux's __INT8_C(c)
if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
- sed 's/#define[\ \ ]*//;s/[\ \ ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
+ sed -e 's/#define[\ \ ]*//;s/[\ \ ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
if [ -s $tHdrH'_cppsym.real' ]; then
cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
fi

View file

@ -0,0 +1,29 @@
FROM buildpack-deps
MAINTAINER Peter Martini <PeterCMartini@GMail.com>
RUN apt-get update \
&& apt-get install -y curl procps \
&& rm -fr /var/lib/apt/lists/*
RUN mkdir /usr/src/perl
COPY DevelPatchPerl.patch /usr/src/perl/
WORKDIR /usr/src/perl
RUN curl -SL https://cpan.metacpan.org/authors/id/D/DA/DAPM/perl-5.14.4.tar.bz2 -o perl-5.14.4.tar.bz2 \
&& echo '3527c9e26f985cba98796439bf555fde8be73cdf *perl-5.14.4.tar.bz2' | sha1sum -c - \
&& tar --strip-components=1 -xjf perl-5.14.4.tar.bz2 -C /usr/src/perl \
&& rm perl-5.14.4.tar.bz2 \
&& cat DevelPatchPerl.patch | patch -p1 \
&& ./Configure -Dusethreads -Duse64bitall -A ccflags=-fwrapv -des \
&& make -j$(nproc) \
&& make test_harness \
&& make install \
&& cd /usr/src \
&& curl -LO https://raw.githubusercontent.com/miyagawa/cpanminus/master/cpanm \
&& chmod +x cpanm \
&& ./cpanm App::cpanminus \
&& rm -fr ./cpanm /root/.cpanm /usr/src/perl
WORKDIR /root
CMD ["perl5.14.4","-de0"]

View file

@ -0,0 +1,277 @@
diff --git a/hints/linux.sh b/hints/linux.sh
index d0ac9fa..956adfc 100644
--- a/hints/linux.sh
+++ b/hints/linux.sh
@@ -39,7 +39,7 @@ i_libutil='undef'
# SuSE Linux can be used as cross-compilation host for Cray XT4 Catamount/Qk.
if test -d /opt/xt-pe
then
- case "`cc -V 2>&1`" in
+ case "`${cc:-cc} -V 2>&1`" in
*catamount*) . hints/catamount.sh; return ;;
esac
fi
@@ -58,17 +58,10 @@ shift
libswanted="$*"
# Debian 4.0 puts ndbm in the -lgdbm_compat library.
-libswanted="$libswanted gdbm_compat"
-
-# 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
-# gcc to load the library for all tests.)
-# We don't use __GLIBC__ and __GLIBC_MINOR__ because they
-# are insufficiently precise to distinguish things like
-# libc-2.0.6 and libc-2.0.7.
-if test -L /lib/libc.so.6; then
- libc=`ls -l /lib/libc.so.6 | awk '{print $NF}'`
- libc=/lib/$libc
+echo $libs
+if echo " $libswanted " | grep -q ' gdbm '; then
+ # Only add if gdbm is in libswanted.
+ libswanted="$libswanted gdbm_compat"
fi
# Configure may fail to find lstat() since it's a static/inline
@@ -87,6 +80,9 @@ case "$usemymalloc" in
'') usemymalloc='n' ;;
esac
+uname_minus_m="`$run uname -m 2>/dev/null`"
+uname_minus_m="${uname_minus_m:-"$targetarch"}"
+
# Check if we're about to use Intel's ICC compiler
case "`${cc:-cc} -V 2>&1`" in
*"Intel(R) C++ Compiler"*|*"Intel(R) C Compiler"*)
@@ -100,7 +96,7 @@ case "`${cc:-cc} -V 2>&1`" in
# The -no-gcc flag is needed otherwise, icc pretends (poorly) to be gcc
ccflags="-we147 -mp -no-gcc $ccflags"
# Prevent relocation errors on 64bits arch
- case "`uname -m`" in
+ case "$uname_minus_m" in
*ia64*|*x86_64*)
cccdlflags='-fPIC'
;;
@@ -134,7 +130,7 @@ case "$optimize" in
# use -O2 by default ; -O3 doesn't seem to bring significant benefits with gcc
'')
optimize='-O2'
- case "`uname -m`" in
+ case "$uname_minus_m" in
ppc*)
# on ppc, it seems that gcc (at least gcc 3.3.2) isn't happy
# with -O2 ; so downgrade to -O1.
@@ -174,7 +170,7 @@ else
fi
case "$plibpth" in
-'') plibpth=`$gcc -print-search-dirs | grep libraries |
+'') plibpth=`LANG=C LC_ALL=C $gcc $ccflags $ldflags -print-search-dirs | grep libraries |
cut -f2- -d= | tr ':' $trnl | grep -v 'gcc' | sed -e 's:/$::'`
set X $plibpth # Collapse all entries on one line
shift
@@ -182,6 +178,32 @@ case "$plibpth" in
;;
esac
+case "$libc" in
+'')
+# 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
+# gcc to load the library for all tests.)
+# We don't use __GLIBC__ and __GLIBC_MINOR__ because they
+# are insufficiently precise to distinguish things like
+# libc-2.0.6 and libc-2.0.7.
+ for p in $plibpth
+ do
+ for trylib in libc.so.6 libc.so
+ do
+ if $test -e $p/$trylib; then
+ libc=`ls -l $p/$trylib | awk '{print $NF}'`
+ if $test "X$libc" != X; then
+ break
+ fi
+ fi
+ done
+ if $test "X$libc" != X; then
+ break
+ fi
+ done
+ ;;
+esac
+
# Are we using ELF? Thanks to Kenneth Albanowski <kjahds@kjahds.com>
# for this test.
cat >try.c <<'EOM'
@@ -202,7 +224,7 @@ main() {
exit(0); /* succeed (yes, it's ELF) */
}
EOM
-if ${cc:-gcc} try.c >/dev/null 2>&1 && $run ./a.out; then
+if ${cc:-gcc} $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
cat <<'EOM' >&4
You appear to have ELF support. I'll try to use it for dynamic loading.
@@ -268,7 +290,7 @@ fi
rm -f try.c a.out
-if /bin/sh -c exit; then
+if ${sh:-/bin/sh} -c exit; then
echo ''
echo 'You appear to have a working bash. Good.'
else
@@ -335,7 +357,7 @@ fi
#'osfmach3ppc') ccdlflags='-Wl,-E' ;;
#esac
-case "`uname -m`" in
+case "$uname_minus_m" in
sparc*)
case "$cccdlflags" in
*-fpic*) cccdlflags="`echo $cccdlflags|sed 's/-fpic/-fPIC/'`" ;;
@@ -350,30 +372,62 @@ esac
# version of -lgdbm which is a bad idea. So if we have 'nm'
# make sure it can read the file
# NI-S 2003/08/07
-if [ -r /usr/lib/libndbm.so -a -x /usr/bin/nm ] ; then
- if /usr/bin/nm /usr/lib/libndbm.so >/dev/null 2>&1 ; then
- echo 'Your shared -lndbm seems to be a real library.'
- else
- echo 'Your shared -lndbm is not a real library.'
- set `echo X "$libswanted "| sed -e 's/ ndbm / /'`
- shift
- libswanted="$*"
- fi
-fi
+case "$nm" in
+ '') ;;
+ *)
+ for p in $plibpth
+ do
+ if $test -r $p/libndbm.so; then
+ if $nm $p/libndbm.so >/dev/null 2>&1 ; then
+ echo 'Your shared -lndbm seems to be a real library.'
+ _libndbm_real=1
+ break
+ fi
+ fi
+ done
+ if $test "X$_libndbm_real" = X; then
+ echo 'Your shared -lndbm is not a real library.'
+ set `echo X "$libswanted "| sed -e 's/ ndbm / /'`
+ shift
+ libswanted="$*"
+ fi
+ ;;
+esac
+# Linux on Synology.
+if [ -f /etc/synoinfo.conf -a -d /usr/syno ]; then
+ # Tested on Synology DS213 and DS413
+ # OS version info in /etc.defaults/VERSION
+ # http://forum.synology.com/wiki/index.php/What_kind_of_CPU_does_my_NAS_have
+ # Synology DS213 running DSM 4.3-3810-0 (2013-11-06)
+ # CPU model Marvell Kirkwood mv6282 ARMv5te
+ # Linux 2.6.32.12 #3810 Wed Nov 6 05:13:41 CST 2013 armv5tel GNU/Linux
+ # Synology DS413 running DSM 4.3-3810-0 (2013-11-06)
+ # CPU model Freescale QorIQ P1022 ppc (e500v2)
+ # linux 2.6.32.12 #3810 ppc GNU/Linux
+ # All development stuff installed with ipkg is in /opt
+ if [ "$LANG" = "" -o "$LANG" = "C" ]; then
+ echo 'Your LANG is safe'
+ else
+ echo 'Please set $LANG to "C". All other $LANG settings will cause havoc' >&4
+ LANG=C
+ fi
+ echo 'Setting up to use /opt/*' >&4
+ locincpth="/opt/include $locincpth"
+ libpth="/opt/lib $libpth"
+ libspth="/opt/lib $libspth"
+ loclibpth="/opt/lib $loclibpth"
+ # POSIX will not link without the pthread lib
+ libswanted="$libswanted pthread"
+ echo "$libswanted" >&4
+fi
# 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'
-if getconf GNU_LIBPTHREAD_VERSION | grep NPTL >/dev/null 2>/dev/null
-then
- threadshavepids=""
-else
- threadshavepids="-DTHREADS_HAVE_PIDS"
-fi
case "$usethreads" in
$define|true|[yY]*)
- ccflags="-D_REENTRANT -D_GNU_SOURCE $threadshavepids $ccflags"
+ ccflags="-D_REENTRANT -D_GNU_SOURCE $ccflags"
if echo $libswanted | grep -v pthread >/dev/null
then
set `echo X "$libswanted "| sed -e 's/ c / pthread c /'`
@@ -420,16 +474,6 @@ $define|true|[yY]*)
;;
esac
-# If we are using g++ we must use nm and force ourselves to use
-# the /usr/lib/libc.a (resetting the libc below to an empty string
-# makes Configure to look for the right one) because the symbol
-# scanning tricks of Configure will crash and burn horribly.
-case "$cc" in
-*g++*) usenm=true
- libc=''
- ;;
-esac
-
# If using g++, the Configure scan for dlopen() and (especially)
# dlerror() might fail, easier just to forcibly hint them in.
case "$cc" in
@@ -453,7 +497,7 @@ then
DBLIB="$DBDIR/libdb.so"
if [ -f $DBLIB ]
then
- if nm -u $DBLIB | grep pthread >/dev/null
+ if ${nm:-nm} -u $DBLIB | grep pthread >/dev/null
then
if ldd $DBLIB | grep pthread >/dev/null
then
diff --git a/make_ext.pl b/make_ext.pl
index 13a15b4..a564bb3 100644
--- a/make_ext.pl
+++ b/make_ext.pl
@@ -377,6 +377,10 @@ WriteMakefile(
EOM
close $fh or die "Can't close Makefile.PL: $!";
}
+ eval {
+ my $ftime = time - 4;
+ utime $ftime, $ftime, 'Makefile.PL';
+ };
print "\nRunning Makefile.PL in $ext_dir\n";
# Presumably this can be simplified
diff --git a/Configure b/Configure
index a780b81..3ae16ca 100755
--- a/Configure
+++ b/Configure
@@ -21633,15 +21633,16 @@ $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $r
EOSH
chmod +x Cppsym.try
$eunicefix Cppsym.try
-./Cppsym < Cppsym.know > Cppsym.true
+./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
: Add in any linux cpp "predefined macros":
case "$osname::$gccversion" in
*linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
tHdrH=_tmpHdr
rm -f $tHdrH'.h' $tHdrH
touch $tHdrH'.h'
+ # Filter out macro arguments, such as Linux's __INT8_C(c)
if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
- sed 's/#define[\ \ ]*//;s/[\ \ ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
+ sed -e 's/#define[\ \ ]*//;s/[\ \ ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
if [ -s $tHdrH'_cppsym.real' ]; then
cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
fi

View file

@ -0,0 +1,29 @@
FROM buildpack-deps
MAINTAINER Peter Martini <PeterCMartini@GMail.com>
RUN apt-get update \
&& apt-get install -y curl procps \
&& rm -fr /var/lib/apt/lists/*
RUN mkdir /usr/src/perl
COPY DevelPatchPerl.patch /usr/src/perl/
WORKDIR /usr/src/perl
RUN curl -SL https://cpan.metacpan.org/authors/id/D/DA/DAPM/perl-5.14.4.tar.bz2 -o perl-5.14.4.tar.bz2 \
&& echo '3527c9e26f985cba98796439bf555fde8be73cdf *perl-5.14.4.tar.bz2' | sha1sum -c - \
&& tar --strip-components=1 -xjf perl-5.14.4.tar.bz2 -C /usr/src/perl \
&& rm perl-5.14.4.tar.bz2 \
&& cat DevelPatchPerl.patch | patch -p1 \
&& ./Configure -Duse64bitall -A ccflags=-fwrapv -des \
&& make -j$(nproc) \
&& make test_harness \
&& make install \
&& cd /usr/src \
&& curl -LO https://raw.githubusercontent.com/miyagawa/cpanminus/master/cpanm \
&& chmod +x cpanm \
&& ./cpanm App::cpanminus \
&& rm -fr ./cpanm /root/.cpanm /usr/src/perl
WORKDIR /root
CMD ["perl5.14.4","-de0"]

View file

@ -1,43 +0,0 @@
From 6f87f404fa51739971a4068da1f11443024f3fc4 Mon Sep 17 00:00:00 2001
From: Andy Dougherty <doughera@lafayette.edu>
Date: Wed, 6 Jun 2012 11:12:58 -0400
Subject: [perl #113024] Configure: Avoid Cppsym warnings for extra tokens
[perl #113024]
The cppsymbols can include macros such as __INT16_C(c), which can't
be tested with a simple #ifdef. This patch strips off the opening
parenthesis and everything following it. These macros were generated
by cpp -dM.
Also ensure Cppsym.true list is sorted for later input to comm.
(I noticed this while testing this change on Solaris.)
---
Configure | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/Configure b/Configure
index a780b81..3ae16ca 100755
--- a/Configure
+++ b/Configure
@@ -21936,15 +21936,16 @@ $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $r
EOSH
chmod +x Cppsym.try
$eunicefix Cppsym.try
-./Cppsym < Cppsym.know > Cppsym.true
+./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
: Add in any linux cpp "predefined macros":
case "$osname::$gccversion" in
*linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
tHdrH=_tmpHdr
rm -f $tHdrH'.h' $tHdrH
touch $tHdrH'.h'
+ # Filter out macro arguments, such as Linux's __INT8_C(c)
if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
- sed 's/#define[\ \ ]*//;s/[\ \ ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
+ sed -e 's/#define[\ \ ]*//;s/[\ \ ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
if [ -s $tHdrH'_cppsym.real' ]; then
cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
fi
--
2.1.4

View file

@ -1,10 +0,0 @@
# This should be auto-generated; for now, it's not,
# simply because it should be generated before the build,
# which means having the appropriate version's patchlevel.h
# available, which I don't want to bake into the fetch just
# yet.
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -135,0 +136 @@
+ ,"Backport of perl5 git 6f87f404fa51739971a4068da1f11443024f3fc4"

View file

@ -0,0 +1,266 @@
From 8826551a8a505d9d3e091aa31943d0fc6ef92cba Mon Sep 17 00:00:00 2001
From: Peter Martini <PeterCMartini@GMail.com>
Date: Wed, 15 Apr 2015 22:36:13 -0400
Subject: [PATCH] tmp
---
hints/linux.sh | 145 +++++++++++++++++++++++++++++++++++++++++----------------
patchlevel.h | 1 +
2 files changed, 107 insertions(+), 39 deletions(-)
diff --git a/hints/linux.sh b/hints/linux.sh
index 688c68d..fb5a46e 100644
--- a/hints/linux.sh
+++ b/hints/linux.sh
@@ -39,7 +39,7 @@ i_libutil='undef'
# SuSE Linux can be used as cross-compilation host for Cray XT4 Catamount/Qk.
if test -d /opt/xt-pe
then
- case "`cc -V 2>&1`" in
+ case "`${cc:-cc} -V 2>&1`" in
*catamount*) . hints/catamount.sh; return ;;
esac
fi
@@ -58,17 +58,10 @@ shift
libswanted="$*"
# Debian 4.0 puts ndbm in the -lgdbm_compat library.
-libswanted="$libswanted gdbm_compat"
-
-# 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
-# gcc to load the library for all tests.)
-# We don't use __GLIBC__ and __GLIBC_MINOR__ because they
-# are insufficiently precise to distinguish things like
-# libc-2.0.6 and libc-2.0.7.
-if test -L /lib/libc.so.6; then
- libc=`ls -l /lib/libc.so.6 | awk '{print $NF}'`
- libc=/lib/$libc
+echo $libs
+if echo " $libswanted " | grep -q ' gdbm '; then
+ # Only add if gdbm is in libswanted.
+ libswanted="$libswanted gdbm_compat"
fi
# Configure may fail to find lstat() since it's a static/inline
@@ -87,6 +80,9 @@ case "$usemymalloc" in
'') usemymalloc='n' ;;
esac
+uname_minus_m="`$run uname -m 2>/dev/null`"
+uname_minus_m="${uname_minus_m:-"$targetarch"}"
+
# Check if we're about to use Intel's ICC compiler
case "`${cc:-cc} -V 2>&1`" in
*"Intel(R) C++ Compiler"*|*"Intel(R) C Compiler"*)
@@ -100,7 +96,7 @@ case "`${cc:-cc} -V 2>&1`" in
# The -no-gcc flag is needed otherwise, icc pretends (poorly) to be gcc
ccflags="-we147 -mp -no-gcc $ccflags"
# Prevent relocation errors on 64bits arch
- case "`uname -m`" in
+ case "$uname_minus_m" in
*ia64*|*x86_64*)
cccdlflags='-fPIC'
;;
@@ -134,7 +130,7 @@ case "$optimize" in
# use -O2 by default ; -O3 doesn't seem to bring significant benefits with gcc
'')
optimize='-O2'
- case "`uname -m`" in
+ case "$uname_minus_m" in
ppc*)
# on ppc, it seems that gcc (at least gcc 3.3.2) isn't happy
# with -O2 ; so downgrade to -O1.
@@ -174,7 +170,7 @@ else
fi
case "$plibpth" in
-'') plibpth=`LANG=C LC_ALL=C $gcc -print-search-dirs | grep libraries |
+'') plibpth=`LANG=C LC_ALL=C $gcc $ccflags $ldflags -print-search-dirs | grep libraries |
cut -f2- -d= | tr ':' $trnl | grep -v 'gcc' | sed -e 's:/$::'`
set X $plibpth # Collapse all entries on one line
shift
@@ -182,6 +178,49 @@ case "$plibpth" in
;;
esac
+# libquadmath is sometimes installed as gcc internal library,
+# so contrary to our usual policy of *not* looking at gcc internal
+# directories we now *do* look at them, in case they contain
+# the quadmath library.
+# XXX This may apply to other gcc internal libraries, if such exist.
+# XXX This could be at Configure level, but then the $gcc is messy.
+case "$usequadmath" in
+"$define")
+ for d in `LANG=C LC_ALL=C $gcc $ccflags $ldflags -print-search-dirs | grep libraries | cut -f2- -d= | tr ':' $trnl | grep 'gcc' | sed -e 's:/$::'`
+ do
+ case `ls $d/*libquadmath*$so* 2>/dev/null` in
+ $d/*libquadmath*$so*) xlibpth="$xlibpth $d" ;;
+ esac
+ done
+ ;;
+esac
+
+case "$libc" in
+'')
+# 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
+# gcc to load the library for all tests.)
+# We don't use __GLIBC__ and __GLIBC_MINOR__ because they
+# are insufficiently precise to distinguish things like
+# libc-2.0.6 and libc-2.0.7.
+ for p in $plibpth
+ do
+ for trylib in libc.so.6 libc.so
+ do
+ if $test -e $p/$trylib; then
+ libc=`ls -l $p/$trylib | awk '{print $NF}'`
+ if $test "X$libc" != X; then
+ break
+ fi
+ fi
+ done
+ if $test "X$libc" != X; then
+ break
+ fi
+ done
+ ;;
+esac
+
# Are we using ELF? Thanks to Kenneth Albanowski <kjahds@kjahds.com>
# for this test.
cat >try.c <<'EOM'
@@ -202,7 +241,7 @@ main() {
exit(0); /* succeed (yes, it's ELF) */
}
EOM
-if ${cc:-gcc} try.c >/dev/null 2>&1 && $run ./a.out; then
+if ${cc:-gcc} $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
cat <<'EOM' >&4
You appear to have ELF support. I'll try to use it for dynamic loading.
@@ -268,7 +307,7 @@ fi
rm -f try.c a.out
-if /bin/sh -c exit; then
+if ${sh:-/bin/sh} -c exit; then
echo ''
echo 'You appear to have a working bash. Good.'
else
@@ -335,7 +374,7 @@ fi
#'osfmach3ppc') ccdlflags='-Wl,-E' ;;
#esac
-case "`uname -m`" in
+case "$uname_minus_m" in
sparc*)
case "$cccdlflags" in
*-fpic*) cccdlflags="`echo $cccdlflags|sed 's/-fpic/-fPIC/'`" ;;
@@ -350,17 +389,55 @@ esac
# version of -lgdbm which is a bad idea. So if we have 'nm'
# make sure it can read the file
# NI-S 2003/08/07
-if [ -r /usr/lib/libndbm.so -a -x /usr/bin/nm ] ; then
- if /usr/bin/nm /usr/lib/libndbm.so >/dev/null 2>&1 ; then
- echo 'Your shared -lndbm seems to be a real library.'
- else
- echo 'Your shared -lndbm is not a real library.'
- set `echo X "$libswanted "| sed -e 's/ ndbm / /'`
- shift
- libswanted="$*"
- fi
-fi
+case "$nm" in
+ '') ;;
+ *)
+ for p in $plibpth
+ do
+ if $test -r $p/libndbm.so; then
+ if $nm $p/libndbm.so >/dev/null 2>&1 ; then
+ echo 'Your shared -lndbm seems to be a real library.'
+ _libndbm_real=1
+ break
+ fi
+ fi
+ done
+ if $test "X$_libndbm_real" = X; then
+ echo 'Your shared -lndbm is not a real library.'
+ set `echo X "$libswanted "| sed -e 's/ ndbm / /'`
+ shift
+ libswanted="$*"
+ fi
+ ;;
+esac
+# Linux on Synology.
+if [ -f /etc/synoinfo.conf -a -d /usr/syno ]; then
+ # Tested on Synology DS213 and DS413
+ # OS version info in /etc.defaults/VERSION
+ # http://forum.synology.com/wiki/index.php/What_kind_of_CPU_does_my_NAS_have
+ # Synology DS213 running DSM 4.3-3810-0 (2013-11-06)
+ # CPU model Marvell Kirkwood mv6282 ARMv5te
+ # Linux 2.6.32.12 #3810 Wed Nov 6 05:13:41 CST 2013 armv5tel GNU/Linux
+ # Synology DS413 running DSM 4.3-3810-0 (2013-11-06)
+ # CPU model Freescale QorIQ P1022 ppc (e500v2)
+ # linux 2.6.32.12 #3810 ppc GNU/Linux
+ # All development stuff installed with ipkg is in /opt
+ if [ "$LANG" = "" -o "$LANG" = "C" ]; then
+ echo 'Your LANG is safe'
+ else
+ echo 'Please set $LANG to "C". All other $LANG settings will cause havoc' >&4
+ LANG=C
+ fi
+ echo 'Setting up to use /opt/*' >&4
+ locincpth="/opt/include $locincpth"
+ libpth="/opt/lib $libpth"
+ libspth="/opt/lib $libspth"
+ loclibpth="/opt/lib $loclibpth"
+ # POSIX will not link without the pthread lib
+ libswanted="$libswanted pthread"
+ echo "$libswanted" >&4
+fi
# This script UU/usethreads.cbu will get 'called-back' by Configure
# after it has prompted the user for whether to use threads.
@@ -414,16 +491,6 @@ $define|true|[yY]*)
;;
esac
-# If we are using g++ we must use nm and force ourselves to use
-# the /usr/lib/libc.a (resetting the libc below to an empty string
-# makes Configure to look for the right one) because the symbol
-# scanning tricks of Configure will crash and burn horribly.
-case "$cc" in
-*g++*) usenm=true
- libc=''
- ;;
-esac
-
# If using g++, the Configure scan for dlopen() and (especially)
# dlerror() might fail, easier just to forcibly hint them in.
case "$cc" in
@@ -447,7 +514,7 @@ then
DBLIB="$DBDIR/libdb.so"
if [ -f $DBLIB ]
then
- if nm -u $DBLIB | grep pthread >/dev/null
+ if ${nm:-nm} -u $DBLIB 2>/dev/null | grep pthread >/dev/null
then
if ldd $DBLIB | grep pthread >/dev/null
then
diff --git a/patchlevel.h b/patchlevel.h
index be508d1..11ae2e8 100644
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -137,6 +137,7 @@ static const char * const local_patches[] = {
,"uncommitted-changes"
#endif
PERL_GIT_UNPUSHED_COMMITS /* do not remove this line */
+ ,"Devel::PatchPerl 1.32"
,NULL
};
--
1.9.1

View file

@ -6,14 +6,14 @@ RUN apt-get update \
&& rm -fr /var/lib/apt/lists/*
RUN mkdir /usr/src/perl
COPY *.patch /usr/src/perl/
COPY DevelPatchPerl.patch /usr/src/perl/
WORKDIR /usr/src/perl
RUN curl -SL https://cpan.metacpan.org/authors/id/R/RJ/RJBS/perl-5.16.3.tar.bz2 -o perl-5.16.3.tar.bz2 \
&& echo '060bc17cf9f142d043f9bf7b861422ec624875ea *perl-5.16.3.tar.bz2' | sha1sum -c - \
&& tar --strip-components=1 -xjf perl-5.16.3.tar.bz2 -C /usr/src/perl \
&& rm perl-5.16.3.tar.bz2 \
&& cat *.patch | patch -p1 \
&& cat DevelPatchPerl.patch | patch -p1 \
&& ./Configure -Dusethreads -Duse64bitall -A ccflags=-fwrapv -des \
&& make -j$(nproc) \
&& make test_harness \

View file

@ -1,43 +0,0 @@
From 6f87f404fa51739971a4068da1f11443024f3fc4 Mon Sep 17 00:00:00 2001
From: Andy Dougherty <doughera@lafayette.edu>
Date: Wed, 6 Jun 2012 11:12:58 -0400
Subject: [perl #113024] Configure: Avoid Cppsym warnings for extra tokens
[perl #113024]
The cppsymbols can include macros such as __INT16_C(c), which can't
be tested with a simple #ifdef. This patch strips off the opening
parenthesis and everything following it. These macros were generated
by cpp -dM.
Also ensure Cppsym.true list is sorted for later input to comm.
(I noticed this while testing this change on Solaris.)
---
Configure | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/Configure b/Configure
index a780b81..3ae16ca 100755
--- a/Configure
+++ b/Configure
@@ -21936,15 +21936,16 @@ $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $r
EOSH
chmod +x Cppsym.try
$eunicefix Cppsym.try
-./Cppsym < Cppsym.know > Cppsym.true
+./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
: Add in any linux cpp "predefined macros":
case "$osname::$gccversion" in
*linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
tHdrH=_tmpHdr
rm -f $tHdrH'.h' $tHdrH
touch $tHdrH'.h'
+ # Filter out macro arguments, such as Linux's __INT8_C(c)
if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
- sed 's/#define[\ \ ]*//;s/[\ \ ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
+ sed -e 's/#define[\ \ ]*//;s/[\ \ ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
if [ -s $tHdrH'_cppsym.real' ]; then
cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
fi
--
2.1.4

View file

@ -1,10 +0,0 @@
# This should be auto-generated; for now, it's not,
# simply because it should be generated before the build,
# which means having the appropriate version's patchlevel.h
# available, which I don't want to bake into the fetch just
# yet.
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -135,0 +136 @@
+ ,"Backport of perl5 git 6f87f404fa51739971a4068da1f11443024f3fc4"

View file

@ -0,0 +1,266 @@
From 8826551a8a505d9d3e091aa31943d0fc6ef92cba Mon Sep 17 00:00:00 2001
From: Peter Martini <PeterCMartini@GMail.com>
Date: Wed, 15 Apr 2015 22:36:13 -0400
Subject: [PATCH] tmp
---
hints/linux.sh | 145 +++++++++++++++++++++++++++++++++++++++++----------------
patchlevel.h | 1 +
2 files changed, 107 insertions(+), 39 deletions(-)
diff --git a/hints/linux.sh b/hints/linux.sh
index 688c68d..fb5a46e 100644
--- a/hints/linux.sh
+++ b/hints/linux.sh
@@ -39,7 +39,7 @@ i_libutil='undef'
# SuSE Linux can be used as cross-compilation host for Cray XT4 Catamount/Qk.
if test -d /opt/xt-pe
then
- case "`cc -V 2>&1`" in
+ case "`${cc:-cc} -V 2>&1`" in
*catamount*) . hints/catamount.sh; return ;;
esac
fi
@@ -58,17 +58,10 @@ shift
libswanted="$*"
# Debian 4.0 puts ndbm in the -lgdbm_compat library.
-libswanted="$libswanted gdbm_compat"
-
-# 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
-# gcc to load the library for all tests.)
-# We don't use __GLIBC__ and __GLIBC_MINOR__ because they
-# are insufficiently precise to distinguish things like
-# libc-2.0.6 and libc-2.0.7.
-if test -L /lib/libc.so.6; then
- libc=`ls -l /lib/libc.so.6 | awk '{print $NF}'`
- libc=/lib/$libc
+echo $libs
+if echo " $libswanted " | grep -q ' gdbm '; then
+ # Only add if gdbm is in libswanted.
+ libswanted="$libswanted gdbm_compat"
fi
# Configure may fail to find lstat() since it's a static/inline
@@ -87,6 +80,9 @@ case "$usemymalloc" in
'') usemymalloc='n' ;;
esac
+uname_minus_m="`$run uname -m 2>/dev/null`"
+uname_minus_m="${uname_minus_m:-"$targetarch"}"
+
# Check if we're about to use Intel's ICC compiler
case "`${cc:-cc} -V 2>&1`" in
*"Intel(R) C++ Compiler"*|*"Intel(R) C Compiler"*)
@@ -100,7 +96,7 @@ case "`${cc:-cc} -V 2>&1`" in
# The -no-gcc flag is needed otherwise, icc pretends (poorly) to be gcc
ccflags="-we147 -mp -no-gcc $ccflags"
# Prevent relocation errors on 64bits arch
- case "`uname -m`" in
+ case "$uname_minus_m" in
*ia64*|*x86_64*)
cccdlflags='-fPIC'
;;
@@ -134,7 +130,7 @@ case "$optimize" in
# use -O2 by default ; -O3 doesn't seem to bring significant benefits with gcc
'')
optimize='-O2'
- case "`uname -m`" in
+ case "$uname_minus_m" in
ppc*)
# on ppc, it seems that gcc (at least gcc 3.3.2) isn't happy
# with -O2 ; so downgrade to -O1.
@@ -174,7 +170,7 @@ else
fi
case "$plibpth" in
-'') plibpth=`LANG=C LC_ALL=C $gcc -print-search-dirs | grep libraries |
+'') plibpth=`LANG=C LC_ALL=C $gcc $ccflags $ldflags -print-search-dirs | grep libraries |
cut -f2- -d= | tr ':' $trnl | grep -v 'gcc' | sed -e 's:/$::'`
set X $plibpth # Collapse all entries on one line
shift
@@ -182,6 +178,49 @@ case "$plibpth" in
;;
esac
+# libquadmath is sometimes installed as gcc internal library,
+# so contrary to our usual policy of *not* looking at gcc internal
+# directories we now *do* look at them, in case they contain
+# the quadmath library.
+# XXX This may apply to other gcc internal libraries, if such exist.
+# XXX This could be at Configure level, but then the $gcc is messy.
+case "$usequadmath" in
+"$define")
+ for d in `LANG=C LC_ALL=C $gcc $ccflags $ldflags -print-search-dirs | grep libraries | cut -f2- -d= | tr ':' $trnl | grep 'gcc' | sed -e 's:/$::'`
+ do
+ case `ls $d/*libquadmath*$so* 2>/dev/null` in
+ $d/*libquadmath*$so*) xlibpth="$xlibpth $d" ;;
+ esac
+ done
+ ;;
+esac
+
+case "$libc" in
+'')
+# 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
+# gcc to load the library for all tests.)
+# We don't use __GLIBC__ and __GLIBC_MINOR__ because they
+# are insufficiently precise to distinguish things like
+# libc-2.0.6 and libc-2.0.7.
+ for p in $plibpth
+ do
+ for trylib in libc.so.6 libc.so
+ do
+ if $test -e $p/$trylib; then
+ libc=`ls -l $p/$trylib | awk '{print $NF}'`
+ if $test "X$libc" != X; then
+ break
+ fi
+ fi
+ done
+ if $test "X$libc" != X; then
+ break
+ fi
+ done
+ ;;
+esac
+
# Are we using ELF? Thanks to Kenneth Albanowski <kjahds@kjahds.com>
# for this test.
cat >try.c <<'EOM'
@@ -202,7 +241,7 @@ main() {
exit(0); /* succeed (yes, it's ELF) */
}
EOM
-if ${cc:-gcc} try.c >/dev/null 2>&1 && $run ./a.out; then
+if ${cc:-gcc} $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
cat <<'EOM' >&4
You appear to have ELF support. I'll try to use it for dynamic loading.
@@ -268,7 +307,7 @@ fi
rm -f try.c a.out
-if /bin/sh -c exit; then
+if ${sh:-/bin/sh} -c exit; then
echo ''
echo 'You appear to have a working bash. Good.'
else
@@ -335,7 +374,7 @@ fi
#'osfmach3ppc') ccdlflags='-Wl,-E' ;;
#esac
-case "`uname -m`" in
+case "$uname_minus_m" in
sparc*)
case "$cccdlflags" in
*-fpic*) cccdlflags="`echo $cccdlflags|sed 's/-fpic/-fPIC/'`" ;;
@@ -350,17 +389,55 @@ esac
# version of -lgdbm which is a bad idea. So if we have 'nm'
# make sure it can read the file
# NI-S 2003/08/07
-if [ -r /usr/lib/libndbm.so -a -x /usr/bin/nm ] ; then
- if /usr/bin/nm /usr/lib/libndbm.so >/dev/null 2>&1 ; then
- echo 'Your shared -lndbm seems to be a real library.'
- else
- echo 'Your shared -lndbm is not a real library.'
- set `echo X "$libswanted "| sed -e 's/ ndbm / /'`
- shift
- libswanted="$*"
- fi
-fi
+case "$nm" in
+ '') ;;
+ *)
+ for p in $plibpth
+ do
+ if $test -r $p/libndbm.so; then
+ if $nm $p/libndbm.so >/dev/null 2>&1 ; then
+ echo 'Your shared -lndbm seems to be a real library.'
+ _libndbm_real=1
+ break
+ fi
+ fi
+ done
+ if $test "X$_libndbm_real" = X; then
+ echo 'Your shared -lndbm is not a real library.'
+ set `echo X "$libswanted "| sed -e 's/ ndbm / /'`
+ shift
+ libswanted="$*"
+ fi
+ ;;
+esac
+# Linux on Synology.
+if [ -f /etc/synoinfo.conf -a -d /usr/syno ]; then
+ # Tested on Synology DS213 and DS413
+ # OS version info in /etc.defaults/VERSION
+ # http://forum.synology.com/wiki/index.php/What_kind_of_CPU_does_my_NAS_have
+ # Synology DS213 running DSM 4.3-3810-0 (2013-11-06)
+ # CPU model Marvell Kirkwood mv6282 ARMv5te
+ # Linux 2.6.32.12 #3810 Wed Nov 6 05:13:41 CST 2013 armv5tel GNU/Linux
+ # Synology DS413 running DSM 4.3-3810-0 (2013-11-06)
+ # CPU model Freescale QorIQ P1022 ppc (e500v2)
+ # linux 2.6.32.12 #3810 ppc GNU/Linux
+ # All development stuff installed with ipkg is in /opt
+ if [ "$LANG" = "" -o "$LANG" = "C" ]; then
+ echo 'Your LANG is safe'
+ else
+ echo 'Please set $LANG to "C". All other $LANG settings will cause havoc' >&4
+ LANG=C
+ fi
+ echo 'Setting up to use /opt/*' >&4
+ locincpth="/opt/include $locincpth"
+ libpth="/opt/lib $libpth"
+ libspth="/opt/lib $libspth"
+ loclibpth="/opt/lib $loclibpth"
+ # POSIX will not link without the pthread lib
+ libswanted="$libswanted pthread"
+ echo "$libswanted" >&4
+fi
# This script UU/usethreads.cbu will get 'called-back' by Configure
# after it has prompted the user for whether to use threads.
@@ -414,16 +491,6 @@ $define|true|[yY]*)
;;
esac
-# If we are using g++ we must use nm and force ourselves to use
-# the /usr/lib/libc.a (resetting the libc below to an empty string
-# makes Configure to look for the right one) because the symbol
-# scanning tricks of Configure will crash and burn horribly.
-case "$cc" in
-*g++*) usenm=true
- libc=''
- ;;
-esac
-
# If using g++, the Configure scan for dlopen() and (especially)
# dlerror() might fail, easier just to forcibly hint them in.
case "$cc" in
@@ -447,7 +514,7 @@ then
DBLIB="$DBDIR/libdb.so"
if [ -f $DBLIB ]
then
- if nm -u $DBLIB | grep pthread >/dev/null
+ if ${nm:-nm} -u $DBLIB 2>/dev/null | grep pthread >/dev/null
then
if ldd $DBLIB | grep pthread >/dev/null
then
diff --git a/patchlevel.h b/patchlevel.h
index be508d1..11ae2e8 100644
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -137,6 +137,7 @@ static const char * const local_patches[] = {
,"uncommitted-changes"
#endif
PERL_GIT_UNPUSHED_COMMITS /* do not remove this line */
+ ,"Devel::PatchPerl 1.32"
,NULL
};
--
1.9.1

View file

@ -6,14 +6,14 @@ RUN apt-get update \
&& rm -fr /var/lib/apt/lists/*
RUN mkdir /usr/src/perl
COPY *.patch /usr/src/perl/
COPY DevelPatchPerl.patch /usr/src/perl/
WORKDIR /usr/src/perl
RUN curl -SL https://cpan.metacpan.org/authors/id/R/RJ/RJBS/perl-5.16.3.tar.bz2 -o perl-5.16.3.tar.bz2 \
&& echo '060bc17cf9f142d043f9bf7b861422ec624875ea *perl-5.16.3.tar.bz2' | sha1sum -c - \
&& tar --strip-components=1 -xjf perl-5.16.3.tar.bz2 -C /usr/src/perl \
&& rm perl-5.16.3.tar.bz2 \
&& cat *.patch | patch -p1 \
&& cat DevelPatchPerl.patch | patch -p1 \
&& ./Configure -Duse64bitall -A ccflags=-fwrapv -des \
&& make -j$(nproc) \
&& make test_harness \

View file

@ -0,0 +1,249 @@
From 6509088d78a8d7e1e04b224f4058d74d2d147075 Mon Sep 17 00:00:00 2001
From: Peter Martini <PeterCMartini@GMail.com>
Date: Wed, 15 Apr 2015 22:36:18 -0400
Subject: [PATCH] tmp
---
hints/linux.sh | 135 ++++++++++++++++++++++++++++++++++++++++++++-------------
patchlevel.h | 1 +
2 files changed, 107 insertions(+), 29 deletions(-)
diff --git a/hints/linux.sh b/hints/linux.sh
index a148248..fb5a46e 100644
--- a/hints/linux.sh
+++ b/hints/linux.sh
@@ -39,7 +39,7 @@ i_libutil='undef'
# SuSE Linux can be used as cross-compilation host for Cray XT4 Catamount/Qk.
if test -d /opt/xt-pe
then
- case "`cc -V 2>&1`" in
+ case "`${cc:-cc} -V 2>&1`" in
*catamount*) . hints/catamount.sh; return ;;
esac
fi
@@ -58,17 +58,10 @@ shift
libswanted="$*"
# Debian 4.0 puts ndbm in the -lgdbm_compat library.
-libswanted="$libswanted gdbm_compat"
-
-# 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
-# gcc to load the library for all tests.)
-# We don't use __GLIBC__ and __GLIBC_MINOR__ because they
-# are insufficiently precise to distinguish things like
-# libc-2.0.6 and libc-2.0.7.
-if test -L /lib/libc.so.6; then
- libc=`ls -l /lib/libc.so.6 | awk '{print $NF}'`
- libc=/lib/$libc
+echo $libs
+if echo " $libswanted " | grep -q ' gdbm '; then
+ # Only add if gdbm is in libswanted.
+ libswanted="$libswanted gdbm_compat"
fi
# Configure may fail to find lstat() since it's a static/inline
@@ -87,6 +80,9 @@ case "$usemymalloc" in
'') usemymalloc='n' ;;
esac
+uname_minus_m="`$run uname -m 2>/dev/null`"
+uname_minus_m="${uname_minus_m:-"$targetarch"}"
+
# Check if we're about to use Intel's ICC compiler
case "`${cc:-cc} -V 2>&1`" in
*"Intel(R) C++ Compiler"*|*"Intel(R) C Compiler"*)
@@ -100,7 +96,7 @@ case "`${cc:-cc} -V 2>&1`" in
# The -no-gcc flag is needed otherwise, icc pretends (poorly) to be gcc
ccflags="-we147 -mp -no-gcc $ccflags"
# Prevent relocation errors on 64bits arch
- case "`uname -m`" in
+ case "$uname_minus_m" in
*ia64*|*x86_64*)
cccdlflags='-fPIC'
;;
@@ -134,7 +130,7 @@ case "$optimize" in
# use -O2 by default ; -O3 doesn't seem to bring significant benefits with gcc
'')
optimize='-O2'
- case "`uname -m`" in
+ case "$uname_minus_m" in
ppc*)
# on ppc, it seems that gcc (at least gcc 3.3.2) isn't happy
# with -O2 ; so downgrade to -O1.
@@ -174,7 +170,7 @@ else
fi
case "$plibpth" in
-'') plibpth=`LANG=C LC_ALL=C $gcc -print-search-dirs | grep libraries |
+'') plibpth=`LANG=C LC_ALL=C $gcc $ccflags $ldflags -print-search-dirs | grep libraries |
cut -f2- -d= | tr ':' $trnl | grep -v 'gcc' | sed -e 's:/$::'`
set X $plibpth # Collapse all entries on one line
shift
@@ -182,6 +178,49 @@ case "$plibpth" in
;;
esac
+# libquadmath is sometimes installed as gcc internal library,
+# so contrary to our usual policy of *not* looking at gcc internal
+# directories we now *do* look at them, in case they contain
+# the quadmath library.
+# XXX This may apply to other gcc internal libraries, if such exist.
+# XXX This could be at Configure level, but then the $gcc is messy.
+case "$usequadmath" in
+"$define")
+ for d in `LANG=C LC_ALL=C $gcc $ccflags $ldflags -print-search-dirs | grep libraries | cut -f2- -d= | tr ':' $trnl | grep 'gcc' | sed -e 's:/$::'`
+ do
+ case `ls $d/*libquadmath*$so* 2>/dev/null` in
+ $d/*libquadmath*$so*) xlibpth="$xlibpth $d" ;;
+ esac
+ done
+ ;;
+esac
+
+case "$libc" in
+'')
+# 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
+# gcc to load the library for all tests.)
+# We don't use __GLIBC__ and __GLIBC_MINOR__ because they
+# are insufficiently precise to distinguish things like
+# libc-2.0.6 and libc-2.0.7.
+ for p in $plibpth
+ do
+ for trylib in libc.so.6 libc.so
+ do
+ if $test -e $p/$trylib; then
+ libc=`ls -l $p/$trylib | awk '{print $NF}'`
+ if $test "X$libc" != X; then
+ break
+ fi
+ fi
+ done
+ if $test "X$libc" != X; then
+ break
+ fi
+ done
+ ;;
+esac
+
# Are we using ELF? Thanks to Kenneth Albanowski <kjahds@kjahds.com>
# for this test.
cat >try.c <<'EOM'
@@ -202,7 +241,7 @@ main() {
exit(0); /* succeed (yes, it's ELF) */
}
EOM
-if ${cc:-gcc} try.c >/dev/null 2>&1 && $run ./a.out; then
+if ${cc:-gcc} $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
cat <<'EOM' >&4
You appear to have ELF support. I'll try to use it for dynamic loading.
@@ -268,7 +307,7 @@ fi
rm -f try.c a.out
-if /bin/sh -c exit; then
+if ${sh:-/bin/sh} -c exit; then
echo ''
echo 'You appear to have a working bash. Good.'
else
@@ -335,7 +374,7 @@ fi
#'osfmach3ppc') ccdlflags='-Wl,-E' ;;
#esac
-case "`uname -m`" in
+case "$uname_minus_m" in
sparc*)
case "$cccdlflags" in
*-fpic*) cccdlflags="`echo $cccdlflags|sed 's/-fpic/-fPIC/'`" ;;
@@ -350,17 +389,55 @@ esac
# version of -lgdbm which is a bad idea. So if we have 'nm'
# make sure it can read the file
# NI-S 2003/08/07
-if [ -r /usr/lib/libndbm.so -a -x /usr/bin/nm ] ; then
- if /usr/bin/nm /usr/lib/libndbm.so >/dev/null 2>&1 ; then
- echo 'Your shared -lndbm seems to be a real library.'
- else
- echo 'Your shared -lndbm is not a real library.'
- set `echo X "$libswanted "| sed -e 's/ ndbm / /'`
- shift
- libswanted="$*"
- fi
-fi
+case "$nm" in
+ '') ;;
+ *)
+ for p in $plibpth
+ do
+ if $test -r $p/libndbm.so; then
+ if $nm $p/libndbm.so >/dev/null 2>&1 ; then
+ echo 'Your shared -lndbm seems to be a real library.'
+ _libndbm_real=1
+ break
+ fi
+ fi
+ done
+ if $test "X$_libndbm_real" = X; then
+ echo 'Your shared -lndbm is not a real library.'
+ set `echo X "$libswanted "| sed -e 's/ ndbm / /'`
+ shift
+ libswanted="$*"
+ fi
+ ;;
+esac
+# Linux on Synology.
+if [ -f /etc/synoinfo.conf -a -d /usr/syno ]; then
+ # Tested on Synology DS213 and DS413
+ # OS version info in /etc.defaults/VERSION
+ # http://forum.synology.com/wiki/index.php/What_kind_of_CPU_does_my_NAS_have
+ # Synology DS213 running DSM 4.3-3810-0 (2013-11-06)
+ # CPU model Marvell Kirkwood mv6282 ARMv5te
+ # Linux 2.6.32.12 #3810 Wed Nov 6 05:13:41 CST 2013 armv5tel GNU/Linux
+ # Synology DS413 running DSM 4.3-3810-0 (2013-11-06)
+ # CPU model Freescale QorIQ P1022 ppc (e500v2)
+ # linux 2.6.32.12 #3810 ppc GNU/Linux
+ # All development stuff installed with ipkg is in /opt
+ if [ "$LANG" = "" -o "$LANG" = "C" ]; then
+ echo 'Your LANG is safe'
+ else
+ echo 'Please set $LANG to "C". All other $LANG settings will cause havoc' >&4
+ LANG=C
+ fi
+ echo 'Setting up to use /opt/*' >&4
+ locincpth="/opt/include $locincpth"
+ libpth="/opt/lib $libpth"
+ libspth="/opt/lib $libspth"
+ loclibpth="/opt/lib $loclibpth"
+ # POSIX will not link without the pthread lib
+ libswanted="$libswanted pthread"
+ echo "$libswanted" >&4
+fi
# This script UU/usethreads.cbu will get 'called-back' by Configure
# after it has prompted the user for whether to use threads.
@@ -437,7 +514,7 @@ then
DBLIB="$DBDIR/libdb.so"
if [ -f $DBLIB ]
then
- if nm -u $DBLIB | grep pthread >/dev/null
+ if ${nm:-nm} -u $DBLIB 2>/dev/null | grep pthread >/dev/null
then
if ldd $DBLIB | grep pthread >/dev/null
then
diff --git a/patchlevel.h b/patchlevel.h
index cb033ea..1318325 100644
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -137,6 +137,7 @@ static const char * const local_patches[] = {
,"uncommitted-changes"
#endif
PERL_GIT_UNPUSHED_COMMITS /* do not remove this line */
+ ,"Devel::PatchPerl 1.32"
,NULL
};
--
1.9.1

View file

@ -6,15 +6,17 @@ RUN apt-get update \
&& rm -fr /var/lib/apt/lists/*
RUN mkdir /usr/src/perl
COPY DevelPatchPerl.patch /usr/src/perl/
WORKDIR /usr/src/perl
RUN curl -SL https://cpan.metacpan.org/authors/id/R/RJ/RJBS/perl-5.18.4.tar.bz2 -o perl-5.18.4.tar.bz2 \
&& echo '69c34558a0a939a7adbbc1de48c06ea418d81e27 *perl-5.18.4.tar.bz2' | sha1sum -c - \
&& tar --strip-components=1 -xjf perl-5.18.4.tar.bz2 -C /usr/src/perl \
&& rm perl-5.18.4.tar.bz2 \
&& cat DevelPatchPerl.patch | patch -p1 \
&& ./Configure -Dusethreads -Duse64bitall -A ccflags=-fwrapv -des \
&& make -j$(nproc) \
&& TEST_JOBS=$(nproc) make test_harness \
&& make test_harness \
&& make install \
&& cd /usr/src \
&& curl -LO https://raw.githubusercontent.com/miyagawa/cpanminus/master/cpanm \

View file

@ -0,0 +1,249 @@
From 6509088d78a8d7e1e04b224f4058d74d2d147075 Mon Sep 17 00:00:00 2001
From: Peter Martini <PeterCMartini@GMail.com>
Date: Wed, 15 Apr 2015 22:36:18 -0400
Subject: [PATCH] tmp
---
hints/linux.sh | 135 ++++++++++++++++++++++++++++++++++++++++++++-------------
patchlevel.h | 1 +
2 files changed, 107 insertions(+), 29 deletions(-)
diff --git a/hints/linux.sh b/hints/linux.sh
index a148248..fb5a46e 100644
--- a/hints/linux.sh
+++ b/hints/linux.sh
@@ -39,7 +39,7 @@ i_libutil='undef'
# SuSE Linux can be used as cross-compilation host for Cray XT4 Catamount/Qk.
if test -d /opt/xt-pe
then
- case "`cc -V 2>&1`" in
+ case "`${cc:-cc} -V 2>&1`" in
*catamount*) . hints/catamount.sh; return ;;
esac
fi
@@ -58,17 +58,10 @@ shift
libswanted="$*"
# Debian 4.0 puts ndbm in the -lgdbm_compat library.
-libswanted="$libswanted gdbm_compat"
-
-# 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
-# gcc to load the library for all tests.)
-# We don't use __GLIBC__ and __GLIBC_MINOR__ because they
-# are insufficiently precise to distinguish things like
-# libc-2.0.6 and libc-2.0.7.
-if test -L /lib/libc.so.6; then
- libc=`ls -l /lib/libc.so.6 | awk '{print $NF}'`
- libc=/lib/$libc
+echo $libs
+if echo " $libswanted " | grep -q ' gdbm '; then
+ # Only add if gdbm is in libswanted.
+ libswanted="$libswanted gdbm_compat"
fi
# Configure may fail to find lstat() since it's a static/inline
@@ -87,6 +80,9 @@ case "$usemymalloc" in
'') usemymalloc='n' ;;
esac
+uname_minus_m="`$run uname -m 2>/dev/null`"
+uname_minus_m="${uname_minus_m:-"$targetarch"}"
+
# Check if we're about to use Intel's ICC compiler
case "`${cc:-cc} -V 2>&1`" in
*"Intel(R) C++ Compiler"*|*"Intel(R) C Compiler"*)
@@ -100,7 +96,7 @@ case "`${cc:-cc} -V 2>&1`" in
# The -no-gcc flag is needed otherwise, icc pretends (poorly) to be gcc
ccflags="-we147 -mp -no-gcc $ccflags"
# Prevent relocation errors on 64bits arch
- case "`uname -m`" in
+ case "$uname_minus_m" in
*ia64*|*x86_64*)
cccdlflags='-fPIC'
;;
@@ -134,7 +130,7 @@ case "$optimize" in
# use -O2 by default ; -O3 doesn't seem to bring significant benefits with gcc
'')
optimize='-O2'
- case "`uname -m`" in
+ case "$uname_minus_m" in
ppc*)
# on ppc, it seems that gcc (at least gcc 3.3.2) isn't happy
# with -O2 ; so downgrade to -O1.
@@ -174,7 +170,7 @@ else
fi
case "$plibpth" in
-'') plibpth=`LANG=C LC_ALL=C $gcc -print-search-dirs | grep libraries |
+'') plibpth=`LANG=C LC_ALL=C $gcc $ccflags $ldflags -print-search-dirs | grep libraries |
cut -f2- -d= | tr ':' $trnl | grep -v 'gcc' | sed -e 's:/$::'`
set X $plibpth # Collapse all entries on one line
shift
@@ -182,6 +178,49 @@ case "$plibpth" in
;;
esac
+# libquadmath is sometimes installed as gcc internal library,
+# so contrary to our usual policy of *not* looking at gcc internal
+# directories we now *do* look at them, in case they contain
+# the quadmath library.
+# XXX This may apply to other gcc internal libraries, if such exist.
+# XXX This could be at Configure level, but then the $gcc is messy.
+case "$usequadmath" in
+"$define")
+ for d in `LANG=C LC_ALL=C $gcc $ccflags $ldflags -print-search-dirs | grep libraries | cut -f2- -d= | tr ':' $trnl | grep 'gcc' | sed -e 's:/$::'`
+ do
+ case `ls $d/*libquadmath*$so* 2>/dev/null` in
+ $d/*libquadmath*$so*) xlibpth="$xlibpth $d" ;;
+ esac
+ done
+ ;;
+esac
+
+case "$libc" in
+'')
+# 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
+# gcc to load the library for all tests.)
+# We don't use __GLIBC__ and __GLIBC_MINOR__ because they
+# are insufficiently precise to distinguish things like
+# libc-2.0.6 and libc-2.0.7.
+ for p in $plibpth
+ do
+ for trylib in libc.so.6 libc.so
+ do
+ if $test -e $p/$trylib; then
+ libc=`ls -l $p/$trylib | awk '{print $NF}'`
+ if $test "X$libc" != X; then
+ break
+ fi
+ fi
+ done
+ if $test "X$libc" != X; then
+ break
+ fi
+ done
+ ;;
+esac
+
# Are we using ELF? Thanks to Kenneth Albanowski <kjahds@kjahds.com>
# for this test.
cat >try.c <<'EOM'
@@ -202,7 +241,7 @@ main() {
exit(0); /* succeed (yes, it's ELF) */
}
EOM
-if ${cc:-gcc} try.c >/dev/null 2>&1 && $run ./a.out; then
+if ${cc:-gcc} $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
cat <<'EOM' >&4
You appear to have ELF support. I'll try to use it for dynamic loading.
@@ -268,7 +307,7 @@ fi
rm -f try.c a.out
-if /bin/sh -c exit; then
+if ${sh:-/bin/sh} -c exit; then
echo ''
echo 'You appear to have a working bash. Good.'
else
@@ -335,7 +374,7 @@ fi
#'osfmach3ppc') ccdlflags='-Wl,-E' ;;
#esac
-case "`uname -m`" in
+case "$uname_minus_m" in
sparc*)
case "$cccdlflags" in
*-fpic*) cccdlflags="`echo $cccdlflags|sed 's/-fpic/-fPIC/'`" ;;
@@ -350,17 +389,55 @@ esac
# version of -lgdbm which is a bad idea. So if we have 'nm'
# make sure it can read the file
# NI-S 2003/08/07
-if [ -r /usr/lib/libndbm.so -a -x /usr/bin/nm ] ; then
- if /usr/bin/nm /usr/lib/libndbm.so >/dev/null 2>&1 ; then
- echo 'Your shared -lndbm seems to be a real library.'
- else
- echo 'Your shared -lndbm is not a real library.'
- set `echo X "$libswanted "| sed -e 's/ ndbm / /'`
- shift
- libswanted="$*"
- fi
-fi
+case "$nm" in
+ '') ;;
+ *)
+ for p in $plibpth
+ do
+ if $test -r $p/libndbm.so; then
+ if $nm $p/libndbm.so >/dev/null 2>&1 ; then
+ echo 'Your shared -lndbm seems to be a real library.'
+ _libndbm_real=1
+ break
+ fi
+ fi
+ done
+ if $test "X$_libndbm_real" = X; then
+ echo 'Your shared -lndbm is not a real library.'
+ set `echo X "$libswanted "| sed -e 's/ ndbm / /'`
+ shift
+ libswanted="$*"
+ fi
+ ;;
+esac
+# Linux on Synology.
+if [ -f /etc/synoinfo.conf -a -d /usr/syno ]; then
+ # Tested on Synology DS213 and DS413
+ # OS version info in /etc.defaults/VERSION
+ # http://forum.synology.com/wiki/index.php/What_kind_of_CPU_does_my_NAS_have
+ # Synology DS213 running DSM 4.3-3810-0 (2013-11-06)
+ # CPU model Marvell Kirkwood mv6282 ARMv5te
+ # Linux 2.6.32.12 #3810 Wed Nov 6 05:13:41 CST 2013 armv5tel GNU/Linux
+ # Synology DS413 running DSM 4.3-3810-0 (2013-11-06)
+ # CPU model Freescale QorIQ P1022 ppc (e500v2)
+ # linux 2.6.32.12 #3810 ppc GNU/Linux
+ # All development stuff installed with ipkg is in /opt
+ if [ "$LANG" = "" -o "$LANG" = "C" ]; then
+ echo 'Your LANG is safe'
+ else
+ echo 'Please set $LANG to "C". All other $LANG settings will cause havoc' >&4
+ LANG=C
+ fi
+ echo 'Setting up to use /opt/*' >&4
+ locincpth="/opt/include $locincpth"
+ libpth="/opt/lib $libpth"
+ libspth="/opt/lib $libspth"
+ loclibpth="/opt/lib $loclibpth"
+ # POSIX will not link without the pthread lib
+ libswanted="$libswanted pthread"
+ echo "$libswanted" >&4
+fi
# This script UU/usethreads.cbu will get 'called-back' by Configure
# after it has prompted the user for whether to use threads.
@@ -437,7 +514,7 @@ then
DBLIB="$DBDIR/libdb.so"
if [ -f $DBLIB ]
then
- if nm -u $DBLIB | grep pthread >/dev/null
+ if ${nm:-nm} -u $DBLIB 2>/dev/null | grep pthread >/dev/null
then
if ldd $DBLIB | grep pthread >/dev/null
then
diff --git a/patchlevel.h b/patchlevel.h
index cb033ea..1318325 100644
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -137,6 +137,7 @@ static const char * const local_patches[] = {
,"uncommitted-changes"
#endif
PERL_GIT_UNPUSHED_COMMITS /* do not remove this line */
+ ,"Devel::PatchPerl 1.32"
,NULL
};
--
1.9.1

View file

@ -6,15 +6,17 @@ RUN apt-get update \
&& rm -fr /var/lib/apt/lists/*
RUN mkdir /usr/src/perl
COPY DevelPatchPerl.patch /usr/src/perl/
WORKDIR /usr/src/perl
RUN curl -SL https://cpan.metacpan.org/authors/id/R/RJ/RJBS/perl-5.18.4.tar.bz2 -o perl-5.18.4.tar.bz2 \
&& echo '69c34558a0a939a7adbbc1de48c06ea418d81e27 *perl-5.18.4.tar.bz2' | sha1sum -c - \
&& tar --strip-components=1 -xjf perl-5.18.4.tar.bz2 -C /usr/src/perl \
&& rm perl-5.18.4.tar.bz2 \
&& cat DevelPatchPerl.patch | patch -p1 \
&& ./Configure -Duse64bitall -A ccflags=-fwrapv -des \
&& make -j$(nproc) \
&& TEST_JOBS=$(nproc) make test_harness \
&& make test_harness \
&& make install \
&& cd /usr/src \
&& curl -LO https://raw.githubusercontent.com/miyagawa/cpanminus/master/cpanm \

View file

@ -0,0 +1,62 @@
From 5d5851601cb066f11ce5c132bb40ec63408e5fe2 Mon Sep 17 00:00:00 2001
From: Peter Martini <PeterCMartini@GMail.com>
Date: Wed, 15 Apr 2015 22:36:23 -0400
Subject: [PATCH] tmp
---
hints/linux.sh | 19 ++++++++++++++++++-
patchlevel.h | 1 +
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/hints/linux.sh b/hints/linux.sh
index 956adfc..fb5a46e 100644
--- a/hints/linux.sh
+++ b/hints/linux.sh
@@ -178,6 +178,23 @@ case "$plibpth" in
;;
esac
+# libquadmath is sometimes installed as gcc internal library,
+# so contrary to our usual policy of *not* looking at gcc internal
+# directories we now *do* look at them, in case they contain
+# the quadmath library.
+# XXX This may apply to other gcc internal libraries, if such exist.
+# XXX This could be at Configure level, but then the $gcc is messy.
+case "$usequadmath" in
+"$define")
+ for d in `LANG=C LC_ALL=C $gcc $ccflags $ldflags -print-search-dirs | grep libraries | cut -f2- -d= | tr ':' $trnl | grep 'gcc' | sed -e 's:/$::'`
+ do
+ case `ls $d/*libquadmath*$so* 2>/dev/null` in
+ $d/*libquadmath*$so*) xlibpth="$xlibpth $d" ;;
+ esac
+ done
+ ;;
+esac
+
case "$libc" in
'')
# If you have glibc, then report the version for ./myconfig bug reporting.
@@ -497,7 +514,7 @@ then
DBLIB="$DBDIR/libdb.so"
if [ -f $DBLIB ]
then
- if ${nm:-nm} -u $DBLIB | grep pthread >/dev/null
+ if ${nm:-nm} -u $DBLIB 2>/dev/null | grep pthread >/dev/null
then
if ldd $DBLIB | grep pthread >/dev/null
then
diff --git a/patchlevel.h b/patchlevel.h
index 07e1217..8016ec8 100644
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -137,6 +137,7 @@ static const char * const local_patches[] = {
,"uncommitted-changes"
#endif
PERL_GIT_UNPUSHED_COMMITS /* do not remove this line */
+ ,"Devel::PatchPerl 1.32"
,NULL
};
--
1.9.1

View file

@ -6,15 +6,17 @@ RUN apt-get update \
&& rm -fr /var/lib/apt/lists/*
RUN mkdir /usr/src/perl
COPY DevelPatchPerl.patch /usr/src/perl/
WORKDIR /usr/src/perl
RUN curl -SL https://cpan.metacpan.org/authors/id/S/SH/SHAY/perl-5.20.2.tar.bz2 -o perl-5.20.2.tar.bz2 \
&& echo '63126c683b4c79c35008a47d56f7beae876c569f *perl-5.20.2.tar.bz2' | sha1sum -c - \
&& tar --strip-components=1 -xjf perl-5.20.2.tar.bz2 -C /usr/src/perl \
&& rm perl-5.20.2.tar.bz2 \
&& cat DevelPatchPerl.patch | patch -p1 \
&& ./Configure -Dusethreads -Duse64bitall -des \
&& make -j$(nproc) \
&& TEST_JOBS=$(nproc) make test_harness \
&& make test_harness \
&& make install \
&& cd /usr/src \
&& curl -LO https://raw.githubusercontent.com/miyagawa/cpanminus/master/cpanm \

View file

@ -0,0 +1,62 @@
From 5d5851601cb066f11ce5c132bb40ec63408e5fe2 Mon Sep 17 00:00:00 2001
From: Peter Martini <PeterCMartini@GMail.com>
Date: Wed, 15 Apr 2015 22:36:23 -0400
Subject: [PATCH] tmp
---
hints/linux.sh | 19 ++++++++++++++++++-
patchlevel.h | 1 +
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/hints/linux.sh b/hints/linux.sh
index 956adfc..fb5a46e 100644
--- a/hints/linux.sh
+++ b/hints/linux.sh
@@ -178,6 +178,23 @@ case "$plibpth" in
;;
esac
+# libquadmath is sometimes installed as gcc internal library,
+# so contrary to our usual policy of *not* looking at gcc internal
+# directories we now *do* look at them, in case they contain
+# the quadmath library.
+# XXX This may apply to other gcc internal libraries, if such exist.
+# XXX This could be at Configure level, but then the $gcc is messy.
+case "$usequadmath" in
+"$define")
+ for d in `LANG=C LC_ALL=C $gcc $ccflags $ldflags -print-search-dirs | grep libraries | cut -f2- -d= | tr ':' $trnl | grep 'gcc' | sed -e 's:/$::'`
+ do
+ case `ls $d/*libquadmath*$so* 2>/dev/null` in
+ $d/*libquadmath*$so*) xlibpth="$xlibpth $d" ;;
+ esac
+ done
+ ;;
+esac
+
case "$libc" in
'')
# If you have glibc, then report the version for ./myconfig bug reporting.
@@ -497,7 +514,7 @@ then
DBLIB="$DBDIR/libdb.so"
if [ -f $DBLIB ]
then
- if ${nm:-nm} -u $DBLIB | grep pthread >/dev/null
+ if ${nm:-nm} -u $DBLIB 2>/dev/null | grep pthread >/dev/null
then
if ldd $DBLIB | grep pthread >/dev/null
then
diff --git a/patchlevel.h b/patchlevel.h
index 07e1217..8016ec8 100644
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -137,6 +137,7 @@ static const char * const local_patches[] = {
,"uncommitted-changes"
#endif
PERL_GIT_UNPUSHED_COMMITS /* do not remove this line */
+ ,"Devel::PatchPerl 1.32"
,NULL
};
--
1.9.1

View file

@ -6,15 +6,17 @@ RUN apt-get update \
&& rm -fr /var/lib/apt/lists/*
RUN mkdir /usr/src/perl
COPY DevelPatchPerl.patch /usr/src/perl/
WORKDIR /usr/src/perl
RUN curl -SL https://cpan.metacpan.org/authors/id/S/SH/SHAY/perl-5.20.2.tar.bz2 -o perl-5.20.2.tar.bz2 \
&& echo '63126c683b4c79c35008a47d56f7beae876c569f *perl-5.20.2.tar.bz2' | sha1sum -c - \
&& tar --strip-components=1 -xjf perl-5.20.2.tar.bz2 -C /usr/src/perl \
&& rm perl-5.20.2.tar.bz2 \
&& cat DevelPatchPerl.patch | patch -p1 \
&& ./Configure -Duse64bitall -des \
&& make -j$(nproc) \
&& TEST_JOBS=$(nproc) make test_harness \
&& make test_harness \
&& make install \
&& cd /usr/src \
&& curl -LO https://raw.githubusercontent.com/miyagawa/cpanminus/master/cpanm \

View file

@ -1,4 +1,28 @@
releases:
- version: 5.8.9
sha1: 19843b5a7585cf35d96c07dbcd419bbdd5813617
pause: NWCLARK
extra_flags: "-A ccflags=-fwrapv"
test_parallel: no
- version: 5.10.1
sha1: 98b762b5cd4fb76dd354dfa5ba0d21bc2acacaf2
pause: DAPM
extra_flags: "-A ccflags=-fwrapv"
test_parallel: no
- version: 5.12.5
sha1: 812139ceef512eb8458af29ffbf46d78ef26c12a
pause: DOM
extra_flags: "-A ccflags=-fwrapv"
test_parallel: no
- version: 5.14.4
sha1: 3527c9e26f985cba98796439bf555fde8be73cdf
pause: DAPM
extra_flags: "-A ccflags=-fwrapv"
test_parallel: no
- version: 5.16.3
sha1: 060bc17cf9f142d043f9bf7b861422ec624875ea
pause: RJBS
@ -9,7 +33,9 @@ releases:
sha1: 69c34558a0a939a7adbbc1de48c06ea418d81e27
pause: RJBS
extra_flags: "-A ccflags=-fwrapv"
test_parallel: no
- version: 5.20.2
sha1: 63126c683b4c79c35008a47d56f7beae876c569f
pause: SHAY
test_parallel: no

View file

@ -3,6 +3,8 @@ use v5.14;
use strict;
use warnings;
use YAML::XS;
use Devel::PatchPerl;
use LWP::Simple;
sub die_with_sample {
die <<EOF;
@ -42,8 +44,45 @@ my %builds = (
die_with_sample unless defined $yaml->{releases};
die_with_sample unless ref $yaml->{releases} eq "ARRAY";
if (! -d "downloads") {
mkdir "downloads" or die "Couldn't create a downloads directory";
}
for my $release (@{$yaml->{releases}}) {
do { die_with_sample unless $release->{$_}} for (qw(version pause sha1));
die "Bad version: $release->{version}" unless $release->{version} =~ /\A5\.\d+\.\d+\Z/;
my $patch;
my $file = "perl-$release->{version}.tar.bz2";
my $url = "http://www.cpan.org/src/5.0/$file";
if (-f "downloads/$file" &&
`sha1sum downloads/$file` =~ /^\Q$release->{sha1}\E\s+\Qdownloads\/$file\E/) {
print "Skipping download of $file, already current\n";
} else {
print "Downloading $url\n";
getstore($url, "downloads/$file");
}
{
my $dir = "downloads/perl-$release->{version}";
qx{rm -fR $dir};
mkdir $dir or die "Couldn't create $dir";
qx{
tar -C "downloads" -jxf $dir.tar.bz2 &&\
cd $dir &&\
find . -exec chmod u+w {} + &&\
git init &&\
git add . &&\
git commit -m tmp
};
die "Couldn't create a temp git repo for $release->{version}" if $? != 0;
Devel::PatchPerl->patch_source($release->{version}, $dir);
$patch = qx{
cd $dir && git commit -am tmp >/dev/null 2>/dev/null && git format-patch -1 --stdout
};
die "Couldn't create a Devel::PatchPerl patch for $release->{version}" if $? != 0;
}
$release->{pause} =~ s#(((.).).*)#$3/$2/$1#;
$release->{extra_flags} = "" unless defined $release->{extra_flags};
@ -58,14 +97,10 @@ for my $release (@{$yaml->{releases}}) {
mkdir $dir unless -d $dir;
# glob switches behavior in scalar context, so force an intermediate
# list context so we can get the count
if (() = glob "$dir/*.patch") {
$output =~ s#{{copy_patches}}#COPY *.patch /usr/src/perl/#;
$output =~ s#{{apply_patches}}#cat *.patch | patch -p1#;
} else {
$output =~ s/{{copy_patches}}\n//mg;
$output =~ s/.*{{apply_patches}}.*\n//mg;
# Set up the generated DevelPatchPerl.patch
{
open(my $fh, ">$dir/DevelPatchPerl.patch");
print $fh $patch;
}
if (defined $release->{test_parallel} && $release->{test_parallel} eq "no") {
@ -152,14 +187,14 @@ RUN apt-get update \
&& rm -fr /var/lib/apt/lists/*
RUN mkdir /usr/src/perl
{{copy_patches}}
COPY DevelPatchPerl.patch /usr/src/perl/
WORKDIR /usr/src/perl
RUN curl -SL https://cpan.metacpan.org/authors/id/{{pause}}/perl-{{version}}.tar.bz2 -o perl-{{version}}.tar.bz2 \
&& echo '{{sha1}} *perl-{{version}}.tar.bz2' | sha1sum -c - \
&& tar --strip-components=1 -xjf perl-{{version}}.tar.bz2 -C /usr/src/perl \
&& rm perl-{{version}}.tar.bz2 \
&& {{apply_patches}} \
&& cat DevelPatchPerl.patch | patch -p1 \
&& ./Configure {{args}} {{extra_flags}} -des \
&& make -j$(nproc) \
&& {{test}} \