Commit Graph

532 Commits

Author SHA1 Message Date
Dylan Baker e991c4d454 Use SPDX-License-Identifier consistently
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-13 15:19:21 -05:00
Nigel Kukard 2c4a1b6324 Add support for lcov 2.0
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-08 23:13:06 -04:00
CorrodedCoder 5b16e830cc Adjust kernel detection to support Solaris 5.10 or earlier
The logic previously added to distinguish between illumos and Solaris made use of a uname invocation with a -o switch which is not supported on Solaris 5.10 or earlier.
illumos started with version 5.11 so the logic has been shortcut to report 'solaris' in such cases where the version is 5.10 or below.
2023-09-25 13:05:24 -07:00
Christoph Reiter d0b09898c7 get_llvm_tool_names: add llvm 17
this fixes the "frameworks: 15 llvm" tests with llvm 17
2023-09-23 12:34:23 -07:00
L. E. Segovia 878d950887 environment, env2mfile: Don't shell split paths if they point to a valid executable
Fixes #11128
2023-09-15 07:31:37 -04:00
Xavier Claessens b4b1395ef5 Suggest using --reconfigure only when not already using it 2023-08-24 19:09:20 -04:00
Xavier Claessens 18b96cd069 machine file: Add @GLOBAL_SOURCE_ROOT@ and @DIRNAME@ 2023-08-23 11:33:39 -04:00
Simon McVittie b95ebf80b8 environment: Don't override mips64 to mips if no compilers are available
If we have a build- or host-architecture compiler, we can detect mips64
vs. mips by the fact that mips64 compilers define __mips64.  However,
machine_info_can_run() doesn't provide any compilers, because it is
interested in the architecture of the underlying kernel. If we don't
return mips64 when running on a mips64 kernel, machine_info_can_run()
will wrongly say that we can't run mips64 binaries.

If we're running a complete 32-bit mips user-space on a mips64 kernel,
it's OK to return mips64 in the absence of any compilers, as a result
of the previous commit "environment: Assume that mips64 can run 32-bit
mips binaries".

Resolves: https://github.com/mesonbuild/meson/issues/12017
Bug-Debian: https://bugs.debian.org/1041499
Fixes: 6def03c7 "detect_cpu: Fix mips32 detection on mips64"
Signed-off-by: Simon McVittie <smcv@debian.org>
2023-08-06 02:32:25 -04:00
Simon McVittie 2cf79c5062 environment: Assume that mips64 can run 32-bit mips binaries
The relationship between mips64 and mips is similar to the relationship
between x86_64 and x86. Representing it here is necessary so that we
will not require an exe_wrapper when cross-compiling for 32-bit mips on
mips64, or when a complete 32-bit mips user-space runs on a 64-bit kernel
without using linux32 to alter uname(2) to pretend to be 32-bit.

Signed-off-by: Simon McVittie <smcv@debian.org>
2023-08-06 02:32:25 -04:00
Eli Schwartz 0bb1647fd1
move various bits of type-checking only code to TYPE_CHECKING blocks
Mostly detected with flake8-type-checking. Also quote T.cast() first
arguments, since those are not affected by future annotations.
2023-07-19 18:31:37 -04:00
Tristan Partin b0f1f374e7 Add type annotations where they previously didn't exist 2023-07-12 18:56:06 -05:00
Tristan Partin d4bcf05c39 Annotate naked fundamental Python types
Although mypy wasn't complaining, pyright was.
2023-07-12 18:56:06 -05:00
Tristan Partin 921c2370a7 Replace some type comments with annotations 2023-07-12 18:56:06 -05:00
Dylan Baker 42c68291c4 environment: separate illumos and Solaris kernels in Machines
While both kernels are derived from the OpenSolaris project of Sun, they
have diverged and code that works with one may not work with the other.
As such, we should provide different values for them. This was requested
by both Oracle and the illumos upstreams.

Fixes: #11922
2023-07-04 19:02:03 +03:00
Jussi Pakkanen b0d2a92584 Add kernel and subsystem properties to machine objects. 2023-06-19 18:03:57 +03:00
Karol Herbst 8284be8139 dependencies/llvm: strip default include dirs
Fixes an issue with rust.bindgen if a cmake LLVM dependency with the
system include_type is getting used as a dependency.
2023-06-08 09:49:29 -07:00
Cyan 6def03c787 detect_cpu: Fix mips32 detection on mips64
MIPS64 can run MIPS32 code natively, so there is a chance that a mixture
of MIPS64 kernel and MIPS32 userland exists. Before this Meson just
treats such mixture as mips64, because uname -m returns mips64.

