Compare commits

...

6 Commits

Author SHA1 Message Date
Rémi Verschelde
3504af335e Replace obsoleted Python distutils.spawn.find_executable by shutil.which 2025-10-14 11:55:30 +02:00
Rémi Verschelde
df26bb676c Replace obsoleted Python distutils.dir_util.copy_tree by shutil.copytree 2025-10-14 00:16:11 +02:00
Raul Santos
ae49eba999 Merge pull request #91 from raulsntos/android-fixes
Fix Android target names and add flags for 16KB page size
2025-10-12 23:52:47 +02:00
Rémi Verschelde
9fb4d32e35 Merge pull request #92 from godotengine/update-ci
CI: Bump actions, various fixes, update to Mono 6.12.0.206
2025-10-12 13:03:45 +02:00
Rémi Verschelde
945d2619f8 CI: Bump actions, various fixes, update to Mono 6.12.0.206
- Update TuxFamily links for Linux SDKs.
- Downgrade CMake to v3 on macOS, it breaks building old LLVM.
- Fix conflict between LLVM `regex_impl.h` header guard and Xcode SDK.
- Pin `macos-13` as newer ones are arm64-based and our scripts don't seem
  to infer this properly.
- Patch Mono `offsets-tool.py` to support newer Clang (dotnet patches).
2025-10-12 12:14:33 +02:00
Rémi Verschelde
4912f62a8f Revert "Add patch to fix Linux kernel regression with mmap and MAP_32BIT"
This reverts commit d496154ab1.

The Linux kernel regression has been patched in 6.1.30 and 6.3.4.
2023-06-02 15:55:02 +02:00
16 changed files with 468 additions and 183 deletions

View File

