Rewrited Windows NSIS Installer

Changed version of Stratagus to 2.2.5.1
This commit is contained in:
Pali Rohár 2010-06-25 11:56:11 +02:00
parent 1e90bee11b
commit b872c0b665
3 changed files with 143 additions and 56 deletions

View file

@ -5,12 +5,10 @@ make distclean || exit 1
./configure --enable-win32 --host=amd64-mingw32msvc --prefix=/usr/amd64-mingw32msvc --enable-static --without-bzip2 --with-theora --disable-stdio-redirect || exit 1
make || exit 1
makensis -DAMD64 stratagus.nsi || exit 1
mv stratagus-install.exe stratagus-install-amd64.exe || exit 1
make distclean || exit 1
./autogen.sh || exit 1
./configure --enable-win32 --host=i586-mingw32msvc --prefix=/usr/i586-mingw32msvc --enable-static --without-bzip2 --with-theora --disable-stdio-redirect || exit 1
make || exit 1
makensis stratagus.nsi || exit 1
mv stratagus-install.exe stratagus-install-i586.exe || exit 1

View file

@ -169,7 +169,7 @@ inline char *new_strdup(const char *str)
-- General
----------------------------------------------------------------------------*/
#define VERSION "2.2.5" /// Engine version shown
#define VERSION "2.2.5.1" /// Engine version shown
#ifndef StratagusMajorVerion
/// Stratagus major version

View file

