xref: /glogg/glogg.nsi (revision 36b4ae360c9fee4e102dfbf982365b1767944a16)
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"
10*36b4ae36SNicolas 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
209a361c77SNicolas BonnefonInstallDir "$PROGRAMFILES\glogg"
219a361c77SNicolas BonnefonInstallDirRegKey HKLM Software\glogg ""
229a361c77SNicolas Bonnefon
239a361c77SNicolas Bonnefon; glogg icon
249a361c77SNicolas Bonnefon; !define MUI_ICON glogg.ico
259a361c77SNicolas Bonnefon
269a361c77SNicolas BonnefonRequestExecutionLevel user
279a361c77SNicolas Bonnefon
289a361c77SNicolas BonnefonName "glogg"
299a361c77SNicolas BonnefonCaption "glogg ${VERSION} Setup"
309a361c77SNicolas Bonnefon
319a361c77SNicolas Bonnefon# Pages
329a361c77SNicolas Bonnefon!define MUI_WELCOMEPAGE_TITLE "Welcome to the glogg ${VERSION} Setup Wizard"
33*36b4ae36SNicolas Bonnefon!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of glogg\
34*36b4ae36SNicolas Bonnefon, a fast, advanced log explorer.$\r$\n$\r$\n\
35*36b4ae36SNicolas Bonnefonglogg and the Qt libraries are released under the GPL, see \
36*36b4ae36SNicolas Bonnefonthe COPYING file.$\r$\n$\r$\n$_CLICK"
379a361c77SNicolas Bonnefon; MUI_FINISHPAGE_LINK_LOCATION "http://nsis.sf.net/"
389a361c77SNicolas Bonnefon
399a361c77SNicolas Bonnefon!insertmacro MUI_PAGE_WELCOME
409a361c77SNicolas Bonnefon;!insertmacro MUI_PAGE_LICENSE "COPYING"
419a361c77SNicolas Bonnefon# !ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD...
429a361c77SNicolas Bonnefon!insertmacro MUI_PAGE_COMPONENTS
439a361c77SNicolas Bonnefon!insertmacro MUI_PAGE_DIRECTORY
449a361c77SNicolas Bonnefon!insertmacro MUI_PAGE_INSTFILES
459a361c77SNicolas Bonnefon!insertmacro MUI_PAGE_FINISH
469a361c77SNicolas Bonnefon
479a361c77SNicolas Bonnefon!insertmacro MUI_UNPAGE_WELCOME
489a361c77SNicolas Bonnefon!insertmacro MUI_UNPAGE_CONFIRM
499a361c77SNicolas Bonnefon!insertmacro MUI_UNPAGE_INSTFILES
509a361c77SNicolas Bonnefon!insertmacro MUI_UNPAGE_FINISH
519a361c77SNicolas Bonnefon
529a361c77SNicolas Bonnefon# Languages
539a361c77SNicolas Bonnefon!insertmacro MUI_LANGUAGE "English"
549a361c77SNicolas Bonnefon
559a361c77SNicolas Bonnefon# Installer sections
569a361c77SNicolas BonnefonSection "glogg" glogg
579a361c77SNicolas Bonnefon    ; Prevent this section from being unselected
589a361c77SNicolas Bonnefon    SectionIn RO
599a361c77SNicolas Bonnefon
609a361c77SNicolas Bonnefon    SetOutPath $INSTDIR
619a361c77SNicolas Bonnefon    File release\glogg.exe
629a361c77SNicolas Bonnefon    File release\mingwm10.dll
639a361c77SNicolas Bonnefon    File COPYING
649a361c77SNicolas Bonnefon    File README.textile
659a361c77SNicolas Bonnefon
66*36b4ae36SNicolas Bonnefon    ; Create the 'sendto' link
67*36b4ae36SNicolas Bonnefon    CreateShortCut "$SENDTO\glogg.lnk" "$INSTDIR\glogg,exe" "" "$INSTDIR\glogg.exe" 0
68*36b4ae36SNicolas Bonnefon
69*36b4ae36SNicolas Bonnefon    ; Register as an otion (but not main handler) for some files (.txt, .Log, .cap)
70*36b4ae36SNicolas Bonnefon    WriteRegStr HKCR "Applications\glogg.exe" "" ""
71*36b4ae36SNicolas Bonnefon    WriteRegStr HKCR "Applications\glogg.exe\shell" "" "open"
72*36b4ae36SNicolas Bonnefon    WriteRegStr HKCR "Applications\glogg.exe\shell\open" "FriendlyAppName" "glogg"
73*36b4ae36SNicolas Bonnefon    WriteRegStr HKCR "Applications\glogg.exe\shell\open\command" "" '"$INSTDIR\glogg.exe" "%1"'
74*36b4ae36SNicolas Bonnefon    WriteRegStr HKCR "*\OpenWithList\glogg.exe" "" ""
75*36b4ae36SNicolas Bonnefon    WriteRegStr HKCR ".txt\OpenWithList\glogg.exe" "" ""
76*36b4ae36SNicolas Bonnefon    WriteRegStr HKCR ".Log\OpenWithList\glogg.exe" "" ""
77*36b4ae36SNicolas Bonnefon    WriteRegStr HKCR ".cap\OpenWithList\glogg.exe" "" ""
78*36b4ae36SNicolas Bonnefon
799a361c77SNicolas Bonnefon    ; Register uninstaller
809a361c77SNicolas Bonnefon    WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg"\
819a361c77SNicolas Bonnefon"UninstallString" '"$INSTDIR\Uninstall.exe"'
829a361c77SNicolas Bonnefon    WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg"\
839a361c77SNicolas Bonnefon"InstallLocation" "$INSTDIR"
849a361c77SNicolas Bonnefon    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg" "DisplayName" "glogg"
859a361c77SNicolas Bonnefon    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg" "DisplayVersion" "${VERSION}"
869a361c77SNicolas Bonnefon    WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg" "NoModify" "1"
879a361c77SNicolas Bonnefon    WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg" "NoRepair" "1"
889a361c77SNicolas Bonnefon
899a361c77SNicolas Bonnefon    ; Create uninstaller
909a361c77SNicolas Bonnefon    WriteUninstaller "$INSTDIR\Uninstall.exe"
919a361c77SNicolas BonnefonSectionEnd
929a361c77SNicolas Bonnefon
939a361c77SNicolas BonnefonSection "Qt4 Runtime libraries" qtlibs
949a361c77SNicolas Bonnefon    SetOutPath $INSTDIR
959a361c77SNicolas Bonnefon    File release\QtCore4.dll
969a361c77SNicolas Bonnefon    File release\QtGui4.dll
979a361c77SNicolas BonnefonSectionEnd
989a361c77SNicolas Bonnefon
99*36b4ae36SNicolas BonnefonSection "Create Start menu shortcut" shortcut
100*36b4ae36SNicolas Bonnefon    SetShellVarContext all
101*36b4ae36SNicolas Bonnefon    CreateShortCut "$SMPROGRAMS\glogg.lnk" "$INSTDIR\glogg.exe" "" "$INSTDIR\glogg.exe" 0
102*36b4ae36SNicolas BonnefonSectionEnd
103*36b4ae36SNicolas Bonnefon
104*36b4ae36SNicolas BonnefonSection /o "Associate with .log files" associate
105*36b4ae36SNicolas Bonnefon    ${registerExtension} "$INSTDIR\glogg.exe" ".log" "Log file"
106*36b4ae36SNicolas BonnefonSectionEnd
107*36b4ae36SNicolas Bonnefon
1089a361c77SNicolas Bonnefon# Descriptions
1099a361c77SNicolas Bonnefon!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
1109a361c77SNicolas Bonnefon    !insertmacro MUI_DESCRIPTION_TEXT ${glogg} "The core files required to use glogg."
1119a361c77SNicolas Bonnefon    !insertmacro MUI_DESCRIPTION_TEXT ${qtlibs} "Needed by glogg, you have to install these unless \
1129a361c77SNicolas Bonnefonyou already have the Qt4 development kit installed."
113*36b4ae36SNicolas Bonnefon    !insertmacro MUI_DESCRIPTION_TEXT ${shortcut} "Create a shortcut in the Start menu for glogg."
1149a361c77SNicolas Bonnefon!insertmacro MUI_FUNCTION_DESCRIPTION_END
1159a361c77SNicolas Bonnefon
1169a361c77SNicolas Bonnefon# Uninstaller
1179a361c77SNicolas BonnefonSection "Uninstall"
1189a361c77SNicolas Bonnefon    Delete "$INSTDIR\Uninstall.exe"
1199a361c77SNicolas Bonnefon
1209a361c77SNicolas Bonnefon    Delete "$INSTDIR\glogg.exe"
1219a361c77SNicolas Bonnefon    Delete "$INSTDIR\README.textile"
1229a361c77SNicolas Bonnefon    Delete "$INSTDIR\COPYING"
1239a361c77SNicolas Bonnefon    Delete "$INSTDIR\mingwm10.dll"
1249a361c77SNicolas Bonnefon    Delete "$INSTDIR\QtCore4.dll"
1259a361c77SNicolas Bonnefon    Delete "$INSTDIR\QtGui4.dll"
1269a361c77SNicolas Bonnefon    RMDir "$INSTDIR"
1279a361c77SNicolas Bonnefon
1289a361c77SNicolas Bonnefon    DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg"
129*36b4ae36SNicolas Bonnefon
130*36b4ae36SNicolas Bonnefon    ; Remove settings
131*36b4ae36SNicolas Bonnefon    DeleteRegKey HKCU "Software\glogg"
132*36b4ae36SNicolas Bonnefon
133*36b4ae36SNicolas Bonnefon    ; Remove the file associations
134*36b4ae36SNicolas Bonnefon    ${unregisterExtension} ".log" "Log file"
135*36b4ae36SNicolas Bonnefon
136*36b4ae36SNicolas Bonnefon    DeleteRegKey HKCR "*\OpenWithList\glogg.exe"
137*36b4ae36SNicolas Bonnefon    DeleteRegKey HKCR ".txt\OpenWithList\glogg.exe"
138*36b4ae36SNicolas Bonnefon    DeleteRegKey HKCR ".Log\OpenWithList\glogg.exe"
139*36b4ae36SNicolas Bonnefon    DeleteRegKey HKCR ".cap\OpenWithList\glogg.exe"
140*36b4ae36SNicolas Bonnefon    DeleteRegKey HKCR "Applications\glogg.exe\shell\open\command"
141*36b4ae36SNicolas Bonnefon    DeleteRegKey HKCR "Applications\glogg.exe\shell\open"
142*36b4ae36SNicolas Bonnefon    DeleteRegKey HKCR "Applications\glogg.exe\shell"
143*36b4ae36SNicolas Bonnefon    DeleteRegKey HKCR "Applications\glogg.exe"
1449a361c77SNicolas Bonnefon
1459a361c77SNicolas Bonnefon    ; Remove the shortcut, if any
1469a361c77SNicolas Bonnefon    SetShellVarContext all
1479a361c77SNicolas Bonnefon    Delete "$SMPROGRAMS\glogg.lnk"
1489a361c77SNicolas BonnefonSectionEnd
149