Skip to content

Commit fccd94a

Browse files
committed
Merge pull request #14 from Perl/allowpatches
Allowpatches
2 parents b1ad374 + a12be2a commit fccd94a

9 files changed

+222
-2
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
From 6f87f404fa51739971a4068da1f11443024f3fc4 Mon Sep 17 00:00:00 2001
2+
From: Andy Dougherty <[email protected]>
3+
Date: Wed, 6 Jun 2012 11:12:58 -0400
4+
Subject: [perl #113024] Configure: Avoid Cppsym warnings for extra tokens
5+
[perl #113024]
6+
7+
The cppsymbols can include macros such as __INT16_C(c), which can't
8+
be tested with a simple #ifdef. This patch strips off the opening
9+
parenthesis and everything following it. These macros were generated
10+
by cpp -dM.
11+
12+
Also ensure Cppsym.true list is sorted for later input to comm.
13+
(I noticed this while testing this change on Solaris.)
14+
---
15+
Configure | 5 +++--
16+
1 file changed, 3 insertions(+), 2 deletions(-)
17+
18+
diff --git a/Configure b/Configure
19+
index a780b81..3ae16ca 100755
20+
--- a/Configure
21+
+++ b/Configure
22+
@@ -21936,15 +21936,16 @@ $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $r
23+
EOSH
24+
chmod +x Cppsym.try
25+
$eunicefix Cppsym.try
26+
-./Cppsym < Cppsym.know > Cppsym.true
27+
+./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
28+
: Add in any linux cpp "predefined macros":
29+
case "$osname::$gccversion" in
30+
*linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
31+
tHdrH=_tmpHdr
32+
rm -f $tHdrH'.h' $tHdrH
33+
touch $tHdrH'.h'
34+
+ # Filter out macro arguments, such as Linux's __INT8_C(c)
35+
if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
36+
- sed 's/#define[\ \ ]*//;s/[\ \ ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
37+
+ sed -e 's/#define[\ \ ]*//;s/[\ \ ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
38+
if [ -s $tHdrH'_cppsym.real' ]; then
39+
cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
40+
fi
41+
--
42+
2.1.4
43+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This should be auto-generated; for now, it's not,
2+
# simply because it should be generated before the build,
3+
# which means having the appropriate version's patchlevel.h
4+
# available, which I don't want to bake into the fetch just
5+
# yet.
6+
7+
--- a/patchlevel.h
8+
+++ b/patchlevel.h
9+
@@ -135,0 +136 @@
10+
+ ,"Backport of perl5 git 6f87f404fa51739971a4068da1f11443024f3fc4"

5.016.003-64bit,threaded/Dockerfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
FROM buildpack-deps
2+
MAINTAINER Peter Martini <[email protected]>
3+
4+
RUN apt-get update \
5+
&& apt-get install -y curl procps \
6+
&& rm -fr /var/lib/apt/lists/*
7+
8+
RUN mkdir /usr/src/perl
9+
COPY *.patch /usr/src/perl/
10+
WORKDIR /usr/src/perl
11+
12+
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 \
13+
&& echo '060bc17cf9f142d043f9bf7b861422ec624875ea *perl-5.16.3.tar.bz2' | sha1sum -c - \
14+
&& tar --strip-components=1 -xjf perl-5.16.3.tar.bz2 -C /usr/src/perl \
15+
&& rm perl-5.16.3.tar.bz2 \
16+
&& cat *.patch | patch -p1 \
17+
&& ./Configure -Dusethreads -Duse64bitall -A ccflags=-fwrapv -des \
18+
&& make -j$(nproc) \
19+
&& make test_harness \
20+
&& make install \
21+
&& cd /usr/src \
22+
&& curl -LO https://raw.githubusercontent.com/miyagawa/cpanminus/master/cpanm \
23+
&& chmod +x cpanm \
24+
&& ./cpanm App::cpanminus \
25+
&& rm -fr ./cpanm /root/.cpanm /usr/src/perl
26+
27+
WORKDIR /root
28+
29+
CMD ["perl5.16.3","-de0"]
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
From 6f87f404fa51739971a4068da1f11443024f3fc4 Mon Sep 17 00:00:00 2001
2+
From: Andy Dougherty <[email protected]>
3+
Date: Wed, 6 Jun 2012 11:12:58 -0400
4+
Subject: [perl #113024] Configure: Avoid Cppsym warnings for extra tokens
5+
[perl #113024]
6+
7+
The cppsymbols can include macros such as __INT16_C(c), which can't
8+
be tested with a simple #ifdef. This patch strips off the opening
9+
parenthesis and everything following it. These macros were generated
10+
by cpp -dM.
11+
12+
Also ensure Cppsym.true list is sorted for later input to comm.
13+
(I noticed this while testing this change on Solaris.)
14+
---
15+
Configure | 5 +++--
16+
1 file changed, 3 insertions(+), 2 deletions(-)
17+
18+
diff --git a/Configure b/Configure
19+
index a780b81..3ae16ca 100755
20+
--- a/Configure
21+
+++ b/Configure
22+
@@ -21936,15 +21936,16 @@ $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $r
23+
EOSH
24+
chmod +x Cppsym.try
25+
$eunicefix Cppsym.try
26+
-./Cppsym < Cppsym.know > Cppsym.true
27+
+./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
28+
: Add in any linux cpp "predefined macros":
29+
case "$osname::$gccversion" in
30+
*linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
31+
tHdrH=_tmpHdr
32+
rm -f $tHdrH'.h' $tHdrH
33+
touch $tHdrH'.h'
34+
+ # Filter out macro arguments, such as Linux's __INT8_C(c)
35+
if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
36+
- sed 's/#define[\ \ ]*//;s/[\ \ ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
37+
+ sed -e 's/#define[\ \ ]*//;s/[\ \ ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
38+
if [ -s $tHdrH'_cppsym.real' ]; then
39+
cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
40+
fi
41+
--
42+
2.1.4
43+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This should be auto-generated; for now, it's not,
2+
# simply because it should be generated before the build,
3+
# which means having the appropriate version's patchlevel.h
4+
# available, which I don't want to bake into the fetch just
5+
# yet.
6+
7+
--- a/patchlevel.h
8+
+++ b/patchlevel.h
9+
@@ -135,0 +136 @@
10+
+ ,"Backport of perl5 git 6f87f404fa51739971a4068da1f11443024f3fc4"

5.016.003-64bit/Dockerfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
FROM buildpack-deps
2+
MAINTAINER Peter Martini <[email protected]>
3+
4+
RUN apt-get update \
5+
&& apt-get install -y curl procps \
6+
&& rm -fr /var/lib/apt/lists/*
7+
8+
RUN mkdir /usr/src/perl
9+
COPY *.patch /usr/src/perl/
10+
WORKDIR /usr/src/perl
11+
12+
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 \
13+
&& echo '060bc17cf9f142d043f9bf7b861422ec624875ea *perl-5.16.3.tar.bz2' | sha1sum -c - \
14+
&& tar --strip-components=1 -xjf perl-5.16.3.tar.bz2 -C /usr/src/perl \
15+
&& rm perl-5.16.3.tar.bz2 \
16+
&& cat *.patch | patch -p1 \
17+
&& ./Configure -Duse64bitall -A ccflags=-fwrapv -des \
18+
&& make -j$(nproc) \
19+
&& make test_harness \
20+
&& make install \
21+
&& cd /usr/src \
22+
&& curl -LO https://raw.githubusercontent.com/miyagawa/cpanminus/master/cpanm \
23+
&& chmod +x cpanm \
24+
&& ./cpanm App::cpanminus \
25+
&& rm -fr ./cpanm /root/.cpanm /usr/src/perl
26+
27+
WORKDIR /root
28+
29+
CMD ["perl5.16.3","-de0"]

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,9 @@ The 64bit builds specify use64bitall despite this being largely redundant
1919

2020
The individual Dockerfiles are generated via 'generate.pl', which uses
2121
Releases.yaml to populate the individual files.
22+
23+
For older versions of Perl, some patches may be necessary to build properly on
24+
a current base OS. In those cases, perl -V will show the locally applied patches.
25+
These changes should be limited to Configure rather than to code itself, and
26+
will be a cherry pick or back port of a patch from the mainline perl branch
27+
whenever possible.

Releases.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
releases:
2+
- version: 5.16.3
3+
sha1: 060bc17cf9f142d043f9bf7b861422ec624875ea
4+
pause: RJBS
5+
extra_flags: "-A ccflags=-fwrapv"
6+
test_parallel: no
7+
28
- version: 5.18.4
39
sha1: 69c34558a0a939a7adbbc1de48c06ea418d81e27
410
pause: RJBS

generate.pl

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,26 @@ sub die_with_sample {
5656
($release->{version} =~ /(\d+)\.(\d+)\.(\d+)/),
5757
$config;
5858

59+
mkdir $dir unless -d $dir;
60+
61+
# glob switches behavior in scalar context, so force an intermediate
62+
# list context so we can get the count
63+
if (() = glob "$dir/*.patch") {
64+
$output =~ s#{{copy_patches}}#COPY *.patch /usr/src/perl/#;
65+
$output =~ s#{{apply_patches}}#cat *.patch | patch -p1#;
66+
} else {
67+
$output =~ s/{{copy_patches}}\n//mg;
68+
$output =~ s/.*{{apply_patches}}.*\n//mg;
69+
}
70+
71+
if (defined $release->{test_parallel} && $release->{test_parallel} eq "no") {
72+
$output =~ s/{{test}}/make test_harness/;
73+
} elsif (!defined $release->{test_parallel} || $release->{test_parallel} eq "yes") {
74+
$output =~ s/{{test}}/TEST_JOBS=\$(nproc) make test_harness/;
75+
} else {
76+
die "test_parallel was provided for $release->{version} but is invalid; should be 'yes' or 'no'\n";
77+
}
78+
5979
open my $dockerfile, ">$dir/Dockerfile" or die "Couldn't open $dir/Dockerfile for writing";
6080
print $dockerfile $output;
6181
close $dockerfile;
@@ -80,6 +100,10 @@ =head1 DESCRIPTION
80100
81101
=over 4
82102
103+
=item REQUIRED
104+
105+
=over 4
106+
83107
=item version
84108
85109
The actual perl version, such as B<5.20.1>.
@@ -92,11 +116,29 @@ =head1 DESCRIPTION
92116
93117
The PAUSE (CPAN user) account that the release was uploaded to.
94118
95-
=item (optionally) extra_args
119+
=back
120+
121+
=item OPTIONAL
122+
123+
=over 4
124+
125+
=item extra_args
96126
97127
Additional text to pass to C<Configure>. At the moment, this is necessary for
98128
5.18.x so that it can get the C<-fwrapv> flag.
99129
130+
Default: C<"">
131+
132+
=item test_parallel
133+
134+
This can be either 'no', 'yes', or unspecified (equivalent to 'yes').
135+
Added due to dist/IO/t/io_unix.t failing when TEST_JOBS > 1, but should
136+
only be used in case of a documented issue.
137+
138+
Default: C<yes>
139+
140+
=back
141+
100142
=back
101143
102144
=cut
@@ -110,15 +152,17 @@ =head1 DESCRIPTION
110152
&& rm -fr /var/lib/apt/lists/*
111153
112154
RUN mkdir /usr/src/perl
155+
{{copy_patches}}
113156
WORKDIR /usr/src/perl
114157
115158
RUN curl -SL https://cpan.metacpan.org/authors/id/{{pause}}/perl-{{version}}.tar.bz2 -o perl-{{version}}.tar.bz2 \
116159
&& echo '{{sha1}} *perl-{{version}}.tar.bz2' | sha1sum -c - \
117160
&& tar --strip-components=1 -xjf perl-{{version}}.tar.bz2 -C /usr/src/perl \
118161
&& rm perl-{{version}}.tar.bz2 \
162+
&& {{apply_patches}} \
119163
&& ./Configure {{args}} {{extra_flags}} -des \
120164
&& make -j$(nproc) \
121-
&& TEST_JOBS=$(nproc) make test_harness \
165+
&& {{test}} \
122166
&& make install \
123167
&& cd /usr/src \
124168
&& curl -LO https://raw.githubusercontent.com/miyagawa/cpanminus/master/cpanm \

0 commit comments

Comments
 (0)