From 2f0a47c7ed9ab6d2de968f4b93fa6d6a62af3de8 Mon Sep 17 00:00:00 2001 From: Ignacio Etcheverry Date: Wed, 29 Jan 2020 12:27:35 +0100 Subject: [PATCH] BCL: Fix net_4_x build for Windows --- README.md | 3 +++ bcl.py | 11 +++++++++-- files/patches/bcl-profile-platform-override.diff | 13 +++++++++++++ patch_mono.py | 3 ++- 4 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 files/patches/bcl-profile-platform-override.diff diff --git a/README.md b/README.md index e1bc4a5..99e02d7 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,9 @@ _AOT cross-compilers for WebAssembly cannot be built with this script yet._ # Build the Desktop BCL. ./bcl.py make --product=desktop +# Build the Desktop BCL for Windows. +./bcl.py make --product=desktop-win32 + # Build the Android BCL. ./bcl.py make --product=android diff --git a/bcl.py b/bcl.py index 4f06fe7..04c280a 100755 --- a/bcl.py +++ b/bcl.py @@ -11,14 +11,16 @@ from options import * from os_utils import * -product_values = ['desktop', 'android', 'wasm'] +product_values = ['desktop', 'desktop-win32', 'android', 'wasm'] profiles_table = { 'desktop': ['net_4_x'], + 'desktop-win32': ['net_4_x'], 'android': ['monodroid', 'monodroid_tools'], 'wasm': ['wasm', 'wasm_tools'] } test_profiles_table = { 'desktop': [], + 'desktop-win32': [], 'android': ['monodroid', 'monodroid_tools'], 'wasm': ['wasm'] } @@ -97,6 +99,10 @@ def make_product(opts: BclOpts, product: str): make_args = ['-C', build_dir, '-C', 'runtime', 'all-mcs', 'build_profiles=%s' % ' '.join(profiles)] make_args += ['V=1'] if opts.verbose_make else [] + + if product == 'desktop-win32': + make_args += ['PROFILE_PLATFORM=win32'] # Requires patch: 'bcl-profile-platform-override.diff' + run_command('make', args=make_args, name='make profiles') if opts.tests and len(test_profiles) > 0: @@ -107,7 +113,8 @@ 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: - copy_tree('%s/mcs/class/lib/%s' % (opts.mono_source_root, profile), '%s/%s' % (install_dir, profile)) + profile_dir = profile + '-win32' if product == 'desktop-win32' else profile + copy_tree('%s/mcs/class/lib/%s' % (opts.mono_source_root, profile_dir), '%s/%s' % (install_dir, profile_dir)) # Remove unneeded files import glob diff --git a/files/patches/bcl-profile-platform-override.diff b/files/patches/bcl-profile-platform-override.diff new file mode 100644 index 0000000..6843105 --- /dev/null +++ b/files/patches/bcl-profile-platform-override.diff @@ -0,0 +1,13 @@ +diff --git a/mcs/build/rules.make b/mcs/build/rules.make +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 diff --git a/patch_mono.py b/patch_mono.py index a60551e..c906695 100755 --- a/patch_mono.py +++ b/patch_mono.py @@ -27,7 +27,8 @@ def main(raw_args): patches = [ 'fix-mono-android-tkill.diff', - 'mono-dbg-agent-clear-tls-instead-of-abort.diff' + 'mono-dbg-agent-clear-tls-instead-of-abort.diff', + 'bcl-profile-platform-override.diff' ] from subprocess import Popen