contribs: lua: Use an import library when linking, fix building with lld
authorMartin Storsjö <martin@martin.st>
Thu, 21 Dec 2017 21:57:42 +0000 (23:57 +0200)
committerHugo Beauzée-Luyssen <hugo@beauzee.fr>
Fri, 22 Dec 2017 10:09:04 +0000 (11:09 +0100)
lld doesn't support providing the DLL instead of an import library
when linking.

Signed-off-by: Hugo Beauzée-Luyssen <hugo@beauzee.fr>
contrib/src/lua/implib.patch [new file with mode: 0644]
contrib/src/lua/rules.mak

diff --git a/contrib/src/lua/implib.patch b/contrib/src/lua/implib.patch
new file mode 100644 (file)
index 0000000..db37ffe
--- /dev/null
@@ -0,0 +1,35 @@
+diff -urN lua-5.1.4-orig/src/Makefile lua-5.1.4/src/Makefile
+--- lua-5.1.4-orig/src/Makefile        2017-12-14 07:30:51.879954115 +0000
++++ lua-5.1.4/src/Makefile     2017-12-14 08:00:29.765126324 +0000
+@@ -23,6 +23,7 @@
+ PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
+ LUA_A=        liblua.a
++LUA_A_LINK= $(LUA_A)
+ CORE_O=       lapi.o lcode.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
+@@ -52,10 +53,10 @@
+       $(RANLIB) $@
+ $(LUA_T): $(LUA_O) $(LUA_A)
+-      $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
++      $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A_LINK) $(LIBS)
+ $(LUAC_T): $(LUAC_O) $(LUA_A)
+-      $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
++      $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A_LINK) $(LIBS)
+ clean:
+       $(RM) $(ALL_T) $(ALL_O)
+@@ -107,8 +108,8 @@
+ #     $(MAKE) all MYCFLAGS=-DLUA_USE_MACOSX
+ mingw:
+-      $(MAKE) "LUA_A=lua51.dll" "LUA_T=lua.exe" \
+-      "AR=$(CC) -shared -o" "RANLIB=strip --strip-unneeded" \
++      $(MAKE) "LUA_A=lua51.dll" "LUA_T=lua.exe" "LUA_A_LINK=lua51.lib" \
++      "AR=$(CC) -shared -Wl,--out-implib,lua51.lib -o" "RANLIB=strip --strip-unneeded" \
+       "MYCFLAGS=-DLUA_BUILD_AS_DLL" "MYLIBS=" "MYLDFLAGS=-s" lua.exe
+       $(MAKE) "LUAC_T=luac.exe" luac.exe
index b1a27c4..cdd4ce9 100644 (file)
@@ -46,6 +46,7 @@ lua: lua-$(LUA_VERSION).tar.gz .sum-lua
        $(APPLY) $(SRC)/lua/luac-32bits.patch
        $(APPLY) $(SRC)/lua/no-localeconv.patch
        $(APPLY) $(SRC)/lua/lua-ios-support.patch
+       $(APPLY) $(SRC)/lua/implib.patch
 ifdef HAVE_WINSTORE
        $(APPLY) $(SRC)/lua/lua-winrt.patch
 endif