xref: /glogg/glogg.nsi (revision 7029a38b766213669ea9d77f2adfc13b99bec1d3)
19a361c77SNicolas Bonnefon# NSIS script creating the Windows installer for glogg
29a361c77SNicolas Bonnefon
39a361c77SNicolas Bonnefon# Is passed to the script using -DVERSION=$(git describe) on the command line
49a361c77SNicolas Bonnefon!ifndef VERSION
59a361c77SNicolas Bonnefon    !define VERSION 'anonymous-build'
69a361c77SNicolas Bonnefon!endif
79a361c77SNicolas Bonnefon
89a361c77SNicolas Bonnefon# Headers
99a361c77SNicolas Bonnefon!include "MUI2.nsh"
1036b4ae36SNicolas Bonnefon!include "FileAssociation.nsh"
119a361c77SNicolas Bonnefon
129a361c77SNicolas Bonnefon# General
139a361c77SNicolas BonnefonOutFile "glogg-${VERSION}-setup.exe"
149a361c77SNicolas Bonnefon
159a361c77SNicolas BonnefonXpStyle on
169a361c77SNicolas Bonnefon
179a361c77SNicolas BonnefonSetCompressor /SOLID lzma
189a361c77SNicolas Bonnefon
199a361c77SNicolas Bonnefon; Registry key to keep track of the directory we are installed in
20d022340fSNicolas Bonnefon!ifdef ARCH32
219a361c77SNicolas Bonnefon  InstallDir "$PROGRAMFILES\glogg"
22d022340fSNicolas Bonnefon!else
23d022340fSNicolas Bonnefon  InstallDir "$PROGRAMFILES64\glogg"
24d022340fSNicolas Bonnefon!endif
259a361c77SNicolas BonnefonInstallDirRegKey HKLM Software\glogg ""
269a361c77SNicolas Bonnefon
279a361c77SNicolas Bonnefon; glogg icon
289a361c77SNicolas Bonnefon; !define MUI_ICON glogg.ico
299a361c77SNicolas Bonnefon
3070379430SNicolas BonnefonRequestExecutionLevel admin
319a361c77SNicolas Bonnefon
329a361c77SNicolas BonnefonName "glogg"
339a361c77SNicolas BonnefonCaption "glogg ${VERSION} Setup"
349a361c77SNicolas Bonnefon
359a361c77SNicolas Bonnefon# Pages
369a361c77SNicolas Bonnefon!define MUI_WELCOMEPAGE_TITLE "Welcome to the glogg ${VERSION} Setup Wizard"
3736b4ae36SNicolas Bonnefon!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of glogg\
3836b4ae36SNicolas Bonnefon, a fast, advanced log explorer.$\r$\n$\r$\n\
3936b4ae36SNicolas Bonnefonglogg and the Qt libraries are released under the GPL, see \
4036b4ae36SNicolas Bonnefonthe COPYING file.$\r$\n$\r$\n$_CLICK"
419a361c77SNicolas Bonnefon; MUI_FINISHPAGE_LINK_LOCATION "http://nsis.sf.net/"
429a361c77SNicolas Bonnefon
439a361c77SNicolas Bonnefon!insertmacro MUI_PAGE_WELCOME
449a361c77SNicolas Bonnefon;!insertmacro MUI_PAGE_LICENSE "COPYING"
459a361c77SNicolas Bonnefon# !ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD...
469a361c77SNicolas Bonnefon!insertmacro MUI_PAGE_COMPONENTS
479a361c77SNicolas Bonnefon!insertmacro MUI_PAGE_DIRECTORY
489a361c77SNicolas Bonnefon!insertmacro MUI_PAGE_INSTFILES
499a361c77SNicolas Bonnefon!insertmacro MUI_PAGE_FINISH
509a361c77SNicolas Bonnefon
519a361c77SNicolas Bonnefon!insertmacro MUI_UNPAGE_WELCOME
529a361c77SNicolas Bonnefon!insertmacro MUI_UNPAGE_CONFIRM
539a361c77SNicolas Bonnefon!insertmacro MUI_UNPAGE_INSTFILES
549a361c77SNicolas Bonnefon!insertmacro MUI_UNPAGE_FINISH
559a361c77SNicolas Bonnefon
569a361c77SNicolas Bonnefon# Languages
579a361c77SNicolas Bonnefon!insertmacro MUI_LANGUAGE "English"
589a361c77SNicolas Bonnefon
599a361c77SNicolas Bonnefon# Installer sections
609a361c77SNicolas BonnefonSection "glogg" glogg
619a361c77SNicolas Bonnefon    ; Prevent this section from being unselected
629a361c77SNicolas Bonnefon    SectionIn RO
639a361c77SNicolas Bonnefon
649a361c77SNicolas Bonnefon    SetOutPath $INSTDIR
659a361c77SNicolas Bonnefon    File release\glogg.exe
669a361c77SNicolas Bonnefon    File COPYING
67*7029a38bSNicolas Bonnefon    File README.md
689a361c77SNicolas Bonnefon
6936b4ae36SNicolas Bonnefon    ; Create the 'sendto' link
7036b4ae36SNicolas Bonnefon    CreateShortCut "$SENDTO\glogg.lnk" "$INSTDIR\glogg,exe" "" "$INSTDIR\glogg.exe" 0
7136b4ae36SNicolas Bonnefon
7236b4ae36SNicolas Bonnefon    ; Register as an otion (but not main handler) for some files (.txt, .Log, .cap)
7336b4ae36SNicolas Bonnefon    WriteRegStr HKCR "Applications\glogg.exe" "" ""
7436b4ae36SNicolas Bonnefon    WriteRegStr HKCR "Applications\glogg.exe\shell" "" "open"
7536b4ae36SNicolas Bonnefon    WriteRegStr HKCR "Applications\glogg.exe\shell\open" "FriendlyAppName" "glogg"
7636b4ae36SNicolas Bonnefon    WriteRegStr HKCR "Applications\glogg.exe\shell\open\command" "" '"$INSTDIR\glogg.exe" "%1"'
7736b4ae36SNicolas Bonnefon    WriteRegStr HKCR "*\OpenWithList\glogg.exe" "" ""
7836b4ae36SNicolas Bonnefon    WriteRegStr HKCR ".txt\OpenWithList\glogg.exe" "" ""
7936b4ae36SNicolas Bonnefon    WriteRegStr HKCR ".Log\OpenWithList\glogg.exe" "" ""
8036b4ae36SNicolas Bonnefon    WriteRegStr HKCR ".cap\OpenWithList\glogg.exe" "" ""
8136b4ae36SNicolas Bonnefon
829a361c77SNicolas Bonnefon    ; Register uninstaller
839a361c77SNicolas Bonnefon    WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg"\
849a361c77SNicolas Bonnefon"UninstallString" '"$INSTDIR\Uninstall.exe"'
859a361c77SNicolas Bonnefon    WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg"\
869a361c77SNicolas Bonnefon"InstallLocation" "$INSTDIR"
879a361c77SNicolas Bonnefon    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg" "DisplayName" "glogg"
889a361c77SNicolas Bonnefon    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg" "DisplayVersion" "${VERSION}"
899a361c77SNicolas Bonnefon    WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg" "NoModify" "1"
909a361c77SNicolas Bonnefon    WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg" "NoRepair" "1"
919a361c77SNicolas Bonnefon
929a361c77SNicolas Bonnefon    ; Create uninstaller
939a361c77SNicolas Bonnefon    WriteUninstaller "$INSTDIR\Uninstall.exe"
949a361c77SNicolas BonnefonSectionEnd
959a361c77SNicolas Bonnefon
96dc8ea655SNicolas BonnefonSection "Qt5 Runtime libraries" qtlibs
979a361c77SNicolas Bonnefon    SetOutPath $INSTDIR
98dc8ea655SNicolas Bonnefon    File release\Qt5Core.dll
99dc8ea655SNicolas Bonnefon    File release\Qt5Gui.dll
100dc8ea655SNicolas Bonnefon    File release\Qt5Network.dll
101dc8ea655SNicolas Bonnefon    File release\Qt5Widgets.dll
1029ba963cbSNicolas Bonnefon    File release\libwinpthread-1.dll
103*7029a38bSNicolas Bonnefon    SetOutPath $INSTDIR\platforms
104*7029a38bSNicolas Bonnefon    File release\qwindows.dll
1059a361c77SNicolas BonnefonSectionEnd
1069a361c77SNicolas Bonnefon
10736b4ae36SNicolas BonnefonSection "Create Start menu shortcut" shortcut
10836b4ae36SNicolas Bonnefon    SetShellVarContext all
10936b4ae36SNicolas Bonnefon    CreateShortCut "$SMPROGRAMS\glogg.lnk" "$INSTDIR\glogg.exe" "" "$INSTDIR\glogg.exe" 0
11036b4ae36SNicolas BonnefonSectionEnd
11136b4ae36SNicolas Bonnefon
11236b4ae36SNicolas BonnefonSection /o "Associate with .log files" associate
11336b4ae36SNicolas Bonnefon    ${registerExtension} "$INSTDIR\glogg.exe" ".log" "Log file"
11436b4ae36SNicolas BonnefonSectionEnd
11536b4ae36SNicolas Bonnefon
1169a361c77SNicolas Bonnefon# Descriptions
1179a361c77SNicolas Bonnefon!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
1189a361c77SNicolas Bonnefon    !insertmacro MUI_DESCRIPTION_TEXT ${glogg} "The core files required to use glogg."
1199a361c77SNicolas Bonnefon    !insertmacro MUI_DESCRIPTION_TEXT ${qtlibs} "Needed by glogg, you have to install these unless \
120*7029a38bSNicolas Bonnefonyou already have the Qt5 development kit installed."
12136b4ae36SNicolas Bonnefon    !insertmacro MUI_DESCRIPTION_TEXT ${shortcut} "Create a shortcut in the Start menu for glogg."
122afcc2cb7SNicolas Bonnefon    !insertmacro MUI_DESCRIPTION_TEXT ${associate} "Make glogg the default viewer for .log files."
1239a361c77SNicolas Bonnefon!insertmacro MUI_FUNCTION_DESCRIPTION_END
1249a361c77SNicolas Bonnefon
1259a361c77SNicolas Bonnefon# Uninstaller
1269a361c77SNicolas BonnefonSection "Uninstall"
1279a361c77SNicolas Bonnefon    Delete "$INSTDIR\Uninstall.exe"
1289a361c77SNicolas Bonnefon
1299a361c77SNicolas Bonnefon    Delete "$INSTDIR\glogg.exe"
130afcc2cb7SNicolas Bonnefon    Delete "$INSTDIR\README"
1319a361c77SNicolas Bonnefon    Delete "$INSTDIR\COPYING"
1329a361c77SNicolas Bonnefon    Delete "$INSTDIR\mingwm10.dll"
133da722d7bSNicolas Bonnefon    Delete "$INSTDIR\libgcc_s_dw2-1.dll"
1349a361c77SNicolas Bonnefon    Delete "$INSTDIR\QtCore4.dll"
1359a361c77SNicolas Bonnefon    Delete "$INSTDIR\QtGui4.dll"
1369e112cbdSNicolas Bonnefon    Delete "$INSTDIR\QtNetwork4.dll"
137dc8ea655SNicolas Bonnefon    Delete "$INSTDIR\Qt5Core.dll"
138dc8ea655SNicolas Bonnefon    Delete "$INSTDIR\Qt5Gui.dll"
139dc8ea655SNicolas Bonnefon    Delete "$INSTDIR\Qt5Network.dll"
140dc8ea655SNicolas Bonnefon    Delete "$INSTDIR\Qt5Widgets.dll"
1419ba963cbSNicolas Bonnefon    Delete "$INSTDIR\libwinpthread-1.dll"
142*7029a38bSNicolas Bonnefon    Delete "$INSTDIR\platforms\qwindows.dll"
1439a361c77SNicolas Bonnefon    RMDir "$INSTDIR"
1449a361c77SNicolas Bonnefon
145803db976SNicolas Bonnefon    ; Remove settings in %appdata%
146803db976SNicolas Bonnefon    Delete "$APPDATA\glogg\glogg.ini"
147803db976SNicolas Bonnefon    RMDir "$APPDATA\glogg"
148803db976SNicolas Bonnefon
1499a361c77SNicolas Bonnefon    DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg"
15036b4ae36SNicolas Bonnefon
151803db976SNicolas Bonnefon    ; Remove settings in the registry (from glogg < 0.9)
15236b4ae36SNicolas Bonnefon    DeleteRegKey HKCU "Software\glogg"
15336b4ae36SNicolas Bonnefon
15436b4ae36SNicolas Bonnefon    ; Remove the file associations
15536b4ae36SNicolas Bonnefon    ${unregisterExtension} ".log" "Log file"
15636b4ae36SNicolas Bonnefon
15736b4ae36SNicolas Bonnefon    DeleteRegKey HKCR "*\OpenWithList\glogg.exe"
15836b4ae36SNicolas Bonnefon    DeleteRegKey HKCR ".txt\OpenWithList\glogg.exe"
15936b4ae36SNicolas Bonnefon    DeleteRegKey HKCR ".Log\OpenWithList\glogg.exe"
16036b4ae36SNicolas Bonnefon    DeleteRegKey HKCR ".cap\OpenWithList\glogg.exe"
16136b4ae36SNicolas Bonnefon    DeleteRegKey HKCR "Applications\glogg.exe\shell\open\command"
16236b4ae36SNicolas Bonnefon    DeleteRegKey HKCR "Applications\glogg.exe\shell\open"
16336b4ae36SNicolas Bonnefon    DeleteRegKey HKCR "Applications\glogg.exe\shell"
16436b4ae36SNicolas Bonnefon    DeleteRegKey HKCR "Applications\glogg.exe"
1659a361c77SNicolas Bonnefon
1669a361c77SNicolas Bonnefon    ; Remove the shortcut, if any
1679a361c77SNicolas Bonnefon    SetShellVarContext all
1689a361c77SNicolas Bonnefon    Delete "$SMPROGRAMS\glogg.lnk"
1699a361c77SNicolas BonnefonSectionEnd
170