From ae04406cd2ad8190e0bf85b91e4990188311226b Mon Sep 17 00:00:00 2001 From: Tobiasz Laskowski Date: Mon, 16 Feb 2026 00:33:05 +0000 Subject: [PATCH] Fix luajit rolling release build in msys shell The SHELL=cmd argument is needed when running hererocks from cmd or powershell, because in that case luajit will use dos commands. However, if MSYSTEM or TERM are defined (e.g. in a msys shell) then luajit will build using bash commands and the build will fail with the error below. To fix this, this patch respects the same variables that luajit uses to decide whether to use dos or unix commands. SHELL=cmd is no longer set in a unix environment, but still is in a dos environment. See luajit src/Makefile: https://github.com/LuaJIT/LuaJIT/blob/26fd1a7d6770b2237240a071e6f01132877a2425/src/Makefile#L157 Current build error: ``` Building LuaJIT @26fd1a7 (target: mingw) "==== Building LuaJIT 2.1 ====" mingw32-make -C src mingw32-make[1]: Entering directory 'C:/Users/RUNNER~1/AppData/Local/Temp/tmpadzy1my3/LuaJIT/src' "HOSTCC host/minilua.o" "HOSTLINK host/minilua.exe" "VERSION luajit.h" Error: host/genversion.lua:14: run from the wrong directory mingw32-make[1]: *** [Makefile:673: luajit.h] Error 1 mingw32-make[1]: Leaving directory 'C:/Users/RUNNER~1/AppData/Local/Temp/tmpadzy1my3/LuaJIT/src' mingw32-make: *** [Makefile:127: default] Error 2 Error: got exitcode 2 from command mingw32-make SHELL=cmd ``` --- hererocks.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hererocks.py b/hererocks.py index 0c2a21e..3492296 100755 --- a/hererocks.py +++ b/hererocks.py @@ -2433,7 +2433,9 @@ def make(self): make_args = [] if opts.target == "mingw" and program_exists("mingw32-make"): make = "mingw32-make" - make_args.append("SHELL=cmd") + if not ("MSYSTEM" in os.environ or "TERM" in os.environ): + # luajit makefile uses dos commands, unless running in msys/cygwin shell + make_args.append("SHELL=cmd") elif opts.target == "freebsd": make = "gmake" else: