blob: 1549357a554bc05bcfb4c6e9b3b39c7c764c367c (
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
|
include meson.inc
inherit nativesdk
inherit siteinfo
SRC_URI += "file://meson-setup.py \
file://meson-wrapper"
def meson_endian(prefix, d):
arch, os = d.getVar(prefix + "_ARCH"), d.getVar(prefix + "_OS")
sitedata = siteinfo_data_for_machine(arch, os, d)
if "endian-little" in sitedata:
return "little"
elif "endian-big" in sitedata:
return "big"
else:
bb.fatal("Cannot determine endianism for %s-%s" % (arch, os))
MESON_TOOLCHAIN_ARGS = "${BUILDSDK_CC_ARCH}${TOOLCHAIN_OPTIONS}"
MESON_C_ARGS = "${MESON_TOOLCHAIN_ARGS} ${BUILDSDK_CFLAGS}"
MESON_CPP_ARGS = "${MESON_TOOLCHAIN_ARGS} ${BUILDSDK_CXXFLAGS}"
MESON_LINK_ARGS = "${MESON_TOOLCHAIN_ARGS} ${BUILDSDK_LDFLAGS}"
# The cross file logic is similar but not identical to that in meson.bbclass,
# since it's generating for an SDK rather than a cross-compile. Important
# differences are:
# - We can't set vars like CC, CXX, etc. yet because they will be filled in with
# real paths by meson-setup.sh when the SDK is extracted.
# - Some overrides aren't needed, since the SDK injects paths that take care of
# them.
do_install_append() {
install -d ${D}${datadir}/meson
cat >${D}${datadir}/meson/meson.cross.template <<EOF
[binaries]
c = @CC
cpp = @CXX
ar = @AR
nm = @NM
ld = @LD
strip = @STRIP
pkgconfig = 'pkg-config'
[properties]
needs_exe_wrapper = true
c_args = @CFLAGS
c_link_args = @LDFLAGS
cpp_args = @CPPFLAGS
cpp_link_args = @LDFLAGS
[host_machine]
system = '${SDK_OS}'
cpu_family = '${SDK_ARCH}'
cpu = '${SDK_ARCH}'
endian = '${@meson_endian("SDK", d)}'
EOF
install -d ${D}${SDKPATHNATIVE}/post-relocate-setup.d
install -m 0755 ${WORKDIR}/meson-setup.py ${D}${SDKPATHNATIVE}/post-relocate-setup.d/
# We need to wrap the real meson with a thin env setup wrapper.
mv ${D}${bindir}/meson ${D}${bindir}/meson.real
install -m 0755 ${WORKDIR}/meson-wrapper ${D}${bindir}/meson
}
RDEPENDS_${PN} += "\
nativesdk-ninja \
nativesdk-python3 \
nativesdk-python3-setuptools \
"
FILES_${PN} += "${datadir}/meson ${SDKPATHNATIVE}"
|