-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile.mxe
106 lines (90 loc) · 3.21 KB
/
Dockerfile.mxe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
## base image
FROM abeimler/simple-cppbuilder:base AS base
ARG extra_libraries
ARG vcpkg_host_triplet="x64-linux"
ARG processor="x86_64"
ARG vcpkg_target_triplet="x64-mingw-dynamic"
ARG cross_triplet="x86_64-w64-mingw32.shared"
ARG cc="${cross_triplet}-gcc"
ARG cxx="${cross_triplet}-g++"
ARG cmake="${cross_triplet}-cmake"
ARG make="make"
ARG cmake_generator="Ninja Multi-Config"
# Install packages available from standard repos
RUN pacman-db-upgrade && \
pacman -S --noconfirm \
${extra_libraries} \
cmake make ninja && \
pacman -Scc --noconfirm
# install extra packages from AUR (powershell)
USER yay
RUN yay -Syu --noconfirm && yay -S --noconfirm \
powershell-bin && \
yay -Scc --noconfirm && \
rm -rf /home/yay/.cache/*
USER root
# install mxe
RUN pacman-db-upgrade && \
pacman -S --noconfirm \
bzip2 lzip p7zip unzip xz perl ruby gperf intltool perl-xml-parser python-mako && \
pacman -Scc --noconfirm
ARG mxe_source_dir="/opt/mxe"
RUN git clone --depth 1 https://github.com/mxe/mxe.git $mxe_source_dir
WORKDIR $mxe_source_dir
RUN make cc MXE_TARGETS="${cross_triplet}" && \
make ccache cmake cmake-conf ninja --jobs=4 JOBS=2 MXE_TARGETS="${cross_triplet}" && \
make clean-junk
#RUN rm -rf $mxe_source_dir/log $mxe_source_dir/tmp-*
WORKDIR /
ENV MXE_SOURCE_DIR $mxe_source_dir
ENV PATH="${mxe_source_dir}/usr/bin:${PATH}"
ARG cross_root="${mxe_source_dir}/usr"
ARG cmake_toolchain_file="${cross_root}/${cross_triplet}/share/cmake/mxe-conf.cmake"
# cross compiler settings
ENV CC $cc
ENV CXX $cxx
ENV CMAKE $cmake
ENV MAKE $make
ENV PROCESSOR $processor
ENV CROSS_TRIPLET $cross_triplet
ENV TARGET_TRIPLET $vcpkg_target_triplet
ENV CROSS_CMAKE $cmake
ENV CROSS_MAKE $make
ENV CROSS "${cross_triplet}-"
ENV CROSS_ROOT $cross_root
ENV CROSS_TOOLCHAIN $cmake_toolchain_file
# compiler env settings
# e.g. mingw-env, emsdk_env.sh
RUN mkdir -p /home/cross && touch /home/cross/.bashrc
ARG setup_env_script="/home/cross/.bashrc"
ARG setup_env_script_args=""
ENV SETUP_ENV_SCRIPT $setup_env_script
ENV SETUP_ENV_SCRIPT_ARGS $setup_env_script_args
RUN echo "source \"$SETUP_ENV_SCRIPT $SETUP_ENV_SCRIPT_ARGS\"" >> /root/.bash_profile && \
. $setup_env_script $setup_env_script_args
# install vcpkg
## https://github.com/microsoft/vcpkg/blob/master/docs/users/mingw.md
WORKDIR /home/project
ENV VCPKG_DEFAULT_HOST_TRIPLET $vcpkg_host_triplet
ENV VCPKG_DEFAULT_TRIPLET $vcpkg_target_triplet
ENV VCPKG_DISABLE_METRICS 1
RUN git clone --depth 1 https://github.com/Microsoft/vcpkg.git /home/project/vcpkg && \
/home/project/vcpkg/bootstrap-vcpkg.sh -disableMetrics
ENV VCPKG_ROOT "/home/project/vcpkg"
ENV VCPKG_TOOLCHAIN_FILE "$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake"
ENV TOOLCHAIN_FILE "$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake"
# build script settings
ENV TARGET "all"
ENV BUILD_TYPE "Release"
ENV CMAKE_GENERATOR $cmake_generator
ENV CHAINLOAD_TOOLCHAIN_FILE $cmake_toolchain_file
ENV CMAKE_ARGS ""
# setup project env
WORKDIR /home/project
COPY ./cmake /home/cmake
COPY ./scripts/docker-build.mxe.sh ./docker-build.sh
COPY ./taskfiles/*.yml /home/taskfiles/
COPY ./taskfiles/TaskfileCross.yml /home/taskfiles/Taskfile.yml
ENV PROJECT_DIR /home/project
WORKDIR /home/project
RUN mkdir build