1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2 ; geany.nsi - this file is part of Geany, a fast and lightweight IDE
4 ; Copyright 2007-2012 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
5 ; Copyright 2007-2012 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
7 ; This program is free software; you can redistribute it and/or modify
8 ; it under the terms of the GNU General Public License as published by
9 ; the Free Software Foundation; either version 2 of the License, or
10 ; (at your option) any later version.
12 ; This program is distributed in the hope that it will be useful,
13 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ; GNU General Public License for more details.
17 ; You should have received a copy of the GNU General Public License
18 ; along with this program; if not, write to the Free Software
19 ; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 ; Installer script for Geany (Windows Installer)
23 ; (Script originally generated by the HM NIS Edit Script Wizard)
24 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
27 ; Do a Cyclic Redundancy Check to make sure the installer was not corrupted by the download
29 RequestExecutionLevel highest
; set execution level for Windows Vista
34 !define PRODUCT_NAME
"Geany"
35 !define PRODUCT_VERSION
"@VERSION@"
36 !define PRODUCT_VERSION_ID
"@VERSION@.0.0"
37 !define PRODUCT_PUBLISHER
"The Geany developer team"
38 !define PRODUCT_WEB_SITE
"http://www.geany.org/"
39 !define PRODUCT_DIR_REGKEY
"Software\Geany"
40 !define PRODUCT_UNINST_KEY
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
41 !define PRODUCT_EXE
"$INSTDIR\bin\Geany.exe"
42 !define PRODUCT_REGNAME
"Geany.ProjectFile"
43 !define PRODUCT_EXT
".geany"
44 !define RESOURCEDIR
"geany-${PRODUCT_VERSION}"
45 !define GTK_VERSION @GTK_VERSION@
50 VIProductVersion
"${PRODUCT_VERSION_ID}"
51 VIAddVersionKey
"ProductName" "${PRODUCT_NAME}"
52 VIAddVersionKey
"FileVersion" "${PRODUCT_VERSION}"
53 VIAddVersionKey
"ProductVersion" "${PRODUCT_VERSION}"
54 VIAddVersionKey
"LegalCopyright" "Copyright 2005-2014 by the Geany developer team"
55 VIAddVersionKey
"FileDescription" "${PRODUCT_NAME} Installer"
57 BrandingText "$(^NAME) installer (NSIS 2.46)"
58 InstallDir "$PROGRAMFILES\Geany"
59 Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
60 SetCompressor
/SOLID lzma
62 ShowUnInstDetails hide
65 OutFile "geany-${PRODUCT_VERSION}_setup.exe"
67 OutFile "geany-${PRODUCT_VERSION}_nogtk_setup.exe"
80 ;Reserve files used in .onInit, for faster start-up
81 ReserveFile
"${NSISDIR}\Plugins\System.dll"
82 ReserveFile
"${NSISDIR}\Plugins\UserInfo.dll"
83 ReserveFile
"${NSISDIR}\Plugins\InstallOptions.dll"
84 ReserveFile
"${NSISDIR}\Plugins\LangDLL.dll"
86 !define MUI_ABORTWARNING
87 !define MUI_ICON
"icons\geany.ico"
88 !define MUI_UNICON
"${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall-full.ico"
91 !insertmacro MUI_PAGE_WELCOME
93 ;!define MUI_LICENSEPAGE_RADIOBUTTONS
94 !insertmacro MUI_PAGE_LICENSE
"${RESOURCEDIR}\Copying.txt"
96 !insertmacro MUI_PAGE_COMPONENTS
98 !define MUI_PAGE_CUSTOMFUNCTION_LEAVE OnDirLeave
99 !insertmacro MUI_PAGE_DIRECTORY
101 !define MUI_STARTMENUPAGE_DEFAULTFOLDER
"Geany"
102 !define MUI_STARTMENUPAGE_REGISTRY_ROOT
HKLM
103 !define MUI_STARTMENUPAGE_REGISTRY_KEY
"${PRODUCT_UNINST_KEY}"
104 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME
"Start Menu Folder"
105 !insertmacro MUI_PAGE_STARTMENU
${PRODUCT_NAME} "$StartmenuFolder"
107 !insertmacro MUI_PAGE_INSTFILES
109 !define MUI_FINISHPAGE_SHOWREADME
"$INSTDIR\News.txt"
110 !define MUI_FINISHPAGE_SHOWREADME_TEXT
"Show Release Notes"
111 !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
112 !define MUI_FINISHPAGE_RUN
"$INSTDIR\bin\Geany.exe"
113 !define MUI_FINISHPAGE_RUN_NOTCHECKED
114 !insertmacro MUI_PAGE_FINISH
116 !insertmacro MUI_UNPAGE_INSTFILES
; Uninstaller page
117 !insertmacro MUI_LANGUAGE
"English" ; Language file
119 ;;;;;;;;;;;;;;;;;;;;;;;;;;;
120 ; Sections and InstTypes ;
121 ;;;;;;;;;;;;;;;;;;;;;;;;;;;
125 Section "!Program Files" SEC01
129 SetOutPath "$INSTDIR"
130 File "${RESOURCEDIR}\*.txt"
132 SetOutPath "$INSTDIR\bin"
133 File "${RESOURCEDIR}\bin\Geany.exe"
134 File "${RESOURCEDIR}\bin\*Geany*.dll"
136 SetOutPath "$INSTDIR\data"
137 File "${RESOURCEDIR}\data\GPL-2"
138 File "${RESOURCEDIR}\data\file*"
139 File "${RESOURCEDIR}\data\geany.glade"
140 !if ${GTK_VERSION} >=
3
141 File "${RESOURCEDIR}\data\geany.css"
143 File "${RESOURCEDIR}\data\geany.gtkrc"
145 File "${RESOURCEDIR}\data\snippets.conf"
146 File "${RESOURCEDIR}\data\ui_toolbar.xml"
148 SetOutPath "$INSTDIR\data\templates"
149 File /r
"${RESOURCEDIR}\data\templates\*"
151 SetOutPath "$INSTDIR\data\colorschemes"
152 File /r
"${RESOURCEDIR}\data\colorschemes\*"
153 # Geany color schemes project, don't bail out if they are missing
154 File /nonfatal
/r
"..\geany-themes\colorschemes\*.conf"
156 SetOutPath "$INSTDIR\share\icons"
157 File /r
"${RESOURCEDIR}\share\icons\*"
159 SetOutPath "$INSTDIR"
161 CreateShortCut "$INSTDIR\Geany.lnk" "$INSTDIR\bin\Geany.exe"
162 !insertmacro MUI_STARTMENU_WRITE_BEGIN
${PRODUCT_NAME}
163 CreateDirectory "$SMPROGRAMS\$StartmenuFolder"
164 CreateShortCut "$SMPROGRAMS\$StartmenuFolder\Geany.lnk" "$INSTDIR\bin\Geany.exe"
165 !insertmacro MUI_STARTMENU_WRITE_END
167 ; register the extension .geany
168 ; write information about file type
169 WriteRegStr SHCTX
"Software\Classes\${PRODUCT_REGNAME}" "" "${PRODUCT_NAME} Project File"
170 WriteRegStr SHCTX
"Software\Classes\${PRODUCT_REGNAME}\DefaultIcon" "" "${PRODUCT_EXE},0"
171 WriteRegStr SHCTX
"Software\Classes\${PRODUCT_REGNAME}\Shell\open\command" "" '"${PRODUCT_EXE}" "%1"'
172 ; write information about file extensions
173 WriteRegStr SHCTX
"Software\Classes\${PRODUCT_EXT}" "" "${PRODUCT_REGNAME}"
175 System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) (0x08000000, 0, 0, 0)'
178 Section "Plugins" SEC02
181 SetOutPath "$INSTDIR\lib\geany"
182 File "${RESOURCEDIR}\lib\geany\*.dll"
185 Section "Language Files" SEC03
187 SetOutPath "$INSTDIR\share\locale"
188 File /r
"${RESOURCEDIR}\share\locale\*"
190 SetOutPath "$INSTDIR\share\locale"
191 File /r
"gtk\share\locale\*"
195 Section "Documentation" SEC04
198 SetOutPath "$INSTDIR\share\doc"
199 File /r
"${RESOURCEDIR}\share\doc\*"
200 WriteIniStr
"$INSTDIR\Documentation.url" "InternetShortcut" "URL" "$INSTDIR\share\doc\geany\html\index.html"
201 !insertmacro MUI_STARTMENU_WRITE_BEGIN
${PRODUCT_NAME}
202 CreateShortCut "$SMPROGRAMS\$StartmenuFolder\Documentation.lnk" "$INSTDIR\Documentation.url"
203 !insertmacro MUI_STARTMENU_WRITE_END
206 Section "Autocompletion Tags" SEC05
208 SetOutPath "$INSTDIR\data"
210 File "${RESOURCEDIR}\data\php.tags"
211 File "${RESOURCEDIR}\data\pascal.tags"
212 File "${RESOURCEDIR}\data\python.tags"
213 File "${RESOURCEDIR}\data\html_entities.tags"
214 File "${RESOURCEDIR}\data\c99.tags"
217 ; Include GTK runtime library but only if desired from command line
219 Section "GTK ${GTK_VERSION} Runtime Environment" SEC06
222 SetOutPath "$INSTDIR\bin"
224 SetOutPath "$INSTDIR\etc"
226 SetOutPath "$INSTDIR\lib"
228 SetOutPath "$INSTDIR\share\themes"
229 File /r
"gtk\share\themes\*"
230 !if ${GTK_VERSION} >=
3
231 SetOutPath "$INSTDIR\share\icons"
232 File /r
"gtk\share\icons\*"
233 SetOutPath "$INSTDIR\share\glib-2.0"
234 File /r
"gtk\share\glib-2.0\*"
235 SetOutPath "$INSTDIR\share\gtk-3.0"
236 File /r
"gtk\share\gtk-3.0\*"
241 Section "Context Menus" SEC07
243 WriteRegStr HKCR "*\shell\OpenWithGeany" "" "Open with Geany"
244 WriteRegStr HKCR "*\shell\OpenWithGeany" "Icon" "$INSTDIR\bin\geany.exe"
245 WriteRegStr HKCR "*\shell\OpenWithGeany\command" "" '"$INSTDIR\bin\geany.exe" "%1"'
248 Section "Desktop Shortcuts" SEC08
250 CreateShortCut "$DESKTOP\Geany.lnk" "$INSTDIR\bin\Geany.exe"
251 CreateShortCut "$QUICKLAUNCH\Geany.lnk" "$INSTDIR\bin\Geany.exe"
255 Section "Development files" SEC09
257 SetOutPath "$INSTDIR\include"
258 File /r
"${RESOURCEDIR}\include\*"
260 SetOutPath "$INSTDIR\lib\pkgconfig"
261 File "${RESOURCEDIR}\lib\pkgconfig\geany.pc"
264 Section -AdditionalIcons
266 !insertmacro MUI_STARTMENU_WRITE_BEGIN
${PRODUCT_NAME}
267 WriteIniStr
"$INSTDIR\Website.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
268 CreateShortCut "$SMPROGRAMS\$StartmenuFolder\Website.lnk" "$INSTDIR\Website.url"
269 CreateShortCut "$SMPROGRAMS\$StartmenuFolder\Uninstall.lnk" "$INSTDIR\uninst.exe"
270 !insertmacro MUI_STARTMENU_WRITE_END
274 WriteUninstaller "$INSTDIR\uninst.exe"
275 WriteRegStr SHCTX
"${PRODUCT_DIR_REGKEY}" Path
"$INSTDIR"
276 WriteRegStr SHCTX
"${PRODUCT_UNINST_KEY}" "StartMenu" "$SMPROGRAMS\$StartmenuFolder"
277 ${if} $Answer ==
"yes" ; if user is admin
278 WriteRegStr SHCTX
"${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
279 WriteRegStr SHCTX
"${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
280 WriteRegStr SHCTX
"${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\bin\Geany.exe"
281 WriteRegStr SHCTX
"${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
282 WriteRegStr SHCTX
"${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
283 WriteRegStr SHCTX
"${PRODUCT_UNINST_KEY}" "URLUpdateInfo" "${PRODUCT_WEB_SITE}"
284 WriteRegStr SHCTX
"${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
285 WriteRegDWORD SHCTX
"${PRODUCT_UNINST_KEY}" "NoModify" 0x00000001
286 WriteRegDWORD SHCTX
"${PRODUCT_UNINST_KEY}" "NoRepair" 0x00000001
291 Delete "$INSTDIR\Website.url"
292 Delete "$INSTDIR\Documentation.url"
293 Delete "$INSTDIR\uninst.exe"
294 Delete "$INSTDIR\News.txt"
295 Delete "$INSTDIR\ReadMe.txt"
296 Delete "$INSTDIR\Thanks.txt"
297 Delete "$INSTDIR\ToDo.txt"
298 Delete "$INSTDIR\Authors.txt"
299 Delete "$INSTDIR\ChangeLog.txt"
300 Delete "$INSTDIR\Copying.txt"
301 Delete "$INSTDIR\Geany.lnk"
303 ; delete start menu entry
304 ReadRegStr $0 SHCTX
"${PRODUCT_UNINST_KEY}" "StartMenu"
307 Delete "$QUICKLAUNCH\Geany.lnk"
308 Delete "$DESKTOP\Geany.lnk"
310 RMDir /r
"$INSTDIR\bin"
311 RMDir /r
"$INSTDIR\data"
312 RMDir /r
"$INSTDIR\etc"
313 RMDir /r
"$INSTDIR\include"
314 RMDir /r
"$INSTDIR\lib"
315 RMDir /r
"$INSTDIR\share"
318 ; remove .geany file extension
319 ReadRegStr $R0 SHCTX
"Software\Classes\${PRODUCT_EXT}" ""
320 ${if} $R0 ==
"${PRODUCT_REGNAME}"
321 DeleteRegKey SHCTX
"${PRODUCT_EXT}"
322 DeleteRegKey HKCR "${PRODUCT_EXT}"
323 DeleteRegKey SHCTX
"${PRODUCT_REGNAME}"
324 DeleteRegKey HKCR "${PRODUCT_REGNAME}"
327 DeleteRegKey HKCR "*\shell\OpenWithGeany"
329 DeleteRegKey SHCTX
"${PRODUCT_UNINST_KEY}"
330 DeleteRegKey HKCU "${PRODUCT_UNINST_KEY}"
331 DeleteRegKey SHCTX
"${PRODUCT_DIR_REGKEY}"
332 DeleteRegKey HKCU "${PRODUCT_DIR_REGKEY}"
337 ;;;;;;;;;;;;;;;;;;;;;;;;;
338 ; Section descriptions ;
339 ;;;;;;;;;;;;;;;;;;;;;;;;;
340 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
341 !insertmacro MUI_DESCRIPTION_TEXT
${SEC01} "Required program files. You cannot skip these files."
342 !insertmacro MUI_DESCRIPTION_TEXT
${SEC02} "Available plugins like 'Version Diff', 'Class Builder' and 'Insert Special Characters'."
343 !insertmacro MUI_DESCRIPTION_TEXT
${SEC03} "Various translations of Geany's interface."
344 !insertmacro MUI_DESCRIPTION_TEXT
${SEC04} "Manual in Text and HTML format."
345 !insertmacro MUI_DESCRIPTION_TEXT
${SEC05} "Symbol lists necessary for auto completion of symbols."
347 !insertmacro MUI_DESCRIPTION_TEXT
${SEC06} "You need these files to run Geany. If you have already installed a GTK Runtime Environment (${GTK_VERSION} or higher), you can skip it."
349 !insertmacro MUI_DESCRIPTION_TEXT
${SEC07} "Add context menu item 'Open With Geany'"
350 !insertmacro MUI_DESCRIPTION_TEXT
${SEC08} "Create shortcuts for Geany on the desktop and in the Quicklaunch Bar"
351 !insertmacro MUI_DESCRIPTION_TEXT
${SEC09} "You need these files only if you want to develop own plugins for Geany. If unsure, you can skip it."
352 !insertmacro MUI_FUNCTION_DESCRIPTION_END
354 ;;;;;;;;;;;;;;;;;;;;;
356 ;;;;;;;;;;;;;;;;;;;;;
358 ; (from http://jabref.svn.sourceforge.net/viewvc/jabref/trunk/jabref/src/windows/nsis/setup.nsi)
359 !macro IsUserAdmin Result UName
365 UserInfo::GetAccountType
368 StrCpy ${Result} "yes"
370 StrCpy ${Result} "no"
375 StrCpy ${Result} "yes"
380 StrCpy "$StartmenuFolder" "Geany"
382 ; (from http://jabref.svn.sourceforge.net/viewvc/jabref/trunk/jabref/src/windows/nsis/setup.nsi)
383 ; If the user does *not* have administrator privileges, abort
386 !insertmacro IsUserAdmin
$Answer $UserName ; macro from LyXUtils.nsh
387 ${if} $Answer ==
"yes"
388 SetShellVarContext all
; set that e.g. shortcuts will be created for all users
390 SetShellVarContext current
391 ; TODO is this really what we want? $PROGRAMFILES is not much better because
392 ; probably the unprivileged user can't write it anyways
393 StrCpy $INSTDIR "$PROFILE\$(^Name)"
396 ; prevent running multiple instances of the installer
397 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "geany_installer") i .r1 ?e'
400 MessageBox MB_OK|
MB_ICONEXCLAMATION "The installer is already running." /SD
IDOK
402 ; warn about a new install over an existing installation
403 ReadRegStr $R0 SHCTX
"${PRODUCT_UNINST_KEY}" "UninstallString"
406 MessageBox MB_YESNO|
MB_ICONEXCLAMATION \
407 "Geany has already been installed. $\nDo you want to remove the previous version before installing $(^Name) ?" \
408 /SD
IDYES IDYES remove
IDNO finish
411 ; run the uninstaller
413 ; we read the installation path of the old installation from the Registry
414 ReadRegStr $UNINSTDIR SHCTX
"${PRODUCT_DIR_REGKEY}" "Path"
415 IfSilent dosilent nonsilent
417 ExecWait '$R0 /S _?=$UNINSTDIR' ;Do not copy the uninstaller to a temp file
420 ExecWait '$R0 _?=$UNINSTDIR' ;Do not copy the uninstaller to a temp file
424 Function un
.onUninstSuccess
426 MessageBox MB_ICONINFORMATION|
MB_OK "$(^Name) was successfully removed from your computer." \
431 ; If the user does *not* have administrator privileges, abort
433 !insertmacro IsUserAdmin
$Answer $UserName
434 ${if} $Answer ==
"yes"
435 SetShellVarContext all
437 ; check if the Geany has been installed with admin permisions
438 ReadRegStr $0 HKLM "${PRODUCT_UNINST_KEY}" "Publisher"
440 MessageBox MB_OK|
MB_ICONSTOP "You need administrator privileges to uninstall Geany!" \
444 SetShellVarContext current
447 MessageBox MB_ICONQUESTION|
MB_YESNO|MB_DEFBUTTON2
"Are you sure you want to completely remove $(^Name) and all of its components?" \
454 SetOutPath "$INSTDIR" ; what about IfError creating $INSTDIR?
455 GetTempFileName $1 "$INSTDIR" ; creates tmp file (or fails)
456 FileOpen $0 "$1" "w" ; error to open?
458 IfErrors notPossible possible
461 RMDir "$INSTDIR" ; removes folder if empty
462 MessageBox MB_OK "The given directory is not writeable. Please choose another one!" /SD
IDOK