-
Notifications
You must be signed in to change notification settings - Fork 2
/
BUILD.bazel
66 lines (57 loc) · 1.66 KB
/
BUILD.bazel
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
load("//lib:lib.bzl", "package_lib")
load("//toolchains:utils.bzl", "no_error")
load("//toolchains/make:configure.bzl", "configure_make_lib")
load(":package.bzl", "NAME")
package(default_visibility = ["//:__subpackages__"])
package_lib()
BUILD_DEPS_K8 = [
"//lib/nasm:runtime",
]
CONFIGURE_OPTIONS = [
"--disable-cli",
"--enable-pic",
"--enable-static",
]
CONFIGURE_OPTIONS_K8 = CONFIGURE_OPTIONS + [
"--host=x86_64-pc-linux-gnu",
]
CONFIGURE_OPTIONS_WASM = CONFIGURE_OPTIONS + [
"--host=wasm32-unknown-emscripten",
'--extra-cflags="{}"'.format(
no_error([
# keep sorted
"empty-body",
"unused-but-set-variable",
]),
),
"--disable-asm",
]
DBG_ON = ["--enable-debug"]
OPT_ON = ["--enable-lto"]
configure_make_lib(
name = NAME,
build_data = {
"//config:wasm": [],
"//conditions:default": BUILD_DEPS_K8,
},
configure_options = select({
"//config:k8_dbg": CONFIGURE_OPTIONS_K8 + DBG_ON,
"//config:k8_fastbuild": CONFIGURE_OPTIONS_K8,
"//config:k8_opt": CONFIGURE_OPTIONS_K8 + OPT_ON,
"//config:wasm_dbg": CONFIGURE_OPTIONS_WASM + DBG_ON,
"//config:wasm_fastbuild": CONFIGURE_OPTIONS_WASM,
"//config:wasm_opt": CONFIGURE_OPTIONS_WASM + OPT_ON,
}),
copts = select({
"//config:wasm": ["-sSHARED_MEMORY"], # for -pthread support
"//conditions:default": [],
}),
env = {
"//config:wasm": {},
"//conditions:default": {
"AS": "$(execpath //lib/nasm:runtime)/bin/nasm",
"ASFLAGS": "", # override toolchain flags
},
},
env_override = ["ASFLAGS"],
)