1
0
mirror of https://github.com/systemd/systemd synced 2024-07-08 20:15:55 +00:00

meson: obtain dbus directories from pkg-config

This commit is contained in:
Yu Watanabe 2021-12-26 16:19:17 +09:00
parent 7e560e79eb
commit 1bd0cc452c

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])
############################################################