1 ; xnedit.nsi: Copyright 2021-2022 Valerio Messina GNU GPL v2+
2 ; xnedit.nsi is part of XNEdit multi-purpose text editor:
3 ; https://github.com/unixwork/xnedit a fork of Nedit http://www.nedit.org
4 ; XNEdit is free software: you can redistribute it and/or modify
5 ; it under the terms of the GNU General Public License as published by
6 ; the Free Software Foundation, either version 2 of the License, or
7 ; (at your option) any later version.
8 ;
9 ; XNEdit is distributed in the hope that it will be useful,
10 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 ; GNU General Public License for more details.
13 ;
14 ; You should have received a copy of the GNU General Public License
15 ; along with XNEdit. If not, see <http://www.gnu.org/licenses/>.
16
17 ; xnedit.nsi: setup.exe installer generator for Win32/64 systems
18 ; This configuration file is used by NSIS to generate a Win setup package
19 ; It will install XNEdit into a fixed directory:
20 ; %ProgramFiles%\xnedit when OS and XNEdit has the same bit size
21 ; %ProgramFiles(x86)%\xnedit on 64 bit OS when XNEdit is compiled @32 bit
22 ; It is based on example2.nsi, so it remember the installation directory,
23 ; has uninstall support and (optionally) installs start menu shortcuts.
24 ; International unicode version
25 ; ToDo: let's choose at least the destination drive letter
26 ; unistaller should let choose to keep custom settings in ~\.xnedit\
27 ; V.0.01.00 2022/01/18
28
29 ;--------------------------------
30 ; Compiler Compression options
31 SetCompress force
32 SetCompressor /SOLID lzma
33
34 ; Name shown in the installer and uninstaller
35 Name "XNEdit multi-purpose text editor"
36
37 ; The file to write
38 Unicode True
39 OutFile "XNEditM.m.dwinXX_setup.exe"
40
41 ; The default installation directory
42 InstallDir $PROGRAMFILES64\xnedit
43
44 ; Registry key to check for directory (so if you install again, it will
45 ; overwrite the old one automatically)
46 InstallDirRegKey HKLM "Software\Xnedit" "Install_Dir"
47
48 ; Request application privileges for Windows Vista
49 RequestExecutionLevel admin
50
51 ;--------------------------------
52 ; Pages
53 Page components
54 ;Page directory
55 Page instfiles
56
57 UninstPage uninstConfirm
58 UninstPage instfiles
59
60 ;--------------------------------
61 ; The stuff to install actions
62 Section "Xnedit (required)"
63 SectionIn RO
64
65 ; Set output path to the installation directory.
66 SetOutPath "$INSTDIR"
67
68 ; Put files to install there
69 File fonts.conf
70 File hide.vbs
71 File xnc.sh
72 File xnedit.bat
73 File xnedit.ico
74 File LICENSE
75 File README.md
76 File ReleaseNotes
77 File CHANGELOG
78
79 ; Subdirectories
80 File /r ".xnedit"
81 File /r "cygroot" ; cygwin3.2.0 released Mar 29 2021
82
83 ; SendTo context menu
84 CreateShortCut "$SENDTO\XNEdit.lnk" "$INSTDIR\xnedit.bat" "" "$INSTDIR\xnedit.ico" 0
85
86 ; Write the installation path into the registry
87 WriteRegStr HKLM SOFTWARE\Xnedit "Install_Dir" "$INSTDIR"
88
89 ; Write the uninstall keys for Windows
90 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Xnedit" "DisplayName" "XNEdit"
91 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Xnedit" "UninstallString" '"$INSTDIR\uninstall.exe"'
92 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Xnedit" "NoModify" 1
93 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Xnedit" "NoRepair" 1
94 WriteUninstaller "uninstall.exe"
95 SectionEnd
96
97 ; Optional section (can be disabled by the user)
98 Section "Start Menu Shortcuts"
99 CreateDirectory "$SMPROGRAMS\XNEdit"
100 CreateShortCut "$SMPROGRAMS\XNEdit\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
101 CreateShortCut "$SMPROGRAMS\XNEdit\XNEdit.lnk" "$INSTDIR\xnedit.bat" "" "$INSTDIR\xnedit.ico" 0
102 SectionEnd
103
104 ;--------------------------------
105 ; Uninstaller actions
106 Section "Uninstall"
107 ; Remove files in subdirectories
108 Delete "$INSTDIR\cygroot\bin\*.*"
109 Delete "$INSTDIR\cygroot\tmp\*.*"
110 Delete "$INSTDIR\cygroot\usr\share\fonts\dejavu\*.*"
111 Delete "$INSTDIR\cygroot\usr\share\fonts\*.*"
112 Delete "$INSTDIR\cygroot\usr\share\x11\locale\*.*"
113 Delete "$INSTDIR\cygroot\*.*"
114
115 ; Remove files
116 Delete "$INSTDIR\fonts.conf"
117 Delete "$INSTDIR\hide.vbs"
118 Delete "$INSTDIR\xnc.sh"
119 Delete "$INSTDIR\xnedit.bat"
120 Delete "$INSTDIR\xnedit.ico"
121 Delete "$INSTDIR\LICENSE"
122 Delete "$INSTDIR\README.md"
123 Delete "$INSTDIR\ReleaseNotes"
124 Delete "$INSTDIR\CHANGELOG"
125
126 ; Remove user custom settings
127 Delete "$INSTDIR\.xnedit\autoload.nm" ; comment to keep user configurations
128 Delete "$INSTDIR\.xnedit\cygspecial.nm" ; comment to keep user configurations
129 Delete "$INSTDIR\.xnedit\nedit.rc" ; comment to keep user configurations
130 Delete "$INSTDIR\.xnedit\nedit.history" ; comment to keep user configurations
131
132 ; Remove uninstaller
133 Delete "$INSTDIR\uninstall.exe"
134
135 ; Remove shortcuts in start Menu, if any
136 Delete "$SMPROGRAMS\XNEdit\*.*"
137
138 ; Remove directories used
139 RMDir /r "$INSTDIR\cygroot"
140 RMDir "$INSTDIR\.xnedit"
141 RMDir "$INSTDIR"
142 RMDir "$SMPROGRAMS\Xnedit"
143
144 ; Remove shortcut in SendTo context menu
145 Delete "$SENDTO\XNEdit.lnk"
146
147 ; Remove registry keys
148 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Xnedit"
149 DeleteRegKey HKLM SOFTWARE\Xnedit
150 SectionEnd
151