I can no longer stay anonymous; add a CONTRIBUTORS section with the bits for
[p5sagit/local-lib.git] / Makefile.PL
CommitLineData
391107e5 1use strict;
2use warnings;
86f54d7f 3use vars qw($bootstrapping);
4
5BEGIN {
6 if (grep { /^--bootstrap(?:=(.*))?$/ } @ARGV) {
7 $bootstrapping = 1;
8 my @args = (defined $1 ? ($1) : ());
9
10 {
11 local @INC = @INC;
12 unshift(@INC, 'lib');
13 require local::lib;
14 }
15
16 local::lib->import(@args);
17
18 push(@ARGV,$ENV{PERL_MM_OPT});
19
20 system($^X, '-MExtUtils::MakeMaker 6.31', '-e1');
b57052ce 21 my $eumm = $? >> 8;
22
23 system($^X, '-MCPAN 1.80', '-e1');
24 my $cpan = $? >> 8;
25 my $cpan_command = '';
86f54d7f 26
27 # XXX - remove the force on EUMM once its test suite survive PERL_MM_OPT
28
b57052ce 29 if ($eumm) { # non-zero exit
30 $cpan_command .= 'force("install","ExtUtils::MakeMaker"); ';
31 }
32 if ($cpan) {
33 $cpan_command .= 'install("CPAN"); ';
34 }
35 if(length $cpan_command) {
36 system($^X, '-MCPAN', '-e', $cpan_command);
86f54d7f 37 }
38
39 }
40}
41
391107e5 42use inc::Module::Install;
43
44name 'local-lib';
45all_from 'lib/local/lib.pm';
46
47requires 'ExtUtils::MakeMaker' => '6.31'; # version INSTALL_BASE was added
86f54d7f 48requires 'ExtUtils::CBuilder'; # this and ParseXS are needed for MB C_support
49requires 'ExtUtils::ParseXS';
391107e5 50requires 'Module::Build' => '0.28'; # lib -> lib/perl5 change
86f54d7f 51requires 'CPAN' => '1.80'; # sudo support
52
10fcef9b 53# No, really. See
54# https://rt.cpan.org/Public/Bug/Display.html?id=23735
55# for why CPAN now sets the CPANPLUS env var.
56# trouble is this means we can't auto_install(_now) CPAN itself
57# without this beautiful hack
58
59my $no_cpanplus_env = !exists $ENV{PERL5_CPANPLUS_IS_RUNNING};
60require CPAN;
61delete $ENV{PERL5_CPANPLUS_IS_RUNNING} if $no_cpanplus_env;
62
86f54d7f 63if ($bootstrapping) {
64 auto_install_now;
65} else {
66 auto_install;
67}
391107e5 68
69WriteAll;