~ubuntu-branches/ubuntu/trusty/libapache2-mod-perl2/trusty

« back to all changes in this revision

Viewing changes to debian/patches/250-lfs-perl-5.14.patch

  • Committer: Package Import Robot
  • Author(s): Dominic Hargreaves
  • Date: 2011-11-13 15:14:12 UTC
  • Revision ID: package-import@ubuntu.com-20111113151412-49phtwx0h1diute2
Tags: 2.0.5-4
* Add patch from upstream svn adopting the Perl_sv_dup() changes in
  Perl 5.14
* Don't strip LFS CFLAGS in lib/Apache2/Build.pm any more
  (Closes: #636651)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Description: Don't strip LFS CFLAGS any more
 
2
 
 
3
From Niko's message
 
4
<http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=636651#34>:
 
5
 
 
6
"The mod_perl2 2.0.5 test suite works for me with Perl 5.14 if I hardwire
 
7
has_large_files_conflict() to return 0 and apply r1125476 from 2.0.6-dev:
 
8
 http://svn.apache.org/viewvc/perl/modperl/trunk/src/modules/perl/modperl_svptr_table.c?r1=932879&r2=1125476
 
9
 
 
10
The elaborate comments about large file issues in lib/Apache2/Build.pm
 
11
around strip_lfs() seem to be partly outdated; selectively quoting:
 
12
 
 
13
# on Unix systems where by default off_t is a "long", a 32-bit integer,
 
14
# there are two different ways to get "large file" support, i.e. the
 
15
# ability to manipulate files bigger than 2Gb:
 
16
#
 
17
# 1) you compile using -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64.
 
18
[...]
 
19
# 2) you compile using -D_LARGEFILE64_SOURCE
 
20
[...]
 
21
# The problem that mod_perl has to work around is when you take a
 
22
# package built with approach (1), i.e. Perl, and any package which was
 
23
# *not* built with (1), i.e. APR, and want to interface between
 
24
# them. [1]
 
25
[...]
 
26
# Perl built with -Duselargefiles uses approach (1).
 
27
#
 
28
# APR HEAD uses (2) by default.
 
29
[...]
 
30
# [1]: In some cases, it may be OK to interface between packages which
 
31
# use (1) and packages which use (2).  APR HEAD is currently not such a
 
32
# case, since the size of apr_ino_t is still changing when
 
33
# _FILE_OFFSET_BITS is defined.
 
34
 
 
35
The last paragraph dates back to 2004, and the apr changelogs read:
 
36
 
 
37
> Changes for APR 1.2.12
 
38
>   *) Define apr_ino_t in such a way that it doesn't change definition
 
39
>   based on the library consumer's -D'efines to the filesystem.
 
40
>   [Lucian Adrian Grijincu <lucian.grijincu gmail.com>]
 
41
 
 
42
> Changes for APR 1.4.3
 
43
>   *) configure: Make definition of apr_ino_t independent of
 
44
>      _FILE_OFFSET_BITS even on platforms where ino_t is 'unsigned int'.
 
45
>      [Stefan Fritsch]
 
46
 
 
47
To summarize, it looks like Apache2::Build::strip_lfs() breaks with Perl
 
48
5.14 with -Duselargefiles on 32-bit architectures, and is not necessary
 
49
since at least apr 1.4.3, possibly earlier."
 
50
 
 
51
Bug-Debian: http://bugs.debian.org/636651
 
52
 
 
53
diff --git a/lib/Apache2/Build.pm b/lib/Apache2/Build.pm
 
54
index 97e4089..af867b7 100644
 
55
--- a/lib/Apache2/Build.pm
 
56
+++ b/lib/Apache2/Build.pm
 
