dockcross/common.windows

116 lines
2.8 KiB
Plaintext
Raw Normal View History

#
# 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/
#
# For example:
#
# ENV WINEARCH win64
# ARG MXE_TARGET_ARCH=x86_64
#
# mxe master 2017-10-25
ARG MXE_GIT_TAG=994ad47302e8811614b7eb49fc05234942b95b89
ENV CMAKE_TOOLCHAIN_FILE /usr/src/mxe/usr/${MXE_TARGET_ARCH}-w64-mingw32.static/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 -y install \
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 \
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.static" > settings.mk && \
echo "LOCAL_PKG_LIST := gcc" >> settings.mk && \
echo ".DEFAULT local-pkg-list:" >> settings.mk && \
echo "local-pkg-list: \$(LOCAL_PKG_LIST)" >> settings.mk && \
#
# Build MXE
#
cd /usr/src/mxe && \
make -j$(nproc) && \
#
# 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.static-cmake cmake && \
ln -s /usr/src/mxe/usr/bin/${MXE_TARGET_ARCH}-w64-mingw32.static-cpack cpack
ENV PATH ${PATH}:/usr/src/mxe/usr/bin
ENV CROSS_TRIPLE ${MXE_TARGET_ARCH}-w64-mingw32.static
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
WORKDIR /work