From c55dffec9a318f5e127129ed8bec8cbf1d14b283 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Mon, 12 Jul 2021 14:46:24 +0200 Subject: [PATCH] macOS: Use `godot-mono-builds` scripts, add macOS arm64 This changes our handmade `configure` calls to rely on the streamlined build process from `godot-mono-builds`, so that our builds are consistent with the ones generated there. This enables us to target macOS arm64 easily as neikeq did the relevant work in the `godot-mono-builds` scripts. Includes a backport of https://github.com/mono/mono/pull/21147 to fix Mono build with `godot-mono-builds` using a wrapper for osxcross. --- Dockerfile.osx | 31 ++++---------- files/mono-config-macosx | 46 --------------------- files/patches/mono-btls-cmake-wrapper.patch | 13 ++++++ 3 files changed, 21 insertions(+), 69 deletions(-) delete mode 100644 files/mono-config-macosx create mode 100644 files/patches/mono-btls-cmake-wrapper.patch diff --git a/Dockerfile.osx b/Dockerfile.osx index 01ef0e7..2fb935b 100644 --- a/Dockerfile.osx +++ b/Dockerfile.osx @@ -19,30 +19,15 @@ ENV PATH="/root/osxcross/target/bin:${PATH}" RUN cp -a /root/files/${mono_version} /root && \ cd /root/${mono_version} && \ - export CMAKE=/root/osxcross/target/bin/x86_64-apple-darwin20.2-cmake && \ - NOCONFIGURE=1 ./autogen.sh && \ - ./configure --prefix=/root/dependencies/mono \ - --build=x86_64-linux-gnu \ - --host=x86_64-apple-darwin20.2 \ - --disable-boehm \ - --disable-mcs-build \ - --with-tls=pthread \ - --disable-dtrace \ - --disable-executables \ - mono_cv_uscore=yes \ - _lt_dar_can_shared=yes \ - CC=o64-clang \ - CXX=o64-clang++ && \ - make -j && \ - make install && \ + patch -p1 < /root/files/patches/mono-btls-cmake-wrapper.patch && \ + export MONO_SOURCE_ROOT=/root/${mono_version} && \ + export OSXCROSS_SDK=20.2 && \ + cd /root/${mono_version}/godot-mono-builds && \ + python3 osx.py configure -j --target=x86_64 --target=arm64 && \ + python3 osx.py make -j --target=x86_64 --target=arm64 && \ + python3 bcl.py make --product=desktop && \ + python3 osx.py copy-bcl --target=x86_64 --target=arm64 && \ cd /root && \ - rm -rf /root/dependencies/mono/bin/mono{,-sgen} /root/dependencies/mono/lib/mono && \ - ln -s /usr/bin/mono /root/dependencies/mono/bin/mono && \ - ln -s /usr/bin/mono-sgen /root/dependencies/mono/bin/mono-sgen && \ - ln -s /usr/lib/mono /root/dependencies/mono/lib/mono && \ - mkdir -p /root/dependencies/mono/etc && \ - cp -rvp /etc/mono /root/dependencies/mono/etc/ && \ - cp /root/files/mono-config-macosx /root/dependencies/mono/etc/mono/config && \ rm -rf /root/${mono_version} CMD /bin/bash diff --git a/files/mono-config-macosx b/files/mono-config-macosx deleted file mode 100644 index 0295dd4..0000000 --- a/files/mono-config-macosx +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/files/patches/mono-btls-cmake-wrapper.patch b/files/patches/mono-btls-cmake-wrapper.patch new file mode 100644 index 0000000..9b1a852 --- /dev/null +++ b/files/patches/mono-btls-cmake-wrapper.patch @@ -0,0 +1,13 @@ +diff --git a/mono/btls/Makefile.am b/mono/btls/Makefile.am +index 9a385443..094b26f4 100644 +--- a/mono/btls/Makefile.am ++++ b/mono/btls/Makefile.am +@@ -58,7 +58,7 @@ all-local: build-shared/libmono-btls-shared$(libsuffix) + + build-shared/$(BUILDFILE): + -mkdir -p build-shared +- (cd build-shared && CC="$(CC)" CXX="$(CXX)" "$(CMAKE)" $(CMAKE_ARGS) $(BTLS_CMAKE_ARGS) -DBUILD_SHARED_LIBS=1 "$(abs_top_srcdir)/mono/btls") ++ (cd build-shared && CC="$(CC)" CXX="$(CXX)" $(CMAKE) $(CMAKE_ARGS) $(BTLS_CMAKE_ARGS) -DBUILD_SHARED_LIBS=1 "$(abs_top_srcdir)/mono/btls") + + if NINJA + build-shared/libmono-btls-shared$(libsuffix): build-shared/$(BUILDFILE) $(MONO_BTLS_SOURCES_FILES)