| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Module::Install::External; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Provides dependency declarations for external non-Perl things |
|
4
|
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
1504
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
28
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use Module::Install::Base (); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
19
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
4
|
use vars qw{$VERSION $ISCORE @ISA}; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
94
|
|
|
9
|
|
|
|
|
|
|
BEGIN { |
|
10
|
1
|
|
|
1
|
|
4
|
$VERSION = '1.21'; |
|
11
|
1
|
|
|
|
|
2
|
$ISCORE = 1; |
|
12
|
1
|
|
|
|
|
335
|
@ISA = qw{Module::Install::Base}; |
|
13
|
|
|
|
|
|
|
} |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub requires_xs { |
|
16
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# First check for the basic C compiler |
|
19
|
0
|
|
|
|
|
|
$self->requires_external_cc; |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# We need a C compiler that can build XS files |
|
22
|
0
|
0
|
|
|
|
|
unless ( $self->can_xs ) { |
|
23
|
0
|
|
|
|
|
|
print "Unresolvable missing external dependency.\n"; |
|
24
|
0
|
|
|
|
|
|
print "This package requires perl's header files.\n"; |
|
25
|
0
|
|
|
|
|
|
print STDERR "NA: Unable to build distribution on this platform.\n"; |
|
26
|
0
|
|
|
|
|
|
exit(0); |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
1; |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub requires_external_cc { |
|
33
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# We need a C compiler, use the can_cc method for this |
|
36
|
0
|
0
|
|
|
|
|
unless ( $self->can_cc ) { |
|
37
|
0
|
|
|
|
|
|
print "Unresolvable missing external dependency.\n"; |
|
38
|
0
|
|
|
|
|
|
print "This package requires a C compiler.\n"; |
|
39
|
0
|
|
|
|
|
|
print STDERR "NA: Unable to build distribution on this platform.\n"; |
|
40
|
0
|
|
|
|
|
|
exit(0); |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# Unlike some of the other modules, while we need to specify a |
|
44
|
|
|
|
|
|
|
# C compiler as a dep, it needs to be a build-time dependency. |
|
45
|
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
1; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub requires_external_bin { |
|
50
|
0
|
|
|
0
|
1
|
|
my ($self, $bin, $version) = @_; |
|
51
|
0
|
0
|
|
|
|
|
if ( $version ) { |
|
52
|
0
|
|
|
|
|
|
die "requires_external_bin does not support versions yet"; |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# Load the package containing can_run early, |
|
56
|
|
|
|
|
|
|
# to avoid breaking the message below. |
|
57
|
0
|
|
|
|
|
|
$self->load('can_run'); |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# Locate the bin |
|
60
|
0
|
|
|
|
|
|
print "Locating bin:$bin..."; |
|
61
|
0
|
|
|
|
|
|
my $found_bin = $self->can_run( $bin ); |
|
62
|
0
|
0
|
|
|
|
|
if ( $found_bin ) { |
|
63
|
0
|
|
|
|
|
|
print " found at $found_bin.\n"; |
|
64
|
|
|
|
|
|
|
} else { |
|
65
|
0
|
|
|
|
|
|
print " missing.\n"; |
|
66
|
0
|
|
|
|
|
|
print "Unresolvable missing external dependency.\n"; |
|
67
|
0
|
|
|
|
|
|
print "Please install '$bin' seperately and try again.\n"; |
|
68
|
0
|
|
|
|
|
|
print STDERR "NA: Unable to build distribution on this platform.\n"; |
|
69
|
0
|
|
|
|
|
|
exit(0); |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
# Once we have some way to specify external deps, do it here. |
|
73
|
|
|
|
|
|
|
# In the mean time, continue as normal. |
|
74
|
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
1; |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
__END__ |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=pod |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 NAME |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Module::Install::External - Specify dependencies on external non-Perl things |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
C<Module::Install::External> provides command that allow you to |
|
91
|
|
|
|
|
|
|
declaratively specify a dependency on a program or system that is not |
|
92
|
|
|
|
|
|
|
Perl. |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
The commands it provides are similar to those in L<Module::Install::Can>, |
|
95
|
|
|
|
|
|
|
except that they implement an explicit dependency, in addition to just |
|
96
|
|
|
|
|
|
|
working out if the particular thing is available. |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 COMMANDS |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head2 requires_xs |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
requires_xs; |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
The C<requires_xs> command explicitly specifies that a C compiler and the |
|
105
|
|
|
|
|
|
|
perl header files are required in order to build (at F<make>-time) the |
|
106
|
|
|
|
|
|
|
distribution (specifically XS files). |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
It does not take any params, and aborts the F<Makefile.PL> execution in a |
|
109
|
|
|
|
|
|
|
way that an automated installation or testing system will interpret as a |
|
110
|
|
|
|
|
|
|
C<NA> ("not applicable to this platform") result. |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
This may be changed to an alternative abort result at a later time. |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Returns true as a convenience. |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head2 requires_external_cc |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
requires_external_cc; |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
The C<requires_external_cc> command explicitly specifies that a C compiler |
|
121
|
|
|
|
|
|
|
is required in order to build (at F<make>-time) the distribution. |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
It does not take any params, and aborts the F<Makefile.PL> execution |
|
124
|
|
|
|
|
|
|
in a way that an automated installation or testing system will interpret |
|
125
|
|
|
|
|
|
|
as a C<NA> ("not applicable to this platform") result. |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
This may be changed to an alternative abort result at a later time. |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Returns true as a convenience. |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head2 requires_external_bin |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
requires_external_bin 'cvs'; |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
The C<requires_external_bin> command takes the name of a system command |
|
136
|
|
|
|
|
|
|
or program, similar to the C<can_run> command, except that |
|
137
|
|
|
|
|
|
|
C<requires_external_bin> checks in a way that is a declarative explicit |
|
138
|
|
|
|
|
|
|
dependency. |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
The takes a single param of the command/program name, and aborts the |
|
141
|
|
|
|
|
|
|
C<Makefile.PL> execution in a way that an automated installation or |
|
142
|
|
|
|
|
|
|
testing system will interpret as a C<NA> ("not applicable to this |
|
143
|
|
|
|
|
|
|
platform") result. |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Returns true as a convenience. |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head1 TO DO |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
Work out how to save the external dependency metadata, in agreement with |
|
150
|
|
|
|
|
|
|
the larger Perl community. |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Implement the agreed external dependency metadata solution. |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head1 AUTHORS |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
Adam Kennedy E<lt>adamk@cpan.orgE<gt> |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
L<Module::Install> |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
Copyright 2006 Adam Kennedy. |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
167
|
|
|
|
|
|
|
under the same terms as Perl itself. |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
See L<http://www.perl.com/perl/misc/Artistic.html> |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=cut |