summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhuyaliang <[email protected]>2021-10-07 21:36:04 +0800
committerraveit65 <[email protected]>2021-10-15 21:33:59 +0200
commitf1c1e72d96c11194ff89752a4e22b6edffa75666 (patch)
tree66b1ef28de295faa53273f025bb4ed0bdf8da733
parentddeb66b5af61a5367c8b72a5e5845317e82b62a4 (diff)
downloadmate-system-monitor-f1c1e72d96c11194ff89752a4e22b6edffa75666.tar.bz2
mate-system-monitor-f1c1e72d96c11194ff89752a4e22b6edffa75666.tar.xz
Add meson build support
-rw-r--r--help/meson.build21
-rw-r--r--meson.build190
-rw-r--r--meson_options.txt6
-rw-r--r--meson_post_install.py15
-rw-r--r--pixmaps/meson.build10
-rw-r--r--po/meson.build1
-rw-r--r--src/meson.build103
-rw-r--r--src/msm.gresource.xml2
-rw-r--r--src/procdialogs.cpp2
-rw-r--r--tools/meson.build16
10 files changed, 364 insertions, 2 deletions
diff --git a/help/meson.build b/help/meson.build
new file mode 100644
index 0000000..f1fc372
--- /dev/null
+++ b/help/meson.build
@@ -0,0 +1,21 @@
+gnome.yelp(meson.project_name(),
+ sources: [
+ 'index.docbook',
+ 'legal.xml',
+ ],
+ media: [
+ 'figures/addColumn.png',
+ 'figures/changePriority.png',
+ 'figures/colorPanel.png',
+ 'figures/columnContextMenu.png',
+ 'figures/mate-system-monitor_window.png',
+ 'figures/memoryMaps.png',
+ 'figures/moreInfo.png',
+ 'figures/processListing.png',
+ 'figures/sortButton.png',
+ 'figures/sortMenu2.png',
+ 'figures/sortMenu.png',
+ 'figures/systemMonitor.png',
+ 'figures/viewMenu.png',
+ ],
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..0fc4e20
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,190 @@
+project('mate-system-monitor',
+ 'c', 'cpp',
+ default_options : [
+ 'c_std=c11', 'cpp_std=c++11', 'warning_level=3'
+ ],
+ version: '1.26.0',
+ url: 'https://mate-desktop.org',
+ meson_version: '>=0.50.0',
+)
+
+
+gnome = import('gnome')
+i18n = import('i18n')
+
+cc = meson.get_compiler('c')
+cx = meson.get_compiler('cpp')
+
+gettext_package = meson.project_name()
+
+conf = configuration_data()
+conf.set_quoted('VERSION', meson.project_version())
+conf.set_quoted('PACKAGE_URL', 'https://mate-desktop.org')
+conf.set_quoted('GETTEXT_PACKAGE', gettext_package)
+conf.set_quoted('MATELOCALEDIR',
+ join_paths(get_option('prefix'), get_option('localedir'))
+)
+conf.set_quoted('DATADIR',
+ join_paths(get_option('prefix'), get_option('datadir')))
+
+conf.set_quoted('PKGLIBEXECDIR',
+ join_paths(get_option('prefix'), get_option('libdir'), meson.project_name(),meson.project_name())
+)
+conf.set_quoted('LIBEXECDIR',
+ join_paths(get_option('prefix'), get_option('libexecdir')))
+
+dataconf = configuration_data()
+dataconf.set('VERSION', meson.project_version())
+dataconf.set('GETTEXT_PACKAGE', gettext_package)
+dataconf.set('pkglibexecdir',
+ join_paths(get_option('prefix'),get_option('libexecdir'), meson.project_name())
+)
+
+prefix = get_option('prefix')
+datadir = join_paths(prefix, get_option('datadir'))
+
+################################################################################
+# Dependencies
+
+giomm = dependency('giomm-2.4', version: '>=2.26.0')
+glib = dependency('glib-2.0', version: '>=2.56.0')
+glibmm = dependency('glibmm-2.4', version: '>=2.22')
+gmodule = dependency('gmodule-2.0')
+gtk3 = dependency('gtk+-3.0', version: '>=3.22.0')
+gtkmm = dependency('gtkmm-3.0', version: '>=3.8.1')
+libgtop = dependency('libgtop-2.0', version: '>=2.37.2')
+librsvg = dependency('librsvg-2.0', version: '>=2.35')
+libxml = dependency('libxml-2.0', version: '>=2.0')
+
+if get_option('wnck')
+ libwnck = dependency('libwnck-3.0', version: '>=2.91.0')
+else
+ libwnck = dependency('', required: false)
+endif
+conf.set('HAVE_WNCK', libwnck.found())
+
+if get_option('systemd')
+ libsystemd = dependency('libsystemd', version: '>=44')
+else
+ libsystemd = dependency('', required: false)
+endif
+conf.set('HAVE_SYSTEMD', libsystemd.found())
+
+
+################################################################################
+# Compiler flags
+
+extra_flags = [
+ '-Wcast-align',
+ '-Wchar-subscripts',
+ '-Winline',
+ '-Wmissing-declarations',
+ '-Wpointer-arith',
+ '-Wsign-compare',
+]
+extra_cflags = [
+ '-Wmissing-prototypes',
+ '-Wnested-externs',
+]
+extra_cxxflags = [
+ # '-fvisibility=hidden',
+ # '-fvisibility-inlines-hidden',
+]
+
+cflags = extra_flags + extra_cflags
+cxxflags = extra_flags + extra_cxxflags
+
+add_project_arguments(cc.get_supported_arguments(cflags),
+ language: 'c'
+)
+add_project_arguments(cx.get_supported_arguments(cxxflags),
+ language: 'cpp'
+)
+
+configure_file(
+ output: 'config.h',
+ configuration: conf,
+)
+
+################################################################################
+# Generate files
+
+desktop_files = i18n.merge_file(
+ input : configure_file(
+ configuration: dataconf,
+ input : 'mate-system-monitor.desktop.in.in',
+ output: 'mate-system-monitor.desktop.in'
+ ),
+ output: 'mate-system-monitor.desktop',
+ po_dir: 'po',
+ type: 'desktop',
+ install: true,
+ install_dir: join_paths(get_option('datadir'), 'applications'),
+)
+
+appdata_file = i18n.merge_file(
+ input : 'mate-system-monitor.appdata.xml.in',
+ output: 'mate-system-monitor.appdata.xml',
+ po_dir: 'po',
+ install: true,
+ install_dir: join_paths(get_option('datadir'), 'metainfo'),
+)
+
+i18n.merge_file(
+ input : configure_file(
+ configuration: dataconf,
+ input : 'org.mate.mate-system-monitor.policy.in.in',
+ output: 'org.mate.mate-system-monitor.policy.in'
+ ),
+ output: 'org.mate.mate-system-monitor.policy',
+ po_dir: 'po',
+ data_dirs: 'po',
+ install: true,
+ install_dir: join_paths(get_option('datadir'), 'polkit-1', 'actions'),
+)
+
+install_man(
+ 'mate-system-monitor.1',
+)
+appstream_util = find_program('appstream-util', required: false)
+if appstream_util.found()
+ test('validate_appdata',
+ appstream_util,
+ args: [ 'validate-relax', '--nonet', appdata_file ],
+ )
+endif
+
+desktop_validate = find_program('desktop-file-validate', required: false)
+if desktop_validate.found()
+ test('validate_desktop',
+ desktop_validate,
+ args: [ desktop_files ],
+ )
+endif
+
+################################################################################
+# Subdirectories
+
+rootInclude = include_directories('.')
+
+subdir('po')
+subdir('pixmaps')
+subdir('tools')
+subdir('src')
+subdir('help')
+
+
+message('\n'.join(['',
+'Configuration:',
+'',
+' Source code location: @0@'.format(meson.source_root()),
+' C Compiler: @0@ @1@'.format(cc.get_id(), cc.version()),
+' C++ Compiler: @0@ @1@'.format(cx.get_id(), cx.version()),
+' CFLAGS: @0@'.format(cflags),
+' CXXFLAGS: @0@'.format(cxxflags),
+' systemd support: @0@'.format(libsystemd.found()),
+' wnck support: @0@ @1@'.format(libwnck.found(),
+ libwnck.found() ? '(this will likely make system-monitor segfault)' : ''),
+]))
+
+meson.add_install_script('meson_post_install.py')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..4671783
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,6 @@
+option('wnck', type: 'boolean', value: false,
+ description: 'enable wnck support, this will likely make system-monitor segfault'
+)
+option('systemd', type: 'boolean', value: true,
+ description: 'systemd support'
+)
diff --git a/meson_post_install.py b/meson_post_install.py
new file mode 100644
index 0000000..b26c88a
--- /dev/null
+++ b/meson_post_install.py
@@ -0,0 +1,15 @@
+#!/usr/bin/env python3
+
+import os
+import subprocess
+
+install_prefix = os.environ['MESON_INSTALL_PREFIX']
+icondir = os.path.join(install_prefix, 'share', 'icons', 'hicolor')
+schemadir = os.path.join(install_prefix, 'share', 'glib-2.0', 'schemas')
+
+if not os.environ.get('DESTDIR'):
+ print('Update icon cache...')
+ subprocess.call(['gtk-update-icon-cache', '-f', '-t', icondir])
+
+ print('Compiling gsettings schemas...')
+ subprocess.call(['glib-compile-schemas', schemadir])
diff --git a/pixmaps/meson.build b/pixmaps/meson.build
new file mode 100644
index 0000000..10ca500
--- /dev/null
+++ b/pixmaps/meson.build
@@ -0,0 +1,10 @@
+faces = [
+ ['download.svg'],
+ ['side.png'],
+ ['upload.svg'],
+]
+foreach face: faces
+ install_data(face,
+ install_dir : join_paths(get_option('datadir'), 'pixmaps', 'mate-system-monitor')
+ )
+endforeach
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..e9b77d7
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext(meson.project_name(), preset: 'glib')
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..4810ad7
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,103 @@
+system_monitor_sources = []
+
+msm_resource = gnome.compile_resources(
+ 'msm',
+ 'msm.gresource.xml',
+ source_dir: 'src',
+)
+
+system_monitor_sources += [
+ 'argv.cpp',
+ 'procman.cpp',
+ 'interface.cpp',
+ 'callbacks.cpp',
+ 'load-graph.cpp',
+ 'proctable.cpp',
+ 'prettytable.cpp',
+ 'util.cpp',
+ 'procactions.cpp',
+ 'procdialogs.cpp',
+ 'memmaps.cpp',
+ 'openfiles.cpp',
+ 'procproperties.cpp',
+ 'smooth_refresh.cpp',
+ 'disks.cpp',
+ 'selinux.cpp',
+ 'cgroups.cpp',
+ 'procman_gksu.cpp',
+ 'procman_pkexec.cpp',
+ 'sysinfo.cpp',
+ 'lsof.cpp',
+ 'selection.cpp',
+ 'settings-keys.cpp',
+ 'iconthemewrapper.cpp',
+ 'procman-app.cpp',
+ 'gsm_color_button.c',
+ msm_resource
+]
+
+system_monitor_headers = [
+ 'argv.h',
+ 'callbacks.h',
+ 'cgroups.h',
+ 'defaulttable.h',
+ 'disks.h',
+ 'gsm_color_button.h',
+ 'iconthemewrapper.h',
+ 'interface.h',
+ 'load-graph.h',
+ 'lsof.h',
+ 'memmaps.h',
+ 'openfiles.h',
+ 'prettytable.h',
+ 'procactions.h',
+ 'procdialogs.h',
+ 'procman-app.h',
+ 'procman_gksu.h',
+ 'procman.h',
+ 'procman_pkexec.h',
+ 'procproperties.h',
+ 'proctable.h',
+ 'selection.h',
+ 'selinux.h',
+ 'settings-keys.h',
+ 'smooth_refresh.h',
+ 'sysinfo.h',
+ 'util.h',
+]
+
+msm_schemas = configure_file(
+ input : 'org.mate.system-monitor.gschema.xml.in',
+ output: 'org.mate.system-monitor.gschema.xml',
+ configuration: dataconf,
+ install: true,
+ install_dir: join_paths(get_option('datadir'), 'glib-2.0', 'schemas'),
+)
+
+msm_gsettings = gnome.mkenums('org.mate.mate-system-monitor.enums.xml',
+ sources: system_monitor_headers,
+ comments: '<!-- @comment@ -->',
+ fhead: '<schemalist>',
+ vhead: ' <@type@ id=\'org.mate.mate-system-monitor.@EnumName@\'>',
+ vprod: ' <value nick=\'@valuenick@\' value=\'@valuenum@\'/>',
+ vtail: ' </@type@>',
+ ftail: '</schemalist>',
+ install_header: true,
+ install_dir: join_paths(get_option('datadir'), 'glib-2.0', 'schemas'),
+)
+
+executable(meson.project_name(),
+ system_monitor_sources,
+ include_directories: rootInclude,
+ dependencies: [
+ gmodule,
+ gtkmm,
+ libgtop,
+ libsystemd,
+ libwnck,
+ libxml,
+ librsvg,
+ ],
+ install: true,
+ install_dir : get_option('bindir')
+)
diff --git a/src/msm.gresource.xml b/src/msm.gresource.xml
index f9e9c0f..c77245e 100644
--- a/src/msm.gresource.xml
+++ b/src/msm.gresource.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
- <gresource prefix="/org/mate/system-monitor">
+ <gresource prefix="/org/mate/mate-system-monitor">
<file compressed="true" preprocess="xml-stripblanks">preferences.ui</file>
</gresource>
</gresources>
diff --git a/src/procdialogs.cpp b/src/procdialogs.cpp
index c7b3e01..7e23301 100644
--- a/src/procdialogs.cpp
+++ b/src/procdialogs.cpp
@@ -465,7 +465,7 @@ procdialog_create_preferences_dialog (ProcData *procdata)
if (prefs_dialog)
return;
- builder = gtk_builder_new_from_resource("/org/mate/system-monitor/preferences.ui");
+ builder = gtk_builder_new_from_resource("/org/mate/mate-system-monitor/preferences.ui");
prefs_dialog = GET_WIDGET("preferences_dialog");
notebook = GET_WIDGET("notebook");
diff --git a/tools/meson.build b/tools/meson.build
new file mode 100644
index 0000000..e73131c
--- /dev/null
+++ b/tools/meson.build
@@ -0,0 +1,16 @@
+commands = [
+ 'renice',
+ 'kill',
+]
+
+foreach command : commands
+ executable('gsm-' + command,
+ 'msm_execute_helper.c',
+ dependencies: [
+ glib,
+ ],
+ c_args: '-DCOMMAND="@0@"'.format(command),
+ install: true,
+ install_dir: join_paths(get_option('libexecdir'), meson.project_name())
+ )
+endforeach