Make labnag a meson feature flag

Add a 'labnag' meson option (default: auto) to allow disabling the
labnag notification daemon at build time. This is useful for
embedded/headless deployments (e.g. Android) where labnag is not
needed, and avoids building its wayland-client dependencies.

Disable with: meson setup build -Dlabnag=disabled
This commit is contained in:
GlassOnTin 2026-03-30 11:55:49 +01:00 committed by Johan Malm
parent 3128f50a25
commit 862d230ff9
2 changed files with 55 additions and 52 deletions

View file

@ -1,21 +1,22 @@
wayland_client = dependency('wayland-client') if get_option('labnag').allowed()
wayland_cursor = dependency('wayland-cursor') wayland_client = dependency('wayland-client')
wayland_cursor = dependency('wayland-cursor')
nag_sources = files( nag_sources = files(
'labnag.c', 'labnag.c',
'pool-buffer.c', 'pool-buffer.c',
) )
wl_protocol_dir = wayland_protos.get_variable('pkgdatadir') wl_protocol_dir = wayland_protos.get_variable('pkgdatadir')
protocols = [ protocols = [
wl_protocol_dir / 'stable/tablet/tablet-v2.xml', wl_protocol_dir / 'stable/tablet/tablet-v2.xml',
wl_protocol_dir / 'stable/xdg-shell/xdg-shell.xml', wl_protocol_dir / 'stable/xdg-shell/xdg-shell.xml',
wl_protocol_dir / 'staging/cursor-shape/cursor-shape-v1.xml', wl_protocol_dir / 'staging/cursor-shape/cursor-shape-v1.xml',
'../protocols/wlr-layer-shell-unstable-v1.xml', '../protocols/wlr-layer-shell-unstable-v1.xml',
] ]
foreach xml : protocols foreach xml : protocols
nag_sources += custom_target( nag_sources += custom_target(
xml.underscorify() + '_c', xml.underscorify() + '_c',
input: xml, input: xml,
@ -28,16 +29,16 @@ foreach xml : protocols
output: '@BASENAME@-client-protocol.h', output: '@BASENAME@-client-protocol.h',
command: [wayland_scanner, 'client-header', '@INPUT@', '@OUTPUT@'], command: [wayland_scanner, 'client-header', '@INPUT@', '@OUTPUT@'],
) )
endforeach endforeach
if host_machine.system() in ['freebsd', 'openbsd'] if host_machine.system() in ['freebsd', 'openbsd']
# For signalfd() # For signalfd()
epoll_dep = dependency('epoll-shim') epoll_dep = dependency('epoll-shim')
else else
epoll_dep = [] epoll_dep = []
endif endif
executable( executable(
'labnag', 'labnag',
nag_sources, nag_sources,
dependencies: [ dependencies: [
@ -53,7 +54,8 @@ executable(
], ],
include_directories: [labwc_inc], include_directories: [labwc_inc],
install: true, install: true,
) )
endif
clients = files('lab-sensible-terminal') clients = files('lab-sensible-terminal')
install_data(clients, install_dir: get_option('bindir')) install_data(clients, install_dir: get_option('bindir'))

View file

@ -2,6 +2,7 @@ option('man-pages', type: 'feature', value: 'auto', description: 'Generate and i
option('xwayland', type: 'feature', value: 'auto', description: 'Enable support for X11 applications') option('xwayland', type: 'feature', value: 'auto', description: 'Enable support for X11 applications')
option('svg', type: 'feature', value: 'enabled', description: 'Enable svg window buttons') option('svg', type: 'feature', value: 'enabled', description: 'Enable svg window buttons')
option('icon', type: 'feature', value: 'enabled', description: 'Enable window icons') option('icon', type: 'feature', value: 'enabled', description: 'Enable window icons')
option('labnag', type: 'feature', value: 'auto', description: 'Build labnag notification daemon')
option('nls', type: 'feature', value: 'auto', description: 'Enable native language support') option('nls', type: 'feature', value: 'auto', description: 'Enable native language support')
option('static_analyzer', type: 'feature', value: 'disabled', description: 'Run gcc static analyzer') option('static_analyzer', type: 'feature', value: 'disabled', description: 'Run gcc static analyzer')
option('test', type: 'feature', value: 'disabled', description: 'Run tests') option('test', type: 'feature', value: 'disabled', description: 'Run tests')