diff options
Diffstat (limited to 'meta/recipes-devtools/meson')
8 files changed, 371 insertions, 0 deletions
diff --git a/meta/recipes-devtools/meson/meson/0001-Make-CPU-family-warnings-fatal.patch b/meta/recipes-devtools/meson/meson/0001-Make-CPU-family-warnings-fatal.patch new file mode 100644 index 0000000000..848dccfbe7 --- /dev/null +++ b/meta/recipes-devtools/meson/meson/0001-Make-CPU-family-warnings-fatal.patch @@ -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 + diff --git a/meta/recipes-devtools/meson/meson/0001-is_debianlike-always-return-False.patch b/meta/recipes-devtools/meson/meson/0001-is_debianlike-always-return-False.patch new file mode 100644 index 0000000000..83c4782a61 --- /dev/null +++ b/meta/recipes-devtools/meson/meson/0001-is_debianlike-always-return-False.patch @@ -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: diff --git a/meta/recipes-devtools/meson/meson/0001-python-module-do-not-manipulate-the-environment-when.patch b/meta/recipes-devtools/meson/meson/0001-python-module-do-not-manipulate-the-environment-when.patch new file mode 100644 index 0000000000..86abfa9d52 --- /dev/null +++ b/meta/recipes-devtools/meson/meson/0001-python-module-do-not-manipulate-the-environment-when.patch @@ -0,0 +1,38 @@ +From dd5b4a200cd2fdf7fef627c4b6752f90c00b863a 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 | 7 +------ + 1 file changed, 1 insertion(+), 6 deletions(-) + +diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py +index f479ab9..b934bc6 100644 +--- a/mesonbuild/modules/python.py ++++ b/mesonbuild/modules/python.py +@@ -239,10 +239,6 @@ def python_factory(env: 'Environment', for_machine: 'MachineChoice', + # If python-X.Y.pc exists in LIBPC, we will try to use it + def wrap_in_pythons_pc_dir(name: str, env: 'Environment', kwargs: T.Dict[str, T.Any], + installation: 'PythonInstallation') -> 'ExternalDependency': +- old_pkg_libdir = os.environ.pop('PKG_CONFIG_LIBDIR', None) +- old_pkg_path = os.environ.pop('PKG_CONFIG_PATH', None) +- if pkg_libdir: +- os.environ['PKG_CONFIG_LIBDIR'] = pkg_libdir + try: + return PythonPkgConfigDependency(name, env, kwargs, installation) + finally: +@@ -251,8 +247,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.extend([ + functools.partial(wrap_in_pythons_pc_dir, pkg_name, env, kwargs, installation), diff --git a/meta/recipes-devtools/meson/meson/0002-Support-building-allarch-recipes-again.patch b/meta/recipes-devtools/meson/meson/0002-Support-building-allarch-recipes-again.patch new file mode 100644 index 0000000000..dcc1ce9c27 --- /dev/null +++ b/meta/recipes-devtools/meson/meson/0002-Support-building-allarch-recipes-again.patch @@ -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 + diff --git a/meta/recipes-devtools/meson/meson/disable-rpath-handling.patch b/meta/recipes-devtools/meson/meson/disable-rpath-handling.patch new file mode 100644 index 0000000000..7aaed8b4a3 --- /dev/null +++ b/meta/recipes-devtools/meson/meson/disable-rpath-handling.patch @@ -0,0 +1,37 @@ +From 18600f7a1cddf23aeabd188f86e66983f27ccfe3 Mon Sep 17 00:00:00 2001 +From: Richard Purdie <richard.purdie@linuxfoundation.org> +Date: Fri, 23 Nov 2018 15:28:28 +0000 +Subject: [PATCH] meson: Disable rpath stripping at install time + +We need to allow our rpaths generated through the compiler flags to make it into +our binaries. Therefore disable the meson manipulations of these unless there +is a specific directive to do something differently in the project. + +RP 2018/11/23 + +Upstream-Status: Submitted [https://github.com/mesonbuild/meson/issues/2567] +--- + mesonbuild/minstall.py | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/mesonbuild/minstall.py b/mesonbuild/minstall.py +index 7d0da13..17d50db 100644 +--- a/mesonbuild/minstall.py ++++ b/mesonbuild/minstall.py +@@ -718,8 +718,11 @@ class Installer: + if file_copied: + self.did_install_something = True + try: +- self.fix_rpath(outname, t.rpath_dirs_to_remove, install_rpath, final_path, +- install_name_mappings, verbose=False) ++ if install_rpath: ++ self.fix_rpath(outname, t.rpath_dirs_to_remove, install_rpath, final_path, ++ install_name_mappings, verbose=False) ++ else: ++ print("RPATH changes at install time disabled") + except SystemExit as e: + if isinstance(e.code, int) and e.code == 0: + pass +-- +2.20.1 + diff --git a/meta/recipes-devtools/meson/meson/meson-setup.py b/meta/recipes-devtools/meson/meson/meson-setup.py new file mode 100755 index 0000000000..daaa551de2 --- /dev/null +++ b/meta/recipes-devtools/meson/meson/meson-setup.py @@ -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) diff --git a/meta/recipes-devtools/meson/meson/meson-wrapper b/meta/recipes-devtools/meson/meson/meson-wrapper new file mode 100755 index 0000000000..8fafaad975 --- /dev/null +++ b/meta/recipes-devtools/meson/meson/meson-wrapper @@ -0,0 +1,19 @@ +#!/bin/sh + +if [ -z "$OECORE_NATIVE_SYSROOT" ]; then + echo "OECORE_NATIVE_SYSROOT not set; are you in a Yocto SDK environment?" >&2 +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 + +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/meson_0.61.2.bb b/meta/recipes-devtools/meson/meson_0.61.2.bb new file mode 100644 index 0000000000..a51db1e3d4 --- /dev/null +++ b/meta/recipes-devtools/meson/meson_0.61.2.bb @@ -0,0 +1,135 @@ +HOMEPAGE = "http://mesonbuild.com" +SUMMARY = "A high performance build system" +DESCRIPTION = "Meson is a build system designed to increase programmer \ +productivity. It does this by providing a fast, simple and easy to use \ +interface for modern software development tools and practices." + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://COPYING;md5=3b83ef96387f14655fc854ddc3c6bd57" + +SRC_URI = "https://github.com/mesonbuild/meson/releases/download/${PV}/meson-${PV}.tar.gz \ + file://meson-setup.py \ + file://meson-wrapper \ + file://0001-python-module-do-not-manipulate-the-environment-when.patch \ + file://disable-rpath-handling.patch \ + file://0001-Make-CPU-family-warnings-fatal.patch \ + file://0002-Support-building-allarch-recipes-again.patch \ + file://0001-is_debianlike-always-return-False.patch \ + " +SRC_URI[sha256sum] = "0233a7f8d959079318f6052b0939c27f68a5de86ba601f25c9ee6869fb5f5889" + +UPSTREAM_CHECK_URI = "https://github.com/mesonbuild/meson/releases" +UPSTREAM_CHECK_REGEX = "meson-(?P<pver>\d+(\.\d+)+)\.tar" + +inherit setuptools_build_meta + +PIP_INSTALL_PACKAGE = "meson" + +RDEPENDS:${PN} = "ninja python3-modules python3-pkg-resources" + +FILES:${PN} += "${datadir}/polkit-1" + +do_install:append () { + # As per the same issue in the python recipe itself: + # Unfortunately the following pyc files are non-deterministc due to 'frozenset' + # being written without strict ordering, even with PYTHONHASHSEED = 0 + # Upstream is discussing ways to solve the issue properly, until then let's + # just not install the problematic files. + # More info: http://benno.id.au/blog/2013/01/15/python-determinism + rm ${D}${libdir}/python*/site-packages/mesonbuild/dependencies/__pycache__/mpi.cpython* +} + +BBCLASSEXTEND = "native nativesdk" + +inherit meson-routines + +# The cross file logic is similar but not identical to that in meson.bbclass, +# since it's generating for an SDK rather than a cross-compile. Important +# differences are: +# - We can't set vars like CC, CXX, etc. yet because they will be filled in with +# 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:class-nativesdk() { + 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 +cpp = @CXX +ar = @AR +nm = @NM +strip = @STRIP +pkgconfig = 'pkg-config' + +[built-in options] +c_args = @CFLAGS +c_link_args = @LDFLAGS +cpp_args = @CPPFLAGS +cpp_link_args = @LDFLAGS + +[properties] +needs_exe_wrapper = true +sys_root = @OECORE_TARGET_SYSROOT + +[host_machine] +system = '${SDK_OS}' +cpu_family = '${@meson_cpu_family("SDK_ARCH", d)}' +cpu = '${SDK_ARCH}' +endian = '${@meson_endian("SDK", d)}' +EOF + + install -d ${D}${SDKPATHNATIVE}/post-relocate-setup.d + install -m 0755 ${WORKDIR}/meson-setup.py ${D}${SDKPATHNATIVE}/post-relocate-setup.d/ + + # We need to wrap the real meson with a thin env setup wrapper. + mv ${D}${bindir}/meson ${D}${bindir}/meson.real + install -m 0755 ${WORKDIR}/meson-wrapper ${D}${bindir}/meson +} + +FILES:${PN}:append:class-nativesdk = "${datadir}/meson ${SDKPATHNATIVE}" |