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']) diff --git a/tools/ports/contrib/lua.py b/tools/ports/contrib/lua.py index a815a7dffdb3c..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.a' +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 @@ -36,10 +38,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(get_lib_name(settings), create, what='port')] def clear(ports, settings, shared): - shared.cache.erase_lib(lib_name) + shared.cache.erase_lib(get_lib_name(settings))