From 108bd996ee72b16c14f0ee0ca86959b142582394 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Sun, 3 Oct 2021 14:35:30 -0400 Subject: add install_emptydir function 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 --- docs/markdown/snippets/install_emptydir.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 docs/markdown/snippets/install_emptydir.md (limited to 'docs/markdown/snippets') diff --git a/docs/markdown/snippets/install_emptydir.md b/docs/markdown/snippets/install_emptydir.md new file mode 100644 index 0000000..baedf58 --- /dev/null +++ b/docs/markdown/snippets/install_emptydir.md @@ -0,0 +1,18 @@ +## install_emptydir function + +It is now possible to define a directory which will be created during +installation, without creating it as a side effect of installing files into it. +This replaces custom `meson.add_install_script()` routines. For example: + +```meson +meson.add_install_script('sh', '-c', 'mkdir -p "$DESTDIR/@0@"'.format(path)) +``` + +can be replaced by: + +```meson +install_emptydir(path) +``` + +and as a bonus this works reliably on Windows, prints a sensible progress +message, will be uninstalled by `ninja uninstall`, etc. -- cgit v1.1