mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-04 23:02:28 +00:00
policy: fix compilation on a variety of configurations
* Meson >=0.41.0, (unreleased) polkit 0.114+ don't use data_dirs argument * Meson >=0.41.0, older polkit, use local ITS rules with data_dirs argument * Meson <0.41.0, any polkit, use custom policy building rules Later on when meson 0.41.0+ and polkit 0.114+ is in many stable distros this commit can be reverted and dependencies updated. Fixes: #107
This commit is contained in:
parent
f0bb65efa8
commit
df430376fc
8
policy/its/polkit.its
Normal file
8
policy/its/polkit.its
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0"?>
|
||||
<its:rules xmlns:its="http://www.w3.org/2005/11/its"
|
||||
version="2.0">
|
||||
<its:translateRule selector="//*" translate="no"/>
|
||||
<its:translateRule selector="//action/description |
|
||||
//action/message"
|
||||
translate="yes"/>
|
||||
</its:rules>
|
6
policy/its/polkit.loc
Normal file
6
policy/its/polkit.loc
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0"?>
|
||||
<locatingRules>
|
||||
<locatingRule name="polkit policy" pattern="*.policy">
|
||||
<documentRule localName="policyconfig" target="polkit.its"/>
|
||||
</locatingRule>
|
||||
</locatingRules>
|
@ -1,11 +1,43 @@
|
||||
install_data('org.freedesktop.fwupd.rules',
|
||||
install_dir : 'share/polkit-1/rules.d')
|
||||
|
||||
i18n.merge_file(
|
||||
input: 'org.freedesktop.fwupd.policy.in',
|
||||
output: 'org.freedesktop.fwupd.policy',
|
||||
type: 'xml',
|
||||
po_dir: join_paths(meson.source_root(), 'po'),
|
||||
install: true,
|
||||
install_dir: join_paths(get_option('datadir'), 'polkit-1', 'actions')
|
||||
)
|
||||
#meson 0.41.0 added support for data_dirs argument
|
||||
if meson.version().version_compare('>=0.41.0')
|
||||
#newer polkit has the ITS rules included
|
||||
if polkit.version().version_compare('>0.113')
|
||||
i18n.merge_file(
|
||||
input: 'org.freedesktop.fwupd.policy.in',
|
||||
output: 'org.freedesktop.fwupd.policy',
|
||||
install: true,
|
||||
install_dir: join_paths(get_option('datadir'), 'polkit-1', 'actions') ,
|
||||
type: 'xml',
|
||||
po_dir: join_paths(meson.source_root(), 'po')
|
||||
)
|
||||
#older polkit is missing ITS rules and will fail
|
||||
else
|
||||
i18n.merge_file(
|
||||
input: 'org.freedesktop.fwupd.policy.in',
|
||||
output: 'org.freedesktop.fwupd.policy',
|
||||
install: true,
|
||||
install_dir: join_paths(get_option('datadir'), 'polkit-1', 'actions') ,
|
||||
type: 'xml',
|
||||
data_dirs: join_paths(meson.source_root(), 'policy'),
|
||||
po_dir: join_paths(meson.source_root(), 'po')
|
||||
)
|
||||
endif
|
||||
#older polkit and older meson, need to do some custom targets
|
||||
#see https://github.com/hughsie/fwupd/issues/107
|
||||
else
|
||||
envbin = find_program('env')
|
||||
gettext_data_dir = 'GETTEXTDATADIRS=' + join_paths(meson.source_root(), 'policy')
|
||||
custom_target('org.freedesktop.fwupd.policy',
|
||||
input: 'org.freedesktop.fwupd.policy.in',
|
||||
output: 'org.freedesktop.fwupd.policy',
|
||||
command: [envbin, gettext_data_dir, 'msgfmt', '--xml',
|
||||
'--template', '@INPUT@',
|
||||
'-d', join_paths(meson.source_root(), 'po'),
|
||||
'-o', '@OUTPUT@'],
|
||||
install: true,
|
||||
install_dir: join_paths(get_option('datadir'), 'polkit-1', 'actions')
|
||||
)
|
||||
endif
|
||||
|
Loading…
Reference in New Issue
Block a user