Discussion:
[pulseaudio-discuss] [PATCH] Port to meson
Jan Tojnar
2018-07-08 02:46:48 UTC
Permalink
---
doc/README.html.in | 8 +++----
doc/html2txt | 2 ++
doc/meson.build | 25 ++++++++++++++++++++
meson.build | 52 ++++++++++++++++++++++++++++++++++++++++++
meson_options.txt | 1 +
po/meson.build | 4 ++++
src/meson.build | 33 +++++++++++++++++++++++++++
src/paprefs.desktop.in | 6 ++---
8 files changed, 124 insertions(+), 7 deletions(-)
create mode 100755 doc/html2txt
create mode 100644 doc/meson.build
create mode 100644 meson.build
create mode 100644 meson_options.txt
create mode 100644 po/meson.build
create mode 100644 src/meson.build

diff --git a/doc/README.html.in b/doc/README.html.in
index 1e0c0fb..4a8051a 100644
--- a/doc/README.html.in
+++ b/doc/README.html.in
@@ -95,10 +95,10 @@ module <tt>module-gsettings</tt> must be loaded in the daemon.</p>

<h2><a name="installation">Installation</a></h2>

-<p>As this package is made with the GNU autotools you should run
-<tt>./configure</tt> inside the distribution directory for configuring
-the source tree. After that you should run <tt>make</tt> for
-compilation and <tt>make install</tt> (as root) for installation of
+<p>As this package is made with the Meson you should run
+<tt>meson build</tt> inside the distribution directory for configuring
+the source tree. After that you should run <tt>ninja -C build</tt> for
+compilation and <tt>ninja install</tt> (as root) for installation of
<tt>paprefs</tt>.</p>

<h2><a name="acks">Acknowledgements</a></h2>
diff --git a/doc/html2txt b/doc/html2txt
new file mode 100755
index 0000000..63e5a20
--- /dev/null
+++ b/doc/html2txt
@@ -0,0 +1,2 @@
+#!/bin/sh
+lynx --dump $1 | sed 's,file://localhost/.*/doc/README.html,README,'
diff --git a/doc/meson.build b/doc/meson.build
new file mode 100644
index 0000000..531cf3b
--- /dev/null
+++ b/doc/meson.build
@@ -0,0 +1,25 @@
+doc_conf = configuration_data()
+doc_conf.set('PACKAGE_VERSION', meson.project_version())
+doc_conf.set('PACKAGE_BUGREPORT', mailing_list)
+doc_conf.set('PACKAGE_URL', homepage)
+
+readme_html = configure_file(
+ input: 'README.html.in',
+ output: 'README.html',
+ configuration: doc_conf,
+)
+
+if tidy.found()
+ test('XHTML documentation uses correct mark-up', tidy, args: ['-e', readme_html])
+endif
+
+if with_lynx
+ custom_target(
+ 'README',
+ input: readme_html,
+ output: 'README',
+ command: [find_program('./html2txt'), '@INPUT@'],
+ capture: true,
+ build_by_default: true,
+ )
+endif
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..d2d002e
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,52 @@
+project('paprefs', 'cpp',
+ license: 'GPL2+',
+ version: '0.9.10',
+ meson_version: '>=0.40.1'
+)
+
+mailing_list = 'pulseaudio-discuss (at) lists (dot) freedesktop (dot) org'
+homepage = 'http://freedesktop.org/software/pulseaudio/paprefs/'
+
+with_lynx = get_option('lynx')
+
+i18n = import('i18n')
+
+gtkmm = dependency('gtkmm-3.0')
+giomm = dependency('giomm-2.4', version: '>= 2.26')
+sigc = dependency('sigc++-2.0')
+dbus_glib = dependency('dbus-glib-1')
+libpulse = dependency('libpulse')
+
+lynx = find_program('lynx', required: with_lynx)
+tidy = find_program('tidy', required: false)
+
+prefix = get_option('prefix')
+bindir = join_paths(prefix, get_option('bindir'))
+localedir = join_paths(prefix, get_option('localedir'))
+datadir = join_paths(prefix, get_option('datadir'))
+pkgdatadir = join_paths(datadir, meson.project_name())
+
+conf = configuration_data()
+
+conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
+conf.set_quoted('GLADE_FILE', join_paths(pkgdatadir, 'paprefs.glade'))
+conf.set_quoted('LOCALEDIR', localedir)
+conf.set_quoted('MODDIR', libpulse.get_pkgconfig_variable('modlibexecdir'))
+# Needs fixing on some borked OS
+conf.set_quoted('SHREXT', '.so')
+
+configure_file(
+ output : 'config.h',
+ configuration : conf
+)
+
+common_flags = [
+ '-DHAVE_CONFIG_H',
+]
+add_project_arguments(common_flags, language: 'cpp')
+
+configuration_inc = include_directories('.')
+
+subdir('src')
+subdir('po')
+subdir('doc')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..a4a9ce8
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1 @@
+option('lynx', type: 'boolean', value: false, description: 'enable documentation generation (using lynx)')
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..2611f29
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,4 @@
+i18n.gettext(
+ meson.project_name(),
+ preset: 'glib',
+ )
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..54740eb
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,33 @@
+paprefs_sources = [
+ 'paprefs.cc',
+]
+
+paprefs_dependencies = [
+ giomm,
+ gtkmm,
+ sigc,
+ dbus_glib,
+ libpulse,
+]
+
+executable(
+ 'paprefs',
+ paprefs_sources,
+ include_directories: configuration_inc,
+ dependencies: paprefs_dependencies,
+ install: true,
+)
+
+desktop_file = i18n.merge_file(
+ input: 'paprefs.desktop.in',
+ output: 'paprefs.desktop',
+ type: 'desktop',
+ po_dir: '../po',
+ install: true,
+ install_dir: join_paths(datadir, 'applications'),
+)
+
+install_data(
+ 'paprefs.glade',
+ install_dir: join_paths(pkgdatadir),
+)
diff --git a/src/paprefs.desktop.in b/src/paprefs.desktop.in
index 113b111..dcab321 100644
--- a/src/paprefs.desktop.in
+++ b/src/paprefs.desktop.in
@@ -1,9 +1,9 @@
[Desktop Entry]
Version=1.0
Encoding=UTF-8
-_Name=PulseAudio Preferences
-_GenericName=Sound Server Preferences
-_Comment=View and modify the configuration of the local sound server
+Name=PulseAudio Preferences
+GenericName=Sound Server Preferences
+Comment=View and modify the configuration of the local sound server
Exec=paprefs
Icon=preferences-desktop
StartupNotify=true
--
2.17.1
Tanu Kaskinen
2018-07-10 12:47:20 UTC
Permalink
Post by Jan Tojnar
---
doc/README.html.in | 8 +++----
doc/html2txt | 2 ++
doc/meson.build | 25 ++++++++++++++++++++
meson.build | 52 ++++++++++++++++++++++++++++++++++++++++++
meson_options.txt | 1 +
po/meson.build | 4 ++++
src/meson.build | 33 +++++++++++++++++++++++++++
src/paprefs.desktop.in | 6 ++---
8 files changed, 124 insertions(+), 7 deletions(-)
create mode 100755 doc/html2txt
create mode 100644 doc/meson.build
create mode 100644 meson.build
create mode 100644 meson_options.txt
create mode 100644 po/meson.build
create mode 100644 src/meson.build
Thanks! Applied. The install command in the readme wasn't quite right,
I fixed that.
--
Tanu

