5 use vars qw($bootstrapping $bootstrapping_args);
10 # watch out for fancy dashes. these can wind up in our @ARGV if the user is
11 # copypasting the bootstrap command from the POD displayed e.g. by perldoc
12 # on a Mac OS X terminal. since no software recognizes and handles these
13 # dashes, it's better to die loudly telling the user exactly what happened
14 # so they don't make the same mistake again rather than being the only
15 # program in the universe that works with them.
16 if(grep { /−/ } @ARGV) {
18 WHOA THERE! It looks like you've got some fancy dashes in your commandline!
19 These are *not* the traditional -- dashes that software recognizes. You
20 probably got these by copy-pasting from the perldoc for this module as
21 rendered by a UTF8-capable formatter. This most typically happens on an OS X
22 terminal, but can happen elsewhere too. Please try again after replacing the
23 dashes with normal minus signs.
26 if (my ($x) = grep { /^--bootstrap(?:=.*)?$/ } @ARGV) {
27 @ARGV = grep { !/^--bootstrap(?:=.*)?$/ } @ARGV;
29 my ($path) = $x =~ /^--bootstrap(?:=(.*))?$/;
30 my @args = $path ? $path : ();
38 local::lib->import(@args);
40 my @libs = map { "-I$_" } split ':', $ENV{PERL5LIB};
41 $bootstrapping_args = "@libs";
42 push(@ARGV,$ENV{PERL_MM_OPT});
45 system($^X, '-MExtUtils::MakeMaker 6.31', '-e1');
48 system($^X, '-MCPAN 1.80', '-e1');
50 my $cpan_command = '';
52 system($^X, '-MCPAN', '-e',
53 'my $done; require ExtUtils::MakeMaker;
54 my $orig = ExtUtils::MakeMaker->can("prompt");
55 *ExtUtils::MakeMaker::prompt = sub {
56 if (!$done && $_[0] =~ /manual configuration/) {
63 unless ($done || -w $CPAN::Config->{keep_source_where}) {
64 my $save = $CPAN::Config->{urllist};
65 delete @{$CPAN::Config}{keys %$CPAN::Config};
66 $CPAN::Config->{urllist} = $save;
71 $ENV{PERL_MM_USE_DEFAULT} = 1;
73 # XXX - remove the force on EUMM once its test suite survive PERL_MM_OPT
75 if ($eumm) { # non-zero exit
76 $cpan_command .= 'force("install","ExtUtils::MakeMaker"); ';
79 $cpan_command .= 'force("install","CPAN"); ';
81 if(length $cpan_command) {
82 system($^X, '-MCPAN', '-e', $cpan_command);
85 system($^X, '-MCPAN', '-e', 'CPAN::Config->load; CPAN::Config->commit;');
92 use inc::Module::Install;
95 all_from 'lib/local/lib.pm';
97 requires 'ExtUtils::MakeMaker' => '6.31'; # version INSTALL_BASE was added
98 requires 'ExtUtils::CBuilder'; # this and ParseXS are needed for MB C_support
99 requires 'ExtUtils::ParseXS';
100 requires 'Module::Build' => '0.28'; # lib -> lib/perl5 change
101 requires 'CPAN' => '1.80'; # sudo support
104 # https://rt.cpan.org/Public/Bug/Display.html?id=23735
105 # for why CPAN now sets the CPANPLUS env var.
106 # trouble is this means we can't auto_install(_now) CPAN itself
107 # without this beautiful hack
109 my $no_cpanplus_env = !exists $ENV{PERL5_CPANPLUS_IS_RUNNING};
110 my $no_cpan_env = !exists $ENV{PERL5_CPAN_IS_RUNNING};
112 delete $ENV{PERL5_CPANPLUS_IS_RUNNING} if $no_cpanplus_env;
113 delete $ENV{PERL5_CPAN_IS_RUNNING} if $no_cpan_env;
115 # and make sure that the user doesn't have any existing CPAN config that'll
116 # cause us problems for the next few steps.
117 require CPAN::HandleConfig;
118 CPAN::HandleConfig->load;
119 for my $eumm_setting ( qw/makepl_arg make_install_arg/ ) {
120 if ($CPAN::Config->{$eumm_setting} =~ /(?:PREFIX|INSTALL_BASE)/) {
121 die "Possibly invalid config detected in $eumm_setting: " . $CPAN::Config->{$eumm_setting};
125 for my $mb_setting (qw/mbuild_arg mbuild_install_arg mbuildpl_arg/) {
126 if ($CPAN::Config->{$mb_setting} =~ /(?:--prefix|--install_base)/) {
127 die "Possibly invalid config detected in $mb_setting: " . $CPAN::Config->{$mb_setting};
131 if ($bootstrapping) {
134 PERL += $bootstrapping_args
135 FULLPERL += $bootstrapping_args