From 0f525d908da229218c88a30cdaa837d492f802be Mon Sep 17 00:00:00 2001 From: Glenn Watson Date: Thu, 22 Jan 2015 09:08:39 +1000 Subject: Change glutin headless mode to be a build config, as it breaks some Linux distros linking to both. The majority of this change is simply re-arranging the code in the glutin port so that the windowed/headless code is configured at build time rather than runtime. There shouldn't be any functional difference as a result of this change. --- python/servo/build_commands.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'python/servo/build_commands.py') diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py index 78d9fb51318..c4f6edc62b8 100644 --- a/python/servo/build_commands.py +++ b/python/servo/build_commands.py @@ -1,5 +1,6 @@ from __future__ import print_function, unicode_literals +import os import os.path as path import subprocess from time import time @@ -12,6 +13,8 @@ from mach.decorators import ( from servo.command_base import CommandBase, cd +def is_headless_build(): + return int(os.getenv('SERVO_HEADLESS', 0)) == 1 @CommandProvider class MachCommands(CommandBase): @@ -69,6 +72,10 @@ class MachCommands(CommandBase): if debug_mozjs or self.config["build"]["debug-mozjs"]: features += ["script/debugmozjs"] + if is_headless_build(): + opts += ["--no-default-features"] + features += ["glutin_app", "headless"] + if features: opts += ["--features", "%s" % ' '.join(features)] @@ -132,11 +139,11 @@ class MachCommands(CommandBase): help='Number of jobs to run in parallel') def build_tests(self, jobs=None): self.ensure_bootstrapped() - opts = [] - if jobs is not None: - opts += ["-j", jobs] + args = ["cargo", "test", "--no-run"] + if is_headless_build(): + args += ["--no-default-features", "--features", "glutin_app headless"] return subprocess.call( - ["cargo", "test", "--no-run"], + args, env=self.build_env(), cwd=self.servo_crate()) @Command('clean', -- cgit v1.2.3