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