Subject: | [Win32] gmake needs SHELL to be specified. |
Hi,
Perl-5.21.7 (current blead) can be built using gmake and gcc, courtesy of this GNUmakefile:
https://gist.github.com/kmx/b5805847b6485c5c3a65
However, when building modules, if there's a sh.exe somewhere in the path (eg Cygwin or msys) gmake tries to run in that shell instead of the desired cmd.exe shell - which, of course, fails.
This seems to be a gmake feature - kmx dug up the following link which provides pertinent info:
https://www.gnu.org/software/make/manual/html_node/Choosing-the-Shell.html
Basically we just need the generated Makefile to specify 'SHELL = cmd.exe' (or whatever the native shell, as specified by $ENV{COMSPEC}, happens to be).
The following patch to MM_Unix.pm worked fine for me:
#############################
--- MM_Unix.pm_orig 2014-12-25 23:52:56 +1100
+++ MM_Unix.pm 2014-12-25 23:57:19 +1100
@@ -332,6 +332,16 @@
# They may have been overridden via Makefile.PL or on the command line.
END
+ my @pre;
+ if($^O eq 'MSWin32') {
+ @pre = <<"END";
+
+SHELL = $ENV{COMSPEC}
+END
+ }
+
+ unshift @m, @pre;
+
my(%once_only);
foreach my $key (@{$self->{CONFIG}}){
# SITE*EXP macros are defined in &constants; avoid duplicates here
#############################
That patch also specifies the SHELL setting for 'dmake' and 'nmake'. Neither of those needs that setting - but neither of them suffers if the setting is made. You could exclude them if you want. However, I don't think we should assume that the Windows GNU Make utility will be named 'gmake'.
Minw.org compilers already ship with a GNU Make utility named 'mingw32-make' and, faik, there may be other GNU Make utilities for Windows with different names, too.
Cheers,
Rob