From 35bd2e70f94866ce7128123d0f369c9048f3da22 Mon Sep 17 00:00:00 2001 From: Arnaud Rebillout Date: Sun, 21 Oct 2018 15:39:30 +0700 Subject: [PATCH] meson: Add optional GSettings support Signed-off-by: Arnaud Rebillout --- meson.build | 8 ++++++ meson_options.txt | 3 +++ src/modules/gsettings/meson.build | 37 +++++++++++++++++++++++++++ src/modules/gsettings/post-install.sh | 9 +++++++ src/modules/meson.build | 9 +++++++ 5 files changed, 66 insertions(+) create mode 100644 src/modules/gsettings/meson.build create mode 100755 src/modules/gsettings/post-install.sh diff --git a/meson.build b/meson.build index 1b825975c..4fed0441d 100644 --- a/meson.build +++ b/meson.build @@ -39,10 +39,13 @@ assert(prefix.startswith('/'), 'Prefix is not absolute: "@0@"'.format(prefix)) bindir = join_paths(prefix, get_option('bindir')) libdir = join_paths(prefix, get_option('libdir')) +libexecdir = join_paths(prefix, get_option('libexecdir')) datadir = join_paths(prefix, get_option('datadir')) localstatedir = join_paths(prefix, get_option('localstatedir')) sysconfdir = join_paths(prefix, get_option('sysconfdir')) +pulselibexecdir = join_paths(libexecdir, 'pulse') + pulsedspdir = get_option('pulsedspdir') if pulsedspdir == '' join_paths(libdir, 'pulseaudio') @@ -230,6 +233,11 @@ if dbus_dep.found() cdata.set('HAVE_DBUS', 1) endif +gio_dep = dependency('gio-2.0', version : '>= 2.26.0', required : get_option('gsettings')) +if gio_dep.found() + cdata.set('HAVE_GSETTINGS', 1) +endif + glib_dep = dependency('glib-2.0', version : '>= 2.4.0', required: get_option('glib')) if glib_dep.found() cdata.set('HAVE_GLIB', 1) diff --git a/meson_options.txt b/meson_options.txt index a5e76f528..3d73a8af1 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -41,6 +41,9 @@ option('fftw', option('glib', type : 'feature', value : 'auto', description : 'Optional GLib 2 support') +option('gsettings', + type : 'feature', value : 'auto', + description : 'Optional GSettings support') option('gtk', type : 'feature', value : 'auto', description : 'Optional Gtk+ 3 support') diff --git a/src/modules/gsettings/meson.build b/src/modules/gsettings/meson.build new file mode 100644 index 000000000..7a0a0341a --- /dev/null +++ b/src/modules/gsettings/meson.build @@ -0,0 +1,37 @@ +# GSettings helper + +gsettings_helper_sources = [ + 'gsettings-helper.c', +] + +gsettings_helper = executable('gsettings-helper', + gsettings_helper_sources, + c_args : pa_c_args, + include_directories : [configinc, topinc], + link_with : [libpulsecommon, libpulse], + dependencies : [gio_dep], + install_dir : pulselibexecdir, + install : true, +) + +# GSettings schemas + +compile_schemas = find_program('glib-compile-schemas', required : false) +if compile_schemas.found() + test('Validate schema files in ' + meson.current_source_dir(), + compile_schemas, + args: ['--strict', '--dry-run', meson.current_source_dir()] + ) +endif + +install_data('org.freedesktop.pulseaudio.gschema.xml', + install_dir : join_paths(datadir, 'glib-2.0', 'schemas') +) + +meson.add_install_script('post-install.sh', datadir) + +# Conversion from GConf to GSettings + +install_data('pulseaudio.convert', + install_dir : join_paths(datadir, 'GConf', 'gsettings') +) diff --git a/src/modules/gsettings/post-install.sh b/src/modules/gsettings/post-install.sh new file mode 100755 index 000000000..026204671 --- /dev/null +++ b/src/modules/gsettings/post-install.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +set -e +set -u + +DATADIR="$1" + +echo "Compiling GSettings schemas..." +glib-compile-schemas "$DATADIR/glib-2.0/schemas" diff --git a/src/modules/meson.build b/src/modules/meson.build index 90cfabd36..8be0021d8 100644 --- a/src/modules/meson.build +++ b/src/modules/meson.build @@ -137,6 +137,15 @@ if dbus_dep.found() and fftw_dep.found() ] endif +if gio_dep.found() + subdir('gsettings') + all_modules += [ + [ 'module-gsettings', + [ 'gsettings/module-gsettings.c', 'stdin-util.c', 'stdin-util.h' ], + [], ['-DPA_GSETTINGS_HELPER="' + pulselibexecdir + 'gsettings-helper"'] ] + ] +endif + if jack_dep.found() all_modules += [ [ 'module-jack-sink', 'jack/module-jack-sink.c', [], [], [jack_dep] ], -- 2.34.1