From 9758e9e1f1128748952d759e9a741951d4b98f9a Mon Sep 17 00:00:00 2001 From: NickZh <62114203+mrnickzh@users.noreply.github.com> Date: Thu, 7 May 2026 19:08:28 +0300 Subject: [PATCH 1/3] Update lua.py --- tools/ports/contrib/lua.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/ports/contrib/lua.py b/tools/ports/contrib/lua.py index a815a7dffdb3c..314e89fa9f515 100644 --- a/tools/ports/contrib/lua.py +++ b/tools/ports/contrib/lua.py @@ -14,7 +14,7 @@ LICENSE = 'MIT License' port_name = 'contrib.lua' -lib_name = 'liblua.a' +lib_name = 'liblua' def get(ports, settings, shared): @@ -36,10 +36,15 @@ def create(final): ldblib.c liolib.c lmathlib.c loadlib.c loslib.c lstrlib.c ltablib.c lutf8lib.c linit.c '''.split() - ports.build_port(source_path, final, port_name, srcs=srcs) + flags=[] - return [shared.cache.get_lib(lib_name, create, what='port')] + if settings.PTHREADS: + flags += ['-pthread'] + + ports.build_port(source_path, final, port_name, srcs=srcs, flags=flags) + + return [shared.cache.get_lib(lib_name + ('-mt' if settings.PTHREADS else '') + '.a', create, what='port')] def clear(ports, settings, shared): - shared.cache.erase_lib(lib_name) + shared.cache.erase_lib(lib_name + ('-mt' if settings.PTHREADS else '') + '.a') From 7a3b8b25e93446a48082233c2154d6301e55b0b7 Mon Sep 17 00:00:00 2001 From: NickZh <62114203+mrnickzh@users.noreply.github.com> Date: Thu, 7 May 2026 21:21:28 +0300 Subject: [PATCH 2/3] Update lua.py --- tools/ports/contrib/lua.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/ports/contrib/lua.py b/tools/ports/contrib/lua.py index 314e89fa9f515..898f36e7bfa0a 100644 --- a/tools/ports/contrib/lua.py +++ b/tools/ports/contrib/lua.py @@ -14,8 +14,10 @@ LICENSE = 'MIT License' port_name = 'contrib.lua' -lib_name = 'liblua' +variants = {'contrib.lua-mt': {'PTHREADS': 1}} +def get_lib_name(settings): + return 'liblua' + ('-mt' if settings.PTHREADS else '') + '.a' def get(ports, settings, shared): # get the port @@ -43,8 +45,8 @@ def create(final): ports.build_port(source_path, final, port_name, srcs=srcs, flags=flags) - return [shared.cache.get_lib(lib_name + ('-mt' if settings.PTHREADS else '') + '.a', create, what='port')] + return [shared.cache.get_lib(get_lib_name(settings), create, what='port')] def clear(ports, settings, shared): - shared.cache.erase_lib(lib_name + ('-mt' if settings.PTHREADS else '') + '.a') + shared.cache.erase_lib(get_lib_name(settings)) From a89ea087ecf653076ae3a62c6c90a1af456ccdb5 Mon Sep 17 00:00:00 2001 From: NickZh <62114203+mrnickzh@users.noreply.github.com> Date: Thu, 7 May 2026 21:52:54 +0300 Subject: [PATCH 3/3] Update test_other.py --- test/test_other.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/test_other.py b/test/test_other.py index aaf37a772ff95..ccb40d2519607 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -2701,6 +2701,7 @@ def test_external_ports(self): ''', stdout) @requires_network + @also_with_pthreads def test_port_contrib_lua(self): self.do_runf('other/test_port_contrib_lua.c', 'hello world\nHELLO WORLD\nsqrt(16)=4\n', cflags=['--use-port=contrib.lua'])