summaryrefslogtreecommitdiff
path: root/xmake/plugins/pack/batchcmds.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2023-12-22 12:29:35 +0800
committerGitHub <[email protected]>2023-12-22 12:29:35 +0800
commit59d2e638b29858f34647de156ac8a699196acb64 (patch)
tree7f3d725b78ffc0486e7fc02e429be143cbbb9b6c /xmake/plugins/pack/batchcmds.lua
parent17733b58e60dbc2729de94c17aedf48d6495136c (diff)
parent80937fbe6cf18a5372cdadb012a92ffc3985719b (diff)
Merge pull request #4529 from xmake-io/srpm
pack xmake install to srpm
Diffstat (limited to 'xmake/plugins/pack/batchcmds.lua')
-rw-r--r--xmake/plugins/pack/batchcmds.lua27
1 files changed, 20 insertions, 7 deletions
diff --git a/xmake/plugins/pack/batchcmds.lua b/xmake/plugins/pack/batchcmds.lua
index 2403b5bca..3d9229cce 100644
--- a/xmake/plugins/pack/batchcmds.lua
+++ b/xmake/plugins/pack/batchcmds.lua
@@ -183,15 +183,25 @@ function _on_target_installcmd_headeronly(target, batchcmds_, opt)
_install_headers(target, batchcmds_, includedir)
end
+-- on install source target command
+function _on_target_installcmd_source(target, batchcmds_, opt)
+ local package = opt.package
+ batchcmds_:vrunv("xmake", {"install", "-o", path(package:install_rootdir()), target:name()})
+end
+
-- on build target command
function _on_target_buildcmd(target, batchcmds_, opt)
local package = opt.package
- batchcmds_:vrunv("xmake", {"build", target:name()})
+ batchcmds_:vrunv("xmake", {"build", "-y", target:name()})
end
-- on install target command
function _on_target_installcmd(target, batchcmds_, opt)
local package = opt.package
+ if package:from_source() then
+ _on_target_installcmd_source(target, batchcmds_, opt)
+ return
+ end
-- install target binaries
local scripts = {
@@ -278,9 +288,18 @@ function _on_target_uninstallcmd_headeronly(target, batchcmds_, opt)
_uninstall_headers(target, batchcmds_, includedir)
end
+-- on uninstall source target command
+function _on_target_uninstallcmd_source(target, batchcmds_, opt)
+ -- TODO
+end
+
-- on uninstall target command
function _on_target_uninstallcmd(target, batchcmds_, opt)
local package = opt.package
+ if package:from_source() then
+ _on_target_uninstallcmd_source(target, batchcmds_, opt)
+ return
+ end
-- uninstall target binaries
local scripts = {
@@ -412,9 +431,6 @@ end
-- on install command
function _on_installcmd(package, batchcmds_)
- if not package:from_binary() then
- return
- end
local srcfiles, dstfiles = package:installfiles()
for idx, srcfile in ipairs(srcfiles) do
batchcmds_:cp(srcfile, dstfiles[idx])
@@ -426,9 +442,6 @@ end
-- on uninstall command
function _on_uninstallcmd(package, batchcmds_)
- if not package:from_binary() then
- return
- end
local _, dstfiles = package:installfiles()
for _, dstfile in ipairs(dstfiles) do
batchcmds_:rm(dstfile, {emptydirs = true})