Skip to content

Commit ffbf324

Browse files
committed
Installing FFI
1 parent f20ebd0 commit ffbf324

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

tasks/cpython.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ def build(ctx, clean=False, noconf=False, nobuild=False):
8787
"--disable-ipv6",
8888
"--disable-shared",
8989
"--prefix={}".format(INSTALL_DIR),
90+
"--with-system-ffi",
9091
]
9192
)
9293

tasks/ffi.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from tasks.env import THIRD_PARTY_DIR, USABLE_CPUS, PROJ_ROOT
1414

1515
LIBFFI_DIR = join(THIRD_PARTY_DIR, "libffi")
16+
LIBFFI_INSTALL_DIR = join(LIBFFI_DIR, "wasm32-unknown-wasi")
1617

1718

1819
@task(default=True)
@@ -46,12 +47,19 @@ def build(ctx, clean=False):
4647
run("make install", shell=True, check=True, cwd=LIBFFI_DIR)
4748

4849
# Ensure the lib is copied into place
49-
src_lib = join(LIBFFI_DIR, "wasm32-unknown-wasi", ".libs", "libffi.a")
50+
src_lib = join(LIBFFI_INSTALL_DIR, ".libs", "libffi.a")
5051
dest_lib = join(WASM_LIB_INSTALL, "libffi.a")
5152
print("Copying {} to {}".format(src_lib, dest_lib))
5253
run("cp {} {}".format(src_lib, dest_lib), shell=True, check=True)
5354

55+
# Copy header files
56+
header_src = join(LIBFFI_INSTALL_DIR, "include", "*")
57+
header_dest = join(WASM_SYSROOT, "include")
58+
print("Copying {} to {}".format(header_src, header_dest))
59+
run("cp {} {}".format(header_src, header_dest), shell=True, check=True)
60+
5461
# Copy imports into place
5562
src_imports = join(PROJ_ROOT, "libffi.imports")
5663
dest_imports = join(WASM_LIB_INSTALL, "libffi.imports")
64+
print("Copying {} to {}".format(src_imports, dest_imports))
5765
run("cp {} {}".format(src_imports, dest_imports), check=True, shell=True)

0 commit comments

Comments
 (0)