Mono: Update to 6.12.0.147, adds Apple Silicon support

This is a Preview release of Mono, so we use `centos8-preview` packages which
correspond to its MSBuild version requirements (16.10.1).

For osxcross, we need to build compiler-rt to be able to link the new Apple
Silicon support code. See #83 for details.
Includes a backport of https://github.com/tpoechtrager/osxcross/pull/284 to
simplify the install process.

Actual macOS arm64 builds will be added in a follow-up commit.
This commit is contained in:
Rémi Verschelde
2021-07-12 14:40:28 +02:00
parent b409e6b9e9
commit c98720506a
5 changed files with 127 additions and 7 deletions

View File

@@ -61,7 +61,7 @@ RUN if [ -z "${mono_version}" ]; then echo -e "\n\nargument mono-version is mand
# Until we can build the cross-compiler, we include a pre-made build in the container.
RUN mkdir -p /root/aot-compilers/iphone-arm64 && \
curl -LO https://github.com/godotengine/godot-mono-builds/releases/download/release-df330ce/ios-cross-arm64.zip && \
curl -LO https://github.com/godotengine/godot-mono-builds/releases/download/release-c3a9d31/ios-cross-arm64.zip && \
dnf -y install --setopt=install_weak_deps=False p7zip && \
7za e ios-cross-arm64.zip ios-cross-arm64-release/bin/aarch64-apple-darwin-mono-sgen -o/root/aot-compilers/iphone-arm64 && \
rm ios-cross-arm64.zip

View File

@@ -16,9 +16,9 @@ RUN if [ -z "${mono_version}" ]; then echo -e "\n\nargument mono-version is mand
rm -rf /root/${mono_version} && \
cert-sync /etc/pki/tls/certs/ca-bundle.crt && \
rpm -ivh --nodeps \
https://download.mono-project.com/repo/centos8-stable/m/msbuild/msbuild-16.6+xamarinxplat.2021.01.15.16.11-0.xamarin.2.epel8.noarch.rpm \
https://download.mono-project.com/repo/centos8-stable/m/msbuild/msbuild-sdkresolver-16.6+xamarinxplat.2021.01.15.16.11-0.xamarin.2.epel8.noarch.rpm \
https://download.mono-project.com/repo/centos8-stable/m/msbuild-libhostfxr/msbuild-libhostfxr-3.0.0.2019.04.16.02.13-0.xamarin.4.epel8.x86_64.rpm \
https://download.mono-project.com/repo/centos8-stable/n/nuget/nuget-5.6.0.6489.bin-0.xamarin.1.epel8.noarch.rpm
https://download.mono-project.com/repo/centos8-preview/m/msbuild/msbuild-16.10.1+xamarinxplat.2021.05.26.14.00-0.xamarin.7.epel8.noarch.rpm \
https://download.mono-project.com/repo/centos8-preview/m/msbuild/msbuild-sdkresolver-16.10.1+xamarinxplat.2021.05.26.14.00-0.xamarin.7.epel8.noarch.rpm \
https://download.mono-project.com/repo/centos8-preview/m/msbuild-libhostfxr/msbuild-libhostfxr-3.0.0.2019.04.16.02.13-0.xamarin.4.epel8.x86_64.rpm \
https://download.mono-project.com/repo/centos8-preview/n/nuget/nuget-5.6.0.6489.bin-0.xamarin.1.epel8.noarch.rpm
CMD /bin/bash

View File

@@ -10,7 +10,9 @@ RUN if [ -z "${mono_version}" ]; then echo -e "\n\nargument mono-version is mand
cd /root/osxcross && \
git checkout 447cf3b3ea4323d24648f5f7f775f5977a0d15bd && \
ln -s /root/files/MacOSX11.1.sdk.tar.xz /root/osxcross/tarballs && \
UNATTENDED=1 ./build.sh
patch -p1 < /root/files/patches/osxcross-pr284-compiler-rt.patch && \
UNATTENDED=1 ./build.sh && \
ENABLE_COMPILER_RT_INSTALL=1 ./build_compiler_rt.sh
ENV OSXCROSS_ROOT=/root/osxcross
ENV PATH="/root/osxcross/target/bin:${PATH}"

View File

@@ -97,7 +97,7 @@ if [ ! -e ${mono_root} ]; then
# Set up godot-mono-builds in tree
git clone --progress https://github.com/godotengine/godot-mono-builds
pushd godot-mono-builds
git checkout df330ce0bec35836a33b97db27c1e72014571103
git checkout release/mono-6.12.0.147
export MONO_SOURCE_ROOT=${mono_root}
python3 patch_mono.py
popd

View File

