Commit Graph

478 Commits

Author SHA1 Message Date
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
Eli Schwartz 187dc656f4
merge various TYPE_CHECKING blocks into one
A bunch of files have several T.TYPE_CHECKING blocks that each do some
things which could just as well be done once, with a single `if`
statement. Make them do so.
2022-03-07 19:01:04 -05:00
Dylan Baker 5f595f0d1b coredata: fix annotations of get_option 2022-03-03 10:29:14 -08:00
Eli Schwartz 4934b9968a
fix missing encodings
These were caught by the testsuite erroring out with a fatal
EncodingWarning due to the previous commit.

Fixes #9996
2022-03-01 21:42:52 -05:00
Eli Schwartz 78945fb983
python module: add option to specify a python environment to install to
The default behavior of installing relative to prefix may be unexpected,
and is definitely wrong in many cases.

Give users control in order to specify that yes, they actually want to
install to a venv.

This is particularly useful for projects that use meson as a build
system for a python module, where *all* files shall be installed into
the python site-packages.
2022-02-22 22:22:16 -05:00
Jan Tojnar df451f1013 meson: Allow directory options outside of prefix
This bring us in line with Autotools and CMake and it is useful
for platforms like Nix, which install projects
into multiple independent prefixes.

As a consequence, `get_option` might return absolute paths for some
directory options, if a directory outside of prefix is passed.

This is technically a backwards incompatible change but its effect
should be minimal, thanks to widespread use of `join_paths`/`/` operator
and pkg-config generator module. It should only cause an issue when
a path were constructed by concatenating the value of directory path option.

Also remove a comment about commonpath since we do not use that since
<00f5dadd5b>.

Fixes: https://github.com/mesonbuild/meson/issues/2561
2022-02-09 11:04:59 -05:00
Jussi Pakkanen 3ab08265c0 Bump version number for new development. 2022-01-10 19:00:28 +02:00
Jussi Pakkanen 9e1f20728f Prepare release 0.61.0. 2022-01-10 18:27:11 +02:00
Jussi Pakkanen 09f52a3817 Bump version numbers for rc1. 2022-01-02 22:22:31 +02:00
Eli Schwartz db528e3bb9
fix crash during MesonException
In commit e5a6283c4c, this function was
reorganized to assign value -> newvalue instead of overwriting newvalue,
but the error message case wasn't updated to match. As a result,
actually hitting the error would report an even more errory error, i.e.
a traceback.

(Actually hitting the error requires passing an array option as a python
object that isn't a list or a string. This is impossible to do from the
command line or meson_options.txt, but can be done with builtin options.)
2021-12-30 15:15:25 -05:00
Crend King 809792c223 Support Visual Studio 2022 backend 2021-11-21 08:08:11 -05:00
Eli Schwartz 8947352889 fix various flake8 whitespace errors 2021-10-27 09:51:52 -04:00
Jussi Pakkanen 954fa95133 Bump version number for new development. 2021-10-24 19:09:47 +03:00
Jussi Pakkanen f64e5cee6b Bump version number for release. 2021-10-24 18:12:07 +03:00
Jussi Pakkanen cf587f39ea Update version number for rc2. 2021-10-19 17:00:45 +03:00
Jussi Pakkanen a331ba1b8b Bump version number for rc1. 2021-10-11 19:52:04 +03:00
Christian Clauss a5020857f3 Fix typos discovered by codespell 2021-10-10 16:12:25 -04:00
Xavier Claessens 77ef437cc4 optinterpreter: Add deprecated kwarg
It can be either:
- boolean: the option is completely deprecated.
- list: some choices are deprecated.
- dict: some choices are deprecated and replaced by another.

Fixes: #7444
2021-10-09 18:13:34 -04:00
Xavier Claessens 329d111709 python: Add platlibdir and purelibdir options 2021-10-08 17:47:35 -04:00
Eli Schwartz 5a8e066c56
remove useless variables that are no longer or were never used 2021-10-04 16:29:31 -04:00
Xavier Claessens ca866bcfc7 coredata: 0.59.1 -> 0.59.99 is a major version difference
Remove test_minor_version_does_not_reconfigure_wipe() because when run
during dev cycle that test reconfigure with .99 -> .100 which is
considered a major version change now. It is covered by a more efficient
internal test now anyway.

