|
| 1 | +project( |
| 2 | + 'dunst', |
| 3 | + 'c', |
| 4 | + version: '1.9.2', |
| 5 | + license: 'MIT', |
| 6 | + meson_version: '>=0.60.0', |
| 7 | + default_options: [ |
| 8 | + 'c_std=gnu11', |
| 9 | + 'warning_level=1', |
| 10 | + 'b_ndebug=if-release', |
| 11 | + ], |
| 12 | +) |
| 13 | + |
| 14 | +cc = meson.get_compiler('c') |
| 15 | + |
| 16 | +cairo = dependency('cairo') |
| 17 | +glib = dependency('glib-2.0') |
| 18 | +gio = dependency('gio-2.0') |
| 19 | +gdk_pixbuf = dependency('gdk-pixbuf-2.0') |
| 20 | +pangocairo = dependency('pangocairo') |
| 21 | +x11 = dependency('x11', required: get_option('x11')) |
| 22 | +xinerama = dependency('xinerama', required: get_option('x11')) |
| 23 | +xext = dependency('xext', required: get_option('x11')) |
| 24 | +xrandr = dependency('xrandr', required: get_option('x11'), version: '>=1.5') |
| 25 | +xscrnsaver = dependency('xscrnsaver', required: get_option('x11')) |
| 26 | +systemd = dependency('systemd', required: get_option('systemd')) |
| 27 | +libnotify = dependency('libnotify', required: get_option('dunstify')) |
| 28 | +realtime = cc.find_library('rt') |
| 29 | +math = cc.find_library('m') |
| 30 | +wayland_client = dependency('wayland-client', required: get_option('wayland')) |
| 31 | +wayland_protos = dependency('wayland-protocols', version: '>=1.12', required: get_option('wayland')) |
| 32 | +wayland_cursor = dependency('wayland-cursor', required: get_option('wayland')) |
| 33 | + |
| 34 | +dunst_depends = [ |
| 35 | + cairo, |
| 36 | + glib, |
| 37 | + gio, |
| 38 | + gdk_pixbuf, |
| 39 | + pangocairo, |
| 40 | + systemd, |
| 41 | + libnotify, |
| 42 | + realtime, |
| 43 | + math, |
| 44 | +] |
| 45 | + |
| 46 | +x11_support = x11.found() and xinerama.found() and xext.found() and xrandr.found() and xscrnsaver.found() |
| 47 | +wayland_support = wayland_client.found() and wayland_cursor.found() and wayland_protos.found() |
| 48 | + |
| 49 | +if not x11_support and not wayland_support |
| 50 | + error('either wayland or x11 support is required') |
| 51 | +endif |
| 52 | + |
| 53 | +if wayland_support and not x11_support |
| 54 | + add_project_arguments('-DWAYLAND_ONLY', language: 'c') |
| 55 | +endif |
| 56 | + |
| 57 | +if x11_support |
| 58 | + dunst_depends += [x11, xinerama, xext, xrandr, xscrnsaver] |
| 59 | + add_project_arguments('-DENABLE_X11', language: 'c') |
| 60 | +endif |
| 61 | + |
| 62 | +if wayland_support |
| 63 | + dunst_depends += [wayland_client, wayland_cursor] |
| 64 | + add_project_arguments('-DENABLE_WAYLAND', language: 'c') |
| 65 | +endif |
| 66 | + |
| 67 | +c_version_arg = '-DVERSION="@0@"'.format(meson.project_version()) |
| 68 | +sysconfdir = get_option('sysconfdir') / 'xdg' |
| 69 | + |
| 70 | +add_project_arguments( |
| 71 | + '-DSYSCONFDIR="@0@"'.format(get_option('prefix') / sysconfdir), |
| 72 | + language: 'c', |
| 73 | +) |
| 74 | + |
| 75 | +subdir('src') |
| 76 | + |
| 77 | +install_data('dunstctl', install_dir: get_option('bindir')) |
| 78 | +install_data('dunstrc', install_dir: sysconfdir / 'dunst') |
| 79 | + |
| 80 | +conf_data = configuration_data() |
| 81 | +conf_data.set('bindir', get_option('bindir')) |
| 82 | +conf_data.set('sysconfdir', sysconfdir) |
| 83 | + |
| 84 | +configure_file( |
| 85 | + input: 'org.knopwob.dunst.service.in', |
| 86 | + output: 'dunst.service', |
| 87 | + configuration: conf_data, |
| 88 | + install_dir: get_option('datadir') / 'dbus-1/services', |
| 89 | +) |
| 90 | + |
| 91 | +if systemd.found() |
| 92 | + user_units_dir = systemd.get_variable(pkgconfig: 'systemduserunitdir') |
| 93 | + configure_file( |
| 94 | + configuration: conf_data, |
| 95 | + input: 'dunst.systemd.service.in', |
| 96 | + output: '@BASENAME@', |
| 97 | + install_dir: user_units_dir, |
| 98 | + ) |
| 99 | +endif |
| 100 | + |
| 101 | +if libnotify.found() |
| 102 | + executable( |
| 103 | + 'dunstify', |
| 104 | + 'dunstify.c', |
| 105 | + dependencies: [glib, libnotify, gdk_pixbuf], |
| 106 | + install: true, |
| 107 | + ) |
| 108 | +endif |
| 109 | + |
| 110 | +subdir('test') |
| 111 | + |
| 112 | +pod2man = find_program('pod2man', native: true, required: get_option('docs')) |
| 113 | +if pod2man.found() |
| 114 | + subdir('docs') |
| 115 | +endif |
| 116 | + |
| 117 | +summary( |
| 118 | + { |
| 119 | + 'X11 support': x11_support, |
| 120 | + 'Wayland support': wayland_support, |
| 121 | + 'Man pages': pod2man.found(), |
| 122 | + 'Dunstify': libnotify.found(), |
| 123 | + 'Install systemd service units': systemd.found(), |
| 124 | + }, |
| 125 | + bool_yn: true, |
| 126 | +) |
0 commit comments