dev-util/meson: Sync with Gentoo

It's from Gentoo commit b71a2848f9b83ab69c7da6ed82f3549debdb2d64.
This commit is contained in:
Flatcar Buildbot 2024-01-01 07:12:14 +00:00 committed by Krzesimir Nowak
parent 14421dbf30
commit 18f88c195a
7 changed files with 609 additions and 0 deletions

View File

@ -8,3 +8,5 @@ DIST meson-1.2.3.tar.gz 2184484 BLAKE2B 7d76c54bddba249ab97ebd5dd0afc448177ff9fa
DIST meson-1.2.3.tar.gz.asc 833 BLAKE2B 1416c49302aab80b5f647cc1d6cd18c36f6199e79c7d13ea284143b2423267b5823850218578626937c14589ebcdf19069b310394c63bc762ab8f59d7ebe3780 SHA512 852c031ecfe032cb48d284bb270597d114294b7d1be5dd0df6ec2f78a62e1a5ba82711bc14ae410e47ced54f99a639055a1628b0acf7aa07a3a80034fce5ebc9
DIST meson-1.3.0.tar.gz 2222383 BLAKE2B cb9ac8e00fe924df67166938687584a9de35e784e1e52bff281649d787695d37e3044ea3d6d5869181fe1e9676b5136548293dbd5cdbd091a6de0c449b8932f5 SHA512 fbcbdd9551ad12b7be84411b96357e01c7c0c38a8e9933093d2e71ed7e12bd4278245798684d389c332eb75dd50c99310affc9acb01cf8bedd45265335083a32
DIST meson-1.3.0.tar.gz.asc 833 BLAKE2B d83b819e75e732d694ac98412717af39a8115defc7371f1983e4619cf990b5cdfd7ab7c93911f2a8b6c7055c7252ebeba04d15f508f4278b506e326fa1801a25 SHA512 8c72bfe5f3bdec9c9f787dd5a7186599bb44079a89d0a87a535a6e890adb7718cbf570b2ac74583b72b92aa05160823a8571ca530384787c428e49d6fbe095ba
DIST meson-1.3.1.tar.gz 2222386 BLAKE2B 64d53eddc8cb321a4e2dabaa4b7499798a7b68764b1a7a5182bfa21d081dc07105acab616119b88ff610e5d75504f03d1c0aefee3602ddf538fc491ff3d0204a SHA512 6e694beb70329535faca9405358c04e2fd5a490b0c0d2678d5831b7de3477e0fcf4f6a242f1bc6218da04ac4f6e096ee53cdf273c6b6a38a35d370e8c16694ba
DIST meson-1.3.1.tar.gz.asc 833 BLAKE2B 1db7aabe3b7d491dfcd288a780d10784517a73e07348f2d5b98d1fa347dd08b2afa210511c7f5ff867b10ecd3ce470ea764b5ce6907aa7dcaa4d619f705e339c SHA512 0f652d375fa7700f3048266330d783664593c08da47d4f0d87af0be5d8b5e21113521651fb923c6a1cfe88aef7067ebd85b27946f19e71133d7c9805839fc873

View File

