diff options
-rwxr-xr-x | Makefile.SH | 14 | ||||
-rw-r--r-- | vms/descrip_mms.template | 2 | ||||
-rw-r--r-- | win32/Makefile | 2 | ||||
-rw-r--r-- | win32/makefile.mk | 2 | ||||
-rw-r--r-- | write_buildcustomize.pl | 30 |
5 files changed, 39 insertions, 11 deletions
diff --git a/Makefile.SH b/Makefile.SH index 17707a1f70..cac96e72e4 100755 --- a/Makefile.SH +++ b/Makefile.SH @@ -866,15 +866,15 @@ $(MINIPERL_EXE): lib/buildcustomize.pl lib/buildcustomize.pl: $& $(mini_obj) $(CC) -o $(MINIPERL_EXE) $(CLDFLAGS) $(mini_obj) $(libs) $(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest - $(MINIPERL) write_buildcustomize.pl >lib/buildcustomize.pl + $(MINIPERL) -f write_buildcustomize.pl !NO!SUBS! ;; next4*) $spitshell >>$Makefile <<'!NO!SUBS!' -lib/buildcustomize.pl: $& $(mini_obj) write_buildcustomize.pl - $(CC) -o $(MINIPERL_EXE) $(mini_obj) $(libs) - $(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest - $(MINIPERL) write_buildcustomize.pl >lib/buildcustomize.pl +lib/buildcustomize.pl: $& $(mini_obj) write ldcustomize.pl + $(CC) -o $(MINIPERL_EXE) $(mini_obj libs) + $(LDLIBPTH) $(RUN) ./miniperl$(HOST _EXT) -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest + $(MINIPERL) -f write_buildcustomize.pl !NO!SUBS! ;; darwin*) @@ -896,7 +896,7 @@ lib/buildcustomize.pl: $& $(mini_obj) write_buildcustomize.pl $(CC) $(CLDFLAGS) $(NAMESPACEFLAGS) -o $(MINIPERL_EXE) \ $(mini_obj) $(libs) $(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest - $(MINIPERL) write_buildcustomize.pl >lib/buildcustomize.pl + $(MINIPERL) -f write_buildcustomize.pl !NO!SUBS! ;; *) @@ -906,7 +906,7 @@ lib/buildcustomize.pl: $& $(mini_obj) write_buildcustomize.pl $(LDLIBPTH) $(CC) $(CLDFLAGS) -o $(MINIPERL_EXE) \ $(mini_obj) $(libs) $(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest - $(MINIPERL) write_buildcustomize.pl >lib/buildcustomize.pl + $(MINIPERL) -f write_buildcustomize.pl !NO!SUBS! ;; esac diff --git a/vms/descrip_mms.template b/vms/descrip_mms.template index 7f919719a0..7ccc84b2c8 100644 --- a/vms/descrip_mms.template +++ b/vms/descrip_mms.template @@ -350,7 +350,7 @@ miniperl : $(DBG)miniperl$(E) vmspipe.com [.lib]buildcustomize.pl : miniperlmain$(O), $(DBG)libperlmini$(OLB) $(CRTL) write_buildcustomize.pl [.lib.VMS]Filespec.pm Link $(LINKFLAGS)/NoDebug/Trace/NoMap/NoFull/NoCross/Exe=$(MINIPERL_EXE) miniperlmain$(O), $(DBG)libperlmini$(OLB)/Library/Include=globals $(CRTLOPTS) - $(MINIPERL) write_buildcustomize.pl > [.lib]buildcustomize.pl + $(MINIPERL) "-f" write_buildcustomize.pl $(DBG)miniperl$(E) : miniperlmain$(O), $(DBG)libperlmini$(OLB) $(CRTL) Link $(LINKFLAGS)/Trace/Exe=$(MMS$TARGET) miniperlmain$(O), $(DBG)libperlmini$(OLB)/Library/Include=globals $(CRTLOPTS) diff --git a/win32/Makefile b/win32/Makefile index c7acd9c83e..8adf7f0e02 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -960,7 +960,7 @@ $(MINIPERL) : ..\lib\buildcustomize.pl $(LINK_FLAGS) $(DELAYLOAD) $(LIBFILES) $(MINI_OBJ) << $(EMBED_EXE_MANI) - $(MINIPERL) -I..\lib ..\write_buildcustomize.pl .. >..\lib\buildcustomize.pl + $(MINIPERL) -I..\lib -f ..\write_buildcustomize.pl .. $(MINIDIR) : if not exist "$(MINIDIR)" mkdir "$(MINIDIR)" diff --git a/win32/makefile.mk b/win32/makefile.mk index 4d11255fcf..4c449db759 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -1094,7 +1094,7 @@ $(MINIPERL) : ..\lib\buildcustomize.pl @$(mktmp $(DELAYLOAD) $(LIBFILES) $(MINI_OBJ)) $(EMBED_EXE_MANI) .ENDIF - $(MINIPERL) -I..\lib ..\write_buildcustomize.pl .. >..\lib\buildcustomize.pl + $(MINIPERL) -I..\lib -f ..\write_buildcustomize.pl .. $(MINIDIR) : if not exist "$(MINIDIR)" mkdir "$(MINIDIR)" diff --git a/write_buildcustomize.pl b/write_buildcustomize.pl index 018e60e1fd..709923baa2 100644 --- a/write_buildcustomize.pl +++ b/write_buildcustomize.pl @@ -10,6 +10,8 @@ if (@ARGV) { unshift @INC, ('dist/Cwd', 'dist/Cwd/lib'); require File::Spec::Functions; +my $file = 'lib/buildcustomize.pl'; + # 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/ @@ -42,10 +44,15 @@ my $inc = join ",\n ", map { "q\0$_\0" } (map {File::Spec::Functions::rel2abs($_)} @toolchain, 'lib'), '.'; +open my $fh, '>', $file + or die "Can't open $file: $!"; + +my $error; + # 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"; +print $fh <<"EOT" or $error = "Can't print to $file: $!"; #!perl # We are miniperl, building extensions @@ -53,3 +60,24 @@ print <<"EOT"; # installed directories (which we don't need to read, and may confuse us) \@INC = ($inc); EOT + +if ($error) { + close $fh + or warn "Can't unlink $file after error: $!"; +} else { + close $fh and exit; + $error = "Can't close $file: $!"; +} + +# It's going very wrong, so try to remove the botched file. + +unlink $file + or warn "Can't unlink $file after error: $!"; +die $error; + +# Local variables: +# cperl-indent-level: 4 +# indent-tabs-mode: nil +# End: +# +# ex: set ts=8 sts=4 sw=4 et: |