diff --git a/utils/dockerbuilds/make_mingw_build b/utils/dockerbuilds/make_mingw_build new file mode 100755 index 00000000000..92faea8ff55 --- /dev/null +++ b/utils/dockerbuilds/make_mingw_build @@ -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 diff --git a/utils/dockerbuilds/mingw/Dockerfile b/utils/dockerbuilds/mingw/Dockerfile new file mode 100644 index 00000000000..a424563ff1d --- /dev/null +++ b/utils/dockerbuilds/mingw/Dockerfile @@ -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 diff --git a/utils/dockerbuilds/mingw/get_dlls.py b/utils/dockerbuilds/mingw/get_dlls.py new file mode 100755 index 00000000000..efc5481e458 --- /dev/null +++ b/utils/dockerbuilds/mingw/get_dlls.py @@ -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, ".")