While at it, remove no-op `with Path(self.builddir):` statement, the
intention was clearly to set workdir.

Fixes: #9260
2021-09-21 18:09:12 +02:00
Eli Schwartz 87e13af1c8
apply flake8 fixes for unused imports and missing imports 2021-09-14 15:55:07 -04:00
Xavier Claessens 5e55a0bb2b interpreter: Add summary of all user defined options
It is a commonly needed information to help debugging build issues. We
already were printing options with non-default value at the end of the
configure but outside of the summary.

Keeping the list of user defined options in the interpreter will also in
the future be useful to use new default value on reconfigure.
2021-09-02 19:38:29 -04:00
Dylan Baker 4d7031437c pylint: turn on superflous-parens
We have a lot of these. Some of them are harmless, if unidiomatic, such
as `if (condition)`, others are potentially dangerous `assert(...)`, as
`assert(condtion)` works as expected, but `assert(condition, message)`
will result in an assertion that never triggers, as what you're actually
asserting is `bool(tuple[2])`, which will always be true.
2021-08-31 16:28:54 -04:00
Dylan Baker e9639be167 compilers: Fix annotations for run and cached_compile
Which absolutely should accept `str | File`, but the annotations claim
that only strings are accepted.
2021-08-16 16:21:51 -07:00
Eli Schwartz 59d4f771d2
editorconfig: add setting to trim trailing whitespace
and clean up all outstanding issues

