wp-uninstalled: build this script with the meson dirs filled in

./builddir/wp-uninstalled.sh can now be called without a -b argument,
it'll automatically set the full paths. This is useful when building as
a subproject.

meson has a limitation: the configure_file() object is just a file
wrapper object. Wrap this into a custom_target() whose return value has
a full_path() method. This way, pipewire can use
wireplumber_uninstalled.full_path() without having to build the
directory structure itself.
This commit is contained in:
Peter Hutterer 2021-10-13 11:01:53 +10:00 committed by George Kiagiadakis
parent e9b1ab41ee
commit 52aaf96179
2 changed files with 26 additions and 2 deletions

View file

@ -118,3 +118,21 @@ subdir('src')
if get_option('tests')
subdir('tests')
endif
conf_uninstalled = configuration_data()
conf_uninstalled.set('MESON', '')
conf_uninstalled.set('MESON_SOURCE_ROOT', meson.project_source_root())
conf_uninstalled.set('MESON_BUILD_ROOT', meson.project_build_root())
wp_uninstalled = configure_file(
input : 'wp-uninstalled.sh',
output : 'wp-uninstalled.sh.in',
configuration : conf_uninstalled,
)
wireplumber_uninstalled = custom_target('wp-uninstalled',
output : 'wp-uninstalled.sh',
input : wp_uninstalled,
build_by_default : true,
command : ['cp', '@INPUT@', '@OUTPUT@'],
)

View file

@ -2,8 +2,14 @@
set -e
SOURCEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
BUILDDIR=${SOURCEDIR}/build
# This is unset by meson
if [ -z "@MESON@" ]; then
SOURCEDIR="@MESON_SOURCE_ROOT@"
BUILDDIR="@MESON_BUILD_ROOT@"
else
SOURCEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
BUILDDIR=${SOURCEDIR}/build
fi
CONFIGDIR=config
while getopts ":b:c:" opt; do