From 07104e60f41ca07de67fb4039064fbc2af8bff05 Mon Sep 17 00:00:00 2001 From: GenericHeroGuy <86008856+GenericHeroGuy@users.noreply.github.com> Date: Tue, 12 Nov 2024 00:43:25 +0100 Subject: [PATCH] Fix building on Windows (hopefully) --- src/bluajit/Makefile.cfg | 9 +++++++-- src/lua_script.c | 14 +++++++------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/bluajit/Makefile.cfg b/src/bluajit/Makefile.cfg index 353d4b50c..30ed28f1b 100644 --- a/src/bluajit/Makefile.cfg +++ b/src/bluajit/Makefile.cfg @@ -30,6 +30,11 @@ XCFLAGS+= -DLUAJIT_INTONLY # needed for the headers OPTS+=-DLUAJIT_INTONLY +ifdef MINGW +TARGET_SYS= Windows +HOST_MSYS= mingw +endif + ifeq (Windows,$(findstring Windows,$(OS))$(MSYSTEM)$(TERM)) HOST_SYS= Windows else @@ -56,7 +61,7 @@ HOST_RM?= rm -f HOST_XCFLAGS= -Ibluajit HOST_XLIBS= -HOST_ACFLAGS= $(CCOPTIONS) $(HOST_XCFLAGS) $(TARGET_ARCH) $(HOST_CFLAGS) +HOST_ACFLAGS= $(XCFLAGS) $(HOST_XCFLAGS) $(TARGET_ARCH) TARGET_CC= $(CROSS)$(CC) @@ -352,7 +357,7 @@ ifeq (iOS,$(TARGET_SYS)) LJVM_MODE= machasm endif -ifeq (Windows,$(HOST_SYS)) +ifeq (Windows,$(TARGET_SYS)) MINILUA_T= $(OBJDIR)/minilua.exe BUILDVM_T= $(OBJDIR)/buildvm.exe ifeq (,$(HOST_MSYS)) diff --git a/src/lua_script.c b/src/lua_script.c index 88d2721ed..a74c57f3b 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -340,7 +340,7 @@ static void jit_library(lua_State *L) { lua_rawset(L, -4); \ lua_pop(L, 1); -#define DELETE(name) \ +#define DELEET(name) \ lua_pushliteral(L, name); \ lua_pushnil(L); \ lua_rawset(L, -3); \ @@ -348,7 +348,7 @@ static void jit_library(lua_State *L) { // replace io.open, delete io.popen lua_getglobal(L, "io"); REPLACE("open", namechecker) - DELETE("popen") + DELEET("popen") lua_pop(L, 1); // replace file:write @@ -358,14 +358,14 @@ static void jit_library(lua_State *L) { // delete various base library functions lua_pushvalue(L, LUA_GLOBALSINDEX); - DELETE("dofile") - DELETE("loadfile") - DELETE("load") - DELETE("loadstring") + DELEET("dofile") + DELEET("loadfile") + DELEET("load") + DELEET("loadstring") lua_pop(L, 1); #undef REPLACE -#undef DELETE +#undef DELEET } #endif // ifndef NOBLUAJIT