189 lines
5.3 KiB
NSIS
189 lines
5.3 KiB
NSIS
;This file is part of Tryton. The COPYRIGHT file at the top level of
|
|
;this repository contains the full copyright notices and license terms.
|
|
|
|
;Check version
|
|
!ifndef VERSION
|
|
!error "Missing VERSION! Specify it with '/DVERSION=<VERSION>'"
|
|
!endif
|
|
!ifndef GTKDIR
|
|
!error "Missing GTKDIR! Specify it with '/DGTKDIR=<GTKDIR>'"
|
|
!endif
|
|
|
|
;Include Modern UI
|
|
!include "MUI.nsh"
|
|
|
|
;General
|
|
Name "Tryton ${VERSION}"
|
|
OutFile "tryton-setup-${VERSION}.exe"
|
|
SetCompressor lzma
|
|
SetCompress auto
|
|
|
|
;Default installation folder
|
|
InstallDir "$PROGRAMFILES\tryton-${VERSION}"
|
|
|
|
;Get installation folder from registry if available
|
|
InstallDirRegKey HKCU "Software\tryton-${VERSION}" ""
|
|
|
|
BrandingText "Tryton ${VERSION}"
|
|
|
|
;Vista redirects $SMPROGRAMS to all users without this
|
|
RequestExecutionLevel admin
|
|
|
|
;Variables
|
|
Var MUI_TEMP
|
|
Var STARTMENU_FOLDER
|
|
|
|
;Interface Settings
|
|
!define MUI_ABORTWARNING
|
|
|
|
;Language Selection Dialog Settings
|
|
;Remember the installer language
|
|
!define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
|
|
!define MUI_LANGDLL_REGISTRY_KEY "Software\Modern UI Test"
|
|
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
|
|
|
|
;Pages
|
|
|
|
!define MUI_ICON "share\pixmaps\tryton\tryton.ico"
|
|
!define MUI_LICENSEPAGE_TEXT_BOTTOM "$(LicenseText)"
|
|
!define MUI_LICENSEPAGE_BUTTON "$(LicenseNext)"
|
|
|
|
!insertmacro MUI_PAGE_LICENSE "LICENSE"
|
|
!insertmacro MUI_PAGE_DIRECTORY
|
|
!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
|
|
!insertmacro MUI_PAGE_INSTFILES
|
|
|
|
!insertmacro MUI_UNPAGE_CONFIRM
|
|
!insertmacro MUI_UNPAGE_INSTFILES
|
|
|
|
;Languages
|
|
|
|
!insertmacro MUI_LANGUAGE "English"
|
|
!include "english.nsh"
|
|
!insertmacro MUI_LANGUAGE "French"
|
|
!include "french.nsh"
|
|
!insertmacro MUI_LANGUAGE "German"
|
|
!include "german.nsh"
|
|
!insertmacro MUI_LANGUAGE "Spanish"
|
|
!include "spanish.nsh"
|
|
|
|
;Reserve Files
|
|
|
|
;If you are using solid compression, files that are required before
|
|
;the actual installation should be stored first in the data block,
|
|
;because this will make your installer start faster.
|
|
!insertmacro MUI_RESERVEFILE_LANGDLL
|
|
|
|
;Installer Sections
|
|
Function .onInit
|
|
ClearErrors
|
|
ReadRegStr $0 HKCU "Software\tryton-${VERSION}" ""
|
|
IfErrors DoInstall 0
|
|
MessageBox MB_OK "$(PreviousInstall)"
|
|
Quit
|
|
DoInstall:
|
|
FunctionEnd
|
|
|
|
Section $(SecTrytonName) SecTryton
|
|
SectionIn 1 2 RO
|
|
;Set output path to the installation directory
|
|
SetOutPath "$INSTDIR"
|
|
|
|
;Put file
|
|
File /r "dist\*"
|
|
File "COPYRIGHT"
|
|
File "INSTALL"
|
|
File "LICENSE"
|
|
File "README"
|
|
File "TODO"
|
|
File "CHANGELOG"
|
|
|
|
SetOutPath "$INSTDIR\GTK\bin"
|
|
File /r "${GTKDIR}\bin\*"
|
|
|
|
SetOutPath "$INSTDIR\GTK\etc"
|
|
File /r "${GTKDIR}\etc\*"
|
|
|
|
SetOutPath "$INSTDIR\GTK\lib"
|
|
File /r "${GTKDIR}\lib\*"
|
|
|
|
SetOutPath "$INSTDIR\GTK\share\gtk-2.0"
|
|
File /r "${GTKDIR}\share\gtk-2.0\*"
|
|
|
|
SetOutPath "$INSTDIR\GTK\share\gtkthemeselector"
|
|
File /r "${GTKDIR}\share\gtkthemeselector\*"
|
|
|
|
SetOutPath "$INSTDIR\GTK\share\locale\de"
|
|
File /r "${GTKDIR}\share\locale\de\*"
|
|
|
|
SetOutPath "$INSTDIR\GTK\share\locale\es"
|
|
File /r "${GTKDIR}\share\locale\es\*"
|
|
|
|
SetOutPath "$INSTDIR\GTK\share\locale\fr"
|
|
File /r "${GTKDIR}\share\locale\fr\*"
|
|
|
|
SetOutPath "$INSTDIR\GTK\share\themes"
|
|
File /r "${GTKDIR}\share\themes\*"
|
|
|
|
SetOutPath "$INSTDIR\doc"
|
|
File /r "doc\*"
|
|
|
|
SetOutPath "$INSTDIR\plugins"
|
|
File /r "tryton\plugins\*"
|
|
|
|
;Write the installation path into the registry
|
|
WriteRegStr HKCU "Software\tryton-${VERSION}" "" $INSTDIR
|
|
WriteRegStr HKLM "Software\tryton-${VERSION}" "" $INSTDIR
|
|
|
|
;Write the uninstall keys for Windows
|
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\tryton-${VERSION}" "DisplayName" "Tryton ${VERSION} (remove only)"
|
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\tryton-${VERSION}" "UninstallString" "$INSTDIR\uninstall.exe"
|
|
|
|
;Create the uninstaller
|
|
WriteUninstaller uninstall.exe
|
|
SectionEnd
|
|
|
|
Section $(SecStartMenuName) SecStartMenu
|
|
SectionIn 1 2
|
|
|
|
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
|
|
SetShellVarContext all
|
|
|
|
CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
|
|
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
|
|
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Tryton-${VERSION}.lnk" "$INSTDIR\tryton.exe" "" "$INSTDIR\tryton.exe" 0
|
|
CreateShortCut "$DESKTOP\Tryton-${VERSION}.lnk" "$INSTDIR\tryton.exe" "" "$INSTDIR\tryton.exe" 0
|
|
|
|
!insertmacro MUI_STARTMENU_WRITE_END
|
|
|
|
SectionEnd
|
|
|
|
;Descriptions
|
|
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
|
!insertmacro MUI_DESCRIPTION_TEXT ${SecTryton} $(SecTrytonDesc)
|
|
!insertmacro MUI_DESCRIPTION_TEXT ${SecStartMenu} $(SecStartMenuDesc)
|
|
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
|
|
|
Section "Uninstall"
|
|
;Add your stuff here
|
|
RMDIR /r "$INSTDIR"
|
|
|
|
;remove registry keys
|
|
DeleteRegKey HKCU "Software\tryton-${VERSION}"
|
|
DeleteRegKey HKLM "Software\tryton-${VERSION}"
|
|
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\tryton-${VERSION}"
|
|
|
|
SetShellVarContext all
|
|
Delete "$DESKTOP\Tryton-${VERSION}.lnk"
|
|
|
|
!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
|
|
|
|
StrCmp $MUI_TEMP "" noshortcuts
|
|
Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
|
|
Delete "$SMPROGRAMS\$MUI_TEMP\Tryton-${VERSION}.lnk"
|
|
RMDir "$SMPROGRAMS\$MUI_TEMP"
|
|
noshortcuts:
|
|
|
|
|
|
SectionEnd
|