comparison package-files/windows/win32installer.iss @ 34:d175593317a8

Add a bunch of packaging stuff, NOT WORKING YET,
author David Barts <n5jrn@me.com>
date Wed, 29 Apr 2020 21:49:21 -0700
parents
children
comparison
equal deleted inserted replaced
33:3d86f0391168 34:d175593317a8
1 ; Inno Setup installer script for jEdit
2 ; encoding=UTF-8Y
3 ; (BOM seems the only way to let Inno Setup know the encoding)
4 ;
5 ; Björn "Vampire" Kautler <Vampire@jEdit.org>
6 ;
7
8 [Setup]
9 AllowNoIcons=true
10 AppContact=jedit-devel@lists.sourceforge.net
11 AppCopyright=Copyright © 1998-@current.year@ Contributors
12 AppID=jEdit
13 AppName=jEdit
14 AppPublisher=Contributors
15 AppPublisherURL=http://www.jEdit.org
16 AppReadmeFile={app}\doc\README.txt
17 AppSupportURL=http://www.jEdit.org
18 AppUpdatesURL=http://www.jEdit.org
19 AppVerName=jEdit @jedit.version@
20 AppVersion=@jedit.version@
21 ArchitecturesInstallIn64BitMode=x64
22 ChangesAssociations=true
23 ChangesEnvironment=true
24 DefaultDirName={pf}\jEdit
25 DefaultGroupName=jEdit
26 FlatComponentsList=false
27 ; Do not use LicenseFile here as the GPL does not require acceptance of
28 ; the license for running the program, but still show it as information
29 InfoBeforeFile=@dist.dir.for.innosetup@\doc\COPYING.txt
30 OutputBaseFilename=@win.filename@
31 OutputDir=@dist.dir.for.innosetup@
32 SetupIconFile=@base.dir.for.innosetup@\icons\jedit.ico
33 ShowTasksTreeLines=true
34 SolidCompression=true
35 SourceDir=@dist.dir.for.innosetup@
36 TimeStampsInUTC=true
37 UninstallDisplayIcon={app}\jedit.exe
38 UninstallDisplayName=jEdit @jedit.version@
39 VersionInfoCompany=Contributors
40 VersionInfoCopyright=Copyright © 1998-@current.year@ Contributors
41 VersionInfoDescription=Programmer's Text Editor
42 VersionInfoTextVersion=@jedit.version@
43 VersionInfoVersion=@jedit.build.number@
44 WizardImageFile=@base.dir.for.innosetup@\icons\WindowsInstallerImage.bmp
45 WizardSmallImageFile=@base.dir.for.innosetup@\icons\WindowsInstallerSmallImage.bmp
46
47 [Components]
48 Name: main; Description: jEdit - Programmer's Text Editor; Flags: fixed; Types: custom compact full
49 Name: apidoc; Description: {cm:APIDocumentation}; Types: full
50 Name: macros; Description: {cm:Macros}; Types: compact full
51
52 [Tasks]
53 Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}
54 Name: quicklaunchicon; Description: {cm:CreateQuickLaunchIcon}; GroupDescription: {cm:AdditionalIcons}
55 Name: autostartserver; Description: {cm:AutostartJEditServer}; GroupDescription: Autostart:
56
57 [Files]
58 Source: @jar.filename@; DestDir: {app}; Flags: ignoreversion sortfilesbyextension sortfilesbyname; Components: main
59 Source: jedit.exe; DestDir: {app}; Flags: ignoreversion sortfilesbyextension sortfilesbyname; AfterInstall: updatePATHVariable; Components: main
60 Source: classes\package-files\windows\jEdit.url; DestDir: {app}; Flags: ignoreversion sortfilesbyextension sortfilesbyname; Components: main
61 Source: doc\*; DestDir: {app}\doc; Excludes: \doc\api\*; Flags: ignoreversion recursesubdirs createallsubdirs sortfilesbyextension sortfilesbyname; Components: main
62 Source: doc\api\*; DestDir: {app}\doc\api; Flags: ignoreversion recursesubdirs createallsubdirs sortfilesbyextension sortfilesbyname; Components: apidoc
63 Source: jars\QuickNotepad.jar; DestDir: {app}\jars; Flags: ignoreversion sortfilesbyextension sortfilesbyname; Components: main
64 Source: macros\*; DestDir: {app}\macros; Flags: ignoreversion recursesubdirs createallsubdirs sortfilesbyextension sortfilesbyname; Components: macros
65 Source: keymaps\*; DestDir: {app}\keymaps; Flags: ignoreversion recursesubdirs createallsubdirs sortfilesbyextension sortfilesbyname; Components: main
66 Source: modes\*; DestDir: {app}\modes; Flags: ignoreversion recursesubdirs createallsubdirs sortfilesbyextension sortfilesbyname; Components: main
67 Source: properties\*; DestDir: {app}\properties; Flags: ignoreversion recursesubdirs createallsubdirs sortfilesbyextension sortfilesbyname; Components: main
68 Source: startup\*; DestDir: {app}\startup; Flags: ignoreversion recursesubdirs createallsubdirs sortfilesbyextension sortfilesbyname; Components: main
69
70 [Icons]
71 Name: {group}\jEdit; Filename: {app}\jedit.exe; WorkingDir: {app}; Comment: jEdit - Programmer's Text Editor; HotKey: ctrl+alt+j
72 Name: {group}\{cm:ProgramOnTheWeb,jEdit}; Filename: {app}\jEdit.url; Comment: jEdit Website
73 Name: {group}\{cm:LaunchProgram,jEdit Server}; Filename: {app}\jedit.exe; Parameters: "-background -nogui --l4j-dont-wait"; WorkingDir: {app}; Comment: {cm:LaunchProgram,jEdit Server}
74 Name: {group}\{cm:QuitProgram,jEdit Server}; Filename: {app}\jedit.exe; Parameters: "-quit"; WorkingDir: {app}; Comment: {cm:QuitProgram,jEdit Server}
75 Name: {group}\{cm:UninstallProgram,jEdit}; Filename: {uninstallexe}; Comment: {cm:UninstallProgram,jEdit}
76 Name: {userdesktop}\jEdit; Filename: {app}\jedit.exe; Tasks: desktopicon; WorkingDir: {app}; Comment: jEdit - Programmer's Text Editor
77 Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\jEdit; Filename: {app}\jedit.exe; Tasks: quicklaunchicon; WorkingDir: {app}; Comment: jEdit - Programmer's Text Editor
78
79 [Languages]
80 Name: en; MessagesFile: compiler:Default.isl
81 Name: de; MessagesFile: compiler:Languages\German.isl
82 Name: eu; MessagesFile: compiler:Languages\Basque.isl
83 Name: pt_BR; MessagesFile: compiler:Languages\BrazilianPortuguese.isl
84 Name: ca; MessagesFile: compiler:Languages\Catalan.isl
85 Name: cs; MessagesFile: compiler:Languages\Czech.isl
86 Name: da; MessagesFile: compiler:Languages\Danish.isl
87 Name: nl; MessagesFile: compiler:Languages\Dutch.isl
88 Name: fi; MessagesFile: compiler:Languages\Finnish.isl
89 Name: fr; MessagesFile: compiler:Languages\French.isl
90 Name: he; MessagesFile: compiler:Languages\Hebrew.isl
91 Name: hu; MessagesFile: compiler:Languages\Hungarian.isl
92 Name: it; MessagesFile: compiler:Languages\Italian.isl
93 Name: ja; MessagesFile: compiler:Languages\Japanese.isl
94 Name: no; MessagesFile: compiler:Languages\Norwegian.isl
95 Name: pl; MessagesFile: compiler:Languages\Polish.isl
96 Name: pt; MessagesFile: compiler:Languages\Portuguese.isl
97 Name: ru; MessagesFile: compiler:Languages\Russian.isl
98 Name: sk; MessagesFile: compiler:Languages\Slovak.isl
99 Name: sl; MessagesFile: compiler:Languages\Slovenian.isl
100 Name: es; MessagesFile: compiler:Languages\Spanish.isl
101
102 [CustomMessages]
103 ; Default messages
104 APIDocumentation=API Documentation (for macro and plugin development)
105 Macros=Default set of macros (highly recommended)
106 AutostartJEditServer=Start jEdit Server automatically on system startup
107 QuitProgram=Quit %1
108 OpenWithProgram=Open with %1
109 pleaseQuitJEdit=The installer will now try to quit a running instance of jEdit.%nPlease save your work and exit jEdit for the installation to continue.
110 ViewFile=View %1
111 ; German messages
112 de.APIDocumentation=API Dokumentation (für Macro und Plugin Entwicklung)
113 de.Macros=Standard Makros (sehr empfohlen)
114 de.AutostartJEditServer=jEdit Server automatisch beim Hochfahren starten
115 de.QuitProgram=%1 beenden
116 de.OpenWithProgram=Mit %1 öffnen
117 de.pleaseQuitJEdit=Die Installation wird nun versuchen eine laufende Instanz von jEdit zu beenden.%nBitte speichern Sie Ihre Arbeit und beenden Sie jEdit um mit der Installation fortzufahren.
118 de.ViewFile=%1 anzeigen
119 ; French messages
120 fr.APIDocumentation=API Documentation (pour développement de Macro et Plugin)
121 fr.Macros=Macros standards (vraiment recommandées)
122 fr.AutostartJEditServer=Démarrer automatiquement le serveur jEdit au démarrage de l'ordinateur
123 fr.QuitProgram=Quitter %1
124 fr.OpenWithProgram=Ouvrir avec %1
125 fr.pleaseQuitJEdit=L'installation va tenter à présent de quitter une instance de jEdit en cours.%nVeuillez enregistrer votre travail et quitter jEdit afin de poursuivre l'installation.
126 fr.ViewFile=Afficher %1
127
128 [Registry]
129 Root: HKCR; Subkey: *\Shell; Flags: uninsdeletekeyifempty
130 Root: HKCR; Subkey: *\Shell\{cm:OpenWithProgram,jEdit}; Flags: uninsdeletekey
131 Root: HKCR; Subkey: *\Shell\{cm:OpenWithProgram,jEdit}\Command; ValueType: string; ValueData: """{app}\jedit.exe"" ""%1"""
132 Root: HKCR; Subkey: *\Shell\{cm:OpenWithProgram,jEdit}; ValueName: Icon; ValueType: string; ValueData: "{app}\jedit.exe"
133 Root: HKLM; Subkey: SOFTWARE\Microsoft\Windows\CurrentVersion\Run; ValueType: string; ValueName: jEdit Server; ValueData: """{app}\jedit.exe"" -background -nogui --l4j-dont-wait"; Flags: uninsdeletevalue; Tasks: autostartserver
134
135 [Run]
136 Filename: {app}\jedit.exe; Description: {cm:ViewFile,README}; Parameters: "--l4j-dont-wait -nosettings ""{app}\doc\README.txt"""; WorkingDir: {app}; Flags: nowait postinstall skipifsilent
137 Filename: {app}\jedit.exe; Description: {cm:ViewFile,CHANGES}; Parameters: "--l4j-dont-wait -nosettings ""{app}\doc\CHANGES.txt"""; WorkingDir: {app}; Flags: nowait postinstall skipifsilent
138 Filename: {app}\jedit.exe; Description: {cm:LaunchProgram,jEdit}; Parameters: "--l4j-dont-wait"; WorkingDir: {app}; Flags: nowait postinstall skipifsilent; Tasks: not autostartserver
139 Filename: {app}\jedit.exe; Description: {cm:LaunchProgram,jEdit}; Parameters: "--l4j-dont-wait -background"; WorkingDir: {app}; Flags: nowait postinstall skipifsilent; Tasks: autostartserver
140
141 [Code]
142 function findPathLine(lines: Array Of String): Integer;
143 var
144 i : Integer;
145 begin
146 for i := 0 to GetArrayLength(lines) - 1 do begin
147 if Uppercase(Copy(Trim(lines[i]),1,5)) = 'PATH=' then begin
148 Result := i;
149 end;
150 end;
151 end;
152
153 function appendAppDirIfNecessary(var path: String): Boolean;
154 var
155 appDir : String;
156 begin
157 appDir := ExpandConstant('{app}');
158 if Pos(Uppercase(appDir),Uppercase(path)) = 0 then begin
159 if Copy(path,Length(path),1) <> ';' then begin
160 path := path + ';';
161 end;
162 path := path + appDir;
163 Result := true;
164 end else begin
165 Result := false;
166 end;
167 end;
168
169 procedure updatePATHVariableInRegistry;
170 var
171 path : String;
172 begin
173 RegQueryStringValue(HKLM,'SYSTEM\CurrentControlSet\Control\Session Manager\Environment','Path',path);
174 if appendAppDirIfNecessary(path) then begin
175 RegWriteStringValue(HKLM,'SYSTEM\CurrentControlSet\Control\Session Manager\Environment','Path',path);
176 end;
177 end;
178
179 procedure updatePATHVariableInAutoexecBat;
180 var
181 lines : Array Of String;
182 pathLine : Integer;
183 path : String;
184 begin
185 LoadStringsFromFile(ExpandConstant('{sd}\AUTOEXEC.BAT'),lines);
186 pathLine := findPathLine(lines);
187 if pathLine = -1 then begin
188 pathLine := GetArrayLength(lines);
189 SetArrayLength(lines,pathLine + 1);
190 lines[pathLine] := 'PATH=';
191 end;
192 path := Trim(lines[pathLine]);
193 if appendAppDirIfNecessary(path) then begin
194 lines[pathLine] := path;
195 SaveStringsToFile(ExpandConstant('{sd}\AUTOEXEC.BAT'),lines,false);
196 end;
197 end;
198
199 procedure updatePATHVariable;
200 begin
201 if UsingWinNT then begin
202 updatePATHVariableInRegistry;
203 end else begin
204 updatePATHVariableInAutoexecBat;
205 end;
206 end;
207
208 function removeAppDirIfNecessary(var path: String): Boolean;
209 var
210 appDir : String;
211 position : Integer;
212 begin
213 appDir := ExpandConstant('{app}');
214 position := Pos(Uppercase(appDir),Uppercase(path));
215 if position = 0 then begin
216 Result := false;
217 end else begin
218 Delete(path,position,Length(appDir));
219 if Copy(path,position,1) = ';' then begin
220 Delete(path,position,1);
221 end;
222 Result := true;
223 end;
224 end;
225
226 procedure cleanPATHVariableInRegistry;
227 var
228 path : String;
229 begin
230 RegQueryStringValue(HKLM,'SYSTEM\CurrentControlSet\Control\Session Manager\Environment','Path',path);
231 if removeAppDirIfNecessary(path) then begin
232 RegWriteStringValue(HKLM,'SYSTEM\CurrentControlSet\Control\Session Manager\Environment','Path',path);
233 end;
234 end;
235
236 procedure cleanPATHVariableInAutoexecBat;
237 var
238 lines : Array Of String;
239 pathLine : Integer;
240 path : String;
241 begin
242 LoadStringsFromFile(ExpandConstant('{sd}\AUTOEXEC.BAT'),lines);
243 pathLine := findPathLine(lines);
244 if pathLine <> -1 then begin
245 path := Trim(lines[pathLine]);
246 if removeAppDirIfNecessary(path) then begin
247 lines[pathLine] := path;
248 SaveStringsToFile(ExpandConstant('{sd}\AUTOEXEC.BAT'),lines,false);
249 end;
250 end;
251 end;
252
253 procedure cleanPATHVariable;
254 begin
255 if UsingWinNT then begin
256 cleanPATHVariableInRegistry;
257 end else begin
258 cleanPATHVariableInAutoexecBat;
259 end;
260 end;
261
262 procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
263 begin
264 if CurUninstallStep = usPostUninstall then begin
265 cleanPATHVariable;
266 end;
267 end;
268
269 procedure quitJEdit;
270 var
271 resultCode : Integer;
272 begin
273 case SuppressibleMsgBox(CustomMessage('pleaseQuitJEdit'),mbConfirmation,MB_OKCANCEL or MB_DEFBUTTON2, IDYES) of
274 IDOK: begin
275 ExtractTemporaryFile('@jar.filename@');
276 ExtractTemporaryFile('jedit.exe');
277 ExecAsOriginalUser(ExpandConstant('{tmp}/jedit.exe'),'-quit',ExpandConstant('{tmp}'),SW_SHOW,ewWaitUntilTerminated,resultCode);
278 end;
279 IDCANCEL: Abort;
280 end;
281 end;
282
283 procedure CurStepChanged(CurStep: TSetupStep);
284 begin
285 if CurStep = ssInstall then begin
286 quitJEdit;
287 end;
288 end;