diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2019-08-20 22:42:12 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-20 22:42:12 -0400 |
commit | 2e0d1ad567dce6be99dbae33c3e0dd9993a8d4fb (patch) | |
tree | 71eaedb753e1ff512caa65eb37806b20b37e05c7 /python/servo/command_base.py | |
parent | 6af82582ebaa8135a436cda463779d9a0fe6c5b6 (diff) | |
parent | 7d167461e860e90d83bdaceea83a719bb216690b (diff) | |
download | servo-2e0d1ad567dce6be99dbae33c3e0dd9993a8d4fb.tar.gz servo-2e0d1ad567dce6be99dbae33c3e0dd9993a8d4fb.zip |
Auto merge of #24005 - ferjm:windows.pkgconfig, r=Manishearth
Simplify Windows build by not setting PKG_CONFIG_PATH
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #23177
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/24005)
<!-- Reviewable:end -->
Diffstat (limited to 'python/servo/command_base.py')
-rw-r--r-- | python/servo/command_base.py | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/python/servo/command_base.py b/python/servo/command_base.py index b4e5c5d942f..94757dbf3b9 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -239,6 +239,25 @@ def set_osmesa_env(bin_path, env): return env +def gstreamer_root(target, env, topdir=None): + if is_windows: + arch = { + "x86_64": "X86_64", + "x86": "X86", + "aarch64": "ARM64", + } + gst_x64 = arch[target.split('-')[0]] + gst_default_path = path.join("C:\\gstreamer\\1.0", gst_x64) + gst_env = "GSTREAMER_1_0_ROOT_" + gst_x64 + if env.get(gst_env) is not None: + return env.get(gst_env) + elif os.path.exists(path.join(gst_default_path, "bin", "ffi-7.dll")): + return gst_default_path + elif sys.platform == "linux2": + return path.join(topdir, "support", "linux", "gstreamer", "gst") + return None + + class BuildNotFound(Exception): def __init__(self, message): self.message = message @@ -365,9 +384,6 @@ class CommandBase(object): build_type = "release" if release else "debug" return path.join(base_path, build_type, apk_name) - def get_gstreamer_path(self): - return path.join(self.context.topdir, "support", "linux", "gstreamer", "gst") - def get_binary_path(self, release, dev, target=None, android=False, magicleap=False, simpleservo=False): # TODO(autrilla): this function could still use work - it shouldn't # handle quitting, or printing. It should return the path, or an error. @@ -542,7 +558,7 @@ class CommandBase(object): return self.get_executable(destination_folder) - def needs_gstreamer_env(self, target): + def needs_gstreamer_env(self, target, env): try: if check_gstreamer_lib(): return False @@ -554,8 +570,8 @@ class CommandBase(object): if "x86_64" not in effective_target or "android" in effective_target: # We don't build gstreamer for non-x86_64 / android yet return False - if sys.platform == "linux2": - if path.isdir(self.get_gstreamer_path()): + if sys.platform == "linux2" or is_windows: + if path.isdir(gstreamer_root(effective_target, env, self.get_top_dir)): return True else: raise Exception("Your system's gstreamer libraries are out of date \ @@ -569,8 +585,10 @@ install them, let us know by filing a bug!") def set_run_env(self, android=False): """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 not android and self.needs_gstreamer_env(None): - gstpath = self.get_gstreamer_path() + if not android and self.needs_gstreamer_env(None, os.environ): + gstpath = gstreamer_root(host_triple(), os.environ, self.get_top_dir) + if gstpath is None: + return os.environ["LD_LIBRARY_PATH"] = path.join(gstpath, "lib") os.environ["GST_PLUGIN_SYSTEM_PATH"] = path.join(gstpath, "lib", "gstreamer-1.0") os.environ["PKG_CONFIG_PATH"] = path.join(gstpath, "lib", "pkgconfig") @@ -624,8 +642,8 @@ install them, let us know by filing a bug!") # Always build harfbuzz from source env["HARFBUZZ_SYS_NO_PKG_CONFIG"] = "true" - if self.needs_gstreamer_env(target): - gstpath = self.get_gstreamer_path() + if self.needs_gstreamer_env(target or host_triple(), env): + gstpath = gstreamer_root(target or host_triple(), env, self.get_top_dir()) extra_path += [path.join(gstpath, "bin")] libpath = path.join(gstpath, "lib") # we append in the reverse order so that system gstreamer libraries |