diff options
author | V3n3RiX <venerix@koprulu.sector> | 2023-12-06 11:01:58 +0000 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2023-12-06 11:01:58 +0000 |
commit | 334d7d1830a3556a4c5d62a0f8547e5eb40bc83e (patch) | |
tree | 21b32eab75d2e75a1706e24db41ef23a89bb0ca2 /dev-util/meson | |
parent | b8cec1611ea575eea46e4927fedf000feed71b16 (diff) |
gentoo auto-resync : 06:12:2023 - 11:01:57
Diffstat (limited to 'dev-util/meson')
-rw-r--r-- | dev-util/meson/Manifest | 2 | ||||
-rw-r--r-- | dev-util/meson/files/0001-ninja-backend-don-t-hide-all-compiler-warnings-for-t.patch | 250 | ||||
-rw-r--r-- | dev-util/meson/meson-1.3.0-r2.ebuild | 135 |
3 files changed, 387 insertions, 0 deletions
diff --git a/dev-util/meson/Manifest b/dev-util/meson/Manifest index 45f8a1121452..03c9acdcbfbe 100644 --- a/dev-util/meson/Manifest +++ b/dev-util/meson/Manifest @@ -1,4 +1,5 @@ AUX 0001-Only-convert-boolean-values-for-cmake-formats.patch 1094 BLAKE2B 3c65ba28fab604a1c63e195650a88a9ae7539a04d373e46d48fb742f372efdcebcb68977a669e7d6ceacec98db02c21b6daec45c1fea569c9cec29728ef83e6f SHA512 b6e4ee780969f858f5bd8a92998b012988df5aa6deba4666108dbed8bc77012c224499a3b09ce5278e67c41f7eaabe2cfa1452ece8877509f05241a3d5e2d7c2 +AUX 0001-ninja-backend-don-t-hide-all-compiler-warnings-for-t.patch 12301 BLAKE2B 44875bf6aa6e18de99e9c7202cd931f95a43dc29dac69a83cfa1cefbdf5442bc292920bd46b2479e39f150a534afe9f8db72022eb029c344b4c3e5f59a7274a6 SHA512 f106bf93bdedb82d079061715178bb0cbdf333113555ca0f61da0d0112ca6eff08135585d7e442d16a85b65232ff501a33e5ad208d230ea6d9fa10b30271f247 AUX 1.2.2/0001-python-dependency-ensure-that-setuptools-doesn-t-inj.patch 1547 BLAKE2B 4a61642466aa4ed4eee39fce2e796832b8325938f8ca15ea86a5d4f255dbe65be837ccbcf82ebb1a766d0ff5e7d8a69e93b7676f3af421bbc6907fec0e6ca231 SHA512 efdd2b0cb9fac0188b5c21cb3f98152d488c5299820a055031f2f75598bc0a8811988511091dfc7f99440b48defdf7e80a783cb7c374ccbba2a1e4d20a9065e3 AUX 1.2.2/0002-python-module-stop-using-distutils-schemes-on-suffic.patch 2799 BLAKE2B 1806655c247c4f009b41062e5ae5c90cb7ea3150c311bbdbc768e37a1d6e4a4599568584c1cd00a06315159422150ea953cda2325e97aae761bf6c7fb8b4b89e SHA512 3654092cd93f54af7ec7ea89f396c0e947d00b6a626037b827be589926502f37ecf3795c01d514b97a9990d95c6b5050f1304ba1de2ae867a86b3ca73a163893 AUX 1.2.2/0003-python-module-refactor-pypy-detection-into-a-consist.patch 1295 BLAKE2B 5422ac19ec0e44e2f773851895e0fee95d71a8c2c76b904779af04d36f1e59b457f7378a2898496b24873be2262cb24a17216d1d3bbd13ced864b55047ca16e6 SHA512 5c2e389dc313fb0ac7d2a717eeda602839c610120e1251b110201e75fdd2b1e65a1870229fb327c5947ccb5ebc9f6165bb301ab6c20468943ba91dc5e6a6b36c @@ -26,5 +27,6 @@ EBUILD meson-1.2.2-r1.ebuild 3298 BLAKE2B df141e7d10d26fdb41e298cdf856fe46e632ad EBUILD meson-1.2.2.ebuild 3285 BLAKE2B 1b38a024705bc9a5046a19ed80f2ba126ff984112a5761283778207d1cce3e33ea39260cc3e6ce864b3f5d07ceaf7a0431f56638830491814da0455cfd2a7e7a SHA512 c581592f28a3a39834afa3369af14ddc267a1e3c2f35e2c41674354da560828fd2037550a6314f0063700528414b0bdfa42aecc82ea86340384985db8aee0fc3 EBUILD meson-1.2.3.ebuild 3277 BLAKE2B 8a19cba268c31b8adc4f4852eca184639f0d6344934c321279a7dd48f5e3de02ce63bd4f3cff5814d8e42beff6733c9cf52c3742c254b051fa1d7a07d1885c33 SHA512 7fa82018c0f7d0179e1ccd5df33651e0e59561d2a35ccb189a32f7dc298cbe25bdfe4fd5db0eaf314a22b181ed111b74d957e240ab77cad62e2de9b3be9be512 EBUILD meson-1.3.0-r1.ebuild 3402 BLAKE2B 86c1be84d1a2a95ef3a2c325754d773502fc38e0e689f8eb449c4a26e1498148383f608612d3f82fe223402b6d09b58a7f38f52c24211e1285512c7f134b9fa0 SHA512 28e238d500cfcd0afc8b01f1bb22c957fc86c0d85b3c17814861e2ffc4dee2024a022cb08b991dd73d32e0fef1c01ab411a2db6df6595851bbf70e1211e51aa0 +EBUILD meson-1.3.0-r2.ebuild 3565 BLAKE2B b88c922ff1d15321edb90011528ca0ba2464bdc2b665d7ded1d9f9d39cf62482bd60c8753713c9536bda0515f2e832750839cb85d4ed27e3f531fb7e8332eddb SHA512 6e215fe8b4a40ecd73b866e0735812fa6a80e55d01e90f2b4d91aaf0ccc05d0dea3f78014e8462683dbc5b3faa0c0210a783e5f76d5355964746156bb6f5f5b6 EBUILD meson-9999.ebuild 3227 BLAKE2B 8c8e99032af1d188ca7a8a227c992a4f53676523bcbdb5d7a0b44e254f897f6c2ed597bc6bd8472ddcf67f27e0d9117129fe93ebb452b80603dddf2d1664023e SHA512 a483a7433c22951f9da4d82c13eaff36f94b3772324641483129a4d7a138438382d6b349079808579d4fee22d59631f00a20759a8ac01f73a506c73f7e077218 MISC metadata.xml 472 BLAKE2B 559073667cf007cd507f379014c8d0d494908742f606ca5eeb2a0cef3b5a8cb63cea4e9aa33b228163211dff8f794d178cbcd6c91bb283f894e6b072db28bacc SHA512 9232fe05900dca57d21f41023255c9a6fba57b213737ac8842ea180681488d9a2a306c8fbeba66cf02204f4523192e64af745aa65db946beac723cfe271e4fd5 diff --git a/dev-util/meson/files/0001-ninja-backend-don-t-hide-all-compiler-warnings-for-t.patch b/dev-util/meson/files/0001-ninja-backend-don-t-hide-all-compiler-warnings-for-t.patch new file mode 100644 index 000000000000..652ffd25228b --- /dev/null +++ b/dev-util/meson/files/0001-ninja-backend-don-t-hide-all-compiler-warnings-for-t.patch @@ -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 + diff --git a/dev-util/meson/meson-1.3.0-r2.ebuild b/dev-util/meson/meson-1.3.0-r2.ebuild new file mode 100644 index 000000000000..af208ef34bdc --- /dev/null +++ b/dev-util/meson/meson-1.3.0-r2.ebuild @@ -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 +} |