Mono build scripts for Godot
Go to file
Rémi Verschelde 6236e2ee74
CI: Mono 6.12.0.198, Python 3.11, use ubuntu-latest
- Rediff patches against Mono 6.12.0.198.
- Drop `xcode_13_14_fix.diff` which is included upstream in 6.12.0.198.
2023-05-26 12:59:57 +02:00
.github CI: Mono 6.12.0.198, Python 3.11, use ubuntu-latest 2023-05-26 12:59:57 +02:00
files CI: Mono 6.12.0.198, Python 3.11, use ubuntu-latest 2023-05-26 12:59:57 +02:00
__init__.py
.gitignore Apple silicon: arm64 macOS and arm64 iOS simulator 2021-05-22 02:36:45 +02:00
android.py Upgrade Android NDK to r23 LTS 2022-07-08 10:30:28 +01:00
bcl.py Enable BTLS when building for Windows 2021-07-29 08:09:14 -06:00
cmd_utils.py
desktop.py Windows: Re-add --enable-btls-lib to build BTLS dll 2022-05-24 15:46:20 +02:00
format.sh CI: Build with Mono 6.12.0.111 and Emscripten 1.39.9 2020-11-16 17:17:03 +01:00
ios.py Apple silicon: arm64 macOS and arm64 iOS simulator 2021-05-22 02:36:45 +02:00
LICENSE
linux.py Use /usr/bin/env python3 shebang 2020-10-13 14:55:12 +02:00
llvm.py Apple silicon: arm64 macOS and arm64 iOS simulator 2021-05-22 02:36:45 +02:00
msbuild_helper.py WASM/BCL: Build WebAssembly.Framework.sln and include in BCL 2020-12-14 20:51:58 +01:00
options.py Upgrade Android NDK to r23 LTS 2022-07-08 10:30:28 +01:00
os_utils.py offsets-tool: new location and OSXCross support 2020-04-16 15:28:28 +02:00
osx.py Use /usr/bin/env python3 shebang 2020-10-13 14:55:12 +02:00
patch_emscripten.py CI: Build with Mono 6.12.0.111 and Emscripten 1.39.9 2020-11-16 17:17:03 +01:00
patch_mono.py CI: Mono 6.12.0.198, Python 3.11, use ubuntu-latest 2023-05-26 12:59:57 +02:00
print_env.sh
README.md CI: Mono 6.12.0.198, Python 3.11, use ubuntu-latest 2023-05-26 12:59:57 +02:00
reference_assemblies.py Use /usr/bin/env python3 shebang 2020-10-13 14:55:12 +02:00
runtime.py offsets-tool: new location and OSXCross support 2020-04-16 15:28:28 +02:00
wasm.py Use /usr/bin/env python3 shebang 2020-10-13 14:55:12 +02:00
windows.py Use /usr/bin/env python3 shebang 2020-10-13 14:55:12 +02:00

Mono build scripts for Godot

Build

This repository contains scripts for building the Mono runtime to use with Godot Engine.

Supported versions

The scripts are tested against specific versions of the toolchains used by Godot. While they may work with other versions, you might have issues applying patches or compiling, so we recommend using the versions below.

  • Mono: 6.12.0.198.
  • Emscripten: 1.39.9.
  • Android NDK: 23.2.8568313

Command-line options

Requires Python 3.7 or higher

These scripts are based on the Mono sdks makefiles, with some changes to work well with Godot. Some platforms or targets depend on files from the sdks directory in the Mono source repository. This directory may be missing from tarballs. If that's the case, cloning the git repository may be needed. This table can be used to determine the branch for a specific version of Mono.

Some patches need to be applied to the Mono sources before building. This can be done by running python3 ./patch_mono.py.

Run python3 SCRIPT.py --help for the full list of command line options.

By default, the scripts will install the resulting files to $HOME/mono-installs. A custom output directory can be specified with the --install-dir option.

