Skip to content

Commit ffdc9b9

Browse files
committed
Download CEF from opensource.spotify.com
1 parent 6757645 commit ffdc9b9

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

utils/buildactions/install_cef.lua

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ premake.modules.install_cef = {}
44

55
-- Config variables
66
local CEF_PATH = "vendor/cef3/"
7-
local CEF_URL_PREFIX = "https://mirror.mtasa.com/bdata/cef/"
7+
local CEF_URL_PREFIX = "http://opensource.spotify.com/cefbuilds/cef_binary_"
88
local CEF_URL_SUFFIX = "_windows32_minimal.tar.bz2"
99

10-
local CEF_VERSION = "80.0.4+g74f7b0c+chromium-80.0.3987.122" -- Change here to update CEF version
10+
-- Change here to update CEF version
11+
local CEF_VERSION = "80.0.4+g74f7b0c+chromium-80.0.3987.122"
1112

1213
function make_cef_download_url()
1314
return CEF_URL_PREFIX..http.escapeUrlParam(CEF_VERSION)..CEF_URL_SUFFIX
@@ -22,20 +23,15 @@ newaction {
2223
if os.host() ~= "windows" then return end
2324

2425
-- Download md5
25-
local correct_checksum, result_string = http.get(make_cef_download_url()..".md5")
26+
local correct_checksum, result_string = http.get(make_cef_download_url()..".sha1")
2627
if result_string ~= "OK" and result_string then
2728
print("Could not check CEF checksum: "..result_string)
2829
return -- Do nothing and rely on earlier installed files (to allow working offline)
29-
30-
-- TODO(jusonex): It might make sense to fallback to spotify cef mirror
3130
end
3231

33-
-- Trim whitespace
34-
correct_checksum = correct_checksum:gsub("[%s%c]", "")
35-
3632
-- Check md5
3733
local archive_path = CEF_PATH.."temp.tar.bz2"
38-
if os.isfile(archive_path) and os.md5_file(archive_path) == correct_checksum then
34+
if os.isfile(archive_path) and os.sha1_file(archive_path):lower() == correct_checksum then
3935
print("CEF consistency checks succeeded")
4036
return
4137
end
@@ -56,10 +52,10 @@ newaction {
5652
-- Extract first bz2 and then tar
5753
os.extract_archive(archive_path, CEF_PATH, true) -- Extract .tar.bz2 to .tar
5854
os.extract_archive(CEF_PATH.."temp.tar", CEF_PATH, true) -- Extract .tar
59-
55+
6056
-- Move all files from cef_binary*/* to ./
6157
os.expanddir_wildcard(CEF_PATH.."cef_binary*", CEF_PATH)
62-
58+
6359
-- Delete .tar archive, but keep .tar.bz2 for checksumming
6460
os.remove(CEF_PATH.."temp.tar")
6561
end

utils/buildactions/utils.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,18 @@ end
7777
function os.expanddir_wildcard(from, to)
7878
local dir = os.matchdirs(from)[1]
7979
if not dir then return end
80-
80+
8181
-- TODO: Optimize this
8282
os.copydir(dir, to)
8383
os.rmdir(dir)
8484
end
8585

86-
function os.md5_file(path)
86+
function os.sha1_file(path)
8787
if os.host() == "windows" then
88-
local s, errc = os.outputof(string.format("CertUtil -hashfile \"%s\" MD5", path))
89-
return (s:match("\n(.*)\n(.*)") or ""):gsub(" ", "")
88+
local s, errc = os.outputof(string.format("powershell -Command (Get-FileHash \"%s\" -Algorithm SHA1).Hash", path))
89+
return (errc == 0) and s or ""
9090
else
91-
return os.outputof(string.format("md5sum \"%s\" | awk '{ print $1 }'", path))
91+
return os.outputof(string.format("sha1sum \"%s\" | awk '{ print $1 }'", path))
9292
end
9393
end
9494

0 commit comments

Comments
 (0)