Commit Graph

478 Commits

Author SHA1 Message Date
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
Dylan Baker f6672c7a19 use real pathlib module
We added the _pathlib module to work around defeciencies in python 3.5's
implementation, since we now rely on 3.6 lets drop this
2020-11-20 15:08:40 -08:00
Elliot ff50f724bb
Fix #5492 (#7919)
* fix 5492 with cleaner code

* remove argparse import

* replace list(map( with list comprehension

* pass str rather than Path to get_cmd_line_file
2020-11-01 10:50:15 -08:00
Jussi Pakkanen 8fbf10c4bc Bump version number for new development. 2020-10-30 11:17:02 +02:00
Jussi Pakkanen f16d31607e Bump version number for release. This is the 10 000th commit! 2020-10-30 10:25:24 +02:00
Jussi Pakkanen 42d6b37423 Update version number to rc2. 2020-10-26 20:17:56 +02:00
Jussi Pakkanen 55d370e565 Bump version number for rc1. 2020-10-19 00:34:49 +03:00
Xavier Claessens 7271b1e942 Machine file pkg_config_path overrides environment
This is consistent with c_args in machine file overriding CFLAGS from
env. This also spotted an issue where in a native build this resulted
in pkg_config_path being /bar instead of /foo:
`-Dpkg_config_path=/foo -Dbuild.pkg_config_path=/bar`

Fixes: #7573
2020-10-16 17:42:24 -04:00
Xavier Claessens 7902d2032d Refactor handling of machine file options
It is much easier to not try to parse options into complicated
structures until we actually collected all options: machine files,
command line, project()'s default_options, environment.
2020-10-16 17:42:24 -04:00
Dylan Baker 94ac51fdda options: Handle updates to choices in options
Currently if you change the `choices` field in the meson_options.txt
file, no update will be done until `meson setup --wipe` is called. Now
if the choices change then the options will be properly merged.

If the currently select value is still valid it is guaranteed to be
kept, if it is now invalid the new default value will be used and a
warning will be printed.

Fixes #7386
2020-10-05 23:10:35 +03:00
Dylan Baker 4b1c1d83c8 machinefiles: Allow keys to be stored case insensitive
This is required to make the various keys in the [user options] section
work the same as they do in the meson_options.txt file, where we don't
have any rules about case sensitivity.

There is some risk here. Someone may be relying on this lower by default
behavior, and this could break their machine files.

Fixes #7731
2020-10-05 08:59:45 -04:00
Daniel Mensinger 1dfaccfd91 pathlib: Fix resolve() by overriding it in Python 3.5 2020-10-04 10:45:48 +02:00
Dylan Baker 6d173f9678 mesonlib: make OptionOverrideProxy a true MutableMapping
So that we can actually use it anyplace that an OptionDictType could be
used. I've also done a bit optimizing/simplifying of the implementation.
This is needed for cuda, as it returns an OptionOverrideProxy where we
ask for an OptionDicType
2020-10-01 15:05:00 -07:00
Dylan Baker 54329eeed7 dependencies/hdf5: Use the correct compilers for the machine
Instead of the default ones, this is especially important when cross
compiling or when using compilers that aren't compatible with the
default ones.
squash! dependencies/hdf5: Use the actual system compilers
2020-09-25 11:11:46 -07:00
Dylan Baker 79d1ecd5bc compilers/compilers: Fully type annotate 2020-09-24 12:14:13 -07:00
Dylan Baker d326c87fe2 compilers: Use a distinct type for compile/link results
Currently we do some crazy hackery where we add extra properties to a
Popen object and return that. That's crazy. Especially since some of our
hackery is to delete attributes off of the Popen we don't want. Instead,
let's just have a discrete type that has exactly the properties we want.
2020-09-24 12:14:13 -07:00
Dylan Baker f342efd080 pylint: turn on bad-indentation error
and fix all of the bad indentation
2020-09-22 17:57:03 -07:00
Nirbheek Chauhan fb7099c6cf mtest: Check version in the test data after loading
Same as coredata.dat and build.dat loading. Also, do not assert if
things change. Raise the appropriate exception.

Fixes https://github.com/mesonbuild/meson/issues/7613
2020-09-10 08:18:16 +00:00
Daniel Mensinger 47373a2438
typing: get rid of most T.cast 2020-09-08 20:15:58 +02:00
Daniel Mensinger 23818fc5a3
typing: more fixes 2020-09-08 20:15:58 +02:00
Zbigniew Jędrzejewski-Szmek 6006987ce5 "Downgrade" warning when regenerating after version bump
There is nothing to "warn" about, this is a completely routine
occurence. OTOH, when something is corrupted, we should warn. Keep
the red color and "WARNING:" prefix in that case.

Example output:
$ ninja -C build
Regenerating configuration from scratch: Build directory has been generated with Meson version 0.55.999, which is incompatible with current version 0.56.0.
The Meson build system
Version: 0.56.0
...
2020-08-04 17:15:37 +03:00
John Ericson 2447a1132a Capitalize some constants in coredata
I've been getting confused between them and similarly-named other
things, so I figured it was high time to clean this up.
2020-08-04 00:24:05 +03:00
Dylan Baker 591e6e94b9 Put machine file and cmd line parsing in Environment
This creates a full set of option in environment that mirror those in
coredata, this mirroring of the coredata structure is convenient because
lookups int env (such as when initializing compilers) becomes a straight
dict lookup, with no list iteration. It also means that all of the
command line and machine files are read and stored in the correct order
before they're ever accessed, simplifying the logic of using them.
2020-08-01 22:00:06 -07:00
Dylan Baker 5db3860abf push all config-file settings into coredata.set_default_options
This puts all of them together, in the next patch they'll be pulled back
out, but it's convenient to start that refactor by moving them all
there, then moving them into env as a whole.
2020-08-01 22:00:06 -07:00
Dylan Baker 601789cc7c machine-files: deprecate the paths section 2020-08-01 22:00:06 -07:00
Dylan Baker e981798e0b coredata: fix type annotation 2020-08-01 22:00:06 -07:00
Dylan Baker 17c8193615 machine-files: give better error messages about using integers 2020-08-01 22:00:06 -07:00
Dylan Baker bbba6a7f36 Allow setting built-in options from cross/native files
This is like the project options, but for meson builtin options.

The only real differences here have to do with the differences between
meson builtin options and project options. Some meson options can be set
on a per-machine basis (build.pkg_config_path vs pkg_config_path) others
can be set on a per-subproject basis, but should inherit the parent
setting.
2020-08-01 22:00:06 -07:00
Dylan Baker af763e093a mconf/mintro: use authoritative list of options from coredata
This splits the directory options and non-directory options into two
dicts, and then merges them later to maintain API.
2020-08-01 22:00:06 -07:00
Dylan Baker a6164ca5a8 Allow setting project options from cross or native files
This allows adding a `[project options]` section to a cross or native file
that contains the options defined for a project in it's meson_option.txt
file.
2020-07-30 19:34:37 -07:00
Xavier Claessens c016401f95 coredata: Make warning_level per subproject builtin option 2020-07-22 19:19:50 -04:00
James Hilliard 998c78fb0a coredata: add missing EnvironmentException import
Fixes:
NameError: name 'EnvironmentException' is not defined

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
2020-07-19 15:26:59 +03:00
Jussi Pakkanen cd8bdef776 Bump version number for new development. [skip ci] 2020-07-12 18:30:25 +03:00
Jussi Pakkanen d0c68dc115 Updated everything for release 0.55.0. 2020-07-12 17:25:51 +03:00
Jussi Pakkanen 7ab0090d2a Update version number for rc 2. 2020-07-05 23:52:03 +03:00
Nirbheek Chauhan 40319c9634 Don't make unactionable warnings fatal
Some warnings are out of the user's control, such as the RCC QT bug,
or the GNU windres bug, or our informational warning about
auto-disabling of options when -Db_bitcode is enabled.

Such warnings should not be fatal when --fatal-meson-warnings is
passed because there's no action that the user can take to fix it. The
only purpose it serves is to prevent people who use those features
from using --fatal-meson-warnings.
2020-07-05 16:13:00 +03:00
Jussi Pakkanen f8bec97084 Bump version number for RC1. 2020-07-02 20:03:36 +03:00
Xavier Claessens 1c8731a100 envconfig: Add [constants] section in machine files
Machine files already supports `+` operator as an implementation detail,
since it's using eval(). Now make it an officially supported feature and
add a way to define constants that are used while evaluating an entry
value.
2020-06-29 20:16:21 +03:00
Mathieu Duponchelle 20709af4d2 interpreter: add support for --force-fallback-for
This new command line option allows specifying dependencies for
which to force fallback.

See the documentation for more information

Fixes: #7218
2020-06-16 13:45:40 -04:00
Nirbheek Chauhan 5b8a636504 Fix typo in bitcode message 2020-06-11 07:10:43 +00:00
Michael Hirsch 58e1534773 tell variable name when erroring on bad combo option
fixes #7269
2020-06-10 01:05:41 +03:00
Nirbheek Chauhan 3e13497574 coredata: Fixup the default libdir value, not the set value
We shouldn't change the value of libdir after builtins have been
initialized because we want to change the *default* value.
2020-05-14 15:38:44 +00:00
Dylan Baker 85708facae
Merge pull request #6620 from jon-turney/test-output-check
Add a mechanism for validating meson output in tests
2020-05-13 11:32:28 -07:00
Ole André Vadla Ravnås 859dc4255a Fix outdated cross-compilation checks 2020-05-13 15:51:54 +00:00
Jussi Pakkanen ec8db6a1b5
Merge pull request #7076 from mesonbuild/revertcrossfixup
Revert cross fixup
2020-05-06 23:21:37 +03:00
Eric Engestrom 8ce4952890 coredata: init IntegerOption choices to the correct value
It's not a boolean, so let's avoid initializing it to invalid choices
followed by assigning it valid ones.
2020-05-04 09:59:25 -07:00
Jussi Pakkanen dee10c9151 Revert "coredata: init_builtins should always call libdir_cross_fixup"
This reverts commit cc4e9e79be.
2020-05-04 18:11:39 +03:00
Jon Turney 6a5c6fb439
Be more careful about the use of repr() in error messages
Generally, we'd want to use str() rather than repr() in error messages
anyhow, as that explicitly gives something designed to be read by
humans.

Sometimes {!r} is being used as a shortcut to avoid writing the quotes
in '{!s}'.

Unfortunately, these things aren't quite the same, as the repr of a
string containing '\' (the path separator on Windows) will have those
escaped.

We don't have a good string representation to use for the arbitrary
internal object used as an argument for install_data() when it's neither
a string nor file (which doesn't lead to a good error message), so drop
that for the moment.
2020-04-30 20:11:32 +01:00
John Ericson 278c294aa4 Compiler options per lang
A current rather untyped storage of options is one of the things that
contributes to the options code being so complex. This takes a small
step in synching down by storing the compiler options in dicts per
language.

Future work might be replacing the langauge strings with an enum, and
defaultdict with a custom struct, just like `PerMachine` and
`MachineChoice`.
2020-04-20 23:23:15 +03:00
Jussi Pakkanen 41485f3eca Bump version number for new development. [skip ci] 2020-03-29 20:46:20 +03:00
Jussi Pakkanen 15b0bd6e93 Update everything for new release. 2020-03-29 20:37:15 +03:00
Xavier Claessens 4d7ccd1399 Make werror per subproject option 2020-03-24 22:48:55 +02:00
Jussi Pakkanen 253fbc4470 Bump version number for rc1. 2020-03-24 10:53:02 +02:00
John Ericson 3a4388e51d Fix legacy env var support with cross
Fix #3969
2020-03-23 17:51:36 +02:00
Nirbheek Chauhan 69e9d32bca coredata: Warn on usage of both -Dbuildtype and -Doptimization/-Ddebug
It may not be obvious to users that these two ways to set build-types
override each other and specifying both is redundant, and conflicts
are resolved based on whichever is specified later.

Closes https://github.com/mesonbuild/meson/issues/6742
2020-03-11 07:11:59 -04:00
Nirbheek Chauhan bd953b6b29 coredata: Passing an option is supposed to set it, not flip the default
With the current logic passing `--debug` will actually be parsed as
`-Ddebug=false`, which is absolutely not what is expected.

There is no case in which the presence of a boolean option in `--foo`
form will mean 'I want feature foo disabled', regardless of the
*default* value of that option.

Also includes a test.

Closes https://github.com/mesonbuild/meson/issues/4686
2020-03-11 07:11:59 -04:00
Nirbheek Chauhan c7aa4c8861 coredata: Set default options as cmdline args that override each other
The previous code was assuming that options do not depend on each
other, and that you can set defaults using `dict.setdefault()`. This
is not true for `buildtype` + `optimization`/`debug`, so we add
defaults + overrides in the right order and use the options parsing
code later to compute the values.

Includes a test.

Closes https://github.com/mesonbuild/meson/issues/6752
2020-03-11 07:11:59 -04:00
Nirbheek Chauhan bc135f6c4d coredata: Convert all option parsing to OrderedDict()
This ensures that options are always parsed in the order in which they
were specified on the command-line, even with Python 3.5, and
non-CPython implementations compatible with CPython 3.5 and 3.6.

Closes https://github.com/mesonbuild/meson/issues/6742
2020-03-11 07:11:59 -04:00
Stéphane Cerveau cc4e9e79be coredata: init_builtins should always call libdir_cross_fixup
As the interpreter reinitialize the coredate builtins, need to call
again libdir_cross_fixup
2020-03-02 19:09:31 +05:30
Dylan Baker be9bff81a2 coredata: Fix search and replace mistake
A descriptive string had List replaced with T.List on accident.
2020-02-21 14:34:20 -05:00
Dylan Baker edb52e9003 coredata: Warn on reconfigure if PKG_CONFIG_PATH has changed
Fixes #6520
Fixes #5223
2020-02-21 14:34:20 -05:00
Xavier Claessens 76ae865864 coredata: Fix crash when cmd_line_options contains booleans
`meson setup --debug` puts a bool object in cmd_line_options dictionary
that we have to convert to string.

Fixes: #6646
2020-02-19 09:31:50 -05:00
Jussi Pakkanen 47759550e5 Add unity block size option. 2020-02-12 22:31:08 +02:00
Jussi Pakkanen 6b5c1a4fc3 Refactor UserIntegerOption to work with BuiltinOption. 2020-02-12 22:31:08 +02:00
Xavier Claessens 3ba0073df6 Make 'default_library' per-subproject builtin option
Currently it's just like if all builtin/base/compiler options are
yielding. This patch makes possible to have non-yielding builtin
options. The value in is overriden in this order:
 - Value from parent project
 - Value from subproject's default_options if set
 - Value from subproject() default_options if set
 - Value from command line if set
2020-02-06 14:11:24 -05:00
Jon Turney a3e2aa2d66
Fix prefix dependent option defaults (#6552)
* Extend test_prefix_dependent_defaults unit test to cover default case

Extend test_prefix_dependent_defaults unit test to cover the default
case, when the default prefix is '/usr/local'. (On Windows, the default
prefix is 'c:/')

* Restore adjusting option defaults depending on the default prefix

Restore adjusting option defaults, depending on the default prefix.
Droppped in d778a371
2020-02-04 23:27:59 +02:00
Daniel Mensinger 4104cbdaf9
typing: Fix Any --> T.Any 2020-01-31 09:48:21 +01:00
Michael Hirsch, Ph.D 00f5dadd5b
Bugfix: sanitize_dir: use pathlib to handle case-insensitive filesystems (#6398) 2020-01-30 23:07:44 +02:00
Jussi Pakkanen 7375eaa263 Always disable interpolation for ini parsers. 2020-01-27 22:22:12 +02:00
Xavier Claessens b6b4903129 mconf: Recommend using --reconfigure when setting unknown options
Fixes: #6477
2020-01-25 12:08:47 +02:00
Daniel Mensinger 09b53c534f types: import typing as T (fixes #6333) 2020-01-08 15:28:17 +01:00
Jussi Pakkanen 74d245a8c0 Bump version number for new development. 2020-01-07 22:57:44 +02:00
Jussi Pakkanen 8d576eba91 Prepare new release. 2020-01-07 22:12:25 +02:00
Dylan Baker 47dfe34c85 Consider compiler arguments in linker detection logic
If a user passes -fuse-ld=gold to gcc or clang, they expect that they'll
get ld.gold, not whatever the default is. Meson currently doesn't do
that, because it doesn't pass these arguments to the linker detection
logic. This patch fixes that. Another case that this is needed is with
clang's --target option

This is a bad solution, honestly, and it would be better to use $LD or a
cross/native file but this is needed for backwards compatability.

Fixes #6057
2019-12-12 10:57:27 -08:00
Dylan Baker 87766b3727 Allow setting <lang>_args before the compiler is detected
This is required to be able to pass compiler and linker arguments to the
methods that try to guess what linker to use.
2019-12-12 10:52:07 -08:00
Michael Hirsch, Ph.D 1031c96d31 catch malformed command line array option with helpful error
fixes #6291
2019-12-07 07:24:31 -05:00
Michael Hirsch, Ph.D 9cb600cbb8 type anno 2019-12-07 07:24:31 -05:00
Daniel Mensinger e4a0ee205d lgtm: Fix redundant code 2019-12-05 00:22:10 +02:00
Daniel Mensinger 286b9f0921 lgtm: Fix Module imported with `import` and `import from` 2019-12-05 00:22:10 +02:00
Paulo Neves 07389e23bc coredata: CmdLineFileParser no longer interpolates strings.
Previously if a user tried to pass a command line build
option that contained a '%' character the command line
parser assumed that there was string interpolation to be
done. As there is no sense in such a scenario no code
provides any input for the interpolation. This then leads to
a failure.

In this commit we specifically override the defaults in
ConfigParser and set interpolation to None, which disables
command line build option interpolation.

Fixes #6157
2019-11-13 22:04:15 +02:00
Wolfgang Stöggl f037e7ef45 Fix typos found by codespell
- Typos were found by codespell v1.16.0
2019-11-06 09:55:30 -05:00
Jussi Pakkanen ba1367b588 Bump version number for new development. [skip ci] 2019-10-06 22:53:31 +03:00
Jussi Pakkanen 2779603c68 Updated version numbers for 0.52.0 release. 2019-10-06 20:05:19 +03:00
Jussi Pakkanen 0b4d1e8afd Cross build is defined by the existance of a cross file. 2019-10-06 17:46:16 +03:00
Olexa Bilaniuk e32b0f8fbb Deduplicate PKG_CONFIG_PATH entries when initializing the array option pkg_config_path.
This avoids a warning about duplicate entries in an array option,
and closes #5736.
2019-09-30 20:54:08 +03:00
Xavier Claessens 2e7f0ce557 Print user defined options in meson-log.txt
It can be useful to know what options have been passed to the command
line, excluding default values.

Closes: #5956
2019-09-25 22:50:48 +03:00
Aleksey Gurtovoy 75daed27bc mesonlib.split_args/quote_arg/join_args 2019-09-05 23:42:47 +03:00
Clinton Roy bba3ae5724 correct function call 2019-09-03 08:48:28 -07:00
Jussi Pakkanen 5fd4963766 Made build. options alias basic ones when native building. 2019-08-06 21:34:15 +03:00
Jussi Pakkanen 534c95cc3e Made set_option kwargs named-only. 2019-08-06 21:34:15 +03:00
Dylan Baker e33183a4cc coredata: Ignore directories when searching for machine files
Otherwise having an output directory matching the name of the cross file
in the current working directory will cause an error. This patch instead
collects any invalid names and prints them along with the error message
when no valid file can be found.

Fixes #5640
2019-07-31 22:36:59 +03:00
Dylan Baker 019f73dd7c coredata: Add a type for the options dict
This is used in a lot of places, having a single way to reference it is
convenient. It's placed under a typing.TYPE_CHECKING guard to mimimize
runtime impact
2019-07-23 09:58:24 +00:00
Michael Hirsch, Ph.D 85cc424712 expanduser for tilde 2019-07-07 23:10:14 +03:00
Dylan Baker 56f7e5c74f coredata: Correctly handle receiving a pipe for native/cross files
* coredata: Correctly handle receiving a pipe for native/cross files

In some cases a cross/native file may be a pipe, such as when using bash
process replacement `meson --native-file
<([binaries]llvm-config='/opt/bin/llvm-config')`, for example. In this
case we copy the contents of the pipe into a file in the meson-private
directory so we can create a proper ninja dependency, and be able to
reload the file on --wipe/--reconfigure. This requires some extra
negotiation to preserve these native/cross files.

Fixes #5505

* run_unitests: Add a unit test for native files that are pipes

Using mkfifo.
2019-06-23 17:53:17 +03:00
Jussi Pakkanen 8dfc24dbf1 Update version number for new development. 2019-06-16 23:51:31 +03:00
Jussi Pakkanen 5ecab57667 Update things for new release. 2019-06-16 22:03:29 +03:00
John Ericson 07777e15d4 Purge `is_cross` and friends without changing user interfaces
In most cases instead pass `for_machine`, the name of the relevant
machines (what compilers target, what targets run on, etc). This allows
us to use the cross code path in the native case, deduplicating the
code.

As one can see, environment got bigger as more information is kept
structured there, while ninjabackend got a smaller. Overall a few amount
of lines were added, but the hope is what's added is a lot simpler than
what's removed.
2019-06-09 13:13:25 -04:00
John Ericson af2d7af998 Per machine do 'build.' and '' option prefixes
See the docs/ changes for details.
2019-06-05 23:05:34 -04:00
Dylan Baker 0714ba58c7 coredata: add cmake_prefix_path option 2019-05-27 01:24:08 +03:00
Dylan Baker 146e97e974 Use dependency cache 2019-05-20 10:05:36 -07:00
Dylan Baker 5df6823bd8 coredata: Introduce a class to act as the dependency cache
Handling the PKG_CONFIG_PATH variable in meson introduces a new problem
for caching dependencies. We want to encode the pkg_config_path (or
cross_pkg_config_path if we're cross compiling) to be part of the key,
but we don't want to put that into the key for non-pkg-config
dependencies to avoid spurious cache misses (since pkg_config_path isn't
relevant to cmake, for example). However, on a cache lookup we can't
know that a dependency is a pkg-config dependency until we've looked in
the cache.

My solution is a two layer cache, the first layer remains the same as
before, the second layer is a dict-like object that encapsulates the
dependency type information and uses pkg_config_path and
cross_pkg_config_path as a sub key (and could be extended easily for
other types). A new object type is introduced to encapsulate this so
that callers don't need to be aware of the implementation details.
2019-05-17 12:26:20 -07:00