Compare commits

...

89 Commits

Author SHA1 Message Date
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
Rémi Verschelde
d496154ab1 Add patch to fix Linux kernel regression with mmap and MAP_32BIT 2023-05-26 12:58:55 +02:00
Rémi Verschelde
8767196960 Merge pull request #80 from bruvzg/btls_arm_macos
Add patch for ARM64 macOS BTLS build.
2023-02-09 22:57:44 +01:00
bruvzg
a0e457e7c1 Add patch for ARM64 macOS BTLS build. 2023-02-09 21:16:57 +02:00
Rémi Verschelde
5299efd80c Merge pull request #75 from akien-mga/ci-use-linux-sdk
CI: Use our own Linux SDK to maximize glibc compatibilty
2022-10-07 23:38:09 +02:00
Rémi Verschelde
11364fafc7 Merge pull request #73 from Atlinx/Atlinx/master
Add arm64 to osx build
2022-10-07 23:37:56 +02:00
Atlinx
a7297fdf09 Add arm64 to osx build
[ci skip]
2022-10-07 23:36:47 +02:00
Rémi Verschelde
08b10e1b66 Merge pull request #74 from akien-mga/android-artifact-names
Fix Android artifact names after #69
2022-10-07 23:34:41 +02:00
Rémi Verschelde
6291fa07a6 CI: Use our own Linux SDK to maximize glibc compatibilty
Should help alleviate this kind of issue when compiling Godot itself with our
Linux SDK and trying to use prebuilt Mono:
```
ld: /home/runner/mono-installs/desktop-linux-x86_64-release/lib/libmonosgen-2.0.a(libmonoutils_la-mono-rand.o): in function `mono_rand_try_get_bytes':
(.text+0x16a): undefined reference to `getrandom'
```
2022-10-07 22:01:34 +02:00
Rémi Verschelde
574f1404d2 Fix Android artifact names after #69
[ci skip]
2022-10-07 14:24:17 +02:00
Rémi Verschelde
4bf530983a Merge pull request #69 from madmiraal/fix-68 2022-07-08 17:07:30 +02:00
Marcel Admiraal
d29929a407 Upgrade Android NDK to r23 LTS 2022-07-08 10:30:28 +01:00
Rémi Verschelde
fcf205c105 CI: Mono 6.12.0.182, Android 32 and other updates 2022-06-22 09:07:55 +02:00
Rémi Verschelde
2fa04b9dc7 Windows: Re-add --enable-btls-lib to build BTLS dll
I reverted this by mistake while investigating an unrelated crash.
See #66 for details.

This reverts commits aaee521d08
and 20368d7289.
2022-05-24 15:46:20 +02:00
Rémi Verschelde
7533d081e4 Mono: Bump to 6.12.0.179 2022-05-19 08:27:24 +02:00
Rémi Verschelde
aaee521d08 Revert "Windows: Configure with --enable-btls-lib to build BTLS dll"
This reverts commit f63f4e2e44.
2022-05-19 08:26:29 +02:00
Rémi Verschelde
20368d7289 Revert "desktop: Only enable btls-lib on Windows"
This reverts commit 2ef74ff260.

This doesn't work on Windows as is either, so a full revert of #47 is needed.
Might be specific to MinGW cross compilation but this needs further work
either way.
2022-05-19 08:24:48 +02:00
Rémi Verschelde
c865201eba Mono: Bump to 6.12.0.178 2022-05-09 22:53:08 +02:00
Rémi Verschelde
62c407fd0f Merge pull request #65 from akien-mga/btls-lib-windows-only 2022-05-09 22:51:14 +02:00
Rémi Verschelde
2ef74ff260 desktop: Only enable btls-lib on Windows
Follow-up to #47 and #49.
This caused issues on macOS ARM64, see https://github.com/godotengine/build-containers/issues/95.
2022-05-09 13:37:08 +02:00
Rémi Verschelde
1cc1257eda Mono: Bump to 6.12.0.177 2022-05-03 11:50:55 +02:00
Rémi Verschelde
187d156c89 CI: Bump download-artifact and upload-artifact to v3 2022-05-03 11:50:40 +02:00
Rémi Verschelde
4e93604bc4 CI: Bump old ubuntu version to ubuntu-18.04
The ubuntu-16.04 runners have been removed from GitHub Actions.
2022-04-01 01:06:46 +02:00
Rémi Verschelde
efd26fbbff Merge pull request #61 from akien-mga/mono-6.12.0.174 2022-04-01 00:59:05 +02:00
Rémi Verschelde
baa6f22377 Mono: Bump to 6.12.0.174
Should also fix CI by including
5a21247f36
2022-03-31 19:15:56 +02:00
Rémi Verschelde
dfb29cab81 CI: Update all actions versions 2022-03-31 19:14:32 +02:00
Rémi Verschelde
0d72e71a50 Merge pull request #50 from akien-mga/android-bump-min-19-target-30
Android: Bump min SDK to 19, target SDK to 30
2021-08-17 08:54:25 +02:00
Rémi Verschelde
1755de4f1e Android: Bump min SDK to 19, target SDK to 30
Following https://github.com/godotengine/godot/pull/51719.

Also removes now obsolete code to check whether we're using NDK 18+,
since we don't support any earlier version.
2021-08-16 10:20:55 +02:00
Rémi Verschelde
6d4f576264 Merge pull request #49 from godotengine/btls-lib-windows-desktop
Windows: Configure with `--enable-btls-lib` to build BTLS dll
2021-08-10 09:03:16 +02:00
Ignacio Roldán Etcheverry
f63f4e2e44 Windows: Configure with --enable-btls-lib to build BTLS dll
Patched Mono to make the BTLS CMake build work with MinGW on Linux.
2021-08-06 20:29:35 +02:00
Ignacio Roldán Etcheverry
aad08390cb Merge pull request #48 from Calinou/fix-mono-log-spam
Fix Mono log spam
2021-08-04 00:28:23 +02:00
Hugo Locurcio
2d30ce6362 Fix Mono log spam
This prevents Mono logs from being spammed, which could result
in log file sizes in the dozens of gigabytes.
2021-08-03 17:49:37 +02:00
Ignacio Roldán Etcheverry
c6bdc0feca Merge pull request #47 from TechnoPorg/windows-enable-btls
Enable BTLS when building for Windows
2021-07-29 23:37:24 +02:00
TechnoPorg
d62d874dd2 Enable BTLS when building for Windows 2021-07-29 08:09:14 -06:00
Rémi Verschelde
2bf7d71c7c Merge pull request #46 from akien-mga/fix-copy_bcl-desktop-win32
bcl: Fix copy_bcl for desktop-win32 profile
2021-07-27 08:44:33 +02:00
Rémi Verschelde
fb6da044d7 bcl: Fix copy_bcl for desktop-win32 profile 2021-07-26 14:59:52 +02:00
Rémi Verschelde
c3a9d311bc Merge pull request #43 from akien-mga/mono-6.12.0.147
CI: Build with Mono 6.12.0.147
2021-07-06 20:41:50 +02:00
Rémi Verschelde
d75582bd3c Set actions/cache to v2, we don't need explicit manual bumps for 2.1.x 2021-07-06 17:47:28 +02:00
Rémi Verschelde
75a0b00364 Merge pull request #41 from godotengine/dependabot/github_actions/mymindstorm/setup-emsdk-10
Bump mymindstorm/setup-emsdk from 9 to 10
2021-07-06 17:45:14 +02:00
Rémi Verschelde
47e40daefe CI: Build with Mono 6.12.0.147 2021-07-06 16:57:49 +02:00
Ignacio Roldán Etcheverry
29683d76fc Merge pull request #40 from godotengine/dummy-xamarin-ios-dll
iOS BCL: Build dummy `Xamarin.iOS.dll` which is necessary
2021-06-02 23:34:07 +02:00
Ignacio Roldán Etcheverry
7937417c83 Merge pull request #39 from godotengine/ios-and-m1-stuff
Apple silicon: arm64 macOS and arm64 iOS simulator
2021-06-02 23:32:45 +02:00
dependabot[bot]
0cfb06c6e4 Bump mymindstorm/setup-emsdk from 9 to 10
Bumps [mymindstorm/setup-emsdk](https://github.com/mymindstorm/setup-emsdk) from 9 to 10.
- [Release notes](https://github.com/mymindstorm/setup-emsdk/releases)
- [Commits](https://github.com/mymindstorm/setup-emsdk/compare/v9...v10)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-27 06:00:10 +00:00
Ignacio Roldán Etchevery
0a2b5f8fab Apple silicon: arm64 macOS and arm64 iOS simulator 2021-05-22 02:36:45 +02:00
Ignacio Roldán Etchevery
61df21a190 iOS BCL: Build dummy Xamarin.iOS.dll which is necessary
Fixes godotengine/godot#42960
2021-05-22 02:21:43 +02:00
Rémi Verschelde
aa9e050543 CI: Build with Mono 6.12.0.144 + other env updates
Update env components to these versions:

- Python 3.9
- Pin NDK to 21.4.7075529 as done by Godot

Not updating Android API level to 30 yet as some feature work is needed in
Godot to support new requirements.

Mono 6.12.0.144 is still a Preview release, but contrarily to 6.12.0.122,
it has a successful Windows build. It also theoretically finalizes support
for Apple M1, so we can attempt using it to build Mono for that arch.
2021-05-11 16:02:22 +02:00
Rémi Verschelde
90c8c8d4c0 Merge pull request #34 from godotengine/dependabot/github_actions/actions/cache-v2.1.5
Bump actions/cache from v2.1.4 to v2.1.5
2021-05-11 12:47:25 +02:00
Rémi Verschelde
3eb55684e3 Merge pull request #35 from godotengine/dependabot/github_actions/mymindstorm/setup-emsdk-v9
Bump mymindstorm/setup-emsdk from v8 to v9
2021-05-11 12:45:36 +02:00
Rémi Verschelde
326d5482bf Merge pull request #33 from godotengine/dependabot/github_actions/actions/setup-python-v2.2.2
Bump actions/setup-python from v2.1.4 to v2.2.2
2021-05-11 12:45:28 +02:00
dependabot[bot]
92e46486d8 Bump mymindstorm/setup-emsdk from v8 to v9
Bumps [mymindstorm/setup-emsdk](https://github.com/mymindstorm/setup-emsdk) from v8 to v9.
- [Release notes](https://github.com/mymindstorm/setup-emsdk/releases)
- [Commits](https://github.com/mymindstorm/setup-emsdk/compare/v8...c0f39b967594b2b09f069eecfd219642f522b596)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-03 07:43:29 +00:00
dependabot[bot]
eb8d9aff08 Bump actions/cache from v2.1.4 to v2.1.5
Bumps [actions/cache](https://github.com/actions/cache) from v2.1.4 to v2.1.5.
- [Release notes](https://github.com/actions/cache/releases)
- [Commits](https://github.com/actions/cache/compare/v2.1.4...1a9e2138d905efd099035b49d8b7a3888c653ca8)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-13 06:24:43 +00:00
dependabot[bot]
806260f507 Bump actions/setup-python from v2.1.4 to v2.2.2
Bumps [actions/setup-python](https://github.com/actions/setup-python) from v2.1.4 to v2.2.2.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v2.1.4...dc73133d4da04e56a135ae2246682783cc7c7cb6)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-13 06:24:40 +00:00
Rémi Verschelde
df330ce0be CI: Build with Mono 6.12.0.122 (stable)
Upgrades us to the current stable release.
Further work is done in Preview on Apple Silicon support but we'll look into this
after the Godot 3.3 release.
2021-03-27 11:57:02 +01:00
Rémi Verschelde
d462909236 Merge pull request #32 from godotengine/dependabot/github_actions/actions/cache-v2.1.4
Bump actions/cache from v1.2.0 to v2.1.4
2021-03-26 13:39:35 +01:00
Rémi Verschelde
05775a4758 Merge pull request #31 from godotengine/dependabot/github_actions/mymindstorm/setup-emsdk-v8
Bump mymindstorm/setup-emsdk from v7 to v8
2021-03-26 13:39:12 +01:00
dependabot[bot]
7e681d3553 Bump actions/cache from v1.2.0 to v2.1.4
Bumps [actions/cache](https://github.com/actions/cache) from v1.2.0 to v2.1.4.
- [Release notes](https://github.com/actions/cache/releases)
- [Commits](https://github.com/actions/cache/compare/v1.2.0...26968a09c0ea4f3e233fdddbafd1166051a095f6)

Signed-off-by: dependabot[bot] <support@github.com>
2021-02-05 06:31:00 +00:00
dependabot[bot]
3f52d14ef8 Bump mymindstorm/setup-emsdk from v7 to v8
Bumps [mymindstorm/setup-emsdk](https://github.com/mymindstorm/setup-emsdk) from v7 to v8.
- [Release notes](https://github.com/mymindstorm/setup-emsdk/releases)
- [Commits](https://github.com/mymindstorm/setup-emsdk/compare/v7...d38289e54786ef9965c3dcd51c396cb0c4bae40f)

Signed-off-by: dependabot[bot] <support@github.com>
2021-02-01 07:57:59 +00:00
Rémi Verschelde
bda87f2d2b Merge pull request #29 from akien-mga/wasm-apply-m2n_trampolines_hook
WASM: Apply m2n_trampolines_hook patch added in 0e31293
2021-01-06 19:49:49 +01:00
Rémi Verschelde
f83e263970 Merge pull request #28 from akien-mga/mono-6.12.0.114-android-18
CI: Bump Mono to 6.12.0.114 and fix Android 32-bit min API
2021-01-06 16:40:37 +01:00
Rémi Verschelde
7028c15e29 WASM: Apply m2n_trampolines_hook patch added in 0e31293 2021-01-06 16:40:04 +01:00
Rémi Verschelde
241a00d3f3 CI: Bump Mono to 6.12.0.114 and fix Android 32-bit min API
Following up on #22, we should target API level 18 like the Godot source does,
which is used by armv7/x86 builds. 64-bit builds do require API level 21 as a
minimum, but our build scripts handle upgrading this value already.
2020-12-30 08:41:33 +01:00
Ignacio Etcheverry
9d75cff174 WASM/BCL: Build WebAssembly.Framework.sln and include in BCL 2020-12-14 20:51:58 +01:00
Rémi Verschelde
61e36a93b6 Merge pull request #22 from akien-mga/android-min-api-18
Android: Fix support for API 18-20 for 32-bit
2020-12-07 11:12:05 +01:00
Rémi Verschelde
c2d2922f42 Merge pull request #20 from godotengine/dependabot/github_actions/actions/setup-python-v2.1.4
Bump actions/setup-python from v1 to v2.1.4
2020-12-07 10:06:03 +01:00
Rémi Verschelde
8daa270631 Android: Fix support for API 18-20 for 32-bit
Fixes https://github.com/godotengine/godot/issues/44159.
2020-12-07 10:05:30 +01:00
Ignacio Roldán Etcheverry
767b8e2ada Merge pull request #21 from godotengine/mono-patch-hook-wasm-m2n
WASM: Add patch to let Godot provide its own m2n trampolines
2020-12-05 01:05:42 +01:00
Ignacio Etcheverry
0e312939bd WASM: Add patch to let Godot provide its own m2n trampolines
Mono on WASM relies on trampolines for a fixed pre-defined set of
method signatures in order for the interpreter to call native
functions.
As a workaround for this limitation, Godot has been passing long,
ulong, float and double as pointers in internal calls.
This patch should allow Godot to provide its own trampolines, which
can be generated automatically at compile time thanks to templates.

This patch is made against the Mono tag mono-6.12.0.111. The
following commit is expected to break this patch:
mono/mono@174aeaa31c
It will need to be updated once we upgrade the a newer Mono
version in the official Godot builds.
2020-12-04 23:36:32 +01:00
dependabot[bot]
f12b3e4071 Bump actions/setup-python from v1 to v2.1.4
Bumps [actions/setup-python](https://github.com/actions/setup-python) from v1 to v2.1.4.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v1...41b7212b1668f5de9d65e9c82aa777e6bbedb3a8)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-20 15:30:05 +00:00
Rémi Verschelde
0be1cc2e9b Merge pull request #14 from jlosito/dependabot-configs
Allow dependabot to check GitHub actions daily
2020-11-20 16:29:38 +01:00
Ignacio Roldán Etcheverry
7cae902cee Merge pull request #10 from tdaffin/easier-build
Make it a little easier to get a successful working build
2020-11-17 15:18:01 +01:00
Rémi Verschelde
d8956230a3 Merge pull request #18 from akien-mga/readme-versions
README: Document known good versions
2020-11-17 14:29:55 +01:00
John Losito
fbc5214dd5 Allow dependabot to check GitHub actions daily 2020-11-17 09:35:34 +01:00
Rémi Verschelde
958bf8d33d README: Document known good versions
Same as in CI configuration.

Fixes #9.
2020-11-17 09:34:23 +01:00
Rémi Verschelde
42b90fe9a6 Merge pull request #15 from akien-mga/ci-mono-6.12-emsdk-1.39.7
CI: Build with Mono 6.12.0.111 and Emscripten 1.39.7
2020-11-16 20:21:28 +01:00
Rémi Verschelde
6a98b5d325 CI: Address deprecation warning for set-env 2020-11-16 17:17:19 +01:00
Rémi Verschelde
1b5f2bb8d9 CI: Build with Mono 6.12.0.111 and Emscripten 1.39.9
This is what we'll be using for official builds for 3.2.4+.

Co-authored-by: Ignacio Etcheverry <ignalfonsore@gmail.com>
2020-11-16 17:17:03 +01:00
Tom Daffin
913582e1df Code review changes 2020-11-07 06:35:08 -07:00
Rémi Verschelde
b4c77dcfb6 Merge pull request #16 from akien-mga/fix-emsdk-setup
CI: Bump mymindstorm/setup-emsdk to v7
2020-10-20 10:12:24 +02:00
Rémi Verschelde
1e2d41160b CI: Bump mymindstorm/setup-emsdk to v7
Might fix CI builds.
2020-10-20 09:00:59 +02:00
Rémi Verschelde
d73d810ba1 Merge pull request #13 from akien-mga/android-python3-make-standalone-toolchain
Android: Force using python3 for `make_standalone_toolchain.py`
2020-10-20 08:26:22 +02:00
Rémi Verschelde
a3ce68fbb0 Merge pull request #12 from akien-mga/python3-shebang
Use `/usr/bin/env python3` shebang
2020-10-20 08:26:14 +02:00
Rémi Verschelde
d40cfcf47c Android: Force using python3 for make_standalone_toolchain.py
This allows using the script on a system without Python 2 installed.
(`make_standalone_toolchain.py` uses `/usr/bin/env python` as shebang.)
2020-10-13 15:07:09 +02:00
Rémi Verschelde
210f65f97a Use /usr/bin/env python3 shebang 2020-10-13 14:55:12 +02:00
Tom Daffin
d2f48f2b45 Make it a little easier to get a successful working build 2020-09-19 11:48:57 -06:00
Ignacio Roldán Etcheverry
331653f9c3 Merge pull request #7 from aaronfranke/formatting
Add a formatting script for GitHub Actions and add GitHub metadata
2020-07-04 23:03:15 +02:00
Aaron Franke
db32366ec9 Add a formatting script for GitHub Actions and add GitHub metadata 2020-07-03 23:12:01 -04:00
Ignacio Etcheverry
3669d9aba4 CI: Use actions/cache@v1.2.0 (supports the branch 'create' event)
actions/cache@v1 wasn't supported for branch creation events ('create').
This meant our CI builds (when a 'release/**') branch is created,
would not re-use the cached resourced and instead do everything from scratch.
2020-05-23 22:04:43 +02:00
Ignacio Etcheverry
d1f88c23fb CI: Run Linux builds on Ubuntu 16.04 for better compatibility 2020-05-23 17:42:13 +02:00
Ignacio Etcheverry
42a0caae0f CI: Add net_4_x-win32 to the BCL profiles to build 2020-05-15 21:57:56 +02:00
35 changed files with 993 additions and 713 deletions

2
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1,2 @@
patreon: godotengine
custom: https://godotengine.org/donate

30
.github/ISSUE_TEMPLATE/bug-report.md vendored Normal file
View File

@@ -0,0 +1,30 @@
---
name: Bug Report
about: Report a bug with this repo.
title: ''
labels: bug
assignees: neikeq
---
<!--
Please search existing issues for potential duplicates before filing yours:
https://github.com/godotengine/godot-csharp-visualstudio/issues?q=is%3Aissue
Only submit an issue if it is reproducible with the latest stable Godot version.
-->
**OS/device including version:**
<!-- Specify GPU model and drivers if graphics-related. -->
**Issue description:**
<!-- What happened, what was expected, and what went wrong. -->
**Screenshots of issue:**
<!--
This section is optional.
Drag in an image, or post an image with a link in the form of:
![Alt Text Here](https://pbs.twimg.com/media/DW5AJnZVAAM1805?format=jpg)
-->

View File

@@ -0,0 +1,13 @@
---
name: Feature / Enhancement Request
about: Adding new features or improving existing ones.
title: ''
labels: enhancement
assignees: neikeq
---
<!--
Please search existing issues for potential duplicates before filing yours:
https://github.com/godotengine/godot-csharp-visualstudio/issues?q=is%3Aissue
-->

6
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

View File

@@ -2,29 +2,34 @@ name: Build
on:
push:
branches:
- '**'
- '!release/**'
paths-ignore:
- '.gitignore'
- 'LICENSE'
- 'README.md'
pull_request:
branches:
- '**'
- '!release/**'
paths-ignore:
- '.gitignore'
- 'LICENSE'
- 'README.md'
create:
branches:
- 'release/**'
env:
# Use SHA instead of the branch for caching purposes
MONO_BRANCH: 2019-10
MONO_SHA: 1d0d939dc30a5b56f478bc9f097cab146276b9af
PYTHON_VERSION: 3.8
EMSDK_VERSION: 1.38.47-upstream
ANDROID_PLATFORM: android-29
ANDROID_CMAKE_VERSION: 3.6.4111459
ANDROID_API: 21
# Use SHA or tag instead of the branch for caching purposes.
MONO_TAG: mono-6.12.0.198
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
# NOTE: Underscore and brackets to workaround issue in nektos/act': https://github.com/nektos/act/issues/104
jobs:
linux:
name: Linux
@@ -35,43 +40,62 @@ jobs:
steps:
- name: Set Environment Variables
run: |
echo "::set-env name=MONO_SOURCE_ROOT::$GITHUB_WORKSPACE/mono_sources"
- name: Install Dependencies (x86)
if: matrix.target == 'x86'
echo "MONO_SOURCE_ROOT=$GITHUB_WORKSPACE/mono_sources" >> $GITHUB_ENV
- name: Install Dependencies
run: |
sudo dpkg --add-architecture i386
sudo apt-get -y update
sudo apt-get -y install git autoconf libtool libtool-bin automake build-essential gettext cmake python3 curl
sudo apt-get -y install gcc-multilib g++-multilib zlib1g-dev:i386
- name: Install Dependencies (x86_64)
sudo apt-get -y install git autoconf libtool libtool-bin automake gettext cmake python3 curl
- name: Install Linux SDK (x86_64)
if: matrix.target == 'x86_64'
run: |
sudo apt-get -y update
sudo apt-get -y install git autoconf libtool libtool-bin automake build-essential gettext cmake python3 curl
cd /home/runner
curl -LO https://downloads.tuxfamily.org/godotengine/toolchains/linux/2021-02-11/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
- 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
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
- name: Cache Mono Sources
id: cache_mono_sources
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ${{ env.MONO_SOURCE_ROOT }}
key: ${{ runner.os }}-${{ env.MONO_SHA }}-mono-sources
key: ${{ runner.os }}-${{ env.MONO_TAG }}-mono-sources
- name: Checkout Mono Sources
if: steps.cache_mono_sources.outputs['cache-hit'] != 'true'
uses: actions/checkout@v2
if: steps.cache_mono_sources.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: mono/mono
ref: ${{ env.MONO_SHA }}
ref: ${{ env.MONO_TAG }}
submodules: true
path: ${{ env.MONO_SOURCE_ROOT }}
- 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@v2
uses: actions/checkout@v3
with:
path: godot-mono-builds
- name: Setup Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Patch Mono
if: steps.cache_mono_sources.outputs['cache-hit'] != 'true'
run:
python3 godot-mono-builds/patch_mono.py
- name: Configure
@@ -85,13 +109,15 @@ 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@v2
uses: actions/upload-artifact@v3
with:
name: linux-${{ matrix.target }}
path: ~/mono-installs-artifacts/linux-${{ matrix.target }}.zip
- 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: Upload config.log After Error
if: ${{ failure() }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: linux-${{ matrix.target }}-config.log
path: ~/mono-configs/desktop-linux-${{ matrix.target }}-release/config.log
@@ -105,42 +131,45 @@ jobs:
steps:
- name: Set Environment Variables
run: |
echo "::set-env name=MONO_SOURCE_ROOT::$GITHUB_WORKSPACE/mono_sources"
echo "MONO_SOURCE_ROOT=$GITHUB_WORKSPACE/mono_sources" >> $GITHUB_ENV
- name: Install Dependencies (x86)
if: matrix.target == 'x86'
run: |
sudo dpkg --add-architecture i386
sudo apt-get -y update
sudo apt-get -y install git autoconf libtool libtool-bin automake build-essential gettext cmake python3 curl
sudo apt-get -y install mingw-w64
- name: Install Dependencies (x86_64)
if: matrix.target == 'x86_64'
run: |
sudo apt-get -y update
sudo apt-get -y install git autoconf libtool libtool-bin automake build-essential gettext cmake python3 curl
sudo apt-get -y install mingw-w64 libz-mingw-w64-dev
- name: Cache Mono Sources
id: cache_mono_sources
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ${{ env.MONO_SOURCE_ROOT }}
key: ${{ runner.os }}-${{ env.MONO_SHA }}-mono-sources
key: ${{ runner.os }}-${{ env.MONO_TAG }}-mono-sources
- name: Checkout Mono Sources
if: steps.cache_mono_sources.outputs['cache-hit'] != 'true'
uses: actions/checkout@v2
if: steps.cache_mono_sources.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: mono/mono
ref: ${{ env.MONO_SHA }}
ref: ${{ env.MONO_TAG }}
submodules: true
path: ${{ env.MONO_SOURCE_ROOT }}
- 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@v2
uses: actions/checkout@v3
with:
path: godot-mono-builds
- name: Setup Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Patch Mono
if: steps.cache_mono_sources.outputs['cache-hit'] != 'true'
run:
python3 godot-mono-builds/patch_mono.py
- name: Configure
@@ -154,13 +183,15 @@ 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@v2
uses: actions/upload-artifact@v3
with:
name: windows-${{ matrix.target }}
path: ~/mono-installs-artifacts/windows-${{ matrix.target }}.zip
- 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: Upload config.log After Error
if: ${{ failure() }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: windows-${{ matrix.target }}-config.log
path: ~/mono-configs/desktop-windows-${{ matrix.target }}-release/config.log
@@ -170,38 +201,39 @@ jobs:
runs-on: macos-latest
strategy:
matrix:
target: [x86_64]
target: [arm64, x86_64]
steps:
- name: Set Environment Variables
run: |
echo "::set-env name=MONO_SOURCE_ROOT::$GITHUB_WORKSPACE/mono_sources"
echo "MONO_SOURCE_ROOT=$GITHUB_WORKSPACE/mono_sources" >> $GITHUB_ENV
- name: Install Dependencies
run: |
brew install autoconf automake libtool pkg-config cmake python3
- name: Cache Mono Sources
id: cache_mono_sources
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ${{ env.MONO_SOURCE_ROOT }}
key: ${{ runner.os }}-${{ env.MONO_SHA }}-mono-sources
key: ${{ runner.os }}-${{ env.MONO_TAG }}-mono-sources
- name: Checkout Mono Sources
if: steps.cache_mono_sources.outputs['cache-hit'] != 'true'
uses: actions/checkout@v2
if: steps.cache_mono_sources.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: mono/mono
ref: ${{ env.MONO_SHA }}
ref: ${{ env.MONO_TAG }}
submodules: true
path: ${{ env.MONO_SOURCE_ROOT }}
- 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@v2
uses: actions/checkout@v3
with:
path: godot-mono-builds
- name: Setup Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Patch Mono
if: steps.cache_mono_sources.outputs['cache-hit'] != 'true'
run:
python3 godot-mono-builds/patch_mono.py
- name: Configure
@@ -215,13 +247,15 @@ 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@v2
uses: actions/upload-artifact@v3
with:
name: osx-${{ matrix.target }}
path: ~/mono-installs-artifacts/osx-${{ matrix.target }}.zip
- 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: Upload config.log After Error
if: ${{ failure() }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: osx-${{ matrix.target }}-config.log
path: ~/mono-configs/desktop-osx-${{ matrix.target }}-release/config.log
@@ -231,38 +265,39 @@ jobs:
runs-on: macos-latest
strategy:
matrix:
target: [arm64, x86_64]
target: [arm64, x86_64, arm64-sim]
steps:
- name: Set Environment Variables
run: |
echo "::set-env name=MONO_SOURCE_ROOT::$GITHUB_WORKSPACE/mono_sources"
echo "MONO_SOURCE_ROOT=$GITHUB_WORKSPACE/mono_sources" >> $GITHUB_ENV
- name: Install Dependencies
run: |
brew install autoconf automake libtool pkg-config cmake python3
- name: Cache Mono Sources
id: cache_mono_sources
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ${{ env.MONO_SOURCE_ROOT }}
key: ${{ runner.os }}-${{ env.MONO_SHA }}-mono-sources
key: ${{ runner.os }}-${{ env.MONO_TAG }}-mono-sources
- name: Checkout Mono Sources
if: steps.cache_mono_sources.outputs['cache-hit'] != 'true'
uses: actions/checkout@v2
if: steps.cache_mono_sources.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: mono/mono
ref: ${{ env.MONO_SHA }}
ref: ${{ env.MONO_TAG }}
submodules: true
path: ${{ env.MONO_SOURCE_ROOT }}
- 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@v2
uses: actions/checkout@v3
with:
path: godot-mono-builds
- name: Setup Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Patch Mono
if: steps.cache_mono_sources.outputs['cache-hit'] != 'true'
run:
python3 godot-mono-builds/patch_mono.py
- name: Configure
@@ -277,13 +312,15 @@ 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@v2
uses: actions/upload-artifact@v3
with:
name: ios-${{ matrix.target }}
path: ~/mono-installs-artifacts/ios-${{ matrix.target }}.zip
- 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: Upload config.log After Error
if: ${{ failure() }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: ios-${{ matrix.target }}-config.log
path: ~/mono-configs/ios-${{ matrix.target }}-release/config.log
@@ -302,38 +339,39 @@ jobs:
steps:
- name: Set Environment Variables
run: |
echo "::set-env name=MONO_SOURCE_ROOT::$GITHUB_WORKSPACE/mono_sources"
echo "MONO_SOURCE_ROOT=$GITHUB_WORKSPACE/mono_sources" >> $GITHUB_ENV
- name: Install Dependencies
run: |
brew install autoconf automake libtool pkg-config cmake python3
- name: Cache Mono Sources
id: cache_mono_sources
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ${{ env.MONO_SOURCE_ROOT }}
key: ${{ runner.os }}-${{ env.MONO_SHA }}-mono-sources
key: ${{ runner.os }}-${{ env.MONO_TAG }}-mono-sources
- name: Checkout Mono Sources
if: steps.cache_mono_sources.outputs['cache-hit'] != 'true'
uses: actions/checkout@v2
if: steps.cache_mono_sources.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: mono/mono
ref: ${{ env.MONO_SHA }}
ref: ${{ env.MONO_TAG }}
submodules: true
path: ${{ env.MONO_SOURCE_ROOT }}
- 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@v2
uses: actions/checkout@v3
with:
path: godot-mono-builds
- name: Setup Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Patch Mono
if: steps.cache_mono_sources.outputs['cache-hit'] != 'true'
run:
python3 godot-mono-builds/patch_mono.py
- name: Download LLVM artifact
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: llvm-${{ matrix.llvm }}-macos-latest
# Tilde ~/ not supported when downloading yet: https://github.com/actions/download-artifact/issues/37
@@ -361,19 +399,21 @@ 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@v2
uses: actions/upload-artifact@v3
with:
name: ios-${{ matrix.target }}
path: ~/mono-installs-artifacts/ios-${{ matrix.target }}.zip
- 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: Upload Runtime config.log After Error
if: ${{ failure() }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
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@v2
uses: actions/upload-artifact@v3
with:
name: ios-${{ matrix.target }}-config.log
path: ~/mono-configs/ios-${{ matrix.target }}-release/config.log
@@ -383,191 +423,63 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
target: [armeabi-v7a, arm64-v8a, x86, x86_64]
target: [armv7, arm64v8, x86, x86_64]
steps:
- name: Set Environment Variables
run: |
echo "::set-env name=MONO_SOURCE_ROOT::$GITHUB_WORKSPACE/mono_sources"
env
echo "MONO_SOURCE_ROOT=$GITHUB_WORKSPACE/mono_sources" >> $GITHUB_ENV
- name: Install Dependencies
run: |
sudo apt-get -y update
sudo apt-get -y install git autoconf libtool libtool-bin automake build-essential gettext cmake python3 curl
sudo apt-get -y install snapd
- name: Install Android SDK Manager
run: |
sudo snap install androidsdk
androidsdk "platforms;${ANDROID_PLATFORM}"
androidsdk "ndk-bundle"
androidsdk "cmake;${ANDROID_CMAKE_VERSION}"
echo "::set-env name=ANDROID_SDK_ROOT::$HOME/snap/androidsdk/current/"
echo "::set-env name=ANDROID_NDK_ROOT::$ANDROID_SDK_ROOT/ndk-bundle"
- name: Cache Mono Sources
id: cache_mono_sources
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ${{ env.MONO_SOURCE_ROOT }}
key: ${{ runner.os }}-${{ env.MONO_SHA }}-mono-sources
key: ${{ runner.os }}-${{ env.MONO_TAG }}-mono-sources
- name: Checkout Mono Sources
if: steps.cache_mono_sources.outputs['cache-hit'] != 'true'
uses: actions/checkout@v2
if: steps.cache_mono_sources.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: mono/mono
ref: ${{ env.MONO_SHA }}
ref: ${{ env.MONO_TAG }}
submodules: true
path: ${{ env.MONO_SOURCE_ROOT }}
- 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@v2
uses: actions/checkout@v3
with:
path: godot-mono-builds
- name: Setup Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Patch Mono
if: steps.cache_mono_sources.outputs['cache-hit'] != 'true'
run:
python3 godot-mono-builds/patch_mono.py
- name: Configure
run:
python3 godot-mono-builds/android.py configure --target=${{ matrix.target }} -j 2 --android-api-version=${ANDROID_API} --android-cmake-version=${ANDROID_CMAKE_VERSION}
python3 godot-mono-builds/android.py configure --target=${{ matrix.target }} -j 2
- name: Make
run:
python3 godot-mono-builds/android.py make --target=${{ matrix.target }} -j 2 --android-api-version=${ANDROID_API} --android-cmake-version=${ANDROID_CMAKE_VERSION}
python3 godot-mono-builds/android.py make --target=${{ matrix.target }} -j 2
- name: Compress Output
run: |
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@v2
uses: actions/upload-artifact@v3
with:
name: android-${{ matrix.target }}
path: ~/mono-installs-artifacts/android-${{ matrix.target }}.zip
- 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: Upload config.log After Error
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: android-${{ matrix.target }}-config.log
path: ~/mono-configs/android-${{ matrix.target }}-release/config.log
android-cross:
needs: llvm
name: Android Cross-compiler
runs-on: ubuntu-latest
strategy:
matrix:
target: [cross-arm, cross-arm64, cross-x86, cross-x86_64, cross-arm-win, cross-arm64-win, cross-x86-win, cross-x86_64-win]
include:
- target: cross-arm
llvm: llvm64
runtime_target: armeabi-v7a
- target: cross-arm64
llvm: llvm64
runtime_target: arm64-v8a
- target: cross-x86
llvm: llvm64
runtime_target: x86
- target: cross-x86_64
llvm: llvm64
runtime_target: x86_64
- target: cross-arm-win
llvm: llvmwin64
runtime_target: armeabi-v7a
- target: cross-arm64-win
llvm: llvmwin64
runtime_target: arm64-v8a
- target: cross-x86-win
llvm: llvmwin64
runtime_target: x86
- target: cross-x86_64-win
llvm: llvmwin64
runtime_target: x86_64
steps:
- name: Set Environment Variables
run: |
echo "::set-env name=MONO_SOURCE_ROOT::$GITHUB_WORKSPACE/mono_sources"
- name: Install Dependencies
run: |
sudo apt-get -y update
sudo apt-get -y install git autoconf libtool libtool-bin automake build-essential gettext cmake python3 curl
- name: Install Dependencies (Targeting Windows)
if: matrix.llvm == 'llvmwin64'
run: |
sudo apt-get -y install mingw-w64 libz-mingw-w64-dev
- name: Install Android SDK Manager
run: |
sudo apt-get -y install snapd
sudo snap install androidsdk
androidsdk "platforms;${ANDROID_PLATFORM}"
androidsdk "ndk-bundle"
androidsdk "cmake;${ANDROID_CMAKE_VERSION}"
echo "::set-env name=ANDROID_SDK_ROOT::$HOME/snap/androidsdk/current/"
echo "::set-env name=ANDROID_NDK_ROOT::$ANDROID_SDK_ROOT/ndk-bundle"
- name: Cache Mono Sources
id: cache_mono_sources
uses: actions/cache@v1
with:
path: ${{ env.MONO_SOURCE_ROOT }}
key: ${{ runner.os }}-${{ env.MONO_SHA }}-mono-sources
- name: Checkout Mono Sources
if: steps.cache_mono_sources.outputs['cache-hit'] != 'true'
uses: actions/checkout@v2
with:
repository: mono/mono
ref: ${{ env.MONO_SHA }}
submodules: true
path: ${{ env.MONO_SOURCE_ROOT }}
- name: Checkout
uses: actions/checkout@v2
with:
path: godot-mono-builds
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Download LLVM artifact
uses: actions/download-artifact@v2
with:
name: llvm-${{ matrix.llvm }}-ubuntu-latest
# 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.
path: ./llvm-${{ matrix.llvm }}
- name: Stamp LLVM
run: |
mkdir -p $HOME/mono-installs/ && mv ./llvm-${{ matrix.llvm }} $HOME/mono-installs/
chmod 755 $HOME/mono-installs/llvm-${{ matrix.llvm }}/bin/*
mkdir -p $HOME/mono-configs/ && touch $HOME/mono-configs/.stamp-${{ matrix.llvm }}-make
- name: Patch Mono
if: steps.cache_mono_sources.outputs['cache-hit'] != 'true'
run:
python3 godot-mono-builds/patch_mono.py
- name: Configure Runtime
run:
python3 godot-mono-builds/android.py configure --target=${{ matrix.runtime_target }} -j 2 --android-api-version=${ANDROID_API} --android-cmake-version=${ANDROID_CMAKE_VERSION}
- name: Configure
run:
python3 godot-mono-builds/android.py configure --target=${{ matrix.target }} -j 2 --android-api-version=${ANDROID_API} --android-cmake-version=${ANDROID_CMAKE_VERSION}
- name: Make
run:
python3 godot-mono-builds/android.py make --target=${{ matrix.target }} -j 2 --android-api-version=${ANDROID_API} --android-cmake-version=${ANDROID_CMAKE_VERSION}
- name: Compress Output
run: |
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@v2
with:
name: android-${{ matrix.target }}
path: ~/mono-installs-artifacts/android-${{ matrix.target }}.zip
- name: Upload Runtime config.log After Error
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: android-${{ matrix.target }}-runtime-config.log
path: ~/mono-configs/android-${{ matrix.runtime_target }}-release/config.log
- name: Upload Cross config.log After Error
if: ${{ failure() }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: android-${{ matrix.target }}-config.log
path: ~/mono-configs/android-${{ matrix.target }}-release/config.log
@@ -581,39 +493,40 @@ jobs:
steps:
- name: Set Environment Variables
run: |
echo "::set-env name=MONO_SOURCE_ROOT::$GITHUB_WORKSPACE/mono_sources"
echo "MONO_SOURCE_ROOT=$GITHUB_WORKSPACE/mono_sources" >> $GITHUB_ENV
- name: Install Dependencies
run: |
sudo apt-get -y update
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@v1
uses: actions/cache@v3
with:
path: ${{ env.MONO_SOURCE_ROOT }}
key: ${{ runner.os }}-${{ env.MONO_SHA }}-mono-sources
key: ${{ runner.os }}-${{ env.MONO_TAG }}-mono-sources
- name: Checkout Mono Sources
if: steps.cache_mono_sources.outputs['cache-hit'] != 'true'
uses: actions/checkout@v2
if: steps.cache_mono_sources.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: mono/mono
ref: ${{ env.MONO_SHA }}
ref: ${{ env.MONO_TAG }}
submodules: true
path: ${{ env.MONO_SOURCE_ROOT }}
- 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@v2
uses: actions/checkout@v3
with:
path: godot-mono-builds
- name: Setup Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Setup Emscripten SDK
uses: mymindstorm/setup-emsdk@v2
uses: mymindstorm/setup-emsdk@v12
with:
version: ${{ env.EMSDK_VERSION }}
- name: Patch Mono
if: steps.cache_mono_sources.outputs['cache-hit'] != 'true'
run:
python3 godot-mono-builds/patch_mono.py
- name: Configure
@@ -627,13 +540,15 @@ 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@v2
uses: actions/upload-artifact@v3
with:
name: wasm-${{ matrix.target }}
path: ~/mono-installs-artifacts/wasm-${{ matrix.target }}.zip
- 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: Upload config.log After Error
if: ${{ failure() }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: wasm-${{ matrix.target }}-config.log
path: ~/mono-configs/wasm-${{ matrix.target }}-release/config.log
@@ -646,72 +561,92 @@ jobs:
os: [ubuntu-latest, macos-latest]
target: [llvm64, llvmwin64]
exclude:
# We already build for Windows on ubuntu-latest
- os: macos-latest
target: llvmwin64
steps:
- name: Cache LLVM
id: cache_llvm
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ~/mono-installs/llvm-${{ matrix.target }}
key: ${{ runner.os }}-${{ env.MONO_SHA }}-llvm-${{ matrix.target }}
key: ${{ runner.os }}-${{ env.MONO_TAG }}-llvm-${{ matrix.target }}
- name: Set Environment Variables
run: |
echo "::set-env name=MONO_SOURCE_ROOT::$GITHUB_WORKSPACE/mono_sources"
echo "MONO_SOURCE_ROOT=$GITHUB_WORKSPACE/mono_sources" >> $GITHUB_ENV
- name: Install Dependencies (Linux)
if: steps.cache_llvm.outputs['cache-hit'] != 'true' && matrix.os == 'ubuntu-latest'
if: steps.cache_llvm.outputs.cache-hit != 'true' && runner.os == 'Linux'
run: |
sudo apt-get -y update
sudo apt-get -y install git autoconf libtool libtool-bin automake build-essential gettext cmake python3 curl
sudo apt-get -y install git autoconf libtool libtool-bin automake gettext cmake python3 curl
- name: Install Linux SDK (x86_64)
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
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
- name: Install Dependencies (Linux Targeting Windows)
if: steps.cache_llvm.outputs['cache-hit'] != 'true' && matrix.os == 'ubuntu-latest' && matrix.target == 'llvmwin64'
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-latest'
run: |
brew install autoconf automake libtool pkg-config cmake python3
- name: Cache Mono Sources
if: steps.cache_llvm.outputs['cache-hit'] != 'true'
if: steps.cache_llvm.outputs.cache-hit != 'true'
id: cache_mono_sources
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ${{ env.MONO_SOURCE_ROOT }}
key: ${{ runner.os }}-${{ env.MONO_SHA }}-mono-sources
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@v2
if: steps.cache_mono_sources.outputs.cache-hit != 'true' && steps.cache_llvm.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: mono/mono
ref: ${{ env.MONO_SHA }}
ref: ${{ env.MONO_TAG }}
submodules: true
path: ${{ env.MONO_SOURCE_ROOT }}
- name: Clean Mono
if: steps.cache_llvm.outputs.cache-hit != 'true'
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@v2
if: steps.cache_llvm.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
path: godot-mono-builds
- name: Setup Python
if: steps.cache_llvm.outputs['cache-hit'] != 'true'
uses: actions/setup-python@v1
if: steps.cache_llvm.outputs.cache-hit != 'true'
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Patch Mono
if: steps.cache_mono_sources.outputs['cache-hit'] != 'true' && steps.cache_llvm.outputs['cache-hit'] != 'true'
if: steps.cache_llvm.outputs.cache-hit != 'true'
run:
python3 godot-mono-builds/patch_mono.py
- name: Make
if: steps.cache_llvm.outputs['cache-hit'] != 'true'
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@v2
uses: actions/upload-artifact@v3
with:
name: llvm-${{ matrix.target }}-${{ matrix.os }}
path: ~/mono-installs/llvm-${{ matrix.target }}
- name: Clean Mono
if: steps.cache_llvm.outputs.cache-hit != 'true'
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@v2
uses: actions/upload-artifact@v3
with:
name: llvm-${{ matrix.target }}-${{ matrix.os }}-config.log
path: ~/mono-configs/llvm-${{ matrix.target }}/config.log
@@ -721,42 +656,58 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
# desktop-win32 is disabled until build is fixed
product: [desktop, android, ios, wasm]
product: [desktop, desktop-win32, android, ios, wasm]
steps:
- name: Set Environment Variables
run: |
echo "::set-env name=MONO_SOURCE_ROOT::$GITHUB_WORKSPACE/mono_sources"
- name: Install Dependencies (x86_64)
echo "MONO_SOURCE_ROOT=$GITHUB_WORKSPACE/mono_sources" >> $GITHUB_ENV
- name: Install Dependencies
run: |
sudo apt-get -y update
sudo apt-get -y install git autoconf libtool libtool-bin automake build-essential gettext cmake python3 curl
sudo apt-get -y install git autoconf libtool libtool-bin automake gettext cmake python3 curl
- 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
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
- name: Cache Mono Sources
id: cache_mono_sources
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ${{ env.MONO_SOURCE_ROOT }}
key: ${{ runner.os }}-${{ env.MONO_SHA }}-mono-sources
key: ${{ runner.os }}-${{ env.MONO_TAG }}-mono-sources
- name: Checkout Mono Sources
if: steps.cache_mono_sources.outputs['cache-hit'] != 'true'
uses: actions/checkout@v2
if: steps.cache_mono_sources.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: mono/mono
ref: ${{ env.MONO_SHA }}
ref: ${{ env.MONO_TAG }}
submodules: true
path: ${{ env.MONO_SOURCE_ROOT }}
- 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@v2
uses: actions/checkout@v3
with:
path: godot-mono-builds
- name: Setup Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Patch Mono
if: steps.cache_mono_sources.outputs['cache-hit'] != 'true'
run:
python3 godot-mono-builds/patch_mono.py
- name: Make Desktop BCL for this Build Platform
if: matrix.product == 'desktop-win32'
run:
python3 godot-mono-builds/bcl.py make --product=desktop -j 2
- name: Make
run:
python3 godot-mono-builds/bcl.py make --product=${{ matrix.product }} -j 2
@@ -765,20 +716,22 @@ 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@v2
uses: actions/upload-artifact@v3
with:
name: bcl-${{ matrix.product }}
path: ~/mono-installs-artifacts/bcl-${{ matrix.product }}.zip
- 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: Upload config.log After Error
if: ${{ failure() }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: bcl-${{ matrix.product }}-config.log
path: ~/mono-configs/bcl/config.log
create-release:
if: success() && github.ref == 'refs/heads/release' && github.event_name == 'push'
needs: [linux, windows, osx, ios, ios-cross, android, android-cross, wasm, bcl]
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
outputs:
@@ -786,45 +739,38 @@ jobs:
steps:
- name: Short SHA
id: short-sha
run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)"
run: echo "::set-output name=sha7::$(echo ${GITHUB_SHA} | cut -c1-7)"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: release-${{ steps.short-sha.outputs.sha8 }}
release_name: Release ${{ steps.short-sha.outputs.sha8 }}
tag_name: release-${{ steps.short-sha.outputs.sha7 }}
release_name: Release ${{ steps.short-sha.outputs.sha7 }} with ${{ env.MONO_TAG }}
body: |
Mono:
- Branch: ${{ env.MONO_BRANCH }}
- Commit: ${{ env.MONO_SHA }}
Mono Version: ${{ env.MONO_TAG }}
EMSDK Version: ${{ env.EMSDK_VERSION }}
Android Platform: ${{ env.ANDROID_PLATFORM }}
Android API: ${{ env.ANDROID_API }}
iOS Min Version: ${{ env.IOS_VERSION_MIN }}
draft: false
prerelease: false
upload-release-artifacts:
if: success() && github.ref == 'refs/heads/release' && github.event_name == 'push'
if: success() && github.event_name == 'create' && startsWith(github.ref, 'refs/heads/release/')
needs: create-release
name: Upload Release Artifacts
runs-on: ubuntu-latest
strategy:
matrix:
# bcl-desktop-win32 is disabled until build is fixed
artifact_name: [linux-x86, linux-x86_64, windows-x86, windows-x86_64, osx-x86_64,
artifact_name: [linux-x86, linux-x86_64, windows-x86, windows-x86_64, osx-arm64, osx-x86_64,
ios-arm64, ios-x86_64, ios-cross-arm64,
android-armeabi-v7a, android-arm64-v8a, android-x86, android-x86_64,
android-cross-arm, android-cross-arm64, android-cross-x86, android-cross-x86_64,
android-cross-arm-win, android-cross-arm64-win, android-cross-x86-win, android-cross-x86_64-win,
android-armv7, android-arm64v8, android-x86, android-x86_64,
wasm-runtime, wasm-runtime-threads,
bcl-desktop, bcl-android, bcl-ios, bcl-wasm]
bcl-desktop, bcl-desktop-win32, bcl-android, bcl-ios, bcl-wasm]
steps:
- name: Download Artifact
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: ${{ matrix.artifact_name }}
path: ./

15
.github/workflows/static_checks.yml vendored Normal file
View File

@@ -0,0 +1,15 @@
name: Continuous integration
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Lint repo
run: |
sudo apt-get update -qq
sudo apt-get install -qq dos2unix recode
bash ./format.sh

1
.gitignore vendored
View File

@@ -1,2 +1,3 @@
__pycache__/
*.pyc
.DS_Store

View File

@@ -2,7 +2,16 @@
[![Build](https://github.com/godotengine/godot-mono-builds/workflows/Build/badge.svg)](https://github.com/godotengine/godot-mono-builds/actions)
This repository contains scripts for building the Mono runtime to use with Godot Engine
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
@@ -10,9 +19,9 @@ This repository contains scripts for building the Mono runtime to use with Godot
These scripts are based on the Mono [sdks](https://github.com/mono/mono/tree/master/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](https://www.mono-project.com/docs/about-mono/versioning/#mono-source-versioning) 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 `python ./patch_mono.py`.
Some patches need to be applied to the Mono sources before building. This can be done by running `python3 ./patch_mono.py`.
Run `python SCRIPT.py --help` for the full list of command line options.
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.
@@ -27,9 +36,22 @@ export MONO_SOURCE_ROOT=$HOME/git/mono
### Notes
- Python 3.7 or higher is required.
- OSXCROSS is supported expect for building the Mono cross-compilers.
- 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
```bash
@@ -50,25 +72,18 @@ _AOT cross-compilers for desktop platforms cannot be built with these scripts ye
## Android
Building for Android requires the Android SDK cmdline-tools to be installed in the Android SDK folder.
```bash
# These are the default values. This step can be omitted if SDK and NDK root are in this location.
# 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
export ANDROID_NDK_ROOT=$ANDROID_SDK_ROOT/ndk-bundle
# Build the runtime for all supported Android ABIs.
./android.py configure --target=all-runtime
./android.py make --target=all-runtime
# Build the AOT cross-compilers targeting all supported Android ABIs.
./android.py configure --target=all-cross
./android.py make --target=all-cross
# Build the AOT cross-compilers for Windows targeting all supported Android ABIs.
./android.py configure --target=all-cross-win --mxe-prefix=/usr
./android.py make --target=all-cross-win --mxe-prefix=/usr
./android.py configure --target=all-targets
./android.py make --target=all-targets
```
The option `--target=all-runtime` is a shortcut for `--target=armeabi-v7a --target=x86 --target=arm64-v8a --target=x86_64`. The equivalent applies for `all-cross` and `all-cross-win`.
The option `--target=all-targets` is a shortcut for `--target=armv7 --target=arm64v8 --target=x86 --target=x86_64`.
# iOS
@@ -123,6 +138,8 @@ _AOT cross-compilers for WebAssembly cannot be built with this script yet._
./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
```bash

View File

@@ -1,96 +1,72 @@
#!/usr/bin/python
#!/usr/bin/env python3
import os
import os.path
import subprocess
import sys
from os.path import join as path_join
from options import *
from os_utils import *
import runtime
runtime_targets = ['armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64']
cross_targets = ['cross-arm', 'cross-arm64', 'cross-x86', 'cross-x86_64']
cross_mxe_targets = ['cross-arm-win', 'cross-arm64-win', 'cross-x86-win', 'cross-x86_64-win']
DEFAULT_NDK_VERSION = '23.2.8568313'
DEFAULT_CMAKE_VERSION = '3.18.1'
targets = ['armv7', 'arm64v8', 'x86', 'x86_64']
def is_cross(target) -> bool:
return target in cross_targets or is_cross_mxe(target)
def get_min_api_version(target) -> str:
# Minimum API version should be in sync with Godot's platform/android/detect.py.
# Note: The minimum API version for arm64v8 and x86_64 is '21'
min_versions = {
'armv7': '19',
'arm64v8': '21',
'x86': '19',
'x86_64': '21',
}
return min_versions[target]
def is_cross_mxe(target) -> bool:
return target in cross_mxe_targets
def check_for_android_ndk(opts: AndroidOpts):
if not os.path.exists(os.path.join(opts.android_sdk_root, 'ndk', opts.android_ndk_version)):
print("Attempting to install Android NDK version %s" % (opts.android_ndk_version))
sdkmanager = opts.android_sdk_root + "/cmdline-tools/latest/bin/sdkmanager"
if os.path.exists(sdkmanager):
sdk_args = "ndk;" + opts.android_ndk_version
subprocess.check_call([sdkmanager, sdk_args])
else:
print("ERROR: Cannot find %s. Please ensure ANDROID_SDK_ROOT is correct and cmdline-tools are installed" % (sdkmanager))
sys.exit(1)
def android_autodetect_cmake(opts: AndroidOpts) -> str:
from distutils.version import LooseVersion
from os import listdir
sdk_cmake_basedir = path_join(opts.android_sdk_root, 'cmake')
versions = []
for entry in listdir(sdk_cmake_basedir):
if os.path.isdir(path_join(sdk_cmake_basedir, entry)):
try:
version = LooseVersion(entry)
versions += [version]
except ValueError:
continue # Not a version folder
if len(versions) == 0:
raise BuildError('Cannot auto-detect Android CMake version')
lattest_version = str(sorted(versions)[-1])
print('Auto-detected Android CMake version: ' + lattest_version)
return lattest_version
def check_for_cmake(opts: AndroidOpts):
if not os.path.exists(os.path.join(opts.android_sdk_root, 'cmake', opts.android_cmake_version)):
print("Attempting to install CMake version %s" % (opts.android_cmake_version))
sdkmanager = opts.android_sdk_root + "/cmdline-tools/latest/bin/sdkmanager"
if os.path.exists(sdkmanager):
sdk_args = "cmake;" + opts.android_cmake_version
subprocess.check_call([sdkmanager, sdk_args])
else:
print("ERROR: Cannot find %s. Please ensure ANDROID_SDK_ROOT is correct and cmdline-tools are installed" % (sdkmanager))
sys.exit(1)
def get_api_version_or_min(opts: AndroidOpts, target: str) -> str:
min_versions = { 'arm64-v8a': '21', 'x86_64': '21' }
if target in min_versions and int(opts.android_api_version) < int(min_versions[target]):
print('WARNING: %s is less than minimum platform for %s; using %s' % (opts.android_api_version, target, min_versions[target]))
return min_versions[target]
min_api_version = get_min_api_version(target)
if int(opts.android_api_version) < int(min_api_version):
print('WARNING: API version %s is less than the minimum for platform %s; using %s' % (opts.android_api_version, target, min_api_version))
return min_api_version
return opts.android_api_version
def get_android_cmake_version(opts: AndroidOpts) -> str:
return opts.android_cmake_version if opts.android_cmake_version != 'autodetect' else android_autodetect_cmake(opts)
class AndroidTargetTable:
archs = {
'armeabi-v7a': 'arm',
'arm64-v8a': 'arm64',
'x86': 'x86',
'x86_64': 'x86_64'
}
abi_names = {
'armeabi-v7a': 'arm-linux-androideabi',
'arm64-v8a': 'aarch64-linux-android',
'x86': 'i686-linux-android',
'x86_64': 'x86_64-linux-android'
}
host_triples = {
'armeabi-v7a': 'armv5-linux-androideabi',
'arm64-v8a': 'aarch64-linux-android',
'x86': 'i686-linux-android',
'x86_64': 'x86_64-linux-android'
}
def setup_android_target_template(env: dict, opts: AndroidOpts, target: str):
extra_target_envs = {
'armeabi-v7a': {
'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']
},
'arm64-v8a': {
'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']
},
@@ -100,55 +76,51 @@ def setup_android_target_template(env: dict, opts: AndroidOpts, target: str):
'android-x86_64_CXXFLAGS': ['-DL_cuserid=9']
}
}
env.update(extra_target_envs[target])
if target in extra_target_envs:
env.update(extra_target_envs[target])
if target == "armv7":
target_triple = "armv7a-linux-androideabi"
bin_utils = "arm-linux-androideabi"
elif target == "arm64v8":
target_triple = "aarch64-linux-android"
bin_utils = target_triple
elif target == "x86":
target_triple = "i686-linux-android"
bin_utils = target_triple
elif target == "x86_64":
target_triple = "x86_64-linux-android"
bin_utils = target_triple
android_new_ndk = True
if sys.platform.startswith("linux"):
host_subpath = "linux-x86_64"
elif sys.platform.startswith("darwin"):
host_subpath = "darwin-x86_64"
elif sys.platform.startswith("win"):
if platform.machine().endswith("64"):
host_subpath = "windows-x86_64"
else:
host_subpath = "windows"
with open(path_join(opts.android_ndk_root, 'source.properties')) as file:
for line in file:
line = line.strip()
if line.startswith('Pkg.Revision ') or line.startswith('Pkg.Revision='):
pkg_revision = line.split('=')[1].strip()
mayor = int(pkg_revision.split('.')[0])
android_new_ndk = mayor >= 18
break
cmake_path = os.path.join(opts.android_sdk_root, 'cmake', opts.android_cmake_version, 'bin')
ndk_path = os.path.join(opts.android_sdk_root, 'ndk', opts.android_ndk_version)
toolchain_path = os.path.join(ndk_path, 'toolchains/llvm/prebuilt', host_subpath)
compiler_path = os.path.join(toolchain_path, 'bin')
compiler_wrapper = target_triple + env['ANDROID_API_VERSION'] + '-'
bin_utils_path = os.path.join(toolchain_path, bin_utils, 'bin')
android_api = env['ANDROID_API_VERSION']
arch = AndroidTargetTable.archs[target]
abi_name = AndroidTargetTable.abi_names[target]
host_triple = AndroidTargetTable.host_triples[target]
api = env['ANDROID_API_VERSION']
toolchain_path = path_join(opts.android_toolchains_prefix, opts.toolchain_name_fmt % (target, api))
tools_path = path_join(toolchain_path, 'bin')
name_fmt = abi_name + '-%s'
sdk_cmake_dir = path_join(opts.android_sdk_root, 'cmake', get_android_cmake_version(opts))
if not os.path.isdir(sdk_cmake_dir):
print('Android CMake directory \'%s\' not found' % sdk_cmake_dir)
AR = path_join(tools_path, name_fmt % 'ar')
AS = path_join(tools_path, name_fmt % 'as')
CC = path_join(tools_path, name_fmt % 'clang')
CXX = path_join(tools_path, name_fmt % 'clang++')
AR = os.path.join(compiler_path, 'llvm-ar')
AS = os.path.join(bin_utils_path, 'as')
CC = os.path.join(compiler_path, compiler_wrapper + 'clang')
CXX = os.path.join(compiler_path, compiler_wrapper + 'clang++')
LD = os.path.join(compiler_path, 'ld')
DLLTOOL = ''
LD = path_join(tools_path, name_fmt % 'ld')
OBJDUMP = path_join(tools_path, name_fmt % 'objdump')
RANLIB = path_join(tools_path, name_fmt % 'ranlib')
CMAKE = path_join(sdk_cmake_dir, 'bin', 'cmake')
STRIP = path_join(tools_path, name_fmt % 'strip')
CPP = path_join(tools_path, name_fmt % 'cpp')
if not os.path.isfile(CPP):
CPP = path_join(tools_path, (name_fmt % 'clang'))
CPP += ' -E'
CXXCPP = path_join(tools_path, name_fmt % 'cpp')
if not os.path.isfile(CXXCPP):
CXXCPP = path_join(tools_path, (name_fmt % 'clang++'))
CXXCPP += ' -E'
OBJDUMP = os.path.join(compiler_path, 'llvm-objdump')
RANLIB = os.path.join(compiler_path, 'llvm-ranlib')
CMAKE = os.path.join(cmake_path, 'cmake')
STRIP = os.path.join(compiler_path, 'llvm-strip')
CPP = CC + ' -E'
CXXCPP = CXX + ' -E'
ccache_path = os.environ.get('CCACHE', '')
if ccache_path:
@@ -176,25 +148,18 @@ def setup_android_target_template(env: dict, opts: AndroidOpts, target: str):
CFLAGS += [
'-fstack-protector',
'-DMONODROID=1'
'-D__ANDROID_API__=' + android_api
]
CFLAGS += ['-D__ANDROID_API__=' + api] if android_new_ndk else []
CXXFLAGS += [
'-fstack-protector',
'-DMONODROID=1'
'-D__ANDROID_API__=' + android_api,
]
CXXFLAGS += ['-D__ANDROID_API__=' + api] if android_new_ndk else []
CPPFLAGS += ['-I%s/sysroot/usr/include' % toolchain_path]
CXXCPPFLAGS += ['-I%s/sysroot/usr/include' % toolchain_path]
path_link = '%s/platforms/android-%s/arch-%s/usr/lib' % (opts.android_ndk_root, api, arch)
LDFLAGS += [
'-z', 'now', '-z', 'relro', '-z', 'noexecstack',
'-ldl', '-lm', '-llog', '-lc', '-lgcc',
'-Wl,-rpath-link=%s,-dynamic-linker=/system/bin/linker' % path_link,
'-L' + path_link
'-ldl', '-lm', '-llog', '-lc'
]
# Fixes this error: DllImport unable to load library 'dlopen failed: empty/missing DT_HASH in "libmono-native.so" (built with --hash-style=gnu?)'.
@@ -211,15 +176,15 @@ def setup_android_target_template(env: dict, opts: AndroidOpts, target: str):
'--enable-minimal=ssa,portability,attach,verifier,full_messages,sgen_remset'
',sgen_marksweep_par,sgen_marksweep_fixed,sgen_marksweep_fixed_par'
',sgen_copying,logging,security,shared_handles,interpreter',
'--with-btls-android-ndk=%s' % opts.android_ndk_root,
'--with-btls-android-api=%s' % api,
'--with-btls-android-ndk=%s' % ndk_path,
'--with-btls-android-api=%s' % android_api,
]
CONFIGURE_FLAGS += ['--enable-monodroid']
CONFIGURE_FLAGS += ['--with-btls-android-ndk-asm-workaround'] if android_new_ndk else []
CONFIGURE_FLAGS += ['--with-btls-android-ndk-asm-workaround']
CONFIGURE_FLAGS += [
'--with-btls-android-cmake-toolchain=%s/build/cmake/android.toolchain.cmake' % opts.android_ndk_root,
'--with-btls-android-cmake-toolchain=%s/build/cmake/android.toolchain.cmake' % ndk_path,
'--with-sigaltstack=yes',
'--with-tls=pthread',
'--without-ikvm-native',
@@ -250,186 +215,16 @@ def setup_android_target_template(env: dict, opts: AndroidOpts, target: str):
env['_android-%s_CONFIGURE_FLAGS' % target] = CONFIGURE_FLAGS
# Runtime template
runtime.setup_runtime_template(env, opts, 'android', target, host_triple)
runtime.setup_runtime_template(env, opts, 'android', target, target_triple)
class AndroidCrossTable:
target_archs = {
'cross-arm': 'armv7',
'cross-arm64': 'aarch64-v8a',
'cross-x86': 'i686',
'cross-x86_64': 'x86_64'
}
def strip_libs(opts: AndroidOpts, product: str, target: str):
ndk_path = os.path.join(opts.android_sdk_root, 'ndk', opts.android_ndk_version)
toolchain_path = os.path.join(ndk_path, 'toolchains/llvm/prebuilt/linux-x86_64')
strip = os.path.join(toolchain_path, 'bin', 'llvm-strip')
device_targets = {
'cross-arm': 'armeabi-v7a',
'cross-arm64': 'arm64-v8a',
'cross-x86': 'x86',
'cross-x86_64': 'x86_64'
}
offsets_dumper_abis = {
'cross-arm': 'armv7-none-linux-androideabi',
'cross-arm64': 'aarch64-v8a-linux-android',
'cross-x86': 'i686-none-linux-android',
'cross-x86_64': 'x86_64-none-linux-android'
}
def get_android_libclang_path(opts):
if sys.platform == 'darwin':
return '%s/toolchains/llvm/prebuilt/darwin-x86_64/lib64/libclang.dylib' % opts.android_ndk_root
elif sys.platform in ['linux', 'linux2']:
loc = '%s/toolchains/llvm/prebuilt/linux-x86_64/lib64/libclang.so.9svn' % opts.android_ndk_root
if os.path.isfile(loc):
return loc
return '%s/toolchains/llvm/prebuilt/linux-x86_64/lib64/libclang.so.8svn' % opts.android_ndk_root
assert False
def setup_android_cross_template(env: dict, opts: AndroidOpts, target: str, host_arch: str):
def get_host_triple():
if sys.platform == 'darwin':
return '%s-apple-darwin11' % host_arch
elif sys.platform in ['linux', 'linux2']:
return '%s-linux-gnu' % host_arch
assert False
target_arch = AndroidCrossTable.target_archs[target]
device_target = AndroidCrossTable.device_targets[target]
offsets_dumper_abi = AndroidCrossTable.offsets_dumper_abis[target]
host_triple = get_host_triple()
target_triple = '%s-linux-android' % target_arch
android_libclang = get_android_libclang_path(opts)
env['_android-%s_OFFSETS_DUMPER_ARGS' % target] = [
'--libclang=%s' % android_libclang,
'--sysroot=%s/sysroot' % opts.android_ndk_root
]
env['_android-%s_AR' % target] = 'ar'
env['_android-%s_AS' % target] = 'as'
env['_android-%s_CC' % target] = 'cc'
env['_android-%s_CXX' % target] = 'c++'
env['_android-%s_CXXCPP' % target] = 'cpp'
env['_android-%s_LD' % target] = 'ld'
env['_android-%s_RANLIB' % target] = 'ranlib'
env['_android-%s_STRIP' % target] = 'strip'
is_darwin = sys.platform == 'darwin'
CFLAGS = []
CFLAGS += ['-DDEBUG_CROSS'] if not opts.release else []
CFLAGS += ['-mmacosx-version-min=10.9'] if is_darwin else []
env['_android-%s_CFLAGS' % target] = CFLAGS
CXXFLAGS = []
CXXFLAGS += ['-DDEBUG_CROSS'] if not opts.release else []
CXXFLAGS += ['-mmacosx-version-min=10.9', '-stdlib=libc++'] if is_darwin else []
env['_android-%s_CXXFLAGS' % target] = CXXFLAGS
env['_android-%s_CONFIGURE_FLAGS' % target] = [
'--disable-boehm',
'--disable-mcs-build',
'--disable-nls',
'--enable-maintainer-mode',
'--with-tls=pthread'
]
# Runtime cross template
runtime.setup_runtime_cross_template(env, opts, 'android', target, host_triple, target_triple, device_target, 'llvm64', offsets_dumper_abi)
def setup_android_cross_mxe_template(env: dict, opts: AndroidOpts, target: str, host_arch: str):
table_target = cross_targets[cross_mxe_targets.index(target)] # Re-use the non-mxe table
target_arch = AndroidCrossTable.target_archs[table_target]
device_target = AndroidCrossTable.device_targets[table_target]
offsets_dumper_abi = AndroidCrossTable.offsets_dumper_abis[table_target]
host_triple = '%s-w64-mingw32' % host_arch
target_triple = '%s-linux-android' % target_arch
android_libclang = get_android_libclang_path(opts)
env['_android-%s_OFFSETS_DUMPER_ARGS' % target] = [
'--libclang=%s' % android_libclang,
'--sysroot=%s/sysroot' % opts.android_ndk_root
]
mxe_bin = path_join(opts.mxe_prefix, 'bin')
env['_android-%s_PATH' % target] = mxe_bin
name_fmt = host_arch + '-w64-mingw32-%s'
env['_android-%s_AR' % target] = path_join(mxe_bin, name_fmt % 'ar')
env['_android-%s_AS' % target] = path_join(mxe_bin, name_fmt % 'as')
env['_android-%s_CC' % target] = path_join(mxe_bin, name_fmt % 'gcc')
env['_android-%s_CXX' % target] = path_join(mxe_bin, name_fmt % 'g++')
env['_android-%s_DLLTOOL' % target] = path_join(mxe_bin, name_fmt % 'dlltool')
env['_android-%s_LD' % target] = path_join(mxe_bin, name_fmt % 'ld')
env['_android-%s_OBJDUMP' % target] = path_join(mxe_bin, name_fmt % 'objdump')
env['_android-%s_RANLIB' % target] = path_join(mxe_bin, name_fmt % 'ranlib')
env['_android-%s_STRIP' % target] = path_join(mxe_bin, name_fmt % 'strip')
mingw_zlib_prefix = '%s/opt/mingw-zlib/usr' % opts.mxe_prefix
if not os.path.isdir(mingw_zlib_prefix):
mingw_zlib_prefix = opts.mxe_prefix
CFLAGS = []
CFLAGS += ['-DDEBUG_CROSS'] if not opts.release else []
CFLAGS += ['-I%s/%s-w64-mingw32/include' % (mingw_zlib_prefix, host_arch)]
env['_android-%s_CFLAGS' % target] = CFLAGS
CXXFLAGS = []
CXXFLAGS += ['-DDEBUG_CROSS'] if not opts.release else []
CXXFLAGS += ['-I%s/%s-w64-mingw32/include' % (mingw_zlib_prefix, host_arch)]
env['_android-%s_CXXFLAGS' % target] = CXXFLAGS
env['_android-%s_LDFLAGS' % target] = []
CONFIGURE_FLAGS = [
'--disable-boehm',
'--disable-mcs-build',
'--disable-nls',
'--enable-static-gcc-libs',
'--enable-maintainer-mode',
'--with-tls=pthread'
]
CONFIGURE_FLAGS += ['--with-static-zlib=%s/%s-w64-mingw32/lib/libz.a' % (mingw_zlib_prefix, host_arch)]
env['_android-%s_CONFIGURE_FLAGS' % target] = CONFIGURE_FLAGS
# Runtime cross template
runtime.setup_runtime_cross_template(env, opts, 'android', target, host_triple, target_triple, device_target, 'llvmwin64', offsets_dumper_abi)
def make_standalone_toolchain(opts: AndroidOpts, target: str, api: str):
install_dir = path_join(opts.android_toolchains_prefix, opts.toolchain_name_fmt % (target, api))
if os.path.isdir(path_join(install_dir, 'bin')):
return # Looks like it's already there, so no need to re-create it
command = path_join(opts.android_ndk_root, 'build', 'tools', 'make_standalone_toolchain.py')
args = ['--verbose', '--force', '--api=' + api, '--arch=' + AndroidTargetTable.archs[target],
'--install-dir=' + install_dir]
run_command(command, args=args, name='make_standalone_toolchain')
def strip_libs(opts: AndroidOpts, product: str, target: str, api: str):
toolchain_path = path_join(opts.android_toolchains_prefix, opts.toolchain_name_fmt % (target, api))
tools_path = path_join(toolchain_path, 'bin')
name_fmt = AndroidTargetTable.abi_names[target] + '-%s'
strip = path_join(tools_path, name_fmt % 'strip')
install_dir = path_join(opts.install_dir, '%s-%s-%s' % (product, target, opts.configuration))
out_libs_dir = path_join(install_dir, 'lib')
install_dir = os.path.join(opts.install_dir, '%s-%s-%s' % (product, target, opts.configuration))
out_libs_dir = os.path.join(install_dir, 'lib')
lib_files = globs(('*.a', '*.so'), dirpath=out_libs_dir)
if len(lib_files):
@@ -439,20 +234,9 @@ def strip_libs(opts: AndroidOpts, product: str, target: str, api: str):
def configure(opts: AndroidOpts, product: str, target: str):
env = { 'ANDROID_API_VERSION': get_api_version_or_min(opts, target) }
if is_cross(target):
import llvm
setup_android_target_template(env, opts, target)
if is_cross_mxe(target):
llvm.make(opts, 'llvmwin64')
setup_android_cross_mxe_template(env, opts, target, host_arch='x86_64')
else:
llvm.make(opts, 'llvm64')
setup_android_cross_template(env, opts, target, host_arch='x86_64')
else:
make_standalone_toolchain(opts, target, env['ANDROID_API_VERSION'])
setup_android_target_template(env, opts, target)
if not os.path.isfile(path_join(opts.mono_source_root, 'configure')):
if not os.path.isfile(os.path.join(opts.mono_source_root, 'configure')):
runtime.run_autogen(opts)
runtime.run_configure(env, opts, product, target)
@@ -461,7 +245,7 @@ def configure(opts: AndroidOpts, product: str, target: str):
def make(opts: AndroidOpts, product: str, target: str):
env = { 'ANDROID_API_VERSION': get_api_version_or_min(opts, target) }
build_dir = path_join(opts.configure_dir, '%s-%s-%s' % (product, target, opts.configuration))
build_dir = os.path.join(opts.configure_dir, '%s-%s-%s' % (product, target, opts.configuration))
make_args = make_default_args(opts)
make_args += ['-C', build_dir]
@@ -471,15 +255,15 @@ def make(opts: AndroidOpts, product: str, target: str):
run_command('make', args=['-C', '%s/support' % build_dir, 'install'], name='make install support')
run_command('make', args=['-C', '%s/data' % build_dir, 'install'], name='make install data')
if opts.strip_libs and not is_cross(target):
strip_libs(opts, product, target, env['ANDROID_API_VERSION'])
if opts.strip_libs:
strip_libs(opts, product, target)
def clean(opts: AndroidOpts, product: str, target: str):
rm_rf(
path_join(opts.configure_dir, '%s-%s-%s' % (product, target, opts.configuration)),
path_join(opts.configure_dir, '%s-%s-%s.config.cache' % (product, target, opts.configuration)),
path_join(opts.install_dir, '%s-%s-%s' % (product, target, opts.configuration))
os.path.join(opts.configure_dir, '%s-%s-%s' % (product, target, opts.configuration)),
os.path.join(opts.configure_dir, '%s-%s-%s.config.cache' % (product, target, opts.configuration)),
os.path.join(opts.install_dir, '%s-%s-%s' % (product, target, opts.configuration))
)
@@ -489,13 +273,7 @@ def main(raw_args):
from collections import OrderedDict
from typing import Callable
target_shortcuts = {
'all-runtime': runtime_targets,
'all-cross': cross_targets,
'all-cross-win': cross_mxe_targets
}
target_values = runtime_targets + cross_targets + cross_mxe_targets + list(target_shortcuts)
target_choices = targets + ['all-targets']
actions = OrderedDict()
actions['configure'] = configure
@@ -504,26 +282,20 @@ def main(raw_args):
parser = cmd_utils.build_arg_parser(
description='Builds the Mono runtime for Android',
env_vars={
'ANDROID_SDK_ROOT': 'Overrides default value for --android-sdk',
'ANDROID_NDK_ROOT': 'Overrides default value for --android-ndk',
'ANDROID_HOME': 'Same as ANDROID_SDK_ROOT'
}
env_vars={ 'ANDROID_SDK_ROOT': 'Overrides default value for --android-sdk' }
)
home = os.environ.get('HOME')
android_sdk_default = os.environ.get('ANDROID_HOME', os.environ.get('ANDROID_SDK_ROOT', path_join(home, 'Android/Sdk')))
android_ndk_default = os.environ.get('ANDROID_NDK_ROOT', path_join(android_sdk_default, 'ndk-bundle'))
android_sdk_default = os.environ.get('ANDROID_SDK_ROOT', os.path.join(home, 'Android/Sdk'))
default_help = 'default: %(default)s'
parser.add_argument('action', choices=['configure', 'make', 'clean'])
parser.add_argument('--target', choices=target_values, action='append', required=True)
parser.add_argument('--toolchains-prefix', default=path_join(home, 'android-toolchains'), help=default_help)
parser.add_argument('--target', choices=target_choices, action='append', required=True)
parser.add_argument('--android-sdk', default=android_sdk_default, help=default_help)
parser.add_argument('--android-ndk', default=android_ndk_default, help=default_help)
parser.add_argument('--android-api-version', default='21', help=default_help)
parser.add_argument('--android-cmake-version', default='autodetect', help=default_help)
parser.add_argument('--android-ndk-version', default=DEFAULT_NDK_VERSION, help=default_help)
parser.add_argument('--android-api-version', default=get_min_api_version(targets[0]), help=default_help)
parser.add_argument('--android-cmake-version', default=DEFAULT_CMAKE_VERSION, help=default_help)
cmd_utils.add_runtime_arguments(parser, default_help)
@@ -538,11 +310,14 @@ def main(raw_args):
print('Mono sources directory not found: ' + opts.mono_source_root)
sys.exit(1)
targets = cmd_utils.expand_input_targets(input_targets, target_shortcuts)
check_for_android_ndk(opts)
check_for_cmake(opts)
build_targets = cmd_utils.expand_input_targets(input_targets, { 'all-targets': targets })
action = actions[input_action]
try:
for target in targets:
for target in build_targets:
action(opts, 'android', target)
except BuildError as e:
sys.exit(e.message)

81
bcl.py
View File

@@ -1,5 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python
#!/usr/bin/env python3
import os
import os.path
@@ -27,8 +26,21 @@ test_profiles_table = {
'wasm': ['wasm']
}
def get_install_dir(opts: BaseOpts, product: str):
return path_join(opts.install_dir, '%s-bcl' % product)
def configure_bcl(opts: BclOpts):
def get_profile_dir(profile: str, product: str):
if product == 'desktop-win32':
return profile + '-win32'
else:
return profile
def get_profile_install_dirs(opts: BaseOpts, product: str):
install_dir = get_install_dir(opts, product)
profiles = profiles_table[product]
return [path_join(install_dir, get_profile_dir(profile, product)) for profile in profiles]
def configure_bcl(opts: BclOpts, product: str):
stamp_file = path_join(opts.configure_dir, '.stamp-bcl-configure')
if os.path.isfile(stamp_file):
@@ -42,12 +54,21 @@ def configure_bcl(opts: BclOpts):
CONFIGURE_FLAGS = [
'--disable-boehm',
'--disable-btls-lib',
'--disable-nls',
'--disable-support-build',
'--with-mcs-docs=no'
]
if product == 'desktop-win32':
CONFIGURE_FLAGS += [
'--enable-btls',
'--enable-btls-lib'
]
else:
CONFIGURE_FLAGS += [
'--disable-btls-lib'
]
configure = path_join(opts.mono_source_root, 'configure')
configure_args = CONFIGURE_FLAGS
@@ -72,8 +93,8 @@ def make_bcl(opts: BclOpts):
touch(stamp_file)
def build_bcl(opts: BclOpts):
configure_bcl(opts)
def build_bcl(opts: BclOpts, product: str):
configure_bcl(opts, product)
make_bcl(opts)
@@ -85,14 +106,14 @@ def clean_bcl(opts: BclOpts):
def make_product(opts: BclOpts, product: str):
build_bcl(opts)
build_bcl(opts, product)
build_dir = path_join(opts.configure_dir, 'bcl')
profiles = profiles_table[product]
test_profiles = test_profiles_table[product]
install_dir = path_join(opts.install_dir, '%s-bcl' % product)
install_dir = get_install_dir(opts, product)
mkdir_p(install_dir)
@@ -113,7 +134,7 @@ def make_product(opts: BclOpts, product: str):
# Copy the bcl profiles to the output directory
from distutils.dir_util import copy_tree
for profile in profiles:
profile_dir = profile + '-win32' if product == 'desktop-win32' else profile
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))
# Remove unneeded files
@@ -127,6 +148,27 @@ def make_product(opts: BclOpts, product: str):
file_pattern_recursive = '%s/**/%s' % (install_dir, file_pattern)
[rm_rf(x) for x in glob.iglob(file_pattern_recursive, recursive=True)]
# WebAssembly.Framework.sln
if product == 'wasm':
wasm_fx_output_dir = '%s/sdks/wasm/framework/netstandard2.0' % opts.mono_source_root
wasm_fx_sln_file = '%s/sdks/wasm/framework/src/WebAssembly.Framework.sln' % opts.mono_source_root
output_dir = path_join(install_dir, 'wasm')
from msbuild_helper import build_solution
build_solution(wasm_fx_sln_file, 'Release')
import shutil
from glob import glob
fglob = glob(path_join(wasm_fx_output_dir, '*.dll'))
if not opts.remove_pdb:
fglob.extend(glob(path_join(wasm_fx_output_dir, '*.pdb')))
for file in fglob:
if os.path.isfile(file):
shutil.copy(file, output_dir)
# godot_android_ext profile (custom 'Mono.Android.dll')
if product == 'android':
this_script_dir = os.path.dirname(os.path.realpath(__file__))
@@ -145,11 +187,30 @@ def make_product(opts: BclOpts, product: str):
run_command('csc', android_env_csc_args)
# (custom 'Xamarin.iOS.dll')
if product == 'ios':
this_script_dir = os.path.dirname(os.path.realpath(__file__))
monotouch_profile_dir = '%s/%s' % (install_dir, 'monotouch')
refs = ['mscorlib.dll', 'System.Net.Http.dll']
mkdir_p(monotouch_profile_dir)
android_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]
run_command('csc', android_env_csc_args)
def clean_product(opts: BclOpts, product: str):
clean_bcl(opts)
install_dir = path_join(opts.install_dir, '%s-bcl' % product)
install_dir = get_install_dir(opts, product)
rm_rf(install_dir)

View File

@@ -15,7 +15,7 @@ import runtime
targets = {
'linux': ['x86', 'x86_64'],
'windows': ['x86', 'x86_64'],
'osx': ['x86_64']
'osx': ['arm64', 'x86_64']
}
target_arch = {
@@ -28,14 +28,24 @@ target_arch = {
'x86_64': 'x86_64'
},
'osx': {
'arm64': 'arm64',
'x86_64': 'x86_64'
}
}
host_triples = {
'linux': '%s-linux-gnu',
'windows': '%s-w64-mingw32',
'osx': '%s-apple-darwin',
'linux': {
'x86': 'i686-linux-gnu',
'x86_64': 'x86_64-linux-gnu'
},
'windows': {
'x86': 'i686-w64-mingw32',
'x86_64': 'x86_64-w64-mingw32'
},
'osx': {
'arm64': 'aarch64-apple-darwin20',
'x86_64': 'x86_64-apple-darwin'
}
}
llvm_table = {
@@ -70,25 +80,26 @@ def get_osxcross_sdk(osxcross_bin, arch):
def setup_desktop_template(env: dict, opts: DesktopOpts, product: str, target_platform: str, target: str):
host_triple = host_triples[target_platform] % target_arch[target_platform][target]
host_triple = host_triples[target_platform][target]
CONFIGURE_FLAGS = [
'--disable-boehm',
'--disable-mcs-build',
'--enable-maintainer-mode',
'--with-tls=pthread',
'--without-ikvm-native'
'--without-ikvm-native',
'--enable-btls',
]
if target_platform == 'windows':
CONFIGURE_FLAGS += [
'--with-libgdiplus=%s' % opts.mxe_prefix
'--with-libgdiplus=%s' % opts.mxe_prefix,
'--enable-btls-lib',
]
else:
CONFIGURE_FLAGS += [
'--disable-iconv',
'--disable-nls',
'--enable-dynamic-btls',
'--with-sigaltstack=yes',
]
@@ -137,7 +148,20 @@ def setup_desktop_template(env: dict, opts: DesktopOpts, product: str, target_pl
# DTrace is not available when building with OSXCROSS
CONFIGURE_FLAGS += ['--enable-dtrace=no']
else:
env['_%s-%s_CC' % (product, target)] = 'cc'
osx_toolchain = '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain'
env['_%s-%s_CC' % (product, target)] = '%s/usr/bin/clang' % osx_toolchain
env['_%s-%s_CXX' % (product, target)] = '%s/usr/bin/clang++' % osx_toolchain
osx_sysroot = '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk'
CFLAGS = [
'-isysroot', osx_sysroot,
'-arch', target_arch[target_platform][target]
]
env['_%s-%s_CFLAGS' % (product, target)] = CFLAGS
env['_%s-%s_CXXFLAGS' % (product, target)] = CFLAGS
env['_%s-%s_CONFIGURE_FLAGS' % (product, target)] = CONFIGURE_FLAGS
@@ -187,6 +211,14 @@ def configure(opts: DesktopOpts, product: str, target_platform: str, target: str
def make(opts: DesktopOpts, product: str, target_platform: str, target: str):
build_dir = path_join(opts.configure_dir, '%s-%s-%s' % (product, target, opts.configuration))
if target_platform == 'windows':
mxe = 'mxe-Win64' if target == 'x86_64' else 'mxe-Win32'
replace_in_new_file(
src_file='%s/sdks/builds/%s.cmake.in' % (opts.mono_source_root, mxe),
search='@MXE_PATH@', replace=opts.mxe_prefix,
dst_file='%s/mono/btls/%s.cmake' % (opts.mono_source_root, mxe)
)
make_args = make_default_args(opts)
make_args += ['-C', build_dir]
@@ -198,6 +230,14 @@ def make(opts: DesktopOpts, product: str, target_platform: str, target: str):
if opts.strip_libs:
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 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)
def clean(opts: DesktopOpts, product: str, target_platform: str, target: str):
rm_rf(
@@ -215,13 +255,14 @@ def run_main(raw_args, target_platform):
actions = OrderedDict()
actions['configure'] = configure
actions['make'] = make
actions['copy-bcl'] = copy_bcl
actions['clean'] = clean
parser = cmd_utils.build_arg_parser(description='Builds the Mono runtime for the Desktop')
default_help = 'default: %(default)s'
parser.add_argument('action', choices=['configure', 'make', 'clean'])
parser.add_argument('action', choices=['configure', 'make', 'copy-bcl', 'clean'])
parser.add_argument('--target', choices=targets[target_platform], action='append', required=True)
parser.add_argument('--with-llvm', action='store_true', default=False, help=default_help)

View File

@@ -3,11 +3,11 @@ index e57a636ef4d..60c60a8fc17 100644
--- a/mcs/build/rules.make
+++ b/mcs/build/rules.make
@@ -94,7 +94,7 @@ include $(topdir)/build/config-default.make
include $(topdir)/build/platforms/$(BUILD_PLATFORM).make
-PROFILE_PLATFORM = $(if $(PLATFORMS),$(if $(filter $(PLATFORMS),$(HOST_PLATFORM)),$(HOST_PLATFORM),$(error Unknown platform "$(HOST_PLATFORM)" for profile "$(PROFILE)")))
+PROFILE_PLATFORM ?= $(if $(PLATFORMS),$(if $(filter $(PLATFORMS),$(HOST_PLATFORM)),$(HOST_PLATFORM),$(error Unknown platform "$(HOST_PLATFORM)" for profile "$(PROFILE)")))
PROFILE_DIRECTORY = $(PROFILE)$(if $(PROFILE_PLATFORM),-$(PROFILE_PLATFORM))
# Useful

View File

@@ -0,0 +1,33 @@
diff --git a/configure.ac b/configure.ac
index 19b20127ca2..d07afde5e05 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5924,6 +5924,8 @@ if test "x$enable_btls" = "xyes"; then
if test "x$HAVE_YASM" != "xyes"; then
BTLS_CMAKE_ARGS="-DOPENSSL_NO_ASM=1"
fi
+ mono_btls_dir_abs=`cd $srcdir && pwd`/mono/btls
+ BTLS_CMAKE_ARGS="$BTLS_CMAKE_ARGS -DCYGWIN=TRUE -DCMAKE_TOOLCHAIN_FILE=\"$mono_btls_dir_abs/mxe-Win32.cmake\""
;;
esac
;;
@@ -5935,6 +5937,8 @@ if test "x$enable_btls" = "xyes"; then
if test "x$HAVE_YASM" != "xyes"; then
BTLS_CMAKE_ARGS="-DOPENSSL_NO_ASM=1"
fi
+ mono_btls_dir_abs=`cd $srcdir && pwd`/mono/btls
+ BTLS_CMAKE_ARGS="$BTLS_CMAKE_ARGS -DCYGWIN=TRUE -DCMAKE_TOOLCHAIN_FILE=\"$mono_btls_dir_abs/mxe-Win64.cmake\""
;;
esac
;;
diff --git a/mono/btls/CMakeLists.txt b/mono/btls/CMakeLists.txt
index 992f41e4c7f..9946f5d21a4 100644
--- a/mono/btls/CMakeLists.txt
+++ b/mono/btls/CMakeLists.txt
@@ -129,4 +129,5 @@ endif ()
if (CYGWIN)
target_link_libraries (mono-btls-shared wsock32 ws2_32)
+ target_link_options (mono-btls-shared PRIVATE -static-libgcc)
endif ()
\ No newline at end of file

View File

@@ -0,0 +1,59 @@
diff --git a/configure.ac b/configure.ac
index d07afde5e05..2c052530f2c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4927,9 +4927,6 @@ if test "x$target_mach" = "xyes"; then
CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC -DTARGET_OSX"
CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC -DTARGET_OSX"
target_osx=yes
- if test "x$TARGET" = "xARM64"; then
- BTLS_SUPPORTED=no
- fi
], [
AC_DEFINE(TARGET_IOS,1,[The JIT/AOT targets iOS])
CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC -DTARGET_IOS"
@@ -5952,7 +5949,11 @@ if test "x$enable_btls" = "xyes"; then
;;
aarch64)
btls_arch=aarch64
- btls_cflags="-march=armv8-a+crypto"
+ if test "x$target_mach" = "xyes"; then
+ btls_cflags="-arch arm64"
+ else
+ btls_cflags="-march=armv8-a+crypto"
+ fi
;;
s390x)
btls_arch=s390x
diff --git a/mono/btls/CMakeLists.txt b/mono/btls/CMakeLists.txt
index 9946f5d21a4..a8aa3d07b0e 100644
--- a/mono/btls/CMakeLists.txt
+++ b/mono/btls/CMakeLists.txt
@@ -21,6 +21,15 @@ if (MSVC OR CYGWIN)
set(BTLS_HOST_WIN32 1)
endif ()
+if (NOT "${BTLS_ARCH}" STREQUAL "")
+ message (STATUS "SET ARCH: ${BTLS_ARCH}")
+ set (CMAKE_SYSTEM_PROCESSOR "${BTLS_ARCH}")
+endif ()
+
+if ((("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "arm64") OR ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64")) AND APPLE AND NOT IOS)
+ set(OPENSSL_NO_ASM 1)
+endif ()
+
if (NOT OPENSSL_NO_ASM)
if (BTLS_HOST_WIN32)
if (CYGWIN AND "${BTLS_ARCH}" STREQUAL "i386")
@@ -38,11 +47,6 @@ if (NOT OPENSSL_NO_ASM)
endif ()
endif ()
-if (NOT "${BTLS_ARCH}" STREQUAL "")
- message (STATUS "SET ARCH: ${BTLS_ARCH}")
- set (CMAKE_SYSTEM_PROCESSOR "${BTLS_ARCH}")
-endif ()
-
if (NOT MSVC)
if(${CMAKE_SYSTEM_NAME} MATCHES "AIX" OR ${CMAKE_SYSTEM_NAME} MATCHES "OS400")
# GCC+XCOFF doesn't support -fvisibility=hidden, and we would prefer XCOFF debugging info.

View File

@@ -1,8 +1,8 @@
diff --git a/mono/metadata/threads.c b/mono/metadata/threads.c
index ad9b8823f8f..3542b32b540 100644
index 8d6753f2e01..1c1bd460123 100644
--- a/mono/metadata/threads.c
+++ b/mono/metadata/threads.c
@@ -77,8 +77,12 @@ mono_native_thread_join_handle (HANDLE thread_handle, gboolean close_handle);
@@ -78,8 +78,12 @@ mono_native_thread_join_handle (HANDLE thread_handle, gboolean close_handle);
#include <zircon/syscalls.h>
#endif
@@ -18,10 +18,10 @@ index ad9b8823f8f..3542b32b540 100644
#ifdef HOST_ANDROID
diff --git a/mono/utils/mono-threads-posix.c b/mono/utils/mono-threads-posix.c
index 3e4bf93de5f..79c9f731fe7 100644
index cd32e6b042d..5e2fd4618b8 100644
--- a/mono/utils/mono-threads-posix.c
+++ b/mono/utils/mono-threads-posix.c
@@ -31,8 +31,12 @@
@@ -32,8 +32,12 @@
#include <errno.h>

View File

@@ -0,0 +1,48 @@
diff --git a/mono/metadata/threadpool-io.c b/mono/metadata/threadpool-io.c
index a8a947e7dea..b87b59ed5b6 100644
--- a/mono/metadata/threadpool-io.c
+++ b/mono/metadata/threadpool-io.c
@@ -179,6 +179,7 @@ selector_thread_wakeup_drain_pipes (void)
{
gchar buffer [128];
gint received;
+ static gint warnings_issued = 0;
for (;;) {
#if !defined(HOST_WIN32)
@@ -191,11 +192,16 @@ selector_thread_wakeup_drain_pipes (void)
* some unices (like AIX) send ERESTART, which doesn't
* exist on some other OSes errno
*/
- if (errno != EINTR && errno != EAGAIN && errno != ERESTART)
+ if (errno != EINTR && errno != EAGAIN && errno != ERESTART) {
#else
- if (errno != EINTR && errno != EAGAIN)
+ if (errno != EINTR && errno != EAGAIN) {
#endif
- g_warning ("selector_thread_wakeup_drain_pipes: read () failed, error (%d) %s\n", errno, g_strerror (errno));
+ // limit amount of spam we write
+ if (warnings_issued < 100) {
+ g_warning ("selector_thread_wakeup_drain_pipes: read () failed, error (%d) %s\n", errno, g_strerror (errno));
+ warnings_issued++;
+ }
+ }
break;
}
#else
@@ -203,8 +209,13 @@ selector_thread_wakeup_drain_pipes (void)
if (received == 0)
break;
if (received == SOCKET_ERROR) {
- if (WSAGetLastError () != WSAEINTR && WSAGetLastError () != WSAEWOULDBLOCK)
- g_warning ("selector_thread_wakeup_drain_pipes: recv () failed, error (%d)\n", WSAGetLastError ());
+ if (WSAGetLastError () != WSAEINTR && WSAGetLastError () != WSAEWOULDBLOCK) {
+ // limit amount of spam we write
+ if (warnings_issued < 100) {
+ g_warning ("selector_thread_wakeup_drain_pipes: recv () failed, error (%d)\n", WSAGetLastError ());
+ warnings_issued++;
+ }
+ }
break;
}
#endif

View File

@@ -1,10 +1,10 @@
diff --git a/mono/mini/debugger-agent.c b/mono/mini/debugger-agent.c
index df6329391df..05f30d5b4dc 100644
index 32bfc471ea2..5087405eed5 100644
--- a/mono/mini/debugger-agent.c
+++ b/mono/mini/debugger-agent.c
@@ -4088,8 +4088,12 @@ thread_startup (MonoProfiler *prof, uintptr_t tid)
@@ -4172,8 +4172,12 @@ thread_startup (MonoProfiler *prof, uintptr_t tid)
}
tls = (DebuggerTlsData *)mono_native_tls_get_value (debugger_tls_id);
- g_assert (!tls);
- // FIXME: Free this somewhere

View File

@@ -0,0 +1,47 @@
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

@@ -1,13 +1,13 @@
diff --git a/mono/utils/mono-log-darwin.c b/mono/utils/mono-log-darwin.c
index 3cb127bad59..30ff5edc307 100644
index 2cb41b1481e..4f566ddb90a 100644
--- a/mono/utils/mono-log-darwin.c
+++ b/mono/utils/mono-log-darwin.c
@@ -5,7 +5,8 @@
*/
#include <config.h>
-#if defined(HOST_WATCHOS) && (__WATCH_OS_VERSION_MIN_REQUIRED >= __WATCHOS_3_0)
+#if (defined(HOST_WATCHOS) && (__WATCH_OS_VERSION_MIN_REQUIRED >= __WATCHOS_3_0)) \
-#if (defined(HOST_WATCHOS) && (__WATCH_OS_VERSION_MIN_REQUIRED >= __WATCHOS_3_0)) || defined(HOST_MACCAT)
+#if (defined(HOST_WATCHOS) && (__WATCH_OS_VERSION_MIN_REQUIRED >= __WATCHOS_3_0)) || defined(HOST_MACCAT) \
+ || (defined(HOST_IOS) && (__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 100000))
/* emitted by clang:
* > /Users/lewurm/work/mono-watch4/mono/utils/mono-log-darwin.c:35:2: error: 'asl_log' is \

View File

@@ -1,5 +1,5 @@
diff --git a/mono/tools/offsets-tool/offsets-tool.py b/mono/tools/offsets-tool/offsets-tool.py
index 35445ba585c..d1586ee5ecd 100644
index f06799cba12..adf7eb4bbd6 100644
--- a/mono/tools/offsets-tool/offsets-tool.py
+++ b/mono/tools/offsets-tool/offsets-tool.py
@@ -54,6 +54,7 @@ class OffsetsTool:

View File

@@ -0,0 +1,52 @@
diff --git a/mono/mini/aot-runtime-wasm.c b/mono/mini/aot-runtime-wasm.c
index ccc5a26510c..2f7001be00b 100644
--- a/mono/mini/aot-runtime-wasm.c
+++ b/mono/mini/aot-runtime-wasm.c
@@ -112,6 +112,22 @@ mono_wasm_interp_to_native_trampoline (void *target_func, InterpMethodArguments
icall_trampoline_dispatch (cookie, target_func, margs);
}
+typedef mono_bool (*GodotMonoM2nIcallTrampolineDispatch)(const char *cookie, void *target_func, InterpMethodArguments *margs);
+
+GodotMonoM2nIcallTrampolineDispatch m2n_icall_trampoline_dispatch_hook = NULL;
+
+GodotMonoM2nIcallTrampolineDispatch
+godot_mono_get_m2n_icall_trampoline_dispatch_hook (void)
+{
+ return m2n_icall_trampoline_dispatch_hook;
+}
+
+MONO_API void
+godot_mono_register_m2n_icall_trampoline_dispatch_hook (GodotMonoM2nIcallTrampolineDispatch hook)
+{
+ m2n_icall_trampoline_dispatch_hook = hook;
+}
+
#else /* TARGET_WASM */
MONO_EMPTY_SOURCE_FILE (aot_runtime_wasm);
diff --git a/mono/mini/wasm_m2n_invoke.g.h b/mono/mini/wasm_m2n_invoke.g.h
index aea7e9698ad..3bb715f9fd8 100644
--- a/mono/mini/wasm_m2n_invoke.g.h
+++ b/mono/mini/wasm_m2n_invoke.g.h
@@ -1017,6 +1017,10 @@ wasm_invoke_vil (void *target_func, InterpMethodArguments *margs)
}
+typedef mono_bool (*GodotMonoM2nIcallTrampolineDispatch)(const char *cookie, void *target_func, InterpMethodArguments *margs);
+
+GodotMonoM2nIcallTrampolineDispatch godot_mono_get_m2n_icall_trampoline_dispatch_hook (void);
+
static void
icall_trampoline_dispatch (const char *cookie, void *target_func, InterpMethodArguments *margs)
{
@@ -1820,5 +1824,9 @@ icall_trampoline_dispatch (const char *cookie, void *target_func, InterpMethodAr
}
}
}
+ GodotMonoM2nIcallTrampolineDispatch trampoline_dispatch_hook = godot_mono_get_m2n_icall_trampoline_dispatch_hook ();
+ if (trampoline_dispatch_hook != NULL && trampoline_dispatch_hook (cookie, target_func, margs)) {
+ return;
+ }
g_error ("CANNOT HANDLE COOKIE %s\n", cookie);
}

15
files/xi.cs Normal file
View File

@@ -0,0 +1,15 @@
using System.Net.Http;
[assembly:System.Reflection.AssemblyVersionAttribute ("0.0.0.0")]
[assembly:System.Runtime.CompilerServices.InternalsVisibleTo ("System.Net.Http, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
namespace ObjCRuntime
{
internal class RuntimeOptions
{
internal static HttpMessageHandler GetHttpMessageHandler()
{
return new HttpClientHandler();
}
}
}

BIN
files/xi.snk Normal file

Binary file not shown.

48
format.sh Executable file
View File

@@ -0,0 +1,48 @@
#!/usr/bin/env bash
set -uo pipefail
IFS=$'\n\t'
# Loops through all text files tracked by Git.
git grep -zIl '' |
while IFS= read -rd '' f; do
# Exclude csproj and hdr files, and patches.
if [[ "$f" == *"csproj" ]]; then
continue
elif [[ "$f" == *"hdr" ]]; then
continue
elif [[ "$f" == *"diff" ]]; then
continue
elif [[ "$f" == *"patch" ]]; then
continue
fi
# Ensures that files are UTF-8 formatted.
recode UTF-8 "$f" 2> /dev/null
# Ensures that files have LF line endings.
dos2unix "$f" 2> /dev/null
# Ensures that files do not contain a BOM.
sed -i '1s/^\xEF\xBB\xBF//' "$f"
# Ensures that files end with newline characters.
tail -c1 < "$f" | read -r _ || echo >> "$f";
# Remove trailing space characters.
sed -z -i 's/\x20\x0A/\x0A/g' "$f"
done
git diff > patch.patch
FILESIZE="$(stat -c%s patch.patch)"
MAXSIZE=5
# If no patch has been generated all is OK, clean up, and exit.
if (( FILESIZE < MAXSIZE )); then
printf "Files in this commit comply with the formatting rules.\n"
rm -f patch.patch
exit 0
fi
# A patch has been created, notify the user, clean up, and exit.
printf "\n*** The following differences were found between the code "
printf "and the formatting rules:\n\n"
cat patch.patch
printf "\n*** Aborting, please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\n"
rm -f patch.patch
exit 1

37
ios.py
View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python3
import os
import os.path
@@ -14,7 +14,7 @@ import runtime
this_script_dir = os.path.dirname(os.path.realpath(__file__))
device_targets = ['armv7', 'arm64']
sim_targets = ['i386', 'x86_64']
sim_targets = ['i386', 'x86_64', 'arm64-sim']
cross_targets = ['cross-armv7', 'cross-arm64']
@@ -26,6 +26,7 @@ class iOSTargetTable:
archs = {
'armv7': 'arm',
'arm64': 'arm64',
'arm64-sim': 'arm64',
'i386': 'i386',
'x86_64': 'x86_64'
}
@@ -33,6 +34,7 @@ class iOSTargetTable:
host_triples = {
'armv7': 'arm-apple-darwin11',
'arm64': 'aarch64-apple-darwin11',
'arm64-sim': 'aarch64-apple-darwin11',
'i386': 'i386-apple-darwin11',
'x86_64': 'x86_64-apple-darwin11'
}
@@ -40,6 +42,7 @@ class iOSTargetTable:
osxcross_tool_triples = {
'armv7': 'arm-apple-darwin11', # TODO: ?
'arm64': 'arm-apple-darwin11',
'arm64-sim': 'arm-apple-darwin11',
'i386': 'i386-apple-darwin11', # TODO: ?
'x86_64': 'x86_64-apple-darwin11'
}
@@ -96,6 +99,9 @@ def setup_ios_device_template(env: dict, opts: iOSOpts, target: str):
'ac_cv_func_futimens=no',
'ac_cv_func_utimensat=no',
'ac_cv_func_shm_open_working_with_mmap=no',
'ac_cv_func_pthread_jit_write_protect_np=no',
'ac_cv_func_preadv=no',
'ac_cv_func_pwritev=no',
'mono_cv_sizeof_sunpath=104',
'mono_cv_uscore=yes'
]
@@ -121,13 +127,7 @@ def setup_ios_device_template(env: dict, opts: iOSOpts, target: str):
'-DSMALL_CONFIG', '-D_XOPEN_SOURCE', '-DHOST_IOS', '-DHAVE_LARGE_FILE_SUPPORT=1'
]
LDFLAGS = []
# https://github.com/mono/mono/issues/19393
if os.environ.get('DISABLE_NO_WEAK_IMPORTS', '0') != '1':
LDFLAGS += ['-Wl,-no_weak_imports']
LDFLAGS += [
LDFLAGS = [
'-arch %s' % arch,
'-framework', 'CoreFoundation',
'-lobjc', '-lc++'
@@ -188,7 +188,7 @@ def setup_ios_simulator_template(env: dict, opts: iOSOpts, target: str):
if not ios_sysroot_path:
raise RuntimeError('Cannot find iOS SDK; specify one manually with \'--ios-sdk\'.')
sysroot_flags = ['-isysroot', ios_sysroot_path, '-miphoneos-version-min=%s' % opts.ios_version_min]
sysroot_flags = ['-isysroot', ios_sysroot_path, '-mios-simulator-version-min=%s' % opts.ios_version_min]
arch = iOSTargetTable.archs[target]
host_triple = iOSTargetTable.host_triples[target]
@@ -225,6 +225,9 @@ def setup_ios_simulator_template(env: dict, opts: iOSOpts, target: str):
'ac_cv_func_futimens=no',
'ac_cv_func_utimensat=no',
'ac_cv_func_shm_open_working_with_mmap=no',
'ac_cv_func_pthread_jit_write_protect_np=no',
'ac_cv_func_preadv=no',
'ac_cv_func_pwritev=no',
'mono_cv_uscore=yes'
]
@@ -306,8 +309,11 @@ class iOSCrossTable:
}
def setup_ios_cross_template(env: dict, opts: iOSOpts, target: str, host_arch: str):
def llvm_for(host_arch: str) -> str:
return 'llvmarm64' if host_arch == 'arm64' else 'llvm64'
def setup_ios_cross_template(env: dict, opts: iOSOpts, target: str, host_arch: str):
target_triple = iOSCrossTable.target_triples[target]
device_target = iOSCrossTable.device_targets[target]
offsets_dumper_abi = iOSCrossTable.offsets_dumper_abis[target]
@@ -411,7 +417,7 @@ def setup_ios_cross_template(env: dict, opts: iOSOpts, target: str, host_arch: s
env['_ios-%s_CONFIGURE_FLAGS' % target] = CONFIGURE_FLAGS
# Runtime cross template
runtime.setup_runtime_cross_template(env, opts, 'ios', target, host_triple, target_triple, device_target, 'llvm64', offsets_dumper_abi)
runtime.setup_runtime_cross_template(env, opts, 'ios', target, host_triple, target_triple, device_target, llvm_for(host_arch), offsets_dumper_abi)
def strip_libs(opts: iOSOpts, product: str, target: str):
@@ -427,8 +433,11 @@ def configure(opts: iOSOpts, product: str, target: str):
if is_cross(target):
import llvm
llvm.make(opts, 'llvm64')
setup_ios_cross_template(env, opts, target, host_arch='x86_64')
host_arch='x86_64'
llvm.make(opts, llvm_for(host_arch))
setup_ios_cross_template(env, opts, target, host_arch)
else:
if is_sim:
setup_ios_simulator_template(env, opts, target)

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python3
from desktop import run_main

10
llvm.py
View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python3
import os
import sys
@@ -11,7 +11,7 @@ from os_utils import *
# TODO: OSXCROSS
target_values = ['llvm32', 'llvm64', 'llvmwin32', 'llvmwin64']
target_values = ['llvm32', 'llvm64', 'llvmarm64', 'llvmwin32', 'llvmwin64']
mxe_targets = {
'llvmwin32': {'arch': 'i686', 'mxe': 'mxe-Win32'},
'llvmwin64': {'arch': 'x86_64', 'mxe': 'mxe-Win64'}
@@ -38,8 +38,8 @@ def make(opts: BaseOpts, target: str):
CMAKE_ARGS += [
'-DCMAKE_EXE_LINKER_FLAGS="-static"',
'-DCROSS_TOOLCHAIN_FLAGS_NATIVE=-DCMAKE_TOOLCHAIN_FILE=%s/external/llvm/cmake/modules/NATIVE.cmake' % opts.mono_source_root,
'-DCMAKE_TOOLCHAIN_FILE=%s/external/llvm/cmake/modules/%s.cmake' % (opts.mono_source_root, mxe),
'-DCROSS_TOOLCHAIN_FLAGS_NATIVE=-DCMAKE_TOOLCHAIN_FILE=%s/external/llvm-project/llvm/cmake/modules/NATIVE.cmake' % opts.mono_source_root,
'-DCMAKE_TOOLCHAIN_FILE=%s/external/llvm-project/llvm/cmake/modules/%s.cmake' % (opts.mono_source_root, mxe),
'-DLLVM_ENABLE_THREADS=Off',
'-DLLVM_BUILD_EXECUTION_ENGINE=Off'
]
@@ -58,7 +58,7 @@ def make(opts: BaseOpts, target: str):
replace_in_new_file(
src_file='%s/sdks/builds/%s.cmake.in' % (opts.mono_source_root, mxe),
search='@MXE_PATH@', replace=opts.mxe_prefix,
dst_file='%s/external/llvm/cmake/modules/%s.cmake' % (opts.mono_source_root, mxe)
dst_file='%s/external/llvm-project/llvm/cmake/modules/%s.cmake' % (opts.mono_source_root, mxe)
)
if target in ['llvm32', 'llvmwin32']:

61
msbuild_helper.py Normal file
View File

@@ -0,0 +1,61 @@
import os
from os_utils import *
def find_dotnet_cli():
import os.path
for hint_dir in os.environ["PATH"].split(os.pathsep):
hint_dir = hint_dir.strip('"')
hint_path = os.path.join(hint_dir, "dotnet")
if os.path.isfile(hint_path) and os.access(hint_path, os.X_OK):
return hint_path
def find_msbuild():
import os.path
import sys
hint_dirs = []
if sys.platform == "darwin":
hint_dirs[:0] = [
"/Library/Frameworks/Mono.framework/Versions/Current/bin",
"/usr/local/var/homebrew/linked/mono/bin",
]
for hint_dir in hint_dirs:
hint_path = os.path.join(hint_dir, "msbuild")
if os.path.isfile(hint_path):
return hint_path
for hint_dir in os.environ["PATH"].split(os.pathsep):
hint_dir = hint_dir.strip('"')
hint_path = os.path.join(hint_dir, "msbuild")
if os.path.isfile(hint_path) and os.access(hint_path, os.X_OK):
return hint_path
return None
def build_solution(solution_path, build_config, extra_msbuild_args=[]):
msbuild_args = []
dotnet_cli = find_dotnet_cli()
if dotnet_cli:
msbuild_path = dotnet_cli
msbuild_args += ["msbuild"] # `dotnet msbuild` command
else:
msbuild_path = find_msbuild()
if msbuild_path is None:
raise BuildError("Cannot find MSBuild executable")
print("MSBuild path: " + msbuild_path)
# Build solution
msbuild_args += [solution_path, "/restore", "/t:Build", "/p:Configuration=" + build_config]
msbuild_args += extra_msbuild_args
run_command(msbuild_path, msbuild_args, name="msbuild")

View File

@@ -23,9 +23,8 @@ class RuntimeOpts(BaseOpts):
@dataclass
class AndroidOpts(RuntimeOpts):
android_toolchains_prefix: str
android_sdk_root: str
android_ndk_root: str
android_ndk_version: str
android_api_version: str
android_cmake_version: str
toolchain_name_fmt: str = '%s-api%s-clang'
@@ -80,9 +79,8 @@ def runtime_opts_from_args(args):
def android_opts_from_args(args):
return AndroidOpts(
**vars(runtime_opts_from_args(args)),
android_toolchains_prefix = abspath(args.toolchains_prefix),
android_sdk_root = abspath(args.android_sdk),
android_ndk_root = abspath(args.android_ndk),
android_ndk_version = args.android_ndk_version,
android_api_version = args.android_api_version,
android_cmake_version = args.android_cmake_version
)

2
osx.py
View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python3
from desktop import run_main

View File

@@ -1,5 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python3
def main(raw_args):
import os
@@ -24,7 +23,6 @@ def main(raw_args):
patches = [
'%s/sdks/builds/fix-emscripten-8511.diff' % mono_source_root,
'%s/sdks/builds/emscripten-pr-8457.diff' % mono_source_root
]
from subprocess import Popen

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python3
def main(raw_args):
@@ -27,9 +27,14 @@ def main(raw_args):
patches = [
'fix-mono-android-tkill.diff',
'fix-mono-log-spam.diff',
'mono-dbg-agent-clear-tls-instead-of-abort.diff',
'bcl-profile-platform-override.diff',
'mono_ios_asl_log_deprecated.diff'
'mono_ios_asl_log_deprecated.diff',
'wasm_m2n_trampolines_hook.diff',
'btls-cmake-args-linux-mingw.diff',
'btls-cmake-arm64.diff',
'mono-linux-disable-mmap-MAP_32BIT.diff',
]
if os.path.isfile(os.path.join(mono_source_root, 'mono/tools/offsets-tool/offsets-tool.py')):

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python3
import sys

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python3
import os
import os.path

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python3
from desktop import run_main