Permalink
Browse files

Update BUILD.CMD for VS2010. Clean up code in BUILD.CMD. Replace GetV…

…ersion.nsi with Sigcheck.
  • Loading branch information...
1 parent 79dad7e commit 59e09e376225404e73cfb03d200634401eeab929 rmcardle committed Dec 9, 2011
Showing with 37 additions and 45 deletions.
  1. +37 −15 BUILD.CMD
  2. +0 −30 Installer/GetVersion.nsi
View
@@ -1,17 +1,22 @@
@echo off
-REM SET VERSIONTAG=RC5
+setlocal enabledelayedexpansion
-SET VCVARSALL="%ProgramFiles(x86)%\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"
-SET DEVENV="devenv.exe"
-SET MAKENSIS="%ProgramFiles(x86)%\NSIS\Unicode\makensis.exe"
-SET RAR="%ProgramFiles%\WinRAR\WinRAR.exe"
-SET SIGNCMD=signtool.exe sign /n "Next Generation Software" /sha1 "c4ece717747eb7d0cac824f6c7431e5237138b02" /t http://timestamp.verisign.com/scripts/timstamp.dll
+set VERSIONTAG=
-call %VCVARSALL% x86 > NUL 2>&1
+set VCVARSALL="%ProgramFiles(x86)%\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
+set DEVENV="devenv.exe"
+set MAKENSIS="%ProgramFiles(x86)%\NSIS\Unicode\makensis.exe"
+set RAR="%ProgramFiles%\WinRAR\WinRAR.exe"
+set SIGNCMD=signtool.exe sign /n "Next Generation Software" /sha1 "c4ece717747eb7d0cac824f6c7431e5237138b02" /t http://timestamp.verisign.com/scripts/timstamp.dll
-rmdir /s /q "%~dp0\mRemoteV1\bin" > NUL 2>&1
-rmdir /s /q "%~dp0\mRemoteV1\obj" > NUL 2>&1
+rem Windows Sysinternals Sigcheck from http://technet.microsoft.com/en-us/sysinternals/bb897441
+set SIGCHECK="%ProgramFiles(x86)%\Sigcheck\sigcheck.exe"
+
+call %VCVARSALL% x86
+
+rmdir /s /q "%~dp0\mRemoteV1\bin" > nul 2>&1
+rmdir /s /q "%~dp0\mRemoteV1\obj" > nul 2>&1
echo Building release version...
%DEVENV% "%~dp0\mRemoteV1.sln" /build "Release"
@@ -22,12 +27,22 @@ echo Building portable version...
echo Signing binaries...
%SIGNCMD% "%~dp0\mRemoteV1\bin\Release\de\mRemoteNG.resources.dll" "%~dp0\mRemoteV1\bin\Release\en-US\mRemoteNG.resources.dll" "%~dp0\mRemoteV1\bin\Release\fr\mRemoteNG.resources.dll" "%~dp0\mRemoteV1\bin\Release\AxInterop.WFICALib.dll" "%~dp0\mRemoteV1\bin\Release\AxInterop.MSTSCLib.dll" "%~dp0\mRemoteV1\bin\Release\Interop.WFICALib.dll" "%~dp0\mRemoteV1\bin\Release\Interop.ShDocVw.dll" "%~dp0\mRemoteV1\bin\Release\Interop.MSTSCLib.dll" "%~dp0\mRemoteV1\bin\Release\Interop.EOLWTSCOM.dll" "%~dp0\mRemoteV1\bin\Release\Interop.EOLWTSCOM.dll" "%~dp0\mRemoteV1\bin\Release\mRemoteNG.exe" "%~dp0\mRemoteV1\bin\Release Portable\de\mRemoteNG.resources.dll" "%~dp0\mRemoteV1\bin\Release Portable\en-US\mRemoteNG.resources.dll" "%~dp0\mRemoteV1\bin\Release Portable\fr\mRemoteNG.resources.dll" "%~dp0\mRemoteV1\bin\Release Portable\AxInterop.WFICALib.dll" "%~dp0\mRemoteV1\bin\Release Portable\AxInterop.MSTSCLib.dll" "%~dp0\mRemoteV1\bin\Release Portable\Interop.WFICALib.dll" "%~dp0\mRemoteV1\bin\Release Portable\Interop.ShDocVw.dll" "%~dp0\mRemoteV1\bin\Release Portable\Interop.MSTSCLib.dll" "%~dp0\mRemoteV1\bin\Release Portable\Interop.EOLWTSCOM.dll" "%~dp0\mRemoteV1\bin\Release Portable\Interop.EOLWTSCOM.dll" "%~dp0\mRemoteV1\bin\Release Portable\mRemoteNG.exe"
-mkdir "%~dp0\Release"
+mkdir "%~dp0\Release" > nul 2>&1
echo Getting product version...
-%MAKENSIS% "%~dp0\Installer\GetVersion.nsi"
-"%~dp0\Release\GetVersion.exe"
-call "%~dp0\Release\Version.cmd"
+set VERSIONNSH="%~dp0\Release\Version.nsh"
+set SIGCHECK=!SIGCHECK:"=^"!
+set SIGCHECK=!SIGCHECK: =^^ !
+set SIGCHECK=!SIGCHECK:(=^^(!
+set SIGCHECK=!SIGCHECK:)=^^)!
+for /F "usebackq delims=. tokens=1-4" %%i in (`!SIGCHECK! /accepteula -q -n "%~dp0\mRemoteV1\bin\Release\mRemoteNG.exe"`) do (
+ set PRODUCT_VERSION_SHORT=%%i.%%j
+ echo ^^!define PRODUCT_VERSION "%%i.%%j.%%k.%%l" > %VERSIONNSH%
+ echo ^^!define PRODUCT_VERSION_SHORT "%%i.%%j" >> %VERSIONNSH%
+ echo ^^!define PRODUCT_VERSION_MAJOR "%%i" >> %VERSIONNSH%
+ echo ^^!define PRODUCT_VERSION_MINOR "%%j" >> %VERSIONNSH%
+)
+echo Version is %PRODUCT_VERSION_SHORT%
echo Creating installer package...
if defined VERSIONTAG (
@@ -44,17 +59,24 @@ if defined VERSIONTAG (
set PORTABLEZIP="%~dp0\Release\mRemoteNG-Portable-%PRODUCT_VERSION_SHORT%.zip"
)
+del %VERSIONNSH%
+
echo Signing installer package...
%SIGNCMD% %INSTALLEREXE%
echo Creating release ZIP file...
-del /f /q %BINARYZIP% > NUL 2>&1
+del /f /q %BINARYZIP% > nul 2>&1
%RAR% a -m5 -r -ep1 -afzip -inul %BINARYZIP% "%~dp0\mRemoteV1\bin\Release\*.*"
%RAR% a -m5 -r -ep1 -afzip -inul %BINARYZIP% "%~dp0\Installer\Dependencies\*.*"
%RAR% a -m5 -ep -afzip -inul %BINARYZIP% "%~dp0\*.TXT"
echo Creating portable ZIP file...
-del /f /q %PORTABLEZIP% > NUL 2>&1
+del /f /q %PORTABLEZIP% > nul 2>&1
%RAR% a -m5 -r -ep1 -afzip -inul %PORTABLEZIP% "%~dp0\mRemoteV1\bin\Release Portable\*.*"
%RAR% a -m5 -r -ep1 -afzip -inul %PORTABLEZIP% "%~dp0\Installer\Dependencies\*.*"
%RAR% a -m5 -ep -afzip -inul %PORTABLEZIP% "%~dp0\*.TXT"
+
+echo.
+echo Build process complete.
+echo.
+pause
View
@@ -1,30 +0,0 @@
-!define AppFile "$EXEDIR\..\mRemoteV1\bin\Release\mRemoteNG.exe"
-!define VersionCmdFile "$EXEDIR\Version.cmd"
-!define VersionNshFile "$EXEDIR\Version.nsh"
-
-OutFile "..\Release\GetVersion.exe"
-SilentInstall silent
-RequestExecutionLevel user
-
-Section
- ## Get file version
- GetDllVersion "${AppFile}" $R0 $R1
- IntOp $R3 $R0 / 0x00010000
- IntOp $R4 $R0 & 0x0000FFFF
- IntOp $R5 $R1 / 0x00010000
- IntOp $R6 $R1 & 0x0000FFFF
- StrCpy $R1 "$R3.$R4.$R5.$R6"
- StrCpy $R2 "$R3.$R4"
-
- FileOpen $R0 "${VersionCmdFile}" w
- FileWrite $R0 '@echo off$\r$\n'
- FileWrite $R0 'SET PRODUCT_VERSION_SHORT=$R2$\r$\n'
- FileClose $R0
-
- FileOpen $R0 "${VersionNshFile}" w
- FileWrite $R0 '!define PRODUCT_VERSION "$R1"$\r$\n'
- FileWrite $R0 '!define PRODUCT_VERSION_SHORT "$R2"$\r$\n'
- FileWrite $R0 '!define PRODUCT_VERSION_MAJOR "$R3"$\r$\n'
- FileWrite $R0 '!define PRODUCT_VERSION_MINOR "$R4"$\r$\n'
- FileClose $R0
-SectionEnd

0 comments on commit 59e09e3

Please sign in to comment.