From 80ed9d81bcf66afa2d800bc362e467180dbf246c Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 4 Mar 2021 09:07:44 +0100 Subject: [PATCH] Add configure option to disable building for legacy Xamarin. (#10773) * Add configure option to disable building for legacy Xamarin. This can greatly speed up the debug-edit-build cycle when doing .NET development, since it cuts down the build time in half more or less. * Bump maccore. New commits in xamarin/maccore: * xamarin/maccore@548fa45432 [mlaunch] Disable building mlaunch when not including the legacy Xamarin build. (#2403) Diff: https://github.com/xamarin/maccore/compare/0562e08b127898cd0468742dfbf29a52fd013598..548fa4543223f4d785a26b6bddaa82b85ae6f3d0 --- Make.config | 1 + configure | 11 +++++++++++ mk/xamarin.mk | 2 +- runtime/Makefile | 7 +++++++ src/Makefile | 10 ++++++++++ tools/mlaunch/Makefile | 2 ++ tools/mmp/Makefile | 7 +++++-- tools/mtouch/Makefile | 9 ++++++--- 8 files changed, 43 insertions(+), 6 deletions(-) diff --git a/Make.config b/Make.config index a800d765a4..f48b78627e 100644 --- a/Make.config +++ b/Make.config @@ -205,6 +205,7 @@ INCLUDE_TVOS=1 INCLUDE_MACCATALYST=1 INCLUDE_DEVICE=1 INCLUDE_DOTNET_WATCHOS= +INCLUDE_XAMARIN_LEGACY=1 # disable source code install by default (it's enabled for CI builds) ENABLE_INSTALL_SOURCE= diff --git a/configure b/configure index e920ad9c4c..3af184fb1a 100755 --- a/configure +++ b/configure @@ -41,6 +41,9 @@ Usage: configure [options] --enable-install-source Enable building of API documentation --disable-install-source Disable building of API documentation. + + --enable-legacy-xamarin Enable building the legacy version of Xamarin.iOS/Xamarin.Mac. + --disable-legacy-xamarin Disable building the legacy version of Xamarin.iOS/Xamarin.Mac. EOL } @@ -139,6 +142,14 @@ while test x$1 != x; do echo "ENABLE_INSTALL_SOURCE=" >> "$CONFIGURED_FILE" shift ;; + --enable-legacy-xamarin) + echo "INCLUDE_XAMARIN_LEGACY=1" >> "$CONFIGURED_FILE" + shift + ;; + --disable-legacy-xamarin) + echo "INCLUDE_XAMARIN_LEGACY=" >> "$CONFIGURED_FILE" + shift + ;; --help|-h) show_help exit 0 diff --git a/mk/xamarin.mk b/mk/xamarin.mk index 2e0b2512ae..e52559274c 100644 --- a/mk/xamarin.mk +++ b/mk/xamarin.mk @@ -7,7 +7,7 @@ MONO_BRANCH := $(shell cd $(MONO_PATH) 2> /dev/null && git symbolic-ref --sho endif ifdef ENABLE_XAMARIN -NEEDED_MACCORE_VERSION := 0562e08b127898cd0468742dfbf29a52fd013598 +NEEDED_MACCORE_VERSION := 548fa4543223f4d785a26b6bddaa82b85ae6f3d0 NEEDED_MACCORE_BRANCH := main MACCORE_DIRECTORY := maccore diff --git a/runtime/Makefile b/runtime/Makefile index 64e3cde3ad..b21adb3859 100644 --- a/runtime/Makefile +++ b/runtime/Makefile @@ -205,8 +205,11 @@ $$(RUNTIME_$(2)_TARGETS_DIRS): $(Q) mkdir -p $$@ all-$(2):: $$(RUNTIME_$(2)_TARGETS) + +ifdef INCLUDE_XAMARIN_LEGACY all-local:: $$(RUNTIME_$(2)_TARGETS) install-local:: $$(RUNTIME_$(2)_TARGETS) +endif endef @@ -438,7 +441,9 @@ MAC_LIBS = \ # embedding the Mono runtime). # +ifdef INCLUDE_XAMARIN_LEGACY all-local:: $(TARGETS) +endif define ObjTemplate DYNAMIC_DYLIB$(2)_OBJECTS = $$(foreach src,$$(MAC_SOURCES),.libs/mac/$$(basename $$(src))$(3).dylib.$(1).o) @@ -547,8 +552,10 @@ $(MAC_DESTDIR)$(XAMARIN_MACOS_SDK)/include/%.h: %.h | $(MAC_DESTDIR)$(XAMARIN_MA $(RUNTIME_MAC_TARGETS_DIRS): $(Q) mkdir -p $@ +ifdef INCLUDE_XAMARIN_LEGACY all-local:: $(RUNTIME_MAC_TARGETS) install-local:: $(RUNTIME_MAC_TARGETS) +endif # # .NET diff --git a/src/Makefile b/src/Makefile index 3e756ed586..6e0b0f1d57 100644 --- a/src/Makefile +++ b/src/Makefile @@ -406,10 +406,12 @@ PROJECT_FILES += $(PROJECT_DIR)/xamios.csproj $(PROJECT_DIR)/MonoTouch.NUnitLite all-ios: $(IOS_TARGETS) install-ios: $(IOS_TARGETS) +ifdef INCLUDE_XAMARIN_LEGACY ifdef INCLUDE_IOS INSTALL_TARGETS+=install-ios ALL_TARGETS+=all-ios endif +endif # # Xamarin.Mac @@ -624,8 +626,10 @@ MAC_VARIANTS_TARGETS = \ $(MAC_BUILD_DIR)/mobile-reference/Xamarin.Mac.dll \ $(MAC_BUILD_DIR)/full-reference/Xamarin.Mac.dll \ +ifdef INCLUDE_XAMARIN_LEGACY INSTALL_TARGETS+=install-mac ALL_TARGETS+=all-mac +endif MAC_TARGETS_DIRS += \ $(MAC_BUILD_DIR) \ @@ -987,10 +991,12 @@ $(WATCH_TARGETS_DIRS): all-watch: $(WATCH_TARGETS) install-watch: $(WATCH_TARGETS) +ifdef INCLUDE_XAMARIN_LEGACY ifdef INCLUDE_WATCH ALL_TARGETS += all-watch INSTALL_TARGETS += install-watch endif +endif # # Xamarin.TVOS @@ -1468,10 +1474,12 @@ $(MACCATALYST_TARGETS_DIRS): all-maccatalyst: $(MACCATALYST_TARGETS) install-maccatalyst: $(MACCATALYST_TARGETS) +ifdef INCLUDE_XAMARIN_LEGACY ifdef INCLUDE_MACCATALYST ALL_TARGETS += all-maccatalyst INSTALL_TARGETS += install-maccatalyst endif +endif ### .NET ### @@ -1522,10 +1530,12 @@ $(TVOS_TARGETS_DIRS): all-tvos: $(TVOS_TARGETS) install-tvos: $(TVOS_TARGETS) +ifdef INCLUDE_XAMARIN_LEGACY ifdef INCLUDE_TVOS ALL_TARGETS += all-tvos INSTALL_TARGETS += install-tvos endif +endif # # Global targets diff --git a/tools/mlaunch/Makefile b/tools/mlaunch/Makefile index 63944f9bea..09307eb4f7 100644 --- a/tools/mlaunch/Makefile +++ b/tools/mlaunch/Makefile @@ -5,11 +5,13 @@ include $(TOP)/Make.config COLOR_GREEN:=$(shell tput setaf 120 2>/dev/null) COLOR_CLEAR:=$(shell tput sgr0 2>/dev/null) +ifdef INCLUDE_XAMARIN_LEGACY ifdef ENABLE_XAMARIN ifdef INCLUDE_MAC ENABLE_MLAUNCH=1 endif endif +endif DOTNET_PLATFORMS_MOBILE=$(filter-out macOS,$(DOTNET_PLATFORMS)) diff --git a/tools/mmp/Makefile b/tools/mmp/Makefile index 8810bfe257..fb4930ac5e 100644 --- a/tools/mmp/Makefile +++ b/tools/mmp/Makefile @@ -71,20 +71,23 @@ Xamarin.Mac.registrar.full.x86_64.m: $(TOP)/src/build/mac/full-64/Xamarin.Mac. $(Q) touch Xamarin.Mac.registrar.full.x86_64.m Xamarin.Mac.registrar.full.x86_64.h %.x86_64.a: %.x86_64.m - $(Q_CC) $(MAC_CC) -DDEBUG -g -gdwarf-2 -x objective-c++ -std=c++14 -o $@ -c -arch x86_64 $< -Wall -Wno-unguarded-availability-new -I$(MAC_DESTDIR)$(XAMARIN_MACOS_SDK)/include -mmacosx-version-min=$(MIN_OSX_SDK_VERSION) -fobjc-runtime=macosx + $(Q_CC) $(MAC_CC) -DDEBUG -g -gdwarf-2 -x objective-c++ -std=c++14 -o $@ -c -arch x86_64 $< -Wall -Wno-unguarded-availability-new -I$(TOP)/runtime -mmacosx-version-min=$(MIN_OSX_SDK_VERSION) -fobjc-runtime=macosx Xamarin.Mac.registrar.%.a: Xamarin.Mac.registrar.%.x86_64.a $(Q) $(CP) $< $@ dotnet: $(MMP_TARGETS_DOTNET) ifdef ENABLE_DOTNET -MMP_TARGETS += $(MMP_TARGETS_DOTNET) +install-local:: $(MMP_TARGETS_DOTNET) +all-local:: $(MMP_TARGETS_DOTNET) endif +ifdef INCLUDE_XAMARIN_LEGACY ifdef INCLUDE_MAC install-local:: $(MMP_TARGETS) all-local:: $(MMP_TARGETS) endif +endif clean-local:: rm -f mmp.stub.c mmp.helper.o diff --git a/tools/mtouch/Makefile b/tools/mtouch/Makefile index 2f0606255c..ddc5e0661f 100644 --- a/tools/mtouch/Makefile +++ b/tools/mtouch/Makefile @@ -232,10 +232,10 @@ define RunRegistrar $$(Q) touch $$(basename $$@).m $$(basename $$@).h %.registrar.$(1).$(2).a: %.registrar.$(1).$(2).m %.registrar.$(1).$(2).h - $$(Q_CC) $$(IOS_CC) -DDEBUG -g -gdwarf-2 $(6) -stdlib=libc++ -std=c++14 -x objective-c++ -o $$@ -c $$< -Wall -Wno-unguarded-availability-new -I$(7) + $$(Q_CC) $$(IOS_CC) -DDEBUG -g -gdwarf-2 $(6) -stdlib=libc++ -std=c++14 -x objective-c++ -o $$@ -c $$< -Wall -Wno-unguarded-availability-new -I$(7) -I$(TOP)/runtime .libs/Microsoft.$(9).registrar.$(10).a: .libs/Microsoft.$(9).registrar.$(10).m .libs/Microsoft.$(9).registrar.$(10).h | .libs - $$(Q_CC) $$(IOS_CC) -DDEBUG -g -gdwarf-2 $(6) -stdlib=libc++ -std=c++14 -x objective-c++ -o $$@ -c $$< -Wall -Wno-unguarded-availability-new -I$(7) + $$(Q_CC) $$(IOS_CC) -DDEBUG -g -gdwarf-2 $(6) -stdlib=libc++ -std=c++14 -x objective-c++ -o $$@ -c $$< -Wall -Wno-unguarded-availability-new -I$(7) -I$(TOP)/runtime # make will automatically consider files created in chained implicit rules as temporary files, and delete them afterwards # marking those files as .SECONDARY will prevent that deletion. @@ -377,13 +377,16 @@ $(foreach platform,$(DOTNET_PLATFORMS_MTOUCH),$(foreach rid,$(DOTNET_$(platform) dotnet: $(TARGETS_DOTNET) ifdef ENABLE_DOTNET -TARGETS += $(TARGETS_DOTNET) +install-local:: $(TARGETS_DOTNET) +all-local:: $(TARGETS_DOTNET) endif +ifdef INCLUDE_XAMARIN_LEGACY ifdef INCLUDE_IOS install-local:: $(TARGETS) all-local:: $(TARGETS) endif +endif install-mtouch: \ $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/bin/mtouch \