diff --git a/lib/wp/base-dirs.c b/lib/wp/base-dirs.c index 5121e5f0..e1782ed2 100644 --- a/lib/wp/base-dirs.c +++ b/lib/wp/base-dirs.c @@ -8,6 +8,8 @@ #include "base-dirs.h" #include "log.h" +#include "wpversion.h" +#include "wpbuildbasedirs.h" WP_DEFINE_LOCAL_LOG_TOPIC ("wp-base-dirs") @@ -99,8 +101,7 @@ lookup_dirs (guint flags, gboolean is_absolute) } } if (flags & WP_BASE_DIRS_BUILD_SYSCONFDIR) { - g_ptr_array_add (dirs, - g_canonicalize_filename (WIREPLUMBER_DEFAULT_CONFIG_DIR, NULL)); + g_ptr_array_add (dirs, g_canonicalize_filename (subdir, BUILD_SYSCONFDIR)); } if (flags & WP_BASE_DIRS_XDG_DATA_DIRS) { const gchar * const *xdg_dirs = g_get_system_data_dirs (); @@ -109,12 +110,12 @@ lookup_dirs (guint flags, gboolean is_absolute) } } if (flags & WP_BASE_DIRS_BUILD_DATADIR) { - g_ptr_array_add (dirs, - g_canonicalize_filename(WIREPLUMBER_DEFAULT_DATA_DIR, NULL)); + g_ptr_array_add (dirs, g_canonicalize_filename (subdir, BUILD_DATADIR)); } if (flags & WP_BASE_DIRS_BUILD_LIBDIR) { - g_ptr_array_add (dirs, - g_canonicalize_filename (WIREPLUMBER_DEFAULT_MODULE_DIR, NULL)); + subdir = (flags & WP_BASE_DIRS_FLAG_SUBDIR_WIREPLUMBER) ? + "wireplumber-" WIREPLUMBER_API_VERSION : "."; + g_ptr_array_add (dirs, g_canonicalize_filename (subdir, BUILD_LIBDIR)); } } diff --git a/lib/wp/meson.build b/lib/wp/meson.build index 399d195e..333d8212 100644 --- a/lib/wp/meson.build +++ b/lib/wp/meson.build @@ -111,15 +111,21 @@ wpversion = configure_file( ) wp_gen_sources += [wpversion] +wpbuildbasedirs_data = configuration_data() +wpbuildbasedirs_data.set('BUILD_SYSCONFDIR', '"@0"'.format(get_option('prefix') / get_option('sysconfdir'))) +wpbuildbasedirs_data.set('BUILD_DATADIR', '"@0"'.format(get_option('prefix') / get_option('datadir'))) +wpbuildbasedirs_data.set('BUILD_LIBDIR', '"@0"'.format(get_option('prefix') / get_option('libdir'))) +wpbuildbasedirs_data.set('BUILD_LOCALEDIR', '"@0"'.format(get_option('prefix') / get_option('localedir'))) +wpbuildbasedirs = configure_file ( + output : 'wpbuildbasedirs.h', + configuration : wpbuildbasedirs_data, +) + wp_lib = library('wireplumber-' + wireplumber_api_version, - wp_lib_sources, wp_lib_priv_sources, wpenums_c, wpenums_h, wpversion, + wp_lib_sources, wp_lib_priv_sources, wpenums_c, wpenums_h, wpversion, wpbuildbasedirs, c_args : [ '-D_GNU_SOURCE', '-DG_LOG_USE_STRUCTURED', - '-DWIREPLUMBER_DEFAULT_MODULE_DIR="@0@"'.format(wireplumber_module_dir), - '-DWIREPLUMBER_DEFAULT_CONFIG_DIR="@0@"'.format(wireplumber_config_dir), - '-DWIREPLUMBER_DEFAULT_DATA_DIR="@0@"'.format(wireplumber_data_dir), - '-DLOCALE_DIR="@0@"'.format(wireplumber_locale_dir), '-DBUILDING_WP', ], install: true, diff --git a/lib/wp/wp.c b/lib/wp/wp.c index 6d3e9a72..924b8ab1 100644 --- a/lib/wp/wp.c +++ b/lib/wp/wp.c @@ -9,6 +9,7 @@ #include "wp.h" #include #include +#include "wpbuildbasedirs.h" WP_DEFINE_LOCAL_LOG_TOPIC ("wp") @@ -39,7 +40,7 @@ wp_init (WpInitFlags flags) if (flags & WP_INIT_SPA_TYPES) wp_spa_dynamic_type_init (); - bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR); + bindtextdomain (GETTEXT_PACKAGE, BUILD_LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); /* ensure WpProxy subclasses are loaded, which is needed to be able