This is a significant speed-up on Windows because terminals are
slow to print things out.
Speed-up in gst-build on Windows:
```
meson install:
before: 5.1 seconds
after: 4.0 seconds
```
In `--only-changed` mode, we were spending half our time inside
`makedirs()`, which is a waste in the case when only a few files have
changed.
Speed-up on Windows with gst-build:
```
meson install --only-changed
before: 1.6 seconds
after: 0.9 seconds
```
This gives a significant speedup in large projects such as gst-build
since now we only search for the tool once. Speed-up on Windows:
```
meson install:
before: 15.3 seconds
after: 5.4 seconds
meson install --only-changed:
before: 11.6 seconds
after: 2.7 seconds
```
If we preserve the existing file, we did not install anything. In that
case, the output now looks like:
```
ninja: Entering directory `.'
ninja: no work to do.
Nothing to install.
Preserved 1732 unchanged files, see meson-logs\install-log.txt for the full list
```
This also avoids an `isfile` lookup, which shaves off a few seconds in
gst-build install.
This leads to better version parsing. An concrete example use case is
llc. When invoking llc with "--version", the output is
```
LLVM (http://llvm.org/):
LLVM version 9.0.1
...
```
The old version parsing recognizes the dot in the first line as version.
This commit also tries to adapt the two regexes to each other.
Reported-by: Björn Fiedler <fiedler@sra.uni-hannover.de>
-g is --extern-only and -P is --format=posix. We were missing
--defined-only for some reason, which we pass to `nm` on Linux.
This avoids having to manually filter later.
Otherwise there's a high likelihood that some program run by us will
mess up the console settings and break ANSI colors. F.ex., running
`uname` in the Visual Studio 2019 x86 developer prompt using
`run_command()` does this.
Looking at 45c8557d, the idea behind this seems to be that a test could
conditionally indicate that the list of installed files should not be
validated by creating that file.
It's no longer used anywhere.
Also remove a lingering no-install-files file which isn't used since commit
c693bd9b.
Just add or alter attributes of the TestResult object, rather than many,
many invocations of the constructor with very similar arguments.
Define helper methods for TestResult to add the results of a step and
set the failure reason.
This gives consistent reporting of this error for all platforms.
Also, reporting this error when constructing the BuildTarget, rather
than discovering the problem during backend generation means that the
error is reported against with a location.
Add a test that trying to use a native compiler in a target after it's
been tentatively added with add_languages() without native: but isn't
actually available gives an error.
This improves the common case of a simple meson.build which doesn't
contain any 'native: true' targets to not require a native compiler when
cross-compiling, without needing any changes in the meson.build.
v2:
Do it the right way around!