openembedded-core.lists.openembedded.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Kanavin <alex.kanavin@gmail.com>
To: Hsia-Jun Li <randy.li@synaptics.com>
Cc: OE-core <openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH 2/2] [WIP]: meson: install native file in sdk
Date: Tue, 12 Oct 2021 12:49:30 +0200	[thread overview]
Message-ID: <CANNYZj9wu6gCuU5_4AU6ancy=i1sjwvtwLz9YLE87gmB9QkSFA@mail.gmail.com> (raw)
In-Reply-To: <20211012101233.49978-3-randy.li@synaptics.com>

[-- Attachment #1: Type: text/plain, Size: 5375 bytes --]

Can you add a nativesdk testcase for this please? Into
meta/lib/oeqa/sdk/cases/.

Alex

On Tue, 12 Oct 2021 at 12:13, Hsia-Jun Li <randy.li@synaptics.com> wrote:

> 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>
> ---
>  meta/classes/meson-routines.bbclass           |  4 ++
>  .../meson/meson/meson-setup.py                |  2 +
>  .../meson/meson/meson-wrapper                 |  1 +
>  .../meson/nativesdk-meson_0.59.1.bb           | 38 +++++++++++++++++++
>  4 files changed, 45 insertions(+)
>
> diff --git a/meta/classes/meson-routines.bbclass
> b/meta/classes/meson-routines.bbclass
> index be3aeedeba..a74a9916d8 100644
> --- a/meta/classes/meson-routines.bbclass
> +++ b/meta/classes/meson-routines.bbclass
> @@ -4,6 +4,10 @@ def meson_array(var, d):
>      items = d.getVar(var).split()
>      return repr(items[0] if len(items) == 1 else items)
>
> +def meson_list_str(var, d):
> +    items = d.getVar(var).split()
> +    return repr(items[0]) if len(items) == 1 else ', '.join(repr(s) for s
> in items)
> +
>  # Map our ARCH values to what Meson expects:
>  # http://mesonbuild.com/Reference-tables.html#cpu-families
>  def meson_cpu_family(var, d):
> diff --git a/meta/recipes-devtools/meson/meson/meson-setup.py
> b/meta/recipes-devtools/meson/meson/meson-setup.py
> index 7ac4e3ad47..4a0a967fef 100755
> --- a/meta/recipes-devtools/meson/meson/meson-setup.py
> +++ b/meta/recipes-devtools/meson/meson/meson-setup.py
> @@ -27,6 +27,8 @@ 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()
> 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.1.bb
> b/meta/recipes-devtools/meson/nativesdk-meson_0.59.1.bb
> index 5657397ddc..f537204a2d 100644
> --- a/meta/recipes-devtools/meson/nativesdk-meson_0.59.1.bb
> +++ b/meta/recipes-devtools/meson/nativesdk-meson_0.59.1.bb
> @@ -15,6 +15,44 @@ SRC_URI += "file://meson-setup.py \
>  #   them.
>  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}' ,
> ${@meson_list_str('BUILD_OPTIMIZATION', d)}]
> +c_link_args = ['-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',
> +               '-Wl,--dynamic-linker=' @OECORE_NATIVE_SYSROOT
> '${base_libdir_native}'
> +               '${@bb.utils.contains('BUILD_ARCH', 'x86_64',
> 'ld-linux-x86-64.so.2', '', d)}
> +                ${@bb.utils.contains('BUILD_ARCH', 'i686',
> 'ld-linux.so.2', '', d)}
> +                ${@bb.utils.contains('BUILD_ARCH', 'aarch64',
> 'ld-linux-aarch64.so.1', '', d)}'
> +]
> +cpp_args = ['-isystem@OECORE_NATIVE_SYSROOT' 'usr/include',
> ${@meson_list_str('BUILD_OPTIMIZATION', d)}]
> +cpp_link_args = ['-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',
> +               '-Wl,--dynamic-linker=' @OECORE_NATIVE_SYSROOT
> '${base_libdir_native}'
> +               '${@bb.utils.contains('BUILD_ARCH', 'x86_64',
> 'ld-linux-x86-64.so.2', '', d)}
> +                ${@bb.utils.contains('BUILD_ARCH', 'i686',
> 'ld-linux.so.2', '', d)}
> +                ${@bb.utils.contains('BUILD_ARCH', 'aarch64',
> 'ld-linux-aarch64.so.1', '', d)}'
> +]
> +[properties]
> +sys_root = @OECORE_NATIVE_SYSROOT
> +EOF
> +
>      cat >${D}${datadir}/meson/meson.cross.template <<EOF
>  [binaries]
>  c = @CC
> --
> 2.17.1
>
>

[-- Attachment #2: Type: text/html, Size: 7434 bytes --]

  reply	other threads:[~2021-10-12 10:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-12 10:12 [PATCH 0/2] meson: fix environmemt files in SDK Hsia-Jun Li
2021-10-12 10:12 ` [PATCH 1/2] meson: move lang args to the right section Hsia-Jun Li
2021-10-12 10:12 ` [PATCH 2/2] [WIP]: meson: install native file in sdk Hsia-Jun Li
2021-10-12 10:49   ` Alexander Kanavin [this message]
2021-10-12 11:23     ` Hsia-Jun Li

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='CANNYZj9wu6gCuU5_4AU6ancy=i1sjwvtwLz9YLE87gmB9QkSFA@mail.gmail.com' \
    --to=alex.kanavin@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=randy.li@synaptics.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).