浏览代码

Download files from http://binary.dmdirc.com/ not http://shanemcc.co.uk/dmdirc-binaries/

Rework Windows installer a bit so that the JRE Downloader has a UAC Manifest (Thus no longer requiring vistas work around for files with "install" in the name)
Add Vista.pas which changes the fonts of the downloader to Vista fonts, and gives Vista native message dialogs
Make the UAC Manifest also have a dependancy on ComCtls v6, Now the buttons and progress bars in the downloader look native (on XP and Vista, previously the looked liek Win9X or so)
Edit some of the messages given in popup boxes.
In theory the Setup.exe will now compile in delphi on windows aswell (altho in practice this is still a PITA)
Add missing license header to launcher.dpr
Windows Launchers also have the ComCtl v6 dependancy, and the vista native dialogs (and the version has been bumped up 1)


git-svn-id: http://svn.dmdirc.com/trunk@4174 00569f92-eb28-0410-84fd-f71c24880f
tags/0.6
Shane Mc Cormack 16 年前
父节点
当前提交
6b559d730d

+ 1
- 1
installer/osx/makeInstallerOSX.sh 查看文件

373
 
373
 
374
 	# Compres it \o
374
 	# Compres it \o
375
 	if [ ! -e "${PWD}/compress-dmg" ]; then
375
 	if [ ! -e "${PWD}/compress-dmg" ]; then
376
-		wget http://shanemcc.co.uk/dmdirc-binaries/dmg -O compress-dmg
376
+		wget http://binary.dmdirc.com/dmg -O compress-dmg
377
 		chmod a+x compress-dmg
377
 		chmod a+x compress-dmg
378
 	fi;
378
 	fi;
379
 	if [ ! -e "${PWD}/compress-dmg" ]; then
379
 	if [ ! -e "${PWD}/compress-dmg" ]; then

+ 24
- 0
installer/windows/Launcher.dpr 查看文件

1
+{*
2
+ * This application launches the dmdirc java-based installer.
3
+ * 
4
+ * DMDirc - Open Source IRC Client
5
+ * Copyright (c) 2006-2008 Chris Smith, Shane Mc Cormack, Gregory Holmes
6
+ * 
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ * 
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ * 
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ *}
1
 program Launcher;
25
 program Launcher;
2
 {$MODE Delphi}
26
 {$MODE Delphi}
3
 {$APPTYPE GUI}
27
 {$APPTYPE GUI}

+ 58
- 21
installer/windows/Setup.dpr 查看文件

23
  * SOFTWARE.
23
  * SOFTWARE.
24
  *}
24
  *}
25
 program Setup;
25
 program Setup;
26
-{$MODE Delphi}
26
+
27
+{$R most.res}
28
+
29
+{$IFDEF FPC}
30
+	{$MODE Delphi}
31
+{$ENDIF}
27
 // Use this instead of {$APPTYPE XXX}
32
 // Use this instead of {$APPTYPE XXX}
28
 // APP_XXX is the same as {$APPTYPE XXX}
33
 // APP_XXX is the same as {$APPTYPE XXX}
29
 // Defaults to console
34
 // Defaults to console
56
 // {$UNDEF LAZARUS}
61
 // {$UNDEF LAZARUS}
57
 
62
 
58
 uses 
63
 uses 
59
-	{$IFDEF LAZARUS}Interfaces, Forms, ComCtrls, Buttons, Messages, Controls, StdCtrls,{$ENDIF}
60
-	Windows, SysUtils, classes, registry, strutils;
64
+	{$IFDEF LAZARUS}Interfaces, Forms, ComCtrls, Buttons, Messages, Controls, StdCtrls, {$ENDIF}
65
+	Vista, Windows, SysUtils, classes, registry, strutils {$IFNDEF FPC},masks{$ENDIF};
61
 
66
 
62
 {$IFDEF LAZARUS}
67
 {$IFDEF LAZARUS}
63
 	type
68
 	type
122
 		CancelButton.Caption := 'Cancel';
127
 		CancelButton.Caption := 'Cancel';
123
 		CancelButton.onClick := self.onButtonClick;
128
 		CancelButton.onClick := self.onButtonClick;
124
 		
129
 		
125
-		self.Caption := pChar('DMDirc Setup - '+CaptionLabel.Caption);;
130
+		self.Caption := pChar('DMDirc Setup');
126
 		Application.Title := self.Caption;
131
 		Application.Title := self.Caption;
132
+		
133
+		SetVistaFonts(self);
127
 	end;
134
 	end;
128
 	
135
 	
129
 	procedure TProgressForm.onButtonClick(Sender: TObject);
136
 	procedure TProgressForm.onButtonClick(Sender: TObject);
135
 	begin
142
 	begin
136
 		ProgressBar.Position := value;
143
 		ProgressBar.Position := value;
137
 		CaptionLabel.Caption := pchar('Downloading JRE - '+inttostr(value)+'%');
144
 		CaptionLabel.Caption := pchar('Downloading JRE - '+inttostr(value)+'%');
138
-		self.Caption := pChar('DMDirc Setup - '+CaptionLabel.Caption);;
145
+		self.Caption := pChar('DMDirc Setup - '+CaptionLabel.Caption);
139
 		Application.Title := self.Caption;
146
 		Application.Title := self.Caption;
140
 	end;
147
 	end;
141
 {$ENDIF}
148
 {$ENDIF}
142
 
149
 
143
 function askQuestion(Question: String): boolean;
150
 function askQuestion(Question: String): boolean;
144
 begin
151
 begin
