aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/servo/Cargo.toml12
-rw-r--r--components/servo/lib.rs4
-rw-r--r--ports/glutin/Cargo.toml2
-rw-r--r--ports/libsimpleservo/api/Cargo.toml2
-rw-r--r--ports/libsimpleservo/capi/Cargo.toml2
-rw-r--r--ports/libsimpleservo/jniapi/Cargo.toml2
-rw-r--r--python/servo/build_commands.py6
-rw-r--r--python/servo/command_base.py29
-rw-r--r--python/servo/devenv_commands.py11
-rw-r--r--python/servo/post_build_commands.py8
10 files changed, 60 insertions, 18 deletions
diff --git a/components/servo/Cargo.toml b/components/servo/Cargo.toml
index f3e4cd086c5..458ffb114a0 100644
--- a/components/servo/Cargo.toml
+++ b/components/servo/Cargo.toml
@@ -36,6 +36,8 @@ webgl_backtrace = [
"canvas_traits/webgl_backtrace",
]
vslatestinstalled = ["script/vslatestinstalled"]
+media-dummy = ["servo-media-dummy"]
+media-gstreamer = ["servo-media-gstreamer", "gstreamer"]
[dependencies]
background_hang_monitor = {path = "../background_hang_monitor"}
@@ -71,6 +73,8 @@ script_traits = {path = "../script_traits"}
servo_config = {path = "../config"}
servo_geometry = {path = "../geometry"}
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"}
sparkle = "0.1"
style = {path = "../style", features = ["servo"]}
@@ -84,16 +88,10 @@ webvr_traits = {path = "../webvr_traits"}
webxr-api = {git = "https://github.com/servo/webxr"}
webxr = {git = "https://github.com/servo/webxr"}
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]
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]
mozangle = {version = "0.2"}
diff --git a/components/servo/lib.rs b/components/servo/lib.rs
index e32c28ef740..d201bc2d757 100644
--- a/components/servo/lib.rs
+++ b/components/servo/lib.rs
@@ -135,7 +135,7 @@ pub use msg::constellation_msg::TopLevelBrowsingContextId as BrowserId;
pub use servo_config as config;
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 {
use super::ServoMedia;
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 {
use super::ServoMedia;
pub fn init() {
diff --git a/ports/glutin/Cargo.toml b/ports/glutin/Cargo.toml
index d4ad9f3a299..69c71acb509 100644
--- a/ports/glutin/Cargo.toml
+++ b/ports/glutin/Cargo.toml
@@ -33,6 +33,8 @@ default = ["webdriver", "max_log_level"]
egl = ["libservo/egl"]
energy-profiling = ["libservo/energy-profiling"]
debugmozjs = ["libservo/debugmozjs"]
+media-dummy = ["libservo/media-dummy"]
+media-gstreamer = ["libservo/media-gstreamer"]
js_backtrace = ["libservo/js_backtrace"]
layout-2013 = ["libservo/layout-2013"]
layout-2020 = ["libservo/layout-2020"]
diff --git a/ports/libsimpleservo/api/Cargo.toml b/ports/libsimpleservo/api/Cargo.toml
index ce9c10bac1c..d681fb59b07 100644
--- a/ports/libsimpleservo/api/Cargo.toml
+++ b/ports/libsimpleservo/api/Cargo.toml
@@ -35,6 +35,8 @@ canvas2d-azure = ["libservo/canvas2d-azure"]
canvas2d-raqote = ["libservo/canvas2d-raqote"]
default = ["webdriver", "max_log_level"]
debugmozjs = ["libservo/debugmozjs"]
+media-dummy = ["libservo/media-dummy"]
+media-gstreamer = ["libservo/media-gstreamer"]
egl = ["libservo/egl"]
energy-profiling = ["libservo/energy-profiling"]
googlevr = ["libservo/googlevr"]
diff --git a/ports/libsimpleservo/capi/Cargo.toml b/ports/libsimpleservo/capi/Cargo.toml
index 62c8b31632e..1e0850dc22a 100644
--- a/ports/libsimpleservo/capi/Cargo.toml
+++ b/ports/libsimpleservo/capi/Cargo.toml
@@ -31,6 +31,8 @@ canvas2d-azure = ["simpleservo/canvas2d-azure"]
canvas2d-raqote = ["simpleservo/canvas2d-raqote"]
debugmozjs = ["simpleservo/debugmozjs"]
default = ["webdriver", "max_log_level"]
+media-dummy = ["simpleservo/media-dummy"]
+media-gstreamer = ["simpleservo/media-gstreamer"]
egl = ["simpleservo/egl"]
energy-profiling = ["simpleservo/energy-profiling"]
googlevr = ["simpleservo/googlevr"]
diff --git a/ports/libsimpleservo/jniapi/Cargo.toml b/ports/libsimpleservo/jniapi/Cargo.toml
index d0e61568e60..953b1c1a4eb 100644
--- a/ports/libsimpleservo/jniapi/Cargo.toml
+++ b/ports/libsimpleservo/jniapi/Cargo.toml
@@ -31,6 +31,8 @@ canvas2d-azure = ["simpleservo/canvas2d-azure"]
canvas2d-raqote = ["simpleservo/canvas2d-raqote"]
debugmozjs = ["simpleservo/debugmozjs"]
default = ["webdriver", "max_log_level"]
+media-dummy = ["simpleservo/media-dummy"]
+media-gstreamer = ["simpleservo/media-gstreamer"]
egl = ["simpleservo/egl"]
energy-profiling = ["simpleservo/energy-profiling"]
googlevr = ["simpleservo/googlevr"]
diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py
index d4ac8d98b68..8f462939b5b 100644
--- a/python/servo/build_commands.py
+++ b/python/servo/build_commands.py
@@ -171,7 +171,7 @@ class MachCommands(CommandBase):
@CommandArgument('params', nargs='...',
help="Command-line arguments to be passed through to Cargo")
@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,
target=None, android=False, magicleap=False, libsimpleservo=False,
features=None, uwp=False, win_arm64=False, **kwargs):
@@ -191,6 +191,8 @@ class MachCommands(CommandBase):
if not uwp:
uwp = target and 'uwp' in target
+ features += self.pick_media_stack(media_stack, target)
+
target_path = base_path = self.get_target_dir()
if android:
target_path = path.join(target_path, "android")
@@ -243,7 +245,7 @@ class MachCommands(CommandBase):
check_call(["rustup" + BIN_SUFFIX, "target", "add",
"--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_clobbered()
diff --git a/python/servo/command_base.py b/python/servo/command_base.py
index 2a82ec51612..5a8818333a9 100644
--- a/python/servo/command_base.py
+++ b/python/servo/command_base.py
@@ -562,9 +562,11 @@ class CommandBase(object):
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:
return False
+ if "media-dummy" in features:
+ return False
try:
if check_gstreamer_lib():
return False
@@ -620,7 +622,7 @@ install them, let us know by filing a bug!")
'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."""
env = os.environ.copy()
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
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())
extra_path += [path.join(gstpath, "bin")]
libpath = path.join(gstpath, "lib")
@@ -791,6 +793,12 @@ install them, let us know by filing a bug!")
help='Cross compile for given target platform',
),
CommandArgument(
+ '--media-stack',
+ default=None,
+ choices=["gstreamer", "dummy"],
+ help='Which media stack to use',
+ ),
+ CommandArgument(
'--android',
default=None,
action='store_true',
@@ -854,13 +862,26 @@ install them, let us know by filing a bug!")
android = self.handle_android_target(target)
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(
self, command, cargo_args,
env=None, verbose=False,
target=None, android=False, magicleap=False, libsimpleservo=False,
features=None, debug_mozjs=False, with_debug_assertions=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()
target, android = self.pick_target_triple(target, android, magicleap)
diff --git a/python/servo/devenv_commands.py b/python/servo/devenv_commands.py
index 78f6e2ce392..45a3f946f38 100644
--- a/python/servo/devenv_commands.py
+++ b/python/servo/devenv_commands.py
@@ -38,16 +38,23 @@ class MachCommands(CommandBase):
'params', default=None, nargs='...',
help="Command-line arguments to be passed through to cargo check")
@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:
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_clobbered()
env = self.build_env()
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
notify_build_done(self.config, elapsed, status == 0)
diff --git a/python/servo/post_build_commands.py b/python/servo/post_build_commands.py
index 4c3b6aba3c5..a6ab4de647c 100644
--- a/python/servo/post_build_commands.py
+++ b/python/servo/post_build_commands.py
@@ -239,7 +239,8 @@ class PostBuildCommands(CommandBase):
'params', nargs='...',
help="Command-line arguments to be passed through to cargo doc")
@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["RUSTUP_TOOLCHAIN"] = self.toolchain()
rustc_path = check_output(["rustup" + BIN_SUFFIX, "which", "rustc"], env=env)
@@ -268,6 +269,11 @@ class PostBuildCommands(CommandBase):
copy2(full_name, destination)
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)
if returncode:
return returncode