https://liberapay.com/tanuk
https://www.patreon.com/tanuk
Felipe Sateler
2018-07-09 21:04:57 UTC
Permalink
Meson is much nicer than autotools, see
https://wiki.gnome.org/Initiatives/GnomeGoals/MesonPorting.
With this patch, you can invoke
meson build -Ddocs=true
ninja -C build
sudo ninja -C build install
to compile and install the package.
The .desktop file changes would break the autotools build, wouldn't it?. If
a port to meson is desired (I'm not a maintainer, although this gets a +1
from me), then either a workaround should be found, or autotools be dropped
at the same time.
--
Saludos,
Felipe Sateler
Jan Tojnar
2018-07-10 13:12:38 UTC
Permalink
It will build fine, only the translations will not be merged back to
the produced desktop file. Solution would be porting the autotools code
from intltool to vanilla gettext (see
https://wiki.gnome.org/Initiatives/GnomeGoals/GettextMigration) but
autotools removal will be easier.
Post by Felipe Sateler
Meson is much nicer than autotools, see
https://wiki.gnome.org/Initiatives/GnomeGoals/MesonPorting.
With this patch, you can invoke
meson build -Ddocs=true
ninja -C build
sudo ninja -C build install
to compile and install the package.
The .desktop file changes would break the autotools build, wouldn't
it?. If a port to meson is desired (I'm not a maintainer, although
this gets a +1 from me), then either a workaround should be found, or
autotools be dropped at the same time.
--
Saludos,
Felipe Sateler
Tanu Kaskinen
2018-07-15 07:42:54 UTC
Permalink
Post by Jan Tojnar
It will build fine, only the translations will not be merged back to
the produced desktop file. Solution would be porting the autotools code
from intltool to vanilla gettext (see
https://wiki.gnome.org/Initiatives/GnomeGoals/GettextMigration) but
autotools removal will be easier.
We need some solution to this, and it seems that removing the autotools
build system would be ok. Do you want to make a patch, or should I do
it?
--
Tanu

https://www.patreon.com/tanuk
https://liberapay.com/tanuk
Jan Tojnar
2018-07-15 09:38:09 UTC
Permalink
Post by Tanu Kaskinen
e need some solution to this, and it seems that removing the autotools
build system would be ok. Do you want to make a patch, or should I do
it?
It would be nice if you could remove it.

Loading...