blob: 0e76cc78f85667e6038936bc15d72aec76a79e94 [file] [log] [blame]
Brad Bishop19323692019-04-05 15:28:33 -04001include meson.inc
2
William A. Kennington IIIac69b482021-06-02 12:28:27 -07003inherit meson-routines
Andrew Geisslerd1e89492021-02-12 15:35:20 -06004inherit nativesdk
Brad Bishop19323692019-04-05 15:28:33 -04005
6SRC_URI += "file://meson-setup.py \
7 file://meson-wrapper"
8
Brad Bishop19323692019-04-05 15:28:33 -04009# The cross file logic is similar but not identical to that in meson.bbclass,
10# since it's generating for an SDK rather than a cross-compile. Important
11# differences are:
12# - We can't set vars like CC, CXX, etc. yet because they will be filled in with
13# real paths by meson-setup.sh when the SDK is extracted.
14# - Some overrides aren't needed, since the SDK injects paths that take care of
15# them.
Patrick Williams213cb262021-08-07 19:21:33 -050016do_install:append() {
Brad Bishop19323692019-04-05 15:28:33 -040017 install -d ${D}${datadir}/meson
18 cat >${D}${datadir}/meson/meson.cross.template <<EOF
19[binaries]
20c = @CC
21cpp = @CXX
22ar = @AR
23nm = @NM
Brad Bishop19323692019-04-05 15:28:33 -040024strip = @STRIP
25pkgconfig = 'pkg-config'
26
27[properties]
28needs_exe_wrapper = true
29c_args = @CFLAGS
30c_link_args = @LDFLAGS
31cpp_args = @CPPFLAGS
32cpp_link_args = @LDFLAGS
Andrew Geisslerd1e89492021-02-12 15:35:20 -060033sys_root = @OECORE_TARGET_SYSROOT
Brad Bishop19323692019-04-05 15:28:33 -040034
35[host_machine]
36system = '${SDK_OS}'
William A. Kennington IIIac69b482021-06-02 12:28:27 -070037cpu_family = '${@meson_cpu_family("SDK_ARCH", d)}'
Brad Bishop19323692019-04-05 15:28:33 -040038cpu = '${SDK_ARCH}'
39endian = '${@meson_endian("SDK", d)}'
40EOF
41
42 install -d ${D}${SDKPATHNATIVE}/post-relocate-setup.d
43 install -m 0755 ${WORKDIR}/meson-setup.py ${D}${SDKPATHNATIVE}/post-relocate-setup.d/
44
45 # We need to wrap the real meson with a thin env setup wrapper.
46 mv ${D}${bindir}/meson ${D}${bindir}/meson.real
47 install -m 0755 ${WORKDIR}/meson-wrapper ${D}${bindir}/meson
48}
49
Patrick Williams213cb262021-08-07 19:21:33 -050050RDEPENDS:${PN} += "\
Brad Bishop19323692019-04-05 15:28:33 -040051 nativesdk-ninja \
52 nativesdk-python3 \
53 nativesdk-python3-setuptools \
54 "
55
Patrick Williams213cb262021-08-07 19:21:33 -050056FILES:${PN} += "${datadir}/meson ${SDKPATHNATIVE}"