servo: Merge #14531 - Various Windows installer fixes and improvements (from UK992:win32-installer); r=larsbergstrom

r? @metajack or @larsbergstrom

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors

Source-Repo: https://github.com/servo/servo
Source-Revision: ced1199c61ef93e56269fbe803cb6d7ee4df25c7
This commit is contained in:
UK992 2016-12-12 13:07:25 -08:00
Родитель d9d8fc335a
Коммит 85a80d3a5a
2 изменённых файлов: 66 добавлений и 82 удалений

Просмотреть файл

@ -329,33 +329,44 @@ class PackageCommands(CommandBase):
print("Packaged Servo into " + tar_path) print("Packaged Servo into " + tar_path)
@Command('install', @Command('install',
description='Install Servo (currently, Android only)', description='Install Servo (currently, Android and Windows only)',
category='package') category='package')
@CommandArgument('--release', '-r', action='store_true', @CommandArgument('--release', '-r', action='store_true',
help='Install the release build') help='Install the release build')
@CommandArgument('--dev', '-d', action='store_true', @CommandArgument('--dev', '-d', action='store_true',
help='Install the dev build') help='Install the dev build')
def install(self, release=False, dev=False): @CommandArgument('--android',
action='store_true',
help='Install on Android')
def install(self, release=False, dev=False, android=False):
try: try:
binary_path = self.get_binary_path(release, dev, android=True) binary_path = self.get_binary_path(release, dev, android=android)
except BuildNotFound: except BuildNotFound:
print("Servo build not found. Building servo...") print("Servo build not found. Building servo...")
result = Registrar.dispatch( result = Registrar.dispatch(
"build", context=self.context, release=release, dev=dev "build", context=self.context, release=release, dev=dev, android=android
) )
if result: if result:
return result return result
try: try:
binary_path = self.get_binary_path(release, dev, android=True) binary_path = self.get_binary_path(release, dev, android=android)
except BuildNotFound: except BuildNotFound:
print("Rebuilding Servo did not solve the missing build problem.") print("Rebuilding Servo did not solve the missing build problem.")
return 1 return 1
apk_path = binary_path + ".apk" if android:
if not path.exists(apk_path): pkg_path = binary_path + ".apk"
result = Registrar.dispatch("package", context=self.context, release=release, dev=dev) exec_command = ["adb", "install", "-r", pkg_path]
elif is_windows():
pkg_path = path.join(path.dirname(binary_path), 'msi', 'Servo.msi')
exec_command = ["msiexec", "/i", pkg_path]
if not path.exists(pkg_path):
result = Registrar.dispatch(
"package", context=self.context, release=release, dev=dev, android=android
)
if result != 0: if result != 0:
return result return result
print(["adb", "install", "-r", apk_path]) print(" ".join(exec_command))
return subprocess.call(["adb", "install", "-r", apk_path], env=self.build_env()) return subprocess.call(exec_command, env=self.build_env())

