summaryrefslogtreecommitdiff
path: root/mesonbuild/scripts
AgeCommit message (Collapse)Author
2024-06-18Improve `nm` usage in symbolextractor script on macOSRalf Gommers
This fixes the unit test `TestAllPlatformTests.test_noop_changes_cause_no_rebuilds`, when run with an `nm` binary from `cctools-port` (as shipped by conda-forge, see https://github.com/conda-forge/cctools-and-ld64-feedstock). It also addresses the issue discussed in https://github.com/mesonbuild/meson/discussions/11131, and this build warning: ``` [48/1383] Generating symbol file scipy/special/libsf_error_state.dylib.p/libsf_error_state.dylib.symbols WARNING: ['arm64-apple-darwin20.0.0-nm'] does not work. Relinking will always happen on source changes. error: arm64-apple-darwin20.0.0-nm: invalid argument -- ``` as reported in scipy#20740. The unit test traceback was: ``` > self.assertBuildRelinkedOnlyTarget('mylib') E AssertionError: Lists differ: ['mylib', 'prog'] != ['mylib'] E E First list contains 1 additional elements. E First extra element 1: E 'prog' E E - ['mylib', 'prog'] E + ['mylib'] unittests/allplatformstests.py:1292: AssertionError ``` The `nm` shipped by Apple yields the exact same results either way; the man page for `nm` only lists the single-character form so this seems preferred either way.
2024-06-04Extract native file parser to machinefile source file.Jussi Pakkanen
2024-04-04env2mfile: Only consume LDFLAGS for relevant languagesOle André Vadla Ravnås
It makes no sense to add them into vala_link_args, for example.
2024-04-01depfixer: change fix_darwin to act like fix_rpathtype_entryFabian Groffen
This somewhat aligns "darwin" (Mach-O) with how ELF RPATHs are treated. Instead of blindly removing all RPATHs, only remove the ones that are in the rpath_dirs_to_remove set. This way, RPATHs that were added by the toolchain or user are left untouched. It is important not to remove RPATHs as they may be vital for the executable at runtime. Issues #12045 and #12288 are examples of this. Issue: https://github.com/mesonbuild/meson/issues/12045 Signed-off-by: Fabian Groffen <grobian@gentoo.org> Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
2024-03-29scripts/depscan: remove unnecessary functionDylan Baker
This basically existed for an assert which we don't need, as mypy would catch that issue for us anyway. Removing the function entirely has some small performance advantages
2024-03-29scripts/depscan: pick language once, at configure timeDylan Baker
We already have to decide whether to scan a file at configure time, so we don't want to have to do it again at compile time, every time the depscan rule is run. We can do this by saving and passing the language to use in the pickle, so depscan doesn't have to re-calculate it. As an added bonus, this removes an import from depscan
2024-03-29scripts/depscan: combine pickle and JSON data into a single fileDylan Baker
We don't need to write and pass two separate files to the depscanner, I've used the pickle because the pickle serializer/deserializer should be faster than JSON, thought I haven't tested.
2024-03-28depscan: use a defaultdict to simplify append actionDylan Baker
2024-02-24scripts/coverage: Implemented handling for passing the gcovr and llvm-cov ↵dragonmux
binaries to use to the script
2024-02-23env2mfile: move language args to `built-in options`Ole André Vadla Ravnås
As putting them in the `properties` section is considered deprecated, and Meson would then complain when trying to consume the resulting machine file.
2024-02-16coverage: pass .lcovrc config file to genhtmlEsther Dalhuisen
The .lcovrc file can contain several directives for genhtml, mostly pertaining the visualisation of the generated HTML report. Passing the config file to genhtml allows the user to customize their report. Fixes #12863
2024-01-28python module: correct the embedded path for bytecompiled filesEli Schwartz
In recursive scanning, a script variable was overwritten that caused the logic *intended* to make the embedded path be trimmed based on $DESTDIR, to no longer apply. This resulted in embedding the staging path, but only when install_subdir() was used instead of specifying each file as the argument to install_sources.
2023-12-13Use SPDX-License-Identifier consistentlyDylan Baker
This replaces all of the Apache blurbs at the start of each file with an `# SPDX-License-Identifier: Apache-2.0` string. It also fixes existing uses to be consistent in capitalization, and to be placed above any copyright notices. This removes nearly 3000 lines of boilerplate from the project (only python files), which no developer cares to look at. SPDX is in common use, particularly in the Linux kernel, and is the recommended format for Meson's own `project(license: )` field
2023-12-06Fix coverage with lcov 2.0 and uncovered subprojectsDavid Robillard
Version 2.0 of lcov triggers an error when an exclude pattern is unused. This can happen when the project has subprojects, but no code in them ends up covered: lcov: ERROR: 'exclude' pattern '/[...]/subprojects/*' is unused. (use "lcov --ignore-errors unused ..." to bypass this error) So, simply do as it says. Unused patterns doesn't seem problematic (or even interesting) here, so I don't think there's any risk in simply turning this off, which matches what happened with earlier versions of lcov anyway.
2023-11-02scan-build: Exclude subprojects from scan-build reportAndrew McNulty
When a user invokes the scan-build target that Meson generates all subprojects are included in the resulting report. This commit modifies the invocation of scan-build to exclude all bugs that scan-build finds in the subprojects from the final report. A release note has also been added describing the changed behaviour.
2023-11-01Add comments suggesting to keep shell completion scripts up-to-date near cmd ↵Luke Elliott
line argument code
2023-10-26i18n module: Invoke itstool with the full command lineChun-wei Fan
Certain envs may not support invoking itstool by itself directly as a script as shebang lines are not supported, such as under cmd.exe shells on Windows, that are normally used for Visual Studio (and the like, such as clang-cl) builds. This will call the corresponding interpreter to invoke itstool when needed, so that itstool can be properly run, even if shebang lines are not supported by the env. This will fix building appstream on Windows using clang-cl, for instance.
2023-10-20add missing imports for future annotationsEli Schwartz
2023-10-08Add support for lcov 2.0Nigel Kukard
lcov 2.0 deprecates `--rc lcov_branch_coverage=1` for `--rc branch_coverage=1` and gives an error when an exclude is used on a non existing directory. I added a version check for lcov and removed the subprojects directory from the exclusion list if it does not exist. Fixes #11995
2023-10-02python module: stop using distutils "link to libpython" probe on recent pythonEli Schwartz
On python >=3.8, this information is expected to be encoded in the sysconfig vars. In distutils, it is always necessary to link to libpython on Windows; for posix platforms, it depends on the value of LIBPYTHON (which is the library to link to, possibly the empty string) as generated by configure.ac and embedded into python.pc and python-config.sh, and then coded a second time in the distutils python sources. There are a couple of caveats which have ramifications for Cygwin and Android: - python.pc and python-config.sh disagree with distutils when python is not built shared. In that case, the former act the same as a shared build, while the latter *never* links to libpython - python.pc disagrees with python-config.sh and distutils when python is built shared. The former never links to libpython, while the latter do The disagreement is resolved in favor of distutils' behavior in all cases, and python.pc is correct for our purposes on python 3.12; see: https://github.com/python/cpython/pull/100356 https://github.com/python/cpython/pull/100967 Although it was not backported to older releases, Cygwin at least has always patched in a fix for python.pc, which behavior is now declared canonical. We can reliably assume it is always correct. This is the other half of the fix for #7702
2023-10-02python module: refactor pypy detection into a consistent variableEli Schwartz
2023-10-02python module: stop using distutils schemes on sufficiently new DebianEli Schwartz
Since 3.10.3, Debian finally started patching sysconfig with custom paths, instead of just distutils. This means we can now go use that instead. It reduces our reliance on the deprecated distutils module. Partial fix for #7702
2023-09-26mypy: replace fchmod by chmodCharles Brunet
The former is unix-only, which complains when running on the Windows platform -- even though this code is in a unix-specific branch. But per the docs: > As of Python 3.3, this is equivalent to os.chmod(fd, mode). So we can just use the identical function that is available in more places.
2023-09-25Add clang-tidy-fix targetLei YU
Add the `clang-tidy-fix` target to apply clang-tidy fixes to the source code. This is done by calling `run-clang-tidy` with `-fix` argument. Add a test case to run `clang-tidy-fix` and verify the file is changed. Signed-off-by: Lei YU <yulei.sh@bytedance.com>
2023-09-15environment, env2mfile: Don't shell split paths if they point to a valid ↵L. E. Segovia
executable Fixes #11128
2023-08-14Python: Add 'limited_api' kwarg to extension_moduleAndrew McNulty
This commit adds a new keyword arg to extension_module() that enables a user to target the Python Limited API, declaring the version of the limited API that they wish to target. Two new unittests have been added to test this functionality.
2023-08-11treewide: automatic rewriting of all comment-style type annotationsEli Schwartz
Performed using https://github.com/ilevkivskyi/com2ann This has no actual effect on the codebase as type checkers (still) support both and negligible effect on runtime performance since __future__ annotations ameliorates that. Technically, the bytecode would be bigger for non function-local annotations, of which we have many either way. So if it doesn't really matter, why do a large-scale refactor? Simple: because people keep wanting to, but it's getting nickle-and-dimed. If we're going to do this we might as well do it consistently in one shot, using tooling that guarantees repeatability and correctness. Repeat with: ``` com2ann mesonbuild/ ```
2023-08-02treewide: internally avoid deprecated machine file uses of "pkgconfig"Eli Schwartz
We support this in a machine file: ``` [binaries] pkgconfig = 'pkg-config' pkg-config = 'pkg-config' ``` and you can use either one, because internally we look up both. If you only set *one* of them, this plays awkwardly with setting $PKG_CONFIG, since we don't know which one you set in the machine file and the *other* one will be initialized from the environment instead. In commit 22df45a31981874310a78dde0df59a6a7c5ebb29 we changed program lookup of config-tool style dependencies to use the regular tool names and only fall back on the strange internal names. This affected the pkg-config class too. The result is that instead of preferring `pkgconfig =` followed by $PKG_CONFIG followed by `pkg-config =`, we inverted the lookup order. This is a good idea anyway, because now it behaves consistently with `find_program('pkg-config')`. Unfortunately, we documented the wrong name in a bunch of places, and also used the wrong name in various testsuite bits, which meant that if you set $PKG_CONFIG and then ran the testsuite, it would fail. Correct these references, because they are buggy. One test case expected to find_program() a native copy for convenience of testing against natively installed glib. Force it to resolve a native copy.
2023-06-19Add kernel and subsystem properties to machine objects.Jussi Pakkanen
2023-06-12env2mfile: Take pkg-config properties from envXavier Claessens
2023-06-12env2mfile: Take binaries from env for cross file tooXavier Claessens
2023-06-12env2mfile: Not all compilers have env for flagsXavier Claessens
2023-05-16meson_exe: print suitable debug information for DLL not found errorsEli Schwartz
It's particularly inscrutable if you do not know where DLLs weren't found because you don't know what the PATH was in the child process.
2023-05-02bytecompile: switch to handling destdir in the script launcher envEli Schwartz
2023-05-02python module: add an automatic byte-compilation stepEli Schwartz
For all source `*.py` files installed via either py.install_sources() or an `install_dir: py.get_install_dir()`, produce `*.pyc` files at install time. Controllable via a module option.
2023-04-25Fix html coverage report generation when using clang on linuxJakob Widauer
2023-04-11fix various spelling issuesJosh Soref
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-03-28Import cpu detection fix from Debian.Jussi Pakkanen
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1033579
2023-03-21Fix run_tool() when git is not installedAlyssa Ross
Previously, it would raise an exception.
2023-03-16hotdoc: Install devhelp files at the right locationXavier Claessens
When devhelp is enabled, hotdoc generates a devhelp/ subdir that needs to be installed to /usr/share/devhelp/. Otherwise, the html/ subdir needs to be installed to /usr/share/doc/<project>/html/
2023-02-28Add detection code for powerpc64le.Jussi Pakkanen
Originally from: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1019413
2023-02-28Add a deb_ prefix to constants that are only used in Debian system detection.Jussi Pakkanen
2023-02-28Handle a cross compilation setup that only has a C compiler.Jussi Pakkanen
2023-02-28Add Debian platform autodetect to env2mfile.Jussi Pakkanen
2023-02-24work around circular imports in python probe scriptEli Schwartz
It seems this happens because at some point setuptools imports gettext, and we have a script by the same name. In general, this path injection by default is bad news for our use case. Python 3.11 introduced -P for this reason, but we cannot depend on that. Instead, check for it first, and delete it, before doing more imports.
2023-02-23clangformat: don't noisily print status messages for every checked fileEli Schwartz
The version lookup should be silent. While we're at it, the version lookup should not be happening more than once, which printing multiple messages indicated we were doing. Pass the version into the per-file function rather than looking it up fresh each time. Fixes https://github.com/mesonbuild/meson/pull/11054#issuecomment-1430169280
2023-02-22python module: move the introspection script into an external scriptEli Schwartz
We write this out as an embedded string to a tempfile in order to run it, which is pretty awkward. And usually Meson's files are already files on disk, not packed into a zip, so we can simply run it directly. Since python 3.7, which is our new minimum, we can handle this well via the stdlib. (There's also mesonbuild.mesondata, but we do not need persistence in the builddir.) This also solves the problem that has always been there, of giant python programs inside strings occasionally confusing syntax highlighters. Or even, it would be nice if we had syntax highlighting for this introspection program. :D
2023-02-01pylint 2.16: remove pointless parens around equality assignmentsEli Schwartz
Given the construct `foo = (bar == baz)` some people like parentheses and some do not. They're pointless and don't mean anything, though. I don't feel this is particularly helpful to code clarity, tbh, and pylint now notices this and warns about it in our current pylint config. I think this is reasonable, so let's remove the odd parens.
2023-02-01simplify instantiation of builtin type using builtins instead of functionsEli Schwartz
2023-02-01treewide: add future annotations importEli Schwartz