mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Do not require setting PKG_CONFIG_PATH on Windows
This commit is contained in:
parent
00a9f30773
commit
72e28dffcd
2 changed files with 29 additions and 28 deletions
|
@ -30,7 +30,7 @@ from mach.decorators import (
|
||||||
from mach.registrar import Registrar
|
from mach.registrar import Registrar
|
||||||
|
|
||||||
from mach_bootstrap import _get_exec_path
|
from mach_bootstrap import _get_exec_path
|
||||||
from servo.command_base import CommandBase, cd, call, check_call, BIN_SUFFIX, append_to_path_env
|
from servo.command_base import CommandBase, cd, call, check_call, BIN_SUFFIX, append_to_path_env, gstreamer_root
|
||||||
from servo.util import host_triple
|
from servo.util import host_triple
|
||||||
|
|
||||||
|
|
||||||
|
@ -776,23 +776,6 @@ class MachCommands(CommandBase):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def gstreamer_root(target, env):
|
|
||||||
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
|
|
||||||
else:
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
def package_gstreamer_dlls(env, servo_exe_dir, target, uwp):
|
def package_gstreamer_dlls(env, servo_exe_dir, target, uwp):
|
||||||
gst_root = gstreamer_root(target, env)
|
gst_root = gstreamer_root(target, env)
|
||||||
if not gst_root:
|
if not gst_root:
|
||||||
|
|
|
@ -239,6 +239,25 @@ def set_osmesa_env(bin_path, env):
|
||||||
return 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):
|
class BuildNotFound(Exception):
|
||||||
def __init__(self, message):
|
def __init__(self, message):
|
||||||
self.message = message
|
self.message = message
|
||||||
|
@ -365,9 +384,6 @@ class CommandBase(object):
|
||||||
build_type = "release" if release else "debug"
|
build_type = "release" if release else "debug"
|
||||||
return path.join(base_path, build_type, apk_name)
|
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):
|
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
|
# TODO(autrilla): this function could still use work - it shouldn't
|
||||||
# handle quitting, or printing. It should return the path, or an error.
|
# 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)
|
return self.get_executable(destination_folder)
|
||||||
|
|
||||||
def needs_gstreamer_env(self, target):
|
def needs_gstreamer_env(self, target, env):
|
||||||
try:
|
try:
|
||||||
if check_gstreamer_lib():
|
if check_gstreamer_lib():
|
||||||
return False
|
return False
|
||||||
|
@ -554,8 +570,8 @@ class CommandBase(object):
|
||||||
if "x86_64" not in effective_target or "android" in effective_target:
|
if "x86_64" not in effective_target or "android" in effective_target:
|
||||||
# We don't build gstreamer for non-x86_64 / android yet
|
# We don't build gstreamer for non-x86_64 / android yet
|
||||||
return False
|
return False
|
||||||
if sys.platform == "linux2":
|
if sys.platform == "linux2" or is_windows:
|
||||||
if path.isdir(self.get_gstreamer_path()):
|
if path.isdir(gstreamer_root(effective_target, env, self.get_top_dir)):
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
raise Exception("Your system's gstreamer libraries are out of date \
|
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):
|
def set_run_env(self, android=False):
|
||||||
"""Some commands, like test-wpt, don't use a full build env,
|
"""Some commands, like test-wpt, don't use a full build env,
|
||||||
but may still need dynamic search paths. This command sets that up"""
|
but may still need dynamic search paths. This command sets that up"""
|
||||||
if not android and self.needs_gstreamer_env(None):
|
if not android and self.needs_gstreamer_env(None, os.environ):
|
||||||
gstpath = self.get_gstreamer_path()
|
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["LD_LIBRARY_PATH"] = path.join(gstpath, "lib")
|
||||||
os.environ["GST_PLUGIN_SYSTEM_PATH"] = path.join(gstpath, "lib", "gstreamer-1.0")
|
os.environ["GST_PLUGIN_SYSTEM_PATH"] = path.join(gstpath, "lib", "gstreamer-1.0")
|
||||||
os.environ["PKG_CONFIG_PATH"] = path.join(gstpath, "lib", "pkgconfig")
|
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
|
# Always build harfbuzz from source
|
||||||
env["HARFBUZZ_SYS_NO_PKG_CONFIG"] = "true"
|
env["HARFBUZZ_SYS_NO_PKG_CONFIG"] = "true"
|
||||||
|
|
||||||
if self.needs_gstreamer_env(target):
|
if self.needs_gstreamer_env(target or host_triple(), env):
|
||||||
gstpath = self.get_gstreamer_path()
|
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")
|
||||||
# we append in the reverse order so that system gstreamer libraries
|
# we append in the reverse order so that system gstreamer libraries
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue