Skip to content

Commit 13dd85c

Browse files
author
Bram
committed
win32: use tmp file when creating config.sh
When `config_sh.PL` failed then it created an empty '..\config.sh' file. This is unwanted since if make is then re-run it detects a '..\config.sh' file and skips the target which leads to completely different errors. After adding a `die "Foobar";` in win32/config_sh.PL: $ gmake INST_TOP=... CCHOME=... ... ..\miniperl.exe -I..\lib config_sh.PL ... > ..\config.sh Foobar at config_sh.PL line 5. gmake: *** [GNUmakefile:1175: ..\config.sh] Error 255 Re-running the make command: $ gmake INST_TOP=... CCHOME=... ..\miniperl.exe -I..\lib ..\configpm --chdir=.. Use of uninitialized value $t in string eq at ..\configpm line 345. ... written lib/Config.pod updated lib/Config.pm updated lib/Config_heavy.pl syntax error at lib/Config_heavy.pl line 165, near "x;" Compilation failed in require at ..\configpm line 1144. gmake: *** [GNUmakefile:1190: ..\lib\Config.pm] Error 255 When `gmake` was re-run it started with the '$(CONFIGPM)' target instead of the '..\config.sh' target. The fix: instead of creating '..\config.sh' it now first creates '..\config.sh.tmp' and then renames[^1] it to '..\config.sh' Tested the GNUmakefile on Windows 10 using GNU Make v4.2.1, I did *not* test the Makefile (no nmake installed). [^1]: `rename` on windows only takes a path in the first argument. That is: `rename ..\config.sh.tmp config.sh` can be considered the same as `move ..\config.sh.tmp ..\config.sh`.
1 parent 9b8ba59 commit 13dd85c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

win32/GNUmakefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -1172,7 +1172,8 @@ endif
11721172
..\perl$(o) : ..\git_version.h
11731173

11741174
..\config.sh : $(CFGSH_TMPL) config_sh.PL FindExt.pm $(HAVEMINIPERL)
1175-
$(MINIPERL) -I..\lib config_sh.PL $(CFG_VARS) $(CFGSH_TMPL) > ..\config.sh
1175+
$(MINIPERL) -I..\lib config_sh.PL $(CFG_VARS) $(CFGSH_TMPL) > ..\config.sh.tmp
1176+
rename ..\config.sh.tmp config.sh
11761177

11771178
# This target is for when changes to the main config.sh happen.
11781179
# Edit config.gc, then make perl using GCC in a minimal configuration (i.e.

win32/Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,8 @@ perlglob$(o) : perlglob.c
872872
..\perl$(o) : ..\git_version.h
873873

874874
..\config.sh : $(CFGSH_TMPL) config_sh.PL FindExt.pm $(MINIPERL)
875-
$(MINIPERL) -I..\lib config_sh.PL $(CFG_VARS) $(CFGSH_TMPL) > ..\config.sh
875+
$(MINIPERL) -I..\lib config_sh.PL $(CFG_VARS) $(CFGSH_TMPL) > ..\config.sh.tmp
876+
rename ..\config.sh.tmp config.sh
876877

877878
# This target is for when changes to the main config.sh happen.
878879
# Edit config.vc, then make perl in a minimal configuration (i.e. with MULTI,

0 commit comments

Comments
 (0)