forked from mRemoteNG/mRemoteNG
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBUILD.CMD
82 lines (63 loc) · 4.16 KB
/
BUILD.CMD
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
@echo off
setlocal enabledelayedexpansion
set VERSIONTAG=
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
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"
echo Building portable version...
%DEVENV% "%~dp0\mRemoteV1.sln" /build "Release Portable"
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" > nul 2>&1
echo Getting product version...
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 (
%MAKENSIS% /DPRODUCT_VERSION_TAG=%VERSIONTAG% "%~dp0\Installer\mRemote.nsi"
set INSTALLEREXE="%~dp0\Release\mRemoteNG-Installer-%PRODUCT_VERSION_SHORT%-%VERSIONTAG%.exe"
set BINARYZIP="%~dp0\Release\mRemoteNG-%PRODUCT_VERSION_SHORT%-%VERSIONTAG%.zip"
set PORTABLEZIP="%~dp0\Release\mRemoteNG-Portable-%PRODUCT_VERSION_SHORT%-%VERSIONTAG%.zip"
) else (
%MAKENSIS% "%~dp0\Installer\mRemote.nsi"
set INSTALLEREXE="%~dp0\Release\mRemoteNG-Installer-%PRODUCT_VERSION_SHORT%.exe"
set BINARYZIP="%~dp0\Release\mRemoteNG-%PRODUCT_VERSION_SHORT%.zip"
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
%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
%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