All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anuj Mittal <anuj.mittal@intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [honister][PATCH 14/24] meson: install native file in sdk
Date: Wed,  3 Nov 2021 00:44:02 +0800	[thread overview]
Message-ID: <2ea62c23bf9d37e46d3cd9aa7527c535994d4b77.1635871270.git.anuj.mittal@intel.com> (raw)
In-Reply-To: <cover.1635871270.git.anuj.mittal@intel.com>

From: "Hsia-Jun(Randy) Li" <randy.li@synaptics.com>

Without a native environment file, find_program() can't
locate the native program inside SDK.

That stops wayland compositor using wayland scanner.

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>
---
 .../meson/meson/meson-setup.py                |  8 ++++
 .../meson/meson/meson-wrapper                 |  1 +
 .../meson/nativesdk-meson_0.58.1.bb           | 46 +++++++++++++++++++
 3 files changed, 55 insertions(+)

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.58.1.bb b/meta/recipes-devtools/meson/nativesdk-meson_0.58.1.bb
index 5657397ddc..7b77041c7e 100644
--- a/meta/recipes-devtools/meson/nativesdk-meson_0.58.1.bb
+++ b/meta/recipes-devtools/meson/nativesdk-meson_0.58.1.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 <<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
 [binaries]
 c = @CC
-- 
2.31.1



  parent reply	other threads:[~2021-11-02 16:47 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-02 16:43 [honister][PATCH 00/24] Review request Anuj Mittal
2021-11-02 16:43 ` [honister][PATCH 01/24] python3-setuptools: _distutils/sysconfig fix Anuj Mittal
2021-11-02 16:43 ` [honister][PATCH 02/24] waffle: convert to git, website is down Anuj Mittal
2021-11-02 16:43 ` [honister][PATCH 03/24] strace: show test suite log on failure Anuj Mittal
2021-11-02 16:43 ` [honister][PATCH 04/24] classes/populate_sdk_base: Add setscene tasks Anuj Mittal
2021-11-02 16:43 ` [honister][PATCH 05/24] staging: Fix autoconf-native rebuild failure Anuj Mittal
2021-11-02 16:43 ` [honister][PATCH 06/24] linux-yocto/5.10: update to v5.10.73 Anuj Mittal
2021-11-02 16:43 ` [honister][PATCH 07/24] linux-yocto/5.14: update to v5.14.12 Anuj Mittal
2021-11-02 16:43 ` [honister][PATCH 08/24] linux-yocto/5.14: update to v5.14.13 Anuj Mittal
2021-11-02 16:43 ` [honister][PATCH 09/24] linux-yocto/5.10: update to v5.10.74 Anuj Mittal
2021-11-02 16:43 ` [honister][PATCH 10/24] linux-yocto/5.14: common-pc: enable CONFIG_ATA_PIIX as built-in Anuj Mittal
2021-11-02 16:43 ` [honister][PATCH 11/24] linux-yocto/5.14: update to v5.14.14 Anuj Mittal
2021-11-02 16:44 ` [honister][PATCH 12/24] linux-yocto/5.10: update to v5.10.75 Anuj Mittal
2021-11-02 16:44 ` [honister][PATCH 13/24] meson: move lang args to the right section Anuj Mittal
2021-11-02 16:44 ` Anuj Mittal [this message]
2021-11-02 16:44 ` [honister][PATCH 15/24] go.bbclass: Allow adding parameters to go ldflags Anuj Mittal
2021-11-02 16:44 ` [honister][PATCH 16/24] stress-ng: convert to git, website is down Anuj Mittal
2021-11-02 16:44 ` [honister][PATCH 17/24] tzdata: upgrade 2021a -> 2021d Anuj Mittal
2021-11-02 16:44 ` [honister][PATCH 18/24] tzdata: update 2021d -> 2021e Anuj Mittal
2021-11-02 16:44 ` [honister][PATCH 19/24] spdx.py: Add annotation to relationship Anuj Mittal
2021-11-02 16:44 ` [honister][PATCH 20/24] create-spdx: add create_annotation function Anuj Mittal
2021-11-02 16:44 ` [honister][PATCH 21/24] create-spdx: cross recipes are native also Anuj Mittal
2021-11-02 16:44 ` [honister][PATCH 22/24] oeqa/runtime/parselogs: modified drm error in common errors list Anuj Mittal
2021-11-02 16:44 ` [honister][PATCH 23/24] meson.bblcass: Remove empty egg-info directories before running meson Anuj Mittal
2021-11-02 16:44 ` [honister][PATCH 24/24] qemu.inc: " Anuj Mittal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2ea62c23bf9d37e46d3cd9aa7527c535994d4b77.1635871270.git.anuj.mittal@intel.com \
    --to=anuj.mittal@intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.