xref: /glogg/glogg.nsi (revision 9a361c77fce85c9bbe1326d984941ec8feb5541d)
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
11# General
12OutFile "glogg-${VERSION}-setup.exe"
13
14XpStyle on
15
16SetCompressor /SOLID lzma
17
18; Registry key to keep track of the directory we are installed in
19InstallDir "$PROGRAMFILES\glogg"
20InstallDirRegKey HKLM Software\glogg ""
21
22; glogg icon
23; !define MUI_ICON glogg.ico
24
25RequestExecutionLevel user
26
27Name "glogg"
28Caption "glogg ${VERSION} Setup"
29
30# Pages
31!define MUI_WELCOMEPAGE_TITLE "Welcome to the glogg ${VERSION} Setup Wizard"
32!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of logcrawer, a log browser.\
33$\r$\n$\r$\nglogg is blah.$\r$\n$\r$\n\
34glogg is released under the GPL, see http://www.fsf.org/licensing/licenses/gpl.html$\r$\n\
35Qt libraries are released under the GPL, see http://qt.nokia.com/products/licensing$\r$\n$\r$\n$_CLICK"
36; MUI_FINISHPAGE_LINK_LOCATION "http://nsis.sf.net/"
37
38!insertmacro MUI_PAGE_WELCOME
39;!insertmacro MUI_PAGE_LICENSE "COPYING"
40# !ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD...
41!insertmacro MUI_PAGE_COMPONENTS
42!insertmacro MUI_PAGE_DIRECTORY
43!insertmacro MUI_PAGE_INSTFILES
44!insertmacro MUI_PAGE_FINISH
45
46!insertmacro MUI_UNPAGE_WELCOME
47!insertmacro MUI_UNPAGE_CONFIRM
48!insertmacro MUI_UNPAGE_INSTFILES
49!insertmacro MUI_UNPAGE_FINISH
50
51# Languages
52!insertmacro MUI_LANGUAGE "English"
53
54# Installer sections
55Section "glogg" glogg
56    ; Prevent this section from being unselected
57    SectionIn RO
58
59    SetOutPath $INSTDIR
60    File release\glogg.exe
61    File release\mingwm10.dll
62    File COPYING
63    File README.textile
64
65    ; Register uninstaller
66    WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg"\
67"UninstallString" '"$INSTDIR\Uninstall.exe"'
68    WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg"\
69"InstallLocation" "$INSTDIR"
70    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg" "DisplayName" "glogg"
71    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg" "DisplayVersion" "${VERSION}"
72    WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg" "NoModify" "1"
73    WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg" "NoRepair" "1"
74
75    ; Create uninstaller
76    WriteUninstaller "$INSTDIR\Uninstall.exe"
77SectionEnd
78
79Section "Qt4 Runtime libraries" qtlibs
80    SetOutPath $INSTDIR
81    File release\QtCore4.dll
82    File release\QtGui4.dll
83SectionEnd
84
85# Descriptions
86!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
87    !insertmacro MUI_DESCRIPTION_TEXT ${glogg} "The core files required to use glogg."
88    !insertmacro MUI_DESCRIPTION_TEXT ${qtlibs} "Needed by glogg, you have to install these unless \
89you already have the Qt4 development kit installed."
90!insertmacro MUI_FUNCTION_DESCRIPTION_END
91
92# Uninstaller
93Section "Uninstall"
94    Delete "$INSTDIR\Uninstall.exe"
95
96    Delete "$INSTDIR\glogg.exe"
97    Delete "$INSTDIR\README.textile"
98    Delete "$INSTDIR\COPYING"
99    Delete "$INSTDIR\mingwm10.dll"
100    Delete "$INSTDIR\QtCore4.dll"
101    Delete "$INSTDIR\QtGui4.dll"
102    RMDir "$INSTDIR"
103
104    DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg"
105    DeleteRegKey /ifempty HKCU "Software\glogg"
106
107    ; Remove the shortcut, if any
108    SetShellVarContext all
109    Delete "$SMPROGRAMS\glogg.lnk"
110SectionEnd
111