forked from libapps/libapps-mirror
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild
More file actions
executable file
·52 lines (40 loc) · 1.52 KB
/
build
File metadata and controls
executable file
·52 lines (40 loc) · 1.52 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
49
50
51
52
#!/usr/bin/env python3
# Copyright 2019 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Build WASM libc shim package."""
import os
import shutil
import sys
FILESDIR = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, os.path.join(FILESDIR, "..", "bin"))
import ssh_client # pylint: disable=wrong-import-position
S = "%(workdir)s"
def src_compile(metadata):
"""Compile the source."""
tc = metadata["toolchain"]
shutil.rmtree(os.path.join(tc.incdir, "wassh-libc-sup"), ignore_errors=True)
ssh_client.emake(
f"OUTPUT={metadata['workdir']}", cwd=os.path.join(FILESDIR, "src")
)
def src_install(metadata):
"""Install the package."""
tc = metadata["toolchain"]
srcdir = os.path.join(FILESDIR, "include")
for root, _, files in os.walk(srcdir):
for header in files:
relsrcdir = os.path.relpath(root, srcdir)
targetdir = os.path.join(tc.incdir, "wassh-libc-sup", relsrcdir)
os.makedirs(targetdir, exist_ok=True)
ssh_client.copy(
os.path.join(root, header), os.path.join(targetdir, header)
)
ssh_client.copy(
os.path.join(metadata["workdir"], "libwassh.a"),
os.path.join(tc.libdir, "libwassh-libc-sup.a"),
)
ssh_client.copy(
os.path.join(FILESDIR, "src", "wassh.imports"),
os.path.join(tc.libdir, "wassh-libc-sup.imports"),
)
ssh_client.build_package(sys.modules[__name__], "wasm")