summaryrefslogtreecommitdiff
path: root/xmake
diff options
context:
space:
mode:
authorruki <[email protected]>2023-11-21 22:41:26 +0800
committerruki <[email protected]>2023-11-21 22:41:26 +0800
commitb07ccfbad1bf0ab942bf9247f09655c75f5cf199 (patch)
tree6e4a2afdc2afec5ad101f5246daf7836133fe0ef /xmake
parentd9bd4228a079cadf73092c1317a3a34717c6f3e6 (diff)
pack xmakesrc tar.gz and zip
Diffstat (limited to 'xmake')
-rw-r--r--xmake/includes/xpack/xmake.lua3
-rw-r--r--xmake/plugins/pack/xpack.lua22
2 files changed, 18 insertions, 7 deletions
diff --git a/xmake/includes/xpack/xmake.lua b/xmake/includes/xpack/xmake.lua
index cbfedc600..3eb0d86cb 100644
--- a/xmake/includes/xpack/xmake.lua
+++ b/xmake/includes/xpack/xmake.lua
@@ -39,9 +39,12 @@ local apis = {
-- set company name
"xpack.set_company",
-- set package formats, e.g. nsis, deb, rpm, targz, zip, runself, ...
+ -- we can also add custom formats
"xpack.set_formats",
-- set the base name of the output file
"xpack.set_basename",
+ -- set the extension of the output file
+ "xpack.set_extension",
-- add targets to be packaged
"xpack.add_targets",
-- set installed binary directory, e.g. bin
diff --git a/xmake/plugins/pack/xpack.lua b/xmake/plugins/pack/xpack.lua
index 0d6dd08f3..07e162c67 100644
--- a/xmake/plugins/pack/xpack.lua
+++ b/xmake/plugins/pack/xpack.lua
@@ -320,15 +320,23 @@ function xpack:specfile()
return self:get("specfile") or path.join(self:buildir(), self:basename() .. extension)
end
+-- get the extension
+function xpack:extension()
+ local extension = self:get("extension")
+ if extension == nil then
+ local extensions = {
+ nsis = ".exe",
+ zip = ".zip",
+ targz = ".tar.gz"
+ }
+ extension = extensions[self:format()] or ""
+ end
+ return extension
+end
+
-- get the output filename
function xpack:filename()
- local extensions = {
- nsis = ".exe",
- zip = ".zip",
- targz = ".tar.gz"
- }
- local extension = extensions[self:format()] or ""
- return self:basename() .. extension
+ return self:basename() .. self:extension()
end
-- get the output file