/
build-installer-win64.bat
151 lines (131 loc) · 6.23 KB
/
build-installer-win64.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
rem DEPENDENCIES:
rem 1. Node.js ('npm' binary in PATH)
rem 2. 7zip ('7z' binary in PATH)
rem
rem installer dev mode: set SKIP_TOOLS/SKIP_NODE/SKIP_CARDANO_FETCH/SKIP_STACK/SKIP_LIBS/SKIP_TO_FRONTEND/SKIP_TO_INSTALLER
set /p CLUSTERS=<installer-clusters.cfg
@echo ##############################################################################
@echo ###
@echo ### Will build clusters: %CLUSTERS%
@echo ###
@echo ##############################################################################
set LIBRESSL_VERSION=2.5.3
set CURL_VERSION=7.54.0
set DAEDALUS_VERSION_DEFAULT=local-dev-build
set DAEDALUS_VERSION=%1
@if [%DAEDALUS_VERSION%]==[] (@echo WARNING: DAEDALUS_VERSION [argument #1] wasnt provided, defaulting to %DAEDALUS_VERSION_DEFAULT%
set DAEDALUS_VERSION=%DAEDALUS_VERSION_DEFAULT%);
set CURL_URL=https://bintray.com/artifact/download/vszakats/generic/curl-%CURL_VERSION%-win64-mingw.7z
set CURL_BIN=curl-%CURL_VERSION%-win64-mingw\bin
set LIBRESSL_URL=https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-%LIBRESSL_VERSION%-windows.zip
set DLLS_URL=https://s3.eu-central-1.amazonaws.com/daedalus-ci-binaries/DLLs.zip
@echo Building Daedalus version: %DAEDALUS_VERSION%
@echo ..with LibreSSL version: %LIBRESSL_VERSION%
@echo .
@if not [%SKIP_TO_INSTALLER%]==[] (@echo WARNING: SKIP_TO_INSTALLER active, skipping to frontend packaging
pushd installers & goto :build_installers)
@if not [%SKIP_TO_FRONTEND%]==[] (@echo WARNING: SKIP_TO_FRONTEND active, skipping directly to installer rebuild
pushd installers & goto :build_frontend)
@if not [%SKIP_TOOLS%]==[] (@echo WARNING: SKIP_TOOLS active, skipping installing tools
goto :after_tools)
@echo ##############################################################################
@echo ###
@echo ### Installing tools: curl, 7z
@echo ###
@echo ##############################################################################
powershell -Command "try { Import-Module BitsTransfer; Start-BitsTransfer -Source '%CURL_URL%' -Destination 'curl.7z'; } catch { exit 1; }"
@if %errorlevel% neq 0 (@echo FAILED: couldn't obtain curl from %CURL_URL% using BITS
popd & exit /b 1)
del /f curl.exe curl-ca-bundle.crt libcurl.dll
7z e curl.7z %CURL_BIN%\curl.exe %CURL_BIN%\curl-ca-bundle.crt %CURL_BIN%\libcurl.dll
@if %errorlevel% neq 0 (@echo FAILED: couldn't extract curl from downloaded archive
popd & exit /b 1)
:after_tools
@if not [%SKIP_NODE%]==[] (@echo WARNING: SKIP_NODE active, skipping Node dependencies
goto :after_node)
@echo ##############################################################################
@echo ###
@echo ### Installing Node dependencies
@echo ###
@echo ##############################################################################
call npm install
@if %errorlevel% neq 0 (@echo FAILED: npm install
exit /b 1)
:after_node
@echo ##############################################################################
@echo ###
@echo ### Preparing installer generator
@echo ###
@echo ##############################################################################
pushd installers
@if not [%SKIP_LIBS%]==[] (@echo WARNING: SKIP_LIBS active, skipping lib installation
goto :after_libs)
del /f LibreSSL.zip 2>nul
@echo Obtaining LibreSSL %LIBRESSL_VERSION%
..\curl %LIBRESSL_URL% -o LibreSSL.zip
@if %errorlevel% neq 0 (@echo FAILED: LibreSSL couldn't be obtained
popd & exit /b 1)
7z x LibreSSL.zip
@if %errorlevel% neq 0 (@echo FAILED: LibreSSL couldn't be extracted from downloaded archive
popd & exit /b 1)
del LibreSSL.zip
rmdir /s/q libressl
move libressl-%LIBRESSL_VERSION%-windows libressl
@echo Copying DLLs
@rem TODO: get rocksdb from rocksdb-haskell
rmdir /s/q DLLs 2>nul
mkdir DLLs
pushd DLLs
..\..\curl --location %DLLS_URL% -o DLLs.zip
@if %errorlevel% neq 0 (@echo FAILED: couldn't obtain CardanoSL DLL package
exit /b 1)
7z x DLLs.zip
@if %errorlevel% neq 0 (@echo FAILED: 7z x DLLs.zip
popd & popd & exit /b 1)
del DLLs.zip
popd
:after_libs
@if not [%SKIP_STACK%]==[] (@echo "WARNING: SKIP_STACK active, skipping stack setup"
goto :after_stack)
@echo ##############################################################################
@echo ###
@echo ### Installing stack
@echo ###
@echo ##############################################################################
..\curl --location http://www.stackage.org/stack/windows-x86_64 -o stack.zip
@if %errorlevel% neq 0 (@echo FAILED: stack couldn't be obtained
popd & exit /b 1)
del /f stack.exe 2>nul
7z x stack.zip stack.exe
@if %errorlevel% neq 0 (@echo FAILED: couldn't extract stack from the distribution package
exit /b 1)
del stack.zip
stack setup --no-reinstall >/nul
:after_stack
FOR /F "tokens=* USEBACKQ" %%F IN (`stack path --local-bin`) DO (
SET PATHEXTN=%%F)
set PATH=%PATH%;%PATHEXTN%
@echo ##############################################################################
@echo ###
@echo ### Building installer generator
@echo ###
@echo ##############################################################################
call ..\scripts\appveyor-retry stack --no-terminal -j 2 install daedalus-installer
@if %errorlevel% neq 0 (@echo FATAL: persistent failure while installing daedalus-installer
popd & exit /b 1)
:build_installers
if NOT DEFINED APPVEYOR_BUILD_NUMBER ( set APPVEYOR_BUILD_NUMBER=0 )
set XARGS="--build-job %APPVEYOR_BUILD_NUMBER% -v %DAEDALUS_VERSION%"
IF DEFINED APPVEYOR_PULL_REQUEST_NUMBER ( set XARGS="%XARGS:"=% --pull-request %APPVEYOR_PULL_REQUEST_NUMBER%" )
FOR %%C IN (%CLUSTERS:"=%) DO (
@echo ##############################################################################
@echo ###
@echo ### Building fo-r cluster %%C
@echo ###
@echo ##############################################################################
make-installer %XARGS:"=% -c %%C -o daedalus-0.10.1-cardano-sl-%DAEDALUS_VERSION%-%%C-windows.exe
@if %errorlevel% neq 0 ( @echo FATAL: failed to build installer
popd & exit /b 1)
copy /y launcher-config.yaml launcher-config-%%C.win64.yaml
copy /y wallet-topology.yaml wallet-topology-%%C.win64.yaml
)