1# NSIS script creating the Windows installer for glogg 2 3# Is passed to the script using -DVERSION=$(git describe) on the command line 4!ifndef VERSION 5 !define VERSION 'anonymous-build' 6!endif 7 8# Headers 9!include "MUI2.nsh" 10!include "FileAssociation.nsh" 11 12# General 13OutFile "glogg-${VERSION}-setup.exe" 14 15XpStyle on 16 17SetCompressor /SOLID lzma 18 19; Registry key to keep track of the directory we are installed in 20!ifdef ARCH32 21 InstallDir "$PROGRAMFILES\glogg" 22!else 23 InstallDir "$PROGRAMFILES64\glogg" 24!endif 25InstallDirRegKey HKLM Software\glogg "" 26 27; glogg icon 28; !define MUI_ICON glogg.ico 29 30RequestExecutionLevel admin 31 32Name "glogg" 33Caption "glogg ${VERSION} Setup" 34 35# Pages 36!define MUI_WELCOMEPAGE_TITLE "Welcome to the glogg ${VERSION} Setup Wizard" 37!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of glogg\ 38, a fast, advanced log explorer.$\r$\n$\r$\n\ 39glogg and the Qt libraries are released under the GPL, see \ 40the COPYING file.$\r$\n$\r$\n$_CLICK" 41; MUI_FINISHPAGE_LINK_LOCATION "http://nsis.sf.net/" 42 43!insertmacro MUI_PAGE_WELCOME 44;!insertmacro MUI_PAGE_LICENSE "COPYING" 45# !ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD... 46!insertmacro MUI_PAGE_COMPONENTS 47!insertmacro MUI_PAGE_DIRECTORY 48!insertmacro MUI_PAGE_INSTFILES 49!insertmacro MUI_PAGE_FINISH 50 51!insertmacro MUI_UNPAGE_WELCOME 52!insertmacro MUI_UNPAGE_CONFIRM 53!insertmacro MUI_UNPAGE_INSTFILES 54!insertmacro MUI_UNPAGE_FINISH 55 56# Languages 57!insertmacro MUI_LANGUAGE "English" 58 59# Installer sections 60Section "glogg" glogg 61 ; Prevent this section from being unselected 62 SectionIn RO 63 64 SetOutPath $INSTDIR 65 File release\glogg.exe 66 File COPYING 67 File README.md 68 69 ; Create the 'sendto' link 70 CreateShortCut "$SENDTO\glogg.lnk" "$INSTDIR\glogg,exe" "" "$INSTDIR\glogg.exe" 0 71 72 ; Register as an otion (but not main handler) for some files (.txt, .Log, .cap) 73 WriteRegStr HKCR "Applications\glogg.exe" "" "" 74 WriteRegStr HKCR "Applications\glogg.exe\shell" "" "open" 75 WriteRegStr HKCR "Applications\glogg.exe\shell\open" "FriendlyAppName" "glogg" 76 WriteRegStr HKCR "Applications\glogg.exe\shell\open\command" "" '"$INSTDIR\glogg.exe" "%1"' 77 WriteRegStr HKCR "*\OpenWithList\glogg.exe" "" "" 78 WriteRegStr HKCR ".txt\OpenWithList\glogg.exe" "" "" 79 WriteRegStr HKCR ".Log\OpenWithList\glogg.exe" "" "" 80 WriteRegStr HKCR ".cap\OpenWithList\glogg.exe" "" "" 81 82 ; Register uninstaller 83 WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg"\ 84"UninstallString" '"$INSTDIR\Uninstall.exe"' 85 WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg"\ 86"InstallLocation" "$INSTDIR" 87 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg" "DisplayName" "glogg" 88 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg" "DisplayVersion" "${VERSION}" 89 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg" "NoModify" "1" 90 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg" "NoRepair" "1" 91 92 ; Create uninstaller 93 WriteUninstaller "$INSTDIR\Uninstall.exe" 94SectionEnd 95 96Section "Qt5 Runtime libraries" qtlibs 97 SetOutPath $INSTDIR 98 File release\Qt5Core.dll 99 File release\Qt5Gui.dll 100 File release\Qt5Network.dll 101 File release\Qt5Widgets.dll 102 File release\libwinpthread-1.dll 103 SetOutPath $INSTDIR\platforms 104 File release\qwindows.dll 105SectionEnd 106 107Section "Create Start menu shortcut" shortcut 108 SetShellVarContext all 109 CreateShortCut "$SMPROGRAMS\glogg.lnk" "$INSTDIR\glogg.exe" "" "$INSTDIR\glogg.exe" 0 110SectionEnd 111 112Section /o "Associate with .log files" associate 113 ${registerExtension} "$INSTDIR\glogg.exe" ".log" "Log file" 114SectionEnd 115 116# Descriptions 117!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN 118 !insertmacro MUI_DESCRIPTION_TEXT ${glogg} "The core files required to use glogg." 119 !insertmacro MUI_DESCRIPTION_TEXT ${qtlibs} "Needed by glogg, you have to install these unless \ 120you already have the Qt5 development kit installed." 121 !insertmacro MUI_DESCRIPTION_TEXT ${shortcut} "Create a shortcut in the Start menu for glogg." 122 !insertmacro MUI_DESCRIPTION_TEXT ${associate} "Make glogg the default viewer for .log files." 123!insertmacro MUI_FUNCTION_DESCRIPTION_END 124 125# Uninstaller 126Section "Uninstall" 127 Delete "$INSTDIR\Uninstall.exe" 128 129 Delete "$INSTDIR\glogg.exe" 130 Delete "$INSTDIR\README" 131 Delete "$INSTDIR\README.md" 132 Delete "$INSTDIR\COPYING" 133 Delete "$INSTDIR\mingwm10.dll" 134 Delete "$INSTDIR\libgcc_s_dw2-1.dll" 135 Delete "$INSTDIR\QtCore4.dll" 136 Delete "$INSTDIR\QtGui4.dll" 137 Delete "$INSTDIR\QtNetwork4.dll" 138 Delete "$INSTDIR\Qt5Core.dll" 139 Delete "$INSTDIR\Qt5Gui.dll" 140 Delete "$INSTDIR\Qt5Network.dll" 141 Delete "$INSTDIR\Qt5Widgets.dll" 142 Delete "$INSTDIR\libwinpthread-1.dll" 143 Delete "$INSTDIR\platforms\qwindows.dll" 144 RMDir "$INSTDIR" 145 146 ; Remove settings in %appdata% 147 Delete "$APPDATA\glogg\glogg.ini" 148 RMDir "$APPDATA\glogg" 149 150 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg" 151 152 ; Remove settings in the registry (from glogg < 0.9) 153 DeleteRegKey HKCU "Software\glogg" 154 155 ; Remove the file associations 156 ${unregisterExtension} ".log" "Log file" 157 158 DeleteRegKey HKCR "*\OpenWithList\glogg.exe" 159 DeleteRegKey HKCR ".txt\OpenWithList\glogg.exe" 160 DeleteRegKey HKCR ".Log\OpenWithList\glogg.exe" 161 DeleteRegKey HKCR ".cap\OpenWithList\glogg.exe" 162 DeleteRegKey HKCR "Applications\glogg.exe\shell\open\command" 163 DeleteRegKey HKCR "Applications\glogg.exe\shell\open" 164 DeleteRegKey HKCR "Applications\glogg.exe\shell" 165 DeleteRegKey HKCR "Applications\glogg.exe" 166 167 ; Remove the shortcut, if any 168 SetShellVarContext all 169 Delete "$SMPROGRAMS\glogg.lnk" 170SectionEnd 171