diff options
author | Mukilan Thiyagarajan <me@mukilan.in> | 2023-04-29 19:41:41 +0200 |
---|---|---|
committer | Mukilan Thiyagarajan <me@mukilan.in> | 2023-05-12 00:14:38 +0530 |
commit | 8cfb19a8fba80a809af028223dd3a58d38123d02 (patch) | |
tree | ef051de063464259172ea52acfbf0a1d67dceb18 /python/servo/gstreamer.py | |
parent | 425b0fe641e16083507c459041ff5dd19256ed7c (diff) | |
download | servo-8cfb19a8fba80a809af028223dd3a58d38123d02.tar.gz servo-8cfb19a8fba80a809af028223dd3a58d38123d02.zip |
Consume official GStreamer binaries on MacOS
This PR re-enables support for the gstreamer mediastack
in macOS by consuming the official binary '.pkg' files
from gstreamer.freedesktop.org
To maintain symmetry with other platforms, the '.pkg'
files are uploaded to servo-build-deps and fetched from
there using the new script 'etc/install_macos_gstreamer.sh'.
Unlike the Homebrew version, the official GStreamer is
distributed as a 'relocatable' framework i.e the dylibs all
have @rpath-relative install names and also link to other
dylibs using @rpath relative path. To address this difference
the 'servo' binary needs to be patched with 'install_name_tool'
to add an LC_RPATH command that sets the relative paths
that the dynamic linker should search when trying to satify
dependencies. In Servo's case, this will be a path relative to
the 'servo' binary itself i.e '@executable_path/lib/'
The additional 'lib' is due to a flaw in the gstreamer
packaging where the install names of some of the dylibs
have the prefix '@rpath/lib' and some of them just have '@rpath'.
This PR also fixes a couple of issues present in the
`mach build` process on MacOS:
1. `mach build` process was not copying transitive dependencies
of servo binary but only the first level dylibs
2. `mach build` process didn't patch the links to dylibs
in servo binary (and dependencies). This meant though
(some) dylibs were copied to local path, the binary
still loaded the dylibs from system GStreamer installation
i.e homebrew instead of the copieds dylibs
The build and runtime dependencies in etc/homebrew/Brewfile
and etc/homebrew/Brewfile-build have also been removed in This
PR.
Signed-off-by: Mukilan Thiyagarajan <me@mukilan.in>
Diffstat (limited to 'python/servo/gstreamer.py')
-rw-r--r-- | python/servo/gstreamer.py | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/python/servo/gstreamer.py b/python/servo/gstreamer.py index 1b7739d0f62..42da291e9f0 100644 --- a/python/servo/gstreamer.py +++ b/python/servo/gstreamer.py @@ -9,7 +9,6 @@ import os import sys -import platform GSTREAMER_DYLIBS = [ # gstreamer @@ -121,20 +120,9 @@ def windows_plugins(uwp): return [f"{lib}.dll" for lib in libs] -def macos_lib_dir(): - # homebrew use /opt/homebrew on macos ARM, use /usr/local on Intel - if platform.machine() == 'arm64': - return os.path.join('/', 'opt', 'homebrew', 'lib') - return os.path.join('/', 'usr', 'local', 'lib') - - -def macos_dylibs(): - dylibs = [ - *[f"lib{lib}-1.0.0.dylib" for lib in GSTREAMER_DYLIBS], - "libnice.dylib", - "libnice.10.dylib", - ] - return [os.path.join(macos_lib_dir(), lib) for lib in dylibs] +def macos_gst_root(): + return os.path.join( + "/", "Library", "Frameworks", "GStreamer.framework", "Versions", "1.0") def macos_plugins(): @@ -148,7 +136,7 @@ def macos_plugins(): ] def plugin_path(plugin): - return os.path.join(macos_lib_dir(), 'gstreamer-1.0', f"lib{plugin}.dylib") + return os.path.join(macos_gst_root(), 'lib', 'gstreamer-1.0', f"lib{plugin}.dylib") # These plugins depend on the particular version of GStreamer that is installed # on the system that is building servo. |