Пример #1
0
def main():
    parser = argparse.ArgumentParser(description=__doc__,
                                     usage="%(prog)s [options] [files ...]")
    parser.add_argument('files',
                        metavar='files',
                        type=str,
                        nargs='*',
                        help='symbol files to regenerate (default: all)')
    args = parser.parse_args()

    if not shared.Settings.WASM:
        sys.stderr.write('This script only runs in WASM mode\n')
        sys.exit(1)

    shared.safe_ensure_dirs(get_symbols_dir())
    if args.files:
        for symbol_file in args.files:
            if not is_symbol_file_supported(symbol_file):
                print('skipping %s because it is not supported' % symbol_file)
                continue
            lib_file = get_lib_file(symbol_file)
            if not os.path.exists(lib_file):
                print('skipping %s because %s does not exist' %
                      (symbol_file, lib_file))
                continue
            generate_symbol_file(symbol_file, lib_file)
    else:
        # Build all combinations of libraries and generate symbols files
        system_libs = Library.get_all_variations()
        for lib in system_libs.values():
            if lib.name not in target_libs:
                continue
            lib_file = lib.get_path()
            symbol_file = get_symbol_file(lib_file)
            generate_symbol_file(symbol_file, lib_file)

        # Not to generate too many symbols files with the same contents, if there
        # exists a default symbols file (that has a library name without any
        # suffices, such as -mt) and its contents are the same as another symbols
        # file with suffices, remove it.
        for lib in system_libs.values():
            if lib.name not in target_libs:
                continue
            lib_file = lib.get_path()
            symbol_file = get_symbol_file(lib_file)
            default_symbol_file = os.path.join(get_symbols_dir(),
                                               lib.name + '.symbols')
            if symbol_file != default_symbol_file and \
               os.path.isfile(default_symbol_file) and \
               filecmp.cmp(default_symbol_file, symbol_file):
                os.unlink(symbol_file)
    return 0
Пример #2
0
native optimizer, as well as fetch and build ports like zlib and sdl2
"""

from __future__ import print_function
import argparse
import logging
import os
import subprocess
import sys

from tools import shared
from tools.system_libs import Library

C_BARE = 'int main() {}'

SYSTEM_LIBRARIES = Library.get_all_variations()
SYSTEM_TASKS = list(SYSTEM_LIBRARIES.keys())

# This is needed to build the generated_struct_info.json file.
# It is not a system library, but it needs to be built before running with FROZEN_CACHE.
SYSTEM_TASKS += ['struct_info']

USER_TASKS = [
    'binaryen',
    'boost_headers',
    'bullet',
    'bzip2',
    'cocos2d',
    'freetype',
    'harfbuzz',
    'icu',