From 2723b0c6e27c28f5139a031c5f529102bc2fba7d Mon Sep 17 00:00:00 2001 From: George Kiagiadakis Date: Fri, 18 Jun 2021 19:24:28 +0300 Subject: [PATCH] meson: export plugin and data dirs for other projects to find them SPA_PLUGIN_DIR is exported in pkgconfig as 'plugindir' PIPEWIRE_MODULE_DIR is exported as 'moduledir' PIPEWIRE_CONFIG_DIR is exported only in uninstalled environments as 'confdatadir' (not making this public due to the possible upcoming configuration changes in pipewire) All variables are also exported on the meson dependency objects, so that subprojects can find them. Wireplumber can then find them like this: pipewire_moduledir = pipewire_dep.get_variable( pkgconfig: 'moduledir', internal: 'moduledir', default_value: '') ... and this works regardless of whether wireplumber is being configured as a subproject or using the uninstalled pkgconfig files or using the system installation of pipewire. This is required in order to run wireplumber tests in the uninstalled environment with 'meson test' --- spa/meson.build | 6 +++++- src/pipewire/meson.build | 11 ++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/spa/meson.build b/spa/meson.build index e43eb5651..e48d63b78 100644 --- a/spa/meson.build +++ b/spa/meson.build @@ -47,6 +47,7 @@ endif spa_dep = declare_dependency( include_directories : [spa_inc], version : spaversion, + variables : { 'plugindir' : meson.current_build_dir() / 'plugins' } ) pkgconfig.generate(filebase : 'lib@0@'.format(spa_name), @@ -54,6 +55,9 @@ pkgconfig.generate(filebase : 'lib@0@'.format(spa_name), subdirs : spa_name, description : 'Simple Plugin API', version : spaversion, - extra_cflags : '-D_REENTRANT') + extra_cflags : '-D_REENTRANT', + variables : ['plugindir=${libdir}/@0@'.format(spa_name)], + uninstalled_variables : ['plugindir=${prefix}/spa/plugins'], +) meson.override_dependency('lib@0@'.format(spa_name), spa_dep) diff --git a/src/pipewire/meson.build b/src/pipewire/meson.build index ec2f55774..d49677350 100644 --- a/src/pipewire/meson.build +++ b/src/pipewire/meson.build @@ -109,6 +109,10 @@ libpipewire = shared_library(pipewire_name, pipewire_sources, pipewire_dep = declare_dependency(link_with : libpipewire, include_directories : [pipewire_inc, configinc], dependencies : [pthread_lib, atomic_dep, spa_dep], + variables : { + 'moduledir' : meson.current_build_dir() / '..' / 'modules', + 'confdatadir' : meson.current_build_dir() / '..' / 'daemon', + } ) pkgconfig.generate(libpipewire, @@ -119,7 +123,12 @@ pkgconfig.generate(libpipewire, description : 'PipeWire Interface', version : pipewire_version, extra_cflags : '-D_REENTRANT', - variables : ['moduledir=${libdir}/@0@'.format(pipewire_name)]) + variables : ['moduledir=${libdir}/@0@'.format(pipewire_name)], + uninstalled_variables : [ + 'moduledir=${prefix}/src/modules', + 'confdatadir=${prefix}/src/daemon', + ], +) meson.override_dependency('lib@0@'.format(pipewire_name), pipewire_dep)