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 # Getopt::Long is here because it's used by podlators, which is one of the
27 # Term::ReadLine is not here for building but for allowing the debugger to
28 # run under miniperl when nothing but miniperl will build :-(.
29 # Text::ParseWords is required in ExtUtils::Liblist::Kid
36 cpan/ExtUtils-Install/lib
37 cpan/ExtUtils-MakeMaker/lib
38 cpan/ExtUtils-Manifest/lib
41 dist/Term-ReadLine/lib
48 cpan/Text-ParseWords/lib
49 cpan/ExtUtils-PL2Bat/lib
52 # These are for XS building on Win32, since nonxs and xs build simultaneously
53 # on Win32 if parallel building
55 dist/ExtUtils-ParseXS/lib
57 cpan/ExtUtils-Constant/lib
59 ) if $^O eq 'MSWin32';
60 push @toolchain, 'ext/VMS-Filespec/lib' if $^O eq 'VMS';
62 unshift @INC, @toolchain;
63 require File::Spec::Functions;
66 my $cwd = Cwd::getcwd();
69 or die "$0: Can't determine current working directory\n";
71 # lib must be last, as the toolchain modules write themselves into it
72 # as they build, and it's important that @INC order ensures that the partially
73 # written files are always masked by the complete versions.
75 my $inc = join ",\n ",
77 (map {File::Spec::Functions::rel2abs($_, $cwd)} (
78 # faster build on the non-parallel Win32 build process
79 $^O eq 'MSWin32' ? ('lib', @toolchain ) : (@toolchain, 'lib')
82 open my $fh, '>', $file
83 or die "Can't open $file: $!";
87 # If any of the system's build tools are written in Perl, then this module
88 # may well be loaded by a much older version than we are building. So keep it
89 # as backwards compatible as is easy.
90 print $fh <<"EOT" or $error = "Can't print to $file: $!";
93 # !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
94 # This file is generated by write_buildcustomize.pl.
95 # Any changes made here will be lost!
97 # We are miniperl, building extensions
98 # Replace the first entry of \@INC ("lib") with the list of
99 # directories we need.
100 splice(\@INC, 0, 1, $inc);
107 or warn "Can't unlink $file after error: $!";
111 $error = "Can't load generated $file: $@";
113 $error = "Can't close $file: $!";
117 # It's going very wrong, so try to remove the botched file.
120 or warn "Can't unlink $file after error: $!";
123 # ex: set ts=8 sts=4 sw=4 et: