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'
This commit is contained in:
George Kiagiadakis 2021-06-18 19:24:28 +03:00
parent 9e0ce7cbd6
commit 2723b0c6e2
2 changed files with 15 additions and 2 deletions

View file

@ -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)

View file

@ -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)