From 4311fe03247c605bdb83706749203d553944a35e Mon Sep 17 00:00:00 2001 From: "Hsia-Jun(Randy) Li" Date: Mon, 25 Oct 2021 11:37:44 +0800 Subject: meson: install native file in sdk Without a native environment file, find_program() can't locate the native program inside SDK. That stops wayland compositor using wayland scanner. (From OE-Core rev: c6aed1084006727e3baf70ab9d1f70d9d2d6c01f) Signed-off-by: Hsia-Jun(Randy) Li Signed-off-by: Alexandre Belloni Signed-off-by: Richard Purdie --- meta/recipes-devtools/meson/meson/meson-setup.py | 8 ++++ meta/recipes-devtools/meson/meson/meson-wrapper | 1 + .../meson/nativesdk-meson_0.59.2.bb | 46 ++++++++++++++++++++++ 3 files changed, 55 insertions(+) (limited to 'meta/recipes-devtools/meson') diff --git a/meta/recipes-devtools/meson/meson/meson-setup.py b/meta/recipes-devtools/meson/meson/meson-setup.py index 7ac4e3ad47..daaa551de2 100755 --- a/meta/recipes-devtools/meson/meson/meson-setup.py +++ b/meta/recipes-devtools/meson/meson/meson-setup.py @@ -27,9 +27,17 @@ except KeyError: template_file = os.path.join(sysroot, 'usr/share/meson/meson.cross.template') cross_file = os.path.join(sysroot, 'usr/share/meson/%smeson.cross' % os.environ["TARGET_PREFIX"]) +native_template_file = os.path.join(sysroot, 'usr/share/meson/meson.native.template') +native_file = os.path.join(sysroot, 'usr/share/meson/meson.native') with open(template_file) as in_file: template = in_file.read() output = Template(template).substitute(Environ()) with open(cross_file, "w") as out_file: out_file.write(output) + +with open(native_template_file) as in_file: + template = in_file.read() + output = Template(template).substitute({'OECORE_NATIVE_SYSROOT': os.environ['OECORE_NATIVE_SYSROOT']}) + with open(native_file, "w") as out_file: + out_file.write(output) diff --git a/meta/recipes-devtools/meson/meson/meson-wrapper b/meta/recipes-devtools/meson/meson/meson-wrapper index d4ffe60f9a..d4b5187f8d 100755 --- a/meta/recipes-devtools/meson/meson/meson-wrapper +++ b/meta/recipes-devtools/meson/meson/meson-wrapper @@ -11,4 +11,5 @@ unset CC CXX CPP LD AR NM STRIP exec "$OECORE_NATIVE_SYSROOT/usr/bin/meson.real" \ --cross-file "${OECORE_NATIVE_SYSROOT}/usr/share/meson/${TARGET_PREFIX}meson.cross" \ + --native-file "${OECORE_NATIVE_SYSROOT}/usr/share/meson/meson.native" \ "$@" diff --git a/meta/recipes-devtools/meson/nativesdk-meson_0.59.2.bb b/meta/recipes-devtools/meson/nativesdk-meson_0.59.2.bb index 5657397ddc..7b77041c7e 100644 --- a/meta/recipes-devtools/meson/nativesdk-meson_0.59.2.bb +++ b/meta/recipes-devtools/meson/nativesdk-meson_0.59.2.bb @@ -13,8 +13,54 @@ SRC_URI += "file://meson-setup.py \ # 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. +def var_list2str(var, d): + items = d.getVar(var).split() + return items[0] if len(items) == 1 else ', '.join(repr(s) for s in items) + +def generate_native_link_template(d): + val = ['-L@{OECORE_NATIVE_SYSROOT}${libdir_native}', + '-L@{OECORE_NATIVE_SYSROOT}${base_libdir_native}', + '-Wl,-rpath-link,@{OECORE_NATIVE_SYSROOT}${libdir_native}', + '-Wl,-rpath-link,@{OECORE_NATIVE_SYSROOT}${base_libdir_native}', + '-Wl,--allow-shlib-undefined' + ] + build_arch = d.getVar('BUILD_ARCH') + if 'x86_64' in build_arch: + loader = 'ld-linux-x86-64.so.2' + elif 'i686' in build_arch: + loader = 'ld-linux.so.2' + elif 'aarch64' in build_arch: + loader = 'ld-linux-aarch64.so.1' + elif 'ppc64le' in build_arch: + loader = 'ld64.so.2' + + if loader: + val += ['-Wl,--dynamic-linker=@{OECORE_NATIVE_SYSROOT}${base_libdir_native}/' + loader] + + return repr(val) + do_install:append() { install -d ${D}${datadir}/meson + + cat >${D}${datadir}/meson/meson.native.template <${D}${datadir}/meson/meson.cross.template <