|
| 1 | +REM execute this script inside elevated (Run as Administrator) console "x64 Native Tools Command Prompt for VS 2022" |
| 2 | + |
| 3 | +echo off |
| 4 | + |
| 5 | +echo Installing chocolatey windows package manager... |
| 6 | +@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" |
| 7 | +choco -? |
| 8 | +IF %errorlevel% NEQ 0 ( |
| 9 | + echo Can't install chocolatey |
| 10 | + exit /b %errorlevel% |
| 11 | +) |
| 12 | + |
| 13 | +choco feature enable -n allowEmptyChecksums |
| 14 | + |
| 15 | +echo Installing pkgconfiglite... |
| 16 | +choco install -y pkgconfiglite |
| 17 | +IF %errorlevel% NEQ 0 ( |
| 18 | + echo Can't install pkgconfiglite |
| 19 | + exit /b %errorlevel% |
| 20 | +) |
| 21 | + |
| 22 | +echo Installing ninja... |
| 23 | +choco install -y ninja |
| 24 | +IF %errorlevel% NEQ 0 ( |
| 25 | + echo Can't install ninja |
| 26 | + exit /b %errorlevel% |
| 27 | +) |
| 28 | + |
| 29 | +echo Installing ccache... |
| 30 | +choco install -y ccache |
| 31 | +IF %errorlevel% NEQ 0 ( |
| 32 | + echo Can't install ccache |
| 33 | + exit /b %errorlevel% |
| 34 | +) |
| 35 | + |
| 36 | +echo Installing nasm... |
| 37 | +choco install -y nasm |
| 38 | +where nasm |
| 39 | +SET PATH=%PATH%;C:\Program Files\NASM |
| 40 | +IF %errorlevel% NEQ 0 ( |
| 41 | + echo Can't install nasm |
| 42 | + exit /b %errorlevel% |
| 43 | +) |
| 44 | + |
| 45 | +if not exist "third_libs" ( |
| 46 | + mkdir "third_libs" |
| 47 | +) |
| 48 | +cd third_libs |
| 49 | + |
| 50 | +set third_libs=%cd% |
| 51 | +echo %third_libs% |
| 52 | + |
| 53 | +if not exist "zlib" ( |
| 54 | + git clone https://github.com/madler/zlib.git |
| 55 | + cd zlib |
| 56 | + git checkout v1.3.1 |
| 57 | + cd contrib\vstudio\vc14 |
| 58 | + msbuild zlibstat.vcxproj /p:Configuration=ReleaseWithoutAsm /p:platform=x64 -p:PlatformToolset=v143 |
| 59 | + cd ..\..\..\.. |
| 60 | +) else ( |
| 61 | + echo Using zlib... |
| 62 | +) |
| 63 | + |
| 64 | +if not exist "lz4" ( |
| 65 | + git clone https://github.com/lz4/lz4.git |
| 66 | + cd lz4 |
| 67 | + git checkout v1.9.4 |
| 68 | + cd build\VS2022\liblz4 |
| 69 | + msbuild liblz4.vcxproj /p:Configuration=Release /p:platform=x64 -p:PlatformToolset=v143 |
| 70 | + cd ..\..\..\.. |
| 71 | +) else ( |
| 72 | + echo Using lz4... |
| 73 | +) |
| 74 | + |
| 75 | +if not exist "libsodium" ( |
| 76 | + git clone https://github.com/jedisct1/libsodium |
| 77 | + cd libsodium |
| 78 | + git checkout 1.0.18-RELEASE |
| 79 | + msbuild libsodium.vcxproj /p:Configuration=Release /p:platform=x64 -p:PlatformToolset=v143 |
| 80 | + cd .. |
| 81 | +) else ( |
| 82 | + echo Using libsodium... |
| 83 | +) |
| 84 | + |
| 85 | +if not exist "openssl" ( |
| 86 | + git clone https://github.com/openssl/openssl.git |
| 87 | + cd openssl |
| 88 | + git checkout openssl-3.1.4 |
| 89 | + where perl |
| 90 | + perl Configure VC-WIN64A |
| 91 | + IF %errorlevel% NEQ 0 ( |
| 92 | + echo Can't configure openssl |
| 93 | + exit /b %errorlevel% |
| 94 | + ) |
| 95 | + nmake |
| 96 | + cd .. |
| 97 | +) else ( |
| 98 | + echo Using openssl... |
| 99 | +) |
| 100 | + |
| 101 | +if not exist "libmicrohttpd" ( |
| 102 | + git clone https://github.com/Karlson2k/libmicrohttpd.git |
| 103 | + cd libmicrohttpd |
| 104 | + git checkout v1.0.1 |
| 105 | + cd w32\VS2022 |
| 106 | + msbuild libmicrohttpd.vcxproj /p:Configuration=Release-static /p:platform=x64 -p:PlatformToolset=v143 |
| 107 | + IF %errorlevel% NEQ 0 ( |
| 108 | + echo Can't compile libmicrohttpd |
| 109 | + exit /b %errorlevel% |
| 110 | + ) |
| 111 | + cd ../../.. |
| 112 | +) else ( |
| 113 | + echo Using libmicrohttpd... |
| 114 | +) |
| 115 | + |
| 116 | +cd .. |
| 117 | +echo Current dir %cd% |
| 118 | + |
| 119 | +mkdir build |
| 120 | +cd build |
| 121 | +cmake -GNinja -DCMAKE_BUILD_TYPE=Release ^ |
| 122 | +-DPORTABLE=1 ^ |
| 123 | +-DSODIUM_USE_STATIC_LIBS=1 ^ |
| 124 | +-DSODIUM_LIBRARY_RELEASE=%third_libs%\libsodium\Build\Release\x64\libsodium.lib ^ |
| 125 | +-DSODIUM_LIBRARY_DEBUG=%third_libs%\libsodium\Build\Release\x64\libsodium.lib ^ |
| 126 | +-DSODIUM_INCLUDE_DIR=%third_libs%\libsodium\src\libsodium\include ^ |
| 127 | +-DLZ4_FOUND=1 ^ |
| 128 | +-DLZ4_INCLUDE_DIRS=%third_libs%\lz4\lib ^ |
| 129 | +-DLZ4_LIBRARIES=%third_libs%\lz4\build\VS2022\liblz4\bin\x64_Release\liblz4_static.lib ^ |
| 130 | +-DMHD_FOUND=1 ^ |
| 131 | +-DMHD_LIBRARY=%third_libs%\libmicrohttpd\w32\VS2022\Output\x64\libmicrohttpd.lib ^ |
| 132 | +-DMHD_INCLUDE_DIR=%third_libs%\libmicrohttpd\src\include ^ |
| 133 | +-DZLIB_FOUND=1 ^ |
| 134 | +-DZLIB_INCLUDE_DIR=%third_libs%\zlib ^ |
| 135 | +-DZLIB_LIBRARIES=%third_libs%\zlib\contrib\vstudio\vc14\x64\ZlibStatReleaseWithoutAsm\zlibstat.lib ^ |
| 136 | +-DOPENSSL_FOUND=1 ^ |
| 137 | +-DOPENSSL_INCLUDE_DIR=%third_libs%\openssl\include ^ |
| 138 | +-DOPENSSL_CRYPTO_LIBRARY=%third_libs%\openssl\libcrypto_static.lib ^ |
| 139 | +-DCMAKE_CXX_FLAGS="/DTD_WINDOWS=1 /EHsc /bigobj" .. |
| 140 | + |
| 141 | +IF %errorlevel% NEQ 0 ( |
| 142 | + echo Can't configure TON |
| 143 | + exit /b %errorlevel% |
| 144 | +) |
| 145 | + |
| 146 | +IF "%1"=="-t" ( |
| 147 | +ninja storage-daemon storage-daemon-cli blockchain-explorer fift func tolk tonlib tonlibjson ^ |
| 148 | +tonlib-cli validator-engine lite-client validator-engine-console generate-random-id ^ |
| 149 | +json2tlo dht-server http-proxy rldp-http-proxy adnl-proxy create-state create-hardfork emulator ^ |
| 150 | +test-ed25519 test-bigint test-vm test-fift test-cells test-smartcont test-net ^ |
| 151 | +test-tdactor test-tdutils test-tonlib-offline test-adnl test-dht test-rldp test-rldp2 test-catchain ^ |
| 152 | +test-fec test-tddb test-db test-validator-session-state test-emulator proxy-liteserver |
| 153 | +IF %errorlevel% NEQ 0 ( |
| 154 | + echo Can't compile TON |
| 155 | + exit /b %errorlevel% |
| 156 | +) |
| 157 | +) else ( |
| 158 | +ninja storage-daemon storage-daemon-cli blockchain-explorer fift func tolk tonlib tonlibjson ^ |
| 159 | +tonlib-cli validator-engine lite-client validator-engine-console generate-random-id ^ |
| 160 | +json2tlo dht-server http-proxy rldp-http-proxy adnl-proxy create-state create-hardfork emulator proxy-liteserver |
| 161 | +IF %errorlevel% NEQ 0 ( |
| 162 | + echo Can't compile TON |
| 163 | + exit /b %errorlevel% |
| 164 | +) |
| 165 | +) |
| 166 | + |
| 167 | +copy validator-engine\validator-engine.exe test |
| 168 | +IF %errorlevel% NEQ 0 ( |
| 169 | + echo validator-engine.exe does not exist |
| 170 | + exit /b %errorlevel% |
| 171 | +) |
| 172 | + |
| 173 | +echo Strip and copy artifacts |
| 174 | +cd .. |
| 175 | +echo where strip |
| 176 | +where strip |
| 177 | +mkdir artifacts |
| 178 | +mkdir artifacts\smartcont |
| 179 | +mkdir artifacts\lib |
| 180 | + |
| 181 | +for %%I in (build\storage\storage-daemon\storage-daemon.exe ^ |
| 182 | + build\storage\storage-daemon\storage-daemon-cli.exe ^ |
| 183 | + build\blockchain-explorer\blockchain-explorer.exe ^ |
| 184 | + build\crypto\fift.exe ^ |
| 185 | + build\crypto\tlbc.exe ^ |
| 186 | + build\crypto\func.exe ^ |
| 187 | + build\tolk\tolk.exe ^ |
| 188 | + build\crypto\create-state.exe ^ |
| 189 | + build\validator-engine-console\validator-engine-console.exe ^ |
| 190 | + build\tonlib\tonlib-cli.exe ^ |
| 191 | + build\tonlib\tonlibjson.dll ^ |
| 192 | + build\http\http-proxy.exe ^ |
| 193 | + build\rldp-http-proxy\rldp-http-proxy.exe ^ |
| 194 | + build\dht-server\dht-server.exe ^ |
| 195 | + build\lite-client\lite-client.exe ^ |
| 196 | + build\validator-engine\validator-engine.exe ^ |
| 197 | + build\utils\generate-random-id.exe ^ |
| 198 | + build\utils\json2tlo.exe ^ |
| 199 | + build\utils\proxy-liteserver.exe ^ |
| 200 | + build\adnl\adnl-proxy.exe ^ |
| 201 | + build\emulator\emulator.dll) do ( |
| 202 | + echo strip -s %%I & copy %%I artifacts\ |
| 203 | + strip -s %%I & copy %%I artifacts\ |
| 204 | +) |
| 205 | + |
| 206 | +xcopy /e /k /h /i crypto\smartcont artifacts\smartcont |
| 207 | +xcopy /e /k /h /i crypto\fift\lib artifacts\lib |
0 commit comments