Make it a little easier to get a successful working build

This commit is contained in:
Tom Daffin 2020-09-18 12:49:52 -06:00
parent 331653f9c3
commit d2f48f2b45
3 changed files with 37 additions and 4 deletions

View File

@ -30,6 +30,19 @@ export MONO_SOURCE_ROOT=$HOME/git/mono
- OSXCROSS is supported expect 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` and `mono_static=yes`
e.g.
`scons -j6 target=release_debug tools=yes module_mono_enabled=yes copy_mono_root=yes mono_static=yes mono_prefix="$HOME/mono-installs/desktop-linux-x86_64-release"`
## Desktop
```bash

19
bcl.py
View File

@ -27,6 +27,19 @@ test_profiles_table = {
'wasm': ['wasm']
}
def get_install_dir(opts: BaseOpts, product: str):
return path_join(opts.install_dir, '%s-bcl' % product)
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):
stamp_file = path_join(opts.configure_dir, '.stamp-bcl-configure')
@ -92,7 +105,7 @@ def make_product(opts: BclOpts, product: str):
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 +126,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
@ -149,7 +162,7 @@ def make_product(opts: BclOpts, product: str):
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

@ -198,6 +198,12 @@ 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'):
copy_tree(src_dir, dest_dir)
def clean(opts: DesktopOpts, product: str, target_platform: str, target: str):
rm_rf(
@ -215,13 +221,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)