|  | 
|  | 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)' | 
0 commit comments