mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-02-04 07:10:29 +01:00
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>
This commit is contained in:
parent
e2f2c5dd42
commit
398820d1fe
5 changed files with 46 additions and 19 deletions
|
|
@ -184,6 +184,19 @@ if platform_unix and use_traditional_activation
|
|||
)
|
||||
endif
|
||||
|
||||
install_emptydirs += [
|
||||
get_option('datadir') / 'dbus-1' / 'session.d',
|
||||
get_option('datadir') / 'dbus-1' / 'services',
|
||||
]
|
||||
|
||||
if platform_unix
|
||||
install_emptydirs += [
|
||||
get_option('localstatedir') / 'run' / 'dbus',
|
||||
get_option('datadir') / 'dbus-1' / 'system.d',
|
||||
get_option('datadir') / 'dbus-1' / 'system-services',
|
||||
]
|
||||
endif
|
||||
|
||||
if use_systemd
|
||||
install_symlinks += [
|
||||
{
|
||||
|
|
|
|||
14
meson.build
14
meson.build
|
|
@ -42,6 +42,7 @@ data_config = configuration_data()
|
|||
compile_args = []
|
||||
link_args = []
|
||||
|
||||
install_emptydirs = []
|
||||
install_symlinks = []
|
||||
|
||||
###############################################################################
|
||||
|
|
@ -980,9 +981,7 @@ subdir('doc')
|
|||
subdir('cmake')
|
||||
|
||||
meson.add_install_script('meson_post_install.py',
|
||||
'@0@'.format(platform_unix),
|
||||
'@0@'.format(relocation),
|
||||
'@0@'.format(use_systemd),
|
||||
)
|
||||
|
||||
pkgconfig.generate(
|
||||
|
|
@ -1011,6 +1010,17 @@ pkgconfig.generate(
|
|||
}
|
||||
)
|
||||
|
||||
if meson.version().version_compare('>=0.60.0')
|
||||
foreach dir : install_emptydirs
|
||||
install_emptydir(dir)
|
||||
endforeach
|
||||
else
|
||||
meson.add_install_script(
|
||||
'tools/meson-compat-install-emptydirs.py',
|
||||
':'.join(install_emptydirs),
|
||||
)
|
||||
endif
|
||||
|
||||
foreach symlink : install_symlinks
|
||||
if not platform_unix
|
||||
warning(
|
||||
|
|
|
|||
|
|
@ -57,23 +57,8 @@ def to_destdir(path):
|
|||
|
||||
# Define paths here
|
||||
abs_libdir = destdir_prefix / get_option('libdir')
|
||||
dbus_data_dir = destdir_prefix / get_option('datadir') / 'dbus-1'
|
||||
|
||||
platform_unix = sys.argv[1].lower() == 'true'
|
||||
relocation = sys.argv[2].lower() == 'true'
|
||||
|
||||
def post_install_data():
|
||||
(dbus_data_dir / 'session.d').mkdir(parents=True, exist_ok=True)
|
||||
(dbus_data_dir / 'services').mkdir(parents=True, exist_ok=True)
|
||||
(dbus_data_dir / 'session.d').mkdir(parents=True, exist_ok=True)
|
||||
|
||||
localstatedir = Path(get_option('localstatedir'))
|
||||
if destdir:
|
||||
localstatedir = destdir / localstatedir.relative_to(localstatedir.anchor)
|
||||
if platform_unix:
|
||||
(localstatedir / 'run' / 'dbus').mkdir(parents=True, exist_ok=True)
|
||||
(dbus_data_dir / 'system.d').mkdir(parents=True, exist_ok=True)
|
||||
(dbus_data_dir / 'system-services').mkdir(parents=True, exist_ok=True)
|
||||
relocation = sys.argv[1].lower() == 'true'
|
||||
|
||||
def post_install_relocation():
|
||||
# Edit pkg-config file to replace the prefix
|
||||
|
|
@ -116,6 +101,5 @@ def post_install_exe():
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
post_install_data()
|
||||
post_install_relocation()
|
||||
post_install_exe()
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
19
tools/meson-compat-install-emptydirs.py
Executable file
19
tools/meson-compat-install-emptydirs.py
Executable file
|
|
@ -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)
|
||||
Loading…
Add table
Reference in a new issue