This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perlunicode: Narrow verabitm lines so don't wrap
[perl5.git] / write_buildcustomize.pl
1 #!./miniperl -w
2
3 use strict;
4 if (@ARGV) {
5     my $dir = shift;
6     chdir $dir or die "Can't chdir '$dir': $!";
7     unshift @INC, 'lib';
8 }
9
10 unshift @INC, ('dist/Cwd', 'dist/Cwd/lib');
11 require 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
20 my @toolchain = qw(cpan/AutoLoader/lib
21                    dist/Cwd dist/Cwd/lib
22                    dist/ExtUtils-Command/lib
23                    dist/ExtUtils-Install/lib
24                    cpan/ExtUtils-MakeMaker/lib
25                    dist/ExtUtils-Manifest/lib
26                    cpan/File-Path/lib
27                    ext/re
28                    );
29
30 # Used only in ExtUtils::Liblist::Kid::_win32_ext()
31 push @toolchain, 'cpan/Text-ParseWords/lib' if $^O eq 'MSWin32';
32
33 # lib must be last, as the the toolchain modules write themselves into it
34 # as they build, and it's important that @INC order ensures that the partially
35 # written files are always masked by the complete versions.
36
37 my $inc = join ",\n        ",
38     map { "q\0$_\0" }
39     (map {File::Spec::Functions::rel2abs($_)} @toolchain, 'lib'), '.';
40
41 # If any of the system's build tools are written in Perl, then this module
42 # may well be loaded by a much older version than we are building. So keep it
43 # as backwards compatible as is easy.
44 print <<"EOT";
45 #!perl
46
47 # We are miniperl, building extensions
48 # Reset \@INC completely, adding the directories we need, and removing the
49 # installed directories (which we don't need to read, and may confuse us)
50 \@INC = ($inc);
51 EOT