#!/bin/bash # # Windows Docker Build Script for RinHash Miner # This script builds the Windows executable using Docker cross-compilation # echo "=== RinHash Windows Docker Build Script ===" echo "Building Windows executable with NO_CURL fallback networking..." echo "" # Check if Docker is available if ! command -v docker &> /dev/null; then echo "❌ Error: Docker is not installed or not in PATH" echo "Please install Docker Desktop and try again." exit 1 fi # Check if we're in the right directory if [ ! -f "cpuminer-opt-rin/algo/rinhash/rinhash.c" ]; then echo "❌ Error: cpuminer-opt-rin directory not found in current location" echo "Please run this script from the miner directory:" echo "cd /mnt/shared/DEV/repos/d-popov.com/mines/rin/miner" exit 1 fi echo "📁 Working directory: $(pwd)" echo "🐳 Using Docker container: cpuminer-windows-builder" echo "" # Build the Windows executable echo "🔨 Building Windows executable..." docker run --rm \ -v "$(pwd)/cpuminer-opt-rin:/work" \ -v "$(pwd)/cpuminer-opt-rin/build/win:/output" \ cpuminer-windows-builder \ bash -c "cd /work && make clean && rm -rf Makefile Makefile.in configure config.* && ./autogen.sh && ./configure --host=x86_64-w64-mingw32 CFLAGS='-O3 -march=x86-64 -DNO_CURL' LDFLAGS='-static' && make -j4 && cp cpuminer.exe /output/" # Check if build was successful if [ $? -eq 0 ]; then echo "" echo "✅ Build completed successfully!" echo "📁 Checking output files..." ls -la cpuminer-opt-rin/build/win/cpuminer.exe 2>/dev/null if [ $? -eq 0 ]; then FILE_SIZE=$(stat -c%s "cpuminer-opt-rin/build/win/cpuminer.exe" 2>/dev/null || stat -f%z "cpuminer-opt-rin/build/win/cpuminer.exe" 2>/dev/null) echo "📦 Windows executable ready: cpuminer-opt-rin/build/win/cpuminer.exe (${FILE_SIZE} bytes)" echo "" echo "🚀 Ready for shipping to Windows systems!" echo "💡 Mining command example:" echo " cpuminer.exe -a rinhash -o stratum+tcp://pool.example.com:3333 -u wallet -p x -t 4" else echo "❌ Warning: Executable not found in output directory" fi else echo "" echo "❌ Build failed!" echo "💡 Troubleshooting:" echo " - Check Docker is running" echo " - Ensure cpuminer-windows-builder image is available" echo " - Verify source files are present in cpuminer-opt-rin/" exit 1 fi echo "" echo "=== Build Complete ==="