Commit 98fe3228 authored by George Kiagiadakis's avatar George Kiagiadakis

meson: export the module & config dirs to the C code

This allows loading of config and modules when deployed in
the target system without setting environment variables.
parent 0e01895d
......@@ -26,7 +26,8 @@ wp_lib = library('wireplumber-' + wireplumber_api_version,
c_args : [
'-D_GNU_SOURCE',
'-DG_LOG_USE_STRUCTURED',
'-DG_LOG_DOMAIN="libwireplumber"'
'-DG_LOG_DOMAIN="libwireplumber"',
'-DWIREPLUMBER_DEFAULT_MODULE_DIR="@0@"'.format(wireplumber_module_dir),
],
install: true,
include_directories: wp_lib_include_dir,
......
......@@ -56,9 +56,12 @@ wp_module_class_init (WpModuleClass * klass)
static const gchar *
get_module_dir (void)
{
const gchar *module_dir = NULL;
if (!module_dir)
static const gchar *module_dir = NULL;
if (!module_dir) {
module_dir = g_getenv ("WIREPLUMBER_MODULE_DIR");
if (!module_dir)
module_dir = WIREPLUMBER_DEFAULT_MODULE_DIR;
}
return module_dir;
}
......
......@@ -11,9 +11,17 @@ project('wireplumber', ['c'],
wireplumber_api_version = '0.1'
wireplumber_so_version = '0'
modules_install_dir = join_paths(
get_option('libdir'), 'wireplumber-' + wireplumber_api_version
)
if get_option('libdir').startswith('/')
wireplumber_module_dir = join_paths(get_option('libdir'), 'wireplumber-' + wireplumber_api_version)
else
wireplumber_module_dir = join_paths(get_option('prefix'), get_option('libdir'), 'wireplumber-' + wireplumber_api_version)
endif
if get_option('sysconfdir').startswith('/')
wireplumber_config_dir = join_paths(get_option('sysconfdir'), 'wireplumber')
else
wireplumber_config_dir = join_paths(get_option('prefix'), get_option('sysconfdir'), 'wireplumber')
endif
gobject_dep = dependency('gobject-2.0')
gmodule_dep = dependency('gmodule-2.0')
......
......@@ -14,7 +14,7 @@ shared_library(
],
c_args : [common_c_args, '-DG_LOG_DOMAIN="m-pipewire"'],
install : true,
install_dir : modules_install_dir,
install_dir : wireplumber_module_dir,
dependencies : [wp_dep, pipewire_dep],
)
......@@ -25,7 +25,7 @@ shared_library(
],
c_args : [common_c_args, '-DG_LOG_DOMAIN="m-pw-alsa-udev"'],
install : true,
install_dir : modules_install_dir,
install_dir : wireplumber_module_dir,
dependencies : [wp_dep, pipewire_dep],
)
......@@ -36,6 +36,6 @@ shared_library(
],
c_args : [common_c_args, '-DG_LOG_DOMAIN="m-pw-audio-softdsp-endpoint"'],
install : true,
install_dir : modules_install_dir,
install_dir : wireplumber_module_dir,
dependencies : [wp_dep, pipewire_dep],
)
......@@ -10,8 +10,6 @@
#include <gio/gio.h>
#include <glib-unix.h>
#define WIREPLUMBER_DEFAULT_CONFIG_FILE "wireplumber.conf"
static GOptionEntry entries[] =
{
{ NULL }
......
......@@ -2,17 +2,19 @@ wp_sources = [
'main.c',
]
wireplumber_config_file = join_paths(wireplumber_config_dir, 'wireplumber.conf')
install_data('wireplumber.conf',
install_dir: wireplumber_config_dir
)
executable('wireplumber',
wp_sources,
c_args : [
'-D_GNU_SOURCE',
'-DG_LOG_USE_STRUCTURED',
'-DG_LOG_DOMAIN="wireplumber"'
'-DG_LOG_DOMAIN="wireplumber"',
'-DWIREPLUMBER_DEFAULT_CONFIG_FILE="@0@"'.format(wireplumber_config_file),
],
install: true,
dependencies : [gobject_dep, gio_dep, wp_dep],
)
install_data('wireplumber.conf',
install_dir: join_paths(get_option('sysconfdir'), 'wireplumber')
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment