From e493be38440b6858b188a4467b6578aba87ffdfe Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 3 Jun 2020 11:03:35 +0100 Subject: [PATCH] scripts: Use special ${LIB} token for architecture-independence On GNU/Linux systems, the literal string '${LIB}' in dynamic linker paths expands to "lib", a biarch libQUAL directory such as "lib64", or a Debian-style multiarch directory such as "lib/x86_64-linux-gnu". If we're installing libraries to such a directory, and we have both word-sizes' compatibility libraries available, then pw-pulse can use LD_LIBRARY_PATH='/usr/${LIB}/pipewire-0.3/pulse' to make both i386 and x86_64 programs load the correct version. Signed-off-by: Simon McVittie --- meson.build | 15 +++++++++++++++ pipewire-jack/src/meson.build | 5 ++++- pipewire-pulseaudio/src/meson.build | 5 ++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index d758f0185..1301a3f80 100644 --- a/meson.build +++ b/meson.build @@ -35,6 +35,21 @@ pipewire_sysconfdir = join_paths(prefix, get_option('sysconfdir')) pipewire_configdir = join_paths(pipewire_sysconfdir, 'pipewire') modules_install_dir = join_paths(pipewire_libdir, pipewire_name) + +if host_machine.system() == 'linux' + # glibc ld.so interprets ${LIB} in a library loading path with an + # appropriate value for the current architecture, typically something + # like lib, lib64 or lib/x86_64-linux-gnu. + # This allows the same pw-pulse script to work for both 32- and 64-bit + # applications on biarch/multiarch distributions, by setting something + # like LD_LIBRARY_PATH='/usr/${LIB}/pipewire-0.3/pulse'. + # Note that ${LIB} is a special token expanded by the runtime linker, + # not an environment variable, and must be passed through literally. + modules_install_dir_dlopen = join_paths(prefix, '${LIB}', pipewire_name) +else + modules_install_dir_dlopen = modules_install_dir +endif + spa_plugindir = join_paths(pipewire_libdir, spa_name) pipewire_headers_dir = join_paths(pipewire_name, 'pipewire') diff --git a/pipewire-jack/src/meson.build b/pipewire-jack/src/meson.build index 23c2d8a22..0ea26143b 100644 --- a/pipewire-jack/src/meson.build +++ b/pipewire-jack/src/meson.build @@ -20,10 +20,13 @@ jack_dep = dependency('jack', version : '>= 1.9.10', required : false) libjack_path = get_option('libjack-path') if libjack_path == '' libjack_path = join_paths(modules_install_dir, 'jack') + libjack_path_dlopen = join_paths(modules_install_dir_dlopen, 'jack') +else + libjack_path_dlopen = libjack_path endif tools_config = configuration_data() -tools_config.set('LIBJACK_PATH', libjack_path) +tools_config.set('LIBJACK_PATH', libjack_path_dlopen) configure_file(input : 'pw-jack.in', output : 'pw-jack', diff --git a/pipewire-pulseaudio/src/meson.build b/pipewire-pulseaudio/src/meson.build index d700d2d9b..332824f6d 100644 --- a/pipewire-pulseaudio/src/meson.build +++ b/pipewire-pulseaudio/src/meson.build @@ -51,10 +51,13 @@ vflag = '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), mapfil libpulse_path = get_option('libpulse-path') if libpulse_path == '' libpulse_path = join_paths(modules_install_dir, 'pulse') + libpulse_path_dlopen = join_paths(modules_install_dir_dlopen, 'pulse') +else + libpulse_path_dlopen = libpulse_path endif tools_config = configuration_data() -tools_config.set('LIBPULSE_PATH', libpulse_path) +tools_config.set('LIBPULSE_PATH', libpulse_path_dlopen) configure_file(input : 'pw-pulse.in', output : 'pw-pulse',