From b2a11ac756f940c30b05aa0a8baf733572df4ce5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexander=20K=C3=B6plinger?= Date: Thu, 5 Oct 2017 02:37:24 +0200 Subject: [PATCH] Add new profile for monodroid tools (#5699) * Add new profile for monodroid tools This allows the XA build to use these instead of needing to build net_4_x. We build the assemblies against the .NET 4.6 reference assemblies. * Skip monodroid_tools in verify (aka mcs-compileall) Exclude it from the test_profiles since running tests makes no sense there. Also refactor to exclude binary_reference_assemblies as well, it was already excluded manually in mcs-compileall before. --- mcs/Makefile | 2 ++ mcs/build/executable.make | 10 +++++++++- mcs/build/library.make | 17 +++++++++++++++-- mcs/build/profiles/monodroid_tools.make | 18 ++++++++++++++++++ mcs/build/rules.make | 1 + mcs/class/Makefile | 8 +++++++- mcs/tools/Makefile | 1 + runtime/Makefile.am | 9 +++------ 8 files changed, 56 insertions(+), 10 deletions(-) create mode 100644 mcs/build/profiles/monodroid_tools.make diff --git a/mcs/Makefile b/mcs/Makefile index ea121b9459e..3b4fb20c46c 100644 --- a/mcs/Makefile +++ b/mcs/Makefile @@ -7,6 +7,7 @@ SUBDIRS := build jay mcs class nunit24 ilasm tools tests errors docs packages basic_SUBDIRS := build jay class build_SUBDIRS := build class class/aot-compiler tools ilasm monodroid_SUBDIRS := build class +monodroid_tools_SUBDIRS := build class tools monotouch_SUBDIRS := build class monotouch_watch_SUBDIRS := build class monotouch_tv_SUBDIRS := build class @@ -66,6 +67,7 @@ $(_boot_:%=profile-do--xbuild_12--%): profile-do--xbuild_12--%: $(_boot_:%=profile-do--binary_reference_assemblies--%): profile-do--binary_reference_assemblies--%: profile-do--build--% $(_boot_:%=profile-do--net_4_x--%): profile-do--net_4_x--%: profile-do--build--% $(_boot_:%=profile-do--monodroid--%): profile-do--monodroid--%: profile-do--build--% +$(_boot_:%=profile-do--monodroid_tools--%): profile-do--monodroid_tools--%: profile-do--build--% $(_boot_:%=profile-do--monotouch--%): profile-do--monotouch--%: profile-do--build--% $(_boot_:%=profile-do--monotouch_watch--%): profile-do--monotouch_watch--%: profile-do--build--% $(_boot_:%=profile-do--monotouch_tv--%): profile-do--monotouch_tv--%: profile-do--build--% diff --git a/mcs/build/executable.make b/mcs/build/executable.make index 020609b26a4..7ac941ca839 100644 --- a/mcs/build/executable.make +++ b/mcs/build/executable.make @@ -42,8 +42,16 @@ executable_CLEAN_FILES += $(build_lib) $(build_lib).so $(build_lib).mdb $(build_ makefrag = $(depsdir)/$(PROFILE)_$(base_prog).makefrag +ifdef TARGET_NET_REFERENCE +# System.*.dll references come from the TARGET_NET_REFERENCE dir, others from the profile dir +LIB_REFS_MONO = $(call _FILTER_OUT,System,$(LIB_REFS)) +LIB_REFS_SYSTEM = $(filter-out $(LIB_REFS_MONO),$(LIB_REFS)) + +MCS_REFERENCES = $(patsubst %,-r:$(topdir)/../external/binary-reference-assemblies/$(TARGET_NET_REFERENCE)/%.dll,$(LIB_REFS_SYSTEM)) +MCS_REFERENCES += $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE_DIRECTORY)/%.dll,$(LIB_REFS_MONO)) +else MCS_REFERENCES = $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE_DIRECTORY)/%.dll,$(LIB_REFS)) -MCS_REFERENCES += $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE_DIRECTORY)/%.exe,$(EXE_REFS)) +endif ifdef KEYFILE LIB_MCS_FLAGS += /keyfile:$(KEYFILE) diff --git a/mcs/build/library.make b/mcs/build/library.make index 3fe7d922338..76a49a7220b 100644 --- a/mcs/build/library.make +++ b/mcs/build/library.make @@ -18,13 +18,26 @@ # Have to rename to handle differences between assembly/directory names DEP_LIBS=$(patsubst System.Xml,System.XML,$(LIB_REFS)) -_FILTER_OUT = $(foreach x,$(2),$(if $(findstring $(1),$(x)),,$(x))) - LIB_REFS_FULL = $(call _FILTER_OUT,=, $(LIB_REFS)) LIB_REFS_ALIAS = $(filter-out $(LIB_REFS_FULL),$(LIB_REFS)) +ifdef TARGET_NET_REFERENCE +# System.*.dll references come from the TARGET_NET_REFERENCE dir, others from the profile dir +LIB_REFS_MONO_FULL = $(call _FILTER_OUT,System,$(LIB_REFS_FULL)) +LIB_REFS_MONO_ALIAS = $(call _FILTER_OUT,System,$(LIB_REFS_ALIAS)) + +LIB_REFS_SYSTEM_FULL = $(filter-out $(LIB_REFS_MONO_FULL),$(LIB_REFS_FULL)) +LIB_REFS_SYSTEM_ALIAS = $(filter-out $(LIB_REFS_MONO_ALIAS),$(LIB_REFS_ALIAS)) + +LIB_MCS_FLAGS += $(patsubst %,-r:$(topdir)/../external/binary-reference-assemblies/$(TARGET_NET_REFERENCE)/%.dll,$(LIB_REFS_SYSTEM_FULL)) +LIB_MCS_FLAGS += $(patsubst %,-r:%.dll, $(subst =,=$(topdir)/../external/binary-reference-assemblies/$(TARGET_NET_REFERENCE)/,$(LIB_REFS_SYSTEM_ALIAS))) + +LIB_MCS_FLAGS += $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE_DIRECTORY)/%.dll,$(LIB_REFS_MONO_FULL)) +LIB_MCS_FLAGS += $(patsubst %,-r:%.dll, $(subst =,=$(topdir)/class/lib/$(PROFILE_DIRECTORY)/,$(LIB_REFS_MONO_ALIAS))) +else LIB_MCS_FLAGS += $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE_DIRECTORY)/%.dll,$(LIB_REFS_FULL)) LIB_MCS_FLAGS += $(patsubst %,-r:%.dll, $(subst =,=$(topdir)/class/lib/$(PROFILE_DIRECTORY)/,$(LIB_REFS_ALIAS))) +endif ifdef KEYFILE KEYFILE_MCS_FLAGS += /keyfile:$(KEYFILE) diff --git a/mcs/build/profiles/monodroid_tools.make b/mcs/build/profiles/monodroid_tools.make new file mode 100644 index 00000000000..27cb67b9ffa --- /dev/null +++ b/mcs/build/profiles/monodroid_tools.make @@ -0,0 +1,18 @@ +# -*- makefile -*- + +BOOTSTRAP_PROFILE = build + +BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_CSC) +MCS = $(BOOTSTRAP_MCS) + +profile-check: + @: + +TARGET_NET_REFERENCE = v4.6 +DEFAULT_REFERENCES = -r:$(topdir)/../external/binary-reference-assemblies/$(TARGET_NET_REFERENCE)/mscorlib.dll + +PROFILE_MCS_FLAGS = -d:NET_4_6 -d:MONO -d:WIN_PLATFORM -nowarn:1699 -nostdlib $(DEFAULT_REFERENCES) $(PLATFORM_DEBUG_FLAGS) + +FRAMEWORK_VERSION = 4.5 + +NO_INSTALL = yes diff --git a/mcs/build/rules.make b/mcs/build/rules.make index 7e1ee2124c1..349599433af 100644 --- a/mcs/build/rules.make +++ b/mcs/build/rules.make @@ -9,6 +9,7 @@ empty := space := $(empty) $(empty) +_FILTER_OUT = $(foreach x,$(2),$(if $(findstring $(1),$(x)),,$(x))) # given $(thisdir), we compute the path to the top directory # diff --git a/mcs/class/Makefile b/mcs/class/Makefile index 1f390d66641..7d9329e02da 100644 --- a/mcs/class/Makefile +++ b/mcs/class/Makefile @@ -106,6 +106,11 @@ monodroid_dirs := \ Mono.Posix \ $(pcl_facade_dirs) +monodroid_tools_dirs := \ + Mono.Cecil \ + ICSharpCode.SharpZipLib \ + monodoc + monotouch_dirs := \ $(mobile_common_dirs) \ Mono.Simd \ @@ -341,6 +346,7 @@ orbis_dirs := \ $(pcl_facade_dirs) monodroid_SUBDIRS := $(monodroid_dirs) +monodroid_tools_SUBDIRS := $(monodroid_tools_dirs) monotouch_SUBDIRS := $(monotouch_dirs) monotouch_watch_SUBDIRS := $(monotouch_watch_dirs) monotouch_tv_SUBDIRS := $(monotouch_tv_dirs) @@ -362,7 +368,7 @@ unreal_SUBDIRS := $(unreal_dirs) include ../build/rules.make -SUBDIRS = $(testing_aot_full_dirs) $(testing_aot_hybrid_dirs) $(monotouch_dirs) $(monodroid_dirs) $(xammac_dirs) $(net_4_x_dirs) $(net_4_x_parallel_dirs) $(xammac_net_4_5_SUBDIRS) $(unreal_dirs) +SUBDIRS = $(testing_aot_full_dirs) $(testing_aot_hybrid_dirs) $(monotouch_dirs) $(monodroid_dirs) $(monodroid_tools_dirs) $(xammac_dirs) $(net_4_x_dirs) $(net_4_x_parallel_dirs) $(xammac_net_4_5_SUBDIRS) $(unreal_dirs) DIST_ONLY_SUBDIRS = dlr aot-compiler reference-assemblies $(xbuild_4_0_dirs) Microsoft.NuGet.Build.Tasks diff --git a/mcs/tools/Makefile b/mcs/tools/Makefile index ec1f2bd2d51..09db25649e7 100644 --- a/mcs/tools/Makefile +++ b/mcs/tools/Makefile @@ -50,6 +50,7 @@ net_4_5_dirs := \ linker-analyzer build_SUBDIRS = resgen gacutil security culevel cil-stringreplacer commoncryptogenerator resx2sr linker +monodroid_tools_SUBDIRS = cil-strip mkbundle mdoc mono-symbolicate net_4_5_SUBDIRS = gacutil net_4_x_SUBDIRS = gacutil net_4_5_PARALLEL_SUBDIRS = $(net_4_5_dirs) diff --git a/runtime/Makefile.am b/runtime/Makefile.am index 326158c3af8..2cd119314fe 100644 --- a/runtime/Makefile.am +++ b/runtime/Makefile.am @@ -33,7 +33,7 @@ net_profile = net_4_x endif if INSTALL_MONODROID -build_profiles += monodroid +build_profiles += monodroid monodroid_tools endif if INSTALL_MONOTOUCH @@ -72,7 +72,7 @@ if INSTALL_UNREAL build_profiles += unreal endif -test_profiles = $(build_profiles) +test_profiles = $(filter-out binary_reference_assemblies monodroid_tools,$(build_profiles)) if BUILD_MCS @@ -142,13 +142,10 @@ endif # Compile all assemblies with the verifier turned on. Code must be valid but not verifiable. # TODO it would be nice to split assemblies without unsafe code to use the verifier with verifiable mode. -# Skip binary_reference_assemblies because they contain metadata only mcs-compileall: mono-wrapper etc/mono/config save_MONO_PATH=$$MONO_PATH; mcs_topdir=`cd $(mcs_topdir) && $(cur_dir_cmd)`; ok=:; \ for profile in $(test_profiles); do \ - if [ "binary_reference_assemblies" = "$$profile" ]; then \ - continue; \ - elif [ "xbuild_12" = "$$profile" ]; then \ + if [ "xbuild_12" = "$$profile" ]; then \ MONO_PATH="$$mcs_topdir/class/lib/$$profile$(PLATFORM_PATH_SEPARATOR)$$mcs_topdir/class/lib/net_4_x$(PLATFORM_PATH_SEPARATOR)$$save_MONO_PATH"; \ elif [ "xbuild_14" = "$$profile" ]; then \ MONO_PATH="$$mcs_topdir/class/lib/$$profile$(PLATFORM_PATH_SEPARATOR)$$mcs_topdir/class/lib/net_4_x$(PLATFORM_PATH_SEPARATOR)$$save_MONO_PATH"; \ -- 2.25.1