summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-11-14 22:50:59 +0800
committerruki <[email protected]>2023-11-14 22:50:59 +0800
commite861b85caa465a4370917972c34f237d271f8d16 (patch)
tree7b1c2a4a7ad37a30e105fad4d4d3488cf5981a69
parentc1ba5880b4ba84bfec6497627633f5cd5ab1dfff (diff)
modify basename
-rw-r--r--xmake/plugins/pack/nsis/main.lua4
-rw-r--r--xmake/plugins/pack/xpack.lua14
-rw-r--r--xmake/scripts/xpack/nsis/makensis.nsi4
3 files changed, 16 insertions, 6 deletions
diff --git a/xmake/plugins/pack/nsis/main.lua b/xmake/plugins/pack/nsis/main.lua
index 9efa29d20..30f2a0f0e 100644
--- a/xmake/plugins/pack/nsis/main.lua
+++ b/xmake/plugins/pack/nsis/main.lua
@@ -61,7 +61,7 @@ function _get_command_strings(package, cmd)
-- https://nsis.sourceforge.io/Reference/File
local srcfiles = os.files(cmd.srcpath)
for _, srcfile in ipairs(srcfiles) do
- table.insert(result, string.format("File /oname=%s %s", cmd.dstpath, srcfile))
+ -- table.insert(result, string.format("File /oname=%s %s", cmd.dstpath, srcfile))
end
elseif kind == "rm" then
-- TODO
@@ -121,6 +121,7 @@ end
-- get specvars
function _get_specvars(package)
local specvars = table.clone(package:specvars())
+ specvars.PACKAGE_OUTPUTFILE = path.absolute(package:outputfile()):gsub("\\", "/")
specvars.PACKAGE_INSTALLCMDS = function ()
return _get_installcmds(package)
end
@@ -171,6 +172,7 @@ function main(package)
os.tryrm(package:buildir())
-- pack nsis package
+ os.mkdir(package:outputdir())
_pack_nsis(makensis.program, package, opt)
-- done
diff --git a/xmake/plugins/pack/xpack.lua b/xmake/plugins/pack/xpack.lua
index cc377276e..68b2bbdc5 100644
--- a/xmake/plugins/pack/xpack.lua
+++ b/xmake/plugins/pack/xpack.lua
@@ -194,21 +194,29 @@ end
-- get the build directory
function xpack:buildir()
- return path.join(config.buildir(), ".xpack", self:name(), self:format())
+ return path.join(config.buildir(), ".xpack", self:name())
end
-- get the output directory
function xpack:outputdir()
local outputdir = option.get("outputdir")
if outputdir == nil then
- outputdir = path.join(config.buildir(), "xpack", self:name(), self:format())
+ outputdir = path.join(config.buildir(), "xpack", self:name())
end
return outputdir
end
-- get the basename
function xpack:basename()
- return self:get("basename") or self:name()
+ local basename = self:get("basename")
+ if basename == nil then
+ basename = self:name()
+ local version = self:version()
+ if version then
+ basename = basename .. "-" .. version
+ end
+ end
+ return basename
end
-- get the spec variables
diff --git a/xmake/scripts/xpack/nsis/makensis.nsi b/xmake/scripts/xpack/nsis/makensis.nsi
index 856ebffd1..7bda3ed81 100644
--- a/xmake/scripts/xpack/nsis/makensis.nsi
+++ b/xmake/scripts/xpack/nsis/makensis.nsi
@@ -20,8 +20,8 @@
; set the package name
Name "${PACKAGE_NAME} - v${VERSION}"
-; set the output file name
-OutFile "${PACKAGE_FILENAME}"
+; set the output file path
+OutFile "${PACKAGE_OUTPUTFILE}"
; use unicode
Unicode true