summaryrefslogtreecommitdiff
path: root/xmake/modules/private/utils/batchcmds.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2024-07-17 00:57:22 +0800
committerruki <[email protected]>2024-07-17 00:57:22 +0800
commitad8a223ce684cd394179aca49fbea9c7b2e0d4c0 (patch)
tree336c5e99524b50b66780eb4da5fcd31b3543c24a /xmake/modules/private/utils/batchcmds.lua
parent10df5c458fcf66832c0ef437157c7397f2283b18 (diff)
add rpath for xpack
Diffstat (limited to 'xmake/modules/private/utils/batchcmds.lua')
-rw-r--r--xmake/modules/private/utils/batchcmds.lua51
1 files changed, 39 insertions, 12 deletions
diff --git a/xmake/modules/private/utils/batchcmds.lua b/xmake/modules/private/utils/batchcmds.lua
index 6c3742b9f..3ea49ea8d 100644
--- a/xmake/modules/private/utils/batchcmds.lua
+++ b/xmake/modules/private/utils/batchcmds.lua
@@ -29,6 +29,7 @@ import("core.tool.linker")
import("core.tool.compiler")
import("core.language.language")
import("utils.progress", {alias = "progress_utils"})
+import("utils.binary.rpath", {alias = "rpath_utils"})
-- define module
local batchcmds = batchcmds or object { _init = {"_TARGET", "_CMDS", "_DEPINFO", "_tip"}}
@@ -173,6 +174,20 @@ function _runcmd_ln(cmd, opt)
end
end
+-- run command: clean rpath
+function _runcmd_clean_rpath(cmd, opt)
+ if not opt.dryrun then
+ rpath_utils.clean(cmd.filepath, opt.opt)
+ end
+end
+
+-- run command: insert rpath
+function _runcmd_insert_rpath(cmd, opt)
+ if not opt.dryrun then
+ rpath_utils.insert(cmd.filepath, cmd.rpath, opt.opt)
+ end
+end
+
-- run command
function _runcmd(cmd, opt)
local kind = cmd.kind
@@ -180,18 +195,20 @@ function _runcmd(cmd, opt)
if not maps then
maps =
{
- show = _runcmd_show,
- runv = _runcmd_runv,
- vrunv = _runcmd_vrunv,
- execv = _runcmd_execv,
- vexecv = _runcmd_vexecv,
- mkdir = _runcmd_mkdir,
- rmdir = _runcmd_rmdir,
- cd = _runcmd_cd,
- rm = _runcmd_rm,
- cp = _runcmd_cp,
- mv = _runcmd_mv,
- ln = _runcmd_ln
+ show = _runcmd_show,
+ runv = _runcmd_runv,
+ vrunv = _runcmd_vrunv,
+ execv = _runcmd_execv,
+ vexecv = _runcmd_vexecv,
+ mkdir = _runcmd_mkdir,
+ rmdir = _runcmd_rmdir,
+ cd = _runcmd_cd,
+ rm = _runcmd_rm,
+ cp = _runcmd_cp,
+ mv = _runcmd_mv,
+ ln = _runcmd_ln,
+ clean_rpath = _runcmd_clean_rpath,
+ insert_rpath = _runcmd_insert_rpath
}
_g.maps = maps
end
@@ -389,6 +406,16 @@ function batchcmds:show(format, ...)
table.insert(self:cmds(), {kind = "show", showtext = showtext})
end
+-- add command: clean rpath
+function batchcmds:clean_rpath(filepath, opt)
+ table.insert(self:cmds(), {kind = "clean_rpath", filepath = filepath, opt = opt})
+end
+
+-- add command: insert rpath
+function batchcmds:insert_rpath(filepath, rpath, opt)
+ table.insert(self:cmds(), {kind = "insert_rpath", filepath = filepath, rpath = rpath, opt = opt})
+end
+
-- add raw command for the specific generator or xpack format
function batchcmds:rawcmd(kind, rawstr)
table.insert(self:cmds(), {kind = kind, rawstr = rawstr})