meson: Add -Wl,-rpath,${libdir} on macOS

We made the gstreamer installation prefix relocatable by picking up
plugins relative to the location of libgstreamer-1.0.dylib, similar to
how it's done for Windows:

https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1627

This had a lot of side-effects:

https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1051
https://gitlab.freedesktop.org/gstreamer/cerbero/-/issues/363
https://gitlab.freedesktop.org/gstreamer/cerbero/-/issues/371
https://gitlab.freedesktop.org/gstreamer/cerbero/-/issues/362

A partial fix for the cerbero side of these was:

https://gitlab.freedesktop.org/gstreamer/cerbero/-/merge_requests/807

However, this relied on the consumers knowing that they need to add
`LC_RPATH` entries to the libdir of the prefix. This is done
automatically by build systems like Meson, but not by others, such as
Autotools, CMake, Cargo, XCode, etc. For those, we need to add the
RPATH entries to the gstreamer-1.0.pc file.

This also has the side-effect of fixing the loading of gstreamer rust
plugins on macOS:

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1159

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1149

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2218>
This commit is contained in:
Nirbheek Chauhan 2022-04-18 15:44:47 +05:30 committed by GStreamer Marge Bot
parent c4255f08f7
commit 97655eb8ac
3 changed files with 6 additions and 1 deletions

View file

@ -24,6 +24,7 @@ library_def = {'lib': gstsdp}
pkg_name = 'gstreamer-sdp-1.0'
sdp_gen_sources = []
pkgconfig.generate(gstsdp,
libraries : [gst_dep],
variables : pkgconfig_variables,
subdirs : pkgconfig_subdirs,
name : pkg_name,

View file

@ -259,7 +259,7 @@ libgst = library('gstreamer-1.0', gst_sources,
pkg_name = 'gstreamer-1.0'
library_def = {'lib': libgst}
pkgconfig.generate(libgst,
libraries : [glib_dep, gobject_dep],
libraries : [glib_dep, gobject_dep] + pkgconfig_libs,
variables : pkgconfig_variables,
uninstalled_variables: pkgconfig_uninstalled_variables,
subdirs : pkgconfig_subdirs,

View file

@ -616,6 +616,10 @@ pkgconfig_uninstalled_variables = ['exec_prefix=${prefix}',
'bashhelpersdir=${gstreamerdir}/data/bash-completion/helpers',
'helpersdir=${gstreamerdir}/libs/gst/helpers']
pkgconfig_subdirs = ['gstreamer-1.0']
pkgconfig_libs = []
if host_system == 'darwin'
pkgconfig_libs = ['-Wl,-rpath,${libdir}']
endif
static_build = get_option('default_library') == 'static'
libraries = []