mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-21 13:53:37 -07:00
NSIS: Require Windows 10 1809 for Qt6 builds
Also refactor the config.nsi with more defines that control the build. Closes #17783
This commit is contained in:
parent
680455a21b
commit
2af1e1874e
62 changed files with 167 additions and 28 deletions
152
dist/windows/config.nsi
vendored
Normal file
152
dist/windows/config.nsi
vendored
Normal file
|
@ -0,0 +1,152 @@
|
|||
; Uncomment when packaging 64bit qbittorrent
|
||||
;!define QBT_IS_X64
|
||||
|
||||
; Uncomment when packaging qt6 qbittorrent
|
||||
; It will also define QBT_IS_X64
|
||||
;!define QBT_USES_QT6
|
||||
|
||||
!ifdef QBT_USES_QT6
|
||||
!define /redef QBT_IS_X64
|
||||
!endif
|
||||
|
||||
; qBittorrent version
|
||||
!define /ifndef QBT_VERSION "4.5.0"
|
||||
|
||||
Unicode true
|
||||
ManifestDPIAware true
|
||||
;Compress the header too
|
||||
!packhdr "$%TEMP%\exehead.tmp" 'upx.exe -9 --best --ultra-brute "$%TEMP%\exehead.tmp"'
|
||||
|
||||
;Setting the compression
|
||||
SetCompressor /SOLID LZMA
|
||||
SetCompressorDictSize 64
|
||||
XPStyle on
|
||||
|
||||
!include "MUI.nsh"
|
||||
!include "UAC.nsh"
|
||||
!include "FileFunc.nsh"
|
||||
!include "WinVer.nsh"
|
||||
!ifdef QBT_IS_X64
|
||||
!include "x64.nsh"
|
||||
!endif
|
||||
|
||||
;For the file association
|
||||
!define SHCNE_ASSOCCHANGED 0x8000000
|
||||
!define SHCNF_IDLIST 0
|
||||
|
||||
;For special folder detection
|
||||
!define CSIDL_APPDATA '0x1A' ;Application Data path
|
||||
!define CSIDL_LOCALAPPDATA '0x1C' ;Local Application Data path
|
||||
|
||||
!define MUI_FINISHPAGE_RUN
|
||||
!define MUI_FINISHPAGE_RUN_FUNCTION PageFinishRun
|
||||
!define MUI_FINISHPAGE_RUN_TEXT $(launch_qbt)
|
||||
|
||||
!ifndef QBT_IS_X64
|
||||
; The name of the installer
|
||||
Name "qBittorrent ${QBT_VERSION}"
|
||||
|
||||
; The file to write
|
||||
OutFile "qbittorrent_${QBT_VERSION}_setup.exe"
|
||||
!else ; QBT_IS_X64
|
||||
!ifndef QBT_USES_QT6
|
||||
; The name of the installer
|
||||
Name "qBittorrent ${QBT_VERSION} x64"
|
||||
|
||||
; The file to write
|
||||
OutFile "qbittorrent_${QBT_VERSION}_x64_setup.exe"
|
||||
!else ; QBT_USES_QT6
|
||||
; The name of the installer
|
||||
Name "qBittorrent ${QBT_VERSION} (qt6) x64"
|
||||
|
||||
; The file to write
|
||||
OutFile "qbittorrent_${QBT_VERSION}_qt6_x64_setup.exe"
|
||||
!endif ; QBT_USES_QT6
|
||||
!endif ; QBT_IS_X64
|
||||
|
||||
;Installer Version Information
|
||||
VIAddVersionKey "ProductName" "qBittorrent"
|
||||
VIAddVersionKey "CompanyName" "The qBittorrent project"
|
||||
VIAddVersionKey "LegalCopyright" "Copyright ©2006-2022 The qBittorrent project"
|
||||
VIAddVersionKey "FileDescription" "qBittorrent - A Bittorrent Client"
|
||||
VIAddVersionKey "FileVersion" "${QBT_VERSION}"
|
||||
|
||||
VIProductVersion "${QBT_VERSION}.0"
|
||||
|
||||
; The default installation directory. It changes depending if we install in the 64bit dir or not.
|
||||
; A caveat of this is if a user has installed a 32bit version and then runs the 64bit installer
|
||||
; (which in turn launches the 32bit uninstaller first) the value will still point to the 32bit location.
|
||||
; The user has to manually uninstall the old version and THEN run the 64bit installer
|
||||
!ifndef QBT_IS_X64
|
||||
InstallDir $PROGRAMFILES32\qBittorrent
|
||||
!else
|
||||
InstallDir $PROGRAMFILES64\qBittorrent
|
||||
!endif
|
||||
|
||||
; Registry key to check for directory (so if you install again, it will
|
||||
; overwrite the old one automatically)
|
||||
InstallDirRegKey HKLM Software\qbittorrent InstallLocation
|
||||
|
||||
; Request application privileges for Windows Vista
|
||||
RequestExecutionLevel user
|
||||
|
||||
;--------------------------------
|
||||
;General Settings
|
||||
!define MUI_ABORTWARNING
|
||||
!define MUI_HEADERIMAGE
|
||||
!define MUI_COMPONENTSPAGE_NODESC
|
||||
;!define MUI_ICON "qbittorrent.ico"
|
||||
!define MUI_LICENSEPAGE_CHECKBOX
|
||||
!define MUI_LANGDLL_ALLLANGUAGES
|
||||
|
||||
;--------------------------------
|
||||
;Remember the unistaller/installer language
|
||||
!define MUI_LANGDLL_REGISTRY_ROOT "HKLM"
|
||||
!define MUI_LANGDLL_REGISTRY_KEY "Software\qbittorrent"
|
||||
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
|
||||
|
||||
;--------------------------------
|
||||
;Installer Pages
|
||||
!insertmacro MUI_PAGE_WELCOME
|
||||
!insertmacro MUI_PAGE_LICENSE "license.txt"
|
||||
!insertmacro MUI_PAGE_COMPONENTS
|
||||
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE check_instance
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
!insertmacro MUI_PAGE_FINISH
|
||||
|
||||
;--------------------------------
|
||||
;Uninstaller Pages
|
||||
!insertmacro MUI_UNPAGE_CONFIRM
|
||||
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE un.check_instance
|
||||
!insertmacro MUI_UNPAGE_COMPONENTS
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
|
||||
!insertmacro MUI_RESERVEFILE_LANGDLL
|
||||
ReserveFile "${NSISDIR}\Plugins\x86-unicode\FindProcDLL.dll"
|
||||
ReserveFile "${NSISDIR}\Plugins\x86-unicode\UAC.dll"
|
||||
|
||||
!macro Init thing
|
||||
uac_tryagain:
|
||||
!insertmacro UAC_RunElevated
|
||||
${Switch} $0
|
||||
${Case} 0
|
||||
${IfThen} $1 = 1 ${|} Quit ${|} ;we are the outer process, the inner process has done its work, we are done
|
||||
${IfThen} $3 <> 0 ${|} ${Break} ${|} ;we are admin, let the show go on
|
||||
${If} $1 = 3 ;RunAs completed successfully, but with a non-admin user
|
||||
MessageBox mb_YesNo|mb_IconExclamation|mb_TopMost|mb_SetForeground "This ${thing} requires admin privileges, try again" /SD IDNO IDYES uac_tryagain IDNO 0
|
||||
${EndIf}
|
||||
;fall-through and die
|
||||
${Case} 1223
|
||||
MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "This ${thing} requires admin privileges, aborting!"
|
||||
Quit
|
||||
${Case} 1062
|
||||
MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "Logon service not running, aborting!"
|
||||
Quit
|
||||
${Default}
|
||||
MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "Unable to elevate , error $0"
|
||||
Quit
|
||||
${EndSwitch}
|
||||
|
||||
SetShellVarContext all
|
||||
!macroend
|
Loading…
Add table
Add a link
Reference in a new issue