Swipe the MANIFEST.SKIP from Devel::REPL.
[p5sagit/local-lib.git] / Makefile.PL
CommitLineData
391107e5 1use strict;
2use warnings;
86f54d7f 3use vars qw($bootstrapping);
4
5BEGIN {
c2447f35 6 if (my ($x) = grep { /^--bootstrap(?:=.*)?$/ } @ARGV) {
7 @ARGV = grep { !/^--bootstrap(?:=.*)?$/ } @ARGV;
86f54d7f 8 $bootstrapping = 1;
c2447f35 9 $x =~ /^--bootstrap(?:=(.*))?$/;
86f54d7f 10 my @args = (defined $1 ? ($1) : ());
11
12 {
13 local @INC = @INC;
14 unshift(@INC, 'lib');
15 require local::lib;
16 }
17
18 local::lib->import(@args);
19
20 push(@ARGV,$ENV{PERL_MM_OPT});
4662123f 21 push(@ARGV, map { "-I$_" } split(':',$ENV{PERL5LIB}));
86f54d7f 22
23 system($^X, '-MExtUtils::MakeMaker 6.31', '-e1');
b57052ce 24 my $eumm = $? >> 8;
25
26 system($^X, '-MCPAN 1.80', '-e1');
27 my $cpan = $? >> 8;
28 my $cpan_command = '';
86f54d7f 29
715c31a0 30 system($^X, '-MCPAN', '-e',
279e9381 31 'my $done; require ExtUtils::MakeMaker;
32 my $orig = ExtUtils::MakeMaker->can("prompt");
33 *ExtUtils::MakeMaker::prompt = sub {
34 if (!$done && $_[0] =~ /manual configuration/) {
35 $done++;
36 return "no";
37 }
38 return $orig->(@_);
39 };
40 CPAN::Config->load;
41 unless ($done || -w $CPAN::Config->{keep_source_where}) {
715c31a0 42 my $save = $CPAN::Config->{urllist};
43 delete @{$CPAN::Config}{keys %$CPAN::Config};
44 $CPAN::Config->{urllist} = $save;
45 CPAN::Config->init;
46 }'
47 );
48
279e9381 49 $ENV{PERL_MM_USE_DEFAULT} = 1;
50
86f54d7f 51 # XXX - remove the force on EUMM once its test suite survive PERL_MM_OPT
52
b57052ce 53 if ($eumm) { # non-zero exit
54 $cpan_command .= 'force("install","ExtUtils::MakeMaker"); ';
55 }
56 if ($cpan) {
c2447f35 57 $cpan_command .= 'force("install","CPAN"); ';
b57052ce 58 }
59 if(length $cpan_command) {
60 system($^X, '-MCPAN', '-e', $cpan_command);
86f54d7f 61 }
715c31a0 62 if ($cpan) {
63 system($^X, '-MCPAN', '-e', 'CPAN::Config->load; CPAN::Config->commit;');
64 }
86f54d7f 65 }
66}
67
391107e5 68use inc::Module::Install;
69
70name 'local-lib';
71all_from 'lib/local/lib.pm';
72
73requires 'ExtUtils::MakeMaker' => '6.31'; # version INSTALL_BASE was added
86f54d7f 74requires 'ExtUtils::CBuilder'; # this and ParseXS are needed for MB C_support
75requires 'ExtUtils::ParseXS';
391107e5 76requires 'Module::Build' => '0.28'; # lib -> lib/perl5 change
86f54d7f 77requires 'CPAN' => '1.80'; # sudo support
78
10fcef9b 79# No, really. See
80# https://rt.cpan.org/Public/Bug/Display.html?id=23735
81# for why CPAN now sets the CPANPLUS env var.
82# trouble is this means we can't auto_install(_now) CPAN itself
83# without this beautiful hack
84
85my $no_cpanplus_env = !exists $ENV{PERL5_CPANPLUS_IS_RUNNING};
86require CPAN;
87delete $ENV{PERL5_CPANPLUS_IS_RUNNING} if $no_cpanplus_env;
88
86f54d7f 89if ($bootstrapping) {
90 auto_install_now;
91} else {
92 auto_install;
93}
391107e5 94
95WriteAll;