diffs from apeiron
[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 $eumm = $? >> 8;
22
23     system($^X, '-MCPAN 1.80', '-e1');
24     my $cpan = $? >> 8;
25     my $cpan_command = '';
26
27     # XXX - remove the force on EUMM once its test suite survive PERL_MM_OPT
28
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);
37     }
38
39   }
40 }
41
42 use inc::Module::Install;
43
44 name 'local-lib';
45 all_from 'lib/local/lib.pm';
46
47 requires 'ExtUtils::MakeMaker' => '6.31'; # version INSTALL_BASE was added
48 requires 'ExtUtils::CBuilder'; # this and ParseXS are needed for MB C_support
49 requires 'ExtUtils::ParseXS';
50 requires 'Module::Build' => '0.28'; # lib -> lib/perl5 change
51 requires 'CPAN' => '1.80'; # sudo support
52
53 if ($bootstrapping) {
54   auto_install_now;
55 } else {
56   auto_install;
57 }
58
59 WriteAll;