145
-	Result := MessageBox(0, PChar(Question), 'DMDirc Setup', MB_YESNO or MB_ICONQUESTION) = IDYES;
152
+	Result := TaskDialog(0, 'DMDirc Setup', 'Question', Question, TD_ICON_QUESTION, TD_BUTTON_YES + TD_BUTTON_NO) = mrYes;
146
 end;
153
 end;
147
 
154
 
148
-procedure showError(ErrorMessage: String; addFooter: boolean = true);
155
+procedure showError(ErrorMessage: String; addFooter: boolean = true; includeDescInXP: boolean = true);
149
 begin
156
 begin
150
 	if IsConsole then begin
157
 	if IsConsole then begin
151
 		writeln('');
158
 		writeln('');
161
 			writeln('please feel free to contact us.');
168
 			writeln('please feel free to contact us.');
162
 		end;
169
 		end;
163
 		writeln('-----------------------------------------------------------------------');
170
 		writeln('-----------------------------------------------------------------------');
164
-		readln();
171
+		readln;
165
 	end
172
 	end
166
 	else begin
173
 	else begin
167
 		if addFooter then begin
174
 		if addFooter then begin
168
 			ErrorMessage := ErrorMessage+#13#10;
175
 			ErrorMessage := ErrorMessage+#13#10;
169
 			ErrorMessage := ErrorMessage+#13#10+'If you feel this is incorrect, or you require some further assistance,';
176
 			ErrorMessage := ErrorMessage+#13#10+'If you feel this is incorrect, or you require some further assistance,';
170
-			ErrorMessage := ErrorMessage+#13#10+'please feel free to contact us.';
177
+			if not IsWindowsVista then ErrorMessage := ErrorMessage+#13#10;
178
+			ErrorMessage := ErrorMessage+'please feel free to contact us.';
171
 		end;
179
 		end;
172
 		
180
 		
173
-		MessageBox(0, PChar(ErrorMessage), 'Sorry, setup is unable to continue', MB_OK + MB_ICONSTOP);
181
+		TaskDialog(0, 'DMDirc Setup', 'Sorry, setup is unable to continue.', ErrorMessage, TD_ICON_ERROR, TD_BUTTON_OK, includeDescInXP, false);
174
 	end;
182
 	end;
175
 end;
183
 end;
176
 
184
 
177
-procedure showmessage(message: String);
185
+procedure showmessage(message: String; context:String = 'Information');
178
 begin
186
 begin
179
 	if IsConsole then begin
187
 	if IsConsole then begin
180
 		writeln('');
188
 		writeln('');
181
 		writeln('-----------------------------------------------------------------------');
189
 		writeln('-----------------------------------------------------------------------');
182
-		writeln('Information:!');
190
+		writeln(context+':');
183
 		writeln('-----------------------------------------------------------------------');
191
 		writeln('-----------------------------------------------------------------------');
184
 		writeln(message);
192
 		writeln(message);
185
 		writeln('-----------------------------------------------------------------------');
193
 		writeln('-----------------------------------------------------------------------');
186
-		readln();
194
+		readln;
187
 	end
195
 	end
188
 	else begin
196
 	else begin
189
-		MessageBox(0, PChar(message), 'DMDirc Setup', MB_OK + MB_ICONINFORMATION);
197
+		TaskDialog(0, 'DMDirc Setup', context, message, TD_ICON_INFORMATION, TD_BUTTON_OK);
190
 	end;
198
 	end;
191
 end;
199
 end;
192
 
200
 
234
 var
242
 var
235
 	hand: THandle;
243
 	hand: THandle;
236
 begin
244
 begin
245
+	hand := 0;
237
 	Result := 0;
246
 	Result := 0;
238
 	if FileExists(name) then begin
247
 	if FileExists(name) then begin
239
 		try
248
 		try
241
 			Result := GetFileSize(hand, nil);
250
 			Result := GetFileSize(hand, nil);
242
 		finally
251
 		finally
243
 			try
252
 			try
244
-				CloseHandle(hand);
253
+				if (hand <> 0) then CloseHandle(hand);
245
 			except
254
 			except
246
 				Result := -1;
255
 				Result := -1;
247
 			end;
256
 			end;
249
 	end;
258
 	end;
250
 end;
259
 end;
251
 
260
 
261
+function DoMatch(Input: String; Wildcard: String): boolean;
262
+begin
263
+	{$ifdef FPC}
264
+		Result := IsWild(Input,Wildcard,True);
265
+	{$else}
266
+		Result := MatchesMask(Input,Wildcard);
267
+	{$endif}
268
+end;
269
+
270
+{$IFNDEF VER150}
271
+function AnsiMidStr(Source: String; Start: Integer; Count: Integer): String;
272
+begin
273
+	// Not perfectly accurate, but does the job
274
+	Result := Copy(Source, Start, Count);
275
+end;
276
+{$ENDIF}
277
+
252
 function downloadJRE(message: String = 'Would you like to download the java JRE?'): boolean;
278
 function downloadJRE(message: String = 'Would you like to download the java JRE?'): boolean;
253
 var
279
 var
254
 	ProcessInfo: TProcessInformation;
280
 	ProcessInfo: TProcessInformation;
275
 	match := false;
301
 	match := false;
276
 	while not Eof(f) do begin
302
 	while not Eof(f) do begin
277
 		ReadLn(f, line);
303
 		ReadLn(f, line);
278
-		match := IsWild(line,'Length:*',True);
304
+		match := DoMatch(line,'Length:*');
279
 		if match then break;
305
 		if match then break;
280
 	end;
306
 	end;
281
 	if match then begin
307
 	if match then begin
324
 					{$ENDIF}
350
 					{$ENDIF}
325
 				end
351
 				end
326
 				else Result := processResult = 0;
