lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


This is a new version of the previous patch, intended for lua 5.4.3.

The previous patch incorrectly made luac link dynamically too, which is
not supported. This is fixed in this patch version and makes the
"Fix Windows build" patch not needed anymore.

I just noticed I accidentally sent the patch from the wrong branch though, being on-top of the "[PATCH] Add a Makefile variable to override the strip tool"
one, I will re-send a fixed version in a moment…

On 10 Nov 2021, at 11:56, Marvin Scholz wrote:

lld versions below lld 13 didn't support linking directly with a DLL
instead of an import library.

Based on a patch by Martin Storsjö
---
 src/Makefile | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/Makefile b/src/Makefile
index 78d79aa..965d10a 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -34,6 +34,7 @@ CMCFLAGS=
PLATS= guess aix bsd c89 freebsd generic linux linux-readline macosx mingw posix solaris

 LUA_A=	liblua.a
+LUA_A_LINK= $(LUA_A)
CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o LIB_O= lauxlib.o lbaselib.o lcorolib.o ldblib.o liolib.o lmathlib.o loadlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o linit.o
 BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS)
@@ -62,7 +63,7 @@ $(LUA_A): $(BASE_O)
 	$(RANLIB) $@

 $(LUA_T): $(LUA_O) $(LUA_A)
-	$(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
+	$(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A_LINK) $(LIBS)

 $(LUAC_T): $(LUAC_O) $(LUA_A)
 	$(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
@@ -130,8 +131,8 @@ Darwin macos macosx:
$(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX -DLUA_USE_READLINE" SYSLIBS="-lreadline"

 mingw:
-	$(MAKE) "LUA_A=lua54.dll" "LUA_T=lua.exe" \
-	"AR=$(CC) -shared -o" "RANLIB=$(STRIP) --strip-unneeded" \
+	$(MAKE) "LUA_A=lua54.dll" "LUA_T=lua.exe" "LUA_A_LINK=lua54.lib" \
+ "AR=$(CC) -shared -Wl,--out-implib,lua54.lib -o" "RANLIB=$(STRIP) --strip-unneeded" \
 	"SYSCFLAGS=-DLUA_BUILD_AS_DLL" "SYSLIBS=" "SYSLDFLAGS=-s" lua.exe
 	$(MAKE) "LUAC_T=luac.exe" luac.exe

--
2.33.0