@ -1,88 +1,177 @@
;
; stratagus.nsi - Windows NSIS Installer for Stratragus
; Copyright (C) 2010 Pali Rohár <pali.rohar@gmail.com>
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
;
;
!include "MUI.nsh"
;--------------------------------
Name "Stratagus"
OutFile "stratagus-install.exe"
Icon "contrib/stratagus.ico"
BrandingText " "
!define NAME "Stratagus"
!define VERSION "2.2.5.1"
;--------------------------------
!define ICON "contrib/stratagus.ico"
!define STRATAGUS "stratagus.exe"
!define UNINSTALL "uninstall.exe"
!define INSTALLER "${NAME}-${VERSION}.exe"
!define INSTALLDIR "$PROGRAMFILES\${NAME}\"
!ifdef AMD64
InstallDir $PROGRAMFILES64\Stratagus
!else
InstallDir $PROGRAMFILES\Stratagus
!undef INSTALLER
!define INSTALLER "${NAME}-${VERSION}-x86_64.exe"
!undef INSTALLDIR
!define INSTALLDIR "$PROGRAMFILES64\${NAME}\"
!undef NAME
!define NAME "Stratagus (64 bit)"
!endif
!define REGKEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${NAME}"
!define LANGUAGE "English"
;--------------------------------
LangString REMOVEPREVIOUS ${LANG_ENGLISH} "Removing previous installation"
LangString REMOVECONFIGURATION ${LANG_ENGLISH} "Removing configuration files:"
LangString DESC_REMOVEEXE ${LANG_ENGLISH} "Remove ${NAME} executable"
LangString DESC_REMOVECONF ${LANG_ENGLISH} "Remove all other configuration files and directories in ${NAME} install directory created by user or ${NAME}"
!ifdef AMD64
LangString AMD64ONLY ${LANG_ENGLISH} "This version is for 64 bits computers only."
!endif
;--------------------------------
!define MUI_ICON "${ICON}"
!define MUI_UNICON "${ICON}"
!define MUI_ABORTWARNING
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_UNFINISHPAGE_NOAUTOCLOSE
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "COPYING"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_COMPONENTS
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
!insertmacro MUI_LANGUAGE "${LANGUAGE}"
;--------------------------------
Name "${NAME}"
Icon "${ICON}"
OutFile "${INSTALLER}"
InstallDir "${INSTALLDIR}"
InstallDirRegKey HKLM "${REGKEY}" "InstallLocation"
BrandingText " "
ShowInstDetails Show
ShowUnInstDetails Show
XPStyle on
RequestExecutionLevel admin
;--------------------------------
!ifdef AMD64
Function .onInit
!ifdef AMD64
System::Call "kernel32::GetCurrentProcess() i .s"
System::Call "kernel32::IsWow64Process(i s, *i .r0)"
IntCmp $0 0 0 end
IntCmp $0 0 0 endAMD64
MessageBox MB_OK|MB_ICONSTOP "This version is for 64 bit computers only."
MessageBox MB_OK|MB_ICONSTOP "$(AMD64ONLY)"
Abort
endAMD64:
end:
FunctionEnd
!endif
ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Stratagus" "InstallLocation"
StrCmp $R0 "" end
StrCpy $instdir $R0
end:
FunctionEnd
Function Uninstall
ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Stratagus" "InstallLocation"
StrCmp $R0 "" end
DetailPrint "Removing previous installation"
ExecWait "$R0\uninstall.exe /S _?=$R0"
RMDir $R0
end:
FunctionEnd
;--------------------------------
Page directory
Page instfiles
Section "-${NAME}" UninstallPrevious
Section ""
SectionIn RO
Call Uninstall
ReadRegStr $R0 HKLM "${REGKEY}" "InstallLocation"
StrCmp $R0 "" end
DetailPrint "$(REMOVEPREVIOUS)"
SetDetailsPrint none
ExecWait "$R0\${UNINSTALL} /S _?=$R0"
Delete "$R0\${UNINSTALL}"
RMDir $R0
SetDetailsPrint lastused
end:
SectionEnd
Section "${NAME}"
SectionIn RO
SetOutPath $INSTDIR
File "stratagus.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Stratagus" "DisplayName" "Stratagus"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Stratagus" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Stratagus" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Stratagus" "InstallLocation" "$INSTDIR"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Stratagus" "DisplayIcon" "$\"$INSTDIR\stratagus.exe$\",0"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Stratagus" "NoModify" 1
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Stratagus" "NoRepair" 1
WriteUninstaller $INSTDIR\uninstall.exe
File "${STRATAGUS}"
WriteRegStr HKLM "${REGKEY}" "DisplayName" "${NAME}"
WriteRegStr HKLM "${REGKEY}" "UninstallString" "$\"$INSTDIR\${UNINSTALL}$\""
WriteRegStr HKLM "${REGKEY}" "QuietUninstallString" "$\"$INSTDIR\${UNINSTALL}$\" /S"
WriteRegStr HKLM "${REGKEY}" "InstallLocation" "$INSTDIR"
WriteRegStr HKLM "${REGKEY}" "DisplayIcon" "$\"$INSTDIR\${STRATAGUS}$\",0"
WriteRegStr HKLM "${REGKEY}" "DisplayVersion" "${VERSION}"
WriteRegDWORD HKLM "${REGKEY}" "NoModify" 1
WriteRegDWORD HKLM "${REGKEY}" "NoRepair" 1
WriteUninstaller "$INSTDIR\${UNINSTALL}"
SectionEnd
;--------------------------------
UninstPage uninstConfirm
UninstPage instfiles
Section "un.${NAME}" Executable
Section "Uninstall"
SectionIn RO
Delete $INSTDIR\stratagus.exe
Delete $INSTDIR\uninstall.exe
RMDir $INSTDIR
DeleteRegKey /ifempty HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Stratagus"
Delete "$INSTDIR\${STRATAGUS}"
Delete "$INSTDIR\${UNINSTALL}"
RMDir "$INSTDIR"
DeleteRegKey /ifempty HKLM "${REGKEY}"
SectionEnd
Section /o "un.Configuration" Configuration
DetailPrint "$(REMOVECONFIGURATION)"
RMDir /r "$INSTDIR"
SectionEnd
!insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${Executable} $(DESC_REMOVEEXE)
!insertmacro MUI_DESCRIPTION_TEXT ${Configuration} $(DESC_REMOVECONF)
!insertmacro MUI_UNFUNCTION_DESCRIPTION_END
;--------------------------------