From ae3d1b9888838ea94a26c261e296575caf70e049 Mon Sep 17 00:00:00 2001 From: sewn Date: Mon, 13 Nov 2023 22:09:06 +0300 Subject: [PATCH 01/16] initial meson build --- .gitignore | 1 + Makefile | 8 ++- docs/{dunst.1.pod => dunst.1.pod.in} | 4 +- docs/meson.build | 61 +++++++++++++++++++ dunst.systemd.service.in | 1 + meson.build | 87 ++++++++++++++++++++++++++++ meson_options.txt | 5 ++ org.knopwob.dunst.service.in | 2 +- src/meson.build | 64 ++++++++++++++++++++ src/wayland/protocols/meson.build | 43 ++++++++++++++ test/meson.build | 38 ++++++++++++ 11 files changed, 308 insertions(+), 6 deletions(-) rename docs/{dunst.1.pod => dunst.1.pod.in} (97%) create mode 100644 docs/meson.build create mode 100644 meson.build create mode 100644 meson_options.txt create mode 100644 src/meson.build create mode 100644 src/wayland/protocols/meson.build create mode 100644 test/meson.build diff --git a/.gitignore b/.gitignore index 82328540a..19253ad28 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ core vgcore.* /docs/*.1 +/docs/dunst.1.pod /docs/*.5 /docs/internal/coverage /docs/internal/html diff --git a/Makefile b/Makefile index 7c61a0d67..ecdc5db4a 100644 --- a/Makefile +++ b/Makefile @@ -132,8 +132,10 @@ doc: docs/dunst.1 docs/dunst.5 docs/dunstctl.1 docs/dunstify.1 # Can't dedup this as we need to explicitly provide the name and title text to # pod2man :( +docs/dunst.1.pod: docs/dunst.1.pod.in + ${SED} "s|@sysconfdir@|${SYSCONFDIR}|" $< > $@ docs/dunst.1: docs/dunst.1.pod - ${SED} "s|##SYSCONFDIR##|${SYSCONFDIR}|" $< | ${POD2MAN} --name=dunst -c "Dunst Reference" --section=1 --release=${VERSION} > $@ + ${POD2MAN} --name=dunst -c "Dunst Reference" --section=1 --release=${VERSION} $< > $@ docs/dunst.5: docs/dunst.5.pod ${POD2MAN} --name=dunst -c "Dunst Reference" --section=5 --release=${VERSION} $< > $@ docs/dunstctl.1: docs/dunstctl.pod @@ -147,11 +149,11 @@ doc-doxygen: .PHONY: service service-dbus service-systemd wayland-protocols service: service-dbus service-dbus: - @${SED} "s|##PREFIX##|$(PREFIX)|" org.knopwob.dunst.service.in > org.knopwob.dunst.service + @${SED} "s|@bindir@|$(BINDIR)|" org.knopwob.dunst.service.in > org.knopwob.dunst.service ifneq (0,${SYSTEMD}) service: service-systemd service-systemd: - @${SED} "s|##PREFIX##|$(PREFIX)|" dunst.systemd.service.in > dunst.systemd.service + @${SED} "s|@bindir@|$(BINDIR)|" dunst.systemd.service.in > dunst.systemd.service endif ifneq (0,${WAYLAND}) diff --git a/docs/dunst.1.pod b/docs/dunst.1.pod.in similarity index 97% rename from docs/dunst.1.pod rename to docs/dunst.1.pod.in index 558d3c236..b21a74f07 100644 --- a/docs/dunst.1.pod +++ b/docs/dunst.1.pod.in @@ -92,7 +92,7 @@ Set notification timeout time. =head1 CONFIGURATION -A default configuration file is included (usually ##SYSCONFDIR##/dunst/dunstrc) +A default configuration file is included (usually @sysconfdir@/dunst/dunstrc) and serves as the least important configuration file. Note: this was previously /usr/share/dunst/dunstrc. You can edit this file to change the system-wide defaults or copy it to a more important location to override its settings. See @@ -145,7 +145,7 @@ This is the most important directory. (C<$HOME/.config> if unset or empty) This, like C<$PATH> for instance, is a :-separated list of base directories in I. -(F<##SYSCONFDIR##> if unset or empty) +(F<@sysconfdir@> if unset or empty) =back diff --git a/docs/meson.build b/docs/meson.build new file mode 100644 index 000000000..71c1f9763 --- /dev/null +++ b/docs/meson.build @@ -0,0 +1,61 @@ +pod2man = find_program('pod2man', native: true) +man1 = join_paths(get_option('mandir'), 'man1') +man5 = join_paths(get_option('mandir'), 'man5') +pod2man_version_arg = '--release=@0@'.format(meson.project_version()) + +dunst1 = configure_file( + input: 'dunst.1.pod.in', + output: 'dunst.1.pod', + configuration: conf_data, +) + +custom_target( + 'dunst1_pod2man', + input: dunst1, + output: 'dunst.1', + command: [ + pod2man, + '--name=dunst', + '--center=Dunst Reference', + '--section=1', + pod2man_version_arg, + '@INPUT@', + '@OUTPUT@', + ], + install: true, + install_dir: man1, +) + +custom_target( + 'dunst5_pod2man', + input: 'dunst.5.pod', + output: 'dunst.5', + command: [ + pod2man, + '--name=dunst', + '--center=Dunst Reference', + '--section=5', + pod2man_version_arg, + '@INPUT@', + '@OUTPUT@', + ], + install: true, + install_dir: man5, +) + +custom_target( + 'dunstctl_pod2man', + input: 'dunstctl.pod', + output: 'dunstctl.1', + command: [ + pod2man, + '--name=dunst', + '--center=dunstctl Reference', + '--section=1', + pod2man_version_arg, + '@INPUT@', + '@OUTPUT@', + ], + install: true, + install_dir: man1, +) diff --git a/dunst.systemd.service.in b/dunst.systemd.service.in index af1a62bc1..be7bf062d 100644 --- a/dunst.systemd.service.in +++ b/dunst.systemd.service.in @@ -7,4 +7,5 @@ PartOf=graphical-session.target Type=dbus BusName=org.freedesktop.Notifications ExecStart=##PREFIX##/bin/dunst +ExecStart=@bindir@/dunst Slice=session.slice diff --git a/meson.build b/meson.build new file mode 100644 index 000000000..29b3236cc --- /dev/null +++ b/meson.build @@ -0,0 +1,87 @@ +project( + 'dunst', + 'c', + version: '1.9.2', + license: 'MIT', + meson_version: '>=0.60.0', + default_options: [ + 'c_std=gnu99', + 'warning_level=1', + 'buildtype=release', + ], +) + +add_project_arguments([ + '-pedantic', + '-Wno-gnu-zero-variadic-macro-arguments', + '-Wno-overlength-strings', +], language: 'c') + +if get_option('buildtype').startswith('debug') + add_project_arguments('-DDEBUG_BUILD', language: 'c') +endif + +cc = meson.get_compiler('c') + +cairo = dependency('cairo') +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') +systemd = dependency('systemd', required: get_option('systemd')) +libnotify = dependency('libnotify', required: get_option('dunstify')) +realtime = cc.find_library('rt') +math = cc.find_library('m') +wayland_client = dependency('wayland-client', required: get_option('wayland')) +wayland_protos = dependency('wayland-protocols', version: '>=1.32', required: get_option('wayland')) +wayland_cursor = dependency('wayland-cursor', required: get_option('wayland')) + +c_version_arg = '-DVERSION="@0@"'.format(meson.project_version()) + +subdir('src') + +install_data('dunstctl', install_dir: get_option('bindir')) +install_data('dunstrc', install_dir: get_option('sysconfdir') / 'dunst') + +conf_data = configuration_data() +conf_data.set('bindir', get_option('bindir')) +conf_data.set('sysconfdir', get_option('sysconfdir')) + +configure_file( + input: 'org.knopwob.dunst.service.in', + output: '@BASENAME@', + configuration: conf_data, + install_dir: join_paths(get_option('datadir'), 'dbus-1/services'), +) + +if systemd.found() + user_units_dir = systemd.get_pkgconfig_variable('systemduserunitdir') + configure_file( + configuration: conf_data, + input: 'dunst.systemd.service.in', + output: '@BASENAME@', + install_dir: user_units_dir, + ) +endif + +if libnotify.found() + executable( + 'dunstify', + 'dunstify.c', + dependencies: [ glib, libnotify, gdk_pixbuf ], + install: true, + ) +endif + +if get_option('test') + subdir('test') +endif + +if get_option('docs').enabled() + subdir('docs') +endif diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 000000000..25565d5d8 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,5 @@ +option('docs', type: 'feature', value: 'enabled', description: 'Generate and install man pages') +option('test', type: 'boolean', value: false, description: 'Build test program') +option('wayland', type: 'feature', value: 'auto', description: 'Enable wayland support') +option('dunstify', type: 'feature', value: 'auto', description: 'Install libnotify dunstify utility') +option('systemd', type: 'feature', value: 'auto', description: 'Install systemd user service unit') diff --git a/org.knopwob.dunst.service.in b/org.knopwob.dunst.service.in index a8e8ac17b..9c3b6beef 100644 --- a/org.knopwob.dunst.service.in +++ b/org.knopwob.dunst.service.in @@ -1,4 +1,4 @@ [D-BUS Service] Name=org.freedesktop.Notifications -Exec=##PREFIX##/bin/dunst +Exec=@bindir@/dunst SystemdService=dunst.service diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 000000000..13235a972 --- /dev/null +++ b/src/meson.build @@ -0,0 +1,64 @@ +dunst_depends = [ + cairo, + glib, + gio, + gdk_pixbuf, + pangocairo, + x11, + xinerama, + xext, + xrandr, + xscrnsaver, + systemd, + libnotify, + realtime, + math, +] + +dunst_src_files = [ + 'dbus.c', + 'draw.c', + 'dunst.c', + 'icon-lookup.c', + 'icon.c', + 'ini.c', + 'input.c', + 'log.c', + 'markup.c', + 'menu.c', + 'notification.c', + 'option_parser.c', + 'output.c', + 'queues.c', + 'rules.c', + 'settings.c', + 'utils.c', + 'x11/screen.c', + 'x11/x.c', +] + +if wayland_client.found() and wayland_cursor.found() and wayland_protos.found() + add_global_arguments('-DENABLE_WAYLAND', language: 'c') + + subdir('wayland/protocols') + + dunst_depends += [ + client_protos, wayland_client, wayland_cursor, + ] + dunst_src_files += [ + 'wayland/foreign_toplevel.c', + 'wayland/libgwater-wayland.c', + 'wayland/pool-buffer.c', + 'wayland/wl.c', + 'wayland/wl_output.c', + ] +endif + +executable( + 'dunst', + '../main.c', + dunst_src_files, + dependencies: dunst_depends, + c_args: c_version_arg, + install: true, +) diff --git a/src/wayland/protocols/meson.build b/src/wayland/protocols/meson.build new file mode 100644 index 000000000..cebdb15c4 --- /dev/null +++ b/src/wayland/protocols/meson.build @@ -0,0 +1,43 @@ +wl_protocol_dir = wayland_protos.get_variable(pkgconfig: 'pkgdatadir') + +wayland_scanner = dependency('wayland-scanner', version: '>=1.14.91', native: true) +wayland_scanner_path = wayland_scanner.get_variable(pkgconfig: 'wayland_scanner') +wayland_scanner_prog = find_program(wayland_scanner_path, native: true) + +wayland_scanner_code = generator( + wayland_scanner_prog, + output: '@BASENAME@.h', + arguments: ['private-code', '@INPUT@', '@OUTPUT@'], +) + +wayland_scanner_client = generator( + wayland_scanner_prog, + output: '@BASENAME@-client-header.h', + arguments: ['client-header', '@INPUT@', '@OUTPUT@'], +) + +client_protocols = [ + wl_protocol_dir / 'stable/xdg-shell/xdg-shell.xml', + 'wlr-layer-shell-unstable-v1.xml', + 'idle.xml', + 'wlr-foreign-toplevel-management-unstable-v1.xml', +] + +client_protos_src = [] +client_protos_headers = [] + +foreach p : client_protocols + client_protos_src += wayland_scanner_code.process(p) + client_protos_headers += wayland_scanner_client.process(p) +endforeach + +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, +) diff --git a/test/meson.build b/test/meson.build new file mode 100644 index 000000000..9d0455f8c --- /dev/null +++ b/test/meson.build @@ -0,0 +1,38 @@ +test_src_files = [ + 'dbus.c', + 'draw.c', + 'dunst.c', + 'helpers.c', + 'icon-lookup.c', + 'icon.c', + 'ini.c', + 'input.c', + 'log.c', + 'markup.c', + 'menu.c', + 'misc.c', + 'notification.c', + 'option_parser.c', + 'queues.c', + 'rules.c', + 'setting.c', + 'settings_data.c', + 'test.c', + 'utils.c', +] + +foreach dunst_src_file : dunst_src_files + src_file = dunst_src_file.split('/')[-1] + if src_file not in test_src_files + test_src_files += '..' / 'src' / dunst_src_file + endif +endforeach + +test_prog = executable('test-runner', + test_src_files, + dependencies: dunst_depends, + c_args: c_version_arg, + install: false, +) + +test('Run tests', test_prog) From 3e29dbf42bcf5cf0a6dd7081d6ce3964523a3f26 Mon Sep 17 00:00:00 2001 From: Aleksei Bavshin Date: Sat, 13 Jan 2024 16:57:28 +0300 Subject: [PATCH 02/16] meson: use files() for dunst sources --- src/meson.build | 8 ++++---- test/meson.build | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/meson.build b/src/meson.build index 13235a972..38f4f9037 100644 --- a/src/meson.build +++ b/src/meson.build @@ -15,7 +15,7 @@ dunst_depends = [ math, ] -dunst_src_files = [ +dunst_src_files = files( 'dbus.c', 'draw.c', 'dunst.c', @@ -35,7 +35,7 @@ dunst_src_files = [ 'utils.c', 'x11/screen.c', 'x11/x.c', -] +) if wayland_client.found() and wayland_cursor.found() and wayland_protos.found() add_global_arguments('-DENABLE_WAYLAND', language: 'c') @@ -45,13 +45,13 @@ if wayland_client.found() and wayland_cursor.found() and wayland_protos.found() dunst_depends += [ client_protos, wayland_client, wayland_cursor, ] - dunst_src_files += [ + dunst_src_files += files( 'wayland/foreign_toplevel.c', 'wayland/libgwater-wayland.c', 'wayland/pool-buffer.c', 'wayland/wl.c', 'wayland/wl_output.c', - ] + ) endif executable( diff --git a/test/meson.build b/test/meson.build index 9d0455f8c..7145916b9 100644 --- a/test/meson.build +++ b/test/meson.build @@ -21,10 +21,10 @@ test_src_files = [ 'utils.c', ] +fs = import('fs') foreach dunst_src_file : dunst_src_files - src_file = dunst_src_file.split('/')[-1] - if src_file not in test_src_files - test_src_files += '..' / 'src' / dunst_src_file + if fs.name(dunst_src_file) not in test_src_files + test_src_files += dunst_src_file endif endforeach From 7a00e1d0030d9e8da0a0a0eed32f5bbf2eb148f8 Mon Sep 17 00:00:00 2001 From: Aleksei Bavshin Date: Sat, 13 Jan 2024 16:59:45 +0300 Subject: [PATCH 03/16] meson: use path seperator --- docs/meson.build | 5 ++--- meson.build | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/meson.build b/docs/meson.build index 71c1f9763..62f6a68a4 100644 --- a/docs/meson.build +++ b/docs/meson.build @@ -1,6 +1,5 @@ -pod2man = find_program('pod2man', native: true) -man1 = join_paths(get_option('mandir'), 'man1') -man5 = join_paths(get_option('mandir'), 'man5') +man1 = get_option('mandir') / 'man1' +man5 = get_option('mandir') / 'man5' pod2man_version_arg = '--release=@0@'.format(meson.project_version()) dunst1 = configure_file( diff --git a/meson.build b/meson.build index 29b3236cc..387fa79ed 100644 --- a/meson.build +++ b/meson.build @@ -56,7 +56,7 @@ configure_file( input: 'org.knopwob.dunst.service.in', output: '@BASENAME@', configuration: conf_data, - install_dir: join_paths(get_option('datadir'), 'dbus-1/services'), + install_dir: get_option('datadir') / 'dbus-1/services', ) if systemd.found() From 5391279c985c1a67ce95f265f975e0b8621042dc Mon Sep 17 00:00:00 2001 From: Aleksei Bavshin Date: Sat, 13 Jan 2024 17:01:48 +0300 Subject: [PATCH 04/16] meson: make man generation automatic requirement --- meson.build | 3 ++- meson_options.txt | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 387fa79ed..c8b1491b9 100644 --- a/meson.build +++ b/meson.build @@ -82,6 +82,7 @@ if get_option('test') subdir('test') endif -if get_option('docs').enabled() +pod2man = find_program('pod2man', native: true, required: get_option('docs')) +if pod2man.found() subdir('docs') endif diff --git a/meson_options.txt b/meson_options.txt index 25565d5d8..a083a40e2 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,4 +1,4 @@ -option('docs', type: 'feature', value: 'enabled', description: 'Generate and install man pages') +option('docs', type: 'feature', value: 'auto', description: 'Generate and install man pages') option('test', type: 'boolean', value: false, description: 'Build test program') option('wayland', type: 'feature', value: 'auto', description: 'Enable wayland support') option('dunstify', type: 'feature', value: 'auto', description: 'Install libnotify dunstify utility') From 0e109572adf1b3f3d35f99521a76a569fd5974c3 Mon Sep 17 00:00:00 2001 From: sewn Date: Sat, 13 Jan 2024 17:02:36 +0300 Subject: [PATCH 05/16] meson: remove test build option --- meson.build | 4 +--- meson_options.txt | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/meson.build b/meson.build index c8b1491b9..796112648 100644 --- a/meson.build +++ b/meson.build @@ -78,9 +78,7 @@ if libnotify.found() ) endif -if get_option('test') - subdir('test') -endif +subdir('test') pod2man = find_program('pod2man', native: true, required: get_option('docs')) if pod2man.found() diff --git a/meson_options.txt b/meson_options.txt index a083a40e2..69f1eb12b 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,5 +1,4 @@ option('docs', type: 'feature', value: 'auto', description: 'Generate and install man pages') -option('test', type: 'boolean', value: false, description: 'Build test program') option('wayland', type: 'feature', value: 'auto', description: 'Enable wayland support') option('dunstify', type: 'feature', value: 'auto', description: 'Install libnotify dunstify utility') option('systemd', type: 'feature', value: 'auto', description: 'Install systemd user service unit') From 1d8630276398dc16932ce226da0ac659daa17650 Mon Sep 17 00:00:00 2001 From: sewn Date: Sat, 13 Jan 2024 17:05:46 +0300 Subject: [PATCH 06/16] meson: allow debug builds by default --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 796112648..c5736afea 100644 --- a/meson.build +++ b/meson.build @@ -7,7 +7,7 @@ project( default_options: [ 'c_std=gnu99', 'warning_level=1', - 'buildtype=release', + 'b_ndebug=if-release', ], ) From fe1b06169e5bb1bf9f9a53fa6e0cf6773266520a Mon Sep 17 00:00:00 2001 From: sewn Date: Sat, 13 Jan 2024 17:10:00 +0300 Subject: [PATCH 07/16] meson: set test workdir for it's data --- test/meson.build | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/meson.build b/test/meson.build index 7145916b9..b7157d29f 100644 --- a/test/meson.build +++ b/test/meson.build @@ -35,4 +35,7 @@ test_prog = executable('test-runner', install: false, ) -test('Run tests', test_prog) +test('Run tests', + test_prog, + workdir: meson.project_source_root(), +) From 16434ed6de30c7bdd99cccd59dd38694f4370375 Mon Sep 17 00:00:00 2001 From: sewn Date: Sun, 14 Jan 2024 20:54:34 +0300 Subject: [PATCH 08/16] meson: set sysconfdir xdg, use dep variable for systemd --- meson.build | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index c5736afea..63d07afe8 100644 --- a/meson.build +++ b/meson.build @@ -42,15 +42,21 @@ wayland_protos = dependency('wayland-protocols', version: '>=1.32', required: ge wayland_cursor = dependency('wayland-cursor', required: get_option('wayland')) c_version_arg = '-DVERSION="@0@"'.format(meson.project_version()) +sysconfdir = get_option('sysconfdir') / 'xdg' + +add_project_arguments( + '-DSYSCONFDIR="@0@"'.format(get_option('prefix') / sysconfdir), + language: 'c' +) subdir('src') install_data('dunstctl', install_dir: get_option('bindir')) -install_data('dunstrc', install_dir: get_option('sysconfdir') / 'dunst') +install_data('dunstrc', install_dir: sysconfdir / 'dunst') conf_data = configuration_data() conf_data.set('bindir', get_option('bindir')) -conf_data.set('sysconfdir', get_option('sysconfdir')) +conf_data.set('sysconfdir', sysconfdir) configure_file( input: 'org.knopwob.dunst.service.in', @@ -60,7 +66,7 @@ configure_file( ) if systemd.found() - user_units_dir = systemd.get_pkgconfig_variable('systemduserunitdir') + user_units_dir = systemd.get_variable(pkgconfig: 'systemduserunitdir') configure_file( configuration: conf_data, input: 'dunst.systemd.service.in', From c0ff84830114665c51dead5e0450b6196dca7f28 Mon Sep 17 00:00:00 2001 From: sewn Date: Sun, 14 Jan 2024 20:55:52 +0300 Subject: [PATCH 09/16] meson: use dunst.service for systemd service name --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 63d07afe8..a790ee614 100644 --- a/meson.build +++ b/meson.build @@ -60,7 +60,7 @@ conf_data.set('sysconfdir', sysconfdir) configure_file( input: 'org.knopwob.dunst.service.in', - output: '@BASENAME@', + output: 'dunst.service', configuration: conf_data, install_dir: get_option('datadir') / 'dbus-1/services', ) From dfb00bc6d4de064bfe147f79848cbbdf48d88663 Mon Sep 17 00:00:00 2001 From: sewn Date: Thu, 25 Jan 2024 13:55:05 +0300 Subject: [PATCH 10/16] meson: don't consider wayland protos as source becomes consistent with Makefile. --- src/meson.build | 2 +- src/wayland/protocols/meson.build | 18 ++---------------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/src/meson.build b/src/meson.build index 38f4f9037..b25a6c751 100644 --- a/src/meson.build +++ b/src/meson.build @@ -43,7 +43,7 @@ if wayland_client.found() and wayland_cursor.found() and wayland_protos.found() subdir('wayland/protocols') dunst_depends += [ - client_protos, wayland_client, wayland_cursor, + wayland_client, wayland_cursor, ] dunst_src_files += files( 'wayland/foreign_toplevel.c', diff --git a/src/wayland/protocols/meson.build b/src/wayland/protocols/meson.build index cebdb15c4..62f4c63b8 100644 --- a/src/wayland/protocols/meson.build +++ b/src/wayland/protocols/meson.build @@ -23,21 +23,7 @@ client_protocols = [ 'wlr-foreign-toplevel-management-unstable-v1.xml', ] -client_protos_src = [] -client_protos_headers = [] - foreach p : client_protocols - client_protos_src += wayland_scanner_code.process(p) - client_protos_headers += wayland_scanner_client.process(p) + wayland_scanner_code.process(p) + wayland_scanner_client.process(p) endforeach - -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, -) From 8bae342f8fcc87f586f213354e727f237eb9c113 Mon Sep 17 00:00:00 2001 From: sewn Date: Thu, 29 Feb 2024 13:42:35 +0300 Subject: [PATCH 11/16] meson: lower wayland-protos version requirement --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index a790ee614..f0023e95f 100644 --- a/meson.build +++ b/meson.build @@ -38,7 +38,7 @@ libnotify = dependency('libnotify', required: get_option('dunstify')) realtime = cc.find_library('rt') math = cc.find_library('m') wayland_client = dependency('wayland-client', required: get_option('wayland')) -wayland_protos = dependency('wayland-protocols', version: '>=1.32', 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')) c_version_arg = '-DVERSION="@0@"'.format(meson.project_version()) From ee8c2485c0871bb53d2c82bed7add2df3b2a5c35 Mon Sep 17 00:00:00 2001 From: sewn Date: Thu, 29 Feb 2024 14:11:21 +0300 Subject: [PATCH 12/16] meson: make x11 support optional, add summary --- meson.build | 25 ++++++++++++++++++++----- meson_options.txt | 1 + src/meson.build | 25 +++++++++++++++++-------- 3 files changed, 38 insertions(+), 13 deletions(-) diff --git a/meson.build b/meson.build index f0023e95f..a4a283dd8 100644 --- a/meson.build +++ b/meson.build @@ -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') @@ -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' @@ -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) diff --git a/meson_options.txt b/meson_options.txt index 69f1eb12b..80d272386 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -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') diff --git a/src/meson.build b/src/meson.build index b25a6c751..7c20bbbb6 100644 --- a/src/meson.build +++ b/src/meson.build @@ -4,11 +4,6 @@ dunst_depends = [ gio, gdk_pixbuf, pangocairo, - x11, - xinerama, - xext, - xrandr, - xscrnsaver, systemd, libnotify, realtime, @@ -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') From 52227ada0e63e74ab6738ac4dfe1c93ae958b56d Mon Sep 17 00:00:00 2001 From: sewn Date: Sun, 25 Aug 2024 20:18:10 +0300 Subject: [PATCH 13/16] src/meson: add missing wayland source --- src/meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/src/meson.build b/src/meson.build index 7c20bbbb6..c833bb6ea 100644 --- a/src/meson.build +++ b/src/meson.build @@ -60,6 +60,7 @@ if wayland_support 'wayland/pool-buffer.c', 'wayland/wl.c', 'wayland/wl_output.c', + 'wayland/wl_seat.c', ) endif From 432460c6025a2438cf282b29f823105a0b12b9c2 Mon Sep 17 00:00:00 2001 From: sewn Date: Sun, 25 Aug 2024 20:19:30 +0300 Subject: [PATCH 14/16] meson: add WAYLAND_ONLY and tweak compiler flags --- meson.build | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index a4a283dd8..404f995b1 100644 --- a/meson.build +++ b/meson.build @@ -12,9 +12,7 @@ project( ) add_project_arguments([ - '-pedantic', - '-Wno-gnu-zero-variadic-macro-arguments', - '-Wno-overlength-strings', + '-Wno-maybe-uninitialized', ], language: 'c') if get_option('buildtype').startswith('debug') @@ -48,6 +46,10 @@ if not x11_support and not wayland_support error('either wayland or x11 support is required') endif +if wayland_support and not x11_support + add_project_arguments('-DWAYLAND_ONLY', language: 'c') +endif + c_version_arg = '-DVERSION="@0@"'.format(meson.project_version()) sysconfdir = get_option('sysconfdir') / 'xdg' From 9ed0847fd4dde49a53d04c522d608235681df79a Mon Sep 17 00:00:00 2001 From: sewn Date: Mon, 26 Aug 2024 17:03:13 +0300 Subject: [PATCH 15/16] test/meson: update run for arg --- test/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/meson.build b/test/meson.build index b7157d29f..4a96c91f8 100644 --- a/test/meson.build +++ b/test/meson.build @@ -37,5 +37,5 @@ test_prog = executable('test-runner', test('Run tests', test_prog, - workdir: meson.project_source_root(), + args: meson.current_source_dir(), ) From 4d80400d486c8b248e6797cbe5e04e8578fbfde4 Mon Sep 17 00:00:00 2001 From: sewn Date: Thu, 12 Dec 2024 17:27:39 +0300 Subject: [PATCH 16/16] meson/test: use env to send testdir info --- test/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/meson.build b/test/meson.build index 4a96c91f8..e80201572 100644 --- a/test/meson.build +++ b/test/meson.build @@ -37,5 +37,5 @@ test_prog = executable('test-runner', test('Run tests', test_prog, - args: meson.current_source_dir(), + env: environment({'TESTDIR': meson.current_source_dir()}), )