mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
build: Combine and simplify GStreamer shared object lists (#31038)
Add documentation and simplify the way that GStreamer shared objects lists are stored. In addition, move the list of extra GStreamer DLL dependencies to to the `gstreamer.py` file. The conditional plugin logic is no longer required as we are having already increased our GStreamer version requirements.
This commit is contained in:
parent
94a3c49a80
commit
54dd8becc1
2 changed files with 80 additions and 66 deletions
|
@ -372,13 +372,15 @@ def resolve_rpath(lib, rpath_root):
|
|||
raise Exception("Unable to satisfy rpath dependency: " + lib)
|
||||
|
||||
|
||||
def copy_dependencies(binary_path, lib_path, gst_root):
|
||||
def copy_dependencies(binary_path, lib_path, gst_lib_dir):
|
||||
relative_path = path.relpath(lib_path, path.dirname(binary_path)) + "/"
|
||||
|
||||
# Update binary libraries
|
||||
binary_dependencies = set(otool(binary_path))
|
||||
change_non_system_libraries_path(binary_dependencies, relative_path, binary_path)
|
||||
binary_dependencies = binary_dependencies.union(macos_plugins())
|
||||
|
||||
plugins = [os.path.join(gst_lib_dir, "gstreamer-1.0", plugin) for plugin in macos_plugins()]
|
||||
binary_dependencies = binary_dependencies.union(plugins)
|
||||
|
||||
# Update dependencies libraries
|
||||
need_checked = binary_dependencies
|
||||
|
@ -390,7 +392,7 @@ def copy_dependencies(binary_path, lib_path, gst_root):
|
|||
# No need to check these for their dylibs
|
||||
if is_system_library(f):
|
||||
continue
|
||||
full_path = resolve_rpath(f, gst_root)
|
||||
full_path = resolve_rpath(f, gst_lib_dir)
|
||||
need_relinked = set(otool(full_path))
|
||||
new_path = path.join(lib_path, path.basename(full_path))
|
||||
if not path.exists(new_path):
|
||||
|
@ -427,41 +429,8 @@ def package_gstreamer_dlls(env, servo_exe_dir, target):
|
|||
print("Could not find GStreamer installation directory.")
|
||||
return False
|
||||
|
||||
# All the shared libraries required for starting up and loading plugins.
|
||||
gst_dlls = [
|
||||
"avcodec-59.dll",
|
||||
"avfilter-8.dll",
|
||||
"avformat-59.dll",
|
||||
"avutil-57.dll",
|
||||
"bz2.dll",
|
||||
"ffi-7.dll",
|
||||
"gio-2.0-0.dll",
|
||||
"glib-2.0-0.dll",
|
||||
"gmodule-2.0-0.dll",
|
||||
"gobject-2.0-0.dll",
|
||||
"graphene-1.0-0.dll",
|
||||
"intl-8.dll",
|
||||
"libcrypto-1_1-x64.dll",
|
||||
"libjpeg-8.dll",
|
||||
"libogg-0.dll",
|
||||
"libpng16-16.dll",
|
||||
"libssl-1_1-x64.dll",
|
||||
"libvorbis-0.dll",
|
||||
"libvorbisenc-2.dll",
|
||||
"libwinpthread-1.dll",
|
||||
"nice-10.dll",
|
||||
"opus-0.dll",
|
||||
"orc-0.4-0.dll",
|
||||
"pcre2-8-0.dll",
|
||||
"swresample-4.dll",
|
||||
"theora-0.dll",
|
||||
"theoradec-1.dll",
|
||||
"theoraenc-1.dll",
|
||||
"z-1.dll",
|
||||
] + windows_dlls()
|
||||
|
||||
missing = []
|
||||
for gst_lib in gst_dlls:
|
||||
for gst_lib in windows_dlls():
|
||||
try:
|
||||
shutil.copy(path.join(gst_root, "bin", gst_lib), servo_exe_dir)
|
||||
except Exception:
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
import os
|
||||
import sys
|
||||
|
||||
GSTREAMER_DYLIBS = [
|
||||
GSTREAMER_BASE_LIBS = [
|
||||
# gstreamer
|
||||
"gstbase",
|
||||
"gstcontroller",
|
||||
|
@ -36,9 +36,13 @@ GSTREAMER_DYLIBS = [
|
|||
"gstwebrtc",
|
||||
"gstwebrtcnice",
|
||||
]
|
||||
"""
|
||||
These are the GStreamer base libraries used by both MacOS and Windows
|
||||
platforms. These are distinct from GStreamer plugins, but GStreamer plugins
|
||||
may have shared object dependencies on them.
|
||||
"""
|
||||
|
||||
|
||||
GSTREAMER_PLUGINS = [
|
||||
GSTREAMER_PLUGIN_LIBS = [
|
||||
# gstreamer
|
||||
"gstcoreelements",
|
||||
"gstnice",
|
||||
|
@ -53,6 +57,7 @@ GSTREAMER_PLUGINS = [
|
|||
"gstplayback",
|
||||
"gsttheora",
|
||||
"gsttypefindfunctions",
|
||||
"gstvideoconvertscale",
|
||||
"gstvolume",
|
||||
"gstvorbis",
|
||||
# gst-plugins-good
|
||||
|
@ -78,18 +83,75 @@ GSTREAMER_PLUGINS = [
|
|||
# gst-libav
|
||||
"gstlibav",
|
||||
]
|
||||
"""
|
||||
The list of plugin libraries themselves, used for both MacOS and Windows.
|
||||
"""
|
||||
|
||||
GSTREAMER_MAC_PLUGIN_LIBS = [
|
||||
# gst-plugins-good
|
||||
"gstosxaudio",
|
||||
"gstosxvideo",
|
||||
# gst-plugins-bad
|
||||
"gstapplemedia",
|
||||
]
|
||||
"""
|
||||
Plugins that are only used for MacOS.
|
||||
"""
|
||||
|
||||
GSTREAMER_WIN_PLUGIN_LIBS = [
|
||||
# gst-plugins-bad
|
||||
"gstwasapi"
|
||||
]
|
||||
"""
|
||||
Plugins that are only used for Windows.
|
||||
"""
|
||||
|
||||
GSTREAMER_WIN_DEPENDENCY_LIBS = [
|
||||
"avcodec-59.dll",
|
||||
"avfilter-8.dll",
|
||||
"avformat-59.dll",
|
||||
"avutil-57.dll",
|
||||
"bz2.dll",
|
||||
"ffi-7.dll",
|
||||
"gio-2.0-0.dll",
|
||||
"glib-2.0-0.dll",
|
||||
"gmodule-2.0-0.dll",
|
||||
"gobject-2.0-0.dll",
|
||||
"graphene-1.0-0.dll",
|
||||
"intl-8.dll",
|
||||
"libcrypto-1_1-x64.dll",
|
||||
"libjpeg-8.dll",
|
||||
"libogg-0.dll",
|
||||
"libpng16-16.dll",
|
||||
"libssl-1_1-x64.dll",
|
||||
"libvorbis-0.dll",
|
||||
"libvorbisenc-2.dll",
|
||||
"libwinpthread-1.dll",
|
||||
"nice-10.dll",
|
||||
"opus-0.dll",
|
||||
"orc-0.4-0.dll",
|
||||
"pcre2-8-0.dll",
|
||||
"swresample-4.dll",
|
||||
"theora-0.dll",
|
||||
"theoradec-1.dll",
|
||||
"theoraenc-1.dll",
|
||||
"z-1.dll",
|
||||
]
|
||||
"""
|
||||
DLLs that GStreamer ships in the Windows distribution that are necessary for
|
||||
using the plugin selection that we have. This list is curated by a combination
|
||||
of using `dumpbin` and the errors that appear when starting Servo.
|
||||
"""
|
||||
|
||||
|
||||
def windows_dlls():
|
||||
libs = list(GSTREAMER_DYLIBS)
|
||||
return [f"{lib}-1.0-0.dll" for lib in libs]
|
||||
return GSTREAMER_WIN_DEPENDENCY_LIBS + [f"{lib}-1.0-0.dll" for lib in GSTREAMER_BASE_LIBS]
|
||||
|
||||
|
||||
def windows_plugins():
|
||||
libs = [
|
||||
*GSTREAMER_PLUGINS,
|
||||
"gstvideoconvertscale",
|
||||
"gstwasapi"
|
||||
*GSTREAMER_PLUGIN_LIBS,
|
||||
*GSTREAMER_WIN_PLUGIN_LIBS
|
||||
]
|
||||
return [f"{lib}.dll" for lib in libs]
|
||||
|
||||
|
@ -101,34 +163,17 @@ def macos_gst_root():
|
|||
|
||||
def macos_plugins():
|
||||
plugins = [
|
||||
*GSTREAMER_PLUGINS,
|
||||
# gst-plugins-good
|
||||
"gstosxaudio",
|
||||
"gstosxvideo",
|
||||
# gst-plugins-bad
|
||||
"gstapplemedia",
|
||||
*GSTREAMER_PLUGIN_LIBS,
|
||||
*GSTREAMER_MAC_PLUGIN_LIBS
|
||||
]
|
||||
|
||||
def plugin_path(plugin):
|
||||
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.
|
||||
conditional_plugins = [
|
||||
# gst-plugins-base
|
||||
plugin_path("gstvideoconvert"),
|
||||
plugin_path("gstvideoscale"),
|
||||
plugin_path("gstvideoconvertscale")
|
||||
]
|
||||
conditional_plugins = list(filter(lambda path: os.path.exists(path),
|
||||
conditional_plugins))
|
||||
return [plugin_path(plugin) for plugin in plugins] + conditional_plugins
|
||||
return [f"lib{plugin}.dylib" for plugin in plugins]
|
||||
|
||||
|
||||
def write_plugin_list(target):
|
||||
plugins = []
|
||||
if "apple-" in target:
|
||||
plugins = [os.path.basename(x) for x in macos_plugins()]
|
||||
plugins = macos_plugins()
|
||||
elif '-windows-' in target:
|
||||
plugins = windows_plugins()
|
||||
print('''/* This is a generated file. Do not modify. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue