[gnome-power-manager/wip/hughsie/meson] Port to the Meson buildsystem
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-power-manager/wip/hughsie/meson] Port to the Meson buildsystem
- Date: Mon, 5 Dec 2016 15:11:03 +0000 (UTC)
commit 4b5f812e24a01136cd672e6ac517d14d4bf3f8a0
Author: Richard Hughes <richard hughsie com>
Date: Wed Nov 30 14:44:16 2016 +0000
Port to the Meson buildsystem
Automake and autoconf are impossible to fully understand and Meson now provides
everything we need for a much smaller, faster, and more understandable build.
See http://mesonbuild.com/ for more information.
Makefile.am | 67 -------
RELEASE | 2 +-
autogen.sh | 20 ---
config.h.in | 7 +
configure.ac | 155 -----------------
contrib/gnome-power-manager.spec.in | 8 +-
data/Makefile.am | 22 ---
data/appdata/Makefile.am | 8 -
data/appdata/meson.build | 12 ++
data/appdata/org.gnome.PowerStats.appdata.xml.in | 12 +-
data/icons/Makefile.am | 16 --
data/icons/hicolor/Makefile.am | 19 --
data/icons/hicolor/meson.build | 18 ++
data/icons/meson.build | 5 +
data/meson.build | 26 +++
data/org.gnome.PowerStats.desktop.in.in | 8 +-
git.mk | 200 ----------------------
m4/.gitignore | 1 -
man/Makefile.am | 16 --
man/meson.build | 14 ++
meson.build | 140 +++++++++++++++
meson_options.txt | 1 +
meson_post_install.sh | 18 ++
po/.gitignore | 8 -
po/LINGUAS | 2 +-
po/POTFILES | 6 +
po/POTFILES.in | 9 -
po/meson.build | 10 +
src/Makefile.am | 98 -----------
src/gpm-statistics.c | 6 +-
src/meson.build | 62 +++++++
31 files changed, 339 insertions(+), 657 deletions(-)
---
diff --git a/RELEASE b/RELEASE
index ca990fc..bcea6ac 100644
--- a/RELEASE
+++ b/RELEASE
@@ -3,7 +3,7 @@ Follow http://developer.gnome.org/dotplan/for_maintainers.html
git log --format="%s" GNOME_POWER_MANAGER_3_22_2.. | grep -i -v trivial | grep -v Merge | uniq
Add any user visible changes into data/appdata/org.gnome.PowerStats.appdata.xml.in
-Run "make distcheck", correct any problems encountered
+Run "ninja dist"
git commit -a -m "GNOME Power Manager 3.22.3"
git tag -s GNOME_POWER_MANAGER_3_22_3 -m "==== Version 3.22.3 ===="
diff --git a/config.h.in b/config.h.in
new file mode 100644
index 0000000..c47b02f
--- /dev/null
+++ b/config.h.in
@@ -0,0 +1,7 @@
+/* config.h.in. */
+
+/* Package name for gettext */
+#mesondefine GETTEXT_PACKAGE
+
+#mesondefine DATADIR
+#mesondefine LOCALEDIR
diff --git a/contrib/gnome-power-manager.spec.in b/contrib/gnome-power-manager.spec.in
index 8ec317e..58f3f34 100644
--- a/contrib/gnome-power-manager.spec.in
+++ b/contrib/gnome-power-manager.spec.in
@@ -14,10 +14,10 @@ BuildRequires: gettext
BuildRequires: libtool
BuildRequires: cairo-devel
BuildRequires: upower-devel >= 0.9.0
-BuildRequires: intltool
BuildRequires: glib2-devel >= 2.25.9
BuildRequires: gtk3-devel >= 2.91.3
BuildRequires: docbook-utils
+BuildRequires: meson
# obsolete sub-package
Obsoletes: gnome-power-manager-extra <= 2.30.1
@@ -31,11 +31,11 @@ displaying icons and handling user callbacks in an interactive GNOME session.
%setup -q
%build
-%configure
-make
+%meson
+%meson_build
%install
-%make_install
+%meson_install
%find_lang %name --with-gnome
diff --git a/data/appdata/meson.build b/data/appdata/meson.build
new file mode 100644
index 0000000..4135bf6
--- /dev/null
+++ b/data/appdata/meson.build
@@ -0,0 +1,12 @@
+# Copyright (C) 2016 Richard Hughes <richard hughsie com>
+#
+# Licensed under the GNU General Public License Version 2 or later
+
+i18n.merge_file(
+ input: 'org.gnome.PowerStats.appdata.xml.in',
+ output: 'org.gnome.PowerStats.appdata.xml',
+ type: 'xml',
+ po_dir: join_paths(meson.source_root(), 'po'),
+ install: true,
+ install_dir: join_paths(get_option('datadir'), 'appdata')
+)
diff --git a/data/appdata/org.gnome.PowerStats.appdata.xml.in
b/data/appdata/org.gnome.PowerStats.appdata.xml.in
index 3b44be7..185fbc4 100644
--- a/data/appdata/org.gnome.PowerStats.appdata.xml.in
+++ b/data/appdata/org.gnome.PowerStats.appdata.xml.in
@@ -4,18 +4,18 @@
<id>org.gnome.PowerStats.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-2.0+ and GFDL-1.3</project_license>
- <_name>GNOME Power Statistics</_name>
- <_summary>Observe power management</_summary>
+ <name>GNOME Power Statistics</name>
+ <summary>Observe power management</summary>
<description>
- <_p>
+ <p>
Power Statistics can show historical and current battery information and
programs waking up that use power.
- </_p>
- <_p>
+ </p>
+ <p>
You probably only need to install this application if you are having
problems with your laptop battery, or are trying to work out what programs
are using significant amounts of power.
- </_p>
+ </p>
</description>
<screenshots>
<screenshot type="default">
diff --git a/data/icons/hicolor/meson.build b/data/icons/hicolor/meson.build
new file mode 100644
index 0000000..73269f4
--- /dev/null
+++ b/data/icons/hicolor/meson.build
@@ -0,0 +1,18 @@
+# Copyright (C) 2016 Richard Hughes <richard hughsie com>
+#
+# Licensed under the GNU General Public License Version 2 or later
+
+install_data('16x16/org.gnome.PowerStats.png',
+ install_dir : 'share/icons/hicolor/16x16/apps')
+install_data('22x22/org.gnome.PowerStats.png',
+ install_dir : 'share/icons/hicolor/22x22/apps')
+install_data('24x24/org.gnome.PowerStats.png',
+ install_dir : 'share/icons/hicolor/24x24/apps')
+install_data('32x32/org.gnome.PowerStats.png',
+ install_dir : 'share/icons/hicolor/32x32/apps')
+install_data('48x48/org.gnome.PowerStats.png',
+ install_dir : 'share/icons/hicolor/48x48/apps')
+install_data('scalable/org.gnome.PowerStats.svg',
+ install_dir : 'share/icons/hicolor/scalable/apps')
+install_data('symbolic/org.gnome.PowerStats-symbolic.svg',
+ install_dir : 'share/icons/hicolor/symbolic/apps')
diff --git a/data/icons/meson.build b/data/icons/meson.build
new file mode 100644
index 0000000..3721dff
--- /dev/null
+++ b/data/icons/meson.build
@@ -0,0 +1,5 @@
+# Copyright (C) 2016 Richard Hughes <richard hughsie com>
+#
+# Licensed under the GNU General Public License Version 2 or later
+
+subdir('hicolor')
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..ef686a2
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,26 @@
+# Copyright (C) 2016 Richard Hughes <richard hughsie com>
+#
+# Licensed under the GNU General Public License Version 2 or later
+
+subdir('appdata')
+subdir('icons')
+
+compiled = gnome.compile_schemas()
+install_data('org.gnome.power-manager.gschema.xml',
+ install_dir : 'share/glib-2.0/schemas'
+)
+
+# replace @VERSION@
+versionedfile = configure_file(
+ input : 'org.gnome.PowerStats.desktop.in.in',
+ output : 'org.gnome.PowerStats.desktop.in',
+ configuration : conf
+)
+i18n.merge_file(
+ input: versionedfile,
+ output: 'org.gnome.PowerStats.desktop',
+ type: 'desktop',
+ po_dir: join_paths(meson.source_root(), 'po'),
+ install: true,
+ install_dir: join_paths(get_option('datadir'), 'applications')
+)
diff --git a/data/org.gnome.PowerStats.desktop.in.in b/data/org.gnome.PowerStats.desktop.in.in
index d0eacf4..e6653e4 100644
--- a/data/org.gnome.PowerStats.desktop.in.in
+++ b/data/org.gnome.PowerStats.desktop.in.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
@@ -12,5 +12,5 @@ StartupNotify=true
X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=gnome-power-manager
X-GNOME-Bugzilla-Component=gnome-power-statistics
-X-GNOME-Bugzilla-Version=@VERSION@
+X-GNOME-Bugzilla-Version=@PACKAGE_VERSION@
X-Desktop-File-Install-Version=0.10
diff --git a/man/meson.build b/man/meson.build
new file mode 100644
index 0000000..24c33e6
--- /dev/null
+++ b/man/meson.build
@@ -0,0 +1,14 @@
+# Copyright (C) 2016 Richard Hughes <richard hughsie com>
+#
+# Licensed under the GNU General Public License Version 2 or later
+
+docbook2man = find_program('docbook2man', required : false)
+if docbook2man.found()
+ custom_target('gnome-power-statistics-man',
+ output : 'gnome-power-statistics.1',
+ input : 'gnome-power-statistics.sgml',
+ command : [docbook2man, '@INPUT@', '--output', 'man'],
+ install : true,
+ install_dir : 'share/man/man1'
+ )
+endif
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..501c444
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,140 @@
+# Copyright (C) 2016 Richard Hughes <richard hughsie com>
+#
+# Licensed under the GNU General Public License Version 2 or later
+
+project('gnome-power-manager', 'c',
+ version : '3.22.3',
+ default_options : ['warning_level=1'],
+ meson_version : '>=0.37.0'
+)
+
+conf = configuration_data()
+conf.set('PACKAGE_VERSION', meson.project_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'
+]
+cc = meson.get_compiler('c')
+foreach arg: test_args
+ if cc.has_argument(arg)
+ add_project_arguments(arg, language : 'c')
+ endif
+endforeach
+
+# enable full RELRO where possible
+# FIXME: until https://github.com/mesonbuild/meson/issues/1140 is fixed
+global_link_args = []
+test_link_args = [
+ '-Wl,-z,relro',
+ '-Wl,-z,now',
+]
+foreach arg: test_link_args
+ if cc.has_argument(arg)
+ global_link_args += arg
+ endif
+endforeach
+add_global_link_arguments(
+ global_link_args,
+ language: 'c'
+)
+
+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)
+
+gnome = import('gnome')
+i18n = import('i18n')
+
+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')))
+configure_file(
+ input : 'config.h.in',
+ output : 'config.h',
+ configuration : conf
+)
+top_build_incdir = include_directories(meson.current_build_dir())
+
+subdir('src')
+subdir('man')
+subdir('po')
+subdir('data')
+
+archiver = find_program('git', required : false)
+if archiver.found()
+ run_target('dist',
+ # git config tar.tar.xz.command "xz -c"
+ command: [
+ 'git', 'archive',
+ '--prefix=' + meson.project_name() + '-' + meson.project_version() + '/',
+ 'HEAD',
+ '--format=tar.xz',
+ '--output',
+ meson.project_name() + '-' + meson.project_version() + '.tar.xz'
+ ]
+ )
+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('NEWS',
+ output : 'NEWS',
+ input : 'data/appdata/org.gnome.PowerStats.appdata.xml.in',
+ command : [appstream_util, 'appdata-to-news', '@INPUT@'],
+ capture : true
+ )
+endif
+
+# 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..04c3a3a
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1 @@
+option('enable-tests', type : 'boolean', value : true, description : 'enable tests')
diff --git a/meson_post_install.sh b/meson_post_install.sh
new file mode 100755
index 0000000..465156b
--- /dev/null
+++ b/meson_post_install.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+# Copyright (C) 2016 Richard Hughes <richard hughsie com>
+#
+# Licensed under the GNU General Public License Version 2 or later
+
+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/LINGUAS b/po/LINGUAS
index 14b4f2c..eb14eaf 100644
--- a/po/LINGUAS
+++ b/po/LINGUAS
@@ -73,7 +73,7 @@ te
tg
th
tr
-ug
+ug
uk
vi
zh_CN
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..4ae4c19
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,10 @@
+# Copyright (C) 2016 Richard Hughes <richard hughsie com>
+#
+# Licensed under the GNU General Public License Version 2 or later
+
+i18n.gettext(meson.project_name(),
+ preset : 'glib',
+ args: [
+ '--default-domain=' + meson.project_name()
+ ]
+)
diff --git a/src/gpm-statistics.c b/src/gpm-statistics.c
index cf18d21..b10a900 100644
--- a/src/gpm-statistics.c
+++ b/src/gpm-statistics.c
@@ -1913,7 +1913,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);
@@ -1932,7 +1932,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");
+ DATADIR 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..49fa9e3
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,62 @@
+# Copyright (C) 2016 Richard Hughes <richard hughsie com>
+#
+# Licensed under the GNU General Public License Version 2 or later
+
+cargs = ['-DG_LOG_DOMAIN="Gpm"']
+
+gnome_power_statistics_resources = gnome.compile_resources(
+ 'gnome-power-statistics-resources',
+ 'gnome-power-manager.gresource.xml',
+ source_dir : '.',
+ c_name : 'gpm'
+)
+
+executable(
+ 'gnome-power-statistics',
+ gnome_power_statistics_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('..'),
+ ],
+ dependencies : [
+ cairo,
+ gdk,
+ gtk,
+ libm,
+ upower
+ ],
+ c_args : cargs,
+ install : true,
+ install_dir : 'bin'
+)
+
+if get_option('enable-tests')
+ e = executable(
+ 'gnome-power-self-test',
+ sources : [
+ 'gpm-array-float.c',
+ 'gpm-array-float.h',
+ 'gpm-self-test.c'
+ ],
+ include_directories : [
+ include_directories('..'),
+ ],
+ dependencies : [
+ cairo,
+ gdk,
+ gtk,
+ libm,
+ upower
+ ],
+ c_args : cargs
+ )
+ test('gnome-power-self-test', e)
+endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]