6 my $file = 'lib/buildcustomize.pl';
10 chdir $dir or die "Can't chdir '$dir': $!";
15 # Used during cross-compilation.
19 # To clarify, this isn't the entire suite of modules considered "toolchain"
20 # It's not even all modules needed to build ext/
21 # It's just the source paths of the (minimum complete set of) modules in ext/
22 # needed to build the nonxs modules
23 # After which, all nonxs modules are in lib, which was always sufficient to
24 # allow miniperl to build everything else.
25 # Term::ReadLine is not here for building but for allowing the debugger to
26 # run under miniperl when nothing but miniperl will build :-(.
28 my @toolchain = qw(cpan/AutoLoader/lib
30 dist/PathTools dist/PathTools/lib
31 dist/ExtUtils-Command/lib
32 dist/ExtUtils-Install/lib
33 cpan/ExtUtils-MakeMaker/lib
34 dist/ExtUtils-Manifest/lib
37 dist/Term-ReadLine/lib
44 # Used only in ExtUtils::Liblist::Kid::_win32_ext()
45 push @toolchain, 'cpan/Text-ParseWords/lib' if $^O eq 'MSWin32';
46 push @toolchain, 'ext/VMS-Filespec/lib' if $^O eq 'VMS';
48 unshift @INC, @toolchain;
49 require File::Spec::Functions;
51 # lib must be last, as the toolchain modules write themselves into it
52 # as they build, and it's important that @INC order ensures that the partially
53 # written files are always masked by the complete versions.
55 my $inc = join ",\n ",
57 (map {File::Spec::Functions::rel2abs($_)} @toolchain, 'lib');
59 open my $fh, '>', $file
60 or die "Can't open $file: $!";
64 # If any of the system's build tools are written in Perl, then this module
65 # may well be loaded by a much older version than we are building. So keep it
66 # as backwards compatible as is easy.
67 print $fh <<"EOT" or $error = "Can't print to $file: $!";
70 # !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
71 # This file is generated by write_buildcustomize.pl.
72 # Any changes made here will be lost!
74 # We are miniperl, building extensions
75 # Replace the first entry of \@INC ("lib") with the list of
76 # directories we need.
77 splice(\@INC, 0, 1, $inc);
83 or warn "Can't unlink $file after error: $!";
87 $error = "Can't load generated $file: $@";
89 $error = "Can't close $file: $!";
93 # It's going very wrong, so try to remove the botched file.
96 or warn "Can't unlink $file after error: $!";
100 # cperl-indent-level: 4
101 # indent-tabs-mode: nil
104 # ex: set ts=8 sts=4 sw=4 et: