summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-11-22 23:02:16 +0800
committerruki <[email protected]>2023-11-22 23:02:16 +0800
commit0415ab4d9b7ba347aed638422a7b40885da2943e (patch)
tree8428042084067b0b5821eae298466413611da4b9
parent3cf88c4347b0605396b3d5c75f0b34a1c67128ab (diff)
enable long path for xmake/xpack
-rw-r--r--core/xpack.lua15
-rw-r--r--xmake/plugins/pack/nsis/main.lua4
2 files changed, 16 insertions, 3 deletions
diff --git a/core/xpack.lua b/core/xpack.lua
index 18b7073d0..c81509da0 100644
--- a/core/xpack.lua
+++ b/core/xpack.lua
@@ -1,6 +1,6 @@
xpack("xmake")
set_homepage("https://xmake.io")
--- set_title("Xmake build utility ($(arch))")
+ set_title("Xmake build utility ($(arch))")
set_description("A cross-platform build utility based on Lua.")
set_copyright("Copyright (C) 2015-present, TBOOX Open Source Group")
set_licensefile("../LICENSE.md")
@@ -9,6 +9,8 @@ xpack("xmake")
set_bindir(".")
set_iconfile("src/demo/xmake.ico")
+ add_components("LongPath")
+
on_load(function (package)
local arch = package:arch()
if package:is_plat("windows") then
@@ -63,6 +65,17 @@ xpack("xmake")
end
end)
+xpack_component("LongPath")
+ 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)
+ batchcmds:rawcmd("nsis", [[
+ ${If} $NoAdmin == "false"
+ ; Enable long path
+ WriteRegDWORD ${HKLM} "SYSTEM\CurrentControlSet\Control\FileSystem" "LongPathsEnabled" 1
+ ${EndIf}]])
+ end)
+
xpack("xmakesrc")
set_formats("src_zip", "src_targz")
set_basename("xmake-v$(version)")
diff --git a/xmake/plugins/pack/nsis/main.lua b/xmake/plugins/pack/nsis/main.lua
index de091430d..d7d69fdef 100644
--- a/xmake/plugins/pack/nsis/main.lua
+++ b/xmake/plugins/pack/nsis/main.lua
@@ -224,7 +224,7 @@ function _get_specvars(package)
local install_description_texts = {}
for name, component in table.orderpairs(package:components()) do
local installcmds = _get_component_installcmds(component)
- if installcmds then
+ if installcmds and #installcmds > 0 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, installcmds)
@@ -233,7 +233,7 @@ function _get_specvars(package)
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
+ if uninstallcmds and #uninstallcmds > 0 then
local tag = "Uninstall" .. name
table.insert(install_sections, string.format('Section "un.%s" %s', component:title(), tag))
table.insert(install_sections, uninstallcmds)