swayidle/meson.build

162 lines
3.7 KiB
Meson
Raw Normal View History

2019-01-12 15:21:21 +01:00
project(
'swayidle',
'c',
2022-12-04 15:18:01 +01:00
version: '1.8.0',
2019-01-12 15:21:21 +01:00
license: 'MIT',
meson_version: '>=0.59.0',
2019-01-12 15:21:21 +01:00
default_options: [
'c_std=c11',
'warning_level=2',
'werror=true',
],
)
add_project_arguments(
[
'-Wno-unused-parameter',
'-Wno-unused-result',
'-Wundef',
'-Wvla',
2019-01-12 15:21:21 +01:00
],
language: 'c',
)
2020-02-09 19:04:16 +01:00
sysconfdir = get_option('sysconfdir')
prefix = get_option('prefix')
add_project_arguments(
'-DSYSCONFDIR="@0@"'.format(join_paths(prefix, sysconfdir)),
2022-12-04 15:21:08 +01:00
language : 'c',
)
2020-02-09 19:04:16 +01:00
2019-01-12 15:21:21 +01:00
wayland_client = dependency('wayland-client')
wayland_protos = dependency('wayland-protocols', version: '>=1.27')
2019-01-12 15:21:21 +01:00
wayland_server = dependency('wayland-server')
2022-12-04 15:21:08 +01:00
bash_comp = dependency('bash-completion', required: false)
fish_comp = dependency('fish', required: false)
2019-01-24 23:32:33 +01:00
logind = dependency('lib' + get_option('logind-provider'), required: get_option('logind'))
scdoc = find_program('scdoc', required: get_option('man-pages'))
wayland_scanner = dependency('wayland-scanner', native: true, version: '>=1.14.91')
wayland_scanner_prog = find_program(wayland_scanner.get_variable('wayland_scanner'), native: true)
2019-01-12 15:21:21 +01:00
wl_protocol_dir = wayland_protos.get_variable('pkgdatadir')
2019-01-12 15:21:21 +01:00
wayland_scanner_code = generator(
wayland_scanner_prog,
2019-01-12 15:21:21 +01:00
output: '@BASENAME@-protocol.c',
arguments: ['private-code', '@INPUT@', '@OUTPUT@'],
2019-01-12 15:21:21 +01:00
)
wayland_scanner_client = generator(
wayland_scanner_prog,
2019-01-12 15:21:21 +01:00
output: '@BASENAME@-client-protocol.h',
arguments: ['client-header', '@INPUT@', '@OUTPUT@'],
)
protos = [
'idle.xml',
wl_protocol_dir / 'staging/ext-idle-notify/ext-idle-notify-v1.xml',
]
client_protos_src = []
client_protos_headers = []
foreach xml : protos
client_protos_src += wayland_scanner_code.process(xml)
client_protos_headers += wayland_scanner_client.process(xml)
endforeach
2019-01-12 15:21:21 +01:00
lib_client_protos = static_library(
'client_protos',
[client_protos_src, client_protos_headers],
dependencies: [wayland_client]
) # for the include directory
client_protos = declare_dependency(
link_with: lib_client_protos,
sources: client_protos_headers,
)
2018-11-18 00:33:06 +01:00
swayidle_deps = [
client_protos,
wayland_client,
wayland_server,
]
2019-01-24 23:32:33 +01:00
conf_data = configuration_data()
conf_data.set10('HAVE_SYSTEMD', false)
conf_data.set10('HAVE_ELOGIND', false)
if logind.found()
swayidle_deps += logind
conf_data.set10('HAVE_' + get_option('logind-provider').to_upper(), true)
2018-11-18 00:33:06 +01:00
endif
2019-01-24 23:32:33 +01:00
configure_file(output: 'config.h', configuration: conf_data)
2019-01-12 15:21:21 +01:00
executable(
'swayidle', [
'main.c',
],
2018-11-18 00:33:06 +01:00
dependencies: swayidle_deps,
2019-01-24 23:32:33 +01:00
install: true,
)
2019-01-12 15:21:21 +01:00
if scdoc.found()
mandir = get_option('mandir')
man_files = [
'swayidle.1.scd',
]
foreach filename : man_files
topic = filename.split('.')[-3].split('/')[-1]
section = filename.split('.')[-2]
output = '@0@.@1@'.format(topic, section)
custom_target(
output,
input: filename,
output: output,
command: scdoc,
feed: true,
capture: true,
2019-01-12 15:21:21 +01:00
install: true,
install_dir: '@0@/man@1@'.format(mandir, section)
)
endforeach
endif
2019-01-12 15:39:41 +01:00
datadir = get_option('datadir')
2019-01-24 23:32:33 +01:00
if get_option('zsh-completions')
2019-01-12 15:39:41 +01:00
zsh_files = files(
'completions/zsh/_swayidle',
)
zsh_install_dir = datadir + '/zsh/site-functions'
install_data(zsh_files, install_dir: zsh_install_dir)
endif
2019-01-24 23:32:33 +01:00
if get_option('bash-completions')
2019-01-12 15:39:41 +01:00
bash_files = files(
'completions/bash/swayidle',
)
if bash_comp.found()
bash_install_dir = bash_comp.get_variable('completionsdir')
else
bash_install_dir = datadir + '/bash-completion/completions'
endif
2019-01-12 15:39:41 +01:00
install_data(bash_files, install_dir: bash_install_dir)
endif
2019-01-24 23:32:33 +01:00
if get_option('fish-completions')
2019-01-12 15:39:41 +01:00
fish_files = files(
'completions/fish/swayidle.fish',
)
if fish_comp.found()
fish_install_dir = fish_comp.get_variable('completionsdir')
else
fish_install_dir = datadir + '/fish/vendor_completions.d'
endif
2019-01-12 15:39:41 +01:00
install_data(fish_files, install_dir: fish_install_dir)
endif