heinous bootstrapping code
[p5sagit/local-lib.git] / Makefile.PL
1 use strict;
2 use warnings;
3 use vars qw($bootstrapping);
4
5 BEGIN {
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');
21     my $r = $? >> 8;
22
23     # XXX - remove the force on EUMM once its test suite survive PERL_MM_OPT
24
25     if ($r) { # non-zero exit
26       system($^X, '-MCPAN', '-e', 'force("install","ExtUtils::MakeMaker");');
27     }
28
29   }
30 }
31
32 use inc::Module::Install;
33
34 name 'local-lib';
35 all_from 'lib/local/lib.pm';
36
37 include('CPAN');
38 include('CPAN::HandleConfig');
39 include('CPAN::Debug');
40 include('CPAN::Version');
41 include('CPAN::Tarzip');
42
43 requires 'ExtUtils::MakeMaker' => '6.31'; # version INSTALL_BASE was added
44 requires 'ExtUtils::CBuilder'; # this and ParseXS are needed for MB C_support
45 requires 'ExtUtils::ParseXS';
46 requires 'Module::Build' => '0.28'; # lib -> lib/perl5 change
47 requires 'CPAN' => '1.80'; # sudo support
48
49 if ($bootstrapping) {
50   auto_install_now;
51 } else {
52   auto_install;
53 }
54
55 WriteAll;