xdg-desktop-portal-hyprland/meson.build

155 lines
4.1 KiB
Meson
Raw Normal View History

2018-12-12 22:29:57 +01:00
project(
2021-03-04 20:17:35 +01:00
'xdg-desktop-portal-wlr',
'c',
2021-11-05 16:25:28 +01:00
version: '0.5.0',
2021-03-04 20:17:35 +01:00
license: 'MIT',
meson_version: '>=0.50.0',
default_options: ['c_std=c11', 'warning_level=2', 'werror=true'],
2018-12-12 22:29:57 +01:00
)
2020-03-13 17:53:50 +01:00
cc = meson.get_compiler('c')
add_project_arguments(cc.get_supported_arguments([
'-Wno-missing-braces',
'-Wno-missing-field-initializers',
'-Wno-unused-parameter',
'-D_POSIX_C_SOURCE=200809L',
2020-03-13 17:53:50 +01:00
]), language: 'c')
2018-12-12 22:29:57 +01:00
prefix = get_option('prefix')
sysconfdir = get_option('sysconfdir')
add_project_arguments('-DSYSCONFDIR="@0@"'.format(join_paths(prefix, sysconfdir)), language : 'c')
2020-01-24 23:31:01 +01:00
inc = include_directories('include')
2018-12-12 22:29:57 +01:00
2020-01-24 23:31:01 +01:00
rt = cc.find_library('rt')
pipewire = dependency('libpipewire-0.3', version: '>= 0.3.41')
2018-12-12 22:29:57 +01:00
wayland_client = dependency('wayland-client')
wayland_protos = dependency('wayland-protocols', version: '>=1.14')
2021-05-01 17:03:54 +02:00
iniparser = dependency('inih')
epoll = dependency('', required: false)
if (not cc.has_function('timerfd_create', prefix: '#include <sys/timerfd.h>') or
not cc.has_function('signalfd', prefix: '#include <sys/signalfd.h>'))
epoll = dependency('epoll-shim')
endif
if pipewire.version() == '0.3.49'
add_project_arguments(cc.get_supported_arguments([
'-D_GNU_SOURCE',
]), language: 'c')
endif
if get_option('sd-bus-provider') == 'auto'
assert(get_option('auto_features').auto(), 'sd-bus-provider must not be set to auto since auto_features != auto')
sdbus = dependency('libsystemd',
required: false,
not_found_message: 'libsystemd not found, trying libelogind',
)
if not sdbus.found()
sdbus = dependency('libelogind',
required: false,
not_found_message: 'libelogind not found, trying basu',
)
endif
if not sdbus.found()
sdbus = dependency('basu',
required: false,
)
endif
if not sdbus.found()
error('Neither libsystemd, nor libelogind, nor basu was found')
endif
else
sdbus = dependency(get_option('sd-bus-provider'))
endif
add_project_arguments('-DHAVE_' + sdbus.name().to_upper() + '=1', language: 'c')
2018-12-12 22:29:57 +01:00
2020-01-24 23:31:01 +01:00
subdir('protocols')
2018-12-12 22:29:57 +01:00
xdpw_files = files([
'src/core/main.c',
'src/core/logger.c',
'src/core/config.c',
'src/core/request.c',
'src/core/session.c',
'src/core/timer.c',
'src/core/timespec_util.c',
'src/screenshot/screenshot.c',
'src/screencast/screencast.c',
'src/screencast/screencast_common.c',
'src/screencast/wlr_screencast.c',
'src/screencast/pipewire_screencast.c',
'src/screencast/fps_limit.c',
])
2018-12-12 22:29:57 +01:00
executable(
'xdg-desktop-portal-wlr',
[xdpw_files, wl_proto_files],
2018-12-12 22:29:57 +01:00
dependencies: [
wayland_client,
sdbus,
2020-01-24 23:31:01 +01:00
pipewire,
2020-03-23 16:49:36 +01:00
rt,
iniparser,
epoll,
2018-12-12 22:29:57 +01:00
],
2020-01-24 23:31:01 +01:00
include_directories: [inc],
2018-12-12 22:29:57 +01:00
install: true,
2020-04-10 10:48:41 +02:00
install_dir: get_option('libexecdir'),
)
conf_data = configuration_data()
conf_data.set('libexecdir',
join_paths(get_option('prefix'), get_option('libexecdir')))
conf_data.set('systemd_service', '')
systemd = dependency('systemd', required: get_option('systemd'))
if systemd.found()
systemd_service_file = 'xdg-desktop-portal-wlr.service'
user_unit_dir = systemd.get_pkgconfig_variable('systemduserunitdir',
define_variable: ['prefix', get_option('prefix')])
conf_data.set('systemd_service', 'SystemdService=' + systemd_service_file)
configure_file(
configuration: conf_data,
input: 'contrib/systemd/' + systemd_service_file + '.in',
output: '@BASENAME@',
install_dir: user_unit_dir,
)
endif
configure_file(
configuration: conf_data,
input: 'org.freedesktop.impl.portal.desktop.wlr.service.in',
output: '@BASENAME@',
install_dir: join_paths(get_option('datadir'), 'dbus-1', 'services'),
2018-12-12 22:29:57 +01:00
)
install_data(
'wlr.portal',
install_dir: join_paths(get_option('datadir'), 'xdg-desktop-portal', 'portals'),
)
2021-03-08 19:33:12 +01:00
scdoc = dependency('scdoc', required: get_option('man-pages'), version: '>= 1.9.7')
if scdoc.found()
man_pages = ['xdg-desktop-portal-wlr.5.scd']
foreach src : man_pages
topic = src.split('.')[0]
section = src.split('.')[1]
output = topic + '.' + section
custom_target(
output,
input: files(src),
output: output,
command: [
'sh', '-c', '@0@ < @INPUT@ > @1@'.format(scdoc.get_pkgconfig_variable('scdoc'), output)
],
install: true,
install_dir: join_paths(get_option('mandir'), 'man' + section),
)
endforeach
endif