Commit Graph

250 Commits

Author SHA1 Message Date
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
Dylan Baker 0b66a106e3 coredata: fix bugs reading PKG_CONFIG_PATH
There are two distinct bugs here:
1) if PKG_CONFIG_PATH is unset then the variable will be set to [''],
   which causes it to have the wrong behavior in some truthiness tests
2) We read PKG_CONFIG_PATH on invocations after the first, which causes
   it to overwrite the value saved into the coredata.dat file. Putting
   the two bugs together it means that -Dpkg_config_path doesn't work
   with `meson configure`
2019-05-16 10:46:39 -07:00
John Ericson 957d8e051c Make `PerMachine` and `MachineChoice` have just `build` and `host`
Meson itself *almost* only cares about the build and host platforms. The
exception is it takes a `target_machine` in the cross file and exposes
it to the user; but it doesn't do anything else with it. It's therefore
overkill to put target in `PerMachine` and `MachineChoice`. Instead, we
make a `PerThreeMachine` only for the machine infos.

Additionally fix a few other things that were bugging me in the process:

 - Get rid of `MachineInfos` class. Since `envconfig.py` was created, it
   has no methods that couldn't just got on `PerMachine`

 - Make `default_missing` and `miss_defaulting` work functionally. That
   means we can just locally bind rather than bind as class vars the
   "unfrozen" configuration. This helps prevent bugs where one forgets
   to freeze a configuration.
2019-05-16 00:27:57 +03:00
John Ericson 4030e7cb7a UserOption no longer has a name field.
This avoids the duplication where the option is stored in a dict at its
name, and also contains its own name. In general, the maxim in
programming is things shouldn't know their own name, so removed the name
field just leaving the option's position in the dictionary as its name.
2019-05-15 14:21:47 +03:00
Dylan Baker c0aa89e57f
Merge pull request #4952 from mensinda/cacheCompiles
Cache compilers.compile() in coredata
2019-05-02 14:54:02 -07:00
John Ericson 4c2617a9c6 Add some type annotations and fix lints
Some things, like `method[...](...)` or `x: ... = ...` python 3.5
doesn't support, so I made a comment instead with the intention that it
can someday be made into a real annotation.
2019-05-02 10:58:23 -07:00
Daniel Mensinger c9bd84fd25
Cache compile results in coredata 2019-04-28 14:31:49 +02:00
Dylan Baker 3edc7f343b coredata: store cross/native files in the same form they will be used (#5224)
* coredata: store cross/native files in the same form they will be used

Currently they're forced to absolute paths when they're stored in the
coredata datastructure, then when they're loaded we de-absolute path
them to check if they're in the system wide directories. This doesn't
work at all, since the ninja backend will generat a dependency on a
file that is in the source directory unless the path was already given
as absolute. This results in builds being retriggereed forever due to
a non-existant file.

The right way to do this is to figure out whether the file is in the
build directory, is absolute, or is in one of the system paths at
creation time, and store that path as absolute. Then the code that
reads the file and the code that generates the dependencies in the
ninja backend just takes the computed list and there is no mismatch
between them.

Fixes #5257

* run_unittests: Add a test for correct native file storage

This tests the bug in #5257
2019-04-21 23:10:02 +03:00
TheQwertiest bf65660509 Updated meson --help output 2019-04-20 14:17:13 +03:00
Jussi Pakkanen 04710b087a Add support for VS2019. Closes #4640. 2019-04-10 23:13:47 +03:00
Dylan Baker 377b652b93 coredata: Add ability to mark options as having separate cross values
Currently this only marks the pkg_config_path flag, but it could be
used to mark any of these values as having separate values for cross
and native builds, assuming that the necessary plumbing is done.
2019-04-05 15:08:17 -07:00
Dylan Baker 569e646e1e dependencies: Add command line option for pkg_config_path
This creates a new command line option to store pkg_config_path into,
and store the environment variable into that option. Currently this
works like the environment variable, for both cross and native targets.
2019-04-05 15:08:17 -07:00
Dylan Baker 5ce0d9fbbb coredata: Don't log warnings about reserved prefixes 2019-04-05 09:26:42 -07:00
Dylan Baker 863de72599 coredata: Fold add_builtin_argument into BuiltinOption
It really is a method of the BuiltinOption class, not a standalone
function.
2019-04-04 15:02:20 -07:00
Dylan Baker 1d7eda5fc8 coredata: Merge get_builtin_option_cmdline_name into BuiltinOption 2019-04-04 15:02:20 -07:00
Dylan Baker c3cb966631 coredata: merge get_builtin_option_default in to BuiltinOption 2019-04-04 15:02:20 -07:00
Dylan Baker 5aa2219f50 coredata: pull get_builtin_option_choices into BuiltinOption
We can remove some guards here since we know the object will have
certain attributes.
2019-04-04 15:02:20 -07:00
Dylan Baker 1e5496d1ba coredata: Remove get_builtin_option_description
Since the attribute is always accessible from a BuiltinOptions
instance we don't need a special function for this.
2019-04-04 15:02:20 -07:00
Dylan Baker 6940848f0b coredata: Move argparse action getterin into BuiltinOption class 2019-04-04 15:02:20 -07:00
Dylan Baker f8fcc7174d coredata: Remove is_builtin_option
This is a silly abstraction at this point.
2019-04-04 15:02:20 -07:00
Dylan Baker c6060d795c coredata: remove get_builtin_options
This returns a list out of th keys of a dict. In both cases of use
remaining though it's used for checking membership, checking for list
membership, lists are O(n) lookup, while dicts are O(1), so removing
the abstraction reduces typing and improves performance.
2019-04-04 15:02:20 -07:00
Dylan Baker d778a371ac coredata: Add an object to abstract builtins
Currently the builtins are stored as lists, then there are a mess of
functions which take said lists, check what the type of the first
thing is, and then extract data from various points in the list based
on that.

This is stupid. This is what structs/classes are for.
2019-04-04 15:02:17 -07:00
Jussi Pakkanen 1a79fdd7e7 Reuse build setup for host when native compiling. Closes #5047. 2019-04-01 19:20:08 +00:00
John Ericson e677704d21 Don't collect preprocssor flags separately from compiler flags
I recall that @jpakkane never wanted this, but @nirbheek did, but then
@nirbheek changed his mind.

I am fine either way except for the cross inconsistency that exists
today: There is no `c_preproc_args` or similar one can put in the cross
file, so no way to replicate the effect of CPPFLAGS during cross
compilation.
2019-03-27 14:45:42 +00:00
Ross Burton 65e59c84a1 mesonbuild: allow multiple --cross-file options
Just like --native-file, allow multiple --cross-file options.  This is mostly
unifying the logic between cross_files and config_files.
2019-03-20 10:06:17 +00:00
Ross Burton d57dd1092e load_configs: generalise the search path
Instead of hard-coding the fact that load_configs() searches for files under
meson/native, pass in the subdirectory allowing the cross-file code to use the
same logic.
2019-03-19 19:16:30 +00:00
Jussi Pakkanen 35c3cf2822 Bump version number for new development. 2019-03-10 20:40:31 +02:00
Jussi Pakkanen 9f48f5fe94 Update everything for new release. 2019-03-10 19:25:09 +02:00
John Ericson 2d6d242aec Feed compiler Properties to get its options defaulted
Before, the logic initialization compiler options from environment
variables vs config files was strewn about. Now, it is consolidated. We
leverage the new `envconfig.py` module to expose the configuration data
to `compilers.py` without creating an import cycle.
2019-02-27 13:10:16 -08:00