Commit Graph

502 Commits

Author SHA1 Message Date
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
Tristan Partin 4c13aa30a1 dependency: Add JDK system dependency
The JDK system dependency is important for detecting JDK include paths
that may be useful when developing a JNI interface.
2021-04-12 10:43:11 -07:00
Dylan Baker 2cfa656935 environment: simplify handling of native files with no cross files
Instead of treating native files as always being for the build machine,
and then copying them to the host machine, treat them as for the build
machine only when a cross file is also present
2021-04-06 16:09:13 -07:00
Dylan Baker 223858fd7d environment: fix typos in comment 2021-04-06 16:09:13 -07:00
Dylan Baker fdde948ca1 environment: don't load project options from a native file in a cross build 2021-04-06 16:09:13 -07:00
Dylan Baker 111070bf49 environment: Add some comments to the _load_machine_file_options method 2021-04-06 16:09:13 -07:00
Dylan Baker f99ed692c4 environment: get environment variables for both host and build machines
Fixes #8605
2021-04-01 09:54:43 -07:00
Dylan Baker 2cd0723c42 Split environment variable and command line cflags
They are supposed to have different behavior. The environment variables
apply to both the compiler and linker when the compiler acts as a
linker, but the command line ones do not.

Fixes #8345
2021-03-30 18:52:17 +03:00
Dylan Baker 40e3577a65 split program related classes and functions out of dependencies
Dependencies is already a large and complicated package without adding
programs to the list. This also allows us to untangle a bit of spaghetti
that we have.
2021-03-19 08:47:10 -04:00
Dylan Baker 2be074b1d4 ninjabackend: Use rsp_file_syntax method
This also makes us of the new enum value in the backend, for better type
saftey.
2021-03-14 22:05:55 -07:00
Eli Schwartz 487eef2907
remove unused environment function
The script dir is never really used since meson --internal handles this.
The last remaining use of the raw script dir got removed in commit
522392e755.
2021-03-08 19:22:02 -05:00
Eli Schwartz 6a0fabc647
mass rewrite of string formatting to use f-strings everywhere
performed by running "pyupgrade --py36-plus" and committing the results
2021-03-04 17:16:11 -05:00
Eli Schwartz 4340bf34fa
various python neatness cleanups
All changes were created by running

"pyupgrade --py3-only --keep-percent-format"

and committing the results. I have not touched string formatting for
now.

- use set literals
- simplify .format() parameter naming
- remove __future__
- remove default "r" mode for open()
- use OSError rather than compatibility aliases
- remove stray parentheses in function(generator) scopes
2021-03-04 17:11:26 -05:00
Dylan Baker 91e56c7d59 environment: Allow setting build options in cross files
This did work previously, so we need to let it continue working. I'm
proposing removing it in 0.60 because the correct solution has always
worked.

I've also been a bit more defensive here, and made setting
`subproject:opt = foo` in the machine files an error, as we have
`[subproject:built-in options]` or `[subproject:project options]` for
that.
2021-02-18 10:57:20 -08:00
Dylan Baker 10d94a12b8 Environment: Fix passing envrionment variables CPPFLAGS and CFLAGS
Or other language flags that use CPPFLAGS (like CXXFLAGS). The problem
here is actually rather simple, `dict.setdefault()` doesn't work like I
thought it did, I thought it created a weak entry, but it actually is
equivalent to:
```python
if k not in dict:
    dict[k] = v
```
Instead we'll use an intermediate dictionary (a default dictionary
actually, since that makes things a little cleaner) and then add the
keys from that dict to self.options as applicable.

Test case written by Jussi, Fix by Dylan

Co-authored-by: Jussi Pakkanen
Fixes: #8361
Fixes: #8345
2021-02-17 14:46:15 +02:00
Ali Alnubani a174855200 environment: fix typos
Fixed typos and reworded some sentences.

Signed-off-by: Ali Alnubani <alialnu@nvidia.com>
2021-02-03 15:30:10 +00:00
Dylan Baker 23d3b98fc1 split mesonlib into a package
Currently mesonlib does some import tricks to figure out whether it
needs to use windows or posix specific functions. This is a little
hacky, but works fine. However, the way the typing stubs are implemented
for the msvcrt and fnctl modules will cause mypy to fail on the other
platform, since the functions are not implemented.

