1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-28 03:25:31 +03:00

Merge pull request #21898 from yuwata/meson-dbus-interfaces-dir

meson: obtain dbus related directories from pkg-config
This commit is contained in:
Luca Boccassi 2021-12-29 12:39:50 +00:00 committed by GitHub
commit d39d3696c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 58 additions and 31 deletions

View File

@ -191,21 +191,6 @@ if docdir == ''
docdir = datadir / 'doc/systemd'
endif
dbuspolicydir = get_option('dbuspolicydir')
if dbuspolicydir == ''
dbuspolicydir = datadir / 'dbus-1/system.d'
endif
dbussessionservicedir = get_option('dbussessionservicedir')
if dbussessionservicedir == ''
dbussessionservicedir = datadir / 'dbus-1/services'
endif
dbussystemservicedir = get_option('dbussystemservicedir')
if dbussystemservicedir == ''
dbussystemservicedir = datadir / 'dbus-1/system-services'
endif
pamlibdir = get_option('pamlibdir')
if pamlibdir == ''
pamlibdir = rootlibdir / 'security'
@ -1473,6 +1458,59 @@ else
endif
conf.set10('HAVE_DBUS', have)
dbusdatadir = datadir / 'dbus-1'
if conf.get('HAVE_DBUS') == 1
dbusdatadir = libdbus.get_variable(pkgconfig: 'datadir', default_value: datadir) / 'dbus-1'
endif
dbuspolicydir = get_option('dbuspolicydir')
if dbuspolicydir == ''
dbuspolicydir = dbusdatadir / 'system.d'
endif
dbussessionservicedir = get_option('dbussessionservicedir')
if dbussessionservicedir == ''
dbussessionservicedir = dbusdatadir / 'services'
if conf.get('HAVE_DBUS') == 1
dbussessionservicedir = libdbus.get_variable(pkgconfig: 'session_bus_services_dir', default_value: dbussessionservicedir)
endif
endif
dbussystemservicedir = get_option('dbussystemservicedir')
if dbussystemservicedir == ''
dbussystemservicedir = dbusdatadir / 'system-services'
if conf.get('HAVE_DBUS') == 1
dbussystemservicedir = libdbus.get_variable(pkgconfig: 'system_bus_services_dir', default_value: dbussystemservicedir)
endif
endif
dbus_interfaces_dir = get_option('dbus-interfaces-dir')
if dbus_interfaces_dir == '' or dbus_interfaces_dir == 'yes'
if meson.is_cross_build() and dbus_interfaces_dir != 'yes'
dbus_interfaces_dir = 'no'
warning('Exporting D-Bus interface XML files is disabled during cross build. Pass path or "yes" to force enable.')
else
dbus_interfaces_dir = dbusdatadir / 'interfaces'
if conf.get('HAVE_DBUS') == 1
dbus_interfaces_dir = libdbus.get_variable(pkgconfig: 'interfaces_dir', default_value: dbus_interfaces_dir)
endif
endif
endif
if dbus_interfaces_dir == dbusdatadir / 'interfaces' or dbus_interfaces_dir == 'no'
dbus_interfaces_dir_name = 'interfaces'
dbus_interfaces_dir_parent = dbusdatadir
else
elements = dbus_interfaces_dir.split('/')
dbus_interfaces_dir_name = elements[-1]
dbus_interfaces_dir_parent = '/'
foreach elem : elements
if elem == dbus_interfaces_dir_name and dbus_interfaces_dir == dbus_interfaces_dir_parent / dbus_interfaces_dir_name
break
endif
dbus_interfaces_dir_parent = dbus_interfaces_dir_parent / elem
endforeach
endif
# We support one or the other. If gcrypt is available, we assume it's there to
# be used, and use it in preference.
opt = get_option('cryptolib')
@ -1731,17 +1769,6 @@ public_programs = []
# D-Bus introspection XML export
dbus_programs = []
dbus_interfaces_dir = get_option('dbus-interfaces-dir')
if dbus_interfaces_dir == ''
if not meson.is_cross_build()
dbus_interfaces_dir = datadir / 'dbus-1'
else
message('D-Bus interfaces export is disabled during cross build. Pass path or yes to force enable.')
dbus_interfaces_dir = 'no'
endif
elif dbus_interfaces_dir == 'yes'
dbus_interfaces_dir = datadir / 'dbus-1'
endif
basic_includes = include_directories(
'src/basic',
@ -3876,9 +3903,9 @@ alias_target('update-man-rules', update_man_rules)
custom_target(
'export-dbus-interfaces',
output : 'interfaces',
output : dbus_interfaces_dir_name,
install : dbus_interfaces_dir != 'no',
install_dir : dbus_interfaces_dir,
install_dir : dbus_interfaces_dir_parent,
command : [export_dbus_interfaces_py, '@OUTPUT@', dbus_programs])
############################################################
@ -3905,6 +3932,7 @@ summary({
'D-Bus policy directory' : dbuspolicydir,
'D-Bus session directory' : dbussessionservicedir,
'D-Bus system directory' : dbussystemservicedir,
'D-Bus interfaces directory' : dbus_interfaces_dir,
'bash completions directory' : bashcompletiondir,
'zsh completions directory' : zshcompletiondir,
'private shared lib version tag' : shared_lib_tag,

View File

@ -179,6 +179,8 @@ option('dbussessionservicedir', type : 'string',
description : 'D-Bus session service directory')
option('dbussystemservicedir', type : 'string',
description : 'D-Bus system service directory')
option('dbus-interfaces-dir', type : 'string',
description : 'export D-Bus introspection XML as standalone files')
option('pkgconfigdatadir', type : 'string', value : '',
description : 'directory for arch-independent pkg-config files')
option('pkgconfiglibdir', type : 'string', value : '',
@ -484,6 +486,3 @@ option('analyze', type: 'boolean', value: 'true',
option('bpf-framework', type : 'combo', choices : ['auto', 'true', 'false'],
description: 'build BPF programs from source code in restricted C')
option('dbus-interfaces-dir', type : 'string',
description : 'export D-Bus introspection XML as standalone files')