summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhuyaliang <[email protected]>2023-10-27 15:56:30 +0800
committerzhuyaliang <[email protected]>2023-10-27 15:56:30 +0800
commitdd55b0a24361c3a2f8eb112fab16a55a9b2c8d8f (patch)
treeb331f95a50a4a381b89023b742ff547a3b05594b
parent05f3a440f3cbd7c4fd04962f964292a764f5b6ac (diff)
downloadmate-notification-daemon-meson.tar.bz2
mate-notification-daemon-meson.tar.xz
add meson build supportmeson
-rw-r--r--data/icons/meson.build20
-rw-r--r--data/meson.build80
-rw-r--r--meson.build180
-rw-r--r--meson_options.txt3
-rwxr-xr-xmeson_post_install.sh14
-rw-r--r--po/meson.build6
6 files changed, 303 insertions, 0 deletions
diff --git a/data/icons/meson.build b/data/icons/meson.build
new file mode 100644
index 0000000..54db0e3
--- /dev/null
+++ b/data/icons/meson.build
@@ -0,0 +1,20 @@
+apps_path = [
+ '16x16',
+ '22x22',
+ '24x24',
+ '32x32',
+ '48x48',
+]
+
+foreach app: apps_path
+ install_data(
+ join_paths(app, 'mate-notification-properties.png'),
+ install_dir: join_paths(mm_iconsdir, 'hicolor', app, 'apps')
+ )
+endforeach
+
+install_data(
+ join_paths('scalable','mate-notification-properties.svg'),
+ install_dir: join_paths(mm_iconsdir, 'hicolor', 'scalable', 'apps')
+)
+
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..3d2048f
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,80 @@
+po_dir = join_paths(meson.source_root(), 'po')
+
+schema_data = configuration_data()
+schema_data.set('GETTEXT_PACKAGE', meson.project_name())
+configure_file(
+ input : 'org.mate.NotificationDaemon.gschema.xml.in',
+ output : 'org.mate.NotificationDaemon.gschema.xml',
+ configuration : schema_data,
+ install : true,
+ install_dir : join_paths(mm_datadir, 'glib-2.0', 'schemas')
+)
+
+# .desktop file
+
+desktop_data = configuration_data()
+desktop_data.set('VERSION', meson.project_version())
+desktop_data.set('LIBEXECDIR', mm_execdir)
+desktop_data.set('APPLET_LOCATION', APPLET_LOCATION)
+desktop_data.set('ENABLE_IN_PROCESS', enable_process)
+desktop_in_file = configure_file(
+ input : 'mate-notification-daemon.desktop.in.in',
+ output : 'mate-notification-daemon.desktop.in',
+ configuration : desktop_data
+)
+
+i18n.merge_file(
+ input : desktop_in_file,
+ output : 'mate-notification-daemon.desktop',
+ type : 'desktop',
+ po_dir : po_dir,
+ install : true,
+ install_dir: join_paths(get_option('sysconfdir'), 'xdg', 'autostart')
+)
+
+desktop_in_file = configure_file(
+ input : 'org.mate.applets.MateNotificationApplet.desktop.in.in',
+ output : 'org.mate.applets.MateNotificationApplet.desktop.in',
+ configuration : desktop_data
+)
+
+i18n.merge_file(
+ input : desktop_in_file,
+ output : 'org.mate.applets.MateNotificationApplet.desktop',
+ type : 'desktop',
+ po_dir : po_dir,
+ install : true,
+ install_dir : join_paths(mm_datadir, 'mate-panel', 'applets')
+)
+
+i18n.merge_file(
+ input : 'mate-notification-properties.desktop.in',
+ output : 'mate-notification-properties.desktop',
+ type : 'desktop',
+ po_dir : po_dir,
+ install : true,
+ install_dir : join_paths(mm_datadir, 'applications')
+)
+
+# .service files
+
+service_data = configuration_data()
+service_data.set('LIBEXECDIR', mm_execdir)
+
+configure_file(
+ input : 'org.mate.panel.applet.MateNotificationAppletFactory.service.in',
+ output : 'org.mate.panel.applet.MateNotificationAppletFactory.service',
+ configuration : service_data,
+ install : true,
+ install_dir : join_paths(mm_datadir, 'dbus-1/services')
+)
+
+configure_file(
+ input : 'org.freedesktop.mate.Notifications.service.in',
+ output : 'org.freedesktop.mate.Notifications.service',
+ configuration : service_data,
+ install : true,
+ install_dir : join_paths(mm_datadir, 'dbus-1/services')
+)
+
+subdir('icons')
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..998f912
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,180 @@
+project('mate-notification-daemon', 'c',
+ version : '1.27.1',
+ default_options : ['warning_level=1'],
+ meson_version : '>=0.50.0'
+)
+
+conf = configuration_data()
+
+prefix = get_option('prefix')
+mm_execdir = join_paths(prefix, get_option('libexecdir'))
+mm_libdir = join_paths(prefix, get_option('libdir'))
+mm_datadir = join_paths(prefix, get_option('datadir'))
+mm_localedir = join_paths(prefix, get_option('localedir'))
+mm_bindir = join_paths(prefix, get_option('bindir'))
+mm_sbindir = join_paths(prefix, get_option('sbindir'))
+mm_mandir = join_paths(prefix, get_option('mandir'))
+mm_desktopdir = join_paths(mm_datadir, 'applications')
+mm_pkgdatadir = join_paths(mm_datadir, meson.project_name())
+mm_iconsdir = join_paths(mm_pkgdatadir, 'icons')
+
+# get suported warning flags
+test_args = [
+ '-Waggregate-return',
+ '-Warray-bounds',
+ '-Wcast-align',
+ '-Wclobbered',
+ '-Wdeclaration-after-statement',
+ '-Wempty-body',
+ '-Wextra',
+ '-Wformat=2',
+ '-Wformat-nonliteral',
+ '-Wformat-security',
+ '-Wformat-signedness',
+ '-Wignored-qualifiers',
+ '-Wimplicit-function-declaration',
+ '-Winit-self',
+ '-Winline',
+ '-Wmissing-declarations',
+ '-Wmissing-format-attribute',
+ '-Wmissing-include-dirs',
+ '-Wmissing-noreturn',
+ '-Wmissing-parameter-type',
+ '-Wmissing-prototypes',
+ '-Wnested-externs',
+ '-Wno-discarded-qualifiers',
+ '-Wno-missing-field-initializers',
+ '-Wno-strict-aliasing',
+ '-Wno-suggest-attribute=format',
+ '-Wno-unused-parameter',
+ '-Wold-style-definition',
+ '-Woverride-init',
+ '-Wpacked',
+ '-Wpointer-arith',
+ '-Wredundant-decls',
+ '-Wreturn-type',
+ '-Wshadow',
+ '-Wsign-compare',
+ '-Wstrict-aliasing',
+ '-Wstrict-prototypes',
+ '-Wswitch-default',
+ '-Wtype-limits',
+ '-Wundef',
+ '-Wuninitialized',
+ '-Wunused-but-set-variable',
+ '-Wwrite-strings'
+]
+cc = meson.get_compiler('c')
+foreach arg: test_args
+ if cc.has_argument(arg)
+ add_project_arguments(arg, language : 'c')
+ endif
+endforeach
+
+common_flags = [
+ '-DHAVE_CONFIG_H',
+]
+
+add_project_arguments(common_flags, language: 'c')
+# enable full RELRO where possible
+# FIXME: until https://github.com/mesonbuild/meson/issues/1140 is fixed
+test_link_args = [
+ '-Wl,-z,relro',
+ '-Wl,-z,now',
+]
+foreach arg: test_link_args
+ if cc.has_link_argument(arg)
+ add_project_link_arguments(arg, language : 'c')
+ endif
+endforeach
+
+enable_x11 = get_option('x11')
+enable_wayland = get_option('wayland')
+enable_process = get_option('in-process')
+
+if enable_wayland == 'auto'
+ if dependency('gtk-layer-shell-0', version : '>= 0.6').found()
+ enable_wayland = 'yes'
+ else
+ enable_wayland = 'no'
+ endif
+endif
+
+if enable_x11 == 'auto'
+ if dependency('libwnck-3.0').found() and dependency('x11').found()
+ enable_x11 = 'yes'
+ else
+ enable_x11 = 'no'
+ endif
+endif
+
+if enable_x11 == 'no' and enable_wayland == 'no'
+ error ('At least one backend must be enabled (x11 = yes or wayland = yes)')
+endif
+
+gtk = dependency('gtk+-3.0', version : '>= 3.22.0')
+glib = dependency('glib-2.0', version : '>= 2.50.0')
+gdk = dependency('gdk-3.0', version : '>= 3.22.0')
+matemixer = dependency('libmatemixer', version : '>= 1.10.0')
+canberra = dependency('libcanberra-gtk3', version : '>= 0.13')
+md = dependency('mate-desktop-2.0', version : '>= 1.27.1')
+matepanel = dependency('libmatepanelapplet-4.0', version : '>= 1.17.0')
+libxml = dependency('libxml-2.0')
+libm = cc.find_library('m', required: false)
+
+if enable_wayland == 'yes'
+ gls = dependency('gtk-layer-shell-0', version : '>= 0.6')
+ waylandclient = dependency('wayland-client')
+ conf.set('HAVE_WAYLAND', 1)
+endif
+
+if enable_x11 == 'yes'
+ x11 = dependency('x11')
+ libwnck = dependency('libwnck-3.0')
+ conf.set('HAVE_X11', 1)
+endif
+
+if enable_process
+ conf.set('ENABLE_IN_PROCESSS', 1)
+ APPLET_LOCATION = join_paths(mm_pkgdatadir, 'libmate-notification-applet.so')
+ conf.set_quoted('PANEL_APPLET_FACTORY', 'MATE_PANEL_APPLET_IN_PROCESS_FACTORY')
+else
+ APPLET_LOCATION = join_paths(mm_execdir, 'mate-notification-applet')
+ conf.set_quoted('PANEL_APPLET_FACTORY', 'MATE_PANEL_APPLET_OUT_PROCESS_FACTORY')
+endif
+
+gnome = import('gnome')
+i18n = import('i18n')
+
+conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
+conf.set_quoted('LOCALEDIR', mm_localedir)
+conf.set_quoted('DATADIR', mm_datadir)
+
+conf.set_quoted('PACKAGE_URL', 'https://mate-desktop.org')
+conf.set_quoted('VERSION', meson.project_version())
+conf.set_quoted('PACKAGE_VERSION', meson.project_version())
+
+configure_file(
+ output : 'config.h',
+ configuration : conf
+)
+config_inc = include_directories('.')
+
+#subdir('man')
+#subdir('mate-volume-control')
+subdir('po')
+subdir('data')
+
+summary = [
+ 'configuration summary:',
+ '',
+ ' project: @0@ @1@'.format(meson.project_name(), meson.project_version()),
+ ' prefix: @0@'.format(prefix),
+ ' Wayland support: @0@'.format(enable_wayland),
+ ' X11 support: @0@'.format(enable_x11),
+ ' Building in-process: @0@'.format(enable_process),
+ ''
+]
+message('\n'.join(summary))
+
+meson.add_install_script('meson_post_install.sh')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..c16ec58
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,3 @@
+option('wayland', type : 'string', value : 'auto', description : 'wayland enabled')
+option('x11', type : 'string', value : 'auto', description : 'X11 enabled')
+option('in-process', type : 'boolean', value : false, description : 'in-process enabled')
diff --git a/meson_post_install.sh b/meson_post_install.sh
new file mode 100755
index 0000000..c523b15
--- /dev/null
+++ b/meson_post_install.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+if [ -z $MESON_INSTALL_PREFIX ]; then
+ echo 'This is meant to be ran from Meson only!'
+ exit 1
+fi
+
+if [ -z $DESTDIR ]; then
+ echo 'Compiling GSchema'
+ glib-compile-schemas "$MESON_INSTALL_PREFIX/share/glib-2.0/schemas"
+ echo 'Updating icon cache'
+ gtk-update-icon-cache -qtf "$MESON_INSTALL_PREFIX/share/icons/hicolor"
+ echo 'Updating desktop database'
+ update-desktop-database -q "$MESON_INSTALL_PREFIX/share/applications"
+fi
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..964935b
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,6 @@
+i18n.gettext(meson.project_name(),
+ preset : 'glib',
+ args: [
+ '--default-domain=' + meson.project_name()
+ ]
+)