Skip 'test cases/common/141 special characters/meson.build' since it
intentionally uses trailing newlines.
2021-08-15 09:36:18 -04:00
Florian Schmaus dbf2ace6ca
coredata: throw a MesonException on unknown options
Fixes #7288.
2021-07-26 01:10:58 +03:00
Jussi Pakkanen 72f8838aad Bump version number for new development. 2021-07-18 15:04:34 +03:00
Jussi Pakkanen 116e4d4850 Set up the 0.59.0 release. 2021-07-18 13:39:53 +03:00
Jussi Pakkanen f6cb717bba Update version number for rc2. 2021-07-12 01:03:32 +03:00
Jussi Pakkanen 3a241496c8 Bump version number for rc1. 2021-07-05 22:11:31 +03:00
Eli Schwartz dd31891c1f more f-strings too complex to be caught by pyupgrade 2021-07-05 17:55:04 +03:00
Daniel Mensinger 3e396b3782
fix: Always explicitly set encoding for text files (fixes #8263) 2021-06-29 11:28:08 +02:00
fanc999 edfe24178d
Add Visual Studio 2012/2013 backends (#8803)
* backends: Add a Visual Studio 2013 backend

This is more-or-less a quick port from the VS2015 backend, except that
we update the Visual Studio version strings and toolset versions
accordingly.  Also correct the generator string for Visual Studio 2015
in mesonbuild/cmake/common.py.

* backend: Add VS2012 backend

Similar to what we did for Visual Studio 2013, add a Visual Studio 2012
backend.

* vs2010backend.py: Implement `link_whole:` if needed

We actually need Visual Studio 2015 Update 2 to use `/WHOLEARCHIVE:`,
which is what we are currently using for `link_whole:` on Visual Studio.
For Visual Studio versions before that, we need to expand from the
static targets that were indicated by `link_whole:`, and any of the
sub-dependent targets that were pulled in via the dependent target's
`link_whole:`.  This wil ensure `link_whole:` would actually work in
such cases.

* vs2010backend.py: Handle objects from generated sources

Unforunately, we can't use backends.determine_ext_objs() reliably, as
the Visual Studio backends handle this differently.

* vs2010backend.py: Fix generating VS2010 projects

Visual Studio 2010 (at least the Express Edition) does not set the envvar
%VisualStudioVersion% in its command prompt, so fix generating VS2010
projects by taking account into this, so that we can determine the location
of vcvarsall.bat correctly.

* whole archive test: Disable on vs2012/2013 backends too

The Visual Studio 2012/2013 IDE has problems handling the items that would be
generated from this test case, so skip this test when using
--backend=vs[2012|2013].  This test does work for the Ninja backend when
VS2012 or VS2013 is used, though.

Consolidate this error message with XCode along with the vs2010 backend.

* docs: Add the new vs2012 and vs2013 backends

Let people know that we have backends for vs2012 and 2013.  Also let
people know that generating Visual Studio 2010 projects have been fixed
and the pre-vs2015 backends now handle the `link_whole:` project option.
2021-06-22 21:00:23 +03:00
Daniel Mensinger 66b32a4591 holders: Introduce HoldableObject 2021-06-18 23:48:33 +02:00
Xavier Claessens d5917c1b87 coredata: Invalidate deps cache when changing wrap_mode option
Fixes: #8858
2021-06-11 09:40:21 -04:00
Daniel Mensinger 25875ae0d3 typing: Fully annotate dependencies.{detect,factory} + some other fixes 2021-06-06 20:30:24 +03:00
Daniel Mensinger 49c730ef05
cmake: Fix CMakeToolchain (fixes #8293)
Instead of guessing the internal compiler
variables, Meson now runns CMake once to
determine what they actually are.
2021-05-29 13:20:25 +02:00
Dylan Baker a5b43aa16c Add a helper to simplify the usage of PerMachineDefaultable 2021-05-28 09:26:38 -04:00
Dylan Baker 76b98459ac coredata: Use a PerMachineDefaultable for the deps cache 2021-05-28 09:26:38 -04:00
Jussi Pakkanen 8810583864 Bump version number for new development. 2021-05-02 13:34:58 +03:00
Jussi Pakkanen 753954be86 Release 0.58.0. 2021-05-02 12:42:42 +03:00
Jussi Pakkanen a493c950a7 Bump version number for rc1. 2021-04-26 23:39:15 +01:00
Dylan Baker d4e867809b store the list of initializes subprojects in the coredata structure
We need to konw on rconfigure which options have already bee set not
just for the super project, but also for the subproject. However, using
first_invocation is not sufficient, as a reconfigure could add a new
subpproject that wasn't present before, and we need to initialize that
project's builtins.
2021-04-26 17:05:44 +01:00
Dylan Baker aac67b502b coredata: Check for built-in options as host options
These options often don't exist for the build machine, as they're
generally invalid (ie, prefix, libdir, etc). So we should always check
for their existance as host optiuons, since all we want to know in this
case is if the option is yeilding (valid per-subproject), and build/vs
host doesn't matter in that cases:

Fixes #8613
2021-04-06 16:09:13 -07:00
Dylan Baker 2cd0723c42 Split environment variable and command line cflags
They are supposed to have different behavior. The environment variables
apply to both the compiler and linker when the compiler acts as a
linker, but the command line ones do not.

Fixes #8345
2021-03-30 18:52:17 +03:00
Dylan Baker 23c706add1 coredata: Fix dependency cache
The host cache had BUILD, which is wrong.
2021-03-28 22:44:21 +03:00
Xavier Claessens 20a90cf709 cmd_line_file.txt: Use cross/native file path resolved by coredata
This fix issue when using --wipe and the machine file was passed as a
pipe and written locally, or when the file was resolved in XDG_DATA_HOME
or XDG_DATA_DIRS.

Fixes: #8560
2021-03-22 14:45:10 -04:00
Paolo Bonzini 32e49b5ff2 coredata: be more robust on unpickling errors
When reverting from 0.57 to 0.56, one can see an error like this:

  File /Users/pm215/src/qemu-for-merges/meson/mesonbuild/coredata.py,
line 1016, in load
    obj = pickle.load(f)
ModuleNotFoundError: No module named 'mesonbuild.mesonlib.universal';
'mesonbuild.mesonlib' is not a package
FAILED: build.ninja

The reason is that the old version fails to resolve mesonbuild.mesonlib,
which is a similar situation to the existing AttributeError check.  Raise
a MesonException for ModuleNotFoundError as well, so that reconfiguration
proceeds using cmd_line.txt.
2021-03-16 09:32:57 -04:00
Eli Schwartz 6a0fabc647
mass rewrite of string formatting to use f-strings everywhere
performed by running "pyupgrade --py36-plus" and committing the results
2021-03-04 17:16:11 -05:00
Eli Schwartz 4340bf34fa
various python neatness cleanups
All changes were created by running

"pyupgrade --py3-only --keep-percent-format"

and committing the results. I have not touched string formatting for
now.

- use set literals
- simplify .format() parameter naming
- remove __future__
- remove default "r" mode for open()
- use OSError rather than compatibility aliases
- remove stray parentheses in function(generator) scopes
2021-03-04 17:11:26 -05:00
Jussi Pakkanen ba99181ba7 Bump version for new development. 2021-02-14 21:57:29 +02:00
Jussi Pakkanen 5d651e76b5 Set up release 0.57. 2021-02-14 21:28:44 +02:00
Jussi Pakkanen ba770d1877 Bump version numbers for rc1. 2021-02-09 01:20:19 +02:00
Volker-Weissmann f31ffaaf17
bugfix concerning octal umasks (#8282)
* bugfix concerning octal umasks

* minor fix

* spelling mistake
2021-02-01 09:48:48 -08:00
Jussi Pakkanen 8133a7b9a4 Keep buildtype the same even if user changes debug and/or optimization. 2021-01-19 20:25:55 +00:00
Xavier Claessens 5db77fd103 coredata: Add missing nopromote wrap_mode choice 2021-01-14 18:29:28 +00:00
Dylan Baker 4b0b44afac move handling of CFLAGS and friends to environment
This has a bunch of nice features. It obviously centralizes everything,
which is nice. It also means that env is only re-read at `meson --wipe`,
not `meson --reconfigure`. And it's going to allow more cleanups.
2021-01-11 11:15:06 -08:00
Dylan Baker a539fda0cf fix LGTM warnings 2021-01-04 12:20:59 -08:00
Dylan Baker e81acbd606 Use a single coredata dictionary for options
This patches takes the options work to it's logical conclusion: A single
flat dictionary of OptionKey: UserOptions. This allows us to simplify a
large number of cases, as we don't need to check if an option is in this
dict or that one (or any of 5 or 6, actually).
2021-01-04 12:20:58 -08:00
Dylan Baker 71db6b04a3 use OptionKey for builtin and base options
I would have prefered to do these seperatately, but they are combined in
some cases, so it was much easier to convert them together.

this eliminates the builtins_per_machine dict, as it's duplicated with
the OptionKey's machine parameter.
2021-01-04 12:20:40 -08:00
Dylan Baker f9b19e73a5 move OptionKey to mesonlib
There's starting to be a lot of things including coredata that coredata
needs to itself include. putting it in mesonlib makes more sense
2021-01-04 12:20:40 -08:00
Dylan Baker fe973d9fc4 use OptionKey for compiler_options 2021-01-04 12:20:39 -08:00
Dylan Baker 615686fd6d use new optionkey.is_* methods 2021-01-04 12:15:41 -08:00
Dylan Baker 30ec7612c8 coredata: Add a type to the OptionKey
This is useful for figuring out what kind of option this is. My hope is
that in the longterm this is less useful, but we'll still want it for
the configuration summary printing.
2021-01-04 12:15:41 -08:00
Dylan Baker 7142c92285 use OptionKey for backend_options 2021-01-04 12:15:41 -08:00
Dylan Baker e2ef6930ff use OptionKey for coredata.user_options 2021-01-04 12:15:41 -08:00
Dylan Baker b37f0cce2c movve insert_build_prefix to mconf
that's the only place it's used anyway.
2021-01-04 12:15:41 -08:00
Dylan Baker b25a423a64 use the OptionKey type for command line and machine files 2021-01-04 12:15:41 -08:00
Dylan Baker 983380d5ce coredata: Add OptionKey type
This is a complex key that can store multiple bits of data in a single
place. It can be generated from a command line formatted string, and
it's str method returns it to that form.

It's intentionally immutable, use the evolve() method to create
variations of an existing key.
2021-01-04 12:15:41 -08:00