Skip to content

Commit 86ad16c

Browse files
committed
Add lua port
1 parent 451e3a5 commit 86ad16c

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

src/settings.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,6 +1367,10 @@ var USE_SDL_NET = 1;
13671367
// [link]
13681368
var USE_ICU = 0;
13691369

1370+
// 1 = use lua from PUC ftp
1371+
// [link]
1372+
var USE_LUA = 0;
1373+
13701374
// 1 = use zlib from emscripten-ports
13711375
// [link]
13721376
var USE_ZLIB = 0;

tools/ports/lua.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Copyright 2021 The Emscripten Authors. All rights reserved.
2+
# Emscripten is available under two separate licenses, the MIT license and the
3+
# University of Illinois/NCSA Open Source License. Both these licenses can be
4+
# found in the LICENSE file.
5+
6+
import logging
7+
import os
8+
import shutil
9+
10+
11+
VERSION = '5.4.3'
12+
HASH = '3a1a3ee8694b72b4ec9d3ce76705fe179328294353604ca950c53f41b41161b449877d43318ef4501fee44ecbd6c83314ce7468d7425ba9b2903c9c32a28bbc0'
13+
14+
15+
def needed(settings):
16+
return settings.USE_LUA
17+
18+
19+
def get_lib_name(base_name, settings):
20+
return base_name + ('-mt' if settings.USE_PTHREADS else '') + '.a'
21+
22+
23+
def get(ports, settings, shared):
24+
url = 'https://www.lua.org/ftp/lua-%s.tar.gz' % VERSION
25+
ports.fetch_project('lua', url, 'lua', sha512hash=HASH)
26+
27+
def create(final):
28+
logging.info('building port: lua')
29+
30+
source_path = os.path.join(ports.get_dir(), 'lua', 'lua-' + VERSION, 'src')
31+
dest_path = os.path.join(ports.get_build_dir(), 'lua')
32+
33+
shutil.rmtree(dest_path, ignore_errors=True)
34+
shutil.copytree(source_path, dest_path)
35+
ports.build_port(dest_path, final, [dest_path], exclude_dirs=[], flags=[])
36+
37+
ports.install_headers(source_path)
38+
39+
return [shared.Cache.get_lib('liblua.a', create)]
40+
41+
42+
def clear(ports, settings, shared):
43+
shared.Cache.erase_lib('liblua.a')
44+
45+
46+
def process_args(ports):
47+
return []
48+
49+
50+
def show():
51+
return 'lua (USE_LUA=1; MIT License)'

tools/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
'USE_VORBIS',
3232
'USE_COCOS2D',
3333
'USE_ICU',
34+
'USE_LUA',
3435
'USE_MODPLUG',
3536
'USE_SDL_MIXER',
3637
'USE_SDL_IMAGE',

0 commit comments

Comments
 (0)