From 86ad16c59fea401cd01d6763270ea642d8b40e48 Mon Sep 17 00:00:00 2001 From: Zoltan Zarkov Date: Thu, 16 Dec 2021 10:51:19 -0600 Subject: [PATCH] Add lua port --- src/settings.js | 4 ++++ tools/ports/lua.py | 51 ++++++++++++++++++++++++++++++++++++++++++++++ tools/settings.py | 1 + 3 files changed, 56 insertions(+) create mode 100644 tools/ports/lua.py diff --git a/src/settings.js b/src/settings.js index 265c13a474800..6225abcdff10e 100644 --- a/src/settings.js +++ b/src/settings.js @@ -1367,6 +1367,10 @@ var USE_SDL_NET = 1; // [link] var USE_ICU = 0; +// 1 = use lua from PUC ftp +// [link] +var USE_LUA = 0; + // 1 = use zlib from emscripten-ports // [link] var USE_ZLIB = 0; diff --git a/tools/ports/lua.py b/tools/ports/lua.py new file mode 100644 index 0000000000000..f782bef53b2cb --- /dev/null +++ b/tools/ports/lua.py @@ -0,0 +1,51 @@ +# Copyright 2021 The Emscripten Authors. All rights reserved. +# Emscripten is available under two separate licenses, the MIT license and the +# University of Illinois/NCSA Open Source License. Both these licenses can be +# found in the LICENSE file. + +import logging +import os +import shutil + + +VERSION = '5.4.3' +HASH = '3a1a3ee8694b72b4ec9d3ce76705fe179328294353604ca950c53f41b41161b449877d43318ef4501fee44ecbd6c83314ce7468d7425ba9b2903c9c32a28bbc0' + + +def needed(settings): + return settings.USE_LUA + + +def get_lib_name(base_name, settings): + return base_name + ('-mt' if settings.USE_PTHREADS else '') + '.a' + + +def get(ports, settings, shared): + url = 'https://www.lua.org/ftp/lua-%s.tar.gz' % VERSION + ports.fetch_project('lua', url, 'lua', sha512hash=HASH) + + def create(final): + logging.info('building port: lua') + + source_path = os.path.join(ports.get_dir(), 'lua', 'lua-' + VERSION, 'src') + dest_path = os.path.join(ports.get_build_dir(), 'lua') + + shutil.rmtree(dest_path, ignore_errors=True) + shutil.copytree(source_path, dest_path) + ports.build_port(dest_path, final, [dest_path], exclude_dirs=[], flags=[]) + + ports.install_headers(source_path) + + return [shared.Cache.get_lib('liblua.a', create)] + + +def clear(ports, settings, shared): + shared.Cache.erase_lib('liblua.a') + + +def process_args(ports): + return [] + + +def show(): + return 'lua (USE_LUA=1; MIT License)' diff --git a/tools/settings.py b/tools/settings.py index 37292143de32a..f978f8113fefb 100644 --- a/tools/settings.py +++ b/tools/settings.py @@ -31,6 +31,7 @@ 'USE_VORBIS', 'USE_COCOS2D', 'USE_ICU', + 'USE_LUA', 'USE_MODPLUG', 'USE_SDL_MIXER', 'USE_SDL_IMAGE',