Files
hush3/util/build-win.sh
dan_s 8a0eb77692 Fix RandomX validation exploit with difficulty reset, improve build system
- One-time difficulty reset to minimum for 17 blocks at activation height
- Separate RandomX build dirs for linux/win64 cross-compilation
- Add build target tracking to auto-clean on target switch
- Automated win64 release packaging to release-win64/
- Add build artifacts to .gitignore
- Miner memory diagnostics and large-page dataset fallback
2026-02-19 22:07:38 -06:00

96 lines
2.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# Copyright (c) 2016-2024 The Hush developers
# Distributed under the GPLv3 software license, see the accompanying
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
export HOST=x86_64-w64-mingw32
CXX=x86_64-w64-mingw32-g++-posix
CC=x86_64-w64-mingw32-gcc-posix
PREFIX="$(pwd)/depends/$HOST"
set -eu -o pipefail
set -x
cd "$(dirname "$(readlink -f "$0")")/.."
cd depends/ && make HOST=$HOST V=1 NO_QT=1
cd ..
./autogen.sh
CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site CXXFLAGS="-DPTW32_STATIC_LIB -DCURL_STATICLIB -fopenmp -pthread" ./configure --prefix="${PREFIX}" --host=x86_64-w64-mingw32 --enable-static --disable-shared
# Build CryptoConditions stuff
WD=$PWD
cd src/cc
echo $PWD
./makecustom
cd $WD
# Build RandomX for Windows
cd src/RandomX
if [ -f "build-win64/librandomx.a" ]
then
ls -la build-win64/librandomx*
else
mkdir -p build-win64 && cd build-win64
CC="${CC} -g " CXX="${CXX} -g " cmake -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++-posix -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc-posix -DARCH=native ..
make
fi
cd $WD
sed -i 's/-lboost_system-mt /-lboost_system-mt-s /' configure
cd src/
CC="${CC} -g " CXX="${CXX} -g " make V=1 hushd.exe hush-cli.exe hush-tx.exe
# Create release package
cd $WD
echo "Creating Windows release package..."
VERSION=$(grep -oP 'define\(_CLIENT_VERSION.*?,\s*\K[0-9]+' configure.ac | head -4 | tr '\n' '.' | sed 's/\.$//')
VERSION=${VERSION:-3.10.4}
RELEASE_DIR="release-win64"
mkdir -p "$RELEASE_DIR"
# Strip binaries
x86_64-w64-mingw32-strip -s src/hushd.exe src/hush-cli.exe src/hush-tx.exe
# Copy binaries
cp src/hushd.exe src/hush-cli.exe src/hush-tx.exe "$RELEASE_DIR/"
# Copy required data files
cp asmap.dat sapling-spend.params sapling-output.params "$RELEASE_DIR/"
# Create DragonX batch files
cat > "$RELEASE_DIR/dragonxd.bat" << 'EOF'
@call :GET_CURRENT_DIR
@cd %THIS_DIR%
hushd.exe -ac_name=DRAGONX -ac_algo=randomx -ac_halving=3500000 -ac_reward=300000000 -ac_blocktime=36 -ac_private=1 -addnode=176.126.87.241 %*
@goto :EOF
:GET_CURRENT_DIR
@pushd %~dp0
@set THIS_DIR=%CD%
@popd
@goto :EOF
EOF
cat > "$RELEASE_DIR/dragonx-cli.bat" << 'EOF'
@call :GET_CURRENT_DIR
@cd %THIS_DIR%
hush-cli.exe -ac_name=DRAGONX %*
@goto :EOF
:GET_CURRENT_DIR
@pushd %~dp0
@set THIS_DIR=%CD%
@popd
@goto :EOF
EOF
# Create ZIP
rm -f "$RELEASE_DIR/hush-${VERSION}-win64.zip"
cd "$RELEASE_DIR"
zip -9 "hush-${VERSION}-win64.zip" *.exe *.bat *.dat *.params
cd ..
echo "Release package created: $RELEASE_DIR/hush-${VERSION}-win64.zip"
ls -lh "$RELEASE_DIR/hush-${VERSION}-win64.zip"