From 14c1dcd322c493cd994d677c9cbb2edbbf0525f2 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 8 Aug 2023 12:02:51 +0100 Subject: [PATCH] meson: Allow `sudo meson install`, which doesn't set `DESTDIR` This is generally not recommended (dbus should usually be installed from the OS distributor's packages, which should install into a staging directory using `DESTDIR`), but we'll want to use it in Gitlab-CI. Signed-off-by: Simon McVittie --- tools/meson-compat-install-emptydirs.py | 4 ++-- tools/meson-compat-install-symlink.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/meson-compat-install-emptydirs.py b/tools/meson-compat-install-emptydirs.py index 0fc76287..45ae62de 100755 --- a/tools/meson-compat-install-emptydirs.py +++ b/tools/meson-compat-install-emptydirs.py @@ -9,10 +9,10 @@ import sys from pathlib import Path for d in sys.argv[1].split(':'): - if os.path.isabs(d) and 'DESTDIR' in os.environ: + if os.path.isabs(d): p = Path(d) d = p.relative_to(p.anchor) - dest = os.path.join(os.environ['DESTDIR'], d) + dest = os.path.join(os.environ.get('DESTDIR', '/'), d) else: dest = os.path.join(os.environ['MESON_INSTALL_DESTDIR_PREFIX'], d) diff --git a/tools/meson-compat-install-symlink.py b/tools/meson-compat-install-symlink.py index 6e7ac333..69ff2a66 100755 --- a/tools/meson-compat-install-symlink.py +++ b/tools/meson-compat-install-symlink.py @@ -14,7 +14,7 @@ link_name, d, pointing_to = sys.argv[1:] if os.path.isabs(d): p = Path(d) d = p.relative_to(p.anchor) - dest = os.path.join(os.environ['DESTDIR'], d) + dest = os.path.join(os.environ.get('DESTDIR', '/'), d) else: dest = os.path.join(os.environ['MESON_INSTALL_DESTDIR_PREFIX'], d)