Upstream-Status:Inappropriate [Backport] Rebased by Nitin A Kamble on 3/11/2011 commit 5e4c4c91bd52a48de59520d5e9b4e3478e49c613 Author: Nicholas Clark Date: Mon Feb 14 10:14:18 2011 +0000 Use a buildcustomize.pl to set @INC in miniperl when building extensions. With the build tools now shipped in various subdirectories of cpan/ and dist/ we need to add several paths to @INC when invoking MakeMaker (etc) to build extensions. The previous approach of using $ENV{PERL5LIB} was fragile, because: a: It was hitting the length limit for %ENV variables on VMS b: It was running the risk of race conditions in a parallel build - ExtUtils::Makemaker "knows" to add -I../..lib, which puts lib at the *front* of @INC, but if one parallel process happens to copy a module into lib/ whilst another is searching for it, the second may get a partial read c: Overwriting $ENV{PERL5LIB} breaks any system where any of the installed build tools are actually implemented in Perl, if they are relying on $ENV{PERL5LIB} for setup This approach a: Doesn't have %ENV length limits b: Ensures that lib/ is last, so copy targets are always shadowing copy sources c: Only affects miniperl, and doesn't touch $ENV{PERL5LIB} Approaches that turned out to have fatal flaws: 1: Using $ENV{PERL5OPT} with a module fails because ExtUtils::MakeMaker searches for the build perl without setting lib, and treats the error caused by a failed -M as "not a valid perl 5 binary" 2: Refactoring ExtUtils::MakeMaker to *not* use -I for lib, and instead rely on $ENV{PERL5LIB} [which includes "../../lib"] fails because: some extensions have subdirectories, and on these EU::MM correctly uses -I../../../lib, where as $ENV{PERL5LIB} only has space for relative paths, and only with two levels. This approach actually takes advantage of ExtUtils::MakeMaker setting an -I option correct for the depth of directory being built. Index: perl-5.12.3/Cross/Makefile-cross-SH =================================================================== --- perl-5.12.3.orig/Cross/Makefile-cross-SH +++ perl-5.12.3/Cross/Makefile-cross-SH @@ -324,7 +324,7 @@ $spitshell >>$Makefile <<'!NO!SUBS!' CONFIGPM = xlib/$(CROSS_NAME)/Config.pm -private = preplibrary $(CONFIGPM) $(CROSS_LIB)/Config.pod +private = preplibrary $(CONFIGPM) $(CROSS_LIB)/Config.pod lib/buildcustomize.pl shextract = Makefile cflags config.h makeaperl makedepend \ makedir myconfig writemain pod/Makefile @@ -752,6 +752,9 @@ lib/lib.pm: miniperl $(CONFIGPM) @-rm -f $@ $(LDLIBPTH) ./miniperl -Ilib -MCross lib/lib_pm.PL +lib/buildcustomize.pl: $(MINIPERL_EXE) write_buildcustomize.pl + $(MINIPERL) write_buildcustomize.pl >lib/buildcustomize.pl + unidatafiles $(unidatafiles): uni.data uni.data: miniperl$(EXE_EXT) $(CONFIGPM) lib/unicore/mktables @@ -922,16 +925,16 @@ manicheck: FORCE -$(DYNALOADER): preplibrary FORCE +$(DYNALOADER): lib/buildcustomize.pl preplibrary FORCE @$(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl --cross $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=static $(STATIC_LDFLAGS) -d_dummy $(dynamic_ext): miniperl$(EXE_EXT) preplibrary makeppport $(DYNALOADER) FORCE +d_dummy $(dynamic_ext): miniperl$(EXE_EXT) lib/buildcustomize.pl preplibrary makeppport $(DYNALOADER) FORCE @$(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl --cross $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=dynamic -s_dummy $(static_ext): miniperl$(EXE_EXT) preplibrary makeppport $(DYNALOADER) FORCE +s_dummy $(static_ext): miniperl$(EXE_EXT) lib/buildcustomize.pl preplibrary makeppport $(DYNALOADER) FORCE @$(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl --cross $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=static $(STATIC_LDFLAGS) -n_dummy $(nonxs_ext): miniperl$(EXE_EXT) preplibrary $(DYNALOADER) FORCE +n_dummy $(nonxs_ext): miniperl$(EXE_EXT) lib/buildcustomize.pl preplibrary $(DYNALOADER) FORCE @$(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl --cross $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) !NO!SUBS! Index: perl-5.12.3/MANIFEST =================================================================== --- perl-5.12.3.orig/MANIFEST +++ perl-5.12.3/MANIFEST @@ -4747,6 +4747,7 @@ win32/wince.c WinCE port win32/wince.h WinCE port win32/wincesck.c WinCE port writemain.SH Generate perlmain.c from miniperlmain.c+extensions +write_buildcustomize.pl Generate lib/buildcustomize.pl x2p/a2p.c Output of a2p.y run through byacc x2p/a2p.h Global declarations x2p/a2p.pod Pod for awk to perl translator Index: perl-5.12.3/Makefile.SH =================================================================== --- perl-5.12.3.orig/Makefile.SH +++ perl-5.12.3/Makefile.SH @@ -428,7 +428,7 @@ esac ## In the following dollars and backticks do not need the extra backslash. $spitshell >>$Makefile <<'!NO!SUBS!' -private = preplibrary $(CONFIGPM) $(CONFIGPOD) lib/ExtUtils/Miniperl.pm git_version.h +private = preplibrary $(CONFIGPM) $(CONFIGPOD) lib/ExtUtils/Miniperl.pm git_version.h lib/buildcustomize.pl # Files to be built with variable substitution before miniperl # is available. @@ -991,6 +991,9 @@ $(plextract): $(MINIPERL_EXE) $(CONFIGPM x2p/s2p: $(MINIPERL_EXE) $(CONFIGPM) $(dynamic_ext) x2p/s2p.PL cd x2p; $(LDLIBPTH) $(MAKE) s2p +lib/buildcustomize.pl: $(MINIPERL_EXE) write_buildcustomize.pl + $(MINIPERL) write_buildcustomize.pl >lib/buildcustomize.pl + unidatafiles $(unidatafiles) pod/perluniprops.pod: uni.data uni.data: $(MINIPERL_EXE) $(CONFIGPM) lib/unicore/mktables $(nonxs_ext) @@ -1160,16 +1163,16 @@ manicheck: FORCE # # DynaLoader may be needed for extensions that use Makefile.PL. -$(DYNALOADER): $(MINIPERL_EXE) preplibrary FORCE $(nonxs_ext) +$(DYNALOADER): $(MINIPERL_EXE) lib/buildcustomize.pl preplibrary FORCE $(nonxs_ext) $(MINIPERL) make_ext.pl $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=static $(STATIC_LDFLAGS) -d_dummy $(dynamic_ext): $(MINIPERL_EXE) preplibrary makeppport $(DYNALOADER) FORCE $(PERLEXPORT) +d_dummy $(dynamic_ext): $(MINIPERL_EXE) lib/buildcustomize.pl preplibrary makeppport $(DYNALOADER) FORCE $(PERLEXPORT) $(MINIPERL) make_ext.pl $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=dynamic -s_dummy $(static_ext): $(MINIPERL_EXE) preplibrary makeppport $(DYNALOADER) FORCE +s_dummy $(static_ext): $(MINIPERL_EXE) lib/buildcustomize.pl preplibrary makeppport $(DYNALOADER) FORCE $(MINIPERL) make_ext.pl $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=static $(STATIC_LDFLAGS) -n_dummy $(nonxs_ext): $(MINIPERL_EXE) preplibrary FORCE +n_dummy $(nonxs_ext): $(MINIPERL_EXE) lib/buildcustomize.pl preplibrary FORCE $(MINIPERL) make_ext.pl $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) !NO!SUBS! Index: perl-5.12.3/installperl =================================================================== --- perl-5.12.3.orig/installperl +++ perl-5.12.3/installperl @@ -714,6 +714,8 @@ sub installlib { # ignore the test extensions return if $dir =~ m{\bXS/(?:APItest|Typemap)\b}; return if $name =~ m{\b(?:APItest|Typemap)\.pm$}; + # ignore the build support code + return if $name =~ /\bbuildcustomize\.pl$/; # ignore the demo files return if $dir =~ /\b(?:demos?|eg)\b/; Index: perl-5.12.3/make_ext.pl =================================================================== --- perl-5.12.3.orig/make_ext.pl +++ perl-5.12.3/make_ext.pl @@ -4,11 +4,9 @@ use warnings; use Config; BEGIN { if ($^O eq 'MSWin32') { - unshift @INC, ('../cpan/Cwd', '../cpan/Cwd/lib'); - require File::Spec::Functions; + unshift @INC, '../cpan/Cwd'; require FindExt; - } - else { + } else { unshift @INC, 'cpan/Cwd'; } } @@ -18,27 +16,6 @@ my $is_Win32 = $^O eq 'MSWin32'; my $is_VMS = $^O eq 'VMS'; my $is_Unix = !$is_Win32 && !$is_VMS; -# To clarify, this isn't the entire suite of modules considered "toolchain" -# It's not even all modules needed to build ext/ -# It's just the source paths of the (minimum complete set of) modules in ext/ -# needed to build the nonxs modules -# After which, all nonxs modules are in lib, which was always sufficient to -# allow miniperl to build everything else. - -# This list cannot get any longer without overflowing the length limit for -# environment variables on VMS -my @toolchain = qw(cpan/AutoLoader/lib - cpan/Cwd cpan/Cwd/lib - cpan/ExtUtils-Command/lib - dist/ExtUtils-Install/lib - cpan/ExtUtils-MakeMaker/lib - cpan/ExtUtils-Manifest/lib - cpan/File-Path/lib - ); - -# Used only in ExtUtils::Liblist::Kid::_win32_ext() -push @toolchain, 'cpan/Text-ParseWords/lib' if $is_Win32; - my @ext_dirs = qw(cpan dist ext); my $ext_dirs_re = '(?:' . join('|', @ext_dirs) . ')'; @@ -295,16 +272,7 @@ sub build_extension { $perl ||= "$up/miniperl"; my $return_dir = $up; my $lib_dir = "$up/lib"; - # $lib_dir must be last, as we're copying files into it, and in a parallel - # make there's a race condition if one process tries to open a module that - # another process has half-written. - my @new_inc = ((map {"$up/$_"} @toolchain), $lib_dir); - if ($is_Win32) { - @new_inc = map {File::Spec::Functions::rel2abs($_)} @new_inc; - } - $ENV{PERL5LIB} = join $Config{path_sep}, @new_inc; $ENV{PERL_CORE} = 1; - # warn $ENV{PERL5LIB}; my $makefile; if ($is_VMS) { @@ -375,7 +343,7 @@ EOM @cross = '-MCross'; } - my @args = (@cross, 'Makefile.PL'); + my @args = ("-I$lib_dir", @cross, 'Makefile.PL'); if ($is_VMS) { my $libd = VMS::Filespec::vmspath($lib_dir); push @args, "INST_LIB=$libd", "INST_ARCHLIB=$libd"; Index: perl-5.12.3/vms/descrip_mms.template =================================================================== --- perl-5.12.3.orig/vms/descrip_mms.template +++ perl-5.12.3/vms/descrip_mms.template @@ -360,7 +360,7 @@ CRTLOPTS =,$(CRTL)/Options unidatadirs = lib/unicore/To lib/unicore/lib # Modules which must be installed before we can build extensions -LIBPREREQ = $(ARCHDIR)Config.pm $(ARCHDIR)Config_heavy.pl [.lib.VMS]Filespec.pm $(ARCHDIR)vmspipe.com [.lib]re.pm +LIBPREREQ = $(ARCHDIR)Config.pm $(ARCHDIR)Config_heavy.pl [.lib.VMS]Filespec.pm $(ARCHDIR)vmspipe.com [.lib]re.pm [.lib]buildcustomize.pl utils1 = [.lib.pods]perldoc.com [.lib.ExtUtils]Miniperl.pm [.utils]c2ph.com [.utils]h2ph.com utils2 = [.utils]h2xs.com [.utils]libnetcfg.com [.lib]perlbug.com [.utils]dprofpp.com @@ -458,6 +458,9 @@ archcorefiles : $(ac) $(ARCHAUTO)time.st [.lib]re.pm : [.ext.re]re.pm Copy/NoConfirm/Log $(MMS$SOURCE) [.lib] +[.lib]buildcustomize.pl : write_buildcustomize.pl $(MINIPERL_EXE) + $(MINIPERL) write_buildcustomize.pl > [.lib]buildcustomize.pl + vmspipe.com : [.vms]vmspipe.com Copy/NoConfirm/Log $(MMS$SOURCE) [] @@ -561,7 +564,7 @@ unidatafiles.ts : $(MINIPERL_EXE) [.lib] @ If F$Search("$(MMS$TARGET)").nes."" Then Delete/NoLog/NoConfirm $(MMS$TARGET);* @ Copy/NoConfirm _NLA0: $(MMS$TARGET) -DynaLoader$(O) : $(ARCHDIR)Config.pm $(MINIPERL_EXE) [.lib.VMS]Filespec.pm +DynaLoader$(O) : [.lib]buildcustomize.pl $(ARCHDIR)Config.pm $(MINIPERL_EXE) [.lib.VMS]Filespec.pm $(MINIPERL) make_ext.pl "MAKE=$(MMS)" "DynaLoader" dynext : $(LIBPREREQ) $(DBG)perlshr$(E) unidatafiles.ts DynaLoader$(O) preplibrary makeppport $(MINIPERL_EXE) @@ -1856,6 +1859,7 @@ tidy : cleanlis - If F$Search("[.utils]*.com;-1").nes."" Then Purge/NoConfirm/Log [.utils]*.com - If F$Search("[.x2p]*.com;-1").nes."" Then Purge/NoConfirm/Log [.x2p]*.com - If F$Search("[.lib.pods]*.com;-1").nes."" Then Purge/NoConfirm/Log [.lib.pods]*.com + - If F$Search("[.lib]buildcustomize.pl;-1").nes."" Then Purge/NoConfirm/Log [.lib]buildcustomize.pl clean : tidy cleantest - $(MINIPERL) make_ext.pl "MAKE=$(MMS)" "--all" "--target=clean" Index: perl-5.12.3/win32/Makefile =================================================================== --- perl-5.12.3.orig/win32/Makefile +++ perl-5.12.3/win32/Makefile @@ -923,6 +923,9 @@ $(CONFIGPM) : $(MINIPERL) ..\config.sh c -$(MINIPERL) -I..\lib $(ICWD) config_h.PL "INST_VER=$(INST_VER)" if errorlevel 1 $(MAKE) /$(MAKEFLAGS) $(CONFIGPM) +..\lib\buildcustomize.pl: $(MINIPERL) ..\write_buildcustomize.pl + $(MINIPERL) -I..\lib ..\write_buildcustomize.pl .. >..\lib\buildcustomize.pl + $(MINIPERL) : $(MINIDIR) $(MINI_OBJ) $(LINK32) -subsystem:console -out:$@ @<< $(LINK_FLAGS) $(LIBFILES) $(MINI_OBJ) @@ -1045,24 +1048,24 @@ MakePPPort: $(MINIPERL) $(CONFIGPM) Exte #------------------------------------------------------------------------------- # There's no direct way to mark a dependency on # DynaLoader.pm, so this will have to do -Extensions: ..\make_ext.pl $(PERLDEP) $(CONFIGPM) $(DYNALOADER) +Extensions: ..\make_ext.pl ..\lib\buildcustomize.pl $(PERLDEP) $(CONFIGPM) $(DYNALOADER) $(XCOPY) ..\*.h $(COREDIR)\*.* $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --dynamic -Extensions_reonly: ..\make_ext.pl $(PERLDEP) $(CONFIGPM) $(DYNALOADER) +Extensions_reonly: ..\make_ext.pl ..\lib\buildcustomize.pl $(PERLDEP) $(CONFIGPM) $(DYNALOADER) $(XCOPY) ..\*.h $(COREDIR)\*.* $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --dynamic +re -Extensions_static : ..\make_ext.pl list_static_libs.pl $(PERLDEP) $(CONFIGPM) +Extensions_static : ..\make_ext.pl ..\lib\buildcustomize.pl list_static_libs.pl $(PERLDEP) $(CONFIGPM) $(XCOPY) ..\*.h $(COREDIR)\*.* $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --static $(MINIPERL) -I..\lib list_static_libs.pl > Extensions_static -Extensions_nonxs: ..\make_ext.pl $(PERLDEP) $(CONFIGPM) +Extensions_nonxs: ..\make_ext.pl ..\lib\buildcustomize.pl $(PERLDEP) $(CONFIGPM) $(XCOPY) ..\*.h $(COREDIR)\*.* $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --nonxs -$(DYNALOADER) : ..\make_ext.pl $(PERLDEP) $(CONFIGPM) Extensions_nonxs +$(DYNALOADER) : ..\make_ext.pl ..\lib\buildcustomize.pl $(PERLDEP) $(CONFIGPM) Extensions_nonxs $(XCOPY) ..\*.h $(COREDIR)\*.* $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(EXTDIR) --dynaloader @@ -1159,6 +1162,7 @@ distclean: realclean -del /f $(LIBDIR)\Win32CORE.pm -del /f $(LIBDIR)\Win32API\File.pm -del /f $(LIBDIR)\Win32API\File\cFile.pc + -del /f $(LIBDIR)\buildcustomize.pl -del /f $(DISTDIR)\XSLoader\XSLoader.pm -if exist $(LIBDIR)\App rmdir /s /q $(LIBDIR)\App -if exist $(LIBDIR)\Archive rmdir /s /q $(LIBDIR)\Archive Index: perl-5.12.3/win32/makefile.mk =================================================================== --- perl-5.12.3.orig/win32/makefile.mk +++ perl-5.12.3/win32/makefile.mk @@ -1215,6 +1215,10 @@ $(CONFIGPM) : $(MINIPERL) ..\config.sh c $(MINIPERL) -I..\lib $(ICWD) config_h.PL "INST_VER=$(INST_VER)" \ || $(MAKE) $(MAKEMACROS) $(CONFIGPM) $(MAKEFILE) +..\lib\buildcustomize.pl: $(MINIPERL) ..\write_buildcustomize.pl + $(MINIPERL) -I..\lib ..\write_buildcustomize.pl .. >..\lib\buildcustomize.pl + + $(MINIPERL) : $(MINIDIR) $(MINI_OBJ) $(CRTIPMLIBS) .IF "$(CCTYPE)" == "BORLAND" if not exist $(CCLIBDIR)\PSDK\odbccp32.lib \ @@ -1423,24 +1427,24 @@ MakePPPort: $(MINIPERL) $(CONFIGPM) Exte #------------------------------------------------------------------------------- # There's no direct way to mark a dependency on # DynaLoader.pm, so this will have to do -Extensions : ..\make_ext.pl $(PERLDEP) $(CONFIGPM) $(DYNALOADER) +Extensions : ..\make_ext.pl ..\lib\buildcustomize.pl $(PERLDEP) $(CONFIGPM) $(DYNALOADER) $(XCOPY) ..\*.h $(COREDIR)\*.* $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --dynamic -Extensions_reonly : ..\make_ext.pl $(PERLDEP) $(CONFIGPM) $(DYNALOADER) +Extensions_reonly : ..\make_ext.pl ..\lib\buildcustomize.pl $(PERLDEP) $(CONFIGPM) $(DYNALOADER) $(XCOPY) ..\*.h $(COREDIR)\*.* $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --dynamic +re -Extensions_static : ..\make_ext.pl list_static_libs.pl $(PERLDEP) $(CONFIGPM) +Extensions_static : ..\make_ext.pl ..\lib\buildcustomize.pl list_static_libs.pl $(PERLDEP) $(CONFIGPM) $(XCOPY) ..\*.h $(COREDIR)\*.* $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --static $(MINIPERL) -I..\lib list_static_libs.pl > Extensions_static -Extensions_nonxs : ..\make_ext.pl $(PERLDEP) $(CONFIGPM) +Extensions_nonxs : ..\make_ext.pl ..\lib\buildcustomize.pl $(PERLDEP) $(CONFIGPM) $(XCOPY) ..\*.h $(COREDIR)\*.* $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --nonxs -$(DYNALOADER) : ..\make_ext.pl $(PERLDEP) $(CONFIGPM) Extensions_nonxs +$(DYNALOADER) : ..\make_ext.pl ..\lib\buildcustomize.pl $(PERLDEP) $(CONFIGPM) Extensions_nonxs $(XCOPY) ..\*.h $(COREDIR)\*.* $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(EXTDIR) --dynaloader @@ -1534,6 +1538,7 @@ distclean: realclean -del /f $(LIBDIR)\Win32CORE.pm -del /f $(LIBDIR)\Win32API\File.pm -del /f $(LIBDIR)\Win32API\File\cFile.pc + -del /f $(LIBDIR)\buildcustomize.pl -del /f $(DISTDIR)\XSLoader\XSLoader.pm -if exist $(LIBDIR)\App rmdir /s /q $(LIBDIR)\App -if exist $(LIBDIR)\Archive rmdir /s /q $(LIBDIR)\Archive Index: perl-5.12.3/write_buildcustomize.pl =================================================================== --- /dev/null +++ perl-5.12.3/write_buildcustomize.pl @@ -0,0 +1,50 @@ +#!./miniperl -w + +use strict; +if (@ARGV) { + my $dir = shift; + chdir $dir or die "Can't chdir '$dir': $!"; + unshift @INC, 'lib'; +} + +unshift @INC, ('cpan/Cwd', 'cpan/Cwd/lib'); +require File::Spec::Functions; + +# To clarify, this isn't the entire suite of modules considered "toolchain" +# It's not even all modules needed to build ext/ +# It's just the source paths of the (minimum complete set of) modules in ext/ +# needed to build the nonxs modules +# After which, all nonxs modules are in lib, which was always sufficient to +# allow miniperl to build everything else. + +my @toolchain = qw(cpan/AutoLoader/lib + cpan/Cwd cpan/Cwd/lib + cpan/ExtUtils-Command/lib + dist/ExtUtils-Install/lib + cpan/ExtUtils-MakeMaker/lib + cpan/ExtUtils-Manifest/lib + cpan/File-Path/lib + ); + +# Used only in ExtUtils::Liblist::Kid::_win32_ext() +push @toolchain, 'cpan/Text-ParseWords/lib' if $^O eq 'MSWin32'; + +# lib must be last, as the the toolchain modules write themselves into it +# as they build, and it's important that @INC order ensures that the partially +# written files are always masked by the complete versions. + +my $inc = join ",\n ", + map { "q\0$_\0" } + (map {File::Spec::Functions::rel2abs($_)} @toolchain, 'lib'), '.'; + +# If any of the system's build tools are written in Perl, then this module +# may well be loaded by a much older version than we are building. So keep it +# as backwards compatible as is easy. +print <<"EOT"; +#!perl + +# We are miniperl, building extensions +# Reset \@INC completely, adding the directories we need, and removing the +# installed directories (which we don't need to read, and may confuse us) +\@INC = ($inc); +EOT