@ -0,0 +1,31 @@
From 9016e6958bb83feb9a724f20d8badb116bf7c5f2 Mon Sep 17 00:00:00 2001
From: Jan200101 <sentrycraft123@gmail.com>
Date: Tue, 21 Nov 2023 08:42:56 +0100
Subject: [PATCH] Only convert boolean values for cmake formats
This caused a regression with mesondefine where
`conf_data.set("FOO", true)`
turned into
`#define FOO 1`
instead of
`#define FOO`
---
mesonbuild/utils/universal.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mesonbuild/utils/universal.py b/mesonbuild/utils/universal.py
index 26194628c..93e64c0a2 100644
--- a/mesonbuild/utils/universal.py
+++ b/mesonbuild/utils/universal.py
@@ -1210,7 +1210,7 @@ def do_replacement(regex: T.Pattern[str], line: str,
var, _ = confdata.get(varname)
if isinstance(var, str):
var_str = var
- elif isinstance(var, bool):
+ elif variable_format.startswith("cmake") and isinstance(var, bool):
var_str = str(int(var))
elif isinstance(var, int):
var_str = str(var)
--
2.41.0

View File

@ -0,0 +1,55 @@
From 2fbc7b5ce3aced483b196dd10ca9eee1713b7494 Mon Sep 17 00:00:00 2001
From: Eli Schwartz <eschwartz93@gmail.com>
Date: Tue, 26 Dec 2023 15:06:12 -0500
Subject: [PATCH] Revert "clike: Deduplicate rpath linker flags"
This reverts commit 53ea59ad8455277797117d225f326851fe7d369c.
This breaks at least:
- frameworks/17 mpi
- frameworks/30 scalapack
The problem is that openmpi's pkg-config emitted link arguments
includes:
```
-Wl,-rpath -Wl,/path/to/libdir
```
The deduplication logic in meson doesn't contain sufficient information
to tell when the compiler is passing an argument that requires values,
and definitely cannot tell when that argument is split across argv. But
for arguments that *can* do this, it is not possible to deduplicate a
single argument as standalone, because it is not standalone.
The argument for deduplicating rpath here was that if you have multiple
dependencies that all add the same rpath, the Apple ld64 emits a
non-fatal warning "duplicate -rpath ignored". Since this is non-fatal,
it's not a major issue. A major issue is when builds fatally error out
with:
```
FAILED: scalapack_c
cc -o scalapack_c scalapack_c.p/main.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,--start-group /usr/lib64/libscalapack.so /usr/lib64/liblapack.so /usr/lib64/libblas.so -Wl,-rpath -Wl,/usr/lib64 -Wl,/usr/lib64 -Wl,--enable-new-dtags /usr/lib64/libmpi.so -Wl,--end-group
/usr/libexec/gcc/x86_64-pc-linux-gnu/ld: error: /usr/lib64: read: Is a directory
```
---
mesonbuild/compilers/mixins/clike.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mesonbuild/compilers/mixins/clike.py b/mesonbuild/compilers/mixins/clike.py
index b3fc96cec..76c8e0413 100644
--- a/mesonbuild/compilers/mixins/clike.py
+++ b/mesonbuild/compilers/mixins/clike.py
@@ -54,7 +54,7 @@ class CLikeCompilerArgs(arglist.CompilerArgs):
# NOTE: not thorough. A list of potential corner cases can be found in
# https://github.com/mesonbuild/meson/pull/4593#pullrequestreview-182016038
- dedup1_prefixes = ('-l', '-Wl,-l', '-Wl,--export-dynamic', '-Wl,-rpath')
+ dedup1_prefixes = ('-l', '-Wl,-l', '-Wl,--export-dynamic')
dedup1_suffixes = ('.lib', '.dll', '.so', '.dylib', '.a')
dedup1_args = ('-c', '-S', '-E', '-pipe', '-pthread')
--
2.41.0

View File

@ -0,0 +1,250 @@
From 5f659af870011e74299d1455a65c2cd5f5ace51f Mon Sep 17 00:00:00 2001
From: Eli Schwartz <eschwartz93@gmail.com>
Date: Tue, 5 Dec 2023 14:26:54 -0500
Subject: [PATCH] ninja backend: don't hide all compiler warnings for
transpiled languages
This was originally added for vala only, with the rationale that vala
generates bad code that has warnings. Unfortunately, the rationale was
fatally flawed. The compiler warns about a number of things, which the
user can control depending on their code (or their code generator's
code), but some of those things are absolutely critical to warn about.
In particular, GCC 14 and clang 17 are updating their defaults to warn
-- and error by default for -- invalid C code that breaks the standard,
but has been silently accepted for over 20 years "because lots of people
do it". The code in question is UB, and compilers will generate faulty
machine code that behaves erroneously and probably has a mass of CVEs
waiting to happen.
Compiler warnings are NOT safe to just... universally turn off. Compiler
warnings could be either:
- coding style lints
- threatening statements that the code is factually and behaviorally wrong
There is no magic bullet to ignore the former while respecting the
latter. And the very last thing we should ever do is pass `-w`, since
that causes ALL warnings to be disabled, even the manually added
`-Werror=XXX`.
If vala generated code creates warnings, then the vala compiler can
decrease the log level by generating better code, or by adding warning
suppression pragmas for *specific* issues, such as unused functions.
---
mesonbuild/backend/backends.py | 13 ++-----
mesonbuild/backend/ninjabackend.py | 19 ++++------
.../failing build/1 vala c werror/meson.build | 10 -----
.../failing build/1 vala c werror/prog.vala | 7 ----
.../1 vala c werror/unused-var.c | 8 ----
test cases/vala/5 target glib/meson.build | 4 --
unittests/linuxliketests.py | 37 -------------------
7 files changed, 11 insertions(+), 87 deletions(-)
delete mode 100644 test cases/failing build/1 vala c werror/meson.build
delete mode 100644 test cases/failing build/1 vala c werror/prog.vala
delete mode 100644 test cases/failing build/1 vala c werror/unused-var.c
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index 2c24e4c31..639e07b2a 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -986,7 +986,7 @@ class Backend:
return compiler.get_no_stdinc_args()
return []
- def generate_basic_compiler_args(self, target: build.BuildTarget, compiler: 'Compiler', no_warn_args: bool = False) -> 'CompilerArgs':
+ def generate_basic_compiler_args(self, target: build.BuildTarget, compiler: 'Compiler') -> 'CompilerArgs':
# Create an empty commands list, and start adding arguments from
# various sources in the order in which they must override each other
# starting from hard-coded defaults followed by build options and so on.
@@ -999,17 +999,12 @@ class Backend:
commands += self.get_no_stdlib_args(target, compiler)
# Add things like /NOLOGO or -pipe; usually can't be overridden
commands += compiler.get_always_args()
- # Only add warning-flags by default if the buildtype enables it, and if
- # we weren't explicitly asked to not emit warnings (for Vala, f.ex)
- if no_warn_args:
- commands += compiler.get_no_warn_args()
- else:
- # warning_level is a string, but mypy can't determine that
- commands += compiler.get_warn_args(T.cast('str', target.get_option(OptionKey('warning_level'))))
+ # warning_level is a string, but mypy can't determine that
+ commands += compiler.get_warn_args(T.cast('str', target.get_option(OptionKey('warning_level'))))
# Add -Werror if werror=true is set in the build options set on the
# command-line or default_options inside project(). This only sets the
# action to be done for warnings if/when they are emitted, so it's ok
- # to set it after get_no_warn_args() or get_warn_args().
+ # to set it after or get_warn_args().
if target.get_option(OptionKey('werror')):
commands += compiler.get_werror_args()
# Add compile args for c_* or cpp_* build options set on the
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 049ae253f..cdb747d73 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -1939,7 +1939,7 @@ class NinjaBackend(backends.Backend):
if cratetype in {'bin', 'dylib'}:
args.extend(rustc.get_linker_always_args())
- args += self.generate_basic_compiler_args(target, rustc, False)
+ args += self.generate_basic_compiler_args(target, rustc)
# Rustc replaces - with _. spaces or dots are not allowed, so we replace them with underscores
args += ['--crate-name', target.name.replace('-', '_').replace(' ', '_').replace('.', '_')]
depfile = os.path.join(target.subdir, target.name + '.d')
@@ -2804,10 +2804,9 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485'''))
bargs = []
return (sargs, bargs)
- def _generate_single_compile(self, target: build.BuildTarget, compiler: 'Compiler',
- is_generated: bool = False) -> 'CompilerArgs':
+ def _generate_single_compile(self, target: build.BuildTarget, compiler: Compiler) -> CompilerArgs:
commands = self._generate_single_compile_base_args(target, compiler)
- commands += self._generate_single_compile_target_args(target, compiler, is_generated)
+ commands += self._generate_single_compile_target_args(target, compiler)
return commands
def _generate_single_compile_base_args(self, target: build.BuildTarget, compiler: 'Compiler') -> 'CompilerArgs':
@@ -2825,14 +2824,10 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485'''))
return commands
@lru_cache(maxsize=None)
- def _generate_single_compile_target_args(self, target: build.BuildTarget, compiler: 'Compiler',
- is_generated: bool = False) -> 'ImmutableListProtocol[str]':
- # The code generated by valac is usually crap and has tons of unused
- # variables and such, so disable warnings for Vala C sources.
- no_warn_args = is_generated == 'vala'
+ def _generate_single_compile_target_args(self, target: build.BuildTarget, compiler: Compiler) -> ImmutableListProtocol[str]:
# Add compiler args and include paths from several sources; defaults,
# build options, external dependencies, etc.
- commands = self.generate_basic_compiler_args(target, compiler, no_warn_args)
+ commands = self.generate_basic_compiler_args(target, compiler)
# Add custom target dirs as includes automatically, but before
# target-specific include directories.
if target.implicit_include_directories:
@@ -2901,7 +2896,7 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485'''))
if use_pch and 'mw' not in compiler.id:
commands += self.get_pch_include_args(compiler, target)
- commands += self._generate_single_compile_target_args(target, compiler, is_generated=False)
+ commands += self._generate_single_compile_target_args(target, compiler)
# Metrowerks compilers require PCH include args to come after intraprocedural analysis args
if use_pch and 'mw' in compiler.id:
@@ -2935,7 +2930,7 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485'''))
if use_pch and 'mw' not in compiler.id:
commands += self.get_pch_include_args(compiler, target)
- commands += self._generate_single_compile_target_args(target, compiler, is_generated)
+ commands += self._generate_single_compile_target_args(target, compiler)
# Metrowerks compilers require PCH include args to come after intraprocedural analysis args
if use_pch and 'mw' in compiler.id:
diff --git a/test cases/failing build/1 vala c werror/meson.build b/test cases/failing build/1 vala c werror/meson.build
deleted file mode 100644
index 736d7aa43..000000000
--- a/test cases/failing build/1 vala c werror/meson.build
+++ /dev/null
@@ -1,10 +0,0 @@
-project('valatest', 'c', default_options : 'werror=true')
-
-if find_program('valac', required : false).found()
- add_languages('vala')
- valadeps = [dependency('glib-2.0'), dependency('gobject-2.0')]
- # Must fail due to -Werror and unused variable in C file
- executable('valaprog', 'prog.vala', 'unused-var.c', dependencies : valadeps)
-else
- executable('failprog', 'unused-var.c')
-endif
diff --git a/test cases/failing build/1 vala c werror/prog.vala b/test cases/failing build/1 vala c werror/prog.vala
deleted file mode 100644
index 638e77660..000000000
--- a/test cases/failing build/1 vala c werror/prog.vala
+++ /dev/null
@@ -1,7 +0,0 @@
-class MainProg : GLib.Object {
-
- public static int main(string[] args) {
- stdout.printf("Vala is working.\n");
- return 0;
- }
-}
diff --git a/test cases/failing build/1 vala c werror/unused-var.c b/test cases/failing build/1 vala c werror/unused-var.c
deleted file mode 100644
index 6b85078c9..000000000
--- a/test cases/failing build/1 vala c werror/unused-var.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#warning "something"
-
-int
-somelib(void)
-{
- int unused_var;
- return 33;
-}
diff --git a/test cases/vala/5 target glib/meson.build b/test cases/vala/5 target glib/meson.build
index f285d9f16..089bb3c97 100644
--- a/test cases/vala/5 target glib/meson.build
+++ b/test cases/vala/5 target glib/meson.build
@@ -1,9 +1,5 @@
project('valatest', 'vala', 'c')
-if not meson.is_unity()
- add_global_arguments('-Werror', language : 'c')
-endif
-
valadeps = [dependency('glib-2.0', version : '>=2.32'), dependency('gobject-2.0')]
e = executable('valaprog', 'GLib.Thread.vala', 'retcode.c', dependencies : valadeps)
diff --git a/unittests/linuxliketests.py b/unittests/linuxliketests.py
index 4fcf52e09..a02c99e8f 100644
--- a/unittests/linuxliketests.py
+++ b/unittests/linuxliketests.py
@@ -298,43 +298,6 @@ class LinuxlikeTests(BasePlatformTests):
self.build()
self._run(self.mtest_command)
- def test_vala_c_warnings(self):
- '''
- Test that no warnings are emitted for C code generated by Vala. This
- can't be an ordinary test case because we need to inspect the compiler
- database.
- https://github.com/mesonbuild/meson/issues/864
- '''
- if not shutil.which('valac'):
- raise SkipTest('valac not installed.')
- testdir = os.path.join(self.vala_test_dir, '5 target glib')
- self.init(testdir)
- compdb = self.get_compdb()
- vala_command = None
- c_command = None
- for each in compdb:
- if each['file'].endswith('GLib.Thread.c'):
- vala_command = each['command']
- elif each['file'].endswith('GLib.Thread.vala'):
- continue
- elif each['file'].endswith('retcode.c'):
- c_command = each['command']
- else:
- m = 'Unknown file {!r} in vala_c_warnings test'.format(each['file'])
- raise AssertionError(m)
- self.assertIsNotNone(vala_command)
- self.assertIsNotNone(c_command)
- # -w suppresses all warnings, should be there in Vala but not in C
- self.assertIn(" -w ", vala_command)
- self.assertNotIn(" -w ", c_command)
- # -Wall enables all warnings, should be there in C but not in Vala
- self.assertNotIn(" -Wall ", vala_command)
- self.assertIn(" -Wall ", c_command)
- # -Werror converts warnings to errors, should always be there since it's
- # injected by an unrelated piece of code and the project has werror=true
- self.assertIn(" -Werror ", vala_command)
- self.assertIn(" -Werror ", c_command)
-
@skipIfNoPkgconfig
def test_qtdependency_pkgconfig_detection(self):
'''
--
2.41.0

View File

@ -54,6 +54,9 @@ RDEPEND="
PATCHES=(
"${FILESDIR}"/${PN}-1.2.1-python-path.patch
# backport fix for broken configure_file()
"${FILESDIR}"/0001-Only-convert-boolean-values-for-cmake-formats.patch
)
python_prepare_all() {

View File

@ -0,0 +1,135 @@
# Copyright 2016-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..12} pypy3 )
DISTUTILS_USE_PEP517=setuptools
if [[ ${PV} = *9999* ]]; then
EGIT_REPO_URI="https://github.com/mesonbuild/meson"
inherit git-r3
else
inherit verify-sig
MY_PV=${PV/_/}
MY_P=${P/_/}
S=${WORKDIR}/${MY_P}
SRC_URI="
https://github.com/mesonbuild/meson/releases/download/${MY_PV}/${MY_P}.tar.gz
verify-sig? ( https://github.com/mesonbuild/meson/releases/download/${MY_PV}/${MY_P}.tar.gz.asc )
"
BDEPEND="verify-sig? ( sec-keys/openpgp-keys-jpakkane )"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/jpakkane.gpg
if [[ ${PV} != *_rc* ]] ; then
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
fi
fi
inherit bash-completion-r1 distutils-r1 toolchain-funcs
DESCRIPTION="Open source build system"
HOMEPAGE="https://mesonbuild.com/"
LICENSE="Apache-2.0"
SLOT="0"
IUSE="test"
RESTRICT="!test? ( test )"
DEPEND="
test? (
dev-libs/glib:2
dev-libs/gobject-introspection
dev-util/ninja
dev-vcs/git
sys-libs/zlib[static-libs(+)]
virtual/pkgconfig
)
"
RDEPEND="
virtual/pkgconfig
"
PATCHES=(
"${FILESDIR}"/${PN}-1.2.1-python-path.patch
# backport fix for broken configure_file()
"${FILESDIR}"/0001-Only-convert-boolean-values-for-cmake-formats.patch
# backport fix for hiding compiler warnings (such as Modern C) in vala and cython
"${FILESDIR}"/0001-ninja-backend-don-t-hide-all-compiler-warnings-for-t.patch
)
python_prepare_all() {
local disable_unittests=(
# ASAN and sandbox both want control over LD_PRELOAD
# https://bugs.gentoo.org/673016
-e 's/test_generate_gir_with_address_sanitizer/_&/'
# ASAN is unsupported on some targets
# https://bugs.gentoo.org/692822
-e 's/test_pch_with_address_sanitizer/_&/'
# https://github.com/mesonbuild/meson/issues/7203
-e 's/test_templates/_&/'
# Broken due to python2 wrapper
-e 's/test_python_module/_&/'
)
sed -i "${disable_unittests[@]}" unittests/*.py || die
# Broken due to python2 script created by python_wrapper_setup
rm -r "test cases/frameworks/1 boost" || die
distutils-r1_python_prepare_all
}
src_test() {
tc-export PKG_CONFIG
if ${PKG_CONFIG} --exists Qt5Core && ! ${PKG_CONFIG} --exists Qt5Gui; then
ewarn "Found Qt5Core but not Qt5Gui; skipping tests"
else
distutils-r1_src_test
fi
}
python_test() {
(
# test_meson_installed
unset PYTHONDONTWRITEBYTECODE
# https://bugs.gentoo.org/687792
unset PKG_CONFIG
# test_cross_file_system_paths
unset XDG_DATA_HOME
# 'test cases/unit/73 summary' expects 80 columns
export COLUMNS=80
# If JAVA_HOME is not set, meson looks for javac in PATH.
# If javac is in /usr/bin, meson assumes /usr/include is a valid
# JDK include path. Setting JAVA_HOME works around this broken
# autodetection. If no JDK is installed, we should end up with an empty
# value in JAVA_HOME, and the tests should get skipped.
export JAVA_HOME=$(java-config -O 2>/dev/null)
# Call python3 instead of EPYTHON to satisfy test_meson_uninstalled.
python3 run_tests.py
) || die "Testing failed with ${EPYTHON}"
}
python_install_all() {
distutils-r1_python_install_all
insinto /usr/share/vim/vimfiles
doins -r data/syntax-highlighting/vim/{ftdetect,indent,syntax}
insinto /usr/share/zsh/site-functions
doins data/shell-completions/zsh/_meson
dobashcomp data/shell-completions/bash/meson
}

View File

@ -0,0 +1,133 @@
# Copyright 2016-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..12} pypy3 )
DISTUTILS_USE_PEP517=setuptools
if [[ ${PV} = *9999* ]]; then
EGIT_REPO_URI="https://github.com/mesonbuild/meson"
inherit git-r3
else
inherit verify-sig
MY_PV=${PV/_/}
MY_P=${P/_/}
S=${WORKDIR}/${MY_P}
SRC_URI="
https://github.com/mesonbuild/meson/releases/download/${MY_PV}/${MY_P}.tar.gz
verify-sig? ( https://github.com/mesonbuild/meson/releases/download/${MY_PV}/${MY_P}.tar.gz.asc )
"
BDEPEND="verify-sig? ( sec-keys/openpgp-keys-jpakkane )"
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/jpakkane.gpg
if [[ ${PV} != *_rc* ]] ; then
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
fi
fi
inherit bash-completion-r1 distutils-r1 toolchain-funcs
DESCRIPTION="Open source build system"
HOMEPAGE="https://mesonbuild.com/"
LICENSE="Apache-2.0"
SLOT="0"
IUSE="test"
RESTRICT="!test? ( test )"
DEPEND="
test? (
dev-libs/glib:2
dev-libs/gobject-introspection
dev-util/ninja
dev-vcs/git
sys-libs/zlib[static-libs(+)]
virtual/pkgconfig
)
"
RDEPEND="
virtual/pkgconfig
"
PATCHES=(
"${FILESDIR}"/${PN}-1.2.1-python-path.patch
# backport fix for hiding compiler warnings (such as Modern C) in vala and cython
"${FILESDIR}"/0001-ninja-backend-don-t-hide-all-compiler-warnings-for-t.patch
# backport revert for broken rpath changes: https://github.com/mesonbuild/meson/pull/12672
"${FILESDIR}"/0001-Revert-clike-Deduplicate-rpath-linker-flags.patch
)
python_prepare_all() {
local disable_unittests=(
# ASAN and sandbox both want control over LD_PRELOAD
# https://bugs.gentoo.org/673016
-e 's/test_generate_gir_with_address_sanitizer/_&/'
# ASAN is unsupported on some targets
# https://bugs.gentoo.org/692822
-e 's/test_pch_with_address_sanitizer/_&/'
)
sed -i "${disable_unittests[@]}" unittests/*.py || die
# Broken due to python2 script created by python_wrapper_setup
rm -r "test cases/frameworks/1 boost" || die
distutils-r1_python_prepare_all
}
src_test() {
tc-export PKG_CONFIG
if ${PKG_CONFIG} --exists Qt5Core && ! ${PKG_CONFIG} --exists Qt5Gui; then
ewarn "Found Qt5Core but not Qt5Gui; skipping tests"
else
distutils-r1_src_test
fi
}
python_test() {
(
# remove unwanted python_wrapper_setup contents
# We actually do want to non-error if python2 is installed and tested.
remove="${T}/${EPYTHON}/bin:"
PATH=${PATH/${remove}/}
# test_meson_installed
unset PYTHONDONTWRITEBYTECODE
# https://bugs.gentoo.org/687792
unset PKG_CONFIG
# test_cross_file_system_paths
unset XDG_DATA_HOME
# 'test cases/unit/73 summary' expects 80 columns
export COLUMNS=80
# If JAVA_HOME is not set, meson looks for javac in PATH.
# If javac is in /usr/bin, meson assumes /usr/include is a valid
# JDK include path. Setting JAVA_HOME works around this broken
# autodetection. If no JDK is installed, we should end up with an empty
# value in JAVA_HOME, and the tests should get skipped.
export JAVA_HOME=$(java-config -O 2>/dev/null)
${EPYTHON} -u run_tests.py
) || die "Testing failed with ${EPYTHON}"
}
python_install_all() {
distutils-r1_python_install_all
insinto /usr/share/vim/vimfiles
doins -r data/syntax-highlighting/vim/{ftdetect,indent,syntax}
insinto /usr/share/zsh/site-functions
doins data/shell-completions/zsh/_meson
dobashcomp data/shell-completions/bash/meson
}