@@ -0,0 +1,118 @@
From b875d7c1360c8ff2077463d7a5a12e1cff1cc683 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= <rverschelde@gmail.com>
Date: Mon, 12 Jul 2021 13:34:32 +0200
Subject: [PATCH] compiler-rt: Add option to automate install process
Also mention that compiler-rt can be needed to build code using
`__builtin_available()`.
Fixes #278.
---
README.COMPILER-RT.md | 4 ++++
README.md | 3 +++
build_compiler_rt.sh | 33 ++++++++++++++++++++++++---------
3 files changed, 31 insertions(+), 9 deletions(-)
diff --git a/README.COMPILER-RT.md b/README.COMPILER-RT.md
index b2754dfcf..dced89686 100644
--- a/README.COMPILER-RT.md
+++ b/README.COMPILER-RT.md
@@ -10,6 +10,10 @@ Ensure you have finished `build.sh`,
then run: `./build_compiler_rt.sh`.
+By default, installation steps for compiler-rt will be printed to the terminal
+to run manually, but you can automate the installation process by defining
+`ENABLE_COMPILER_RT_INSTALL`.
+
You can verify compiler-rt is working by invoking the following command:
echo "int main(void){return 0;}" | xcrun clang -xc -o/dev/null -v - 2>&1 | \
diff --git a/README.md b/README.md
index 60d19f917..f32bf626c 100644
--- a/README.md
+++ b/README.md
@@ -33,6 +33,9 @@ It also includes scripts for optionally building
* the "compiler-rt" runtime library, and
* the `llvm-dsymutil` tool required for debugging.
+Note: The "compiler-rt" library can be needed to link code that uses the
+`__builtin_available()` runtime version check.
+
### WHAT CAN BE BUILT WITH IT? ###
diff --git a/build_compiler_rt.sh b/build_compiler_rt.sh
index 8f47262a2..508742cab 100755
--- a/build_compiler_rt.sh
+++ b/build_compiler_rt.sh
@@ -182,22 +182,39 @@ fi
rm -f $BUILD_DIR/.compiler-rt_build_complete
+# Installation. Can be either automated (ENABLE_COMPILER_RT_INSTALL) or will
+# print the commands that the user should run manually.
+
+function print_or_run() {
+ if [ -z "$ENABLE_COMPILER_RT_INSTALL" ]; then
+ echo "$@"
+ else
+ $@
+ fi
+}
+
echo ""
echo ""
echo ""
-echo "Please run the following commands by hand to install compiler-rt:"
+if [ -z "$ENABLE_COMPILER_RT_INSTALL" ]; then
+ echo "Please run the following commands by hand to install compiler-rt:"
+else
+ echo "Installing compiler-rt headers and libraries to the following paths:"
+ echo " ${CLANG_INCLUDE_DIR}"
+ echo " ${CLANG_DARWIN_LIB_DIR}"
+fi
echo ""
-echo "mkdir -p ${CLANG_INCLUDE_DIR}"
-echo "mkdir -p ${CLANG_DARWIN_LIB_DIR}"
-echo "cp -rv $BUILD_DIR/compiler-rt/compiler-rt/include/sanitizer ${CLANG_INCLUDE_DIR}"
+print_or_run mkdir -p ${CLANG_INCLUDE_DIR}
+print_or_run mkdir -p ${CLANG_DARWIN_LIB_DIR}
+print_or_run cp -rv $BUILD_DIR/compiler-rt/compiler-rt/include/sanitizer ${CLANG_INCLUDE_DIR}
if [ $USE_CMAKE -eq 1 ]; then
### CMAKE ###
- echo "cp -v $BUILD_DIR/compiler-rt/compiler-rt/build/lib/darwin/*.a ${CLANG_DARWIN_LIB_DIR}"
- echo "cp -v $BUILD_DIR/compiler-rt/compiler-rt/build/lib/darwin/*.dylib ${CLANG_DARWIN_LIB_DIR}"
+ print_or_run cp -v $BUILD_DIR/compiler-rt/compiler-rt/build/lib/darwin/*.a ${CLANG_DARWIN_LIB_DIR}
+ print_or_run cp -v $BUILD_DIR/compiler-rt/compiler-rt/build/lib/darwin/*.dylib ${CLANG_DARWIN_LIB_DIR}
### CMAKE END ###
@@ -209,7 +226,7 @@ else
function print_install_command() {
if [ -f "$1" ]; then
- echo "cp $PWD/compiler-rt/$1 ${CLANG_DARWIN_LIB_DIR}/$2"
+ print_or_run cp $PWD/compiler-rt/$1 ${CLANG_DARWIN_LIB_DIR}/$2
fi
}
@@ -219,14 +236,12 @@ else
print_install_command "cc_kext/libcompiler_rt.a" "libclang_rt.cc_kext.a"
print_install_command "profile_osx/libcompiler_rt.a" "libclang_rt.profile_osx.a"
-
print_install_command "ubsan_osx_dynamic/libcompiler_rt.dylib" \
"libclang_rt.ubsan_osx_dynamic.dylib"
print_install_command "asan_osx_dynamic/libcompiler_rt.dylib" \
"libclang_rt.asan_osx_dynamic.dylib"
-
popd &>/dev/null
### MAKE END ###