Skip to content

Commit

Permalink
bsp: meson: backport version 0.63.3
Browse files Browse the repository at this point in the history
When using kirkstone with some scarthgap compatible meta layers some
gstreamer from the BSP layer require the meson version 0.62.1 or newer.

This commit copies from oe/meta at langdale.

Signed-off-by: Daiane Angolini <daiane.angolini@foundries.io>
  • Loading branch information
angolini authored and ricardosalveti committed Jun 21, 2024
1 parent 4b370d5 commit c8db41e
Show file tree
Hide file tree
Showing 9 changed files with 429 additions and 0 deletions.
3 changes: 3 additions & 0 deletions meta-lmp-bsp/conf/machine/include/lmp-machine-custom.inc
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ OSTREE_KERNEL_ARGS:mx6ull-generic-bsp ?= "console=tty1 console=ttymxc0,115200 ${
OSTREE_KERNEL_ARGS:mx7d-generic-bsp ?= "console=tty1 console=ttymxc0,115200 ${OSTREE_KERNEL_ARGS_COMMON}"
OSTREE_KERNEL_ARGS:mx7ulp-generic-bsp ?= "console=tty1 console=ttyLP0,115200 ${OSTREE_KERNEL_ARGS_COMMON}"

PREFERRED_VERSION_meson:imx8-nxp-bsp ?= "0.63.3.imx"
PREFERRED_VERSION_meson:imx9-nxp-bsp ?= "0.63.3.imx"

# Embedded Artists i.MX7ULP COM
UBOOT_SIGN_ENABLE:sota:imx7ulpea-ucom ?= "1"
PREFERRED_PROVIDER_u-boot-default-script:imx7ulpea-ucom = "u-boot-base-scr"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
From 8739e1c3bef653415ad4b9b9c318ccfa76c43da6 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 31 Mar 2022 15:00:24 -0700
Subject: [PATCH] Check for clang before guessing gcc or lcc

clang --version can yield a string like below when its installed into
such a directory

