Skip to content

Commit

Permalink
fix(scripting/v8): bundle icudtl for linux (hotfix)
Browse files Browse the repository at this point in the history
Final hotfix before returning to PR flow.
  • Loading branch information
blattersturm committed Sep 18, 2021
1 parent bdd2d7c commit 98e9c7b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 7 deletions.
5 changes: 4 additions & 1 deletion code/components/citizen-scripting-v8/src/V8ScriptRuntime.cpp
Expand Up @@ -2667,9 +2667,12 @@ void V8ScriptGlobals::Initialize()
const char* flags = "--turbo-inline-js-wasm-calls --expose_gc --harmony-top-level-await";
V8::SetFlagsFromString(flags, strlen(flags));

auto icuDataPath = MakeRelativeCitPath(fmt::sprintf(_P("citizen/scripting/v8/%d.%d/icudtl.dat"), V8_MAJOR_VERSION, V8_MINOR_VERSION));

#ifdef _WIN32
auto icuDataPath = MakeRelativeCitPath(fmt::sprintf(L"citizen/scripting/v8/%d.%d/icudtl.dat", V8_MAJOR_VERSION, V8_MINOR_VERSION));
V8::InitializeICUDefaultLocation(ToNarrow(MakeRelativeCitPath(L"dummy")).c_str(), ToNarrow(icuDataPath).c_str());
#else
V8::InitializeICU(icuDataPath.c_str());
#endif

// initialize global V8
Expand Down
33 changes: 27 additions & 6 deletions code/vendor/v8-base.lua
Expand Up @@ -25,18 +25,19 @@ return {
run = function()
kind 'Utility'

if os.istarget('windows') then
files {
('../vendor/v8/%s/tag.txt'):format(baseVersion)
}
files {
('../vendor/v8/%s/tag.txt'):format(baseVersion)
}

local v8share = ('vendor/v8/%s/share/'):format(baseVersion)
local v8sharedir = path.getabsolute('../') .. '/' .. v8share

if os.istarget('windows') then
filter 'files:**/tag.txt'
buildmessage 'Preparing V8'

local v8bin = ('vendor/v8/%s/bin/%%{cfg.shortname:lower()}'):format(baseVersion)
local v8bindir = path.getabsolute('../') .. '/' .. v8bin
local v8share = ('vendor/v8/%s/share/'):format(baseVersion)
local v8sharedir = path.getabsolute('../') .. '/' .. v8share
local v8url = baseURL .. '/' .. v8bin
local v8dll = ('v8-%s.dll'):format(version)

Expand All @@ -61,6 +62,26 @@ return {
('{COPY} %s/%s %%{cfg.targetdir}/citizen/scripting/v8/%s/'):format(v8bindir, 'snapshot_blob.bin', baseVersion),
('{COPY} %s/%s %%{cfg.targetdir}/citizen/scripting/v8/%s/'):format(v8sharedir, '*.dat', baseVersion),
}
else
filter 'files:**/tag.txt'
buildmessage 'Preparing V8'

buildinputs {
v8sharedir .. '/icudtl.dat',
v8sharedir .. '/icudtl_extra.dat'
}

buildoutputs {
('%%{cfg.targetdir}/citizen/scripting/v8/%s/icudtl.dat'):format(baseVersion),
('%%{cfg.targetdir}/citizen/scripting/v8/%s/icudtl_extra.dat'):format(baseVersion)
}

buildcommands {
('{MKDIR} %%{cfg.targetdir}/citizen/scripting/v8/%s/'):format(baseVersion),
('{COPY} %s/%s %%{cfg.targetdir}/citizen/scripting/v8/%s/'):format(v8sharedir, '*.dat', baseVersion),
}
end

filter {}
end
}

0 comments on commit 98e9c7b

Please sign in to comment.