Upstream-Status:Inappropriate [Backport]

Rebased by Nitin A Kamble <nitin.a.kamble@intel.com> on 3/11/2011

commit 7353f64c5bca6e7102582a1e0017c850930249c3
Author: Nicholas Clark <nick@ccl4.org>
Date:   Mon Feb 14 20:36:36 2011 +0000

    Add ext/re/re.pm to the @INC set for miniperl by lib/buildcustomize.pl
    
    This avoids a build-time race condition where lib/re.pm might be read midway
    through the *second* copy of it (when ext/re/Makefile is being run). It also
    simplifies many [Mm]akefile* rules, which previously had a special case to
    copy it early.

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
@@ -727,7 +727,7 @@ fi
 $spitshell >>$Makefile <<'!NO!SUBS!'
 
 .PHONY: preplibrary
-preplibrary: miniperl $(CONFIGPM) lib/lib.pm lib/re.pm $(PREPLIBRARY_LIBPERL)
+preplibrary: miniperl $(CONFIGPM) lib/lib.pm $(PREPLIBRARY_LIBPERL)
 
 .PHONY: makeppport
 makeppport: miniperl$(EXE_EXT) $(CONFIGPM)
@@ -748,10 +748,6 @@ $(plextract):	miniperl $(CONFIGPM) x2p/s
 	@-rm -f $@
 	$(LDLIBPTH) ./miniperl -I`pwd`/lib $@.PL
 
-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
 
@@ -1212,7 +1208,7 @@ minitest.prep:
 
 # Can't depend on lib/Config.pm because that might be where miniperl
 # is crashing.
-minitest: miniperl$(EXE_EXT) lib/re.pm minitest.prep
+minitest: miniperl$(EXE_EXT) minitest.prep
 	- cd t && (rm -f perl$(EXE_EXT); $(LNS) ../miniperl$(EXE_EXT) perl$(EXE_EXT)) \
 		&& $(LDLIBPTH) ./perl TEST -minitest base/*.t comp/*.t cmd/*.t run/*.t io/*.t op/*.t uni/*.t </dev/tty
 
Index: perl-5.12.3/Makefile.SH
===================================================================
--- perl-5.12.3.orig/Makefile.SH
+++ perl-5.12.3/Makefile.SH
@@ -970,7 +970,7 @@ esac
 $spitshell >>$Makefile <<'!NO!SUBS!'
 
 .PHONY: preplibrary
-preplibrary: $(MINIPERL_EXE) $(CONFIGPM) lib/re.pm $(PREPLIBRARY_LIBPERL)
+preplibrary: $(MINIPERL_EXE) $(CONFIGPM) $(PREPLIBRARY_LIBPERL)
 
 $(CONFIGPM_FROM_CONFIG_SH): $(CONFIGPOD)
 
@@ -980,10 +980,6 @@ $(CONFIGPOD): config.sh $(MINIPERL_EXE) 
 lib/ExtUtils/Miniperl.pm: miniperlmain.c $(MINIPERL_EXE) minimod.pl $(CONFIGPM)
 	$(MINIPERL) minimod.pl > lib/ExtUtils/Miniperl.pm
 
-lib/re.pm: ext/re/re.pm
-	@-rm -f $@
-	cp ext/re/re.pm lib/re.pm
-
 $(plextract):	$(MINIPERL_EXE) $(CONFIGPM) x2p/s2p $(dynamic_ext)
 	@-rm -f $@
 	$(MINIPERL) $@.PL
@@ -1267,7 +1263,7 @@ _cleaner2:
 	rm -f lib/.exists lib/*/.exists lib/*/*/.exists
 	rm -f h2ph.man pstruct
 	rm -rf .config
-	rm -f preload lib/re.pm
+	rm -f preload
 	rm -rf lib/Encode lib/Compress lib/Hash lib/re
 	rm -rf lib/TAP lib/Module/Pluggable lib/App
 	rm -rf lib/mro
@@ -1464,7 +1460,7 @@ minitest.prep:
 
 # Can't depend on lib/Config.pm because that might be where miniperl
 # is crashing.
