| 1 | package Module::Install::External; | ||||||||||
| 2 | |||||||||||
| 3 | # Provides dependency declarations for external non-Perl things | ||||||||||
| 4 | |||||||||||
| 5 | 46 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 46 | ▶ | use Module::Install::Base (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 46 | ▶ | use vars qw{$VERSION $ISCORE @ISA}; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 46 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 46 | $VERSION = '1.21'; | |||||||||
| 11 | 46 | $ISCORE = 1; | |||||||||
| 12 | 46 | @ISA = qw{Module::Install::Base}; | |||||||||
| 13 | } | ||||||||||
| 14 | |||||||||||
| 15 | 0 | ▶ | sub requires_xs { | ||||||||
|
Subroutine
requires_xs: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 16 | 0 | 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 | ▶ | unless ( $self->can_xs ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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 | 0 | ▶ | sub requires_external_cc { | ||||||||
|
Subroutine
requires_external_cc: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 33 | 0 | my $self = shift; | |||||||||
| 34 | |||||||||||
| 35 | # We need a C compiler, use the can_cc method for this | ||||||||||
| 36 | 0 | ▶ | unless ( $self->can_cc ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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 | 0 | ▶ | sub requires_external_bin { | ||||||||
|
Subroutine
requires_external_bin: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 50 | 0 | my ($self, $bin, $version) = @_; | |||||||||
| 51 | 0 | ▶ | if ( $version ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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 | ▶ | if ( $found_bin ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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 | 46 | 1; | |||||||||
| 79 | |||||||||||
| 80 | __END__ | ||||||||||