|
| 1 | +import {loadFile, writeFile} from "qjs:std" |
| 2 | + |
| 3 | +const cutils_c = loadFile("cutils.c") |
| 4 | +const cutils_h = loadFile("cutils.h") |
| 5 | +const libbf_c = loadFile("libbf.c") |
| 6 | +const libbf_h = loadFile("libbf.h") |
| 7 | +const libregexp_c = loadFile("libregexp.c") |
| 8 | +const libregexp_h = loadFile("libregexp.h") |
| 9 | +const libregexp_opcode_h = loadFile("libregexp-opcode.h") |
| 10 | +const libunicode_c = loadFile("libunicode.c") |
| 11 | +const libunicode_h = loadFile("libunicode.h") |
| 12 | +const libunicode_table_h = loadFile("libunicode-table.h") |
| 13 | +const list_h = loadFile("list.h") |
| 14 | +const quickjs_atom_h = loadFile("quickjs-atom.h") |
| 15 | +const quickjs_c = loadFile("quickjs.c") |
| 16 | +const quickjs_c_atomics_h = loadFile("quickjs-c-atomics.h") |
| 17 | +const quickjs_h = loadFile("quickjs.h") |
| 18 | +const quickjs_libc_c = loadFile("quickjs-libc.c") |
| 19 | +const quickjs_libc_h = loadFile("quickjs-libc.h") |
| 20 | +const quickjs_opcode_h = loadFile("quickjs-opcode.h") |
| 21 | + |
| 22 | +let source = "#if defined(CONFIG_QUICKJS_LIBC) && defined(__linux__) && !defined(_GNU_SOURCE)\n" |
| 23 | + + "#define _GNU_SOURCE\n" |
| 24 | + + "#endif\n" |
| 25 | + + quickjs_c_atomics_h |
| 26 | + + cutils_h |
| 27 | + + list_h |
| 28 | + + libbf_h |
| 29 | + + libunicode_h // exports lre_is_id_start, used by libregexp.h |
| 30 | + + libregexp_h |
| 31 | + + libunicode_table_h |
| 32 | + + quickjs_h |
| 33 | + + quickjs_c |
| 34 | + + cutils_c |
| 35 | + + libbf_c |
| 36 | + + libregexp_c |
| 37 | + + libunicode_c |
| 38 | + + "#ifdef CONFIG_QUICKJS_LIBC\n" |
| 39 | + + quickjs_libc_h |
| 40 | + + quickjs_libc_c |
| 41 | + + "#endif // CONFIG_QUICKJS_LIBC\n" |
| 42 | +source = source.replace(/#include "quickjs-atom.h"/g, quickjs_atom_h) |
| 43 | +source = source.replace(/#include "quickjs-opcode.h"/g, quickjs_opcode_h) |
| 44 | +source = source.replace(/#include "libregexp-opcode.h"/g, libregexp_opcode_h) |
| 45 | +source = source.replace(/#include "[^"]+"/g, "") |
| 46 | +writeFile("quickjs-amalgam.c", source) |
0 commit comments