win build
This commit is contained in:
93
rin/miner/Dockerfile.windows-build-simple
Normal file
93
rin/miner/Dockerfile.windows-build-simple
Normal file
@@ -0,0 +1,93 @@
|
||||
# Simple cross-compile approach using system packages where possible
|
||||
FROM ubuntu:22.04
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# Install MinGW and development tools
|
||||
RUN apt-get update && apt-get install -y \
|
||||
build-essential \
|
||||
automake \
|
||||
autoconf \
|
||||
pkg-config \
|
||||
libtool \
|
||||
wget \
|
||||
mingw-w64 \
|
||||
mingw-w64-tools \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Set cross-compilation environment
|
||||
ENV HOST=x86_64-w64-mingw32
|
||||
ENV CC=${HOST}-gcc
|
||||
ENV CXX=${HOST}-g++
|
||||
ENV AR=${HOST}-ar
|
||||
ENV STRIP=${HOST}-strip
|
||||
ENV RANLIB=${HOST}-ranlib
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
# Use a minimal build - just build the few deps we absolutely need
|
||||
# Build GMP (essential for cpuminer)
|
||||
RUN wget https://gmplib.org/download/gmp/gmp-6.3.0.tar.xz && \
|
||||
tar -xf gmp-6.3.0.tar.xz && \
|
||||
cd gmp-6.3.0 && \
|
||||
./configure --host=${HOST} --prefix=/usr/${HOST} --enable-static --disable-shared && \
|
||||
make -j$(nproc) && make install && \
|
||||
cd .. && rm -rf gmp-6.3.0*
|
||||
|
||||
# Build jansson (needed for JSON RPC)
|
||||
RUN wget https://github.com/akheron/jansson/releases/download/v2.14/jansson-2.14.tar.gz && \
|
||||
tar -xzf jansson-2.14.tar.gz && \
|
||||
cd jansson-2.14 && \
|
||||
./configure --host=${HOST} --prefix=/usr/${HOST} --enable-static --disable-shared && \
|
||||
make -j$(nproc) && make install && \
|
||||
cd .. && rm -rf jansson-2.14*
|
||||
|
||||
# Build a basic libcurl (simplified)
|
||||
RUN wget https://curl.se/download/curl-8.8.0.tar.gz && \
|
||||
tar -xzf curl-8.8.0.tar.gz && \
|
||||
cd curl-8.8.0 && \
|
||||
./configure --host=${HOST} --prefix=/usr/${HOST} \
|
||||
--enable-static --disable-shared \
|
||||
--disable-ldap --disable-ldaps \
|
||||
--without-ssl --without-libpsl --without-nghttp2 \
|
||||
--without-brotli --without-zstd --without-zlib && \
|
||||
make -j$(nproc) && make install && \
|
||||
cd .. && rm -rf curl-8.8.0*
|
||||
|
||||
# Copy cpuminer source
|
||||
COPY cpuminer /build/cpuminer
|
||||
|
||||
WORKDIR /build/cpuminer
|
||||
|
||||
# Create a build script with minimal dependencies
|
||||
RUN echo '#!/bin/bash\n\
|
||||
set -e\n\
|
||||
\n\
|
||||
echo "Cleaning previous builds..."\n\
|
||||
make clean || true\n\
|
||||
rm -f config.status\n\
|
||||
\n\
|
||||
echo "Running autogen..."\n\
|
||||
./autogen.sh\n\
|
||||
\n\
|
||||
echo "Configuring for Windows cross-compile (minimal deps)..."\n\
|
||||
./configure \\\n\
|
||||
--host=${HOST} \\\n\
|
||||
--with-curl=/usr/${HOST} \\\n\
|
||||
CFLAGS="-O3 -march=x86-64 -static-libgcc" \\\n\
|
||||
LDFLAGS="-L/usr/${HOST}/lib -static" \\\n\
|
||||
CPPFLAGS="-I/usr/${HOST}/include"\n\
|
||||
\n\
|
||||
echo "Building cpuminer..."\n\
|
||||
make -j$(nproc)\n\
|
||||
\n\
|
||||
echo "Stripping binary..."\n\
|
||||
${STRIP} cpuminer.exe\n\
|
||||
\n\
|
||||
echo "Build complete! cpuminer.exe created."\n\
|
||||
ls -la cpuminer.exe\n\
|
||||
file cpuminer.exe\n\
|
||||
' > /build/build-windows.sh && chmod +x /build/build-windows.sh
|
||||
|
||||
CMD ["/build/build-windows.sh"]
|
||||
|
||||
Reference in New Issue
Block a user