From 1b11e658131cf0e6777e3c96a44fcccfe5f4ac3e Mon Sep 17 00:00:00 2001 From: Stephen Just Date: Sun, 19 Feb 2023 22:08:47 -0800 Subject: [PATCH] Apply msys2 patches --- etc/luajit.pc | 2 +- src/Makefile | 10 ++++++++-- src/luaconf.h | 16 ++++++++++++---- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/etc/luajit.pc b/etc/luajit.pc index 39e1e577..aa750d82 100644 --- a/etc/luajit.pc +++ b/etc/luajit.pc @@ -21,5 +21,5 @@ URL: https://luajit.org Version: ${version} Requires: Libs: -L${libdir} -l${libname} -Libs.private: -Wl,-E -lm -ldl +Libs.private: -lm -liconv Cflags: -I${includedir} diff --git a/src/Makefile b/src/Makefile index 30d64be2..a59afa2f 100644 --- a/src/Makefile +++ b/src/Makefile @@ -24,7 +24,7 @@ NODOTABIVER= 51 # removing the '#' in front of them. Make sure you force a full recompile # with "make clean", followed by "make" if you change any options. # -DEFAULT_CC = gcc +DEFAULT_CC = cc # # LuaJIT builds as a native 32 or 64 bit binary by default. CC= $(DEFAULT_CC) @@ -527,6 +527,7 @@ ALL_RM= $(ALL_T) $(ALL_GEN) *.o host/*.o $(WIN_RM) # Mixed mode defaults. TARGET_O= $(LUAJIT_A) +TARGET_LO= $(TARGET_O) TARGET_T= $(LUAJIT_T) $(LUAJIT_SO) TARGET_DEP= $(LIB_VMDEF) $(LUAJIT_SO) @@ -583,6 +584,11 @@ ifeq (dynamic,$(BUILDMODE)) TARGET_DYNCC= @: LJVMCORE_DYNO= $(LJVMCORE_O) TARGET_O= $(LUAJIT_SO) + ifeq (Windows,$(TARGET_SYS)) + TARGET_LO= libluajit-${ABIVER}.dll.a + else + TARGET_LO= $(TARGET_O) + endif TARGET_XLDFLAGS+= $(TARGET_DYNXLDOPTS) else ifeq (Darwin,$(TARGET_SYS)) @@ -719,7 +725,7 @@ $(LUAJIT_SO): $(LJVMCORE_O) $(LUAJIT_T): $(TARGET_O) $(LUAJIT_O) $(TARGET_DEP) $(E) "LINK $@" - $(Q)$(TARGET_LD) $(TARGET_ALDFLAGS) -o $@ $(LUAJIT_O) $(TARGET_O) $(TARGET_ALIBS) + $(Q)$(TARGET_LD) $(TARGET_ALDFLAGS) -o $@ $(LUAJIT_O) $(TARGET_LO) $(TARGET_ALIBS) $(Q)$(TARGET_STRIP) $@ $(E) "OK Successfully built LuaJIT" diff --git a/src/luaconf.h b/src/luaconf.h index e8790c1d..ea24a282 100644 --- a/src/luaconf.h +++ b/src/luaconf.h @@ -18,12 +18,20 @@ ** In Windows, any exclamation mark ('!') in the path is replaced by the ** path of the directory of the executable file of the current process. */ -#define LUA_LDIR "!\\lua\\" -#define LUA_CDIR "!\\" + +/* Paths for modules expecting non-jit lua5.1 */ +#define LUA_LDIR "!\\..\\share\\lua\\5.1\\" +#define LUA_CDIR "!\\..\\lib\\lua\\5.1\\" + +#define LUAJIT_LDIR "!\\lua\\" +#define LUAJIT_CDIR "!\\" #define LUA_PATH_DEFAULT \ - ".\\?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" + ".\\?.lua;" LUAJIT_LDIR"?.lua;" LUAJIT_LDIR"?\\init.lua;" \ + LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \ + LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua" #define LUA_CPATH_DEFAULT \ - ".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll" + ".\\?.dll;" LUAJIT_CDIR"?.dll;" LUA_CDIR"?.dll;" LUAJIT_CDIR"loadall.dll" + #else /* ** Note to distribution maintainers: do NOT patch the following lines!