win build
This commit is contained in:
105
rin/miner/Dockerfile.windows-build-complete
Normal file
105
rin/miner/Dockerfile.windows-build-complete
Normal file
@@ -0,0 +1,105 @@
|
||||
# Complete source build using git clone
|
||||
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 \
|
||||
git \
|
||||
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
|
||||
|
||||
# Build zlib for Windows first
|
||||
RUN wget https://github.com/madler/zlib/archive/refs/tags/v1.3.1.tar.gz -O zlib-1.3.1.tar.gz && \
|
||||
tar -xzf zlib-1.3.1.tar.gz && \
|
||||
cd zlib-1.3.1 && \
|
||||
CC=${HOST}-gcc AR=${HOST}-ar RANLIB=${HOST}-ranlib ./configure --prefix=/usr/${HOST} --static && \
|
||||
make libz.a && \
|
||||
cp libz.a /usr/${HOST}/lib/ && \
|
||||
cp zlib.h zconf.h /usr/${HOST}/include/ && \
|
||||
cd .. && rm -rf zlib-1.3.1*
|
||||
|
||||
# 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 (with zlib support)
|
||||
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} \
|
||||
--with-zlib=/usr/${HOST} \
|
||||
--enable-static --disable-shared \
|
||||
--disable-ldap --disable-ldaps \
|
||||
--without-ssl --without-libpsl --without-nghttp2 \
|
||||
--without-brotli --without-zstd && \
|
||||
make -j$(nproc) && make install && \
|
||||
cd .. && rm -rf curl-8.8.0*
|
||||
|
||||
# Clone the complete cpuminer-opt source
|
||||
RUN git clone https://github.com/JayDDee/cpuminer-opt.git cpuminer-opt
|
||||
|
||||
WORKDIR /build/cpuminer-opt
|
||||
|
||||
# Create build script
|
||||
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..."\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\
|
||||
LIBS="-static -lcurl -lz -lws2_32 -lwldap32 -lwinmm" \\\n\
|
||||
--enable-static=yes\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