servo: Merge #14877 - Package: Create ZIP on Windows and fix MacOS nightlies (from UK992:mach-package); r=Wafflespeanut

Fix https://github.com/servo/servo/issues/14852

r? @Wafflespeanut

Source-Repo: https://github.com/servo/servo
Source-Revision: 698491b8872d9f364e47b4e249851ad35f552a4b
This commit is contained in:
UK992 2017-01-05 21:45:31 -08:00
Родитель 55fe4d2c1f
Коммит ce7a545f6b
4 изменённых файлов: 60 добавлений и 42 удалений

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

@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>servo</string>
<string>run-servo</string>
<key>CFBundleGetInfoString</key>
<string>Servo</string>
<key>CFBundleIconFile</key>

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

@ -106,6 +106,32 @@ def copy_dependencies(binary_path, lib_path):
need_checked.difference_update(checked)
def copy_windows_dependencies(binary_path, destination):
try:
[shutil.copy(path.join(binary_path, d), destination) for d in ["libeay32md.dll", "ssleay32md.dll"]]
except:
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",
]
[shutil.copy(path.join("C:\\msys64\\mingw64\\bin", d), path.join(destination, d)) for d in deps]
def change_prefs(resources_path, platform):
print("Swapping prefs")
prefs_path = path.join(resources_path, "prefs.json")
@ -220,6 +246,16 @@ class PackageCommands(CommandBase):
credits_file.write(template.render(version=version))
delete(template_path)
print("Writing run-servo")
bhtml_path = path.join('${0%/*}', '..', 'Resources', 'browserhtml', 'index.html')
runservo = os.open(
path.join(content_dir, 'run-servo'),
os.O_WRONLY | os.O_CREAT,
int("0755", 8)
)
os.write(runservo, '#!/bin/bash\nexec ${0%/*}/servo ' + bhtml_path)
os.close(runservo)
print("Creating dmg")
os.symlink('/Applications', path.join(dir_to_dmg, 'Applications'))
dmg_path = path.join(target_dir, "servo-tech-demo.dmg")
@ -264,8 +300,14 @@ class PackageCommands(CommandBase):
browserhtml_path = get_browserhtml_path(binary_path)
print("Copying files")
dir_to_resources = path.join(dir_to_msi, 'resources')
dir_to_temp = path.join(dir_to_msi, 'temp')
dir_to_temp_servo = path.join(dir_to_temp, 'servo')
dir_to_resources = path.join(dir_to_temp_servo, 'resources')
shutil.copytree(path.join(dir_to_root, 'resources'), dir_to_resources)
shutil.copytree(browserhtml_path, path.join(dir_to_temp_servo, 'browserhtml'))
shutil.copy(binary_path, dir_to_temp_servo)
shutil.copy("{}.manifest".format(binary_path), dir_to_temp_servo)
copy_windows_dependencies(target_dir, dir_to_temp_servo)
change_prefs(dir_to_resources, "windows")
@ -275,8 +317,8 @@ class PackageCommands(CommandBase):
wxs_path = path.join(dir_to_msi, "Servo.wxs")
open(wxs_path, "w").write(template.render(
exe_path=target_dir,
resources_path=dir_to_resources,
browserhtml_path=browserhtml_path))
dir_to_temp=dir_to_temp_servo,
resources_path=dir_to_resources))
# run candle and light
print("Creating MSI")
@ -293,8 +335,14 @@ class PackageCommands(CommandBase):
except subprocess.CalledProcessError as e:
print("WiX light exited with return value %d" % e.returncode)
return e.returncode
msi_path = path.join(dir_to_msi, "Servo.msi")
print("Packaged Servo into {}".format(msi_path))
print("Packaged Servo into " + path.join(dir_to_msi, "Servo.msi"))
print("Creating ZIP")
shutil.make_archive(path.join(dir_to_msi, "Servo"), "zip", dir_to_temp)
print("Packaged Servo into " + path.join(dir_to_msi, "Servo.zip"))
print("Cleaning up")
delete(dir_to_temp)
else:
dir_to_temp = path.join(target_dir, 'packaging-temp')
browserhtml_path = get_browserhtml_path(binary_path)

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

@ -3,6 +3,5 @@
"dom.mozbrowser.enabled": true,
"shell.builtin-key-shortcuts.enabled": false,
"os:windows,os:linux;shell.homepage": "browserhtml/index.html",
"os:macosx;shell.homepage": "../Resources/browserhtml/index.html",
"os:macosx;shell.native-titlebar.enabled": false
}

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

@ -40,16 +40,11 @@
IconIndex="0"
Advertise="yes"/>
</File>
<File Id="ServoManifest"
Name="servo.exe.manifest"
Source="${windowize(exe_path)}\servo.exe.manifest"
DiskId="1"/>
${include_dependencies()}
</Component>
${include_directory(resources_path, "resources")}
${include_directory(browserhtml_path, "browserhtml")}
${include_directory(path.join(dir_to_temp, "browserhtml"), "browserhtml")}
</Directory>
</Directory>
</Directory>
@ -87,9 +82,7 @@ import uuid
from servo.command_base import host_triple
def make_id(s):
s = s.replace(os.getcwd(), "").replace("-", "_").replace("/", "_").replace("\\", "_")
if "browserhtml" in s:
s = "browserhtml_" + s[s.index("out") + 4:]
s = s.replace("-", "_").replace("/", "_").replace("\\", "_")
return "Id{}".format(s)
def listfiles(directory):
@ -100,30 +93,8 @@ def listdirs(directory):
return [f for f in os.listdir(directory)
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 listdeps(temp_dir):
return [path.join(temp_dir, f) for f in os.listdir(temp_dir) if os.path.isfile(path.join(temp_dir, f)) and f != "servo.exe"]
def windowize(p):
if not p.startswith("/"):
@ -134,7 +105,7 @@ components = []
%>
<%def name="include_dependencies()">
% for f in listdeps(exe_path):
% for f in listdeps(dir_to_temp):
<File Id="${make_id(path.basename(f)).replace(".","").replace("+","x")}"
Name="${path.basename(f)}"
Source="${f}"
@ -150,7 +121,7 @@ components = []
<CreateFolder/>
<% components.append(make_id(path.basename(d))) %>
% for f in listfiles(d):
<File Id="${make_id(path.join(d, f))}"
<File Id="${make_id(path.join(d, f).replace(dir_to_temp, ""))}"
Name="${f}"
Source="${windowize(path.join(d, f))}"
DiskId="1"/>