Commit Graph

457 Commits

Author SHA1 Message Date
Xavier Claessens c16dd8d711 coredata: Malformed machine file is not a Meson bug
Fixes: #11899
2023-06-23 06:03:20 -04:00
Xavier Claessens c503c757f1 coredata: Fix wrong stable_version value 2023-06-13 21:14:34 -04:00
Xavier Claessens d8cb62bf2b Allow targetting Meson 1.2.0 when version is 1.1.99
When a project targets a dev version of Meson (e.g. 1.1.99) for
experimenting, this allows to use:

  project(..., meson_version: '>=1.2.0')

It avoids getting warnings when using FeatureNew for features introduced
in 1.2.0.
2023-06-13 10:32:48 -04:00
Eli Schwartz 95b03f7930 avoid clearing the dependency cache unnecessarily based on wrap-mode
We actually do not and should not care about wrap-mode at all for this.
We want to cache dependency lookups whenever humanly possible, but only
use them in cases where we would anyways be using them -- which in
particular means if we said to force a subproject fallback for this dep,
we want to bypass the cache.

Currently, we handle this by always looking up the cache for all
dependencies, but clearing the cache at startup if a reconfigure means
we are changing our resolution strategy. This is bad -- we might have
many dependencies that are worth caching, and only one dependency that
should stop being cached and use a subproject instead.

The simple solution is to handle the forcefallback case when doing a
cache lookup, and not do a cache lookup at all. Now we don't have to
nuke the entire cache. In fact, if a future reconfigure changes the
forcefallback state back to not being forced, we can reuse the original
cached dependency, which is still there.

Closes #11828
2023-05-29 15:04:34 -04:00
Eli Schwartz d3804d0579
Remove pointless install_umask validation check for None
This option can never have a value of None. There are only two sources
of values at all:

- the class instance initializer when defining BUILTIN_CORE_OPTIONS
- user-provided command-line or machine file values etc. which can only
  be meson types

We know we don't construct the Option instance with None, and users
cannot pass a None anywhere since that's not a meson type. The only
reason this was ever checked for was as an artifact during the initial
implementation of the option in commit 8651d55c6a.

At the time, a review comment was made that `-Dinstall_umask=none` was a
bad UX and "preserve" should be used instead. Before that, this option
type accepted `None` (in the BUILTIN_CORE_OPTIONS initializer) and
`'none'` (provided by users) which is odd and should have consistently
been the latter. Then inside set_value, it checked for the magic
initializer value and converted it to the real value.

After review comments and a force-push, the patch ended up using `None`
in the initializer, and `'preserve'` everywhere else, and still handling
both in set_value and converting both to a proper string.

In the very next commit in the patch series, the initializer was
migrated to use an actual umask of 022, and now `None` was entirely
impossible to get anywhere at all. But the wart of checking for it was
never removed. Remove it at long last.
2023-05-24 19:05:06 -04:00
Volker Weißmann 2699fd4b8a During reconfigure, show that no compiler was found, if compiler fails sanity check. 2023-05-13 11:06:24 +03:00
Eli Schwartz 0e7fb07f91
python module: add an automatic byte-compilation step
For all source `*.py` files installed via either py.install_sources() or
an `install_dir: py.get_install_dir()`, produce `*.pyc` files at install
time. Controllable via a module option.
2023-05-02 19:28:35 -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
Jussi Pakkanen eb472a133f Bump version number for new development. 2023-04-10 20:01:06 +03:00
Jussi Pakkanen ae163a3f3e Bump version number for release. 2023-04-10 18:39:25 +03:00
Jussi Pakkanen 71487c876e Bump version number for rc2. 2023-04-02 22:52:22 +03:00
Xavier Claessens ad151d9f11 coredata: Fix changing prefix option
This is a regression from #11537.
2023-03-30 17:01:04 -04:00
Xavier Claessens b30cd5d2d5 Make --vsenv a readonly builtin option
We need to remember its value when reconfiguring, but the Build object
is not reused, only coredata is.

This also makes CLI more consistent by allowing `-Dvsenv=true` syntax.

Fixes: #11309
2023-03-29 09:33:41 -04:00
Jussi Pakkanen 697b42f022 Bump version number for rc1. 2023-03-28 17:21:47 +03:00
Xavier Claessens 567d1fec9b Make backend option read-only 2023-03-28 00:36:37 +03:00
Eli Schwartz a024d75e15
backends: add a new "none" backend
It can only be used for projects that don't have any rules at all, i.e.
they are purely using Meson to:

