From 34618724350e46d9e71e309a0742789f1fe2ba65 Mon Sep 17 00:00:00 2001 From: SChernykh <15806605+SChernykh@users.noreply.github.com> Date: Sat, 5 Jul 2025 12:58:49 +0200 Subject: [PATCH] Build scripts: fixed Windows 7 compatibility --- CMakeLists.txt | 2 +- patches/boringssl/win7.patch | 2 +- release_scripts/build_all.sh | 2 +- release_scripts/images/ubuntu/prepare.sh | 7 +++++++ release_scripts/windows_x64/build.sh | 2 +- release_scripts/windows_x64/p2pool_windows_x64.sh | 3 +++ 6 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 935ee37..3f7afaa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -412,7 +412,7 @@ if (STATIC_BINARY OR STATIC_LIBS) if (WIN32) set(STATIC_LIBS ${STATIC_LIBS} ws2_32 iphlpapi userenv psapi dnsapi dbghelp) if ((CMAKE_CXX_COMPILER_ID MATCHES GNU) OR (CMAKE_CXX_COMPILER_ID MATCHES Clang)) - set(STATIC_LIBS ${STATIC_LIBS} bcrypt) + set(STATIC_LIBS ${STATIC_LIBS} bcrypt pthread) endif() elseif (CMAKE_SYSTEM_NAME STREQUAL FreeBSD) set(STATIC_LIBS ${STATIC_LIBS} pthread) diff --git a/patches/boringssl/win7.patch b/patches/boringssl/win7.patch index c8a4bec..8632dd9 100644 --- a/patches/boringssl/win7.patch +++ b/patches/boringssl/win7.patch @@ -14,7 +14,7 @@ index a44774d23..09cf10942 100644 // See: https://learn.microsoft.com/en-us/windows/win32/seccng/processprng typedef BOOL (WINAPI *ProcessPrngFunction)(PBYTE pbData, SIZE_T cbData); static ProcessPrngFunction g_processprng_fn = NULL; -+static HCRYPTPROV g_hCryptProv = NULL; ++static HCRYPTPROV g_hCryptProv = 0; + +static BOOL WINAPI wrapper_CryptGenRandom(PBYTE pbData, SIZE_T cbData) +{ diff --git a/release_scripts/build_all.sh b/release_scripts/build_all.sh index 0e7d526..19fbaec 100755 --- a/release_scripts/build_all.sh +++ b/release_scripts/build_all.sh @@ -18,7 +18,7 @@ if [ $? -ne 0 ]; then fi rm -f p2pool.tar -tar -f p2pool.tar -c ../cmake -c ../external -c ../src -c ../CMakeLists.txt -c ../LICENSE -c ../README.md +tar -f p2pool.tar -c ../cmake -c ../external -c ../patches -c ../src -c ../CMakeLists.txt -c ../LICENSE -c ../README.md ln p2pool.tar freebsd_aarch64/p2pool.tar ln p2pool.tar freebsd_x64/p2pool.tar diff --git a/release_scripts/images/ubuntu/prepare.sh b/release_scripts/images/ubuntu/prepare.sh index 53811ff..7b85687 100755 --- a/release_scripts/images/ubuntu/prepare.sh +++ b/release_scripts/images/ubuntu/prepare.sh @@ -433,3 +433,10 @@ rm /usr/lib/x86_64-linux-gnu/crt1.o rm /usr/lib/x86_64-linux-gnu/crti.o rm /usr/lib/x86_64-linux-gnu/crtn.o rm /usr/lib/x86_64-linux-gnu/libc.a + +echo "Deleting temporary files" + +cd /root +rm -rf * + +echo "All done" diff --git a/release_scripts/windows_x64/build.sh b/release_scripts/windows_x64/build.sh index 84e30c0..296eb44 100755 --- a/release_scripts/windows_x64/build.sh +++ b/release_scripts/windows_x64/build.sh @@ -3,7 +3,7 @@ # Example usage: ./build.sh v4.8.1 cd "$(dirname "$0")" -[ ! -f "p2pool.tar" ] && tar -f p2pool.tar -c ../../cmake -c ../../external -c ../../src -c ../../CMakeLists.txt -c ../../LICENSE -c ../../README.md +[ ! -f "p2pool.tar" ] && tar -f p2pool.tar -c ../../cmake -c ../../external -c ../../patches -c ../../src -c ../../CMakeLists.txt -c ../../LICENSE -c ../../README.md docker build --build-arg P2POOL_VERSION=$1 --build-arg BUILD_TIMESTAMP="$(git show --no-patch --format=%ct $1)" -t p2pool_windows_x64_build . diff --git a/release_scripts/windows_x64/p2pool_windows_x64.sh b/release_scripts/windows_x64/p2pool_windows_x64.sh index 33e0b1b..5d4760c 100755 --- a/release_scripts/windows_x64/p2pool_windows_x64.sh +++ b/release_scripts/windows_x64/p2pool_windows_x64.sh @@ -15,6 +15,9 @@ flags_libs="--target=x86_64-pc-windows-gnu -Os -flto -Wl,/timestamp:$2 -fuse-ld= flags_p2pool="--target=x86_64-pc-windows-gnu -Wl,/timestamp:$2 -fuse-ld=lld -femulated-tls -Wno-unused-command-line-argument $flags_size $flags_datetime" flags_cxx_headers="-isystem /usr/local/x86_64-w64-mingw32/include/c++ -isystem /usr/local/x86_64-w64-mingw32/include/c++/15.1.0 -isystem /usr/local/x86_64-w64-mingw32/include" +cd /p2pool +git apply --verbose --ignore-whitespace --directory=external/src/grpc/third_party/boringssl-with-bazel patches/boringssl/win7.patch + cd /p2pool/external/src/curl cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../../../cmake/windows_x86_64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_libs" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include make -j$(nproc)