-
Notifications
You must be signed in to change notification settings - Fork 48
/
build_ualds.bat
68 lines (53 loc) · 1.91 KB
/
build_ualds.bat
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
@ECHO off
REM ****************************************************************************************************************
REM ** This script builds the UA-LDS.
REM ** This must be run from a Visual Studio command line.
REM ****************************************************************************************************************
SETLOCAL
set SRCDIR=%~dp0
set INSTALLDIR=%~dp0
set SIGNTOOL=C:\Build\sign_output.bat
set ZIP="C:\Program Files\7-zip\7z.exe"
set VS_CONFIG=RelWithDebInfo
set LDSFN=OPC UA Local Discovery Server
set GIT=C:\Program Files\Git\bin\git.exe
IF NOT EXIST "%GIT%" SET GIT=C:\Program Files (x86)\Git\bin\git.exe
ECHO STEP 1) Deleting Output Directories
REM IF EXIST %INSTALLDIR%\bin rmdir /s /q %INSTALLDIR%\bin
IF "%1"=="no-stack" GOTO noStack
ECHO STEP 2) Fetch OpenSSL
REM IF EXIST %INSTALLDIR%\stack\openssl rmdir /s /q %INSTALLDIR%\stack\openssl
CALL fetch_openssl.bat
ECHO STEP 3) Building Stack
cd %SRCDIR%\stack
CALL build_win32.bat
set code=%errorlevel%
if not %code%==0 goto :error
:noStack
ECHO STEP 4) Update Build Number
cd %SRCDIR%
IF NOT DEFINED BUILD_VERSION SET BUILD_VERSION=413
IF NOT DEFINED BUILD_NUMBER SET BUILD_NUMBER=1
ECHO Building Version: %BUILD_VERSION%.%BUILD_NUMBER%
perl -pi.bak -e "s/XXX/%BUILD_VERSION%/;" .\config.h
perl -pi.bak -e "s/YYY/%BUILD_NUMBER%/;" .\config.h
del /Q *.bak
ECHO STEP 5) Building LDS
cd %SRCDIR%
CALL build_win32.bat
set code=%errorlevel%
if not %code%==0 goto :error
ECHO STEP 6) Sign the Binaries
IF EXIST "%SIGNTOOL%" CALL "%SIGNTOOL%" %INSTALLDIR%\build\bin\%VS_CONFIG%\*.dll /dual
IF EXIST "%SIGNTOOL%" CALL "%SIGNTOOL%" %INSTALLDIR%\build\bin\%VS_CONFIG%\*.exe /dual
ECHO STEP 7) ZIP the Binaries
%ZIP% a "%LDSFN%.zip" "%INSTALLDIR%\build\bin\%VS_CONFIG%\*.exe"
%ZIP% a "%LDSFN%.zip" "%INSTALLDIR%\build\bin\%VS_CONFIG%\*.dll"
goto :end
:error
echo build failed with exit code %code%
popd
exit /b %code%
:end
ECHO *** ALL DONE ***
ENDLOCAL