Skip to content

Instantly share code, notes, and snippets.

@pgrandin
Created May 20, 2019 18:15
Show Gist options
  • Save pgrandin/e5b5e38535f8b0b75a793f12eec06414 to your computer and use it in GitHub Desktop.
Save pgrandin/e5b5e38535f8b0b75a793f12eec06414 to your computer and use it in GitHub Desktop.
Building a mingw-w64 toolchain
# http://www.nathancoulson.com/proj_cross.php
FROM ubuntu:18.04
# pocketpc-cab removed
RUN apt-get update && apt-get install -y --no-install-recommends wget build-essential libmpfr-dev gettext \
ca-certificates zip ssh librsvg2-bin xsltproc vim \
&& apt-get clean && apt-get autoremove && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ENV target="x86_64-w64-mingw32"
ENV binutils_version="2.31.90"
ENV sysroot="/usr/x86_64-w64-mingw32/sysroot/"
RUN wget -q https://newcontinuum.dl.sourceforge.net/project/mingw-w64/mingw-w64/mingw-w64-release/mingw-w64-v6.0.0.tar.bz2 \
&& tar xjpf mingw-w64-v6.0.0.tar.bz2 && rm mingw-w64-v6.0.0.tar.bz2
RUN cd /mingw-w64-v6.0.0/mingw-w64-headers/ && mkdir build && cd build && \
../configure --target=${target} --prefix=${sysroot} --host=x86_64-w64-mingw32 \
&& make -j6 && make && make install \
&& ln -s x86_64-w64-mingw32 ${sysroot}/mingw
# && install -d -m755 ${sysroot}/mingw/lib
RUN wget -q ftp://sourceware.org/pub/binutils/snapshots/binutils-${binutils_version}.tar.xz
RUN unxz binutils-${binutils_version}.tar.xz && tar xf binutils-${binutils_version}.tar \
&& rm binutils-${binutils_version}.tar
RUN cd binutils-${binutils_version} && mkdir build && cd build && \
../configure --prefix=/usr --target=${target} --with-sysroot=${sysroot} \
--enable-targets=x86_64-w64-mingw32,i686-w64-mingw32 \
&& make -j6 && make && make install
RUN apt-get update && apt-get install -y --no-install-recommends m4
RUN mkdir /deps
RUN wget http://gnu.mirrors.hoobly.com/gmp/gmp-6.1.2.tar.xz \
&& unxz gmp-6.1.2.tar.xz && tar xf gmp-6.1.2.tar && cd gmp-6.1.2 \
&& mkdir build && cd build && ../configure --prefix=/deps/ \
&& make -j6 && make && make install
RUN wget http://gnu.mirrors.hoobly.com/mpfr/mpfr-4.0.2.tar.xz \
&& unxz mpfr-4.0.2.tar.xz && tar xf mpfr-4.0.2.tar && cd mpfr-4.0.2 \
&& mkdir build && cd build && ../configure --prefix=/deps/ --with-gmp=/deps/ --enable-static --disable-shared \
&& make -j6 && make && make install
RUN wget http://gnu.mirrors.hoobly.com/mpc/mpc-1.1.0.tar.gz \
&& tar xfz mpc-1.1.0.tar.gz && cd mpc-1.1.0 \
&& mkdir build && cd build && ../configure --prefix=/deps/ --with-gmp=/deps/ --with-mpfr=/deps/ --enable-static --disable-shared \
&& make -j6 && make && make install
ENV gcc_version="7.4.0"
RUN wget -q ftp://ftp.gnu.org/gnu/gcc/gcc-${gcc_version}/gcc-${gcc_version}.tar.xz \
&& unxz gcc-${gcc_version}.tar.xz && tar xpf gcc-${gcc_version}.tar
# RUN cd gcc-${gcc_version} && mkdir build && cd build && \
# ../configure --prefix=/usr --target=${target} --enable-languages=c,c++ \
# --libexecdir=/usr/lib --disable-static --enable-threads=win32 \
# --with-sysroot=${sysroot} --enable-targets=all --with-cpu=generic \
# --with-gmp=/deps/ --with-mpfr=/deps/ --with-mpc=/deps/ \
# && make all-gcc && make install-gcc
# RUN wget http://gnu.mirrors.hoobly.com/gcc/gcc-${gcc_version}/gcc-${gcc_version}.tar.xz && \
# unxz gcc-${gcc_version}.tar.xz && tar xf gcc-${gcc_version}.tar && cd gcc-${gcc_version} \
# && mkdir build && cd build && ../configure --target=${target} && make -j6 && make && make install
# RUN wget http://www.cmake.org/files/v3.2/cmake-3.2.0-Linux-i386.sh --no-check-certificate && \
# RUN wget -c http://cfhcable.dl.sourceforge.net/project/cegcc/cegcc/0.59.1/mingw32ce-0.59.1.tar.bz2 \
# -O mingw32ce-0.59.1.tar.bz2 --no-check-certificate && tar xvjpf mingw32ce-0.59.1.tar.bz2 \
# && rm mingw32ce-0.59.1.tar.bz2
#
# COPY cmake-3.2.0-Linux-i386.sh /
# RUN yes | bash /cmake-3.2.0-Linux-i386.sh --prefix /usr/local && rm /cmake-3.2.0-Linux-i386.sh
#
# RUN mkdir /var/lib/apt/lists/partial
# ENV MINGW32CE_PATH="/opt/mingw32ce"
# ENV PATH=$PATH:$MINGW32CE_PATH/bin:/cmake-3.2.0-Linux-i386/bin/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment