gst-env.py: Output DYLD_LIBRARY_PATH with --only-environment on macOS

DYLD_LIBRARY_PATH is considered a security risk by Apple, so shells
filter it out, but we can set it when using --only-environment so
people can use it like so:

  eval $(./gst-env.py --only-environment)

This is currently the only way to build an app that links to gstreamer
inside the devenv on macOS and have it run properly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3708>
This commit is contained in:
Nirbheek Chauhan 2023-01-11 01:13:30 +05:30 committed by GStreamer Marge Bot
parent 8e8d8206f1
commit 3d13a0d252

View file

@ -294,8 +294,12 @@ def get_subprocess_env(options, gst_version):
if os.name == 'nt':
lib_path_envvar = 'PATH'
elif platform.system() == 'Darwin':
# RPATH is sufficient on macOS, and DYLD_LIBRARY_PATH can cause issues with dynamic linker path priority
# DYLD_LIBRARY_PATH is stripped when new shells are spawned and can
# cause issues with runtime linker resolution, so only set it when
# using --only-environment
lib_path_envvar = None
if options.only_environment:
lib_path_envvar = 'DYLD_LIBRARY_PATH'
else:
lib_path_envvar = 'LD_LIBRARY_PATH'