[gnome-power-manager/wip/hughsie/meson] Port to meson
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-power-manager/wip/hughsie/meson] Port to meson
- Date: Wed, 30 Nov 2016 15:55:05 +0000 (UTC)
commit 7407c393f737cfa732f442aaa3f5cdc9182737e9
Author: Richard Hughes <richard hughsie com>
Date: Wed Nov 30 14:44:16 2016 +0000
Port to meson
Makefile.am | 67 -------
autogen.sh | 20 --
config.h.in | 10 +
configure.ac | 155 ---------------
data/Makefile.am | 18 +--
data/appdata/meson.build | 9 +
data/icons/Makefile.am | 16 --
data/icons/hicolor/Makefile.am | 19 --
data/meson.build | 16 ++
...sktop.in.in => org.gnome.PowerStats.desktop.in} | 6 +-
git.mk | 200 --------------------
m4/.gitignore | 1 -
man/Makefile.am | 16 --
meson.build | 124 ++++++++++++
meson_options.txt | 1 +
po/.gitignore | 8 -
po/LINGUAS | 81 --------
po/POTFILES | 6 +
po/POTFILES.in | 9 -
po/meson.build | 89 +++++++++
src/Makefile.am | 98 ----------
src/gpm-statistics.c | 6 +-
src/meson.build | 46 +++++
23 files changed, 309 insertions(+), 712 deletions(-)
---
diff --git a/config.h.in b/config.h.in
new file mode 100644
index 0000000..ce4cb13
--- /dev/null
+++ b/config.h.in
@@ -0,0 +1,10 @@
+/* config.h.in. */
+
+/* Have tests */
+#mesondefine HAVE_TESTS
+
+/* Package name for gettext */
+#mesondefine GETTEXT_PACKAGE
+
+/* Define to the version of this package */
+#mesondefine PACKAGE_VERSION
diff --git a/data/Makefile.am b/data/Makefile.am
index 9928dc7..ebcebdb 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1,22 +1,6 @@
-SUBDIRS = appdata icons
+SUBDIRS = icons
@INTLTOOL_DESKTOP_RULE@
desktopdir = $(datadir)/applications
desktop_in_files = org.gnome.PowerStats.desktop.in
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
-
-@GSETTINGS_RULES@
-gsettings_SCHEMAS = org.gnome.power-manager.gschema.xml
-
-EXTRA_DIST = \
- $(gsettings_SCHEMAS) \
- $(desktop_in_files)
-
-clean-local :
- rm -f *~
-
-DISTCLEANFILES = \
- org.gnome.PowerStats.desktop \
- org.gnome.power-manager.gschema.xml
-
--include $(top_srcdir)/git.mk
diff --git a/data/appdata/meson.build b/data/appdata/meson.build
new file mode 100644
index 0000000..fcd0ab8
--- /dev/null
+++ b/data/appdata/meson.build
@@ -0,0 +1,9 @@
+# Copyright (C) 2016 Richard Hughes <richard hughsie com>
+#
+# Licensed under the GNU General Public License Version 2 or later
+
+# FIXME: needs to merge in translations!
+configure_file(input : 'org.gnome.PowerStats.appdata.xml.in',
+ output : 'org.gnome.PowerStats.appdata.xml',
+ install_dir : get_option('datadir') + '/appdata',
+ configuration : conf)
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..1df854d
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,16 @@
+# Copyright (C) 2016 Richard Hughes <richard hughsie com>
+#
+# Licensed under the GNU General Public License Version 2 or later
+
+compiled = gnome.compile_schemas()
+install_data('org.gnome.power-manager.gschema.xml',
+ install_dir : 'share/glib-2.0/schemas')
+
+# FIXME: needs to merge in translations!
+configure_file(input : 'org.gnome.PowerStats.desktop.in',
+ output : 'org.gnome.PowerStats.desktop',
+ install_dir : get_option('datadir') + '/applications',
+ configuration : conf)
+
+subdir('appdata')
+subdir('icons')
diff --git a/data/org.gnome.PowerStats.desktop.in.in b/data/org.gnome.PowerStats.desktop.in
similarity index 80%
rename from data/org.gnome.PowerStats.desktop.in.in
rename to data/org.gnome.PowerStats.desktop.in
index d0eacf4..5455565 100644
--- a/data/org.gnome.PowerStats.desktop.in.in
+++ b/data/org.gnome.PowerStats.desktop.in
@@ -1,7 +1,7 @@
[Desktop Entry]
-_Name=Power Statistics
-_Comment=Observe power management
-_Keywords=battery;consumption;charge;
+Name=Power Statistics
+Comment=Observe power management
+Keywords=battery;consumption;charge;
Icon=org.gnome.PowerStats
Exec=gnome-power-statistics
Terminal=false
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..598ff67
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,124 @@
+# Copyright (C) 2016 Richard Hughes <richard hughsie com>
+#
+# Licensed under the GNU General Public License Version 2 or later
+
+project('gnome-power-manager', 'c',
+ default_options : ['warning_level=1'])
+
+version_major = '3'
+version_minor = '22'
+version_micro = '3'
+version = '@0@.@1@.@2@'.format(version_major, version_minor, version_micro)
+
+conf = configuration_data()
+conf.set('VERSION_MAJOR', version_major)
+conf.set('VERSION_MINOR', version_minor)
+conf.set('VERSION_MICRO', version_micro)
+conf.set('VERSION', '@0@'.format(version))
+
+# 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'
+]
+common_c_args = []
+cc = meson.get_compiler('c')
+foreach arg: test_args
+ if cc.has_argument(arg)
+ common_c_args += [ arg ]
+ endif
+endforeach
+
+gtk = dependency('gtk+-3.0', version : '>= 3.3.8')
+gdk = dependency('gdk-3.0', version : '>= 2.91.7')
+cairo = dependency('cairo', version : '>= 1.0.0')
+upower = dependency('upower-glib', version : '>= 0.9.1')
+libm = cc.find_library('libm', required: false)
+
+if get_option('enable-tests')
+ conf.set('HAVE_TESTS', 1)
+endif
+
+# use gperf for faster string -> enum matching
+docbook2man = find_program('docbook2man', required : false)
+if docbook2man.found()
+ conf.set('HAVE_DOCBOOK2MAN', 1)
+endif
+
+gnome = import('gnome')
+i18n = import('i18n')
+
+conf.set('GETTEXT_PACKAGE', '"gnome-power-manager"')
+configure_file(input : 'config.h.in',
+ output : 'config.h',
+ configuration : conf)
+top_build_incdir = include_directories(meson.current_build_dir())
+
+add_global_arguments('-DLOCALEDIR="@0@"'.format(get_option('localedir')), language : 'c')
+add_global_arguments('-DDATA_DIR="@0@"'.format(get_option('datadir')), language : 'c')
+
+subdir('src')
+subdir('man')
+subdir('po')
+subdir('data')
+
+archiver = find_program('git', required : false)
+if archiver.found()
+ run_target('dist',
+ command: ['git', 'archive', '--prefix=appstream-glib/',
+ 'HEAD',
+ '--output', 'gnome-power-manager-' + version + '.tar.gz']
+ )
+else
+ message('git not found, you will not be able to run `ninja dist`')
+endif
+
+appstream_util = find_program('appstream-util', required : false)
+if appstream_util.found()
+ custom_target('xxxNEWSnotsurewhattoputhere',
+ output : 'NEWS',
+ input : 'data/appdata/org.gnome.PowerStats.appdata.xml.in',
+ command : [appstream_util, 'appdata-to-news', '@INPUT@', '--output', '@OUTPUT@']
+ )
+endif
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..04c3a3a
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1 @@
+option('enable-tests', type : 'boolean', value : true, description : 'enable tests')
diff --git a/po/POTFILES b/po/POTFILES
new file mode 100644
index 0000000..62440f1
--- /dev/null
+++ b/po/POTFILES
@@ -0,0 +1,6 @@
+data/appdata/org.gnome.PowerStats.appdata.xml.in
+data/org.gnome.power-manager.gschema.xml
+data/org.gnome.PowerStats.desktop.in
+src/egg-graph-widget.c
+src/gpm-statistics.c
+src/gpm-statistics.ui
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..99edcee
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,89 @@
+# Copyright (C) 2016 Richard Hughes <richard hughsie com>
+#
+# Licensed under the GNU General Public License Version 2 or later
+
+langs = [
+ 'af',
+ 'ar',
+ 'as',
+ 'ast',
+ 'be',
+ 'be@latin',
+ 'bg',
+ 'bn',
+ 'bn_IN',
+ 'bs',
+ 'ca',
+ 'ca@valencia',
+ 'cs',
+ 'cy',
+ 'da',
+ 'de',
+ 'dz',
+ 'el',
+ 'en_CA',
+ 'en_GB',
+ 'en@shaw',
+ 'eo',
+ 'es',
+ 'et',
+ 'eu',
+ 'fa',
+ 'fi',
+ 'fr',
+ 'ga',
+ 'gd',
+ 'gl',
+ 'gu',
+ 'he',
+ 'hi',
+ 'hr',
+ 'hu',
+ 'id',
+ 'is',
+ 'it',
+ 'ja',
+ 'ka',
+ 'km',
+ 'kn',
+ 'ko',
+ 'ku',
+ 'lt',
+ 'lv',
+ 'mai',
+ 'mg',
+ 'mk',
+ 'ml',
+ 'mr',
+ 'my',
+ 'nb',
+ 'nl',
+ 'nn',
+ 'oc',
+ 'or',
+ 'pa',
+ 'pl',
+ 'pt',
+ 'pt_BR',
+ 'ro',
+ 'ru',
+ 'si',
+ 'sk',
+ 'sl',
+ 'sr',
+ 'sr@latin',
+ 'sv',
+ 'ta',
+ 'te',
+ 'tg',
+ 'th',
+ 'tr',
+ 'ug',
+ 'uk',
+ 'vi',
+ 'zh_CN',
+ 'zh_HK',
+ 'zh_TW'
+ ]
+
+i18n.gettext('gnome-power-manager', languages : langs)
diff --git a/src/gpm-statistics.c b/src/gpm-statistics.c
index 9ab08c2..9f50a4b 100644
--- a/src/gpm-statistics.c
+++ b/src/gpm-statistics.c
@@ -2048,7 +2048,7 @@ main (int argc, char *argv[])
setlocale (LC_ALL, "");
- bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
+ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
@@ -2067,7 +2067,9 @@ main (int argc, char *argv[])
/* add application specific icons to search path */
gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
- GPM_DATA G_DIR_SEPARATOR_S "icons");
+ DATA_DIR G_DIR_SEPARATOR_S
+ "gnome-power-manager" G_DIR_SEPARATOR_S
+ "icons");
/* run */
status = g_application_run (G_APPLICATION (application), argc, argv);
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..3d88ff5
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,46 @@
+# Copyright (C) 2016 Richard Hughes <richard hughsie com>
+#
+# Licensed under the GNU General Public License Version 2 or later
+
+cargs = ['-DG_LOG_DOMAIN="Gpm"']
+cargs += common_c_args
+
+simple_resources = gnome.compile_resources('simple-resources',
+ 'gnome-power-manager.gresource.xml',
+ source_dir : '.',
+ c_name : 'gpm')
+
+gnome_power_statistics = executable(
+ 'gnome-power-statistics',
+ simple_resources,
+ sources : [
+ 'gpm-array-float.c',
+ 'gpm-array-float.h',
+ 'gpm-statistics.c',
+ 'egg-graph-point.c',
+ 'egg-graph-point.h',
+ 'egg-graph-widget.c',
+ 'egg-graph-widget.h',
+ ],
+ include_directories : [
+ include_directories('@0@/..'.format(meson.current_build_dir())),
+ ],
+ dependencies : [gtk, gdk, cairo, upower, libm],
+ c_args : cargs
+)
+
+if get_option('enable-tests')
+ gnome_power_self_test = executable(
+ 'gnome-power-self-test',
+ sources : [
+ 'gpm-array-float.c',
+ 'gpm-array-float.h',
+ 'gpm-self-test.c'
+ ],
+ include_directories : [
+ include_directories('@0@/..'.format(meson.current_build_dir())),
+ ],
+ dependencies : [gtk, gdk, cairo, upower, libm],
+ c_args : cargs
+ )
+endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]