refactor datadir, install completions, dbus service activation

This commit is contained in:
Tony Crisci
2020-01-24 11:33:07 -05:00
parent dea63c0ee2
commit 1debe0e409
10 changed files with 45 additions and 19 deletions

28
data/meson.build Normal file
View File

@@ -0,0 +1,28 @@
application_id = 'org.mpris.MediaPlayer2.playerctld'
service_conf = configuration_data()
service_conf.set('application_id', application_id)
service_conf.set('bindir', bindir)
service_conf.set('prefix', prefix)
service = application_id + '.service'
configure_file(
input: service + '.in',
output: service,
install: true,
install_dir: join_paths(datadir, 'dbus-1', 'services'),
configuration: service_conf
)
if get_option('bash-completions')
bash_files = files(
'playerctl.bash',
)
if bash_comp.found()
bash_install_dir = bash_comp.get_pkgconfig_variable('completionsdir')
else
bash_install_dir = join_paths(datadir, 'bash-completion', 'completions')
endif
install_data(bash_files, install_dir: bash_install_dir)
endif

View File

@@ -0,0 +1,3 @@
[D-BUS Service]
Name=@application_id@
Exec=@prefix@/@bindir@/playerctld

View File

@@ -10,6 +10,10 @@ release_date = 'March 26, 2019'
gnome = import('gnome')
pkgconfig = import('pkgconfig')
datadir = get_option('datadir')
bindir = get_option('bindir')
prefix = get_option('prefix')
version_conf = configuration_data()
playerctl_version = meson.project_version().split('-')[0]
@@ -40,6 +44,8 @@ version_conf.set(
gobject_dep = dependency('gobject-2.0', version: '>=2.38')
gio_dep = dependency('gio-unix-2.0')
glib_dep = dependency('glib-2.0')
bash_comp = dependency('bash-completion', required: false)
subdir('playerctl')
subdir('data')
subdir('doc')

View File

@@ -1,2 +1,3 @@
option('gtk-doc', type: 'boolean', value: true, description: 'build docs')
option('introspection', type: 'boolean', value: true, description: 'build gir data')
option('bash-completions', type: 'boolean', value: true, description: 'Install bash shell completions.')

View File

@@ -9,7 +9,7 @@ configuration_inc = include_directories('..')
playerctl_generated = gnome.gdbus_codegen(
'playerctl-generated',
'mpris-dbus-interface.xml',
join_paths(meson.source_root(), 'data', 'mpris-dbus-interface.xml'),
)
headers = [
@@ -48,8 +48,8 @@ deps = [
gio_dep,
]
symbols_file = 'playerctl.syms'
symbols_flag = '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), symbols_file)
symbols_file = join_paths(meson.source_root(), 'data', 'playerctl.syms')
symbols_flag = '-Wl,--version-script,@0@'.format(symbols_file)
playerctl_lib = both_libraries(
'playerctl',

View File

@@ -130,12 +130,12 @@ static void proxy_method_call_async_callback(GObject *source_object, GAsyncResul
if (g_variant_n_children(body) > 1) {
GVariant *error_message_variant = g_variant_get_child_value(body, 1);
const char *error_message = g_variant_get_string(error_message_variant, 0);
g_dbus_method_invocation_return_dbus_error(invocation, g_dbus_message_get_error_name(reply),
error_message);
g_dbus_method_invocation_return_dbus_error(
invocation, g_dbus_message_get_error_name(reply), error_message);
g_variant_unref(error_message_variant);
} else {
g_dbus_method_invocation_return_dbus_error(invocation, g_dbus_message_get_error_name(reply),
"Failed to call method");
g_dbus_method_invocation_return_dbus_error(
invocation, g_dbus_message_get_error_name(reply), "Failed to call method");
}
break;
}

View File

@@ -1,12 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: Playerctl
Description: A C library for MPRIS players
Version: @VERSION@
Libs: -L${libdir} -lplayerctl-1.0
Cflags: -I${includedir}/playerctl
Requires: gobject-2.0
Requires.private: gio-2.0