352
 				else Result := processResult = 0;
327
-				if not Result then showError('JRE Download Failed', false);
353
+				if not Result then begin
354
+					if not terminateDownload then begin
355
+						showError('JRE Download Failed', false);
356
+					end
357
+					else begin
358
+						// If the download was cancelled by the form, this error will already
359
+						// have been given.
360
+						{$IFNDEF LAZARUS}
361
+							showError('JRE Download was aborted', false);
362
+						{$ENDIF}
363
+					end;
364
+				end;
328
 			end;
365
 			end;
329
 		finally
366
 		finally
330
 			bits.free;
367
 			bits.free;
357
 	if canContinue then begin
394
 	if canContinue then begin
358
 		// Final result of this function is the return value of installing java.
395
 		// Final result of this function is the return value of installing java.
359
 		if needDownload or askQuestion(question) then begin
396
 		if needDownload or askQuestion(question) then begin
360
-			showmessage('The Java installer will now run. Please follow the instructions given.'+#13#10+'The DMDirc installation will continue afterwards.');
397
+			showmessage('The Java installer will now run. Please follow the instructions given. '+#13#10+'The DMDirc installation will continue afterwards.');
361
 			Result := (ExecAndWait('jre.exe') = 0);
398
 			Result := (ExecAndWait('jre.exe') = 0);
362
 		end;
399
 		end;
363
 	end
400
 	end
374
 		Application.Initialize;
411
 		Application.Initialize;
375
 		Application.CreateForm(TProgressForm, form);
412
 		Application.CreateForm(TProgressForm, form);
376
 	{$ENDIF}
413
 	{$ENDIF}
377
-		
414
+	
378
 	if IsConsole then begin
415
 	if IsConsole then begin
379
 		writeln('-----------------------------------------------------------------------');
416
 		writeln('-----------------------------------------------------------------------');
380
 		writeln('Welcome to the DMDirc installer.');
417
 		writeln('Welcome to the DMDirc installer.');
398
 		if (ExecAndWait(javaCommand+' -version') <> 0) then begin
435
 		if (ExecAndWait(javaCommand+' -version') <> 0) then begin
399
 			dowriteln('Failed!');
436
 			dowriteln('Failed!');
400
 			if not installJRE(false) then begin
437
 			if not installJRE(false) then begin
401
-				showError('Sorry, DMDirc setup can not continue without java', false);
438
+				showError('DMDirc setup can not continue without java. Please install java and try again', false, false);
402
 				exit;
439
 				exit;
403
 			end;
440
 			end;
404
 		end
441
 		end
426
 		if (ExecAndWait(javaCommand+' -cp DMDirc.jar com.dmdirc.installer.Main '+params) <> 0) then begin
463
 		if (ExecAndWait(javaCommand+' -cp DMDirc.jar com.dmdirc.installer.Main '+params) <> 0) then begin
427
 			dowriteln('Failed!');
464
 			dowriteln('Failed!');
428
 			if not installJRE(true) then begin
465
 			if not installJRE(true) then begin
429
-				showError('Sorry, DMDirc setup can not continue without an updated version of java', false);
466
+				showError('Sorry, DMDirc setup can not continue without an updated version of java.', false, false);
430
 				exit;
467
 				exit;
431
 			end
468
 			end
432
 			else begin
469
 			else begin

+ 7
- 1
installer/windows/UAC.manifest 查看文件

1
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
1
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
 <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> 
2
 <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> 
3
-  <assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="UACAwareApplication" type="win32"/>
3
+  <assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="DMDirc Installer" type="win32"/>
4
+  <description>DMDirc Installer</description>
5
+  <dependency>
6
+    <dependentAssembly>
7
+      <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*"/>
8
+    </dependentAssembly>
9
+  </dependency>
4
   <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
10
   <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
5
     <security>
11
     <security>
6
       <requestedPrivileges>
12
       <requestedPrivileges>

+ 114
- 114
installer/windows/makeInstallerWindows.sh 查看文件

255
 
255
 
256
 echo "	ReleaseNumber: String = '${isRelease}';" > SetupConsts.inc
256
 echo "	ReleaseNumber: String = '${isRelease}';" > SetupConsts.inc
257
 
257
 
258
-FILES="DMDirc.jar Setup.exe";
259
-if [ "" != "${jre}" ]; then
260
-	if [ ! -e "../common/${jrename}.exe" ]; then
261
-		echo "Downloading JRE to include in installer"
262
-		wget ${jre} -O ../common/${jrename}.exe
263
-	fi
264
-	ln -sf ../common/${jrename}.exe jre.exe
265
-	FILES="${FILES} jre.exe"
266
-fi;
267
-DELETEFILES=${FILES}
268
-FPC=`which fpc`
269
-lazarusDir="/usr/share/lazarus"
270
-if [ ! -e "${lazarusDir}/lcl" ]; then
271
-	lazarusDir="/usr/lib/lazarus/"
272
-fi;
273
-compilerFlags="-Sd -Twin32 ${compilerFlags}";
274
-if [ ! -e "Setup.exe"  -o "${compileSetup}" = "true" ]; then
275
-	echo "Setup.exe does not exist. Lets try and compile it."
276
-	if [ "${FPC}" = "" ]; then
277
-		echo "FPC Compiler not found, Setup.exe can not be built."
278
-		exit 1;
279
-	else
280
-		echo "Building Setup.exe..."
281
-		extraFlags=""
282
-		if [ -e "${lazarusDir}/lcl" ]; then
283
-			echo "Using Lazarus"
284
-			mkdir -p ${PWD}/lazarus-build
285
-			extraFlags="-dLAZARUS -FU${PWD}/lazarus-build -Fu${PWD}/lazarus-build -Fu${lazarusDir}/lcl/widgetset/ -Fu${lazarusDir}/lcl/interfaces/win32/ -Fu${lazarusDir}/lcl/ -Fi${lazarusDir}/lcl/include/"
286
-		else
287
-			echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@";
288
-			echo "@        Building installer *WITHOUT* lazarus.        @";
289
-			echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@";
290
-		fi;
291
-		${FPC} ${compilerFlags} ${extraFlags} Setup.dpr
292
-		if [ $? -ne 0 ]; then
293
-			if [ -e "Setup.exe" -a "${useOldSetup}" = "true" ]; then
294
-				echo "Unable to compile Setup.exe, using existing version."
295
-			else
296
-				echo "Unable to compile Setup.exe, terminating."
297
-				exit 1;
298
-			fi
299
-		fi;
300
-	fi
301
-fi
302
-
303
-ls
304
-if [ ! -e "Setup.exe" ]; then
305
-	echo "Still can't find Setup.exe, terminating."
306
-	exit 1;
307
-fi
308
-
309
-echo "Compressing files.."
310
-
311
-#if [ -e "../common/installer.jar" ]; then
312
-#	ln -sf ../common/installer.jar ./installer.jar
313
-#	FILES="${FILES} installer.jar"
314
-#	DELETEFILES="${DELETEFILES} installer.jar"
315
-#else
316
-#	echo "[WARNING] Creating installer-less archive - relying on Setup.exe"
317
-#fi
318
-
258
+FILES=""
259
+# Icon Res file
319
 if [ -e ${jarPath}"/src/com/dmdirc/res/icon.ico" ]; then
260
 if [ -e ${jarPath}"/src/com/dmdirc/res/icon.ico" ]; then
320
 	ln -sf ${jarPath}"/src/com/dmdirc/res/icon.ico" ./icon.ico
261
 	ln -sf ${jarPath}"/src/com/dmdirc/res/icon.ico" ./icon.ico
321
 	FILES="${FILES} icon.ico"
262
 	FILES="${FILES} icon.ico"
322
-	DELETEFILES="${DELETEFILES} icon.ico"
323
-fi
324
-
325
-# Shortcut.exe is from http://www.optimumx.com/download/#Shortcut
326
-if [ ! -e Shortcut.exe ]; then
327
-	wget http://shanemcc.co.uk/dmdirc-binaries/Shortcut.zip
328
-	unzip -q Shortcut.zip Shortcut.exe
329
-	rm Shortcut.zip
330
-fi
331
-FILES="${FILES} Shortcut.exe"
332
-DELETEFILES="${DELETEFILES} Shortcut.exe"
333
-
334
-if [ "${isRelease}" != "" ]; then
335
-	DOCSDIR=${jarPath}
336
-else
337
-	DOCSDIR="../common"
338
 fi
263
 fi
339
-
340
-if [ -e "${DOCSDIR}/README.TXT" ]; then
341
-	ln -sf "${DOCSDIR}/README.TXT" .
342
-	FILES="${FILES} README.TXT"
343
-	DELETEFILES="${DELETEFILES} README.TXT"
344
-fi
345
-
346
-if [ -e "${DOCSDIR}/CHANGES.TXT" ]; then
347
-	ln -sf "${DOCSDIR}/CHANGES.TXT" .
348
-	FILES="${FILES} CHANGES.TXT"
349
-	DELETEFILES="${DELETEFILES} CHANGES.TXT"
350
-elif [ -e "${DOCSDIR}/CHANGELOG.TXT" ]; then
351
-	ln -sf "${DOCSDIR}/CHANGELOG.TXT" .
352
-	FILES="${FILES} CHANGELOG.TXT"
353
-	DELETEFILES="${DELETEFILES} CHANGELOG.TXT"
354
-fi
355
-
356
-if [ -e "${jarPath}/launcher/windows" ]; then
357
-	# Try to compile all
358
-	olddir=${PWD}
359
-	cd "${jarPath}/launcher/windows/"
360
-	sh compile.sh
361
-	cd ${olddir}
362
-	# Now add to file list.
363
-	for thisfile in `ls -1 ${jarPath}/launcher/windows/*.exe`; do
364
-		ln -sf ${thisfile} .
365
-		FILES="${FILES} ${thisfile}"
366
-	done
367
-fi
368
-
369
-# Icon Res file
370
 echo "icon.ico ICON icon.ico" > icon.rc
264
 echo "icon.ico ICON icon.ico" > icon.rc
371
 
265
 
372
 # Other resources
266
 # Other resources
468
 cat icon.rc >> uninstall.rc
362
 cat icon.rc >> uninstall.rc
469
 windres -F pe-i386 -i uninstall.rc -o uninstall.res
363
 windres -F pe-i386 -i uninstall.rc -o uninstall.res
470
 
364
 
365
+cat UAC.rc > all.rc
366
+cat version.rc >> all.rc
367
+cat files.rc >> all.rc
368
+cat icon.rc >> all.rc
369
+# Build later after extractor.exe exists
370
+
371
+cat UAC.rc > most.rc
372
+cat version.rc >> most.rc
373
+cat icon.rc >> most.rc
374
+
375
+windres -F pe-i386 -i most.rc -o most.res
376
+
377
+FILES="${FILES} DMDirc.jar Setup.exe";
378
+if [ "" != "${jre}" ]; then
379
+	if [ ! -e "../common/${jrename}.exe" ]; then
380
+		echo "Downloading JRE to include in installer"
381
+		wget ${jre} -O ../common/${jrename}.exe
382
+	fi
383
+	ln -sf ../common/${jrename}.exe jre.exe
384
+	FILES="${FILES} jre.exe"
385
+fi;
386
+DELETEFILES=${FILES}
387
+FPC=`which fpc`
388
+lazarusDir="/usr/share/lazarus"
389
+if [ ! -e "${lazarusDir}/lcl" ]; then
390
+	lazarusDir="/usr/lib/lazarus/"
391
+fi;
392
+
393
+compilerFlags="-Sd -Twin32 ${compilerFlags}";
394
+if [ ! -e "Setup.exe"  -o "${compileSetup}" = "true" ]; then
395
+	echo "Setup.exe does not exist. Lets try and compile it."
396
+	if [ "${FPC}" = "" ]; then
397
+		echo "FPC Compiler not found, Setup.exe can not be built."
398
+		exit 1;
399
+	else
400
+		echo "Building Setup.exe..."
401
+		extraFlags=""
402
+		if [ -e "${lazarusDir}/lcl" ]; then
403
+			echo "Using Lazarus"
404
+			mkdir -p ${PWD}/lazarus-build
405
+			extraFlags="-dLAZARUS -FU${PWD}/lazarus-build -Fu${PWD}/lazarus-build -Fu${lazarusDir}/lcl/widgetset/ -Fu${lazarusDir}/lcl/interfaces/win32/ -Fu${lazarusDir}/lcl/ -Fi${lazarusDir}/lcl/include/"
406
+		else
407
+			echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@";
408
+			echo "@        Building installer *WITHOUT* lazarus.        @";
409
+			echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@";
410
+		fi;
411
+		${FPC} ${compilerFlags} ${extraFlags} Setup.dpr
412
+		if [ $? -ne 0 ]; then
413
+			if [ -e "Setup.exe" -a "${useOldSetup}" = "true" ]; then
414
+				echo "Unable to compile Setup.exe, using existing version."
415
+			else
416
+				echo "Unable to compile Setup.exe, terminating."
417
+				exit 1;
418
+			fi
419
+		fi;
420
+	fi
421
+fi
422
+
423
+ls
424
+if [ ! -e "Setup.exe" ]; then
425
+	echo "Still can't find Setup.exe, terminating."
426
+	exit 1;
427
+fi
428
+
429
+echo "Compressing files.."
430
+
431
+# Shortcut.exe is from http://www.optimumx.com/download/#Shortcut
432
+if [ ! -e Shortcut.exe ]; then
433
+	wget http://binary.dmdirc.com/Shortcut.zip
434
+	unzip -q Shortcut.zip Shortcut.exe
435
+	rm Shortcut.zip
436
+fi
437
+FILES="${FILES} Shortcut.exe"
438
+DELETEFILES="${DELETEFILES} Shortcut.exe"
439
+
440
+if [ "${isRelease}" != "" ]; then
441
+	DOCSDIR=${jarPath}
442
+else
443
+	DOCSDIR="../common"
444
+fi
445
+
446
+if [ -e "${DOCSDIR}/README.TXT" ]; then
447
+	ln -sf "${DOCSDIR}/README.TXT" .
448
+	FILES="${FILES} README.TXT"
449
+	DELETEFILES="${DELETEFILES} README.TXT"
450
+fi
451
+
452
+if [ -e "${DOCSDIR}/CHANGES.TXT" ]; then
453
+	ln -sf "${DOCSDIR}/CHANGES.TXT" .
454
+	FILES="${FILES} CHANGES.TXT"
455
+	DELETEFILES="${DELETEFILES} CHANGES.TXT"
456
+elif [ -e "${DOCSDIR}/CHANGELOG.TXT" ]; then
457
+	ln -sf "${DOCSDIR}/CHANGELOG.TXT" .
458
+	FILES="${FILES} CHANGELOG.TXT"
459
+	DELETEFILES="${DELETEFILES} CHANGELOG.TXT"
460
+fi
461
+
462
+if [ -e "${jarPath}/launcher/windows" ]; then
463
+	# Try to compile all
464
+	olddir=${PWD}
465
+	cd "${jarPath}/launcher/windows/"
466
+	sh compile.sh
467
+	cd ${olddir}
468
+	# Now add to file list.
469
+	for thisfile in `ls -1 ${jarPath}/launcher/windows/*.exe`; do
470
+		ln -sf ${thisfile} .
471
+		FILES="${FILES} ${thisfile}"
472
+	done
473
+fi
474
+
471
 ${FPC} ${compilerFlags} ${3}Uninstaller.dpr
475
 ${FPC} ${compilerFlags} ${3}Uninstaller.dpr
472
 if [ -e "Uninstaller.exe" ]; then
476
 if [ -e "Uninstaller.exe" ]; then
473
 	FILES="${FILES} Uninstaller.exe"
477
 	FILES="${FILES} Uninstaller.exe"
476
 
480
 
477
 # Add wget to allow downloading jre
481
 # Add wget to allow downloading jre
478
 if [ ! -e "wget.exe" ]; then
482
 if [ ! -e "wget.exe" ]; then
479
-	wget http://shanemcc.co.uk/dmdirc-binaries/wget.exe
483
+	wget http://binary.dmdirc.com/wget.exe
480
 fi;
484
 fi;
481
 
485
 
482
 if [ ! -e "wget.exe" ]; then
486
 if [ ! -e "wget.exe" ]; then
502
 
506
 
503
 if [ ! -e "7zS.sfx" ]; then
507
 if [ ! -e "7zS.sfx" ]; then
504
 	echo "Obtaining sfx stub.."
508
 	echo "Obtaining sfx stub.."
505
-	wget http://shanemcc.co.uk/dmdirc-binaries/7zS.sfx
509
+	wget http://binary.dmdirc.com/7zS.sfx
506
 fi
510
 fi
507
 
511
 
508
 if [ ! -e "7zS.sfx" ]; then
512
 if [ ! -e "7zS.sfx" ]; then
556
 	echo "end;" >> ExtractCode.inc
560
 	echo "end;" >> ExtractCode.inc
557
 fi
561
 fi
558
 
562
 
559
-cat UAC.rc > all.rc
560
-cat version.rc >> all.rc
561
-cat files.rc >> all.rc
562
-cat icon.rc >> all.rc
563
 windres -F pe-i386 -i all.rc -o all.res
563
 windres -F pe-i386 -i all.rc -o all.res
564
 
564
 
565
 ${FPC} ${compilerFlags} ${3}Launcher.dpr
565
 ${FPC} ${compilerFlags} ${3}Launcher.dpr

+ 29
- 6
launcher/windows/DMDirc.dpr 查看文件

2
 {$MODE Delphi}
2
 {$MODE Delphi}
3
 {$APPTYPE GUI}
3
 {$APPTYPE GUI}
4
 
4
 
5
+{$R comctl.rc}
5
 {$R icon.rc}
6
 {$R icon.rc}
6
 {$R version.rc}
7
 {$R version.rc}
7
 
8
 
8
-uses Windows, SysUtils, classes, StrUtils;
9
+uses Windows, SysUtils, classes, StrUtils, Vista;
10
+
11
+function askQuestion(Question: String): boolean;
12
+begin
13
+	Result := TaskDialog(0, 'DMDirc Setup', 'Question', Question, TD_ICON_QUESTION, TD_BUTTON_YES + TD_BUTTON_NO) = mrYes;
14
+end;
15
+
16
+procedure showError(ErrorMessage: String; addFooter: boolean = true);
17
+begin
18
+	if addFooter then begin
19
+		ErrorMessage := ErrorMessage+#13#10;
20
+		ErrorMessage := ErrorMessage+#13#10+'If you feel this is incorrect, or you require some further assistance,';
21
+		ErrorMessage := ErrorMessage+#13#10+'please feel free to contact us.';
22
+	end;
23
+	
24
+	TaskDialog(0, 'DMDirc Setup', 'Sorry, setup is unable to continue', ErrorMessage, TD_ICON_ERROR, TD_BUTTON_OK, true);
25
+end;
26
+
27
+procedure showmessage(message: String; context:String = 'Information');
28
+begin
29
+	TaskDialog(0, 'DMDirc Setup', context, message, TD_ICON_INFORMATION, TD_BUTTON_OK);
30
+end;
31
+
9
 
32
 
10
 // Run an application and wait for it to finish.
33
 // Run an application and wait for it to finish.
11
 function ExecAndWait(sProgramToRun: String): Longword;
34
 function ExecAndWait(sProgramToRun: String): Longword;
52
 end;
75
 end;
53
 
76
 
54
 const
77
 const
55
-	launcherVersion: String = '1';
78
+	launcherVersion: String = '2';
56
 var
79
 var
57
 	errorMessage: String;
80
 	errorMessage: String;
58
 	javaCommand: String = 'javaw.exe';
81
 	javaCommand: String = 'javaw.exe';
96
 				errorMessage := errorMessage+#13#10;
119
 				errorMessage := errorMessage+#13#10;
97
 				errorMessage := errorMessage+#13#10+'Please click ''Allow'' on the UAC prompt to complete the update, or click no';
120
 				errorMessage := errorMessage+#13#10+'Please click ''Allow'' on the UAC prompt to complete the update, or click no';
98
 				errorMessage := errorMessage+#13#10+'here to continue without updating.';
121
 				errorMessage := errorMessage+#13#10+'here to continue without updating.';
99
-				if MessageBox(0, PChar(errorMessage), 'Windows Vista', MB_YESNO) = IDYES then begin
122
+				if askQuestion(errorMessage) then begin
100
 					RunProgram('"'+ExtractFileDir(paramstr(0))+'\DMDircUpdater.exe" --UpdateSourceDir "'+directory+'"', not launcherUpdate);
123
 					RunProgram('"'+ExtractFileDir(paramstr(0))+'\DMDircUpdater.exe" --UpdateSourceDir "'+directory+'"', not launcherUpdate);
101
 				end;
124
 				end;
102
 			end
125
 			end
116
 			errorMessage := errorMessage+#13#10+'If you feel this is incorrect, or you require some further assistance,';
139
 			errorMessage := errorMessage+#13#10+'If you feel this is incorrect, or you require some further assistance,';
117
 			errorMessage := errorMessage+#13#10+'please feel free to contact us.';
140
 			errorMessage := errorMessage+#13#10+'please feel free to contact us.';
118
 			
141
 			
119
-			MessageBox(0, PChar(errorMessage), 'Sorry, DMDirc is unable to continue', MB_OK + MB_ICONSTOP);
142
+			showError(errorMessage);
120
 		end
143
 		end
121
 		// Else try and run client. (This only asks for help output to check that client
144
 		// Else try and run client. (This only asks for help output to check that client
122
 		// runs on this OS, otherwise later segfaults or so would cause the error to
145
 		// runs on this OS, otherwise later segfaults or so would cause the error to
131
 				errorMessage := errorMessage+#13#10+'If you feel this is incorrect, or you require some further assistance,';
154
 				errorMessage := errorMessage+#13#10+'If you feel this is incorrect, or you require some further assistance,';
132
 				errorMessage := errorMessage+#13#10+'please feel free to contact us.';
155
 				errorMessage := errorMessage+#13#10+'please feel free to contact us.';
133
 				
156
 				
134
-				MessageBox(0, PChar(errorMessage), 'Sorry, DMDirc is unable to continue', MB_OK + MB_ICONSTOP);
157
+				showError(errorMessage);
135
 			end
158
 			end
136
 			else begin
159
 			else begin
137
 				Launch(javaCommand+' -ea -jar "'+jarName+'"'+' -l windows-'+launcherVersion+' '+cliParams)
160
 				Launch(javaCommand+' -ea -jar "'+jarName+'"'+' -l windows-'+launcherVersion+' '+cliParams)
139
 		end
162
 		end
140
 		else begin
163
 		else begin
141
 			errorMessage := 'Your DMDirc installation has been broken. DMDirc.jar no longer exists.';
164
 			errorMessage := 'Your DMDirc installation has been broken. DMDirc.jar no longer exists.';
142
-			MessageBox(0, PChar(errorMessage), 'Sorry, DMDirc is unable to continue', MB_OK + MB_ICONSTOP);
165
+			showError(errorMessage);
143
 		end;
166
 		end;
144
 	end;
167
 	end;
145
 end.
168
 end.

二进制
launcher/windows/DMDirc.exe 查看文件


+ 33
- 12
launcher/windows/DMDircUpdater.dpr 查看文件

4
 
4
 
5
 {$R UAC.rc}
5
 {$R UAC.rc}
6
 
6
 
7
-uses Windows, SysUtils, classes, StrUtils;
7
+uses Windows, SysUtils, classes, StrUtils, Vista;
8
+
9
+function askQuestion(Question: String): boolean;
10
+begin
11
+	Result := TaskDialog(0, 'DMDirc Setup', 'Question', Question, TD_ICON_QUESTION, TD_BUTTON_YES + TD_BUTTON_NO) = mrYes;
12
+end;
13
+
14
+procedure showError(ErrorMessage: String; addFooter: boolean = true);
15
+begin
16
+	if addFooter then begin
17
+		ErrorMessage := ErrorMessage+#13#10;
18
+		ErrorMessage := ErrorMessage+#13#10+'If you feel this is incorrect, or you require some further assistance,';
19
+		ErrorMessage := ErrorMessage+#13#10+'please feel free to contact us.';
20
+	end;
21
+	
22
+	TaskDialog(0, 'DMDirc Setup', 'Sorry, setup is unable to continue', ErrorMessage, TD_ICON_ERROR, TD_BUTTON_OK, true);
23
+end;
24
+
25
+procedure showmessage(message: String; context:String = 'Information');
26
+begin
27
+	TaskDialog(0, 'DMDirc Setup', context, message, TD_ICON_INFORMATION, TD_BUTTON_OK);
28
+end;
8
 
29
 
9
 // Run an application and don't wait for it to finish.
30
 // Run an application and don't wait for it to finish.
10
 procedure Launch(sProgramToRun: String);
31
 procedure Launch(sProgramToRun: String);
57
 					Launch('"'+thisDir+'\DMDircLauncherUpdater.exe" '+cliParams);
78
 					Launch('"'+thisDir+'\DMDircLauncherUpdater.exe" '+cliParams);
58
 				end
79
 				end
59
 				else begin
80
 				else begin
60
-					MessageBox(0, 'Unable to overwrite launcher', 'Launcher Update Failed', MB_ICONSTOP);
81
+					showmessage('Unable to overwrite launcher', 'Update Failed');
61
 				end;
82
 				end;
62
 			end
83
 			end
63
 			else begin
84
 			else begin
64
 				launcherUpdate := true;
85
 				launcherUpdate := true;
65
 				if FileExists(pchar(thisDir+'\DMDirc.exe')) then begin
86
 				if FileExists(pchar(thisDir+'\DMDirc.exe')) then begin
66
 					if not DeleteFile(pchar(thisDir+'\DMDirc.exe')) then begin
87
 					if not DeleteFile(pchar(thisDir+'\DMDirc.exe')) then begin
67
-						MessageBox(0, 'Unable to delete DMDirc.exe', 'Update Failed', MB_ICONSTOP);
88
+						showmessage('Unable to delete DMDirc.exe', 'Launcher Update Failed');
68
 					end;
89
 					end;
69
 				end;
90
 				end;
70
 				
91
 				
71
 				if not FileExists(pchar(thisDir+'\DMDirc.exe')) and MoveFile(pchar(sourceDir+'\.DMDirc.exe'), pchar(thisDir+'\DMDirc.exe')) then begin
92
 				if not FileExists(pchar(thisDir+'\DMDirc.exe')) and MoveFile(pchar(sourceDir+'\.DMDirc.exe'), pchar(thisDir+'\DMDirc.exe')) then begin
72
 					if FileExists(pchar(thisDir+'\DMDircUpdater.exe')) then begin
93
 					if FileExists(pchar(thisDir+'\DMDircUpdater.exe')) then begin
73
 						if not DeleteFile(pchar(thisDir+'\DMDircUpdater.exe')) then begin
94
 						if not DeleteFile(pchar(thisDir+'\DMDircUpdater.exe')) then begin
74
-							MessageBox(0, 'Unable to delete DMDircUpdater.exe', 'Update Failed', MB_ICONSTOP);
95
+							showmessage('Unable to delete DMDircUpdater.exe', 'Launcher Update Failed');
75
 						end;
96
 						end;
76
 					end;
97
 					end;
77
 					if not FileExists(pchar(thisDir+'\DMDircUpdater.exe')) and MoveFile(pchar(sourceDir+'\.DMDircUpdater.exe'), pchar(thisDir+'\DMDircUpdater.exe')) then begin
98
 					if not FileExists(pchar(thisDir+'\DMDircUpdater.exe')) and MoveFile(pchar(sourceDir+'\.DMDircUpdater.exe'), pchar(thisDir+'\DMDircUpdater.exe')) then begin
78
-						MessageBox(0, 'Launcher update was successful.', 'Launcher Update Completed', MB_OK);
99
+						showmessage('Launcher update was successful');
79
 					end
100
 					end
80
 					else begin
101
 					else begin
81
-						MessageBox(0, pchar('Unable to update DMDircUpdater.exe'), 'Launcher Update Failed', MB_ICONSTOP);
102
+						showmessage('Unable to update DMDircUpdater.exe', 'Launcher Update Failed');
82
 					end;
103
 					end;
83
 				end
104
 				end
84
 				else begin
105
 				else begin
85
-					MessageBox(0, pchar('Unable to update DMDirc.exe'), 'Launcher Update Failed', MB_ICONSTOP);
106
+					showmessage('Unable to update DMDirc.exe', 'Launcher Update Failed');
86
 				end;
107
 				end;
87
 			end;
108
 			end;
88
 		end;
109
 		end;
92
 			if FileExists(pchar(sourceDir+'\.DMDirc.jar')) then begin
113
 			if FileExists(pchar(sourceDir+'\.DMDirc.jar')) then begin
93
 				if FileExists(pchar(jarName)) then begin
114
 				if FileExists(pchar(jarName)) then begin
94
 					if not DeleteFile(pchar(jarName)) then begin
115
 					if not DeleteFile(pchar(jarName)) then begin
95
-						MessageBox(0, 'Unable to delete DMDirc.jar', 'Update Failed', MB_ICONSTOP);
116
+						showmessage('Unable to update DMDirc.jar', 'Launcher Update Failed');
96
 					end;
117
 					end;
97
 				end;
118
 				end;
98
 				
119
 				
99
 				if MoveFile(pchar(sourceDir+'\.DMDirc.jar'), pchar(jarName)) then begin
120
 				if MoveFile(pchar(sourceDir+'\.DMDirc.jar'), pchar(jarName)) then begin
100
-					MessageBox(0, 'Client update was successful.', 'Update Completed', MB_OK);
121
+					showmessage('Client update was successful');
101
 				end
122
 				end
102
 				else begin
123
 				else begin
103
-					MessageBox(0, pchar('Unable to move '''+sourceDir+'\.DMDirc.jar'' to '+jarName), 'Update Failed', MB_ICONSTOP);
124
+					showmessage('Unable to move '''+sourceDir+'\.DMDirc.jar'' to '+jarName, 'Update Failed');
104
 				end;
125
 				end;
105
 			end;
126
 			end;
106
 			
127
 			
107
 			if launcherUpdate then begin
128
 			if launcherUpdate then begin
108
-				MessageBox(0, 'The DMDirc launcher has been updated, to complete the update please relaunch DMDirc.', 'Restart Required', MB_OK);
129
+				showmessage('The DMDirc launcher has been updated, to complete the update please relaunch DMDirc.', 'Restart Required');
109
 			end;
130
 			end;
110
 		end;
131
 		end;
111
 	end
132
 	end
112
 	else begin
133
 	else begin
113
-		MessageBox(0, 'This program can not be run on its own.', 'Error', MB_ICONSTOP);
134
+		showError('This program can not be run on its own.');
114
 	end;
135
 	end;
115
 end.
136
 end.

二进制
launcher/windows/DMDircUpdater.exe 查看文件


+ 0
- 11
launcher/windows/UAC.manifest 查看文件

1
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
-<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> 
3
-  <assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="UACAwareApplication" type="win32"/>
4
-  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
5
-    <security>
6
-      <requestedPrivileges>
7
-        <requestedExecutionLevel level="requireAdministrator"/>
8
-      </requestedPrivileges>
9
-    </security>
10
-  </trustInfo>
11
-</assembly>

+ 0
- 1
launcher/windows/UAC.rc 查看文件

1
-1 24 "UAC.manifest"

+ 10
- 0
launcher/windows/comctl.manifest 查看文件

1
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> 
3
+  <assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="DMDirc Updater" type="win32"/>
4
+  <description>DMDirc Updater</description>
5
+  <dependency>
6
+    <dependentAssembly>
7
+      <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*"/>
8
+    </dependentAssembly>
9
+  </dependency>
10
+</assembly>

+ 1
- 0
launcher/windows/comctl.rc 查看文件

1
+1 24 "comctl.manifest"

+ 4
- 1
launcher/windows/compile.sh 查看文件

1
 #!/bin/sh
1
 #!/bin/sh
2
+rm Vista.pas UAC.manifest UAC.rc
3
+cp ../../installer/windows/Vista.pas ../../installer/windows/UAC.manifest  ../../installer/windows/UAC.rc .
4
+
2
 rm -Rf ./*.exe
5
 rm -Rf ./*.exe
3
 fpc -Sd -Twin32 DMDirc.dpr
6
 fpc -Sd -Twin32 DMDirc.dpr
4
 fpc -Sd -Twin32 DMDircUpdater.dpr
7
 fpc -Sd -Twin32 DMDircUpdater.dpr
5
-rm -Rf ./*.o ./*.or
8
+rm -Rf ./*.o ./*.or ./*.ppu
6
 if [ -e DMDircUpdater.exe -a -e DMDirc.exe ]; then
9
 if [ -e DMDircUpdater.exe -a -e DMDirc.exe ]; then
7
 	exit 0;
10
 	exit 0;
8
 else
11
 else

正在加载...
取消
保存