blob: 283043cf4bf803e1d53b62c4d6576fcdccd32612 (
plain)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
DEPENDS += "bazel-native \
openjdk-8-native \
"
BAZEL_OUTPUTBASE_DIR ?= "${WORKDIR}/bazel/output_base"
export BAZEL_ARGS="--output_user_root=${WORKDIR}/bazel/user_root \
--output_base=${BAZEL_OUTPUTBASE_DIR} \
--bazelrc=${S}/bazelrc \
"
export JAVA_HOME="${RECIPE_SYSROOT_NATIVE}/usr/lib/jvm/openjdk-8-native"
do_prepare_recipe_sysroot[postfuncs] += "do_install_bazel"
do_install_bazel() {
install -m 0755 ${STAGING_BINDIR_NATIVE}/bazel ${S}
create_cmdline_wrapper ${S}/bazel \$BAZEL_ARGS
zip -A ${S}/bazel.real
}
def bazel_get_flags(d):
flags = ""
for i in d.getVar("CC").split()[1:]:
flags += "--conlyopt=%s --cxxopt=%s --linkopt=%s " % (i, i, i)
for i in d.getVar("CFLAGS").split():
if i == "-g":
continue
flags += "--conlyopt=%s " % i
for i in d.getVar("BUILD_CFLAGS").split():
flags += "--host_conlyopt=%s " % i
for i in d.getVar("CXXFLAGS").split():
if i == "-g":
continue
flags += "--cxxopt=%s " % i
for i in d.getVar("BUILD_CXXFLAGS").split():
flags += "--host_cxxopt=%s " % i
for i in d.getVar("CPPFLAGS").split():
if i == "-g":
continue
flags += "--conlyopt=%s --cxxopt=%s " % (i, i)
for i in d.getVar("BUILD_CPPFLAGS").split():
flags += "--host_conlyopt=%s --host_cxxopt=%s " % (i, i)
for i in d.getVar("LDFLAGS").split():
if i == "-Wl,--as-needed":
continue
flags += "--linkopt=%s " % i
for i in d.getVar("BUILD_LDFLAGS").split():
if i == "-Wl,--as-needed":
continue
flags += "--host_linkopt=%s " % i
for i in d.getVar("TOOLCHAIN_OPTIONS").split():
if i == "-Wl,--as-needed":
continue
flags += "--linkopt=%s " % i
return flags
bazel_do_configure () {
cat > "${S}/bazelrc" <<-EOF
build --verbose_failures
build --spawn_strategy=standalone --genrule_strategy=standalone
build --jobs=${@oe.utils.cpu_count()}
test --verbose_failures --verbose_test_summary
test --spawn_strategy=standalone --genrule_strategy=standalone
build --linkopt=-Wl,-latomic
build --linkopt=-Wl,--no-as-needed
build --host_linkopt=-Wl,--no-as-needed
build --strip=never
fetch --distdir=${DL_DIR}
build --distdir=${DL_DIR}
EOF
}
bazel_do_configure_append_class-target () {
cat >> "${S}/bazelrc" <<-EOF
# FLAGS
build ${@bazel_get_flags(d)}
EOF
sed -i "s:${WORKDIR}:${BAZEL_OUTPUTBASE_DIR}/external/yocto_compiler:g" ${S}/bazelrc
}
EXPORT_FUNCTIONS do_configure
|