This replaces the absolute hack of using
```
install_subdir('nonexisting', install_dir: 'share')
```
which requires you to make sure you don't accidentally or deliberately
have a completely different directory with the same name in your source
tree that is full of files you don't want installed. It also avoids
splitting the name in two and listing them in the wrong order.
You can also set the install mode of each directory component by listing
them one at a time in order, and in fact create nested structures at
all.
Fixes#1604
Properly fixes#2904
On linux system ldconfig needs to be called to update
the ld.so.cache to be able to load libraries from
/usr/local/lib/x86_64-linux-gnu on debian based
distributions for example.
Meson already works like that, except in do_copydir() that requires
absolute destdir. Better explicitly support that instead of leaving it
undefined and unconsistent.
"meson setup" is resolving symlinks for the build directory in
validate_core_dirs. For consistency with it, do the same when
the build directory is passed via -C to devenv, dist, init, install
and test.
This ensures for example that the path to test dependencies is
computed correctly in "meson test".
Fixes: #8765
The existing code works, but it probably doesn't do what the author
thought it would do. `(x or y or z) is not None` works by checking that
each of those things are *truthy* in turn, and returning the first
truthy value, which is compared against None. Using `all()` makes it
very clear that what you want to do is make sure that each value is not
None.
If a custom_target output is a directory, we install it as a directory,
not as a file. And, we try to track subdirectories which are created so
uninstalling works. But one directory creation did not go through
DirMaker, in the case where the output directory does not have any
further subdirectories.
Consolidate on makedirs, since I don't see much point in using os.mkdir
right here.
In commit caab4d3d, the uid and gid arguments passed to os.chown() by
set_chown() were accidentally swapped, causing files to end up with
incorrect owner/group if the owner and group are not the same.
Also update the documentation to better indicate which argument to
install_mode is which.
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
By default all subprojects are installed. If --skip-subprojects is given
with no value only the main project is installed. If --skip-subprojects
is given with a value, it should be a coma separated list of subprojects
to skip and all others will be installed.
Fixes: #2550.
In 0.57.0 installation via polkit won't work anymore. `destdir` is
defaulted to an empty string ('') instead of None. But polkit
installation code incorrectly tests `destdir is None`.
It is common, at least in GNOME projects, to have scripts that must be
run only in the final destination, to update system icon cache, etc.
Skipping them from Meson ensures we can properly log that they have not
been run instead of relying on such scripts to to it (they don't
always).
On Windows this would fail because of missing DLL:
```
mylib = library(...)
exe = executable(..., link_with: mylib)
meson.add_install_script(exe)
```
The reason is on Windows we cannot rely on rpath to find libraries from
build directory, they are searched in $PATH. We already have all that
mechanism in place for custom_target() using ExecutableSerialisation
class, so reuse it for install/dist/postconf scripts too.
This has bonus side effect to also use exe_wrapper for those scripts.
Fixes: #8187
Add a new attribute to an object outside of the initializer of
construtor is considered an antipattern for good reason, it's gross,
it's confusing, and it often leads to AttributeErrors down some paths.
Let's not do that.
This adds annotations and fixes a couple of issues (passing Set[bytes]
where List[byte] is expected), however, there's some very gross addition
of attributes to types going on that I haven't fixed yet, and mypy is
very grump about.
It is a usual workflow to fix something and retest to see if it is fixed using a
particular test. When tests start to become numerous, it becomes time consuming
for "meson test" to relink all of them (and in fact rebuild the whole project)
where the user has already specified the tests they want to run, as well as
the tests' dependencies.
Teach meson to be smart and only build what is needed for the test (or suite)
that were specified.
Fixes: #7473
Related: #7830
Previously the destdir was ignored completely when using elevated
privileges to install files as pkexec stripped the DESTDIR environment
variable.
As the destdir is not supposed to require any special privileges
anyways, just re-raise the error.
This catches some very real errors.
The one in scalapack is pretty silly actually, it's failing to figure
out that the exploded list is at least two arguments. However, the code
is actually clearer by not using a list and exploding it, so I've done
that and pylint is happy too.
D lang compilers have an option -release (or similar) which turns off
asserts, contracts, and other runtime type checking. This patch wires
that up to the b_ndebug flag.
Fixes#7082
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
```
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.
When `--only-changed` is passed, we only want to know about files that
were newly-installed. Everything else is noise. The full list can
always be found in `install-log.txt` anyway. Sample output:
```
ninja: Entering directory `.'
ninja: no work to do.
Preserved 667 unchanged files, see meson-logs\install-log.txt for the full list
```