When cross-compiling to Windows, --mxe-prefix must be specified. For example, with the mingw-w64 package installed on Ubuntu, one can pass --mxe-prefix=/usr.

A path to the Mono source tree must be provided with the --mono-sources option or with the MONO_SOURCE_ROOT environment variable:

export MONO_SOURCE_ROOT=$HOME/git/mono

Notes

  • Python 3.7 or higher is required.
  • OSXCROSS is supported except for building the Mono cross-compilers.
  • Building on Windows is not supported. It's possible to use Cygwin or WSL (Windows Subsystem for Linux) but this hasn't been tested.

Compiling Godot for Desktop with this Runtime

In order to compile mono into Godot for deskop you will need to first build for desktop (see 'Desktop' below), and then Base Class Libraries (see 'Base Class library' below).

Then run the 'copy-bcl' action of the same desktop script you ran configure and make on, specifying the same target platforms you used before. This will copy the bcl runtime into the runtime directories that the subsequent Godot build (using copy_mono_root=yes) expects to find them in. e.g. ./linux.py copy-bcl --target=x86 --target=x86_64

Then you'll need to compile Godot using copy_mono_root=yes e.g. scons -j6 target=release_debug tools=yes module_mono_enabled=yes copy_mono_root=yes mono_prefix="$HOME/mono-installs/desktop-linux-x86_64-release"

Desktop

# Build the runtimes for 32-bit and 64-bit Linux.
./linux.py configure --target=x86 --target=x86_64
./linux.py make --target=x86 --target=x86_64

# Build the runtimes for 32-bit and 64-bit Windows.
./windows.py configure --target=x86 --target=x86_64 --mxe-prefix=/usr
./windows.py make --target=x86 --target=x86_64 --mxe-prefix=/usr

# Build the runtime for 64-bit macOS.
./osx.py configure --target=x86_64
./osx.py make --target=x86_64

AOT cross-compilers for desktop platforms cannot be built with these scripts yet.

Android

Building for Android requires the Android SDK cmdline-tools to be installed in the Android SDK folder.

# The default location for the Android SDK is $HOME/Android/Sdk. This step can be omitted if SDK is in this location.
export ANDROID_SDK_ROOT=$HOME/Android/Sdk

# Build the runtime for all supported Android ABIs.
./android.py configure --target=all-targets
./android.py make --target=all-targets

The option --target=all-targets is a shortcut for --target=armv7 --target=arm64v8 --target=x86 --target=x86_64.

iOS

# Build the runtime for the iPhone simulator.
./ios.py configure --target=x86_64
./ios.py make --target=x86_64

# Build the runtime for the iPhone device.
./ios.py configure --target=arm64
./ios.py make --target=arm64

# Build the AOT cross-compiler targeting the iPhone device.
./ios.py configure --target=cross-arm64
./ios.py make --target=cross-arm64

The runtime can also be built an OSXCROSS iOS toolchain. The --ios-toolchain and --ios-sdk options are the equivalent of the Godot SCons options IPHONEPATH and IPHONESDK respectively. The cross compiler cannot be built with OSXCROSS yet.

WebAssembly

Just like with Godot, an active Emscripten SDK is needed for building the Mono WebAssembly runtime.

Some patches may need to be applied to the Emscripten SDK before building Mono. This can be done by running ./patch_emscripten.py.

# Build the runtime for WebAssembly.
./wasm.py configure --target=runtime
./wasm.py make --target=runtime

AOT cross-compilers for WebAssembly cannot be built with this script yet.

Base Class library

# Build the Desktop BCL.
./bcl.py make --product=desktop

# Build the Desktop BCL for Windows.
./bcl.py make --product=desktop-win32

# Build the Android BCL.
./bcl.py make --product=android

# Build the iOS BCL.
./bcl.py make --product=ios

# Build the WebAssembly BCL.
./bcl.py make --product=wasm

NOTE: Building the Desktop BCL for the current system is required first to be able to build the Desktop BCL for Windows.

Reference Assemblies

./reference_assemblies.py install