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 <smcv@collabora.com>
This commit is contained in:
Simon McVittie 2023-08-08 12:02:51 +01:00
parent dd5fdcacf7
commit 14c1dcd322
2 changed files with 3 additions and 3 deletions

View file

@ -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)

View file

@ -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)