Commit Graph

447 Commits

Author SHA1 Message Date
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
Paolo Bonzini e4d9ba5c9e improve help for -Ddebug
"Debug" is not a very helpful help message.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-04-27 08:37:31 -04:00
Xavier Claessens 3c8343b483 Allow deprecating an option for a new one 2022-04-21 14:18:29 -04:00
Fredrik Salomonsson 2e31330fe6 pkgconfig: Add relocatable module option
If set to true it will generate the pkgconfig files as relocatable i.e
the prefix variable will be relative to the install_dir. By default
this is false.

Will generate a MesonException if the pkgconfig file is installed
outside of the package and pkgconfig.relocatable=true.
2022-04-19 17:35:08 -04:00
Xavier Claessens 999fb3d1e9 coredata: Do not forget subproject's default_options 2022-03-22 17:20:48 -04:00
Xavier Claessens 06d12064d0 OptionOverrideProxy: Make it immutable to avoid copies
It is always used as an immutable view so there is no point in doing
copies. However, mypy insist it must implement the same APIs as
Dict[OptionKey, UserOption[Any]] so keep faking it.
2022-03-22 17:20:48 -04:00
Jussi Pakkanen a559dbe70d Bump version number for new development. 2022-03-22 00:13:50 +02:00
Jussi Pakkanen fb67adf3e6 Prepare the 0.62.0 release. 2022-03-21 23:24:01 +02:00
Paolo Bonzini ca7b16f937 coredata: be even more robust on unpickling errors
When reverting from 0.62 to 0.59, one can see an error like this:

line 1003, in load
    obj = pickle.load(f)
  File "/Users/pm215/src/qemu-for-merges/meson/mesonbuild/mesonlib/universal.py",
line 2076, in __setstate__
    self.__init__(**state)  # type: ignore
TypeError: __init__() got an unexpected keyword argument 'module'
FAILED: build.ninja

Raise a MesonException for TypeError as well, so that reconfiguration
proceeds using cmd_line.txt.
2022-03-16 10:49:26 -04:00
Jussi Pakkanen 1be444b464 Bump version number for rc2. 2022-03-15 11:30:58 +02:00
Jussi Pakkanen cec7d491f9 Bump version numbers for rc1 release. 2022-03-10 11:43:45 +02:00