summaryrefslogtreecommitdiff
path: root/xmake/modules/private/utils/batchcmds.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2024-07-17 00:57:56 +0800
committerruki <[email protected]>2024-07-17 00:57:56 +0800
commit61325d912523d963241467a3dc5a2e20fe63ef42 (patch)
treeef40445e244afb700d1d305cadfbed9f15cb5197 /xmake/modules/private/utils/batchcmds.lua
parentad8a223ce684cd394179aca49fbea9c7b2e0d4c0 (diff)
improve batchcmds
Diffstat (limited to 'xmake/modules/private/utils/batchcmds.lua')
-rw-r--r--xmake/modules/private/utils/batchcmds.lua28
1 files changed, 27 insertions, 1 deletions
diff --git a/xmake/modules/private/utils/batchcmds.lua b/xmake/modules/private/utils/batchcmds.lua
index 3ea49ea8d..97f414c77 100644
--- a/xmake/modules/private/utils/batchcmds.lua
+++ b/xmake/modules/private/utils/batchcmds.lua
@@ -188,6 +188,20 @@ function _runcmd_insert_rpath(cmd, 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
@@ -208,7 +222,9 @@ function _runcmd(cmd, opt)
mv = _runcmd_mv,
ln = _runcmd_ln,
clean_rpath = _runcmd_clean_rpath,
- insert_rpath = _runcmd_insert_rpath
+ insert_rpath = _runcmd_insert_rpath,
+ remove_rpath = _runcmd_remove_rpath,
+ change_rpath = _runcmd_change_rpath
}
_g.maps = maps
end
@@ -416,6 +432,16 @@ 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})