project(
'cont8nuum',
'c',
version: '0.1.0',
license: 'CC0-1.0',
meson_version: '>=1.3.0',
default_options: ['c_std=c11', 'warning_level=2', 'buildtype=debugoptimized', 'werror=false'],
)
add_project_arguments(
'-DWLR_USE_UNSTABLE',
'-D_POSIX_C_SOURCE=200809L',
'-DC8_VERSION="@0@"'.format(meson.project_version()),
'-DC8_DATADIR="@0@"'.format(get_option('prefix') / get_option('datadir')),
'-DC8_LIBEXECDIR="@0@"'.format(get_option('prefix') / get_option('libexecdir')),
'-DC8_BINDIR="@0@"'.format(get_option('prefix') / get_option('bindir')),
'-Wno-unused-parameter',
'-Wno-missing-field-initializers',
language: 'c',
)
cc = meson.get_compiler('c')
wayland_server = dependency('wayland-server')
wayland_protos = dependency('wayland-protocols', version: '>=1.32')
c8_protocols = dependency('c8-protocols')
wlroots = dependency('wlroots-0.20')
xkbcommon = dependency('xkbcommon')
libinput = dependency('libinput')
pixman = dependency('pixman-1')
libdrm = dependency('libdrm')
cairo = dependency('cairo')
pangocairo = dependency('pangocairo')
fontconfig = dependency('fontconfig')
math = cc.find_library('m')
c8ui_core = dependency('c8ui-core')
have_xwayland = wlroots.get_variable(pkgconfig: 'have_xwayland', default_value: 'false') == 'true'
if get_option('xwayland').enabled() and not have_xwayland
error('xwayland requested but wlroots was built without it')
endif
have_xwayland = have_xwayland and not get_option('xwayland').disabled()
xcb = dependency('xcb', required: have_xwayland)
add_project_arguments(
'-DC8_HAVE_XWAYLAND=@0@'.format(have_xwayland.to_int()),
language: 'c',
)
wayland_scanner = find_program(
dependency('wayland-scanner', native: true).get_variable('wayland_scanner'),
native: true,
)
wl_protocol_dir = wayland_protos.get_variable('pkgdatadir')
c8_protocol_dir = c8_protocols.get_variable('pkgdatadir')
server_protocols = [
wl_protocol_dir / 'stable/xdg-shell/xdg-shell.xml',
wl_protocol_dir / 'unstable/xdg-output/xdg-output-unstable-v1.xml',
c8_protocol_dir / 'wlr-layer-shell-unstable-v1.xml',
c8_protocol_dir / 'cont8nuum-settings-v1.xml',
c8_protocol_dir / 'cont8nuum-shell-v1.xml',
c8_protocol_dir / 'cont8nuum-stereo-v1.xml',
]
server_protos_src = []
foreach xml : server_protocols
name = xml.split('/')[-1].replace('.xml', '')
server_protos_src += custom_target(
name + '_server_h',
input: xml,
output: '@BASENAME@-protocol.h',
command: [wayland_scanner, 'server-header', '@INPUT@', '@OUTPUT@'],
)
endforeach
# Code for the ones we serve ourselves (the rest wlroots does)
foreach xml : [
c8_protocol_dir / 'cont8nuum-settings-v1.xml',
c8_protocol_dir / 'cont8nuum-shell-v1.xml',
c8_protocol_dir / 'cont8nuum-stereo-v1.xml',
wl_protocol_dir / 'unstable/xdg-output/xdg-output-unstable-v1.xml',
]
name = xml.split('/')[-1].replace('.xml', '')
server_protos_src += custom_target(
name + '_code',
input: xml,
output: name + '-protocol.c',
command: [wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@'],
)
endforeach
subdir('src')
install_data('data/cont8nuum.desktop',
install_dir: get_option('datadir') / 'wayland-sessions')
install_data('data/config.ini',
install_dir: get_option('datadir') / 'doc' / 'cont8nuum')
summary({
'Xwayland': have_xwayland,
}, bool_yn: true)
# The session: services started alongside, see src/session.c
systemd_user_dir = get_option('prefix') / 'lib' / 'systemd' / 'user'
install_data('data/systemd/cont8nuum-session.target',
'data/systemd/cont8nuum-ssh-agent.service',
install_dir: systemd_user_dir)
configure_file(
input: 'data/systemd/cont8nuum-polkit-agent.service.in',
output: 'cont8nuum-polkit-agent.service',
configuration: {
'libexecdir': get_option('prefix') / get_option('libexecdir'),
},
install_dir: systemd_user_dir,
)
configure_file(
input: 'data/systemd/cont8nuum-gtk.service.in',
output: 'cont8nuum-gtk.service',
configuration: {
'libexecdir': get_option('prefix') / get_option('libexecdir'),
},
install_dir: systemd_user_dir,
)
install_data('data/c8-gtk-settings',
install_dir: get_option('libexecdir'),
install_mode: 'rwxr-xr-x')
install_data('data/c8-polkit-agent',
install_dir: get_option('libexecdir'),
install_mode: 'rwxr-xr-x')
install_data('data/cont8nuum-portals.conf',
install_dir: get_option('datadir') / 'xdg-desktop-portal')
# xdg-desktop-portal-wlr only looks in ~/.config and /etc/xdg
xdpw_dir = get_option('xdpw_dir')
if xdpw_dir == ''
if get_option('prefix').startswith('/usr')
xdpw_dir = '/etc/xdg/xdg-desktop-portal-wlr'
else
xdpw_dir = get_option('sysconfdir') / 'xdg' / 'xdg-desktop-portal-wlr'
endif
endif
install_data('data/xdg-desktop-portal-wlr.conf', install_dir: xdpw_dir,
rename: 'cont8nuum')
# The glasses' sensors (hidraw) for the session's user; udev reads
# /etc/udev/rules.d, not /usr/local
udev_dir = get_option('udev_dir')
if udev_dir == ''
if get_option('prefix').startswith('/usr')
udev_dir = '/etc/udev/rules.d'
else
udev_dir = get_option('prefix') / 'lib' / 'udev' / 'rules.d'
endif
endif
install_data('data/udev/70-cont8nuum-xreal.rules', install_dir: udev_dir)