| Age | Commit message (Collapse) | Author |
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Since OptionKey is immutable, it is possible to return self
if we know that the returned value is the same as the one
being transformed.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Fixes: #15258
|
|
|
|
1. Generate OMF objs with `-Zomf' compiler flags
2. Generate OMF libs with `.lib' suffix using `emxomfar' as a librarian
|
|
Options are now added to pending_options only if they *can* be accepted
as pending, so there is never a need check if something is in pending_options
but not acceptable.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
No need to focus on the "value" part of the name.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
The keys are always global and there are no yielding
options in fact; historically it was the way to make an option
not per-subproject, but that's no longer needed.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Just move everything to optstore, together with the methods it calls.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
This is a simple access, and there are already uses of COMPILER_BASE_OPTIONS
outside options.py.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Only return True if the option actually exists. While at it, ensure
that the right machine is looked up in get_default_for_b_option; this
allows removing the try/except block.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
The two methods are identical.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
|
Boolean options need to be translated from string "true" to True and
so on, otherwise we will get an assertion later when trying to set the
value:
```
Traceback (most recent call last):
File "meson.git/mesonbuild/mesonmain.py", line 193, in run
return options.run_func(options)
~~~~~~~~~~~~~~~~^^^^^^^^^
File "meson.git/mesonbuild/msetup.py", line 395, in run
app.generate()
~~~~~~~~~~~~^^
File "meson.git/mesonbuild/msetup.py", line 194, in generate
return self._generate(env, capture, vslite_ctx)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
File "meson.git/mesonbuild/msetup.py", line 282, in _generate
captured_compile_args = intr.backend.generate(capture, vslite_ctx)
File "meson.git/mesonbuild/backend/ninjabackend.py", line 647, in generate
self.generate_target(t)
~~~~~~~~~~~~~~~~~~~~^^^
File "meson.git/mesonbuild/backend/ninjabackend.py", line 1099, in generate_target
elem = self.generate_link(target, outname, final_obj_list, linker, pch_objects, stdlib_args=stdlib_args)
File "meson.git/mesonbuild/backend/ninjabackend.py", line 3632, in generate_link
base_link_args = compilers.get_base_link_args(target,
linker,
self.environment)
File "meson.git/mesonbuild/compilers/compilers.py", line 405, in get_base_link_args
option_enabled(linker.base_options, target, env, 'b_lundef')):
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "meson.git/mesonbuild/compilers/compilers.py", line 234, in option_enabled
assert isinstance(ret, bool), 'must return bool' # could also be str
~~~~~~~~~~^^^^^^^^^^^
AssertionError: must return bool
```
This assertion is being hit because the vo-aacenc wrap sets
`b_lundef=true` in `default_options:` in `project()`, which ends up in
`self.augments` when the project is being invoked as a subproject.
The fix is to use set_option even for pending subproject options. This
will follow this path:
new_value = opt.validate_value(new_value)
old_value = self.augments.get(key, opt.value)
self.augments[key] = new_value
This regressed in 2bafe7dc403b92c7b1f7bbad62dd8533e90f8523.
First noticed at: https://github.com/mesonbuild/wrapdb/actions/runs/18123699172/job/51573947286?pr=2425
[Commit message by Nirbheek Chauhan <nirbheek@centricular.com>]
|
|
It doesn't appear to have been needed at all? But only newer mypy
versions go so far as to report it as an unused ignore (which is an
error code itself).
|
|
Newer mypy astutely notices this always sets `self.options[str_key]`,
which violates the type requirement for OptionKey. Per the comment,
nobody should be using it, and fortunately nobody is. Deleting the code
(or making it raise MesonBugException) has no impact on the testsuite.
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Filipe Laíns <lains@riseup.net>
Signed-off-by: Michał Górny <mgorny@quansight.com>
|
|
Fixes: #14956
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
OptionStore.get_value did not change build keys to host when not
cross-compiling. get_value_object_and_value_for also didn't when
accessing self.augments.
Make all accessors go through ensure_and_validate_key so that the
conversion is done early. Otherwise, when "native: true" targets look
up compiler options they do so with the "build.*" name, which does not
exist when not cross compiling.
This removes the distinction between get_value(), meant to be for global
options, and get_value_for() which would be for project-specific options.
While the distinction was added in commit d37d649b0 ("Make all Meson
level options overridable per subproject.", 2025-02-13), it is not
particularly useful and can be a source of bugs like the one in
test_build_to_host_subproject testcase (corresponding to issue #14869).
Fixes: #14869
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Ensure that valobj.yielding is cleared for options in the toplevel project.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
This reverts commit 9ad10ee78f632a60d35327eaa9b88c7efde35fe6. The "if"
in set_option() was removed, because get_key_and_value_object_for
now always returns the subproject key and option object; remove the
function as well.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
This makes it possible to adjust the value of the option with a
subproject-specific augment. This was an undocumented change in 1.8
which was (voluntarily) undone in commit eae4efa72 ("options: resolve
yielding options at the time they are added", 2025-07-13), but is
useful. This reimplementation of yielding options makes it possible
to presreve the bugfix while restoring this new feature.
Reported-by: Nirbheek Chauhan <nirbheek@centricular.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Optional[str]]
As a side effect, this deduplicates -D and -U arguments passed
to meson configure, taking into account the relative ordering
of -D and -U options.
Fixes: #14754
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Fixes: #14774
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
New languages and subprojects can appear in subsequent configurations.
Subproject options are kept for later now that they are not stored
in pending_options, but compiler options for example are not. Drop
OptionStore.clear_pending so that they are preserved as well.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Restore behavior of 1.7.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Remove all the special casing and late validation now that early augments
are stored in pending_subproject_options until the subproject is found.
As a result, this makes the buildtype special case operate on subprojects
as well. It also simplifies set_from_configure_command(), which does not
have to treat various kinds of options in different ways.
Fixes: #14729
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Fixes: 8dcc9d342 ("options: accept compiler and built-in options in --reconfigure and "meson configure"", 2025-05-21
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Reserve pending_options for those that could appear later in
the configuration process. Options are added there only if
accept_as_pending_option() is true.
This is a preparation for changing the code so that it checks
pending_options for subprojects as well.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Remove knowledge of the internal pending_options from msetup;
operate on the command line and check against the option store.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
As shown in the test, "-Dtests=true" should not override the
subproject() call because tests is a project options and those
do not share a namespace.
Fixes: #14728
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
These options are never looked up except by "meson configure" and
introspection, because option values are taken from self.augments[]
instead.
Fixes: #14558
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Thanks to several fixes applied between commit d37d649b0 ("Make all
Meson level options overridable per subproject.", 2025-02-13) and now,
OptionStore never gets a string key. Tighten the type of OptionDict,
and use it whenever possible.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
self.project_options is set already a couple lines above.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
There is common logic hiding between project() and "meson configure": the
complication that the comment mentions for the "default_options" case
actually applies to "meson configure", to machine files, to command line
options and to project options. Reuse the same function in all four cases.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Suggested-by: Dylan Baker <dylan@pnwbakers.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
They must be there when running re-configuring, because the backend cannot
be changed, but they can be pending on the first invocation.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Starting with Meson 1.8.0, "meson configure" prints some options as
":foo" instead of "foo". Print the option as it was passed by the
user.
While at it, make errors more consistent and/or correct (e.g.
"Unknown option" instead of "Unknown options").
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Restore the behavior from before commit d37d649b0 ("Make all Meson level
options overridable per subproject.", 2025-02-13). The old code was:
options: T.MutableMapping[OptionKey, T.Any] = OrderedDict()
# process project default options
for k, v in default_options.items():
if not subproject or k.subproject == subproject:
options[k] = v
# override them with machine default and command line options
options.update(env.options)
env.options = options
Fixes: #14608
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Make more of the first-invocation logic apply to subsequent configuration
of the build tree.
This also opens the door for using set_option_maybe_root for the
first invocation. This is a huge cleanup but also a larger change,
and therefore not something for stable branches. Leave it for later.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
configure"
Follow the same logic that is used at the end of the first invocation.
This fixes
meson setup --reconfigure -Db_ndebug=true
on a project that has no language that defines b_ndebug.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
The check for unknown options is duplicated in OptionStore and MesonApp. Place the
better version of the two as a new method of OptionStore, and use it in
OptionStore.validate_cmd_line_options.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|