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 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 "Qt4 Runtime libraries" qtlibs 97 SetOutPath $INSTDIR 98 File release\QtCore4.dll 99 File release\QtGui4.dll 100 File release\QtNetwork4.dll 101 File release\libwinpthread-1.dll 102SectionEnd 103 104Section "Create Start menu shortcut" shortcut 105 SetShellVarContext all 106 CreateShortCut "$SMPROGRAMS\glogg.lnk" "$INSTDIR\glogg.exe" "" "$INSTDIR\glogg.exe" 0 107SectionEnd 108 109Section /o "Associate with .log files" associate 110 ${registerExtension} "$INSTDIR\glogg.exe" ".log" "Log file" 111SectionEnd 112 113# Descriptions 114!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN 115 !insertmacro MUI_DESCRIPTION_TEXT ${glogg} "The core files required to use glogg." 116 !insertmacro MUI_DESCRIPTION_TEXT ${qtlibs} "Needed by glogg, you have to install these unless \ 117you already have the Qt4 development kit installed." 118 !insertmacro MUI_DESCRIPTION_TEXT ${shortcut} "Create a shortcut in the Start menu for glogg." 119 !insertmacro MUI_DESCRIPTION_TEXT ${associate} "Make glogg the default viewer for .log files." 120!insertmacro MUI_FUNCTION_DESCRIPTION_END 121 122# Uninstaller 123Section "Uninstall" 124 Delete "$INSTDIR\Uninstall.exe" 125 126 Delete "$INSTDIR\glogg.exe" 127 Delete "$INSTDIR\README" 128 Delete "$INSTDIR\COPYING" 129 Delete "$INSTDIR\mingwm10.dll" 130 Delete "$INSTDIR\libgcc_s_dw2-1.dll" 131 Delete "$INSTDIR\QtCore4.dll" 132 Delete "$INSTDIR\QtGui4.dll" 133 Delete "$INSTDIR\QtNetwork4.dll" 134 Delete "$INSTDIR\libwinpthread-1.dll" 135 RMDir "$INSTDIR" 136 137 ; Remove settings in %appdata% 138 Delete "$APPDATA\glogg\glogg.ini" 139 RMDir "$APPDATA\glogg" 140 141 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg" 142 143 ; Remove settings in the registry (from glogg < 0.9) 144 DeleteRegKey HKCU "Software\glogg" 145 146 ; Remove the file associations 147 ${unregisterExtension} ".log" "Log file" 148 149 DeleteRegKey HKCR "*\OpenWithList\glogg.exe" 150 DeleteRegKey HKCR ".txt\OpenWithList\glogg.exe" 151 DeleteRegKey HKCR ".Log\OpenWithList\glogg.exe" 152 DeleteRegKey HKCR ".cap\OpenWithList\glogg.exe" 153 DeleteRegKey HKCR "Applications\glogg.exe\shell\open\command" 154 DeleteRegKey HKCR "Applications\glogg.exe\shell\open" 155 DeleteRegKey HKCR "Applications\glogg.exe\shell" 156 DeleteRegKey HKCR "Applications\glogg.exe" 157 158 ; Remove the shortcut, if any 159 SetShellVarContext all 160 Delete "$SMPROGRAMS\glogg.lnk" 161SectionEnd 162