2
0
mirror of https://github.com/ars3niy/tdlib-purple synced 2025-08-22 09:57:52 +00:00

Reformatted nsis script

This commit is contained in:
Arseniy Lartsev 2020-09-08 12:44:55 +02:00
parent 2408ce615d
commit da88896645

View File

@ -1,96 +1,96 @@
; Script based on the telegram-purple NSI files ; Script based on the telegram-purple NSI files
SetCompressor /SOLID /FINAL lzma SetCompressor /SOLID /FINAL lzma
; todo: SetBrandingImage ; todo: SetBrandingImage
; HM NIS Edit Wizard helper defines ; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "tdlib-purple" !define PRODUCT_NAME "tdlib-purple"
!define PRPL_INSTALL_TARGET "libtelegram-tdlib.dll" !define PRPL_INSTALL_TARGET "libtelegram-tdlib.dll"
!define PRODUCT_VERSION "${PLUGIN_VERSION}" !define PRODUCT_VERSION "${PLUGIN_VERSION}"
!define PRODUCT_PUBLISHER "The ${PRODUCT_NAME} team" !define PRODUCT_PUBLISHER "The ${PRODUCT_NAME} team"
!define PRODUCT_WEB_SITE "https://github.com/ars3niy/tdlib-purple" !define PRODUCT_WEB_SITE "https://github.com/ars3niy/tdlib-purple"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM" !define PRODUCT_UNINST_ROOT_KEY "HKLM"
; MUI 1.67 compatible ------ ; MUI 1.67 compatible ------
!include "MUI.nsh" !include "MUI.nsh"
; MUI Settings ; MUI Settings
!define MUI_ABORTWARNING !define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico" !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico" !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
; Welcome page ; Welcome page
!insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_WELCOME
; License page ; License page
!insertmacro MUI_PAGE_LICENSE "LICENSE" !insertmacro MUI_PAGE_LICENSE "LICENSE"
; Instfiles page ; Instfiles page
!insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_RUN !define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_TEXT "Run Pidgin" !define MUI_FINISHPAGE_RUN_TEXT "Run Pidgin"
!define MUI_FINISHPAGE_RUN_FUNCTION "RunPidgin" !define MUI_FINISHPAGE_RUN_FUNCTION "RunPidgin"
!insertmacro MUI_PAGE_FINISH !insertmacro MUI_PAGE_FINISH
; Uninstaller pages ; Uninstaller pages
;!insertmacro MUI_UNPAGE_INSTFILES ;!insertmacro MUI_UNPAGE_INSTFILES
; Language files ; Language files
!insertmacro MUI_LANGUAGE "English" !insertmacro MUI_LANGUAGE "English"
; MUI end ------ ; MUI end ------
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "${BUILD_DIR}\${PRODUCT_NAME}-${PRODUCT_VERSION}.exe" OutFile "${BUILD_DIR}\${PRODUCT_NAME}-${PRODUCT_VERSION}.exe"
Var "PidginDir" Var "PidginDir"
ShowInstDetails show ShowInstDetails show
ShowUnInstDetails show ShowUnInstDetails show
Section "MainSection" SEC01 Section "MainSection" SEC01
;Check for pidgin installation ;Check for pidgin installation
Call GetPidginInstPath Call GetPidginInstPath
SetOverwrite try SetOverwrite try
SetOutPath "$PidginDir\pixmaps\pidgin" SetOutPath "$PidginDir\pixmaps\pidgin"
File "/oname=protocols\16\telegram.png" "data\telegram16.png" File "/oname=protocols\16\telegram.png" "data\telegram16.png"
File "/oname=protocols\22\telegram.png" "data\telegram22.png" File "/oname=protocols\22\telegram.png" "data\telegram22.png"
File "/oname=protocols\48\telegram.png" "data\telegram48.png" File "/oname=protocols\48\telegram.png" "data\telegram48.png"
SetOverwrite try SetOverwrite try
copy: copy:
ClearErrors ClearErrors
Delete "$PidginDir\plugins\${PRPL_INSTALL_TARGET}" Delete "$PidginDir\plugins\${PRPL_INSTALL_TARGET}"
IfErrors dllbusy IfErrors dllbusy
SetOutPath "$PidginDir\plugins" SetOutPath "$PidginDir\plugins"
File "/oname=${PRPL_INSTALL_TARGET}" "${BUILD_DIR}\${PRPL_LIBRARY}" File "/oname=${PRPL_INSTALL_TARGET}" "${BUILD_DIR}\${PRPL_LIBRARY}"
Goto after_copy Goto after_copy
dllbusy: dllbusy:
MessageBox MB_RETRYCANCEL "${PRPL_INSTALL_TARGET} is busy. Please close Pidgin (including tray icon) and try again" IDCANCEL cancel MessageBox MB_RETRYCANCEL "${PRPL_INSTALL_TARGET} is busy. Please close Pidgin (including tray icon) and try again" IDCANCEL cancel
Goto copy Goto copy
cancel: cancel:
Abort "Installation of ${PRODUCT_NAME} aborted" Abort "Installation of ${PRODUCT_NAME} aborted"
after_copy: after_copy:
SetOutPath "$PidginDir\locale" SetOutPath "$PidginDir\locale"
!include "${BUILD_DIR}\lang.nsi" !include "${BUILD_DIR}\lang.nsi"
SectionEnd SectionEnd
Function GetPidginInstPath Function GetPidginInstPath
Push $0 Push $0
ReadRegStr $0 HKLM "Software\pidgin" "" ReadRegStr $0 HKLM "Software\pidgin" ""
IfFileExists "$0\pidgin.exe" cont IfFileExists "$0\pidgin.exe" cont
ReadRegStr $0 HKCU "Software\pidgin" "" ReadRegStr $0 HKCU "Software\pidgin" ""
IfFileExists "$0\pidgin.exe" cont IfFileExists "$0\pidgin.exe" cont
MessageBox MB_OK|MB_ICONINFORMATION "Failed to find Pidgin installation." MessageBox MB_OK|MB_ICONINFORMATION "Failed to find Pidgin installation."
Abort "Failed to find Pidgin installation. Please install Pidgin first." Abort "Failed to find Pidgin installation. Please install Pidgin first."
cont: cont:
StrCpy $PidginDir $0 StrCpy $PidginDir $0
FunctionEnd FunctionEnd
Function RunPidgin Function RunPidgin
ExecShell "" "$PidginDir\pidgin.exe" ExecShell "" "$PidginDir\pidgin.exe"
FunctionEnd FunctionEnd