summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-11-22 22:39:22 +0800
committerruki <[email protected]>2023-11-22 22:39:22 +0800
commitc891130491d408f297902484df74ac6afa9b8d88 (patch)
treead818346a8066a9a08701199d809f23fbcc778b8
parent8846d9ece834a1d8b78234da6f1e439e1075b45e (diff)
impl uncheck component
-rw-r--r--tests/plugins/pack/xmake.lua1
-rw-r--r--xmake/includes/xpack/xmake.lua4
-rw-r--r--xmake/plugins/pack/nsis/main.lua2
3 files changed, 5 insertions, 2 deletions
diff --git a/tests/plugins/pack/xmake.lua b/tests/plugins/pack/xmake.lua
index fcf0f9e8c..a93fc18f6 100644
--- a/tests/plugins/pack/xmake.lua
+++ b/tests/plugins/pack/xmake.lua
@@ -42,6 +42,7 @@ xpack("test")
end)
xpack_component("LongPath")
+ set_default(false)
set_title("Enable Long Path")
set_description("Increases the maximum path length limit, up to 32,767 characters (before 256).")
on_installcmd(function (component, batchcmds)
diff --git a/xmake/includes/xpack/xmake.lua b/xmake/includes/xpack/xmake.lua
index 88936bb8b..345431ffc 100644
--- a/xmake/includes/xpack/xmake.lua
+++ b/xmake/includes/xpack/xmake.lua
@@ -64,7 +64,9 @@ local apis = {
-- set package component title
"xpack_component.set_title",
-- set package component description
- "xpack_component.set_description"
+ "xpack_component.set_description",
+ -- enable/disable this component by default
+ "xpack_component.set_default"
},
paths = {
-- set the spec file path, support the custom variable pattern, e.g. set_specfile("", {pattern = "%${([^\n]-)}"})
diff --git a/xmake/plugins/pack/nsis/main.lua b/xmake/plugins/pack/nsis/main.lua
index 9ba1b1429..a50708514 100644
--- a/xmake/plugins/pack/nsis/main.lua
+++ b/xmake/plugins/pack/nsis/main.lua
@@ -226,7 +226,7 @@ function _get_specvars(package)
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, 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, "SectionEnd")
table.insert(install_descs, string.format('LangString DESC_%s ${LANG_ENGLISH} "%s"', tag, description))