build-sys: Add a meson-based build systeom

The only missing feature for parity with autotools is generating a text
README using lynx. I think this might be okay to skip as it seems
unnecessary as a dependency.
This commit is contained in:
Arun Raghavan 2022-01-14 18:35:55 -05:00
parent 791c1055d4
commit 805d6522c6
8 changed files with 197 additions and 0 deletions

1
.gitignore vendored
View File

@ -12,6 +12,7 @@ config.h.in
config.log config.log
config.status config.status
configure configure
build
depcomp depcomp
README README
README.html README.html

2
doc/html2txt Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
lynx --dump $1 | sed 's,file://localhost/.*/doc/README.html,README,'

34
doc/meson.build Normal file
View File

@ -0,0 +1,34 @@
doc_cdata = configuration_data()
doc_cdata.set('PACKAGE_VERSION', meson.project_version())
doc_cdata.set('PACKAGE_URL', 'http://freedesktop.org/software/pulseaudio/pavucontrol/')
readme_html = configure_file(
input : 'README.html.in',
output : 'README.html',
configuration : doc_cdata,
install : true,
install_dir : docdir,
)
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,
install : true,
install_dir : docdir,
)
endif
install_data(
sources : 'style.css',
install_dir : docdir,
)

41
meson.build Normal file
View File

@ -0,0 +1,41 @@
project('pavucontrol', 'cpp',
version : '5.0',
meson_version : '>= 0.50.0',
default_options : [ 'c_std=gnu11', 'cpp_std=c++11' ]
)
with_lynx = get_option('lynx')
gtkmm_dep = dependency('gtkmm-3.0', version : '>= 3.0', required : true)
sigcpp_dep = dependency('sigc++-2.0', required : true)
canberragtk_dep = dependency('libcanberra-gtk3', version : '>= 0.16', required : true)
libpulse_dep = dependency('libpulse', version : '>= 5.0', required : true)
libpulsemlglib_dep = dependency('libpulse-mainloop-glib', version : '>= 0.9.16', required : true)
lynx = find_program('lynx', required: with_lynx)
tidy = find_program('tidy', required: false)
configinc = include_directories('.')
prefix = get_option('prefix')
datadir = join_paths(prefix, get_option('datadir'))
docdir = join_paths(datadir, 'doc', 'pavucontrol')
localedir = join_paths(prefix, get_option('localedir'))
cdata = configuration_data()
cdata.set('ENABLE_NLS', 1)
cdata.set_quoted('PACKAGE', 'pavucontrol')
cdata.set_quoted('PACKAGE_NAME', 'pavucontrol')
cdata.set_quoted('PACKAGE_STRING', 'pavucontrol')
cdata.set_quoted('PACKAGE_VERSION', meson.project_version())
cdata.set_quoted('GETTEXT_PACKAGE', 'pavucontrol')
cdata.set_quoted('LOCALEDIR', localedir)
cdata.set_quoted('GLADE_FILE', join_paths(datadir, 'pavucontrol', 'pavucontrol.glade'))
# Now generate config.h from everything above
configure_file(output : 'config.h', configuration : cdata)
subdir('doc')
subdir('po')
subdir('src')

3
meson_options.txt Normal file
View File

@ -0,0 +1,3 @@
option('lynx',
type : 'boolean', value : true,
description : 'Enable building of the README text file for installation')

78
po/Makevars Normal file
View File

@ -0,0 +1,78 @@
# Makefile variables for PO directory in any package using GNU gettext.
# Usually the message domain is the same as the package name.
DOMAIN = $(PACKAGE)
# These two variables depend on the location of this directory.
subdir = po
top_builddir = ..
# These options get passed to xgettext.
XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ --from-code=UTF-8
# This is the copyright holder that gets inserted into the header of the
# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
# package. (Note that the msgstr strings, extracted from the package's
# sources, belong to the copyright holder of the package.) Translators are
# expected to transfer the copyright for their translations to this person
# or entity, or to disclaim their copyright. The empty string stands for
# the public domain; in this case the translators are expected to disclaim
# their copyright.
COPYRIGHT_HOLDER = PulseAudio contributors
# This tells whether or not to prepend "GNU " prefix to the package
# name that gets inserted into the header of the $(DOMAIN).pot file.
# Possible values are "yes", "no", or empty. If it is empty, try to
# detect it automatically by scanning the files in $(top_srcdir) for
# "GNU packagename" string.
PACKAGE_GNU =
# This is the email address or URL to which the translators shall report
# bugs in the untranslated strings:
# - Strings which are not entire sentences, see the maintainer guidelines
# in the GNU gettext documentation, section 'Preparing Strings'.
# - Strings which use unclear terms or require additional context to be
# understood.
# - Strings which make invalid assumptions about notation of date, time or
# money.
# - Pluralisation problems.
# - Incorrect English spelling.
# - Incorrect formatting.
# It can be your email address, or a mailing list address where translators
# can write to without being subscribed, or the URL of a web page through
# which the translators can contact you.
MSGID_BUGS_ADDRESS =
# This is the list of locale categories, beyond LC_MESSAGES, for which the
# message catalogs shall be used. It is usually empty.
EXTRA_LOCALE_CATEGORIES =
# This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt'
# context. Possible values are "yes" and "no". Set this to yes if the
# package uses functions taking also a message context, like pgettext(), or
# if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.
USE_MSGCTXT = no
# These options get passed to msgmerge.
# Useful options are in particular:
# --previous to keep previous msgids of translated messages,
# --quiet to reduce the verbosity.
MSGMERGE_OPTIONS =
# These options get passed to msginit.
# If you want to disable line wrapping when writing PO files, add
# --no-wrap to MSGMERGE_OPTIONS, XGETTEXT_OPTIONS, and
# MSGINIT_OPTIONS.
MSGINIT_OPTIONS =
# This tells whether or not to regenerate a PO file when $(DOMAIN).pot
# has changed. Possible values are "yes" and "no". Set this to no if
# the POT file is checked in the repository and the version control
# program ignores timestamps.
PO_DEPENDS_ON_POT = no
# This tells whether or not to forcibly update $(DOMAIN).pot and
# regenerate PO files on "make dist". Possible values are "yes" and
# "no". Set this to no if the POT file and PO files are maintained
# externally.
DIST_DEPENDS_ON_UPDATE_PO = no

4
po/meson.build Normal file
View File

@ -0,0 +1,4 @@
i18n = import('i18n')
i18n.gettext(meson.project_name(), preset: 'glib')
po_dir = meson.current_source_dir()

34
src/meson.build Normal file
View File

@ -0,0 +1,34 @@
pavucontrol_sources = [
'cardwidget.cc',
'channelwidget.cc',
'devicewidget.cc',
'mainwindow.cc',
'minimalstreamwidget.cc',
'pavuapplication.cc',
'pavucontrol.cc',
'rolewidget.cc',
'sinkinputwidget.cc',
'sinkwidget.cc',
'sourceoutputwidget.cc',
'sourcewidget.cc',
'streamwidget.cc',
]
executable('pavucontrol',
pavucontrol_sources,
install: true,
cpp_args: ['-DHAVE_CONFIG_H'],
include_directories : configinc,
dependencies : [gtkmm_dep, sigcpp_dep, canberragtk_dep, libpulse_dep, libpulsemlglib_dep],
)
install_data('pavucontrol.glade')
desktop_file = i18n.merge_file(
input : 'pavucontrol.desktop.in',
output : 'pavucontrol.desktop',
po_dir : po_dir,
type : 'desktop',
install : true,
install_dir : join_paths(datadir, 'applications'),
)