(svn r14075) -Codechange: make the windows installer more platform aware and warn when the to-be-installed binary isn't the recommended one (or won't work at all).

This commit is contained in:
rubidium 2008-08-15 12:47:20 +00:00
parent 3a529ce878
commit d7382c86a5
5 changed files with 73 additions and 7 deletions

View File

@ -0,0 +1,4 @@
@echo off
"c:\Program Files\NSIS\makensis.exe" /DVERSION_INCLUDE=version_win9x.txt install.nsi > win9x.log
"c:\Program Files\NSIS\makensis.exe" /DVERSION_INCLUDE=version_win32.txt install.nsi > win32.log
"c:\Program Files\NSIS\makensis.exe" /DVERSION_INCLUDE=version_win64.txt install.nsi > win64.log

View File

@ -1,6 +1,7 @@
!define APPNAME "OpenTTD" ; Define application name
!define APPVERSION "0.6.1" ; Define application version
!define INSTALLERVERSION 48 ; NEED TO UPDATE THIS FOR EVERY RELEASE!!!
!include ${VERSION_INCLUDE}
!define APPURLLINK "http://www.openttd.org"
!define APPNAMEANDVERSION "${APPNAME} ${APPVERSION}"
@ -18,21 +19,21 @@ SetCompressor LZMA
; Version Info
Var AddWinPrePopulate
VIProductVersion "${APPVERSIONINTERNAL}"
VIAddVersionKey "ProductName" "OpenTTD Installer"
VIAddVersionKey "ProductName" "OpenTTD Installer ${APPBITS} bits version ${EXTRA_VERSION}"
VIAddVersionKey "Comments" "Installs ${APPNAMEANDVERSION}"
VIAddVersionKey "CompanyName" "OpenTTD Developers"
VIAddVersionKey "FileDescription" "Installs ${APPNAMEANDVERSION}"
VIAddVersionKey "ProductVersion" "${APPVERSION}"
VIAddVersionKey "InternalName" "InstOpenTTD"
VIAddVersionKey "FileVersion" "${APPVERSION}"
VIAddVersionKey "InternalName" "InstOpenTTD-${APPARCH}"
VIAddVersionKey "FileVersion" "${APPVERSION}-${APPARCH}"
VIAddVersionKey "LegalCopyright" " "
; Main Install settings
Name "${APPNAMEANDVERSION}"
Name "${APPNAMEANDVERSION} ${APPBITS} bits version ${EXTRA_VERSION}"
; NOTE: Keep trailing backslash!
InstallDir "$PROGRAMFILES\OpenTTD\"
InstallDirRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Install Folder"
OutFile "openttd-${APPVERSION}-win32.exe"
OutFile "openttd-${APPVERSION}-${APPARCH}.exe"
CRCCheck force
ShowInstDetails show
@ -45,7 +46,7 @@ Var CDDRIVE
!include "MUI.nsh"
!define MUI_ABORTWARNING
!define MUI_WELCOMEPAGE_TITLE_3LINES
!insertmacro MUI_PAGE_WELCOME
!define MUI_LICENSEPAGE_RADIOBUTTONS
@ -75,6 +76,8 @@ Page custom SelectCDEnter SelectCDExit ": TTD folder"
; New custom page to show UNICODE and MSLU information
Page custom ShowWarningsPage
!define MUI_FINISHPAGE_TITLE_3LINES
!define MUI_FINISHPAGE_RUN_TEXT "Run ${APPNAMEANDVERSION} now!"
!define MUI_FINISHPAGE_RUN "$INSTDIR\openttd.exe"
!define MUI_FINISHPAGE_LINK "Visit the OpenTTD site for latest news, FAQs and downloads"
!define MUI_FINISHPAGE_LINK_LOCATION "${APPURLLINK}"
@ -84,6 +87,7 @@ Page custom ShowWarningsPage
!define MUI_WELCOMEFINISHPAGE_CUSTOMFUNCTION_INIT DisableBack
!insertmacro MUI_PAGE_FINISH
!define MUI_PAGE_HEADER_TEXT "Uninstall ${APPNAMEANDVERSION}"
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
@ -127,7 +131,7 @@ Section "!OpenTTD" Section1
File ${PATH_ROOT}known-bugs.txt
; Copy executable
File /oname=openttd.exe ${PATH_ROOT}objs\Win32\Release\openttd.exe
File /oname=openttd.exe ${BINARY_DIR}\openttd.exe
File ${PATH_ROOT}objs\strgen\strgen.exe
@ -249,6 +253,7 @@ Section "Uninstall"
Delete "$INSTDIR\COPYING"
Delete "$INSTDIR\INSTALL.LOG"
Delete "$INSTDIR\crash.log"
Delete "$INSTDIR\crash.dmp"
Delete "$INSTDIR\openttd.cfg"
Delete "$INSTDIR\hs.dat"
Delete "$INSTDIR\cached_sprites.*"
@ -267,6 +272,8 @@ Section "Uninstall"
Delete "$INSTDIR\data\openttd.grf"
Delete "$INSTDIR\data\roadstops.grf"
Delete "$INSTDIR\data\trkfoundw.grf"
Delete "$INSTDIR\data\openttdd.grf"
Delete "$INSTDIR\data\openttdw.grf"
Delete "$INSTDIR\data\sample.cat"
; Windows Data files
@ -396,6 +403,47 @@ WinNT:
Push $R0
FunctionEnd
;-------------------------------------------------------------------------------
; Check whether we're not running an installer for 64 bits on 32 bits and vice versa
Function CheckProcessorArchitecture
cpudesc::tell
Pop $0 ;full identification string in $0
StrCpy $1 $0 2, 56 ;pull out the architecture
StrCmp $1 "00" 0 Win64
ClearErrors
IntCmp ${APPBITS} 64 0 Done
MessageBox MB_OKCANCEL|MB_ICONSTOP "You want to install the 64 bits OpenTTD on a 32 bits Operating System. This is not going to work. Please download the correct version. Do you really want to continue?" IDOK Done IDCANCEL Abort
GoTo Done
Win64:
ClearErrors
IntCmp ${APPBITS} 64 Done 0
MessageBox MB_OKCANCEL|MB_ICONINFORMATION "You want to install the 32 bits OpenTTD on a 64 bits Operating System. This is not adviced, but will work with reduced capabilities. We suggest that you download the correct version. Do you really want to continue?" IDOK Done IDCANCEL Abort
GoTo Done
Abort:
Quit
Done:
FunctionEnd
;-------------------------------------------------------------------------------
; Check whether we're not running an installer for NT on 9x and vice versa
Function CheckWindowsVersion
Call GetWindowsVersion
Pop $R0
StrCmp $R0 "win9x" 0 WinNT
ClearErrors
StrCmp ${APPARCH} "win9x" Done 0
MessageBox MB_OKCANCEL|MB_ICONSTOP "You want to install the Windows 2000, XP and Vista version on Windows 95, 98 or ME. This is will not work. Please download the correct version. Do you really want to continue?" IDOK Done IDCANCEL Abort
GoTo Done
WinNT:
ClearErrors
StrCmp ${APPARCH} "win9x" 0 Done
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "You want to install the Windows 95, 98 and ME version on Windows 2000, XP or Vista. This is not adviced, but will work with reduced capabilities. We suggest that you download the correct version. Do you really want to continue?" IDOK Done IDCANCEL Abort
Abort:
Quit
Done:
FunctionEnd
Var OLDVERSION
Var UninstallString
@ -446,6 +494,8 @@ InstallerIsOlder:
FinishCallback:
ClearErrors
Call CheckProcessorArchitecture
Call CheckWindowsVersion
FunctionEnd
; eof

View File

@ -0,0 +1,4 @@
!define APPBITS 32 ; Define number of bits for the architecture
!define EXTRA_VERSION "for Windows 2000, XP and Vista"
!define APPARCH "win32" ; Define the application architecture
!define BINARY_DIR "${PATH_ROOT}objs\win32\Release"

View File

@ -0,0 +1,4 @@
!define APPBITS 64 ; Define number of bits for the architecture
!define EXTRA_VERSION "for Windows XP and Vista"
!define APPARCH "win64" ; Define the application architecture
!define BINARY_DIR "${PATH_ROOT}objs\x64\Release"

View File

@ -0,0 +1,4 @@
!define APPBITS 32 ; Define number of bits for the architecture
!define EXTRA_VERSION "for Windows 95, 98 and ME"
!define APPARCH "win9x" ; Define the application architecture
!define BINARY_DIR "${PATH_ROOT}bin"