#!/bin/bash # Script to build cpuminer for Windows using Docker cross-compilation set -e SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" REPO_DIR="$SCRIPT_DIR" echo "Building cpuminer for Windows using Docker..." echo "Working directory: $REPO_DIR" # Build the Docker image echo "Building Docker image with MinGW toolchain..." docker build -t cpuminer-windows-builder -f Dockerfile.windows-build-complete . # Run the build echo "Running Windows cross-compilation..." docker run --rm -v "$REPO_DIR:/output" cpuminer-windows-builder bash -c " /build/build-windows.sh && echo 'Copying binary to output...' && cp /build/cpuminer/cpuminer.exe /output/ && echo 'Copying required DLLs...' && cp /build/cpuminer/*.dll /output/ 2>/dev/null || echo 'No DLLs to copy from source' " if [ -f "$REPO_DIR/cpuminer.exe" ]; then echo "" echo "✅ Build successful!" echo "Windows executable: $REPO_DIR/cpuminer.exe" echo "" echo "File info:" file "$REPO_DIR/cpuminer.exe" || true ls -la "$REPO_DIR/cpuminer.exe" echo "" echo "The executable is ready to run on Windows x64." echo "Make sure to include any required DLL files when distributing." else echo "❌ Build failed - cpuminer.exe not found" exit 1 fi