GTK: Get border for the exact current style's state on GTK 3
[geany-mirror.git] / geany.nsi.in
blob7043039e6bc3209fff7d3bfa3f48d0ee421445c5
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
28 CRCCheck force
29 RequestExecutionLevel highest ; set execution level for Windows Vista
31 ;;;;;;;;;;;;;;;;;;;
32 ; helper defines ;
33 ;;;;;;;;;;;;;;;;;;;
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@
47 ;;;;;;;;;;;;;;;;;;;;;
48 ; Version resource ;
49 ;;;;;;;;;;;;;;;;;;;;;
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
61 ShowInstDetails hide
62 ShowUnInstDetails hide
63 XPStyle on
64 !ifdef INCLUDE_GTK
65 OutFile "geany-${PRODUCT_VERSION}_setup.exe"
66 !else
67 OutFile "geany-${PRODUCT_VERSION}_nogtk_setup.exe"
68 !endif
70 Var Answer
71 Var UserName
72 Var StartmenuFolder
73 Var UNINSTDIR
75 ;;;;;;;;;;;;;;;;
76 ; MUI Settings ;
77 ;;;;;;;;;;;;;;;;
78 !include "MUI2.nsh"
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"
90 ; Welcome page
91 !insertmacro MUI_PAGE_WELCOME
92 ; License page
93 ;!define MUI_LICENSEPAGE_RADIOBUTTONS
94 !insertmacro MUI_PAGE_LICENSE "${RESOURCEDIR}\Copying.txt"
95 ; Components page
96 !insertmacro MUI_PAGE_COMPONENTS
97 ; Directory page
98 !define MUI_PAGE_CUSTOMFUNCTION_LEAVE OnDirLeave
99 !insertmacro MUI_PAGE_DIRECTORY
100 ; Start menu page
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"
106 ; Instfiles page
107 !insertmacro MUI_PAGE_INSTFILES
108 ; Finish page
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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;
122 InstType "Full"
123 InstType "Minimal"
125 Section "!Program Files" SEC01
126 SectionIn RO 1 2
127 SetOverwrite ifnewer
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\filetype_extensions.conf"
139 File "${RESOURCEDIR}\data\geany.glade"
140 !if ${GTK_VERSION} >= 3
141 File "${RESOURCEDIR}\data\geany.css"
142 !else
143 File "${RESOURCEDIR}\data\geany.gtkrc"
144 !endif
145 File "${RESOURCEDIR}\data\snippets.conf"
146 File "${RESOURCEDIR}\data\ui_toolbar.xml"
148 SetOutPath "$INSTDIR\data\filedefs"
149 File /r "${RESOURCEDIR}\data\filedefs\*"
151 SetOutPath "$INSTDIR\data\templates"
152 File /r "${RESOURCEDIR}\data\templates\*"
154 SetOutPath "$INSTDIR\data\colorschemes"
155 File /r "${RESOURCEDIR}\data\colorschemes\*"
156 # Geany color schemes project, don't bail out if they are missing
157 File /nonfatal /r "..\geany-themes\colorschemes\*.conf"
159 SetOutPath "$INSTDIR\share\icons"
160 File /r "${RESOURCEDIR}\share\icons\*"
162 SetOutPath "$INSTDIR"
164 CreateShortCut "$INSTDIR\Geany.lnk" "$INSTDIR\bin\Geany.exe"
165 !insertmacro MUI_STARTMENU_WRITE_BEGIN ${PRODUCT_NAME}
166 CreateDirectory "$SMPROGRAMS\$StartmenuFolder"
167 CreateShortCut "$SMPROGRAMS\$StartmenuFolder\Geany.lnk" "$INSTDIR\bin\Geany.exe"
168 !insertmacro MUI_STARTMENU_WRITE_END
170 ; register the extension .geany
171 ; write information about file type
172 WriteRegStr SHCTX "Software\Classes\${PRODUCT_REGNAME}" "" "${PRODUCT_NAME} Project File"
173 WriteRegStr SHCTX "Software\Classes\${PRODUCT_REGNAME}\DefaultIcon" "" "${PRODUCT_EXE},0"
174 WriteRegStr SHCTX "Software\Classes\${PRODUCT_REGNAME}\Shell\open\command" "" '"${PRODUCT_EXE}" "%1"'
175 ; write information about file extensions
176 WriteRegStr SHCTX "Software\Classes\${PRODUCT_EXT}" "" "${PRODUCT_REGNAME}"
177 ; refresh shell
178 System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) (0x08000000, 0, 0, 0)'
179 SectionEnd
181 Section "Plugins" SEC02
182 SectionIn 1
183 SetOverwrite ifnewer
184 SetOutPath "$INSTDIR\lib\geany"
185 File "${RESOURCEDIR}\lib\geany\*.dll"
186 SectionEnd
188 Section "Language Files" SEC03
189 SectionIn 1
190 SetOutPath "$INSTDIR\share\locale"
191 File /r "${RESOURCEDIR}\share\locale\*"
192 !ifdef INCLUDE_GTK
193 SetOutPath "$INSTDIR\share\locale"
194 File /r "gtk\share\locale\*"
195 !endif
196 SectionEnd
198 Section "Documentation" SEC04
199 SectionIn 1
200 SetOverwrite ifnewer
201 SetOutPath "$INSTDIR\share\doc"
202 File /r "${RESOURCEDIR}\share\doc\*"
203 WriteIniStr "$INSTDIR\Documentation.url" "InternetShortcut" "URL" "$INSTDIR\share\doc\geany\html\index.html"
204 !insertmacro MUI_STARTMENU_WRITE_BEGIN ${PRODUCT_NAME}
205 CreateShortCut "$SMPROGRAMS\$StartmenuFolder\Documentation.lnk" "$INSTDIR\Documentation.url"
206 !insertmacro MUI_STARTMENU_WRITE_END
207 SectionEnd
209 Section "Autocompletion Tags" SEC05
210 SectionIn 1
211 SetOverwrite ifnewer
212 SetOutPath "$INSTDIR\data\tags"
213 File /r "${RESOURCEDIR}\data\tags\*"
214 SectionEnd
216 ; Include GTK runtime library but only if desired from command line
217 !ifdef INCLUDE_GTK
218 Section "GTK ${GTK_VERSION} Runtime Environment" SEC06
219 SectionIn 1
220 SetOverwrite ifnewer
221 SetOutPath "$INSTDIR"
222 File "gtk\ReadMe.Dependencies.Geany.txt"
223 SetOutPath "$INSTDIR\bin"
224 File /r "gtk\bin\*"
225 SetOutPath "$INSTDIR\etc"
226 File /r "gtk\etc\*"
227 SetOutPath "$INSTDIR\lib"
228 File /r "gtk\lib\*"
229 SetOutPath "$INSTDIR\share"
230 File /r "gtk\share\*"
231 SectionEnd
232 !endif
234 Section "Context Menus" SEC07
235 SectionIn 1
236 WriteRegStr HKCR "*\shell\OpenWithGeany" "" "Open with Geany"
237 WriteRegStr HKCR "*\shell\OpenWithGeany" "Icon" "$INSTDIR\bin\geany.exe"
238 WriteRegStr HKCR "*\shell\OpenWithGeany\command" "" '"$INSTDIR\bin\geany.exe" "%1"'
239 SectionEnd
241 Section "Desktop Shortcuts" SEC08
242 SectionIn 1
243 CreateShortCut "$DESKTOP\Geany.lnk" "$INSTDIR\bin\Geany.exe"
244 CreateShortCut "$QUICKLAUNCH\Geany.lnk" "$INSTDIR\bin\Geany.exe"
245 SectionEnd
247 ; Development files
248 Section "Development files" SEC09
249 SetOverwrite ifnewer
250 SetOutPath "$INSTDIR\include"
251 File /r "${RESOURCEDIR}\include\*"
253 SetOutPath "$INSTDIR\lib\pkgconfig"
254 File "${RESOURCEDIR}\lib\pkgconfig\geany.pc"
255 SectionEnd
257 Section -AdditionalIcons
258 SetOutPath $INSTDIR
259 !insertmacro MUI_STARTMENU_WRITE_BEGIN ${PRODUCT_NAME}
260 WriteIniStr "$INSTDIR\Website.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
261 CreateShortCut "$SMPROGRAMS\$StartmenuFolder\Website.lnk" "$INSTDIR\Website.url"
262 CreateShortCut "$SMPROGRAMS\$StartmenuFolder\Uninstall.lnk" "$INSTDIR\uninst.exe"
263 !insertmacro MUI_STARTMENU_WRITE_END
264 SectionEnd
266 Section -Post
267 WriteUninstaller "$INSTDIR\uninst.exe"
268 WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" Path "$INSTDIR"
269 WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "StartMenu" "$SMPROGRAMS\$StartmenuFolder"
270 ${if} $Answer == "yes" ; if user is admin
271 WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
272 WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
273 WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\bin\Geany.exe"
274 WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
275 WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
276 WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "URLUpdateInfo" "${PRODUCT_WEB_SITE}"
277 WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
278 WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoModify" 0x00000001
279 WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoRepair" 0x00000001
280 ${endif}
281 SectionEnd
283 Section Uninstall
284 Delete "$INSTDIR\Website.url"
285 Delete "$INSTDIR\Documentation.url"
286 Delete "$INSTDIR\uninst.exe"
287 Delete "$INSTDIR\News.txt"
288 Delete "$INSTDIR\ReadMe.txt"
289 Delete "$INSTDIR\ReadMe.Dependencies.Geany.txt"
290 Delete "$INSTDIR\Thanks.txt"
291 Delete "$INSTDIR\ToDo.txt"
292 Delete "$INSTDIR\Authors.txt"
293 Delete "$INSTDIR\ChangeLog.txt"
294 Delete "$INSTDIR\Copying.txt"
295 Delete "$INSTDIR\Geany.lnk"
297 ; delete start menu entry
298 ReadRegStr $0 SHCTX "${PRODUCT_UNINST_KEY}" "StartMenu"
299 RMDir /r "$0"
301 Delete "$QUICKLAUNCH\Geany.lnk"
302 Delete "$DESKTOP\Geany.lnk"
304 RMDir /r "$INSTDIR\bin"
305 RMDir /r "$INSTDIR\data"
306 RMDir /r "$INSTDIR\etc"
307 RMDir /r "$INSTDIR\include"
308 RMDir /r "$INSTDIR\lib"
309 RMDir /r "$INSTDIR\share"
310 RMDir "$INSTDIR"
312 ; remove .geany file extension
313 ReadRegStr $R0 SHCTX "Software\Classes\${PRODUCT_EXT}" ""
314 ${if} $R0 == "${PRODUCT_REGNAME}"
315 DeleteRegKey SHCTX "${PRODUCT_EXT}"
316 DeleteRegKey HKCR "${PRODUCT_EXT}"
317 DeleteRegKey SHCTX "${PRODUCT_REGNAME}"
318 DeleteRegKey HKCR "${PRODUCT_REGNAME}"
319 ${endif}
321 DeleteRegKey HKCR "*\shell\OpenWithGeany"
323 DeleteRegKey SHCTX "${PRODUCT_UNINST_KEY}"
324 DeleteRegKey HKCU "${PRODUCT_UNINST_KEY}"
325 DeleteRegKey SHCTX "${PRODUCT_DIR_REGKEY}"
326 DeleteRegKey HKCU "${PRODUCT_DIR_REGKEY}"
328 SetAutoClose true
329 SectionEnd
331 ;;;;;;;;;;;;;;;;;;;;;;;;;
332 ; Section descriptions ;
333 ;;;;;;;;;;;;;;;;;;;;;;;;;
334 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
335 !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} "Required program files. You cannot skip these files."
336 !insertmacro MUI_DESCRIPTION_TEXT ${SEC02} "Available plugins like 'Version Diff', 'Class Builder' and 'Insert Special Characters'."
337 !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} "Various translations of Geany's interface."
338 !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} "Manual in Text and HTML format."
339 !insertmacro MUI_DESCRIPTION_TEXT ${SEC05} "Symbol lists necessary for auto completion of symbols."
340 !ifdef INCLUDE_GTK
341 !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."
342 !endif
343 !insertmacro MUI_DESCRIPTION_TEXT ${SEC07} "Add context menu item 'Open With Geany'"
344 !insertmacro MUI_DESCRIPTION_TEXT ${SEC08} "Create shortcuts for Geany on the desktop and in the Quicklaunch Bar"
345 !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."
346 !insertmacro MUI_FUNCTION_DESCRIPTION_END
348 ;;;;;;;;;;;;;;;;;;;;;
349 ; helper functions ;
350 ;;;;;;;;;;;;;;;;;;;;;
352 ; (from http://jabref.svn.sourceforge.net/viewvc/jabref/trunk/jabref/src/windows/nsis/setup.nsi)
353 !macro IsUserAdmin Result UName
354 ClearErrors
355 UserInfo::GetName
356 IfErrors Win9x
357 Pop $0
358 StrCpy ${UName} $0
359 UserInfo::GetAccountType
360 Pop $1
361 ${if} $1 == "Admin"
362 StrCpy ${Result} "yes"
363 ${else}
364 StrCpy ${Result} "no"
365 ${endif}
366 Goto done
368 Win9x:
369 StrCpy ${Result} "yes"
370 done:
371 !macroend
373 Function .onInit
374 StrCpy "$StartmenuFolder" "Geany"
376 ; (from http://jabref.svn.sourceforge.net/viewvc/jabref/trunk/jabref/src/windows/nsis/setup.nsi)
377 ; If the user does *not* have administrator privileges, abort
378 StrCpy $Answer ""
379 StrCpy $UserName ""
380 !insertmacro IsUserAdmin $Answer $UserName ; macro from LyXUtils.nsh
381 ${if} $Answer == "yes"
382 SetShellVarContext all ; set that e.g. shortcuts will be created for all users
383 ${else}
384 SetShellVarContext current
385 ; TODO is this really what we want? $PROGRAMFILES is not much better because
386 ; probably the unprivileged user can't write it anyways
387 StrCpy $INSTDIR "$PROFILE\$(^Name)"
388 ${endif}
390 ; prevent running multiple instances of the installer
391 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "geany_installer") i .r1 ?e'
392 Pop $R0
393 StrCmp $R0 0 +3
394 MessageBox MB_OK|MB_ICONEXCLAMATION "The installer is already running." /SD IDOK
395 Abort
396 ; warn about a new install over an existing installation
397 ReadRegStr $R0 SHCTX "${PRODUCT_UNINST_KEY}" "UninstallString"
398 StrCmp $R0 "" finish
400 MessageBox MB_YESNO|MB_ICONEXCLAMATION \
401 "Geany has already been installed. $\nDo you want to remove the previous version before installing $(^Name) ?" \
402 /SD IDYES IDYES remove IDNO finish
404 remove:
405 ; run the uninstaller
406 ClearErrors
407 ; we read the installation path of the old installation from the Registry
408 ReadRegStr $UNINSTDIR SHCTX "${PRODUCT_DIR_REGKEY}" "Path"
409 IfSilent dosilent nonsilent
410 dosilent:
411 ExecWait '$R0 /S _?=$UNINSTDIR' ;Do not copy the uninstaller to a temp file
412 Goto finish
413 nonsilent:
414 ExecWait '$R0 _?=$UNINSTDIR' ;Do not copy the uninstaller to a temp file
415 finish:
416 FunctionEnd
418 Function un.onUninstSuccess
419 HideWindow
420 MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer." \
421 /SD IDOK
422 FunctionEnd
424 Function un.onInit
425 ; If the user does *not* have administrator privileges, abort
426 StrCpy $Answer ""
427 !insertmacro IsUserAdmin $Answer $UserName
428 ${if} $Answer == "yes"
429 SetShellVarContext all
430 ${else}
431 ; check if the Geany has been installed with admin permisions
432 ReadRegStr $0 HKLM "${PRODUCT_UNINST_KEY}" "Publisher"
433 ${if} $0 != ""
434 MessageBox MB_OK|MB_ICONSTOP "You need administrator privileges to uninstall Geany!" \
435 /SD IDOK
436 Abort
437 ${endif}
438 SetShellVarContext current
439 ${endif}
441 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" \
442 /SD IDYES IDYES +2
443 Abort
444 FunctionEnd
446 Function OnDirLeave
447 ClearErrors
448 SetOutPath "$INSTDIR" ; what about IfError creating $INSTDIR?
449 GetTempFileName $1 "$INSTDIR" ; creates tmp file (or fails)
450 FileOpen $0 "$1" "w" ; error to open?
451 FileWriteByte $0 "0"
452 IfErrors notPossible possible
454 notPossible:
455 RMDir "$INSTDIR" ; removes folder if empty
456 MessageBox MB_OK "The given directory is not writeable. Please choose another one!" /SD IDOK
457 Abort
458 possible:
459 FileClose $0
460 Delete "$1"
461 FunctionEnd