clang version 14.0.0 (https://github.com/llvm/llvm-project 3f43d803382d57e3fc010ca19833077d1023e9c9)
Target: aarch64-yoe-linux
Thread model: posix
InstalledDir: /mnt/b/yoe/master/build/tmp/work/cortexa72-yoe-linux/gnome-text-editor/42.0-r0/recipe-sysroot-native/usr/bin/aarch64-yoe-linux

as you can see InstallDir has 'xt-' subtring and this trips the check to
guess gcc

if 'Free Software Foundation' in out or 'xt-' in out:

Therefore, check if compiler is clang then there is no point of running
this check anyway.

Upstream-Status: Submitted [https://github.com/mesonbuild/meson/pull/10218]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
mesonbuild/compilers/detect.py | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/mesonbuild/compilers/detect.py b/mesonbuild/compilers/detect.py
index 53948b01a..ba335cf39 100644
--- a/mesonbuild/compilers/detect.py
+++ b/mesonbuild/compilers/detect.py
@@ -427,13 +427,14 @@ def _detect_c_or_cpp_compiler(env: 'Environment', lang: str, for_machine: Machin
version = search_version(out)

guess_gcc_or_lcc: T.Optional[str] = None
- if 'Free Software Foundation' in out or 'xt-' in out:
- guess_gcc_or_lcc = 'gcc'
- if 'e2k' in out and 'lcc' in out:
- guess_gcc_or_lcc = 'lcc'
- if 'Microchip Technology' in out:
- # this output has "Free Software Foundation" in its version
- guess_gcc_or_lcc = None
+ if not 'clang' in compiler_name:
+ if 'Free Software Foundation' in out or 'xt-' in out:
+ guess_gcc_or_lcc = 'gcc'
+ if 'e2k' in out and 'lcc' in out:
+ guess_gcc_or_lcc = 'lcc'
+ if 'Microchip Technology' in out:
+ # this output has "Free Software Foundation" in its version
+ guess_gcc_or_lcc = None

if guess_gcc_or_lcc:
defines = _get_gnu_compiler_defines(compiler)
--
2.35.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
From 6c4eef1d92e9e42fdbc888365cab3c95fb33c605 Mon Sep 17 00:00:00 2001
From: Ross Burton <ross.burton@intel.com>
Date: Tue, 3 Jul 2018 13:59:09 +0100
Subject: [PATCH] Make CPU family warnings fatal

Upstream-Status: Inappropriate [OE specific]
Signed-off-by: Ross Burton <ross.burton@intel.com>

---
mesonbuild/envconfig.py | 2 +-
mesonbuild/environment.py | 4 +---
2 files changed, 2 insertions(+), 4 deletions(-)

Index: meson-0.60.2/mesonbuild/envconfig.py
===================================================================
--- meson-0.60.2.orig/mesonbuild/envconfig.py
+++ meson-0.60.2/mesonbuild/envconfig.py
@@ -266,8 +266,8 @@ class MachineInfo(HoldableObject):
'but is missing {}.'.format(minimum_literal - set(literal)))

cpu_family = literal['cpu_family']
- if cpu_family not in known_cpu_families:
- mlog.warning(f'Unknown CPU family {cpu_family}, please report this at https://github.com/mesonbuild/meson/issues/new')
+ if cpu_family not in known_cpu_families and cpu_family != "riscv":
+ raise EnvironmentException('Unknown CPU family {}, see https://wiki.yoctoproject.org/wiki/Meson/UnknownCPU for directions.'.format(cpu_family))

endian = literal['endian']
if endian not in ('little', 'big'):
Index: meson-0.60.2/mesonbuild/environment.py
===================================================================
--- meson-0.60.2.orig/mesonbuild/environment.py
+++ meson-0.60.2/mesonbuild/environment.py
@@ -354,10 +354,8 @@ def detect_cpu_family(compilers: Compile
if any_compiler_has_define(compilers, '__64BIT__'):
trial = 'ppc64'

- if trial not in known_cpu_families:
- mlog.warning(f'Unknown CPU family {trial!r}, please report this at '
- 'https://github.com/mesonbuild/meson/issues/new with the '
- 'output of `uname -a` and `cat /proc/cpuinfo`')
+ if trial not in known_cpu_families and trail != "riscv":
+ raise EnvironmentException('Unknown CPU family %s, see https://wiki.yoctoproject.org/wiki/Meson/UnknownCPU for directions.' % trial)

return trial

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
From 667b9ede638677fb37911306937ea62f05897581 Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex@linutronix.de>
Date: Mon, 18 Oct 2021 15:55:59 +0200
Subject: [PATCH] is_debianlike(): always return False

Otherwise, host contamination happens.

Upstream-Status: Inappropriate [oe-core specific]
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
mesonbuild/mesonlib/universal.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mesonbuild/mesonlib/universal.py b/mesonbuild/mesonlib/universal.py
index d670d04..47d1b52 100644
--- a/mesonbuild/mesonlib/universal.py
+++ b/mesonbuild/mesonlib/universal.py
@@ -651,7 +651,7 @@ def is_cygwin() -> bool:


def is_debianlike() -> bool:
- return os.path.isfile('/etc/debian_version')
+ return False


def is_dragonflybsd() -> bool:
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
From 2e9582167bf9d3273004edb2637310531f0155ab Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Mon, 19 Nov 2018 14:24:26 +0100
Subject: [PATCH] python module: do not manipulate the environment when calling
pkg-config

Upstream-Status: Inappropriate [oe-core specific]
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>

---
mesonbuild/modules/python.py | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py
index 3bbccd1..fda7a25 100644
--- a/mesonbuild/modules/python.py
+++ b/mesonbuild/modules/python.py
@@ -277,9 +277,6 @@ def python_factory(env: 'Environment', for_machine: 'MachineChoice',
# there is no LIBPC, so we can't search in it
return NotFoundDependency('python', env)

- old_pkg_libdir = os.environ.pop('PKG_CONFIG_LIBDIR', None)
- old_pkg_path = os.environ.pop('PKG_CONFIG_PATH', None)
- os.environ['PKG_CONFIG_LIBDIR'] = pkg_libdir
try:
return PythonPkgConfigDependency(name, env, kwargs, installation, True)
finally:
@@ -288,8 +285,7 @@ def python_factory(env: 'Environment', for_machine: 'MachineChoice',
os.environ[name] = value
elif name in os.environ:
del os.environ[name]
- set_env('PKG_CONFIG_LIBDIR', old_pkg_libdir)
- set_env('PKG_CONFIG_PATH', old_pkg_path)
+ pass

candidates.append(functools.partial(wrap_in_pythons_pc_dir, pkg_name, env, kwargs, installation))
# We only need to check both, if a python install has a LIBPC. It might point to the wrong location,
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
From 656bf55fed01df2d2e2ad6d9d9887173cb16b85c Mon Sep 17 00:00:00 2001
From: Peter Kjellerstedt <pkj@axis.com>
Date: Thu, 26 Jul 2018 16:32:49 +0200
Subject: [PATCH 2/2] Support building allarch recipes again

This registers "allarch" as a known CPU family.

Upstream-Status: Inappropriate [OE specific]
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
mesonbuild/envconfig.py | 1 +
1 file changed, 1 insertion(+)

diff --git a/mesonbuild/envconfig.py b/mesonbuild/envconfig.py
index 4d58c91..ff01ad1 100644
--- a/mesonbuild/envconfig.py
+++ b/mesonbuild/envconfig.py
@@ -36,6 +36,7 @@ from pathlib import Path


known_cpu_families = (
+ 'allarch',
'aarch64',
'alpha',
'arc',
--
2.24.0

43 changes: 43 additions & 0 deletions meta-lmp-bsp/recipes-backport/scarthgap/meson/meson-setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env python3

import os
import string
import sys

class Template(string.Template):
delimiter = "@"

class Environ():
def __getitem__(self, name):
val = os.environ[name]
val = val.split()
if len(val) > 1:
val = ["'%s'" % x for x in val]
val = ', '.join(val)
val = '[%s]' % val
elif val:
val = "'%s'" % val.pop()
return val

try:
sysroot = os.environ['OECORE_NATIVE_SYSROOT']
except KeyError:
print("Not in environment setup, bailing")
sys.exit(1)

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)
31 changes: 31 additions & 0 deletions meta-lmp-bsp/recipes-backport/scarthgap/meson/meson-wrapper
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh

if [ -z "$OECORE_NATIVE_SYSROOT" ]; then
exec "meson.real" "$@"
fi

if [ -z "$SSL_CERT_DIR" ]; then
export SSL_CERT_DIR="$OECORE_NATIVE_SYSROOT/etc/ssl/certs/"
fi

# If these are set to a cross-compile path, meson will get confused and try to
# use them as native tools. Unset them to prevent this, as all the cross-compile
# config is already in meson.cross.
unset CC CXX CPP LD AR NM STRIP

case "$1" in
setup|configure|dist|install|introspect|init|test|wrap|subprojects|rewrite|compile|devenv|env2mfile|help) MESON_CMD="$1" ;;
*) echo meson-wrapper: Implicit setup command assumed; MESON_CMD=setup ;;
esac

if [ "$MESON_CMD" = "setup" ]; then
MESON_SETUP_OPTS=" \
--cross-file="$OECORE_NATIVE_SYSROOT/usr/share/meson/${TARGET_PREFIX}meson.cross" \
--native-file="$OECORE_NATIVE_SYSROOT/usr/share/meson/meson.native" \
"
echo meson-wrapper: Running meson with setup options: \"$MESON_SETUP_OPTS\"
fi

exec "$OECORE_NATIVE_SYSROOT/usr/bin/meson.real" \
"$@" \
$MESON_SETUP_OPTS
Loading

0 comments on commit c8db41e

Please sign in to comment.