To aleviate this (and for slightly cleaner design), I've split mesonlib
into a pacakge with three modules. A universal module contains all of
the platform agnositc code, a win32 module contains window specific
code, a posix module contains the posix specific code, and a platform
module contains no-op implementations. Then the package's __init__ file
imports all of the universal functions and all of the functions from the
approriate platform module, or the no-op versions as fallbacks. This
makes mypy happy, and avoids `if`ing all over the code to switch between
the platform specific code.
2021-01-23 12:48:29 +01:00
Dylan Baker ff40ca25b7 make some Environment methods protected
they're really not public methods, they'r only meant to be called from
the initializer. Let's mark them as such.
2021-01-11 11:15:07 -08:00
Dylan Baker 1cc7e4c84c clean up get_env_var_pair
This function returns both the name and the value, but we never actually
use the name, just the value. Also make this module private. We really
want to keep all environment variable reading in the Environment class
so it's done once up front. This should help with that goal.
2021-01-11 11:15:07 -08:00
Dylan Baker 0076db6ff9 move get_env_var_pair to environment
This is only used in environment, so it should live there too.
2021-01-11 11:15:07 -08:00
Dylan Baker f3fcbba1f8 boost: default machine file properties to env var values
This both moves the env reading to configuration time, which is useful,
and also simplifies the implementation of the boost dependency. The
simplification comes from being able to delete basically duplicated code
since the values will be in the Properties if they exist at all.
2021-01-11 11:15:07 -08:00
Dylan Baker e7a5c75285 Move BinaryTable environment lookups to Environment
This means that all the env lookups are done once, at initial configure
time. This has all of the expected advantages.
2021-01-11 11:15:07 -08:00
Dylan Baker 4b0b44afac move handling of CFLAGS and friends to environment
This has a bunch of nice features. It obviously centralizes everything,
which is nice. It also means that env is only re-read at `meson --wipe`,
not `meson --reconfigure`. And it's going to allow more cleanups.
2021-01-11 11:15:06 -08:00
Dylan Baker 3949c2a0e0 move CMAKE_PREFIX_PATH env var handling to environment
This causes the variable to be read up front and stored, rather than be
re-read on each invocation of meson.

This does have two slight behavioral changes. First is the obvious one
that changing the variable between `meson --reconfigure` invocations has
no effect. This is the way PKG_CONFIG_PATH already works. The second
change is that CMAKE_PREFIX_PATH the env var is no longer appended to
the values set in the machine file or on the command line, and is
instead replaced by them. CMAKE_PREFIX_PATH is the only env var in meson
that works this way, every other one is replaced not appended, so while
this is a behavioral change, I also think its a bug fix.
2021-01-11 11:15:06 -08:00
Dylan Baker e81acbd606 Use a single coredata dictionary for options
This patches takes the options work to it's logical conclusion: A single
flat dictionary of OptionKey: UserOptions. This allows us to simplify a
large number of cases, as we don't need to check if an option is in this
dict or that one (or any of 5 or 6, actually).
2021-01-04 12:20:58 -08:00
Dylan Baker f9b19e73a5 move OptionKey to mesonlib
There's starting to be a lot of things including coredata that coredata
needs to itself include. putting it in mesonlib makes more sense
2021-01-04 12:20:40 -08:00
Dylan Baker fe973d9fc4 use OptionKey for compiler_options 2021-01-04 12:20:39 -08:00
Dylan Baker b25a423a64 use the OptionKey type for command line and machine files 2021-01-04 12:15:41 -08:00
Remi Thebault 7a9a9e4a99
Implement support of dlang -makedeps switch (#8119)
* Implement support of dlang -makedeps switch

Fix #8118

* resolve code review comments
2020-12-29 09:56:35 -08:00
Persian Prince f5871f434a
environment.py: Detect all mips* architectures (#8108)
* environment.py: Detect all mips* architectures

We have more than those values, like:

mipsel
mipsel-nf
mips32el
mips33el-nf
mipsisa32r6
mipsisa32r6el

So lets just detect them all.

Sorry I forgot about 64bit and closed https://github.com/mesonbuild/meson/pull/8106

But now it even detects:

mipsisa64r6
mipsisa64r6el

* Make dcbaker happy
2020-12-17 10:37:39 -08:00
Laurin-Luis Lehning bab1087422
Add support for driving lld-link indirectly through clang on Windows 2020-12-13 16:34:50 +02:00