summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2022-06-27 15:37:17 +0100
committerSimon McVittie <smcv@collabora.com>2022-07-13 20:36:13 +0100
commit398820d1fe45f85ac0a22971b88ce8a9903e4d70 (patch)
treedf09528018bc8bba9373d4beaeeb0687e934121a /tools
parente2f2c5dd42e193d4bddb0bda49b07bf254cff248 (diff)
downloaddbus-398820d1fe45f85ac0a22971b88ce8a9903e4d70.tar.gz
build: Change how we create empty directories from Meson
Use install_emptydir() in Meson versions that support it, or a script with similar invocation in versions that do not. This will make it straightforward to migrate to install_emptydir() when we drop support for Meson versions older than 0.60.0. Signed-off-by: Simon McVittie <smcv@collabora.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile.am1
-rwxr-xr-xtools/meson-compat-install-emptydirs.py19
2 files changed, 20 insertions, 0 deletions
diff --git a/tools/Makefile.am b/tools/Makefile.am
index e9c066ba..dee5f862 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -154,4 +154,5 @@ installcheck-local:
EXTRA_DIST += build-timestamp.py
EXTRA_DIST += meson.build
+EXTRA_DIST += meson-compat-install-emptydirs.py
EXTRA_DIST += meson-compat-install-symlink.py
diff --git a/tools/meson-compat-install-emptydirs.py b/tools/meson-compat-install-emptydirs.py
new file mode 100755
index 00000000..0fc76287
--- /dev/null
+++ b/tools/meson-compat-install-emptydirs.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python3
+# Copyright 2022 Collabora Ltd.
+# SPDX-License-Identifier: MIT
+
+# Compatibility shim for installing empty directories with Meson < 0.60
+
+import os
+import sys
+from pathlib import Path
+
+for d in sys.argv[1].split(':'):
+ if os.path.isabs(d) and 'DESTDIR' in os.environ:
+ p = Path(d)
+ d = p.relative_to(p.anchor)
+ dest = os.path.join(os.environ['DESTDIR'], d)
+ else:
+ dest = os.path.join(os.environ['MESON_INSTALL_DESTDIR_PREFIX'], d)
+
+ os.makedirs(dest, mode=0o755, exist_ok=True)