File tree 5 files changed +21
-1
lines changed
5 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ import("lib.detect.find_program")
36
36
function main (opt )
37
37
opt = opt or {}
38
38
opt .shell = true
39
+ opt .envs = opt .envs or {PATH = os.getenv (" PATH" )}
39
40
local program = find_program (opt .program or " cosmoar" , opt )
40
41
if program and is_host (" windows" ) then
41
42
program = program :gsub (" \\ " , " /" )
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ import("lib.detect.find_programver")
37
37
function main (opt )
38
38
opt = opt or {}
39
39
opt .shell = true
40
- opt .envs = {PATH = os.getenv (" PATH" )}
40
+ opt .envs = opt . envs or {PATH = os.getenv (" PATH" )}
41
41
local program = find_program (opt .program or " cosmocc" , opt )
42
42
if program and is_host (" windows" ) then
43
43
program = program :gsub (" \\ " , " /" )
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ import("lib.detect.find_programver")
37
37
function main (opt )
38
38
opt = opt or {}
39
39
opt .shell = true
40
+ opt .envs = opt .envs or {PATH = os.getenv (" PATH" )}
40
41
local program = find_program (opt .program or " cosmoc++" , opt )
41
42
if program and is_host (" windows" ) then
42
43
program = program :gsub (" \\ " , " /" )
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ function main(toolchain)
32
32
local bindir = toolchain :bindir ()
33
33
34
34
-- find cross toolchain from external envirnoment
35
+ local envs
35
36
local cross_toolchain = find_cross_toolchain (sdkdir , {bindir = bindir })
36
37
if not cross_toolchain then
37
38
-- find it from packages
@@ -40,6 +41,11 @@ function main(toolchain)
40
41
if installdir and os .isdir (installdir ) then
41
42
cross_toolchain = find_cross_toolchain (installdir )
42
43
if cross_toolchain then
44
+ -- we need to bind msys2 shell envirnoments for calling cosmocc,
45
+ -- @see https://github.com/xmake-io/xmake/issues/5552
46
+ if is_subhost (" windows" ) then
47
+ envs = package :envs ()
48
+ end
43
49
break
44
50
end
45
51
end
@@ -57,9 +63,13 @@ function main(toolchain)
57
63
toolchain :config_set (" cross" , cross_toolchain .cross )
58
64
toolchain :config_set (" bindir" , cross_toolchain .bindir )
59
65
toolchain :config_set (" sdkdir" , cross_toolchain .sdkdir )
66
+ if envs then
67
+ toolchain :config_set (" envs" , envs )
68
+ end
60
69
toolchain :configs_save ()
61
70
else
62
71
raise (" cosmocc toolchain not found!" )
63
72
end
64
73
return cross_toolchain
65
74
end
75
+
Original file line number Diff line number Diff line change @@ -45,4 +45,12 @@ toolchain("cosmocc")
45
45
toolchain :set (" toolset" , " ranlib" , " aarch64-linux-cosmo-ranlib" )
46
46
toolchain :set (" toolset" , " strip" , " aarch64-linux-cosmo-strip" )
47
47
end
48
+ -- @see https://github.com/xmake-io/xmake/issues/5552
49
+ local envs = toolchain :config (" envs" )
50
+ if envs then
51
+ for k , v in pairs (envs ) do
52
+ toolchain :add (" runenvs" , k , v )
53
+ end
54
+ end
48
55
end )
56
+
You can’t perform that action at this time.
0 commit comments