mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Auto merge of #24668 - tuncer:configure-media-stack-v2, r=asajeffrey
Allow build to explicitly set the media stack <!-- Please describe your changes on the following line: --> _[This is based on @asajeffrey's work in #23423, and is a rebase and continuation of that branch]_ This allows `./mach build` to override the media stack, which is currently hard-wired based on the target. To skip gstreamer, run `./mach build -d --media-stack=dummy`. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #23050 (GitHub issue number if applicable) <!-- Either: --> - [x] These changes do not require tests because it's build infra <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
commit
10a63cc9d4
10 changed files with 60 additions and 18 deletions
|
@ -36,6 +36,8 @@ webgl_backtrace = [
|
||||||
"canvas_traits/webgl_backtrace",
|
"canvas_traits/webgl_backtrace",
|
||||||
]
|
]
|
||||||
vslatestinstalled = ["script/vslatestinstalled"]
|
vslatestinstalled = ["script/vslatestinstalled"]
|
||||||
|
media-dummy = ["servo-media-dummy"]
|
||||||
|
media-gstreamer = ["servo-media-gstreamer", "gstreamer"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
background_hang_monitor = {path = "../background_hang_monitor"}
|
background_hang_monitor = {path = "../background_hang_monitor"}
|
||||||
|
@ -71,6 +73,8 @@ script_traits = {path = "../script_traits"}
|
||||||
servo_config = {path = "../config"}
|
servo_config = {path = "../config"}
|
||||||
servo_geometry = {path = "../geometry"}
|
servo_geometry = {path = "../geometry"}
|
||||||
servo-media = {git = "https://github.com/servo/media"}
|
servo-media = {git = "https://github.com/servo/media"}
|
||||||
|
servo-media-dummy = {git = "https://github.com/servo/media", optional = true}
|
||||||
|
servo-media-gstreamer = {git = "https://github.com/servo/media", optional = true}
|
||||||
servo_url = {path = "../url"}
|
servo_url = {path = "../url"}
|
||||||
sparkle = "0.1"
|
sparkle = "0.1"
|
||||||
style = {path = "../style", features = ["servo"]}
|
style = {path = "../style", features = ["servo"]}
|
||||||
|
@ -84,16 +88,10 @@ webvr_traits = {path = "../webvr_traits"}
|
||||||
webxr-api = {git = "https://github.com/servo/webxr"}
|
webxr-api = {git = "https://github.com/servo/webxr"}
|
||||||
webxr = {git = "https://github.com/servo/webxr"}
|
webxr = {git = "https://github.com/servo/webxr"}
|
||||||
surfman = { version = "0.1", features = ["sm-osmesa"] }
|
surfman = { version = "0.1", features = ["sm-osmesa"] }
|
||||||
|
gstreamer = { version = "0.14.5", optional = true }
|
||||||
|
|
||||||
[target.'cfg(all(not(target_os = "windows"), not(target_os = "ios"), not(target_os="android"), not(target_arch="arm"), not(target_arch="aarch64")))'.dependencies]
|
[target.'cfg(all(not(target_os = "windows"), not(target_os = "ios"), not(target_os="android"), not(target_arch="arm"), not(target_arch="aarch64")))'.dependencies]
|
||||||
gaol = "0.2.1"
|
gaol = "0.2.1"
|
||||||
|
|
||||||
[target.'cfg(any(target_os = "android", target_arch = "x86_64", target_os = "windows"))'.dependencies]
|
|
||||||
gstreamer = "0.14.5"
|
|
||||||
servo-media-gstreamer= {git = "https://github.com/servo/media"}
|
|
||||||
|
|
||||||
[target.'cfg(not(any(target_os = "android", target_arch = "x86_64", target_os = "windows")))'.dependencies.servo-media-dummy]
|
|
||||||
git = "https://github.com/servo/media"
|
|
||||||
|
|
||||||
[target.'cfg(target_os = "windows")'.dependencies]
|
[target.'cfg(target_os = "windows")'.dependencies]
|
||||||
mozangle = {version = "0.2"}
|
mozangle = {version = "0.2"}
|
||||||
|
|
|
@ -135,7 +135,7 @@ pub use msg::constellation_msg::TopLevelBrowsingContextId as BrowserId;
|
||||||
pub use servo_config as config;
|
pub use servo_config as config;
|
||||||
pub use servo_url as url;
|
pub use servo_url as url;
|
||||||
|
|
||||||
#[cfg(any(target_os = "android", target_arch = "x86_64", target_os = "windows",))]
|
#[cfg(feature = "media-gstreamer")]
|
||||||
mod media_platform {
|
mod media_platform {
|
||||||
use super::ServoMedia;
|
use super::ServoMedia;
|
||||||
use servo_media_gstreamer::GStreamerBackend;
|
use servo_media_gstreamer::GStreamerBackend;
|
||||||
|
@ -245,7 +245,7 @@ mod media_platform {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(any(target_os = "android", target_arch = "x86_64", target_os = "windows",)))]
|
#[cfg(feature = "media-dummy")]
|
||||||
mod media_platform {
|
mod media_platform {
|
||||||
use super::ServoMedia;
|
use super::ServoMedia;
|
||||||
pub fn init() {
|
pub fn init() {
|
||||||
|
|
|
@ -33,6 +33,8 @@ default = ["webdriver", "max_log_level"]
|
||||||
egl = ["libservo/egl"]
|
egl = ["libservo/egl"]
|
||||||
energy-profiling = ["libservo/energy-profiling"]
|
energy-profiling = ["libservo/energy-profiling"]
|
||||||
debugmozjs = ["libservo/debugmozjs"]
|
debugmozjs = ["libservo/debugmozjs"]
|
||||||
|
media-dummy = ["libservo/media-dummy"]
|
||||||
|
media-gstreamer = ["libservo/media-gstreamer"]
|
||||||
js_backtrace = ["libservo/js_backtrace"]
|
js_backtrace = ["libservo/js_backtrace"]
|
||||||
layout-2013 = ["libservo/layout-2013"]
|
layout-2013 = ["libservo/layout-2013"]
|
||||||
layout-2020 = ["libservo/layout-2020"]
|
layout-2020 = ["libservo/layout-2020"]
|
||||||
|
|
|
@ -35,6 +35,8 @@ canvas2d-azure = ["libservo/canvas2d-azure"]
|
||||||
canvas2d-raqote = ["libservo/canvas2d-raqote"]
|
canvas2d-raqote = ["libservo/canvas2d-raqote"]
|
||||||
default = ["webdriver", "max_log_level"]
|
default = ["webdriver", "max_log_level"]
|
||||||
debugmozjs = ["libservo/debugmozjs"]
|
debugmozjs = ["libservo/debugmozjs"]
|
||||||
|
media-dummy = ["libservo/media-dummy"]
|
||||||
|
media-gstreamer = ["libservo/media-gstreamer"]
|
||||||
egl = ["libservo/egl"]
|
egl = ["libservo/egl"]
|
||||||
energy-profiling = ["libservo/energy-profiling"]
|
energy-profiling = ["libservo/energy-profiling"]
|
||||||
googlevr = ["libservo/googlevr"]
|
googlevr = ["libservo/googlevr"]
|
||||||
|
|
|
@ -31,6 +31,8 @@ canvas2d-azure = ["simpleservo/canvas2d-azure"]
|
||||||
canvas2d-raqote = ["simpleservo/canvas2d-raqote"]
|
canvas2d-raqote = ["simpleservo/canvas2d-raqote"]
|
||||||
debugmozjs = ["simpleservo/debugmozjs"]
|
debugmozjs = ["simpleservo/debugmozjs"]
|
||||||
default = ["webdriver", "max_log_level"]
|
default = ["webdriver", "max_log_level"]
|
||||||
|
media-dummy = ["simpleservo/media-dummy"]
|
||||||
|
media-gstreamer = ["simpleservo/media-gstreamer"]
|
||||||
egl = ["simpleservo/egl"]
|
egl = ["simpleservo/egl"]
|
||||||
energy-profiling = ["simpleservo/energy-profiling"]
|
energy-profiling = ["simpleservo/energy-profiling"]
|
||||||
googlevr = ["simpleservo/googlevr"]
|
googlevr = ["simpleservo/googlevr"]
|
||||||
|
|
|
@ -31,6 +31,8 @@ canvas2d-azure = ["simpleservo/canvas2d-azure"]
|
||||||
canvas2d-raqote = ["simpleservo/canvas2d-raqote"]
|
canvas2d-raqote = ["simpleservo/canvas2d-raqote"]
|
||||||
debugmozjs = ["simpleservo/debugmozjs"]
|
debugmozjs = ["simpleservo/debugmozjs"]
|
||||||
default = ["webdriver", "max_log_level"]
|
default = ["webdriver", "max_log_level"]
|
||||||
|
media-dummy = ["simpleservo/media-dummy"]
|
||||||
|
media-gstreamer = ["simpleservo/media-gstreamer"]
|
||||||
egl = ["simpleservo/egl"]
|
egl = ["simpleservo/egl"]
|
||||||
energy-profiling = ["simpleservo/energy-profiling"]
|
energy-profiling = ["simpleservo/energy-profiling"]
|
||||||
googlevr = ["simpleservo/googlevr"]
|
googlevr = ["simpleservo/googlevr"]
|
||||||
|
|
|
@ -171,7 +171,7 @@ class MachCommands(CommandBase):
|
||||||
@CommandArgument('params', nargs='...',
|
@CommandArgument('params', nargs='...',
|
||||||
help="Command-line arguments to be passed through to Cargo")
|
help="Command-line arguments to be passed through to Cargo")
|
||||||
@CommandBase.build_like_command_arguments
|
@CommandBase.build_like_command_arguments
|
||||||
def build(self, release=False, dev=False, jobs=None, params=None,
|
def build(self, release=False, dev=False, jobs=None, params=None, media_stack=None,
|
||||||
no_package=False, verbose=False, very_verbose=False,
|
no_package=False, verbose=False, very_verbose=False,
|
||||||
target=None, android=False, magicleap=False, libsimpleservo=False,
|
target=None, android=False, magicleap=False, libsimpleservo=False,
|
||||||
features=None, uwp=False, win_arm64=False, **kwargs):
|
features=None, uwp=False, win_arm64=False, **kwargs):
|
||||||
|
@ -191,6 +191,8 @@ class MachCommands(CommandBase):
|
||||||
if not uwp:
|
if not uwp:
|
||||||
uwp = target and 'uwp' in target
|
uwp = target and 'uwp' in target
|
||||||
|
|
||||||
|
features += self.pick_media_stack(media_stack, target)
|
||||||
|
|
||||||
target_path = base_path = self.get_target_dir()
|
target_path = base_path = self.get_target_dir()
|
||||||
if android:
|
if android:
|
||||||
target_path = path.join(target_path, "android")
|
target_path = path.join(target_path, "android")
|
||||||
|
@ -243,7 +245,7 @@ class MachCommands(CommandBase):
|
||||||
check_call(["rustup" + BIN_SUFFIX, "target", "add",
|
check_call(["rustup" + BIN_SUFFIX, "target", "add",
|
||||||
"--toolchain", self.toolchain(), target])
|
"--toolchain", self.toolchain(), target])
|
||||||
|
|
||||||
env = self.build_env(target=target, is_build=True, uwp=uwp)
|
env = self.build_env(target=target, is_build=True, uwp=uwp, features=features)
|
||||||
self.ensure_bootstrapped(target=target)
|
self.ensure_bootstrapped(target=target)
|
||||||
self.ensure_clobbered()
|
self.ensure_clobbered()
|
||||||
|
|
||||||
|
|
|
@ -562,9 +562,11 @@ class CommandBase(object):
|
||||||
|
|
||||||
return self.get_executable(destination_folder)
|
return self.get_executable(destination_folder)
|
||||||
|
|
||||||
def needs_gstreamer_env(self, target, env, uwp=False):
|
def needs_gstreamer_env(self, target, env, uwp=False, features=[]):
|
||||||
if uwp:
|
if uwp:
|
||||||
return False
|
return False
|
||||||
|
if "media-dummy" in features:
|
||||||
|
return False
|
||||||
try:
|
try:
|
||||||
if check_gstreamer_lib():
|
if check_gstreamer_lib():
|
||||||
return False
|
return False
|
||||||
|
@ -620,7 +622,7 @@ install them, let us know by filing a bug!")
|
||||||
'vcdir': vcinstalldir,
|
'vcdir': vcinstalldir,
|
||||||
}
|
}
|
||||||
|
|
||||||
def build_env(self, hosts_file_path=None, target=None, is_build=False, test_unit=False, uwp=False):
|
def build_env(self, hosts_file_path=None, target=None, is_build=False, test_unit=False, uwp=False, features=None):
|
||||||
"""Return an extended environment dictionary."""
|
"""Return an extended environment dictionary."""
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
if sys.platform == "win32" and type(env['PATH']) == unicode:
|
if sys.platform == "win32" and type(env['PATH']) == unicode:
|
||||||
|
@ -670,7 +672,7 @@ install them, let us know by filing a bug!")
|
||||||
# Always build harfbuzz from source
|
# Always build harfbuzz from source
|
||||||
env["HARFBUZZ_SYS_NO_PKG_CONFIG"] = "true"
|
env["HARFBUZZ_SYS_NO_PKG_CONFIG"] = "true"
|
||||||
|
|
||||||
if is_build and self.needs_gstreamer_env(target or host_triple(), env, uwp):
|
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())
|
gstpath = gstreamer_root(target or host_triple(), env, self.get_top_dir())
|
||||||
extra_path += [path.join(gstpath, "bin")]
|
extra_path += [path.join(gstpath, "bin")]
|
||||||
libpath = path.join(gstpath, "lib")
|
libpath = path.join(gstpath, "lib")
|
||||||
|
@ -790,6 +792,12 @@ install them, let us know by filing a bug!")
|
||||||
default=None,
|
default=None,
|
||||||
help='Cross compile for given target platform',
|
help='Cross compile for given target platform',
|
||||||
),
|
),
|
||||||
|
CommandArgument(
|
||||||
|
'--media-stack',
|
||||||
|
default=None,
|
||||||
|
choices=["gstreamer", "dummy"],
|
||||||
|
help='Which media stack to use',
|
||||||
|
),
|
||||||
CommandArgument(
|
CommandArgument(
|
||||||
'--android',
|
'--android',
|
||||||
default=None,
|
default=None,
|
||||||
|
@ -854,13 +862,26 @@ install them, let us know by filing a bug!")
|
||||||
android = self.handle_android_target(target)
|
android = self.handle_android_target(target)
|
||||||
return target, android
|
return target, android
|
||||||
|
|
||||||
|
# A guess about which platforms should use the gstreamer media stack
|
||||||
|
def pick_media_stack(self, media_stack, target):
|
||||||
|
if not(media_stack):
|
||||||
|
if (
|
||||||
|
not(target) or
|
||||||
|
("armv7" in target and "android" in target) or
|
||||||
|
("x86_64" in target)
|
||||||
|
):
|
||||||
|
media_stack = "gstreamer"
|
||||||
|
else:
|
||||||
|
media_stack = "dummy"
|
||||||
|
return ["media-" + media_stack]
|
||||||
|
|
||||||
def run_cargo_build_like_command(
|
def run_cargo_build_like_command(
|
||||||
self, command, cargo_args,
|
self, command, cargo_args,
|
||||||
env=None, verbose=False,
|
env=None, verbose=False,
|
||||||
target=None, android=False, magicleap=False, libsimpleservo=False,
|
target=None, android=False, magicleap=False, libsimpleservo=False,
|
||||||
features=None, debug_mozjs=False, with_debug_assertions=False,
|
features=None, debug_mozjs=False, with_debug_assertions=False,
|
||||||
with_frame_pointer=False, with_raqote=False, with_layout_2020=False, without_wgl=False,
|
with_frame_pointer=False, with_raqote=False, with_layout_2020=False, without_wgl=False,
|
||||||
uwp=False,
|
uwp=False, media_stack=None,
|
||||||
):
|
):
|
||||||
env = env or self.build_env()
|
env = env or self.build_env()
|
||||||
target, android = self.pick_target_triple(target, android, magicleap)
|
target, android = self.pick_target_triple(target, android, magicleap)
|
||||||
|
|
|
@ -38,16 +38,23 @@ class MachCommands(CommandBase):
|
||||||
'params', default=None, nargs='...',
|
'params', default=None, nargs='...',
|
||||||
help="Command-line arguments to be passed through to cargo check")
|
help="Command-line arguments to be passed through to cargo check")
|
||||||
@CommandBase.build_like_command_arguments
|
@CommandBase.build_like_command_arguments
|
||||||
def check(self, params, **kwargs):
|
def check(self, params, features=[], media_stack=None, target=None,
|
||||||
|
android=False, magicleap=False, **kwargs):
|
||||||
if not params:
|
if not params:
|
||||||
params = []
|
params = []
|
||||||
|
|
||||||
|
features = features or []
|
||||||
|
|
||||||
|
target, android = self.pick_target_triple(target, android, magicleap)
|
||||||
|
|
||||||
|
features += self.pick_media_stack(media_stack, target)
|
||||||
|
|
||||||
self.ensure_bootstrapped()
|
self.ensure_bootstrapped()
|
||||||
self.ensure_clobbered()
|
self.ensure_clobbered()
|
||||||
env = self.build_env()
|
env = self.build_env()
|
||||||
|
|
||||||
build_start = time()
|
build_start = time()
|
||||||
status = self.run_cargo_build_like_command("check", params, env=env, **kwargs)
|
status = self.run_cargo_build_like_command("check", params, env=env, features=features, **kwargs)
|
||||||
elapsed = time() - build_start
|
elapsed = time() - build_start
|
||||||
|
|
||||||
notify_build_done(self.config, elapsed, status == 0)
|
notify_build_done(self.config, elapsed, status == 0)
|
||||||
|
|
|
@ -239,7 +239,8 @@ class PostBuildCommands(CommandBase):
|
||||||
'params', nargs='...',
|
'params', nargs='...',
|
||||||
help="Command-line arguments to be passed through to cargo doc")
|
help="Command-line arguments to be passed through to cargo doc")
|
||||||
@CommandBase.build_like_command_arguments
|
@CommandBase.build_like_command_arguments
|
||||||
def doc(self, params, features, **kwargs):
|
def doc(self, params, features, target=None, android=False, magicleap=False,
|
||||||
|
media_stack=None, **kwargs):
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
env["RUSTUP_TOOLCHAIN"] = self.toolchain()
|
env["RUSTUP_TOOLCHAIN"] = self.toolchain()
|
||||||
rustc_path = check_output(["rustup" + BIN_SUFFIX, "which", "rustc"], env=env)
|
rustc_path = check_output(["rustup" + BIN_SUFFIX, "which", "rustc"], env=env)
|
||||||
|
@ -268,6 +269,11 @@ class PostBuildCommands(CommandBase):
|
||||||
copy2(full_name, destination)
|
copy2(full_name, destination)
|
||||||
|
|
||||||
features = features or []
|
features = features or []
|
||||||
|
|
||||||
|
target, android = self.pick_target_triple(target, android, magicleap)
|
||||||
|
|
||||||
|
features += self.pick_media_stack(media_stack, target)
|
||||||
|
|
||||||
returncode = self.run_cargo_build_like_command("doc", params, features=features, **kwargs)
|
returncode = self.run_cargo_build_like_command("doc", params, features=features, **kwargs)
|
||||||
if returncode:
|
if returncode:
|
||||||
return returncode
|
return returncode
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue