summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-11-15 23:42:59 +0800
committerruki <[email protected]>2023-11-15 23:42:59 +0800
commit7c37e9b9b92b53e4384daea5193f826bf8ac9492 (patch)
tree990c05d53d5d08b15ff6ead277e5cf8d871ae60f
parent355df6fd41db138b340dee56248f8c3fe0dcc75f (diff)
fix nsis desc
-rw-r--r--tests/plugins/pack/xmake.lua2
-rw-r--r--xmake/includes/xpack/xmake.lua5
-rw-r--r--xmake/plugins/pack/nsis/main.lua29
-rw-r--r--xmake/scripts/xpack/nsis/makensis.nsi6
4 files changed, 22 insertions, 20 deletions
diff --git a/tests/plugins/pack/xmake.lua b/tests/plugins/pack/xmake.lua
index f964d58bc..fc436f8b7 100644
--- a/tests/plugins/pack/xmake.lua
+++ b/tests/plugins/pack/xmake.lua
@@ -37,7 +37,7 @@ xpack("test")
batchcmds:rmdir("stub")
end)
- add_nsis_sections("Enable Long Path", [[
+ add_nsis_installcmds("Enable Long Path", [[
${If} $NoAdmin == "false"
; Enable long path
WriteRegDWORD ${HKLM} "SYSTEM\CurrentControlSet\Control\FileSystem" "LongPathsEnabled" 1
diff --git a/xmake/includes/xpack/xmake.lua b/xmake/includes/xpack/xmake.lua
index a8ce5f0fb..bb7d03435 100644
--- a/xmake/includes/xpack/xmake.lua
+++ b/xmake/includes/xpack/xmake.lua
@@ -81,12 +81,13 @@ local apis = {
-- set the spec variable
"xpack.set_specvar",
-- add nsis sections, e.g.
+ -- add NSIS install commands that will be added to the end of the install Section, e.g.
--[[
- add_nsis_sections("Enable Long Path",
+ add_nsis_installcmds("Enable Long Path",
'WriteRegDWORD ${HKLM} "SYSTEM\CurrentControlSet\Control\FileSystem" "LongPathsEnabled" 1',
{description = "Increases the maximum path length limit, up to 32,767 characters (before 256)."})
--]]
- "xpack.add_nsis_sections"
+ "xpack.add_nsis_installcmds"
}
}
interp_add_scopeapis(apis)
diff --git a/xmake/plugins/pack/nsis/main.lua b/xmake/plugins/pack/nsis/main.lua
index ada5b667c..23749962a 100644
--- a/xmake/plugins/pack/nsis/main.lua
+++ b/xmake/plugins/pack/nsis/main.lua
@@ -535,31 +535,32 @@ function _get_specvars(package)
specvars.PACKAGE_UNINSTALLCMDS = function ()
return _get_uninstallcmds(package)
end
- specvars.PACKAGE_NSIS_SECTIONS = function ()
+ specvars.PACKAGE_NSIS_INSTALL_SECTIONS = function ()
local result = {}
- local sections = package:get("nsis_sections")
- for name, section in pairs(sections) do
- local tag = _get_unique_tag(name)
+ local cmds = package:get("nsis_installcmds")
+ for name, cmd in pairs(cmds) do
+ local tag = "Install" .. _get_unique_tag(name)
table.insert(result, string.format('Section "%s" %s', name, tag))
- table.insert(result, section)
+ table.insert(result, cmd)
table.insert(result, "SectionEnd")
end
return table.concat(result, "\n ")
end
- specvars.PACKAGE_NSIS_DESCS = function ()
+ specvars.PACKAGE_NSIS_INSTALL_DESCS = function ()
local result = {}
- local sections = package:get("nsis_sections")
- for name, section in pairs(sections) do
- local tag = _get_unique_tag(name)
- table.insert(result, string.format('LangString DESC_%s ${LANG_ENGLISH} "%s"', tag, name))
+ local cmds = package:get("nsis_installcmds")
+ for name, cmd in pairs(cmds) do
+ local tag = "Install" .. _get_unique_tag(name)
+ local description = package:extraconf("nsis_installcmds." .. name, cmd, "description") or name
+ table.insert(result, string.format('LangString DESC_%s ${LANG_ENGLISH} "%s"', tag, description))
end
return table.concat(result, "\n ")
end
- specvars.PACKAGE_NSIS_DESCRIPTION_TEXTS = function ()
+ specvars.PACKAGE_NSIS_INSTALL_DESCRIPTION_TEXTS = function ()
local result = {}
- local sections = package:get("nsis_sections")
- for name, section in pairs(sections) do
- local tag = _get_unique_tag(name)
+ local cmds = package:get("nsis_installcmds")
+ for name, _ in pairs(cmds) do
+ local tag = "Install" .. _get_unique_tag(name)
table.insert(result, string.format('!insertmacro MUI_DESCRIPTION_TEXT ${%s} $(DESC_%s)', tag, tag))
end
return table.concat(result, "\n ")
diff --git a/xmake/scripts/xpack/nsis/makensis.nsi b/xmake/scripts/xpack/nsis/makensis.nsi
index d201a655e..3b79361bd 100644
--- a/xmake/scripts/xpack/nsis/makensis.nsi
+++ b/xmake/scripts/xpack/nsis/makensis.nsi
@@ -247,18 +247,18 @@ Section "Add to PATH" InstallPath
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
SectionEnd
-${PACKAGE_NSIS_SECTIONS}
+${PACKAGE_NSIS_INSTALL_SECTIONS}
; define language strings
LangString DESC_InstallExeutable ${LANG_ENGLISH} "${PACKAGE_DESCRIPTION}"
LangString DESC_InstallPath ${LANG_ENGLISH} "Add ${PACKAGE_NAME} to PATH"
-${PACKAGE_NSIS_DESCS}
+${PACKAGE_NSIS_INSTALL_DESCS}
; assign language strings to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${InstallExeutable} $(DESC_InstallExeutable)
!insertmacro MUI_DESCRIPTION_TEXT ${InstallPath} $(DESC_InstallPath)
-${PACKAGE_NSIS_DESCRIPTION_TEXTS}
+${PACKAGE_NSIS_INSTALL_DESCRIPTION_TEXTS}
!insertmacro MUI_FUNCTION_DESCRIPTION_END
; setup uninstaller