Commit Graph

1387 Commits

Author SHA1 Message Date
Jussi Pakkanen 5365d9a842 Refactor option classes to their own file. 2024-05-23 21:26:45 +03:00
Eli Schwartz 125d3344ec
pylint: fix false positive for variable defined in different copies of conditional
We do:

```
if is_thing:
    assignme = value

if_is_thing:
    ...
else:
    assignme = []
```

It is always defined on both sides, but there was no particular reason
we had to assign it in the later copy. pylint reported it as a false
positive, and it may prove confusing in general, and it's harmless to
move, so do so.
2024-05-19 15:49:45 -04:00
Jussi Pakkanen 128f0e828e
Pass wrapmode value around as a string. (#13229) 2024-05-19 20:58:46 +03:00
Tristan Partin 05e107832d Pass --quiet to glib-genmarshal
No need to spam about reading the input file.

Fixes: #13119
2024-04-23 18:18:50 +03:00
Momtchil Momtchev 286898219b add an error message for targets that are not dependencies 2024-04-22 10:04:57 -07:00
Dylan Baker d617dc6869 modules: rename qt.py -> _qt.py
Since it's an implementation detail, and shouldn't be exposed. This also
helps give better error messages when a user writes `import('qt')`,
since otherwise you get an error about `qt doesn't have an initialize
method`, and now you get `qt module doesn't exist`.
2024-04-09 12:27:39 -07:00
Matthijs Velsink 7ebbce2072 gnome: Fix indentation of mkenums_simple generated code
Commit 83facb3959 switched to using
`textwrap.dedent` for the code templates for `gnome.mkenums_simple`.
That changed indentation, however, making the generated code harder to
understand.

We improve this by properly indenting the multiline strings before
dedenting them. For optional parameters `decl_decorator` and
`header_prefix`, we add a newline if they are set to keep separation
between generated code blocks.
2024-04-08 12:47:03 -07:00
Stephan Lachnit e7c7f6fa37 cmake: fix incorrect decorator for append_link_args
Signed-off-by: Stephan Lachnit <stephanlachnit@debian.org>
2024-03-18 09:32:47 -07:00
Xavier Claessens 3afbe042af wayland: Stable protocols can have a version
Fixes: #12968
2024-03-15 09:24:46 -04:00
Charles Brunet f9479787a0 fix reconfigure subproject base options 2024-03-10 13:09:32 -07:00
Dylan Baker 2b5c8cc6a7 modules/rust: Fix New Version check that was not updated
Should be 1.4.0 but was 1.3.0
2024-02-26 09:59:39 -08:00
Xavier Claessens 5654f03450 interpreter: Dependency variables can be empty string
There is no reason to forbid empty variables, PkgConfigCLI.variable()
even has code specifically for handling that case.
2024-02-26 10:03:51 -05:00
Tristan Partin 6a119256a1 Add support for BuildTargetTypes to various fs module functions
The new support was added to fs.name, fs.parent, fs.replace_suffix, and
fs.stem.
2024-02-24 13:09:24 -08:00
Tristan Partin 0b19d1c015 Correct fs.read function name in exception message 2024-02-24 13:09:24 -08:00
Tristan Partin 35c6052723 Fix fs module FeatureNew prefixes to match the function name
They were appending _file to the function name when they were meant to
suggest that the function now supports file objects.
2024-02-24 13:09:24 -08:00
Tristan Partin 9cb44c9c58 Fix bad escape character in doc comment 2024-02-24 13:09:24 -08:00
Karol Herbst d44185026d meson/rust: wrap `bindgen`s `wrap-static-fns` functionality
This way the `rust.bindgen` can generate a second output being a C file,
which contains wrapper functions for static inline ones.

This output file can then be compiled via C targets.
2024-02-24 09:11:00 -08:00
Tristan Partin db8246b3fc
Alphabetize the fs module methods dict 2024-02-23 13:32:50 -05:00
Tristan Partin 1b40fb1089
Add location nodes to FeatureNews in the fs module 2024-02-23 13:31:08 -05:00
Dylan Baker e7f20efc8b modules/rust: allow setting a version constraint on bindgen
This allows us to ensure that the bindgen we're using is suitable for
our purpose.
2024-02-23 09:48:32 -08:00
Dylan Baker 9752b89100 modules: fix find_program.wanted
Which should be `str | list[str]`, not `str | None`.
2024-02-23 09:48:32 -08:00
Dylan Baker a75ced6d50 modules/rust: inject a C/C++ standard for bindgen
Especially for C++ this is very important.
2024-02-23 09:48:32 -08:00
Dylan Baker 05d49c6990 modules/rust: Allow explicitly setting the language to bind
This may be of particular use when a header is .h but should be treated
as a C++ header instead of a C header.
2024-02-23 09:48:32 -08:00
Dylan Baker 6a8330af59 rust/bindgen: Use Meson rules for C++ headers
Bindgen natively only considers .hpp to be C++ headers, but Meson
considers some additional extensions including .hh and .hxx to be C++.
2024-02-23 09:48:32 -08:00
Dylan Baker bc46ea22f7 modules/i18n: CustomTargets must have `install_dir` if installing
Since they do not implement a default install dir like BuildTargets do.

Fixes: #12843
2024-02-22 09:05:07 -08:00
Charles Brunet b290a82541 Fix KeyError in Python module
0e7fb07 introduced a subtile bug in the Python module.
If a python version is found, but is missing a required module,
it is added to the list of python installations, but the
`run_bytecompile` attribute for that version was not initialized.
Therefore, if any other python version added something to install, it
was raising a KeyError when trying to read the `run_bytecompile`
attribute for the python version with missing module.
2024-02-19 21:52:09 +02:00
Eli Schwartz 65ee397f34
cuda module: fully type annotate
Special notes:
- _nvcc_arch_flags is always called with exact arguments, no need for
  default values
- min_driver_version has its args annotation loosened because it has to
  fit the constraints of the module interface?
2024-02-12 23:51:35 -05:00
Eli Schwartz 5899daf25b
cuda module: use typed_pos_args for most methods
The min_driver_version function has an extensive, informative custom
error message, so leave that in place.

The other two functions didn't have much information there, and it's
fairly evident that the cuda compiler itself is the best thing to have
here. Moreover, there was some fairly gnarly code to validate the
allowed values, which we can greatly simplify by uplifting the
typechecking parts to the dedicated decorators that are both really good
at it, and have nicely formatted error messages complete with reference
to the problematic functions.
2024-02-12 23:35:39 -05:00
Eli Schwartz 1b15176168
cuda module: inline single-shot function to get compiler version
It is pretty trivial and more confusing when standalone, especially the
use of a sentinel "unknown" string as a standin for "this isn't one of
the allowed object types". Much easier to directly raise an error in the
fallthrough/else.
2024-02-12 23:13:59 -05:00
Eli Schwartz 8ff25c0bca
cuda module: fix type signature for oneshot function
It is only ever invoked once. It has a statically known signature based
on how it's used, so there's no good reason to allow it to accept any
defaults -- and defaulting to None messes with type safety.

Saturate is always given, so don't claim it is only sometimes.
2024-02-12 23:13:59 -05:00
Eli Schwartz cf35d9b4ce
cuda module: use typed_kwargs
This officially only ever accepted string or array of strings.
2024-02-12 23:12:10 -05:00
Eli Schwartz dbfc9d0908
dlang module: simplify dependency handling with DRY
It can be a list or a single dependency, but the same logic happens
either way. Instead of manually expanding the logic for both cases, just
convert it to a list as needed.
2024-02-12 18:52:42 -05:00
Charles Brunet f4f50db441 qt: add preserve_paths keyword to functions
This allow to generate ui and moc under subdirectories,
as this is allowed with generic generators.
2024-02-12 15:49:55 -08:00
Ole André Vadla Ravnås e0d83359aa find_tool: fix error message interpolation 2024-02-08 15:28:18 -08:00
Dylan Baker 55d30b61ff rust: Add `--extern proc_macro` in `rust.proc_macro() not in cargo translation
Cargo does this by default, so it's reasonable that we do the same.

Fixes: #12758
2024-01-30 10:58:14 -08:00
Dylan Baker 37883e7d5f modules/fs: use ModuleState object instead of Interpreter when possible 2024-01-25 10:01:50 -08:00
Dylan Baker 6bd4f7c10e modules/sourceset: remove unused attributes from SourceSetImpl 2024-01-25 10:01:50 -08:00
Valeri ae857e841b
Vala: fixes to gresource handling (#12418)
* Vala: depend on gresources

Valac uses gresource at compile time to look up .ui files

* Automatically pass `--gresourcesdir` to valac

* gnome.compile_resources: clean up duplicate paths better

* Add a test for improved gresouce handling
2024-01-11 17:55:02 +02:00
Dylan Baker 6ccd708f30 modules: get rid of the .*machine variables
They're hardly used, and can be gotten directly from the Environment
instead
2023-12-22 11:31:48 -08: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
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
Chris Lamb 2ed94ccb47 Make the Requires.private line in generated .pkgconfig files reproducible
Whilst working on the Reproducible Builds effort, we noticed that
meson was generates .pkgconfig files that are not reproducible.

For example, here is neatvnc's pkgconfig file when built with HEAD^1:

   Name: neatvnc
   Description: A Neat VNC server library
   Version: 0.7.0
  -Requires.private: pixman-1, aml < 0.4.0, aml >= 0.3.0, zlib, libdrm, libturbojpeg, gnutls, nettle, hogweed, gmp, gbm, libavcodec, libavfilter, libavutil
  +Requires.private: pixman-1, aml >= 0.3.0, aml < 0.4.0, zlib, libdrm, libturbojpeg, gnutls, nettle, hogweed, gmp, gbm, libavcodec, libavfilter, libavutil
   Libs: -L${libdir} -lneatvnc
   Libs.private: -lm
   Cflags: -I${includedir}

This is, ultimately, due to iterating over the contents of a set within a
DefaultDict and can thus be fixed by sorting the output immediately prior to
generating the Requires.private string.

An alternative solution would be to place the sorted(…) call a few lines
down:

    return ', '.join(sorted(result))

However, this changes the expected ordering of the entire line, and many users
may be unhappy with that (alternative) change as a result. By contrast, this
commit will only enforce an ordering when there are multiple version
requirements (eg. a lower and a higher version requirement, ie. a version
range). It will, additionally, order them with the lower part of the range
first.

This was originally filed (with a slightly different patch) by myself in
the the Debian bug tracker <https://bugs.debian.org/1056117>.

Signed-off-by: Chris Lamb <lamby@debian.org>
2023-11-22 22:08:35 +02:00
Eli Schwartz 87480bc497 gnome module: fix invalid find_tool variable contents causing crash
If a tool that is looked up in a .pc file is supposed to be there and
has a pkg-config variable entry, but the value is incorrect, we can't
actually use it.

Since commit ab3d02066c we actually do run
the ExternalProgram search procedure on it though -- which caused it to
go wonky and return a None if it doesn't exist, instead of containing a
path to a program that does not exist and fails at build time. This is
better in the case where searching helps resolve .exe file extensions --
and worse in the case where patches to the dependency means nothing we
do is ever enough to actually find what is expected, since now we crash.

Raise an explicit error in such a case, pointing out that the dependency
itself is broken and needs a distributor-side resolution.

Fixes #12412
2023-11-05 17:41:34 -05:00
Eli Schwartz 01368ffb29
simd module: fix regression that broke using only some simd variants
Regression in commit a3d287c553.

When a given kwarg is not specified, we want to not generate it as a
simd variant. Since the default for buildtarget sources is `[]` it
resulted in building a static library with no sources, and a warning
stating that this was buggy and will eventually be removed.

Fix this by teaching buildtarget sources to allow None, and defaulting
to it specifically for the simd module. We can check this and then skip
processing entirely.

Fixes #12438
2023-10-28 21:58:54 -04:00
Chun-wei Fan ada6236f76 i18n module: Invoke itstool with the full command line
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-26 01:12:14 -04:00
Dylan Baker e6e07f46ea modules/rust: remove missed cargs.extend() 2023-10-20 20:21:08 +05:30
Dylan Baker d38bf5fbb0 interpreter: use typed_kwargs for build_target.gnu_symbol_visibility 2023-10-17 08:09:06 -07:00
Dylan Baker 357abf51c5 interpreter: use typed_kwargs for build_target.native 2023-10-17 08:09:06 -07:00
Dylan Baker 5fcf347661 modules/rust: only use include and define args from global/project args 2023-10-17 12:58:09 +05:30
Dylan Baker 658fe7243b modules/rust: remove rust_crate_type for test() method
This is required to test non-executable targets when they set an
explicit type.
2023-10-16 17:31:12 -07:00