- configure files
- run (script?) tests
- install files that exist by the end of the setup stage

This can be useful e.g. for Meson itself, a pure python project.
2023-03-20 17:22:50 -04:00
Daan De Meyer adb619db61 Stop using replace_if_different() for coredata pickle file
This was added in f774609 to only change the access time of the
coredata file if the coredata struct actually changed. However,
this doesn't work as pickle serializations aren't guaranteed to
be stable. Instead, let's manually check if options have changed
values and skip the save if they haven't changed.

We also extend the associated unit test to cover all the option
types and to ensure that configure does get executed if one of the
options changes value.
2023-03-16 17:18:30 -04:00
Dylan Baker 7c2ac4f8fe utils: fix annotation of pickle_load
It's actually Generic, and we should use Generic annotations to get the
correct result. This means that we don't have to assert or cast the
return type, because mypy just knowns
2023-03-09 19:03:44 -05:00
Andres Freund 9a41ce58d6 Add Compiler.cached_run()
Caching Compiler.run() seems likely to cause problems, but some users, like
.sizeof(), we know enough about the program run to make it safe.

This commit just adds the Compiler.cached_run(), a subsequent commit makes use
of it.
2023-02-27 20:09:32 -05:00
Eli Schwartz 680b5ff819
treewide: add future annotations import 2023-02-01 17:01:30 -05:00
X512 3074731797 haiku: set default prefix and library paths 2023-01-20 14:57:33 -05:00
Dylan Baker c8b8e7e732 coredata: allow deprecation to be passed to Option initializer
Instead of requiring it to be set outside the initializer
2023-01-20 00:18:42 -05:00
Dylan Baker 432c46e67c coredata: get rid of UserArrayOption `**kwargs`
Let's just pass the two arguments explicitly.
2023-01-20 00:18:42 -05:00
Dylan Baker 93e370c7dd coredata: use DEFAULT_YIELDING as the default value for Options
Instead of setting it to `Optional[bool] = None`, and then in the
initializer replacing `None` with `DEFAULT_YIELDING`, just set to to
`bool = DEFAULT_YIELDING`
2023-01-20 00:18:42 -05:00
Dylan Baker 3f733437da coredata: use a frozenset instead of a dict where values are always None 2023-01-20 00:18:42 -05:00
Dylan Baker e0efc7603e coredata: Make a deepcopy of global state before mutating
When a compiler is initialized, it adds specific options that it
supports, but taking some global UserOption objects and adding them to
itself. When it does so, it mutates then if necessary. This means that
each compiler initialized mutates global state, this is bad. This is
worse because in our test suite we do in process testing, so these
mutations are preserved *between tests*, potentially leading to
incorrect results. The simple fix is to do the right thing, and copy the
UserOption before mutating. A deepcopy is required because the option
might be an ArrayOption, and a shallow copy is not sufficient in that
case.
2023-01-18 17:55:41 -05:00
Xavier Claessens e96929f1b2 coredata: Remove dead code 2023-01-11 14:13:18 -05: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 0544ffabf1
add builtin option to install licenses
Unless `meson.install_dependency_manifest()` is explicitly used, this
will cause a default implied one to be installed.
2022-12-27 20:29:46 -05:00
Jussi Pakkanen 8e2355ebc8 Bump version number for new development. 2022-12-23 19:32:00 +02:00
Jussi Pakkanen 05f85c7945 This is it. The 1.0.0. 2022-12-23 18:13:43 +02:00
Jussi Pakkanen 9c1b6a95b0 Bump version number for rc2. 2022-12-17 00:27:25 +02:00
Jussi Pakkanen c8766468a3 Bump version numbers for rc1. 2022-12-10 18:48:22 +02:00
David Robillard 81d7c24a59 Add warning_level=everything
Adds a new maximum warning level that is roughly equivalent to "all warnings".
This adds a way to use `/Wall` with MSVC (without the previous broken warning),
`-Weverything` with clang, and almost all general warnings in GCC with
strictness roughly equivalent to clang's `-Weverything`.

The GCC case must be implemented by meson since GCC doesn't provide a similar
option.  To avoid maintenance headaches for meson, this warning level is
defined objectively: all warnings are included except those that require
specific values or are specific to particular language revisions.  This warning
level is mainly intended for new code, and it is expected (nearly guaranteed)
that projects will need to add some suppressions to build cleanly with it.

