mirror of
https://git.yoctoproject.org/poky
synced 2026-06-03 01:40:07 +00:00
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: 2ea62c23bf9d37e46d3cd9aa7527c535994d4b77) Signed-off-by: Hsia-Jun(Randy) Li <randy.li@synaptics.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit c6aed1084006727e3baf70ab9d1f70d9d2d6c01f) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
ae397dcedc
commit
1eb9a963ff
@@ -27,9 +27,17 @@ except KeyError:
|
|||||||
|
|
||||||
template_file = os.path.join(sysroot, 'usr/share/meson/meson.cross.template')
|
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"])
|
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:
|
with open(template_file) as in_file:
|
||||||
template = in_file.read()
|
template = in_file.read()
|
||||||
output = Template(template).substitute(Environ())
|
output = Template(template).substitute(Environ())
|
||||||
with open(cross_file, "w") as out_file:
|
with open(cross_file, "w") as out_file:
|
||||||
out_file.write(output)
|
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)
|
||||||
|
|||||||
@@ -11,4 +11,5 @@ unset CC CXX CPP LD AR NM STRIP
|
|||||||
|
|
||||||
exec "$OECORE_NATIVE_SYSROOT/usr/bin/meson.real" \
|
exec "$OECORE_NATIVE_SYSROOT/usr/bin/meson.real" \
|
||||||
--cross-file "${OECORE_NATIVE_SYSROOT}/usr/share/meson/${TARGET_PREFIX}meson.cross" \
|
--cross-file "${OECORE_NATIVE_SYSROOT}/usr/share/meson/${TARGET_PREFIX}meson.cross" \
|
||||||
|
--native-file "${OECORE_NATIVE_SYSROOT}/usr/share/meson/meson.native" \
|
||||||
"$@"
|
"$@"
|
||||||
|
|||||||
@@ -13,8 +13,54 @@ SRC_URI += "file://meson-setup.py \
|
|||||||
# real paths by meson-setup.sh when the SDK is extracted.
|
# 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
|
# - Some overrides aren't needed, since the SDK injects paths that take care of
|
||||||
# them.
|
# 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() {
|
do_install:append() {
|
||||||
install -d ${D}${datadir}/meson
|
install -d ${D}${datadir}/meson
|
||||||
|
|
||||||
|
cat >${D}${datadir}/meson/meson.native.template <<EOF
|
||||||
|
[binaries]
|
||||||
|
c = ${@meson_array('BUILD_CC', d)}
|
||||||
|
cpp = ${@meson_array('BUILD_CXX', d)}
|
||||||
|
ar = ${@meson_array('BUILD_AR', d)}
|
||||||
|
nm = ${@meson_array('BUILD_NM', d)}
|
||||||
|
strip = ${@meson_array('BUILD_STRIP', d)}
|
||||||
|
readelf = ${@meson_array('BUILD_READELF', d)}
|
||||||
|
pkgconfig = 'pkg-config-native'
|
||||||
|
|
||||||
|
[built-in options]
|
||||||
|
c_args = ['-isystem@{OECORE_NATIVE_SYSROOT}${includedir_native}' , ${@var_list2str('BUILD_OPTIMIZATION', d)}]
|
||||||
|
c_link_args = ${@generate_native_link_template(d)}
|
||||||
|
cpp_args = ['-isystem@{OECORE_NATIVE_SYSROOT}${includedir_native}' , ${@var_list2str('BUILD_OPTIMIZATION', d)}]
|
||||||
|
cpp_link_args = ${@generate_native_link_template(d)}
|
||||||
|
[properties]
|
||||||
|
sys_root = '@OECORE_NATIVE_SYSROOT'
|
||||||
|
EOF
|
||||||
|
|
||||||
cat >${D}${datadir}/meson/meson.cross.template <<EOF
|
cat >${D}${datadir}/meson/meson.cross.template <<EOF
|
||||||
[binaries]
|
[binaries]
|
||||||
c = @CC
|
c = @CC
|
||||||
|
|||||||
Reference in New Issue
Block a user