Add dockerfile for making mingw cross-compile builds

This commit is contained in:
loonycyborg 2019-11-06 19:39:38 +03:00
parent 4638a4b5b8
commit 42293897e5
3 changed files with 43 additions and 0 deletions

View file

@ -0,0 +1,5 @@
#!/bin/sh -xe
cd mingw
docker build -t mingw-wesnoth .
docker run -it -v "$PWD"/../../..:/wesnoth -v "$PWD"/../mingwbuild:/output mingw-wesnoth

View file

@ -0,0 +1,20 @@
FROM rwgrim/msys2-cross
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y scons g++-mingw-w64-x86-64 pkg-config python3-pefile && \
update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix && \
apt-get clean && \
rm -rf /var/lib/apt/lists
RUN pacman-cross -S --noconfirm \
mingw-w64-x86_64-boost \
mingw-w64-x86_64-SDL2 \
mingw-w64-x86_64-SDL2_image \
mingw-w64-x86_64-SDL2_mixer \
mingw-w64-x86_64-SDL2_ttf \
mingw-w64-x86_64-pango
COPY get_dlls.py /scripts/get_dlls.py
ENTRYPOINT mkdir /build && cd /build && scons -j `nproc` arch=x86-64 prefix=/windows/mingw64 gtkdir=/windows/mingw64 host=x86_64-w64-mingw32 -Y /wesnoth && cp /build/wesnoth.exe /output/ && cd /output && python3 /scripts/get_dlls.py

View file

@ -0,0 +1,18 @@
#!/bin/env python
import pefile, pathlib, shutil
dlls = set()
dllpath = pathlib.Path('/windows/mingw64/bin')
pe_modules = set([pefile.PE('wesnoth.exe')])
while pe_modules:
pe = pe_modules.pop()
for entry in pe.DIRECTORY_ENTRY_IMPORT:
path = dllpath / pathlib.Path(entry.dll.decode())
if path not in dlls and path.exists():
dlls.add(path)
pe_modules.add(pefile.PE(path))
for dll in dlls:
shutil.copy(dll, ".")