1 ; Copyright (C) 2013 Pali Rohár <pali.rohar@gmail.com>
3 ; This file is part of the Trojita Qt IMAP e-mail client,
4 ; http://trojita.flaska.net/
6 ; This program is free software; you can redistribute it and/or
7 ; modify it under the terms of the GNU General Public License as
8 ; published by the Free Software Foundation; either version 2 of
9 ; the License or (at your option) version 3 or any later version
10 ; accepted by the membership of KDE e.V. (or its successor approved
11 ; by the membership of KDE e.V.), which shall act as a proxy
12 ; defined in Section 14 of version 3 of the license.
14 ; This program is distributed in the hope that it will be useful,
15 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ; GNU General Public License for more details.
19 ; You should have received a copy of the GNU General Public License
20 ; along with this program. If not, see <http://www.gnu.org/licenses/>.
23 ;--------------------------------
29 ;--------------------------------
31 !define redefine
"!insertmacro redefine"
32 !macro redefine symbol value
34 !define ${symbol} "${value}"
37 ;--------------------------------
39 !include "trojita-version.nsi"
40 !include "trojita-files.nsi"
42 ;--------------------------------
44 !define NAME
"Trojita"
45 !define NAME_UNICODE
"Trojitá"
46 !define VERSION
"${TROJITA_VERSION}"
47 !define DESCRIPTION
"Qt IMAP e-mail client"
48 !define HOMEPAGE
"http://trojita.flaska.net/"
49 !define LICENSE
"GPLv2/GPLv3"
50 !define COPYRIGHT
"http://quickgit.kde.org/?p=trojita.git&a=blob&f=LICENSE"
52 ;--------------------------------
54 !define ICON
"${TROJITA_ICON_PATH}"
55 !define EXE_PATH
"${TROJITA_EXE_PATH}"
56 !define EXE
"${TROJITA_EXE}"
57 !define UNINSTALL
"uninstall.exe"
58 !define INSTALLER
"${NAME}-Setup.exe"
59 !define INSTALLDIR
"$PROGRAMFILES\${NAME}\"
60 !define LANGUAGE
"English"
63 ${redefine} INSTALLER
"${NAME}-Setup-x86_64.exe"
64 ${redefine} INSTALLDIR
"$PROGRAMFILES64\${NAME}\"
65 ${redefine} NAME
"${NAME} (64 bit)"
68 !define REGKEY
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${NAME}"
70 ;--------------------------------
73 SetCompressor
/SOLID
/FINAL lzma
74 Name "${NAME_UNICODE}"
76 OutFile "${INSTALLER}"
77 InstallDir "${INSTALLDIR}"
78 InstallDirRegKey HKLM "${REGKEY}" "InstallLocation"
79 BrandingText "${NAME_UNICODE} - ${DESCRIPTION}, version ${VERSION} ${HOMEPAGE}"
81 ShowUnInstDetails Show
83 ManifestSupportedOS all
84 RequestExecutionLevel admin
86 ;--------------------------------
90 ;--------------------------------
94 !define MUI_ICON
"${ICON}"
95 !define MUI_UNICON
"${ICON}"
97 !define MUI_ABORTWARNING
98 !define MUI_FINISHPAGE_NOAUTOCLOSE
99 !define MUI_UNFINISHPAGE_NOAUTOCLOSE
101 !insertmacro MUI_PAGE_WELCOME
102 !insertmacro MUI_PAGE_DIRECTORY
103 !insertmacro MUI_PAGE_STARTMENU Application
$STARTMENUDIR
104 !insertmacro MUI_PAGE_INSTFILES
105 !insertmacro MUI_PAGE_FINISH
107 !insertmacro MUI_UNPAGE_CONFIRM
108 !insertmacro MUI_UNPAGE_INSTFILES
109 !insertmacro MUI_UNPAGE_FINISH
111 !insertmacro MUI_LANGUAGE
"${LANGUAGE}"
113 ;--------------------------------
115 VIAddVersionKey
/LANG=
${LANG_ENGLISH} "FileDescription" "${NAME_UNICODE} Setup - ${DESCRIPTION}"
116 VIAddVersionKey
/LANG=
${LANG_ENGLISH} "FileVersion" "${VERSION}"
117 VIAddVersionKey
/LANG=
${LANG_ENGLISH} "InternalName" "${NAME_UNICODE} Setup"
118 VIAddVersionKey
/LANG=
${LANG_ENGLISH} "LegalCopyright" "${COPYRIGHT}"
119 VIAddVersionKey
/LANG=
${LANG_ENGLISH} "License" "${LICENSE}"
120 VIAddVersionKey
/LANG=
${LANG_ENGLISH} "Homepage" "${HOMEPAGE}"
121 VIAddVersionKey
/LANG=
${LANG_ENGLISH} "OriginalFilename" "${INSTALLER}"
122 VIAddVersionKey
/LANG=
${LANG_ENGLISH} "ProductName" "${NAME_UNICODE} Setup"
123 VIAddVersionKey
/LANG=
${LANG_ENGLISH} "ProductVersion" "${VERSION}"
124 VIProductVersion
"${TROJITA_VERNUM1}.${TROJITA_VERNUM2}.${TROJITA_VERNUM3}.${TROJITA_VERNUM4}"
126 ;--------------------------------
128 LangString INSTALLER_RUNNING
${LANG_ENGLISH} "${NAME_UNICODE} Setup is already running"
129 LangString REMOVEPREVIOUS
${LANG_ENGLISH} "Removing previous installation"
132 LangString x86_64_ONLY
${LANG_ENGLISH} "This version is for 64 bits computers only"
135 ;--------------------------------
139 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${NAME}") i .r1 ?e'
143 MessageBox MB_OK|
MB_ICONEXCLAMATION "$(INSTALLER_RUNNING)"
148 System::Call "kernel32::GetCurrentProcess() i .s"
149 System::Call "kernel32::IsWow64Process(i s, *i .r0)"
152 MessageBox MB_OK|
MB_ICONSTOP "$(x86_64_ONLY)"
159 ;--------------------------------
161 Section "-${NAME}" UninstallPrevious
165 ReadRegStr $0 HKLM "${REGKEY}" "InstallLocation"
168 DetailPrint "$(REMOVEPREVIOUS)"
170 ExecWait "$0\${UNINSTALL} /S _?=$0"
171 Delete "$0\${UNINSTALL}"
173 SetDetailsPrint lastused
181 SetOutPath "$INSTDIR"
183 !insertmacro TROJITA_INSTALL_FILES
185 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
186 CreateDirectory "$SMPROGRAMS\$STARTMENUDIR"
187 CreateShortCut "$SMPROGRAMS\$STARTMENUDIR\${NAME_UNICODE}.lnk" "$INSTDIR\${EXE}"
188 CreateShortCut "$SMPROGRAMS\$STARTMENUDIR\Uninstall.lnk" "$INSTDIR\${UNINSTALL}"
189 CreateShortcut
"$DESKTOP\${NAME_UNICODE}.lnk" "$INSTDIR\${EXE}"
190 !insertmacro MUI_STARTMENU_WRITE_END
192 WriteRegStr HKLM "${REGKEY}" "DisplayName" "${NAME_UNICODE} - ${DESCRIPTION}"
193 WriteRegStr HKLM "${REGKEY}" "UninstallString" "$\"$INSTDIR\
${UNINSTALL}$\
""
194 WriteRegStr HKLM "${REGKEY}" "QuietUninstallString" "$\"$INSTDIR\
${UNINSTALL}$\
" /S"
195 WriteRegStr HKLM "${REGKEY}" "InstallLocation" "$INSTDIR"
196 WriteRegStr HKLM "${REGKEY}" "DisplayIcon" "$\"$INSTDIR\
${EXE}$\
",0"
197 WriteRegStr HKLM "${REGKEY}" "DisplayVersion" "${VERSION}"
198 WriteRegStr HKLM "${REGKEY}" "HelpLink" "${HOMEPAGE}"
199 WriteRegStr HKLM "${REGKEY}" "URLUpdateInfo" "${HOMEPAGE}"
200 WriteRegStr HKLM "${REGKEY}" "URLInfoAbout" "${HOMEPAGE}"
201 WriteRegDWORD HKLM "${REGKEY}" "NoModify" 1
202 WriteRegDWORD HKLM "${REGKEY}" "NoRepair" 1
204 WriteUninstaller "$INSTDIR\${UNINSTALL}"
208 ;--------------------------------
214 !insertmacro MUI_STARTMENU_GETFOLDER Application
$STARTMENUDIR
215 Delete "$SMPROGRAMS\$STARTMENUDIR\${NAME_UNICODE}.lnk"
216 Delete "$SMPROGRAMS\$STARTMENUDIR\Uninstall.lnk"
217 RMDir "$SMPROGRAMS\$STARTMENUDIR"
218 Delete "$DESKTOP\${NAME_UNICODE}.lnk"
220 Delete "$INSTDIR\${EXE}"
221 !insertmacro TROJITA_UNINSTALL_FILES
223 DeleteRegKey HKLM "${REGKEY}"
225 Delete "$INSTDIR\${UNINSTALL}"
230 ;--------------------------------