line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#line 1 |
2
|
|
|
|
|
|
|
package Module::Install::Makefile; |
3
|
1
|
|
|
1
|
|
6
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
38
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict 'vars'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
5
|
1
|
|
|
1
|
|
1575
|
use Module::Install::Base; |
|
1
|
|
|
|
|
110804
|
|
|
1
|
|
|
|
|
33
|
|
6
|
|
|
|
|
|
|
use ExtUtils::MakeMaker (); |
7
|
1
|
|
|
1
|
|
11
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
114
|
|
8
|
|
|
|
|
|
|
use vars qw{$VERSION $ISCORE @ISA}; |
9
|
1
|
|
|
1
|
|
3
|
BEGIN { |
10
|
1
|
|
|
|
|
1
|
$VERSION = '0.75'; |
11
|
1
|
|
|
|
|
1893
|
$ISCORE = 1; |
12
|
|
|
|
|
|
|
@ISA = qw{Module::Install::Base}; |
13
|
|
|
|
|
|
|
} |
14
|
0
|
|
|
0
|
0
|
0
|
|
15
|
|
|
|
|
|
|
sub Makefile { $_[0] } |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my %seen = (); |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
0
|
0
|
0
|
sub prompt { |
20
|
|
|
|
|
|
|
shift; |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
0
|
# Infinite loop protection |
23
|
0
|
0
|
|
|
|
0
|
my @c = caller(); |
24
|
0
|
|
|
|
|
0
|
if ( ++$seen{"$c[1]|$c[2]|$_[0]"} > 3 ) { |
25
|
|
|
|
|
|
|
die "Caught an potential prompt infinite loop ($c[1]|$c[2]|$_[0])"; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
0
|
0
|
0
|
|
|
0
|
# In automated testing, always use defaults |
29
|
0
|
|
|
|
|
0
|
if ( $ENV{AUTOMATED_TESTING} and ! $ENV{PERL_MM_USE_DEFAULT} ) { |
30
|
0
|
|
|
|
|
0
|
local $ENV{PERL_MM_USE_DEFAULT} = 1; |
31
|
|
|
|
|
|
|
goto &ExtUtils::MakeMaker::prompt; |
32
|
0
|
|
|
|
|
0
|
} else { |
33
|
|
|
|
|
|
|
goto &ExtUtils::MakeMaker::prompt; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
1
|
|
|
1
|
0
|
23
|
sub makemaker_args { |
38
|
1
|
|
50
|
|
|
92
|
my $self = shift; |
39
|
1
|
50
|
|
|
|
12
|
my $args = ($self->{makemaker_args} ||= {}); |
40
|
1
|
|
|
|
|
14
|
%$args = ( %$args, @_ ) if @_; |
41
|
|
|
|
|
|
|
$args; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# For mm args that take multiple space-seperated args, |
45
|
|
|
|
|
|
|
# append an argument to the current list. |
46
|
0
|
|
|
0
|
0
|
|
sub makemaker_append { |
47
|
0
|
|
|
|
|
|
my $self = sShift; |
48
|
0
|
|
|
|
|
|
my $name = shift; |
49
|
0
|
0
|
|
|
|
|
my $args = $self->makemaker_args; |
50
|
|
|
|
|
|
|
$args->{name} = defined $args->{$name} |
51
|
|
|
|
|
|
|
? join( ' ', $args->{name}, @_ ) |
52
|
|
|
|
|
|
|
: join( ' ', @_ ); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
0
|
0
|
|
sub build_subdirs { |
56
|
0
|
|
0
|
|
|
|
my $self = shift; |
57
|
0
|
|
|
|
|
|
my $subdirs = $self->makemaker_args->{DIR} ||= []; |
58
|
0
|
|
|
|
|
|
for my $subdir (@_) { |
59
|
|
|
|
|
|
|
push @$subdirs, $subdir; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
0
|
0
|
|
sub clean_files { |
64
|
0
|
|
0
|
|
|
|
my $self = shift; |
65
|
0
|
|
|
|
|
|
my $clean = $self->makemaker_args->{clean} ||= {}; |
66
|
|
|
|
|
|
|
%$clean = ( |
67
|
0
|
|
0
|
|
|
|
%$clean, |
68
|
|
|
|
|
|
|
FILES => join ' ', grep { length $_ } ($clean->{FILES} || (), @_), |
69
|
|
|
|
|
|
|
); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
0
|
0
|
|
sub realclean_files { |
73
|
0
|
|
0
|
|
|
|
my $self = shift; |
74
|
0
|
|
|
|
|
|
my $realclean = $self->makemaker_args->{realclean} ||= {}; |
75
|
|
|
|
|
|
|
%$realclean = ( |
76
|
0
|
|
0
|
|
|
|
%$realclean, |
77
|
|
|
|
|
|
|
FILES => join ' ', grep { length $_ } ($realclean->{FILES} || (), @_), |
78
|
|
|
|
|
|
|
); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
0
|
|
|
0
|
0
|
|
sub libs { |
82
|
0
|
0
|
|
|
|
|
my $self = shift; |
83
|
0
|
|
|
|
|
|
my $libs = ref $_[0] ? shift : [ shift ]; |
84
|
|
|
|
|
|
|
$self->makemaker_args( LIBS => $libs ); |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
0
|
|
|
0
|
0
|
|
sub inc { |
88
|
0
|
|
|
|
|
|
my $self = shift; |
89
|
|
|
|
|
|
|
$self->makemaker_args( INC => shift ); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
my %test_dir = (); |
93
|
|
|
|
|
|
|
|
94
|
0
|
0
|
0
|
0
|
|
|
sub _wanted_t { |
95
|
|
|
|
|
|
|
/\.t$/ and -f $_ and $test_dir{$File::Find::dir} = 1; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
0
|
|
|
0
|
0
|
|
sub tests_recursive { |
99
|
0
|
0
|
|
|
|
|
my $self = shift; |
100
|
0
|
|
|
|
|
|
if ( $self->tests ) { |
101
|
|
|
|
|
|
|
die "tests_recursive will not work if tests are already defined"; |
102
|
0
|
|
0
|
|
|
|
} |
103
|
0
|
0
|
|
|
|
|
my $dir = shift || 't'; |
104
|
0
|
|
|
|
|
|
unless ( -d $dir ) { |
105
|
|
|
|
|
|
|
die "tests_recursive dir '$dir' does not exist"; |
106
|
0
|
|
|
|
|
|
} |
107
|
0
|
|
|
|
|
|
%test_dir = (); |
108
|
0
|
|
|
|
|
|
require File::Find; |
109
|
0
|
|
|
|
|
|
File::Find::find( \&_wanted_t, $dir ); |
|
0
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
$self->tests( join ' ', map { "$_/*.t" } sort keys %test_dir ); |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
0
|
|
|
0
|
0
|
|
sub write { |
114
|
0
|
0
|
|
|
|
|
my $self = shift; |
115
|
|
|
|
|
|
|
die "&Makefile->write() takes no arguments\n" if @_; |
116
|
|
|
|
|
|
|
|
117
|
0
|
|
|
|
|
|
# Make sure we have a new enough |
118
|
0
|
|
|
|
|
|
require ExtUtils::MakeMaker; |
119
|
|
|
|
|
|
|
$self->configure_requires( 'ExtUtils::MakeMaker' => $ExtUtils::MakeMaker::VERSION ); |
120
|
|
|
|
|
|
|
|
121
|
0
|
|
|
|
|
|
# Generate the |
122
|
0
|
|
|
|
|
|
my $args = $self->makemaker_args; |
123
|
0
|
|
0
|
|
|
|
$args->{DISTNAME} = $self->name; |
124
|
0
|
|
|
|
|
|
$args->{NAME} = $self->module_name || $self->name; |
125
|
0
|
|
|
|
|
|
$args->{VERSION} = $self->version; |
126
|
0
|
0
|
|
|
|
|
$args->{NAME} =~ s/-/::/g; |
127
|
0
|
|
|
|
|
|
if ( $self->tests ) { |
128
|
|
|
|
|
|
|
$args->{test} = { TESTS => $self->tests }; |
129
|
0
|
0
|
|
|
|
|
} |
130
|
0
|
|
|
|
|
|
if ($] >= 5.005) { |
131
|
0
|
|
|
|
|
|
$args->{ABSTRACT} = $self->abstract; |
132
|
|
|
|
|
|
|
$args->{AUTHOR} = $self->author; |
133
|
0
|
0
|
|
|
|
|
} |
134
|
0
|
|
|
|
|
|
if ( eval($ExtUtils::MakeMaker::VERSION) >= 6.10 ) { |
135
|
|
|
|
|
|
|
$args->{NO_META} = 1; |
136
|
0
|
0
|
0
|
|
|
|
} |
137
|
0
|
|
|
|
|
|
if ( eval($ExtUtils::MakeMaker::VERSION) > 6.17 and $self->sign ) { |
138
|
|
|
|
|
|
|
$args->{SIGN} = 1; |
139
|
0
|
0
|
|
|
|
|
} |
140
|
0
|
|
|
|
|
|
unless ( $self->is_admin ) { |
141
|
|
|
|
|
|
|
delete $args->{SIGN}; |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
|
144
|
0
|
|
0
|
|
|
|
# merge both kinds of requires into prereq_pm |
145
|
0
|
|
|
|
|
|
my $prereq = ($args->{PREREQ_PM} ||= {}); |
146
|
0
|
|
|
|
|
|
%$prereq = ( %$prereq, |
147
|
0
|
|
|
|
|
|
map { @$_ } |
148
|
|
|
|
|
|
|
map { @$_ } |
149
|
|
|
|
|
|
|
grep $_, |
150
|
|
|
|
|
|
|
($self->configure_requires, $self->build_requires, $self->requires) |
151
|
|
|
|
|
|
|
); |
152
|
|
|
|
|
|
|
|
153
|
0
|
|
|
|
|
|
# Remove any reference to perl, PREREQ_PM doesn't support it |
154
|
|
|
|
|
|
|
delete $args->{PREREQ_PM}->{perl}; |
155
|
|
|
|
|
|
|
|
156
|
0
|
|
0
|
|
|
|
# merge both kinds of requires into prereq_pm |
157
|
0
|
0
|
|
|
|
|
my $subdirs = ($args->{DIR} ||= []); |
158
|
0
|
|
|
|
|
|
if ($self->bundles) { |
|
0
|
|
|
|
|
|
|
159
|
0
|
|
|
|
|
|
foreach my $bundle (@{ $self->bundles }) { |
160
|
0
|
0
|
|
|
|
|
my ($file, $dir) = @$bundle; |
161
|
0
|
|
|
|
|
|
push @$subdirs, $dir if -d $dir; |
162
|
|
|
|
|
|
|
delete $prereq->{$file}; |
163
|
|
|
|
|
|
|
} |
164
|
|
|
|
|
|
|
} |
165
|
0
|
0
|
|
|
|
|
|
166
|
0
|
0
|
|
|
|
|
if ( my $perl_version = $self->perl_version ) { |
167
|
|
|
|
|
|
|
eval "use $perl_version; 1" |
168
|
|
|
|
|
|
|
or die "ERROR: perl: Version $] is installed, " |
169
|
|
|
|
|
|
|
. "but we need version >= $perl_version"; |
170
|
|
|
|
|
|
|
} |
171
|
0
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
$args->{INSTALLDIRS} = $self->installdirs; |
173
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
my %args = map { ( $_ => $args->{$_} ) } grep {defined($args->{$_})} keys %$args; |
175
|
0
|
|
|
|
|
|
|
176
|
0
|
0
|
|
|
|
|
my $user_preop = delete $args{dist}->{PREOP}; |
177
|
0
|
|
|
|
|
|
if (my $preop = $self->admin->preop($user_preop)) { |
178
|
|
|
|
|
|
|
$args{dist} = $preop; |
179
|
|
|
|
|
|
|
} |
180
|
0
|
|
|
|
|
|
|
181
|
0
|
|
0
|
|
|
|
my $mm = ExtUtils::MakeMaker::WriteMakefile(%args); |
182
|
|
|
|
|
|
|
$self->fix_up_makefile($mm->{FIRST_MAKEFILE} || 'Makefile'); |
183
|
|
|
|
|
|
|
} |
184
|
|
|
|
|
|
|
|
185
|
0
|
|
|
0
|
0
|
|
sub fix_up_makefile { |
186
|
0
|
|
|
|
|
|
my $self = shift; |
187
|
0
|
|
0
|
|
|
|
my $makefile_name = shift; |
188
|
0
|
|
0
|
|
|
|
my $top_class = ref($self->_top) || ''; |
189
|
|
|
|
|
|
|
my $top_version = $self->_top->VERSION || ''; |
190
|
0
|
0
|
|
|
|
|
|
191
|
|
|
|
|
|
|
my $preamble = $self->preamble |
192
|
|
|
|
|
|
|
? "# Preamble by $top_class $top_version\n" |
193
|
|
|
|
|
|
|
. $self->preamble |
194
|
0
|
|
0
|
|
|
|
: ''; |
195
|
|
|
|
|
|
|
my $postamble = "# Postamble by $top_class $top_version\n" |
196
|
|
|
|
|
|
|
. ($self->postamble || ''); |
197
|
0
|
|
|
|
|
|
|
198
|
0
|
0
|
|
|
|
|
local *MAKEFILE; |
199
|
0
|
|
|
|
|
|
open MAKEFILE, "< $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!"; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
200
|
0
|
0
|
|
|
|
|
my $makefile = do { local $/; }; |
201
|
|
|
|
|
|
|
close MAKEFILE or die $!; |
202
|
0
|
|
|
|
|
|
|
203
|
0
|
|
|
|
|
|
$makefile =~ s/\b(test_harness\(\$\(TEST_VERBOSE\), )/$1'inc', /; |
204
|
0
|
|
|
|
|
|
$makefile =~ s/( -I\$\(INST_ARCHLIB\))/ -Iinc$1/g; |
205
|
0
|
|
|
|
|
|
$makefile =~ s/( "-I\$\(INST_LIB\)")/ "-Iinc"$1/g; |
206
|
0
|
|
|
|
|
|
$makefile =~ s/^(FULLPERL = .*)/$1 "-Iinc"/m; |
207
|
|
|
|
|
|
|
$makefile =~ s/^(PERL = .*)/$1 "-Iinc"/m; |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
# Module::Install will never be used to build the Core Perl |
210
|
|
|
|
|
|
|
# Sometimes PERL_LIB and PERL_ARCHLIB get written anyway, which breaks |
211
|
0
|
|
|
|
|
|
# PREFIX/PERL5LIB, and thus, install_share. Blank them if they exist |
212
|
|
|
|
|
|
|
$makefile =~ s/^PERL_LIB = .+/PERL_LIB =/m; |
213
|
|
|
|
|
|
|
#$makefile =~ s/^PERL_ARCHLIB = .+/PERL_ARCHLIB =/m; |
214
|
|
|
|
|
|
|
|
215
|
0
|
|
|
|
|
|
# Perl 5.005 mentions PERL_LIB explicitly, so we have to remove that as well. |
216
|
|
|
|
|
|
|
$makefile =~ s/(\"?)-I\$\(PERL_LIB\)\1//g; |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
# XXX - This is currently unused; not sure if it breaks other MM-users |
219
|
|
|
|
|
|
|
# $makefile =~ s/^pm_to_blib\s+:\s+/pm_to_blib :: /mg; |
220
|
0
|
0
|
|
|
|
|
|
221
|
0
|
0
|
|
|
|
|
open MAKEFILE, "> $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!"; |
222
|
0
|
0
|
|
|
|
|
print MAKEFILE "$preamble$makefile$postamble" or die $!; |
223
|
|
|
|
|
|
|
close MAKEFILE or die $!; |
224
|
0
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
1; |
226
|
|
|
|
|
|
|
} |
227
|
|
|
|
|
|
|
|
228
|
0
|
|
|
0
|
0
|
|
sub preamble { |
229
|
0
|
0
|
|
|
|
|
my ($self, $text) = @_; |
230
|
0
|
|
|
|
|
|
$self->{preamble} = $text . $self->{preamble} if defined $text; |
231
|
|
|
|
|
|
|
$self->{preamble}; |
232
|
|
|
|
|
|
|
} |
233
|
|
|
|
|
|
|
|
234
|
0
|
|
|
0
|
0
|
|
sub postamble { |
235
|
0
|
|
0
|
|
|
|
my ($self, $text) = @_; |
236
|
0
|
0
|
|
|
|
|
$self->{postamble} ||= $self->admin->postamble; |
237
|
0
|
|
|
|
|
|
$self->{postamble} .= $text if defined $text; |
238
|
|
|
|
|
|
|
$self->{postamble} |
239
|
|
|
|
|
|
|
} |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
1; |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
__END__ |