From 428340a423bee13fa358bbb80f9043ce81348c33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Mon, 12 Jul 2021 14:49:24 +0200 Subject: [PATCH] Windows: Use `godot-mono-builds` scripts, remove Wine dependency Streamlines the build process as done for Linux and macOS in previous commits, and as was done for mobile and web platforms from the start. We're now fully in sync with `godot-mono-builds`. This also removes the need to hack around cross-compilation issues using Wine, which also seemed no longer to work on Fedora 34 anyway. --- Dockerfile.windows | 31 +++++++--------------- files/mono-build-win32.sh | 29 -------------------- files/patches/wine-mono.patch | 50 ----------------------------------- 3 files changed, 9 insertions(+), 101 deletions(-) delete mode 100755 files/mono-build-win32.sh delete mode 100644 files/patches/wine-mono.patch diff --git a/Dockerfile.windows b/Dockerfile.windows index 5e38a4e..45a069c 100644 --- a/Dockerfile.windows +++ b/Dockerfile.windows @@ -5,29 +5,16 @@ ARG mono_version RUN if [ -z "${mono_version}" ]; then echo -e "\n\nargument mono-version is mandatory!\n\n"; exit 1; fi && \ dnf -y install --setopt=install_weak_deps=False \ - mingw32-gcc mingw32-gcc-c++ mingw32-winpthreads-static mingw64-gcc mingw64-gcc-c++ mingw64-winpthreads-static wine && \ + mingw32-gcc mingw32-gcc-c++ mingw32-winpthreads-static mingw64-gcc mingw64-gcc-c++ mingw64-winpthreads-static && \ cp -a /root/files/${mono_version} /root && \ - cd /root/${mono_version} && \ - patch -p1 < /root/files/patches/wine-mono.patch && \ - export WINE_BITS=64 && \ - bash /root/files/mono-build-win32.sh --prefix=/root/dependencies/mono-64 --host=x86_64-w64-mingw32 \ - --with-profile4_x=yes --with-runtime-preset=net_4_x && \ - git clean -fdx && \ - cp /root/dependencies/mono-64/bin/libMonoPosixHelper.dll /root/dependencies/mono-64/bin/MonoPosixHelper.dll && \ - rm -f /root/dependencies/mono-64/bin/mono /root/dependencies/mono-64/bin/mono-sgen && \ - ln -s /usr/bin/mono /root/dependencies/mono-64/bin/mono && \ - ln -s /usr/bin/mono-sgen /root/dependencies/mono-64/bin/mono-sgen && \ - cp -rvp /etc/mono /root/dependencies/mono-64/etc && \ - export WINE_BITS=32 && \ - bash /root/files/mono-build-win32.sh --prefix=/root/dependencies/mono-32 --host=i686-w64-mingw32 \ - --with-profile4_x=yes --with-runtime-preset=net_4_x && \ + export MONO_SOURCE_ROOT=/root/${mono_version} && \ + cd /root/${mono_version}/godot-mono-builds && \ + python3 windows.py configure -j --target=x86_64 --target=x86 --mxe-prefix=/usr && \ + python3 windows.py make -j --target=x86_64 --target=x86 --mxe-prefix=/usr && \ + python3 bcl.py make -j --product=desktop && \ + python3 bcl.py make -j --product=desktop-win32 && \ + python3 windows.py copy-bcl --target=x86_64 --target=x86 && \ cd /root && \ - rm -rf /root/${mono_version} && \ - cp /root/dependencies/mono-32/bin/libMonoPosixHelper.dll /root/dependencies/mono-32/bin/MonoPosixHelper.dll && \ - rm -f /root/dependencies/mono-32/bin/mono /root/dependencies/mono-32/bin/mono-sgen && \ - ln -s /usr/bin/mono /root/dependencies/mono-32/bin/mono && \ - ln -s /usr/bin/mono-sgen /root/dependencies/mono-32/bin/mono-sgen && \ - cp -rvp /etc/mono /root/dependencies/mono-32/etc && \ - dnf -y remove wine + rm -rf /root/${mono_version} CMD /bin/bash diff --git a/files/mono-build-win32.sh b/files/mono-build-win32.sh deleted file mode 100755 index 01d0208..0000000 --- a/files/mono-build-win32.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -if [ "${WINE_BITS}" == "64" ]; then - export WINEPATH="/usr/x86_64-w64-mingw32/sys-root/mingw/bin/" -else - export WINEPATH="/usr/i686-w64-mingw32/sys-root/mingw/bin/" -fi - -echo -e '#!/bin/bash\n'"wine${WINE_BITS}"' $(dirname $0)/mono-sgen.exe "$@"' > mono/mini/mono -chmod +x mono/mini/mono - -mkdir -p .bin -echo -e '#!/bin/bash\necho $@ | awk "{print \$NF}"' > .bin/cygpath -chmod +x .bin/cygpath -export PATH="$(pwd)/.bin/:$PATH" - -./autogen.sh $@ --disable-boehm --with-mcs-docs=no HOST_PROFILE=win32 -echo '#define HAVE_STRUCT_SOCKADDR_IN6 1' >> config.h -pushd mcs/jay -make -j CC=gcc -popd - -for dir in external/roslyn-binaries/Microsoft.Net.Compilers/[0-9]*; do - MONO_PATH="$(winepath -w $(pwd)/${dir});${MONO_PATH}" -done -export MONO_PATH - -make -j -make install diff --git a/files/patches/wine-mono.patch b/files/patches/wine-mono.patch deleted file mode 100644 index c2f21fc..0000000 --- a/files/patches/wine-mono.patch +++ /dev/null @@ -1,50 +0,0 @@ -commit c2e1ed54e1a3f613bdda3f085fee5b21c9fa174d -Author: Hein-Pieter van Braam-Stewart -Date: Sat Dec 14 23:16:19 2019 +0100 - - Workaround - -diff --git a/mcs/build/platforms/win32.make b/mcs/build/platforms/win32.make -index dd969b51..bb15aba2 100644 ---- a/mcs/build/platforms/win32.make -+++ b/mcs/build/platforms/win32.make -@@ -9,10 +9,11 @@ PLATFORM_TEST_HARNESS_EXCLUDES = NotOnWindows - - EXTERNAL_RUNTIME = mono - --PLATFORM_CHANGE_SEPARATOR_CMD=tr '/' '\\\\' -+#PLATFORM_CHANGE_SEPARATOR_CMD=tr '\\' '/' -+PLATFORM_CHANGE_SEPARATOR_CMD=cat - PLATFORM_PATH_SEPARATOR = ; - --override CURDIR:=$(shell cygpath -m $(CURDIR)) -+#override CURDIR:=$(shell cygpath -m $(CURDIR)) - - hidden_prefix = - hidden_suffix = .tmp -diff --git a/mcs/build/profiles/build.make b/mcs/build/profiles/build.make -index b1c9a410..004f9f33 100644 ---- a/mcs/build/profiles/build.make -+++ b/mcs/build/profiles/build.make -@@ -32,7 +32,7 @@ endif - # - ILASM = $(PROFILE_RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/tmp/ilasm.exe - STRING_REPLACER = $(PROFILE_RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/tmp/cil-stringreplacer.exe --GENSOURCES =$(PROFILE_RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/tmp/gensources.exe -+GENSOURCES = mono $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/tmp/gensources.exe - - MCS = $(BOOTSTRAP_MCS) - -diff --git a/mcs/build/rules.make b/mcs/build/rules.make -index e57a636e..16f6cdc7 100644 ---- a/mcs/build/rules.make -+++ b/mcs/build/rules.make -@@ -60,7 +60,7 @@ INTERNAL_CSC = CSC_SDK_PATH_DISABLED= $(RUNTIME) $(RUNTIME_FLAGS) $(CSC_RUNTIME_ - RESGEN = MONO_PATH="$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/resgen.exe - STRING_REPLACER = MONO_PATH="$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/cil-stringreplacer.exe - ILASM = MONO_PATH="$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/ilasm.exe --GENSOURCES = MONO_PATH="$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/gensources.exe -+GENSOURCES = MONO_PATH="$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" mono $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/gensources.exe - - depsdir = $(topdir)/build/deps -