Open
Description
Describe the bug
I cannot easily install emptydirs to the prefixed path when prefix is default because meson is opinionated about what the target path should be.
To Reproduce
- Have this standalone meson.build. I understand the subsequent calls to install_emptydir are redundant and maybe even not idiomatic to meson. By writing those, I'm trying to show that almomst whatever I do, meson overrides my choice. Only the last call with the hardcoded path works. But hardcoded path may not be an option in complex projects.
project('a', 'c')
LOCALSTATEDIR = get_option('localstatedir')
PREFIX = get_option('prefix')
dir = LOCALSTATEDIR / 'run'
dir_with_prefix = PREFIX / dir
dir_with_prefix_2 = '/usr/local' / dir
dir_with_prefix_3 = '/usr/local/run'
install_emptydir(dir)
install_emptydir(dir_with_prefix)
install_emptydir(dir_with_prefix_2)
install_emptydir(dir_with_prefix_3)
- Try with no prefix.
$ rm -rf build && meson setup build && sudo meson install -C build
Installing new directory /var/local/run
Installing new directory /var/local/run
Installing new directory /var/local/run
Installing new directory /usr/local/run
- Try with prefix.
$ rm -rf build && meson setup build --prefix=/opt && sudo meson install -C build
Installing new directory /opt/var/run
Installing new directory /opt/var/run
Installing new directory /usr/local/var/run
Installing new directory /usr/local/run
Expected behavior
I expected to have a way to be able to install empty directories somewhere inside /usr/local
without resorting to hardcoded paths, just like I can install inside /usr/local
with something as simple as configure_file(copy: true, install: true, install_true: SBINDIR)
.
Installing a dummy file with configure_file(input:'dummy', output: 'dummy', copy: true, install: true, install_dir: 'run')
is a valid workaround until this is fixed or if it is not fixed at all. I guess I'll use that.
system parameters
- Not a cross build.
- Endeavour OS 2024.09.22
- Python 3.13.2
- meson 1.7.99 - a recent build
- ninja 1.11.1.git.kitware.jobserver-1
Metadata
Metadata
Assignees
Labels
No labels