summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-11-22 22:49:01 +0800
committerruki <[email protected]>2023-11-22 22:49:01 +0800
commitb3945b966dac469ca213d1d00547697e7da4e7cc (patch)
tree60a259febe8e678e0e0d28529494e8333acb354a
parentc891130491d408f297902484df74ac6afa9b8d88 (diff)
add uninstall sections
-rw-r--r--xmake/plugins/pack/nsis/main.lua15
1 files changed, 11 insertions, 4 deletions
diff --git a/xmake/plugins/pack/nsis/main.lua b/xmake/plugins/pack/nsis/main.lua
index a50708514..de091430d 100644
--- a/xmake/plugins/pack/nsis/main.lua
+++ b/xmake/plugins/pack/nsis/main.lua
@@ -223,15 +223,22 @@ function _get_specvars(package)
local install_descs = {}
local install_description_texts = {}
for name, component in table.orderpairs(package:components()) do
- local tag = "Install" .. name
- local cmd = _get_component_installcmds(component)
- if cmd then
+ local installcmds = _get_component_installcmds(component)
+ if installcmds then
+ local tag = "Install" .. name
table.insert(install_sections, string.format('Section%s "%s" %s', component:get("default") == false and " /o" or "", component:title(), tag))
- table.insert(install_sections, cmd)
+ table.insert(install_sections, installcmds)
table.insert(install_sections, "SectionEnd")
table.insert(install_descs, string.format('LangString DESC_%s ${LANG_ENGLISH} "%s"', tag, description))
table.insert(install_description_texts, string.format('!insertmacro MUI_DESCRIPTION_TEXT ${%s} $(DESC_%s)', tag, tag))
end
+ local uninstallcmds = _get_component_uninstallcmds(component)
+ if uninstallcmds then
+ local tag = "Uninstall" .. name
+ table.insert(install_sections, string.format('Section "un.%s" %s', component:title(), tag))
+ table.insert(install_sections, uninstallcmds)
+ table.insert(install_sections, "SectionEnd")
+ end
end
specvars.PACKAGE_NSIS_INSTALL_SECTIONS = table.concat(install_sections, "\n ")
specvars.PACKAGE_NSIS_INSTALL_DESCS = table.concat(install_descs, "\n ")