~kennylevinsen/poweralertd

ref: 5980677e86678da9d10294181b9d1be7e4836239 poweralertd/meson.build -rw-r--r-- 1.8 KiB
5980677eKenny Levinsen Support basu as sd-bus impl 5 months ago
                                                                                
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
project(
	'poweralertd',
	'c',
	license: 'GPL3',
	meson_version: '>=0.47.0',
	default_options: [
		'c_std=c11',
		'warning_level=2',
		'werror=true',
	],
)

add_project_arguments('-Wno-unused-parameter', language: 'c')
add_project_arguments('-Wno-missing-braces', language: 'c')

configuration = configuration_data()
configuration.set('bindir', join_paths(get_option('prefix'), get_option('bindir')))

basu = dependency('libbasu', required: false)
elogind = dependency('libelogind', required: false)
systemd = dependency('libsystemd', required: false)

if basu.found()
	add_project_arguments('-DHAVE_BASU=1', language: 'c')
	sdbus = basu
elif elogind.found()
	add_project_arguments('-DHAVE_ELOGIND=1', language: 'c')
	sdbus = elogind
elif systemd.found()
	add_project_arguments('-DHAVE_SYSTEMD=1', language: 'c')
	sdbus = systemd

	systemd = dependency('systemd', required: true)
	systemd_units_dir = systemd.get_pkgconfig_variable('systemduserunitdir')
	configure_file(
		configuration: configuration,
		input: 'contrib/systemd-user/poweralertd.service.in',
		output: '@BASENAME@',
		install_dir: systemd_units_dir
	)
else
	dependency('basu')
endif

executable(
	'poweralertd',
	['main.c', 'upower.c', 'notify.c', 'list.c'],
	dependencies: [sdbus],
	install: true,
)

scdoc = dependency('scdoc', required: get_option('man-pages'), version: '>= 1.9.7')

if scdoc.found()
	sh = find_program('sh')

	man_pages = ['poweralertd.1.scd']

	mandir = get_option('mandir')

	foreach src : man_pages
		topic = src.split('.')[0]
		section = src.split('.')[1]
		output = '@0@.@1@'.format(topic, section)

		custom_target(
			output,
			input: src,
			output: output,
			command: [
				sh, '-c', '@0@ < @INPUT@ > @1@'.format(scdoc.get_pkgconfig_variable('scdoc'), output)
			],
			install: true,
			install_dir: '@0@/man@1@'.format(mandir, section)
		)
	endforeach
endif