More commonly, it's just a handy way to occasionally take a look at what
warnings are present with some compiler, in case anything interesting shows up
you might want to enable in general.

Since the warnings enabled at this level are inherently unstable with respect
to compiler versions, it is intended for use by developers and not to be set as
the default.
2022-11-27 16:50:48 -05:00
Loïc Yhuel 11fe8f1157 Ignore unused compiler options for "meson configure"
"meson setup" ignores unused compiler options, like "cpp_args" on a project without C++.

"meson configure" doesn't have the filtering from "set_default_options", so it fails with :
ERROR: Unknown options: "cpp_args"

So now unused compiler options (ie not in coredata.options) are no longer marked unknown.

Fixes: #11060
2022-11-24 21:38:44 -05:00
Eli Schwartz 134e299eda mdist: fix error when running tests with a cross file
Since commit 1420d0dace we use coredata's
cmd_line.txt handler to get the right setup arguments. But there's a bug
in that -- it mishandles cross/native files, producing invalid
descriptions of the command line. The only other place this was used,
though, is when generating meson-log.txt.

Fix it to produce correctly formatted arguments.

Fixes #10980
2022-11-17 10:08:58 -08:00
Jussi Pakkanen 8abbcf7887 Bump version number for new development. 2022-11-06 17:05:06 +02:00
Jussi Pakkanen b9d19afb9a Bump version number for release. 2022-11-06 15:42:20 +02:00
Jussi Pakkanen 43e274c733 Bump version for rc2. 2022-11-01 21:00:43 +02:00
Jussi Pakkanen b0e2d00acd Bump version numbers for 0.64.0.rc1. 2022-10-25 19:35:01 +03:00
Jan Tojnar a590cfde0c compilers: Add optimization=plain option
https://github.com/mesonbuild/meson/pull/9287 changed the `optimization=0`
to pass `-O0` to the compiler. This change is reasonable by itself
but unfortunately, it breaks `buildtype=plain`, which promises
that “no extra build flags are used”.

`buildtype=plain` is important for distros like NixOS,
which manage compiler flags for optimization and hardening
themselves.

Let’s introduce a new optimization level that does nothing
and set it as the default for `buildtype=plain`.
2022-10-09 14:43:18 +03:00
Eli Schwartz 9e2d4994c4
fix incorrect type annotations for coredata compile/link args
These make no sense as single strings.
2022-08-24 23:49:13 -04:00
Daan De Meyer f774609b09 Only reconfigure if configure options actually changed
Currently, if we run "meson configure -Doption=value", meson will
do a reconfigure when running "ninja build" afterwards, even if
the new value is the same one that was already configured previously.

To avoid this unnecessary reconfigure, let's use replace_if_different()
instead of unconditionally replacing the conf file in coredata's save()
function.
2022-07-31 20:43:27 +03:00
Jussi Pakkanen 44c95087d0 Bump version number for new development. 2022-07-03 19:24:45 +03:00
Jussi Pakkanen 9c6dab2cfd Finalize the release. 2022-07-03 17:39:59 +03:00
Jussi Pakkanen eee861845d Bump version number for rc2. 2022-06-27 18:12:30 +03:00
Jussi Pakkanen 28a9c1fdad Update version numbers for rc1. 2022-06-19 22:20:53 +03:00
Xavier Claessens 2e3ac3eec0 minstall: Add more safety checks when unpickling installdata
When need to catch exceptions just like we do in coredata.load() to
print proper error message instead of backtrace when user mix meson
versions.

This happens frequently when user has a newer version of meson installed
in their HOME and then "sudo meson install" uses the system version of
meson.
2022-06-16 17:06:25 -04:00
Eli Schwartz 462b35e4b1 flake8: fix various whitespace nits 2022-06-13 13:34:39 +03:00
Dudemanguy 557680f7d6 add prefer_static built-in option
By default, meson will try to look for shared libraries first before
static ones. In the meson.build itself, one can use the static keyword
to control if a static library will be tried first but there's no simple
way for an end user performing a build to switch back and forth at will.
Let's cover this usecase by adding an option that allows a user to
specify if they want dependency lookups to try static or shared
libraries first. The writer of the meson.build can manually specify the
static keyword where appropriate which will override the value of this
option.
2022-05-03 23:03:56 -04:00