Skip to content

Commit

Permalink
meson: make x11 support optional, add summary
Browse files Browse the repository at this point in the history
  • Loading branch information
apprehensions committed Feb 29, 2024
1 parent 253f333 commit 4ce5154
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 13 deletions.
25 changes: 20 additions & 5 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ glib = dependency('glib-2.0')
gio = dependency('gio-2.0')
gdk_pixbuf = dependency('gdk-pixbuf-2.0')
pangocairo = dependency('pangocairo')
x11 = dependency('x11')
xinerama = dependency('xinerama')
xext = dependency('xext')
xrandr = dependency('xrandr', version: '>=1.5')
xscrnsaver = dependency('xscrnsaver')
x11 = dependency('x11', required: get_option('x11'))
xinerama = dependency('xinerama', required: get_option('x11'))
xext = dependency('xext', required: get_option('x11'))
xrandr = dependency('xrandr', required: get_option('x11'), version: '>=1.5')
xscrnsaver = dependency('xscrnsaver', required: get_option('x11'))
systemd = dependency('systemd', required: get_option('systemd'))
libnotify = dependency('libnotify', required: get_option('dunstify'))
realtime = cc.find_library('rt')
Expand All @@ -41,6 +41,13 @@ wayland_client = dependency('wayland-client', required: get_option('wayland'))
wayland_protos = dependency('wayland-protocols', version: '>=1.12', required: get_option('wayland'))
wayland_cursor = dependency('wayland-cursor', required: get_option('wayland'))

x11_support = x11.found() and xinerama.found() and xext.found() and xrandr.found() and xscrnsaver.found()
wayland_support = wayland_client.found() and wayland_cursor.found() and wayland_protos.found()

if not x11_support and not wayland_support
error('either wayland or x11 support is required')
endif

c_version_arg = '-DVERSION="@0@"'.format(meson.project_version())
sysconfdir = get_option('sysconfdir') / 'xdg'

Expand Down Expand Up @@ -90,3 +97,11 @@ pod2man = find_program('pod2man', native: true, required: get_option('docs'))
if pod2man.found()
subdir('docs')
endif

summary({
'X11 support': x11_support,
'Wayland support': wayland_support,
'Man pages': pod2man.found(),
'Dunstify': libnotify.found(),
'Install systemd service units': systemd.found(),
}, bool_yn: true)
1 change: 1 addition & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
option('docs', type: 'feature', value: 'auto', description: 'Generate and install man pages')
option('wayland', type: 'feature', value: 'auto', description: 'Enable wayland support')
option('x11', type: 'feature', value: 'auto', description: 'Enable X11 support')
option('dunstify', type: 'feature', value: 'auto', description: 'Install libnotify dunstify utility')
option('systemd', type: 'feature', value: 'auto', description: 'Install systemd user service unit')
25 changes: 17 additions & 8 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ dunst_depends = [
gio,
gdk_pixbuf,
pangocairo,
x11,
xinerama,
xext,
xrandr,
xscrnsaver,
systemd,
libnotify,
realtime,
Expand All @@ -33,11 +28,25 @@ dunst_src_files = files(
'rules.c',
'settings.c',
'utils.c',
'x11/screen.c',
'x11/x.c',
)

if wayland_client.found() and wayland_cursor.found() and wayland_protos.found()
if x11_support
add_global_arguments('-DENABLE_X11', language: 'c')

dunst_depends += [
x11,
xinerama,
xext,
xrandr,
xscrnsaver,
]
dunst_src_files += files(
'x11/screen.c',
'x11/x.c',
)
endif

if wayland_support
add_global_arguments('-DENABLE_WAYLAND', language: 'c')

subdir('wayland/protocols')
Expand Down

0 comments on commit 4ce5154

Please sign in to comment.