Minor tweaks to the build process

This commit is contained in:
Birunthan Mohanathas 2013-10-19 16:15:20 +03:00
parent 9ebac71990
commit 04230d608f
2 changed files with 35 additions and 35 deletions

View File

@ -12,6 +12,10 @@ set VERSION_SUBMINOR=1
set VERSION_REVISION=0 set VERSION_REVISION=0
set ISBETA=true set ISBETA=true
set VERSION_FULL=%VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_SUBMINOR%.%VERSION_REVISION%
set VERSION_SHORT=%VERSION_MAJOR%.%VERSION_MINOR%
if not "%VERSION_SUBMINOR%" == "0" set VERSION_SHORT=!VERSION_SHORT!.%VERSION_SUBMINOR%
if "%1" == "RELEASE" set ISBETA=false if "%1" == "RELEASE" set ISBETA=false
if "%1" == "BUILDVERSION" goto BUILDVERSION if "%1" == "BUILDVERSION" goto BUILDVERSION
echo Rainmeter Build echo Rainmeter Build
@ -47,13 +51,11 @@ for /f "usebackq delims= " %%G in (`"%GIT%" rev-list --all --count`) do set VERS
:UPDATEVERSION :UPDATEVERSION
set VERSION=%VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_SUBMINOR%.%VERSION_REVISION%
:: Update Version.h :: Update Version.h
> "..\Version.h" echo #pragma once > "..\Version.h" echo #pragma once
>>"..\Version.h" echo #define FILEVER %VERSION_MAJOR%,%VERSION_MINOR%,%VERSION_SUBMINOR%,%VERSION_REVISION% >>"..\Version.h" echo #define FILEVER %VERSION_MAJOR%,%VERSION_MINOR%,%VERSION_SUBMINOR%,%VERSION_REVISION%
>>"..\Version.h" echo #define PRODUCTVER FILEVER >>"..\Version.h" echo #define PRODUCTVER FILEVER
>>"..\Version.h" echo #define STRFILEVER "%VERSION%" >>"..\Version.h" echo #define STRFILEVER "%VERSION_FULL%"
>>"..\Version.h" echo #define STRPRODUCTVER STRFILEVER >>"..\Version.h" echo #define STRPRODUCTVER STRFILEVER
>>"..\Version.h" echo #define APPVERSION L"%VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_SUBMINOR%" >>"..\Version.h" echo #define APPVERSION L"%VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_SUBMINOR%"
>>"..\Version.h" echo #define RAINMETER_VERSION ((%VERSION_MAJOR% * 1000000) + (%VERSION_MINOR% * 1000) + %VERSION_SUBMINOR%) >>"..\Version.h" echo #define RAINMETER_VERSION ((%VERSION_MAJOR% * 1000000) + (%VERSION_MINOR% * 1000) + %VERSION_SUBMINOR%)
@ -66,9 +68,9 @@ set VERSION=%VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_SUBMINOR%.%VERSION_REVISION
>>"..\Version.cs" echo public class Version >>"..\Version.cs" echo public class Version
>>"..\Version.cs" echo { >>"..\Version.cs" echo {
>>"..\Version.cs" echo #if X64 >>"..\Version.cs" echo #if X64
>>"..\Version.cs" echo public const string Informational = "%VERSION% (64-bit)"; >>"..\Version.cs" echo public const string Informational = "%VERSION_FULL% (64-bit)";
>>"..\Version.cs" echo #else >>"..\Version.cs" echo #else
>>"..\Version.cs" echo public const string Informational = "%VERSION% (32-bit)"; >>"..\Version.cs" echo public const string Informational = "%VERSION_FULL% (32-bit)";
>>"..\Version.cs" echo #endif >>"..\Version.cs" echo #endif
>>"..\Version.cs" echo } >>"..\Version.cs" echo }
>>"..\Version.cs" echo } >>"..\Version.cs" echo }
@ -135,24 +137,23 @@ if not "%CERTFILE%" == "" (
:: Build installer :: Build installer
echo * Building installer echo * Building installer
set INSTALLER_VERSION=%VERSION_MAJOR%.%VERSION_MINOR% set INSTALLER_NAME=Rainmeter-%VERSION_SHORT%.exe
if not "%VERSION_SUBMINOR%" == "0" set INSTALLER_VERSION=!INSTALLER_VERSION!.%VERSION_SUBMINOR% if not "%1" == "RELEASE" set INSTALLER_NAME=Rainmeter-%VERSION_SHORT%-r%VERSION_REVISION%-beta.exe
if "%1" == "RELEASE" ( set INSTALLER_DEFINES=^
"%MAKENSIS%" /DREV="%VERSION_REVISION%" /DVER="%INSTALLER_VERSION%" .\Installer\Installer.nsi > "BuildLog.txt" /DOUTFILE="%INSTALLER_NAME%"^
) else ( /DVERSION_FULL="%VERSION_FULL%"^
"%MAKENSIS%" /DBETA /DREV="%VERSION_REVISION%" /DVER="%INSTALLER_VERSION%" .\Installer\Installer.nsi > "BuildLog.txt" /DVERSION_SHORT="%VERSION_SHORT%"^
) /DVERSION_REVISION="%VERSION_REVISION%"
if not "%1" == "RELEASE" set INSTALLER_DEFINES=!INSTALLER_DEFINES! /DBETA
"%MAKENSIS%" %INSTALLER_DEFINES% .\Installer\Installer.nsi > "BuildLog.txt"
if not %ERRORLEVEL% == 0 echo ERROR %ERRORLEVEL%: Building installer failed & goto END if not %ERRORLEVEL% == 0 echo ERROR %ERRORLEVEL%: Building installer failed & goto END
:: Sign installer :: Sign installer
if not "%CERTFILE%" == "" ( if not "%CERTFILE%" == "" (
echo * Signing installer echo * Signing installer
if "%1" == "RELEASE" ( %SIGNTOOL% %INSTALLER_NAME% > BuildLog.txt
%SIGNTOOL% Rainmeter-%INSTALLER_VERSION%.exe > BuildLog.txt
) else (
%SIGNTOOL% Rainmeter-%INSTALLER_VERSION%-r%VERSION_REVISION%-beta.exe > BuildLog.txt
)
if not %ERRORLEVEL% == 0 echo ERROR %ERRORLEVEL%: Signing installer failed & goto END if not %ERRORLEVEL% == 0 echo ERROR %ERRORLEVEL%: Signing installer failed & goto END
) )

View File

@ -25,26 +25,23 @@
!include "WinVer.nsh" !include "WinVer.nsh"
!include "UAC.nsh" !include "UAC.nsh"
!ifndef VER !ifndef OUTFILE
!define VER "0.0" !define OUTFILE "Rainmeter-test.exe"
!define REV "000" !define VERSION_FULL "0.0.0.0"
!define VERSION_SHORT "0.0"
!define VERSION_REVISION "000"
!else !else
!define INCLUDEFILES !define INCLUDEFILES
!endif !endif
!ifdef BETA
!define OUTFILE "Rainmeter-${VER}-r${REV}-beta.exe"
!else
!define OUTFILE "Rainmeter-${VER}.exe"
!endif
Name "Rainmeter" Name "Rainmeter"
VIAddVersionKey "ProductName" "Rainmeter" VIAddVersionKey "ProductName" "Rainmeter"
VIAddVersionKey "FileDescription" "Rainmeter Installer" VIAddVersionKey "FileDescription" "Rainmeter Installer"
VIAddVersionKey "FileVersion" "${VER}.0" VIAddVersionKey "FileVersion" "${VERSION_FULL}"
VIAddVersionKey "ProductVersion" "${VER}.0.${REV}" VIAddVersionKey "ProductVersion" "${VERSION_FULL}"
VIAddVersionKey "OriginalFilename" "${OUTFILE}" VIAddVersionKey "OriginalFilename" "${OUTFILE}"
VIAddVersionKey "LegalCopyright" "Copyright (C) 2009-2012 - All authors" VIAddVersionKey "LegalCopyright" "Copyright (C) 2009-2013 - All authors"
VIProductVersion "${VER}.0.${REV}" VIProductVersion "${VERSION_FULL}"
BrandingText " " BrandingText " "
SetCompressor /SOLID lzma SetCompressor /SOLID lzma
RequestExecutionLevel user RequestExecutionLevel user
@ -115,7 +112,7 @@ Function .onInit
${OrIf} ${IsWin2003} ${OrIf} ${IsWin2003}
${AndIf} ${AtMostServicePack} 0 ${AndIf} ${AtMostServicePack} 0
${IfNot} ${Silent} ${IfNot} ${Silent}
MessageBox MB_OK|MB_ICONSTOP "Windows XP SP2 or later is required to install Rainmeter ${VER}." MessageBox MB_OK|MB_ICONSTOP "Rainmeter requires Windows XP SP2 or later."
${EndIf} ${EndIf}
SetErrorLevel ${ERROR_UNSUPPORTED} SetErrorLevel ${ERROR_UNSUPPORTED}
Quit Quit
@ -124,7 +121,7 @@ Function .onInit
System::Call 'kernel32::IsProcessorFeaturePresent(i${PF_XMMI_INSTRUCTIONS_AVAILABLE})i.r0' System::Call 'kernel32::IsProcessorFeaturePresent(i${PF_XMMI_INSTRUCTIONS_AVAILABLE})i.r0'
${If} $0 = 0 ${If} $0 = 0
${IfNot} ${Silent} ${IfNot} ${Silent}
MessageBox MB_OK|MB_ICONSTOP "A Pentium III or later processor is required to install Rainmeter ${VER}." MessageBox MB_OK|MB_ICONSTOP "Rainmeter requires a Pentium III or later processor."
${EndIf} ${EndIf}
SetErrorLevel ${ERROR_UNSUPPORTED} SetErrorLevel ${ERROR_UNSUPPORTED}
Quit Quit
@ -732,9 +729,9 @@ SkipIniMove:
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Rainmeter" "UninstallString" "$INSTDIR\uninst.exe" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Rainmeter" "UninstallString" "$INSTDIR\uninst.exe"
!ifdef BETA !ifdef BETA
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Rainmeter" "DisplayVersion" "${VER} beta r${REV}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Rainmeter" "DisplayVersion" "${VERSION_SHORT} beta r${VERSION_REVISION}"
!else !else
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Rainmeter" "DisplayVersion" "${VER} r${REV}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Rainmeter" "DisplayVersion" "${VERSION_SHORT} r${VERSION_REVISION}"
!endif !endif
; Create .rmskin association ; Create .rmskin association
@ -941,12 +938,14 @@ Section Uninstall
Sleep 500 Sleep 500
${Next} ${Next}
; Old stuff
RMDir /r "$INSTDIR\Addons"
RMDir /r "$INSTDIR\Fonts"
RMDir /r "$INSTDIR\Defaults" RMDir /r "$INSTDIR\Defaults"
RMDir /r "$INSTDIR\Languages" RMDir /r "$INSTDIR\Languages"
RMDir /r "$INSTDIR\Plugins" RMDir /r "$INSTDIR\Plugins"
RMDir /r "$INSTDIR\Skins" RMDir /r "$INSTDIR\Skins"
RMDir /r "$INSTDIR\Addons"
RMDir /r "$INSTDIR\Fonts"
Delete "$INSTDIR\Rainmeter.dll" Delete "$INSTDIR\Rainmeter.dll"
Delete "$INSTDIR\Rainmeter.exe" Delete "$INSTDIR\Rainmeter.exe"
Delete "$INSTDIR\Rainmeter.exe.config" Delete "$INSTDIR\Rainmeter.exe.config"