This simplifies build-mingw-w64.sh. When building on native windows (where we also provide unprefixed tools, we can't have the yet incomplete compiler toolchain in $PATH when building the mingw-w64 tools. (Logically, build-mingw-w64-tools belong with build-llvm and install-wrappers; using the original system compiler to build tools that are supposed to run on the current machine, as opposed to the cross target, like when building the runtimes.)
57 lines
1.8 KiB
Docker
57 lines
1.8 KiB
Docker
# Cross compile an llvm-mingw toolchain for windows.
|
|
#
|
|
# This needs to be built with --build-arg BASE=<image>, where image is the name
|
|
# of a docker image that contains a working llvm-mingw cross compiler
|
|
# from a similar enough version.
|
|
#
|
|
# This builds LLVM and all other build tools that need to run on the target
|
|
# platform, but just copies over the runtime libraries from the existing
|
|
# toolchain in the base docker image.
|
|
|
|
ARG BASE=mstorsjo/llvm-mingw:dev
|
|
FROM $BASE
|
|
|
|
RUN apt-get update -qq && \
|
|
apt-get install -qqy zip && \
|
|
apt-get clean -y && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN cd /opt && \
|
|
wget https://github.com/Kitware/CMake/releases/download/v3.16.2/cmake-3.16.2-Linux-x86_64.tar.gz && \
|
|
tar -zxvf cmake-*.tar.gz && \
|
|
rm cmake-*.tar.gz && \
|
|
mv cmake-* cmake
|
|
ENV PATH=/opt/cmake/bin:$PATH
|
|
|
|
ARG CROSS_ARCH=x86_64
|
|
ENV CROSS_TOOLCHAIN_PREFIX=/opt/llvm-mingw-$CROSS_ARCH
|
|
|
|
ENV HOST=$CROSS_ARCH-w64-mingw32
|
|
|
|
ARG FULL_LLVM
|
|
|
|
COPY build-llvm.sh .
|
|
RUN ./build-llvm.sh $CROSS_TOOLCHAIN_PREFIX --host=$HOST
|
|
COPY strip-llvm.sh .
|
|
RUN ./strip-llvm.sh $CROSS_TOOLCHAIN_PREFIX --host=$HOST
|
|
|
|
ARG TOOLCHAIN_ARCHS="i686 x86_64 armv7 aarch64"
|
|
|
|
COPY build-mingw-w64.sh build-mingw-w64-tools.sh ./
|
|
RUN ./build-mingw-w64-tools.sh $CROSS_TOOLCHAIN_PREFIX --skip-include-triplet-prefix --host=$HOST
|
|
|
|
COPY wrappers/*.sh wrappers/*.c wrappers/*.h ./wrappers/
|
|
COPY install-wrappers.sh .
|
|
RUN ./install-wrappers.sh $CROSS_TOOLCHAIN_PREFIX --host=$HOST
|
|
|
|
COPY prepare-cross-toolchain.sh .
|
|
RUN ./prepare-cross-toolchain.sh $TOOLCHAIN_PREFIX $CROSS_TOOLCHAIN_PREFIX $CROSS_ARCH
|
|
|
|
COPY build-make.sh .
|
|
RUN ./build-make.sh $CROSS_TOOLCHAIN_PREFIX --host=$HOST
|
|
|
|
ARG TAG
|
|
RUN ln -s $CROSS_TOOLCHAIN_PREFIX llvm-mingw && \
|
|
zip -9r /llvm-mingw-$TAG$CROSS_ARCH.zip llvm-mingw && \
|
|
ls -lh /llvm-mingw-$TAG$CROSS_ARCH.zip
|