From 9a8cfd772538539776654401d7a1293595405c90 Mon Sep 17 00:00:00 2001 From: zhuyaliang <15132211195@163.com> Date: Mon, 16 Oct 2023 16:17:40 +0800 Subject: Add meson build support --- applets/brightness/meson.build | 68 ++++++++++++ applets/inhibit/meson.build | 68 ++++++++++++ data/icons/meson.build | 154 ++++++++++++++++++++++++++ data/meson.build | 92 ++++++++++++++++ help/LINGUAS | 117 ++++++++++++++++++++ help/meson.build | 24 ++++ meson.build | 147 +++++++++++++++++++++++++ meson_options.txt | 4 + meson_post_install.sh | 15 +++ po/meson.build | 6 + policy/meson.build | 15 +++ src/meson.build | 241 +++++++++++++++++++++++++++++++++++++++++ 12 files changed, 951 insertions(+) create mode 100644 applets/brightness/meson.build create mode 100644 applets/inhibit/meson.build create mode 100644 data/icons/meson.build create mode 100644 data/meson.build create mode 100644 help/LINGUAS create mode 100644 help/meson.build create mode 100644 meson.build create mode 100644 meson_options.txt create mode 100755 meson_post_install.sh create mode 100644 po/meson.build create mode 100644 policy/meson.build create mode 100644 src/meson.build diff --git a/applets/brightness/meson.build b/applets/brightness/meson.build new file mode 100644 index 0000000..a2a7c59 --- /dev/null +++ b/applets/brightness/meson.build @@ -0,0 +1,68 @@ +po_dir = join_paths(meson.source_root(), 'po') + +source_files = files( + 'gpm-common.c', + 'brightness-applet.c' +) + +cflags = [ + '-DMATELOCALEDIR="@0@"'.format(matelocaledir), + '-DG_LOG_DOMAIN="~/mate-power-manager.log"', + '-DGPM_ICONS_DATA="@0@"'.format(mateicons), + '-DBRIGHTNESS_MENU_UI_DIR="@0@"'.format(mateui), + '-DEGG_VERBOSE="GPM_VERBOSE"', + '-DEGG_LOGGING="GPM_LOGGING"', + '-DEGG_CONSOLE="GPM_CONSOLE"' + ] + +executable('mate-brightness-applet', + sources: source_files, + dependencies : [ + gtk, + glib, + cairo, + notify, + dbus, + dbusglib, + matepanel + ], + include_directories : config_inc, + c_args : cflags, + install : true, + install_dir: mateexecdir, +) + +# .service files + +service_data = configuration_data() +service_data.set('LIBEXECDIR', join_paths(prefix, get_option('libexecdir'))) + +configure_file( + input : 'org.mate.panel.applet.BrightnessAppletFactory.service.in', + output : 'org.mate.panel.applet.BrightnessAppletFactory.service', + configuration : service_data, + install : true, + install_dir : join_paths(matedatadir, 'dbus-1/services') +) + +desktop_data = configuration_data() +desktop_data.set('VERSION', meson.project_version()) +desktop_data.set('LIBEXECDIR', join_paths(prefix, get_option('libexecdir'))) +desktop_in_file = configure_file( + input : 'org.mate.BrightnessApplet.mate-panel-applet.desktop.in.in', + output : 'org.mate.BrightnessApplet.mate-panel-applet.desktop.in', + configuration : desktop_data +) + +i18n.merge_file( + input : desktop_in_file, + output : 'org.mate.BrightnessApplet.mate-panel-applet', + type : 'desktop', + po_dir : po_dir, + install : true, + install_dir : join_paths(matedatadir, 'mate-panel', 'applets') +) + +install_data('brightness-applet-menu.xml', + install_dir : join_paths(pkgdatadir, 'ui') +) diff --git a/applets/inhibit/meson.build b/applets/inhibit/meson.build new file mode 100644 index 0000000..f161d3c --- /dev/null +++ b/applets/inhibit/meson.build @@ -0,0 +1,68 @@ +po_dir = join_paths(meson.source_root(), 'po') + +source_files = files( + 'gpm-common.c', + 'inhibit-applet.c' +) + +cflags = [ + '-DMATELOCALEDIR="@0@"'.format(matelocaledir), + '-DG_LOG_DOMAIN="~/mate-power-manager.log"', + '-DGPM_ICONS_DATA="@0@"'.format(mateicons), + '-DINHIBIT_MENU_UI_DIR="@0@"'.format(mateui), + '-DEGG_VERBOSE="GPM_VERBOSE"', + '-DEGG_LOGGING="GPM_LOGGING"', + '-DEGG_CONSOLE="GPM_CONSOLE"' + ] + +executable('mate-inhibit-applet', + sources: source_files, + dependencies : [ + gtk, + glib, + cairo, + notify, + dbus, + dbusglib, + matepanel + ], + include_directories : config_inc, + c_args : cflags, + install : true, + install_dir: mateexecdir, +) + +# .service files + +service_data = configuration_data() +service_data.set('LIBEXECDIR', join_paths(prefix, get_option('libexecdir'))) + +configure_file( + input : 'org.mate.panel.applet.InhibitAppletFactory.service.in', + output : 'org.mate.panel.applet.InhibitAppletFactory.service', + configuration : service_data, + install : true, + install_dir : join_paths(matedatadir, 'dbus-1/services') +) + +desktop_data = configuration_data() +desktop_data.set('VERSION', meson.project_version()) +desktop_data.set('LIBEXECDIR', join_paths(prefix, get_option('libexecdir'))) +desktop_in_file = configure_file( + input : 'org.mate.InhibitApplet.mate-panel-applet.desktop.in.in', + output : 'org.mate.InhibitApplet.mate-panel-applet.desktop.in', + configuration : desktop_data +) + +i18n.merge_file( + input : desktop_in_file, + output : 'org.mate.InhibitApplet.mate-panel-applet', + type : 'desktop', + po_dir : po_dir, + install : true, + install_dir : join_paths(matedatadir, 'mate-panel', 'applets') +) + +install_data('inhibit-applet-menu.xml', + install_dir : join_paths(pkgdatadir, 'ui') +) diff --git a/data/icons/meson.build b/data/icons/meson.build new file mode 100644 index 0000000..164f866 --- /dev/null +++ b/data/icons/meson.build @@ -0,0 +1,154 @@ +apps_icons = [ + ['16x16', 'mate-brightness-applet.png', 'mate-inhibit-applet.png', 'mate-power-manager.png', 'mate-power-statistics.png'], + ['22x22', 'mate-brightness-applet.png', 'mate-inhibit-applet.png', 'mate-power-manager.png', 'mate-power-statistics.png'], + ['24x24', 'mate-brightness-applet.png', 'mate-inhibit-applet.png', 'mate-power-manager.png', 'mate-power-statistics.png'], + ['32x32', 'mate-brightness-applet.png', 'mate-inhibit-applet.png', 'mate-power-manager.png', 'mate-power-statistics.png'], + ['48x48', 'mate-brightness-applet.png', 'mate-inhibit-applet.png', 'mate-power-manager.png', 'mate-power-statistics.png'], + ['64x64', 'mate-brightness-applet.png', 'mate-inhibit-applet.png', 'mate-power-manager.png', 'mate-power-statistics.png'], + ['96x96', 'mate-brightness-applet.png', 'mate-inhibit-applet.png', 'mate-power-manager.png', 'mate-power-statistics.png'], + ['128x128', 'mate-brightness-applet.png', 'mate-inhibit-applet.png', 'mate-power-manager.png', 'mate-power-statistics.png'], + ['256x256', 'mate-brightness-applet.png', 'mate-inhibit-applet.png', 'mate-power-manager.png', 'mate-power-statistics.png'], +] +actions_icons = [ + ['16x16', 'gpm-hibernate.png', 'gpm-suspend.png'], + ['22x22', 'gpm-hibernate.png', 'gpm-suspend.png'], + ['24x24', 'gpm-hibernate.png', 'gpm-suspend.png'], + ['32x32', 'gpm-hibernate.png', 'gpm-suspend.png'], + ['48x48', 'gpm-hibernate.png', 'gpm-suspend.png'], + ['64x64', 'gpm-hibernate.png', 'gpm-suspend.png'], + ['96x96', 'gpm-hibernate.png', 'gpm-suspend.png'], + ['128x128', 'gpm-hibernate.png', 'gpm-suspend.png'], + ['256x256', 'gpm-hibernate.png', 'gpm-suspend.png'], +] + +icons = [ + 'gpm-ac-adapter.png', + 'gpm-battery-000-charging.png', + 'gpm-battery-000.png', + 'gpm-battery-020-charging.png', + 'gpm-battery-020.png', + 'gpm-battery-040-charging.png', + 'gpm-battery-040.png', + 'gpm-battery-060-charging.png', + 'gpm-battery-060.png', + 'gpm-battery-080-charging.png', + 'gpm-battery-080.png', + 'gpm-battery-100-charging.png', + 'gpm-battery-100.png', + 'gpm-battery-charged.png', + 'gpm-battery-empty.png', + 'gpm-battery-missing.png', + 'gpm-brightness-kbd-disabled.png', + 'gpm-brightness-kbd-invalid.png', + 'gpm-brightness-kbd.png', + 'gpm-brightness-lcd-disabled.png', + 'gpm-brightness-lcd-invalid.png', + 'gpm-brightness-lcd.png', + 'gpm-gaming-input-000.png', + 'gpm-gaming-input-020.png', + 'gpm-gaming-input-040.png', + 'gpm-gaming-input-060.png', + 'gpm-gaming-input-080.png', + 'gpm-gaming-input-100.png', + 'gpm-inhibit-invalid.png', + 'gpm-inhibit.png', + 'gpm-keyboard-000.png', + 'gpm-keyboard-020.png', + 'gpm-keyboard-040.png', + 'gpm-keyboard-060.png', + 'gpm-keyboard-080.png', + 'gpm-keyboard-100.png', + 'gpm-mouse-000.png', + 'gpm-mouse-020.png', + 'gpm-mouse-040.png', + 'gpm-mouse-060.png', + 'gpm-mouse-080.png', + 'gpm-mouse-100.png', + 'gpm-phone-000.png', + 'gpm-phone-020.png', + 'gpm-phone-040.png', + 'gpm-phone-060.png', + 'gpm-phone-080.png', + 'gpm-phone-100.png', + 'gpm-ups-000-charging.png', + 'gpm-ups-000.png', + 'gpm-ups-020-charging.png', + 'gpm-ups-020.png', + 'gpm-ups-040-charging.png', + 'gpm-ups-040.png', + 'gpm-ups-060-charging.png', + 'gpm-ups-060.png', + 'gpm-ups-080-charging.png', + 'gpm-ups-080.png', + 'gpm-ups-100-charging.png', + 'gpm-ups-100.png', + 'gpm-ups-missing.png', +] + +pixels = [ + '16x16', + '22x22', + '24x24', + '32x32', + '48x48', + '64x64', + '96x96', + '128x128', + '256x256', +] +pixels2 = [ + '48x48', + '64x64', + '96x96', + '128x128', + '256x256', +] +foreach pixel: pixels + + foreach icon: icons + install_data( + join_paths (pixel, 'status', icon), + install_dir : join_paths(pkgdatadir, 'icons/hicolor', pixel, 'status')) + endforeach + +endforeach + +foreach pixel: pixels2 + install_data( + join_paths (pixel, 'status', 'gpm-monitor.png'), + install_dir : join_paths(pkgdatadir, 'icons/hicolor', pixel, 'status')) +endforeach + +foreach icon: actions_icons + install_data( + join_paths(icon[0], 'actions', icon[1]), + install_dir: join_paths(pkgdatadir, 'icons/hicolor', icon[0], 'actions') + ) + install_data( + join_paths(icon[0], 'actions', icon[2]), + install_dir: join_paths(pkgdatadir, 'icons/hicolor', icon[0], 'actions') + ) +endforeach + +foreach icon: apps_icons + install_data( + join_paths(icon[0], 'apps', icon[1]), + install_dir: join_paths(matedatadir, 'icons/hicolor', icon[0], 'apps') + ) + install_data( + join_paths(icon[0], 'apps', icon[2]), + install_dir: join_paths(matedatadir, 'icons/hicolor', icon[0], 'apps') + ) + install_data( + join_paths(icon[0], 'apps', icon[3]), + install_dir: join_paths(matedatadir, 'icons/hicolor', icon[0], 'apps') + ) + install_data( + join_paths(icon[0], 'apps', icon[4]), + install_dir: join_paths(matedatadir, 'icons/hicolor', icon[0], 'apps') + ) +endforeach + +install_subdir('scalable/actions', install_dir : join_paths(pkgdatadir, 'icons', 'hicolor', 'scalable')) +install_subdir('scalable/status', install_dir : join_paths(pkgdatadir, 'icons', 'hicolor', 'scalable')) +install_subdir('scalable/apps', install_dir : join_paths(matedatadir, 'icons', 'hicolor', 'scalable')) diff --git a/data/meson.build b/data/meson.build new file mode 100644 index 0000000..efed514 --- /dev/null +++ b/data/meson.build @@ -0,0 +1,92 @@ +po_dir = join_paths(meson.source_root(), 'po') +man1_dir = join_paths(matemandir, 'man1') +subdir('icons') + +schema_data = configuration_data() +schema_data.set('GETTEXT_PACKAGE', meson.project_name()) +configure_file( + input : 'org.mate.power-manager.gschema.xml.in', + output : 'org.mate.power-manager.gschema.xml', + configuration : schema_data, + install : true, + install_dir : join_paths(matedatadir, 'glib-2.0', 'schemas') +) + +# .service files + +service_data = configuration_data() +service_data.set('servicedir', matebindir) + +configure_file( + input : 'org.mate.PowerManager.service.in', + output : 'org.mate.PowerManager.service', + configuration : service_data, + install : true, + install_dir : join_paths(matedatadir, 'dbus-1/services') +) + +# .desktop file + +desktop_data = configuration_data() +desktop_data.set('VERSION', meson.project_version()) +desktop_in_file = configure_file( + input : 'mate-power-statistics.desktop.in.in', + output : 'mate-power-statistics.desktop.in', + configuration : desktop_data +) + +i18n.merge_file( + input : desktop_in_file, + output : 'mate-power-statistics.desktop', + type : 'desktop', + po_dir : po_dir, + install : true, + install_dir : join_paths(matedatadir, 'applications') +) + +desktop_in_file = configure_file( + input : 'mate-power-preferences.desktop.in.in', + output : 'mate-power-preferences.desktop.in', + configuration : desktop_data +) + +i18n.merge_file( + input : desktop_in_file, + output : 'mate-power-preferences.desktop', + type : 'desktop', + po_dir : po_dir, + install : true, + install_dir : join_paths(matedatadir, 'applications') +) + +desktop_in_file = configure_file( + input : 'mate-power-manager.desktop.in.in', + output : 'mate-power-manager.desktop.in', + configuration : desktop_data +) + +i18n.merge_file( + input : desktop_in_file, + output : 'mate-power-manager.desktop', + type : 'desktop', + po_dir : po_dir, + install : true, + install_dir: join_paths(get_option('sysconfdir'), 'xdg', 'autostart') +) + +install_data('mate-power-statistics.1', + install_dir : man1_dir +) +install_data('mate-power-preferences.1', + install_dir : man1_dir +) +install_data('mate-power-manager.1', + install_dir : man1_dir +) +install_data('mate-power-backlight-helper.1', + install_dir : man1_dir +) + +install_data('acme.ui', + install_dir : pkgdatadir +) diff --git a/help/LINGUAS b/help/LINGUAS new file mode 100644 index 0000000..d47dd48 --- /dev/null +++ b/help/LINGUAS @@ -0,0 +1,117 @@ +af +am +ar +as +ast +az +be +bg +bn +bn_IN +br +bs +ca +ca@valencia +cmn +crh +cs +cy +da +de +dz +el +en_AU +en_CA +en_GB +eo +es +es_AR +es_CL +es_CO +es_ES +es_MX +es_PR +et +eu +fa +fi +fr +frp +fur +fy +ga +gl +gu +ha +he +hi +hr +hu +hy +ia +id +ie +ig +is +it +ja +jv +ka +kab +kk +kn +ko +ku +ku_IQ +ky +la +lt +lv +mai +mg +mi +mk +ml +mn +mr +ms +nb +nds +ne +nl +nn +nso +oc +or +pa +pl +ps +pt +pt_BR +ro +ru +si +sk +sl +sq +sr +sr@latin +sv +ta +te +th +tk +tr +ug +uk +ur +uz +vi +wa +xh +yo +zh_CN +zh-Hans +zh_HK +zh_TW +zu diff --git a/help/meson.build b/help/meson.build new file mode 100644 index 0000000..8069950 --- /dev/null +++ b/help/meson.build @@ -0,0 +1,24 @@ +mps_help_sources = [ + 'index.docbook', + 'legal.xml', +] + +gnome.yelp( + 'mate-power-manager', + sources: mps_help_sources, + media: [ + 'figures/applet-brightness.png', + 'figures/applet-inhibit.png', + 'figures/gpm-cell-capacity.png', + 'figures/gpm-charged.png', + 'figures/gpm-critical.png', + 'figures/gpm-low.png', + 'figures/gpm-prefs-ac.png', + 'figures/gpm-prefs-battery.png', + 'figures/gpm-prefs-general.png', + 'figures/gpm-stats-graph.png', + 'figures/gpm-suspend-problem.png', + 'figures/gpm-unplugged.png', + 'figures/gs-prefs.png', + ], +) diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..4ea6e3d --- /dev/null +++ b/meson.build @@ -0,0 +1,147 @@ +project('mate-power-manager', 'c', + version : '1.27.0', + default_options : ['warning_level=1'], + meson_version : '>=0.50.0' +) + +conf = configuration_data() + +prefix = get_option('prefix') +mateexecdir = join_paths(prefix, get_option('libexecdir')) +matedatadir = join_paths(prefix, get_option('datadir')) +matelocaledir = join_paths(prefix, get_option('localedir')) +matebindir = join_paths(prefix, get_option('bindir')) +matesbindir = join_paths(prefix, get_option('sbindir')) +matemandir = join_paths(prefix, get_option('mandir')) +pkgdatadir = join_paths(matedatadir, meson.project_name()) +mateicons = join_paths(pkgdatadir, 'icons') +mateui = join_paths(pkgdatadir, 'ui') +data_dir = join_paths(meson.current_source_dir(), 'data') +# 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_applet = get_option('applets') +enable_keyring = get_option('gnome-keyring') +enable_libsecret = get_option('libsecret') + +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') +cairo = dependency('cairo', version : '>= 1.0.0') +xrandr = dependency('xrandr', version : '>= 1.3.0') +xproto = dependency('xproto', version : '>= 7.0.15') +x11 = dependency('x11', version : '>= 1.3.0') +xext = dependency('xext', version : '>= 1.3.0') +dbus = dependency('dbus-1', version : '>= 1.0') +dbusglib = dependency('dbus-glib-1', version : '>= 0.70') +notify = dependency('libnotify', version : '>= 0.7.0') +canberra = dependency('libcanberra-gtk3', version : '>= 0.10') +matepanel = dependency('libmatepanelapplet-4.0', version : '>= 1.17.0',required: enable_applet) +upower = dependency('upower-glib', version : '>= 0.99.8') +libsecret = dependency('libsecret-1', version : '>= 0.11', required: enable_libsecret) +keyring = dependency('gnome-keyring-1', version : '>= 3.0.0', required: enable_keyring) +canberra = dependency('libcanberra-gtk3', version : '>= 0.10') +md = dependency('mate-desktop-2.0', version : '>= 1.27.1') +libm = cc.find_library('m', required: false) + +gnome = import('gnome') +i18n = import('i18n') + +conf.set('WITH_KEYRING', keyring.found()) +conf.set('WITH_LIBSECRET', libsecret.found()) +conf.set_quoted('GETTEXT_PACKAGE', meson.project_name()) +conf.set_quoted('LOCALEDIR', + join_paths(get_option('prefix'), + get_option('localedir'))) +conf.set_quoted('DATADIR', + join_paths(get_option('prefix'), + get_option('datadir'))) + +conf.set_quoted('PACKAGE_URL', 'https://mate-desktop.org') +conf.set_quoted('VERSION', meson.project_version()) + +configure_file( + output : 'config.h', + configuration : conf +) +config_inc = include_directories('.') + +if enable_applet + subdir('applets/brightness') + subdir('applets/inhibit') +endif +subdir('help') +subdir('src') +subdir('policy') +subdir('po') +subdir('data') + +# FIXME: remove when https://github.com/mesonbuild/meson/issues/837 fixed +meson.add_install_script('meson_post_install.sh') diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..cfc3863 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,4 @@ +option('enable-tests', type : 'boolean', value : true, description : 'enable tests') +option('gnome-keyring', type : 'boolean', value : false, description : 'gnome-keyring support') +option('libsecret', type : 'boolean', value : true, description : 'libsecret enabled') +option('applets', type : 'boolean', value : true, description : 'applets enabled') diff --git a/meson_post_install.sh b/meson_post_install.sh new file mode 100755 index 0000000..8895ff5 --- /dev/null +++ b/meson_post_install.sh @@ -0,0 +1,15 @@ +#!/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" + gtk-update-icon-cache -qtf "$MESON_INSTALL_PREFIX/share/mate-power-manager/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() + ] +) diff --git a/policy/meson.build b/policy/meson.build new file mode 100644 index 0000000..0c55ae8 --- /dev/null +++ b/policy/meson.build @@ -0,0 +1,15 @@ +po_dir = join_paths(meson.source_root(), 'po') +dataconf = configuration_data() +dataconf.set('sbindir', matesbindir) + +i18n.merge_file( + input : configure_file( + configuration: dataconf, + input : 'org.mate.power.policy.in2', + output: 'org.mate.power.policy.in' + ), + output: 'org.mate.power.policy', + po_dir: po_dir, + install: true, + install_dir: join_paths(get_option('datadir'), 'polkit-1', 'actions'), +) diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 0000000..35a0b88 --- /dev/null +++ b/src/meson.build @@ -0,0 +1,241 @@ +sources = files( + 'egg-color.c', + 'egg-color.h', + 'egg-precision.h', + 'egg-precision.c', + 'egg-array-float.c', + 'egg-array-float.h', + 'egg-idletime.h', + 'egg-idletime.c', + 'egg-discrete.h', + 'egg-discrete.c', + 'egg-console-kit.h', + 'egg-console-kit.c', + 'gpm-common.h', + 'gpm-common.c', + 'gpm-brightness.h', + 'gpm-brightness.c', + 'gpm-upower.c', + 'gpm-upower.h' +) + +cflags = [ + '-DMATELOCALEDIR="@0@"'.format(matelocaledir), + '-DG_LOG_DOMAIN="PowerManager"', + '-DGPM_ICONS_DATA="@0@"'.format(mateicons), + '-DINHIBIT_MENU_UI_DIR="@0@"'.format(mateui), + '-DSBINDIR="@0@"'.format(matesbindir), + '-DBINDIR="@0@"'.format(matebindir), + '-DGTKBUILDERDIR="@0@"'.format(pkgdatadir), + '-DEGG_VERBOSE="GPM_VERBOSE"', + '-DEGG_LOGGING="GPM_LOGGING"', + '-DUP_DISABLE_DEPRECATED', + '-DI_KNOW_THE_DEVICEKIT_POWER_API_IS_SUBJECT_TO_CHANGE', + '-DEGG_CONSOLE="GPM_CONSOLE"' +] +marshal_files = gnome.genmarshal('gpm-marshal', prefix : 'gpm_marshal', sources : 'gpm-marshal.list') + +dbus_binding_tool = find_program('dbus-binding-tool') +dbus_Backlight = custom_target('org.mate.PowerManager.Backlight', + input: 'org.mate.PowerManager.Backlight.xml', + output: 'org.mate.PowerManager.Backlight.h', + command: [dbus_binding_tool, '--prefix=gpm_backlight', '--mode=glib-server', + '--output=@OUTPUT@', '@INPUT@'] +) +dbus_KbdBacklight = custom_target('org.mate.PowerManager.KbdBacklight', + input: 'org.mate.PowerManager.KbdBacklight.xml', + output: 'org.mate.PowerManager.KbdBacklight.h', + command: [dbus_binding_tool, '--prefix=gpm_kbd_backlight', '--mode=glib-server', + '--output=@OUTPUT@', '@INPUT@'] +) +dbus_Manager = custom_target('org.mate.PowerManager', + input: 'org.mate.PowerManager.xml', + output: 'org.mate.PowerManager.h', + command: [dbus_binding_tool, '--prefix=gpm_manager', '--mode=glib-server', + '--output=@OUTPUT@', '@INPUT@'] +) +deps = [ + glib, + gtk, + dbusglib, + cairo, + upower, + keyring, + libsecret, + notify, +] + +libmpm_shared = static_library( + 'libmpmstatic', + sources: [ + sources, + marshal_files + ], + include_directories: config_inc, + dependencies: deps, + c_args: cflags, + #link_args: ldflags, + install: false, +) +executable( + 'mate-power-backlight-helper', + sources : 'gpm-backlight-helper.c', + include_directories: config_inc, + dependencies : deps, + link_with :libmpm_shared, + c_args : cflags, + install : true, + install_dir : get_option('sbindir') +) + +mate_power_statistics_resources = gnome.compile_resources( + 'mate-power-statistics-resources', + join_paths(data_dir,'org.mate.power-manager.statistics.gresource.xml'), + source_dir : data_dir, + c_name : 'statistics' +) + +executable( + 'mate-power-statistics', + mate_power_statistics_resources, + sources : [ + 'gpm-point-obj.c', + 'gpm-statistics.c', + 'gpm-graph-widget.c', + ], + include_directories : [ + include_directories('..'), + ], + dependencies : [ + libm, + deps + ], + link_with :libmpm_shared, + c_args : cflags, + install : true, + install_dir : get_option('bindir') +) + +mate_power_preferences_resources = gnome.compile_resources( + 'mate-power-preferences-resources', + join_paths(data_dir,'org.mate.power-manager.preferences.gresource.xml'), + source_dir : data_dir, + c_name : 'preferences' +) + +executable( + 'mate-power-preferences', + mate_power_preferences_resources, + sources : [ + 'gpm-prefs.c', + 'gpm-prefs-core.c', + ], + include_directories : [ + include_directories('..'), + ], + dependencies : [ + libm, + x11, + xrandr, + deps + ], + link_with :libmpm_shared, + c_args : cflags, + install : true, + install_dir : get_option('bindir') +) +mate_power_manager_resources = gnome.compile_resources( + 'mate-power-manager-resources', + join_paths(data_dir,'org.mate.power-manager.manager.gresource.xml'), + source_dir : data_dir, + c_name : 'manager' +) + +executable( + 'mate-power-manager', + mate_power_manager_resources, + sources : [ + 'gpm-dpms.c', + 'gpm-phone.c', + 'gpm-backlight.c', + 'gpm-idle.c', + 'gpm-load.c', + 'gpm-control.c', + 'gpm-button.c', + 'gpm-kbd-backlight.c', + 'gpm-main.c', + 'gpm-manager.c', + 'gpm-tray-icon.c', + 'gpm-screensaver.c', + 'gpm-session.c', + 'gpm-networkmanager.c', + 'gsd-media-keys-window.c', + 'msd-osd-window.c', + 'gpm-engine.c', + dbus_Backlight, + dbus_KbdBacklight, + dbus_Manager, + ], + include_directories : [ + include_directories('..'), + ], + dependencies : [ + libm, + md, + x11, + xext, + xrandr, + canberra, + deps + ], + link_with :libmpm_shared, + c_args : cflags, + install : true, + install_dir : get_option('bindir') +) + +if get_option('enable-tests') + e = executable( + 'mate-power-self-test', + sources : [ + 'gpm-self-test.c', + 'egg-color.c', + 'egg-test.c', + 'egg-precision.c', + 'egg-precision.c', + 'egg-idletime.c', + 'egg-discrete.c', + 'egg-array-float.c', + 'egg-console-kit.c', + 'gpm-control.c', + 'gpm-networkmanager.c', + 'gpm-dpms.c', + 'gpm-button.c', + 'gpm-screensaver.c', + 'gpm-engine.c', + 'gpm-phone.c', + 'gpm-idle.c', + 'gpm-session.c', + 'gpm-load.c', + 'gpm-common.c', + 'gpm-upower.c', + marshal_files, + ], + include_directories : [ + include_directories('..'), + ], + dependencies : [ + libm, + x11, + xext, + xrandr, + deps + ], + link_with :libmpm_shared, + c_args : [ + test_args, + '-DEGG_TEST' + ] + ) + test('mate-power-self-test', e) +endif -- cgit v1.2.1