Godot:Compiling:Mono
Build project
Mono build scripts for Godot.
#!/bin/bash
# Linux case:
# sudo apt-get -y install git autoconf libtool libtool-bin automake build-essential gettext cmake python3 curl
WORKING_DIR=$PWD
INSTALL_DIR=$WORKING_DIR/install
MONO_VERSION=6.12.0.122
MONO_NAME=mono-$MONO_VERSION
MONO_FILE=$MONO_NAME.tar.xz
MONO_URL="https://download.mono-project.com/sources/mono/${MONO_FILE}"
MONO_SOURCE_ROOT=$WORKING_DIR/$MONO_NAME
THREAD_FLAG=-j8
GODOT_MONO_BUILD_NAME=godot-mono-builds
GODOT_MONO_BUILD_DIR=$WORKING_DIR/$GODOT_MONO_BUILD_NAME
export MONO_SOURCE_ROOT
if [[ ! -d "$GODOT_MONO_BUILD_DIR" ]]; then
echo "[CLONE GODOT_MONO_BUILD]"
git clone \
https://github.com/godotengine/godot-mono-builds \
$GODOT_MONO_BUILD_NAME
cd "$GODOT_MONO_BUILD_NAME"
git checkout df330ce
git clean -xdf
cd ..
fi
if [[ ! -f "${MONO_FILE}" ]]; then
echo "[DOWNLOAD MONO]"
curl -o "${MONO_FILE}" "${MONO_URL}"
fi
if [[ ! -d "${MONO_SOURCE_ROOT}" ]]; then
echo "[UNCOMPRESS MONO]"
tar vxf "${MONO_FILE}"
fi
echo "[LOAD OPY-ENV]"
. opy-env
# python3 godot-mono-builds/patch_mono.py
function _build
{
local platform=$1
local target=$2
echo "[BUILD ${platform}-${target}]"
python3 godot-mono-builds/${platform}.py \
configure \
--target=${target} \
--install-dir="$INSTALL_DIR" \
$THREAD_FLAG
local config_code=$?
if [[ $config_code -ne 0 ]]; then
echo "[BUILD ${platform}-${target} CONFIGURE] ERROR CODE: $config_code"
exit $config_code
fi
python3 godot-mono-builds/${platform}.py \
make \
--target=${target} \
--install-dir="$INSTALL_DIR" \
$THREAD_FLAG
local make_code=$?
if [[ $make_code -ne 0 ]]; then
echo "[BUILD ${platform}-${target} MAKE] ERROR CODE: $make_code"
exit $make_code
fi
}
_build osx x86_64
_build ios x86_64
_build ios arm64
_build ios cross-arm64
# # Base Class library
python3 godot-mono-build/bcl.py make --product=desktop
python3 godot-mono-build/bcl.py make --product=ios
# Reference Assemblies
python3 godot-mono-build/reference_assemblies.py install