Added windows installer (using NSIS)

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@627 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
ghaushe
2003-02-01 19:27:34 +00:00
parent fcccc5a8f5
commit d64d9129f3
10 changed files with 14701 additions and 0 deletions
+82
View File
@@ -0,0 +1,82 @@
Directions for building the Windows Installer.
it is required that you have cygwin with tar, gzip, 'zip', and perl installed
http://www.cygwin.org
alternatively, steps 3 and 4 can be completed on a linux machine (which
will probably work better anyway)
The following additional tools are required:
NSIS 2.0b0 or newer: nsis.sourceforge.net
NSIS 'ZipDLL' http://nsis.sourceforge.net/archive/download.php?file=ZipDLL.zip
NSIS 'unTGZ' http://nsis.sourceforge.net/archive/viewpage.php?pageid=84
Optionally:
upx 1.90 or newer: http://upx.sourceforge.net/#unstable
resource hacker: http://www.users.on.net/johnson/resourcehacker/
1) Compile uqm.exe
This doesn't seem to work. If someone can figure outhow to add an icon,
please update these directions
#2) Use resource hacker or some other program to attach the uqm icon:
# reshacker -modify uqm.exe,uqm.exe,build\\win32_install\\uqm.ico,icongroup,100,0
2) If you have upx, run it on uqm.exe as follows:
upx --best --crp-ms=100000 uqm.exe
3) Update the 'upgrade' reference.
The UQM installer can install either a 'full' version of the content dir
or an 'upgrade' from a previous version. The last official version was
0.1 as of Jan 31, 2003. To build the upgrade, it is necessary to determine
what has changed since the previous release. Each release is taggged in
the CVS repository with something like 'version_0_1'. A perl script is
included which can build a list of file versions tagged with a specific tag.
The procedure is:
cvs log -h > logfile
build_contour.pl logfile version_0_1 >content_0_1
This will generate a reference contour to compare the current CVS build
against. This only needs to be done once (after each release)
4) Build content .zip files and content.nsh
For this procedure, you must have no modifications in the content tree.
having additional files won't cause any issues, but there can't be any
modified files.
use the 'full' option when building a production release where you plan
to create a full content directory rather than just the upgrade zip
./build_archives.pl 0.2 content_0_1 [full]
This will generate .zip files of the content directory:
uqm_0_2_upgrade_0_1.zip
and (if 'full' is specified)
uqm_0_2_content.zip
These files should be uploaded to the disrtibution web page
It will also generate content.nsh which is a list of all files in the
content directory, for use in building the uninstaller
Lastly, this script will display the sizes of the uncompressed archives
which are needed for the next step
5) Modify the install script:
Edit uqm.nsi, and change the following variables:
MUI_VERSION: The version you are building
OLD_VERSION: The earliest version that can be upgraded from
MIRROR_LOCATION: Where the mirror file lives (probbaly ok as is)
NO_MIRROR_LOCATION: Where to get non-mirrored files from
FULL_NEEDS_UPGRADE: If you built the 'content' archive, set to '0'
otherwise set to '1' (i.e. official builds should
have this set to '0' dev builds set to '1')
CONTENT_USE_MIRROR: Whether to use the mirror for the 'content' archive
CONTENT_PACKAGE_FILE: the name of the 'content' file (from step 4)
CONTENT_TYPE_ZIP/CONTENT_TYPE_TGZ: set the correct define
CONTENT_SIZE: The size of the content archive (uncompressed)
UPGRADE_USE_MIRROR: Whether to use the mirror for the 'upgrade' archive
UPGRADE_PACKAGE_FILE: the name of the 'upgrade' file (from step 4)
UPGRADE_TYPE_ZIP/CONTENT_TYPE_TGZ: set the correct define
UPGRADE_SIZE: The size of the upgrade archive (uncompressed)
6) run NSIS to build the installer:
makensis uqm.nsi
the installer expects all the dlls to be in the same directory as uqm.exe
7) you should be done.
+6
View File
@@ -0,0 +1,6 @@
Things stiill needing doing of rthe installer:
- Support for moving save-game files to the correct location
- untgz.dll doesn't support error checking yet
- suppot different mirror files for upgrade and full innstalls
- check md5 sums on downloaded files
- the uninstaller doesn't seem to get everything
+207
View File
@@ -0,0 +1,207 @@
#! /usr/bin/perl -w
use File::Find;
use Cwd;
# set use_zip = 1 for .zip, = 0 for .tgz
$use_zip = 0;
$version = shift @ARGV;
$file = shift @ARGV;
$tag = shift @ARGV;
$do_full = shift @ARGV;
if (! defined ($version) || ! defined ($file) || scalar(@ARGV)) {
print STDERR "$0 version contour_file [full]\n";
print STDERR " or\n";
print STDERR "$0 version cvs_log_file cvs_tag [full]\n";
exit 1;
}
if (! defined ($do_full)) {
if (defined ($tag) && $tag eq "full") {
$do_full = $tag;
$tag = "";
} else {
$do_full = "";
if (!defined ($tag)) {
$tag = "";
}
}
}
@changed = ();
@all = ();
$ignore = 0;
%alldata = ();
$cwd = cwd();
if ($use_zip) {
$ext = "zip";
} else {
$ext = "tgz";
}
if ($tag) {
if ($tag =~ /(\d+_\d+\S*)$/) {
$vernum = $1;
} else {
$vernum = "";
}
# read in a cvs log for the content dir.
# log is made by doing:
# cd content
# cvs log -h > logfile
open FH, $file || die "Couldn't read cvs-log '$file'\n";
print "Reading revisions from cvs-log file\n";
while (<FH>) {
chomp;
if (/RCS file: (.+)\s*$/) {
if ($1 =~ /\/Attic\//) {
$ignore = 1;
} else {
$ignore = 0;
}
}
if (/Working file: (.+)\s*$/) {
$file = $1;
$alldata{"$file,head"} = "";
$alldata{"$file,prev"} = "";
}
if (/head: (\S+)/) {
$head = $1;
$alldata{"$file,head"} = $head;
if (! $ignore) {
push @changed, $file;
push @all, $file;
}
}
if (/\s+${tag}: (\S+)/) {
$alldata{"$file,prev"} = $1;
if (!$ignore && ($head eq $1 || $head eq "1.1" && $1 eq "1.1.1.1")) {
pop @changed;
}
}
}
close FH;
chdir "../../content";
} else {
print "Reading revisions from local cvs repository\n";
open FH, $file || die "Couldn't read contour '$file'\n";
chdir "../../content";
find (\&find_callback, ".");
# use a contour file and the 'CVS' directories to determine the file list
$first = 1;
$vernum = "";
while (<FH>) {
chomp;
if ($first) {
$vernum = $_;
$first = 0;
next;
}
if (/^(\S+) : (\S+)/) {
if (defined ($alldata{"$1,prev"})) {
if ($alldata{"$1,head"} ne $2 && $alldata{"$1,head"} ne "1.1" &&
$alldata{"$1,head"} ne "1.1.1.1") {
push @changed, $1;
}
$alldata{"$1,prev"} = $2;
} else {
print "Couldn't find '$1' in the repository\n";
}
}
}
close FH;
foreach $change (@all) {
if ($alldata{"$change,prev"} eq "") {
push @changed, $change;
}
}
}
$change_zip = "$cwd/uqm_${version}_upgrade${vernum}.$ext";
$content_zip = "$cwd/uqm_${version}_content.$ext";
# build the upgrade .zip file
$last_dir = "";
$change_size = 0;
open FH1, ">tmpfile" || die "Couldn't create temp file!\n";
foreach $path (@changed) {
if (-f $path) {
($null,$null,$null,$null,$null,$null,$null,$siz1) = stat $path;
$change_size += $siz1;
print FH1 "$path\n";
} else {
print "WARNING: '$path' was not found in local repository\n";
}
}
close FH1;
unlink $change_zip;
if ($use_zip) {
`cat tmpfile | zip -r $change_zip -@`;
} else {
`tar -T tmpfile -czf $change_zip`;
}
open (FH, ">$cwd/content.nsh");
open FH1, ">tmpfile" || die "Couldn't create temp file!\n";
$last_dir = "";
$content_size = 0;
@dirs = ();
foreach $path (@all) {
if (-f $path) {
($null,$null,$null,$null,$null,$null,$null,$siz1) = stat $path;
$content_size += $siz1;
print FH1 "$path\n";
} else {
print "WARNING: '$path' was not found in local repository\n";
}
if ($path =~ /^(.*\/)([^\/]+)$/) {
($dir, $file) = ($1, $2);
if ($dir ne $last_dir) {
push @dirs, $dir;
$last_dir = $dir;
}
print FH "Delete \"\$INSTDIR\\content\\$path\"\n";
}
}
close FH1;
foreach $dir (@dirs) {
print FH "RMDir \"\$INSTDIR\\content\\$dir\"\n";
}
close FH;
if ($do_full) {
unlink $content_zip;
if ($use_zip) {
`cat tmpfile | zip -r $content_zip -@`;
} else {
`tar -T tmpfile -czf $content_zip`;
}
unlink "tmpfile";
}
print "changed: #files: " . scalar (@changed) . " ($change_size kb)\n";
print "total: #files: " . scalar (@all) . " ($content_size kb)\n";
exit;
##########################################
sub find_callback {
my ($file) = $File::Find::name;
my ($dir) = $File::Find::dir;
return if ($dir !~ /(.*)\/CVS$/);
my ($root) = ($1 =~ /[^\/]*\/(.*)$/);
return if ($file !~ /Entries$/);
open FH_find, $_ or die "Can't read file '$file'\n";
while (<FH_find>) {
chomp;
my (@args) = split '/';
if (scalar (@args) >= 3 && -f "../$args[1]") {
if (defined ($root)) {
$file1 = "$root/$args[1]";
} else {
$file1 = $args[1];
}
$alldata{"$file1,head"} = $args[2];
$alldata{"$file1,prev"} = "";
push @all, $file1;
} else {
# print "Couldn't parse '$root' @args\n";
}
}
close FH_find;
}
+32
View File
@@ -0,0 +1,32 @@
#! /usr/bin/perl -w
if (scalar (@ARGV) != 2) {
print STDERR "$0 cvs_log_file cvs_tag\n";
exit 1;
}
$file = shift @ARGV;
$ver = shift @ARGV;
if ($ver =~ /(\d+_\d+\S*)$/) {
$vernum = $1;
} else {
print STDERR "Couldn't parse the cvs-tag for a release version\n";
$vernum = "0_0";
}
print "$vernum\n";
open FH, $file || die "Couldn't find file $file\n";
while (<FH>) {
chomp;
if (/Working file: (.+)\s*$/) {
$file = $1;
}
if (/head: (\S+)/) {
$head = $1;
}
if (/\s+${ver}:\s+(\S+)/) {
print "$file : $1\n";
$file = "";
$head = "";
}
}
close FH;
File diff suppressed because it is too large Load Diff
+64
View File
@@ -0,0 +1,64 @@
[Settings]
NumFields=8
; comment this out to hide the back button
BackEnabled=1
[Field 1]
Type=label
left=0
right=450
top=0
bottom=15
[Field 2]
Type=label
left=0
right=450
top=15
bottom=45
[Field 3]
Type=label
left=0
right=450
top=45
bottom=86; 59
[Field 4]
Type=RadioButton
State=1
left=0
right=450
top=90
bottom=105
[Field 5]
Type=RadioButton
State=0
left=0
right=450
top=105
bottom=120
[Field 6]
Type=CheckBox
State=0
left=0
right=450
top=130
bottom=145
[Field 7]
Type=DirRequest
left=20
right=450
top=145
bottom=168
[Field 8]
Type=label
left=20
right=450
top=170
bottom=210
+288
View File
@@ -0,0 +1,288 @@
!macro Print PARAM
SetDetailsPrint both
DetailPrint "${PARAM}"
SetDetailsPrint textonly
!macroend
;Function MirrorCleanup
; Pop $R5 ;Get number of mirrors on the stack
; mirror_cleanupstart:
; IntCmp $R5 0 mirror_cleanupcomplete
; Pop $R3
; IntOp $R5 $R5 - "1"
; goto mirror_cleanupstart
; mirror_cleanupcomplete:
;FunctionEnd
;------------------------------------------------------------------------------
; TrimNewlines
; input, top of stack (i.e. whatever$\r$\n)
; output, top of stack (replaces, with i.e. whatever)
; modifies no other variables.
;
Function TrimNewlines
Exch $0
Push $1
Push $2
StrCpy $1 0
loop:
IntOp $1 $1 - 1
StrCpy $2 $0 1 $1
StrCmp $2 "$\r" loop
StrCmp $2 "$\n" loop
IntOp $1 $1 + 1
StrLen $2 $0
IntOp $2 $2 + $1
StrCpy $0 $0 $2
Pop $2
Pop $1
Exch $0
FunctionEnd
;------------------------------------------------------------------------------
; TrimBackslashes
; input, top of stack (i.e. whatever\)
; output, top of stack (replaces, with i.e. whatever)
; modifies no other variables.
;
Function TrimBackslashes
Exch $0
Push $1
Push $2
StrCpy $1 0
loop:
IntOp $1 $1 - 1
StrCpy $2 $0 1 $1
StrCmp $2 "\" loop
IntOp $1 $1 + 1
StrLen $2 $0
IntOp $2 $2 + $1
StrCpy $0 $0 $2
Pop $2
Pop $1
Exch $0
FunctionEnd
;------------------------------------------------------------------------------
; DownloadAndExtract
; $0 = Package to download
; $1 = Mirror location or Download location
; $2 = Install directory
; $3 = Use mirror or direct download
; $4 = archive type (either tgz or zip)
Function DownloadAndExtract
SetDetailsPrint textonly
StrCpy $R9 success
; Check if user has selected "Skip"
StrCpy $R0 ""
ReadIniStr $R0 "$PLUGINSDIR\download.ini" "Field 5" state
StrCmp $R0 "1" function_end
; Check if installer should use local package directory and if the target file already exists
StrCpy $R0 ""
ReadIniStr $R0 "$PLUGINSDIR\download.ini" "Field 6" state
StrCmp $R0 "1" try_use_local
IntCmp $3 1 dl_mirror
StrCpy $R3 "$1/$0"
StrCpy $R5 0
goto download_file
try_use_local:
StrCpy $R0 ""
ReadIniStr $R0 "$PLUGINSDIR\download.ini" "Field 7" state
StrCmp $R0 "" use_temp
ClearErrors
CreateDirectory $R0
IfFileExists "$R0\*.*" "" dl_mirror
IfErrors dl_mirror
Push $R0
Call TrimBackslashes
Pop $R0
StrCpy $R0 "$R0\$0"
StrCpy $R2 1
IfFileExists $R0 startextract
dl_mirror:
!insertmacro Print $(DownloadDownloading)
!insertmacro Print $(DownloadRetrievingMirrorList)
; Save variables
Push $0
StrCpy $0 ""
; make the call to download
GetTempFileName $R0
nsisdl::download_quiet $1 $R0 ; for a quiet install, use download_quiet
; check if download succeeded
StrCmp $0 "success" mirrorsuccessful
StrCmp $0 "cancel" mirrorcancelled
; we failed
!insertmacro Print $(DownloadDownloadFailed)
Delete $R0
StrCpy $R1 $0
Pop $0
MessageBox MB_OK|MB_ICONEXCLAMATION $(DownloadMirrorDownloadFailedBox)
StrCpy $R9 failure
goto function_end
mirrorcancelled:
!insertmacro Print $(DownloadDownloadCancelled)
Delete $R0
Pop $0
StrCpy $R9 cancel
goto function_end
mirrorsuccessful:
!insertmacro Print $(DownloadRetrievingMirrorListSuccessful)
Pop $0
;Now parse the mirror list
FileOpen $R1 $R0 a
;Read number of mirrors into $R5
FileRead $R1 $R5
; Check the the first line is a number
IntCmp $R5 0 mirror_broken 0 0
;Chose one random mirror
;Calculate a random number based on the filetime of the downloaded mirror list
GetFileTime $R0 $R7 $R6
IntOp $R6 $R6 & "16777215" ;Just keep the last few bity, also ensure that $R6 is positive
IntOp $R6 $R6 / "100" ;Skip last 2 digits, they aren't really random due to low timer resolution
IntOp $R6 $R6 % $R5
IntOp $R6 $R6 + "1" ; $R6 now contains the index of the mirror to use first
StrCpy $R7 $R5
readmirror:
FileRead $R1 $R4
IntOp $R6 $R6 - "1"
IntOp $R7 $R7 - "1"
Push $R4
Call TrimNewlines
Pop $R4
IntCmp $R6 0 readmirror_random
IntCmp $R7 0 readmirror_done
goto readmirror
readmirror_random:
StrCpy $R3 "$R4/$0"
goto readmirror_done
IntCmp $R7 0 readmirror_done
goto readmirror
mirror_broken:
!insertmacro Print $(DownloadMirrorBroken)
Delete $R0
MessageBox MB_OK|MB_ICONEXCLAMATION $(DownloadMirrorBrokenDlg)
StrCpy $R9 failure
goto function_end
readmirror_done:
;$R3 now contains the mirror to use
!insertmacro Print $(DownloadUsingMirror)
FileClose $R1
;Done parsing
Delete $R0
;Now download the file
download_file:
; Save variables
Push $0
; make the call to download
; Check if installer should use local package directory
StrCpy $R0 ""
ReadIniStr $R0 "$PLUGINSDIR\download.ini" "Field 6" state
StrCmp $R0 "1" use_local
use_temp:
StrCpy $R2 0
GetTempFileName $R0
goto dl_start
use_local:
StrCpy $R0 ""
ReadIniStr $R0 "$PLUGINSDIR\download.ini" "Field 7" state
StrCmp $R0 "" use_temp
ClearErrors
CreateDirectory $R0
IfFileExists "$R0\*.*" use_local2 use_temp
use_local2:
IfErrors use_temp
Push $R0
Call TrimBackslashes
Pop $R0
StrCpy $R0 "$R0\$0"
StrCpy $R2 1
dl_start:
nsisdl::download $R3 $R0 ; for a quiet install, use download_quiet
; check if download succeeded
StrCmp $0 "success" dlsuccessful
StrCmp $0 "cancel" dlcancelled
; we failed
!insertmacro Print $(DownloadDownloadFailed)
Delete $R0
StrCpy $R1 $0
Pop $0
MessageBox MB_OK|MB_ICONEXCLAMATION $(DownloadDownloadFailedBox)
StrCpy $R9 failure
;call MirrorCleanup
goto function_end
dlcancelled:
!insertmacro Print $(DownloadDownloadCancelled)
Delete $R0
Pop $0
;call MirrorCleanup
StrCpy $R9 cancel
goto function_end
dlsuccessful:
!insertmacro Print $(DownloadDownloadSuccessful)
Pop $0
;call MirrorCleanup
startextract:
;Now extract the file
; make the call to ExtractAll
Push $R0
Push $2
StrCmp $4 "tgz" do_tgz_extract
ZipDll::extractall $R0 $2
goto check_extract
do_tgz_extract:
untgz::extract -d $2 $R0
StrCpy $R1 "success"
Push $R1
check_extract:
; check if extract succeeded
Pop $R1
StrCmp $R1 "success" extract_end
MessageBox MB_OK|MB_ICONEXCLAMATION $(DownloadExtractFailedBox)
StrCpy $R9 failure
extract_end:
StrCmp $R2 1 no_delete
Delete $R0
no_delete:
function_end:
Push $R9
SetDetailsPrint both
FunctionEnd
+7
View File
@@ -0,0 +1,7 @@
5
http://easynews.dl.sourceforge.net/sourceforge/sc2
http://umn.dl.sourceforge.net/sourceforge/sc2
http://telia.dl.sourceforge.net/sourceforge/sc2
http://unc.dl.sourceforge.net/sourceforge/sc2
http://twtelecom.dl.sourceforge.net/sourceforge/sc2
+427
View File
@@ -0,0 +1,427 @@
!define MUI_PRODUCT "Ur-Quan Masters" ;Define your own software name here
!define MUI_VERSION "0.13" ;Define your own software version here
!define OLD_VERSION "0.1" ; The earliest version that we can upgrade from
!define MIRROR_LOCATION "http://sc2.sourceforge.net/install_files/mirrors.txt"
!define NO_MIRROR_LOCATION "http://sc2.sourceforge.net/install_files/"
; define FULL_NEEDS_UPGRADE if both arhives are needed for a full install
!define FULL_NEEDS_UPGRADE 1
!define CONTENT_USE_MIRROR 1
;!define CONTENT_PACKAGE_FILE "uqm_0_1_3_content.tgz"
!define CONTENT_PACKAGE_FILE "uqm-0.1-content-full.tgz"
;!define CONTENT_TYPE_ZIP
!define CONTENT_TYPE_TGZ
!define CONTENT_ROOT ""
!define CONTENT_SIZE 148454
;!define UPGRADE_USE_MIRROR 1
!define UPGRADE_PACKAGE_FILE "uqm_0_1_3_upgrade0_1.tgz"
;!define UPGRADE_TYPE_ZIP
!define UPGRADE_TYPE_TGZ
!define UPGRADE_ROOT "\content"
!define UPGRADE_SIZE 1324
;--------------------------------
!include "${NSISDIR}\Contrib\Modern UI\System.nsh"
;--------------------------------
;Configuration
;Preprocessing of input files
!packhdr temp.dat "upx.exe --best --crp-ms=100000 temp.dat"
;SetCompressor bzip2
;Interface
;!define MUI_ICON "uqm.ico"
;!define MUI_UNICON "uninstall.ico"
!define MUI_LICENSEPAGE
!define MUI_COMPONENTSPAGE
!define MUI_DIRECTORYPAGE
!define MUI_ABORTWARNING
!define MUI_UNINSTALLER
!define MUI_UNCONFIRMPAGE
!define MUI_CUSTOMPAGECOMMANDS ;Use customized pages
;Language Files
;English
; We will leave language support, buft sincne English is
; the only language we have so far, there's no reason to pop up a dialog
!insertmacro MUI_LANGUAGE "English"
!include "uqm_english.nsh"
OutFile "UQMSetup.exe"
;Page order
!insertmacro MUI_PAGECOMMAND_LICENSE
!insertmacro MUI_PAGECOMMAND_COMPONENTS
!insertmacro MUI_PAGECOMMAND_DIRECTORY
Page custom DownloadOptions $(PageDownloadTitle)
!insertmacro MUI_PAGECOMMAND_INSTFILES
SetOverwrite on
AutoCloseWindow false
ShowInstDetails show
ShowUninstDetails show
;Folder-select dialog
InstallDir "$PROGRAMFILES\${MUI_PRODUCT}"
;Things that need to be extracted on startup (keep these lines before any File command!)
;!insertmacro MUI_RESERVEFILE_LANGDLL
ReserveFile "download.ini"
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
ReserveFile "${NSISDIR}\Plugins\NSISdl.dll"
!ifdef UPGRADE_TYPE_ZIP | CONTENT_TYPE_ZIP
ReserveFile "${NSISDIR}\Plugins\ZipDLL.dll"
!endif
!ifdef UPGRADE_TYPE_TGZ | CONTENT_TYPE_TGZ
ReserveFile "${NSISDIR}\Plugins\untgz.dll"
!endif
;--------------------------------
;Modern UI system
!undef MUI_DIRECTORYPAGE
!insertmacro MUI_SYSTEM
!define MUI_DIRECTORYPAGE
;--------------------------------
;Installer Sections
InstType $(InstTypeFullName)
InstType $(InstTypeUpgradeName)
Section !$(SecUQMName) SecUQM
SectionIn 1 2 RO
; Set output path to the installation directory.
SetOutPath $INSTDIR
; Put file there
File "..\..\uqm.exe"
File "..\..\README"
File "..\..\NEWS"
File "..\..\ChangeLog"
File "..\..\TODO"
File "..\..\doc\users\manual.txt"
File "..\..\COPYING"
; Write the installation path into the registry
WriteRegStr HKCU "Software\${MUI_PRODUCT}" "Install_Dir" "$INSTDIR"
WriteRegStr HKLM "Software\${MUI_PRODUCT}" "Install_Dir" "$INSTDIR"
; Write the version into the registry for easy upgrade
WriteRegStr HKCU "Software\${MUI_PRODUCT}" "Version" "${MUI_VERSION}"
WriteRegStr HKLM "Software\${MUI_PRODUCT}" "Version" "${MUI_VERSION}"
; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}" "DisplayName" "${MUI_PRODUCT} (remove only)"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}" "UninstallString" '"$INSTDIR\uninstall.exe"'
;Create the uninstaller
WriteUninstaller uninstall.exe
SectionEnd
Section $(SecContentName) SecContent
SectionIn 1
AddSize ${CONTENT_SIZE}
SetOutPath "$INSTDIR\content"
StrCpy $0 ${CONTENT_PACKAGE_FILE}
!ifdef CONTENT_USE_MIRROR
StrCpy $1 ${MIRROR_LOCATION}
StrCpy $3 1
!else
StrCpy $1 ${NO_MIRROR_LOCATION}
StrCpy $3 0
!endiF
StrCpy $2 "$INSTDIR${CONTENT_ROOT}"
!ifdef CONTENT_TYPE_ZIP
StrCpy $4 "zip"
!else
!ifdef CONTENT_TYPE_TGZ
StrCpy $4 "tgz"
!else
!error "Content file type unknown"
!endif
!endif
call DownloadAndExtract
Pop $0
StrCmp $0 success content_ok content_failure
content_ok:
StrCpy $0 "content"
goto content_end
content_failure:
StrCpy $0 ""
content_end:
SectionEnd
Section $(SecUpgradeName) SecUpgrade
!ifdef FULL_NEEDS_UPGRADE
SectionIn 1 2
!else
SectionIn 2
!endif
AddSize ${UPGRADE_SIZE}
StrCpy $R1 0
SetOutPath $INSTDIR\content
StrCpy $0 ${UPGRADE_PACKAGE_FILE}
!ifdef UPGRADE_USE_MIRROR
StrCpy $1 ${MIRROR_LOCATION}
StrCpy $3 1
!else
StrCpy $1 ${NO_MIRROR_LOCATION}
StrCpy $3 0
!endiF
StrCpy $2 "$INSTDIR${UPGRADE_ROOT}"
!ifdef UPGRADE_TYPE_ZIP
StrCpy $4 "zip"
!else
!ifdef UPGRADE_TYPE_TGZ
StrCpy $4 "tgz"
!else
!error "Upgrade file type unknown"
!endif
!endif
call DownloadAndExtract
Pop $0
StrCmp $0 success upgrade_ok upgrade_failure
upgrade_ok:
StrCpy $0 "upgrade"
goto upgrade_end
upgrade_failure:
StrCpy $0 ""
upgrade_end:
SectionEnd
SubSection $(SecSupportDLLName) SecSupportDLL
Section $(SecSDLName) SecSDL
SectionIn 1
; Set output path to the installation directory.
SetOutPath $INSTDIR
; Put file there
File "..\..\SDL.dll"
File "..\..\zlib.dll"
File "..\..\libpng1.dll"
File "..\..\jpeg.dll"
File "..\..\SDL_image.dll"
SectionEnd
Section $(SecVoiceName) SecVoice
SectionIn 1
; Set output path to the installation directory.
SetOutPath $INSTDIR
; Put file there
File "..\..\vorbisfile.dll"
File "..\..\vorbis.dll"
File "..\..\ogg.dll"
SectionEnd
SubSectionEnd
Section $(SecStartMenuName) SecStartMenu
SectionIn 1 2
CreateDirectory "$SMPROGRAMS\${MUI_PRODUCT}"
CreateShortCut "$SMPROGRAMS\${MUI_PRODUCT}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\${MUI_PRODUCT}\uqm.lnk" "$INSTDIR\uqm.exe" "" "$INSTDIR\uqm.exe" 0
SectionEnd
Section $(SecDesktopIconName) SecDesktopIcon
SectionIn 1 2
CreateShortCut "$DESKTOP\uqm.lnk" "$INSTDIR\uqm.exe" "" "$INSTDIR\uqm.exe" 0
SectionEnd
;Display the Finish header
;Insert this macro after the sections if you are not using a finish page
!insertmacro MUI_SECTIONS_FINISHHEADER
;--------------------------------
;Installer Functions
Function .onInit
;Init InstallOptions
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "download.ini"
!define SF_SELECTED 1
!define SECTION_OFF 0xFFFFFFFE
FunctionEnd
Function .onSelChange
Push $0
SectionGetFlags ${SecContent} $0
IntOp $0 $0 & 1
IntCmp $0 0 sel_change_done
SectionGetFlags ${SecUpgrade} $0
!ifdef FULL_NEEDS_UPGRADE
IntOp $0 $0 | 1
!else
IntOp $0 $0 & 0xFFFFFFFE
!endif
SectionSetFlags ${SecUpgrade} $0
sel_change_done:
Pop $0
FunctionEnd
!ifdef MUI_DIRECTORYPAGE
Function SetDirectory
!insertmacro MUI_HEADER_TEXT $(MUI_TEXT_DIRECTORY_TITLE) $(MUI_TEXT_DIRECTORY_SUBTITLE)
FunctionEnd
!endif
Function DownloadOptions
Push $0
Call CheckDownloadDialog
IntCmp $0 1 +2
Return
Pop $0
!insertmacro MUI_HEADER_TEXT $(PageDownloadTitle) $(PageDownloadSubTitle)
!insertmacro MUI_INSTALLOPTIONS_WRITE "download.ini" "Field 1" text $(DownloadDialog1)
!insertmacro MUI_INSTALLOPTIONS_WRITE "download.ini" "Field 3" text $(DownloadDialog3)
!insertmacro MUI_INSTALLOPTIONS_WRITE "download.ini" "Field 4" text $(DownloadDialog4)
!insertmacro MUI_INSTALLOPTIONS_WRITE "download.ini" "Field 5" text $(DownloadDialog5)
!insertmacro MUI_INSTALLOPTIONS_WRITE "download.ini" "Field 6" text $(DownloadDialog6)
!insertmacro MUI_INSTALLOPTIONS_WRITE "download.ini" "Field 8" text $(DownloadDialog8)
StrCpy $R1 ""
StrCpy $R1 $(SecContentName)
!insertmacro MUI_INSTALLOPTIONS_WRITE "download.ini" "Field 2" text $R1
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "download.ini"
FunctionEnd
Function SetDirectoryDialog
!insertmacro MUI_INNERDIALOG_TEXT 1041 $(MUI_INNERTEXT_DIRECTORY_DESTINATION)
Push $0
Call CheckDownloadDialog
IntCmp $0 0 buttoninst
StrCpy $R0 $(DownloadDialogNext2)
goto buttondone
buttoninst:
StrCpy $R0 $(DownloadDialogNext1)
buttondone:
Pop $0
GetDlgItem $R1 $HWNDPARENT 1
SendMessage $R1 ${WM_SETTEXT} 0 "STR:$R0"
FunctionEnd
Function CheckDownloadDialog
Push $R0
SectionGetFlags ${SecContent} $R0
Intop $R0 $R0 & "0x1"
IntCmp $R0 0 dlchk_upg
Pop $R0
StrCpy $0 1
Return
dlchk_upg:
SectionGetFlags ${SecUpgrade} $R0
Intop $R0 $R0 & "0x1"
IntCmp $R0 0 dlchk_end
Pop $R0
StrCpy $0 1
Return
dlchk_end:
Pop $R0
StrCpy $0 0
Return
FunctionEnd
!include "download.nsh"
;--------------------------------
;Descriptions
!insertmacro MUI_FUNCTIONS_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecUQM} $(SecUQMDesc)
!insertmacro MUI_DESCRIPTION_TEXT ${SecUpgrade} $(SecUpgradeDesc)
!insertmacro MUI_DESCRIPTION_TEXT ${SecContent} $(SecContentDesc)
!insertmacro MUI_DESCRIPTION_TEXT ${SecSupportDLL} $(SecSupportDLLDesc)
!insertmacro MUI_DESCRIPTION_TEXT ${SecSDL} $(SecSDLDesc)
!insertmacro MUI_DESCRIPTION_TEXT ${SecVoice} $(SecVoiceDesc)
!insertmacro MUI_DESCRIPTION_TEXT ${SecStartMenu} $(SecStartMenuDesc)
!insertmacro MUI_DESCRIPTION_TEXT ${SecDesktopIcon} $(SecDesktopIconDesc)
!insertmacro MUI_FUNCTIONS_DESCRIPTION_END
;--------------------------------
;Uninstaller section
Section "Uninstall"
;Add your stuff here
; remove registry keys
DeleteRegKey HKCU "Software\${MUI_PRODUCT}"
DeleteRegKey HKLM "Software\${MUI_PRODUCT}"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}"
; remove files
Delete "$INSTDIR\uqm.exe"
Delete "$INSTDIR\README"
Delete "$INSTDIR\NEWS"
Delete "$INSTDIR\ChangeLog"
Delete "$INSTDIR\TODO"
Delete "$INSTDIR\manual.txt"
Delete "$INSTDIR\COPYING"
Delete "$INSTDIR\SDL.dll"
Delete "$INSTDIR\zlib.dll"
Delete "$INSTDIR\libpng1.dll"
Delete "$INSTDIR\jpeg.dll"
Delete "$INSTDIR\SDL_image.dll"
Delete "$INSTDIR\vorbisfile.dll"
Delete "$INSTDIR\vorbis.dll"
Delete "$INSTDIR\ogg.dll"
; Remove content dir
!include "content.nsh"
; MUST REMOVE UNINSTALLER, too
Delete $INSTDIR\uninstall.exe
; remove shortcuts, if any.
Delete "$SMPROGRAMS\${MUI_PRODUCT}\*.*"
Delete $DESKTOP\uqm.lnk
; remove directories used.
RMDir "$SMPROGRAMS\${MUI_PRODUCT}"
RMDir "$INSTDIR\content"
RMDir "$INSTDIR"
;Security - do not delete anything if ${MUI_PRODUCT} is empty
;StrCmp "${MUI_PRODUCT}" "" +2
; DeleteRegKey HKCU "Software\${MUI_PRODUCT}"
!insertmacro MUI_UNFINISHHEADER
SectionEnd
;--------------------------------
;Uninstaller Functions
;--------------------------------
;Ur-Quan Masters install script
;written by Geoffrey Hausheer
;Based on
;NSIS Modern Style UI version 1.61
;Multilanguage & LangDLL Example Script
;Written by Joost Verburg
;and FileZilla installation
;written by Tim Kosse (mailto:tim.kosse@gmx.de)
+65
View File
@@ -0,0 +1,65 @@
;Language specific include file for UrQuan Masters installer
;Created by Geoffrey Hausheer
;Based on installer for FileZilla
;Created by Tim Kosse (mailto:tim.kosse@gmx.de)
;This file has been translated by <insert your name here>
!verbose 3
;License dialog
LicenseData /LANG=${LANG_ENGLISH} "..\..\COPYING"
;Component-select dialog
LangString InstTypeFullName ${LANG_ENGLISH} "Full"
LangString InstTypeUpgradeName ${LANG_ENGLISH} "Upgrade"
LangString SecUQMName ${LANG_ENGLISH} "Ur-Quan Masters (required)"
LangString SecUpgradeName ${LANG_ENGLISH} "Upgrade Data from ${OLD_VERSION}"
LangString SecContentName ${LANG_ENGLISH} "Install All data"
LangString SecSupportDLLName ${LANG_ENGLISH} "Graphics/Sound libs"
LangString SecSDLName ${LANG_ENGLISH} "SDL"
LangString SecVoiceName ${LANG_ENGLISH} "Voice"
LangString SecStartMenuName ${LANG_ENGLISH} "Start Menu Shortcuts"
LangString SecDesktopIconName ${LANG_ENGLISH} "Desktop Icon"
LangString SecUQMDesc ${LANG_ENGLISH} "Install uqm.exe and other required files"
LangString SecUpgradeDesc ${LANG_ENGLISH} "Download the upgrade uqm from a previous ${OLD_VERSION} (or later) install. NOTE: aborting an upgrade can leave your uqm install corrupted"
LangString SecContentDesc ${LANG_ENGLISH} "Download all data files needed to play uqm."
LangString SecSupportDLLDesc ${LANG_ENGLISH} "Install Support .dll files needed to play Ur-Quan Masters"
LangString SecSDLDesc ${LANG_ENGLISH} "Install SDL and SDL_image libraries for graphics and sound support"
LangString SecVoiceDesc ${LANG_ENGLISH} "Install OggVorbis libraries for playing voice"
LangString SecStartMenuDesc ${LANG_ENGLISH} "Create shortcuts in the start menu"
LangString SecDesktopIconDesc ${LANG_ENGLISH} "Add a desktop icon for quick access to UrQuan Masters"
;Page titles
LangString PageDownloadTitle ${LANG_ENGLISH} ": Download options"
LangString PageDownloadSubTitle ${LANG_ENGLISH} "Some components have to be downloaded"
;Download dialog
LangString DownloadDialogNext1 ${LANG_ENGLISH} "&Install"
LangString DownloadDialogNext2 ${LANG_ENGLISH} "&Next >"
LangString DownloadDialog1 ${LANG_ENGLISH} "The following components are not included in the installer to reduce its size:"
LangString DownloadDialog3 ${LANG_ENGLISH} "To install these components, the installer can download the required files. If you don't want to download the files now, you can run the installer again later, or you can download the files manually from http://sc2.sourceforge.net"
LangString DownloadDialog4 ${LANG_ENGLISH} "Download and Install from the internet"
LangString DownloadDialog5 ${LANG_ENGLISH} "Skip these components"
LangString DownloadDialog6 ${LANG_ENGLISH} "Use local package directory (enter below):"
LangString DownloadDialog8 ${LANG_ENGLISH} "When using the package directory, the installer will save all downloaded files in this directory. It will also only download the files which aren't already present in the package directory."
;Download strings
LangString DownloadDownloading ${LANG_ENGLISH} "Downloading $0"
LangString DownloadRetrievingMirrorList ${LANG_ENGLISH} " Retrieving mirror list from $1" ;Don't remove the leading two whitespaces
LangString DownloadDownloadFailed ${LANG_ENGLISH} " Download failed: $0" ;Don't remove the leading two whitespaces
LangString DownloadMirrorDownloadFailedBox ${LANG_ENGLISH} "Failed to download mirror list for $0. Reason: $R1$\nThis component will not be installed.$\nRun the installer again later to retry downloading this component.$\nIf this error stays, the installer may not able to access the internet. In any case you can download the components manually from http://sc2.sourceforge.net"
LangString DownloadDownloadCancelled ${LANG_ENGLISH} " Download cancelled" ;Don't remove the leading two whitespaces
LangString DownloadRetrievingMirrorListSuccessful ${LANG_ENGLISH} " Mirror list download successful" ;Don't remove the leading two whitespaces
LangString DownloadUsingMirror ${LANG_ENGLISH} " Using mirror $R3" ;Don't remove the leading two whitespaces
LangString DownloadDownloadFailedBox ${LANG_ENGLISH} "Failed to download $0. Reason: $R1$\nThis component will not be installed.$\nRun the installer again later to retry downloading this component.$\nIf this error stays, the installer may not able to access the internet. In any case you can download the components manually from http://sc2.sourceforge.net"
LangString DownloadDownloadSuccessful ${LANG_ENGLISH} " Download successful" ;Don't remove the leading two whitespaces
LangString DownloadExtractFailedBox ${LANG_ENGLISH} "Failed to extract contents of $0. Reason: $R1$\nThis component will not be installed."
; Mirror problems
LangString DownloadMirrorBroken ${LANG_ENGLISH} "Failed to parse mirror file"
LangString DownloadMirrorBrokenDlg ${LANG_ENGLISH} "There were problems reading the mirror file. We wil not be able to install downloaded content. You can retrieve the files directly from http://sc2.sourceforge.net"
;Uninstaller
LangString un.QuestionDeleteRegistry ${LANG_ENGLISH} "Delete all Registry keys created by Ur-Quan Masters?"
!verbose 4