line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package ExtUtils::MM_Unix; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
require 5.006; |
4
|
|
|
|
|
|
|
|
5
|
52
|
|
|
52
|
|
21759
|
use strict; |
|
52
|
|
|
|
|
110
|
|
|
52
|
|
|
|
|
1591
|
|
6
|
52
|
|
|
52
|
|
263
|
use warnings; |
|
52
|
|
|
|
|
99
|
|
|
52
|
|
|
|
|
1421
|
|
7
|
|
|
|
|
|
|
|
8
|
52
|
|
|
52
|
|
281
|
use Carp; |
|
52
|
|
|
|
|
101
|
|
|
52
|
|
|
|
|
2739
|
|
9
|
52
|
|
|
52
|
|
740
|
use ExtUtils::MakeMaker::Config; |
|
52
|
|
|
|
|
122
|
|
|
52
|
|
|
|
|
371
|
|
10
|
52
|
|
|
52
|
|
306
|
use File::Basename qw(basename dirname); |
|
52
|
|
|
|
|
112
|
|
|
52
|
|
|
|
|
4952
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our %Config_Override; |
13
|
|
|
|
|
|
|
|
14
|
52
|
|
|
52
|
|
1253
|
use ExtUtils::MakeMaker qw($Verbose neatvalue _sprintf562); |
|
52
|
|
|
|
|
114
|
|
|
52
|
|
|
|
|
24969
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# If $VERSION is in scope, parse_version() breaks |
17
|
|
|
|
|
|
|
{ |
18
|
|
|
|
|
|
|
our $VERSION = '7.70'; |
19
|
|
|
|
|
|
|
$VERSION =~ tr/_//d; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
require ExtUtils::MM_Any; |
23
|
|
|
|
|
|
|
our @ISA = qw(ExtUtils::MM_Any); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my %Is; |
26
|
|
|
|
|
|
|
BEGIN { |
27
|
52
|
|
|
52
|
|
407
|
$Is{OS2} = $^O eq 'os2'; |
28
|
52
|
|
33
|
|
|
621
|
$Is{Win32} = $^O eq 'MSWin32' || $Config{osname} eq 'NetWare'; |
29
|
52
|
|
|
|
|
167
|
$Is{Dos} = $^O eq 'dos'; |
30
|
52
|
|
|
|
|
163
|
$Is{VMS} = $^O eq 'VMS'; |
31
|
52
|
|
|
|
|
161
|
$Is{OSF} = $^O eq 'dec_osf'; |
32
|
52
|
|
|
|
|
135
|
$Is{IRIX} = $^O eq 'irix'; |
33
|
52
|
|
|
|
|
170
|
$Is{NetBSD} = $^O eq 'netbsd'; |
34
|
52
|
|
|
|
|
190
|
$Is{Interix} = $^O eq 'interix'; |
35
|
52
|
|
|
|
|
143
|
$Is{SunOS4} = $^O eq 'sunos'; |
36
|
52
|
|
|
|
|
115
|
$Is{Solaris} = $^O eq 'solaris'; |
37
|
52
|
|
33
|
|
|
398
|
$Is{SunOS} = $Is{SunOS4} || $Is{Solaris}; |
38
|
52
|
|
33
|
|
|
489
|
$Is{BSD} = ($^O =~ /^(?:free|midnight|net|open)bsd$/ or |
39
|
|
|
|
|
|
|
grep( $^O eq $_, qw(bsdos interix dragonfly) ) |
40
|
|
|
|
|
|
|
); |
41
|
52
|
|
|
|
|
158
|
$Is{Android} = $^O =~ /android/; |
42
|
52
|
50
|
|
|
|
2853
|
if ( $^O eq 'darwin' ) { |
43
|
0
|
|
|
|
|
0
|
my @osvers = split /\./, $Config{osvers}; |
44
|
0
|
0
|
|
|
|
0
|
if ( $^X eq '/usr/bin/perl' ) { |
45
|
0
|
|
|
|
|
0
|
$Is{ApplCor} = ( $osvers[0] >= 18 ); |
46
|
|
|
|
|
|
|
} |
47
|
0
|
|
|
|
|
0
|
$Is{AppleRPath} = ( $osvers[0] >= 9 ); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
BEGIN { |
52
|
52
|
50
|
|
52
|
|
321033
|
if( $Is{VMS} ) { |
53
|
|
|
|
|
|
|
# For things like vmsify() |
54
|
0
|
|
|
|
|
0
|
require VMS::Filespec; |
55
|
0
|
|
|
|
|
0
|
VMS::Filespec->import; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 NAME |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
ExtUtils::MM_Unix - methods used by ExtUtils::MakeMaker |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 SYNOPSIS |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
require ExtUtils::MM_Unix; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 DESCRIPTION |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
The methods provided by this package are designed to be used in |
71
|
|
|
|
|
|
|
conjunction with L<ExtUtils::MakeMaker>. When MakeMaker writes a |
72
|
|
|
|
|
|
|
Makefile, it creates one or more objects that inherit their methods |
73
|
|
|
|
|
|
|
from a package L<MM|ExtUtils::MM>. MM itself doesn't provide any methods, but |
74
|
|
|
|
|
|
|
it ISA ExtUtils::MM_Unix class. The inheritance tree of MM lets operating |
75
|
|
|
|
|
|
|
specific packages take the responsibility for all the methods provided |
76
|
|
|
|
|
|
|
by MM_Unix. We are trying to reduce the number of the necessary |
77
|
|
|
|
|
|
|
overrides by defining rather primitive operations within |
78
|
|
|
|
|
|
|
ExtUtils::MM_Unix. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
If you are going to write a platform specific MM package, please try |
81
|
|
|
|
|
|
|
to limit the necessary overrides to primitive methods, and if it is not |
82
|
|
|
|
|
|
|
possible to do so, let's work out how to achieve that gain. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
If you are overriding any of these methods in your Makefile.PL (in the |
85
|
|
|
|
|
|
|
MY class), please report that to the makemaker mailing list. We are |
86
|
|
|
|
|
|
|
trying to minimize the necessary method overrides and switch to data |
87
|
|
|
|
|
|
|
driven Makefile.PLs wherever possible. In the long run less methods |
88
|
|
|
|
|
|
|
will be overridable via the MY class. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 METHODS |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
The following description of methods is still under |
93
|
|
|
|
|
|
|
development. Please refer to the code for not suitably documented |
94
|
|
|
|
|
|
|
sections and complain loudly to the makemaker@perl.org mailing list. |
95
|
|
|
|
|
|
|
Better yet, provide a patch. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Not all of the methods below are overridable in a |
98
|
|
|
|
|
|
|
Makefile.PL. Overridable methods are marked as (o). All methods are |
99
|
|
|
|
|
|
|
overridable by a platform specific MM_*.pm file. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Cross-platform methods are being moved into L<MM_Any|ExtUtils::MM_Any>. |
102
|
|
|
|
|
|
|
If you can't find something that used to be in here, look in MM_Any. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=cut |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
# So we don't have to keep calling the methods over and over again, |
107
|
|
|
|
|
|
|
# we have these globals to cache the values. Faster and shrtr. |
108
|
|
|
|
|
|
|
my $Curdir = __PACKAGE__->curdir; |
109
|
|
|
|
|
|
|
my $Updir = __PACKAGE__->updir; |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head2 Methods |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=over 4 |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=item os_flavor |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Simply says that we're Unix. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=cut |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub os_flavor { |
123
|
223
|
|
|
223
|
1
|
2828
|
return('Unix'); |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=item c_o (o) |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Defines the suffix rules to compile different flavors of C files to |
130
|
|
|
|
|
|
|
object files. |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=cut |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
sub c_o { |
135
|
|
|
|
|
|
|
# --- Translation Sections --- |
136
|
|
|
|
|
|
|
|
137
|
154
|
|
|
154
|
1
|
458
|
my($self) = shift; |
138
|
154
|
50
|
|
|
|
509
|
return '' unless $self->needs_linking(); |
139
|
0
|
|
|
|
|
0
|
my(@m); |
140
|
|
|
|
|
|
|
|
141
|
0
|
|
|
|
|
0
|
my $command = '$(CCCMD)'; |
142
|
0
|
|
|
|
|
0
|
my $flags = '$(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE)'; |
143
|
|
|
|
|
|
|
|
144
|
0
|
0
|
|
|
|
0
|
if ( $Is{ApplCor} ) { |
145
|
0
|
|
|
|
|
0
|
$flags =~ s/"-I(\$\(PERL_INC\))"/-iwithsysroot "$1"/; |
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
|
148
|
0
|
0
|
|
|
|
0
|
if (my $cpp = $self->{CPPRUN}) { |
149
|
0
|
|
|
|
|
0
|
my $cpp_cmd = $self->const_cccmd; |
150
|
0
|
|
|
|
|
0
|
$cpp_cmd =~ s/^CCCMD\s*=\s*\$\(CC\)/\$(CPPRUN)/; |
151
|
0
|
|
|
|
|
0
|
push @m, qq{ |
152
|
|
|
|
|
|
|
.c.i: |
153
|
|
|
|
|
|
|
$cpp_cmd $flags \$*.c > \$*.i |
154
|
|
|
|
|
|
|
}; |
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
|
157
|
0
|
0
|
|
|
|
0
|
my $m_o = $self->{XSMULTI} ? $self->xs_obj_opt('$*.s') : ''; |
158
|
0
|
|
|
|
|
0
|
push @m, sprintf <<'EOF', $command, $flags, $m_o; |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
.c.s : |
161
|
|
|
|
|
|
|
%s -S %s $*.c %s |
162
|
|
|
|
|
|
|
EOF |
163
|
|
|
|
|
|
|
|
164
|
0
|
|
|
|
|
0
|
my @exts = qw(c cpp cxx cc); |
165
|
0
|
0
|
0
|
|
|
0
|
push @exts, 'C' if !$Is{OS2} and !$Is{Win32} and !$Is{Dos}; #Case-specific |
|
|
|
0
|
|
|
|
|
166
|
0
|
0
|
|
|
|
0
|
$m_o = $self->{XSMULTI} ? $self->xs_obj_opt('$*$(OBJ_EXT)') : ''; |
167
|
0
|
|
|
|
|
0
|
my $dbgout = $self->dbgoutflag; |
168
|
0
|
|
|
|
|
0
|
for my $ext (@exts) { |
169
|
0
|
0
|
|
|
|
0
|
push @m, "\n.$ext\$(OBJ_EXT) :\n\t$command $flags " |
|
|
0
|
|
|
|
|
|
170
|
|
|
|
|
|
|
.($dbgout?"$dbgout ":'') |
171
|
|
|
|
|
|
|
."\$*.$ext" . ( $m_o ? " $m_o" : '' ) . "\n"; |
172
|
|
|
|
|
|
|
} |
173
|
0
|
|
|
|
|
0
|
return join "", @m; |
174
|
|
|
|
|
|
|
} |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=item xs_obj_opt |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
Takes the object file as an argument, and returns the portion of compile |
180
|
|
|
|
|
|
|
command-line that will output to the specified object file. |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=cut |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
sub xs_obj_opt { |
185
|
0
|
|
|
0
|
1
|
0
|
my ($self, $output_file) = @_; |
186
|
0
|
|
|
|
|
0
|
"-o $output_file"; |
187
|
|
|
|
|
|
|
} |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=item dbgoutflag |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
Returns a CC flag that tells the CC to emit a separate debugging symbol file |
192
|
|
|
|
|
|
|
when compiling an object file. |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=cut |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
sub dbgoutflag { |
197
|
0
|
|
|
0
|
1
|
0
|
''; |
198
|
|
|
|
|
|
|
} |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=item cflags (o) |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
Does very much the same as the cflags script in the perl |
203
|
|
|
|
|
|
|
distribution. It doesn't return the whole compiler command line, but |
204
|
|
|
|
|
|
|
initializes all of its parts. The const_cccmd method then actually |
205
|
|
|
|
|
|
|
returns the definition of the CCCMD macro which uses these parts. |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=cut |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
#' |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
sub cflags { |
212
|
155
|
|
|
155
|
1
|
934
|
my($self,$libperl)=@_; |
213
|
155
|
50
|
|
|
|
635
|
return $self->{CFLAGS} if $self->{CFLAGS}; |
214
|
155
|
100
|
|
|
|
431
|
return '' unless $self->needs_linking(); |
215
|
|
|
|
|
|
|
|
216
|
1
|
|
|
|
|
3
|
my($prog, $uc, $perltype, %cflags); |
217
|
1
|
|
33
|
|
|
8
|
$libperl ||= $self->{LIBPERL_A} || "libperl$self->{LIB_EXT}" ; |
|
|
|
33
|
|
|
|
|
218
|
1
|
|
|
|
|
5
|
$libperl =~ s/\.\$\(A\)$/$self->{LIB_EXT}/; |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
@cflags{qw(cc ccflags optimize shellflags)} |
221
|
1
|
|
|
|
|
8
|
= @Config{qw(cc ccflags optimize shellflags)}; |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
# Perl 5.21.4 adds the (gcc) warning (-Wall ...) and std (-std=c89) |
224
|
|
|
|
|
|
|
# flags to the %Config, and the modules in the core should be built |
225
|
|
|
|
|
|
|
# with the warning flags, but NOT the -std=c89 flags (the latter |
226
|
|
|
|
|
|
|
# would break using any system header files that are strict C99). |
227
|
1
|
|
|
|
|
3
|
my @ccextraflags = qw(ccwarnflags); |
228
|
1
|
50
|
|
|
|
4
|
if ($ENV{PERL_CORE}) { |
229
|
0
|
|
|
|
|
0
|
for my $x (@ccextraflags) { |
230
|
0
|
0
|
|
|
|
0
|
if (exists $Config{$x}) { |
231
|
0
|
|
|
|
|
0
|
$cflags{$x} = $Config{$x}; |
232
|
|
|
|
|
|
|
} |
233
|
|
|
|
|
|
|
} |
234
|
|
|
|
|
|
|
} |
235
|
|
|
|
|
|
|
|
236
|
1
|
|
|
|
|
2
|
my($optdebug) = ""; |
237
|
|
|
|
|
|
|
|
238
|
1
|
|
50
|
|
|
7
|
$cflags{shellflags} ||= ''; |
239
|
|
|
|
|
|
|
|
240
|
1
|
|
|
|
|
8
|
my(%map) = ( |
241
|
|
|
|
|
|
|
D => '-DDEBUGGING', |
242
|
|
|
|
|
|
|
E => '-DEMBED', |
243
|
|
|
|
|
|
|
DE => '-DDEBUGGING -DEMBED', |
244
|
|
|
|
|
|
|
M => '-DEMBED -DMULTIPLICITY', |
245
|
|
|
|
|
|
|
DM => '-DDEBUGGING -DEMBED -DMULTIPLICITY', |
246
|
|
|
|
|
|
|
); |
247
|
|
|
|
|
|
|
|
248
|
1
|
50
|
|
|
|
23
|
if ($libperl =~ /libperl(\w*)\Q$self->{LIB_EXT}/){ |
249
|
1
|
|
|
|
|
4
|
$uc = uc($1); |
250
|
|
|
|
|
|
|
} else { |
251
|
0
|
|
|
|
|
0
|
$uc = ""; # avoid warning |
252
|
|
|
|
|
|
|
} |
253
|
1
|
50
|
|
|
|
4
|
$perltype = $map{$uc} ? $map{$uc} : ""; |
254
|
|
|
|
|
|
|
|
255
|
1
|
50
|
|
|
|
6
|
if ($uc =~ /^D/) { |
256
|
0
|
|
|
|
|
0
|
$optdebug = "-g"; |
257
|
|
|
|
|
|
|
} |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
|
260
|
1
|
|
|
|
|
3
|
my($name); |
261
|
1
|
|
|
|
|
17
|
( $name = $self->{NAME} . "_cflags" ) =~ s/:/_/g ; |
262
|
1
|
50
|
|
|
|
4
|
if ($prog = $Config{$name}) { |
263
|
|
|
|
|
|
|
# Expand hints for this extension via the shell |
264
|
0
|
0
|
|
|
|
0
|
print "Processing $name hint:\n" if $Verbose; |
265
|
0
|
|
|
|
|
0
|
my(@o)=`cc=\"$cflags{cc}\" |
266
|
|
|
|
|
|
|
ccflags=\"$cflags{ccflags}\" |
267
|
|
|
|
|
|
|
optimize=\"$cflags{optimize}\" |
268
|
|
|
|
|
|
|
perltype=\"$cflags{perltype}\" |
269
|
|
|
|
|
|
|
optdebug=\"$cflags{optdebug}\" |
270
|
|
|
|
|
|
|
eval '$prog' |
271
|
|
|
|
|
|
|
echo cc=\$cc |
272
|
|
|
|
|
|
|
echo ccflags=\$ccflags |
273
|
|
|
|
|
|
|
echo optimize=\$optimize |
274
|
|
|
|
|
|
|
echo perltype=\$perltype |
275
|
|
|
|
|
|
|
echo optdebug=\$optdebug |
276
|
|
|
|
|
|
|
`; |
277
|
0
|
|
|
|
|
0
|
foreach my $line (@o){ |
278
|
0
|
|
|
|
|
0
|
chomp $line; |
279
|
0
|
0
|
|
|
|
0
|
if ($line =~ /(.*?)=\s*(.*)\s*$/){ |
280
|
0
|
|
|
|
|
0
|
$cflags{$1} = $2; |
281
|
0
|
0
|
|
|
|
0
|
print " $1 = $2\n" if $Verbose; |
282
|
|
|
|
|
|
|
} else { |
283
|
0
|
|
|
|
|
0
|
print "Unrecognised result from hint: '$line'\n"; |
284
|
|
|
|
|
|
|
} |
285
|
|
|
|
|
|
|
} |
286
|
|
|
|
|
|
|
} |
287
|
|
|
|
|
|
|
|
288
|
1
|
50
|
|
|
|
3
|
if ($optdebug) { |
289
|
0
|
|
|
|
|
0
|
$cflags{optimize} = $optdebug; |
290
|
|
|
|
|
|
|
} |
291
|
|
|
|
|
|
|
|
292
|
1
|
|
|
|
|
3
|
for (qw(ccflags optimize perltype)) { |
293
|
3
|
|
100
|
|
|
13
|
$cflags{$_} ||= ''; |
294
|
3
|
|
|
|
|
11
|
$cflags{$_} =~ s/^\s+//; |
295
|
3
|
|
|
|
|
12
|
$cflags{$_} =~ s/\s+/ /g; |
296
|
3
|
|
|
|
|
10
|
$cflags{$_} =~ s/\s+$//; |
297
|
3
|
|
100
|
|
|
15
|
$self->{uc $_} ||= $cflags{$_}; |
298
|
|
|
|
|
|
|
} |
299
|
|
|
|
|
|
|
|
300
|
1
|
50
|
|
|
|
19
|
if ($self->{POLLUTE}) { |
301
|
0
|
|
|
|
|
0
|
$self->{CCFLAGS} .= ' -DPERL_POLLUTE '; |
302
|
|
|
|
|
|
|
} |
303
|
|
|
|
|
|
|
|
304
|
1
|
|
|
|
|
11
|
for my $x (@ccextraflags) { |
305
|
1
|
50
|
|
|
|
6
|
next unless exists $cflags{$x}; |
306
|
0
|
0
|
|
|
|
0
|
$self->{CCFLAGS} .= $cflags{$x} =~ m!^\s! ? $cflags{$x} : ' ' . $cflags{$x}; |
307
|
|
|
|
|
|
|
} |
308
|
|
|
|
|
|
|
|
309
|
1
|
|
|
|
|
3
|
my $pollute = ''; |
310
|
1
|
50
|
33
|
|
|
32
|
if ($Config{usemymalloc} and not $Config{bincompat5005} |
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
311
|
|
|
|
|
|
|
and not $Config{ccflags} =~ /-DPERL_POLLUTE_MALLOC\b/ |
312
|
|
|
|
|
|
|
and $self->{PERL_MALLOC_OK}) { |
313
|
0
|
|
|
|
|
0
|
$pollute = '$(PERL_MALLOC_DEF)'; |
314
|
|
|
|
|
|
|
} |
315
|
|
|
|
|
|
|
|
316
|
1
|
|
|
|
|
13
|
return $self->{CFLAGS} = qq{ |
317
|
|
|
|
|
|
|
CCFLAGS = $self->{CCFLAGS} |
318
|
|
|
|
|
|
|
OPTIMIZE = $self->{OPTIMIZE} |
319
|
|
|
|
|
|
|
PERLTYPE = $self->{PERLTYPE} |
320
|
|
|
|
|
|
|
MPOLLUTE = $pollute |
321
|
|
|
|
|
|
|
}; |
322
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
} |
324
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
=item const_cccmd (o) |
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
Returns the full compiler call for C programs and stores the |
329
|
|
|
|
|
|
|
definition in CONST_CCCMD. |
330
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
=cut |
332
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
sub const_cccmd { |
334
|
154
|
|
|
154
|
1
|
566
|
my($self,$libperl)=@_; |
335
|
154
|
50
|
|
|
|
648
|
return $self->{CONST_CCCMD} if $self->{CONST_CCCMD}; |
336
|
154
|
50
|
|
|
|
443
|
return '' unless $self->needs_linking(); |
337
|
|
|
|
|
|
|
return $self->{CONST_CCCMD} = |
338
|
0
|
|
|
|
|
0
|
q{CCCMD = $(CC) -c $(PASTHRU_INC) $(INC) \\ |
339
|
|
|
|
|
|
|
$(CCFLAGS) $(OPTIMIZE) \\ |
340
|
|
|
|
|
|
|
$(PERLTYPE) $(MPOLLUTE) $(DEFINE_VERSION) \\ |
341
|
|
|
|
|
|
|
$(XS_DEFINE_VERSION)}; |
342
|
|
|
|
|
|
|
} |
343
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
=item const_config (o) |
345
|
|
|
|
|
|
|
|
346
|
|
|
|
|
|
|
Sets SHELL if needed, then defines a couple of constants in the Makefile |
347
|
|
|
|
|
|
|
that are imported from %Config. |
348
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
=cut |
350
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
sub const_config { |
352
|
|
|
|
|
|
|
# --- Constants Sections --- |
353
|
|
|
|
|
|
|
|
354
|
155
|
|
|
155
|
1
|
557
|
my($self) = shift; |
355
|
155
|
|
|
|
|
1813
|
my @m = $self->specify_shell(); # Usually returns empty string |
356
|
155
|
|
|
|
|
1053
|
push @m, <<"END"; |
357
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
# These definitions are from config.sh (via $INC{'Config.pm'}). |
359
|
|
|
|
|
|
|
# They may have been overridden via Makefile.PL or on the command line. |
360
|
|
|
|
|
|
|
END |
361
|
|
|
|
|
|
|
|
362
|
155
|
|
|
|
|
358
|
my(%once_only); |
363
|
155
|
|
|
|
|
298
|
foreach my $key (@{$self->{CONFIG}}){ |
|
155
|
|
|
|
|
920
|
|
364
|
|
|
|
|
|
|
# SITE*EXP macros are defined in &constants; avoid duplicates here |
365
|
3565
|
50
|
|
|
|
7361
|
next if $once_only{$key}; |
366
|
3565
|
|
|
|
|
14536
|
push @m, uc($key) , ' = ' , $self->{uc $key}, "\n"; |
367
|
3565
|
|
|
|
|
10420
|
$once_only{$key} = 1; |
368
|
|
|
|
|
|
|
} |
369
|
155
|
|
|
|
|
3037
|
join('', @m); |
370
|
|
|
|
|
|
|
} |
371
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
=item const_loadlibs (o) |
373
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
Defines EXTRALIBS, LDLOADLIBS, BSLOADLIBS, LD_RUN_PATH. See |
375
|
|
|
|
|
|
|
L<ExtUtils::Liblist> for details. |
376
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
=cut |
378
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
sub const_loadlibs { |
380
|
154
|
|
|
154
|
1
|
398
|
my($self) = shift; |
381
|
154
|
50
|
|
|
|
471
|
return "" unless $self->needs_linking; |
382
|
0
|
|
|
|
|
0
|
my @m; |
383
|
0
|
|
|
|
|
0
|
push @m, qq{ |
384
|
|
|
|
|
|
|
# $self->{NAME} might depend on some other libraries: |
385
|
|
|
|
|
|
|
# See ExtUtils::Liblist for details |
386
|
|
|
|
|
|
|
# |
387
|
|
|
|
|
|
|
}; |
388
|
0
|
|
|
|
|
0
|
for my $tmp (qw/ |
389
|
|
|
|
|
|
|
EXTRALIBS LDLOADLIBS BSLOADLIBS |
390
|
|
|
|
|
|
|
/) { |
391
|
0
|
0
|
|
|
|
0
|
next unless defined $self->{$tmp}; |
392
|
0
|
|
|
|
|
0
|
push @m, "$tmp = $self->{$tmp}\n"; |
393
|
|
|
|
|
|
|
} |
394
|
|
|
|
|
|
|
# don't set LD_RUN_PATH if empty |
395
|
0
|
|
|
|
|
0
|
for my $tmp (qw/ |
396
|
|
|
|
|
|
|
LD_RUN_PATH |
397
|
|
|
|
|
|
|
/) { |
398
|
0
|
0
|
|
|
|
0
|
next unless $self->{$tmp}; |
399
|
0
|
|
|
|
|
0
|
push @m, "$tmp = $self->{$tmp}\n"; |
400
|
|
|
|
|
|
|
} |
401
|
0
|
|
|
|
|
0
|
return join "", @m; |
402
|
|
|
|
|
|
|
} |
403
|
|
|
|
|
|
|
|
404
|
|
|
|
|
|
|
=item constants (o) |
405
|
|
|
|
|
|
|
|
406
|
|
|
|
|
|
|
my $make_frag = $mm->constants; |
407
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
Prints out macros for lots of constants. |
409
|
|
|
|
|
|
|
|
410
|
|
|
|
|
|
|
=cut |
411
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
sub constants { |
413
|
155
|
|
|
155
|
1
|
543
|
my($self) = @_; |
414
|
155
|
|
|
|
|
411
|
my @m = (); |
415
|
|
|
|
|
|
|
|
416
|
155
|
|
|
|
|
962
|
$self->{DFSEP} = '$(DIRFILESEP)'; # alias for internal use |
417
|
|
|
|
|
|
|
|
418
|
155
|
|
|
|
|
1258
|
for my $macro (qw( |
419
|
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
AR_STATIC_ARGS DIRFILESEP DFSEP |
421
|
|
|
|
|
|
|
NAME NAME_SYM |
422
|
|
|
|
|
|
|
VERSION VERSION_MACRO VERSION_SYM DEFINE_VERSION |
423
|
|
|
|
|
|
|
XS_VERSION XS_VERSION_MACRO XS_DEFINE_VERSION |
424
|
|
|
|
|
|
|
INST_ARCHLIB INST_SCRIPT INST_BIN INST_LIB |
425
|
|
|
|
|
|
|
INST_MAN1DIR INST_MAN3DIR |
426
|
|
|
|
|
|
|
MAN1EXT MAN3EXT |
427
|
|
|
|
|
|
|
MAN1SECTION MAN3SECTION |
428
|
|
|
|
|
|
|
INSTALLDIRS INSTALL_BASE DESTDIR PREFIX |
429
|
|
|
|
|
|
|
PERLPREFIX SITEPREFIX VENDORPREFIX |
430
|
|
|
|
|
|
|
), |
431
|
2790
|
|
|
|
|
7406
|
(map { ("INSTALL".$_, |
432
|
|
|
|
|
|
|
"DESTINSTALL".$_) |
433
|
|
|
|
|
|
|
} $self->installvars), |
434
|
|
|
|
|
|
|
qw( |
435
|
|
|
|
|
|
|
PERL_LIB |
436
|
|
|
|
|
|
|
PERL_ARCHLIB PERL_ARCHLIBDEP |
437
|
|
|
|
|
|
|
LIBPERL_A MYEXTLIB |
438
|
|
|
|
|
|
|
FIRST_MAKEFILE MAKEFILE_OLD MAKE_APERL_FILE |
439
|
|
|
|
|
|
|
PERLMAINCC PERL_SRC PERL_INC PERL_INCDEP |
440
|
|
|
|
|
|
|
PERL FULLPERL ABSPERL |
441
|
|
|
|
|
|
|
PERLRUN FULLPERLRUN ABSPERLRUN |
442
|
|
|
|
|
|
|
PERLRUNINST FULLPERLRUNINST ABSPERLRUNINST |
443
|
|
|
|
|
|
|
PERL_CORE |
444
|
|
|
|
|
|
|
PERM_DIR PERM_RW PERM_RWX |
445
|
|
|
|
|
|
|
|
446
|
|
|
|
|
|
|
) ) |
447
|
|
|
|
|
|
|
{ |
448
|
13950
|
100
|
|
|
|
30714
|
next unless defined $self->{$macro}; |
449
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
# pathnames can have sharp signs in them; escape them so |
451
|
|
|
|
|
|
|
# make doesn't think it is a comment-start character. |
452
|
13481
|
|
|
|
|
24118
|
$self->{$macro} =~ s/#/\\#/g; |
453
|
|
|
|
|
|
|
$self->{$macro} = $self->quote_dep($self->{$macro}) |
454
|
13481
|
100
|
|
|
|
27470
|
if $ExtUtils::MakeMaker::macro_dep{$macro}; |
455
|
13481
|
|
|
|
|
37140
|
push @m, "$macro = $self->{$macro}\n"; |
456
|
|
|
|
|
|
|
} |
457
|
|
|
|
|
|
|
|
458
|
155
|
|
|
|
|
1698
|
push @m, qq{ |
459
|
|
|
|
|
|
|
MAKEMAKER = $self->{MAKEMAKER} |
460
|
|
|
|
|
|
|
MM_VERSION = $self->{MM_VERSION} |
461
|
|
|
|
|
|
|
MM_REVISION = $self->{MM_REVISION} |
462
|
|
|
|
|
|
|
}; |
463
|
|
|
|
|
|
|
|
464
|
155
|
|
|
|
|
533
|
push @m, q{ |
465
|
|
|
|
|
|
|
# FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle). |
466
|
|
|
|
|
|
|
# BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle) |
467
|
|
|
|
|
|
|
# PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar) |
468
|
|
|
|
|
|
|
# DLBASE = Basename part of dynamic library. May be just equal BASEEXT. |
469
|
|
|
|
|
|
|
}; |
470
|
|
|
|
|
|
|
|
471
|
155
|
|
|
|
|
537
|
for my $macro (qw/ |
472
|
|
|
|
|
|
|
MAKE |
473
|
|
|
|
|
|
|
FULLEXT BASEEXT PARENT_NAME DLBASE VERSION_FROM INC DEFINE OBJECT |
474
|
|
|
|
|
|
|
LDFROM LINKTYPE BOOTDEP |
475
|
|
|
|
|
|
|
/ ) |
476
|
|
|
|
|
|
|
{ |
477
|
1860
|
100
|
|
|
|
3881
|
next unless defined $self->{$macro}; |
478
|
1550
|
|
|
|
|
3689
|
push @m, "$macro = $self->{$macro}\n"; |
479
|
|
|
|
|
|
|
} |
480
|
|
|
|
|
|
|
|
481
|
|
|
|
|
|
|
push @m, " |
482
|
|
|
|
|
|
|
# Handy lists of source code files: |
483
|
155
|
|
|
|
|
2221
|
XS_FILES = ".$self->wraplist(sort keys %{$self->{XS}})." |
484
|
155
|
|
|
|
|
722
|
C_FILES = ".$self->wraplist(sort @{$self->{C}})." |
485
|
155
|
|
|
|
|
588
|
O_FILES = ".$self->wraplist(sort @{$self->{O_FILES}})." |
486
|
155
|
|
|
|
|
569
|
H_FILES = ".$self->wraplist(sort @{$self->{H}})." |
487
|
155
|
|
|
|
|
651
|
MAN1PODS = ".$self->wraplist(sort keys %{$self->{MAN1PODS}})." |
488
|
155
|
|
|
|
|
478
|
MAN3PODS = ".$self->wraplist(sort keys %{$self->{MAN3PODS}})." |
|
155
|
|
|
|
|
739
|
|
489
|
|
|
|
|
|
|
"; |
490
|
|
|
|
|
|
|
|
491
|
|
|
|
|
|
|
push @m, q{ |
492
|
|
|
|
|
|
|
SDKROOT := $(shell xcrun --show-sdk-path) |
493
|
|
|
|
|
|
|
PERL_SYSROOT = $(SDKROOT) |
494
|
154
|
50
|
33
|
|
|
771
|
} if $Is{ApplCor} && $self->{'PERL_INC'} =~ m!^/System/Library/Perl/!; |
495
|
|
|
|
|
|
|
|
496
|
|
|
|
|
|
|
push @m, q{ |
497
|
|
|
|
|
|
|
# Where is the Config information that we are using/depend on |
498
|
|
|
|
|
|
|
CONFIGDEP = $(PERL_ARCHLIBDEP)$(DFSEP)Config.pm $(PERL_SYSROOT)$(PERL_INCDEP)$(DFSEP)config.h |
499
|
154
|
50
|
|
|
|
493
|
} if $Is{ApplCor}; |
500
|
|
|
|
|
|
|
|
501
|
|
|
|
|
|
|
push @m, q{ |
502
|
|
|
|
|
|
|
# Where is the Config information that we are using/depend on |
503
|
|
|
|
|
|
|
CONFIGDEP = $(PERL_ARCHLIBDEP)$(DFSEP)Config.pm $(PERL_INCDEP)$(DFSEP)config.h |
504
|
154
|
50
|
33
|
|
|
707
|
} if -e $self->catfile( $self->{PERL_INC}, 'config.h' ) && !$Is{ApplCor}; |
505
|
|
|
|
|
|
|
|
506
|
154
|
|
|
|
|
1592
|
push @m, qq{ |
507
|
|
|
|
|
|
|
# Where to build things |
508
|
|
|
|
|
|
|
INST_LIBDIR = $self->{INST_LIBDIR} |
509
|
|
|
|
|
|
|
INST_ARCHLIBDIR = $self->{INST_ARCHLIBDIR} |
510
|
|
|
|
|
|
|
|
511
|
|
|
|
|
|
|
INST_AUTODIR = $self->{INST_AUTODIR} |
512
|
|
|
|
|
|
|
INST_ARCHAUTODIR = $self->{INST_ARCHAUTODIR} |
513
|
|
|
|
|
|
|
|
514
|
|
|
|
|
|
|
INST_STATIC = $self->{INST_STATIC} |
515
|
|
|
|
|
|
|
INST_DYNAMIC = $self->{INST_DYNAMIC} |
516
|
|
|
|
|
|
|
INST_BOOT = $self->{INST_BOOT} |
517
|
|
|
|
|
|
|
}; |
518
|
|
|
|
|
|
|
|
519
|
154
|
|
|
|
|
734
|
push @m, qq{ |
520
|
|
|
|
|
|
|
# Extra linker info |
521
|
|
|
|
|
|
|
EXPORT_LIST = $self->{EXPORT_LIST} |
522
|
|
|
|
|
|
|
PERL_ARCHIVE = $self->{PERL_ARCHIVE} |
523
|
|
|
|
|
|
|
PERL_ARCHIVEDEP = $self->{PERL_ARCHIVEDEP} |
524
|
|
|
|
|
|
|
PERL_ARCHIVE_AFTER = $self->{PERL_ARCHIVE_AFTER} |
525
|
|
|
|
|
|
|
}; |
526
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
push @m, " |
528
|
|
|
|
|
|
|
|
529
|
154
|
|
|
|
|
385
|
TO_INST_PM = ".$self->wraplist(map $self->quote_dep($_), sort keys %{$self->{PM}})."\n"; |
|
154
|
|
|
|
|
1119
|
|
530
|
|
|
|
|
|
|
|
531
|
154
|
|
|
|
|
4480
|
join('',@m); |
532
|
|
|
|
|
|
|
} |
533
|
|
|
|
|
|
|
|
534
|
|
|
|
|
|
|
|
535
|
|
|
|
|
|
|
=item depend (o) |
536
|
|
|
|
|
|
|
|
537
|
|
|
|
|
|
|
Same as macro for the depend attribute. |
538
|
|
|
|
|
|
|
|
539
|
|
|
|
|
|
|
=cut |
540
|
|
|
|
|
|
|
|
541
|
|
|
|
|
|
|
sub depend { |
542
|
154
|
|
|
154
|
1
|
536
|
my($self,%attribs) = @_; |
543
|
154
|
|
|
|
|
346
|
my(@m,$key,$val); |
544
|
154
|
|
|
|
|
965
|
for my $key (sort keys %attribs){ |
545
|
0
|
|
|
|
|
0
|
my $val = $attribs{$key}; |
546
|
0
|
0
|
0
|
|
|
0
|
next unless defined $key and defined $val; |
547
|
0
|
|
|
|
|
0
|
push @m, "$key : $val\n"; |
548
|
|
|
|
|
|
|
} |
549
|
154
|
|
|
|
|
829
|
join "", @m; |
550
|
|
|
|
|
|
|
} |
551
|
|
|
|
|
|
|
|
552
|
|
|
|
|
|
|
|
553
|
|
|
|
|
|
|
=item init_DEST |
554
|
|
|
|
|
|
|
|
555
|
|
|
|
|
|
|
$mm->init_DEST |
556
|
|
|
|
|
|
|
|
557
|
|
|
|
|
|
|
Defines the DESTDIR and DEST* variables paralleling the INSTALL*. |
558
|
|
|
|
|
|
|
|
559
|
|
|
|
|
|
|
=cut |
560
|
|
|
|
|
|
|
|
561
|
|
|
|
|
|
|
sub init_DEST { |
562
|
156
|
|
|
156
|
1
|
344
|
my $self = shift; |
563
|
|
|
|
|
|
|
|
564
|
|
|
|
|
|
|
# Initialize DESTDIR |
565
|
156
|
|
50
|
|
|
1279
|
$self->{DESTDIR} ||= ''; |
566
|
|
|
|
|
|
|
|
567
|
|
|
|
|
|
|
# Make DEST variables. |
568
|
156
|
|
|
|
|
1563
|
foreach my $var ($self->installvars) { |
569
|
2808
|
|
|
|
|
4967
|
my $destvar = 'DESTINSTALL'.$var; |
570
|
2808
|
|
33
|
|
|
10710
|
$self->{$destvar} ||= '$(DESTDIR)$(INSTALL'.$var.')'; |
571
|
|
|
|
|
|
|
} |
572
|
|
|
|
|
|
|
} |
573
|
|
|
|
|
|
|
|
574
|
|
|
|
|
|
|
|
575
|
|
|
|
|
|
|
=item init_dist |
576
|
|
|
|
|
|
|
|
577
|
|
|
|
|
|
|
$mm->init_dist; |
578
|
|
|
|
|
|
|
|
579
|
|
|
|
|
|
|
Defines a lot of macros for distribution support. |
580
|
|
|
|
|
|
|
|
581
|
|
|
|
|
|
|
macro description default |
582
|
|
|
|
|
|
|
|
583
|
|
|
|
|
|
|
TAR tar command to use tar |
584
|
|
|
|
|
|
|
TARFLAGS flags to pass to TAR cvf |
585
|
|
|
|
|
|
|
|
586
|
|
|
|
|
|
|
ZIP zip command to use zip |
587
|
|
|
|
|
|
|
ZIPFLAGS flags to pass to ZIP -r |
588
|
|
|
|
|
|
|
|
589
|
|
|
|
|
|
|
COMPRESS compression command to gzip --best |
590
|
|
|
|
|
|
|
use for tarfiles |
591
|
|
|
|
|
|
|
SUFFIX suffix to put on .gz |
592
|
|
|
|
|
|
|
compressed files |
593
|
|
|
|
|
|
|
|
594
|
|
|
|
|
|
|
SHAR shar command to use shar |
595
|
|
|
|
|
|
|
|
596
|
|
|
|
|
|
|
PREOP extra commands to run before |
597
|
|
|
|
|
|
|
making the archive |
598
|
|
|
|
|
|
|
POSTOP extra commands to run after |
599
|
|
|
|
|
|
|
making the archive |
600
|
|
|
|
|
|
|
|
601
|
|
|
|
|
|
|
TO_UNIX a command to convert linefeeds |
602
|
|
|
|
|
|
|
to Unix style in your archive |
603
|
|
|
|
|
|
|
|
604
|
|
|
|
|
|
|
CI command to checkin your ci -u |
605
|
|
|
|
|
|
|
sources to version control |
606
|
|
|
|
|
|
|
RCS_LABEL command to label your sources rcs -Nv$(VERSION_SYM): -q |
607
|
|
|
|
|
|
|
just after CI is run |
608
|
|
|
|
|
|
|
|
609
|
|
|
|
|
|
|
DIST_CP $how argument to manicopy() best |
610
|
|
|
|
|
|
|
when the distdir is created |
611
|
|
|
|
|
|
|
|
612
|
|
|
|
|
|
|
DIST_DEFAULT default target to use to tardist |
613
|
|
|
|
|
|
|
create a distribution |
614
|
|
|
|
|
|
|
|
615
|
|
|
|
|
|
|
DISTVNAME name of the resulting archive $(DISTNAME)-$(VERSION) |
616
|
|
|
|
|
|
|
(minus suffixes) |
617
|
|
|
|
|
|
|
|
618
|
|
|
|
|
|
|
=cut |
619
|
|
|
|
|
|
|
|
620
|
|
|
|
|
|
|
sub init_dist { |
621
|
156
|
|
|
156
|
1
|
454
|
my $self = shift; |
622
|
|
|
|
|
|
|
|
623
|
156
|
|
50
|
|
|
1612
|
$self->{TAR} ||= 'tar'; |
624
|
156
|
|
50
|
|
|
927
|
$self->{TARFLAGS} ||= 'cvf'; |
625
|
156
|
|
50
|
|
|
844
|
$self->{ZIP} ||= 'zip'; |
626
|
156
|
|
50
|
|
|
1139
|
$self->{ZIPFLAGS} ||= '-r'; |
627
|
156
|
|
50
|
|
|
1049
|
$self->{COMPRESS} ||= 'gzip --best'; |
628
|
156
|
|
50
|
|
|
1593
|
$self->{SUFFIX} ||= '.gz'; |
629
|
156
|
|
50
|
|
|
1039
|
$self->{SHAR} ||= 'shar'; |
630
|
156
|
|
50
|
|
|
1130
|
$self->{PREOP} ||= '$(NOECHO) $(NOOP)'; # eg update MANIFEST |
631
|
156
|
|
50
|
|
|
921
|
$self->{POSTOP} ||= '$(NOECHO) $(NOOP)'; # eg remove the distdir |
632
|
156
|
|
50
|
|
|
728
|
$self->{TO_UNIX} ||= '$(NOECHO) $(NOOP)'; |
633
|
|
|
|
|
|
|
|
634
|
156
|
|
50
|
|
|
957
|
$self->{CI} ||= 'ci -u'; |
635
|
156
|
|
50
|
|
|
1049
|
$self->{RCS_LABEL}||= 'rcs -Nv$(VERSION_SYM): -q'; |
636
|
156
|
|
50
|
|
|
772
|
$self->{DIST_CP} ||= 'best'; |
637
|
156
|
|
50
|
|
|
964
|
$self->{DIST_DEFAULT} ||= 'tardist'; |
638
|
|
|
|
|
|
|
|
639
|
156
|
100
|
|
|
|
1427
|
($self->{DISTNAME} = $self->{NAME}) =~ s{::}{-}g unless $self->{DISTNAME}; |
640
|
156
|
|
66
|
|
|
1647
|
$self->{DISTVNAME} ||= $self->{DISTNAME}.'-'.$self->{VERSION}; |
641
|
|
|
|
|
|
|
} |
642
|
|
|
|
|
|
|
|
643
|
|
|
|
|
|
|
=item dist (o) |
644
|
|
|
|
|
|
|
|
645
|
|
|
|
|
|
|
my $dist_macros = $mm->dist(%overrides); |
646
|
|
|
|
|
|
|
|
647
|
|
|
|
|
|
|
Generates a make fragment defining all the macros initialized in |
648
|
|
|
|
|
|
|
init_dist. |
649
|
|
|
|
|
|
|
|
650
|
|
|
|
|
|
|
%overrides can be used to override any of the above. |
651
|
|
|
|
|
|
|
|
652
|
|
|
|
|
|
|
=cut |
653
|
|
|
|
|
|
|
|
654
|
|
|
|
|
|
|
sub dist { |
655
|
97
|
|
|
97
|
1
|
453
|
my($self, %attribs) = @_; |
656
|
|
|
|
|
|
|
|
657
|
97
|
|
|
|
|
534
|
my $make = ''; |
658
|
97
|
50
|
33
|
|
|
528
|
if ( $attribs{SUFFIX} && $attribs{SUFFIX} !~ m!^\.! ) { |
659
|
0
|
|
|
|
|
0
|
$attribs{SUFFIX} = '.' . $attribs{SUFFIX}; |
660
|
|
|
|
|
|
|
} |
661
|
97
|
|
|
|
|
815
|
foreach my $key (qw( |
662
|
|
|
|
|
|
|
TAR TARFLAGS ZIP ZIPFLAGS COMPRESS SUFFIX SHAR |
663
|
|
|
|
|
|
|
PREOP POSTOP TO_UNIX |
664
|
|
|
|
|
|
|
CI RCS_LABEL DIST_CP DIST_DEFAULT |
665
|
|
|
|
|
|
|
DISTNAME DISTVNAME |
666
|
|
|
|
|
|
|
)) |
667
|
|
|
|
|
|
|
{ |
668
|
1552
|
|
33
|
|
|
5577
|
my $value = $attribs{$key} || $self->{$key}; |
669
|
1552
|
|
|
|
|
3803
|
$make .= "$key = $value\n"; |
670
|
|
|
|
|
|
|
} |
671
|
|
|
|
|
|
|
|
672
|
97
|
|
|
|
|
513
|
return $make; |
673
|
|
|
|
|
|
|
} |
674
|
|
|
|
|
|
|
|
675
|
|
|
|
|
|
|
=item dist_basics (o) |
676
|
|
|
|
|
|
|
|
677
|
|
|
|
|
|
|
Defines the targets distclean, distcheck, skipcheck, manifest, veryclean. |
678
|
|
|
|
|
|
|
|
679
|
|
|
|
|
|
|
=cut |
680
|
|
|
|
|
|
|
|
681
|
|
|
|
|
|
|
sub dist_basics { |
682
|
98
|
|
|
98
|
1
|
23086
|
my($self) = shift; |
683
|
|
|
|
|
|
|
|
684
|
98
|
|
|
|
|
513
|
return <<'MAKE_FRAG'; |
685
|
|
|
|
|
|
|
distclean :: realclean distcheck |
686
|
|
|
|
|
|
|
$(NOECHO) $(NOOP) |
687
|
|
|
|
|
|
|
|
688
|
|
|
|
|
|
|
distcheck : |
689
|
|
|
|
|
|
|
$(PERLRUN) "-MExtUtils::Manifest=fullcheck" -e fullcheck |
690
|
|
|
|
|
|
|
|
691
|
|
|
|
|
|
|
skipcheck : |
692
|
|
|
|
|
|
|
$(PERLRUN) "-MExtUtils::Manifest=skipcheck" -e skipcheck |
693
|
|
|
|
|
|
|
|
694
|
|
|
|
|
|
|
manifest : |
695
|
|
|
|
|
|
|
$(PERLRUN) "-MExtUtils::Manifest=mkmanifest" -e mkmanifest |
696
|
|
|
|
|
|
|
|
697
|
|
|
|
|
|
|
veryclean : realclean |
698
|
|
|
|
|
|
|
$(RM_F) *~ */*~ *.orig */*.orig *.bak */*.bak *.old */*.old |
699
|
|
|
|
|
|
|
|
700
|
|
|
|
|
|
|
MAKE_FRAG |
701
|
|
|
|
|
|
|
|
702
|
|
|
|
|
|
|
} |
703
|
|
|
|
|
|
|
|
704
|
|
|
|
|
|
|
=item dist_ci (o) |
705
|
|
|
|
|
|
|
|
706
|
|
|
|
|
|
|
Defines a check in target for RCS. |
707
|
|
|
|
|
|
|
|
708
|
|
|
|
|
|
|
=cut |
709
|
|
|
|
|
|
|
|
710
|
|
|
|
|
|
|
sub dist_ci { |
711
|
97
|
|
|
97
|
1
|
532
|
my($self) = shift; |
712
|
97
|
|
|
|
|
679
|
return sprintf "ci :\n\t%s\n", $self->oneliner(<<'EOF', [qw(-MExtUtils::Manifest=maniread)]); |
713
|
|
|
|
|
|
|
@all = sort keys %{ maniread() }; |
714
|
|
|
|
|
|
|
print(qq{Executing $(CI) @all\n}); |
715
|
|
|
|
|
|
|
system(qq{$(CI) @all}) == 0 or die $!; |
716
|
|
|
|
|
|
|
print(qq{Executing $(RCS_LABEL) ...\n}); |
717
|
|
|
|
|
|
|
system(qq{$(RCS_LABEL) @all}) == 0 or die $!; |
718
|
|
|
|
|
|
|
EOF |
719
|
|
|
|
|
|
|
} |
720
|
|
|
|
|
|
|
|
721
|
|
|
|
|
|
|
=item dist_core (o) |
722
|
|
|
|
|
|
|
|
723
|
|
|
|
|
|
|
my $dist_make_fragment = $MM->dist_core; |
724
|
|
|
|
|
|
|
|
725
|
|
|
|
|
|
|
Puts the targets necessary for 'make dist' together into one make |
726
|
|
|
|
|
|
|
fragment. |
727
|
|
|
|
|
|
|
|
728
|
|
|
|
|
|
|
=cut |
729
|
|
|
|
|
|
|
|
730
|
|
|
|
|
|
|
sub dist_core { |
731
|
97
|
|
|
97
|
1
|
297
|
my($self) = shift; |
732
|
|
|
|
|
|
|
|
733
|
97
|
|
|
|
|
555
|
my $make_frag = ''; |
734
|
97
|
|
|
|
|
722
|
foreach my $target (qw(dist tardist uutardist tarfile zipdist zipfile |
735
|
|
|
|
|
|
|
shdist)) |
736
|
|
|
|
|
|
|
{ |
737
|
679
|
|
|
|
|
1503
|
my $method = $target.'_target'; |
738
|
679
|
|
|
|
|
985
|
$make_frag .= "\n"; |
739
|
679
|
|
|
|
|
6187
|
$make_frag .= $self->$method(); |
740
|
|
|
|
|
|
|
} |
741
|
|
|
|
|
|
|
|
742
|
97
|
|
|
|
|
651
|
return $make_frag; |
743
|
|
|
|
|
|
|
} |
744
|
|
|
|
|
|
|
|
745
|
|
|
|
|
|
|
|
746
|
|
|
|
|
|
|
=item B<dist_target> |
747
|
|
|
|
|
|
|
|
748
|
|
|
|
|
|
|
my $make_frag = $MM->dist_target; |
749
|
|
|
|
|
|
|
|
750
|
|
|
|
|
|
|
Returns the 'dist' target to make an archive for distribution. This |
751
|
|
|
|
|
|
|
target simply checks to make sure the Makefile is up-to-date and |
752
|
|
|
|
|
|
|
depends on $(DIST_DEFAULT). |
753
|
|
|
|
|
|
|
|
754
|
|
|
|
|
|
|
=cut |
755
|
|
|
|
|
|
|
|
756
|
|
|
|
|
|
|
sub dist_target { |
757
|
97
|
|
|
97
|
1
|
390
|
my($self) = shift; |
758
|
|
|
|
|
|
|
|
759
|
97
|
|
|
|
|
647
|
my $date_check = $self->oneliner(<<'CODE', ['-l']); |
760
|
|
|
|
|
|
|
print 'Warning: Makefile possibly out of date with $(VERSION_FROM)' |
761
|
|
|
|
|
|
|
if -e '$(VERSION_FROM)' and -M '$(VERSION_FROM)' < -M '$(FIRST_MAKEFILE)'; |
762
|
|
|
|
|
|
|
CODE |
763
|
|
|
|
|
|
|
|
764
|
97
|
|
|
|
|
1001
|
return sprintf <<'MAKE_FRAG', $date_check; |
765
|
|
|
|
|
|
|
dist : $(DIST_DEFAULT) $(FIRST_MAKEFILE) |
766
|
|
|
|
|
|
|
$(NOECHO) %s |
767
|
|
|
|
|
|
|
MAKE_FRAG |
768
|
|
|
|
|
|
|
} |
769
|
|
|
|
|
|
|
|
770
|
|
|
|
|
|
|
=item B<tardist_target> |
771
|
|
|
|
|
|
|
|
772
|
|
|
|
|
|
|
my $make_frag = $MM->tardist_target; |
773
|
|
|
|
|
|
|
|
774
|
|
|
|
|
|
|
Returns the 'tardist' target which is simply so 'make tardist' works. |
775
|
|
|
|
|
|
|
The real work is done by the dynamically named tardistfile_target() |
776
|
|
|
|
|
|
|
method, tardist should have that as a dependency. |
777
|
|
|
|
|
|
|
|
778
|
|
|
|
|
|
|
=cut |
779
|
|
|
|
|
|
|
|
780
|
|
|
|
|
|
|
sub tardist_target { |
781
|
97
|
|
|
97
|
1
|
330
|
my($self) = shift; |
782
|
|
|
|
|
|
|
|
783
|
97
|
|
|
|
|
395
|
return <<'MAKE_FRAG'; |
784
|
|
|
|
|
|
|
tardist : $(DISTVNAME).tar$(SUFFIX) |
785
|
|
|
|
|
|
|
$(NOECHO) $(NOOP) |
786
|
|
|
|
|
|
|
MAKE_FRAG |
787
|
|
|
|
|
|
|
} |
788
|
|
|
|
|
|
|
|
789
|
|
|
|
|
|
|
=item B<zipdist_target> |
790
|
|
|
|
|
|
|
|
791
|
|
|
|
|
|
|
my $make_frag = $MM->zipdist_target; |
792
|
|
|
|
|
|
|
|
793
|
|
|
|
|
|
|
Returns the 'zipdist' target which is simply so 'make zipdist' works. |
794
|
|
|
|
|
|
|
The real work is done by the dynamically named zipdistfile_target() |
795
|
|
|
|
|
|
|
method, zipdist should have that as a dependency. |
796
|
|
|
|
|
|
|
|
797
|
|
|
|
|
|
|
=cut |
798
|
|
|
|
|
|
|
|
799
|
|
|
|
|
|
|
sub zipdist_target { |
800
|
97
|
|
|
97
|
1
|
293
|
my($self) = shift; |
801
|
|
|
|
|
|
|
|
802
|
97
|
|
|
|
|
269
|
return <<'MAKE_FRAG'; |
803
|
|
|
|
|
|
|
zipdist : $(DISTVNAME).zip |
804
|
|
|
|
|
|
|
$(NOECHO) $(NOOP) |
805
|
|
|
|
|
|
|
MAKE_FRAG |
806
|
|
|
|
|
|
|
} |
807
|
|
|
|
|
|
|
|
808
|
|
|
|
|
|
|
=item B<tarfile_target> |
809
|
|
|
|
|
|
|
|
810
|
|
|
|
|
|
|
my $make_frag = $MM->tarfile_target; |
811
|
|
|
|
|
|
|
|
812
|
|
|
|
|
|
|
The name of this target is the name of the tarball generated by |
813
|
|
|
|
|
|
|
tardist. This target does the actual work of turning the distdir into |
814
|
|
|
|
|
|
|
a tarball. |
815
|
|
|
|
|
|
|
|
816
|
|
|
|
|
|
|
=cut |
817
|
|
|
|
|
|
|
|
818
|
|
|
|
|
|
|
sub tarfile_target { |
819
|
97
|
|
|
97
|
1
|
308
|
my($self) = shift; |
820
|
|
|
|
|
|
|
|
821
|
97
|
|
|
|
|
297
|
return <<'MAKE_FRAG'; |
822
|
|
|
|
|
|
|
$(DISTVNAME).tar$(SUFFIX) : distdir |
823
|
|
|
|
|
|
|
$(PREOP) |
824
|
|
|
|
|
|
|
$(TO_UNIX) |
825
|
|
|
|
|
|
|
$(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME) |
826
|
|
|
|
|
|
|
$(RM_RF) $(DISTVNAME) |
827
|
|
|
|
|
|
|
$(COMPRESS) $(DISTVNAME).tar |
828
|
|
|
|
|
|
|
$(NOECHO) $(ECHO) 'Created $(DISTVNAME).tar$(SUFFIX)' |
829
|
|
|
|
|
|
|
$(POSTOP) |
830
|
|
|
|
|
|
|
MAKE_FRAG |
831
|
|
|
|
|
|
|
} |
832
|
|
|
|
|
|
|
|
833
|
|
|
|
|
|
|
=item zipfile_target |
834
|
|
|
|
|
|
|
|
835
|
|
|
|
|
|
|
my $make_frag = $MM->zipfile_target; |
836
|
|
|
|
|
|
|
|
837
|
|
|
|
|
|
|
The name of this target is the name of the zip file generated by |
838
|
|
|
|
|
|
|
zipdist. This target does the actual work of turning the distdir into |
839
|
|
|
|
|
|
|
a zip file. |
840
|
|
|
|
|
|
|
|
841
|
|
|
|
|
|
|
=cut |
842
|
|
|
|
|
|
|
|
843
|
|
|
|
|
|
|
sub zipfile_target { |
844
|
97
|
|
|
97
|
1
|
281
|
my($self) = shift; |
845
|
|
|
|
|
|
|
|
846
|
97
|
|
|
|
|
312
|
return <<'MAKE_FRAG'; |
847
|
|
|
|
|
|
|
$(DISTVNAME).zip : distdir |
848
|
|
|
|
|
|
|
$(PREOP) |
849
|
|
|
|
|
|
|
$(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME) |
850
|
|
|
|
|
|
|
$(RM_RF) $(DISTVNAME) |
851
|
|
|
|
|
|
|
$(NOECHO) $(ECHO) 'Created $(DISTVNAME).zip' |
852
|
|
|
|
|
|
|
$(POSTOP) |
853
|
|
|
|
|
|
|
MAKE_FRAG |
854
|
|
|
|
|
|
|
} |
855
|
|
|
|
|
|
|
|
856
|
|
|
|
|
|
|
=item uutardist_target |
857
|
|
|
|
|
|
|
|
858
|
|
|
|
|
|
|
my $make_frag = $MM->uutardist_target; |
859
|
|
|
|
|
|
|
|
860
|
|
|
|
|
|
|
Converts the tarfile into a uuencoded file |
861
|
|
|
|
|
|
|
|
862
|
|
|
|
|
|
|
=cut |
863
|
|
|
|
|
|
|
|
864
|
|
|
|
|
|
|
sub uutardist_target { |
865
|
97
|
|
|
97
|
1
|
417
|
my($self) = shift; |
866
|
|
|
|
|
|
|
|
867
|
97
|
|
|
|
|
340
|
return <<'MAKE_FRAG'; |
868
|
|
|
|
|
|
|
uutardist : $(DISTVNAME).tar$(SUFFIX) |
869
|
|
|
|
|
|
|
uuencode $(DISTVNAME).tar$(SUFFIX) $(DISTVNAME).tar$(SUFFIX) > $(DISTVNAME).tar$(SUFFIX)_uu |
870
|
|
|
|
|
|
|
$(NOECHO) $(ECHO) 'Created $(DISTVNAME).tar$(SUFFIX)_uu' |
871
|
|
|
|
|
|
|
MAKE_FRAG |
872
|
|
|
|
|
|
|
} |
873
|
|
|
|
|
|
|
|
874
|
|
|
|
|
|
|
|
875
|
|
|
|
|
|
|
=item shdist_target |
876
|
|
|
|
|
|
|
|
877
|
|
|
|
|
|
|
my $make_frag = $MM->shdist_target; |
878
|
|
|
|
|
|
|
|
879
|
|
|
|
|
|
|
Converts the distdir into a shell archive. |
880
|
|
|
|
|
|
|
|
881
|
|
|
|
|
|
|
=cut |
882
|
|
|
|
|
|
|
|
883
|
|
|
|
|
|
|
sub shdist_target { |
884
|
97
|
|
|
97
|
1
|
265
|
my($self) = shift; |
885
|
|
|
|
|
|
|
|
886
|
97
|
|
|
|
|
326
|
return <<'MAKE_FRAG'; |
887
|
|
|
|
|
|
|
shdist : distdir |
888
|
|
|
|
|
|
|
$(PREOP) |
889
|
|
|
|
|
|
|
$(SHAR) $(DISTVNAME) > $(DISTVNAME).shar |
890
|
|
|
|
|
|
|
$(RM_RF) $(DISTVNAME) |
891
|
|
|
|
|
|
|
$(NOECHO) $(ECHO) 'Created $(DISTVNAME).shar' |
892
|
|
|
|
|
|
|
$(POSTOP) |
893
|
|
|
|
|
|
|
MAKE_FRAG |
894
|
|
|
|
|
|
|
} |
895
|
|
|
|
|
|
|
|
896
|
|
|
|
|
|
|
|
897
|
|
|
|
|
|
|
=item dlsyms (o) |
898
|
|
|
|
|
|
|
|
899
|
|
|
|
|
|
|
Used by some OS' to define DL_FUNCS and DL_VARS and write the *.exp files. |
900
|
|
|
|
|
|
|
|
901
|
|
|
|
|
|
|
Normally just returns an empty string. |
902
|
|
|
|
|
|
|
|
903
|
|
|
|
|
|
|
=cut |
904
|
|
|
|
|
|
|
|
905
|
|
|
|
|
|
|
sub dlsyms { |
906
|
154
|
|
|
154
|
1
|
844
|
return ''; |
907
|
|
|
|
|
|
|
} |
908
|
|
|
|
|
|
|
|
909
|
|
|
|
|
|
|
|
910
|
|
|
|
|
|
|
=item dynamic_bs (o) |
911
|
|
|
|
|
|
|
|
912
|
|
|
|
|
|
|
Defines targets for bootstrap files. |
913
|
|
|
|
|
|
|
|
914
|
|
|
|
|
|
|
=cut |
915
|
|
|
|
|
|
|
|
916
|
|
|
|
|
|
|
sub dynamic_bs { |
917
|
154
|
|
|
154
|
1
|
492
|
my($self, %attribs) = @_; |
918
|
154
|
50
|
|
|
|
492
|
return "\nBOOTSTRAP =\n" unless $self->has_link_code(); |
919
|
0
|
|
|
|
|
0
|
my @exts; |
920
|
0
|
0
|
|
|
|
0
|
if ($self->{XSMULTI}) { |
921
|
0
|
|
|
|
|
0
|
@exts = $self->_xs_list_basenames; |
922
|
|
|
|
|
|
|
} else { |
923
|
0
|
|
|
|
|
0
|
@exts = '$(BASEEXT)'; |
924
|
|
|
|
|
|
|
} |
925
|
|
|
|
|
|
|
return join "\n", |
926
|
0
|
|
|
|
|
0
|
"BOOTSTRAP = @{[map { qq{$_.bs} } @exts]}\n", |
|
0
|
|
|
|
|
0
|
|
927
|
0
|
|
|
|
|
0
|
map { $self->_xs_make_bs($_) } @exts; |
|
0
|
|
|
|
|
0
|
|
928
|
|
|
|
|
|
|
} |
929
|
|
|
|
|
|
|
|
930
|
|
|
|
|
|
|
sub _xs_make_bs { |
931
|
0
|
|
|
0
|
|
0
|
my ($self, $basename) = @_; |
932
|
0
|
|
|
|
|
0
|
my ($v, $d, $f) = File::Spec->splitpath($basename); |
933
|
0
|
|
|
|
|
0
|
my @d = File::Spec->splitdir($d); |
934
|
0
|
0
|
0
|
|
|
0
|
shift @d if $self->{XSMULTI} and $d[0] eq 'lib'; |
935
|
0
|
|
|
|
|
0
|
my $instdir = $self->catdir('$(INST_ARCHLIB)', 'auto', @d, $f); |
936
|
0
|
0
|
|
|
|
0
|
$instdir = '$(INST_ARCHAUTODIR)' if $basename eq '$(BASEEXT)'; |
937
|
0
|
|
|
|
|
0
|
my $instfile = $self->catfile($instdir, "$f.bs"); |
938
|
0
|
|
|
|
|
0
|
my $exists = "$instdir\$(DFSEP).exists"; # match blibdirs_target |
939
|
|
|
|
|
|
|
# 1 2 3 |
940
|
0
|
|
|
|
|
0
|
return _sprintf562 <<'MAKE_FRAG', $basename, $instfile, $exists; |
941
|
|
|
|
|
|
|
# As Mkbootstrap might not write a file (if none is required) |
942
|
|
|
|
|
|
|
# we use touch to prevent make continually trying to remake it. |
943
|
|
|
|
|
|
|
# The DynaLoader only reads a non-empty file. |
944
|
|
|
|
|
|
|
%1$s.bs : $(FIRST_MAKEFILE) $(BOOTDEP) |
945
|
|
|
|
|
|
|
$(NOECHO) $(ECHO) "Running Mkbootstrap for %1$s ($(BSLOADLIBS))" |
946
|
|
|
|
|
|
|
$(NOECHO) $(PERLRUN) \ |
947
|
|
|
|
|
|
|
"-MExtUtils::Mkbootstrap" \ |
948
|
|
|
|
|
|
|
-e "Mkbootstrap('%1$s','$(BSLOADLIBS)');" |
949
|
|
|
|
|
|
|
$(NOECHO) $(TOUCH) "%1$s.bs" |
950
|
|
|
|
|
|
|
$(CHMOD) $(PERM_RW) "%1$s.bs" |
951
|
|
|
|
|
|
|
|
952
|
|
|
|
|
|
|
%2$s : %1$s.bs %3$s |
953
|
|
|
|
|
|
|
$(NOECHO) $(RM_RF) %2$s |
954
|
|
|
|
|
|
|
- $(CP_NONEMPTY) %1$s.bs %2$s $(PERM_RW) |
955
|
|
|
|
|
|
|
MAKE_FRAG |
956
|
|
|
|
|
|
|
} |
957
|
|
|
|
|
|
|
|
958
|
|
|
|
|
|
|
=item dynamic_lib (o) |
959
|
|
|
|
|
|
|
|
960
|
|
|
|
|
|
|
Defines how to produce the *.so (or equivalent) files. |
961
|
|
|
|
|
|
|
|
962
|
|
|
|
|
|
|
=cut |
963
|
|
|
|
|
|
|
|
964
|
|
|
|
|
|
|
sub dynamic_lib { |
965
|
154
|
|
|
154
|
1
|
598
|
my($self, %attribs) = @_; |
966
|
154
|
50
|
|
|
|
469
|
return '' unless $self->needs_linking(); #might be because of a subdir |
967
|
0
|
0
|
|
|
|
0
|
return '' unless $self->has_link_code; |
968
|
0
|
|
|
|
|
0
|
my @m = $self->xs_dynamic_lib_macros(\%attribs); |
969
|
0
|
|
|
|
|
0
|
my @libs; |
970
|
0
|
|
|
|
|
0
|
my $dlsyms_ext = eval { $self->xs_dlsyms_ext }; |
|
0
|
|
|
|
|
0
|
|
971
|
0
|
0
|
|
|
|
0
|
if ($self->{XSMULTI}) { |
972
|
0
|
|
|
|
|
0
|
my @exts = $self->_xs_list_basenames; |
973
|
0
|
|
|
|
|
0
|
for my $ext (@exts) { |
974
|
0
|
|
|
|
|
0
|
my ($v, $d, $f) = File::Spec->splitpath($ext); |
975
|
0
|
|
|
|
|
0
|
my @d = File::Spec->splitdir($d); |
976
|
0
|
0
|
|
|
|
0
|
shift @d if $d[0] eq 'lib'; |
977
|
0
|
0
|
|
|
|
0
|
pop @d if $d[$#d] eq ''; |
978
|
0
|
|
|
|
|
0
|
my $instdir = $self->catdir('$(INST_ARCHLIB)', 'auto', @d, $f); |
979
|
|
|
|
|
|
|
|
980
|
|
|
|
|
|
|
# Dynamic library names may need special handling. |
981
|
0
|
|
|
|
|
0
|
eval { require DynaLoader }; |
|
0
|
|
|
|
|
0
|
|
982
|
0
|
0
|
|
|
|
0
|
if (defined &DynaLoader::mod2fname) { |
983
|
0
|
|
|
|
|
0
|
$f = &DynaLoader::mod2fname([@d, $f]); |
984
|
|
|
|
|
|
|
} |
985
|
|
|
|
|
|
|
|
986
|
0
|
|
|
|
|
0
|
my $instfile = $self->catfile($instdir, "$f.\$(DLEXT)"); |
987
|
0
|
|
|
|
|
0
|
my $objfile = $self->_xsbuild_value('xs', $ext, 'OBJECT'); |
988
|
0
|
0
|
|
|
|
0
|
$objfile = "$ext\$(OBJ_EXT)" unless defined $objfile; |
989
|
0
|
|
|
|
|
0
|
my $ldfrom = $self->_xsbuild_value('xs', $ext, 'LDFROM'); |
990
|
0
|
0
|
|
|
|
0
|
$ldfrom = $objfile unless defined $ldfrom; |
991
|
0
|
|
|
|
|
0
|
my $exportlist = "$ext.def"; |
992
|
0
|
|
|
|
|
0
|
my @libchunk = ($objfile, $instfile, $instdir, $ldfrom, $exportlist); |
993
|
0
|
0
|
|
|
|
0
|
push @libchunk, $dlsyms_ext ? $ext.$dlsyms_ext : undef; |
994
|
0
|
|
|
|
|
0
|
push @libs, \@libchunk; |
995
|
|
|
|
|
|
|
} |
996
|
|
|
|
|
|
|
} else { |
997
|
0
|
|
|
|
|
0
|
my @libchunk = qw($(OBJECT) $(INST_DYNAMIC) $(INST_ARCHAUTODIR) $(LDFROM) $(EXPORT_LIST)); |
998
|
0
|
0
|
|
|
|
0
|
push @libchunk, $dlsyms_ext ? '$(BASEEXT)'.$dlsyms_ext : undef; |
999
|
0
|
|
|
|
|
0
|
@libs = (\@libchunk); |
1000
|
|
|
|
|
|
|
} |
1001
|
0
|
|
|
|
|
0
|
push @m, map { $self->xs_make_dynamic_lib(\%attribs, @$_); } @libs; |
|
0
|
|
|
|
|
0
|
|
1002
|
|
|
|
|
|
|
|
1003
|
0
|
|
|
|
|
0
|
return join("\n",@m); |
1004
|
|
|
|
|
|
|
} |
1005
|
|
|
|
|
|
|
|
1006
|
|
|
|
|
|
|
=item xs_dynamic_lib_macros |
1007
|
|
|
|
|
|
|
|
1008
|
|
|
|
|
|
|
Defines the macros for the C<dynamic_lib> section. |
1009
|
|
|
|
|
|
|
|
1010
|
|
|
|
|
|
|
=cut |
1011
|
|
|
|
|
|
|
|
1012
|
|
|
|
|
|
|
sub xs_dynamic_lib_macros { |
1013
|
0
|
|
|
0
|
1
|
0
|
my ($self, $attribs) = @_; |
1014
|
0
|
|
0
|
|
|
0
|
my $otherldflags = $attribs->{OTHERLDFLAGS} || ""; |
1015
|
0
|
|
0
|
|
|
0
|
my $inst_dynamic_dep = $attribs->{INST_DYNAMIC_DEP} || ""; |
1016
|
0
|
|
|
|
|
0
|
my $armaybe = $self->_xs_armaybe($attribs); |
1017
|
0
|
0
|
|
|
|
0
|
my $ld_opt = $Is{OS2} ? '$(OPTIMIZE) ' : ''; # Useful on other systems too? |
1018
|
0
|
0
|
|
|
|
0
|
my $ld_fix = $Is{OS2} ? '|| ( $(RM_F) $@ && sh -c false )' : ''; |
1019
|
0
|
|
|
|
|
0
|
sprintf <<'EOF', $armaybe, $ld_opt.$otherldflags, $inst_dynamic_dep, $ld_fix; |
1020
|
|
|
|
|
|
|
# This section creates the dynamically loadable objects from relevant |
1021
|
|
|
|
|
|
|
# objects and possibly $(MYEXTLIB). |
1022
|
|
|
|
|
|
|
ARMAYBE = %s |
1023
|
|
|
|
|
|
|
OTHERLDFLAGS = %s |
1024
|
|
|
|
|
|
|
INST_DYNAMIC_DEP = %s |
1025
|
|
|
|
|
|
|
INST_DYNAMIC_FIX = %s |
1026
|
|
|
|
|
|
|
EOF |
1027
|
|
|
|
|
|
|
} |
1028
|
|
|
|
|
|
|
|
1029
|
|
|
|
|
|
|
sub _xs_armaybe { |
1030
|
0
|
|
|
0
|
|
0
|
my ($self, $attribs) = @_; |
1031
|
0
|
|
0
|
|
|
0
|
my $armaybe = $attribs->{ARMAYBE} || $self->{ARMAYBE} || ":"; |
1032
|
0
|
0
|
0
|
|
|
0
|
$armaybe = 'ar' if ($Is{OSF} and $armaybe eq ':'); |
1033
|
0
|
|
|
|
|
0
|
$armaybe; |
1034
|
|
|
|
|
|
|
} |
1035
|
|
|
|
|
|
|
|
1036
|
|
|
|
|
|
|
=item xs_make_dynamic_lib |
1037
|
|
|
|
|
|
|
|
1038
|
|
|
|
|
|
|
Defines the recipes for the C<dynamic_lib> section. |
1039
|
|
|
|
|
|
|
|
1040
|
|
|
|
|
|
|
=cut |
1041
|
|
|
|
|
|
|
|
1042
|
|
|
|
|
|
|
sub xs_make_dynamic_lib { |
1043
|
0
|
|
|
0
|
1
|
0
|
my ($self, $attribs, $object, $to, $todir, $ldfrom, $exportlist, $dlsyms) = @_; |
1044
|
0
|
0
|
|
|
|
0
|
$exportlist = '' if $exportlist ne '$(EXPORT_LIST)'; |
1045
|
0
|
|
|
|
|
0
|
my $armaybe = $self->_xs_armaybe($attribs); |
1046
|
0
|
|
0
|
|
|
0
|
my @m = sprintf '%s : %s $(MYEXTLIB) %s$(DFSEP).exists %s $(PERL_ARCHIVEDEP) $(PERL_ARCHIVE_AFTER) $(INST_DYNAMIC_DEP) %s'."\n", $to, $object, $todir, $exportlist, ($dlsyms || ''); |
1047
|
0
|
|
|
|
|
0
|
my $dlsyms_arg = $self->xs_dlsyms_arg($dlsyms); |
1048
|
0
|
0
|
|
|
|
0
|
if ($armaybe ne ':'){ |
1049
|
0
|
|
|
|
|
0
|
$ldfrom = 'tmp$(LIB_EXT)'; |
1050
|
0
|
|
|
|
|
0
|
push(@m," \$(ARMAYBE) cr $ldfrom $object\n"); |
1051
|
0
|
|
|
|
|
0
|
push(@m," \$(RANLIB) $ldfrom\n"); |
1052
|
|
|
|
|
|
|
} |
1053
|
0
|
0
|
|
|
|
0
|
$ldfrom = "-all $ldfrom -none" if $Is{OSF}; |
1054
|
|
|
|
|
|
|
|
1055
|
0
|
|
|
|
|
0
|
my $ldrun = ''; |
1056
|
|
|
|
|
|
|
# The IRIX linker doesn't use LD_RUN_PATH |
1057
|
0
|
0
|
|
|
|
0
|
if ( $self->{LD_RUN_PATH} ) { |
1058
|
0
|
0
|
0
|
|
|
0
|
if ( $Is{IRIX} ) { |
|
|
0
|
|
|
|
|
|
1059
|
0
|
|
|
|
|
0
|
$ldrun = qq{-rpath "$self->{LD_RUN_PATH}"}; |
1060
|
|
|
|
|
|
|
} |
1061
|
|
|
|
|
|
|
elsif ( $^O eq 'darwin' && $Is{AppleRPath} ) { |
1062
|
|
|
|
|
|
|
# both clang and gcc support -Wl,-rpath, but only clang supports |
1063
|
|
|
|
|
|
|
# -rpath so by using -Wl,-rpath we avoid having to check for the |
1064
|
|
|
|
|
|
|
# type of compiler |
1065
|
0
|
|
|
|
|
0
|
$ldrun = qq{-Wl,-rpath,"$self->{LD_RUN_PATH}"}; |
1066
|
|
|
|
|
|
|
} |
1067
|
|
|
|
|
|
|
} |
1068
|
|
|
|
|
|
|
|
1069
|
|
|
|
|
|
|
# For example in AIX the shared objects/libraries from previous builds |
1070
|
|
|
|
|
|
|
# linger quite a while in the shared dynalinker cache even when nobody |
1071
|
|
|
|
|
|
|
# is using them. This is painful if one for instance tries to restart |
1072
|
|
|
|
|
|
|
# a failed build because the link command will fail unnecessarily 'cos |
1073
|
|
|
|
|
|
|
# the shared object/library is 'busy'. |
1074
|
0
|
|
|
|
|
0
|
push(@m," \$(RM_F) \$\@\n"); |
1075
|
|
|
|
|
|
|
|
1076
|
0
|
|
|
|
|
0
|
my $libs = '$(LDLOADLIBS)'; |
1077
|
0
|
0
|
0
|
|
|
0
|
if (($Is{NetBSD} || $Is{Interix} || $Is{Android}) && $Config{'useshrplib'} eq 'true') { |
|
|
|
0
|
|
|
|
|
1078
|
|
|
|
|
|
|
# Use nothing on static perl platforms, and to the flags needed |
1079
|
|
|
|
|
|
|
# to link against the shared libperl library on shared perl |
1080
|
|
|
|
|
|
|
# platforms. We peek at lddlflags to see if we need -Wl,-R |
1081
|
|
|
|
|
|
|
# or -R to add paths to the run-time library search path. |
1082
|
0
|
0
|
|
|
|
0
|
if ($Config{'lddlflags'} =~ /-Wl,-R/) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1083
|
0
|
|
|
|
|
0
|
$libs .= ' "-L$(PERL_INC)" "-Wl,-R$(INSTALLARCHLIB)/CORE" "-Wl,-R$(PERL_ARCHLIB)/CORE" -lperl'; |
1084
|
|
|
|
|
|
|
} elsif ($Config{'lddlflags'} =~ /-R/) { |
1085
|
0
|
|
|
|
|
0
|
$libs .= ' "-L$(PERL_INC)" "-R$(INSTALLARCHLIB)/CORE" "-R$(PERL_ARCHLIB)/CORE" -lperl'; |
1086
|
|
|
|
|
|
|
} elsif ( $Is{Android} ) { |
1087
|
|
|
|
|
|
|
# The Android linker will not recognize symbols from |
1088
|
|
|
|
|
|
|
# libperl unless the module explicitly depends on it. |
1089
|
0
|
|
|
|
|
0
|
$libs .= ' "-L$(PERL_INC)" -lperl'; |
1090
|
|
|
|
|
|
|
} |
1091
|
|
|
|
|
|
|
} |
1092
|
|
|
|
|
|
|
|
1093
|
0
|
|
|
|
|
0
|
my $ld_run_path_shell = ""; |
1094
|
0
|
0
|
|
|
|
0
|
if ($self->{LD_RUN_PATH} ne "") { |
1095
|
0
|
|
|
|
|
0
|
$ld_run_path_shell = 'LD_RUN_PATH="$(LD_RUN_PATH)" '; |
1096
|
|
|
|
|
|
|
} |
1097
|
|
|
|
|
|
|
|
1098
|
0
|
|
|
|
|
0
|
push @m, sprintf <<'MAKE', $ld_run_path_shell, $ldrun, $dlsyms_arg, $ldfrom, $self->xs_obj_opt('$@'), $libs, $exportlist; |
1099
|
|
|
|
|
|
|
%s$(LD) %s $(LDDLFLAGS) %s %s $(OTHERLDFLAGS) %s $(MYEXTLIB) \ |
1100
|
|
|
|
|
|
|
$(PERL_ARCHIVE) %s $(PERL_ARCHIVE_AFTER) %s \ |
1101
|
|
|
|
|
|
|
$(INST_DYNAMIC_FIX) |
1102
|
|
|
|
|
|
|
$(CHMOD) $(PERM_RWX) $@ |
1103
|
|
|
|
|
|
|
MAKE |
1104
|
0
|
|
|
|
|
0
|
join '', @m; |
1105
|
|
|
|
|
|
|
} |
1106
|
|
|
|
|
|
|
|
1107
|
|
|
|
|
|
|
=item exescan |
1108
|
|
|
|
|
|
|
|
1109
|
|
|
|
|
|
|
Deprecated method. Use libscan instead. |
1110
|
|
|
|
|
|
|
|
1111
|
|
|
|
|
|
|
=cut |
1112
|
|
|
|
|
|
|
|
1113
|
|
|
|
|
|
|
sub exescan { |
1114
|
0
|
|
|
0
|
1
|
0
|
my($self,$path) = @_; |
1115
|
0
|
|
|
|
|
0
|
$path; |
1116
|
|
|
|
|
|
|
} |
1117
|
|
|
|
|
|
|
|
1118
|
|
|
|
|
|
|
=item extliblist |
1119
|
|
|
|
|
|
|
|
1120
|
|
|
|
|
|
|
Called by init_others, and calls ext ExtUtils::Liblist. See |
1121
|
|
|
|
|
|
|
L<ExtUtils::Liblist> for details. |
1122
|
|
|
|
|
|
|
|
1123
|
|
|
|
|
|
|
=cut |
1124
|
|
|
|
|
|
|
|
1125
|
|
|
|
|
|
|
sub extliblist { |
1126
|
156
|
|
|
156
|
1
|
875
|
my($self,$libs) = @_; |
1127
|
156
|
|
|
|
|
1945
|
require ExtUtils::Liblist; |
1128
|
156
|
|
|
|
|
4941
|
$self->ext($libs, $Verbose); |
1129
|
|
|
|
|
|
|
} |
1130
|
|
|
|
|
|
|
|
1131
|
|
|
|
|
|
|
=item find_perl |
1132
|
|
|
|
|
|
|
|
1133
|
|
|
|
|
|
|
Finds the executables PERL and FULLPERL |
1134
|
|
|
|
|
|
|
|
1135
|
|
|
|
|
|
|
=cut |
1136
|
|
|
|
|
|
|
|
1137
|
|
|
|
|
|
|
sub find_perl { |
1138
|
100
|
|
|
100
|
1
|
532
|
my($self, $ver, $names, $dirs, $trace) = @_; |
1139
|
100
|
50
|
|
|
|
329
|
if ($trace >= 2){ |
1140
|
0
|
|
|
|
|
0
|
print "Looking for perl $ver by these names: |
1141
|
|
|
|
|
|
|
@$names |
1142
|
|
|
|
|
|
|
in these dirs: |
1143
|
|
|
|
|
|
|
@$dirs |
1144
|
|
|
|
|
|
|
"; |
1145
|
|
|
|
|
|
|
} |
1146
|
|
|
|
|
|
|
|
1147
|
100
|
|
|
|
|
214
|
my $stderr_duped = 0; |
1148
|
100
|
|
|
|
|
327
|
local *STDERR_COPY; |
1149
|
|
|
|
|
|
|
|
1150
|
100
|
50
|
|
|
|
344
|
unless ($Is{BSD}) { |
1151
|
|
|
|
|
|
|
# >& and lexical filehandles together give 5.6.2 indigestion |
1152
|
100
|
50
|
|
|
|
2520
|
if( open(STDERR_COPY, '>&STDERR') ) { ## no critic |
1153
|
100
|
|
|
|
|
377
|
$stderr_duped = 1; |
1154
|
|
|
|
|
|
|
} |
1155
|
|
|
|
|
|
|
else { |
1156
|
0
|
|
|
|
|
0
|
warn <<WARNING; |
1157
|
|
|
|
|
|
|
find_perl() can't dup STDERR: $! |
1158
|
|
|
|
|
|
|
You might see some garbage while we search for Perl |
1159
|
|
|
|
|
|
|
WARNING |
1160
|
|
|
|
|
|
|
} |
1161
|
|
|
|
|
|
|
} |
1162
|
|
|
|
|
|
|
|
1163
|
100
|
|
|
|
|
518
|
foreach my $name (@$names){ |
1164
|
100
|
|
|
|
|
344
|
my ($abs, $use_dir); |
1165
|
100
|
50
|
|
|
|
2452
|
if ($self->file_name_is_absolute($name)) { # /foo/bar |
|
|
0
|
|
|
|
|
|
1166
|
100
|
|
|
|
|
316
|
$abs = $name; |
1167
|
|
|
|
|
|
|
} elsif ($self->canonpath($name) eq |
1168
|
|
|
|
|
|
|
$self->canonpath(basename($name))) { # foo |
1169
|
0
|
|
|
|
|
0
|
$use_dir = 1; |
1170
|
|
|
|
|
|
|
} else { # foo/bar |
1171
|
0
|
|
|
|
|
0
|
$abs = $self->catfile($Curdir, $name); |
1172
|
|
|
|
|
|
|
} |
1173
|
100
|
50
|
|
|
|
466
|
foreach my $dir ($use_dir ? @$dirs : 1){ |
1174
|
100
|
50
|
|
|
|
327
|
next unless defined $dir; # $self->{PERL_SRC} may be undefined |
1175
|
|
|
|
|
|
|
|
1176
|
100
|
50
|
|
|
|
286
|
$abs = $self->catfile($dir, $name) |
1177
|
|
|
|
|
|
|
if $use_dir; |
1178
|
|
|
|
|
|
|
|
1179
|
100
|
50
|
|
|
|
316
|
print "Checking $abs\n" if ($trace >= 2); |
1180
|
100
|
50
|
|
|
|
877
|
next unless $self->maybe_command($abs); |
1181
|
100
|
50
|
|
|
|
512
|
print "Executing $abs\n" if ($trace >= 2); |
1182
|
|
|
|
|
|
|
|
1183
|
100
|
|
|
|
|
219
|
my $val; |
1184
|
100
|
|
|
|
|
757
|
my $version_check = qq{"$abs" -le "require $ver; print qq{VER_OK}"}; |
1185
|
|
|
|
|
|
|
|
1186
|
|
|
|
|
|
|
# To avoid using the unportable 2>&1 to suppress STDERR, |
1187
|
|
|
|
|
|
|
# we close it before running the command. |
1188
|
|
|
|
|
|
|
# However, thanks to a thread library bug in many BSDs |
1189
|
|
|
|
|
|
|
# ( http://www.freebsd.org/cgi/query-pr.cgi?pr=51535 ) |
1190
|
|
|
|
|
|
|
# we cannot use the fancier more portable way in here |
1191
|
|
|
|
|
|
|
# but instead need to use the traditional 2>&1 construct. |
1192
|
100
|
50
|
|
|
|
383
|
if ($Is{BSD}) { |
1193
|
0
|
|
|
|
|
0
|
$val = `$version_check 2>&1`; |
1194
|
|
|
|
|
|
|
} else { |
1195
|
100
|
50
|
|
|
|
918
|
close STDERR if $stderr_duped; |
1196
|
100
|
|
|
|
|
746786
|
$val = `$version_check`; |
1197
|
|
|
|
|
|
|
|
1198
|
|
|
|
|
|
|
# 5.6.2's 3-arg open doesn't work with >& |
1199
|
100
|
50
|
|
|
|
5563
|
open STDERR, ">&STDERR_COPY" ## no critic |
1200
|
|
|
|
|
|
|
if $stderr_duped; |
1201
|
|
|
|
|
|
|
} |
1202
|
|
|
|
|
|
|
|
1203
|
100
|
50
|
|
|
|
3390
|
if ($val =~ /^VER_OK/m) { |
|
|
0
|
|
|
|
|
|
1204
|
100
|
50
|
|
|
|
812
|
print "Using PERL=$abs\n" if $trace; |
1205
|
100
|
|
|
|
|
6665
|
return $abs; |
1206
|
|
|
|
|
|
|
} elsif ($trace >= 2) { |
1207
|
0
|
|
|
|
|
0
|
print "Result: '$val' ".($? >> 8)."\n"; |
1208
|
|
|
|
|
|
|
} |
1209
|
|
|
|
|
|
|
} |
1210
|
|
|
|
|
|
|
} |
1211
|
0
|
|
|
|
|
0
|
print "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n"; |
1212
|
0
|
|
|
|
|
0
|
0; # false and not empty |
1213
|
|
|
|
|
|
|
} |
1214
|
|
|
|
|
|
|
|
1215
|
|
|
|
|
|
|
|
1216
|
|
|
|
|
|
|
=item fixin |
1217
|
|
|
|
|
|
|
|
1218
|
|
|
|
|
|
|
$mm->fixin(@files); |
1219
|
|
|
|
|
|
|
|
1220
|
|
|
|
|
|
|
Inserts the sharpbang or equivalent magic number to a set of @files. |
1221
|
|
|
|
|
|
|
|
1222
|
|
|
|
|
|
|
=cut |
1223
|
|
|
|
|
|
|
|
1224
|
|
|
|
|
|
|
sub fixin { # stolen from the pink Camel book, more or less |
1225
|
6
|
|
|
6
|
1
|
17115
|
my ( $self, @files ) = @_; |
1226
|
|
|
|
|
|
|
|
1227
|
6
|
|
|
|
|
16
|
for my $file (@files) { |
1228
|
6
|
|
|
|
|
16
|
my $file_new = "$file.new"; |
1229
|
6
|
|
|
|
|
11
|
my $file_bak = "$file.bak"; |
1230
|
|
|
|
|
|
|
|
1231
|
6
|
50
|
|
|
|
223
|
open( my $fixin, '<', $file ) or croak "Can't process '$file': $!"; |
1232
|
6
|
|
|
|
|
37
|
local $/ = "\n"; |
1233
|
6
|
|
|
|
|
85
|
chomp( my $line = <$fixin> ); |
1234
|
6
|
50
|
|
|
|
54
|
next unless $line =~ s/^\s*\#!\s*//; # Not a shebang file. |
1235
|
|
|
|
|
|
|
|
1236
|
6
|
|
|
|
|
44
|
my $shb = $self->_fixin_replace_shebang( $file, $line ); |
1237
|
6
|
100
|
|
|
|
35
|
next unless defined $shb; |
1238
|
|
|
|
|
|
|
|
1239
|
5
|
50
|
|
|
|
334
|
open( my $fixout, ">", "$file_new" ) or do { |
1240
|
0
|
|
|
|
|
0
|
warn "Can't create new $file: $!\n"; |
1241
|
0
|
|
|
|
|
0
|
next; |
1242
|
|
|
|
|
|
|
}; |
1243
|
|
|
|
|
|
|
|
1244
|
|
|
|
|
|
|
# Print out the new #! line (or equivalent). |
1245
|
5
|
|
|
|
|
30
|
local $\; |
1246
|
5
|
|
|
|
|
15
|
local $/; |
1247
|
5
|
|
|
|
|
149
|
print $fixout $shb, <$fixin>; |
1248
|
5
|
|
|
|
|
54
|
close $fixin; |
1249
|
5
|
|
|
|
|
203
|
close $fixout; |
1250
|
|
|
|
|
|
|
|
1251
|
5
|
|
|
|
|
174
|
chmod 0666, $file_bak; |
1252
|
5
|
|
|
|
|
37
|
unlink $file_bak; |
1253
|
5
|
50
|
|
|
|
17
|
unless ( _rename( $file, $file_bak ) ) { |
1254
|
0
|
|
|
|
|
0
|
warn "Can't rename $file to $file_bak: $!"; |
1255
|
0
|
|
|
|
|
0
|
next; |
1256
|
|
|
|
|
|
|
} |
1257
|
5
|
50
|
|
|
|
16
|
unless ( _rename( $file_new, $file ) ) { |
1258
|
0
|
|
|
|
|
0
|
warn "Can't rename $file_new to $file: $!"; |
1259
|
0
|
0
|
|
|
|
0
|
unless ( _rename( $file_bak, $file ) ) { |
1260
|
0
|
|
|
|
|
0
|
warn "Can't rename $file_bak back to $file either: $!"; |
1261
|
0
|
|
|
|
|
0
|
warn "Leaving $file renamed as $file_bak\n"; |
1262
|
|
|
|
|
|
|
} |
1263
|
0
|
|
|
|
|
0
|
next; |
1264
|
|
|
|
|
|
|
} |
1265
|
5
|
|
|
|
|
237
|
unlink $file_bak; |
1266
|
|
|
|
|
|
|
} |
1267
|
|
|
|
|
|
|
continue { |
1268
|
6
|
50
|
|
|
|
48
|
system("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':'; |
1269
|
|
|
|
|
|
|
} |
1270
|
|
|
|
|
|
|
} |
1271
|
|
|
|
|
|
|
|
1272
|
|
|
|
|
|
|
|
1273
|
|
|
|
|
|
|
sub _rename { |
1274
|
10
|
|
|
10
|
|
25
|
my($old, $new) = @_; |
1275
|
|
|
|
|
|
|
|
1276
|
10
|
|
|
|
|
23
|
foreach my $file ($old, $new) { |
1277
|
20
|
50
|
33
|
|
|
51
|
if( $Is{VMS} and basename($file) !~ /\./ ) { |
1278
|
|
|
|
|
|
|
# rename() in 5.8.0 on VMS will not rename a file if it |
1279
|
|
|
|
|
|
|
# does not contain a dot yet it returns success. |
1280
|
0
|
|
|
|
|
0
|
$file = "$file."; |
1281
|
|
|
|
|
|
|
} |
1282
|
|
|
|
|
|
|
} |
1283
|
|
|
|
|
|
|
|
1284
|
10
|
|
|
|
|
310
|
return rename($old, $new); |
1285
|
|
|
|
|
|
|
} |
1286
|
|
|
|
|
|
|
|
1287
|
|
|
|
|
|
|
sub _fixin_replace_shebang { |
1288
|
6
|
|
|
6
|
|
19
|
my ( $self, $file, $line ) = @_; |
1289
|
|
|
|
|
|
|
|
1290
|
|
|
|
|
|
|
# Now figure out the interpreter name. |
1291
|
6
|
|
|
|
|
21
|
my ( $origcmd, $arg ) = split ' ', $line, 2; |
1292
|
6
|
|
|
|
|
25
|
(my $cmd = $origcmd) =~ s!^.*/!!; |
1293
|
|
|
|
|
|
|
|
1294
|
|
|
|
|
|
|
# Now look (in reverse) for interpreter in absolute PATH (unless perl). |
1295
|
6
|
|
|
|
|
11
|
my $interpreter; |
1296
|
6
|
50
|
33
|
|
|
33
|
if ( defined $ENV{PERL_MM_SHEBANG} && $ENV{PERL_MM_SHEBANG} eq "relocatable" ) { |
|
|
100
|
|
|
|
|
|
1297
|
0
|
|
|
|
|
0
|
$interpreter = "/usr/bin/env perl"; |
1298
|
|
|
|
|
|
|
} |
1299
|
|
|
|
|
|
|
elsif ( $cmd =~ m{^perl(?:\z|[^a-z])} ) { |
1300
|
3
|
50
|
|
|
|
14
|
if ( $Config{startperl} =~ m,^\#!.*/perl, ) { |
1301
|
3
|
|
|
|
|
6
|
$interpreter = $Config{startperl}; |
1302
|
3
|
|
|
|
|
10
|
$interpreter =~ s,^\#!,,; |
1303
|
|
|
|
|
|
|
} |
1304
|
|
|
|
|
|
|
else { |
1305
|
0
|
|
|
|
|
0
|
$interpreter = $Config{perlpath}; |
1306
|
|
|
|
|
|
|
} |
1307
|
|
|
|
|
|
|
} |
1308
|
|
|
|
|
|
|
else { |
1309
|
|
|
|
|
|
|
my (@absdirs) |
1310
|
3
|
|
|
|
|
53
|
= reverse grep { $self->file_name_is_absolute($_) } $self->path; |
|
13
|
|
|
|
|
60
|
|
1311
|
3
|
|
|
|
|
7
|
$interpreter = ''; |
1312
|
|
|
|
|
|
|
|
1313
|
3
|
|
|
|
|
7
|
foreach my $dir (@absdirs) { |
1314
|
12
|
|
|
|
|
38
|
my $maybefile = $self->catfile($dir,$cmd); |
1315
|
12
|
100
|
|
|
|
28
|
if ( $self->maybe_command($maybefile) ) { |
1316
|
3
|
50
|
33
|
|
|
11
|
warn "Ignoring $interpreter in $file\n" |
1317
|
|
|
|
|
|
|
if $Verbose && $interpreter; |
1318
|
3
|
|
|
|
|
8
|
$interpreter = $maybefile; |
1319
|
|
|
|
|
|
|
} |
1320
|
|
|
|
|
|
|
} |
1321
|
|
|
|
|
|
|
|
1322
|
|
|
|
|
|
|
# If the shebang is absolute and exists in PATH, but was not |
1323
|
|
|
|
|
|
|
# the first one found, leave it alone if it's actually the |
1324
|
|
|
|
|
|
|
# same file as first one. This avoids packages built on |
1325
|
|
|
|
|
|
|
# merged-/usr systems with /usr/bin before /bin in the path |
1326
|
|
|
|
|
|
|
# breaking when installed on systems without merged /usr |
1327
|
3
|
50
|
33
|
|
|
43
|
if ($origcmd ne $interpreter and $self->file_name_is_absolute($origcmd)) { |
1328
|
3
|
|
|
|
|
105
|
my $origdir = dirname($origcmd); |
1329
|
3
|
100
|
66
|
|
|
10
|
if ($self->maybe_command($origcmd) && grep { $_ eq $origdir } @absdirs) { |
|
2
|
|
|
|
|
9
|
|
1330
|
1
|
|
|
|
|
24
|
my ($odev, $oino) = stat $origcmd; |
1331
|
1
|
|
|
|
|
15
|
my ($idev, $iino) = stat $interpreter; |
1332
|
1
|
50
|
33
|
|
|
10
|
if ($odev == $idev && $oino eq $iino) { |
1333
|
1
|
50
|
|
|
|
5
|
warn "$origcmd is the same as $interpreter, leaving alone" |
1334
|
|
|
|
|
|
|
if $Verbose; |
1335
|
1
|
|
|
|
|
3
|
$interpreter = $origcmd; |
1336
|
|
|
|
|
|
|
} |
1337
|
|
|
|
|
|
|
} |
1338
|
|
|
|
|
|
|
} |
1339
|
|
|
|
|
|
|
} |
1340
|
|
|
|
|
|
|
|
1341
|
|
|
|
|
|
|
# Figure out how to invoke interpreter on this machine. |
1342
|
|
|
|
|
|
|
|
1343
|
6
|
|
|
|
|
28
|
my ($does_shbang) = $Config{'sharpbang'} =~ /^\s*\#\!/; |
1344
|
6
|
|
|
|
|
13
|
my ($shb) = ""; |
1345
|
6
|
100
|
|
|
|
13
|
if ($interpreter) { |
1346
|
5
|
50
|
|
|
|
12
|
print "Changing sharpbang in $file to $interpreter" |
1347
|
|
|
|
|
|
|
if $Verbose; |
1348
|
|
|
|
|
|
|
# this is probably value-free on DOSISH platforms |
1349
|
5
|
50
|
|
|
|
10
|
if ($does_shbang) { |
1350
|
5
|
|
|
|
|
21
|
$shb .= "$Config{'sharpbang'}$interpreter"; |
1351
|
5
|
100
|
|
|
|
14
|
$shb .= ' ' . $arg if defined $arg; |
1352
|
5
|
|
|
|
|
9
|
$shb .= "\n"; |
1353
|
|
|
|
|
|
|
} |
1354
|
|
|
|
|
|
|
} |
1355
|
|
|
|
|
|
|
else { |
1356
|
1
|
50
|
|
|
|
3
|
warn "Can't find $cmd in PATH, $file unchanged" |
1357
|
|
|
|
|
|
|
if $Verbose; |
1358
|
1
|
|
|
|
|
3
|
return; |
1359
|
|
|
|
|
|
|
} |
1360
|
5
|
|
|
|
|
13
|
return $shb |
1361
|
|
|
|
|
|
|
} |
1362
|
|
|
|
|
|
|
|
1363
|
|
|
|
|
|
|
=item force (o) |
1364
|
|
|
|
|
|
|
|
1365
|
|
|
|
|
|
|
Writes an empty FORCE: target. |
1366
|
|
|
|
|
|
|
|
1367
|
|
|
|
|
|
|
=cut |
1368
|
|
|
|
|
|
|
|
1369
|
|
|
|
|
|
|
sub force { |
1370
|
154
|
|
|
154
|
1
|
645
|
my($self) = shift; |
1371
|
154
|
|
|
|
|
1001
|
'# Phony target to force checking subdirectories. |
1372
|
|
|
|
|
|
|
FORCE : |
1373
|
|
|
|
|
|
|
$(NOECHO) $(NOOP) |
1374
|
|
|
|
|
|
|
'; |
1375
|
|
|
|
|
|
|
} |
1376
|
|
|
|
|
|
|
|
1377
|
|
|
|
|
|
|
=item guess_name |
1378
|
|
|
|
|
|
|
|
1379
|
|
|
|
|
|
|
Guess the name of this package by examining the working directory's |
1380
|
|
|
|
|
|
|
name. MakeMaker calls this only if the developer has not supplied a |
1381
|
|
|
|
|
|
|
NAME attribute. |
1382
|
|
|
|
|
|
|
|
1383
|
|
|
|
|
|
|
=cut |
1384
|
|
|
|
|
|
|
|
1385
|
|
|
|
|
|
|
# '; |
1386
|
|
|
|
|
|
|
|
1387
|
|
|
|
|
|
|
sub guess_name { |
1388
|
0
|
|
|
0
|
1
|
0
|
my($self) = @_; |
1389
|
52
|
|
|
52
|
|
537
|
use Cwd 'cwd'; |
|
52
|
|
|
|
|
142
|
|
|
52
|
|
|
|
|
435423
|
|
1390
|
0
|
|
|
|
|
0
|
my $name = basename(cwd()); |
1391
|
0
|
|
|
|
|
0
|
$name =~ s|[\-_][\d\.\-]+\z||; # this is new with MM 5.00, we |
1392
|
|
|
|
|
|
|
# strip minus or underline |
1393
|
|
|
|
|
|
|
# followed by a float or some such |
1394
|
0
|
|
|
|
|
0
|
print "Warning: Guessing NAME [$name] from current directory name.\n"; |
1395
|
0
|
|
|
|
|
0
|
$name; |
1396
|
|
|
|
|
|
|
} |
1397
|
|
|
|
|
|
|
|
1398
|
|
|
|
|
|
|
=item has_link_code |
1399
|
|
|
|
|
|
|
|
1400
|
|
|
|
|
|
|
Returns true if C, XS, MYEXTLIB or similar objects exist within this |
1401
|
|
|
|
|
|
|
object that need a compiler. Does not descend into subdirectories as |
1402
|
|
|
|
|
|
|
needs_linking() does. |
1403
|
|
|
|
|
|
|
|
1404
|
|
|
|
|
|
|
=cut |
1405
|
|
|
|
|
|
|
|
1406
|
|
|
|
|
|
|
sub has_link_code { |
1407
|
778
|
|
|
778
|
1
|
1621
|
my($self) = shift; |
1408
|
778
|
100
|
|
|
|
4597
|
return $self->{HAS_LINK_CODE} if defined $self->{HAS_LINK_CODE}; |
1409
|
160
|
100
|
100
|
|
|
833
|
if ($self->{OBJECT} or @{$self->{C} || []} or $self->{MYEXTLIB}){ |
|
159
|
100
|
100
|
|
|
1538
|
|
1410
|
3
|
|
|
|
|
7
|
$self->{HAS_LINK_CODE} = 1; |
1411
|
3
|
|
|
|
|
22
|
return 1; |
1412
|
|
|
|
|
|
|
} |
1413
|
157
|
|
|
|
|
754
|
return $self->{HAS_LINK_CODE} = 0; |
1414
|
|
|
|
|
|
|
} |
1415
|
|
|
|
|
|
|
|
1416
|
|
|
|
|
|
|
|
1417
|
|
|
|
|
|
|
=item init_dirscan |
1418
|
|
|
|
|
|
|
|
1419
|
|
|
|
|
|
|
Scans the directory structure and initializes DIR, XS, XS_FILES, |
1420
|
|
|
|
|
|
|
C, C_FILES, O_FILES, H, H_FILES, PL_FILES, EXE_FILES. |
1421
|
|
|
|
|
|
|
|
1422
|
|
|
|
|
|
|
Called by init_main. |
1423
|
|
|
|
|
|
|
|
1424
|
|
|
|
|
|
|
=cut |
1425
|
|
|
|
|
|
|
|
1426
|
|
|
|
|
|
|
sub init_dirscan { # --- File and Directory Lists (.xs .pm .pod etc) |
1427
|
156
|
|
|
156
|
1
|
475
|
my($self) = @_; |
1428
|
156
|
|
|
|
|
443
|
my(%dir, %xs, %c, %o, %h, %pl_files, %pm); |
1429
|
|
|
|
|
|
|
|
1430
|
156
|
|
|
|
|
419
|
my %ignore = map {( $_ => 1 )} qw(Makefile.PL Build.PL test.pl t); |
|
624
|
|
|
|
|
3205
|
|
1431
|
|
|
|
|
|
|
|
1432
|
|
|
|
|
|
|
# ignore the distdir |
1433
|
|
|
|
|
|
|
$Is{VMS} ? $ignore{"$self->{DISTVNAME}.dir"} = 1 |
1434
|
156
|
50
|
|
|
|
1181
|
: $ignore{$self->{DISTVNAME}} = 1; |
1435
|
|
|
|
|
|
|
|
1436
|
156
|
50
|
|
|
|
6062
|
my $distprefix = $Is{VMS} ? qr/^\Q$self->{DISTNAME}\E-v?[\d\.]+\.dir$/i |
1437
|
|
|
|
|
|
|
: qr/^\Q$self->{DISTNAME}\E-v?[\d\.]+$/; |
1438
|
|
|
|
|
|
|
|
1439
|
156
|
50
|
|
|
|
777
|
@ignore{map lc, keys %ignore} = values %ignore if $Is{VMS}; |
1440
|
|
|
|
|
|
|
|
1441
|
156
|
50
|
33
|
|
|
641
|
if ( defined $self->{XS} and !defined $self->{C} ) { |
1442
|
0
|
|
|
|
|
0
|
my @c_files = grep { m/\.c(pp|xx)?\z/i } values %{$self->{XS}}; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
1443
|
0
|
|
|
|
|
0
|
my @o_files = grep { m/(?:.(?:o(?:bj)?)|\$\(OBJ_EXT\))\z/i } values %{$self->{XS}}; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
1444
|
0
|
|
|
|
|
0
|
%c = map { $_ => 1 } @c_files; |
|
0
|
|
|
|
|
0
|
|
1445
|
0
|
|
|
|
|
0
|
%o = map { $_ => 1 } @o_files; |
|
0
|
|
|
|
|
0
|
|
1446
|
|
|
|
|
|
|
} |
1447
|
|
|
|
|
|
|
|
1448
|
156
|
|
|
|
|
1768
|
foreach my $name ($self->lsdir($Curdir)){ |
1449
|
1258
|
50
|
|
|
|
4011
|
next if $name =~ /\#/; |
1450
|
1258
|
50
|
33
|
|
|
6117
|
next if $name =~ $distprefix && -d $name; |
1451
|
1258
|
50
|
|
|
|
2808
|
$name = lc($name) if $Is{VMS}; |
1452
|
1258
|
100
|
100
|
|
|
6892
|
next if $name eq $Curdir or $name eq $Updir or $ignore{$name}; |
|
|
|
100
|
|
|
|
|
1453
|
649
|
100
|
|
|
|
3688
|
next unless $self->libscan($name); |
1454
|
645
|
100
|
33
|
|
|
15222
|
if (-d $name){ |
|
|
50
|
33
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
1455
|
299
|
50
|
|
|
|
3259
|
next if -l $name; # We do not support symlinks at all |
1456
|
299
|
50
|
|
|
|
1042
|
next if $self->{NORECURS}; |
1457
|
299
|
100
|
|
|
|
1019
|
$dir{$name} = $name if (-f $self->catfile($name,"Makefile.PL")); |
1458
|
|
|
|
|
|
|
} elsif ($name =~ /\.xs\z/){ |
1459
|
0
|
|
|
|
|
0
|
my($c); ($c = $name) =~ s/\.xs\z/.c/; |
|
0
|
|
|
|
|
0
|
|
1460
|
0
|
|
|
|
|
0
|
$xs{$name} = $c; |
1461
|
0
|
|
|
|
|
0
|
$c{$c} = 1; |
1462
|
|
|
|
|
|
|
} elsif ($name =~ /\.c(pp|xx|c)?\z/i){ # .c .C .cpp .cxx .cc |
1463
|
0
|
0
|
|
|
|
0
|
$c{$name} = 1 |
1464
|
|
|
|
|
|
|
unless $name =~ m/perlmain\.c/; # See MAP_TARGET |
1465
|
|
|
|
|
|
|
} elsif ($name =~ /\.h\z/i){ |
1466
|
0
|
|
|
|
|
0
|
$h{$name} = 1; |
1467
|
|
|
|
|
|
|
} elsif ($name =~ /\.PL\z/) { |
1468
|
0
|
|
|
|
|
0
|
($pl_files{$name} = $name) =~ s/\.PL\z// ; |
1469
|
|
|
|
|
|
|
} elsif (($Is{VMS} || $Is{Dos}) && $name =~ /[._]pl$/i) { |
1470
|
|
|
|
|
|
|
# case-insensitive filesystem, one dot per name, so foo.h.PL |
1471
|
|
|
|
|
|
|
# under Unix appears as foo.h_pl under VMS or fooh.pl on Dos |
1472
|
0
|
|
|
|
|
0
|
local($/); open(my $pl, '<', $name); my $txt = <$pl>; close $pl; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
1473
|
0
|
0
|
|
|
|
0
|
if ($txt =~ /Extracting \S+ \(with variable substitutions/) { |
1474
|
0
|
|
|
|
|
0
|
($pl_files{$name} = $name) =~ s/[._]pl\z//i ; |
1475
|
|
|
|
|
|
|
} |
1476
|
|
|
|
|
|
|
else { |
1477
|
0
|
|
|
|
|
0
|
$pm{$name} = $self->catfile($self->{INST_LIBDIR},$name); |
1478
|
|
|
|
|
|
|
} |
1479
|
|
|
|
|
|
|
} elsif ($name =~ /\.(p[ml]|pod)\z/){ |
1480
|
0
|
|
|
|
|
0
|
$pm{$name} = $self->catfile($self->{INST_LIBDIR},$name); |
1481
|
|
|
|
|
|
|
} |
1482
|
|
|
|
|
|
|
} |
1483
|
|
|
|
|
|
|
|
1484
|
156
|
|
50
|
|
|
1963
|
$self->{PL_FILES} ||= \%pl_files; |
1485
|
156
|
|
100
|
|
|
2101
|
$self->{DIR} ||= [sort keys %dir]; |
1486
|
156
|
|
50
|
|
|
1680
|
$self->{XS} ||= \%xs; |
1487
|
156
|
|
50
|
|
|
1267
|
$self->{C} ||= [sort keys %c]; |
1488
|
156
|
|
50
|
|
|
1128
|
$self->{H} ||= [sort keys %h]; |
1489
|
156
|
|
100
|
|
|
1072
|
$self->{PM} ||= \%pm; |
1490
|
|
|
|
|
|
|
|
1491
|
156
|
|
|
|
|
286
|
my @o_files = @{$self->{C}}; |
|
156
|
|
|
|
|
573
|
|
1492
|
156
|
|
|
|
|
615
|
%o = (%o, map { $_ => 1 } grep s/\.c(pp|xx|c)?\z/$self->{OBJ_EXT}/i, @o_files); |
|
0
|
|
|
|
|
0
|
|
1493
|
156
|
|
|
|
|
1276
|
$self->{O_FILES} = [sort keys %o]; |
1494
|
|
|
|
|
|
|
} |
1495
|
|
|
|
|
|
|
|
1496
|
|
|
|
|
|
|
|
1497
|
|
|
|
|
|
|
=item init_MANPODS |
1498
|
|
|
|
|
|
|
|
1499
|
|
|
|
|
|
|
Determines if man pages should be generated and initializes MAN1PODS |
1500
|
|
|
|
|
|
|
and MAN3PODS as appropriate. |
1501
|
|
|
|
|
|
|
|
1502
|
|
|
|
|
|
|
=cut |
1503
|
|
|
|
|
|
|
|
1504
|
|
|
|
|
|
|
sub init_MANPODS { |
1505
|
156
|
|
|
156
|
1
|
423
|
my $self = shift; |
1506
|
|
|
|
|
|
|
|
1507
|
|
|
|
|
|
|
# Set up names of manual pages to generate from pods |
1508
|
156
|
|
|
|
|
814
|
foreach my $man (qw(MAN1 MAN3)) { |
1509
|
312
|
100
|
100
|
|
|
3312
|
if ( $self->{"${man}PODS"} |
1510
|
|
|
|
|
|
|
or $self->{"INSTALL${man}DIR"} =~ /^(none|\s*)$/ |
1511
|
|
|
|
|
|
|
) { |
1512
|
231
|
|
100
|
|
|
1560
|
$self->{"${man}PODS"} ||= {}; |
1513
|
|
|
|
|
|
|
} |
1514
|
|
|
|
|
|
|
else { |
1515
|
81
|
|
|
|
|
219
|
my $init_method = "init_${man}PODS"; |
1516
|
81
|
|
|
|
|
1098
|
$self->$init_method(); |
1517
|
|
|
|
|
|
|
} |
1518
|
|
|
|
|
|
|
} |
1519
|
|
|
|
|
|
|
|
1520
|
|
|
|
|
|
|
# logic similar to picking man${num}ext in perl's Configure script |
1521
|
156
|
|
|
|
|
555
|
foreach my $num (1,3) { |
1522
|
312
|
|
|
|
|
908
|
my $installdirs = uc $self->{INSTALLDIRS}; |
1523
|
312
|
100
|
|
|
|
863
|
$installdirs = '' if $installdirs eq 'PERL'; |
1524
|
|
|
|
|
|
|
my @mandirs = File::Spec->splitdir( $self->_expand_macros( |
1525
|
312
|
|
|
|
|
2961
|
$self->{ "INSTALL${installdirs}MAN${num}DIR" } ) ); |
1526
|
312
|
|
|
|
|
1004
|
my $mandir = pop @mandirs; |
1527
|
312
|
|
|
|
|
678
|
my $section = $num; |
1528
|
|
|
|
|
|
|
|
1529
|
312
|
|
|
|
|
1136
|
foreach ($num, "${num}p", "${num}pm", qw< l n o C L >, "L$num") { |
1530
|
2623
|
100
|
|
|
|
43861
|
if ( $mandir =~ /^(?:man|cat)$_$/ ) { |
1531
|
48
|
|
|
|
|
124
|
$section = $_; |
1532
|
48
|
|
|
|
|
101
|
last; |
1533
|
|
|
|
|
|
|
} |
1534
|
|
|
|
|
|
|
} |
1535
|
|
|
|
|
|
|
|
1536
|
312
|
|
|
|
|
1925
|
$self->{"MAN${num}SECTION"} = $section; |
1537
|
|
|
|
|
|
|
} |
1538
|
|
|
|
|
|
|
} |
1539
|
|
|
|
|
|
|
|
1540
|
|
|
|
|
|
|
|
1541
|
|
|
|
|
|
|
sub _has_pod { |
1542
|
42
|
|
|
42
|
|
201
|
my($self, $file) = @_; |
1543
|
|
|
|
|
|
|
|
1544
|
42
|
|
|
|
|
117
|
my($ispod)=0; |
1545
|
42
|
50
|
|
|
|
1709
|
if (open( my $fh, '<', $file )) { |
1546
|
42
|
|
|
|
|
1292
|
while (<$fh>) { |
1547
|
211
|
100
|
|
|
|
1067
|
if (/^=(?:head\d+|item|pod)\b/) { |
1548
|
22
|
|
|
|
|
60
|
$ispod=1; |
1549
|
22
|
|
|
|
|
61
|
last; |
1550
|
|
|
|
|
|
|
} |
1551
|
|
|
|
|
|
|
} |
1552
|
42
|
|
|
|
|
551
|
close $fh; |
1553
|
|
|
|
|
|
|
} else { |
1554
|
|
|
|
|
|
|
# If it doesn't exist yet, we assume, it has pods in it |
1555
|
0
|
|
|
|
|
0
|
$ispod = 1; |
1556
|
|
|
|
|
|
|
} |
1557
|
|
|
|
|
|
|
|
1558
|
42
|
|
|
|
|
393
|
return $ispod; |
1559
|
|
|
|
|
|
|
} |
1560
|
|
|
|
|
|
|
|
1561
|
|
|
|
|
|
|
|
1562
|
|
|
|
|
|
|
=item init_MAN1PODS |
1563
|
|
|
|
|
|
|
|
1564
|
|
|
|
|
|
|
Initializes MAN1PODS from the list of EXE_FILES. |
1565
|
|
|
|
|
|
|
|
1566
|
|
|
|
|
|
|
=cut |
1567
|
|
|
|
|
|
|
|
1568
|
|
|
|
|
|
|
sub init_MAN1PODS { |
1569
|
40
|
|
|
40
|
1
|
204
|
my($self) = @_; |
1570
|
|
|
|
|
|
|
|
1571
|
40
|
100
|
|
|
|
246
|
if ( exists $self->{EXE_FILES} ) { |
1572
|
1
|
|
|
|
|
2
|
foreach my $name (@{$self->{EXE_FILES}}) { |
|
1
|
|
|
|
|
5
|
|
1573
|
1
|
50
|
|
|
|
11
|
next unless $self->_has_pod($name); |
1574
|
|
|
|
|
|
|
|
1575
|
1
|
|
|
|
|
47
|
$self->{MAN1PODS}->{$name} = |
1576
|
|
|
|
|
|
|
$self->catfile("\$(INST_MAN1DIR)", |
1577
|
|
|
|
|
|
|
basename($name).".\$(MAN1EXT)"); |
1578
|
|
|
|
|
|
|
} |
1579
|
|
|
|
|
|
|
} |
1580
|
|
|
|
|
|
|
} |
1581
|
|
|
|
|
|
|
|
1582
|
|
|
|
|
|
|
|
1583
|
|
|
|
|
|
|
=item init_MAN3PODS |
1584
|
|
|
|
|
|
|
|
1585
|
|
|
|
|
|
|
Initializes MAN3PODS from the list of PM files. |
1586
|
|
|
|
|
|
|
|
1587
|
|
|
|
|
|
|
=cut |
1588
|
|
|
|
|
|
|
|
1589
|
|
|
|
|
|
|
sub init_MAN3PODS { |
1590
|
41
|
|
|
41
|
1
|
86
|
my $self = shift; |
1591
|
|
|
|
|
|
|
|
1592
|
41
|
|
|
|
|
86
|
my %manifypods = (); # we collect the keys first, i.e. the files |
1593
|
|
|
|
|
|
|
# we have to convert to pod |
1594
|
|
|
|
|
|
|
|
1595
|
41
|
|
|
|
|
125
|
foreach my $name (keys %{$self->{PM}}) { |
|
41
|
|
|
|
|
199
|
|
1596
|
41
|
50
|
|
|
|
382
|
if ($name =~ /\.pod\z/ ) { |
|
|
50
|
|
|
|
|
|
1597
|
0
|
|
|
|
|
0
|
$manifypods{$name} = $self->{PM}{$name}; |
1598
|
|
|
|
|
|
|
} elsif ($name =~ /\.p[ml]\z/ ) { |
1599
|
41
|
100
|
|
|
|
269
|
if( $self->_has_pod($name) ) { |
1600
|
21
|
|
|
|
|
132
|
$manifypods{$name} = $self->{PM}{$name}; |
1601
|
|
|
|
|
|
|
} |
1602
|
|
|
|
|
|
|
} |
1603
|
|
|
|
|
|
|
} |
1604
|
|
|
|
|
|
|
|
1605
|
41
|
|
|
|
|
128
|
my $parentlibs_re = join '|', @{$self->{PMLIBPARENTDIRS}}; |
|
41
|
|
|
|
|
150
|
|
1606
|
|
|
|
|
|
|
|
1607
|
|
|
|
|
|
|
# Remove "Configure.pm" and similar, if it's not the only pod listed |
1608
|
|
|
|
|
|
|
# To force inclusion, just name it "Configure.pod", or override |
1609
|
|
|
|
|
|
|
# MAN3PODS |
1610
|
41
|
|
|
|
|
246
|
foreach my $name (keys %manifypods) { |
1611
|
21
|
50
|
33
|
|
|
245
|
if ( |
|
|
|
33
|
|
|
|
|
1612
|
|
|
|
|
|
|
($self->{PERL_CORE} and $name =~ /(config|setup).*\.pm/is) or |
1613
|
|
|
|
|
|
|
( $name =~ m/^README\.pod$/i ) # don't manify top-level README.pod |
1614
|
|
|
|
|
|
|
) { |
1615
|
0
|
|
|
|
|
0
|
delete $manifypods{$name}; |
1616
|
0
|
|
|
|
|
0
|
next; |
1617
|
|
|
|
|
|
|
} |
1618
|
21
|
|
|
|
|
101
|
my($manpagename) = $name; |
1619
|
21
|
|
|
|
|
198
|
$manpagename =~ s/\.p(od|m|l)\z//; |
1620
|
|
|
|
|
|
|
# everything below lib is ok |
1621
|
21
|
50
|
|
|
|
289
|
unless($manpagename =~ s!^\W*($parentlibs_re)\W+!!s) { |
1622
|
|
|
|
|
|
|
$manpagename = $self->catfile( |
1623
|
0
|
|
|
|
|
0
|
split(/::/,$self->{PARENT_NAME}),$manpagename |
1624
|
|
|
|
|
|
|
); |
1625
|
|
|
|
|
|
|
} |
1626
|
21
|
|
|
|
|
297
|
$manpagename = $self->replace_manpage_separator($manpagename); |
1627
|
21
|
|
|
|
|
105
|
$self->{MAN3PODS}->{$name} = |
1628
|
|
|
|
|
|
|
$self->catfile("\$(INST_MAN3DIR)", "$manpagename.\$(MAN3EXT)"); |
1629
|
|
|
|
|
|
|
} |
1630
|
|
|
|
|
|
|
} |
1631
|
|
|
|
|
|
|
|
1632
|
|
|
|
|
|
|
|
1633
|
|
|
|
|
|
|
=item init_PM |
1634
|
|
|
|
|
|
|
|
1635
|
|
|
|
|
|
|
Initializes PMLIBDIRS and PM from PMLIBDIRS. |
1636
|
|
|
|
|
|
|
|
1637
|
|
|
|
|
|
|
=cut |
1638
|
|
|
|
|
|
|
|
1639
|
|
|
|
|
|
|
sub init_PM { |
1640
|
156
|
|
|
156
|
1
|
354
|
my $self = shift; |
1641
|
|
|
|
|
|
|
|
1642
|
|
|
|
|
|
|
# Some larger extensions often wish to install a number of *.pm/pl |
1643
|
|
|
|
|
|
|
# files into the library in various locations. |
1644
|
|
|
|
|
|
|
|
1645
|
|
|
|
|
|
|
# The attribute PMLIBDIRS holds an array reference which lists |
1646
|
|
|
|
|
|
|
# subdirectories which we should search for library files to |
1647
|
|
|
|
|
|
|
# install. PMLIBDIRS defaults to [ 'lib', $self->{BASEEXT} ]. We |
1648
|
|
|
|
|
|
|
# recursively search through the named directories (skipping any |
1649
|
|
|
|
|
|
|
# which don't exist or contain Makefile.PL files). |
1650
|
|
|
|
|
|
|
|
1651
|
|
|
|
|
|
|
# For each *.pm or *.pl file found $self->libscan() is called with |
1652
|
|
|
|
|
|
|
# the default installation path in $_[1]. The return value of |
1653
|
|
|
|
|
|
|
# libscan defines the actual installation location. The default |
1654
|
|
|
|
|
|
|
# libscan function simply returns the path. The file is skipped |
1655
|
|
|
|
|
|
|
# if libscan returns false. |
1656
|
|
|
|
|
|
|
|
1657
|
|
|
|
|
|
|
# The default installation location passed to libscan in $_[1] is: |
1658
|
|
|
|
|
|
|
# |
1659
|
|
|
|
|
|
|
# ./*.pm => $(INST_LIBDIR)/*.pm |
1660
|
|
|
|
|
|
|
# ./xyz/... => $(INST_LIBDIR)/xyz/... |
1661
|
|
|
|
|
|
|
# ./lib/... => $(INST_LIB)/... |
1662
|
|
|
|
|
|
|
# |
1663
|
|
|
|
|
|
|
# In this way the 'lib' directory is seen as the root of the actual |
1664
|
|
|
|
|
|
|
# perl library whereas the others are relative to INST_LIBDIR |
1665
|
|
|
|
|
|
|
# (which includes PARENT_NAME). This is a subtle distinction but one |
1666
|
|
|
|
|
|
|
# that's important for nested modules. |
1667
|
|
|
|
|
|
|
|
1668
|
156
|
50
|
|
|
|
540
|
unless( $self->{PMLIBDIRS} ) { |
1669
|
156
|
50
|
|
|
|
445
|
if( $Is{VMS} ) { |
1670
|
|
|
|
|
|
|
# Avoid logical name vs directory collisions |
1671
|
0
|
|
|
|
|
0
|
$self->{PMLIBDIRS} = ['./lib', "./$self->{BASEEXT}"]; |
1672
|
|
|
|
|
|
|
} |
1673
|
|
|
|
|
|
|
else { |
1674
|
156
|
|
|
|
|
678
|
$self->{PMLIBDIRS} = ['lib', $self->{BASEEXT}]; |
1675
|
|
|
|
|
|
|
} |
1676
|
|
|
|
|
|
|
} |
1677
|
|
|
|
|
|
|
|
1678
|
|
|
|
|
|
|
#only existing directories that aren't in $dir are allowed |
1679
|
|
|
|
|
|
|
|
1680
|
|
|
|
|
|
|
# Avoid $_ wherever possible: |
1681
|
|
|
|
|
|
|
# @{$self->{PMLIBDIRS}} = grep -d && !$dir{$_}, @{$self->{PMLIBDIRS}}; |
1682
|
156
|
|
|
|
|
304
|
my (@pmlibdirs) = @{$self->{PMLIBDIRS}}; |
|
156
|
|
|
|
|
517
|
|
1683
|
156
|
|
|
|
|
284
|
@{$self->{PMLIBDIRS}} = (); |
|
156
|
|
|
|
|
466
|
|
1684
|
156
|
|
|
|
|
401
|
my %dir = map { ($_ => $_) } @{$self->{DIR}}; |
|
58
|
|
|
|
|
289
|
|
|
156
|
|
|
|
|
433
|
|
1685
|
156
|
|
|
|
|
509
|
foreach my $pmlibdir (@pmlibdirs) { |
1686
|
312
|
100
|
66
|
|
|
4287
|
-d $pmlibdir && !$dir{$pmlibdir} && push @{$self->{PMLIBDIRS}}, $pmlibdir; |
|
124
|
|
|
|
|
541
|
|
1687
|
|
|
|
|
|
|
} |
1688
|
|
|
|
|
|
|
|
1689
|
156
|
50
|
|
|
|
655
|
unless( $self->{PMLIBPARENTDIRS} ) { |
1690
|
156
|
|
|
|
|
328
|
@{$self->{PMLIBPARENTDIRS}} = ('lib'); |
|
156
|
|
|
|
|
826
|
|
1691
|
|
|
|
|
|
|
} |
1692
|
|
|
|
|
|
|
|
1693
|
156
|
100
|
66
|
|
|
1320
|
return if $self->{PM} and $self->{ARGS}{PM}; |
1694
|
|
|
|
|
|
|
|
1695
|
155
|
100
|
|
|
|
323
|
if (@{$self->{PMLIBDIRS}}){ |
|
155
|
|
|
|
|
525
|
|
1696
|
123
|
50
|
|
|
|
355
|
print "Searching PMLIBDIRS: @{$self->{PMLIBDIRS}}\n" |
|
0
|
|
|
|
|
0
|
|
1697
|
|
|
|
|
|
|
if ($Verbose >= 2); |
1698
|
123
|
|
|
|
|
782
|
require File::Find; |
1699
|
|
|
|
|
|
|
File::Find::find(sub { |
1700
|
369
|
100
|
|
369
|
|
4795
|
if (-d $_){ |
1701
|
246
|
50
|
|
|
|
1327
|
unless ($self->libscan($_)){ |
1702
|
0
|
|
|
|
|
0
|
$File::Find::prune = 1; |
1703
|
|
|
|
|
|
|
} |
1704
|
246
|
|
|
|
|
23123
|
return; |
1705
|
|
|
|
|
|
|
} |
1706
|
123
|
50
|
|
|
|
756
|
return if /\#/; |
1707
|
123
|
50
|
|
|
|
439
|
return if /~$/; # emacs temp files |
1708
|
123
|
50
|
|
|
|
386
|
return if /,v$/; # RCS files |
1709
|
123
|
50
|
|
|
|
364
|
return if m{\.swp$}; # vim swap files |
1710
|
|
|
|
|
|
|
|
1711
|
123
|
|
|
|
|
277
|
my $path = $File::Find::name; |
1712
|
123
|
|
|
|
|
321
|
my $prefix = $self->{INST_LIBDIR}; |
1713
|
123
|
|
|
|
|
184
|
my $striplibpath; |
1714
|
|
|
|
|
|
|
|
1715
|
123
|
|
|
|
|
236
|
my $parentlibs_re = join '|', @{$self->{PMLIBPARENTDIRS}}; |
|
123
|
|
|
|
|
476
|
|
1716
|
|
|
|
|
|
|
$prefix = $self->{INST_LIB} |
1717
|
123
|
50
|
|
|
|
2535
|
if ($striplibpath = $path) =~ s{^(\W*)($parentlibs_re)\W} |
1718
|
|
|
|
|
|
|
{$1}i; |
1719
|
123
|
|
|
|
|
733
|
|
1720
|
123
|
|
|
|
|
391
|
my($inst) = $self->catfile($prefix,$striplibpath); |
1721
|
123
|
|
|
|
|
364
|
local($_) = $inst; # for backwards compatibility |
1722
|
123
|
50
|
|
|
|
503
|
$inst = $self->libscan($inst); |
1723
|
123
|
50
|
|
|
|
360
|
print "libscan($path) => '$inst'\n" if ($Verbose >= 2); |
1724
|
123
|
50
|
33
|
|
|
559
|
return unless $inst; |
1725
|
0
|
|
|
|
|
0
|
if ($self->{XSMULTI} and $inst =~ /\.xs\z/) { |
|
0
|
|
|
|
|
0
|
|
1726
|
0
|
|
|
|
|
0
|
my($base); ($base = $path) =~ s/\.xs\z//; |
1727
|
0
|
|
|
|
|
0
|
$self->{XS}{$path} = "$base.c"; |
|
0
|
|
|
|
|
0
|
|
1728
|
0
|
|
|
|
|
0
|
push @{$self->{C}}, "$base.c"; |
|
0
|
|
|
|
|
0
|
|
1729
|
|
|
|
|
|
|
push @{$self->{O_FILES}}, "$base$self->{OBJ_EXT}"; |
1730
|
123
|
|
|
|
|
4704
|
} else { |
1731
|
|
|
|
|
|
|
$self->{PM}{$path} = $inst; |
1732
|
123
|
|
|
|
|
1198
|
} |
|
123
|
|
|
|
|
14914
|
|
1733
|
|
|
|
|
|
|
}, @{$self->{PMLIBDIRS}}); |
1734
|
|
|
|
|
|
|
} |
1735
|
|
|
|
|
|
|
} |
1736
|
|
|
|
|
|
|
|
1737
|
|
|
|
|
|
|
|
1738
|
|
|
|
|
|
|
=item init_DIRFILESEP |
1739
|
|
|
|
|
|
|
|
1740
|
|
|
|
|
|
|
Using / for Unix. Called by init_main. |
1741
|
|
|
|
|
|
|
|
1742
|
|
|
|
|
|
|
=cut |
1743
|
|
|
|
|
|
|
|
1744
|
156
|
|
|
156
|
1
|
620
|
sub init_DIRFILESEP { |
1745
|
|
|
|
|
|
|
my($self) = shift; |
1746
|
156
|
|
|
|
|
1731
|
|
1747
|
|
|
|
|
|
|
$self->{DIRFILESEP} = '/'; |
1748
|
|
|
|
|
|
|
} |
1749
|
|
|
|
|
|
|
|
1750
|
|
|
|
|
|
|
|
1751
|
|
|
|
|
|
|
=item init_main |
1752
|
|
|
|
|
|
|
|
1753
|
|
|
|
|
|
|
Initializes AR, AR_STATIC_ARGS, BASEEXT, CONFIG, DISTNAME, DLBASE, |
1754
|
|
|
|
|
|
|
EXE_EXT, FULLEXT, FULLPERL, FULLPERLRUN, FULLPERLRUNINST, INST_*, |
1755
|
|
|
|
|
|
|
INSTALL*, INSTALLDIRS, LIB_EXT, LIBPERL_A, MAP_TARGET, NAME, |
1756
|
|
|
|
|
|
|
OBJ_EXT, PARENT_NAME, PERL, PERL_ARCHLIB, PERL_INC, PERL_LIB, |
1757
|
|
|
|
|
|
|
PERL_SRC, PERLRUN, PERLRUNINST, PREFIX, VERSION, |
1758
|
|
|
|
|
|
|
VERSION_SYM, XS_VERSION. |
1759
|
|
|
|
|
|
|
|
1760
|
|
|
|
|
|
|
=cut |
1761
|
|
|
|
|
|
|
|
1762
|
156
|
|
|
156
|
1
|
553
|
sub init_main { |
1763
|
|
|
|
|
|
|
my($self) = @_; |
1764
|
|
|
|
|
|
|
|
1765
|
|
|
|
|
|
|
# --- Initialize Module Name and Paths |
1766
|
|
|
|
|
|
|
|
1767
|
|
|
|
|
|
|
# NAME = Foo::Bar::Oracle |
1768
|
|
|
|
|
|
|
# FULLEXT = Foo/Bar/Oracle |
1769
|
|
|
|
|
|
|
# BASEEXT = Oracle |
1770
|
|
|
|
|
|
|
# PARENT_NAME = Foo::Bar |
1771
|
|
|
|
|
|
|
### Only UNIX: |
1772
|
|
|
|
|
|
|
### ($self->{FULLEXT} = |
1773
|
156
|
|
|
|
|
2428
|
### $self->{NAME}) =~ s!::!/!g ; #eg. BSD/Foo/Socket |
1774
|
|
|
|
|
|
|
$self->{FULLEXT} = $self->catdir(split /::/, $self->{NAME}); |
1775
|
|
|
|
|
|
|
|
1776
|
|
|
|
|
|
|
|
1777
|
|
|
|
|
|
|
# Copied from DynaLoader: |
1778
|
156
|
|
|
|
|
1179
|
|
1779
|
156
|
|
|
|
|
553
|
my(@modparts) = split(/::/,$self->{NAME}); |
1780
|
|
|
|
|
|
|
my($modfname) = $modparts[-1]; |
1781
|
|
|
|
|
|
|
|
1782
|
|
|
|
|
|
|
# Some systems have restrictions on files names for DLL's etc. |
1783
|
|
|
|
|
|
|
# mod2fname returns appropriate file base name (typically truncated) |
1784
|
|
|
|
|
|
|
# It may also edit @modparts if required. |
1785
|
156
|
|
|
|
|
347
|
# We require DynaLoader to make sure that mod2fname is loaded |
|
156
|
|
|
|
|
894
|
|
1786
|
156
|
50
|
|
|
|
642
|
eval { require DynaLoader }; |
1787
|
0
|
|
|
|
|
0
|
if (defined &DynaLoader::mod2fname) { |
1788
|
|
|
|
|
|
|
$modfname = &DynaLoader::mod2fname(\@modparts); |
1789
|
|
|
|
|
|
|
} |
1790
|
156
|
|
|
|
|
2697
|
|
1791
|
156
|
|
100
|
|
|
731
|
($self->{PARENT_NAME}, $self->{BASEEXT}) = $self->{NAME} =~ m!(?:([\w:]+)::)?(\w+)\z! ; |
1792
|
|
|
|
|
|
|
$self->{PARENT_NAME} ||= ''; |
1793
|
156
|
50
|
|
|
|
524
|
|
1794
|
|
|
|
|
|
|
if (defined &DynaLoader::mod2fname) { |
1795
|
0
|
|
|
|
|
0
|
# As of 5.001m, dl_os2 appends '_' |
1796
|
|
|
|
|
|
|
$self->{DLBASE} = $modfname; |
1797
|
156
|
|
|
|
|
836
|
} else { |
1798
|
|
|
|
|
|
|
$self->{DLBASE} = '$(BASEEXT)'; |
1799
|
|
|
|
|
|
|
} |
1800
|
|
|
|
|
|
|
|
1801
|
|
|
|
|
|
|
|
1802
|
|
|
|
|
|
|
# --- Initialize PERL_LIB, PERL_SRC |
1803
|
|
|
|
|
|
|
|
1804
|
156
|
|
|
|
|
12789
|
# *Real* information: where did we get these two from? ... |
1805
|
156
|
|
|
|
|
5063
|
my $inc_config_dir = dirname($INC{'Config.pm'}); |
1806
|
|
|
|
|
|
|
my $inc_carp_dir = dirname($INC{'Carp.pm'}); |
1807
|
156
|
50
|
|
|
|
853
|
|
1808
|
156
|
|
|
|
|
675
|
unless ($self->{PERL_SRC}){ |
1809
|
1248
|
|
|
|
|
8903
|
foreach my $dir_count (1..8) { # 8 is the VMS limit for nesting |
1810
|
|
|
|
|
|
|
my $dir = $self->catdir(($Updir) x $dir_count); |
1811
|
1248
|
0
|
33
|
|
|
6591
|
|
|
|
|
33
|
|
|
|
|
1812
|
|
|
|
|
|
|
if (-f $self->catfile($dir,"config_h.SH") && |
1813
|
|
|
|
|
|
|
-f $self->catfile($dir,"perl.h") && |
1814
|
|
|
|
|
|
|
-f $self->catfile($dir,"lib","strict.pm") |
1815
|
0
|
|
|
|
|
0
|
) { |
1816
|
0
|
|
|
|
|
0
|
$self->{PERL_SRC}=$dir ; |
1817
|
|
|
|
|
|
|
last; |
1818
|
|
|
|
|
|
|
} |
1819
|
|
|
|
|
|
|
} |
1820
|
|
|
|
|
|
|
} |
1821
|
|
|
|
|
|
|
|
1822
|
156
|
50
|
33
|
|
|
981
|
warn "PERL_CORE is set but I can't find your PERL_SRC!\n" if |
1823
|
|
|
|
|
|
|
$self->{PERL_CORE} and !$self->{PERL_SRC}; |
1824
|
156
|
50
|
|
|
|
617
|
|
1825
|
0
|
|
0
|
|
|
0
|
if ($self->{PERL_SRC}){ |
1826
|
|
|
|
|
|
|
$self->{PERL_LIB} ||= $self->catdir("$self->{PERL_SRC}","lib"); |
1827
|
0
|
|
|
|
|
0
|
|
1828
|
|
|
|
|
|
|
$self->{PERL_ARCHLIB} = $self->{PERL_LIB}; |
1829
|
0
|
0
|
|
|
|
0
|
$self->{PERL_INC} = ($Is{Win32}) ? |
1830
|
|
|
|
|
|
|
$self->catdir($self->{PERL_LIB},"CORE") : $self->{PERL_SRC}; |
1831
|
|
|
|
|
|
|
|
1832
|
0
|
0
|
0
|
|
|
0
|
# catch a situation that has occurred a few times in the past: |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
1833
|
|
|
|
|
|
|
unless ( |
1834
|
|
|
|
|
|
|
-s $self->catfile($self->{PERL_SRC},'cflags') |
1835
|
|
|
|
|
|
|
or |
1836
|
|
|
|
|
|
|
$Is{VMS} |
1837
|
|
|
|
|
|
|
&& |
1838
|
|
|
|
|
|
|
-s $self->catfile($self->{PERL_SRC},'vmsish.h') |
1839
|
|
|
|
|
|
|
or |
1840
|
|
|
|
|
|
|
$Is{Win32} |
1841
|
0
|
|
|
|
|
0
|
){ |
1842
|
|
|
|
|
|
|
warn qq{ |
1843
|
|
|
|
|
|
|
You cannot build extensions below the perl source tree after executing |
1844
|
|
|
|
|
|
|
a 'make clean' in the perl source tree. |
1845
|
|
|
|
|
|
|
|
1846
|
|
|
|
|
|
|
To rebuild extensions distributed with the perl source you should |
1847
|
|
|
|
|
|
|
simply Configure (to include those extensions) and then build perl as |
1848
|
|
|
|
|
|
|
normal. After installing perl the source tree can be deleted. It is |
1849
|
|
|
|
|
|
|
not needed for building extensions by running 'perl Makefile.PL' |
1850
|
|
|
|
|
|
|
usually without extra arguments. |
1851
|
|
|
|
|
|
|
|
1852
|
|
|
|
|
|
|
It is recommended that you unpack and build additional extensions away |
1853
|
|
|
|
|
|
|
from the perl source tree. |
1854
|
|
|
|
|
|
|
}; |
1855
|
|
|
|
|
|
|
} |
1856
|
|
|
|
|
|
|
} else { |
1857
|
156
|
|
66
|
|
|
2164
|
# we should also consider $ENV{PERL5LIB} here |
1858
|
156
|
|
33
|
|
|
1806
|
my $old = $self->{PERL_LIB} || $self->{PERL_ARCHLIB} || $self->{PERL_INC}; |
1859
|
156
|
|
66
|
|
|
1124
|
$self->{PERL_LIB} ||= $Config{privlibexp}; |
1860
|
156
|
|
|
|
|
1577
|
$self->{PERL_ARCHLIB} ||= $Config{archlibexp}; |
1861
|
156
|
|
|
|
|
416
|
$self->{PERL_INC} = $self->catdir("$self->{PERL_ARCHLIB}","CORE"); # wild guess for now |
1862
|
|
|
|
|
|
|
my $perl_h; |
1863
|
156
|
0
|
33
|
|
|
615
|
|
1864
|
|
|
|
|
|
|
if (not -f ($perl_h = $self->catfile($self->{PERL_INC},"perl.h")) |
1865
|
|
|
|
|
|
|
and not $old){ |
1866
|
|
|
|
|
|
|
# Maybe somebody tries to build an extension with an |
1867
|
0
|
|
|
|
|
0
|
# uninstalled Perl outside of Perl build tree |
1868
|
0
|
|
|
|
|
0
|
my $lib; |
1869
|
0
|
0
|
|
|
|
0
|
for my $dir (@INC) { |
1870
|
|
|
|
|
|
|
$lib = $dir, last if -e $self->catfile($dir, "Config.pm"); |
1871
|
0
|
0
|
|
|
|
0
|
} |
1872
|
|
|
|
|
|
|
if ($lib) { |
1873
|
|
|
|
|
|
|
# Win32 puts its header files in /perl/src/lib/CORE. |
1874
|
0
|
0
|
|
|
|
0
|
# Unix leaves them in /perl/src. |
1875
|
|
|
|
|
|
|
my $inc = $Is{Win32} ? $self->catdir($lib, "CORE" ) |
1876
|
0
|
0
|
|
|
|
0
|
: dirname $lib; |
1877
|
0
|
|
|
|
|
0
|
if (-e $self->catfile($inc, "perl.h")) { |
1878
|
0
|
|
|
|
|
0
|
$self->{PERL_LIB} = $lib; |
1879
|
0
|
|
|
|
|
0
|
$self->{PERL_ARCHLIB} = $lib; |
1880
|
0
|
|
|
|
|
0
|
$self->{PERL_INC} = $inc; |
1881
|
0
|
|
|
|
|
0
|
$self->{UNINSTALLED_PERL} = 1; |
1882
|
|
|
|
|
|
|
print <<EOP; |
1883
|
|
|
|
|
|
|
... Detected uninstalled Perl. Trying to continue. |
1884
|
|
|
|
|
|
|
EOP |
1885
|
|
|
|
|
|
|
} |
1886
|
|
|
|
|
|
|
} |
1887
|
|
|
|
|
|
|
} |
1888
|
|
|
|
|
|
|
} |
1889
|
156
|
50
|
|
|
|
862
|
|
1890
|
|
|
|
|
|
|
if ($Is{Android}) { |
1891
|
|
|
|
|
|
|
# Android fun times! |
1892
|
|
|
|
|
|
|
# ../../perl -I../../lib -MFile::Glob -e1 works |
1893
|
|
|
|
|
|
|
# ../../../perl -I../../../lib -MFile::Glob -e1 fails to find |
1894
|
|
|
|
|
|
|
# the .so for File::Glob. |
1895
|
|
|
|
|
|
|
# This always affects core perl, but may also affect an installed |
1896
|
0
|
|
|
|
|
0
|
# perl built with -Duserelocatableinc. |
1897
|
0
|
|
|
|
|
0
|
$self->{PERL_LIB} = File::Spec->rel2abs($self->{PERL_LIB}); |
1898
|
|
|
|
|
|
|
$self->{PERL_ARCHLIB} = File::Spec->rel2abs($self->{PERL_ARCHLIB}); |
1899
|
156
|
|
|
|
|
674
|
} |
1900
|
156
|
|
|
|
|
422
|
$self->{PERL_INCDEP} = $self->{PERL_INC}; |
1901
|
|
|
|
|
|
|
$self->{PERL_ARCHLIBDEP} = $self->{PERL_ARCHLIB}; |
1902
|
|
|
|
|
|
|
|
1903
|
|
|
|
|
|
|
# We get SITELIBEXP and SITEARCHEXP directly via |
1904
|
|
|
|
|
|
|
# Get_from_Config. When we are running standard modules, these |
1905
|
|
|
|
|
|
|
# won't matter, we will set INSTALLDIRS to "perl". Otherwise we |
1906
|
|
|
|
|
|
|
# set it to "site". I prefer that INSTALLDIRS be set from outside |
1907
|
156
|
|
100
|
|
|
1603
|
# MakeMaker. |
1908
|
|
|
|
|
|
|
$self->{INSTALLDIRS} ||= "site"; |
1909
|
156
|
|
66
|
|
|
1298
|
|
1910
|
156
|
|
33
|
|
|
1280
|
$self->{MAN1EXT} ||= $Config{man1ext}; |
1911
|
|
|
|
|
|
|
$self->{MAN3EXT} ||= $Config{man3ext}; |
1912
|
|
|
|
|
|
|
|
1913
|
|
|
|
|
|
|
# Get some stuff out of %Config if we haven't yet done so |
1914
|
156
|
50
|
33
|
|
|
608
|
print "CONFIG must be an array ref\n" |
1915
|
156
|
50
|
|
|
|
1027
|
if ($self->{CONFIG} and ref $self->{CONFIG} ne 'ARRAY'); |
1916
|
156
|
|
|
|
|
362
|
$self->{CONFIG} = [] unless (ref $self->{CONFIG}); |
|
156
|
|
|
|
|
1572
|
|
1917
|
156
|
50
|
|
|
|
756
|
push(@{$self->{CONFIG}}, @ExtUtils::MakeMaker::Get_from_Config); |
|
0
|
|
|
|
|
0
|
|
1918
|
156
|
|
|
|
|
305
|
push(@{$self->{CONFIG}}, 'shellflags') if $Config{shellflags}; |
1919
|
156
|
|
|
|
|
293
|
my(%once_only); |
|
156
|
|
|
|
|
563
|
|
1920
|
3588
|
50
|
|
|
|
7579
|
foreach my $m (@{$self->{CONFIG}}){ |
1921
|
|
|
|
|
|
|
next if $once_only{$m}; |
1922
|
3588
|
50
|
|
|
|
8617
|
print "CONFIG key '$m' does not exist in Config.pm\n" |
1923
|
3588
|
|
100
|
|
|
18635
|
unless exists $Config{$m}; |
1924
|
3588
|
|
|
|
|
10394
|
$self->{uc $m} ||= $Config{$m}; |
1925
|
|
|
|
|
|
|
$once_only{$m} = 1; |
1926
|
|
|
|
|
|
|
} |
1927
|
|
|
|
|
|
|
|
1928
|
|
|
|
|
|
|
# This is too dangerous: |
1929
|
|
|
|
|
|
|
# if ($^O eq "next") { |
1930
|
|
|
|
|
|
|
# $self->{AR} = "libtool"; |
1931
|
|
|
|
|
|
|
# $self->{AR_STATIC_ARGS} = "-o"; |
1932
|
|
|
|
|
|
|
# } |
1933
|
|
|
|
|
|
|
# But I leave it as a placeholder |
1934
|
156
|
|
50
|
|
|
2235
|
|
1935
|
|
|
|
|
|
|
$self->{AR_STATIC_ARGS} ||= "cr"; |
1936
|
|
|
|
|
|
|
|
1937
|
156
|
|
50
|
|
|
520
|
# These should never be needed |
1938
|
156
|
|
50
|
|
|
474
|
$self->{OBJ_EXT} ||= '.o'; |
1939
|
|
|
|
|
|
|
$self->{LIB_EXT} ||= '.a'; |
1940
|
156
|
|
100
|
|
|
1047
|
|
1941
|
|
|
|
|
|
|
$self->{MAP_TARGET} ||= "perl"; |
1942
|
156
|
|
33
|
|
|
2037
|
|
1943
|
|
|
|
|
|
|
$self->{LIBPERL_A} ||= "libperl$self->{LIB_EXT}"; |
1944
|
|
|
|
|
|
|
|
1945
|
|
|
|
|
|
|
# make a simple check if we find strict |
1946
|
|
|
|
|
|
|
warn "Warning: PERL_LIB ($self->{PERL_LIB}) seems not to be a perl library directory |
1947
|
|
|
|
|
|
|
(strict.pm not found)" |
1948
|
156
|
50
|
33
|
|
|
875
|
unless -f $self->catfile("$self->{PERL_LIB}","strict.pm") || |
1949
|
|
|
|
|
|
|
$self->{NAME} eq "ExtUtils::MakeMaker"; |
1950
|
|
|
|
|
|
|
} |
1951
|
|
|
|
|
|
|
|
1952
|
|
|
|
|
|
|
=item init_tools |
1953
|
|
|
|
|
|
|
|
1954
|
|
|
|
|
|
|
Initializes tools to use their common (and faster) Unix commands. |
1955
|
|
|
|
|
|
|
|
1956
|
|
|
|
|
|
|
=cut |
1957
|
|
|
|
|
|
|
|
1958
|
157
|
|
|
157
|
1
|
1185
|
sub init_tools { |
1959
|
|
|
|
|
|
|
my $self = shift; |
1960
|
157
|
|
50
|
|
|
3019
|
|
1961
|
157
|
|
50
|
|
|
1374
|
$self->{ECHO} ||= 'echo'; |
1962
|
157
|
|
50
|
|
|
1218
|
$self->{ECHO_N} ||= 'echo -n'; |
1963
|
157
|
|
50
|
|
|
2098
|
$self->{RM_F} ||= "rm -f"; |
1964
|
157
|
|
50
|
|
|
1250
|
$self->{RM_RF} ||= "rm -rf"; |
1965
|
157
|
|
50
|
|
|
1223
|
$self->{TOUCH} ||= "touch"; |
1966
|
157
|
|
50
|
|
|
1361
|
$self->{TEST_F} ||= "test -f"; |
1967
|
157
|
|
50
|
|
|
1667
|
$self->{TEST_S} ||= "test -s"; |
1968
|
157
|
|
50
|
|
|
1189
|
$self->{CP} ||= "cp"; |
1969
|
157
|
|
50
|
|
|
1414
|
$self->{MV} ||= "mv"; |
1970
|
157
|
|
50
|
|
|
1600
|
$self->{CHMOD} ||= "chmod"; |
1971
|
157
|
|
50
|
|
|
1268
|
$self->{FALSE} ||= 'false'; |
1972
|
|
|
|
|
|
|
$self->{TRUE} ||= 'true'; |
1973
|
157
|
|
100
|
|
|
598
|
|
1974
|
|
|
|
|
|
|
$self->{LD} ||= 'ld'; |
1975
|
157
|
|
|
|
|
2282
|
|
1976
|
|
|
|
|
|
|
return $self->SUPER::init_tools(@_); |
1977
|
|
|
|
|
|
|
|
1978
|
|
|
|
|
|
|
# After SUPER::init_tools so $Config{shell} has a |
1979
|
0
|
|
0
|
|
|
0
|
# chance to get set. |
1980
|
|
|
|
|
|
|
$self->{SHELL} ||= '/bin/sh'; |
1981
|
0
|
|
|
|
|
0
|
|
1982
|
|
|
|
|
|
|
return; |
1983
|
|
|
|
|
|
|
} |
1984
|
|
|
|
|
|
|
|
1985
|
|
|
|
|
|
|
|
1986
|
|
|
|
|
|
|
=item init_linker |
1987
|
|
|
|
|
|
|
|
1988
|
|
|
|
|
|
|
Unix has no need of special linker flags. |
1989
|
|
|
|
|
|
|
|
1990
|
|
|
|
|
|
|
=cut |
1991
|
|
|
|
|
|
|
|
1992
|
157
|
|
|
157
|
1
|
482
|
sub init_linker { |
1993
|
157
|
|
50
|
|
|
2727
|
my($self) = shift; |
1994
|
157
|
|
50
|
|
|
1871
|
$self->{PERL_ARCHIVE} ||= ''; |
1995
|
157
|
|
50
|
|
|
1414
|
$self->{PERL_ARCHIVEDEP} ||= ''; |
1996
|
157
|
|
50
|
|
|
1476
|
$self->{PERL_ARCHIVE_AFTER} ||= ''; |
1997
|
|
|
|
|
|
|
$self->{EXPORT_LIST} ||= ''; |
1998
|
|
|
|
|
|
|
} |
1999
|
|
|
|
|
|
|
|
2000
|
|
|
|
|
|
|
|
2001
|
|
|
|
|
|
|
=begin _protected |
2002
|
|
|
|
|
|
|
|
2003
|
|
|
|
|
|
|
=item init_lib2arch |
2004
|
|
|
|
|
|
|
|
2005
|
|
|
|
|
|
|
$mm->init_lib2arch |
2006
|
|
|
|
|
|
|
|
2007
|
|
|
|
|
|
|
=end _protected |
2008
|
|
|
|
|
|
|
|
2009
|
|
|
|
|
|
|
=cut |
2010
|
|
|
|
|
|
|
|
2011
|
154
|
|
|
154
|
1
|
421
|
sub init_lib2arch { |
2012
|
|
|
|
|
|
|
my($self) = shift; |
2013
|
|
|
|
|
|
|
|
2014
|
|
|
|
|
|
|
# The user who requests an installation directory explicitly |
2015
|
|
|
|
|
|
|
# should not have to tell us an architecture installation directory |
2016
|
|
|
|
|
|
|
# as well. We look if a directory exists that is named after the |
2017
|
|
|
|
|
|
|
# architecture. If not we take it as a sign that it should be the |
2018
|
|
|
|
|
|
|
# same as the requested installation directory. Otherwise we take |
2019
|
154
|
|
|
|
|
2794
|
# the found one. |
2020
|
|
|
|
|
|
|
for my $libpair ({l=>"privlib", a=>"archlib"}, |
2021
|
|
|
|
|
|
|
{l=>"sitelib", a=>"sitearch"}, |
2022
|
|
|
|
|
|
|
{l=>"vendorlib", a=>"vendorarch"}, |
2023
|
|
|
|
|
|
|
) |
2024
|
462
|
|
|
|
|
1389
|
{ |
2025
|
462
|
|
|
|
|
1045
|
my $lib = "install$libpair->{l}"; |
2026
|
462
|
|
|
|
|
941
|
my $Lib = uc $lib; |
2027
|
462
|
50
|
33
|
|
|
1615
|
my $Arch = uc "install$libpair->{a}"; |
2028
|
0
|
|
|
|
|
0
|
if( $self->{$Lib} && ! $self->{$Arch} ){ |
2029
|
|
|
|
|
|
|
my($ilib) = $Config{$lib}; |
2030
|
0
|
|
|
|
|
0
|
|
2031
|
|
|
|
|
|
|
$self->prefixify($Arch,$ilib,$self->{$Lib}); |
2032
|
0
|
0
|
|
|
|
0
|
|
2033
|
0
|
0
|
|
|
|
0
|
unless (-d $self->{$Arch}) { |
2034
|
|
|
|
|
|
|
print "Directory $self->{$Arch} not found\n" |
2035
|
0
|
|
|
|
|
0
|
if $Verbose; |
2036
|
|
|
|
|
|
|
$self->{$Arch} = $self->{$Lib}; |
2037
|
0
|
0
|
|
|
|
0
|
} |
2038
|
|
|
|
|
|
|
print "Defaulting $Arch to $self->{$Arch}\n" if $Verbose; |
2039
|
|
|
|
|
|
|
} |
2040
|
|
|
|
|
|
|
} |
2041
|
|
|
|
|
|
|
} |
2042
|
|
|
|
|
|
|
|
2043
|
|
|
|
|
|
|
|
2044
|
|
|
|
|
|
|
=item init_PERL |
2045
|
|
|
|
|
|
|
|
2046
|
|
|
|
|
|
|
$mm->init_PERL; |
2047
|
|
|
|
|
|
|
|
2048
|
|
|
|
|
|
|
Called by init_main. Sets up ABSPERL, PERL, FULLPERL and all the |
2049
|
|
|
|
|
|
|
*PERLRUN* permutations. |
2050
|
|
|
|
|
|
|
|
2051
|
|
|
|
|
|
|
PERL is allowed to be miniperl |
2052
|
|
|
|
|
|
|
FULLPERL must be a complete perl |
2053
|
|
|
|
|
|
|
|
2054
|
|
|
|
|
|
|
ABSPERL is PERL converted to an absolute path |
2055
|
|
|
|
|
|
|
|
2056
|
|
|
|
|
|
|
*PERLRUN contains everything necessary to run perl, find it's |
2057
|
|
|
|
|
|
|
libraries, etc... |
2058
|
|
|
|
|
|
|
|
2059
|
|
|
|
|
|
|
*PERLRUNINST is *PERLRUN + everything necessary to find the |
2060
|
|
|
|
|
|
|
modules being built. |
2061
|
|
|
|
|
|
|
|
2062
|
|
|
|
|
|
|
=cut |
2063
|
|
|
|
|
|
|
|
2064
|
157
|
|
|
157
|
1
|
437
|
sub init_PERL { |
2065
|
|
|
|
|
|
|
my($self) = shift; |
2066
|
157
|
|
|
|
|
341
|
|
2067
|
157
|
|
|
|
|
4182
|
my @defpath = (); |
2068
|
|
|
|
|
|
|
foreach my $component ($self->{PERL_SRC}, $self->path(), |
2069
|
|
|
|
|
|
|
$Config{binexp}) |
2070
|
1727
|
100
|
|
|
|
4097
|
{ |
2071
|
|
|
|
|
|
|
push @defpath, $component if defined $component; |
2072
|
|
|
|
|
|
|
} |
2073
|
|
|
|
|
|
|
|
2074
|
157
|
|
|
|
|
1048
|
# Build up a set of file names (not command names). |
2075
|
|
|
|
|
|
|
my $thisperl = $self->canonpath($^X); |
2076
|
|
|
|
|
|
|
$thisperl .= $Config{exe_ext} unless |
2077
|
157
|
50
|
|
|
|
1763
|
# VMS might have a file version # at the end |
|
|
50
|
|
|
|
|
|
2078
|
|
|
|
|
|
|
$Is{VMS} ? $thisperl =~ m/$Config{exe_ext}(;\d+)?$/i |
2079
|
|
|
|
|
|
|
: $thisperl =~ m/$Config{exe_ext}$/i; |
2080
|
|
|
|
|
|
|
|
2081
|
157
|
50
|
|
|
|
574
|
# We need a relative path to perl when in the core. |
2082
|
|
|
|
|
|
|
$thisperl = $self->abs2rel($thisperl) if $self->{PERL_CORE}; |
2083
|
157
|
|
|
|
|
503
|
|
2084
|
157
|
|
|
|
|
625
|
my @perls = ($thisperl); |
|
471
|
|
|
|
|
1329
|
|
2085
|
|
|
|
|
|
|
push @perls, map { "$_$Config{exe_ext}" } |
2086
|
|
|
|
|
|
|
("perl$Config{version}", 'perl5', 'perl'); |
2087
|
|
|
|
|
|
|
|
2088
|
|
|
|
|
|
|
# miniperl has priority over all but the canonical perl when in the |
2089
|
157
|
|
|
|
|
490
|
# core. Otherwise its a last resort. |
2090
|
157
|
50
|
|
|
|
519
|
my $miniperl = "miniperl$Config{exe_ext}"; |
2091
|
0
|
|
|
|
|
0
|
if( $self->{PERL_CORE} ) { |
2092
|
|
|
|
|
|
|
splice @perls, 1, 0, $miniperl; |
2093
|
|
|
|
|
|
|
} |
2094
|
157
|
|
|
|
|
324
|
else { |
2095
|
|
|
|
|
|
|
push @perls, $miniperl; |
2096
|
|
|
|
|
|
|
} |
2097
|
|
|
|
|
|
|
|
2098
|
157
|
|
66
|
|
|
2238
|
$self->{PERL} ||= |
2099
|
|
|
|
|
|
|
$self->find_perl(5.0, \@perls, \@defpath, $Verbose ); |
2100
|
157
|
|
|
|
|
1323
|
|
2101
|
157
|
|
|
|
|
2085
|
my $perl = $self->{PERL}; |
2102
|
157
|
|
|
|
|
1412
|
$perl =~ s/^"//; |
2103
|
157
|
|
|
|
|
801
|
my $has_mcr = $perl =~ s/^MCR\s*//; |
2104
|
157
|
|
|
|
|
463
|
my $perlflags = ''; |
2105
|
157
|
|
|
|
|
707
|
my $stripped_perl; |
2106
|
157
|
|
|
|
|
1147
|
while ($perl) { |
2107
|
157
|
50
|
|
|
|
3824
|
($stripped_perl = $perl) =~ s/"$//; |
2108
|
0
|
0
|
|
|
|
0
|
last if -x $stripped_perl; |
2109
|
0
|
|
|
|
|
0
|
last unless $perl =~ s/(\s+\S+)$//; |
2110
|
|
|
|
|
|
|
$perlflags = $1.$perlflags; |
2111
|
157
|
|
|
|
|
905
|
} |
2112
|
157
|
50
|
33
|
|
|
2310
|
$self->{PERL} = $stripped_perl; |
2113
|
|
|
|
|
|
|
$self->{PERL} = 'MCR '.$self->{PERL} if $has_mcr || $Is{VMS}; |
2114
|
|
|
|
|
|
|
|
2115
|
157
|
|
|
|
|
1073
|
# When built for debugging, VMS doesn't create perl.exe but ndbgperl.exe. |
2116
|
|
|
|
|
|
|
my $perl_name = 'perl'; |
2117
|
157
|
0
|
33
|
|
|
960
|
$perl_name = 'ndbgperl' if $Is{VMS} && |
|
|
|
33
|
|
|
|
|
2118
|
|
|
|
|
|
|
defined $Config{usevmsdebug} && $Config{usevmsdebug} eq 'define'; |
2119
|
|
|
|
|
|
|
|
2120
|
|
|
|
|
|
|
# XXX This logic is flawed. If "miniperl" is anywhere in the path |
2121
|
|
|
|
|
|
|
# it will get confused. It should be fixed to work only on the filename. |
2122
|
157
|
100
|
|
|
|
735
|
# Define 'FULLPERL' to be a non-miniperl (used in test: target) |
2123
|
100
|
|
|
|
|
3239
|
unless ($self->{FULLPERL}) { |
2124
|
100
|
|
|
|
|
1287
|
($self->{FULLPERL} = $self->{PERL}) =~ s/\Q$miniperl\E$/$perl_name$Config{exe_ext}/i; |
2125
|
|
|
|
|
|
|
$self->{FULLPERL} = qq{"$self->{FULLPERL}"}.$perlflags; |
2126
|
|
|
|
|
|
|
} |
2127
|
|
|
|
|
|
|
# Can't have an image name with quotes, and findperl will have |
2128
|
157
|
50
|
|
|
|
652
|
# already escaped spaces. |
2129
|
|
|
|
|
|
|
$self->{FULLPERL} =~ tr/"//d if $Is{VMS}; |
2130
|
|
|
|
|
|
|
|
2131
|
|
|
|
|
|
|
# `dmake` can fail for image (aka, executable) names which start with double-quotes |
2132
|
|
|
|
|
|
|
# * push quote inward by at least one character (or the drive prefix, if present) |
2133
|
157
|
50
|
|
|
|
4619
|
# * including any initial directory separator preserves the `file_name_is_absolute` property |
2134
|
|
|
|
|
|
|
$self->{FULLPERL} =~ s/^"(\S(:\\|:)?)/$1"/ if $self->is_make_type('dmake'); |
2135
|
|
|
|
|
|
|
|
2136
|
|
|
|
|
|
|
# Little hack to get around VMS's find_perl putting "MCR" in front |
2137
|
157
|
|
|
|
|
1565
|
# sometimes. |
2138
|
157
|
|
|
|
|
1406
|
$self->{ABSPERL} = $self->{PERL}; |
2139
|
157
|
50
|
|
|
|
4808
|
$has_mcr = $self->{ABSPERL} =~ s/^MCR\s*//; |
2140
|
157
|
|
|
|
|
861
|
if( $self->file_name_is_absolute($self->{ABSPERL}) ) { |
2141
|
|
|
|
|
|
|
$self->{ABSPERL} = '$(PERL)'; |
2142
|
|
|
|
|
|
|
} |
2143
|
0
|
|
|
|
|
0
|
else { |
2144
|
|
|
|
|
|
|
$self->{ABSPERL} = $self->rel2abs($self->{ABSPERL}); |
2145
|
|
|
|
|
|
|
|
2146
|
|
|
|
|
|
|
# Quote the perl command if it contains whitespace |
2147
|
0
|
0
|
|
|
|
0
|
$self->{ABSPERL} = $self->quote_literal($self->{ABSPERL}) |
2148
|
|
|
|
|
|
|
if $self->{ABSPERL} =~ /\s/; |
2149
|
0
|
0
|
|
|
|
0
|
|
2150
|
|
|
|
|
|
|
$self->{ABSPERL} = 'MCR '.$self->{ABSPERL} if $has_mcr; |
2151
|
157
|
|
|
|
|
1716
|
} |
2152
|
|
|
|
|
|
|
$self->{PERL} = qq{"$self->{PERL}"}.$perlflags; |
2153
|
|
|
|
|
|
|
|
2154
|
|
|
|
|
|
|
# Can't have an image name with quotes, and findperl will have |
2155
|
157
|
50
|
|
|
|
828
|
# already escaped spaces. |
2156
|
|
|
|
|
|
|
$self->{PERL} =~ tr/"//d if $Is{VMS}; |
2157
|
|
|
|
|
|
|
|
2158
|
|
|
|
|
|
|
# `dmake` can fail for image (aka, executable) names which start with double-quotes |
2159
|
|
|
|
|
|
|
# * push quote inward by at least one character (or the drive prefix, if present) |
2160
|
157
|
50
|
|
|
|
1192
|
# * including any initial directory separator preserves the `file_name_is_absolute` property |
2161
|
|
|
|
|
|
|
$self->{PERL} =~ s/^"(\S(:\\|:)?)/$1"/ if $self->is_make_type('dmake'); |
2162
|
|
|
|
|
|
|
|
2163
|
157
|
100
|
|
|
|
1513
|
# Are we building the core? |
2164
|
157
|
100
|
|
|
|
1042
|
$self->{PERL_CORE} = $ENV{PERL_CORE} unless exists $self->{PERL_CORE}; |
2165
|
|
|
|
|
|
|
$self->{PERL_CORE} = 0 unless defined $self->{PERL_CORE}; |
2166
|
|
|
|
|
|
|
|
2167
|
|
|
|
|
|
|
# Make sure perl can find itself before it's installed. |
2168
|
157
|
0
|
33
|
|
|
2578
|
my $lib_paths = $self->{UNINSTALLED_PERL} || $self->{PERL_CORE} |
|
|
50
|
0
|
|
|
|
|
2169
|
|
|
|
|
|
|
? ( $self->{PERL_ARCHLIB} && $self->{PERL_LIB} && $self->{PERL_ARCHLIB} ne $self->{PERL_LIB} ) ? |
2170
|
|
|
|
|
|
|
q{ "-I$(PERL_LIB)" "-I$(PERL_ARCHLIB)"} : q{ "-I$(PERL_LIB)"} |
2171
|
|
|
|
|
|
|
: undef; |
2172
|
157
|
50
|
|
|
|
1084
|
my $inst_lib_paths = $self->{INST_ARCHLIB} ne $self->{INST_LIB} |
2173
|
|
|
|
|
|
|
? 'RUN)'.$perlflags.' "-I$(INST_ARCHLIB)" "-I$(INST_LIB)"' |
2174
|
|
|
|
|
|
|
: 'RUN)'.$perlflags.' "-I$(INST_LIB)"'; |
2175
|
157
|
|
|
|
|
1207
|
# How do we run perl? |
2176
|
471
|
|
|
|
|
1720
|
foreach my $perl (qw(PERL FULLPERL ABSPERL)) { |
2177
|
|
|
|
|
|
|
my $run = $perl.'RUN'; |
2178
|
471
|
|
|
|
|
3068
|
|
2179
|
471
|
50
|
|
|
|
1307
|
$self->{$run} = qq{\$($perl)}; |
2180
|
|
|
|
|
|
|
$self->{$run} .= $lib_paths if $lib_paths; |
2181
|
471
|
|
|
|
|
3297
|
|
2182
|
|
|
|
|
|
|
$self->{$perl.'RUNINST'} = '$('.$perl.$inst_lib_paths; |
2183
|
|
|
|
|
|
|
} |
2184
|
157
|
|
|
|
|
4832
|
|
2185
|
|
|
|
|
|
|
return 1; |
2186
|
|
|
|
|
|
|
} |
2187
|
|
|
|
|
|
|
|
2188
|
|
|
|
|
|
|
|
2189
|
|
|
|
|
|
|
=item init_platform |
2190
|
|
|
|
|
|
|
|
2191
|
|
|
|
|
|
|
=item platform_constants |
2192
|
|
|
|
|
|
|
|
2193
|
|
|
|
|
|
|
Add MM_Unix_VERSION. |
2194
|
|
|
|
|
|
|
|
2195
|
|
|
|
|
|
|
=cut |
2196
|
|
|
|
|
|
|
|
2197
|
155
|
|
|
155
|
1
|
500
|
sub init_platform { |
2198
|
|
|
|
|
|
|
my($self) = shift; |
2199
|
155
|
|
|
|
|
633
|
|
2200
|
155
|
|
|
|
|
697
|
$self->{MM_Unix_VERSION} = our $VERSION; |
2201
|
|
|
|
|
|
|
$self->{PERL_MALLOC_DEF} = '-DPERL_EXTMALLOC_DEF -Dmalloc=Perl_malloc '. |
2202
|
|
|
|
|
|
|
'-Dfree=Perl_mfree -Drealloc=Perl_realloc '. |
2203
|
|
|
|
|
|
|
'-Dcalloc=Perl_calloc'; |
2204
|
|
|
|
|
|
|
|
2205
|
|
|
|
|
|
|
} |
2206
|
|
|
|
|
|
|
|
2207
|
154
|
|
|
154
|
1
|
446
|
sub platform_constants { |
2208
|
154
|
|
|
|
|
422
|
my($self) = shift; |
2209
|
|
|
|
|
|
|
my $make_frag = ''; |
2210
|
154
|
|
|
|
|
974
|
|
2211
|
|
|
|
|
|
|
foreach my $macro (qw(MM_Unix_VERSION PERL_MALLOC_DEF)) |
2212
|
308
|
50
|
|
|
|
995
|
{ |
2213
|
308
|
|
|
|
|
1149
|
next unless defined $self->{$macro}; |
2214
|
|
|
|
|
|
|
$make_frag .= "$macro = $self->{$macro}\n"; |
2215
|
|
|
|
|
|
|
} |
2216
|
154
|
|
|
|
|
603
|
|
2217
|
|
|
|
|
|
|
return $make_frag; |
2218
|
|
|
|
|
|
|
} |
2219
|
|
|
|
|
|
|
|
2220
|
|
|
|
|
|
|
|
2221
|
|
|
|
|
|
|
=item init_PERM |
2222
|
|
|
|
|
|
|
|
2223
|
|
|
|
|
|
|
$mm->init_PERM |
2224
|
|
|
|
|
|
|
|
2225
|
|
|
|
|
|
|
Called by init_main. Initializes PERL_* |
2226
|
|
|
|
|
|
|
|
2227
|
|
|
|
|
|
|
=cut |
2228
|
|
|
|
|
|
|
|
2229
|
156
|
|
|
156
|
1
|
572
|
sub init_PERM { |
2230
|
|
|
|
|
|
|
my($self) = shift; |
2231
|
156
|
50
|
|
|
|
807
|
|
2232
|
156
|
50
|
|
|
|
664
|
$self->{PERM_DIR} = 755 unless defined $self->{PERM_DIR}; |
2233
|
156
|
50
|
|
|
|
515
|
$self->{PERM_RW} = 644 unless defined $self->{PERM_RW}; |
2234
|
|
|
|
|
|
|
$self->{PERM_RWX} = 755 unless defined $self->{PERM_RWX}; |
2235
|
156
|
|
|
|
|
372
|
|
2236
|
|
|
|
|
|
|
return 1; |
2237
|
|
|
|
|
|
|
} |
2238
|
|
|
|
|
|
|
|
2239
|
|
|
|
|
|
|
|
2240
|
|
|
|
|
|
|
=item init_xs |
2241
|
|
|
|
|
|
|
|
2242
|
|
|
|
|
|
|
$mm->init_xs |
2243
|
|
|
|
|
|
|
|
2244
|
|
|
|
|
|
|
Sets up macros having to do with XS code. Currently just INST_STATIC, |
2245
|
|
|
|
|
|
|
INST_DYNAMIC and INST_BOOT. |
2246
|
|
|
|
|
|
|
|
2247
|
|
|
|
|
|
|
=cut |
2248
|
|
|
|
|
|
|
|
2249
|
156
|
|
|
156
|
1
|
372
|
sub init_xs { |
2250
|
|
|
|
|
|
|
my $self = shift; |
2251
|
156
|
50
|
|
|
|
1266
|
|
2252
|
|
|
|
|
|
|
if ($self->has_link_code()) { |
2253
|
0
|
|
|
|
|
0
|
$self->{INST_STATIC} = |
2254
|
|
|
|
|
|
|
$self->catfile('$(INST_ARCHAUTODIR)', '$(BASEEXT)$(LIB_EXT)'); |
2255
|
0
|
|
|
|
|
0
|
$self->{INST_DYNAMIC} = |
2256
|
|
|
|
|
|
|
$self->catfile('$(INST_ARCHAUTODIR)', '$(DLBASE).$(DLEXT)'); |
2257
|
0
|
|
|
|
|
0
|
$self->{INST_BOOT} = |
2258
|
0
|
0
|
|
|
|
0
|
$self->catfile('$(INST_ARCHAUTODIR)', '$(BASEEXT).bs'); |
2259
|
0
|
|
|
|
|
0
|
if ($self->{XSMULTI}) { |
2260
|
0
|
|
|
|
|
0
|
my @exts = $self->_xs_list_basenames; |
2261
|
0
|
|
|
|
|
0
|
my (@statics, @dynamics, @boots); |
2262
|
0
|
|
|
|
|
0
|
for my $ext (@exts) { |
2263
|
0
|
|
|
|
|
0
|
my ($v, $d, $f) = File::Spec->splitpath($ext); |
2264
|
0
|
0
|
0
|
|
|
0
|
my @d = File::Spec->splitdir($d); |
2265
|
0
|
0
|
|
|
|
0
|
shift @d if defined $d[0] and $d[0] eq 'lib'; |
2266
|
0
|
|
|
|
|
0
|
pop @d if $d[$#d] eq ''; |
2267
|
0
|
|
|
|
|
0
|
my $instdir = $self->catdir('$(INST_ARCHLIB)', 'auto', @d, $f); |
2268
|
0
|
|
|
|
|
0
|
my $instfile = $self->catfile($instdir, $f); |
2269
|
|
|
|
|
|
|
push @statics, "$instfile\$(LIB_EXT)"; |
2270
|
|
|
|
|
|
|
|
2271
|
0
|
|
|
|
|
0
|
# Dynamic library names may need special handling. |
2272
|
0
|
|
|
|
|
0
|
my $dynfile = $instfile; |
|
0
|
|
|
|
|
0
|
|
2273
|
0
|
0
|
|
|
|
0
|
eval { require DynaLoader }; |
2274
|
0
|
|
|
|
|
0
|
if (defined &DynaLoader::mod2fname) { |
2275
|
|
|
|
|
|
|
$dynfile = $self->catfile($instdir, &DynaLoader::mod2fname([@d, $f])); |
2276
|
|
|
|
|
|
|
} |
2277
|
0
|
|
|
|
|
0
|
|
2278
|
0
|
|
|
|
|
0
|
push @dynamics, "$dynfile.\$(DLEXT)"; |
2279
|
|
|
|
|
|
|
push @boots, "$instfile.bs"; |
2280
|
0
|
|
|
|
|
0
|
} |
2281
|
0
|
|
|
|
|
0
|
$self->{INST_STATIC} = join ' ', @statics; |
2282
|
0
|
|
|
|
|
0
|
$self->{INST_DYNAMIC} = join ' ', @dynamics; |
2283
|
|
|
|
|
|
|
$self->{INST_BOOT} = join ' ', @boots; |
2284
|
|
|
|
|
|
|
} |
2285
|
156
|
|
|
|
|
580
|
} else { |
2286
|
156
|
|
|
|
|
593
|
$self->{INST_STATIC} = ''; |
2287
|
156
|
|
|
|
|
681
|
$self->{INST_DYNAMIC} = ''; |
2288
|
|
|
|
|
|
|
$self->{INST_BOOT} = ''; |
2289
|
|
|
|
|
|
|
} |
2290
|
|
|
|
|
|
|
} |
2291
|
|
|
|
|
|
|
|
2292
|
|
|
|
|
|
|
=item install (o) |
2293
|
|
|
|
|
|
|
|
2294
|
|
|
|
|
|
|
Defines the install target. |
2295
|
|
|
|
|
|
|
|
2296
|
|
|
|
|
|
|
=cut |
2297
|
|
|
|
|
|
|
|
2298
|
97
|
|
|
97
|
1
|
438
|
sub install { |
2299
|
97
|
|
|
|
|
232
|
my($self, %attribs) = @_; |
2300
|
|
|
|
|
|
|
my(@m); |
2301
|
97
|
|
|
|
|
754
|
|
2302
|
|
|
|
|
|
|
push @m, q{ |
2303
|
|
|
|
|
|
|
install :: pure_install doc_install |
2304
|
|
|
|
|
|
|
$(NOECHO) $(NOOP) |
2305
|
|
|
|
|
|
|
|
2306
|
|
|
|
|
|
|
install_perl :: pure_perl_install doc_perl_install |
2307
|
|
|
|
|
|
|
$(NOECHO) $(NOOP) |
2308
|
|
|
|
|
|
|
|
2309
|
|
|
|
|
|
|
install_site :: pure_site_install doc_site_install |
2310
|
|
|
|
|
|
|
$(NOECHO) $(NOOP) |
2311
|
|
|
|
|
|
|
|
2312
|
|
|
|
|
|
|
install_vendor :: pure_vendor_install doc_vendor_install |
2313
|
|
|
|
|
|
|
$(NOECHO) $(NOOP) |
2314
|
|
|
|
|
|
|
|
2315
|
|
|
|
|
|
|
pure_install :: pure_$(INSTALLDIRS)_install |
2316
|
|
|
|
|
|
|
$(NOECHO) $(NOOP) |
2317
|
|
|
|
|
|
|
|
2318
|
|
|
|
|
|
|
doc_install :: doc_$(INSTALLDIRS)_install |
2319
|
|
|
|
|
|
|
$(NOECHO) $(NOOP) |
2320
|
|
|
|
|
|
|
|
2321
|
|
|
|
|
|
|
pure__install : pure_site_install |
2322
|
|
|
|
|
|
|
$(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site |
2323
|
|
|
|
|
|
|
|
2324
|
|
|
|
|
|
|
doc__install : doc_site_install |
2325
|
|
|
|
|
|
|
$(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site |
2326
|
|
|
|
|
|
|
|
2327
|
|
|
|
|
|
|
pure_perl_install :: all |
2328
|
|
|
|
|
|
|
$(NOECHO) $(MOD_INSTALL) \ |
2329
|
|
|
|
|
|
|
}; |
2330
|
|
|
|
|
|
|
|
2331
|
|
|
|
|
|
|
push @m, |
2332
|
|
|
|
|
|
|
q{ read "}.$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q{" \ |
2333
|
97
|
50
|
|
|
|
897
|
write "}.$self->catfile('$(DESTINSTALLARCHLIB)','auto','$(FULLEXT)','.packlist').q{" \ |
2334
|
|
|
|
|
|
|
} unless $self->{NO_PACKLIST}; |
2335
|
97
|
|
|
|
|
870
|
|
2336
|
|
|
|
|
|
|
push @m, |
2337
|
|
|
|
|
|
|
q{ "$(INST_LIB)" "$(DESTINSTALLPRIVLIB)" \ |
2338
|
|
|
|
|
|
|
"$(INST_ARCHLIB)" "$(DESTINSTALLARCHLIB)" \ |
2339
|
|
|
|
|
|
|
"$(INST_BIN)" "$(DESTINSTALLBIN)" \ |
2340
|
|
|
|
|
|
|
"$(INST_SCRIPT)" "$(DESTINSTALLSCRIPT)" \ |
2341
|
|
|
|
|
|
|
"$(INST_MAN1DIR)" "$(DESTINSTALLMAN1DIR)" \ |
2342
|
|
|
|
|
|
|
"$(INST_MAN3DIR)" "$(DESTINSTALLMAN3DIR)" |
2343
|
|
|
|
|
|
|
$(NOECHO) $(WARN_IF_OLD_PACKLIST) \ |
2344
|
|
|
|
|
|
|
"}.$self->catdir('$(SITEARCHEXP)','auto','$(FULLEXT)').q{" |
2345
|
|
|
|
|
|
|
|
2346
|
|
|
|
|
|
|
|
2347
|
|
|
|
|
|
|
pure_site_install :: all |
2348
|
|
|
|
|
|
|
$(NOECHO) $(MOD_INSTALL) \ |
2349
|
|
|
|
|
|
|
}; |
2350
|
|
|
|
|
|
|
push @m, |
2351
|
|
|
|
|
|
|
q{ read "}.$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q{" \ |
2352
|
97
|
50
|
|
|
|
636
|
write "}.$self->catfile('$(DESTINSTALLSITEARCH)','auto','$(FULLEXT)','.packlist').q{" \ |
2353
|
|
|
|
|
|
|
} unless $self->{NO_PACKLIST}; |
2354
|
97
|
|
|
|
|
786
|
|
2355
|
|
|
|
|
|
|
push @m, |
2356
|
|
|
|
|
|
|
q{ "$(INST_LIB)" "$(DESTINSTALLSITELIB)" \ |
2357
|
|
|
|
|
|
|
"$(INST_ARCHLIB)" "$(DESTINSTALLSITEARCH)" \ |
2358
|
|
|
|
|
|
|
"$(INST_BIN)" "$(DESTINSTALLSITEBIN)" \ |
2359
|
|
|
|
|
|
|
"$(INST_SCRIPT)" "$(DESTINSTALLSITESCRIPT)" \ |
2360
|
|
|
|
|
|
|
"$(INST_MAN1DIR)" "$(DESTINSTALLSITEMAN1DIR)" \ |
2361
|
|
|
|
|
|
|
"$(INST_MAN3DIR)" "$(DESTINSTALLSITEMAN3DIR)" |
2362
|
|
|
|
|
|
|
$(NOECHO) $(WARN_IF_OLD_PACKLIST) \ |
2363
|
|
|
|
|
|
|
"}.$self->catdir('$(PERL_ARCHLIB)','auto','$(FULLEXT)').q{" |
2364
|
|
|
|
|
|
|
|
2365
|
|
|
|
|
|
|
pure_vendor_install :: all |
2366
|
|
|
|
|
|
|
$(NOECHO) $(MOD_INSTALL) \ |
2367
|
|
|
|
|
|
|
}; |
2368
|
|
|
|
|
|
|
push @m, |
2369
|
|
|
|
|
|
|
q{ read "}.$self->catfile('$(VENDORARCHEXP)','auto','$(FULLEXT)','.packlist').q{" \ |
2370
|
97
|
50
|
|
|
|
570
|
write "}.$self->catfile('$(DESTINSTALLVENDORARCH)','auto','$(FULLEXT)','.packlist').q{" \ |
2371
|
|
|
|
|
|
|
} unless $self->{NO_PACKLIST}; |
2372
|
97
|
|
|
|
|
514
|
|
2373
|
|
|
|
|
|
|
push @m, |
2374
|
|
|
|
|
|
|
q{ "$(INST_LIB)" "$(DESTINSTALLVENDORLIB)" \ |
2375
|
|
|
|
|
|
|
"$(INST_ARCHLIB)" "$(DESTINSTALLVENDORARCH)" \ |
2376
|
|
|
|
|
|
|
"$(INST_BIN)" "$(DESTINSTALLVENDORBIN)" \ |
2377
|
|
|
|
|
|
|
"$(INST_SCRIPT)" "$(DESTINSTALLVENDORSCRIPT)" \ |
2378
|
|
|
|
|
|
|
"$(INST_MAN1DIR)" "$(DESTINSTALLVENDORMAN1DIR)" \ |
2379
|
|
|
|
|
|
|
"$(INST_MAN3DIR)" "$(DESTINSTALLVENDORMAN3DIR)" |
2380
|
|
|
|
|
|
|
|
2381
|
|
|
|
|
|
|
}; |
2382
|
|
|
|
|
|
|
|
2383
|
|
|
|
|
|
|
push @m, q{ |
2384
|
|
|
|
|
|
|
doc_perl_install :: all |
2385
|
|
|
|
|
|
|
$(NOECHO) $(NOOP) |
2386
|
|
|
|
|
|
|
|
2387
|
|
|
|
|
|
|
doc_site_install :: all |
2388
|
|
|
|
|
|
|
$(NOECHO) $(NOOP) |
2389
|
|
|
|
|
|
|
|
2390
|
|
|
|
|
|
|
doc_vendor_install :: all |
2391
|
|
|
|
|
|
|
$(NOECHO) $(NOOP) |
2392
|
97
|
50
|
|
|
|
407
|
|
2393
|
|
|
|
|
|
|
} if $self->{NO_PERLLOCAL}; |
2394
|
|
|
|
|
|
|
|
2395
|
|
|
|
|
|
|
push @m, q{ |
2396
|
|
|
|
|
|
|
doc_perl_install :: all |
2397
|
|
|
|
|
|
|
$(NOECHO) $(ECHO) Appending installation info to "$(DESTINSTALLARCHLIB)/perllocal.pod" |
2398
|
|
|
|
|
|
|
-$(NOECHO) $(MKPATH) "$(DESTINSTALLARCHLIB)" |
2399
|
|
|
|
|
|
|
-$(NOECHO) $(DOC_INSTALL) \ |
2400
|
|
|
|
|
|
|
"Module" "$(NAME)" \ |
2401
|
|
|
|
|
|
|
"installed into" "$(INSTALLPRIVLIB)" \ |
2402
|
|
|
|
|
|
|
LINKTYPE "$(LINKTYPE)" \ |
2403
|
|
|
|
|
|
|
VERSION "$(VERSION)" \ |
2404
|
|
|
|
|
|
|
EXE_FILES "$(EXE_FILES)" \ |
2405
|
|
|
|
|
|
|
>> "}.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{" |
2406
|
|
|
|
|
|
|
|
2407
|
|
|
|
|
|
|
doc_site_install :: all |
2408
|
|
|
|
|
|
|
$(NOECHO) $(ECHO) Appending installation info to "$(DESTINSTALLARCHLIB)/perllocal.pod" |
2409
|
|
|
|
|
|
|
-$(NOECHO) $(MKPATH) "$(DESTINSTALLARCHLIB)" |
2410
|
|
|
|
|
|
|
-$(NOECHO) $(DOC_INSTALL) \ |
2411
|
|
|
|
|
|
|
"Module" "$(NAME)" \ |
2412
|
|
|
|
|
|
|
"installed into" "$(INSTALLSITELIB)" \ |
2413
|
|
|
|
|
|
|
LINKTYPE "$(LINKTYPE)" \ |
2414
|
|
|
|
|
|
|
VERSION "$(VERSION)" \ |
2415
|
|
|
|
|
|
|
EXE_FILES "$(EXE_FILES)" \ |
2416
|
|
|
|
|
|
|
>> "}.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{" |
2417
|
|
|
|
|
|
|
|
2418
|
|
|
|
|
|
|
doc_vendor_install :: all |
2419
|
|
|
|
|
|
|
$(NOECHO) $(ECHO) Appending installation info to "$(DESTINSTALLARCHLIB)/perllocal.pod" |
2420
|
|
|
|
|
|
|
-$(NOECHO) $(MKPATH) "$(DESTINSTALLARCHLIB)" |
2421
|
|
|
|
|
|
|
-$(NOECHO) $(DOC_INSTALL) \ |
2422
|
|
|
|
|
|
|
"Module" "$(NAME)" \ |
2423
|
|
|
|
|
|
|
"installed into" "$(INSTALLVENDORLIB)" \ |
2424
|
|
|
|
|
|
|
LINKTYPE "$(LINKTYPE)" \ |
2425
|
|
|
|
|
|
|
VERSION "$(VERSION)" \ |
2426
|
|
|
|
|
|
|
EXE_FILES "$(EXE_FILES)" \ |
2427
|
|
|
|
|
|
|
>> "}.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{" |
2428
|
97
|
50
|
|
|
|
548
|
|
2429
|
|
|
|
|
|
|
} unless $self->{NO_PERLLOCAL}; |
2430
|
97
|
|
|
|
|
531
|
|
2431
|
|
|
|
|
|
|
push @m, q{ |
2432
|
|
|
|
|
|
|
uninstall :: uninstall_from_$(INSTALLDIRS)dirs |
2433
|
|
|
|
|
|
|
$(NOECHO) $(NOOP) |
2434
|
|
|
|
|
|
|
|
2435
|
|
|
|
|
|
|
uninstall_from_perldirs :: |
2436
|
|
|
|
|
|
|
$(NOECHO) $(UNINSTALL) "}.$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q{" |
2437
|
|
|
|
|
|
|
|
2438
|
|
|
|
|
|
|
uninstall_from_sitedirs :: |
2439
|
|
|
|
|
|
|
$(NOECHO) $(UNINSTALL) "}.$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q{" |
2440
|
|
|
|
|
|
|
|
2441
|
|
|
|
|
|
|
uninstall_from_vendordirs :: |
2442
|
|
|
|
|
|
|
$(NOECHO) $(UNINSTALL) "}.$self->catfile('$(VENDORARCHEXP)','auto','$(FULLEXT)','.packlist').q{" |
2443
|
|
|
|
|
|
|
}; |
2444
|
97
|
|
|
|
|
2154
|
|
2445
|
|
|
|
|
|
|
join("",@m); |
2446
|
|
|
|
|
|
|
} |
2447
|
|
|
|
|
|
|
|
2448
|
|
|
|
|
|
|
=item installbin (o) |
2449
|
|
|
|
|
|
|
|
2450
|
|
|
|
|
|
|
Defines targets to make and to install EXE_FILES. |
2451
|
|
|
|
|
|
|
|
2452
|
|
|
|
|
|
|
=cut |
2453
|
|
|
|
|
|
|
|
2454
|
154
|
|
|
154
|
1
|
503
|
sub installbin { |
2455
|
|
|
|
|
|
|
my($self) = shift; |
2456
|
154
|
100
|
66
|
|
|
1232
|
|
2457
|
1
|
|
|
|
|
4
|
return "" unless $self->{EXE_FILES} && ref $self->{EXE_FILES} eq "ARRAY"; |
|
1
|
|
|
|
|
6
|
|
2458
|
1
|
50
|
|
|
|
4
|
my @exefiles = sort @{$self->{EXE_FILES}}; |
2459
|
|
|
|
|
|
|
return "" unless @exefiles; |
2460
|
1
|
50
|
|
|
|
4
|
|
2461
|
|
|
|
|
|
|
@exefiles = map vmsify($_), @exefiles if $Is{VMS}; |
2462
|
1
|
|
|
|
|
2
|
|
2463
|
1
|
|
|
|
|
13
|
my %fromto; |
2464
|
1
|
|
|
|
|
84
|
for my $from (@exefiles) { |
2465
|
|
|
|
|
|
|
my($path)= $self->catfile('$(INST_SCRIPT)', basename($from)); |
2466
|
1
|
|
|
|
|
7
|
|
2467
|
1
|
|
|
|
|
4
|
local($_) = $path; # for backwards compatibility |
2468
|
1
|
50
|
|
|
|
13
|
my $to = $self->libscan($path); |
2469
|
|
|
|
|
|
|
print "libscan($from) => '$to'\n" if ($Verbose >=2); |
2470
|
1
|
50
|
|
|
|
8
|
|
2471
|
1
|
|
|
|
|
9
|
$to = vmsify($to) if $Is{VMS}; |
2472
|
|
|
|
|
|
|
$fromto{$from} = $to; |
2473
|
1
|
|
|
|
|
6
|
} |
2474
|
|
|
|
|
|
|
my @to = sort values %fromto; |
2475
|
1
|
|
|
|
|
3
|
|
2476
|
1
|
|
|
|
|
7
|
my @m; |
2477
|
|
|
|
|
|
|
push(@m, qq{ |
2478
|
|
|
|
|
|
|
EXE_FILES = @exefiles |
2479
|
|
|
|
|
|
|
|
2480
|
|
|
|
|
|
|
pure_all :: @to |
2481
|
|
|
|
|
|
|
\$(NOECHO) \$(NOOP) |
2482
|
|
|
|
|
|
|
|
2483
|
|
|
|
|
|
|
realclean :: |
2484
|
|
|
|
|
|
|
}); |
2485
|
|
|
|
|
|
|
|
2486
|
1
|
|
|
|
|
7
|
# realclean can get rather large. |
2487
|
1
|
|
|
|
|
5
|
push @m, map "\t$_\n", $self->split_command('$(RM_F)', @to); |
2488
|
|
|
|
|
|
|
push @m, "\n"; |
2489
|
|
|
|
|
|
|
|
2490
|
1
|
|
|
|
|
5
|
# A target for each exe file. |
2491
|
1
|
|
|
|
|
4
|
my @froms = sort keys %fromto; |
2492
|
|
|
|
|
|
|
for my $from (@froms) { |
2493
|
1
|
|
|
|
|
14
|
# 1 2 |
2494
|
|
|
|
|
|
|
push @m, _sprintf562 <<'MAKE', $from, $fromto{$from}; |
2495
|
|
|
|
|
|
|
%2$s : %1$s $(FIRST_MAKEFILE) $(INST_SCRIPT)$(DFSEP).exists $(INST_BIN)$(DFSEP).exists |
2496
|
|
|
|
|
|
|
$(NOECHO) $(RM_F) %2$s |
2497
|
|
|
|
|
|
|
$(CP) %1$s %2$s |
2498
|
|
|
|
|
|
|
$(FIXIN) %2$s |
2499
|
|
|
|
|
|
|
-$(NOECHO) $(CHMOD) $(PERM_RWX) %2$s |
2500
|
|
|
|
|
|
|
|
2501
|
|
|
|
|
|
|
MAKE |
2502
|
|
|
|
|
|
|
|
2503
|
|
|
|
|
|
|
} |
2504
|
1
|
|
|
|
|
7
|
|
2505
|
|
|
|
|
|
|
join "", @m; |
2506
|
|
|
|
|
|
|
} |
2507
|
|
|
|
|
|
|
|
2508
|
|
|
|
|
|
|
=item linkext (o) |
2509
|
|
|
|
|
|
|
|
2510
|
|
|
|
|
|
|
Defines the linkext target which in turn defines the LINKTYPE. |
2511
|
|
|
|
|
|
|
|
2512
|
|
|
|
|
|
|
=cut |
2513
|
|
|
|
|
|
|
|
2514
|
|
|
|
|
|
|
# LINKTYPE => static or dynamic or '' |
2515
|
154
|
|
|
154
|
1
|
620
|
sub linkext { |
2516
|
154
|
|
|
|
|
428
|
my($self, %attribs) = @_; |
2517
|
154
|
50
|
|
|
|
590
|
my $linktype = $attribs{LINKTYPE}; |
2518
|
154
|
50
|
33
|
|
|
1312
|
$linktype = $self->{LINKTYPE} unless defined $linktype; |
2519
|
0
|
|
|
|
|
0
|
if (defined $linktype and $linktype eq '') { |
2520
|
|
|
|
|
|
|
warn "Warning: LINKTYPE set to '', no longer necessary\n"; |
2521
|
154
|
50
|
|
|
|
479
|
} |
2522
|
154
|
|
|
|
|
924
|
$linktype = '$(LINKTYPE)' unless defined $linktype; |
2523
|
|
|
|
|
|
|
" |
2524
|
|
|
|
|
|
|
linkext :: $linktype |
2525
|
|
|
|
|
|
|
\$(NOECHO) \$(NOOP) |
2526
|
|
|
|
|
|
|
"; |
2527
|
|
|
|
|
|
|
} |
2528
|
|
|
|
|
|
|
|
2529
|
|
|
|
|
|
|
=item lsdir |
2530
|
|
|
|
|
|
|
|
2531
|
|
|
|
|
|
|
Takes as arguments a directory name and a regular expression. Returns |
2532
|
|
|
|
|
|
|
all entries in the directory that match the regular expression. |
2533
|
|
|
|
|
|
|
|
2534
|
|
|
|
|
|
|
=cut |
2535
|
|
|
|
|
|
|
|
2536
|
|
|
|
|
|
|
sub lsdir { |
2537
|
300
|
|
|
300
|
1
|
1200
|
# $self |
2538
|
300
|
50
|
|
|
|
13254
|
my(undef, $dir, $regex) = @_; |
|
|
50
|
|
|
|
|
|
2539
|
|
|
|
|
|
|
opendir(my $dh, defined($dir) ? $dir : ".") |
2540
|
300
|
|
|
|
|
23302
|
or return; |
2541
|
300
|
|
|
|
|
4534
|
my @ls = readdir $dh; |
2542
|
300
|
100
|
|
|
|
7035
|
closedir $dh; |
2543
|
300
|
|
|
|
|
10719
|
@ls = grep(/$regex/, @ls) if defined $regex; |
2544
|
|
|
|
|
|
|
@ls; |
2545
|
|
|
|
|
|
|
} |
2546
|
|
|
|
|
|
|
|
2547
|
|
|
|
|
|
|
=item macro (o) |
2548
|
|
|
|
|
|
|
|
2549
|
|
|
|
|
|
|
Simple subroutine to insert the macros defined by the macro attribute |
2550
|
|
|
|
|
|
|
into the Makefile. |
2551
|
|
|
|
|
|
|
|
2552
|
|
|
|
|
|
|
=cut |
2553
|
|
|
|
|
|
|
|
2554
|
154
|
|
|
154
|
1
|
542
|
sub macro { |
2555
|
154
|
|
|
|
|
291
|
my($self,%attribs) = @_; |
2556
|
154
|
|
|
|
|
950
|
my @m; |
2557
|
0
|
|
|
|
|
0
|
foreach my $key (sort keys %attribs) { |
2558
|
0
|
|
|
|
|
0
|
my $val = $attribs{$key}; |
2559
|
|
|
|
|
|
|
push @m, "$key = $val\n"; |
2560
|
154
|
|
|
|
|
948
|
} |
2561
|
|
|
|
|
|
|
join "", @m; |
2562
|
|
|
|
|
|
|
} |
2563
|
|
|
|
|
|
|
|
2564
|
|
|
|
|
|
|
=item makeaperl (o) |
2565
|
|
|
|
|
|
|
|
2566
|
|
|
|
|
|
|
Called by staticmake. Defines how to write the Makefile to produce a |
2567
|
|
|
|
|
|
|
static new perl. |
2568
|
|
|
|
|
|
|
|
2569
|
|
|
|
|
|
|
By default the Makefile produced includes all the static extensions in |
2570
|
|
|
|
|
|
|
the perl library. (Purified versions of library files, e.g., |
2571
|
|
|
|
|
|
|
DynaLoader_pure_p1_c0_032.a are automatically ignored to avoid link errors.) |
2572
|
|
|
|
|
|
|
|
2573
|
|
|
|
|
|
|
=cut |
2574
|
|
|
|
|
|
|
|
2575
|
155
|
|
|
155
|
1
|
2591
|
sub makeaperl { |
2576
|
|
|
|
|
|
|
my($self, %attribs) = @_; |
2577
|
155
|
|
|
|
|
1083
|
my($makefilename, $searchdirs, $static, $extra, $perlinc, $target, $tmp, $libperl) = |
2578
|
155
|
100
|
|
|
|
355
|
@attribs{qw(MAKE DIRS STAT EXTRA INCL TARGET TMP LIBPERL)}; |
|
155
|
|
|
|
|
3839
|
|
2579
|
155
|
|
|
|
|
457
|
s/^(.*)/"-I$1"/ for @{$perlinc || []}; |
2580
|
155
|
|
|
|
|
1161
|
my(@m); |
2581
|
|
|
|
|
|
|
push @m, " |
2582
|
|
|
|
|
|
|
# --- MakeMaker makeaperl section --- |
2583
|
|
|
|
|
|
|
MAP_TARGET = $target |
2584
|
155
|
100
|
|
|
|
1006
|
FULLPERL = $self->{FULLPERL} |
2585
|
|
|
|
|
|
|
MAP_PERLINC = @{$perlinc || []} |
2586
|
155
|
100
|
|
|
|
1186
|
"; |
2587
|
|
|
|
|
|
|
return join '', @m if $self->{PARENT}; |
2588
|
98
|
|
|
|
|
311
|
|
|
98
|
|
|
|
|
578
|
|
2589
|
|
|
|
|
|
|
my($dir) = join ":", @{$self->{DIR}}; |
2590
|
98
|
50
|
|
|
|
397
|
|
2591
|
98
|
|
|
|
|
952
|
unless ($self->{MAKEAPERL}) { |
2592
|
|
|
|
|
|
|
push @m, q{ |
2593
|
|
|
|
|
|
|
$(MAP_TARGET) :: $(MAKE_APERL_FILE) |
2594
|
|
|
|
|
|
|
$(MAKE) $(USEMAKEFILE) $(MAKE_APERL_FILE) $@ |
2595
|
|
|
|
|
|
|
|
2596
|
|
|
|
|
|
|
$(MAKE_APERL_FILE) : static $(FIRST_MAKEFILE) pm_to_blib |
2597
|
|
|
|
|
|
|
$(NOECHO) $(ECHO) Writing \"$(MAKE_APERL_FILE)\" for this $(MAP_TARGET) |
2598
|
|
|
|
|
|
|
$(NOECHO) $(PERLRUNINST) \ |
2599
|
|
|
|
|
|
|
Makefile.PL DIR="}, $dir, q{" \ |
2600
|
|
|
|
|
|
|
MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \ |
2601
|
|
|
|
|
|
|
MAKEAPERL=1 NORECURS=1 CCCDLFLAGS=}; |
2602
|
98
|
|
|
|
|
452
|
|
2603
|
1
|
|
|
|
|
3
|
foreach (@ARGV){ |
2604
|
1
|
50
|
|
|
|
7
|
my $arg = $_; # avoid lvalue aliasing |
2605
|
1
|
|
|
|
|
7
|
if ( $arg =~ /(^.*?=)(.*['\s].*)/ ) { |
2606
|
|
|
|
|
|
|
$arg = $1 . $self->quote_literal($2); |
2607
|
1
|
|
|
|
|
4
|
} |
2608
|
|
|
|
|
|
|
push @m, " \\\n\t\t$arg"; |
2609
|
98
|
|
|
|
|
437
|
} |
2610
|
|
|
|
|
|
|
push @m, "\n"; |
2611
|
98
|
|
|
|
|
1430
|
|
2612
|
|
|
|
|
|
|
return join '', @m; |
2613
|
|
|
|
|
|
|
} |
2614
|
0
|
|
|
|
|
0
|
|
2615
|
0
|
|
|
|
|
0
|
my $cccmd = $self->const_cccmd($libperl); |
2616
|
0
|
|
|
|
|
0
|
$cccmd =~ s/^CCCMD\s*=\s*//; |
2617
|
|
|
|
|
|
|
$cccmd =~ s/\$\(INC\)/ "-I$self->{PERL_INC}" /; |
2618
|
0
|
0
|
|
|
|
0
|
$cccmd .= " $Config{cccdlflags}" |
2619
|
0
|
|
|
|
|
0
|
if ($Config{useshrplib} eq 'true'); |
2620
|
|
|
|
|
|
|
$cccmd =~ s/\(CC\)/\(PERLMAINCC\)/; |
2621
|
|
|
|
|
|
|
|
2622
|
|
|
|
|
|
|
# The front matter of the linkcommand... |
2623
|
0
|
|
|
|
|
0
|
my $linkcmd = join ' ', "\$(CC)", |
2624
|
0
|
|
|
|
|
0
|
grep($_, @Config{qw(ldflags ccdlflags)}); |
2625
|
0
|
|
|
|
|
0
|
$linkcmd =~ s/\s+/ /g; |
2626
|
|
|
|
|
|
|
$linkcmd =~ s,(perl\.exp),\$(PERL_INC)/$1,; |
2627
|
|
|
|
|
|
|
|
2628
|
0
|
|
|
|
|
0
|
# Which *.a files could we make use of... |
2629
|
|
|
|
|
|
|
my $staticlib21 = $self->_find_static_libs($searchdirs); |
2630
|
0
|
0
|
|
|
|
0
|
# We trust that what has been handed in as argument, will be buildable |
2631
|
0
|
|
|
|
|
0
|
$static = [] unless $static; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
2632
|
|
|
|
|
|
|
@$staticlib21{@{$static}} = (1) x @{$static}; |
2633
|
0
|
0
|
0
|
|
|
0
|
|
2634
|
0
|
|
|
|
|
0
|
$extra = [] unless $extra && ref $extra eq 'ARRAY'; |
2635
|
0
|
0
|
|
|
|
0
|
for (sort keys %$staticlib21) { |
2636
|
0
|
|
|
|
|
0
|
next unless /\Q$self->{LIB_EXT}\E\z/; |
2637
|
0
|
|
|
|
|
0
|
$_ = dirname($_) . "/extralibs.ld"; |
2638
|
|
|
|
|
|
|
push @$extra, $_; |
2639
|
|
|
|
|
|
|
} |
2640
|
0
|
0
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
2641
|
|
|
|
|
|
|
s/^(.*)/"-I$1"/ for @{$perlinc || []}; |
2642
|
0
|
|
0
|
|
|
0
|
|
2643
|
0
|
|
0
|
|
|
0
|
$target ||= "perl"; |
2644
|
|
|
|
|
|
|
$tmp ||= "."; |
2645
|
|
|
|
|
|
|
|
2646
|
|
|
|
|
|
|
# MAP_STATIC doesn't look into subdirs yet. Once "all" is made and we |
2647
|
|
|
|
|
|
|
# regenerate the Makefiles, MAP_STATIC and the dependencies for |
2648
|
0
|
|
|
|
|
0
|
# extralibs.all are computed correctly |
2649
|
|
|
|
|
|
|
my @map_static = reverse sort keys %$staticlib21; |
2650
|
|
|
|
|
|
|
push @m, " |
2651
|
0
|
|
|
|
|
0
|
MAP_LINKCMD = $linkcmd |
2652
|
0
|
|
|
|
|
0
|
MAP_STATIC = ", join(" \\\n\t", map { qq{"$_"} } @map_static), " |
|
0
|
|
|
|
|
0
|
|
2653
|
|
|
|
|
|
|
MAP_STATICDEP = ", join(' ', map { $self->quote_dep($_) } @map_static), " |
2654
|
|
|
|
|
|
|
|
2655
|
|
|
|
|
|
|
MAP_PRELIBS = $Config{perllibs} $Config{cryptlib} |
2656
|
|
|
|
|
|
|
"; |
2657
|
0
|
|
|
|
|
0
|
|
2658
|
0
|
0
|
|
|
|
0
|
my $lperl; |
2659
|
0
|
|
|
|
|
0
|
if (defined $libperl) { |
2660
|
|
|
|
|
|
|
($lperl = $libperl) =~ s/\$\(A\)/$self->{LIB_EXT}/; |
2661
|
0
|
0
|
0
|
|
|
0
|
} |
2662
|
0
|
|
0
|
|
|
0
|
unless ($libperl && -f $lperl) { # Ilya's code... |
2663
|
0
|
0
|
|
|
|
0
|
my $dir = $self->{PERL_SRC} || "$self->{PERL_ARCHLIB}/CORE"; |
2664
|
0
|
|
0
|
|
|
0
|
$dir = "$self->{PERL_ARCHLIB}/.." if $self->{UNINSTALLED_PERL}; |
2665
|
0
|
|
|
|
|
0
|
$libperl ||= "libperl$self->{LIB_EXT}"; |
2666
|
0
|
|
0
|
|
|
0
|
$libperl = "$dir/$libperl"; |
2667
|
0
|
|
|
|
|
0
|
$lperl ||= "libperl$self->{LIB_EXT}"; |
2668
|
|
|
|
|
|
|
$lperl = "$dir/$lperl"; |
2669
|
0
|
0
|
0
|
|
|
0
|
|
2670
|
|
|
|
|
|
|
if (! -f $libperl and ! -f $lperl) { |
2671
|
0
|
0
|
|
|
|
0
|
# We did not find a static libperl. Maybe there is a shared one? |
2672
|
0
|
|
|
|
|
0
|
if ($Is{SunOS}) { |
2673
|
|
|
|
|
|
|
$lperl = $libperl = "$dir/$Config{libperl}"; |
2674
|
0
|
0
|
|
|
|
0
|
# SUNOS ld does not take the full path to a shared library |
2675
|
|
|
|
|
|
|
$libperl = '' if $Is{SunOS4}; |
2676
|
|
|
|
|
|
|
} |
2677
|
|
|
|
|
|
|
} |
2678
|
0
|
0
|
0
|
|
|
0
|
|
2679
|
|
|
|
|
|
|
print <<EOF unless -f $lperl || defined($self->{PERL_SRC}); |
2680
|
|
|
|
|
|
|
Warning: $libperl not found |
2681
|
|
|
|
|
|
|
If you're going to build a static perl binary, make sure perl is installed |
2682
|
|
|
|
|
|
|
otherwise ignore this warning |
2683
|
|
|
|
|
|
|
EOF |
2684
|
|
|
|
|
|
|
} |
2685
|
|
|
|
|
|
|
|
2686
|
0
|
0
|
|
|
|
0
|
# SUNOS ld does not take the full path to a shared library |
2687
|
0
|
|
|
|
|
0
|
my $llibperl = $libperl ? '$(MAP_LIBPERL)' : '-lperl'; |
2688
|
|
|
|
|
|
|
my $libperl_dep = $self->quote_dep($libperl); |
2689
|
0
|
|
|
|
|
0
|
|
2690
|
|
|
|
|
|
|
push @m, " |
2691
|
|
|
|
|
|
|
MAP_LIBPERL = $libperl |
2692
|
|
|
|
|
|
|
MAP_LIBPERLDEP = $libperl_dep |
2693
|
|
|
|
|
|
|
LLIBPERL = $llibperl |
2694
|
|
|
|
|
|
|
"; |
2695
|
0
|
|
|
|
|
0
|
|
2696
|
|
|
|
|
|
|
push @m, ' |
2697
|
|
|
|
|
|
|
$(INST_ARCHAUTODIR)/extralibs.all : $(INST_ARCHAUTODIR)$(DFSEP).exists '.join(" \\\n\t", @$extra).' |
2698
|
|
|
|
|
|
|
$(NOECHO) $(RM_F) $@ |
2699
|
|
|
|
|
|
|
$(NOECHO) $(TOUCH) $@ |
2700
|
|
|
|
|
|
|
'; |
2701
|
0
|
|
|
|
|
0
|
|
2702
|
0
|
|
|
|
|
0
|
foreach my $catfile (@$extra){ |
2703
|
|
|
|
|
|
|
push @m, "\tcat $catfile >> \$\@\n"; |
2704
|
|
|
|
|
|
|
} |
2705
|
0
|
0
|
|
|
|
0
|
|
2706
|
|
|
|
|
|
|
my $ldfrom = $self->{XSMULTI} ? '' : '$(LDFROM)'; |
2707
|
0
|
|
|
|
|
0
|
# 1 2 3 4 |
2708
|
|
|
|
|
|
|
push @m, _sprintf562 <<'EOF', $tmp, $ldfrom, $self->xs_obj_opt('$@'), $makefilename; |
2709
|
|
|
|
|
|
|
$(MAP_TARGET) :: %1$s/perlmain$(OBJ_EXT) $(MAP_LIBPERLDEP) $(MAP_STATICDEP) $(INST_ARCHAUTODIR)/extralibs.all |
2710
|
|
|
|
|
|
|
$(MAP_LINKCMD) %2$s $(OPTIMIZE) %1$s/perlmain$(OBJ_EXT) %3$s $(MAP_STATIC) "$(LLIBPERL)" `cat $(INST_ARCHAUTODIR)/extralibs.all` $(MAP_PRELIBS) |
2711
|
|
|
|
|
|
|
$(NOECHO) $(ECHO) "To install the new '$(MAP_TARGET)' binary, call" |
2712
|
|
|
|
|
|
|
$(NOECHO) $(ECHO) " $(MAKE) $(USEMAKEFILE) %4$s inst_perl MAP_TARGET=$(MAP_TARGET)" |
2713
|
|
|
|
|
|
|
$(NOECHO) $(ECHO) " $(MAKE) $(USEMAKEFILE) %4$s map_clean" |
2714
|
|
|
|
|
|
|
|
2715
|
|
|
|
|
|
|
%1$s/perlmain\$(OBJ_EXT): %1$s/perlmain.c |
2716
|
0
|
|
|
|
|
0
|
EOF |
2717
|
|
|
|
|
|
|
push @m, "\t".$self->cd($tmp, qq[$cccmd "-I\$(PERL_INC)" perlmain.c])."\n"; |
2718
|
0
|
0
|
|
|
|
0
|
|
2719
|
0
|
|
|
|
|
0
|
my $maybe_DynaLoader = $Config{usedl} ? 'q(DynaLoader)' : ''; |
2720
|
|
|
|
|
|
|
push @m, _sprintf562 <<'EOF', $tmp, $makefilename, $maybe_DynaLoader; |
2721
|
|
|
|
|
|
|
|
2722
|
|
|
|
|
|
|
%1$s/perlmain.c: %2$s |
2723
|
|
|
|
|
|
|
$(NOECHO) $(ECHO) Writing $@ |
2724
|
|
|
|
|
|
|
$(NOECHO) $(PERL) $(MAP_PERLINC) "-MExtUtils::Miniperl" \ |
2725
|
|
|
|
|
|
|
-e "writemain(grep(s#.*/auto/##s, @ARGV), %3$s)" $(MAP_STATIC) > $@t |
2726
|
|
|
|
|
|
|
$(MV) $@t $@ |
2727
|
|
|
|
|
|
|
|
2728
|
0
|
0
|
0
|
|
|
0
|
EOF |
2729
|
|
|
|
|
|
|
push @m, "\t", q{$(NOECHO) $(PERL) "$(INSTALLSCRIPT)/fixpmain" |
2730
|
|
|
|
|
|
|
} if (defined (&Dos::UseLFN) && Dos::UseLFN()==0); |
2731
|
|
|
|
|
|
|
|
2732
|
0
|
|
|
|
|
0
|
|
2733
|
|
|
|
|
|
|
push @m, q{ |
2734
|
|
|
|
|
|
|
doc_inst_perl : |
2735
|
|
|
|
|
|
|
$(NOECHO) $(ECHO) Appending installation info to "$(DESTINSTALLARCHLIB)/perllocal.pod" |
2736
|
|
|
|
|
|
|
-$(NOECHO) $(MKPATH) "$(DESTINSTALLARCHLIB)" |
2737
|
|
|
|
|
|
|
-$(NOECHO) $(DOC_INSTALL) \ |
2738
|
|
|
|
|
|
|
"Perl binary" "$(MAP_TARGET)" \ |
2739
|
|
|
|
|
|
|
MAP_STATIC "$(MAP_STATIC)" \ |
2740
|
|
|
|
|
|
|
MAP_EXTRA "`cat $(INST_ARCHAUTODIR)/extralibs.all`" \ |
2741
|
|
|
|
|
|
|
MAP_LIBPERL "$(MAP_LIBPERL)" \ |
2742
|
|
|
|
|
|
|
>> "}.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{" |
2743
|
|
|
|
|
|
|
|
2744
|
|
|
|
|
|
|
}; |
2745
|
|
|
|
|
|
|
|
2746
|
|
|
|
|
|
|
push @m, q{ |
2747
|
|
|
|
|
|
|
inst_perl : pure_inst_perl doc_inst_perl |
2748
|
|
|
|
|
|
|
|
2749
|
|
|
|
|
|
|
pure_inst_perl : $(MAP_TARGET) |
2750
|
|
|
|
|
|
|
}.$self->{CP}.q{ $(MAP_TARGET) "}.$self->catfile('$(DESTINSTALLBIN)','$(MAP_TARGET)').q{" |
2751
|
|
|
|
|
|
|
|
2752
|
|
|
|
|
|
|
clean :: map_clean |
2753
|
|
|
|
|
|
|
|
2754
|
0
|
|
|
|
|
0
|
map_clean : |
2755
|
|
|
|
|
|
|
}.$self->{RM_F}.qq{ $tmp/perlmain\$(OBJ_EXT) $tmp/perlmain.c \$(MAP_TARGET) $makefilename \$(INST_ARCHAUTODIR)/extralibs.all |
2756
|
|
|
|
|
|
|
}; |
2757
|
0
|
|
|
|
|
0
|
|
2758
|
|
|
|
|
|
|
join '', @m; |
2759
|
|
|
|
|
|
|
} |
2760
|
|
|
|
|
|
|
|
2761
|
|
|
|
|
|
|
# utility method |
2762
|
0
|
|
|
0
|
|
0
|
sub _find_static_libs { |
2763
|
|
|
|
|
|
|
my ($self, $searchdirs) = @_; |
2764
|
|
|
|
|
|
|
# don't use File::Spec here because on Win32 F::F still uses "/" |
2765
|
0
|
|
|
|
|
0
|
my $installed_version = join('/', |
2766
|
|
|
|
|
|
|
'auto', $self->{FULLEXT}, "$self->{BASEEXT}$self->{LIB_EXT}" |
2767
|
0
|
|
|
|
|
0
|
); |
2768
|
0
|
|
|
|
|
0
|
my %staticlib21; |
2769
|
|
|
|
|
|
|
require File::Find; |
2770
|
0
|
0
|
|
0
|
|
0
|
File::Find::find(sub { |
2771
|
|
|
|
|
|
|
if ($File::Find::name =~ m{/auto/share\z}) { |
2772
|
|
|
|
|
|
|
# in a subdir of auto/share, prune because e.g. |
2773
|
|
|
|
|
|
|
# Alien::pkgconfig uses File::ShareDir to put .a files |
2774
|
0
|
|
|
|
|
0
|
# there. do not want |
2775
|
0
|
|
|
|
|
0
|
$File::Find::prune = 1; |
2776
|
|
|
|
|
|
|
return; |
2777
|
|
|
|
|
|
|
} |
2778
|
0
|
0
|
|
|
|
0
|
|
2779
|
|
|
|
|
|
|
return unless m/\Q$self->{LIB_EXT}\E$/; |
2780
|
0
|
0
|
|
|
|
0
|
|
2781
|
|
|
|
|
|
|
return unless -f 'extralibs.ld'; # this checks is a "proper" XS installation |
2782
|
|
|
|
|
|
|
|
2783
|
0
|
0
|
0
|
|
|
0
|
# Skip perl's libraries. |
2784
|
|
|
|
|
|
|
return if m/^libperl/ or m/^perl\Q$self->{LIB_EXT}\E$/; |
2785
|
|
|
|
|
|
|
|
2786
|
|
|
|
|
|
|
# Skip purified versions of libraries |
2787
|
0
|
0
|
0
|
|
|
0
|
# (e.g., DynaLoader_pure_p1_c0_032.a) |
2788
|
|
|
|
|
|
|
return if m/_pure_\w+_\w+_\w+\.\w+$/ and -f "$File::Find::dir/.pure"; |
2789
|
0
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
|
2790
|
0
|
|
|
|
|
0
|
if( exists $self->{INCLUDE_EXT} ){ |
2791
|
|
|
|
|
|
|
my $found = 0; |
2792
|
0
|
|
|
|
|
0
|
|
2793
|
0
|
|
|
|
|
0
|
(my $xx = $File::Find::name) =~ s,.*?/auto/,,s; |
2794
|
0
|
|
|
|
|
0
|
$xx =~ s,/?$_,,; |
2795
|
|
|
|
|
|
|
$xx =~ s,/,::,g; |
2796
|
|
|
|
|
|
|
|
2797
|
|
|
|
|
|
|
# Throw away anything not explicitly marked for inclusion. |
2798
|
0
|
|
|
|
|
0
|
# DynaLoader is implied. |
|
0
|
|
|
|
|
0
|
|
2799
|
0
|
0
|
|
|
|
0
|
foreach my $incl ((@{$self->{INCLUDE_EXT}},'DynaLoader')){ |
2800
|
0
|
|
|
|
|
0
|
if( $xx eq $incl ){ |
2801
|
0
|
|
|
|
|
0
|
$found++; |
2802
|
|
|
|
|
|
|
last; |
2803
|
|
|
|
|
|
|
} |
2804
|
0
|
0
|
|
|
|
0
|
} |
2805
|
|
|
|
|
|
|
return unless $found; |
2806
|
|
|
|
|
|
|
} |
2807
|
0
|
|
|
|
|
0
|
elsif( exists $self->{EXCLUDE_EXT} ){ |
2808
|
0
|
|
|
|
|
0
|
(my $xx = $File::Find::name) =~ s,.*?/auto/,,s; |
2809
|
0
|
|
|
|
|
0
|
$xx =~ s,/?$_,,; |
2810
|
|
|
|
|
|
|
$xx =~ s,/,::,g; |
2811
|
|
|
|
|
|
|
|
2812
|
0
|
|
|
|
|
0
|
# Throw away anything explicitly marked for exclusion |
|
0
|
|
|
|
|
0
|
|
2813
|
0
|
0
|
|
|
|
0
|
foreach my $excl (@{$self->{EXCLUDE_EXT}}){ |
2814
|
|
|
|
|
|
|
return if( $xx eq $excl ); |
2815
|
|
|
|
|
|
|
} |
2816
|
|
|
|
|
|
|
} |
2817
|
|
|
|
|
|
|
|
2818
|
|
|
|
|
|
|
# don't include the installed version of this extension. I |
2819
|
|
|
|
|
|
|
# leave this line here, although it is not necessary anymore: |
2820
|
|
|
|
|
|
|
# I patched minimod.PL instead, so that Miniperl.pm won't |
2821
|
|
|
|
|
|
|
# include duplicates |
2822
|
|
|
|
|
|
|
|
2823
|
|
|
|
|
|
|
# Once the patch to minimod.PL is in the distribution, I can |
2824
|
0
|
0
|
|
|
|
0
|
# drop it |
2825
|
0
|
0
|
|
|
|
0
|
return if $File::Find::name =~ m:\Q$installed_version\E\z:; |
2826
|
52
|
|
|
52
|
|
531
|
return if !$self->xs_static_lib_is_xs($_); |
|
52
|
|
|
|
|
141
|
|
|
52
|
|
|
|
|
64648
|
|
2827
|
0
|
|
|
|
|
0
|
use Cwd 'cwd'; |
2828
|
0
|
0
|
|
|
|
0
|
$staticlib21{cwd() . "/" . $_}++; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
2829
|
0
|
|
|
|
|
0
|
}, grep( -d $_, map { $self->catdir($_, 'auto') } @{$searchdirs || []}) ); |
2830
|
|
|
|
|
|
|
return \%staticlib21; |
2831
|
|
|
|
|
|
|
} |
2832
|
|
|
|
|
|
|
|
2833
|
|
|
|
|
|
|
=item xs_static_lib_is_xs (o) |
2834
|
|
|
|
|
|
|
|
2835
|
|
|
|
|
|
|
Called by a utility method of makeaperl. Checks whether a given file |
2836
|
|
|
|
|
|
|
is an XS library by seeing whether it defines any symbols starting |
2837
|
|
|
|
|
|
|
with C<boot_> (with an optional leading underscore - needed on MacOS). |
2838
|
|
|
|
|
|
|
|
2839
|
|
|
|
|
|
|
=cut |
2840
|
|
|
|
|
|
|
|
2841
|
0
|
|
|
0
|
1
|
0
|
sub xs_static_lib_is_xs { |
2842
|
0
|
|
|
|
|
0
|
my ($self, $libfile) = @_; |
2843
|
0
|
|
|
|
|
0
|
my $devnull = File::Spec->devnull; |
2844
|
|
|
|
|
|
|
return `nm $libfile 2>$devnull` =~ /\b_?boot_/; |
2845
|
|
|
|
|
|
|
} |
2846
|
|
|
|
|
|
|
|
2847
|
|
|
|
|
|
|
=item makefile (o) |
2848
|
|
|
|
|
|
|
|
2849
|
|
|
|
|
|
|
Defines how to rewrite the Makefile. |
2850
|
|
|
|
|
|
|
|
2851
|
|
|
|
|
|
|
=cut |
2852
|
|
|
|
|
|
|
|
2853
|
154
|
|
|
154
|
1
|
517
|
sub makefile { |
2854
|
154
|
|
|
|
|
323
|
my($self) = shift; |
2855
|
|
|
|
|
|
|
my $m; |
2856
|
|
|
|
|
|
|
# We do not know what target was originally specified so we |
2857
|
|
|
|
|
|
|
# must force a manual rerun to be sure. But as it should only |
2858
|
|
|
|
|
|
|
# happen very rarely it is not a significant problem. |
2859
|
|
|
|
|
|
|
$m = ' |
2860
|
|
|
|
|
|
|
$(OBJECT) : $(FIRST_MAKEFILE) |
2861
|
154
|
50
|
|
|
|
642
|
|
2862
|
|
|
|
|
|
|
' if $self->{OBJECT}; |
2863
|
154
|
50
|
|
|
|
915
|
|
2864
|
154
|
|
|
|
|
733
|
my $newer_than_target = $Is{VMS} ? '$(MMS$SOURCE_LIST)' : '$?'; |
2865
|
154
|
|
|
|
|
544
|
my $mpl_args = join " ", map qq["$_"], @ARGV; |
2866
|
154
|
50
|
|
|
|
497
|
my $cross = ''; |
2867
|
|
|
|
|
|
|
if (defined $::Cross::platform) { |
2868
|
0
|
|
|
|
|
0
|
# Inherited from win32/buildext.pl |
2869
|
|
|
|
|
|
|
$cross = "-MCross=$::Cross::platform "; |
2870
|
154
|
|
|
|
|
1260
|
} |
2871
|
|
|
|
|
|
|
$m .= sprintf <<'MAKE_FRAG', $newer_than_target, $cross, $mpl_args; |
2872
|
|
|
|
|
|
|
# We take a very conservative approach here, but it's worth it. |
2873
|
|
|
|
|
|
|
# We move Makefile to Makefile.old here to avoid gnu make looping. |
2874
|
|
|
|
|
|
|
$(FIRST_MAKEFILE) : Makefile.PL $(CONFIGDEP) |
2875
|
|
|
|
|
|
|
$(NOECHO) $(ECHO) "Makefile out-of-date with respect to %s" |
2876
|
|
|
|
|
|
|
$(NOECHO) $(ECHO) "Cleaning current config before rebuilding Makefile..." |
2877
|
|
|
|
|
|
|
-$(NOECHO) $(RM_F) $(MAKEFILE_OLD) |
2878
|
|
|
|
|
|
|
-$(NOECHO) $(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD) |
2879
|
|
|
|
|
|
|
- $(MAKE) $(USEMAKEFILE) $(MAKEFILE_OLD) clean $(DEV_NULL) |
2880
|
|
|
|
|
|
|
$(PERLRUN) %sMakefile.PL %s |
2881
|
|
|
|
|
|
|
$(NOECHO) $(ECHO) "==> Your Makefile has been rebuilt. <==" |
2882
|
|
|
|
|
|
|
$(NOECHO) $(ECHO) "==> Please rerun the $(MAKE) command. <==" |
2883
|
|
|
|
|
|
|
$(FALSE) |
2884
|
|
|
|
|
|
|
|
2885
|
|
|
|
|
|
|
MAKE_FRAG |
2886
|
154
|
|
|
|
|
631
|
|
2887
|
|
|
|
|
|
|
return $m; |
2888
|
|
|
|
|
|
|
} |
2889
|
|
|
|
|
|
|
|
2890
|
|
|
|
|
|
|
|
2891
|
|
|
|
|
|
|
=item maybe_command |
2892
|
|
|
|
|
|
|
|
2893
|
|
|
|
|
|
|
Returns true, if the argument is likely to be a command. |
2894
|
|
|
|
|
|
|
|
2895
|
|
|
|
|
|
|
=cut |
2896
|
|
|
|
|
|
|
|
2897
|
198
|
|
|
198
|
1
|
568
|
sub maybe_command { |
2898
|
198
|
100
|
66
|
|
|
5165
|
my($self,$file) = @_; |
2899
|
93
|
|
|
|
|
430
|
return $file if -x $file && ! -d $file; |
2900
|
|
|
|
|
|
|
return; |
2901
|
|
|
|
|
|
|
} |
2902
|
|
|
|
|
|
|
|
2903
|
|
|
|
|
|
|
|
2904
|
|
|
|
|
|
|
=item needs_linking (o) |
2905
|
|
|
|
|
|
|
|
2906
|
|
|
|
|
|
|
Does this module need linking? Looks into subdirectory objects (see |
2907
|
|
|
|
|
|
|
also has_link_code()) |
2908
|
|
|
|
|
|
|
|
2909
|
|
|
|
|
|
|
=cut |
2910
|
|
|
|
|
|
|
|
2911
|
1669
|
|
|
1669
|
1
|
3103
|
sub needs_linking { |
2912
|
|
|
|
|
|
|
my($self) = shift; |
2913
|
1669
|
|
|
|
|
10526
|
|
2914
|
1669
|
50
|
|
|
|
6051
|
my $caller = (caller(0))[3]; |
2915
|
|
|
|
|
|
|
confess("needs_linking called too early") if |
2916
|
1669
|
100
|
|
|
|
12248
|
$caller =~ /^ExtUtils::MakeMaker::/; |
2917
|
154
|
50
|
33
|
|
|
759
|
return $self->{NEEDS_LINKING} if defined $self->{NEEDS_LINKING}; |
2918
|
0
|
|
|
|
|
0
|
if ($self->has_link_code or $self->{MAKEAPERL}){ |
2919
|
0
|
|
|
|
|
0
|
$self->{NEEDS_LINKING} = 1; |
2920
|
|
|
|
|
|
|
return 1; |
2921
|
154
|
|
|
|
|
388
|
} |
|
154
|
|
|
|
|
907
|
|
2922
|
56
|
50
|
|
|
|
567
|
foreach my $child (keys %{$self->{CHILDREN}}) { |
2923
|
0
|
|
|
|
|
0
|
if ($self->{CHILDREN}->{$child}->needs_linking) { |
2924
|
0
|
|
|
|
|
0
|
$self->{NEEDS_LINKING} = 1; |
2925
|
|
|
|
|
|
|
return 1; |
2926
|
|
|
|
|
|
|
} |
2927
|
154
|
|
|
|
|
1507
|
} |
2928
|
|
|
|
|
|
|
return $self->{NEEDS_LINKING} = 0; |
2929
|
|
|
|
|
|
|
} |
2930
|
|
|
|
|
|
|
|
2931
|
|
|
|
|
|
|
|
2932
|
|
|
|
|
|
|
=item parse_abstract |
2933
|
|
|
|
|
|
|
|
2934
|
|
|
|
|
|
|
parse a file and return what you think is the ABSTRACT |
2935
|
|
|
|
|
|
|
|
2936
|
|
|
|
|
|
|
=cut |
2937
|
|
|
|
|
|
|
|
2938
|
13
|
|
|
13
|
1
|
10474
|
sub parse_abstract { |
2939
|
13
|
|
|
|
|
26
|
my($self,$parsefile) = @_; |
2940
|
|
|
|
|
|
|
my $result; |
2941
|
13
|
|
|
|
|
68
|
|
2942
|
13
|
50
|
|
|
|
520
|
local $/ = "\n"; |
2943
|
13
|
|
|
|
|
53
|
open(my $fh, '<', $parsefile) or die "Could not open '$parsefile': $!"; |
2944
|
13
|
|
|
|
|
25
|
binmode $fh; |
2945
|
13
|
|
|
|
|
23
|
my $inpod = 0; |
2946
|
13
|
|
|
|
|
51
|
my $pod_encoding; |
2947
|
13
|
|
|
|
|
59
|
my $package = $self->{DISTNAME}; |
2948
|
13
|
|
|
|
|
210
|
$package =~ s/-/::/g; |
2949
|
70
|
100
|
|
|
|
238
|
while (<$fh>) { |
|
|
100
|
|
|
|
|
|
2950
|
70
|
100
|
|
|
|
137
|
$inpod = /^=(?!cut)/ ? 1 : /^=cut/ ? 0 : $inpod; |
2951
|
52
|
|
|
|
|
201
|
next if !$inpod; |
2952
|
|
|
|
|
|
|
s#\r*\n\z##; # handle CRLF input |
2953
|
52
|
100
|
|
|
|
143
|
|
2954
|
1
|
|
|
|
|
12
|
if ( /^=encoding\s*(.*)$/i ) { |
2955
|
|
|
|
|
|
|
$pod_encoding = $1; |
2956
|
|
|
|
|
|
|
} |
2957
|
52
|
100
|
|
|
|
341
|
|
2958
|
13
|
|
|
|
|
45
|
if ( /^($package(?:\.pm)? \s+ -+ \s+)(.*)/x ) { |
2959
|
13
|
|
|
|
|
105
|
$result = $2; |
2960
|
|
|
|
|
|
|
next; |
2961
|
39
|
100
|
|
|
|
134
|
} |
2962
|
|
|
|
|
|
|
next unless $result; |
2963
|
5
|
100
|
66
|
|
|
50
|
|
|
|
|
33
|
|
|
|
|
2964
|
3
|
|
|
|
|
11
|
if ( $result && ( /^\s*$/ || /^\=/ ) ) { |
2965
|
|
|
|
|
|
|
last; |
2966
|
2
|
|
|
|
|
25
|
} |
2967
|
|
|
|
|
|
|
$result = join ' ', $result, $_; |
2968
|
13
|
|
|
|
|
178
|
} |
2969
|
|
|
|
|
|
|
close $fh; |
2970
|
13
|
100
|
33
|
|
|
56
|
|
|
|
|
66
|
|
|
|
|
2971
|
|
|
|
|
|
|
if ( $pod_encoding and !( "$]" < 5.008 or !$Config{useperlio} ) ) { |
2972
|
|
|
|
|
|
|
# Have to wrap in an eval{} for when running under PERL_CORE |
2973
|
|
|
|
|
|
|
# Encode isn't available during build phase and parsing |
2974
|
1
|
|
|
|
|
7
|
# ABSTRACT isn't important there |
2975
|
1
|
|
|
|
|
14
|
eval { |
2976
|
1
|
|
|
|
|
36
|
require Encode; |
2977
|
|
|
|
|
|
|
$result = Encode::decode($pod_encoding, $result); |
2978
|
|
|
|
|
|
|
} |
2979
|
|
|
|
|
|
|
} |
2980
|
13
|
|
|
|
|
214
|
|
2981
|
|
|
|
|
|
|
return $result; |
2982
|
|
|
|
|
|
|
} |
2983
|
|
|
|
|
|
|
|
2984
|
|
|
|
|
|
|
=item parse_version |
2985
|
|
|
|
|
|
|
|
2986
|
|
|
|
|
|
|
my $version = MM->parse_version($file); |
2987
|
|
|
|
|
|
|
|
2988
|
|
|
|
|
|
|
Parse a $file and return what $VERSION is set to by the first assignment. |
2989
|
|
|
|
|
|
|
It will return the string "undef" if it can't figure out what $VERSION |
2990
|
|
|
|
|
|
|
is. $VERSION should be for all to see, so C<our $VERSION> or plain $VERSION |
2991
|
|
|
|
|
|
|
are okay, but C<my $VERSION> is not. |
2992
|
|
|
|
|
|
|
|
2993
|
|
|
|
|
|
|
C<package Foo VERSION> is also checked for. The first version |
2994
|
|
|
|
|
|
|
declaration found is used, but this may change as it differs from how |
2995
|
|
|
|
|
|
|
Perl does it. |
2996
|
|
|
|
|
|
|
|
2997
|
|
|
|
|
|
|
parse_version() will try to C<use version> before checking for |
2998
|
|
|
|
|
|
|
C<$VERSION> so the following will work. |
2999
|
|
|
|
|
|
|
|
3000
|
|
|
|
|
|
|
$VERSION = qv(1.2.3); |
3001
|
|
|
|
|
|
|
|
3002
|
|
|
|
|
|
|
=cut |
3003
|
|
|
|
|
|
|
|
3004
|
155
|
|
|
155
|
1
|
94673
|
sub parse_version { |
3005
|
155
|
|
|
|
|
339
|
my($self,$parsefile) = @_; |
3006
|
|
|
|
|
|
|
my $result; |
3007
|
155
|
|
|
|
|
1120
|
|
3008
|
155
|
|
|
|
|
354
|
local $/ = "\n"; |
3009
|
155
|
50
|
|
|
|
7670
|
local $_; |
3010
|
155
|
|
|
|
|
611
|
open(my $fh, '<', $parsefile) or die "Could not open '$parsefile': $!"; |
3011
|
155
|
|
|
|
|
3853
|
my $inpod = 0; |
3012
|
355
|
50
|
|
|
|
1892
|
while (<$fh>) { |
|
|
50
|
|
|
|
|
|
3013
|
355
|
50
|
33
|
|
|
2068
|
$inpod = /^=(?!cut)/ ? 1 : /^=cut/ ? 0 : $inpod; |
3014
|
355
|
|
|
|
|
763
|
next if $inpod || /^\s*#/; |
3015
|
355
|
100
|
|
|
|
1417
|
chop; |
3016
|
353
|
100
|
|
|
|
3112
|
next if /^\s*(if|unless|elsif)/; |
|
|
100
|
|
|
|
|
|
3017
|
52
|
|
|
52
|
|
449
|
if ( m{^ \s* package \s+ \w[\w\:\']* \s+ (v?[0-9._]+) \s* (;|\{) }x ) { |
|
52
|
|
|
|
|
134
|
|
|
52
|
|
|
|
|
21248
|
|
3018
|
16
|
|
|
|
|
50
|
no warnings; |
3019
|
|
|
|
|
|
|
$result = $1; |
3020
|
|
|
|
|
|
|
} |
3021
|
130
|
|
|
|
|
2249
|
elsif ( m{(?<!\\) ([\$*]) (([\w\:\']*) \bVERSION)\b .* (?<![<>=!])\=[^=]}x ) { |
3022
|
|
|
|
|
|
|
$result = $self->get_version($parsefile, $1, $2); |
3023
|
|
|
|
|
|
|
} |
3024
|
207
|
|
|
|
|
723
|
else { |
3025
|
|
|
|
|
|
|
next; |
3026
|
146
|
100
|
|
|
|
598
|
} |
3027
|
|
|
|
|
|
|
last if defined $result; |
3028
|
155
|
|
|
|
|
2458
|
} |
3029
|
|
|
|
|
|
|
close $fh; |
3030
|
155
|
100
|
100
|
|
|
3104
|
|
3031
|
3
|
|
|
|
|
16
|
if ( defined $result && $result !~ /^v?[\d_\.]+$/ ) { |
3032
|
3
|
|
|
|
|
7
|
require version; |
|
3
|
|
|
|
|
37
|
|
3033
|
3
|
100
|
|
|
|
12
|
my $normal = eval { version->new( $result ) }; |
3034
|
|
|
|
|
|
|
$result = $normal if defined $normal; |
3035
|
155
|
100
|
|
|
|
634
|
} |
3036
|
|
|
|
|
|
|
if ( defined $result ) { |
3037
|
142
|
100
|
66
|
|
|
1348
|
$result = "undef" unless $result =~ m!^v?[\d_\.]+$! |
|
2
|
|
|
|
|
19
|
|
3038
|
|
|
|
|
|
|
or eval { version->parse( $result ) }; |
3039
|
155
|
100
|
|
|
|
489
|
} |
3040
|
155
|
|
|
|
|
1481
|
$result = "undef" unless defined $result; |
3041
|
|
|
|
|
|
|
return $result; |
3042
|
|
|
|
|
|
|
} |
3043
|
|
|
|
|
|
|
|
3044
|
130
|
|
|
130
|
0
|
1547
|
sub get_version { |
3045
|
130
|
|
|
|
|
543
|
my ($self, $parsefile, $sigil, $name) = @_; |
3046
|
|
|
|
|
|
|
my $line = $_; # from the while() loop in parse_version |
3047
|
130
|
|
|
|
|
288
|
{ |
3048
|
130
|
|
|
|
|
893
|
package ExtUtils::MakeMaker::_version; |
3049
|
130
|
|
|
|
|
319
|
undef *version; # in case of unexpected version() sub |
3050
|
130
|
|
|
|
|
774
|
eval { |
3051
|
130
|
|
|
|
|
1822
|
require version; |
3052
|
|
|
|
|
|
|
version::->import; |
3053
|
52
|
|
|
52
|
|
506
|
}; |
|
52
|
|
|
|
|
152
|
|
|
52
|
|
|
|
|
1870
|
|
3054
|
52
|
|
|
52
|
|
353
|
no strict; |
|
52
|
|
|
|
|
148
|
|
|
52
|
|
|
|
|
285858
|
|
3055
|
130
|
|
|
|
|
8032
|
no warnings; |
|
130
|
|
|
|
|
742
|
|
3056
|
130
|
50
|
|
|
|
1430
|
local *{$name}; |
3057
|
130
|
|
|
1
|
|
13219
|
$line = $1 if $line =~ m{^(.+)}s; |
|
1
|
|
|
1
|
|
12
|
|
|
1
|
|
|
1
|
|
6
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
5
|
|
3058
|
130
|
|
|
|
|
738
|
eval($line); ## no critic |
|
130
|
|
|
|
|
734
|
|
3059
|
|
|
|
|
|
|
return ${$name}; |
3060
|
|
|
|
|
|
|
} |
3061
|
|
|
|
|
|
|
} |
3062
|
|
|
|
|
|
|
|
3063
|
|
|
|
|
|
|
=item pasthru (o) |
3064
|
|
|
|
|
|
|
|
3065
|
|
|
|
|
|
|
Defines the string that is passed to recursive make calls in |
3066
|
|
|
|
|
|
|
subdirectories. The variables like C<PASTHRU_DEFINE> are used in each |
3067
|
|
|
|
|
|
|
level, and passed downwards on the command-line with e.g. the value of |
3068
|
|
|
|
|
|
|
that level's DEFINE. Example: |
3069
|
|
|
|
|
|
|
|
3070
|
|
|
|
|
|
|
# Level 0 has DEFINE = -Dfunky |
3071
|
|
|
|
|
|
|
# This code will define level 0's PASTHRU=PASTHRU_DEFINE="$(DEFINE) |
3072
|
|
|
|
|
|
|
# $(PASTHRU_DEFINE)" |
3073
|
|
|
|
|
|
|
# Level 0's $(CCCMD) will include macros $(DEFINE) and $(PASTHRU_DEFINE) |
3074
|
|
|
|
|
|
|
# So will level 1's, so when level 1 compiles, it will get right values |
3075
|
|
|
|
|
|
|
# And so ad infinitum |
3076
|
|
|
|
|
|
|
|
3077
|
|
|
|
|
|
|
=cut |
3078
|
|
|
|
|
|
|
|
3079
|
154
|
|
|
154
|
1
|
469
|
sub pasthru { |
3080
|
154
|
|
|
|
|
351
|
my($self) = shift; |
3081
|
|
|
|
|
|
|
my(@m); |
3082
|
|
|
|
|
|
|
|
3083
|
154
|
50
|
|
|
|
673
|
my(@pasthru); |
3084
|
154
|
|
|
|
|
354
|
my($sep) = $Is{VMS} ? ',' : ''; |
3085
|
|
|
|
|
|
|
$sep .= "\\\n\t"; |
3086
|
154
|
|
|
|
|
876
|
|
3087
|
|
|
|
|
|
|
foreach my $key (qw(LIB LIBPERL_A LINKTYPE OPTIMIZE |
3088
|
|
|
|
|
|
|
PREFIX INSTALL_BASE) |
3089
|
|
|
|
|
|
|
) |
3090
|
924
|
100
|
|
|
|
2375
|
{ |
3091
|
464
|
|
|
|
|
1712
|
next unless defined $self->{$key}; |
3092
|
|
|
|
|
|
|
push @pasthru, "$key=\"\$($key)\""; |
3093
|
|
|
|
|
|
|
} |
3094
|
154
|
|
|
|
|
520
|
|
3095
|
|
|
|
|
|
|
foreach my $key (qw(DEFINE INC)) { |
3096
|
308
|
|
|
|
|
818
|
# default to the make var |
3097
|
|
|
|
|
|
|
my $val = qq{\$($key)}; |
3098
|
|
|
|
|
|
|
# expand within perl if given since need to use quote_literal |
3099
|
308
|
50
|
|
|
|
842
|
# since INC might include space-protecting ""! |
3100
|
308
|
|
|
|
|
691
|
chomp($val = $self->{$key}) if defined $self->{$key}; |
3101
|
308
|
|
|
|
|
772
|
$val .= " \$(PASTHRU_$key)"; |
3102
|
308
|
|
|
|
|
1585
|
my $quoted = $self->quote_literal($val); |
3103
|
|
|
|
|
|
|
push @pasthru, qq{PASTHRU_$key=$quoted}; |
3104
|
|
|
|
|
|
|
} |
3105
|
154
|
|
|
|
|
1387
|
|
3106
|
154
|
|
|
|
|
1023
|
push @m, "\nPASTHRU = ", join ($sep, @pasthru), "\n"; |
3107
|
|
|
|
|
|
|
join "", @m; |
3108
|
|
|
|
|
|
|
} |
3109
|
|
|
|
|
|
|
|
3110
|
|
|
|
|
|
|
=item perl_script |
3111
|
|
|
|
|
|
|
|
3112
|
|
|
|
|
|
|
Takes one argument, a file name, and returns the file name, if the |
3113
|
|
|
|
|
|
|
argument is likely to be a perl script. On MM_Unix this is true for |
3114
|
|
|
|
|
|
|
any ordinary, readable file. |
3115
|
|
|
|
|
|
|
|
3116
|
|
|
|
|
|
|
=cut |
3117
|
|
|
|
|
|
|
|
3118
|
1
|
|
|
1
|
1
|
453
|
sub perl_script { |
3119
|
1
|
50
|
33
|
|
|
24
|
my($self,$file) = @_; |
3120
|
0
|
|
|
|
|
0
|
return $file if -r $file && -f _; |
3121
|
|
|
|
|
|
|
return; |
3122
|
|
|
|
|
|
|
} |
3123
|
|
|
|
|
|
|
|
3124
|
|
|
|
|
|
|
=item perldepend (o) |
3125
|
|
|
|
|
|
|
|
3126
|
|
|
|
|
|
|
Defines the dependency from all *.h files that come with the perl |
3127
|
|
|
|
|
|
|
distribution. |
3128
|
|
|
|
|
|
|
|
3129
|
|
|
|
|
|
|
=cut |
3130
|
|
|
|
|
|
|
|
3131
|
154
|
|
|
154
|
1
|
504
|
sub perldepend { |
3132
|
154
|
|
|
|
|
328
|
my($self) = shift; |
3133
|
|
|
|
|
|
|
my(@m); |
3134
|
154
|
|
|
|
|
551
|
|
3135
|
|
|
|
|
|
|
my $make_config = $self->cd('$(PERL_SRC)', '$(MAKE) lib/Config.pm'); |
3136
|
154
|
50
|
|
|
|
982
|
|
3137
|
|
|
|
|
|
|
push @m, sprintf <<'MAKE_FRAG', $make_config if $self->{PERL_SRC}; |
3138
|
|
|
|
|
|
|
# Check for unpropogated config.sh changes. Should never happen. |
3139
|
|
|
|
|
|
|
# We do NOT just update config.h because that is not sufficient. |
3140
|
|
|
|
|
|
|
# An out of date config.h is not fatal but complains loudly! |
3141
|
|
|
|
|
|
|
$(PERL_INCDEP)/config.h: $(PERL_SRC)/config.sh |
3142
|
|
|
|
|
|
|
-$(NOECHO) $(ECHO) "Warning: $(PERL_INC)/config.h out of date with $(PERL_SRC)/config.sh"; $(FALSE) |
3143
|
|
|
|
|
|
|
|
3144
|
|
|
|
|
|
|
$(PERL_ARCHLIB)/Config.pm: $(PERL_SRC)/config.sh |
3145
|
|
|
|
|
|
|
$(NOECHO) $(ECHO) "Warning: $(PERL_ARCHLIB)/Config.pm may be out of date with $(PERL_SRC)/config.sh" |
3146
|
|
|
|
|
|
|
%s |
3147
|
|
|
|
|
|
|
MAKE_FRAG |
3148
|
154
|
50
|
|
|
|
565
|
|
3149
|
|
|
|
|
|
|
return join "", @m unless $self->needs_linking; |
3150
|
0
|
0
|
|
|
|
0
|
|
3151
|
|
|
|
|
|
|
if ($self->{OBJECT}) { |
3152
|
|
|
|
|
|
|
# Need to add an object file dependency on the perl headers. |
3153
|
0
|
|
|
|
|
0
|
# this is very important for XS modules in perl.git development. |
3154
|
|
|
|
|
|
|
push @m, $self->_perl_header_files_fragment("/"); # Directory separator between $(PERL_INC)/header.h |
3155
|
|
|
|
|
|
|
} |
3156
|
0
|
0
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
3157
|
|
|
|
|
|
|
push @m, join(" ", sort values %{$self->{XS}})." : \$(XSUBPPDEPS)\n" if %{$self->{XS}}; |
3158
|
0
|
|
|
|
|
0
|
|
3159
|
|
|
|
|
|
|
return join "\n", @m; |
3160
|
|
|
|
|
|
|
} |
3161
|
|
|
|
|
|
|
|
3162
|
|
|
|
|
|
|
|
3163
|
|
|
|
|
|
|
=item pm_to_blib |
3164
|
|
|
|
|
|
|
|
3165
|
|
|
|
|
|
|
Defines target that copies all files in the hash PM to their |
3166
|
|
|
|
|
|
|
destination and autosplits them. See L<ExtUtils::Install/DESCRIPTION> |
3167
|
|
|
|
|
|
|
|
3168
|
|
|
|
|
|
|
=cut |
3169
|
|
|
|
|
|
|
|
3170
|
154
|
|
|
154
|
1
|
512
|
sub pm_to_blib { |
3171
|
154
|
|
|
|
|
1513
|
my $self = shift; |
3172
|
154
|
|
|
|
|
963
|
my($autodir) = $self->catdir('$(INST_LIB)','auto'); |
3173
|
|
|
|
|
|
|
my $r = q{ |
3174
|
|
|
|
|
|
|
pm_to_blib : $(FIRST_MAKEFILE) $(TO_INST_PM) |
3175
|
|
|
|
|
|
|
}; |
3176
|
|
|
|
|
|
|
|
3177
|
154
|
|
|
|
|
1312
|
# VMS will swallow '' and PM_FILTER is often empty. So use q[] |
3178
|
|
|
|
|
|
|
my $pm_to_blib = $self->oneliner(<<CODE, ['-MExtUtils::Install']); |
3179
|
|
|
|
|
|
|
pm_to_blib({\@ARGV}, '$autodir', q[\$(PM_FILTER)], '\$(PERM_DIR)') |
3180
|
|
|
|
|
|
|
CODE |
3181
|
|
|
|
|
|
|
|
3182
|
154
|
|
|
|
|
608
|
my @cmds = $self->split_command($pm_to_blib, |
|
122
|
|
|
|
|
328
|
|
|
154
|
|
|
|
|
866
|
|
3183
|
|
|
|
|
|
|
map { ($self->quote_literal($_) => $self->quote_literal($self->{PM}->{$_})) } sort keys %{$self->{PM}}); |
3184
|
154
|
|
|
|
|
589
|
|
|
122
|
|
|
|
|
1015
|
|
3185
|
154
|
|
|
|
|
437
|
$r .= join '', map { "\t\$(NOECHO) $_\n" } @cmds; |
3186
|
|
|
|
|
|
|
$r .= qq{\t\$(NOECHO) \$(TOUCH) pm_to_blib\n}; |
3187
|
154
|
|
|
|
|
593
|
|
3188
|
|
|
|
|
|
|
return $r; |
3189
|
|
|
|
|
|
|
} |
3190
|
|
|
|
|
|
|
|
3191
|
|
|
|
|
|
|
# transform dot-separated version string into comma-separated quadruple |
3192
|
|
|
|
|
|
|
# examples: '1.2.3.4.5' => '1,2,3,4' |
3193
|
|
|
|
|
|
|
# '1.2.3' => '1,2,3,0' |
3194
|
6
|
|
|
6
|
|
36
|
sub _ppd_version { |
3195
|
6
|
|
|
|
|
54
|
my ($self, $string) = @_; |
3196
|
|
|
|
|
|
|
return join ',', ((split /\./, $string), (0) x 4)[0..3]; |
3197
|
|
|
|
|
|
|
} |
3198
|
|
|
|
|
|
|
|
3199
|
|
|
|
|
|
|
=item ppd |
3200
|
|
|
|
|
|
|
|
3201
|
|
|
|
|
|
|
Defines target that creates a PPD (Perl Package Description) file |
3202
|
|
|
|
|
|
|
for a binary distribution. |
3203
|
|
|
|
|
|
|
|
3204
|
|
|
|
|
|
|
=cut |
3205
|
|
|
|
|
|
|
|
3206
|
154
|
|
|
154
|
1
|
619
|
sub ppd { |
3207
|
|
|
|
|
|
|
my($self) = @_; |
3208
|
154
|
|
100
|
|
|
1325
|
|
3209
|
154
|
|
|
|
|
468
|
my $abstract = $self->{ABSTRACT} || ''; |
3210
|
154
|
|
|
|
|
299
|
$abstract =~ s/\n/\\n/sg; |
3211
|
154
|
|
|
|
|
344
|
$abstract =~ s/</</g; |
3212
|
|
|
|
|
|
|
$abstract =~ s/>/>/g; |
3213
|
154
|
100
|
100
|
|
|
396
|
|
|
154
|
|
|
|
|
2455
|
|
3214
|
154
|
|
|
|
|
583
|
my $author = join(', ',@{ ref $self->{AUTHOR} eq 'ARRAY' ? $self->{AUTHOR} : [ $self->{AUTHOR} || '']}); |
3215
|
154
|
|
|
|
|
421
|
$author =~ s/</</g; |
3216
|
|
|
|
|
|
|
$author =~ s/>/>/g; |
3217
|
154
|
|
|
|
|
616
|
|
3218
|
|
|
|
|
|
|
my $ppd_file = "$self->{DISTNAME}.ppd"; |
3219
|
154
|
|
|
|
|
1713
|
|
3220
|
|
|
|
|
|
|
my @ppd_chunks = qq(<SOFTPKG NAME="$self->{DISTNAME}" VERSION="$self->{VERSION}">\n); |
3221
|
154
|
|
|
|
|
898
|
|
3222
|
|
|
|
|
|
|
push @ppd_chunks, sprintf <<'PPD_HTML', $abstract, $author; |
3223
|
|
|
|
|
|
|
<ABSTRACT>%s</ABSTRACT> |
3224
|
|
|
|
|
|
|
<AUTHOR>%s</AUTHOR> |
3225
|
|
|
|
|
|
|
PPD_HTML |
3226
|
154
|
|
|
|
|
413
|
|
3227
|
154
|
100
|
|
|
|
528
|
push @ppd_chunks, " <IMPLEMENTATION>\n"; |
3228
|
6
|
|
|
|
|
86
|
if ( $self->{MIN_PERL_VERSION} ) { |
3229
|
6
|
|
|
|
|
31
|
my $min_perl_version = $self->_ppd_version($self->{MIN_PERL_VERSION}); |
3230
|
|
|
|
|
|
|
push @ppd_chunks, sprintf <<'PPD_PERLVERS', $min_perl_version; |
3231
|
|
|
|
|
|
|
<PERLCORE VERSION="%s" /> |
3232
|
|
|
|
|
|
|
PPD_PERLVERS |
3233
|
|
|
|
|
|
|
|
3234
|
|
|
|
|
|
|
} |
3235
|
|
|
|
|
|
|
|
3236
|
|
|
|
|
|
|
# Don't add "perl" to requires. perl dependencies are |
3237
|
154
|
|
|
|
|
319
|
# handles by ARCHITECTURE. |
|
154
|
|
|
|
|
710
|
|
3238
|
154
|
|
|
|
|
460
|
my %prereqs = %{$self->{PREREQ_PM}}; |
3239
|
|
|
|
|
|
|
delete $prereqs{perl}; |
3240
|
|
|
|
|
|
|
|
3241
|
154
|
|
|
|
|
925
|
# Build up REQUIRE |
3242
|
35
|
|
|
|
|
98
|
foreach my $prereq (sort keys %prereqs) { |
3243
|
35
|
100
|
|
|
|
341
|
my $name = $prereq; |
3244
|
35
|
|
|
|
|
186
|
$name .= '::' unless $name =~ /::/; |
3245
|
|
|
|
|
|
|
my $version = $prereqs{$prereq}; |
3246
|
35
|
|
|
|
|
120
|
|
3247
|
35
|
100
|
|
|
|
152
|
my %attrs = ( NAME => $name ); |
3248
|
35
|
|
|
|
|
165
|
$attrs{VERSION} = $version if $version; |
|
53
|
|
|
|
|
371
|
|
3249
|
35
|
|
|
|
|
288
|
my $attrs = join " ", map { qq[$_="$attrs{$_}"] } sort keys %attrs; |
3250
|
|
|
|
|
|
|
push @ppd_chunks, qq( <REQUIRE $attrs />\n); |
3251
|
|
|
|
|
|
|
} |
3252
|
154
|
|
|
|
|
800
|
|
3253
|
|
|
|
|
|
|
my $archname = $Config{archname}; |
3254
|
|
|
|
|
|
|
|
3255
|
|
|
|
|
|
|
# archname did not change from 5.6 to 5.8, but those versions may |
3256
|
|
|
|
|
|
|
# not be not binary compatible so now we append the part of the |
3257
|
154
|
50
|
|
|
|
1732
|
# version that changes when binary compatibility may change |
3258
|
154
|
|
|
|
|
944
|
if ("$]" >= 5.008) { |
3259
|
|
|
|
|
|
|
$archname .= "-$Config{api_revision}.$Config{api_version}"; |
3260
|
154
|
|
|
|
|
686
|
} |
3261
|
|
|
|
|
|
|
push @ppd_chunks, sprintf <<'PPD_OUT', $archname; |
3262
|
|
|
|
|
|
|
<ARCHITECTURE NAME="%s" /> |
3263
|
|
|
|
|
|
|
PPD_OUT |
3264
|
154
|
50
|
|
|
|
786
|
|
3265
|
0
|
0
|
|
|
|
0
|
if ($self->{PPM_INSTALL_SCRIPT}) { |
3266
|
|
|
|
|
|
|
if ($self->{PPM_INSTALL_EXEC}) { |
3267
|
0
|
|
|
|
|
0
|
push @ppd_chunks, sprintf qq{ <INSTALL EXEC="%s">%s</INSTALL>\n}, |
3268
|
|
|
|
|
|
|
$self->{PPM_INSTALL_EXEC}, $self->{PPM_INSTALL_SCRIPT}; |
3269
|
|
|
|
|
|
|
} |
3270
|
|
|
|
|
|
|
else { |
3271
|
0
|
|
|
|
|
0
|
push @ppd_chunks, sprintf qq{ <INSTALL>%s</INSTALL>\n}, |
3272
|
|
|
|
|
|
|
$self->{PPM_INSTALL_SCRIPT}; |
3273
|
|
|
|
|
|
|
} |
3274
|
|
|
|
|
|
|
} |
3275
|
154
|
50
|
|
|
|
496
|
|
3276
|
0
|
0
|
|
|
|
0
|
if ($self->{PPM_UNINSTALL_SCRIPT}) { |
3277
|
|
|
|
|
|
|
if ($self->{PPM_UNINSTALL_EXEC}) { |
3278
|
0
|
|
|
|
|
0
|
push @ppd_chunks, sprintf qq{ <UNINSTALL EXEC="%s">%s</UNINSTALL>\n}, |
3279
|
|
|
|
|
|
|
$self->{PPM_UNINSTALL_EXEC}, $self->{PPM_UNINSTALL_SCRIPT}; |
3280
|
|
|
|
|
|
|
} |
3281
|
|
|
|
|
|
|
else { |
3282
|
0
|
|
|
|
|
0
|
push @ppd_chunks, sprintf qq{ <UNINSTALL>%s</UNINSTALL>\n}, |
3283
|
|
|
|
|
|
|
$self->{PPM_UNINSTALL_SCRIPT}; |
3284
|
|
|
|
|
|
|
} |
3285
|
|
|
|
|
|
|
} |
3286
|
154
|
|
50
|
|
|
1360
|
|
3287
|
154
|
|
|
|
|
452
|
my ($bin_location) = $self->{BINARY_LOCATION} || ''; |
3288
|
|
|
|
|
|
|
$bin_location =~ s/\\/\\\\/g; |
3289
|
154
|
|
|
|
|
730
|
|
3290
|
|
|
|
|
|
|
push @ppd_chunks, sprintf <<'PPD_XML', $bin_location; |
3291
|
|
|
|
|
|
|
<CODEBASE HREF="%s" /> |
3292
|
|
|
|
|
|
|
</IMPLEMENTATION> |
3293
|
|
|
|
|
|
|
</SOFTPKG> |
3294
|
|
|
|
|
|
|
PPD_XML |
3295
|
154
|
|
|
|
|
1480
|
|
3296
|
|
|
|
|
|
|
my @ppd_cmds = $self->stashmeta(join('', @ppd_chunks), $ppd_file); |
3297
|
154
|
|
|
|
|
1997
|
|
3298
|
|
|
|
|
|
|
return sprintf <<'PPD_OUT', join "\n\t", @ppd_cmds; |
3299
|
|
|
|
|
|
|
# Creates a PPD (Perl Package Description) for a binary distribution. |
3300
|
|
|
|
|
|
|
ppd : |
3301
|
|
|
|
|
|
|
%s |
3302
|
|
|
|
|
|
|
PPD_OUT |
3303
|
|
|
|
|
|
|
|
3304
|
|
|
|
|
|
|
} |
3305
|
|
|
|
|
|
|
|
3306
|
|
|
|
|
|
|
=item prefixify |
3307
|
|
|
|
|
|
|
|
3308
|
|
|
|
|
|
|
$MM->prefixify($var, $prefix, $new_prefix, $default); |
3309
|
|
|
|
|
|
|
|
3310
|
|
|
|
|
|
|
Using either $MM->{uc $var} || $Config{lc $var}, it will attempt to |
3311
|
|
|
|
|
|
|
replace it's $prefix with a $new_prefix. |
3312
|
|
|
|
|
|
|
|
3313
|
|
|
|
|
|
|
Should the $prefix fail to match I<AND> a PREFIX was given as an |
3314
|
|
|
|
|
|
|
argument to WriteMakefile() it will set it to the $new_prefix + |
3315
|
|
|
|
|
|
|
$default. This is for systems whose file layouts don't neatly fit into |
3316
|
|
|
|
|
|
|
our ideas of prefixes. |
3317
|
|
|
|
|
|
|
|
3318
|
|
|
|
|
|
|
This is for heuristics which attempt to create directory structures |
3319
|
|
|
|
|
|
|
that mirror those of the installed perl. |
3320
|
|
|
|
|
|
|
|
3321
|
|
|
|
|
|
|
For example: |
3322
|
|
|
|
|
|
|
|
3323
|
|
|
|
|
|
|
$MM->prefixify('installman1dir', '/usr', '/home/foo', 'man/man1'); |
3324
|
|
|
|
|
|
|
|
3325
|
|
|
|
|
|
|
this will attempt to remove '/usr' from the front of the |
3326
|
|
|
|
|
|
|
$MM->{INSTALLMAN1DIR} path (initializing it to $Config{installman1dir} |
3327
|
|
|
|
|
|
|
if necessary) and replace it with '/home/foo'. If this fails it will |
3328
|
|
|
|
|
|
|
simply use '/home/foo/man/man1'. |
3329
|
|
|
|
|
|
|
|
3330
|
|
|
|
|
|
|
=cut |
3331
|
|
|
|
|
|
|
|
3332
|
2235
|
|
|
2235
|
1
|
5892
|
sub prefixify { |
3333
|
|
|
|
|
|
|
my($self,$var,$sprefix,$rprefix,$default) = @_; |
3334
|
|
|
|
|
|
|
|
3335
|
2235
|
|
100
|
|
|
15275
|
my $path = $self->{uc $var} || |
3336
|
|
|
|
|
|
|
$Config_Override{lc $var} || $Config{lc $var} || ''; |
3337
|
2235
|
50
|
|
|
|
5359
|
|
3338
|
|
|
|
|
|
|
$rprefix .= '/' if $sprefix =~ m|/$|; |
3339
|
2235
|
50
|
|
|
|
4141
|
|
3340
|
2235
|
50
|
|
|
|
3857
|
warn " prefixify $var => $path\n" if $Verbose >= 2; |
3341
|
|
|
|
|
|
|
warn " from $sprefix to $rprefix\n" if $Verbose >= 2; |
3342
|
2235
|
100
|
100
|
|
|
5128
|
|
3343
|
|
|
|
|
|
|
if( $self->{ARGS}{PREFIX} && |
3344
|
|
|
|
|
|
|
$path !~ s{^\Q$sprefix\E\b}{$rprefix}s ) |
3345
|
|
|
|
|
|
|
{ |
3346
|
14
|
50
|
|
|
|
37
|
|
3347
|
14
|
50
|
33
|
|
|
38
|
warn " cannot prefix, using default.\n" if $Verbose >= 2; |
3348
|
|
|
|
|
|
|
warn " no default!\n" if !$default && $Verbose >= 2; |
3349
|
14
|
50
|
|
|
|
90
|
|
3350
|
|
|
|
|
|
|
$path = $self->catdir($rprefix, $default) if $default; |
3351
|
|
|
|
|
|
|
} |
3352
|
2235
|
50
|
|
|
|
4553
|
|
3353
|
2235
|
|
|
|
|
7722
|
print " now $path\n" if $Verbose >= 2; |
3354
|
|
|
|
|
|
|
return $self->{uc $var} = $path; |
3355
|
|
|
|
|
|
|
} |
3356
|
|
|
|
|
|
|
|
3357
|
|
|
|
|
|
|
|
3358
|
|
|
|
|
|
|
=item processPL (o) |
3359
|
|
|
|
|
|
|
|
3360
|
|
|
|
|
|
|
Defines targets to run *.PL files. |
3361
|
|
|
|
|
|
|
|
3362
|
|
|
|
|
|
|
=cut |
3363
|
|
|
|
|
|
|
|
3364
|
154
|
|
|
154
|
1
|
457
|
sub processPL { |
3365
|
154
|
|
|
|
|
455
|
my $self = shift; |
3366
|
|
|
|
|
|
|
my $pl_files = $self->{PL_FILES}; |
3367
|
154
|
50
|
|
|
|
433
|
|
3368
|
|
|
|
|
|
|
return "" unless $pl_files; |
3369
|
154
|
|
|
|
|
722
|
|
3370
|
154
|
|
|
|
|
1024
|
my $m = ''; |
3371
|
0
|
|
|
|
|
0
|
foreach my $plfile (sort keys %$pl_files) { |
3372
|
|
|
|
|
|
|
my $targets = $pl_files->{$plfile}; |
3373
|
|
|
|
|
|
|
my $list = |
3374
|
|
|
|
|
|
|
ref($targets) eq 'HASH' ? [ sort keys %$targets ] : |
3375
|
0
|
0
|
|
|
|
0
|
ref($targets) eq 'ARRAY' ? $pl_files->{$plfile} : |
|
|
0
|
|
|
|
|
|
3376
|
|
|
|
|
|
|
[$pl_files->{$plfile}]; |
3377
|
0
|
|
|
|
|
0
|
|
3378
|
0
|
0
|
|
|
|
0
|
foreach my $target (@$list) { |
3379
|
0
|
|
|
|
|
0
|
if( $Is{VMS} ) { |
3380
|
0
|
|
|
|
|
0
|
$plfile = vmsify($self->eliminate_macros($plfile)); |
3381
|
|
|
|
|
|
|
$target = vmsify($self->eliminate_macros($target)); |
3382
|
|
|
|
|
|
|
} |
3383
|
|
|
|
|
|
|
|
3384
|
|
|
|
|
|
|
# Normally a .PL file runs AFTER pm_to_blib so it can have |
3385
|
|
|
|
|
|
|
# blib in its @INC and load the just built modules. BUT if |
3386
|
|
|
|
|
|
|
# the generated module is something in $(TO_INST_PM) which |
3387
|
|
|
|
|
|
|
# pm_to_blib depends on then it can't depend on pm_to_blib |
3388
|
0
|
|
|
|
|
0
|
# else we have a dependency loop. |
3389
|
|
|
|
|
|
|
my $pm_dep; |
3390
|
0
|
0
|
|
|
|
0
|
my $perlrun; |
3391
|
0
|
|
|
|
|
0
|
if( defined $self->{PM}{$target} ) { |
3392
|
0
|
|
|
|
|
0
|
$pm_dep = ''; |
3393
|
|
|
|
|
|
|
$perlrun = 'PERLRUN'; |
3394
|
|
|
|
|
|
|
} |
3395
|
0
|
|
|
|
|
0
|
else { |
3396
|
0
|
|
|
|
|
0
|
$pm_dep = 'pm_to_blib'; |
3397
|
|
|
|
|
|
|
$perlrun = 'PERLRUNINST'; |
3398
|
|
|
|
|
|
|
} |
3399
|
0
|
|
|
|
|
0
|
|
3400
|
0
|
0
|
|
|
|
0
|
my $extra_inputs = ''; |
3401
|
|
|
|
|
|
|
if( ref($targets) eq 'HASH' ) { |
3402
|
|
|
|
|
|
|
my $inputs = ref($targets->{$target}) |
3403
|
0
|
0
|
|
|
|
0
|
? $targets->{$target} |
3404
|
|
|
|
|
|
|
: [$targets->{$target}]; |
3405
|
0
|
|
|
|
|
0
|
|
3406
|
0
|
0
|
|
|
|
0
|
for my $input (@$inputs) { |
3407
|
0
|
|
|
|
|
0
|
if( $Is{VMS} ) { |
3408
|
|
|
|
|
|
|
$input = vmsify($self->eliminate_macros($input)); |
3409
|
0
|
|
|
|
|
0
|
} |
3410
|
|
|
|
|
|
|
$extra_inputs .= ' '.$input; |
3411
|
|
|
|
|
|
|
} |
3412
|
|
|
|
|
|
|
} |
3413
|
0
|
|
|
|
|
0
|
|
3414
|
|
|
|
|
|
|
$m .= <<MAKE_FRAG; |
3415
|
|
|
|
|
|
|
|
3416
|
|
|
|
|
|
|
pure_all :: $target |
3417
|
|
|
|
|
|
|
\$(NOECHO) \$(NOOP) |
3418
|
|
|
|
|
|
|
|
3419
|
|
|
|
|
|
|
$target :: $plfile $pm_dep $extra_inputs |
3420
|
|
|
|
|
|
|
\$($perlrun) $plfile $target $extra_inputs |
3421
|
|
|
|
|
|
|
MAKE_FRAG |
3422
|
|
|
|
|
|
|
|
3423
|
|
|
|
|
|
|
} |
3424
|
|
|
|
|
|
|
} |
3425
|
154
|
|
|
|
|
622
|
|
3426
|
|
|
|
|
|
|
return $m; |
3427
|
|
|
|
|
|
|
} |
3428
|
|
|
|
|
|
|
|
3429
|
|
|
|
|
|
|
=item specify_shell |
3430
|
|
|
|
|
|
|
|
3431
|
|
|
|
|
|
|
Specify SHELL if needed - not done on Unix. |
3432
|
|
|
|
|
|
|
|
3433
|
|
|
|
|
|
|
=cut |
3434
|
|
|
|
|
|
|
|
3435
|
155
|
|
|
155
|
1
|
979
|
sub specify_shell { |
3436
|
|
|
|
|
|
|
return ''; |
3437
|
|
|
|
|
|
|
} |
3438
|
|
|
|
|
|
|
|
3439
|
|
|
|
|
|
|
=item quote_paren |
3440
|
|
|
|
|
|
|
|
3441
|
|
|
|
|
|
|
Backslashes parentheses C<()> in command line arguments. |
3442
|
|
|
|
|
|
|
Doesn't handle recursive Makefile C<$(...)> constructs, |
3443
|
|
|
|
|
|
|
but handles simple ones. |
3444
|
|
|
|
|
|
|
|
3445
|
|
|
|
|
|
|
=cut |
3446
|
|
|
|
|
|
|
|
3447
|
0
|
|
|
0
|
1
|
0
|
sub quote_paren { |
3448
|
0
|
|
|
|
|
0
|
my $arg = shift; |
3449
|
0
|
|
|
|
|
0
|
$arg =~ s{\$\((.+?)\)}{\$\\\\($1\\\\)}g; # protect $(...) |
3450
|
0
|
|
|
|
|
0
|
$arg =~ s{(?<!\\)([()])}{\\$1}g; # quote unprotected |
3451
|
0
|
|
|
|
|
0
|
$arg =~ s{\$\\\\\((.+?)\\\\\)}{\$($1)}g; # unprotect $(...) |
3452
|
|
|
|
|
|
|
return $arg; |
3453
|
|
|
|
|
|
|
} |
3454
|
|
|
|
|
|
|
|
3455
|
|
|
|
|
|
|
=item replace_manpage_separator |
3456
|
|
|
|
|
|
|
|
3457
|
|
|
|
|
|
|
my $man_name = $MM->replace_manpage_separator($file_path); |
3458
|
|
|
|
|
|
|
|
3459
|
|
|
|
|
|
|
Takes the name of a package, which may be a nested package, in the |
3460
|
|
|
|
|
|
|
form 'Foo/Bar.pm' and replaces the slash with C<::> or something else |
3461
|
|
|
|
|
|
|
safe for a man page file name. Returns the replacement. |
3462
|
|
|
|
|
|
|
|
3463
|
|
|
|
|
|
|
=cut |
3464
|
|
|
|
|
|
|
|
3465
|
22
|
|
|
22
|
1
|
471
|
sub replace_manpage_separator { |
3466
|
|
|
|
|
|
|
my($self,$man) = @_; |
3467
|
22
|
|
|
|
|
123
|
|
3468
|
22
|
|
|
|
|
84
|
$man =~ s,/+,::,g; |
3469
|
|
|
|
|
|
|
return $man; |
3470
|
|
|
|
|
|
|
} |
3471
|
|
|
|
|
|
|
|
3472
|
|
|
|
|
|
|
|
3473
|
|
|
|
|
|
|
=item cd |
3474
|
|
|
|
|
|
|
|
3475
|
|
|
|
|
|
|
=cut |
3476
|
|
|
|
|
|
|
|
3477
|
1191
|
|
|
1191
|
1
|
4996
|
sub cd { |
3478
|
|
|
|
|
|
|
my($self, $dir, @cmds) = @_; |
3479
|
|
|
|
|
|
|
|
3480
|
1191
|
|
|
|
|
2451
|
# No leading tab and no trailing newline makes for easier embedding |
|
1387
|
|
|
|
|
4629
|
|
3481
|
|
|
|
|
|
|
my $make_frag = join "\n\t", map { "cd $dir && $_" } @cmds; |
3482
|
1191
|
|
|
|
|
4033
|
|
3483
|
|
|
|
|
|
|
return $make_frag; |
3484
|
|
|
|
|
|
|
} |
3485
|
|
|
|
|
|
|
|
3486
|
|
|
|
|
|
|
=item oneliner |
3487
|
|
|
|
|
|
|
|
3488
|
|
|
|
|
|
|
=cut |
3489
|
|
|
|
|
|
|
|
3490
|
2403
|
|
|
2403
|
1
|
171344
|
sub oneliner { |
3491
|
2403
|
100
|
|
|
|
5868
|
my($self, $cmd, $switches) = @_; |
3492
|
|
|
|
|
|
|
$switches = [] unless defined $switches; |
3493
|
|
|
|
|
|
|
|
3494
|
2403
|
|
|
|
|
5953
|
# Strip leading and trailing newlines |
3495
|
2403
|
|
|
|
|
9866
|
$cmd =~ s{^\n+}{}; |
3496
|
|
|
|
|
|
|
$cmd =~ s{\n+$}{}; |
3497
|
2403
|
|
|
|
|
8113
|
|
3498
|
2403
|
|
|
|
|
8715
|
my @cmds = split /\n/, $cmd; |
3499
|
2403
|
|
|
|
|
7605
|
$cmd = join " \n\t -e ", map $self->quote_literal($_), @cmds; |
3500
|
|
|
|
|
|
|
$cmd = $self->escape_newlines($cmd); |
3501
|
2403
|
|
|
|
|
5551
|
|
3502
|
|
|
|
|
|
|
$switches = join ' ', @$switches; |
3503
|
2403
|
|
|
|
|
12351
|
|
3504
|
|
|
|
|
|
|
return qq{\$(ABSPERLRUN) $switches -e $cmd --}; |
3505
|
|
|
|
|
|
|
} |
3506
|
|
|
|
|
|
|
|
3507
|
|
|
|
|
|
|
|
3508
|
|
|
|
|
|
|
=item quote_literal |
3509
|
|
|
|
|
|
|
|
3510
|
|
|
|
|
|
|
Quotes macro literal value suitable for being used on a command line so |
3511
|
|
|
|
|
|
|
that when expanded by make, will be received by command as given to |
3512
|
|
|
|
|
|
|
this method: |
3513
|
|
|
|
|
|
|
|
3514
|
|
|
|
|
|
|
my $quoted = $mm->quote_literal(q{it isn't}); |
3515
|
|
|
|
|
|
|
# returns: |
3516
|
|
|
|
|
|
|
# 'it isn'\''t' |
3517
|
|
|
|
|
|
|
print MAKEFILE "target:\n\techo $quoted\n"; |
3518
|
|
|
|
|
|
|
# when run "make target", will output: |
3519
|
|
|
|
|
|
|
# it isn't |
3520
|
|
|
|
|
|
|
|
3521
|
|
|
|
|
|
|
=cut |
3522
|
|
|
|
|
|
|
|
3523
|
12918
|
|
|
12918
|
1
|
23311
|
sub quote_literal { |
3524
|
12918
|
100
|
|
|
|
29178
|
my($self, $text, $opts) = @_; |
3525
|
|
|
|
|
|
|
$opts->{allow_variables} = 1 unless defined $opts->{allow_variables}; |
3526
|
|
|
|
|
|
|
|
3527
|
12918
|
|
|
|
|
26060
|
# Quote single quotes |
3528
|
|
|
|
|
|
|
$text =~ s{'}{'\\''}g; |
3529
|
|
|
|
|
|
|
|
3530
|
12918
|
100
|
|
|
|
36694
|
$text = $opts->{allow_variables} |
3531
|
|
|
|
|
|
|
? $self->escape_dollarsigns($text) : $self->escape_all_dollarsigns($text); |
3532
|
12918
|
|
|
|
|
45836
|
|
3533
|
|
|
|
|
|
|
return "'$text'"; |
3534
|
|
|
|
|
|
|
} |
3535
|
|
|
|
|
|
|
|
3536
|
|
|
|
|
|
|
|
3537
|
|
|
|
|
|
|
=item escape_newlines |
3538
|
|
|
|
|
|
|
|
3539
|
|
|
|
|
|
|
=cut |
3540
|
|
|
|
|
|
|
|
3541
|
3173
|
|
|
3173
|
1
|
6324
|
sub escape_newlines { |
3542
|
|
|
|
|
|
|
my($self, $text) = @_; |
3543
|
3173
|
|
|
|
|
9436
|
|
3544
|
|
|
|
|
|
|
$text =~ s{\n}{\\\n}g; |
3545
|
3173
|
|
|
|
|
8407
|
|
3546
|
|
|
|
|
|
|
return $text; |
3547
|
|
|
|
|
|
|
} |
3548
|
|
|
|
|
|
|
|
3549
|
|
|
|
|
|
|
|
3550
|
|
|
|
|
|
|
=item max_exec_len |
3551
|
|
|
|
|
|
|
|
3552
|
|
|
|
|
|
|
Using L<POSIX>::ARG_MAX. Otherwise falling back to 4096. |
3553
|
|
|
|
|
|
|
|
3554
|
|
|
|
|
|
|
=cut |
3555
|
|
|
|
|
|
|
|
3556
|
767
|
|
|
767
|
1
|
1578
|
sub max_exec_len { |
3557
|
|
|
|
|
|
|
my $self = shift; |
3558
|
767
|
100
|
|
|
|
1988
|
|
3559
|
155
|
50
|
|
|
|
456
|
if (!defined $self->{_MAX_EXEC_LEN}) { |
|
155
|
|
|
|
|
13593
|
|
|
155
|
|
|
|
|
121455
|
|
3560
|
0
|
|
|
|
|
0
|
if (my $arg_max = eval { require POSIX; &POSIX::ARG_MAX }) { |
3561
|
|
|
|
|
|
|
$self->{_MAX_EXEC_LEN} = $arg_max; |
3562
|
|
|
|
|
|
|
} |
3563
|
155
|
|
|
|
|
6264
|
else { # POSIX minimum exec size |
3564
|
|
|
|
|
|
|
$self->{_MAX_EXEC_LEN} = 4096; |
3565
|
|
|
|
|
|
|
} |
3566
|
|
|
|
|
|
|
} |
3567
|
767
|
|
|
|
|
3310
|
|
3568
|
|
|
|
|
|
|
return $self->{_MAX_EXEC_LEN}; |
3569
|
|
|
|
|
|
|
} |
3570
|
|
|
|
|
|
|
|
3571
|
|
|
|
|
|
|
|
3572
|
|
|
|
|
|
|
=item static (o) |
3573
|
|
|
|
|
|
|
|
3574
|
|
|
|
|
|
|
Defines the static target. |
3575
|
|
|
|
|
|
|
|
3576
|
|
|
|
|
|
|
=cut |
3577
|
|
|
|
|
|
|
|
3578
|
|
|
|
|
|
|
sub static { |
3579
|
|
|
|
|
|
|
# --- Static Loading Sections --- |
3580
|
154
|
|
|
154
|
1
|
490
|
|
3581
|
154
|
|
|
|
|
950
|
my($self) = shift; |
3582
|
|
|
|
|
|
|
' |
3583
|
|
|
|
|
|
|
## $(INST_PM) has been moved to the all: target. |
3584
|
|
|
|
|
|
|
## It remains here for awhile to allow for old usage: "make static" |
3585
|
|
|
|
|
|
|
static :: $(FIRST_MAKEFILE) $(INST_STATIC) |
3586
|
|
|
|
|
|
|
$(NOECHO) $(NOOP) |
3587
|
|
|
|
|
|
|
'; |
3588
|
|
|
|
|
|
|
} |
3589
|
|
|
|
|
|
|
|
3590
|
154
|
|
|
154
|
0
|
430
|
sub static_lib { |
3591
|
154
|
50
|
|
|
|
536
|
my($self) = @_; |
3592
|
0
|
|
|
|
|
0
|
return '' unless $self->has_link_code; |
3593
|
|
|
|
|
|
|
my(@m); |
3594
|
0
|
0
|
|
|
|
0
|
my @libs; |
3595
|
0
|
|
|
|
|
0
|
if ($self->{XSMULTI}) { |
3596
|
0
|
|
|
|
|
0
|
for my $ext ($self->_xs_list_basenames) { |
3597
|
0
|
|
|
|
|
0
|
my ($v, $d, $f) = File::Spec->splitpath($ext); |
3598
|
0
|
0
|
|
|
|
0
|
my @d = File::Spec->splitdir($d); |
3599
|
0
|
|
|
|
|
0
|
shift @d if $d[0] eq 'lib'; |
3600
|
0
|
|
|
|
|
0
|
my $instdir = $self->catdir('$(INST_ARCHLIB)', 'auto', @d, $f); |
3601
|
0
|
|
|
|
|
0
|
my $instfile = $self->catfile($instdir, "$f\$(LIB_EXT)"); |
3602
|
0
|
|
|
|
|
0
|
my $objfile = "$ext\$(OBJ_EXT)"; |
3603
|
|
|
|
|
|
|
push @libs, [ $objfile, $instfile, $instdir ]; |
3604
|
|
|
|
|
|
|
} |
3605
|
0
|
|
|
|
|
0
|
} else { |
3606
|
|
|
|
|
|
|
@libs = ([ qw($(OBJECT) $(INST_STATIC) $(INST_ARCHAUTODIR)) ]); |
3607
|
0
|
|
|
|
|
0
|
} |
|
0
|
|
|
|
|
0
|
|
3608
|
0
|
|
|
|
|
0
|
push @m, map { $self->xs_make_static_lib(@$_); } @libs; |
3609
|
|
|
|
|
|
|
join "\n", @m; |
3610
|
|
|
|
|
|
|
} |
3611
|
|
|
|
|
|
|
|
3612
|
|
|
|
|
|
|
=item xs_make_static_lib |
3613
|
|
|
|
|
|
|
|
3614
|
|
|
|
|
|
|
Defines the recipes for the C<static_lib> section. |
3615
|
|
|
|
|
|
|
|
3616
|
|
|
|
|
|
|
=cut |
3617
|
|
|
|
|
|
|
|
3618
|
0
|
|
|
0
|
1
|
0
|
sub xs_make_static_lib { |
3619
|
0
|
|
|
|
|
0
|
my ($self, $from, $to, $todir) = @_; |
3620
|
0
|
|
|
|
|
0
|
my @m = sprintf '%s: %s $(MYEXTLIB) %s$(DFSEP).exists'."\n", $to, $from, $todir; |
3621
|
0
|
|
|
|
|
0
|
push @m, "\t\$(RM_F) \"\$\@\"\n"; |
3622
|
0
|
|
|
|
|
0
|
push @m, $self->static_lib_fixtures; |
3623
|
0
|
|
|
|
|
0
|
push @m, $self->static_lib_pure_cmd($from); |
3624
|
0
|
|
|
|
|
0
|
push @m, "\t\$(CHMOD) \$(PERM_RWX) \$\@\n"; |
3625
|
0
|
|
|
|
|
0
|
push @m, $self->static_lib_closures($todir); |
3626
|
|
|
|
|
|
|
join '', @m; |
3627
|
|
|
|
|
|
|
} |
3628
|
|
|
|
|
|
|
|
3629
|
|
|
|
|
|
|
=item static_lib_closures |
3630
|
|
|
|
|
|
|
|
3631
|
|
|
|
|
|
|
Records C<$(EXTRALIBS)> in F<extralibs.ld> and F<$(PERL_SRC)/ext.libs>. |
3632
|
|
|
|
|
|
|
|
3633
|
|
|
|
|
|
|
=cut |
3634
|
|
|
|
|
|
|
|
3635
|
0
|
|
|
0
|
1
|
0
|
sub static_lib_closures { |
3636
|
0
|
|
|
|
|
0
|
my ($self, $todir) = @_; |
3637
|
|
|
|
|
|
|
my @m = sprintf <<'MAKE_FRAG', $todir; |
3638
|
|
|
|
|
|
|
$(NOECHO) $(ECHO) "$(EXTRALIBS)" > %s$(DFSEP)extralibs.ld |
3639
|
|
|
|
|
|
|
MAKE_FRAG |
3640
|
0
|
0
|
0
|
|
|
0
|
# Old mechanism - still available: |
3641
|
|
|
|
|
|
|
push @m, <<'MAKE_FRAG' if $self->{PERL_SRC} && $self->{EXTRALIBS}; |
3642
|
|
|
|
|
|
|
$(NOECHO) $(ECHO) "$(EXTRALIBS)" >> $(PERL_SRC)$(DFSEP)ext.libs |
3643
|
0
|
|
|
|
|
0
|
MAKE_FRAG |
3644
|
|
|
|
|
|
|
@m; |
3645
|
|
|
|
|
|
|
} |
3646
|
|
|
|
|
|
|
|
3647
|
|
|
|
|
|
|
=item static_lib_fixtures |
3648
|
|
|
|
|
|
|
|
3649
|
|
|
|
|
|
|
Handles copying C<$(MYEXTLIB)> as starter for final static library that |
3650
|
|
|
|
|
|
|
then gets added to. |
3651
|
|
|
|
|
|
|
|
3652
|
|
|
|
|
|
|
=cut |
3653
|
|
|
|
|
|
|
|
3654
|
0
|
|
|
0
|
1
|
0
|
sub static_lib_fixtures { |
3655
|
|
|
|
|
|
|
my ($self) = @_; |
3656
|
|
|
|
|
|
|
# If this extension has its own library (eg SDBM_File) |
3657
|
0
|
0
|
|
|
|
0
|
# then copy that to $(INST_STATIC) and add $(OBJECT) into it. |
3658
|
0
|
|
|
|
|
0
|
return unless $self->{MYEXTLIB}; |
3659
|
|
|
|
|
|
|
"\t\$(CP) \$(MYEXTLIB) \"\$\@\"\n"; |
3660
|
|
|
|
|
|
|
} |
3661
|
|
|
|
|
|
|
|
3662
|
|
|
|
|
|
|
=item static_lib_pure_cmd |
3663
|
|
|
|
|
|
|
|
3664
|
|
|
|
|
|
|
Defines how to run the archive utility. |
3665
|
|
|
|
|
|
|
|
3666
|
|
|
|
|
|
|
=cut |
3667
|
|
|
|
|
|
|
|
3668
|
0
|
|
|
0
|
1
|
0
|
sub static_lib_pure_cmd { |
3669
|
0
|
|
|
|
|
0
|
my ($self, $from) = @_; |
3670
|
0
|
0
|
0
|
|
|
0
|
my $ar; |
3671
|
|
|
|
|
|
|
if (exists $self->{FULL_AR} && -x $self->{FULL_AR}) { |
3672
|
|
|
|
|
|
|
# Prefer the absolute pathed ar if available so that PATH |
3673
|
0
|
|
|
|
|
0
|
# doesn't confuse us. Perl itself is built with the full_ar. |
3674
|
|
|
|
|
|
|
$ar = 'FULL_AR'; |
3675
|
0
|
|
|
|
|
0
|
} else { |
3676
|
|
|
|
|
|
|
$ar = 'AR'; |
3677
|
0
|
|
|
|
|
0
|
} |
3678
|
|
|
|
|
|
|
sprintf <<'MAKE_FRAG', $ar, $from; |
3679
|
|
|
|
|
|
|
$(%s) $(AR_STATIC_ARGS) "$@" %s |
3680
|
|
|
|
|
|
|
$(RANLIB) "$@" |
3681
|
|
|
|
|
|
|
MAKE_FRAG |
3682
|
|
|
|
|
|
|
} |
3683
|
|
|
|
|
|
|
|
3684
|
|
|
|
|
|
|
=item staticmake (o) |
3685
|
|
|
|
|
|
|
|
3686
|
|
|
|
|
|
|
Calls makeaperl. |
3687
|
|
|
|
|
|
|
|
3688
|
|
|
|
|
|
|
=cut |
3689
|
|
|
|
|
|
|
|
3690
|
154
|
|
|
154
|
1
|
508
|
sub staticmake { |
3691
|
154
|
|
|
|
|
327
|
my($self, %attribs) = @_; |
3692
|
|
|
|
|
|
|
my(@static); |
3693
|
154
|
|
|
|
|
765
|
|
3694
|
|
|
|
|
|
|
my(@searchdirs)=($self->{PERL_ARCHLIB}, $self->{SITEARCHEXP}, $self->{INST_ARCHLIB}); |
3695
|
|
|
|
|
|
|
|
3696
|
|
|
|
|
|
|
# And as it's not yet built, we add the current extension |
3697
|
154
|
50
|
|
|
|
280
|
# but only if it has some C code (or XS code, which implies C code) |
|
154
|
|
|
|
|
518
|
|
3698
|
|
|
|
|
|
|
if (@{$self->{C}}) { |
3699
|
|
|
|
|
|
|
@static = $self->catfile($self->{INST_ARCHLIB}, |
3700
|
|
|
|
|
|
|
"auto", |
3701
|
0
|
|
|
|
|
0
|
$self->{FULLEXT}, |
3702
|
|
|
|
|
|
|
"$self->{BASEEXT}$self->{LIB_EXT}" |
3703
|
|
|
|
|
|
|
); |
3704
|
|
|
|
|
|
|
} |
3705
|
|
|
|
|
|
|
|
3706
|
|
|
|
|
|
|
# Either we determine now, which libraries we will produce in the |
3707
|
|
|
|
|
|
|
# subdirectories or we do it at runtime of the make. |
3708
|
|
|
|
|
|
|
|
3709
|
|
|
|
|
|
|
# We could ask all subdir objects, but I cannot imagine, why it |
3710
|
|
|
|
|
|
|
# would be necessary. |
3711
|
|
|
|
|
|
|
|
3712
|
|
|
|
|
|
|
# Instead we determine all libraries for the new perl at |
3713
|
154
|
|
|
|
|
652
|
# runtime. |
3714
|
|
|
|
|
|
|
my(@perlinc) = ($self->{INST_ARCHLIB}, $self->{INST_LIB}, $self->{PERL_ARCHLIB}, $self->{PERL_LIB}); |
3715
|
|
|
|
|
|
|
|
3716
|
|
|
|
|
|
|
$self->makeaperl(MAKE => $self->{MAKEFILE}, |
3717
|
|
|
|
|
|
|
DIRS => \@searchdirs, |
3718
|
|
|
|
|
|
|
STAT => \@static, |
3719
|
|
|
|
|
|
|
INCL => \@perlinc, |
3720
|
|
|
|
|
|
|
TARGET => $self->{MAP_TARGET}, |
3721
|
|
|
|
|
|
|
TMP => "", |
3722
|
154
|
|
|
|
|
2004
|
LIBPERL => $self->{LIBPERL_A} |
3723
|
|
|
|
|
|
|
); |
3724
|
|
|
|
|
|
|
} |
3725
|
|
|
|
|
|
|
|
3726
|
|
|
|
|
|
|
=item subdir_x (o) |
3727
|
|
|
|
|
|
|
|
3728
|
|
|
|
|
|
|
Helper subroutine for subdirs |
3729
|
|
|
|
|
|
|
|
3730
|
|
|
|
|
|
|
=cut |
3731
|
|
|
|
|
|
|
|
3732
|
56
|
|
|
56
|
1
|
393
|
sub subdir_x { |
3733
|
|
|
|
|
|
|
my($self, $subdir) = @_; |
3734
|
56
|
|
|
|
|
469
|
|
3735
|
|
|
|
|
|
|
my $subdir_cmd = $self->cd($subdir, |
3736
|
|
|
|
|
|
|
'$(MAKE) $(USEMAKEFILE) $(FIRST_MAKEFILE) all $(PASTHRU)' |
3737
|
56
|
|
|
|
|
462
|
); |
3738
|
|
|
|
|
|
|
return sprintf <<'EOT', $subdir_cmd; |
3739
|
|
|
|
|
|
|
|
3740
|
|
|
|
|
|
|
subdirs :: |
3741
|
|
|
|
|
|
|
$(NOECHO) %s |
3742
|
|
|
|
|
|
|
EOT |
3743
|
|
|
|
|
|
|
|
3744
|
|
|
|
|
|
|
} |
3745
|
|
|
|
|
|
|
|
3746
|
|
|
|
|
|
|
=item subdirs (o) |
3747
|
|
|
|
|
|
|
|
3748
|
|
|
|
|
|
|
Defines targets to process subdirectories. |
3749
|
|
|
|
|
|
|
|
3750
|
|
|
|
|
|
|
=cut |
3751
|
|
|
|
|
|
|
|
3752
|
|
|
|
|
|
|
sub subdirs { |
3753
|
154
|
|
|
154
|
1
|
403
|
# --- Sub-directory Sections --- |
3754
|
154
|
|
|
|
|
263
|
my($self) = shift; |
3755
|
|
|
|
|
|
|
my(@m); |
3756
|
|
|
|
|
|
|
# This method provides a mechanism to automatically deal with |
3757
|
|
|
|
|
|
|
# subdirectories containing further Makefile.PL scripts. |
3758
|
154
|
|
|
|
|
299
|
# It calls the subdir_x() method for each subdirectory. |
|
154
|
|
|
|
|
877
|
|
3759
|
56
|
|
|
|
|
584
|
foreach my $dir (@{$self->{DIR}}){ |
3760
|
|
|
|
|
|
|
push @m, $self->subdir_x($dir); |
3761
|
|
|
|
|
|
|
#### print "Including $dir subdirectory\n"; |
3762
|
154
|
100
|
|
|
|
653
|
} |
3763
|
56
|
|
|
|
|
223
|
if (@m){ |
3764
|
|
|
|
|
|
|
unshift @m, <<'EOF'; |
3765
|
|
|
|
|
|
|
|
3766
|
|
|
|
|
|
|
# The default clean, realclean and test targets in this Makefile |
3767
|
|
|
|
|
|
|
# have automatically been given entries for each subdir. |
3768
|
|
|
|
|
|
|
|
3769
|
|
|
|
|
|
|
EOF |
3770
|
98
|
|
|
|
|
669
|
} else { |
3771
|
|
|
|
|
|
|
push(@m, "\n# none") |
3772
|
154
|
|
|
|
|
1163
|
} |
3773
|
|
|
|
|
|
|
join('',@m); |
3774
|
|
|
|
|
|
|
} |
3775
|
|
|
|
|
|
|
|
3776
|
|
|
|
|
|
|
=item test (o) |
3777
|
|
|
|
|
|
|
|
3778
|
|
|
|
|
|
|
Defines the test targets. |
3779
|
|
|
|
|
|
|
|
3780
|
|
|
|
|
|
|
=cut |
3781
|
|
|
|
|
|
|
|
3782
|
154
|
|
|
154
|
1
|
535
|
sub test { |
3783
|
154
|
|
50
|
|
|
1249
|
my($self, %attribs) = @_; |
3784
|
154
|
50
|
66
|
|
|
5968
|
my $tests = $attribs{TESTS} || ''; |
|
|
100
|
66
|
|
|
|
|
|
|
|
66
|
|
|
|
|
3785
|
0
|
|
|
|
|
0
|
if (!$tests && -d 't' && defined $attribs{RECURSIVE_TEST_FILES}) { |
3786
|
|
|
|
|
|
|
$tests = $self->find_tests_recursive; |
3787
|
|
|
|
|
|
|
} |
3788
|
113
|
|
|
|
|
1203
|
elsif (!$tests && -d 't') { |
3789
|
|
|
|
|
|
|
$tests = $self->find_tests; |
3790
|
|
|
|
|
|
|
} |
3791
|
154
|
50
|
|
|
|
899
|
# have to do this because nmake is broken |
3792
|
|
|
|
|
|
|
$tests =~ s!/!\\!g if $self->is_make_type('nmake'); |
3793
|
154
|
|
|
|
|
610
|
# note: 'test.pl' name is also hardcoded in init_dirscan() |
3794
|
154
|
50
|
|
|
|
1118
|
my @m; |
3795
|
154
|
|
|
|
|
1345
|
my $default_testtype = $Config{usedl} ? 'dynamic' : 'static'; |
3796
|
|
|
|
|
|
|
push @m, <<EOF; |
3797
|
|
|
|
|
|
|
TEST_VERBOSE=0 |
3798
|
|
|
|
|
|
|
TEST_TYPE=test_\$(LINKTYPE) |
3799
|
|
|
|
|
|
|
TEST_FILE = test.pl |
3800
|
|
|
|
|
|
|
TEST_FILES = $tests |
3801
|
|
|
|
|
|
|
TESTDB_SW = -d |
3802
|
|
|
|
|
|
|
|
3803
|
|
|
|
|
|
|
testdb :: testdb_\$(LINKTYPE) |
3804
|
|
|
|
|
|
|
\$(NOECHO) \$(NOOP) |
3805
|
|
|
|
|
|
|
|
3806
|
|
|
|
|
|
|
test :: \$(TEST_TYPE) |
3807
|
|
|
|
|
|
|
\$(NOECHO) \$(NOOP) |
3808
|
|
|
|
|
|
|
|
3809
|
|
|
|
|
|
|
# Occasionally we may face this degenerate target: |
3810
|
|
|
|
|
|
|
test_ : test_$default_testtype |
3811
|
|
|
|
|
|
|
\$(NOECHO) \$(NOOP) |
3812
|
|
|
|
|
|
|
|
3813
|
|
|
|
|
|
|
EOF |
3814
|
154
|
|
|
|
|
773
|
|
3815
|
308
|
|
|
|
|
1913
|
for my $linktype (qw(dynamic static)) { |
3816
|
308
|
|
|
|
|
1293
|
my $directdeps = join ' ', grep !$self->{SKIPHASH}{$_}, $linktype, "pure_all"; # no depend on a linktype if SKIPped |
3817
|
308
|
|
|
|
|
603
|
push @m, "subdirs-test_$linktype :: $directdeps\n"; |
|
308
|
|
|
|
|
912
|
|
3818
|
112
|
|
|
|
|
466
|
foreach my $dir (@{ $self->{DIR} }) { |
3819
|
112
|
|
|
|
|
509
|
my $test = $self->cd($dir, "\$(MAKE) test_$linktype \$(PASTHRU)"); |
3820
|
|
|
|
|
|
|
push @m, "\t\$(NOECHO) $test\n"; |
3821
|
308
|
|
|
|
|
863
|
} |
3822
|
308
|
100
|
66
|
|
|
2292
|
push @m, "\n"; |
3823
|
226
|
|
|
|
|
891
|
if ($tests or -f "test.pl") { |
3824
|
452
|
|
|
|
|
1000
|
for my $testspec ([ '', '' ], [ 'db', ' $(TESTDB_SW)' ]) { |
3825
|
452
|
|
|
|
|
759
|
my ($db, $switch) = @$testspec; |
3826
|
|
|
|
|
|
|
my ($command, $deps); |
3827
|
452
|
100
|
|
|
|
1269
|
# if testdb, build all but don't test all |
3828
|
452
|
50
|
66
|
|
|
1959
|
$deps = $db eq 'db' ? $directdeps : "subdirs-test_$linktype"; |
3829
|
0
|
|
|
|
|
0
|
if ($linktype eq 'static' and $self->needs_linking) { |
3830
|
0
|
|
|
|
|
0
|
my $target = File::Spec->rel2abs('$(MAP_TARGET)'); |
3831
|
0
|
|
|
|
|
0
|
$command = qq{"$target" \$(MAP_PERLINC)}; |
3832
|
|
|
|
|
|
|
$deps .= ' $(MAP_TARGET)'; |
3833
|
452
|
|
|
|
|
955
|
} else { |
3834
|
|
|
|
|
|
|
$command = '$(FULLPERLRUN)' . $switch; |
3835
|
452
|
|
|
|
|
1452
|
} |
3836
|
452
|
100
|
|
|
|
1058
|
push @m, "test${db}_$linktype :: $deps\n"; |
3837
|
226
|
|
|
|
|
1137
|
if ($db eq 'db') { |
3838
|
|
|
|
|
|
|
push @m, $self->test_via_script($command, '$(TEST_FILE)') |
3839
|
226
|
100
|
|
|
|
3516
|
} else { |
3840
|
|
|
|
|
|
|
push @m, $self->test_via_script($command, '$(TEST_FILE)') |
3841
|
226
|
50
|
|
|
|
1746
|
if -f "test.pl"; |
3842
|
|
|
|
|
|
|
push @m, $self->test_via_harness($command, '$(TEST_FILES)') |
3843
|
|
|
|
|
|
|
if $tests; |
3844
|
452
|
|
|
|
|
1484
|
} |
3845
|
|
|
|
|
|
|
push @m, "\n"; |
3846
|
|
|
|
|
|
|
} |
3847
|
82
|
|
|
|
|
765
|
} else { |
3848
|
|
|
|
|
|
|
push @m, _sprintf562 <<'EOF', $linktype; |
3849
|
|
|
|
|
|
|
testdb_%1$s test_%1$s :: subdirs-test_%1$s |
3850
|
|
|
|
|
|
|
$(NOECHO) $(ECHO) 'No tests defined for $(NAME) extension.' |
3851
|
|
|
|
|
|
|
|
3852
|
|
|
|
|
|
|
EOF |
3853
|
|
|
|
|
|
|
} |
3854
|
|
|
|
|
|
|
} |
3855
|
154
|
|
|
|
|
1985
|
|
3856
|
|
|
|
|
|
|
join "", @m; |
3857
|
|
|
|
|
|
|
} |
3858
|
|
|
|
|
|
|
|
3859
|
|
|
|
|
|
|
=item test_via_harness (override) |
3860
|
|
|
|
|
|
|
|
3861
|
|
|
|
|
|
|
For some reason which I forget, Unix machines like to have |
3862
|
|
|
|
|
|
|
PERL_DL_NONLAZY set for tests. |
3863
|
|
|
|
|
|
|
|
3864
|
|
|
|
|
|
|
=cut |
3865
|
|
|
|
|
|
|
|
3866
|
226
|
|
|
226
|
1
|
925
|
sub test_via_harness { |
3867
|
226
|
|
|
|
|
1363
|
my($self, $perl, $tests) = @_; |
3868
|
|
|
|
|
|
|
return $self->SUPER::test_via_harness("PERL_DL_NONLAZY=1 $perl", $tests); |
3869
|
|
|
|
|
|
|
} |
3870
|
|
|
|
|
|
|
|
3871
|
|
|
|
|
|
|
=item test_via_script (override) |
3872
|
|
|
|
|
|
|
|
3873
|
|
|
|
|
|
|
Again, the PERL_DL_NONLAZY thing. |
3874
|
|
|
|
|
|
|
|
3875
|
|
|
|
|
|
|
=cut |
3876
|
|
|
|
|
|
|
|
3877
|
338
|
|
|
338
|
1
|
1069
|
sub test_via_script { |
3878
|
338
|
|
|
|
|
1522
|
my($self, $perl, $script) = @_; |
3879
|
|
|
|
|
|
|
return $self->SUPER::test_via_script("PERL_DL_NONLAZY=1 $perl", $script); |
3880
|
|
|
|
|
|
|
} |
3881
|
|
|
|
|
|
|
|
3882
|
|
|
|
|
|
|
|
3883
|
|
|
|
|
|
|
=item tool_xsubpp (o) |
3884
|
|
|
|
|
|
|
|
3885
|
|
|
|
|
|
|
Determines typemaps, xsubpp version, prototype behaviour. |
3886
|
|
|
|
|
|
|
|
3887
|
|
|
|
|
|
|
=cut |
3888
|
|
|
|
|
|
|
|
3889
|
154
|
|
|
154
|
1
|
516
|
sub tool_xsubpp { |
3890
|
154
|
50
|
|
|
|
1687
|
my($self) = shift; |
3891
|
|
|
|
|
|
|
return "" unless $self->needs_linking; |
3892
|
0
|
|
|
|
|
0
|
|
3893
|
0
|
|
|
|
|
0
|
my $xsdir; |
3894
|
|
|
|
|
|
|
my @xsubpp_dirs = @INC; |
3895
|
|
|
|
|
|
|
|
3896
|
0
|
0
|
|
|
|
0
|
# Make sure we pick up the new xsubpp if we're building perl. |
3897
|
|
|
|
|
|
|
unshift @xsubpp_dirs, $self->{PERL_LIB} if $self->{PERL_CORE}; |
3898
|
0
|
|
|
|
|
0
|
|
3899
|
0
|
|
|
|
|
0
|
my $foundxsubpp = 0; |
3900
|
0
|
|
|
|
|
0
|
foreach my $dir (@xsubpp_dirs) { |
3901
|
0
|
0
|
|
|
|
0
|
$xsdir = $self->catdir($dir, 'ExtUtils'); |
3902
|
0
|
|
|
|
|
0
|
if( -r $self->catfile($xsdir, "xsubpp") ) { |
3903
|
0
|
|
|
|
|
0
|
$foundxsubpp = 1; |
3904
|
|
|
|
|
|
|
last; |
3905
|
|
|
|
|
|
|
} |
3906
|
0
|
0
|
|
|
|
0
|
} |
3907
|
|
|
|
|
|
|
die "ExtUtils::MM_Unix::tool_xsubpp : Can't find xsubpp" if !$foundxsubpp; |
3908
|
0
|
|
|
|
|
0
|
|
3909
|
0
|
|
|
|
|
0
|
my $tmdir = $self->catdir($self->{PERL_LIB},"ExtUtils"); |
3910
|
0
|
0
|
|
|
|
0
|
my(@tmdeps) = $self->catfile($tmdir,'typemap'); |
3911
|
0
|
|
|
|
|
0
|
if( $self->{TYPEMAPS} ){ |
|
0
|
|
|
|
|
0
|
|
3912
|
0
|
0
|
|
|
|
0
|
foreach my $typemap (@{$self->{TYPEMAPS}}){ |
3913
|
0
|
|
|
|
|
0
|
if( ! -f $typemap ) { |
3914
|
|
|
|
|
|
|
warn "Typemap $typemap not found.\n"; |
3915
|
|
|
|
|
|
|
} |
3916
|
0
|
0
|
|
|
|
0
|
else { |
3917
|
0
|
|
|
|
|
0
|
$typemap = vmsify($typemap) if $Is{VMS}; |
3918
|
|
|
|
|
|
|
push(@tmdeps, $typemap); |
3919
|
|
|
|
|
|
|
} |
3920
|
|
|
|
|
|
|
} |
3921
|
0
|
0
|
|
|
|
0
|
} |
3922
|
|
|
|
|
|
|
push(@tmdeps, "typemap") if -f "typemap"; |
3923
|
|
|
|
|
|
|
# absolutised because with deep-located typemaps, eg "lib/XS/typemap", |
3924
|
|
|
|
|
|
|
# if xsubpp is called from top level with |
3925
|
|
|
|
|
|
|
# $(XSUBPP) ... -typemap "lib/XS/typemap" "lib/XS/Test.xs" |
3926
|
|
|
|
|
|
|
# it says: |
3927
|
|
|
|
|
|
|
# Can't find lib/XS/type map in (fulldir)/lib/XS |
3928
|
|
|
|
|
|
|
# because ExtUtils::ParseXS::process_file chdir's to .xs file's |
3929
|
|
|
|
|
|
|
# location. This is the only way to get all specified typemaps used, |
3930
|
0
|
|
|
|
|
0
|
# wherever located. |
|
0
|
|
|
|
|
0
|
|
3931
|
0
|
|
|
|
|
0
|
my @tmargs = map { '-typemap '.$self->quote_literal(File::Spec->rel2abs($_)) } @tmdeps; |
3932
|
0
|
0
|
|
|
|
0
|
$_ = $self->quote_dep($_) for @tmdeps; |
3933
|
0
|
|
|
|
|
0
|
if( exists $self->{XSOPT} ){ |
3934
|
|
|
|
|
|
|
unshift( @tmargs, $self->{XSOPT} ); |
3935
|
|
|
|
|
|
|
} |
3936
|
0
|
0
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
3937
|
|
|
|
|
|
|
if ($Is{VMS} && |
3938
|
|
|
|
|
|
|
$Config{'ldflags'} && |
3939
|
|
|
|
|
|
|
$Config{'ldflags'} =~ m!/Debug!i && |
3940
|
|
|
|
|
|
|
(!exists($self->{XSOPT}) || $self->{XSOPT} !~ /linenumbers/) |
3941
|
|
|
|
|
|
|
) |
3942
|
0
|
|
|
|
|
0
|
{ |
3943
|
|
|
|
|
|
|
unshift(@tmargs,'-nolinenumbers'); |
3944
|
|
|
|
|
|
|
} |
3945
|
|
|
|
|
|
|
|
3946
|
0
|
0
|
|
|
|
0
|
|
3947
|
0
|
|
|
|
|
0
|
$self->{XSPROTOARG} = "" unless defined $self->{XSPROTOARG}; |
3948
|
|
|
|
|
|
|
my $xsdirdep = $self->quote_dep($xsdir); |
3949
|
|
|
|
|
|
|
# -dep for use when dependency not command |
3950
|
0
|
|
|
|
|
0
|
|
3951
|
|
|
|
|
|
|
return qq{ |
3952
|
|
|
|
|
|
|
XSUBPPDIR = $xsdir |
3953
|
|
|
|
|
|
|
XSUBPP = "\$(XSUBPPDIR)\$(DFSEP)xsubpp" |
3954
|
|
|
|
|
|
|
XSUBPPRUN = \$(PERLRUN) \$(XSUBPP) |
3955
|
|
|
|
|
|
|
XSPROTOARG = $self->{XSPROTOARG} |
3956
|
|
|
|
|
|
|
XSUBPPDEPS = @tmdeps $xsdirdep\$(DFSEP)xsubpp |
3957
|
|
|
|
|
|
|
XSUBPPARGS = @tmargs |
3958
|
|
|
|
|
|
|
XSUBPP_EXTRA_ARGS = |
3959
|
|
|
|
|
|
|
}; |
3960
|
|
|
|
|
|
|
} |
3961
|
|
|
|
|
|
|
|
3962
|
|
|
|
|
|
|
|
3963
|
|
|
|
|
|
|
=item all_target |
3964
|
|
|
|
|
|
|
|
3965
|
|
|
|
|
|
|
Build man pages, too |
3966
|
|
|
|
|
|
|
|
3967
|
|
|
|
|
|
|
=cut |
3968
|
|
|
|
|
|
|
|
3969
|
154
|
|
|
154
|
1
|
414
|
sub all_target { |
3970
|
|
|
|
|
|
|
my $self = shift; |
3971
|
154
|
|
|
|
|
996
|
|
3972
|
|
|
|
|
|
|
return <<'MAKE_EXT'; |
3973
|
|
|
|
|
|
|
all :: pure_all manifypods |
3974
|
|
|
|
|
|
|
$(NOECHO) $(NOOP) |
3975
|
|
|
|
|
|
|
MAKE_EXT |
3976
|
|
|
|
|
|
|
} |
3977
|
|
|
|
|
|
|
|
3978
|
|
|
|
|
|
|
=item top_targets (o) |
3979
|
|
|
|
|
|
|
|
3980
|
|
|
|
|
|
|
Defines the targets all, subdirs, config, and O_FILES |
3981
|
|
|
|
|
|
|
|
3982
|
|
|
|
|
|
|
=cut |
3983
|
|
|
|
|
|
|
|
3984
|
|
|
|
|
|
|
sub top_targets { |
3985
|
|
|
|
|
|
|
# --- Target Sections --- |
3986
|
154
|
|
|
154
|
1
|
456
|
|
3987
|
154
|
|
|
|
|
273
|
my($self) = shift; |
3988
|
|
|
|
|
|
|
my(@m); |
3989
|
154
|
50
|
|
|
|
1736
|
|
3990
|
|
|
|
|
|
|
push @m, $self->all_target, "\n" unless $self->{SKIPHASH}{'all'}; |
3991
|
154
|
|
|
|
|
582
|
|
3992
|
|
|
|
|
|
|
push @m, sprintf <<'EOF'; |
3993
|
|
|
|
|
|
|
pure_all :: config pm_to_blib subdirs linkext |
3994
|
|
|
|
|
|
|
$(NOECHO) $(NOOP) |
3995
|
|
|
|
|
|
|
|
3996
|
|
|
|
|
|
|
subdirs :: $(MYEXTLIB) |
3997
|
|
|
|
|
|
|
$(NOECHO) $(NOOP) |
3998
|
|
|
|
|
|
|
|
3999
|
|
|
|
|
|
|
config :: $(FIRST_MAKEFILE) blibdirs |
4000
|
|
|
|
|
|
|
$(NOECHO) $(NOOP) |
4001
|
|
|
|
|
|
|
EOF |
4002
|
|
|
|
|
|
|
|
4003
|
|
|
|
|
|
|
push @m, ' |
4004
|
154
|
50
|
33
|
|
|
286
|
$(O_FILES) : $(H_FILES) |
|
154
|
0
|
|
|
|
827
|
|
|
0
|
50
|
|
|
|
0
|
|
4005
|
|
|
|
|
|
|
' if @{$self->{O_FILES} || []} && @{$self->{H} || []}; |
4006
|
154
|
|
|
|
|
695
|
|
4007
|
|
|
|
|
|
|
push @m, q{ |
4008
|
|
|
|
|
|
|
help : |
4009
|
|
|
|
|
|
|
perldoc ExtUtils::MakeMaker |
4010
|
|
|
|
|
|
|
}; |
4011
|
154
|
|
|
|
|
1173
|
|
4012
|
|
|
|
|
|
|
join('',@m); |
4013
|
|
|
|
|
|
|
} |
4014
|
|
|
|
|
|
|
|
4015
|
|
|
|
|
|
|
=item writedoc |
4016
|
|
|
|
|
|
|
|
4017
|
|
|
|
|
|
|
Obsolete, deprecated method. Not used since Version 5.21. |
4018
|
|
|
|
|
|
|
|
4019
|
|
|
|
|
|
|
=cut |
4020
|
|
|
|
|
|
|
|
4021
|
|
|
|
|
|
|
sub writedoc { |
4022
|
0
|
|
|
0
|
1
|
0
|
# --- perllocal.pod section --- |
4023
|
0
|
|
0
|
|
|
0
|
my($self,$what,$name,@attribs)=@_; |
4024
|
0
|
|
|
|
|
0
|
my $time = gmtime($ENV{SOURCE_DATE_EPOCH} || time); |
4025
|
0
|
|
|
|
|
0
|
print "=head2 $time: $what C<$name>\n\n=over 4\n\n=item *\n\n"; |
4026
|
0
|
|
|
|
|
0
|
print join "\n\n=item *\n\n", map("C<$_>",@attribs); |
4027
|
|
|
|
|
|
|
print "\n\n=back\n\n"; |
4028
|
|
|
|
|
|
|
} |
4029
|
|
|
|
|
|
|
|
4030
|
|
|
|
|
|
|
=item xs_c (o) |
4031
|
|
|
|
|
|
|
|
4032
|
|
|
|
|
|
|
Defines the suffix rules to compile XS files to C. |
4033
|
|
|
|
|
|
|
|
4034
|
|
|
|
|
|
|
=cut |
4035
|
|
|
|
|
|
|
|
4036
|
154
|
|
|
154
|
1
|
502
|
sub xs_c { |
4037
|
154
|
50
|
|
|
|
477
|
my($self) = shift; |
4038
|
0
|
|
|
|
|
0
|
return '' unless $self->needs_linking(); |
4039
|
|
|
|
|
|
|
' |
4040
|
|
|
|
|
|
|
.xs.c: |
4041
|
|
|
|
|
|
|
$(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $(XSUBPP_EXTRA_ARGS) $*.xs > $*.xsc |
4042
|
|
|
|
|
|
|
$(MV) $*.xsc $*.c |
4043
|
|
|
|
|
|
|
'; |
4044
|
|
|
|
|
|
|
} |
4045
|
|
|
|
|
|
|
|
4046
|
|
|
|
|
|
|
=item xs_cpp (o) |
4047
|
|
|
|
|
|
|
|
4048
|
|
|
|
|
|
|
Defines the suffix rules to compile XS files to C++. |
4049
|
|
|
|
|
|
|
|
4050
|
|
|
|
|
|
|
=cut |
4051
|
|
|
|
|
|
|
|
4052
|
0
|
|
|
0
|
1
|
0
|
sub xs_cpp { |
4053
|
0
|
0
|
|
|
|
0
|
my($self) = shift; |
4054
|
0
|
|
|
|
|
0
|
return '' unless $self->needs_linking(); |
4055
|
|
|
|
|
|
|
' |
4056
|
|
|
|
|
|
|
.xs.cpp: |
4057
|
|
|
|
|
|
|
$(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.xsc |
4058
|
|
|
|
|
|
|
$(MV) $*.xsc $*.cpp |
4059
|
|
|
|
|
|
|
'; |
4060
|
|
|
|
|
|
|
} |
4061
|
|
|
|
|
|
|
|
4062
|
|
|
|
|
|
|
=item xs_o (o) |
4063
|
|
|
|
|
|
|
|
4064
|
|
|
|
|
|
|
Defines suffix rules to go from XS to object files directly. This was |
4065
|
|
|
|
|
|
|
originally only intended for broken make implementations, but is now |
4066
|
|
|
|
|
|
|
necessary for per-XS file under C<XSMULTI>, since each XS file might |
4067
|
|
|
|
|
|
|
have an individual C<$(VERSION)>. |
4068
|
|
|
|
|
|
|
|
4069
|
|
|
|
|
|
|
=cut |
4070
|
|
|
|
|
|
|
|
4071
|
154
|
|
|
154
|
1
|
530
|
sub xs_o { |
4072
|
154
|
50
|
|
|
|
488
|
my ($self) = @_; |
4073
|
0
|
0
|
|
|
|
0
|
return '' unless $self->needs_linking(); |
4074
|
0
|
|
|
|
|
0
|
my $m_o = $self->{XSMULTI} ? $self->xs_obj_opt('$*$(OBJ_EXT)') : ''; |
4075
|
0
|
0
|
|
|
|
0
|
my $dbgout = $self->dbgoutflag; |
4076
|
0
|
|
|
|
|
0
|
$dbgout = $dbgout ? "$dbgout " : ''; |
4077
|
|
|
|
|
|
|
my $frag = ''; |
4078
|
0
|
0
|
|
|
|
0
|
# dmake makes noise about ambiguous rule |
4079
|
|
|
|
|
|
|
$frag .= sprintf <<'EOF', $dbgout, $m_o unless $self->is_make_type('dmake'); |
4080
|
|
|
|
|
|
|
.xs$(OBJ_EXT) : |
4081
|
|
|
|
|
|
|
$(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.xsc |
4082
|
|
|
|
|
|
|
$(MV) $*.xsc $*.c |
4083
|
|
|
|
|
|
|
$(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) %s$*.c %s |
4084
|
0
|
0
|
|
|
|
0
|
EOF |
4085
|
0
|
|
|
|
|
0
|
if ($self->{XSMULTI}) { |
4086
|
0
|
|
|
|
|
0
|
for my $ext ($self->_xs_list_basenames) { |
4087
|
0
|
0
|
|
|
|
0
|
my $pmfile = "$ext.pm"; |
4088
|
0
|
|
|
|
|
0
|
croak "$ext.xs has no matching $pmfile: $!" unless -f $pmfile; |
4089
|
0
|
|
|
|
|
0
|
my $version = $self->parse_version($pmfile); |
4090
|
0
|
|
|
|
|
0
|
my $cccmd = $self->{CONST_CCCMD}; |
4091
|
0
|
|
|
|
|
0
|
$cccmd =~ s/^\s*CCCMD\s*=\s*//; |
4092
|
0
|
|
|
|
|
0
|
$cccmd =~ s/\$\(DEFINE_VERSION\)/-DVERSION=\\"$version\\"/; |
4093
|
0
|
|
|
|
|
0
|
$cccmd =~ s/\$\(XS_DEFINE_VERSION\)/-DXS_VERSION=\\"$version\\"/; |
4094
|
0
|
|
|
|
|
0
|
$self->_xsbuild_replace_macro($cccmd, 'xs', $ext, 'INC'); |
4095
|
0
|
|
|
|
|
0
|
my $define = '$(DEFINE)'; |
4096
|
|
|
|
|
|
|
$self->_xsbuild_replace_macro($define, 'xs', $ext, 'DEFINE'); |
4097
|
0
|
|
|
|
|
0
|
# 1 2 3 4 5 |
4098
|
|
|
|
|
|
|
$frag .= _sprintf562 <<'EOF', $ext, $cccmd, $m_o, $define, $dbgout; |
4099
|
|
|
|
|
|
|
|
4100
|
|
|
|
|
|
|
%1$s$(OBJ_EXT): %1$s.xs |
4101
|
|
|
|
|
|
|
$(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.xsc |
4102
|
|
|
|
|
|
|
$(MV) $*.xsc $*.c |
4103
|
|
|
|
|
|
|
%2$s $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) %4$s %5$s$*.c %3$s |
4104
|
|
|
|
|
|
|
EOF |
4105
|
|
|
|
|
|
|
} |
4106
|
0
|
0
|
|
|
|
0
|
} |
4107
|
0
|
|
|
|
|
0
|
$frag =~ s/"-I(\$\(PERL_INC\))"/-iwithsysroot "$1"/sg if $Is{ApplCor}; |
4108
|
|
|
|
|
|
|
$frag; |
4109
|
|
|
|
|
|
|
} |
4110
|
|
|
|
|
|
|
|
4111
|
|
|
|
|
|
|
# param gets modified |
4112
|
0
|
|
|
0
|
|
0
|
sub _xsbuild_replace_macro { |
4113
|
0
|
|
|
|
|
0
|
my ($self, undef, $xstype, $ext, $varname) = @_; |
4114
|
0
|
0
|
|
|
|
0
|
my $value = $self->_xsbuild_value($xstype, $ext, $varname); |
4115
|
0
|
|
|
|
|
0
|
return unless defined $value; |
4116
|
|
|
|
|
|
|
$_[1] =~ s/\$\($varname\)/$value/; |
4117
|
|
|
|
|
|
|
} |
4118
|
|
|
|
|
|
|
|
4119
|
0
|
|
|
0
|
|
0
|
sub _xsbuild_value { |
4120
|
|
|
|
|
|
|
my ($self, $xstype, $ext, $varname) = @_; |
4121
|
0
|
0
|
|
|
|
0
|
return $self->{XSBUILD}{$xstype}{$ext}{$varname} |
4122
|
|
|
|
|
|
|
if $self->{XSBUILD}{$xstype}{$ext}{$varname}; |
4123
|
0
|
0
|
|
|
|
0
|
return $self->{XSBUILD}{$xstype}{all}{$varname} |
4124
|
0
|
|
|
|
|
0
|
if $self->{XSBUILD}{$xstype}{all}{$varname}; |
4125
|
|
|
|
|
|
|
(); |
4126
|
|
|
|
|
|
|
} |
4127
|
|
|
|
|
|
|
|
4128
|
|
|
|
|
|
|
1; |
4129
|
|
|
|
|
|
|
|
4130
|
|
|
|
|
|
|
=back |
4131
|
|
|
|
|
|
|
|
4132
|
|
|
|
|
|
|
=head1 SEE ALSO |
4133
|
|
|
|
|
|
|
|
4134
|
|
|
|
|
|
|
L<ExtUtils::MakeMaker> |
4135
|
|
|
|
|
|
|
|
4136
|
|
|
|
|
|
|
=cut |
4137
|
|
|
|
|
|
|
|
4138
|
|
|
|
|
|
|
__END__ |