@echo off REM Smart Windows Docker Build Script for RinHash Miner REM Automatically detects curl availability and builds with/without NO_CURL flag accordingly echo === Smart Windows Docker Build Script === echo Automatically detecting curl availability for optimal build... echo. REM Check if Docker is available docker --version >nul 2>&1 if %errorlevel% neq 0 ( echo ❌ Error: Docker is not installed or not in PATH echo Please install Docker Desktop and try again. pause exit /b 1 ) echo Working directory: %CD% echo Using Docker container: cpuminer-windows-builder echo. REM First, try to build with original curl implementation (WITHOUT NO_CURL flag) echo Attempting to build with original curl implementation (recommended)... docker run --rm -v "%CD%/cpuminer-opt-rin:/work" -v "%CD%/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 --with-curl=/usr/x86_64-w64-mingw32 CFLAGS='-O3 -march=x86-64' LDFLAGS='-L/usr/x86_64-w64-mingw32/lib -lcurl -lws2_32 -lwinmm' LIBS='-lcurl' && make -j4 && cp cpuminer.exe /output/cpuminer-curl.exe" set CURL_BUILD_RESULT=%errorlevel% if %CURL_BUILD_RESULT% equ 0 ( echo. echo ✅ SUCCESS: Built with original curl implementation! echo Checking output file... if exist "cpuminer-opt-rin\build\win\cpuminer-curl.exe" ( for %%A in ("cpuminer-opt-rin\build\win\cpuminer-curl.exe") do set FILE_SIZE=%%~zA echo Original curl executable ready: cpuminer-opt-rin\build\win\cpuminer-curl.exe (%FILE_SIZE% bytes) REM Copy as main executable copy "cpuminer-opt-rin\build\win\cpuminer-curl.exe" "cpuminer-opt-rin\build\win\cpuminer.exe" >nul echo Also available as: cpuminer-opt-rin\build\win\cpuminer.exe echo. echo 🎉 BUILD COMPLETE - Using original curl implementation! echo This provides the best networking performance and full stratum features. 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 goto :success ) ) echo. echo ⚠️ Original curl build failed (exit code: %CURL_BUILD_RESULT%) echo Falling back to NO_CURL direct socket implementation... REM Fallback: Build with NO_CURL flag docker run --rm -v "%CD%/cpuminer-opt-rin:/work" -v "%CD%/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/cpuminer-nocurl.exe" set NOCURL_BUILD_RESULT=%errorlevel% if %NOCURL_BUILD_RESULT% equ 0 ( echo. echo ✅ SUCCESS: Built with NO_CURL fallback implementation! echo Checking output file... if exist "cpuminer-opt-rin\build\win\cpuminer-nocurl.exe" ( for %%A in ("cpuminer-opt-rin\build\win\cpuminer-nocurl.exe") do set FILE_SIZE=%%~zA echo Fallback executable ready: cpuminer-opt-rin\build\win\cpuminer-nocurl.exe (%FILE_SIZE% bytes) REM Copy as main executable copy "cpuminer-opt-rin\build\win\cpuminer-nocurl.exe" "cpuminer-opt-rin\build\win\cpuminer.exe" >nul echo Also available as: cpuminer-opt-rin\build\win\cpuminer.exe echo. echo ⚠️ USING FALLBACK: Direct socket implementation (no curl) echo This works but may have limited networking features. 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 goto :success ) ) echo. echo ❌ FAILED: Both curl and NO_CURL builds failed! echo Troubleshooting: echo - Check Docker Desktop is running echo - Verify cpuminer source files are intact echo - Check Docker container logs for specific errors echo. echo Build exit codes: echo - Original curl build: %CURL_BUILD_RESULT% echo - NO_CURL fallback: %NOCURL_BUILD_RESULT% pause exit /b 1 :success echo. echo === Build Complete === pause