6 chdir $dir or die "Can't chdir '$dir': $!";
10 unshift @INC, ('dist/Cwd', 'dist/Cwd/lib');
11 require File::Spec::Functions;
13 my $file = 'lib/buildcustomize.pl';
15 # To clarify, this isn't the entire suite of modules considered "toolchain"
16 # It's not even all modules needed to build ext/
17 # It's just the source paths of the (minimum complete set of) modules in ext/
18 # needed to build the nonxs modules
19 # After which, all nonxs modules are in lib, which was always sufficient to
20 # allow miniperl to build everything else.
21 # Term::ReadLine is not here for building but for allowing the debugger to
22 # run under miniperl when nothing but miniperl will build :-(.
24 my @toolchain = qw(cpan/AutoLoader/lib
27 dist/ExtUtils-Command/lib
28 dist/ExtUtils-Install/lib
29 cpan/ExtUtils-MakeMaker/lib
30 dist/ExtUtils-Manifest/lib
33 dist/Term-ReadLine/lib
36 # Used only in ExtUtils::Liblist::Kid::_win32_ext()
37 push @toolchain, 'cpan/Text-ParseWords/lib' if $^O eq 'MSWin32';
39 # lib must be last, as the toolchain modules write themselves into it
40 # as they build, and it's important that @INC order ensures that the partially
41 # written files are always masked by the complete versions.
43 my $inc = join ",\n ",
45 (map {File::Spec::Functions::rel2abs($_)} @toolchain, 'lib'), '.';
47 open my $fh, '>', $file
48 or die "Can't open $file: $!";
52 # If any of the system's build tools are written in Perl, then this module
53 # may well be loaded by a much older version than we are building. So keep it
54 # as backwards compatible as is easy.
55 print $fh <<"EOT" or $error = "Can't print to $file: $!";
58 # We are miniperl, building extensions
59 # Reset \@INC completely, adding the directories we need, and removing the
60 # installed directories (which we don't need to read, and may confuse us)
66 or warn "Can't unlink $file after error: $!";
70 $error = "Can't load generated $file: $@";
72 $error = "Can't close $file: $!";
76 # It's going very wrong, so try to remove the botched file.
79 or warn "Can't unlink $file after error: $!";
83 # cperl-indent-level: 4
84 # indent-tabs-mode: nil
87 # ex: set ts=8 sts=4 sw=4 et: