Dockerfile 4.35 KB
Newer Older
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
FROM dockcross/base:latest
MAINTAINER Leander Schulten "leander.Schulten@rwth-aachen.de"

ENV WINEARCH win64
ARG MXE_TARGET_ARCH=x86_64
ARG MXE_TARGET_THREAD=.posix
ARG MXE_TARGET_LINK=shared

#
# Before including this script, make sure to set:
#
# WINEARCH environment variable to either "win64" or "win32"
# MXE_TARGET_ARCH argument to either "x86_64" or "i686". See http://mxe.cc/
# MXE_TARGET_THREAD argument to either "" or ".posix". Default is win32. See http://mxe.cc/
# MXE_TARGET_LINK argument to either "static" or "shared"
#
# For example:
#
#  ENV WINEARCH win64
#  ARG MXE_TARGET_ARCH=x86_64
#  ARG MXE_TARGET_THREAD=
#  ARG MXE_TARGET_LINK=shared
#

ENV CMAKE_TOOLCHAIN_FILE /usr/src/mxe/usr/${MXE_TARGET_ARCH}-w64-mingw32.${MXE_TARGET_LINK}${MXE_TARGET_THREAD}/share/cmake/mxe-conf.cmake

ARG DEBIAN_FRONTEND=noninteractive

#
# WINE is used as an emulator for try_run and tests with CMake.
#
# Other dependencies are from the listed MXE requirements:
#   http://mxe.cc/#requirements
# 'cmake' is omitted because it is installed from source in the base image
#
RUN \
  apt-get update && \
  apt-get install --no-install-recommends --yes \
    autoconf \
    automake \
    autopoint \
    bash \
    bison \
    bzip2 \
    flex \
    gettext \
    git \
    g++ \
    g++-multilib \
    gperf \
    intltool \
    libffi-dev \
    libgdk-pixbuf2.0-dev \
    libtool-bin \
    libltdl-dev \
    libssl-dev \
    libxml-parser-perl \
    libc6-dev-i386 \
    lzip \
    make \
    openssl \
    p7zip-full \
    patch \
    perl \
    pkg-config \
    python \
    ruby \
    scons \
    sed \
    unzip \
    wget \
    wine \
    xz-utils \
  && \
  #
  # Install Wine
  #
  dpkg --add-architecture i386 && \
  apt-get update && \
  apt-get install -y wine32 && \
  wine hostname && \
  #
  # Download MXE sources
  #
  cd /usr/src && \
  git clone https://github.com/mxe/mxe.git && \
  cd mxe && \
  # git checkout ${MXE_GIT_TAG} && \
  #
  # Configure "settings.mk" required to build MXE
  #
  cd /usr/src/mxe && \
  echo "MXE_TARGETS := ${MXE_TARGET_ARCH}-w64-mingw32.${MXE_TARGET_LINK}${MXE_TARGET_THREAD}" > settings.mk && \
  echo "LOCAL_PKG_LIST := cc cmake"                                              >> settings.mk && \
  echo ".DEFAULT local-pkg-list:"                                                >> settings.mk && \
  echo "local-pkg-list: \$(LOCAL_PKG_LIST)"                                      >> settings.mk && \
  echo "MXE_PLUGIN_DIRS := plugins/gcc8"                                      >> settings.mk && \
  #
  # Build MXE
  #
  cd /usr/src/mxe && \
  make -j$(nproc) && \
  #
  # Cleanup: By keeping the MXE build system (Makefile, ...), derived images will be able to install
  #          additional packages.
  #
  rm -rf log pkg && \
  #
  # Update MXE toolchain file
  #
  echo 'set(CMAKE_CROSSCOMPILING_EMULATOR "/usr/bin/wine")' >> ${CMAKE_TOOLCHAIN_FILE} && \
  #
  # Replace cmake and cpack binaries
  #
  cd /usr/bin && \
  rm cmake cpack && \
  ln -s /usr/src/mxe/usr/bin/${MXE_TARGET_ARCH}-w64-mingw32.${MXE_TARGET_LINK}${MXE_TARGET_THREAD}-cmake cmake && \
  ln -s /usr/src/mxe/usr/bin/${MXE_TARGET_ARCH}-w64-mingw32.${MXE_TARGET_LINK}${MXE_TARGET_THREAD}-cpack cpack

ENV PATH ${PATH}:/usr/src/mxe/usr/bin
ENV CROSS_TRIPLE ${MXE_TARGET_ARCH}-w64-mingw32.${MXE_TARGET_LINK}${MXE_TARGET_THREAD}
ENV AS=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-as \
    AR=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-ar \
    CC=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-gcc \
    CPP=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-cpp \
    CXX=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-g++ \
    LD=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-ld \
    FC=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-gfortran


# Build-time metadata as defined at http://label-schema.org
ARG BUILD_DATE
ARG IMAGE=dockcross/windows-shared-x64-posix
ARG VERSION=latest
ARG VCS_REF
ARG VCS_URL
LABEL org.label-schema.build-date=$BUILD_DATE \
      org.label-schema.name=$IMAGE \
      org.label-schema.version=$VERSION \
      org.label-schema.vcs-ref=$VCS_REF \
      org.label-schema.vcs-url=$VCS_URL \
      org.label-schema.schema-version="1.0"
ENV DEFAULT_DOCKCROSS_IMAGE ${IMAGE}:${VERSION}

# install qt packages
WORKDIR /usr/src/mxe
RUN make qtbase
RUN make qtdeclarative
RUN make qtimageformats
RUN make qtnetworkauth
RUN make qtquickcontrols2
RUN make qtserialport
RUN make qttools
154
RUN make qtwebsockets
155
156
157

#set path to mxe compiler
RUN export PATH=/usr/src/mxe/usr/bin:$PATH