base-dirs: tidy up the build-time base dirs and honor the SUBDIR_WIREPLUMBER flag
Add a new private header file, wpbuildbasedirs.h, that contains the build-time base directories passed directly from meson, without the "wireplumber" suffix. Use this to set the WP_BASE_DIRS_BUILD_* and adjust the code to honor the SUBDIR_WIREPLUMBER flag.
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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,
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#include "wp.h"
|
||||
#include <pipewire/pipewire.h>
|
||||
#include <libintl.h>
|
||||
#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
|
||||
|
Reference in New Issue
Block a user