@@ -23,17 +23,19 @@ on:
env:
# Use SHA or tag instead of the branch for caching purposes.
MONO_TAG: mono-6.12.0.198
MONO_TAG: mono-6.12.0.206
PYTHON_VERSION: '3.11'
# Should match the version that Mono supports.
EMSDK_VERSION: 1.39.9
# platform/iphone/detect.py
IOS_VERSION_MIN: 10.0
IOS_VERSION_MIN: 12.0
# Supporting Xcode 15+ requires backporting a bunch of stuff.
XCODE_VERSION: 14.3.1
jobs:
linux:
name: Linux
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
strategy:
matrix:
target: [x86, x86_64]
@@ -49,37 +51,37 @@ jobs:
if: matrix.target == 'x86_64'
run: |
cd /home/runner
curl -LO https://downloads.tuxfamily.org/godotengine/toolchains/linux/2021-02-11/x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2
curl -LO https://github.com/godotengine/buildroot/releases/download/godot-2023.08.x-4/x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2
tar xf x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2
rm -f x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2
cd x86_64-godot-linux-gnu_sdk-buildroot
./relocate-sdk.sh
cd bin
rm -f {aclocal*,auto*,libtool*,m4}
for file in x86_64-godot-*; do alias=$(echo $file | sed "s/godot-//"); ln -s $file $alias; done
echo "PATH=/home/runner/x86_64-godot-linux-gnu_sdk-buildroot/bin:${PATH}" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=/home/runner/x86_64-godot-linux-gnu_sdk-buildroot/x86_64-godot-linux-gnu/lib64:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
- name: Install Linux SDK (x86)
if: matrix.target == 'x86'
run: |
cd /home/runner
curl -LO https://downloads.tuxfamily.org/godotengine/toolchains/linux/2021-02-11/i686-godot-linux-gnu_sdk-buildroot.tar.bz2
curl -LO https://github.com/godotengine/buildroot/releases/download/godot-2023.08.x-4/i686-godot-linux-gnu_sdk-buildroot.tar.bz2
tar xf i686-godot-linux-gnu_sdk-buildroot.tar.bz2
rm -f i686-godot-linux-gnu_sdk-buildroot.tar.bz2
cd i686-godot-linux-gnu_sdk-buildroot
./relocate-sdk.sh
cd bin
rm -f {aclocal*,auto*,libtool*,m4}
for file in i686-godot-*; do alias=$(echo $file | sed "s/godot-//"); ln -s $file $alias; done
echo "PATH=/home/runner/i686-godot-linux-gnu_sdk-buildroot/bin:${PATH}" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=/home/runner/i686-godot-linux-gnu_sdk-buildroot/i686-godot-linux-gnu/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
- name: Cache Mono Sources
id: cache_mono_sources
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ env.MONO_SOURCE_ROOT }}
key: ${{ runner.os }}-${{ env.MONO_TAG }}-mono-sources
- name: Checkout Mono Sources
if: steps.cache_mono_sources.outputs.cache-hit != 'true'
uses: actions/checkout@v3
uses: actions/checkout@v5
with:
repository: mono/mono
ref: ${{ env.MONO_TAG }}
@@ -88,11 +90,11 @@ jobs:
- name: Clean Mono
run: pushd ${{ env.MONO_SOURCE_ROOT }} && git reset --hard && git clean -xffd && git submodule foreach --recursive git reset --hard && git submodule foreach --recursive git clean -xffd && git submodule update --init --recursive && popd
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v5
with:
path: godot-mono-builds
- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Patch Mono
@@ -109,7 +111,7 @@ jobs:
mkdir -p $HOME/mono-installs-artifacts
(cd $HOME/mono-installs && zip -ry $HOME/mono-installs-artifacts/linux-${{ matrix.target }}.zip desktop-linux-${{ matrix.target }}-release)
- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: linux-${{ matrix.target }}
path: ~/mono-installs-artifacts/linux-${{ matrix.target }}.zip
@@ -117,14 +119,14 @@ jobs:
run: pushd ${{ env.MONO_SOURCE_ROOT }} && git reset --hard && git clean -xffd && git submodule foreach --recursive git reset --hard && git submodule foreach --recursive git clean -xffd && git submodule update --init --recursive && popd
- name: Upload config.log After Error
if: ${{ failure() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: linux-${{ matrix.target }}-config.log
path: ~/mono-configs/desktop-linux-${{ matrix.target }}-release/config.log
windows:
name: Windows
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
strategy:
matrix:
target: [x86, x86_64]
@@ -147,13 +149,13 @@ jobs:
sudo apt-get -y install mingw-w64 libz-mingw-w64-dev
- name: Cache Mono Sources
id: cache_mono_sources
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ env.MONO_SOURCE_ROOT }}
key: ${{ runner.os }}-${{ env.MONO_TAG }}-mono-sources
- name: Checkout Mono Sources
if: steps.cache_mono_sources.outputs.cache-hit != 'true'
uses: actions/checkout@v3
uses: actions/checkout@v5
with:
repository: mono/mono
ref: ${{ env.MONO_TAG }}
@@ -162,11 +164,11 @@ jobs:
- name: Clean Mono
run: pushd ${{ env.MONO_SOURCE_ROOT }} && git reset --hard && git clean -xffd && git submodule foreach --recursive git reset --hard && git submodule foreach --recursive git clean -xffd && git submodule update --init --recursive && popd
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v5
with:
path: godot-mono-builds
- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Patch Mono
@@ -183,7 +185,7 @@ jobs:
mkdir -p $HOME/mono-installs-artifacts
(cd $HOME/mono-installs && zip -ry $HOME/mono-installs-artifacts/windows-${{ matrix.target }}.zip desktop-windows-${{ matrix.target }}-release)
- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: windows-${{ matrix.target }}
path: ~/mono-installs-artifacts/windows-${{ matrix.target }}.zip
@@ -191,14 +193,14 @@ jobs:
run: pushd ${{ env.MONO_SOURCE_ROOT }} && git reset --hard && git clean -xffd && git submodule foreach --recursive git reset --hard && git submodule foreach --recursive git clean -xffd && git submodule update --init --recursive && popd
- name: Upload config.log After Error
if: ${{ failure() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: windows-${{ matrix.target }}-config.log
path: ~/mono-configs/desktop-windows-${{ matrix.target }}-release/config.log
osx:
name: macOS
runs-on: macos-latest
runs-on: macos-13
strategy:
matrix:
target: [arm64, x86_64]
@@ -206,18 +208,26 @@ jobs:
- name: Set Environment Variables
run: |
echo "MONO_SOURCE_ROOT=$GITHUB_WORKSPACE/mono_sources" >> $GITHUB_ENV
- name: Setup compatible Xcode version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ env.XCODE_VERSION }}
- name: Install Dependencies
run: |
brew install autoconf automake libtool pkg-config cmake python3
brew install automake
- name: Install cmake 3
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.31.7'
- name: Cache Mono Sources
id: cache_mono_sources
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ env.MONO_SOURCE_ROOT }}
key: ${{ runner.os }}-${{ env.MONO_TAG }}-mono-sources
- name: Checkout Mono Sources
if: steps.cache_mono_sources.outputs.cache-hit != 'true'
uses: actions/checkout@v3
uses: actions/checkout@v5
with:
repository: mono/mono
ref: ${{ env.MONO_TAG }}
@@ -226,15 +236,15 @@ jobs:
- name: Clean Mono
run: pushd ${{ env.MONO_SOURCE_ROOT }} && git reset --hard && git clean -xffd && git submodule foreach --recursive git reset --hard && git submodule foreach --recursive git clean -xffd && git submodule update --init --recursive && popd
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v5
with:
path: godot-mono-builds
- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Patch Mono
run:
run: |
python3 godot-mono-builds/patch_mono.py
- name: Configure
run:
@@ -247,7 +257,7 @@ jobs:
mkdir -p $HOME/mono-installs-artifacts
(cd $HOME/mono-installs && zip -ry $HOME/mono-installs-artifacts/osx-${{ matrix.target }}.zip desktop-osx-${{ matrix.target }}-release)
- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: osx-${{ matrix.target }}
path: ~/mono-installs-artifacts/osx-${{ matrix.target }}.zip
@@ -255,14 +265,14 @@ jobs:
run: pushd ${{ env.MONO_SOURCE_ROOT }} && git reset --hard && git clean -xffd && git submodule foreach --recursive git reset --hard && git submodule foreach --recursive git clean -xffd && git submodule update --init --recursive && popd
- name: Upload config.log After Error
if: ${{ failure() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: osx-${{ matrix.target }}-config.log
path: ~/mono-configs/desktop-osx-${{ matrix.target }}-release/config.log
ios:
name: iOS
runs-on: macos-latest
runs-on: macos-13
strategy:
matrix:
target: [arm64, x86_64, arm64-sim]
@@ -270,18 +280,26 @@ jobs:
- name: Set Environment Variables
run: |
echo "MONO_SOURCE_ROOT=$GITHUB_WORKSPACE/mono_sources" >> $GITHUB_ENV
- name: Setup compatible Xcode version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ env.XCODE_VERSION }}
- name: Install Dependencies
run: |
brew install autoconf automake libtool pkg-config cmake python3
brew install automake
- name: Install cmake 3
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.31.7'
- name: Cache Mono Sources
id: cache_mono_sources
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ env.MONO_SOURCE_ROOT }}
key: ${{ runner.os }}-${{ env.MONO_TAG }}-mono-sources
- name: Checkout Mono Sources
if: steps.cache_mono_sources.outputs.cache-hit != 'true'
uses: actions/checkout@v3
uses: actions/checkout@v5
with:
repository: mono/mono
ref: ${{ env.MONO_TAG }}
@@ -290,15 +308,15 @@ jobs:
- name: Clean Mono
run: pushd ${{ env.MONO_SOURCE_ROOT }} && git reset --hard && git clean -xffd && git submodule foreach --recursive git reset --hard && git submodule foreach --recursive git clean -xffd && git submodule update --init --recursive && popd
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v5
with:
path: godot-mono-builds
- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Patch Mono
run:
run: |
python3 godot-mono-builds/patch_mono.py
- name: Configure
run: |
@@ -312,7 +330,7 @@ jobs:
mkdir -p $HOME/mono-installs-artifacts
(cd $HOME/mono-installs && zip -ry $HOME/mono-installs-artifacts/ios-${{ matrix.target }}.zip ios-${{ matrix.target }}-release)
- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ios-${{ matrix.target }}
path: ~/mono-installs-artifacts/ios-${{ matrix.target }}.zip
@@ -320,15 +338,16 @@ jobs:
run: pushd ${{ env.MONO_SOURCE_ROOT }} && git reset --hard && git clean -xffd && git submodule foreach --recursive git reset --hard && git submodule foreach --recursive git clean -xffd && git submodule update --init --recursive && popd
- name: Upload config.log After Error
if: ${{ failure() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ios-${{ matrix.target }}-config.log
path: ~/mono-configs/ios-${{ matrix.target }}-release/config.log
ios-cross:
# Disable for now as it doesn't build.
needs: llvm
name: iOS Cross-compiler
runs-on: macos-latest
runs-on: macos-13
strategy:
matrix:
target: [cross-arm64]
@@ -340,18 +359,26 @@ jobs:
- name: Set Environment Variables
run: |
echo "MONO_SOURCE_ROOT=$GITHUB_WORKSPACE/mono_sources" >> $GITHUB_ENV
- name: Setup compatible Xcode version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ env.XCODE_VERSION }}
- name: Install Dependencies
run: |
brew install autoconf automake libtool pkg-config cmake python3
brew install automake
- name: Install cmake 3
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.31.7'
- name: Cache Mono Sources
id: cache_mono_sources
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ env.MONO_SOURCE_ROOT }}
key: ${{ runner.os }}-${{ env.MONO_TAG }}-mono-sources
- name: Checkout Mono Sources
if: steps.cache_mono_sources.outputs.cache-hit != 'true'
uses: actions/checkout@v3
uses: actions/checkout@v5
with:
repository: mono/mono
ref: ${{ env.MONO_TAG }}
@@ -360,20 +387,20 @@ jobs:
- name: Clean Mono
run: pushd ${{ env.MONO_SOURCE_ROOT }} && git reset --hard && git clean -xffd && git submodule foreach --recursive git reset --hard && git submodule foreach --recursive git clean -xffd && git submodule update --init --recursive && popd
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v5
with:
path: godot-mono-builds
- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Patch Mono
run:
run: |
python3 godot-mono-builds/patch_mono.py
- name: Download LLVM artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v5
with:
name: llvm-${{ matrix.llvm }}-macos-latest
name: llvm-${{ matrix.llvm }}-macos-13
# Tilde ~/ not supported when downloading yet: https://github.com/actions/download-artifact/issues/37
# File permissions are also messed up: https://github.com/actions/upload-artifact/issues/38
# We have to manually move the folder and restore the file permissions in the next step.
@@ -399,7 +426,7 @@ jobs:
mkdir -p $HOME/mono-installs-artifacts
(cd $HOME/mono-installs && zip -ry $HOME/mono-installs-artifacts/ios-${{ matrix.target }}.zip ios-${{ matrix.target }}-release)
- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ios-${{ matrix.target }}
path: ~/mono-installs-artifacts/ios-${{ matrix.target }}.zip
@@ -407,27 +434,26 @@ jobs:
run: pushd ${{ env.MONO_SOURCE_ROOT }} && git reset --hard && git clean -xffd && git submodule foreach --recursive git reset --hard && git submodule foreach --recursive git clean -xffd && git submodule update --init --recursive && popd
- name: Upload Runtime config.log After Error
if: ${{ failure() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ios-${{ matrix.target }}-runtime-config.log
path: ~/mono-configs/ios-${{ matrix.runtime_target }}-release/config.log
- name: Upload Cross config.log After Error
if: ${{ failure() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ios-${{ matrix.target }}-config.log
path: ~/mono-configs/ios-${{ matrix.target }}-release/config.log
android:
name: Android
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
strategy:
matrix:
target: [armv7, arm64v8, x86, x86_64]
steps:
- name: Set Environment Variables
run: |
env
echo "MONO_SOURCE_ROOT=$GITHUB_WORKSPACE/mono_sources" >> $GITHUB_ENV
- name: Install Dependencies
run: |
@@ -435,13 +461,13 @@ jobs:
sudo apt-get -y install git autoconf libtool libtool-bin automake build-essential gettext cmake python3 curl
- name: Cache Mono Sources
id: cache_mono_sources
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ env.MONO_SOURCE_ROOT }}
key: ${{ runner.os }}-${{ env.MONO_TAG }}-mono-sources
- name: Checkout Mono Sources
if: steps.cache_mono_sources.outputs.cache-hit != 'true'
uses: actions/checkout@v3
uses: actions/checkout@v5
with:
repository: mono/mono
ref: ${{ env.MONO_TAG }}
@@ -450,11 +476,11 @@ jobs:
- name: Clean Mono
run: pushd ${{ env.MONO_SOURCE_ROOT }} && git reset --hard && git clean -xffd && git submodule foreach --recursive git reset --hard && git submodule foreach --recursive git clean -xffd && git submodule update --init --recursive && popd
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v5
with:
path: godot-mono-builds
- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Patch Mono
@@ -471,7 +497,7 @@ jobs:
mkdir -p $HOME/mono-installs-artifacts
(cd $HOME/mono-installs && zip -ry $HOME/mono-installs-artifacts/android-${{ matrix.target }}.zip android-${{ matrix.target }}-release)
- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: android-${{ matrix.target }}
path: ~/mono-installs-artifacts/android-${{ matrix.target }}.zip
@@ -479,14 +505,14 @@ jobs:
run: pushd ${{ env.MONO_SOURCE_ROOT }} && git reset --hard && git clean -xffd && git submodule foreach --recursive git reset --hard && git submodule foreach --recursive git clean -xffd && git submodule update --init --recursive && popd
- name: Upload config.log After Error
if: ${{ failure() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: android-${{ matrix.target }}-config.log
path: ~/mono-configs/android-${{ matrix.target }}-release/config.log
wasm:
name: WebAssembly
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
strategy:
matrix:
target: [runtime, runtime-threads]
@@ -500,13 +526,13 @@ jobs:
sudo apt-get -y install git autoconf libtool libtool-bin automake build-essential gettext cmake python3 curl
- name: Cache Mono Sources
id: cache_mono_sources
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ env.MONO_SOURCE_ROOT }}
key: ${{ runner.os }}-${{ env.MONO_TAG }}-mono-sources
- name: Checkout Mono Sources
if: steps.cache_mono_sources.outputs.cache-hit != 'true'
uses: actions/checkout@v3
uses: actions/checkout@v5
with:
repository: mono/mono
ref: ${{ env.MONO_TAG }}
@@ -515,15 +541,15 @@ jobs:
- name: Clean Mono
run: pushd ${{ env.MONO_SOURCE_ROOT }} && git reset --hard && git clean -xffd && git submodule foreach --recursive git reset --hard && git submodule foreach --recursive git clean -xffd && git submodule update --init --recursive && popd
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v5
with:
path: godot-mono-builds
- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Setup Emscripten SDK
uses: mymindstorm/setup-emsdk@v12
uses: mymindstorm/setup-emsdk@v14
with:
version: ${{ env.EMSDK_VERSION }}
- name: Patch Mono
@@ -540,7 +566,7 @@ jobs:
mkdir -p $HOME/mono-installs-artifacts
(cd $HOME/mono-installs && zip -ry $HOME/mono-installs-artifacts/wasm-${{ matrix.target }}.zip wasm-${{ matrix.target }}-release)
- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: wasm-${{ matrix.target }}
path: ~/mono-installs-artifacts/wasm-${{ matrix.target }}.zip
@@ -548,7 +574,7 @@ jobs:
run: pushd ${{ env.MONO_SOURCE_ROOT }} && git reset --hard && git clean -xffd && git submodule foreach --recursive git reset --hard && git submodule foreach --recursive git clean -xffd && git submodule update --init --recursive && popd
- name: Upload config.log After Error
if: ${{ failure() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: wasm-${{ matrix.target }}-config.log
path: ~/mono-configs/wasm-${{ matrix.target }}-release/config.log
@@ -558,22 +584,27 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-22.04, macos-13]
target: [llvm64, llvmwin64]
exclude:
# We already build for Windows on ubuntu-latest
- os: macos-latest
# We already build for Windows on ubuntu-22.04
- os: macos-13
target: llvmwin64
steps:
- name: Cache LLVM
id: cache_llvm
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/mono-installs/llvm-${{ matrix.target }}
key: ${{ runner.os }}-${{ env.MONO_TAG }}-llvm-${{ matrix.target }}
- name: Set Environment Variables
run: |
echo "MONO_SOURCE_ROOT=$GITHUB_WORKSPACE/mono_sources" >> $GITHUB_ENV
- name: Setup compatible Xcode version
if: steps.cache_llvm.outputs.cache-hit != 'true' && matrix.os == 'macos-13'
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ env.XCODE_VERSION }}
- name: Install Dependencies (Linux)
if: steps.cache_llvm.outputs.cache-hit != 'true' && runner.os == 'Linux'
run: |
@@ -583,33 +614,38 @@ jobs:
if: steps.cache_llvm.outputs.cache-hit != 'true' && runner.os == 'Linux'
run: |
cd /home/runner
curl -LO https://downloads.tuxfamily.org/godotengine/toolchains/linux/2021-02-11/x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2
curl -LO https://github.com/godotengine/buildroot/releases/download/godot-2023.08.x-4/x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2
tar xf x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2
rm -f x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2
cd x86_64-godot-linux-gnu_sdk-buildroot
./relocate-sdk.sh
cd bin
rm -f {aclocal*,auto*,libtool*,m4}
for file in x86_64-godot-*; do alias=$(echo $file | sed "s/godot-//"); ln -s $file $alias; done
echo "PATH=/home/runner/x86_64-godot-linux-gnu_sdk-buildroot/bin:${PATH}" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=/home/runner/x86_64-godot-linux-gnu_sdk-buildroot/x86_64-godot-linux-gnu/lib64:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
- name: Install Dependencies (Linux Targeting Windows)
if: steps.cache_llvm.outputs.cache-hit != 'true' && runner.os == 'Linux' && matrix.target == 'llvmwin64'
run: |
sudo apt-get -y install mingw-w64 libz-mingw-w64-dev
- name: Install Dependencies (macOS)
if: steps.cache_llvm.outputs.cache-hit != 'true' && matrix.os == 'macos-latest'
if: steps.cache_llvm.outputs.cache-hit != 'true' && matrix.os == 'macos-13'
run: |
brew install autoconf automake libtool pkg-config cmake python3
brew install automake
- name: Install cmake 3 (macOS)
if: steps.cache_llvm.outputs.cache-hit != 'true' && matrix.os == 'macos-13'
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.31.7'
- name: Cache Mono Sources
if: steps.cache_llvm.outputs.cache-hit != 'true'
id: cache_mono_sources
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ env.MONO_SOURCE_ROOT }}
key: ${{ runner.os }}-${{ env.MONO_TAG }}-mono-sources
- name: Checkout Mono Sources
if: steps.cache_mono_sources.outputs.cache-hit != 'true' && steps.cache_llvm.outputs.cache-hit != 'true'
uses: actions/checkout@v3
uses: actions/checkout@v5
with:
repository: mono/mono
ref: ${{ env.MONO_TAG }}
@@ -620,24 +656,24 @@ jobs:
run: pushd ${{ env.MONO_SOURCE_ROOT }} && git reset --hard && git clean -xffd && git submodule foreach --recursive git reset --hard && git submodule foreach --recursive git clean -xffd && git submodule update --init --recursive && popd
- name: Checkout
if: steps.cache_llvm.outputs.cache-hit != 'true'
uses: actions/checkout@v3
uses: actions/checkout@v5
with:
path: godot-mono-builds
- name: Setup Python
if: steps.cache_llvm.outputs.cache-hit != 'true'
uses: actions/setup-python@v4
uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Patch Mono
if: steps.cache_llvm.outputs.cache-hit != 'true'
run:
run: |
python3 godot-mono-builds/patch_mono.py
- name: Make
if: steps.cache_llvm.outputs.cache-hit != 'true'
run:
python3 godot-mono-builds/llvm.py make --target=${{ matrix.target }} -j 2
- name: Upload LLVM Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: llvm-${{ matrix.target }}-${{ matrix.os }}
path: ~/mono-installs/llvm-${{ matrix.target }}
@@ -646,14 +682,14 @@ jobs:
run: pushd ${{ env.MONO_SOURCE_ROOT }} && git reset --hard && git clean -xffd && git submodule foreach --recursive git reset --hard && git submodule foreach --recursive git clean -xffd && git submodule update --init --recursive && popd
- name: Upload config.log After Error
if: ${{ failure() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: llvm-${{ matrix.target }}-${{ matrix.os }}-config.log
path: ~/mono-configs/llvm-${{ matrix.target }}/config.log
bcl:
name: BCL
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
strategy:
matrix:
product: [desktop, desktop-win32, android, ios, wasm]
@@ -668,24 +704,24 @@ jobs:
- name: Install Linux SDK (x86_64)
run: |
cd /home/runner
curl -LO https://downloads.tuxfamily.org/godotengine/toolchains/linux/2021-02-11/x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2
curl -LO https://github.com/godotengine/buildroot/releases/download/godot-2023.08.x-4/x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2
tar xf x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2
rm -f x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2
cd x86_64-godot-linux-gnu_sdk-buildroot
./relocate-sdk.sh
cd bin
rm -f {aclocal*,auto*,libtool*,m4}
for file in x86_64-godot-*; do alias=$(echo $file | sed "s/godot-//"); ln -s $file $alias; done
echo "PATH=/home/runner/x86_64-godot-linux-gnu_sdk-buildroot/bin:${PATH}" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=/home/runner/x86_64-godot-linux-gnu_sdk-buildroot/x86_64-godot-linux-gnu/lib64:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
- name: Cache Mono Sources
id: cache_mono_sources
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ env.MONO_SOURCE_ROOT }}
key: ${{ runner.os }}-${{ env.MONO_TAG }}-mono-sources
- name: Checkout Mono Sources
if: steps.cache_mono_sources.outputs.cache-hit != 'true'
uses: actions/checkout@v3
uses: actions/checkout@v5
with:
repository: mono/mono
ref: ${{ env.MONO_TAG }}
@@ -694,11 +730,11 @@ jobs:
- name: Clean Mono
run: pushd ${{ env.MONO_SOURCE_ROOT }} && git reset --hard && git clean -xffd && git submodule foreach --recursive git reset --hard && git submodule foreach --recursive git clean -xffd && git submodule update --init --recursive && popd
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v5
with:
path: godot-mono-builds
- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Patch Mono
@@ -716,7 +752,7 @@ jobs:
mkdir -p $HOME/mono-installs-artifacts
(cd $HOME/mono-installs && zip -ry $HOME/mono-installs-artifacts/bcl-${{ matrix.product }}.zip ${{ matrix.product }}-bcl)
- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: bcl-${{ matrix.product }}
path: ~/mono-installs-artifacts/bcl-${{ matrix.product }}.zip
@@ -724,7 +760,7 @@ jobs:
run: pushd ${{ env.MONO_SOURCE_ROOT }} && git reset --hard && git clean -xffd && git submodule foreach --recursive git reset --hard && git submodule foreach --recursive git clean -xffd && git submodule update --init --recursive && popd
- name: Upload config.log After Error
if: ${{ failure() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: bcl-${{ matrix.product }}-config.log
path: ~/mono-configs/bcl/config.log
@@ -733,7 +769,7 @@ jobs:
if: success() && github.event_name == 'create' && startsWith(github.ref, 'refs/heads/release/')
needs: [linux, windows, osx, ios, ios-cross, android, wasm, bcl]
name: Create Release
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
outputs:
release_upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
@@ -760,7 +796,7 @@ jobs:
if: success() && github.event_name == 'create' && startsWith(github.ref, 'refs/heads/release/')
needs: create-release
name: Upload Release Artifacts
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
strategy:
matrix:
artifact_name: [linux-x86, linux-x86_64, windows-x86, windows-x86_64, osx-arm64, osx-x86_64,
@@ -770,7 +806,7 @@ jobs:
bcl-desktop, bcl-desktop-win32, bcl-android, bcl-ios, bcl-wasm]
steps:
- name: Download Artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v5
with:
name: ${{ matrix.artifact_name }}
path: ./

View File

@@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v5
- name: Lint repo
run: |

View File

@@ -9,7 +9,7 @@ This repository contains scripts for building the Mono runtime to use with Godot
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.
- Mono: 6.12.0.206.
- Emscripten: 1.39.9.
- Android NDK: 23.2.8568313

View File

@@ -62,18 +62,20 @@ def get_api_version_or_min(opts: AndroidOpts, target: str) -> str:
def setup_android_target_template(env: dict, opts: AndroidOpts, target: str):
extra_target_envs = {
'armv7': {
'android-armeabi-v7a_CFLAGS': ['-D__POSIX_VISIBLE=201002', '-DSK_RELEASE', '-DNDEBUG', '-UDEBUG', '-fpic', '-march=armv7-a', '-mtune=cortex-a8', '-mfpu=vfp', '-mfloat-abi=softfp'],
'android-armeabi-v7a_CXXFLAGS': ['-D__POSIX_VISIBLE=201002', '-DSK_RELEASE', '-DNDEBUG', '-UDEBUG', '-fpic', '-march=armv7-a', '-mtune=cortex-a8', '-mfpu=vfp', '-mfloat-abi=softfp'],
'android-armeabi-v7a_LDFLAGS': ['-Wl,--fix-cortex-a8']
'android-armv7_CFLAGS': ['-D__POSIX_VISIBLE=201002', '-DSK_RELEASE', '-DNDEBUG', '-UDEBUG', '-fpic', '-march=armv7-a', '-mtune=cortex-a8', '-mfpu=vfp', '-mfloat-abi=softfp'],
'android-armv7_CXXFLAGS': ['-D__POSIX_VISIBLE=201002', '-DSK_RELEASE', '-DNDEBUG', '-UDEBUG', '-fpic', '-march=armv7-a', '-mtune=cortex-a8', '-mfpu=vfp', '-mfloat-abi=softfp'],
'android-armv7_LDFLAGS': ['-Wl,--fix-cortex-a8']
},
'arm64v8': {
'android-arm64-v8a_CFLAGS': ['-D__POSIX_VISIBLE=201002', '-DSK_RELEASE', '-DNDEBUG', '-UDEBUG', '-fpic', '-DL_cuserid=9', '-DANDROID64'],
'android-arm64-v8a_CXXFLAGS': ['-D__POSIX_VISIBLE=201002', '-DSK_RELEASE', '-DNDEBUG', '-UDEBUG', '-fpic', '-DL_cuserid=9', '-DANDROID64']
'android-arm64v8_CFLAGS': ['-D__POSIX_VISIBLE=201002', '-DSK_RELEASE', '-DNDEBUG', '-UDEBUG', '-fpic', '-DL_cuserid=9', '-DANDROID64'],
'android-arm64v8_CXXFLAGS': ['-D__POSIX_VISIBLE=201002', '-DSK_RELEASE', '-DNDEBUG', '-UDEBUG', '-fpic', '-DL_cuserid=9', '-DANDROID64'],
'android-arm64v8_LDFLAGS': ['-Wl,-z,max-page-size=16384', '-Wl,-z,common-page-size=16384']
},
'x86': {},
'x86_64': {
'android-x86_64_CFLAGS': ['-DL_cuserid=9'],
'android-x86_64_CXXFLAGS': ['-DL_cuserid=9']
'android-x86_64_CXXFLAGS': ['-DL_cuserid=9'],
'android-x86_64_LDFLAGS': ['-Wl,-z,max-page-size=16384', '-Wl,-z,common-page-size=16384']
}
}
env.update(extra_target_envs[target])

10
bcl.py
View File

@@ -132,10 +132,10 @@ def make_product(opts: BclOpts, product: str):
run_command('make', args=test_make_args, name='make tests')
# Copy the bcl profiles to the output directory
from distutils.dir_util import copy_tree
from shutil import copytree
for profile in profiles:
profile_dir = get_profile_dir(profile, product)
copy_tree('%s/mcs/class/lib/%s' % (opts.mono_source_root, profile_dir), '%s/%s' % (install_dir, profile_dir))
copytree('%s/mcs/class/lib/%s' % (opts.mono_source_root, profile_dir), '%s/%s' % (install_dir, profile_dir))
# Remove unneeded files
import glob
@@ -195,16 +195,16 @@ def make_product(opts: BclOpts, product: str):
mkdir_p(monotouch_profile_dir)
android_env_csc_args = [
ios_env_csc_args = [
path_join(this_script_dir, 'files', 'xi.cs'),
'-keyfile:' + path_join(this_script_dir, 'files', 'xi.snk'),
'-out:%s' % path_join(monotouch_profile_dir, 'Xamarin.iOS.dll'),
'-optimize', '-deterministic', '-publicsign', '-target:library',
'-nostdlib', '-noconfig', '-langversion:latest'
]
android_env_csc_args += ['-r:%s' % path_join(monotouch_profile_dir, r) for r in refs]
ios_env_csc_args += ['-r:%s' % path_join(monotouch_profile_dir, r) for r in refs]
run_command('csc', android_env_csc_args)
run_command('csc', ios_env_csc_args)
def clean_product(opts: BclOpts, product: str):

View File

@@ -231,13 +231,13 @@ def make(opts: DesktopOpts, product: str, target_platform: str, target: str):
strip_libs(opts, product, target_platform, target)
def copy_bcl(opts: DesktopOpts, product: str, target_platform: str, target: str):
from distutils.dir_util import copy_tree
from shutil import copytree
from bcl import get_profile_install_dirs
dest_dir = path_join(opts.install_dir, '%s-%s-%s' % (product, target, opts.configuration), 'lib/mono/4.5')
for src_dir in get_profile_install_dirs(opts, 'desktop-win32' if target_platform == 'windows' else 'desktop'):
if not os.path.isdir(src_dir):
raise BuildError('BCL source directory does not exist: %s. The BCL must be built prior to this.' % src_dir)
copy_tree(src_dir, dest_dir)
copytree(src_dir, dest_dir)
def clean(opts: DesktopOpts, product: str, target_platform: str, target: str):
rm_rf(

View File

@@ -0,0 +1,20 @@
diff --git a/configure.ac b/configure.ac
index 2c052530..6bf193fd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5976,13 +5976,13 @@ if test "x$enable_btls" = "xyes"; then
BTLS_CMAKE_ARGS="-DANDROID_ABI=\"armeabi-v7a\" -DANDROID_NATIVE_API_LEVEL=$with_btls_android_api"
;;
android-v8a)
- BTLS_CMAKE_ARGS="-DANDROID_ABI=\"arm64-v8a\" -DANDROID_NATIVE_API_LEVEL=$with_btls_android_api"
+ BTLS_CMAKE_ARGS="-DANDROID_ABI=\"arm64-v8a\" -DANDROID_NATIVE_API_LEVEL=$with_btls_android_api -DCMAKE_SHARED_LINKER_FLAGS=\"-Wl,-z,max-page-size=16384\""
;;
android-x86)
BTLS_CMAKE_ARGS="-DANDROID_ABI=\"x86\" -DANDROID_NATIVE_API_LEVEL=$with_btls_android_api"
;;
android-x64)
- BTLS_CMAKE_ARGS="-DANDROID_ABI=\"x86_64\" -DANDROID_NATIVE_API_LEVEL=$with_btls_android_api"
+ BTLS_CMAKE_ARGS="-DANDROID_ABI=\"x86_64\" -DANDROID_NATIVE_API_LEVEL=$with_btls_android_api -DCMAKE_SHARED_LINKER_FLAGS=\"-Wl,-z,max-page-size=16384\""
;;
riscv32)
btls_arch=riscv32

