-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigure.py
More file actions
48 lines (36 loc) · 1.21 KB
/
configure.py
File metadata and controls
48 lines (36 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"""
This is the build configuration for zigcc-build to compile QuickJS as a Python extension module.
"""
import os
from typing import List, TypedDict
class ZigCcConfig(TypedDict):
sources: List[str]
include_dirs: List[str]
defines: List[str]
library_dirs: List[str]
libraries: List[str]
module_name: str
def configure(config: ZigCcConfig):
print("Configuring QuickJS build...")
qjs_root = "quickjs"
# Core QuickJS sources
qjs_sources = [
"libregexp.c",
"libunicode.c",
"cutils.c",
"quickjs-libc.c",
"dtoa.c",
]
# Use wrapper for quickjs.c to ensure stddef.h is included
config["sources"].append("c-sources/quickjs_wrapper.c")
for src in qjs_sources:
config["sources"].append(os.path.join(qjs_root, src))
# Add binding source
config["sources"].append("c-sources/binding.c")
# Set module name to _quickjs (the extension)
config["module_name"] = "_quickjs"
config["include_dirs"].append(qjs_root)
# Standard QuickJS defines
config["defines"].append("_GNU_SOURCE")
config["defines"].append('CONFIG_VERSION="2025-09-13"')
config["defines"].append("CONFIG_BIGNUM")