So in this case we have to check compiler builtin defines for actual
architecture and CPU in use.

- Also fixes mips64 related detection tests in internaltests:
  Normalize mips64 as mips first, then if __mips64 is defined, return
  mips64 for mips64* machines.

  This is a bit confiusing because normally one would detect if a flag
  of 32-bit target is defined while running on a 64-bit machine. For
  mips64 it is almost just the other way around - we need to detect if
  __mips64 is set to make sure it is a mips64 environment.

Co-Authored-By: Jue Wang <maliya355@outlook.com>
2023-04-28 00:20:42 -04:00
Josh Soref cf9fd56bc9 fix various spelling issues
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-11 19:21:05 -04:00
Christoph Reiter aa550033c8 get_llvm_tool_names: add released llvm versions 2023-04-03 15:32:38 -04:00
Eli Schwartz a21af43200
micro-optimize: define typing-only objects in TYPE_CHECKING
Union types that exist solely for use as annotations don't need to be
created in normal runs.
2023-02-01 17:01:30 -05:00
Eli Schwartz 680b5ff819
treewide: add future annotations import 2023-02-01 17:01:30 -05:00
Eli Schwartz 2df484176f Revert "debug cygwin CI"
This reverts commit 79d7891746.

This debug print probably should not have ended up live. Moreover, the
function it debugs is, surprisingly, called rather often. Adding I/O to
it causes it to begin to noticeably lag, on the scale of adding actual
*minutes* to a setup run.

Fixes #11322
2023-01-22 13:09:44 -08:00
Dylan Baker f7cde8d3f6 Add fatal=False to many mlog.warnings()
There are lots of warnings that become fatal, that are simply unfixable
by the end user. Things like using old versions of software (because
they're using some kind of LTS release), warnings about compilers not
supporting certain kinds of checks, or standards being upgraded due to
skipped implementations (MSVC has c++98 and c++14, but not c++11). None
of these should be fatal, they're informative, and too important to
reduce to notices, but not important enough to stop meson if they're
printed.
2023-01-03 14:49:02 -05:00
Eli Schwartz 79d7891746 debug cygwin CI 2022-12-11 22:43:31 +02:00
Xavier Claessens 548c9adad4 Remove useless EmptyExternalProgram
It is only used by Environment.get_exe_wrapper() and every callers were
handling None already. Type annotation was wrong, it already could
return None for the case an exe wrapper is needed but none is provided.
2022-12-07 11:58:36 -05:00
Dylan Baker 2d349eae8c
pylint: enable the set_membership plugin
Which adds the `use-set-for-membership` check. It's generally faster in
python to use a set with the `in` keyword, because it's a hash check
instead of a linear walk, this is especially true with strings, where
it's actually O(n^2), one loop over the container, and an inner loop of
the strings (as string comparison works by checking that `a[n] == b[n]`,
in a loop).

Also, I'm tired of complaining about this in reviews, let the tools do
it for me :)
2022-11-30 16:23:29 -05:00
David Robillard e85138fcc8 Fix various spelling errors
Found with codespell.
2022-11-24 15:17:23 -05:00
GustavoLCR 32bc64e632 Fix native compilation on ARM64 Windows
Move `detect_native_windows_arch()` to `mesonlib/universal.py` and
rename it to `windows_detect_native_arch()`
Use `IsWow64Process2()` to detect native architecture if available
Use native `vcvarsarm64.bat` to initialize vsenv if available
2022-10-25 14:59:06 +03:00
Dylan Baker 4da14918cd pylint: enable consider-using-in 2022-09-19 20:57:52 -04:00
Eli Schwartz 0a9048e554
compilers: don't use instance checks to determine properties
In various situations we want to figure out what type of compiler we
have, because we want to know stuff like "is it the pgi one", or "does
it use msvc style". The compiler object has this property already, via
an API specifically designed to communicate this info, but instead we
performed isinstance checks on a compiler class.

