Skip to content
Permalink
Browse files

Windows: Add missing dependencies

  • Loading branch information...
UK992 committed Oct 16, 2018
1 parent a011682 commit f4d3d8ee1eeb94f643e113ff7fd52e043204c5ea
Showing with 100 additions and 0 deletions.
  1. +100 −0 python/servo/build_commands.py
@@ -18,6 +18,7 @@
import sys
import urllib
import zipfile
import stat

from time import time

@@ -587,6 +588,105 @@ def build(self, target=None, release=False, dev=False, jobs=None,
for ssl_lib in ["libcryptoMD.dll", "libsslMD.dll"]:
shutil.copy(path.join(env['OPENSSL_LIB_DIR'], "../bin" + msvc_x64, ssl_lib),
servo_exe_dir)
# Search for the generated nspr4.dll
build_path = path.join(servo_exe_dir, "build")
nspr4 = "nspr4.dll"
nspr4_path = None
for root, dirs, files in os.walk(build_path):
if nspr4 in files:
nspr4_path = path.join(root, nspr4)
break
if nspr4_path is None:
print("WARNING: could not find nspr4.dll")
else:
shutil.copy(nspr4_path, servo_exe_dir)
# copy needed gstreamer DLLs in to servo.exe dir
gst_x64 = "X86_64" if msvc_x64 == "64" else "X86"
gst_root = ""
gst_default_path = path.join("C:\\gstreamer\\1.0", gst_x64)
gst_env = "GSTREAMER_1_0_ROOT_" + gst_x64
if os.path.exists(path.join(gst_default_path, "bin", "libz.dll")):
gst_root = gst_default_path
elif os.environ.get(gst_env) is not None:
gst_root = os.environ.get(gst_env)
else:
print("Could not found GStreamer installation directory.")
status = 1
gst_dlls = [
"libz.dll",
"libintl-8.dll",
"liborc-0.4-0.dll",
"libwinpthread-1.dll",
"libffi-7.dll",
"libgobject-2.0-0.dll",
"libglib-2.0-0.dll",
"libgmodule-2.0-0.dll",
"libgstreamer-1.0-0.dll",
"libgstplayer-1.0-0.dll",
"libgstapp-1.0-0.dll",
"libgstaudio-1.0-0.dll",
"libgstvideo-1.0-0.dll",
"libgsttag-1.0-0.dll",
"libgstbase-1.0-0.dll",
"libgstpbutils-1.0-0.dll",
]
if gst_root:
for gst_lib in gst_dlls:
shutil.copy(path.join(gst_root, "bin", gst_lib),
servo_exe_dir)
# copy some MSVC DLLs to servo.exe dir
msvc_redist_dir = None
vs_platform = os.environ.get("PLATFORM", "").lower()
vc_dir = os.environ.get("VCINSTALLDIR", "")
vs_version = os.environ.get("VisualStudioVersion", "")
msvc_deps = [
"api-ms-win-crt-runtime-l1-1-0.dll",
"msvcp140.dll",
"vcruntime140.dll",
]
# Check if it's Visual C++ Build Tools or Visual Studio 2015
vs14_vcvars = path.join(vc_dir, "vcvarsall.bat")
is_vs14 = True if os.path.isfile(vs14_vcvars) or vs_version == "14.0" else False
if is_vs14:
msvc_redist_dir = path.join(vc_dir, "redist", vs_platform, "Microsoft.VC140.CRT")
elif vs_version == "15.0":
redist_dir = path.join(os.environ.get("VCINSTALLDIR", ""), "Redist", "MSVC")
if os.path.isdir(redist_dir):
for p in os.listdir(redist_dir)[::-1]:
redist_path = path.join(redist_dir, p)
for v in ["VC141", "VC150"]:
# there are two possible paths
# `x64\Microsoft.VC*.CRT` or `onecore\x64\Microsoft.VC*.CRT`
redist1 = path.join(redist_path, vs_platform, "Microsoft.{}.CRT".format(v))
redist2 = path.join(redist_path, "onecore", vs_platform, "Microsoft.{}.CRT".format(v))
if os.path.isdir(redist1):
msvc_redist_dir = redist1
break
elif os.path.isdir(redist2):
msvc_redist_dir = redist2
break
if msvc_redist_dir:
break
if msvc_redist_dir:
redist_dirs = [
msvc_redist_dir,
path.join(os.environ["WindowsSdkDir"], "Redist", "ucrt", "DLLs", vs_platform),
]
for msvc_dll in msvc_deps:
dll_found = False
for dll_dir in redist_dirs:
dll = path.join(dll_dir, msvc_dll)
servo_dir_dll = path.join(servo_exe_dir, msvc_dll)
if os.path.isfile(dll):
if os.path.isfile(servo_dir_dll):
# avoid permission denied error when overwrite dll in servo build directory
os.chmod(servo_dir_dll, stat.S_IWUSR)
shutil.copy(dll, servo_exe_dir)
dll_found = True
break
if not dll_found:
print("DLL file `{}` not found!".format(msvc_dll))
status = 1

elif sys.platform == "darwin":
# On the Mac, set a lovely icon. This makes it easier to pick out the Servo binary in tools

0 comments on commit f4d3d8e

Please sign in to comment.
You can’t perform that action at this time.