/
meson.build
139 lines (120 loc) · 3.99 KB
/
meson.build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
project(
'rtkit', 'c',
version: '0.13',
license: 'GPL3',
meson_version: '>=0.49.0',
default_options: ['c_std=c99', 'warning_level=2'],
)
add_project_arguments(
'-D_GNU_SOURCE', '-DHAVE_CONFIG_H',
language: 'c'
)
cc = meson.get_compiler('c')
sh = find_program('sh')
xxd = find_program('xxd')
dbus_dep = dependency('dbus-1')
libcap_dep = dependency('libcap')
libsystemd_dep = dependency('libsystemd', required: get_option('libsystemd'))
polkit_dep = dependency('polkit-gobject-1', required: false)
systemd_dep = dependency('systemd', required: false)
thread_dep = dependency('threads')
librt_dep = cc.find_library('z')
cc.check_header('sched.h', dependencies: librt_dep)
cc.has_function('sched_setscheduler', dependencies: librt_dep)
libexecdir = get_option('libexecdir')
testsdir = get_option('libexecdir') / 'installed-tests' / meson.project_name()
busservicedir = get_option('dbus_systemservicedir')
if busservicedir == ''
busservicedir = dbus_dep.get_pkgconfig_variable(
'system_bus_services_dir',
default: get_option('datadir') / 'dbus-1' / 'system-services',
)
endif
interfacedir = get_option('dbus_interfacedir')
if interfacedir == ''
interfacedir = dbus_dep.get_pkgconfig_variable(
'interfaces_dir',
default: get_option('datadir') / 'dbus-1' / 'interfaces',
)
endif
rulesdir = get_option('dbus_rulesdir')
if rulesdir == ''
rulesdir = get_option('datadir') / 'dbus-1' / 'system.d'
endif
policydir = get_option('polkit_actiondir')
if policydir == '' and polkit_dep.found()
policydir = polkit_dep.get_pkgconfig_variable('actiondir', default: '')
endif
if policydir == ''
policydir = get_option('datadir') / 'polkit-1' / 'actions'
endif
systemunitdir = ''
if systemunitdir == '' and systemd_dep.found()
systemunitdir = systemd_dep.get_pkgconfig_variable(
'systemdsystemunitdir',
default: '',
)
endif
if systemunitdir == ''
systemunitdir = get_option('libdir') / 'systemd' / 'system'
endif
config = configuration_data()
config.set('LIBEXECDIR', get_option('prefix') / libexecdir)
config.set_quoted('PACKAGE_VERSION', meson.project_version())
config.set('HAVE_LIBSYSTEMD', libsystemd_dep.found())
config_h = configure_file(
input: 'config.h.meson',
output: 'config.h',
configuration: config,
)
xml_introspection_h = configure_file(
input: 'org.freedesktop.RealtimeKit1.xml',
output: 'xml-introspection.h',
command: [
sh, '-c', '"$1" -i < "$2" > "$3"', sh,
xxd, '@INPUT@', '@OUTPUT@'
],
)
executable(
'rtkit-daemon',
'rtkit-daemon.c', 'rtkit.c', 'rtkit.h', config_h, xml_introspection_h,
dependencies: [
dbus_dep,
libcap_dep,
librt_dep,
libsystemd_dep,
thread_dep
],
install: true,
install_dir: libexecdir,
)
executable(
'rtkit-test',
'rtkit-test.c', 'rtkit.c', 'rtkit.h', config_h,
dependencies: [dbus_dep, librt_dep],
install: get_option('installed_tests'),
install_dir: testsdir,
)
executable(
'rtkitctl',
'rtkitctl.c', 'rtkit.h', config_h,
install: true,
install_dir: get_option('sbindir'),
dependencies: [dbus_dep],
)
install_man('rtkitctl.8')
install_data('org.freedesktop.RealtimeKit1.xml', install_dir: interfacedir)
install_data('org.freedesktop.RealtimeKit1.conf', install_dir: rulesdir)
install_data('org.freedesktop.RealtimeKit1.policy', install_dir: policydir)
configure_file(
input: 'org.freedesktop.RealtimeKit1.service.in',
output: 'org.freedesktop.RealtimeKit1.service',
configuration: config,
install_dir: busservicedir,
)
configure_file(
input: 'rtkit-daemon.service.in',
output: 'rtkit-daemon.service',
configuration: config,
install_dir: systemunitdir,
)