summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-11-22 22:37:56 +0800
committerruki <[email protected]>2023-11-22 22:37:56 +0800
commit8846d9ece834a1d8b78234da6f1e439e1075b45e (patch)
treea5af02425ce1d05e6a75b7d7a98dbe7b05da3ba3
parent98179c982c6d67a88e6918959d8c434fdbbe7a25 (diff)
improve install sections
-rw-r--r--xmake/plugins/pack/nsis/main.lua43
1 files changed, 17 insertions, 26 deletions
diff --git a/xmake/plugins/pack/nsis/main.lua b/xmake/plugins/pack/nsis/main.lua
index e44d41d8b..9ba1b1429 100644
--- a/xmake/plugins/pack/nsis/main.lua
+++ b/xmake/plugins/pack/nsis/main.lua
@@ -217,34 +217,25 @@ function _get_specvars(package)
end
return _translate_filepath(package, iconpath)
end
- specvars.PACKAGE_NSIS_INSTALL_SECTIONS = function ()
- local result = {}
- for name, component in table.orderpairs(package:components()) do
- local tag = "Install" .. name
- local cmd = _get_component_installcmds(component)
- table.insert(result, string.format('Section "%s" %s', component:title(), tag))
- table.insert(result, cmd)
- table.insert(result, "SectionEnd")
- end
- return table.concat(result, "\n ")
- end
- specvars.PACKAGE_NSIS_INSTALL_DESCS = function ()
- local result = {}
- for name, component in table.orderpairs(package:components()) do
- local tag = "Install" .. name
- local description = component:description()
- table.insert(result, string.format('LangString DESC_%s ${LANG_ENGLISH} "%s"', tag, description))
- end
- return table.concat(result, "\n ")
- end
- specvars.PACKAGE_NSIS_INSTALL_DESCRIPTION_TEXTS = function ()
- local result = {}
- for name, component in table.orderpairs(package:components()) do
- local tag = "Install" .. name
- table.insert(result, string.format('!insertmacro MUI_DESCRIPTION_TEXT ${%s} $(DESC_%s)', tag, tag))
+
+ -- install sections
+ local install_sections = {}
+ 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
+ table.insert(install_sections, string.format('Section "%s" %s', component:title(), tag))
+ table.insert(install_sections, cmd)
+ 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
- return table.concat(result, "\n ")
end
+ specvars.PACKAGE_NSIS_INSTALL_SECTIONS = table.concat(install_sections, "\n ")
+ specvars.PACKAGE_NSIS_INSTALL_DESCS = table.concat(install_descs, "\n ")
+ specvars.PACKAGE_NSIS_INSTALL_DESCRIPTION_TEXTS = table.concat(install_description_texts, "\n ")
return specvars
end