meson.build: install symbolic links instead of compiling multiple times

Currently, among others, the `pipewire-pulse` executable is an
exact copy of the `pipewire` executable. Use meson's
`install_symlink()` to avoid the need for compiling the same thing
multiple times. Also use `custom_target()` so that the aliases
are available in an uninstalled environment.

Do the same for `pw-cat`. The benefit is that all aliases
of `pw-cat` are now available in an uninstalled environment.

This commit increasese the minimum meson version to 0.61.1
as that is needed for `install_symlink()`.

The reason for using 0.61.1 instead of 0.61.0 is the following bug:
https://github.com/mesonbuild/meson/issues/9820
This commit is contained in:
Barnabás Pőcze 2023-03-10 01:13:09 +01:00
parent f3230ca2e6
commit 1ef43a5255
3 changed files with 32 additions and 29 deletions

View file

@ -58,16 +58,26 @@ if get_option('pw-cat').allowed() and sndfile_dep.found()
'pw-encplay',
]
executable('pw-cat',
pw_cat = executable('pw-cat',
pwcat_sources,
install: true,
dependencies : [pwcat_deps, pipewire_dep, mathlib],
)
foreach alias : pwcat_aliases
dst = pipewire_bindir / alias
cmd = 'ln -fs @0@ $DESTDIR@1@'.format('pw-cat', dst)
meson.add_install_script('sh', '-c', cmd)
custom_target(
alias,
build_by_default: true,
install: false,
command: [ln, '-sf', meson.project_build_root() + '/@INPUT@', '@OUTPUT@'],
input: pw_cat,
output: alias,
)
install_symlink(
alias,
pointing_to: pw_cat.name(),
install_dir: pipewire_bindir,
)
endforeach
elif not sndfile_dep.found() and get_option('pw-cat').enabled()
error('pw-cat is enabled but required dependency `sndfile` was not found.')