summaryrefslogtreecommitdiff
path: root/xmake/modules/private/utils/batchcmds.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2024-07-23 12:50:50 +0800
committerGitHub <[email protected]>2024-07-23 12:50:50 +0800
commitd4364efee8f1906288ac5c650ae7bd101066240a (patch)
tree72baca766710b28ca154f4b0f0983d7e9d8abc00 /xmake/modules/private/utils/batchcmds.lua
parent45852e6ffcd3f043d961574e72f40d287a2898ab (diff)
parent56ca5adad669d45f400198b0c99a1d20f546970c (diff)
Merge pull request #5335 from xmake-io/install
Improve installation
Diffstat (limited to 'xmake/modules/private/utils/batchcmds.lua')
-rw-r--r--xmake/modules/private/utils/batchcmds.lua77
1 files changed, 65 insertions, 12 deletions
diff --git a/xmake/modules/private/utils/batchcmds.lua b/xmake/modules/private/utils/batchcmds.lua
index 6c3742b9f..97f414c77 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,34 @@ 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: remove rpath
+function _runcmd_remove_rpath(cmd, opt)
+ if not opt.dryrun then
+ rpath_utils.remove(cmd.filepath, cmd.rpath, opt.opt)
+ end
+end
+
+-- run command: change rpath
+function _runcmd_change_rpath(cmd, opt)
+ if not opt.dryrun then
+ rpath_utils.change(cmd.filepath, cmd.rpath_old, cmd.rpath_new, opt.opt)
+ end
+end
+
-- run command
function _runcmd(cmd, opt)
local kind = cmd.kind
@@ -180,18 +209,22 @@ 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,
+ remove_rpath = _runcmd_remove_rpath,
+ change_rpath = _runcmd_change_rpath
}
_g.maps = maps
end
@@ -389,6 +422,26 @@ 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 command: remove rpath
+function batchcmds:remove_rpath(filepath, rpath, opt)
+ table.insert(self:cmds(), {kind = "remove_rpath", filepath = filepath, rpath = rpath, opt = opt})
+end
+
+-- add command: change rpath
+function batchcmds:change_rpath(filepath, rpath_old, rpath_new, opt)
+ table.insert(self:cmds(), {kind = "change_rpath", filepath = filepath, rpath_old = rpath_old, rpath_new = rpath_new, 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})