View File

@@ -0,0 +1,25 @@
diff -aur a/tools/shared.py b/tools/shared.py
--- a/tools/shared.py 2025-10-14 09:16:13.210070677 +0000
+++ b/tools/shared.py 2025-10-14 09:15:07.106178680 +0000
@@ -5,7 +5,7 @@
from __future__ import print_function
-from distutils.spawn import find_executable
+from shutil import which
from subprocess import PIPE, STDOUT
import atexit
import base64
@@ -212,10 +212,10 @@
config_file = '\n'.join(config_file)
# autodetect some default paths
config_file = config_file.replace('\'{{{ EMSCRIPTEN_ROOT }}}\'', repr(__rootpath__))
- llvm_root = os.path.dirname(find_executable('llvm-dis') or '/usr/bin/llvm-dis')
+ llvm_root = os.path.dirname(which('llvm-dis') or '/usr/bin/llvm-dis')
config_file = config_file.replace('\'{{{ LLVM_ROOT }}}\'', repr(llvm_root))
- node = find_executable('nodejs') or find_executable('node') or 'node'
+ node = which('nodejs') or which('node') or 'node'
config_file = config_file.replace('\'{{{ NODE }}}\'', repr(node))
abspath = os.path.abspath(os.path.expanduser(path))

View File

