meson: properly conditionalize polkit installation

... including pkla installation on Debian.

v2:
- fix polkit-gobject-1 pkgconfig name
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2017-04-12 19:09:26 -04:00
parent b710072da4
commit 3ca0cb7363
10 changed files with 33 additions and 10 deletions

View File

@ -617,6 +617,21 @@ if smack_run_label != ''
m4_defines += ['-DHAVE_SMACK_RUN_LABEL']
endif
want_polkit = get_option('polkit')
install_polkit = false
install_polkit_pkla = false
if want_polkit != 'no'
conf.set('ENABLE_POLKIT', 1)
install_polkit = true
libpolkit = dependency('polkit-gobject-1',
required : false)
if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
message('Old polkit detected, will install pkla files')
install_polkit_pkla = true
endif
endif
want_audit = get_option('audit')
if want_audit != 'no'
libaudit = dependency('audit', required : want_audit == 'yes')

View File

@ -159,6 +159,8 @@ option('smack', type : 'combo', choices : ['auto', 'yes', 'no'],
description : 'SMACK support')
option('smack-run-label', type : 'string',
description : 'run systemd --system itself with a specific SMACK label')
option('polkit', type : 'combo', choices : ['auto', 'yes', 'no'],
description : 'PolicyKit support')
option('audit', type : 'combo', choices : ['auto', 'yes', 'no'],
description : 'libaudit support')

View File

@ -203,7 +203,7 @@ custom_target(
input : policy_in,
output : 'org.freedesktop.systemd1.policy',
command : intltool_command,
install : true,
install : install_polkit,
install_dir : polkitpolicydir)
# TODO: this might work with meson from git, see
@ -214,7 +214,7 @@ custom_target(
# po_dir : po_dir,
# input : policy_in,
# output : 'org.freedesktop.systemd1.policy',
# install : true,
# install : install_polkit,
# install_dir : polkitpolicydir)
install_data('system.conf',

View File

@ -11,6 +11,6 @@ if conf.get('ENABLE_HOSTNAMED', 0) == 1
input : 'org.freedesktop.hostname1.policy.in',
output : 'org.freedesktop.hostname1.policy',
command : intltool_command,
install : true,
install : install_polkit,
install_dir : polkitpolicydir)
endif

View File

@ -61,7 +61,7 @@ if conf.get('ENABLE_IMPORTD', 0) == 1
input : 'org.freedesktop.import1.policy.in',
output : 'org.freedesktop.import1.policy',
command : intltool_command,
install : true,
install : install_polkit,
install_dir : polkitpolicydir)
install_data('import-pubring.gpg',

View File

@ -19,7 +19,7 @@ if conf.get('ENABLE_LOCALED', 0) == 1
input : 'org.freedesktop.locale1.policy.in',
output : 'org.freedesktop.locale1.policy',
command : intltool_command,
install : true,
install : install_polkit,
install_dir : polkitpolicydir)
endif

View File

@ -78,7 +78,7 @@ if conf.get('ENABLE_LOGIND', 0) == 1
input : 'org.freedesktop.login1.policy.in',
output : 'org.freedesktop.login1.policy',
command : intltool_command,
install : true,
install : install_polkit,
install_dir : polkitpolicydir)
install_data('70-power-switch.rules',

View File

@ -34,7 +34,7 @@ if conf.get('ENABLE_MACHINED', 0) == 1
input : 'org.freedesktop.machine1.policy.in',
output : 'org.freedesktop.machine1.policy',
command : intltool_command,
install : true,
install : install_polkit,
install_dir : polkitpolicydir)
endif

View File

@ -108,8 +108,14 @@ if conf.get('ENABLE_NETWORKD', 0) == 1
install_dir : dbuspolicydir)
install_data('org.freedesktop.network1.service',
install_dir : dbussystemservicedir)
install_data('systemd-networkd.rules',
install_dir : polkitrulesdir)
if install_polkit
install_data('systemd-networkd.rules',
install_dir : polkitrulesdir)
endif
if install_polkit_pkla
install_data('systemd-networkd.pkla',
install_dir : polkitpkladir)
endif
tests += [
[['src/network/test-networkd-conf.c'],

View File

@ -11,6 +11,6 @@ if conf.get('ENABLE_TIMEDATED', 0) == 1
input : 'org.freedesktop.timedate1.policy.in',
output : 'org.freedesktop.timedate1.policy',
command : intltool_command,
install : true,
install : install_polkit,
install_dir : polkitpolicydir)
endif