summaryrefslogtreecommitdiff
path: root/xmake
diff options
context:
space:
mode:
authorruki <[email protected]>2023-11-22 00:48:56 +0800
committerruki <[email protected]>2023-11-22 00:48:56 +0800
commit8c8f130f69343bbb50dafa718a8fe6df63497974 (patch)
tree0c5831419ce91e09f934ec1390a31c59091f2305 /xmake
parent574d9bca0e5d7a01fdf2500ac83c75f5927bb69d (diff)
add title
Diffstat (limited to 'xmake')
-rw-r--r--xmake/includes/xpack/xmake.lua18
-rw-r--r--xmake/plugins/pack/nsis/main.lua4
-rw-r--r--xmake/plugins/pack/xpack.lua10
-rw-r--r--xmake/plugins/pack/xpack_component.lua5
-rw-r--r--xmake/scripts/xpack/nsis/makensis.nsi2
5 files changed, 24 insertions, 15 deletions
diff --git a/xmake/includes/xpack/xmake.lua b/xmake/includes/xpack/xmake.lua
index eff96089d..88936bb8b 100644
--- a/xmake/includes/xpack/xmake.lua
+++ b/xmake/includes/xpack/xmake.lua
@@ -30,8 +30,10 @@ local apis = {
values = {
-- set package version, we will also get it from project/target
"xpack.set_version",
- -- set pacakge homepage url
+ -- set package homepage url
"xpack.set_homepage",
+ -- set package title
+ "xpack.set_title",
-- set package description
"xpack.set_description",
-- set package copyright
@@ -57,10 +59,10 @@ local apis = {
"xpack.set_includedir",
-- set prefix directory, e.g. prefixdir/bin, prefixdir/lib ..
"xpack.set_prefixdir",
- -- set nsis display name
- "xpack.set_nsis_displayname",
-- set nsis display icon
"xpack.set_nsis_displayicon",
+ -- set package component title
+ "xpack_component.set_title",
-- set package component description
"xpack_component.set_description"
},
@@ -112,15 +114,7 @@ local apis = {
},
keyvalues = {
-- 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_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_installcmds"
+ "xpack.set_specvar"
}
}
interp_add_scopeapis(apis)
diff --git a/xmake/plugins/pack/nsis/main.lua b/xmake/plugins/pack/nsis/main.lua
index 854bc46e7..29e4c6a55 100644
--- a/xmake/plugins/pack/nsis/main.lua
+++ b/xmake/plugins/pack/nsis/main.lua
@@ -195,7 +195,6 @@ function _get_specvars(package)
specvars.PACKAGE_UNINSTALLCMDS = function ()
return _get_uninstallcmds(package)
end
- specvars.PACKAGE_NSIS_DISPLAY_NAME = _get_filter_value(package, "nsis_displayname") or package:name()
specvars.PACKAGE_NSIS_DISPLAY_ICON = function ()
local iconpath = _get_filter_value(package, "nsis_displayicon")
if iconpath then
@@ -206,6 +205,7 @@ function _get_specvars(package)
end
return _translate_filepath(package, iconpath)
end
+ --[[
specvars.PACKAGE_NSIS_INSTALL_SECTIONS = function ()
local result = {}
local cmds = package:get("nsis_installcmds")
@@ -235,7 +235,7 @@ function _get_specvars(package)
table.insert(result, string.format('!insertmacro MUI_DESCRIPTION_TEXT ${%s} $(DESC_%s)', tag, tag))
end
return table.concat(result, "\n ")
- end
+ end]]
return specvars
end
diff --git a/xmake/plugins/pack/xpack.lua b/xmake/plugins/pack/xpack.lua
index 79acbb16a..bd687d39c 100644
--- a/xmake/plugins/pack/xpack.lua
+++ b/xmake/plugins/pack/xpack.lua
@@ -69,6 +69,15 @@ function xpack:license()
return self:get("license")
end
+-- get the package title
+function xpack:title()
+ local title = self:get("title")
+ if title == nil then
+ title = self:name()
+ end
+ return filter.handle(title, self)
+end
+
-- get the package description
function xpack:description()
return self:get("description")
@@ -251,6 +260,7 @@ function xpack:specvars()
PACKAGE_ARCH = self:arch(),
PACKAGE_PLAT = self:plat(),
PACKAGE_NAME = self:name(),
+ PACKAGE_TITLE = self:title() or "",
PACKAGE_DESCRIPTION = self:description() or "",
PACKAGE_FILENAME = self:filename(),
PACKAGE_HOMEPAGE = self:get("homepage") or "",
diff --git a/xmake/plugins/pack/xpack_component.lua b/xmake/plugins/pack/xpack_component.lua
index 62e8a1efe..bb274d08a 100644
--- a/xmake/plugins/pack/xpack_component.lua
+++ b/xmake/plugins/pack/xpack_component.lua
@@ -60,6 +60,11 @@ function xpack_component:extraconf(name, item, key)
end
end
+-- get the component title
+function xpack_component:title()
+ return self:get("title") or self:name()
+end
+
-- get the component description
function xpack_component:description()
return self:get("description")
diff --git a/xmake/scripts/xpack/nsis/makensis.nsi b/xmake/scripts/xpack/nsis/makensis.nsi
index 7be50dd0b..53cd82e99 100644
--- a/xmake/scripts/xpack/nsis/makensis.nsi
+++ b/xmake/scripts/xpack/nsis/makensis.nsi
@@ -287,7 +287,7 @@ Section "${PACKAGE_NAME} (required)" InstallExeutable
; Write the uninstall keys for Windows
!macro AddReg RootKey
WriteRegStr ${RootKey} ${RegUninstall} "NoAdmin" "$NoAdmin"
- WriteRegStr ${RootKey} ${RegUninstall} "DisplayName" "${PACKAGE_NSIS_DISPLAY_NAME}"
+ WriteRegStr ${RootKey} ${RegUninstall} "DisplayName" "${PACKAGE_TITLE}"
!if "${PACKAGE_NSIS_DISPLAY_ICON}" != ""
WriteRegStr ${RootKey} ${RegUninstall} "DisplayIcon" '"${PACKAGE_NSIS_DISPLAY_ICON}"'
!endif