diff options
| author | ruki <[email protected]> | 2023-11-12 00:37:33 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-11-12 00:37:33 +0800 |
| commit | 3d00033b3455adefa71d9b08d14fb14dbfc02505 (patch) | |
| tree | dd01907c6ab0081fe25675d91626fa7331728554 | |
| parent | fb648845e465bf0c376f6d0d4197c8243abdaecd (diff) | |
improve nsis spec
| -rw-r--r-- | xmake/includes/xpack/xmake.lua | 4 | ||||
| -rw-r--r-- | xmake/plugins/pack/xpack.lua | 21 | ||||
| -rw-r--r-- | xmake/scripts/xpack/nsis/makensis.nsi | 64 |
3 files changed, 40 insertions, 49 deletions
diff --git a/xmake/includes/xpack/xmake.lua b/xmake/includes/xpack/xmake.lua index 691645116..7c05f1a11 100644 --- a/xmake/includes/xpack/xmake.lua +++ b/xmake/includes/xpack/xmake.lua @@ -36,6 +36,10 @@ local apis = { "xpack.set_description", -- set package license, we will also get them from target "xpack.set_license", + -- set package copyright + "xpack.set_copyright", + -- set company name + "xpack.set_company", -- set package formats, e.g. nsis, deb, rpm, targz, zip, runself, ... "xpack.set_formats", -- set the base name of the output file diff --git a/xmake/plugins/pack/xpack.lua b/xmake/plugins/pack/xpack.lua index 8c4537f2b..13bf924bb 100644 --- a/xmake/plugins/pack/xpack.lua +++ b/xmake/plugins/pack/xpack.lua @@ -215,26 +215,29 @@ function xpack:specvars() local specvars = self._specvars if specvars == nil then specvars = { - ARCH = self:arch() - , PLAT = self:plat() - , HOST = os.host() - , MODE = config.get("mode") or "release" + PACKAGE_ARCH = self:arch(), + PACKAGE_PLAT = self:plat(), + PACKAGE_NAME = self:name(), + PACKAGE_DESCRIPTION = self:description() or "", + PACKAGE_FILENAME = self:filename(), + PACKAGE_COPYRIGHT = self:get("copyright") or "", + PACKAGE_COMPANY = self:get("company") or "" } -- get version local version, version_build = self:version() if version then - specvars.VERSION = version + specvars.VERSION = version or "0.0.0" try {function () local v = semver.new(version) if v then - specvars.VERSION_MAJOR = v:major() - specvars.VERSION_MINOR = v:minor() - specvars.VERSION_ALTER = v:patch() + specvars.PACKAGE_VERSION_MAJOR = v:major() or "0" + specvars.PACKAGE_VERSION_MINOR = v:minor() or "0" + specvars.PACKAGE_VERSION_ALTER = v:patch() or "0" end end} if version_build then - specvars.VERSION_BUILD = version_build + specvars.PACKAGE_VERSION_BUILD = version_build or "" end end diff --git a/xmake/scripts/xpack/nsis/makensis.nsi b/xmake/scripts/xpack/nsis/makensis.nsi index 120f94f46..bf0de6f06 100644 --- a/xmake/scripts/xpack/nsis/makensis.nsi +++ b/xmake/scripts/xpack/nsis/makensis.nsi @@ -2,7 +2,6 @@ ; it is autogenerated by the xmake build system. ; do not edit by hand. -;-------------------------------- ; includes !include "MUI2.nsh" !include "WordFunc.nsh" @@ -11,26 +10,25 @@ !include "UAC.nsh" ; the version information -!define VERSION_FULL ${VERSION}+${VERSION_BUILD} +!define VERSION ${PACKAGE_VERSION} +!define VERSION_FULL ${PACKAGE_VERSION}+${PACKAGE_VERSION_BUILD} -;-------------------------------- +; set the package name +Name "${PACKAGE_NAME} - v${VERSION}" -; The name of the installer -Name "Xmake - v${VERSION}" +; set the output file name +OutFile "${PACKAGE_FILENAME}" -; The file to write -OutFile "xmake.exe" - -; Use unicode +; use unicode Unicode true -; Use best compressor +; use best compressor SetCompressor /FINAL /SOLID lzma SetCompressorDictSize 64 SetDatablockOptimize ON -; The default installation directory -!ifdef x64 +; set the default installation directory +!if "${PACKAGE_ARCH}" == "x64" !define PROGRAMFILES $PROGRAMFILES64 !define HKLM HKLM64 !define HKCU HKCU64 @@ -40,15 +38,13 @@ SetDatablockOptimize ON !define HKCU HKCU !endif -; Request application privileges for Windows Vista +; request application privileges for Windows Vista RequestExecutionLevel user -; Set DPI Aware +; set DPI aware ManifestDPIAware true -;-------------------------------- -; UAC helper - +; UAC !macro Init thing uac_tryagain: !insertmacro UAC_RunElevated @@ -77,9 +73,7 @@ ManifestDPIAware true SetShellVarContext all !macroend -;-------------------------------- -; Install Pages - +; add the install Pages !insertmacro MUI_PAGE_WELCOME ;!insertmacro MUI_PAGE_LICENSE "..\LICENSE.md" !insertmacro MUI_PAGE_COMPONENTS @@ -89,36 +83,26 @@ ManifestDPIAware true !define MUI_FINISHPAGE_LINK_LOCATION "https://xmake.io/#/sponsor" !insertmacro MUI_PAGE_FINISH -;-------------------------------- -; Uninstall Pages - +; add uninstall Pages !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES !insertmacro MUI_UNPAGE_FINISH -;-------------------------------- -; Languages - +; add languages !insertmacro MUI_LANGUAGE "English" -;-------------------------------- -; Version Information - - +; set product information VIProductVersion ${VERSION}.0 VIFileVersion ${VERSION}.0 -VIAddVersionKey /LANG=0 ProductName Xmake -VIAddVersionKey /LANG=0 Comments "A cross-platform build utility based on Lua$\nwebsite: https://xmake.io" -VIAddVersionKey /LANG=0 CompanyName "The TBOOX Open Source Group" -VIAddVersionKey /LANG=0 LegalCopyright "Copyright (C) 2015-present Ruki Wang, tboox.org, xmake.io" -VIAddVersionKey /LANG=0 FileDescription "Xmake Installer - v${VERSION}" -VIAddVersionKey /LANG=0 OriginalFilename "xmake-${ARCH}.exe" +VIAddVersionKey /LANG=0 ProductName ${PACKAGE_NAME} +VIAddVersionKey /LANG=0 Comments ${PACKAGE_DESCRIPTION} +VIAddVersionKey /LANG=0 CompanyName ${PACKAGE_COMPANY} +VIAddVersionKey /LANG=0 LegalCopyright ${PACKAGE_COPYRIGHT} +VIAddVersionKey /LANG=0 FileDescription "${PACKAGE_NAME} Installer - v${VERSION}" +VIAddVersionKey /LANG=0 OriginalFilename ${PACKAGE_FILENAME} VIAddVersionKey /LANG=0 FileVersion ${VERSION_FULL} VIAddVersionKey /LANG=0 ProductVersion ${VERSION_FULL} - -;-------------------------------- -; Reg paths - +; set registry paths !define RegUninstall "Software\Microsoft\Windows\CurrentVersion\Uninstall\XMake" |
