Commit Graph

14340 Commits

Author SHA1 Message Date
Karol Herbst 0c3e84bbaf dependencies/llvm: strip default include dirs also for config-tool version
This should have been done in my earlier fix, but kinda forgot to test and
fix it there as well.

See https://github.com/mesonbuild/meson/pull/11733 for the discussion.

Fixes: 8284be813 ("dependencies/llvm: strip default include dirs")
Signed-off-by: Karol Herbst <kherbst@redhat.com>
2023-12-20 13:36:23 +05:30
Michael Gene Brockus (Dreamer) 059b9e048d
Update Users.md (#12634)
* Update Users.md
2023-12-18 00:13:23 +02:00
Alyssa Ross 9322a29d7f Skip pkg-config-dependent tests if it's missing 2023-12-17 16:21:11 -05:00
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
Vincent Torri 1f82afe899 add the EFL, Enlightenment, libdwarf and ThorVG as users of meson 2023-12-13 08:29:55 -08:00
Nicolas Werner ebf5757c59 cmake: parse project version
This properly sets the project version in projects meson generates from
cmake projects. This allows dependency fallbacks to properly check the
version constraints in dependency calls when falling back to a cmake
subproject. Before this would fail, because the project version was
undefined.
2023-12-12 20:14:26 -05:00
Andres Freund f6f46173c4 macos: Fix test_pkgconfig_parse_libs() test on arm
The unit test infrastructure hardcodes the architecture as x86_64. On
macos, the test_pkgconfig_parse_libs() test creates a few libraries
for testing using clang. This leads to the test failing on arm based
macs, as darwin_get_object_archs() will skip over these libraries,
which then leads to the test failing because of using -l instead of
referencing the libraries by their full path.

I am not at all sure this is the best approach.

I am also somewhat confused why nobody else has encountered this? CI
apparently just runs on x86_64 macs?

CC: @tristan957
2023-12-13 00:44:59 +02:00
Charles Brunet c168687439 do not trigger workflows on dev branches 2023-12-13 00:13:15 +02:00
H. Vetinari cc5a95a56a detect windows linkers for flang in detect_fortran_compiler 2023-12-11 21:54:47 +02:00
Eli Schwartz fbb8030b27 xcode backend: sundry type annotations
Down from 120 to 44 mypy errors.
2023-12-11 21:13:20 +02:00
Eli Schwartz ff7a997f48 xcode backend: make the type of get_target_dir align with parent class
mypy will complain if backends.Backend has a lru_cache wrapped method,
but it is overridden in XCodeBackend with a method that isn't cached.

This is almost certainly a sign that we should be caching it here too
anyway. The generic backend cache was added years ago via an
intimidating commit f39d2cc3bf which
claims that it reduced call time from 60s to 0.000435s and that this was
specifically due to getting a coredata option every single time. This is
probably workload dependent, but getting an option is *not* nearly as
cheap as a throwaway function call.
2023-12-11 21:13:20 +02:00
Eli Schwartz d8a6bf9352 xcode backend: delete unused code 2023-12-11 21:13:20 +02:00
Eli Schwartz 78e23e48f2 backends: correct nonebackend return annotation and check in run_mypy
The only backend that can return values in generate() is ninja, so this
was useless cruft.
2023-12-11 21:13:20 +02:00
Eli Schwartz c341900d45 coredata: add a few more type annotations
89 erros down to 34. Most of them are from getting the `BUILTIN_*`
variables correct.
2023-12-11 21:13:20 +02:00
Albert Tang b1d2282078
xcode: Filter out targets not built by default 2023-12-10 22:01:23 -05:00
Albert Tang 2915ab31af
xcode: Override determine_swift_deps_dir()
Xcode does not recognize our private directories, nor does it ever
try to generate them. Instead, just import the build directories
for each swift dependency.

This fixes linking between swift targets when they are in their own
subdirectories, as they will have different build directories in that
case.
2023-12-10 22:01:23 -05:00
Albert Tang 354843c428
xcode: Enclose work directory in shell scripts 2023-12-10 22:01:23 -05:00
Albert Tang 1de398a377
xcode: Wrap custom target output paths in quotes
Without this, any build directory with a space in it was enough to
make Xcode fail to open the project due to parsing errors.
2023-12-10 22:01:23 -05:00
Albert Tang 0914f1739b
xcode: Fix generating single generator phase 2023-12-10 22:01:23 -05:00
Albert Tang 1b09cac252
xcode: Search for dependencies for custom targets
When generating aggregated targets, custom targets were not being
checked for dependencies when they should have.

Fixes passing swift test case 4 (generate).
2023-12-10 22:01:23 -05:00
Albert Tang 3836deeed2
xcode: Classify metal and glsl files correctly
This fixes syntax highlighting on Xcode when viewing those files.
2023-12-10 22:01:23 -05:00
Albert Tang 5bf99afe1a
xcode: Set bridging header for mixed swift targets
This must be explicitly set in Xcode or it will not be able to compile
mixed targets successfully. This is not needed for pure Swift targets.

Set a new variable "is_swift" so finding the bridging header does not
take O(n^2) time.

Fixes passing swift test case 5 (mixed) with Xcode backend.
2023-12-10 22:01:23 -05:00
Albert Tang 9d8f69a16f
xcode: Add support for extra files
Fixes #10903
2023-12-10 22:01:23 -05:00
arch1t3cht af0464352a vs: Manually link generated .o files
Fixes #12550 .

VS automatically links CustomBuild outputs ending in .obj or .res,
but others need to be included explicitly.
2023-12-10 22:01:03 -05:00
Eli Schwartz 17c6d5eb47
unittests: migrate from jsonschema to fastjsonschema
The former has rust dependencies, which lead to max capping on Cygwin
since there is no rust compiler there. But it turns out there are other
disadvantages of jsonschema:

- it involves installing 5 wheels, instead of just 1
- it is much slower

To give some perspective to the latter issue, this is what it looks like
when I test with jsonschema:

```
===== 1 passed, 509 deselected in 3.07s =====
Total time: 3.341 seconds
```

And here's what it looks like when I test with fastjsonschema:
```
===== 1 passed, 509 deselected, 1 warning in 0.28s =====
Total time: 0.550 seconds
```

I cannot think of a good reason to use the former. Although in order to
work on old CI images, we'll support it as a fallback mechanism
2023-12-10 19:02:39 -05:00
Daniele Nicolodi 5883089f6c ninja backend: Remove outdated comment
Generation of both C and C++ from Cython is supported via the
cython_language option.
2023-12-09 23:45:05 -08:00
Daniele Nicolodi 76ab2db086 ninja backend: Adjust naming and comments
Meson supports other transpilers generating source code for which
compilation rules need to be generated other than Vala. Reflect this
in variable names and comments to avoid confusion.
2023-12-09 23:45:05 -08:00
Daniele Nicolodi c2ea14fbd2 ninja backend: Make values passed to bool argument consistent 2023-12-09 23:45:05 -08:00
Daniele Nicolodi 7fbadfdeab ninja backend: Remove always true check 2023-12-09 23:45:05 -08:00
Stas Sergeev be04234c85 external_project.py: fix --host value
Currently in cross-compilation mode the --host is set to x86-linux-linux,
which results in an error.
Change the code so that for x86 and x86_64 the second part is 'pc',
and 'unknown' for the rest.
Use cpu model instead of cpu family for the first part, as suggested
by @dcbaker
As the result, we get: i386-pc-linux on my setup.

Fixes #12608
2023-12-08 12:31:01 -05:00
Erwin Jansen 5de09cbe88 Always use posix paths when retrieving link name
This commit modifies the get_target_filename_for_linking function to
always return POSIX-style paths, even on Windows systems. This is
necessary because the Ninja generator can have issues with Windows-style
paths when using the `/WHOLEARCHIVE:` flag.

This is consistent with the syntax accepted by the cl and clang-cl
compilers, as documented in the Microsoft documentation:
https: //learn.microsoft.com/en-us/cpp/build/reference/cl-filename-syntax?view=msvc-170

Fixes: 12534
2023-12-07 11:59:40 +02:00
David Robillard 254abb999f Fix coverage with lcov 2.0 and uncovered subprojects
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-12-06 23:54:42 +02:00
Andres Freund 7148b4f207 macos: Do not emit -undefined,error for Sonoma compatibility
Emitting -undefined,error was correct,, but starting with Xcode 15 / Sonoma,
doing so triggers "ld: warning: -undefined error is deprecated". Given that
"-undefined error" is documented to be the linker's default behaviour, this
warning seems ill advised. However, it does create a lot of noise.  As
"-undefined error" is the default behaviour, the least bad way to deal with
this seems to be to just not emit anything. Of course that only works as long
as nothing else injects -undefined dynamic_lookup, or such. Complain to Apple.

Fixes: https://github.com/mesonbuild/meson/issues/12450
2023-12-06 23:20:09 +02:00
Eli Schwartz 39ecfc2d54
compilers: drop dead code
no_warn_args is unused. Its only purpose was to implement automatic
hiding of UB in transpiled code, and it was not used at all in languages
other than C/C++ -- specifically when the C/C++ source files were
created by transpiling from vala or cython.
2023-12-05 19:52:23 -05:00
Eli Schwartz 5f659af870
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.
2023-12-05 19:51:56 -05:00
Andres Freund 30184a48a0 macos: Skip as-needed test, the linker is too smart
The new linker in Sonoma / Xcode 15 considers the dependency via the
initializer sufficient to pull in the library. The man page now notes:
  The linker never dead strips initialization and termination routines.
  They are considered "roots" of the dead strip graph.

I could not find a good way to skip only if the linker version is new
enough. Before long everyone will be using the new linker anyway...
2023-12-04 23:54:59 +02:00
Dylan Baker f1c748df87 run_project_tests: remove debug print 2023-12-04 14:36:43 -05:00
Randy Eckenrode dcff439df0 Fix test failure on Darwin on a case-sensitive fs
This was encountered while looking into an issue with
https://github.com/NixOS/nixpkgs/pull/268583.

I run my Nix store on case-sensitive APFS, so the test fails due to
trying to link `-framework ldap` instead of `-framework LDAP`.
2023-12-04 16:23:59 +02:00
Christoph Reiter 6eee9e7c0c python: fix mingw python detection code in case pkg-config isn't available
The code assumed that sysconfig.get_platform() returns "mingw" for mingw Python,
but that's no longer the case for 2.5 years now, as it now only starts with
"mingw" and contains further information like the arch and other ABI relevant things
to avoid conflicts.

This updates the detection code to the current status quo. mingw Python only documents
right now that it starts with "mingw", and none of that arch stuff, but it's
unlikely that this will change, and this looks less error prone than looking at CC.

Fixes #12547
2023-12-03 13:42:45 -05:00
Andres Freund 4ddaef8133 macos: Fix test case for constructor_priority when using gcc
GCC does not support constructor_priority on macos. It's possibly not the only
platform for which that is the case, but...
2023-12-03 14:04:46 +02:00
Andres Freund c1f0897248 macos: Fix path in test to be Sonoma compatible
The path tested prior does not exist anymore in Sonoma. It seems less likely
that 'cat' will be removed, so use that.
2023-12-03 12:53:15 +02:00
Andres Freund eb44957c1f Handle macos linker reporting error message in pluring during detection
Previously macos reported "ld: unknown option: --version" when being passed
--version, but now sometimes it reports in plural, albeit without an obvious
pattern when.  To handle that, simply just check for the prefix without the :

Fixes: https://github.com/mesonbuild/meson/issues/12552
2023-12-03 12:50:04 +02:00
Jan200101 9016e6958b 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`
2023-12-02 19:51:44 -05:00
Dylan Baker a85353cd83 cmake: Handle compiler.find_library returning None
I'm not 100% sure that warning is the appropriate action, but it's
better than failing with a backtrace.

Fixes: #12555
2023-12-01 16:19:16 -08:00
Dylan Baker 52638e8c65 dependencies/base: Make MissingCompiler inherit Compiler for mypy
This allows mypy and pyright to correctly determine the return types
from methods, but makes 0 changes at runtime.
2023-12-01 16:19:16 -08:00
Will Toohey 8c70ce466b More robust linker detection for armar (TI vs non-TI) 2023-12-01 22:11:41 +02:00
Eli Schwartz cf64e062bb run_mypy: avoid type-checking tools against every possible python version 2023-11-26 17:12:52 -05:00
Eli Schwartz 739bdef431 NOMERGE: do we need strictyaml too? 2023-11-26 17:12:52 -05:00
Eli Schwartz caa38dad45 fix broken type annotation imports being ignored
If an annotation could not be resolved, it's classified as a "missing
import" and our configuration ignored it:

```
Skipping analyzing "mesonbuild.backends": module is installed, but missing library stubs or py.typed marker
```

As far as mypy is concerned, this library may or may not exist, but it
doesn't have any typing information at all (may need to be installed
first).

We ignored this because of our docs/ and tools/ thirdparty dependencies,
but we really should not. It is trivial to install them, and then
enforce that this "just works".

By enforcing it, we also make sure typos get caught.
2023-11-26 17:12:52 -05:00
Xavier Claessens 319b41b4c9 mlog: Catch OSError when closing pager
For some reasons, with msys2 it sometimes raises OSError instead of
BrokenPipeError.

Fixes: #12541
2023-11-26 01:37:02 -05:00