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/command_base.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/command_base.py')
-rw-r--r-- | python/servo/command_base.py | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/python/servo/command_base.py b/python/servo/command_base.py index 76c32bbd85c..db2070f5b68 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -36,11 +36,12 @@ import toml from xml.etree.ElementTree import XML from servo.util import download_file -from .bootstrap import check_gstreamer_lib +from .bootstrap import check_gstreamer_lib, check_macos_gstreamer_lib from mach.decorators import CommandArgument from mach.registrar import Registrar from servo.packages import WINDOWS_MSVC as msvc_deps from servo.util import host_triple +from servo.gstreamer import macos_gst_root BIN_SUFFIX = ".exe" if sys.platform == "win32" else "" NIGHTLY_REPOSITORY_URL = "https://servo-builds2.s3.amazonaws.com/" @@ -240,6 +241,8 @@ def gstreamer_root(target, env, topdir=None): return gst_default_path elif is_linux(): return path.join(topdir, "support", "linux", "gstreamer", "gst") + elif is_macosx(): + return macos_gst_root() return None @@ -541,6 +544,16 @@ class CommandBase(object): return False if "media-dummy" in features: return False + + if is_macosx(): + if check_macos_gstreamer_lib(): + # We override homebrew gstreamer if installed and + # always use pkgconfig from official gstreamer framework + return True + else: + raise Exception("Official GStreamer framework not found (we need at least 1.21)." + "Please see installation instructions in README.md") + try: if check_gstreamer_lib(): return False @@ -660,14 +673,17 @@ install them, let us know by filing a bug!") env["HARFBUZZ_SYS_NO_PKG_CONFIG"] = "true" if is_build and self.needs_gstreamer_env(target or host_triple(), env, uwp, features): - gstpath = gstreamer_root(target or host_triple(), env, self.get_top_dir()) - extra_path += [path.join(gstpath, "bin")] - libpath = path.join(gstpath, "lib") + gst_root = gstreamer_root(target or host_triple(), env, self.get_top_dir()) + bin_path = path.join(gst_root, "bin") + lib_path = path.join(gst_root, "lib") + pkg_config_path = path.join(lib_path, "pkgconfig") # we append in the reverse order so that system gstreamer libraries # do not get precedence - extra_path = [libpath] + extra_path - extra_lib = [libpath] + extra_lib - append_to_path_env(path.join(libpath, "pkgconfig"), env, "PKG_CONFIG_PATH") + extra_path = [bin_path] + extra_path + extra_lib = [lib_path] + extra_lib + append_to_path_env(pkg_config_path, env, "PKG_CONFIG_PATH") + if is_macosx(): + env["OPENSSL_INCLUDE_DIR"] = path.join(gst_root, "Headers") if is_linux(): distrib, version, _ = distro.linux_distribution() |