diff options
| author | ruki <[email protected]> | 2023-11-22 00:48:56 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-11-22 00:48:56 +0800 |
| commit | 8c8f130f69343bbb50dafa718a8fe6df63497974 (patch) | |
| tree | 0c5831419ce91e09f934ec1390a31c59091f2305 | |
| parent | 574d9bca0e5d7a01fdf2500ac83c75f5927bb69d (diff) | |
add title
| -rw-r--r-- | core/xpack.lua | 8 | ||||
| -rw-r--r-- | tests/plugins/pack/xmake.lua | 15 | ||||
| -rw-r--r-- | xmake/includes/xpack/xmake.lua | 18 | ||||
| -rw-r--r-- | xmake/plugins/pack/nsis/main.lua | 4 | ||||
| -rw-r--r-- | xmake/plugins/pack/xpack.lua | 10 | ||||
| -rw-r--r-- | xmake/plugins/pack/xpack_component.lua | 5 | ||||
| -rw-r--r-- | xmake/scripts/xpack/nsis/makensis.nsi | 2 |
7 files changed, 36 insertions, 26 deletions
diff --git a/core/xpack.lua b/core/xpack.lua index 07e77c1ca..18b7073d0 100644 --- a/core/xpack.lua +++ b/core/xpack.lua @@ -1,5 +1,6 @@ xpack("xmake") set_homepage("https://xmake.io") +-- 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") @@ -7,7 +8,6 @@ xpack("xmake") add_targets("demo") set_bindir(".") set_iconfile("src/demo/xmake.ico") - set_nsis_displayname("Xmake build utility ($(arch))") on_load(function (package) local arch = package:arch() @@ -63,12 +63,6 @@ xpack("xmake") end end) - add_nsis_installcmds("Enable Long Path", [[ - ${If} $NoAdmin == "false" - ; Enable long path - WriteRegDWORD ${HKLM} "SYSTEM\CurrentControlSet\Control\FileSystem" "LongPathsEnabled" 1 - ${EndIf}]], {description = "Increases the maximum path length limit, up to 32,767 characters (before 256)."}) - xpack("xmakesrc") set_formats("src_zip", "src_targz") set_basename("xmake-v$(version)") diff --git a/tests/plugins/pack/xmake.lua b/tests/plugins/pack/xmake.lua index d10af4d54..fcf0f9e8c 100644 --- a/tests/plugins/pack/xmake.lua +++ b/tests/plugins/pack/xmake.lua @@ -20,12 +20,15 @@ target("foo") xpack("test") set_formats("nsis", "zip", "targz") - set_description("hello") + set_title("hello") + set_description("A test installer.") + set_homepage("https://xmake.io") set_licensefile("LICENSE.md") add_targets("test", "foo") set_basename("test-$(plat)-$(arch)-v$(version)") add_installfiles("src/(assets/*.png)", {prefixdir = "images"}) set_iconfile("src/assets/xmake.ico") + add_components("LongPath") after_installcmd(function (package, batchcmds) batchcmds:mkdir(package:installdir("resources")) @@ -38,9 +41,13 @@ xpack("test") batchcmds:rmdir(package:installdir("stub")) end) - add_nsis_installcmds("Enable Long Path", [[ +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}]], {description = "Increases the maximum path length limit, up to 32,767 characters (before 256)."}) - + ${EndIf}]]) + end) 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 |