-minitest: $(MINIPERL_EXE) lib/re.pm minitest.prep
+minitest: $(MINIPERL_EXE) minitest.prep
 	- cd t && (rm -f $(PERL_EXE); $(LNS) ../$(MINIPERL_EXE) $(PERL_EXE)) \
 		&& $(RUN_PERL) TEST -minitest base/*.t comp/*.t cmd/*.t run/*.t io/*.t re/*.t op/*.t uni/*.t </dev/tty
 
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 [.lib]buildcustomize.pl
+LIBPREREQ = $(ARCHDIR)Config.pm $(ARCHDIR)Config_heavy.pl [.lib.VMS]Filespec.pm $(ARCHDIR)vmspipe.com [.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 
@@ -455,9 +455,6 @@ pod = $(pod0) $(pod1) $(pod2) $(pod3) $(
 archcorefiles : $(ac) $(ARCHAUTO)time.stamp
 	@ $(NOOP)
 
-[.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
 
@@ -1487,7 +1484,7 @@ test_harness : all [.t.lib]vmsfspec.t
 	- @[.vms]test.com "$(E)" "$(__DEBUG__)"
 	@ $(MINIPERL) -e "print ""Ran tests"";" > [.t]rantests.
 
-minitest : $(MINITEST_EXE) [.lib]re.pm [.lib.VMS]Filespec.pm unidatafiles.ts
+minitest : $(MINITEST_EXE) [.lib.VMS]Filespec.pm unidatafiles.ts
 	@ PERL_TEST_DRIVER == "minitest"
 	- @[.vms]test.com "$(E)" "$(__DEBUG__)"
 
Index: perl-5.12.3/win32/Makefile
===================================================================
--- perl-5.12.3.orig/win32/Makefile
+++ perl-5.12.3/win32/Makefile
@@ -918,7 +918,6 @@ $(CONFIGPM) : $(MINIPERL) ..\config.sh c
 	if exist lib\* $(RCOPY) lib\*.* ..\lib\$(NULL)
 	$(XCOPY) ..\*.h $(COREDIR)\*.*
 	$(XCOPY) *.h $(COREDIR)\*.*
-	$(XCOPY) ..\ext\re\re.pm $(LIBDIR)\*.*
 	$(RCOPY) include $(COREDIR)\*.*
 	-$(MINIPERL) -I..\lib $(ICWD) config_h.PL "INST_VER=$(INST_VER)"
 	if errorlevel 1 $(MAKE) /$(MAKEFLAGS) $(CONFIGPM)
Index: perl-5.12.3/win32/makefile.mk
===================================================================
--- perl-5.12.3.orig/win32/makefile.mk
+++ perl-5.12.3/win32/makefile.mk
@@ -1210,7 +1210,6 @@ $(CONFIGPM) : $(MINIPERL) ..\config.sh c
 	if exist lib\* $(RCOPY) lib\*.* ..\lib\$(NULL)
 	$(XCOPY) ..\*.h $(COREDIR)\*.*
 	$(XCOPY) *.h $(COREDIR)\*.*
-	$(XCOPY) ..\ext\re\re.pm $(LIBDIR)\*.*
 	$(RCOPY) include $(COREDIR)\*.*
 	$(MINIPERL) -I..\lib $(ICWD) config_h.PL "INST_VER=$(INST_VER)" \
 	    || $(MAKE) $(MAKEMACROS) $(CONFIGPM) $(MAKEFILE)
Index: perl-5.12.3/write_buildcustomize.pl
===================================================================
--- perl-5.12.3.orig/write_buildcustomize.pl
+++ perl-5.12.3/write_buildcustomize.pl
@@ -24,6 +24,7 @@ my @toolchain = qw(cpan/AutoLoader/lib
 		   cpan/ExtUtils-MakeMaker/lib
 		   dist/ExtUtils-Manifest/lib
 		   cpan/File-Path/lib
+		   ext/re
 		   );
 
 # Used only in ExtUtils::Liblist::Kid::_win32_ext()
