summaryrefslogtreecommitdiff
path: root/xmake/plugins/pack/batchcmds.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2023-12-22 00:00:18 +0800
committerruki <[email protected]>2023-12-22 00:00:18 +0800
commit6417898f2e1076a642d85fc91478c84b9e67a39a (patch)
tree12d6f70502c4617d03bd2536f5446559da6ae207 /xmake/plugins/pack/batchcmds.lua
parent17733b58e60dbc2729de94c17aedf48d6495136c (diff)
pack xmake install to srpm
Diffstat (limited to 'xmake/plugins/pack/batchcmds.lua')
-rw-r--r--xmake/plugins/pack/batchcmds.lua25
1 files changed, 19 insertions, 6 deletions
diff --git a/xmake/plugins/pack/batchcmds.lua b/xmake/plugins/pack/batchcmds.lua
index 2403b5bca..9f74ad606 100644
--- a/xmake/plugins/pack/batchcmds.lua
+++ b/xmake/plugins/pack/batchcmds.lua
@@ -183,6 +183,12 @@ 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
@@ -192,6 +198,10 @@ 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})