Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 1 | include meson.inc |
| 2 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 3 | inherit siteinfo |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 4 | inherit nativesdk |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 5 | |
| 6 | SRC_URI += "file://meson-setup.py \ |
| 7 | file://meson-wrapper" |
| 8 | |
| 9 | def meson_endian(prefix, d): |
| 10 | arch, os = d.getVar(prefix + "_ARCH"), d.getVar(prefix + "_OS") |
| 11 | sitedata = siteinfo_data_for_machine(arch, os, d) |
| 12 | if "endian-little" in sitedata: |
| 13 | return "little" |
| 14 | elif "endian-big" in sitedata: |
| 15 | return "big" |
| 16 | else: |
| 17 | bb.fatal("Cannot determine endianism for %s-%s" % (arch, os)) |
| 18 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 19 | # The cross file logic is similar but not identical to that in meson.bbclass, |
| 20 | # since it's generating for an SDK rather than a cross-compile. Important |
| 21 | # differences are: |
| 22 | # - We can't set vars like CC, CXX, etc. yet because they will be filled in with |
| 23 | # real paths by meson-setup.sh when the SDK is extracted. |
| 24 | # - Some overrides aren't needed, since the SDK injects paths that take care of |
| 25 | # them. |
| 26 | do_install_append() { |
| 27 | install -d ${D}${datadir}/meson |
| 28 | cat >${D}${datadir}/meson/meson.cross.template <<EOF |
| 29 | [binaries] |
| 30 | c = @CC |
| 31 | cpp = @CXX |
| 32 | ar = @AR |
| 33 | nm = @NM |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 34 | strip = @STRIP |
| 35 | pkgconfig = 'pkg-config' |
| 36 | |
| 37 | [properties] |
| 38 | needs_exe_wrapper = true |
| 39 | c_args = @CFLAGS |
| 40 | c_link_args = @LDFLAGS |
| 41 | cpp_args = @CPPFLAGS |
| 42 | cpp_link_args = @LDFLAGS |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 43 | sys_root = @OECORE_TARGET_SYSROOT |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 44 | |
| 45 | [host_machine] |
| 46 | system = '${SDK_OS}' |
| 47 | cpu_family = '${SDK_ARCH}' |
| 48 | cpu = '${SDK_ARCH}' |
| 49 | endian = '${@meson_endian("SDK", d)}' |
| 50 | EOF |
| 51 | |
| 52 | install -d ${D}${SDKPATHNATIVE}/post-relocate-setup.d |
| 53 | install -m 0755 ${WORKDIR}/meson-setup.py ${D}${SDKPATHNATIVE}/post-relocate-setup.d/ |
| 54 | |
| 55 | # We need to wrap the real meson with a thin env setup wrapper. |
| 56 | mv ${D}${bindir}/meson ${D}${bindir}/meson.real |
| 57 | install -m 0755 ${WORKDIR}/meson-wrapper ${D}${bindir}/meson |
| 58 | } |
| 59 | |
| 60 | RDEPENDS_${PN} += "\ |
| 61 | nativesdk-ninja \ |
| 62 | nativesdk-python3 \ |
| 63 | nativesdk-python3-setuptools \ |
| 64 | " |
| 65 | |
| 66 | FILES_${PN} += "${datadir}/meson ${SDKPATHNATIVE}" |