@@ -0,0 +1,21 @@
diff --git a/external/llvm-project/llvm/lib/Support/regex_impl.h b/external/llvm-project/llvm/lib/Support/regex_impl.h
index f8296c9ff75e..45bdb469a0b3 100644
--- a/external/llvm-project/llvm/lib/Support/regex_impl.h
+++ b/external/llvm-project/llvm/lib/Support/regex_impl.h
@@ -35,8 +35,8 @@
* @(#)regex.h 8.1 (Berkeley) 6/2/93
*/
-#ifndef _REGEX_H_
-#define _REGEX_H_
+#ifndef _REGEX_IMPL_H_
+#define _REGEX_IMPL_H_
#include <sys/types.h>
typedef off_t llvm_regoff_t;
@@ -105,4 +105,4 @@ size_t llvm_strlcpy(char *dst, const char *src, size_t siz);
}
#endif
-#endif /* !_REGEX_H_ */
+#endif /* !_REGEX_IMPL_H_ */

View File

@@ -1,47 +0,0 @@
From e019d4ac4735e774d0a3c15bb36d5eb3ebfa3053 Mon Sep 17 00:00:00 2001
From: Raphael Robatsch <raphael-git@tapesoftware.net>
Date: Tue, 9 May 2023 11:55:02 +0200
Subject: [PATCH] Disable mmap(MAP_32BIT) support
mmap(2) with flag MAP_32BIT can erroneously return ENOMEM on recent
kernels. Disable MAP_32BIT support for now.
Reference: https://lore.kernel.org/linux-mm/cb8dc31a-fef2-1d09-f133-e9f7b9f9e77a@sony.com/
Reference: https://lore.kernel.org/all/20230414185919.4175572-1-Liam.Howlett@oracle.com/T/#m00a0ac8a72bf2f26711b7f8cc56612a8ef62c3d0
---
mono/mini/mini-amd64.h | 2 --
mono/utils/mono-codeman.c | 4 ----
2 files changed, 6 deletions(-)
diff --git a/mono/mini/mini-amd64.h b/mono/mini/mini-amd64.h
index a5c03c4877c..536a79ef59d 100644
--- a/mono/mini/mini-amd64.h
+++ b/mono/mini/mini-amd64.h
@@ -390,9 +390,7 @@ typedef struct {
#endif /* !HOST_WIN32 */
-#if !defined(__linux__)
#define MONO_ARCH_NOMAP32BIT 1
-#endif
#ifdef TARGET_WIN32
#define MONO_AMD64_ARG_REG1 AMD64_RCX
diff --git a/mono/utils/mono-codeman.c b/mono/utils/mono-codeman.c
index 234aac4b0ca..5eccda92bd0 100644
--- a/mono/utils/mono-codeman.c
+++ b/mono/utils/mono-codeman.c
@@ -68,11 +68,7 @@ static const MonoCodeManagerCallbacks *code_manager_callbacks;
#define MAX_WASTAGE 32
#define MIN_BSIZE 32
-#ifdef __x86_64__
-#define ARCH_MAP_FLAGS MONO_MMAP_32BIT
-#else
#define ARCH_MAP_FLAGS 0
-#endif
#define MONO_PROT_RWX (MONO_MMAP_READ|MONO_MMAP_WRITE|MONO_MMAP_EXEC|MONO_MMAP_JIT)
--
2.40.1

View File

@@ -0,0 +1,32 @@
Extracted from https://github.com/dotnet/runtime/commit/087651ee0c2e315f7fe1cbecab5f507af364ab5c
--
diff --git a/mono/tools/offsets-tool/offsets-tool.py b/mono/tools/offsets-tool/offsets-tool.py
index adf7eb4b..46214429 100644
--- a/mono/tools/offsets-tool/offsets-tool.py
+++ b/mono/tools/offsets-tool/offsets-tool.py
@@ -303,8 +303,11 @@ class OffsetsTool:
if type.size == -1:
continue
f.write ("DECL_SIZE2(%s,%s)\n" % (type.name, type.size))
+ done_fields = {}
for field in type.fields:
- f.write ("DECL_OFFSET2(%s,%s,%s)\n" % (type.name, field.name, field.offset))
+ if field.name not in done_fields:
+ f.write ("DECL_OFFSET2(%s,%s,%s)\n" % (type.name, field.name, field.offset))
+ done_fields [field.name] = field.name
f.write ("#endif //disable metadata check\n")
f.write ("#ifndef DISABLE_JIT_OFFSETS\n")
@@ -314,8 +317,11 @@ class OffsetsTool:
if type.size == -1:
continue
f.write ("DECL_SIZE2(%s,%s)\n" % (type.name, type.size))
+ done_fields = {}
for field in type.fields:
- f.write ("DECL_OFFSET2(%s,%s,%s)\n" % (type.name, field.name, field.offset))
+ if field.name not in done_fields:
+ f.write ("DECL_OFFSET2(%s,%s,%s)\n" % (type.name, field.name, field.offset))
+ done_fields [field.name] = field.name
f.write ("#endif //disable jit check\n")
f.write ("#endif //cross compiler checks\n")

View File

@@ -1,22 +0,0 @@
diff --git a/tools/offsets-tool-py/offsets-tool.py b/tools/offsets-tool-py/offsets-tool.py
index 536206aa5c9..04e515f13f2 100644
--- a/tools/offsets-tool-py/offsets-tool.py
+++ b/tools/offsets-tool-py/offsets-tool.py
@@ -61,6 +61,7 @@ class OffsetsTool:
parser.add_argument ('--targetdir', dest='target_path', help='path to mono tree configured for target', required=True)
parser.add_argument ('--abi=', dest='abi', help='ABI triple to generate', required=True)
parser.add_argument ('--sysroot=', dest='sysroot', help='path to sysroot headers of target')
+ parser.add_argument ('--extra-cflag=', dest='extra_cflags', action='append', help='extra flags for clang')
args = parser.parse_args ()
if not args.libclang or not os.path.isfile (args.libclang):
@@ -78,6 +79,9 @@ class OffsetsTool:
self.target_args = []
android_api_level = "-D__ANDROID_API=21"
+ if args.extra_cflags:
+ self.target_args += args.extra_cflags
+
if "wasm" in args.abi:
require_emscipten_path (args)
self.sys_includes = [args.emscripten_path + "/system/include/libc"]

View File

@@ -0,0 +1,215 @@
From 63e677701d35c7e2dad4fe74a84eb935cd396155 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= <alex.koeplinger@outlook.com>
Date: Mon, 15 May 2023 20:46:12 +0200
Subject: [PATCH] [mono] Update offsets-tool python clang binding so it works
with newer clang (#86256)
They introduced a breaking change to CursorKind.TRANSLATION_UNIT in https://github.com/llvm/llvm-project/commit/bb83f8e70bd1d56152f02307adacd718cd67e312, which means we hit an issue when using the binding against a newer clang. Update the binding to the latest upstream and add a tweak so it still works with older clang versions.
---
mono/tools/offsets-tool/clang/cindex.py | 137 +++++++++++++++++-
1 file changed, 135 insertions(+), 2 deletions(-)
diff --git a/mono/tools/offsets-tool/clang/cindex.py b/mono/tools/offsets-tool/clang/cindex.py
index 44c6f49096f495..0ed1c199ba44dd 100644
--- a/mono/tools/offsets-tool/clang/cindex.py
+++ b/mono/tools/offsets-tool/clang/cindex.py
@@ -286,6 +286,11 @@ def offset(self):
"""Get the file offset represented by this source location."""
return self._get_instantiation()[3]
+ #@property
+ #def is_in_system_header(self):
+ # """Returns true if the given source location is in a system header."""
+ # return conf.lib.clang_Location_isInSystemHeader(self)
+
def __eq__(self, other):
return conf.lib.clang_equalLocations(self, other)
@@ -646,6 +651,11 @@ def name(self):
@classmethod
def from_id(cls, id):
+ if cls == CursorKind and id == 300:
+ # --- DOTNET change ---
+ # The id of CursorKind.TRANSLATION_UNIT changed in https://github.com/llvm/llvm-project/commit/bb83f8e70bd1d56152f02307adacd718cd67e312,
+ # add mapping from the old to the new value so using the binding with an older clang still works.
+ return cls._kinds[350]
if id >= len(cls._kinds) or cls._kinds[id] is None:
raise ValueError('Unknown template argument kind %d' % id)
return cls._kinds[id]
@@ -1152,7 +1162,7 @@ def __repr__(self):
# Objective-C's @synchronized statement.
CursorKind.OBJC_AT_SYNCHRONIZED_STMT = CursorKind(220)
-# Objective-C's autorealease pool statement.
+# Objective-C's autorelease pool statement.
CursorKind.OBJC_AUTORELEASE_POOL_STMT = CursorKind(221)
# Objective-C's for collection statement.
@@ -1312,7 +1322,7 @@ def __repr__(self):
#
# The translation unit cursor exists primarily to act as the root cursor for
# traversing the contents of a translation unit.
-CursorKind.TRANSLATION_UNIT = CursorKind(300)
+CursorKind.TRANSLATION_UNIT = CursorKind(350)
###
# Attributes
@@ -1473,6 +1483,107 @@ def is_default_method(self):
"""
return conf.lib.clang_CXXMethod_isDefaulted(self)
+ #def is_deleted_method(self):
+ # """Returns True if the cursor refers to a C++ member function or member
+ # function template that is declared '= delete'.
+ # """
+ # return conf.lib.clang_CXXMethod_isDeleted(self)
+
+ #def is_copy_assignment_operator_method(self):
+ # """Returnrs True if the cursor refers to a copy-assignment operator.
+
+ # A copy-assignment operator `X::operator=` is a non-static,
+ # non-template member function of _class_ `X` with exactly one
+ # parameter of type `X`, `X&`, `const X&`, `volatile X&` or `const
+ # volatile X&`.
+
+
+ # That is, for example, the `operator=` in:
+
+ # class Foo {
+ # bool operator=(const volatile Foo&);
+ # };
+
+ # Is a copy-assignment operator, while the `operator=` in:
+
+ # class Bar {
+ # bool operator=(const int&);
+ # };
+
+ # Is not.
+ # """
+ # return conf.lib.clang_CXXMethod_isCopyAssignmentOperator(self)
+
+ #def is_move_assignment_operator_method(self):
+ # """Returnrs True if the cursor refers to a move-assignment operator.
+
+ # A move-assignment operator `X::operator=` is a non-static,
+ # non-template member function of _class_ `X` with exactly one
+ # parameter of type `X&&`, `const X&&`, `volatile X&&` or `const
+ # volatile X&&`.
+
+
+ # That is, for example, the `operator=` in:
+
+ # class Foo {
+ # bool operator=(const volatile Foo&&);
+ # };
+
+ # Is a move-assignment operator, while the `operator=` in:
+
+ # class Bar {
+ # bool operator=(const int&&);
+ # };
+
+ # Is not.
+ # """
+ # return conf.lib.clang_CXXMethod_isMoveAssignmentOperator(self)
+
+ #def is_explicit_method(self):
+ # """Determines if a C++ constructor or conversion function is
+ # explicit, returning 1 if such is the case and 0 otherwise.
+
+ # Constructors or conversion functions are declared explicit through
+ # the use of the explicit specifier.
+
+ # For example, the following constructor and conversion function are
+ # not explicit as they lack the explicit specifier:
+
+ # class Foo {
+ # Foo();
+ # operator int();
+ # };
+
+ # While the following constructor and conversion function are
+ # explicit as they are declared with the explicit specifier.
+
+ # class Foo {
+ # explicit Foo();
+ # explicit operator int();
+ # };
+
+ # This method will return 0 when given a cursor pointing to one of
+ # the former declarations and it will return 1 for a cursor pointing
+ # to the latter declarations.
+
+ # The explicit specifier allows the user to specify a
+ # conditional compile-time expression whose value decides
+ # whether the marked element is explicit or not.
+
+ # For example:
+
+ # constexpr bool foo(int i) { return i % 2 == 0; }
+
+ # class Foo {
+ # explicit(foo(1)) Foo();
+ # explicit(foo(2)) operator int();
+ # }
+
+ # This method will return 0 for the constructor and 1 for
+ # the conversion function.
+ # """
+ # return conf.lib.clang_CXXMethod_isExplicit(self)
+
def is_mutable_field(self):
"""Returns True if the cursor refers to a C++ field that is declared
'mutable'.
@@ -2059,6 +2170,7 @@ def __repr__(self):
TypeKind.OBJCSEL = TypeKind(29)
TypeKind.FLOAT128 = TypeKind(30)
TypeKind.HALF = TypeKind(31)
+TypeKind.IBM128 = TypeKind(40)
TypeKind.COMPLEX = TypeKind(100)
TypeKind.POINTER = TypeKind(101)
TypeKind.BLOCKPOINTER = TypeKind(102)
@@ -2122,6 +2234,7 @@ def __repr__(self):
TypeKind.OCLRESERVEID = TypeKind(160)
TypeKind.EXTVECTOR = TypeKind(176)
+TypeKind.ATOMIC = TypeKind(177)
class RefQualifierKind(BaseEnumeration):
"""Describes a specific ref-qualifier of a type."""
@@ -3424,6 +3537,22 @@ def cursor(self):
[Cursor],
bool),
+ #("clang_CXXMethod_isDeleted",
+ # [Cursor],
+ # bool),
+
+ #("clang_CXXMethod_isCopyAssignmentOperator",
+ # [Cursor],
+ # bool),
+
+ #("clang_CXXMethod_isMoveAssignmentOperator",
+ # [Cursor],
+ # bool),
+
+ #("clang_CXXMethod_isExplicit",
+ # [Cursor],
+ # bool),
+
("clang_CXXMethod_isPureVirtual",
[Cursor],
bool),
@@ -4012,6 +4141,10 @@ def cursor(self):
[Cursor],
c_longlong),
+ #("clang_Location_isInSystemHeader",
+ # [SourceLocation],
+ # bool),
+
("clang_Type_getAlignOf",
[Type],
c_longlong),

View File

@@ -18,11 +18,15 @@ def main(raw_args):
args = parser.parse_args(raw_args)
this_script_dir = os.path.dirname(os.path.realpath(__file__))
patches_dir = os.path.join(this_script_dir, 'files', 'patches')
mono_source_root = args.mono_sources
emsdk_root = get_emsdk_root()
patches = [
'%s/sdks/builds/fix-emscripten-8511.diff' % mono_source_root,
'%s/emscripten-python-3.12.diff' % patches_dir,
]
from subprocess import Popen

View File

@@ -34,14 +34,13 @@ def main(raw_args):
'wasm_m2n_trampolines_hook.diff',
'btls-cmake-args-linux-mingw.diff',
'btls-cmake-arm64.diff',
'mono-linux-disable-mmap-MAP_32BIT.diff',
'btls-cmake-android-16kb-page-size.diff',
'offsets-tool-extra-cflags.diff',
'offsets-tool-newer-clang.diff',
'offsets-tool-duplicate-fields.diff',
'llvm-osx-regex-conflict.diff',
]
if os.path.isfile(os.path.join(mono_source_root, 'mono/tools/offsets-tool/offsets-tool.py')):
patches += ['offsets-tool-extra-cflags_new.diff']
else:
patches += ['offsets-tool-extra-cflags_old.diff']
from subprocess import Popen
from sys import exit
for patch in patches: