summaryrefslogtreecommitdiff
path: root/xmake/modules/core/tools
diff options
context:
space:
mode:
authorruki <[email protected]>2024-02-06 22:44:21 +0800
committerruki <[email protected]>2024-02-06 22:44:21 +0800
commit78a1a52f425010571eda84ab1cefeb11d78c20c8 (patch)
treed6e1a9e42a68a2e8674b96abd015800c572a5276 /xmake/modules/core/tools
parent469f941f5680273b5b734996677b055a776f0056 (diff)
add cosmoar support
Diffstat (limited to 'xmake/modules/core/tools')
-rw-r--r--xmake/modules/core/tools/ar.lua5
-rw-r--r--xmake/modules/core/tools/cosmoar.lua38
-rw-r--r--xmake/modules/core/tools/cosmocc.lua1
3 files changed, 42 insertions, 2 deletions
diff --git a/xmake/modules/core/tools/ar.lua b/xmake/modules/core/tools/ar.lua
index 0496238b4..b302504d8 100644
--- a/xmake/modules/core/tools/ar.lua
+++ b/xmake/modules/core/tools/ar.lua
@@ -49,7 +49,8 @@ function linkargv(self, objectfiles, targetkind, targetfile, flags, opt)
end
-- link the library file
-function link(self, objectfiles, targetkind, targetfile, flags)
+function link(self, objectfiles, targetkind, targetfile, flags, opt)
+ opt = opt or {}
os.mkdir(path.directory(targetfile))
-- @note remove the previous archived file first to force recreating a new file
@@ -57,7 +58,7 @@ function link(self, objectfiles, targetkind, targetfile, flags)
-- link it
local program, argv = linkargv(self, objectfiles, targetkind, targetfile, flags)
- os.runv(program, argv, {envs = self:runenvs()})
+ os.runv(program, argv, {envs = self:runenvs(), shell = opt.shell})
end
diff --git a/xmake/modules/core/tools/cosmoar.lua b/xmake/modules/core/tools/cosmoar.lua
new file mode 100644
index 000000000..2ee1741ae
--- /dev/null
+++ b/xmake/modules/core/tools/cosmoar.lua
@@ -0,0 +1,38 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015-present, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file cosmoar.lua
+--
+
+inherit("ar")
+
+function init(self)
+ _super.init(self)
+end
+
+function link(self, objectfiles, targetkind, targetfile, flags, opt)
+ opt = opt or {}
+ if is_host("windows") then
+ targetfile = targetfile:gsub("\\", "/")
+ local objectfiles_new = {}
+ for idx, objectfile in ipairs(objectfiles) do
+ objectfiles_new[idx] = objectfiles[idx]:gsub("\\", "/")
+ end
+ objectfiles = objectfiles_new
+ end
+ return _super.link(self, objectfiles, targetkind, targetfile, flags, table.join(opt, {shell = true}))
+end
diff --git a/xmake/modules/core/tools/cosmocc.lua b/xmake/modules/core/tools/cosmocc.lua
index 60f25a3f0..c53f6e1c5 100644
--- a/xmake/modules/core/tools/cosmocc.lua
+++ b/xmake/modules/core/tools/cosmocc.lua
@@ -32,6 +32,7 @@ end
-- link the target file
function link(self, objectfiles, targetkind, targetfile, flags, opt)
+ opt = opt or {}
if is_host("windows") then
targetfile = targetfile:gsub("\\", "/")
local objectfiles_new = {}