Allow WPT to be run with local gstreamer

This commit is contained in:
Manish Goregaokar 2018-09-03 13:54:20 +05:30
parent eba68a1a49
commit 36797801e9
2 changed files with 25 additions and 11 deletions

View file

@ -477,6 +477,23 @@ class CommandBase(object):
bin_folder = path.join(destination_folder, "PFiles", "Mozilla research", "Servo Tech Demo")
return path.join(bin_folder, "servo{}".format(BIN_SUFFIX))
def needs_gstreamer_env(self, target):
gstpath = path.join(self.context.topdir, "support", "linux", "gstreamer", "gstreamer")
if sys.platform == "linux2" and path.isdir(gstpath):
if not check_gstreamer_lib():
if "x86_64" not in (target or host_triple()):
raise Exception("We don't currently support using local gstreamer builds \
for non-x86_64, please file a bug")
return True
return False
def set_run_env(self):
"""Some commands, like test-wpt, don't use a full build env,
but may still need dynamic search paths. This command sets that up"""
if self.needs_gstreamer_env(None):
gstpath = path.join(self.context.topdir, "support", "linux", "gstreamer", "gstreamer")
os.environ["LD_LIBRARY_PATH"] = path.join(gstpath, "lib", "x86_64-linux-gnu")
def build_env(self, hosts_file_path=None, target=None, is_build=False, test_unit=False):
"""Return an extended environment dictionary."""
env = os.environ.copy()
@ -519,17 +536,13 @@ class CommandBase(object):
# Always build harfbuzz from source
env["HARFBUZZ_SYS_NO_PKG_CONFIG"] = "true"
gstpath = path.join(os.getcwd(), "support", "linux", "gstreamer", "gstreamer")
if sys.platform == "linux2" and path.isdir(gstpath):
if not check_gstreamer_lib():
if "x86_64" not in (target or host_triple()):
raise Exception("We don't currently support using local gstreamer builds \
for non-x86_64, please file a bug")
extra_path += [path.join(gstpath, "bin")]
libpath = path.join(gstpath, "lib", "x86_64-linux-gnu")
extra_path += [libpath]
extra_lib += [libpath]
append_to_path_env(path.join(libpath, "pkgconfig"), env, "PKG_CONFIG_PATH")
if self.needs_gstreamer_env(target):
gstpath = path.join(self.context.topdir, "support", "linux", "gstreamer", "gstreamer")
extra_path += [path.join(gstpath, "bin")]
libpath = path.join(gstpath, "lib", "x86_64-linux-gnu")
extra_path += [libpath]
extra_lib += [libpath]
append_to_path_env(path.join(libpath, "pkgconfig"), env, "PKG_CONFIG_PATH")
if extra_path:
env["PATH"] = "%s%s%s" % (os.pathsep.join(extra_path), os.pathsep, env["PATH"])