This is confusing and indirect, and has the side effect of requiring
more imports everywhere. We should do away with it.
2022-09-19 15:18:59 -04:00
Dylan Baker 32ebb81f1a dependencies: update llvm versions
15 is the current snapshot version, 13 and 14 are released.
2022-06-27 22:16:46 +03:00
Xavier Claessens 18bec0d3e3 pkgconfig: Use EnvironmentVariables to build PKG_CONFIG_* env
The new get_env() method that returns an EnvironmentVariables object
will be needed in next commit that will pass it to CustomTarget.

This has the side effect to use the proper os specific path separator
instead of hardcoding `:`. It is the obvious right thing to do here, but
has caused issues in the past. Hopefully issues have been fixed in the
meantime. If not, better deal with fallouts than keep doing the wrong
thing forever.
2022-04-30 15:01:28 -04:00
Eli Schwartz 187dc656f4
merge various TYPE_CHECKING blocks into one
A bunch of files have several T.TYPE_CHECKING blocks that each do some
things which could just as well be done once, with a single `if`
statement. Make them do so.
2022-03-07 19:01:04 -05:00
Tristan Partin 80cb87e7b7 Change jar() default install dir
The previous install dir seemed incorrect when looking at various Linux
distributions.
2022-02-28 11:44:29 +02:00
Eli Schwartz 0f0b1f22d2
coverage generator: obey the documentation and only generate supported outputs
We say:

> If version 4.2 or higher of the first is found, targets coverage-text,
> coverage-xml, coverage-sonarqube and coverage-html are generated.

But this is totally untrue. Make it true, by actually checking (and
not generating broken coverage commands when older versions of gcovr are
found).

Fixes #9505
2021-11-01 18:57:14 -04:00
Christian Clauss a5020857f3 Fix typos discovered by codespell 2021-10-10 16:12:25 -04:00
Eli Schwartz 4ab70c5512
fix extra whitespace
discovered via flake8 --select E303
2021-10-04 16:29:31 -04:00
Dylan Baker 9795323b86 pylint: check for duplicate imports
I ran into one of these from LGTM, and it would be nice if pylint could
warn me as part of my local development process instead of waiting for
the CI to tell me.
2021-09-24 10:36:05 -07:00
Dylan Baker f073c3cfe1 environment: correctly handle cpu value aarch64_be
Fixes #9191
2021-08-30 10:41:12 -07:00
Dylan Baker 78f8a286d0 environment: add ppc -> ppc64 for aix to detect_cpu
This seems like an oversight, that we'd replace ppc with ppc64 on AIX
for the cpu_family, but not for the specific cpu.
2021-08-30 10:38:47 -07:00
Dylan Baker 42eadd18d6 environment: Add a few type annotations
These are just annotations in code that I'm working for this series
2021-08-30 10:27:53 -07:00
Dylan Baker b2b4c374fc environment: Add correct annotation for wrap_resolver 2021-08-27 14:49:23 -07:00
Dylan Baker 4d6f15b1f1 environment: add annotations and fix get_meson_command
It is theoretically possible for the command to be None so we should
handle that.
2021-08-20 18:57:19 +02:00
Dylan Baker b7ebccd257 environment: add some missing annotations 2021-08-20 18:57:19 +02:00
Eli Schwartz dd31891c1f more f-strings too complex to be caught by pyupgrade 2021-07-05 17:55:04 +03:00
Daniel Mensinger b95d6e319f typing: Annotate compilers.detect 2021-06-25 19:34:48 +02:00
Daniel Mensinger 3f889606c7 Split compiler detection from Environment
This moves all the compiler detection logic into the new
compilers.detect module. This dramatically reduces the size
and complexity of Environment.
2021-06-25 19:34:48 +02:00
Ting-Wei Lan fc93c07e9e environment: Add LLVM suffixes for 11 and 12
Both LLVM 11 and 12 are stable releases. Note that FreeBSD changes the
way to version LLVM executables in LLVM 10.
2021-06-14 09:10:34 -07:00
Daniel Mensinger 7fc755b334 typing: Fully annotate run_project_tests.py 2021-06-09 13:25:36 +02:00
Dylan Baker cf17ef3867 environment: Add detection logic for cython 2021-06-07 09:16:19 -07:00