Skip to content

Commit 540d1fb

Browse files
authored
Improve windows build scripts (#1416)
* improve windows builds * install nasm for openssl compilation on win * install nasm for openssl compilation on win for github * add create-state, proxy-liteserver, rldp-http-proxy, http-proxy, adnl-proxy, dht-server, libtonlibjson.so and libemulator.so to docker image * build new artifacts inside Docker * add files smartcont/auto/* to docker image * build arm64 in docker branch build * improve secp256k1 build
1 parent d3d050a commit 540d1fb

File tree

5 files changed

+217
-188
lines changed

5 files changed

+217
-188
lines changed

.github/workflows/docker-ubuntu-branch-image.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
id: docker_build
4242
uses: docker/build-push-action@v6
4343
with:
44-
platforms: linux/amd64
44+
platforms: linux/amd64,linux/arm64
4545
push: true
4646
context: ./
4747
tags: |

CMake/BuildSECP256K1.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ if (NOT SECP256K1_LIBRARY)
55
set(SECP256K1_INCLUDE_DIR ${SECP256K1_BINARY_DIR}/include)
66

77
file(MAKE_DIRECTORY ${SECP256K1_BINARY_DIR})
8+
file(MAKE_DIRECTORY "${SECP256K1_BINARY_DIR}/include")
89

910
if (MSVC)
1011
set(SECP256K1_BINARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third-party/secp256k1)

Dockerfile

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,38 @@ COPY ./ ./
2020
RUN mkdir build && \
2121
cd build && \
2222
cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DPORTABLE=1 -DTON_ARCH= -DTON_USE_JEMALLOC=ON .. && \
23-
ninja storage-daemon storage-daemon-cli tonlibjson fift func validator-engine validator-engine-console generate-random-id dht-server lite-client
23+
ninja storage-daemon storage-daemon-cli tonlibjson fift func validator-engine validator-engine-console \
24+
generate-random-id dht-server lite-client tolk rldp-http-proxy dht-server proxy-liteserver create-state \
25+
blockchain-explorer emulator tonlibjson http-proxy adnl-proxy
2426

2527
FROM ubuntu:22.04
2628
RUN apt-get update && \
27-
apt-get install -y wget curl libatomic1 openssl libsodium-dev libmicrohttpd-dev liblz4-dev libjemalloc-dev htop net-tools netcat iptraf-ng jq tcpdump pv plzip && \
29+
apt-get install -y wget curl libatomic1 openssl libsodium-dev libmicrohttpd-dev liblz4-dev libjemalloc-dev htop \
30+
net-tools netcat iptraf-ng jq tcpdump pv plzip && \
2831
rm -rf /var/lib/apt/lists/*
2932

30-
RUN mkdir -p /var/ton-work/db /var/ton-work/scripts /usr/share/ton/smartcont/ /usr/lib/fift/
33+
RUN mkdir -p /var/ton-work/db /var/ton-work/scripts /usr/share/ton/smartcont/auto /usr/lib/fift/
3134

3235
COPY --from=builder /ton/build/storage/storage-daemon/storage-daemon /usr/local/bin/
3336
COPY --from=builder /ton/build/storage/storage-daemon/storage-daemon-cli /usr/local/bin/
3437
COPY --from=builder /ton/build/lite-client/lite-client /usr/local/bin/
3538
COPY --from=builder /ton/build/validator-engine/validator-engine /usr/local/bin/
3639
COPY --from=builder /ton/build/validator-engine-console/validator-engine-console /usr/local/bin/
3740
COPY --from=builder /ton/build/utils/generate-random-id /usr/local/bin/
41+
COPY --from=builder /ton/build/blockchain-explorer/blockchain-explorer /usr/local/bin/
42+
COPY --from=builder /ton/build/crypto/create-state /usr/local/bin/
43+
COPY --from=builder /ton/build/utils/proxy-liteserver /usr/local/bin/
44+
COPY --from=builder /ton/build/dht-server/dht-server /usr/local/bin/
45+
COPY --from=builder /ton/build/rldp-http-proxy/rldp-http-proxy /usr/local/bin/
46+
COPY --from=builder /ton/build/http/http-proxy /usr/local/bin/
47+
COPY --from=builder /ton/build/adnl/adnl-proxy /usr/local/bin/
48+
COPY --from=builder /ton/build/tonlib/libtonlibjson.so /usr/local/bin/
49+
COPY --from=builder /ton/build/emulator/libemulator.so /usr/local/bin/
50+
COPY --from=builder /ton/build/tolk/tolk /usr/local/bin/
3851
COPY --from=builder /ton/build/crypto/fift /usr/local/bin/
3952
COPY --from=builder /ton/build/crypto/func /usr/local/bin/
4053
COPY --from=builder /ton/crypto/smartcont/* /usr/share/ton/smartcont/
54+
COPY --from=builder /ton/crypto/smartcont/auto/* /usr/share/ton/smartcont/auto/
4155
COPY --from=builder /ton/crypto/fift/lib/* /usr/lib/fift/
4256

4357
WORKDIR /var/ton-work/db

assembly/native/build-windows-2019.bat

Lines changed: 99 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -26,106 +26,109 @@ IF %errorlevel% NEQ 0 (
2626
exit /b %errorlevel%
2727
)
2828

29-
if not exist "zlib" (
30-
git clone https://github.com/madler/zlib.git
31-
cd zlib
32-
git checkout v1.3.1
33-
cd contrib\vstudio\vc14
34-
msbuild zlibstat.vcxproj /p:Configuration=ReleaseWithoutAsm /p:platform=x64 -p:PlatformToolset=v142
35-
29+
echo Installing nasm...
30+
choco install -y nasm
31+
where nasm
32+
SET PATH=%PATH%;C:\Program Files\NASM
3633
IF %errorlevel% NEQ 0 (
37-
echo Can't install zlib
34+
echo Can't install nasm
3835
exit /b %errorlevel%
3936
)
40-
cd ..\..\..\..
41-
) else (
42-
echo Using zlib...
43-
)
4437

45-
if not exist "lz4" (
46-
git clone https://github.com/lz4/lz4.git
47-
cd lz4
48-
git checkout v1.9.4
49-
cd build\VS2017\liblz4
50-
msbuild liblz4.vcxproj /p:Configuration=Release /p:platform=x64 -p:PlatformToolset=v142
38+
mkdir third_libs
39+
cd third_libs
5140

52-
IF %errorlevel% NEQ 0 (
53-
echo Can't install lz4
54-
exit /b %errorlevel%
55-
)
56-
cd ..\..\..\..
41+
set third_libs=%cd%
42+
echo %third_libs%
43+
44+
if not exist "zlib" (
45+
git clone https://github.com/madler/zlib.git
46+
cd zlib
47+
git checkout v1.3.1
48+
cd contrib\vstudio\vc14
49+
msbuild zlibstat.vcxproj /p:Configuration=ReleaseWithoutAsm /p:platform=x64 -p:PlatformToolset=v142
50+
cd ..\..\..\..
5751
) else (
58-
echo Using lz4...
52+
echo Using zlib...
5953
)
6054

61-
curl --retry 5 --retry-delay 10 -Lo libsodium-1.0.18-stable-msvc.zip https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-stable-msvc.zip
62-
IF %errorlevel% NEQ 0 (
63-
echo Can't download libsodium
64-
exit /b %errorlevel%
65-
)
66-
unzip libsodium-1.0.18-stable-msvc.zip
55+
if not exist "lz4" (
56+
git clone https://github.com/lz4/lz4.git
57+
cd lz4
58+
git checkout v1.9.4
59+
cd build\VS2017\liblz4
60+
msbuild liblz4.vcxproj /p:Configuration=Release /p:platform=x64 -p:PlatformToolset=v142
61+
cd ..\..\..\..
6762
) else (
68-
echo Using libsodium...
63+
echo Using lz4...
6964
)
7065

71-
if not exist "openssl-3.1.4" (
72-
curl -Lo openssl-3.1.4.zip https://github.com/neodiX42/precompiled-openssl-win64/raw/main/openssl-3.1.4.zip
73-
IF %errorlevel% NEQ 0 (
74-
echo Can't download OpenSSL
75-
exit /b %errorlevel%
76-
)
77-
unzip -q openssl-3.1.4.zip
66+
if not exist "libsodium" (
67+
git clone https://github.com/jedisct1/libsodium
68+
cd libsodium
69+
git checkout 1.0.18-RELEASE
70+
msbuild libsodium.vcxproj /p:Configuration=Release /p:platform=x64 -p:PlatformToolset=v142
71+
cd ..
7872
) else (
79-
echo Using openssl...
73+
echo Using libsodium...
8074
)
8175

82-
if not exist "libmicrohttpd-0.9.77-w32-bin" (
83-
curl -Lo libmicrohttpd-0.9.77-w32-bin.zip https://github.com/neodiX42/precompiled-openssl-win64/raw/main/libmicrohttpd-0.9.77-w32-bin.zip
84-
IF %errorlevel% NEQ 0 (
85-
echo Can't download libmicrohttpd
86-
exit /b %errorlevel%
87-
)
88-
unzip -q libmicrohttpd-0.9.77-w32-bin.zip
76+
if not exist "openssl" (
77+
git clone https://github.com/openssl/openssl.git
78+
cd openssl
79+
git checkout openssl-3.1.4
80+
where perl
81+
perl Configure VC-WIN64A
82+
IF %errorlevel% NEQ 0 (
83+
echo Can't configure openssl
84+
exit /b %errorlevel%
85+
)
86+
nmake
87+
cd ..
8988
) else (
90-
echo Using libmicrohttpd...
89+
echo Using openssl...
9190
)
9291

93-
if not exist "readline-5.0-1-lib" (
94-
curl -Lo readline-5.0-1-lib.zip https://github.com/neodiX42/precompiled-openssl-win64/raw/main/readline-5.0-1-lib.zip
95-
IF %errorlevel% NEQ 0 (
96-
echo Can't download readline
97-
exit /b %errorlevel%
98-
)
99-
unzip -q -d readline-5.0-1-lib readline-5.0-1-lib.zip
92+
if not exist "libmicrohttpd" (
93+
git clone https://github.com/Karlson2k/libmicrohttpd.git
94+
cd libmicrohttpd
95+
git checkout v1.0.1
96+
cd w32\VS2019
97+
msbuild libmicrohttpd.vcxproj /p:Configuration=Release-static /p:platform=x64 -p:PlatformToolset=v142
98+
IF %errorlevel% NEQ 0 (
99+
echo Can't compile libmicrohttpd
100+
exit /b %errorlevel%
101+
)
102+
cd ../../..
100103
) else (
101-
echo Using readline...
104+
echo Using libmicrohttpd...
102105
)
103106

104-
105-
set root=%cd%
106-
echo %root%
107-
set SODIUM_DIR=%root%\libsodium
107+
cd ..
108+
echo Current dir %cd%
108109

109110
mkdir build
110111
cd build
111112
cmake -GNinja -DCMAKE_BUILD_TYPE=Release ^
112113
-DPORTABLE=1 ^
113114
-DSODIUM_USE_STATIC_LIBS=1 ^
115+
-DSODIUM_LIBRARY_RELEASE=%third_libs%\libsodium\Build\Release\x64\libsodium.lib ^
116+
-DSODIUM_LIBRARY_DEBUG=%third_libs%\libsodium\Build\Release\x64\libsodium.lib ^
117+
-DSODIUM_INCLUDE_DIR=%third_libs%\libsodium\src\libsodium\include ^
114118
-DLZ4_FOUND=1 ^
115-
-DLZ4_INCLUDE_DIRS=%root%\lz4\lib ^
116-
-DLZ4_LIBRARIES=%root%\lz4\build\VS2017\liblz4\bin\x64_Release\liblz4_static.lib ^
119+
-DLZ4_INCLUDE_DIRS=%third_libs%\lz4\lib ^
120+
-DLZ4_LIBRARIES=%third_libs%\lz4\build\VS2017\liblz4\bin\x64_Release\liblz4_static.lib ^
117121
-DMHD_FOUND=1 ^
118-
-DMHD_LIBRARY=%root%\libmicrohttpd-0.9.77-w32-bin\x86_64\VS2019\Release-static\libmicrohttpd.lib ^
119-
-DMHD_INCLUDE_DIR=%root%\libmicrohttpd-0.9.77-w32-bin\x86_64\VS2019\Release-static ^
122+
-DMHD_LIBRARY=%third_libs%\libmicrohttpd\w32\VS2019\Output\x64\libmicrohttpd.lib ^
123+
-DMHD_INCLUDE_DIR=%third_libs%\libmicrohttpd\src\include ^
120124
-DZLIB_FOUND=1 ^
121-
-DZLIB_INCLUDE_DIR=%root%\zlib ^
122-
-DZLIB_LIBRARIES=%root%\zlib\contrib\vstudio\vc14\x64\ZlibStatReleaseWithoutAsm\zlibstat.lib ^
125+
-DZLIB_INCLUDE_DIR=%third_libs%\zlib ^
126+
-DZLIB_LIBRARIES=%third_libs%\zlib\contrib\vstudio\vc14\x64\ZlibStatReleaseWithoutAsm\zlibstat.lib ^
123127
-DOPENSSL_FOUND=1 ^
124-
-DOPENSSL_INCLUDE_DIR=%root%\openssl-3.1.4\x64\include ^
125-
-DOPENSSL_CRYPTO_LIBRARY=%root%\openssl-3.1.4\x64\lib\libcrypto_static.lib ^
126-
-DREADLINE_INCLUDE_DIR=%root%\readline-5.0-1-lib\include ^
127-
-DREADLINE_LIBRARY=%root%\readline-5.0-1-lib\lib\readline.lib ^
128+
-DOPENSSL_INCLUDE_DIR=%third_libs%\openssl\include ^
129+
-DOPENSSL_CRYPTO_LIBRARY=%third_libs%\openssl\libcrypto_static.lib ^
128130
-DCMAKE_CXX_FLAGS="/DTD_WINDOWS=1 /EHsc /bigobj" ..
131+
129132
IF %errorlevel% NEQ 0 (
130133
echo Can't configure TON
131134
exit /b %errorlevel%
@@ -168,33 +171,38 @@ REM ctest -C Release --output-on-failure -E "test-catchain|test-actors|test-val
168171
)
169172
)
170173

171-
172-
echo Creating artifacts...
174+
echo Strip and copy artifacts
173175
cd ..
176+
echo where strip
177+
where strip
174178
mkdir artifacts
175179
mkdir artifacts\smartcont
176180
mkdir artifacts\lib
177181

178182
for %%I in (build\storage\storage-daemon\storage-daemon.exe ^
179-
build\storage\storage-daemon\storage-daemon-cli.exe ^
180-
build\blockchain-explorer\blockchain-explorer.exe ^
181-
build\crypto\fift.exe ^
182-
build\crypto\tlbc.exe ^
183-
build\crypto\func.exe ^
184-
build\tolk\tolk.exe ^
185-
build\crypto\create-state.exe ^
186-
build\validator-engine-console\validator-engine-console.exe ^
187-
build\tonlib\tonlib-cli.exe ^
188-
build\tonlib\tonlibjson.dll ^
189-
build\http\http-proxy.exe ^
190-
build\rldp-http-proxy\rldp-http-proxy.exe ^
191-
build\dht-server\dht-server.exe ^
192-
build\lite-client\lite-client.exe ^
193-
build\validator-engine\validator-engine.exe ^
194-
build\utils\generate-random-id.exe ^
195-
build\utils\json2tlo.exe ^
196-
build\utils\proxy-liteserver.exe ^
197-
build\adnl\adnl-proxy.exe ^
198-
build\emulator\emulator.dll) do (strip -s %%I & copy %%I artifacts\)
183+
build\storage\storage-daemon\storage-daemon-cli.exe ^
184+
build\blockchain-explorer\blockchain-explorer.exe ^
185+
build\crypto\fift.exe ^
186+
build\crypto\tlbc.exe ^
187+
build\crypto\func.exe ^
188+
build\tolk\tolk.exe ^
189+
build\crypto\create-state.exe ^
190+
build\validator-engine-console\validator-engine-console.exe ^
191+
build\tonlib\tonlib-cli.exe ^
192+
build\tonlib\tonlibjson.dll ^
193+
build\http\http-proxy.exe ^
194+
build\rldp-http-proxy\rldp-http-proxy.exe ^
195+
build\dht-server\dht-server.exe ^
196+
build\lite-client\lite-client.exe ^
197+
build\validator-engine\validator-engine.exe ^
198+
build\utils\generate-random-id.exe ^
199+
build\utils\json2tlo.exe ^
200+
build\utils\proxy-liteserver.exe ^
201+
build\adnl\adnl-proxy.exe ^
202+
build\emulator\emulator.dll) do (
203+
echo strip -s %%I & copy %%I artifacts\
204+
strip -s %%I & copy %%I artifacts\
205+
)
206+
199207
xcopy /e /k /h /i crypto\smartcont artifacts\smartcont
200208
xcopy /e /k /h /i crypto\fift\lib artifacts\lib

0 commit comments

Comments
 (0)