From d7382c86a57b74c513e753b5cb6c155a599cbc4d Mon Sep 17 00:00:00 2001 From: rubidium Date: Fri, 15 Aug 2008 12:47:20 +0000 Subject: [PATCH] (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). --- os/win32/installer/build_installers.bat | 4 ++ os/win32/installer/install.nsi | 64 ++++++++++++++++++++++--- os/win32/installer/version_win32.txt | 4 ++ os/win32/installer/version_win64.txt | 4 ++ os/win32/installer/version_win9x.txt | 4 ++ 5 files changed, 73 insertions(+), 7 deletions(-) create mode 100644 os/win32/installer/build_installers.bat create mode 100644 os/win32/installer/version_win32.txt create mode 100644 os/win32/installer/version_win64.txt create mode 100644 os/win32/installer/version_win9x.txt diff --git a/os/win32/installer/build_installers.bat b/os/win32/installer/build_installers.bat new file mode 100644 index 0000000000..73a2898da2 --- /dev/null +++ b/os/win32/installer/build_installers.bat @@ -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 diff --git a/os/win32/installer/install.nsi b/os/win32/installer/install.nsi index a31b8a9cf1..b16a988fcc 100644 --- a/os/win32/installer/install.nsi +++ b/os/win32/installer/install.nsi @@ -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 diff --git a/os/win32/installer/version_win32.txt b/os/win32/installer/version_win32.txt new file mode 100644 index 0000000000..d6314b8f0f --- /dev/null +++ b/os/win32/installer/version_win32.txt @@ -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" diff --git a/os/win32/installer/version_win64.txt b/os/win32/installer/version_win64.txt new file mode 100644 index 0000000000..ed96e31053 --- /dev/null +++ b/os/win32/installer/version_win64.txt @@ -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" diff --git a/os/win32/installer/version_win9x.txt b/os/win32/installer/version_win9x.txt new file mode 100644 index 0000000000..25ccc23c29 --- /dev/null +++ b/os/win32/installer/version_win9x.txt @@ -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"