diff options
| author | ruki <[email protected]> | 2023-11-17 22:50:34 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-11-17 22:50:34 +0800 |
| commit | e0f074c79be1f712d09df9f7b4b32245ba95f1c9 (patch) | |
| tree | 732f74fe2fd2922f3c95e8542de82cb6ee108f1c | |
| parent | 6a4c1a917ef785489af8cdbed042fdf369f75d75 (diff) | |
add nsis display name
| -rw-r--r-- | core/xpack.lua | 1 | ||||
| -rw-r--r-- | xmake/includes/xpack/xmake.lua | 4 | ||||
| -rw-r--r-- | xmake/plugins/pack/nsis/main.lua | 11 | ||||
| -rw-r--r-- | xmake/scripts/xpack/nsis/makensis.nsi | 2 |
4 files changed, 16 insertions, 2 deletions
diff --git a/core/xpack.lua b/core/xpack.lua index 5cbff58e8..280b1365a 100644 --- a/core/xpack.lua +++ b/core/xpack.lua @@ -5,6 +5,7 @@ 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() diff --git a/xmake/includes/xpack/xmake.lua b/xmake/includes/xpack/xmake.lua index f7198600d..9021404f7 100644 --- a/xmake/includes/xpack/xmake.lua +++ b/xmake/includes/xpack/xmake.lua @@ -49,7 +49,9 @@ local apis = { -- set installed library directory, e.g. lib "xpack.set_libdir", -- set installed include directory, e.g. include - "xpack.set_includedir" + "xpack.set_includedir", + -- set nsis display name + "xpack.set_nsis_displayname" }, 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 a99370a01..3c4fa3bbd 100644 --- a/xmake/plugins/pack/nsis/main.lua +++ b/xmake/plugins/pack/nsis/main.lua @@ -25,6 +25,7 @@ import("lib.detect.find_tool") import("private.utils.batchcmds") import("private.action.require.impl.packagenv") import("private.action.require.impl.install_packages") +import(".filter") -- get the makensis function _get_makensis() @@ -514,6 +515,15 @@ function _get_uninstallcmds(package) return _get_commands_string(package, batchcmds_:cmds(), {install = false}) end +-- get value and filter it +function _get_filter_value(package, name) + local value = package:get(name) + if type(value) == "string" then + value = filter.handle(value, package) + end + return value +end + -- get specvars function _get_specvars(package) local specvars = table.clone(package:specvars()) @@ -526,6 +536,7 @@ 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_INSTALL_SECTIONS = function () local result = {} local cmds = package:get("nsis_installcmds") diff --git a/xmake/scripts/xpack/nsis/makensis.nsi b/xmake/scripts/xpack/nsis/makensis.nsi index 63625bc9a..ffcb39c7c 100644 --- a/xmake/scripts/xpack/nsis/makensis.nsi +++ b/xmake/scripts/xpack/nsis/makensis.nsi @@ -296,7 +296,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_NAME} (${PACKAGE_ARCH})" + WriteRegStr ${RootKey} ${RegUninstall} "DisplayName" "${PACKAGE_NSIS_DISPLAY_NAME}" WriteRegStr ${RootKey} ${RegUninstall} "DisplayIcon" '"$InstDir\${PACKAGE_BINDIR}\${PACKAGE_FILENAME}"' ; TODO WriteRegStr ${RootKey} ${RegUninstall} "Comments" "${PACKAGE_DESCRIPTION}" WriteRegStr ${RootKey} ${RegUninstall} "Publisher" "${PACKAGE_COPYRIGHT}" |
