soup: Ensure that libsoup RPATHs are added with Homebrew too
With the old method of adding build RPATHs, only the libsoup as a subproject was supported. However, it's possible to use Homebrew for libsoup too by adding libsoup as a dependency to the target (even though we don't link to it). Apple ld will not add a LC_LOAD_DYLIB entry for a library unless there are symbols that need it because meson passes `-dead_strip_dylibs`, so we can do this without issue. As a bonus, this ensures the correct build RPATHs in all cases. Additionally, we still need to explicitly add an LC_RPATH for the installed case. Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/4027 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8403>
This commit is contained in:
parent
5e086ea3f5
commit
c2db03a323
@ -157,6 +157,7 @@ if host_system == 'windows'
|
|||||||
else
|
else
|
||||||
if default_library in ['static', 'both']
|
if default_library in ['static', 'both']
|
||||||
# Static plugin links to libsoup directly at build time
|
# Static plugin links to libsoup directly at build time
|
||||||
|
assert(soup_linked_target)
|
||||||
adaptivedemux2_static = static_library('gstadaptivedemux2',
|
adaptivedemux2_static = static_library('gstadaptivedemux2',
|
||||||
c_args: [adaptive_args, soup_linked_target_args],
|
c_args: [adaptive_args, soup_linked_target_args],
|
||||||
dependencies: [adaptive_deps, soup_linked_target_deps],
|
dependencies: [adaptive_deps, soup_linked_target_deps],
|
||||||
@ -165,7 +166,7 @@ else
|
|||||||
if default_library in ['shared', 'both']
|
if default_library in ['shared', 'both']
|
||||||
adaptivedemux2_shared = shared_library('gstadaptivedemux2',
|
adaptivedemux2_shared = shared_library('gstadaptivedemux2',
|
||||||
c_args: adaptive_args,
|
c_args: adaptive_args,
|
||||||
dependencies: adaptive_deps,
|
dependencies: [adaptive_deps, soup_dlopen_target_deps],
|
||||||
kwargs: adaptive_kwargs + soup_dlopen_target_kwargs)
|
kwargs: adaptive_kwargs + soup_dlopen_target_kwargs)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
@ -18,6 +18,7 @@ soup_ver_opt = get_option('soup-version')
|
|||||||
default_library = get_option('default_library')
|
default_library = get_option('default_library')
|
||||||
soup_linked_target = host_system == 'windows' or default_library != 'shared'
|
soup_linked_target = host_system == 'windows' or default_library != 'shared'
|
||||||
soup_lookup_dep = get_option('soup-lookup-dep') or soup_linked_target
|
soup_lookup_dep = get_option('soup-lookup-dep') or soup_linked_target
|
||||||
|
soup_dlopen_target_deps = []
|
||||||
soup_dlopen_target_kwargs = {}
|
soup_dlopen_target_kwargs = {}
|
||||||
|
|
||||||
if get_option('soup').allowed() or get_option('adaptivedemux2').allowed()
|
if get_option('soup').allowed() or get_option('adaptivedemux2').allowed()
|
||||||
@ -43,16 +44,22 @@ if get_option('soup').allowed() or get_option('adaptivedemux2').allowed()
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Hack to set the right RPATH for making dlopen() work inside the devenv on
|
# Hack to set the LC_RPATH for making dlopen() work, since meson will only
|
||||||
# macOS when using libsoup as a subproject.
|
# add that for deps that are in the list of dependencies. We also need to add
|
||||||
|
# install_rpath to cover the installation case. Every other dep is loaded via
|
||||||
|
# absolute LC_LOAD_DYLIB entries.
|
||||||
if host_system == 'darwin'
|
if host_system == 'darwin'
|
||||||
foreach dep : [libsoup3_dep, libsoup2_dep]
|
foreach dep : [libsoup3_dep, libsoup2_dep]
|
||||||
if dep.found() and dep.type_name() == 'internal'
|
if not dep.found()
|
||||||
soup_dlopen_target_kwargs += {
|
continue
|
||||||
'build_rpath': '@loader_path/../../../libsoup-' + dep.version() / 'libsoup',
|
|
||||||
}
|
|
||||||
break
|
|
||||||
endif
|
endif
|
||||||
|
soup_dlopen_target_deps += [dep]
|
||||||
|
if dep.type_name() == 'internal'
|
||||||
|
soup_dlopen_target_kwargs += {'install_rpath': '@loader_path/..'}
|
||||||
|
else
|
||||||
|
soup_dlopen_target_kwargs += {'install_rpath': dep.get_variable('libdir')}
|
||||||
|
endif
|
||||||
|
break
|
||||||
endforeach
|
endforeach
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
@ -71,7 +71,7 @@ else
|
|||||||
if default_library in ['shared', 'both']
|
if default_library in ['shared', 'both']
|
||||||
gstsouphttpsrc_shared = shared_library('gstsoup',
|
gstsouphttpsrc_shared = shared_library('gstsoup',
|
||||||
c_args : soup_library_c_args,
|
c_args : soup_library_c_args,
|
||||||
dependencies : soup_library_deps,
|
dependencies : soup_library_deps + soup_dlopen_target_deps,
|
||||||
kwargs: soup_library_kwargs + soup_dlopen_target_kwargs,
|
kwargs: soup_library_kwargs + soup_dlopen_target_kwargs,
|
||||||
)
|
)
|
||||||
endif
|
endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user