summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/perl/perl-5.12.3/parallel_build_fix_5.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/perl/perl-5.12.3/parallel_build_fix_5.patch')
-rw-r--r--meta/recipes-devtools/perl/perl-5.12.3/parallel_build_fix_5.patch430
1 files changed, 430 insertions, 0 deletions
diff --git a/meta/recipes-devtools/perl/perl-5.12.3/parallel_build_fix_5.patch b/meta/recipes-devtools/perl/perl-5.12.3/parallel_build_fix_5.patch
new file mode 100644
index 0000000000..5891ee6a93
--- /dev/null
+++ b/meta/recipes-devtools/perl/perl-5.12.3/parallel_build_fix_5.patch
@@ -0,0 +1,430 @@
1Upstream-Status:Inappropriate [Backport]
2
3Rebased by Nitin A Kamble <nitin.a.kamble@intel.com> on 3/11/2011
4
5commit 5e4c4c91bd52a48de59520d5e9b4e3478e49c613
6Author: Nicholas Clark <nick@ccl4.org>
7Date: Mon Feb 14 10:14:18 2011 +0000
8
9 Use a buildcustomize.pl to set @INC in miniperl when building extensions.
10
11 With the build tools now shipped in various subdirectories of cpan/ and dist/
12 we need to add several paths to @INC when invoking MakeMaker (etc) to build
13 extensions.
14
15 The previous approach of using $ENV{PERL5LIB} was fragile, because:
16 a: It was hitting the length limit for %ENV variables on VMS
17 b: It was running the risk of race conditions in a parallel build -
18 ExtUtils::Makemaker "knows" to add -I../..lib, which puts lib at the *front*
19 of @INC, but if one parallel process happens to copy a module into lib/
20 whilst another is searching for it, the second may get a partial read
21 c: Overwriting $ENV{PERL5LIB} breaks any system where any of the installed
22 build tools are actually implemented in Perl, if they are relying on
23 $ENV{PERL5LIB} for setup
24
25 This approach
26
27 a: Doesn't have %ENV length limits
28 b: Ensures that lib/ is last, so copy targets are always shadowing copy
29 sources
30 c: Only affects miniperl, and doesn't touch $ENV{PERL5LIB}
31
32 Approaches that turned out to have fatal flaws:
33
34 1: Using $ENV{PERL5OPT} with a module fails because ExtUtils::MakeMaker
35 searches for the build perl without setting lib, and treats the error
36 caused by a failed -M as "not a valid perl 5 binary"
37 2: Refactoring ExtUtils::MakeMaker to *not* use -I for lib, and instead rely
38 on $ENV{PERL5LIB} [which includes "../../lib"] fails because:
39 some extensions have subdirectories, and on these EU::MM correctly uses
40 -I../../../lib, where as $ENV{PERL5LIB} only has space for relative paths,
41 and only with two levels.
42
43 This approach actually takes advantage of ExtUtils::MakeMaker setting an -I
44 option correct for the depth of directory being built.
45
46Index: perl-5.12.3/Cross/Makefile-cross-SH
47===================================================================
48--- perl-5.12.3.orig/Cross/Makefile-cross-SH
49+++ perl-5.12.3/Cross/Makefile-cross-SH
50@@ -324,7 +324,7 @@ $spitshell >>$Makefile <<'!NO!SUBS!'
51
52 CONFIGPM = xlib/$(CROSS_NAME)/Config.pm
53
54-private = preplibrary $(CONFIGPM) $(CROSS_LIB)/Config.pod
55+private = preplibrary $(CONFIGPM) $(CROSS_LIB)/Config.pod lib/buildcustomize.pl
56
57 shextract = Makefile cflags config.h makeaperl makedepend \
58 makedir myconfig writemain pod/Makefile
59@@ -752,6 +752,9 @@ lib/lib.pm: miniperl $(CONFIGPM)
60 @-rm -f $@
61 $(LDLIBPTH) ./miniperl -Ilib -MCross lib/lib_pm.PL
62
63+lib/buildcustomize.pl: $(MINIPERL_EXE) write_buildcustomize.pl
64+ $(MINIPERL) write_buildcustomize.pl >lib/buildcustomize.pl
65+
66 unidatafiles $(unidatafiles): uni.data
67
68 uni.data: miniperl$(EXE_EXT) $(CONFIGPM) lib/unicore/mktables
69@@ -922,16 +925,16 @@ manicheck: FORCE
70
71
72
73-$(DYNALOADER): preplibrary FORCE
74+$(DYNALOADER): lib/buildcustomize.pl preplibrary FORCE
75 @$(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl --cross $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=static $(STATIC_LDFLAGS)
76
77-d_dummy $(dynamic_ext): miniperl$(EXE_EXT) preplibrary makeppport $(DYNALOADER) FORCE
78+d_dummy $(dynamic_ext): miniperl$(EXE_EXT) lib/buildcustomize.pl preplibrary makeppport $(DYNALOADER) FORCE
79 @$(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl --cross $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=dynamic
80
81-s_dummy $(static_ext): miniperl$(EXE_EXT) preplibrary makeppport $(DYNALOADER) FORCE
82+s_dummy $(static_ext): miniperl$(EXE_EXT) lib/buildcustomize.pl preplibrary makeppport $(DYNALOADER) FORCE
83 @$(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl --cross $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=static $(STATIC_LDFLAGS)
84
85-n_dummy $(nonxs_ext): miniperl$(EXE_EXT) preplibrary $(DYNALOADER) FORCE
86+n_dummy $(nonxs_ext): miniperl$(EXE_EXT) lib/buildcustomize.pl preplibrary $(DYNALOADER) FORCE
87 @$(LDLIBPTH) $(RUN) ./miniperl$(EXE_EXT) -Ilib make_ext.pl --cross $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
88 !NO!SUBS!
89
90Index: perl-5.12.3/MANIFEST
91===================================================================
92--- perl-5.12.3.orig/MANIFEST
93+++ perl-5.12.3/MANIFEST
94@@ -4747,6 +4747,7 @@ win32/wince.c WinCE port
95 win32/wince.h WinCE port
96 win32/wincesck.c WinCE port
97 writemain.SH Generate perlmain.c from miniperlmain.c+extensions
98+write_buildcustomize.pl Generate lib/buildcustomize.pl
99 x2p/a2p.c Output of a2p.y run through byacc
100 x2p/a2p.h Global declarations
101 x2p/a2p.pod Pod for awk to perl translator
102Index: perl-5.12.3/Makefile.SH
103===================================================================
104--- perl-5.12.3.orig/Makefile.SH
105+++ perl-5.12.3/Makefile.SH
106@@ -428,7 +428,7 @@ esac
107 ## In the following dollars and backticks do not need the extra backslash.
108 $spitshell >>$Makefile <<'!NO!SUBS!'
109
110-private = preplibrary $(CONFIGPM) $(CONFIGPOD) lib/ExtUtils/Miniperl.pm git_version.h
111+private = preplibrary $(CONFIGPM) $(CONFIGPOD) lib/ExtUtils/Miniperl.pm git_version.h lib/buildcustomize.pl
112
113 # Files to be built with variable substitution before miniperl
114 # is available.
115@@ -991,6 +991,9 @@ $(plextract): $(MINIPERL_EXE) $(CONFIGPM
116 x2p/s2p: $(MINIPERL_EXE) $(CONFIGPM) $(dynamic_ext) x2p/s2p.PL
117 cd x2p; $(LDLIBPTH) $(MAKE) s2p
118
119+lib/buildcustomize.pl: $(MINIPERL_EXE) write_buildcustomize.pl
120+ $(MINIPERL) write_buildcustomize.pl >lib/buildcustomize.pl
121+
122 unidatafiles $(unidatafiles) pod/perluniprops.pod: uni.data
123
124 uni.data: $(MINIPERL_EXE) $(CONFIGPM) lib/unicore/mktables $(nonxs_ext)
125@@ -1160,16 +1163,16 @@ manicheck: FORCE
126 #
127 # DynaLoader may be needed for extensions that use Makefile.PL.
128
129-$(DYNALOADER): $(MINIPERL_EXE) preplibrary FORCE $(nonxs_ext)
130+$(DYNALOADER): $(MINIPERL_EXE) lib/buildcustomize.pl preplibrary FORCE $(nonxs_ext)
131 $(MINIPERL) make_ext.pl $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=static $(STATIC_LDFLAGS)
132
133-d_dummy $(dynamic_ext): $(MINIPERL_EXE) preplibrary makeppport $(DYNALOADER) FORCE $(PERLEXPORT)
134+d_dummy $(dynamic_ext): $(MINIPERL_EXE) lib/buildcustomize.pl preplibrary makeppport $(DYNALOADER) FORCE $(PERLEXPORT)
135 $(MINIPERL) make_ext.pl $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=dynamic
136
137-s_dummy $(static_ext): $(MINIPERL_EXE) preplibrary makeppport $(DYNALOADER) FORCE
138+s_dummy $(static_ext): $(MINIPERL_EXE) lib/buildcustomize.pl preplibrary makeppport $(DYNALOADER) FORCE
139 $(MINIPERL) make_ext.pl $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=static $(STATIC_LDFLAGS)
140
141-n_dummy $(nonxs_ext): $(MINIPERL_EXE) preplibrary FORCE
142+n_dummy $(nonxs_ext): $(MINIPERL_EXE) lib/buildcustomize.pl preplibrary FORCE
143 $(MINIPERL) make_ext.pl $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
144 !NO!SUBS!
145
146Index: perl-5.12.3/installperl
147===================================================================
148--- perl-5.12.3.orig/installperl
149+++ perl-5.12.3/installperl
150@@ -714,6 +714,8 @@ sub installlib {
151 # ignore the test extensions
152 return if $dir =~ m{\bXS/(?:APItest|Typemap)\b};
153 return if $name =~ m{\b(?:APItest|Typemap)\.pm$};
154+ # ignore the build support code
155+ return if $name =~ /\bbuildcustomize\.pl$/;
156 # ignore the demo files
157 return if $dir =~ /\b(?:demos?|eg)\b/;
158
159Index: perl-5.12.3/make_ext.pl
160===================================================================
161--- perl-5.12.3.orig/make_ext.pl
162+++ perl-5.12.3/make_ext.pl
163@@ -4,11 +4,9 @@ use warnings;
164 use Config;
165 BEGIN {
166 if ($^O eq 'MSWin32') {
167- unshift @INC, ('../cpan/Cwd', '../cpan/Cwd/lib');
168- require File::Spec::Functions;
169+ unshift @INC, '../cpan/Cwd';
170 require FindExt;
171- }
172- else {
173+ } else {
174 unshift @INC, 'cpan/Cwd';
175 }
176 }
177@@ -18,27 +16,6 @@ my $is_Win32 = $^O eq 'MSWin32';
178 my $is_VMS = $^O eq 'VMS';
179 my $is_Unix = !$is_Win32 && !$is_VMS;
180
181-# To clarify, this isn't the entire suite of modules considered "toolchain"
182-# It's not even all modules needed to build ext/
183-# It's just the source paths of the (minimum complete set of) modules in ext/
184-# needed to build the nonxs modules
185-# After which, all nonxs modules are in lib, which was always sufficient to
186-# allow miniperl to build everything else.
187-
188-# This list cannot get any longer without overflowing the length limit for
189-# environment variables on VMS
190-my @toolchain = qw(cpan/AutoLoader/lib
191- cpan/Cwd cpan/Cwd/lib
192- cpan/ExtUtils-Command/lib
193- dist/ExtUtils-Install/lib
194- cpan/ExtUtils-MakeMaker/lib
195- cpan/ExtUtils-Manifest/lib
196- cpan/File-Path/lib
197- );
198-
199-# Used only in ExtUtils::Liblist::Kid::_win32_ext()
200-push @toolchain, 'cpan/Text-ParseWords/lib' if $is_Win32;
201-
202 my @ext_dirs = qw(cpan dist ext);
203 my $ext_dirs_re = '(?:' . join('|', @ext_dirs) . ')';
204
205@@ -295,16 +272,7 @@ sub build_extension {
206 $perl ||= "$up/miniperl";
207 my $return_dir = $up;
208 my $lib_dir = "$up/lib";
209- # $lib_dir must be last, as we're copying files into it, and in a parallel
210- # make there's a race condition if one process tries to open a module that
211- # another process has half-written.
212- my @new_inc = ((map {"$up/$_"} @toolchain), $lib_dir);
213- if ($is_Win32) {
214- @new_inc = map {File::Spec::Functions::rel2abs($_)} @new_inc;
215- }
216- $ENV{PERL5LIB} = join $Config{path_sep}, @new_inc;
217 $ENV{PERL_CORE} = 1;
218- # warn $ENV{PERL5LIB};
219
220 my $makefile;
221 if ($is_VMS) {
222@@ -375,7 +343,7 @@ EOM
223 @cross = '-MCross';
224 }
225
226- my @args = (@cross, 'Makefile.PL');
227+ my @args = ("-I$lib_dir", @cross, 'Makefile.PL');
228 if ($is_VMS) {
229 my $libd = VMS::Filespec::vmspath($lib_dir);
230 push @args, "INST_LIB=$libd", "INST_ARCHLIB=$libd";
231Index: perl-5.12.3/vms/descrip_mms.template
232===================================================================
233--- perl-5.12.3.orig/vms/descrip_mms.template
234+++ perl-5.12.3/vms/descrip_mms.template
235@@ -360,7 +360,7 @@ CRTLOPTS =,$(CRTL)/Options
236 unidatadirs = lib/unicore/To lib/unicore/lib
237
238 # Modules which must be installed before we can build extensions
239-LIBPREREQ = $(ARCHDIR)Config.pm $(ARCHDIR)Config_heavy.pl [.lib.VMS]Filespec.pm $(ARCHDIR)vmspipe.com [.lib]re.pm
240+LIBPREREQ = $(ARCHDIR)Config.pm $(ARCHDIR)Config_heavy.pl [.lib.VMS]Filespec.pm $(ARCHDIR)vmspipe.com [.lib]re.pm [.lib]buildcustomize.pl
241
242 utils1 = [.lib.pods]perldoc.com [.lib.ExtUtils]Miniperl.pm [.utils]c2ph.com [.utils]h2ph.com
243 utils2 = [.utils]h2xs.com [.utils]libnetcfg.com [.lib]perlbug.com [.utils]dprofpp.com
244@@ -458,6 +458,9 @@ archcorefiles : $(ac) $(ARCHAUTO)time.st
245 [.lib]re.pm : [.ext.re]re.pm
246 Copy/NoConfirm/Log $(MMS$SOURCE) [.lib]
247
248+[.lib]buildcustomize.pl : write_buildcustomize.pl $(MINIPERL_EXE)
249+ $(MINIPERL) write_buildcustomize.pl > [.lib]buildcustomize.pl
250+
251 vmspipe.com : [.vms]vmspipe.com
252 Copy/NoConfirm/Log $(MMS$SOURCE) []
253
254@@ -561,7 +564,7 @@ unidatafiles.ts : $(MINIPERL_EXE) [.lib]
255 @ If F$Search("$(MMS$TARGET)").nes."" Then Delete/NoLog/NoConfirm $(MMS$TARGET);*
256 @ Copy/NoConfirm _NLA0: $(MMS$TARGET)
257
258-DynaLoader$(O) : $(ARCHDIR)Config.pm $(MINIPERL_EXE) [.lib.VMS]Filespec.pm
259+DynaLoader$(O) : [.lib]buildcustomize.pl $(ARCHDIR)Config.pm $(MINIPERL_EXE) [.lib.VMS]Filespec.pm
260 $(MINIPERL) make_ext.pl "MAKE=$(MMS)" "DynaLoader"
261
262 dynext : $(LIBPREREQ) $(DBG)perlshr$(E) unidatafiles.ts DynaLoader$(O) preplibrary makeppport $(MINIPERL_EXE)
263@@ -1856,6 +1859,7 @@ tidy : cleanlis
264 - If F$Search("[.utils]*.com;-1").nes."" Then Purge/NoConfirm/Log [.utils]*.com
265 - If F$Search("[.x2p]*.com;-1").nes."" Then Purge/NoConfirm/Log [.x2p]*.com
266 - If F$Search("[.lib.pods]*.com;-1").nes."" Then Purge/NoConfirm/Log [.lib.pods]*.com
267+ - If F$Search("[.lib]buildcustomize.pl;-1").nes."" Then Purge/NoConfirm/Log [.lib]buildcustomize.pl
268
269 clean : tidy cleantest
270 - $(MINIPERL) make_ext.pl "MAKE=$(MMS)" "--all" "--target=clean"
271Index: perl-5.12.3/win32/Makefile
272===================================================================
273--- perl-5.12.3.orig/win32/Makefile
274+++ perl-5.12.3/win32/Makefile
275@@ -923,6 +923,9 @@ $(CONFIGPM) : $(MINIPERL) ..\config.sh c
276 -$(MINIPERL) -I..\lib $(ICWD) config_h.PL "INST_VER=$(INST_VER)"
277 if errorlevel 1 $(MAKE) /$(MAKEFLAGS) $(CONFIGPM)
278
279+..\lib\buildcustomize.pl: $(MINIPERL) ..\write_buildcustomize.pl
280+ $(MINIPERL) -I..\lib ..\write_buildcustomize.pl .. >..\lib\buildcustomize.pl
281+
282 $(MINIPERL) : $(MINIDIR) $(MINI_OBJ)
283 $(LINK32) -subsystem:console -out:$@ @<<
284 $(LINK_FLAGS) $(LIBFILES) $(MINI_OBJ)
285@@ -1045,24 +1048,24 @@ MakePPPort: $(MINIPERL) $(CONFIGPM) Exte
286 #-------------------------------------------------------------------------------
287 # There's no direct way to mark a dependency on
288 # DynaLoader.pm, so this will have to do
289-Extensions: ..\make_ext.pl $(PERLDEP) $(CONFIGPM) $(DYNALOADER)
290+Extensions: ..\make_ext.pl ..\lib\buildcustomize.pl $(PERLDEP) $(CONFIGPM) $(DYNALOADER)
291 $(XCOPY) ..\*.h $(COREDIR)\*.*
292 $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --dynamic
293
294-Extensions_reonly: ..\make_ext.pl $(PERLDEP) $(CONFIGPM) $(DYNALOADER)
295+Extensions_reonly: ..\make_ext.pl ..\lib\buildcustomize.pl $(PERLDEP) $(CONFIGPM) $(DYNALOADER)
296 $(XCOPY) ..\*.h $(COREDIR)\*.*
297 $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --dynamic +re
298
299-Extensions_static : ..\make_ext.pl list_static_libs.pl $(PERLDEP) $(CONFIGPM)
300+Extensions_static : ..\make_ext.pl ..\lib\buildcustomize.pl list_static_libs.pl $(PERLDEP) $(CONFIGPM)
301 $(XCOPY) ..\*.h $(COREDIR)\*.*
302 $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --static
303 $(MINIPERL) -I..\lib list_static_libs.pl > Extensions_static
304
305-Extensions_nonxs: ..\make_ext.pl $(PERLDEP) $(CONFIGPM)
306+Extensions_nonxs: ..\make_ext.pl ..\lib\buildcustomize.pl $(PERLDEP) $(CONFIGPM)
307 $(XCOPY) ..\*.h $(COREDIR)\*.*
308 $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --nonxs
309
310-$(DYNALOADER) : ..\make_ext.pl $(PERLDEP) $(CONFIGPM) Extensions_nonxs
311+$(DYNALOADER) : ..\make_ext.pl ..\lib\buildcustomize.pl $(PERLDEP) $(CONFIGPM) Extensions_nonxs
312 $(XCOPY) ..\*.h $(COREDIR)\*.*
313 $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(EXTDIR) --dynaloader
314
315@@ -1159,6 +1162,7 @@ distclean: realclean
316 -del /f $(LIBDIR)\Win32CORE.pm
317 -del /f $(LIBDIR)\Win32API\File.pm
318 -del /f $(LIBDIR)\Win32API\File\cFile.pc
319+ -del /f $(LIBDIR)\buildcustomize.pl
320 -del /f $(DISTDIR)\XSLoader\XSLoader.pm
321 -if exist $(LIBDIR)\App rmdir /s /q $(LIBDIR)\App
322 -if exist $(LIBDIR)\Archive rmdir /s /q $(LIBDIR)\Archive
323Index: perl-5.12.3/win32/makefile.mk
324===================================================================
325--- perl-5.12.3.orig/win32/makefile.mk
326+++ perl-5.12.3/win32/makefile.mk
327@@ -1215,6 +1215,10 @@ $(CONFIGPM) : $(MINIPERL) ..\config.sh c
328 $(MINIPERL) -I..\lib $(ICWD) config_h.PL "INST_VER=$(INST_VER)" \
329 || $(MAKE) $(MAKEMACROS) $(CONFIGPM) $(MAKEFILE)
330
331+..\lib\buildcustomize.pl: $(MINIPERL) ..\write_buildcustomize.pl
332+ $(MINIPERL) -I..\lib ..\write_buildcustomize.pl .. >..\lib\buildcustomize.pl
333+
334+
335 $(MINIPERL) : $(MINIDIR) $(MINI_OBJ) $(CRTIPMLIBS)
336 .IF "$(CCTYPE)" == "BORLAND"
337 if not exist $(CCLIBDIR)\PSDK\odbccp32.lib \
338@@ -1423,24 +1427,24 @@ MakePPPort: $(MINIPERL) $(CONFIGPM) Exte
339 #-------------------------------------------------------------------------------
340 # There's no direct way to mark a dependency on
341 # DynaLoader.pm, so this will have to do
342-Extensions : ..\make_ext.pl $(PERLDEP) $(CONFIGPM) $(DYNALOADER)
343+Extensions : ..\make_ext.pl ..\lib\buildcustomize.pl $(PERLDEP) $(CONFIGPM) $(DYNALOADER)
344 $(XCOPY) ..\*.h $(COREDIR)\*.*
345 $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --dynamic
346
347-Extensions_reonly : ..\make_ext.pl $(PERLDEP) $(CONFIGPM) $(DYNALOADER)
348+Extensions_reonly : ..\make_ext.pl ..\lib\buildcustomize.pl $(PERLDEP) $(CONFIGPM) $(DYNALOADER)
349 $(XCOPY) ..\*.h $(COREDIR)\*.*
350 $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --dynamic +re
351
352-Extensions_static : ..\make_ext.pl list_static_libs.pl $(PERLDEP) $(CONFIGPM)
353+Extensions_static : ..\make_ext.pl ..\lib\buildcustomize.pl list_static_libs.pl $(PERLDEP) $(CONFIGPM)
354 $(XCOPY) ..\*.h $(COREDIR)\*.*
355 $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --static
356 $(MINIPERL) -I..\lib list_static_libs.pl > Extensions_static
357
358-Extensions_nonxs : ..\make_ext.pl $(PERLDEP) $(CONFIGPM)
359+Extensions_nonxs : ..\make_ext.pl ..\lib\buildcustomize.pl $(PERLDEP) $(CONFIGPM)
360 $(XCOPY) ..\*.h $(COREDIR)\*.*
361 $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --nonxs
362
363-$(DYNALOADER) : ..\make_ext.pl $(PERLDEP) $(CONFIGPM) Extensions_nonxs
364+$(DYNALOADER) : ..\make_ext.pl ..\lib\buildcustomize.pl $(PERLDEP) $(CONFIGPM) Extensions_nonxs
365 $(XCOPY) ..\*.h $(COREDIR)\*.*
366 $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(EXTDIR) --dynaloader
367
368@@ -1534,6 +1538,7 @@ distclean: realclean
369 -del /f $(LIBDIR)\Win32CORE.pm
370 -del /f $(LIBDIR)\Win32API\File.pm
371 -del /f $(LIBDIR)\Win32API\File\cFile.pc
372+ -del /f $(LIBDIR)\buildcustomize.pl
373 -del /f $(DISTDIR)\XSLoader\XSLoader.pm
374 -if exist $(LIBDIR)\App rmdir /s /q $(LIBDIR)\App
375 -if exist $(LIBDIR)\Archive rmdir /s /q $(LIBDIR)\Archive
376Index: perl-5.12.3/write_buildcustomize.pl
377===================================================================
378--- /dev/null
379+++ perl-5.12.3/write_buildcustomize.pl
380@@ -0,0 +1,50 @@
381+#!./miniperl -w
382+
383+use strict;
384+if (@ARGV) {
385+ my $dir = shift;
386+ chdir $dir or die "Can't chdir '$dir': $!";
387+ unshift @INC, 'lib';
388+}
389+
390+unshift @INC, ('cpan/Cwd', 'cpan/Cwd/lib');
391+require File::Spec::Functions;
392+
393+# To clarify, this isn't the entire suite of modules considered "toolchain"
394+# It's not even all modules needed to build ext/
395+# It's just the source paths of the (minimum complete set of) modules in ext/
396+# needed to build the nonxs modules
397+# After which, all nonxs modules are in lib, which was always sufficient to
398+# allow miniperl to build everything else.
399+
400+my @toolchain = qw(cpan/AutoLoader/lib
401+ cpan/Cwd cpan/Cwd/lib
402+ cpan/ExtUtils-Command/lib
403+ dist/ExtUtils-Install/lib
404+ cpan/ExtUtils-MakeMaker/lib
405+ cpan/ExtUtils-Manifest/lib
406+ cpan/File-Path/lib
407+ );
408+
409+# Used only in ExtUtils::Liblist::Kid::_win32_ext()
410+push @toolchain, 'cpan/Text-ParseWords/lib' if $^O eq 'MSWin32';
411+
412+# lib must be last, as the the toolchain modules write themselves into it
413+# as they build, and it's important that @INC order ensures that the partially
414+# written files are always masked by the complete versions.
415+
416+my $inc = join ",\n ",
417+ map { "q\0$_\0" }
418+ (map {File::Spec::Functions::rel2abs($_)} @toolchain, 'lib'), '.';
419+
420+# If any of the system's build tools are written in Perl, then this module
421+# may well be loaded by a much older version than we are building. So keep it
422+# as backwards compatible as is easy.
423+print <<"EOT";
424+#!perl
425+
426+# We are miniperl, building extensions
427+# Reset \@INC completely, adding the directories we need, and removing the
428+# installed directories (which we don't need to read, and may confuse us)
429+\@INC = ($inc);
430+EOT