MIRROR: javascript for ๐Ÿœ's, a tiny runtime with big ambitions
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

improve core sources to snapshot generation

+47 -63
+12 -43
libant/meson.build
··· 8 8 'warning_level=2' 9 9 ], subproject_dir: 'vendor') 10 10 11 - use_lto = get_option('lto') 11 + python = find_program('python3') 12 + is_static = true 12 13 14 + use_lto = get_option('lto') 13 15 src_root = meson.project_source_root() / '..' 14 - vendor_dir = 'vendor' 15 - is_static = true 16 + include = include_directories('../include') 16 17 17 18 subdir('meson') 18 19 19 - module_files = run_command('sh', '-c', 20 - 'ls ' + src_root / 'src' / 'modules' / '*.c', 20 + lib_sources = files(run_command( 21 + python, files('meson/sources.py'), src_root / 'sources.json', 'library', src_root, 21 22 check: true 22 - ).stdout().strip().split() 23 - 24 - lib_sources = files( 25 - '../src/roots.c', 26 - '../src/utils.c', 27 - '../src/utf8.c', 28 - '../src/escape.c', 29 - '../src/reactor.c', 30 - '../src/sugar.c', 31 - '../src/ant.c', 32 - '../src/errors.c', 33 - '../src/stack.c', 34 - '../src/gc.c', 35 - '../src/repl.c', 36 - '../src/runtime.c', 37 - '../src/snapshot.c', 38 - '../src/esm/remote.c', 39 - ) + files(module_files) 40 - 41 - include = include_directories('../include') 42 - build_include = include_directories('.') 43 - strip_include = include_directories('../src/strip') 23 + ).stdout().strip().split()) 44 24 45 25 libant_core = static_library( 46 26 'ant_core', 47 27 lib_sources + [snapshot_h], 48 - include_directories: [ 49 - include, 50 - build_include, 51 - version_include, 52 - strip_include 53 - ], 28 + include_directories: include, 54 29 dependencies: ant_deps + [oxc_dep], 55 30 ) 56 31 ··· 58 33 libant_core_lto = static_library( 59 34 'ant_core_lto', 60 35 lib_sources + [snapshot_h], 61 - include_directories: [ 62 - include, 63 - build_include, 64 - version_include, 65 - strip_include 66 - ], 36 + include_directories: include, 67 37 dependencies: ant_deps + [oxc_dep], 68 38 c_args: ['-flto'], 69 39 ) ··· 83 53 84 54 pkg.generate( 85 55 name: 'libant', 86 - description: 'Ant JavaScript Engine - Embeddable JS runtime', 87 - version: version_conf.get('ANT_VERSION'), 56 + version: ant_version, 57 + description: 'javascript for ๐Ÿœ\'s', 88 58 extra_cflags: ['-I${includedir}/ant'], 89 59 libraries: ['-L${libdir}', '-lant'] + pkg_libs 90 60 ) 91 61 92 62 custom_target( 93 63 'ant_header', 94 - input: [config_h], 95 64 output: 'libant.h', 96 65 command: [ 97 66 'bash', meson.project_source_root() / 'scripts' / 'header.sh', 98 - '@INPUT0@', '@OUTPUT@' 67 + '@OUTPUT@', ant_version, timestamp, git_hash, target_triple, 99 68 ], 100 69 build_by_default: true, 101 70 build_always_stale: true
+17 -10
libant/scripts/header.sh
··· 1 1 #!/bin/bash 2 2 set -e 3 - 4 3 . "$(dirname "$0")/common.sh" 5 4 6 - CONFIG_H="$1" 7 - OUTPUT="$2" 5 + OUTPUT="$1" 6 + ANT_VERSION="$2" 7 + ANT_BUILD_TIMESTAMP="$3" 8 + ANT_GIT_HASH="$4" 9 + ANT_TARGET_TRIPLE="$5" 8 10 INCLUDE_DIR="$ROOT_DIR/include" 9 11 10 - if [ -z "$CONFIG_H" ] || [ -z "$OUTPUT" ]; then 11 - echo "Usage: $0 <config.h> <output.h>" 12 + if [ -z "$OUTPUT" ] || [ -z "$ANT_VERSION" ]; then 13 + echo "Usage: $0 <output.h> <version> <timestamp> <git_hash> <target_triple>" 12 14 exit 1 13 15 fi 14 16 15 17 VENDOR_DIR="$SCRIPT_DIR/vendor" 16 18 17 19 HEADERS=( 18 - "config.h:$CONFIG_H" 19 20 "common.h:$INCLUDE_DIR/common.h" 20 21 "types.h:$INCLUDE_DIR/types.h" 21 22 "gc.h:$INCLUDE_DIR/gc.h" ··· 41 42 HEADERS+=("$name:$f") 42 43 done 43 44 44 - cat > "$OUTPUT" << 'EOF' 45 + cat > "$OUTPUT" << EOF 45 46 /* 46 47 * Ant JavaScript Engine 47 48 * https://github.com/themackabu/ant ··· 81 82 82 83 /* forward declarations */ 83 84 struct arg_file; 85 + 86 + /* === metadata === */ 87 + #define ANT_VERSION "$ANT_VERSION" 88 + #define ANT_BUILD_TIMESTAMP $ANT_BUILD_TIMESTAMP 89 + #define ANT_GIT_HASH "$ANT_GIT_HASH" 90 + #define ANT_TARGET_TRIPLE "$ANT_TARGET_TRIPLE" 84 91 85 92 EOF 86 93 ··· 100 107 continue 101 108 fi 102 109 103 - if [[ "$line" =~ ^[[:space:]]*#[[:space:]]*include[[:space:]]+\"(config\.h|common\.h|gc.\h|types\.h|compat\.h|ant\.h|utils\.h|arena\.h|runtime\.h|internal\.h)\" ]]; then 110 + if [[ "$line" =~ ^[[:space:]]*#[[:space:]]*include[[:space:]]+\"(metadata\.h|common\.h|gc.\h|types\.h|compat\.h|ant\.h|utils\.h|arena\.h|runtime\.h|internal\.h)\" ]]; then 104 111 continue 105 112 fi 106 113 if [[ "$line" =~ ^[[:space:]]*#[[:space:]]*include[[:space:]]+\"esm/ ]]; then ··· 110 117 continue 111 118 fi 112 119 113 - if [[ "$line" =~ ^[[:space:]]*#[[:space:]]*include[[:space:]]+\<(config|common|uv|types|utarray|uthash|minicoro)\.h\> ]]; then 120 + if [[ "$line" =~ ^[[:space:]]*#[[:space:]]*include[[:space:]]+\<(metadata|common|uv|types|utarray|uthash|minicoro)\.h\> ]]; then 114 121 continue 115 122 fi 116 123 ··· 122 129 123 130 echo "#endif /* LIBANT_H */" >> "$OUTPUT" 124 131 125 - echo "Generated $OUTPUT" 132 + echo "Generated $OUTPUT"
+1 -6
meson.build
··· 15 15 src_root = meson.project_source_root() 16 16 include = include_directories('include') 17 17 18 - core_files = files(run_command( 19 - python, files('meson/sources.py'), files('sources.json'), 'core', 20 - check: true 21 - ).stdout().strip().split()) 18 + subdir('meson') 22 19 23 20 lib_sources = files(run_command( 24 21 python, files('meson/sources.py'), files('sources.json'), 'engine', 25 22 check: true 26 23 ).stdout().strip().split()) 27 - 28 - subdir('meson') 29 24 30 25 libant = static_library( 31 26 'ant',
+1
meson/deps/meson.build
··· 64 64 '-Wno-sometimes-uninitialized', 65 65 '-Wno-cast-function-type-mismatch', 66 66 '-Wno-missing-field-initializers', 67 + '-I' + src_root / 'vendor' / 'libuv-v1.52.0' / 'include', 67 68 ] 68 69 69 70 if cmake_prefix != ''
+5
meson/snapshot/meson.build
··· 1 1 node = find_program('node', required: true) 2 2 3 + core_files = files(run_command( 4 + python, files('../sources.py'), src_root / 'sources.json', 'core', src_root, 5 + check: true 6 + ).stdout().strip().split()) 7 + 3 8 snapshot_h = custom_target( 4 9 'snapshot', 5 10 input: core_files,
+7 -4
meson/sources.py
··· 1 - import sys, glob, json 1 + import sys, os, glob, json 2 2 3 3 data = json.load(open(sys.argv[1])) 4 4 group = data[sys.argv[2]] 5 + base = sys.argv[3] if len(sys.argv) > 3 else '' 5 6 6 7 matched = set() 7 8 for p in group['patterns']: 8 - matched.update(glob.glob(p, recursive=True)) 9 + full = os.path.join(base, p) if base else p 10 + matched.update(glob.glob(full, recursive=True)) 9 11 10 - matched -= set(group.get('exclude', [])) 11 - print('\n'.join(sorted(matched))) 12 + excluded = set(os.path.join(base, e) if base else e for e in group.get('exclude', [])) 13 + matched -= excluded 14 + print('\n'.join(sorted(matched)))
+4
sources.json
··· 3 3 "patterns": ["src/*.c", "src/esm/*.c", "src/cli/*.c", "src/modules/*.c"], 4 4 "exclude": ["src/main.c"] 5 5 }, 6 + "library": { 7 + "patterns": ["src/*.c", "src/esm/*.c", "src/modules/*.c"], 8 + "exclude": ["src/main.c"] 9 + }, 6 10 "core": { 7 11 "patterns": ["src/core/**/*.ts"], 8 12 "exclude": []