57
@@ -598,7 +598,12 @@ sub cmp_tuples {
 
58
 sub perl_ccopts {
 
59
     my $self = shift;
 
60
 
 
61
-    my $cflags = $self->strip_lfs(" $Config{ccflags} ");
 
62
+    # Debian has removed the call to strip_lfs (which has itself been
 
63
+    # removed) which removed -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
 
64
+    # from CFLAGS, to fix build failures with perl 5.14 on i386 with
 
65
+    # -Duselargefiles
 
66
+    # <http://bugs.debian.org/636651>
 
67
+    my $cflags = " $Config{ccflags} ";
 
68
 
 
69
     my $fixup = \&{"ccopts_$^O"};
 
70
     if (defined &$fixup) {
 
71
@@ -2077,94 +2082,6 @@ sub inc {
 
72
     "@includes";
 
73
 }
 
74
 
 
75
-### Picking the right LFS support flags for mod_perl, by Joe Orton ###
 
76
-#
 
77
-# on Unix systems where by default off_t is a "long", a 32-bit integer,
 
78
-# there are two different ways to get "large file" support, i.e. the
 
79
-# ability to manipulate files bigger than 2Gb:
 
80
-#
 
81
-# 1) you compile using -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64.  This
 
82
-# makes sys/types.h expose off_t as a "long long", a 64-bit integer, and
 
83
-# changes the size of a few other types too.  The C library headers
 
84
-# automatically arrange to expose a correct implementation of functions
 
85
-# like lseek() which take off_t parameters.
 
86
-#
 
87
-# 2) you compile using -D_LARGEFILE64_SOURCE, and use what is called the
 
88
-# "transitional" interface.  This means that the system headers expose a
 
89
-# new type, "off64_t", which is a long long, but the size of off_t is not
 
90
-# changed.   A bunch of new functions like lseek64() are exposed by the C 
 
91
-# library headers, which take off64_t parameters in place of off_t.
 
92
-#
 
93
-# Perl built with -Duselargefiles uses approach (1).
 
94
-#
 
95
-# APR HEAD uses (2) by default. APR 0.9 does not by default use either
 
96
-# approach, but random users can take a httpd-2.0.49 tarball, and do:
 
97
-#
 
98
-#   export CPPFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
 
99
-#   ./configure
 
100
-#
 
101
-# to build a copy of apr/httpd which uses approach (1), though this
 
102
-# isn't really a supported configuration.
 
103
-#
 
104
-# The problem that mod_perl has to work around is when you take a
 
105
-# package built with approach (1), i.e. Perl, and any package which was
 
106
-# *not* built with (1), i.e. APR, and want to interface between
 
107
-# them. [1]
 
108
-#
 
109
-# So what you want to know is whether APR was built using approach (1)
 
110
-# or not.  APR_HAS_LARGE_FILES in HEAD just tells you whether APR was
 
111
-# built using approach (2) or not, which isn't useful in solving this
 
112
-# problem.
 
113
-#
 
114
-# [1]: In some cases, it may be OK to interface between packages which
 
115
-# use (1) and packages which use (2).  APR HEAD is currently not such a
 
116
-# case, since the size of apr_ino_t is still changing when
 
117
-# _FILE_OFFSET_BITS is defined.
 
118
-#
 
119
-# If you want to see how this matters, get some httpd function to do at
 
120
-# the very beginning of main():
 
121
-#
 
122
-#   printf("sizeof(request_rec) = %lu, sizeof(apr_finfo_t) = %ul",
 
123
-#          sizeof(request_rec), sizeof(apr_finfo_t));
 
124
-#
 
125
-# and then put the same printf in mod_perl somewhere, and see the
 
126
-# differences. This is why it is a really terribly silly idea to ever
 
127
-# use approach (1) in anything other than an entirely self-contained
 
128
-# application.
 
129
-#
 
130
-# there is no conflict if both libraries either have or don't have
 
131
-# large files support enabled
 
132
-sub has_large_files_conflict {
 
133
-    my $self = shift;
 
134
-
 
135
-    my $apxs_flags = join $self->apxs_extra_cflags, $self->apxs_extra_cppflags;
 
136
-    my $apr_lfs64  = $apxs_flags      =~ /-D_FILE_OFFSET_BITS=64/;
 
137
-    my $perl_lfs64 = $Config{ccflags} =~ /-D_FILE_OFFSET_BITS=64/;
 
138
-
 
139
-    # XXX: we don't really deal with the case where APR was built with
 
140
-    # -D_FILE_OFFSET_BITS=64 but perl wasn't, since currently we strip
 
141
-    # only perl's ccflags, not apr's flags. the reason we don't deal
 
142
-    # with it is that we didn't have such a case yet, but may need to
 
143
-    # deal with it later
 
144
-
 
145
-    return $perl_lfs64 ^ $apr_lfs64;
 
146
-}
 
147
-
 
148
-# if perl is built with uselargefiles, but apr not, the build won't
 
149
-# work together as it uses two binary incompatible libraries, so
 
150
-# reduce the functionality to the greatest common denominator (C code
 
151
-# will have to make sure to prevent any operations that may rely on
 
152
-# effects created by uselargefiles, e.g. Off_t=8 instead of Off_t=4)
 
153
-sub strip_lfs {
 
154
-    my ($self, $cflags) = @_;
 
155
-    return $cflags unless $self->has_large_files_conflict();
 
156
-
 
157
-    my $lf = $Config{ccflags_uselargefiles}
 
158
-        || '-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64';
 
159
-    $cflags =~ s/$lf//;
 
160
-    $cflags;
 
161
-}
 
162
-
 
163
 sub define {
 
164
     my $self = shift;
 
165
 
 
166
diff --git a/xs/APR/PerlIO/Makefile.PL b/xs/APR/PerlIO/Makefile.PL
 
167
index 4a8f60d..30b2773 100644
 
168
--- a/xs/APR/PerlIO/Makefile.PL
 
169
+++ b/xs/APR/PerlIO/Makefile.PL
 
170
@@ -8,22 +8,11 @@ my $build = Apache2::Build->build_config();
 
171
 
 
172
 my $ccopts = $build->ccopts;
 
173
 
 
174
-# when uselargefiles is on, -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
 
175
-# are needed to get the right 'Off_t', without which perlio compiled
 
176
-# with Off_t as 'long long int', doesn't quite work with apr_perlio.c
 
177
-# compiled with Off_t as 'long int'
 
178
-#
 
179
-# On the other handl if apr is built without large files support, we
 
180
-# have binary compatibility problems, if we try to build mod_perl with
 
181
-# -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
 
182
-#
 
183
-# XXX: it seems that enabling these flags only for apr_perlio/PerlIO
 
184
-# seems to do the trick
 
185
-if ($build->has_large_files_conflict) {
 
186
-    $ccopts .= $Config{uselargefiles}
 
187
-        ? ' ' . $Config{ccflags_uselargefiles}
 
188
-        : '';
 
189
-}
 
190
+# Debian has removed the call to strip_lfs (which has itself been
 
191
+# removed) which removed -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
 
192
+# from CFLAGS, to fix build failures with perl 5.14 on i386 with
 
193
+# -Duselargefiles
 
194
+# <http://bugs.debian.org/636651>
 
195
 
 
196
 ModPerl::BuildMM::WriteMakefile(
 
197
     NAME         => 'APR::PerlIO',