1#!./miniperl -w 2 3use strict; 4if (@ARGV) { 5 my $dir = shift; 6 chdir $dir or die "Can't chdir '$dir': $!"; 7 unshift @INC, 'lib'; 8} 9 10unshift @INC, ('dist/Cwd', 'dist/Cwd/lib'); 11require File::Spec::Functions; 12 13# To clarify, this isn't the entire suite of modules considered "toolchain" 14# It's not even all modules needed to build ext/ 15# It's just the source paths of the (minimum complete set of) modules in ext/ 16# needed to build the nonxs modules 17# After which, all nonxs modules are in lib, which was always sufficient to 18# allow miniperl to build everything else. 19# Term::ReadLine is not here for building but for allowing the debugger to 20# run under miniperl when nothing but miniperl will build :-(. 21 22my @toolchain = qw(cpan/AutoLoader/lib 23 dist/Carp/lib 24 dist/Cwd dist/Cwd/lib 25 dist/ExtUtils-Command/lib 26 dist/ExtUtils-Install/lib 27 cpan/ExtUtils-MakeMaker/lib 28 dist/ExtUtils-Manifest/lib 29 cpan/File-Path/lib 30 ext/re 31 dist/Term-ReadLine/lib 32 ); 33 34# Used only in ExtUtils::Liblist::Kid::_win32_ext() 35push @toolchain, 'cpan/Text-ParseWords/lib' if $^O eq 'MSWin32'; 36 37# lib must be last, as the the toolchain modules write themselves into it 38# as they build, and it's important that @INC order ensures that the partially 39# written files are always masked by the complete versions. 40 41my $inc = join ",\n ", 42 map { "q\0$_\0" } 43 (map {File::Spec::Functions::rel2abs($_)} @toolchain, 'lib'), '.'; 44 45# If any of the system's build tools are written in Perl, then this module 46# may well be loaded by a much older version than we are building. So keep it 47# as backwards compatible as is easy. 48print <<"EOT"; 49#!perl 50 51# We are miniperl, building extensions 52# Reset \@INC completely, adding the directories we need, and removing the 53# installed directories (which we don't need to read, and may confuse us) 54\@INC = ($inc); 55EOT 56