Просмотреть файл

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Name="Servo Tech Demo" <Product Id="*"
Name="Servo Tech Demo"
Manufacturer="Mozilla Research" Manufacturer="Mozilla Research"
Id="5807391a-3a17-476b-a5d2-5f1912569762"
UpgradeCode="060cd15d-eab1-4614-b438-3988e3efdcf1" UpgradeCode="060cd15d-eab1-4614-b438-3988e3efdcf1"
Language="1033" Language="1033"
Codepage="1252" Codepage="1252"
@ -16,6 +16,7 @@
Languages="1033" Languages="1033"
SummaryCodepage="1252" SummaryCodepage="1252"
Compressed="yes"/> Compressed="yes"/>
<MajorUpgrade AllowDowngrades="yes"/>
<Media Id="1" <Media Id="1"
Cabinet="Servo.cab" Cabinet="Servo.cab"
EmbedCab="yes"/> EmbedCab="yes"/>
@ -45,74 +46,7 @@
Source="${windowize(exe_path)}\servo.exe.manifest" Source="${windowize(exe_path)}\servo.exe.manifest"
DiskId="1"/> DiskId="1"/>
<File Id="StdcxxDLL" ${include_dependencies()}
Name="libstdc++-6.dll"
Source="C:\msys64\mingw64\bin\libstdc++-6.dll"
DiskId="1"/>
<File Id="WinpthreadDll"
Name="libwinpthread-1.dll"
Source="C:\msys64\mingw64\bin\libwinpthread-1.dll"
DiskId="1"/>
<File Id="Bzip2Dll"
Name="libbz2-1.dll"
Source="C:\msys64\mingw64\bin\libbz2-1.dll"
DiskId="1"/>
<File Id="GccsehDll"
Name="libgcc_s_seh-1.dll"
Source="C:\msys64\mingw64\bin\libgcc_s_seh-1.dll"
DiskId="1"/>
<File Id="ExpatDll"
Name="libexpat-1.dll"
Source="C:\msys64\mingw64\bin\libexpat-1.dll"
DiskId="1"/>
<File Id="ZlibDll"
Name="zlib1.dll"
Source="C:\msys64\mingw64\bin\zlib1.dll"
DiskId="1"/>
<File Id="PngDll"
Name="libpng16-16.dll"
Source="C:\msys64\mingw64\bin\libpng16-16.dll"
DiskId="1"/>
<File Id="IconvDll"
Name="libiconv-2.dll"
Source="C:\msys64\mingw64\bin\libiconv-2.dll"
DiskId="1"/>
<File Id="GlibDll"
Name="libglib-2.0-0.dll"
Source="C:\msys64\mingw64\bin\libglib-2.0-0.dll"
DiskId="1"/>
<File Id="GraphiteDll"
Name="libgraphite2.dll"
Source="C:\msys64\mingw64\bin\libgraphite2.dll"
DiskId="1"/>
<File Id="IntlDll"
Name="libintl-8.dll"
Source="C:\msys64\mingw64\bin\libintl-8.dll"
DiskId="1"/>
<File Id="PcreDll"
Name="libpcre-1.dll"
Source="C:\msys64\mingw64\bin\libpcre-1.dll"
DiskId="1"/>
<File Id="Eay32Dll"
Name="libeay32.dll"
Source="C:\msys64\mingw64\bin\libeay32.dll"
DiskId="1"/>
<File Id="Ssleay32Dll"
Name="ssleay32.dll"
Source="C:\msys64\mingw64\bin\ssleay32.dll"
DiskId="1"/>
<File Id="HarfbuzzDll"
Name="libharfbuzz-0.dll"
Source="C:\msys64\mingw64\bin\libharfbuzz-0.dll"
DiskId="1"/>
<File Id="FreetypeDll"
Name="libfreetype-6.dll"
Source="C:\msys64\mingw64\bin\libfreetype-6.dll"
DiskId="1"/>
<File Id="FontconfigDll"
Name="libfontconfig-1.dll"
Source="C:\msys64\mingw64\bin\libfontconfig-1.dll"
DiskId="1"/>
</Component> </Component>
${include_directory(path.join(top_path, "resources"), "resources")} ${include_directory(path.join(top_path, "resources"), "resources")}
@ -124,7 +58,7 @@
<Directory Id="ProgramMenuFolder" Name="Programs"> <Directory Id="ProgramMenuFolder" Name="Programs">
<Directory Id="ProgramMenuDir" Name="Servo Tech Demo"> <Directory Id="ProgramMenuDir" Name="Servo Tech Demo">
<Component Id="ProgramMenuDir" Guid="e04737ce-16eb-4977-9b4c-ed2db8a5a77d"> <Component Id="ProgramMenuDir" Guid="e04737ce-16eb-4977-9b4c-ed2db8a5a77d">
<RemoveFolder Id="ProgramMenuDir" On="uninstall"/> <RemoveFolder Id="ProgramMenuDir" On="both"/>
<RegistryValue Root="HKCU" <RegistryValue Root="HKCU"
Key="Software\Mozilla Research\Servo Tech Demo" Key="Software\Mozilla Research\Servo Tech Demo"
Type="string" Type="string"
@ -151,9 +85,13 @@ import os
import os.path as path import os.path as path
import re import re
import uuid import uuid
from servo.command_base import host_triple
def make_id(s): def make_id(s):
return "Id{}".format(s.replace("-", "_").replace("/", "_")) s = s.replace(os.getcwd(), "").replace("-", "_").replace("/", "_").replace("\\", "_")
if "browserhtml" in s:
s = "browserhtml_" + s[s.index("out") + 4:]
return "Id{}".format(s)
def listfiles(directory): def listfiles(directory):
return [f for f in os.listdir(directory) return [f for f in os.listdir(directory)
@ -163,6 +101,31 @@ def listdirs(directory):
return [f for f in os.listdir(directory) return [f for f in os.listdir(directory)
if path.isdir(path.join(directory, f))] if path.isdir(path.join(directory, f))]
def listdeps(exe_path):
if "msvc" in host_triple():
return [path.join(windowize(exe_path), d) for d in ["libeay32md.dll", "ssleay32md.dll"]]
elif "gnu" in host_triple():
deps = [
"libstdc++-6.dll",
"libwinpthread-1.dll",
"libbz2-1.dll",
"libgcc_s_seh-1.dll",
"libexpat-1.dll",
"zlib1.dll",
"libpng16-16.dll",
"libiconv-2.dll",
"libglib-2.0-0.dll",
"libgraphite2.dll",
"libfreetype-6.dll",
"libfontconfig-1.dll",
"libintl-8.dll",
"libpcre-1.dll",
"libeay32.dll",
"ssleay32.dll",
"libharfbuzz-0.dll",
]
return [path.join("C:\\msys64\\mingw64\\bin", d) for d in deps]
def windowize(p): def windowize(p):
if not p.startswith("/"): if not p.startswith("/"):
return p return p
@ -170,6 +133,16 @@ def windowize(p):
components = [] components = []
%> %>
<%def name="include_dependencies()">
% for f in listdeps(exe_path):
<File Id="${make_id(path.basename(f)).replace(".","").replace("+","x")}"
Name="${path.basename(f)}"
Source="${f}"
DiskId="1"/>
% endfor
</%def>
<%def name="include_directory(d, n)"> <%def name="include_directory(d, n)">
<Directory Id="${make_id(path.basename(d))}" Name="${n}"> <Directory Id="${make_id(path.basename(d))}" Name="${n}">
<Component Id="${make_id(path.basename(d))}" <Component Id="${make_id(path.basename(d))}"