From 9ea0738c48de818aaf54c94390656a009400f19e Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 21 Apr 2016 13:18:44 +0200 Subject: [PATCH] Add our mono runtimes to the build. --- .gitignore | 2 + .gitmodules | 8 + Make.config | 5 + Makefile | 2 +- builds/.gitignore | 21 + builds/Makefile | 2029 ++++++++++++++++++++++ builds/Mono.framework-Info.plist | 58 + builds/Mono.framework-tvos.Info.plist | 56 + builds/Mono.framework-watchos.Info.plist | 56 + builds/mac-System.config | 3 + builds/mono-wrapper.in | 7 + builds/wrap-autogen.sh | 33 + builds/wrap-configure.sh | 45 + external/llvm | 1 + external/mono | 1 + mk/versions.mk | 13 + mono/4.5/machine.config | 17 + product.snk | Bin 0 -> 596 bytes 18 files changed, 2356 insertions(+), 1 deletion(-) create mode 100644 .gitmodules create mode 100644 builds/.gitignore create mode 100644 builds/Makefile create mode 100644 builds/Mono.framework-Info.plist create mode 100644 builds/Mono.framework-tvos.Info.plist create mode 100644 builds/Mono.framework-watchos.Info.plist create mode 100644 builds/mac-System.config create mode 100644 builds/mono-wrapper.in create mode 100755 builds/wrap-autogen.sh create mode 100755 builds/wrap-configure.sh create mode 160000 external/llvm create mode 160000 external/mono create mode 100644 mono/4.5/machine.config create mode 100644 product.snk diff --git a/.gitignore b/.gitignore index 32a3a0ed81..3f975d134c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ Make.config.local Make.config.inc +_ios-build +_mac-build diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..d3c69e48dc --- /dev/null +++ b/.gitmodules @@ -0,0 +1,8 @@ +[submodule "external/llvm"] + path = external/llvm + url = git://github.com/mono/llvm.git + branch = master +[submodule "external/mono"] + path = external/mono + url = git://github.com/mono/mono.git + branch = mono-4.5.0-branch diff --git a/Make.config b/Make.config index 3a3553e542..e16162d1f7 100644 --- a/Make.config +++ b/Make.config @@ -209,6 +209,11 @@ DEVICETV_SDK = $(XCODE_DEVELOPER_ROOT)/Platforms/AppleTVOS.platfor DEVICETV_CFLAGS = -arch arm64 -mtvos-version-min=$(MIN_TVOS_SDK_VERSION) -isysroot $(DEVICETV_SDK) $(CFLAGS) -fembed-bitcode $(IOS_COMMON_DEFINES) DEVICETV_OBJC_CFLAGS = $(DEVICETV_CFLAGS) $(DEVICE_OBJC_CFLAGS) +# paths to the modules we depend on, as variables, so people can put +# things in other places if they absolutely must. +MONO_PATH=$(TOP)/external/mono +LLVM_PATH=$(TOP)/external/llvm + MONO_PREFIX ?= /Library/Frameworks/Mono.framework/Versions/Current SYSTEM_MCS=$(MONO_PREFIX)/bin/mcs SYSTEM_SN=$(MONO_PREFIX)/bin/sn diff --git a/Makefile b/Makefile index 1800aaf674..803b280848 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ TOP=. -SUBDIRS= +SUBDIRS=builds include $(TOP)/Make.config include $(TOP)/mk/versions.mk diff --git a/builds/.gitignore b/builds/.gitignore new file mode 100644 index 0000000000..c9c2fd1238 --- /dev/null +++ b/builds/.gitignore @@ -0,0 +1,21 @@ +.stamp* +*.config.cache +install +mac32 +mac64 +llvm +llvm64 +simulator86 +simulator64 +watchsimulator +tvsimulator +tools64 +cross +cross64 +crosstv +cross-watch +target7 +target7s +target64 +targettv +targetwatch diff --git a/builds/Makefile b/builds/Makefile new file mode 100644 index 0000000000..3575db6774 --- /dev/null +++ b/builds/Makefile @@ -0,0 +1,2029 @@ +TOP=.. +include $(TOP)/Make.config + +PREFIX=$(abspath $(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/) + +IPHONESIMULATOR_SDK=$(MONOTOUCH_PREFIX)/SDKs/MonoTouch.iphonesimulator.sdk +IPHONESIMULATOR_PREFIX=$(MONOTOUCH_PREFIX)/SDKs/MonoTouch.iphonesimulator.sdk/usr +IPHONEOS_SDK=$(MONOTOUCH_PREFIX)/SDKs/MonoTouch.iphoneos.sdk +IPHONEOS_PREFIX=$(MONOTOUCH_PREFIX)/SDKs/MonoTouch.iphoneos.sdk/usr + +ifdef ENABLE_XAMARIN +XAMARIN_AUTOGEN_FLAGS=--enable-extension-module=xamarin +XAMARIN_CONFIGURE_FLAGS=--enable-extension-module=xamarin +endif + +ifndef DISABLE_STRIP +INSTALL_STRIP_FLAG=-s +endif + +BITCODE_CFLAGS=-fexceptions +BITCODE_LDFLAGS=-framework CoreFoundation -lobjc -lc++ +BITCODE_CONFIGURE_FLAGS=--enable-llvm-runtime --with-bitcode=yes + +ifdef ENABLE_BITCODE_ON_IOS +IOS_BITCODE_CFLAGS=$(BITCODE_CFLAGS) -fembed-bitcode-marker +IOS_BITCODE_CXXFLAGS=$(BITCODE_CFLAGS) -fembed-bitcode-marker +IOS_BITCODE_LDFLAGS=$(BITCODE_LDFLAGS) +IOS_BITCODE_CONFIGURE_FLAGS=$(BITCODE_CONFIGURE_FLAGS) +endif + +# +# The install-* targets should not depend on any of the build-* targets, +# because it will slow down the install targets unnecessarily (the build-* +# targets will recurse into multiple directories, which would be wasteful +# since in most cases the build has already been done) +# +# Currently 'make install' takes about 4 seconds (without running any build-* +# targets) +# +# This means that 'make all install' will not work in this directory, it must +# be 'make all && make install'. +# + +# This turns off the clang: warning: argument unused during compilation +# warnings when using clang+ccache together +CCACHE_CFLAGS=-Qunused-arguments +CCACHE_CXXFLAGS=-Qunused-arguments + +## +## Xamarin.Mac +## + +# We only build the mono runtimes here (mac32 and mac64) +# The xammac classlibs are built as a part of the 'tools64' build. + +MAC_ASSEMBLY_NAMES = \ + I18N \ + I18N.CJK \ + I18N.MidEast \ + I18N.Other \ + I18N.Rare \ + I18N.West \ + mscorlib \ + Microsoft.CSharp \ + Mono.CSharp \ + Mono.CompilerServices.SymbolWriter \ + Mono.Data.Sqlite \ + Mono.Data.Tds \ + Mono.Security \ + System.ComponentModel.Composition \ + System.ComponentModel.DataAnnotations \ + System.Core \ + System.Data.Services.Client \ + System.Data \ + System.IO.Compression.FileSystem \ + System.IO.Compression \ + System.Json \ + System.Net.Http \ + System.Net \ + System.Numerics \ + System.Runtime.Serialization \ + System.ServiceModel.Web \ + System.ServiceModel \ + System.ServiceModel.Internals \ + System.Transactions \ + System.Web.Services \ + System.Windows \ + System.Xml.Linq \ + System.Xml.Serialization \ + System.Xml \ + System \ + $(TLS_PROVIDER_ASSEMBLY_NAMES) + +FACADE_SUBDIRS_MK = $(MONO_PATH)/mcs/class/Facades/subdirs.make +# File does not exist before checking out mono +-include $(FACADE_SUBDIRS_MK) + +MAC_FACADE_ASSEMBLY_NAMES = $(xammac_PARALLEL_SUBDIRS) + +MAC_4_5_ADDITIONAL_ASSEMBLY_NAMES = \ + Mono.Messaging \ + Mono.Posix \ + System.Configuration \ + System.Configuration.Install \ + System.Data.Linq \ + System.EnterpriseServices \ + System.IdentityModel \ + System.IdentityModel.Selectors \ + System.Messaging \ + System.Runtime.Serialization.Formatters.Soap \ + System.Security + +MAC_4_5_ASSEMBLY_NAMES = $(MAC_ASSEMBLY_NAMES) $(MAC_4_5_ADDITIONAL_ASSEMBLY_NAMES) + +MAC_4_5_FACADE_ASSEMBLY_NAMES = $(MAC_FACADE_ASSEMBLY_NAMES) + +MAC_ASSEMBLIES = $(addsuffix .dll,$(MAC_ASSEMBLY_NAMES)) +MAC_FACADE_ASSEMBLIES = $(addsuffix .dll,$(MAC_FACADE_ASSEMBLY_NAMES)) +MAC_NO_MDB_ASSEMBLIES = System.Windows.dll System.Xml.Serialization.dll +MAC_4_5_ASSEMBLIES = $(addsuffix .dll,$(MAC_4_5_ASSEMBLY_NAMES)) +MAC_4_5_FACADE_ASSEMBLIES = $(addsuffix .dll,$(MAC_4_5_FACADE_ASSEMBLY_NAMES)) + +MAC_DIRECTORIES = \ + $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/bin \ + $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib \ + $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/Xamarin.Mac \ + $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/Xamarin.Mac/Facades \ + $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/4.5 \ + $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/4.5/Facades \ + $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/pkgconfig \ + $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/include \ + $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/etc/mono/assemblies/System \ + +MAC_BCL_TARGETS = \ + $(foreach file,$(MAC_ASSEMBLIES),$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/Xamarin.Mac/$(file)) \ + $(foreach file,$(filter-out $(MAC_NO_MDB_ASSEMBLIES),$(MAC_ASSEMBLIES)),$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/Xamarin.Mac/$(file).mdb) \ + $(foreach file,$(MAC_FACADE_ASSEMBLIES),$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/Xamarin.Mac/Facades/$(file)) \ + $(foreach file,$(MAC_4_5_ASSEMBLIES),$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/4.5/$(file)) \ + $(foreach file,$(filter-out $(MAC_NO_MDB_ASSEMBLIES),$(MAC_4_5_ASSEMBLIES)),$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/4.5/$(file).mdb) \ + $(foreach file,$(MAC_4_5_FACADE_ASSEMBLIES),$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/4.5/Facades/$(file)) \ + +MAC_TARGETS = \ + $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/libmono-profiler-log.a \ + $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/libmono-2.0.dylib \ + $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/libmono-2.0.a \ + $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/pkgconfig/mono-2.pc \ + $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/etc/mono/assemblies/System/System.config \ + $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/bin/bmac-mobile-mono \ + $(MAC_DESTDIR)/Library/Frameworks/Xamarin.Mac.framework/Versions/Current \ + $(MAC_DIRECTORIES) \ + +define MacBuildTemplate +$(2)_CPPFLAGS = \ + -isysroot $(XCODE_MAC_SDKROOT) \ + -mmacosx-version-min=$(MIN_OSX_SDK_VERSION) +$(2)_CFLAGS = -O2 -arch $(1) +$(2)_CXXFLAGS = -O2 -arch $(1) +$(2)_CONFIGURE_FLAGS = \ + --prefix=$$(BUILD_DESTDIR)/$(2) \ + --host=$(1)-apple-darwin10 \ + --cache-file=../$(2).config.cache \ + --enable-maintainer-mode \ + --with-glib=embedded \ + --with-mcs-docs=no \ + --disable-shared-handles \ + --disable-nls \ + --disable-iconv \ + --enable-native-types \ + --disable-mcs-build \ + --disable-boehm \ + $(XAMARIN_CONFIGURE_FLAGS) \ + +$(2)_CONFIGURE_ENVIRONMENT = \ + PATH="$(MONO_PREFIX)/bin:$(PATH)" \ + CPPFLAGS="$$($(2)_CPPFLAGS)" \ + CFLAGS="$$($(2)_CFLAGS)" \ + CXXFLAGS="$$($(2)_CXXFLAGS)" \ + CC="$(MAC_CC)" \ + CXX="$(MAC_CXX)" \ + DEVELOPER_DIR="$(XCODE_DEVELOPER_ROOT)" \ + +setup:: setup-$(2) + +setup-$(2): .stamp-configure-$(2) + +.stamp-configure-$(2): $(MONO_PATH)/configure + $(Q) $$($(2)_CONFIGURE_ENVIRONMENT) ./wrap-configure.sh $(2) $(abspath $(MONO_PATH)/configure) $$($(2)_CONFIGURE_FLAGS) + +$(BUILD_DESTDIR)/mono-$(2): mono-wrapper.in .stamp-configure-$(2) | $(BUILD_DESTDIR) + $$(Q_GEN) sed < $$< > $$@ 's|@ARCH@|$(1)|g; s|@MONO@|$(realpath .)/$(2)/mono/mini/mono|g; s|@FRAMEWORK_ROOT@|$(abspath $(MAC_DESTDIR)/$$(MAC_FRAMEWORK_CURRENT_DIR))|g' + $$(Q) chmod +x $$@ + +build-$(2): .stamp-configure-$(2) $(BUILD_DESTDIR)/mono-$(2) + PATH="$(MONO_PREFIX)/bin:$(PATH)" $(MAKE) -C $(2)/eglib/src + PATH="$(MONO_PREFIX)/bin:$(PATH)" $(MAKE) -C $(2)/mono + PATH="$(MONO_PREFIX)/bin:$(PATH)" $(MAKE) -C $(2)/mono install + PATH="$(MONO_PREFIX)/bin:$(PATH)" $(MAKE) -C $(2)/support +endef + +$(eval $(call MacBuildTemplate,i386,mac32)) +$(eval $(call MacBuildTemplate,x86_64,mac64)) + +define MacInstallBclTemplate + +MAC_DIRECTORIES += \ + $$(BUILD_DESTDIR)/mac/$(2)/bcl/Facades \ + $$(BUILD_DESTDIR)/mac/$(2)/bcl \ + +# copy to temporary directory before signing / mdb-rebasing, +# otherwise we end up re-signing if installing into a different directory. +$$(BUILD_DESTDIR)/mac/$(2)/bcl/Facades/%.dll: $$(MONO_PATH)/mcs/class/lib/$(2)/Facades/%.dll | $$(BUILD_DESTDIR)/mac/$(2)/bcl/Facades + @# sign the Facade assembly + $$(Q) cp $$< $$@ + $$(Q_SN) MONO_CFG_DIR=$(TOP) $(SYSTEM_SN) -q -R $$@ $$(PRODUCT_KEY_PATH) + +$$(BUILD_DESTDIR)/mac/$(2)/bcl/%.dll: $$(MONO_PATH)/mcs/class/lib/$(2)/%.dll | $$(BUILD_DESTDIR)/mac/$(2)/bcl + @# sign the BCL assembly + $$(Q) cp $$< $$@ + $$(Q_SN) MONO_CFG_DIR=$(TOP) $(SYSTEM_SN) -q -R $$@ $$(PRODUCT_KEY_PATH) + +$$(BUILD_DESTDIR)/mac/$(2)/bcl/%.mdb: $$(MONO_PATH)/mcs/class/lib/$(2)/%.mdb .stamp-build-tools64 | $$(BUILD_DESTDIR)/mac/$(2)/bcl + @# mdb-rebase the mdb + $$(Q) cp $$< $$@ + $$(Q_MDB) $$(MDB_REBASE) -q -i $$(abspath $$(MONO_PATH))/ -o $$(MAC_TARGETDIR)$$(MAC_FRAMEWORK_CURRENT_DIR)/src/mono/ $$@ + +$$(MAC_DESTDIR)$$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/$(1)/%.dll: $$(BUILD_DESTDIR)/mac/$(2)/bcl/%.dll | $$(MAC_DESTDIR)$$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/$(1)/Facades + $$(Q) install -m 0755 $$< $$@ + +$$(MAC_DESTDIR)$$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/$(1)/%.mdb: $$(BUILD_DESTDIR)/mac/$(2)/bcl/%.mdb | $$(MAC_DESTDIR)$$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/$(1)/Facades + $$(Q) install -m 0644 $$< $$@ +endef + +$(eval $(call MacInstallBclTemplate,Xamarin.Mac,xammac)) +$(eval $(call MacInstallBclTemplate,4.5,xammac_net_4_5)) + +$(MAC_DIRECTORIES) $(BUILD_DESTDIR): + $(Q) mkdir -p $@ + +mac-facade-check: + $(Q) rm -f .$@* + $(Q) echo $(MAC_FACADE_ASSEMBLIES) | tr ' ' '\n' | sort > .$@1 + $(Q) ls -1 $(MONO_PATH)/mcs/class/lib/xammac_net_4_5/Facades | grep dll | sort > .$@2 + $(Q) if ! diff -u .$@1 .$@2; then echo "\n*** There are Facade assemblies in "$(MONO_PATH)/mcs/class/lib/xammac_net_4_5/Facades " not defined in "$(FACADE_SUBDIRS_MK)" ***\n"; exit 1; fi + $(Q) rm -f .$@* + +define lipo_template_static +$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/$1: mac32/$(2)/.libs/$(1) mac64/$(2)/.libs/$(1) | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib + $(QT_LIPO) lipo -create $$+ -output $$@ + +MAC_TARGETS += $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/$1 +endef + +define lipo_template_dynamic +$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/$1: mac32/$(2)/.libs/$(1) mac64/$(2)/.libs/$(1) | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib + $(QT_LIPO) lipo -create $$+ -output $$@ + $(Q) install_name_tool -id @executable_path/$1 $$@ + +MAC_TARGETS += $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/$1 +endef + +$(eval $(call lipo_template_static,libmono-profiler-log.a,mono/profiler)) +$(eval $(call lipo_template_static,libmonosgen-2.0.a,mono/mini)) +$(eval $(call lipo_template_dynamic,libmonosgen-2.0.dylib,mono/mini)) +$(eval $(call lipo_template_dynamic,libMonoPosixHelper.dylib,support)) + +$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/libmono-2.0.dylib $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/libmono-2.0.a: | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib + $(Q_LN) ln -sf libmonosgen-2.0$(suffix $@) $@ + +$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/pkgconfig/mono-2.pc: mac32/data/mono-2.pc | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/pkgconfig + $(Q_CP) cp $< $@ + +$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/etc/mono/assemblies/System/System.config: mac-System.config | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/etc/mono/assemblies/System + $(Q_CP) cp $< $@ + +$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/bin/bmac-mobile-mono: install/mac64/bin/mono-sgen | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/bin + $(Q) install -m 0755 $< $@ + +$(MAC_DESTDIR)$(MAC_FRAMEWORK_DIR)/Versions/Current: + $(Q_LN) ln -hfs $(MAC_INSTALL_VERSION) $(MAC_DESTDIR)$(MAC_FRAMEWORK_DIR)/Versions/Current + +build:: build-mac +build-mac: build-mac32 build-mac64 + $(MAKE) $(MAC_TARGETS) + +install-local:: install-mac +install-mac: $(MAC_TARGETS) + +clean-local:: clean-mac + +clean-mac: clean-mac32 clean-mac64 + +clean-mac32: + rm -rf mac32 .stamp-configure-mac32 mac32.config.cache + +clean-mac64: + rm -rf mac64 .stamp-configure-mac64 mac64.config.cache + +## +## Xamarin.iOS +## + +all-local:: build + +ifdef INCLUDE_IOS +all-local:: $(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/bin/smcs +endif + +setup:: + +ifdef INCLUDE_IOS +install-local:: $(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/bin/smcs +endif + +clean-local:: + @rm -rf $(BUILD_DESTDIR) .stamp-configure-* + @rm -f $(MONO_PATH)/configure + +$(MONO_PATH)/configure: $(MONO_PATH)/configure.ac Makefile + $(Q) ./wrap-autogen.sh $(MONO_PATH) mono $(XAMARIN_AUTOGEN_FLAGS) + +configure-mono: + rm -f $(MONO_PATH)/configure + $(MAKE) $(MONO_PATH)/configure + +# FIXME: Needed because of broken MonoDevelop assumptions +$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/bin/smcs: + @mkdir -p $(dir $@) + @echo Installing smcs script + @echo "#!/bin/bash" > $@ + @echo >> $@ + @echo 'SMCS=`which mcs`' >> $@ + @echo 'if test -z $$SMCS; then' >> $@ + @echo " SMCS=/Library/Frameworks/Mono.framework/Versions/Current/bin/mcs" >> $@ + @echo "fi" >> $@ + @echo 'unset MONO_PATH' >> $@ + @echo "\$$SMCS -nostdlib -r:$(abspath $(IOS_TARGETDIR)/$(MONOTOUCH_PREFIX)/lib/mono/2.1/mscorlib.dll) -r:$(abspath $(IOS_TARGETDIR)/$(MONOTOUCH_PREFIX)/lib/mono/2.1/System.dll) \"\$$@\"" >> $@ + @chmod +x $@ + +# +# Tools 64bit build. Builds all the class libs as well. +# +TOOLS64_CFLAGS=-arch x86_64 -mmacosx-version-min=$(MIN_OSX_SDK_VERSION) +TOOLS64_CXXFLAGS=-arch x86_64 -mmacosx-version-min=$(MIN_OSX_SDK_VERSION) +TOOLS64_LDFLAGS=-arch x86_64 -mmacosx-version-min=$(MIN_OSX_SDK_VERSION) + +TOOLS64_CONFIGURE_FLAGS= --build=x86_64-apple-darwin10 \ + --with-monotouch_tv=yes \ + --with-monotouch_watch=yes \ + --prefix=$(BUILD_DESTDIR)/tools64 \ + --enable-maintainer-mode \ + --cache-file=../tools64.config.cache \ + --with-glib=embedded \ + --enable-minimal=com \ + --with-profile2=no \ + --with-profile4=no \ + --with-profile4_5=yes \ + --with-monotouch=yes \ + --with-xammac=yes \ + --with-mcs-docs=no \ + --disable-shared-handles \ + --disable-nls \ + --disable-iconv \ + --disable-boehm \ + $(XAMARIN_CONFIGURE_FLAGS) \ + +TOOLS64_CONFIGURE_ENVIRONMENT = \ + CFLAGS="$(TOOLS64_CFLAGS)" \ + CXXFLAGS="$(TOOLS64_CXXFLAGS)" \ + LDFLAGS="$(TOOLS64_LDFLAGS)" \ + DEVELOPER_DIR=$(XCODE_DEVELOPER_ROOT) \ + CC="$(MAC_CC)" \ + CXX="$(MAC_CXX)" \ + +tools:: build-tools64 install-tools + +setup:: setup-tools64 +build:: build-tools64 +clean-local:: clean-tools64 + +tools64: build-tools64 install-tools + +ifdef INCLUDE_IOS +install-local:: install-tools-ios +install-tools:: install-tools-ios +endif +install-local:: install-tools-mac +install-tools:: install-tools-mac + +setup-tools64: .stamp-configure-tools64 + +.stamp-configure-tools64: $(MONO_PATH)/configure + $(Q) $(TOOLS64_CONFIGURE_ENVIRONMENT) ./wrap-configure.sh tools64 $(abspath $(MONO_PATH)/configure) $(TOOLS64_CONFIGURE_FLAGS) + +build-tools-bcl: build-tools64 +build-tools: build-tools64 + +.stamp-build-tools64: .stamp-configure-tools64 + $(MAKE) -C tools64 all EXTERNAL_MCS=$(SYSTEM_MCS) EXTERNAL_RUNTIME=$(SYSTEM_MONO) + # NO_INSTALL is defined in mono/mcs/build/profiles except for net_4_5. If we don't have it, then it attempts to install into a gac, and sometimes fail + NO_INSTALL=1 $(MAKE) -C tools64 -j 1 install EXTERNAL_MCS=$(SYSTEM_MCS) EXTERNAL_RUNTIME=$(SYSTEM_MONO) + @touch .stamp-build-tools64 + +build-tools64: .stamp-build-tools64 +ifdef INCLUDE_IOS + $(MAKE) $(IOS_BCL_TARGETS) +endif +ifdef INCLUDE_TVOS + $(MAKE) $(TVOS_BCL_TARGETS) +endif +ifdef INCLUDE_WATCH + $(MAKE) $(WATCH_BCL_TARGETS) +endif + $(MAKE) $(MAC_BCL_TARGETS) + +clean-tools64: + rm -rf tools64 .stamp-configure-tools64 tools64.config.cache + rm -f .stamp-build-tools64 + +ifdef INCLUDE_WATCH +install-local:: install-tools-watch +install-tools:: install-tools-watch +endif +ifdef INCLUDE_TVOS +install-local:: install-tools-tvos +install-tols:: install-tools-tvos +endif + +# +# Xamarin.iOS/WatchOS/TVOS BCL assemblies +# + +# note: Mono.Cairo is probably used for Android only (removed from xtouch list) +IOS_ASSEMBLIES = I18N.CJK I18N.MidEast I18N.Other I18N.Rare I18N.West I18N Mono.Data.Sqlite Mono.Data.Tds Mono.Security mscorlib \ + System System.Core System.Data System.Data.Services.Client System.Json System.Runtime.Serialization \ + System.ServiceModel.Web System.ServiceModel System.Transactions System.Web.Services System.Xml.Linq System.Xml \ + System.ServiceModel.Internals \ + System.Numerics System.IO.Compression System.IO.Compression.FileSystem \ + System.ComponentModel.DataAnnotations System.ComponentModel.Composition \ + System.Windows System.Xml.Serialization System.Net Mono.Dynamic.Interpreter \ + Microsoft.CSharp Mono.CSharp $(TLS_PROVIDER_ASSEMBLY_NAMES) + +IOS_REPL_ASSEMBLIES = mscorlib System System.Core System.Xml Mono.CSharp + +IOS_FACADE_ASSEMBLIES = $(monotouch_PARALLEL_SUBDIRS) + +# TVOS/WATCHOS BCL is built from a different mono branch and the assembly list might differ across time +TVOS_ASSEMBLIES = $(IOS_ASSEMBLIES) +WATCHOS_ASSEMBLIES = $(IOS_ASSEMBLIES) +TVOS_FACADE_ASSEMBLIES = $(IOS_FACADE_ASSEMBLIES) +WATCHOS_FACADE_ASSEMBLIES = $(IOS_FACADE_ASSEMBLIES) +TVOS_REPL_ASSEMBLIES = $(IOS_REPL_ASSEMBLIES) +WATCHOS_REPL_ASSEMBLIES = $(IOS_REPL_ASSEMBLIES) + +ios-facade-check: + $(Q) rm -f .$@* + $(Q) echo $(IOS_FACADE_ASSEMBLIES) | tr ' ' '\n' | sort > .$@1 + $(Q) ls -1 $(MONO_PATH)/mcs/class/lib/monotouch/Facades | grep dll | sed 's/[.]dll//' | sort > .$@2 + $(Q) if ! diff -u .$@1 .$@2; then echo "\n*** There are Facade assemblies in "$(MONO_PATH)/mcs/class/lib/monotouch/Facades" not defined in "$(FACADE_SUBDIRS_MK)"***\n"; exit 1; fi + $(Q) rm -f .$@* + +watch-facade-check: + $(Q) rm -f .$@* + $(Q) echo $(WATCHOS_FACADE_ASSEMBLIES) | tr ' ' '\n' | sort > .$@1 + $(Q) ls -1 $(MONO_PATH)/mcs/class/lib/monotouch_watch/Facades | grep dll | sed 's/[.]dll//' | sort > .$@2 + $(Q) if ! diff -u .$@1 .$@2; then echo "\n*** There are Facade assemblies in "$(MONO_PATH)/mcs/class/lib/monotouch_watch/Facades" not defined in "$(FACADE_SUBDIRS_MK)" ***\n"; exit 1; fi + $(Q) rm -f .$@* + +tvos-facade-check: + $(Q) rm -f .$@* + $(Q) echo $(TVOS_FACADE_ASSEMBLIES) | tr ' ' '\n' | sort > .$@1 + $(Q) ls -1 $(MONO_PATH)/mcs/class/lib/monotouch_tv/Facades | grep dll | sed 's/[.]dll//' | sort > .$@2 + $(Q) if ! diff -u .$@1 .$@2; then echo "\n*** There are Facade assemblies in "$(MONO_PATH)/mcs/class/lib/monotouch_tv/Facades" not defined in "$(FACADE_SUBDIRS_MK)" ***\n"; exit 1; fi + $(Q) rm -f .$@* + +NO_MDB_ASSEMBLIES = System.Windows System.Xml.Serialization + +IOS_BCL_TARGETS_DIRS += \ + $(PREFIX)/lib/mono/2.1 \ + $(PREFIX)/lib/mono/2.1/Facades \ + $(PREFIX)/lib/mono/Xamarin.iOS \ + $(PREFIX)/lib/mono/2.1/repl \ + $(PREFIX)/lib/mono/Xamarin.iOS/repl \ + $(BUILD_DESTDIR)/ios/bcl/Facades \ + $(BUILD_DESTDIR)/ios/bcl \ + $(BUILD_DESTDIR)/ios/bcl/repl \ + +WATCH_BCL_TARGETS_DIRS += \ + $(PREFIX)/lib/mono/Xamarin.WatchOS \ + $(PREFIX)/lib/mono/Xamarin.WatchOS/Facades \ + $(PREFIX)/lib/mono/Xamarin.WatchOS/repl \ + $(BUILD_DESTDIR)/watchos/bcl/Facades \ + $(BUILD_DESTDIR)/watchos/bcl \ + $(BUILD_DESTDIR)/watchos/bcl/repl \ + +TVOS_BCL_TARGETS_DIRS += \ + $(PREFIX)/lib/mono/Xamarin.TVOS \ + $(PREFIX)/lib/mono/Xamarin.TVOS/Facades \ + $(PREFIX)/lib/mono/Xamarin.TVOS/repl \ + $(BUILD_DESTDIR)/tvos/bcl/Facades \ + $(BUILD_DESTDIR)/tvos/bcl \ + $(BUILD_DESTDIR)/tvos/bcl/repl \ + +IOS_BCL_TARGETS += \ + $(PREFIX)/lib/mono/Xamarin.iOS/Facades \ + $(foreach file,$(IOS_ASSEMBLIES),$(PREFIX)/lib/mono/2.1/$(file).dll) \ + $(foreach file,$(filter-out $(NO_MDB_ASSEMBLIES),$(IOS_ASSEMBLIES)),$(PREFIX)/lib/mono/2.1/$(file).dll.mdb) \ + $(foreach file,$(IOS_ASSEMBLIES),$(PREFIX)/lib/mono/Xamarin.iOS/$(file).dll) \ + $(foreach file,$(filter-out $(NO_MDB_ASSEMBLIES),$(IOS_ASSEMBLIES)),$(PREFIX)/lib/mono/Xamarin.iOS/$(file).dll.mdb) \ + $(PREFIX)/lib/mono/Xamarin.iOS/mscorlib.dll \ + $(PREFIX)/lib/mono/2.1/mscorlib.dll \ + $(PREFIX)/bin/btouch-mono \ + $(foreach file,$(IOS_FACADE_ASSEMBLIES),$(PREFIX)/lib/mono/2.1/Facades/$(file).dll) \ + $(foreach file,$(IOS_REPL_ASSEMBLIES),$(PREFIX)/lib/mono/2.1/repl/$(file).dll) \ + $(foreach file,$(IOS_REPL_ASSEMBLIES),$(PREFIX)/lib/mono/2.1/repl/$(file).dll.mdb) \ + $(foreach file,$(IOS_REPL_ASSEMBLIES),$(PREFIX)/lib/mono/Xamarin.iOS/repl/$(file).dll) \ + $(foreach file,$(IOS_REPL_ASSEMBLIES),$(PREFIX)/lib/mono/Xamarin.iOS/repl/$(file).dll.mdb) \ + +WATCH_BCL_TARGETS += \ + $(foreach file,$(WATCHOS_ASSEMBLIES),$(PREFIX)/lib/mono/Xamarin.WatchOS/$(file).dll) \ + $(foreach file,$(filter-out $(NO_MDB_ASSEMBLIES),$(WATCHOS_ASSEMBLIES)),$(PREFIX)/lib/mono/Xamarin.WatchOS/$(file).dll.mdb) \ + $(PREFIX)/lib/mono/Xamarin.WatchOS/mscorlib.dll \ + $(PREFIX)/bin/bwatch-mono \ + $(foreach file,$(WATCHOS_FACADE_ASSEMBLIES),$(PREFIX)/lib/mono/Xamarin.WatchOS/Facades/$(file).dll) \ + $(foreach file,$(WATCHOS_REPL_ASSEMBLIES),$(PREFIX)/lib/mono/Xamarin.WatchOS/repl/$(file).dll) \ + $(foreach file,$(WATCHOS_REPL_ASSEMBLIES),$(PREFIX)/lib/mono/Xamarin.WatchOS/repl/$(file).dll.mdb) \ + +TVOS_BCL_TARGETS += \ + $(foreach file,$(TVOS_ASSEMBLIES),$(PREFIX)/lib/mono/Xamarin.TVOS/$(file).dll) \ + $(foreach file,$(filter-out $(NO_MDB_ASSEMBLIES),$(TVOS_ASSEMBLIES)),$(PREFIX)/lib/mono/Xamarin.TVOS/$(file).dll.mdb) \ + $(PREFIX)/lib/mono/Xamarin.TVOS/mscorlib.dll \ + $(PREFIX)/bin/btv-mono \ + $(foreach file,$(TVOS_FACADE_ASSEMBLIES),$(PREFIX)/lib/mono/Xamarin.TVOS/Facades/$(file).dll) \ + $(foreach file,$(TVOS_REPL_ASSEMBLIES),$(PREFIX)/lib/mono/Xamarin.TVOS/repl/$(file).dll) \ + $(foreach file,$(TVOS_REPL_ASSEMBLIES),$(PREFIX)/lib/mono/Xamarin.TVOS/repl/$(file).dll.mdb) \ + +$(PREFIX)/lib/mono/Xamarin.iOS/Facades: | $(PREFIX)/lib/mono/Xamarin.iOS + $(Q_LN) ln -Fhs $(abspath $(IOS_TARGETDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1/Facades) $@ + +$(PREFIX)/lib/mono/Xamarin.iOS/repl/%: | $(PREFIX)/lib/mono/Xamarin.iOS/repl + $(Q_LN) ln -Fs ../../2.1/repl/$(@F) $@ + +$(PREFIX)/lib/mono/2.1/Facades/%.dll: $(BUILD_DESTDIR)/ios/bcl/Facades/%.dll | $(PREFIX)/lib/mono/2.1/Facades + $(Q) install -m 0755 $< $@ + +$(PREFIX)/lib/mono/2.1/%.dll: $(BUILD_DESTDIR)/ios/bcl/%.dll | $(PREFIX)/lib/mono/2.1 $(PREFIX)/lib/mono/2.1/repl + $(Q) install -m 0755 $< $@ + +$(PREFIX)/lib/mono/2.1/%.mdb: $(BUILD_DESTDIR)/ios/bcl/%.mdb | $(PREFIX)/lib/mono/2.1 $(PREFIX)/lib/mono/2.1/repl + $(Q) install -m 0644 $< $@ + +$(PREFIX)/bin/btouch-mono: $(BUILD_DESTDIR)/tools64/bin/mono | $(PREFIX)/bin + $(Q) install -s -m 0755 $< $@ + +$(PREFIX)/lib/mono/Xamarin.WatchOS/Facades/%.dll: $(BUILD_DESTDIR)/watchos/bcl/Facades/%.dll | $(PREFIX)/lib/mono/Xamarin.WatchOS/Facades + $(Q) install -m 0755 $< $@ + +$(PREFIX)/lib/mono/Xamarin.WatchOS/%.dll: $(BUILD_DESTDIR)/watchos/bcl/%.dll | $(PREFIX)/lib/mono/Xamarin.WatchOS $(PREFIX)/lib/mono/Xamarin.WatchOS/repl + $(Q) install -m 0755 $< $@ + +$(PREFIX)/lib/mono/Xamarin.WatchOS/%.mdb: $(BUILD_DESTDIR)/watchos/bcl/%.mdb | $(PREFIX)/lib/mono/Xamarin.WatchOS $(PREFIX)/lib/mono/Xamarin.WatchOS/repl + $(Q) install -m 0644 $< $@ + +$(PREFIX)/lib/mono/Xamarin.TVOS/Facades/%.dll: $(BUILD_DESTDIR)/tvos/bcl/Facades/%.dll | $(PREFIX)/lib/mono/Xamarin.TVOS/Facades + $(Q) install -m 0755 $< $@ + +$(PREFIX)/lib/mono/Xamarin.TVOS/%.dll: $(BUILD_DESTDIR)/tvos/bcl/%.dll | $(PREFIX)/lib/mono/Xamarin.TVOS $(PREFIX)/lib/mono/Xamarin.TVOS/repl + $(Q) install -m 0755 $< $@ + +$(PREFIX)/lib/mono/Xamarin.TVOS/%.mdb: $(BUILD_DESTDIR)/tvos/bcl/%.mdb | $(PREFIX)/lib/mono/Xamarin.TVOS $(PREFIX)/lib/mono/Xamarin.TVOS/repl + $(Q) install -m 0644 $< $@ + +$(PREFIX)/bin/btv-mono: $(BUILD_DESTDIR)/tools64/bin/mono | $(PREFIX)/bin + $(Q) install -s -m 0755 $< $@ + +$(PREFIX)/bin/bwatch-mono: $(BUILD_DESTDIR)/tools64/bin/mono | $(PREFIX)/bin + $(Q) install -s -m 0755 $< $@ + +# copy to temporary directory before signing / mdb-rebasing, +# otherwise we end up re-signing if installing into a different directory. +$(BUILD_DESTDIR)/ios/bcl/Facades/%.dll: $(MONO_PATH)/mcs/class/lib/monotouch/Facades/%.dll | $(BUILD_DESTDIR)/ios/bcl/Facades + @# sign the Facade assembly + $(Q) cp $< $@ + $(Q_SN) MONO_CFG_DIR=$(TOP) $(SYSTEM_SN) -q -R $@ $(PRODUCT_KEY_PATH) + +$(BUILD_DESTDIR)/ios/bcl/%.dll: $(MONO_PATH)/mcs/class/lib/monotouch/%.dll | $(BUILD_DESTDIR)/ios/bcl + @# sign the BCL assembly + $(Q) cp $< $@ + $(Q_SN) MONO_CFG_DIR=$(TOP) $(SYSTEM_SN) -q -R $@ $(PRODUCT_KEY_PATH) + +$(BUILD_DESTDIR)/ios/bcl/repl/%.dll: $(MONO_PATH)/mcs/class/lib/monotouch_runtime/%.dll | $(BUILD_DESTDIR)/ios/bcl/repl + @# sign the BCL assembly + $(Q) cp $< $@ + $(Q_SN) MONO_CFG_DIR=$(TOP) $(SYSTEM_SN) -q -R $@ $(PRODUCT_KEY_PATH) + +$(BUILD_DESTDIR)/ios/bcl/%.mdb: $(MONO_PATH)/mcs/class/lib/monotouch/%.mdb .stamp-build-tools64 | $(BUILD_DESTDIR)/ios/bcl + @# mdb-rebase the mdb + $(Q) cp $< $@ + $(Q_MDB) $(MDB_REBASE) -q -i $(abspath $(MONO_PATH))/ -o $(IOS_TARGETDIR)$(MONOTOUCH_PREFIX)/src/mono/ $@ + +$(BUILD_DESTDIR)/ios/bcl/repl/%.mdb: $(MONO_PATH)/mcs/class/lib/monotouch_runtime/%.mdb .stamp-build-tools64 | $(BUILD_DESTDIR)/ios/bcl/repl + @# mdb-rebase the mdb + $(Q) cp $< $@ + $(Q_MDB) $(MDB_REBASE) -q -i $(abspath $(MONO_PATH))/ -o $(IOS_TARGETDIR)$(MONOTOUCH_PREFIX)/src/mono/ $@ + +$(BUILD_DESTDIR)/watchos/bcl/Facades/%.dll: $(MONO_PATH)/mcs/class/lib/monotouch_watch/Facades/%.dll | $(BUILD_DESTDIR)/watchos/bcl/Facades + @# sign the Facade assembly + $(Q) cp $< $@ + $(Q_SN) MONO_CFG_DIR=$(TOP) $(SYSTEM_SN) -q -R $@ $(PRODUCT_KEY_PATH) + +$(BUILD_DESTDIR)/watchos/bcl/%.dll: $(MONO_PATH)/mcs/class/lib/monotouch_watch/%.dll | $(BUILD_DESTDIR)/watchos/bcl + @# sign the BCL assembly + $(Q) cp $< $@ + $(Q_SN) MONO_CFG_DIR=$(TOP) $(SYSTEM_SN) -q -R $@ $(PRODUCT_KEY_PATH) + +$(BUILD_DESTDIR)/watchos/bcl/repl/%.dll: $(MONO_PATH)/mcs/class/lib/monotouch_watch_runtime/%.dll | $(BUILD_DESTDIR)/watchos/bcl/repl + @# sign the BCL assembly + $(Q) cp $< $@ + $(Q_SN) MONO_CFG_DIR=$(TOP) $(SYSTEM_SN) -q -R $@ $(PRODUCT_KEY_PATH) + +$(BUILD_DESTDIR)/watchos/bcl/%.mdb: $(MONO_PATH)/mcs/class/lib/monotouch_watch/%.mdb .stamp-build-tools64 | $(BUILD_DESTDIR)/watchos/bcl + @# mdb-rebase the mdb + $(Q) cp $< $@ + $(Q_MDB) $(MDB_REBASE) -q -i $(abspath $(MONO_PATH))/ -o $(IOS_TARGETDIR)$(MONOTOUCH_PREFIX)/src/mono/ $@ + +$(BUILD_DESTDIR)/watchos/bcl/repl/%.mdb: $(MONO_PATH)/mcs/class/lib/monotouch_watch_runtime/%.mdb .stamp-build-tools64 | $(BUILD_DESTDIR)/watchos/bcl/repl + @# mdb-rebase the mdb + $(Q) cp $< $@ + $(Q_MDB) $(MDB_REBASE) -q -i $(abspath $(MONO_PATH))/ -o $(IOS_TARGETDIR)$(MONOTOUCH_PREFIX)/src/mono/ $@ + +$(BUILD_DESTDIR)/tvos/bcl/Facades/%.dll: $(MONO_PATH)/mcs/class/lib/monotouch_tv/Facades/%.dll | $(BUILD_DESTDIR)/tvos/bcl/Facades + @# sign the Facade assembly + $(Q) cp $< $@ + $(Q_SN) MONO_CFG_DIR=$(TOP) $(SYSTEM_SN) -q -R $@ $(PRODUCT_KEY_PATH) + +$(BUILD_DESTDIR)/tvos/bcl/%.dll: $(MONO_PATH)/mcs/class/lib/monotouch_tv/%.dll | $(BUILD_DESTDIR)/tvos/bcl + @# sign the BCL assembly + $(Q) cp $< $@ + $(Q_SN) MONO_CFG_DIR=$(TOP) $(SYSTEM_SN) -q -R $@ $(PRODUCT_KEY_PATH) + +$(BUILD_DESTDIR)/tvos/bcl/repl/%.dll: $(MONO_PATH)/mcs/class/lib/monotouch_tv_runtime/%.dll | $(BUILD_DESTDIR)/tvos/bcl/repl + @# sign the BCL assembly + $(Q) cp $< $@ + $(Q_SN) MONO_CFG_DIR=$(TOP) $(SYSTEM_SN) -q -R $@ $(PRODUCT_KEY_PATH) + +$(BUILD_DESTDIR)/tvos/bcl/%.mdb: $(MONO_PATH)/mcs/class/lib/monotouch_tv/%.mdb .stamp-build-tools64 | $(BUILD_DESTDIR)/tvos/bcl + @# mdb-rebase the mdb + $(Q) cp $< $@ + $(Q_MDB) $(MDB_REBASE) -q -i $(abspath $(MONO_PATH))/ -o $(IOS_TARGETDIR)$(MONOTOUCH_PREFIX)/src/mono/ $@ + +$(BUILD_DESTDIR)/tvos/bcl/repl/%.mdb: $(MONO_PATH)/mcs/class/lib/monotouch_tv_runtime/%.mdb .stamp-build-tools64 | $(BUILD_DESTDIR)/tvos/bcl/repl + @# mdb-rebase the repl mdb + $(Q) cp $< $@ + $(Q_MDB) $(MDB_REBASE) -q -i $(abspath $(MONO_PATH))/ -o $(IOS_TARGETDIR)$(MONOTOUCH_PREFIX)/src/mono/ $@ + +$(PREFIX)/lib/mono/Xamarin.iOS/%.dll: | $(PREFIX)/lib/mono/Xamarin.iOS + $(Q_LN) ln -Fs ../2.1/$*.dll $@ + +$(PREFIX)/lib/mono/Xamarin.iOS/%.mdb: | $(PREFIX)/lib/mono/Xamarin.iOS + $(Q_LN) ln -Fs ../2.1/$*.mdb $@ + +$(IOS_BCL_TARGETS_DIRS) $(WATCH_BCL_TARGETS_DIRS) $(TVOS_BCL_TARGETS_DIRS): + $(Q) mkdir -p $@ + +.SECONDARY: $(foreach file,$(IOS_FACADE_ASSEMBLIES),$(BUILD_DESTDIR)/ios/bcl/Facades/$(file).dll) $(foreach file,$(IOS_ASSEMBLIES),$(BUILD_DESTDIR)/ios/bcl/$(file).dll.mdb) $(foreach file,$(IOS_ASSEMBLIES),$(BUILD_DESTDIR)/ios/bcl/$(file).dll) +.SECONDARY: \ + $(foreach file,$(MAC_FACADE_ASSEMBLIES),$(BUILD_DESTDIR)/mac/xammac/bcl/Facades/$(file)) \ + $(foreach file,$(MAC_ASSEMBLIES),$(BUILD_DESTDIR)/mac/xammac/bcl/$(file).mdb) \ + $(foreach file,$(MAC_ASSEMBLIES),$(BUILD_DESTDIR)/mac/xammac/bcl/$(file)) \ + $(foreach file,$(MAC_FACADE_ASSEMBLIES),$(BUILD_DESTDIR)/mac/net_4_5/bcl/Facades/$(file)) \ + $(foreach file,$(MAC_4_5_ASSEMBLIES),$(BUILD_DESTDIR)/mac/net_4_5/bcl/$(file).mdb) \ + $(foreach file,$(MAC_4_5_ASSEMBLIES),$(BUILD_DESTDIR)/mac/net_4_5/bcl/$(file)) \ + +.SECONDARY: \ + $(foreach file,$(WATCHOS_FACADE_ASSEMBLIES),$(BUILD_DESTDIR)/watchos/bcl/Facades/$(file).dll) \ + $(foreach file,$(WATCHOS_ASSEMBLIES),$(BUILD_DESTDIR)/watchos/bcl/$(file).dll.mdb) \ + $(foreach file,$(WATCHOS_ASSEMBLIES),$(BUILD_DESTDIR)/watchos/bcl/$(file).dll) \ + $(foreach file,$(WATCHOS_REPL_ASSEMBLIES),$(BUILD_DESTDIR)/watchos/bcl/repl/$(file).dll) \ + $(foreach file,$(WATCHOS_REPL_ASSEMBLIES),$(BUILD_DESTDIR)/watchos/bcl/repl/$(file).dll.mdb) \ + $(foreach file,$(TVOS_FACADE_ASSEMBLIES),$(BUILD_DESTDIR)/tvos/bcl/Facades/$(file).dll) \ + $(foreach file,$(TVOS_ASSEMBLIES),$(BUILD_DESTDIR)/tvos/bcl/$(file).dll.mdb) \ + $(foreach file,$(TVOS_ASSEMBLIES),$(BUILD_DESTDIR)/tvos/bcl/$(file).dll) \ + $(foreach file,$(TVOS_REPL_ASSEMBLIES),$(BUILD_DESTDIR)/tvos/bcl/repl/$(file).dll) \ + $(foreach file,$(TVOS_REPL_ASSEMBLIES),$(BUILD_DESTDIR)/tvos/bcl/repl/$(file).dll.mdb) \ + +install-tools-tvos: $(TVOS_BCL_TARGETS) + $(Q) $(MAKE) tvos-facade-check + +install-tools-watch: $(WATCH_BCL_TARGETS) + $(Q) $(MAKE) watch-facade-check + +install-tools-ios: $(IOS_BCL_TARGETS) + $(Q) $(MAKE) ios-facade-check + +install-tools-mac: $(MAC_BCL_TARGETS) + $(Q) $(MAKE) mac-facade-check + +verify-signature: + for file in $(PREFIX)/lib/mono/2.1/*.dll; do \ + MONO_CFG_DIR=$(TOP) $(SYSTEM_SN) -q -v $$file; \ + done + @MONO_CFG_DIR=$(TOP) $(SYSTEM_SN) -q -v $(PREFIX)/lib/mono/2.1/monotouch.dll \ + @MONO_CFG_DIR=$(TOP) $(SYSTEM_SN) -q -v $(PREFIX)/lib/mono/2.1/MonoTouch.Dialog.dll \ + @MONO_CFG_DIR=$(TOP) $(SYSTEM_SN) -q -v $(PREFIX)/lib/mono/2.1/MonoTouch.NUnitLite.dll \ + @MONO_CFG_DIR=$(TOP) $(SYSTEM_SN) -q -v $(PREFIX)/lib/mono/2.1/OpenTK.dll \ + @MONO_CFG_DIR=$(TOP) $(SYSTEM_SN) -q -v $(PREFIX)/lib/mono/2.1/OpenTK-10.dll + for file in $(IOS_FACADE_ASSEMBLIES); do \ + MONO_CFG_DIR=$(TOP) $(SYSTEM_SN) -q -v $(PREFIX)/lib/mono/2.1/Facades/$$file.dll; \ + done + +# +# Simulator builds +# + +# usage $(call SimulatorBuildTemplate (x86_64,simulator64)) + +SIM_BIN=$(SIMULATOR_BIN_PATH) + +define SimulatorBuildTemplate + +$(eval SIM$(2)_CPPFLAGS=-arch $(1) -O2 -DMONOTOUCH -DHOST_IOS -Wl,-application_extension -mios-simulator-version-min=$(MIN_IOS_SDK_VERSION) -isysroot $(SIMULATOR_SDK)) +$(eval SIM$(2)_CFLAGS=$(SIM$(2)_CPPFLAGS) $(SIMULATOR_BUILD_CFLAGS)) +$(eval SIM$(2)_CXXFLAGS=$(SIM$(2)_CPPFLAGS)) +$(eval SIM$(2)_CONFIGURE_FLAGS= --host=$(1)-apple-darwin10 \ + --cache-file=../$(2).config.cache \ + --enable-maintainer-mode \ + --prefix=$(BUILD_DESTDIR)/$(2) \ + --with-glib=embedded \ + --without-ikvm-native \ + --enable-minimal=com,remoting,shared_perfcounters \ + --disable-mcs-build \ + --disable-nls \ + --disable-iconv \ + --disable-shared-handles \ + --disable-boehm \ + --disable-executables \ + --disable-visibility-hidden \ + --enable-native-types \ + $(XAMARIN_CONFIGURE_FLAGS) \ + ) + +$(eval SIM$(2)_CONFIGURE_ENVIRONMENT= \ + PATH="$(SIM_BIN):$(PATH)" \ + CPPFLAGS="$(SIM$(2)_CPPFLAGS)" \ + CFLAGS="$(SIM$(2)_CFLAGS)" \ + CXXFLAGS="$(SIM$(2)_CXXFLAGS)" \ + CC="$(XCODE_CC)" \ + CXX="$(XCODE_CXX)") + +.PHONY: $(2) + +$(2):: build-$(2) + +setup:: setup-$(2) +build:: build-$(2) +clean-local:: clean-$(2) + +setup-$(2): .stamp-configure-$(2) + +.stamp-configure-$(2): $(MONO_PATH)/configure + $(Q) $(SIM$(2)_CONFIGURE_ENVIRONMENT) ./wrap-configure.sh $(2) $(abspath $(MONO_PATH)/configure) $(SIM$(2)_CONFIGURE_FLAGS) + +build-$(2): .stamp-configure-$(2) + PATH="$(SIM_BIN):$(PATH)" $(MAKE) -C $(2)/eglib all + PATH="$(SIM_BIN):$(PATH)" $(MAKE) -C $(2)/mono all + PATH="$(SIM_BIN):$(PATH)" $(MAKE) -C $(2)/support all + PATH="$(SIM_BIN):$(PATH)" $(MAKE) -C $(2)/eglib install + PATH="$(SIM_BIN):$(PATH)" $(MAKE) -C $(2)/mono install + +clean-$(2): + -rm -rf $(2) .stamp-configure-$(2) $(2).config.cache + +setup-iphonesimulator:: setup-$(2) +build-iphonesimulator:: build-$(2) +clean-iphonesimulator:: clean-$(2) + +$(eval SIM_TARGET_LIBMONOSGEN:=$(SIM_TARGET_LIBMONOSGEN) $(BUILD_DESTDIR)/$(2)/lib/libmonosgen-2.0.a) +$(eval SIM_TARGET_SHAREDMONOSGEN:=$(SIM_TARGET_SHAREDMONOSGEN) $(BUILD_DESTDIR)/$(2)/lib/libmonosgen-2.0.dylib) +$(eval SIM_TARGET_LIBLOGPROFILER:=$(SIM_TARGET_LIBLOGPROFILER) $(BUILD_DESTDIR)/$(2)/lib/libmono-profiler-log.a) +$(eval SIM_TARGET_SHAREDLIBLOGPROFILER:=$(SIM_TARGET_SHAREDLIBLOGPROFILER) $(BUILD_DESTDIR)/$(2)/tmp-lib/libmono-profiler-log.0.dylib) + +$(BUILD_DESTDIR)/$(2)/tmp-lib/libmono-profiler-log.0.dylib: $(BUILD_DESTDIR)/$(2)/lib/libmono-profiler-log.0.dylib | $(BUILD_DESTDIR)/$(2)/tmp-lib + $(Q) cp $$< $$@ + $(Q) install_name_tool -id @executable_path/libmono-profiler-log.dylib -change $(BUILD_DESTDIR)/$(2)/lib/libmonosgen-2.0.1.dylib @executable_path/libmonosgen-2.0.dylib $$@ + +$(BUILD_DESTDIR)/$(2)/tmp-lib: + $$(Q) mkdir -p $$@ + +endef + +ifdef INCLUDE_IOS +$(eval $(call SimulatorBuildTemplate,i386,simulator86)) +$(eval $(call SimulatorBuildTemplate,x86_64,simulator64)) +endif + +iphonesimulator:: setup-iphonesimulator build-iphonesimulator install-iphonesimulator + +# this needs to be here because the normal usage of this makefile is "make all install", but nothing actually lists the -iphonesimulator targets as dependencies. +ifdef INCLUDE_IOS +install-local:: install-iphonesimulator +endif + +IPHONESIMULATOR_TARGETS = \ + $(IOS_DESTDIR)$(IPHONESIMULATOR_PREFIX)/lib/libmonosgen-2.0.a \ + $(IOS_DESTDIR)$(IPHONESIMULATOR_PREFIX)/lib/libmonosgen-2.0.dylib \ + $(IOS_DESTDIR)$(IPHONESIMULATOR_PREFIX)/lib/libmono-profiler-log.a \ + $(IOS_DESTDIR)$(IPHONESIMULATOR_PREFIX)/lib/libmono-profiler-log.dylib \ + $(IOS_DESTDIR)$(IPHONESIMULATOR_SDK)/Frameworks/Mono.framework/Mono \ + $(IOS_DESTDIR)$(IPHONESIMULATOR_SDK)/Frameworks/Mono.framework/Info.plist \ + +IPHONESIMULATOR_DIRECTORIES = \ + $(IOS_DESTDIR)$(IPHONESIMULATOR_SDK)/Frameworks/Mono.framework \ + $(IOS_DESTDIR)$(IPHONESIMULATOR_PREFIX)/lib + +$(IOS_DESTDIR)$(IPHONESIMULATOR_PREFIX)/lib/libmonosgen-2.0.a: $(SIM_TARGET_LIBMONOSGEN) | $(IOS_DESTDIR)$(IPHONESIMULATOR_PREFIX)/lib + $(Q) lipo $(SIM_TARGET_LIBMONOSGEN) -create -output $@ + +$(IOS_DESTDIR)$(IPHONESIMULATOR_PREFIX)/lib/libmonosgen-2.0.dylib: $(SIM_TARGET_SHAREDMONOSGEN) | $(IOS_DESTDIR)$(IPHONESIMULATOR_PREFIX)/lib + $(Q) lipo $(SIM_TARGET_SHAREDMONOSGEN) -create -output $@ + $(Q) install_name_tool -id @executable_path/libmonosgen-2.0.dylib $@ + +$(IOS_DESTDIR)$(IPHONESIMULATOR_PREFIX)/lib/libmono-profiler-log.a: $(SIM_TARGET_LIBLOGPROFILER) | $(IOS_DESTDIR)$(IPHONESIMULATOR_PREFIX)/lib + $(Q) lipo $(SIM_TARGET_LIBLOGPROFILER) -create -output $@ + +$(IOS_DESTDIR)$(IPHONESIMULATOR_PREFIX)/lib/libmono-profiler-log.dylib: $(SIM_TARGET_SHAREDLIBLOGPROFILER) | $(IOS_DESTDIR)$(IPHONESIMULATOR_PREFIX)/lib + $(Q) lipo $(SIM_TARGET_SHAREDLIBLOGPROFILER) -create -output $@ + +$(IPHONESIMULATOR_DIRECTORIES): + $(Q) mkdir -p $@ + +$(IOS_DESTDIR)$(IPHONESIMULATOR_SDK)/Frameworks/Mono.framework/Mono: $(IOS_DESTDIR)$(IPHONESIMULATOR_PREFIX)/lib/libmonosgen-2.0.dylib | $(IOS_DESTDIR)$(IPHONESIMULATOR_SDK)/Frameworks/Mono.framework + $(Q) cp $< $@ + $(Q) install_name_tool -id @rpath/Mono.framework/Mono $@ + +$(IOS_DESTDIR)$(IPHONESIMULATOR_SDK)/Frameworks/Mono.framework/Info.plist: Mono.framework-Info.plist | $(IOS_DESTDIR)$(IPHONESIMULATOR_SDK)/Frameworks/Mono.framework + $(Q) cp $< $@ + +install-iphonesimulator:: $(IPHONESIMULATOR_TARGETS) + +# +# Watch simulator build +# + +WATCHSIMULATOR_SDK = $(XCODE_DEVELOPER_ROOT)/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk +WATCHSIMULATOR_BIN_PATH = $(XCODE_DEVELOPER_ROOT)/Platforms/WatchSimulator.platform/Developer/usr/bin +WATCHSIMULATOR_CC = $(IOS_CC) + +WATCHSIMULATOR_FLAGS = \ + -isysroot $(WATCHSIMULATOR_SDK) \ + -mwatchos-simulator-version-min=$(MIN_WATCHOS_SDK_VERSION) \ + -arch i386 \ + -O2 \ + -gdwarf-2 \ + -Wl,-application_extension \ + -DMONOTOUCH \ + -DHOST_IOS \ + -DHOST_WATCHOS \ + $(SIMULATOR_BUILD_CFLAGS) \ + +WATCHSIMULATOR_CPPFLAGS = $(WATCHSIMULATOR_FLAGS) +WATCHSIMULATOR_CFLAGS = $(WATCHSIMULATOR_FLAGS) +WATCHSIMULATOR_CXXFLAGS = $(WATCHSIMULATOR_FLAGS) +WATCHSIMULATOR_CONFIGURE_FLAGS = \ + --host=i386-apple-darwin10 \ + --disable-boehm \ + --disable-executables \ + --cache-file=../watchsimulator.config.cache \ + --enable-maintainer-mode \ + --prefix=$(BUILD_DESTDIR)/watchsimulator \ + --with-glib=embedded \ + --with-cooperative-gc=yes \ + --without-ikvm-native \ + --enable-minimal=com,remoting,shared_perfcounters \ + --disable-mcs-build \ + --disable-nls \ + --disable-iconv \ + --disable-shared-handles \ + --disable-visibility-hidden \ + --enable-native-types \ + $(XAMARIN_CONFIGURE_FLAGS) \ + +WATCHSIMULATOR_ACVARS = \ + ac_cv_func_system=no \ + ac_cv_func_pthread_kill=no \ + ac_cv_func_kill=no \ + ac_cv_func_sigaction=no \ + ac_cv_func_fork=no \ + ac_cv_func_execv=no \ + ac_cv_func_execve=no \ + ac_cv_func_execvp=no \ + ac_cv_func_signal=no + +WATCHSIMULATOR_ENVIRONMENT = \ + $(WATCHSIMULATOR_ACVARS) \ + PATH="$(WATCHSIMULATOR_BIN_PATH):$(PATH)" \ + CC="$(WATCHSIMULATOR_CC)" \ + CXX="$(WATCHSIMULATOR_CC)" \ + CPPFLAGS="$(WATCHSIMULATOR_CPPFLAGS)" \ + CFLAGS="$(WATCHSIMULATOR_CFLAGS)" \ + CXXFLAGS="$(WATCHSIMULATOR_CXXFLAGS)" \ + DEVELOPER_DIR=$(XCODE_DEVELOPER_ROOT) \ + +ifdef INCLUDE_WATCH +setup:: setup-watchsimulator +build:: build-watchsimulator +clean-local:: clean-watchsimulator +install-local:: install-watchsimulator + +watchsimulator: build-watchsimulator install-watchsimulator + +.PHONY: watchsimulator +endif + +setup-watchsimulator: .stamp-configure-watchsimulator + +.stamp-configure-watchsimulator: $(MONO_PATH)/configure + $(Q) $(WATCHSIMULATOR_ENVIRONMENT) ./wrap-configure.sh watchsimulator $(abspath $(MONO_PATH)/configure) $(WATCHSIMULATOR_CONFIGURE_FLAGS) + +build-watchsimulator: export DEVELOPER_DIR=$(XCODE_DEVELOPER_ROOT) +build-watchsimulator: export PATH:="$(WATCHSIMULATOR_BIN_PATH):$(PATH)" +build-watchsimulator: .stamp-configure-watchsimulator + $(Q) $(MAKE) -C watchsimulator/eglib all + $(Q) $(MAKE) -C watchsimulator/mono all + $(Q) $(MAKE) -C watchsimulator/support all + $(Q) $(MAKE) -C watchsimulator/eglib install + $(Q) $(MAKE) -C watchsimulator/mono install + +clean-watchsimulator: + $(Q) rm -rf watchsimulator .stamp-configure-watchsimulator watchsimulator.config.cache + +WATCHSIMULATOR_LIBMONOSGEN = $(BUILD_DESTDIR)/watchsimulator/lib/libmonosgen-2.0.a +WATCHSIMULATOR_SHAREDMONOSGEN = $(BUILD_DESTDIR)/watchsimulator/lib/libmonosgen-2.0.dylib +WATCHSIMULATOR_LIBLOGPROFILER = $(BUILD_DESTDIR)/watchsimulator/lib/libmono-profiler-log.a +WATCHSIMULATOR_SHAREDLIBLOGPROFILER = $(BUILD_DESTDIR)/watchsimulator/lib/libmono-profiler-log.0.dylib + +WATCHSIMULATOR_TARGETS = \ + $(IOS_DESTDIR)$(XAMARIN_WATCHSIMULATOR_SDK)/usr/lib/libmonosgen-2.0.a \ + $(IOS_DESTDIR)$(XAMARIN_WATCHSIMULATOR_SDK)/usr/lib/libmonosgen-2.0.dylib \ + $(IOS_DESTDIR)$(XAMARIN_WATCHSIMULATOR_SDK)/usr/lib/libmono-profiler-log.a \ + $(IOS_DESTDIR)$(XAMARIN_WATCHSIMULATOR_SDK)/usr/lib/libmono-profiler-log.dylib \ + $(IOS_DESTDIR)$(XAMARIN_WATCHSIMULATOR_SDK)/Frameworks/Mono.framework/Mono \ + $(IOS_DESTDIR)$(XAMARIN_WATCHSIMULATOR_SDK)/Frameworks/Mono.framework/Info.plist \ + +WATCHSIMULATOR_DIRECTORIES = \ + $(IOS_DESTDIR)$(XAMARIN_WATCHSIMULATOR_SDK)/Frameworks/Mono.framework \ + $(IOS_DESTDIR)$(XAMARIN_WATCHSIMULATOR_SDK)/usr/lib \ + +$(IOS_DESTDIR)$(XAMARIN_WATCHSIMULATOR_SDK)/usr/lib/libmonosgen-2.0.a: $(WATCHSIMULATOR_LIBMONOSGEN) | $(IOS_DESTDIR)$(XAMARIN_WATCHSIMULATOR_SDK)/usr/lib + $(Q) $(WATCHOS_BIN_PATH)/lipo $(WATCHSIMULATOR_LIBMONOSGEN) -create -output $@ + +$(IOS_DESTDIR)$(XAMARIN_WATCHSIMULATOR_SDK)/usr/lib/libmonosgen-2.0.dylib: $(WATCHSIMULATOR_SHAREDMONOSGEN) | $(IOS_DESTDIR)$(XAMARIN_WATCHSIMULATOR_SDK)/usr/lib + $(Q) $(WATCHOS_BIN_PATH)/lipo $(WATCHSIMULATOR_SHAREDMONOSGEN) -create -output $@ + $(Q) $(WATCHOS_BIN_PATH)/install_name_tool -id @executable_path/libmonosgen-2.0.dylib $@ + +$(IOS_DESTDIR)$(XAMARIN_WATCHSIMULATOR_SDK)/usr/lib/libmono-profiler-log.a: $(WATCHSIMULATOR_LIBLOGPROFILER) | $(IOS_DESTDIR)$(XAMARIN_WATCHSIMULATOR_SDK)/usr/lib + $(Q) $(WATCHOS_BIN_PATH)/lipo $(WATCHSIMULATOR_LIBLOGPROFILER) -create -output $@ + +$(IOS_DESTDIR)$(XAMARIN_WATCHSIMULATOR_SDK)/usr/lib/libmono-profiler-log.dylib: $(WATCHSIMULATOR_SHAREDLIBLOGPROFILER) | $(IOS_DESTDIR)$(XAMARIN_WATCHSIMULATOR_SDK)/usr/lib + $(Q) $(WATCHOS_BIN_PATH)/lipo $(WATCHSIMULATOR_SHAREDLIBLOGPROFILER) -create -output $@ + $(Q) $(WATCHOS_BIN_PATH)/install_name_tool -id @executable_path/libmono-profiler-log.dylib -change $(BUILD_DESTDIR)/watchsimulator/lib/libmonosgen-2.0.1.dylib @executable_path/libmonosgen-2.0.dylib $@ + +$(WATCHSIMULATOR_DIRECTORIES): + $(Q) mkdir -p $@ + +$(IOS_DESTDIR)$(XAMARIN_WATCHSIMULATOR_SDK)/Frameworks/Mono.framework/Mono: $(IOS_DESTDIR)$(XAMARIN_WATCHSIMULATOR_SDK)/usr/lib/libmonosgen-2.0.dylib | $(IOS_DESTDIR)$(XAMARIN_WATCHSIMULATOR_SDK)/Frameworks/Mono.framework + $(Q) cp $< $@ + $(Q) $(WATCHOS_BIN_PATH)/install_name_tool -id @rpath/Mono.framework/Mono $@ + +$(IOS_DESTDIR)$(XAMARIN_WATCHSIMULATOR_SDK)/Frameworks/Mono.framework/Info.plist: Mono.framework-watchos.Info.plist | $(IOS_DESTDIR)$(XAMARIN_WATCHSIMULATOR_SDK)/Frameworks/Mono.framework + $(Q) cp $< $@ + +install-watchsimulator: $(WATCHSIMULATOR_TARGETS) + +# +# TV simulator build +# + +TVSIMULATOR_SDK = $(XCODE_DEVELOPER_ROOT)/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk +TVSIMULATOR_BIN_PATH = $(XCODE_DEVELOPER_ROOT)/Platforms/AppleTVSimulator.platform/Developer/usr/bin +TVSIMULATOR_CC = $(IOS_CC) +TVOS_BIN_PATH = $(XCODE_DEVELOPER_ROOT)/Toolchains/XcodeDefault.xctoolchain/usr/bin + +TVSIMULATOR_FLAGS = \ + -isysroot $(TVSIMULATOR_SDK) \ + -mtvos-simulator-version-min=$(MIN_TVOS_SDK_VERSION) \ + -arch x86_64 \ + -O2 \ + -gdwarf-2 \ + -Wl,-application_extension \ + -DMONOTOUCH \ + -DHOST_APPLETVOS \ + -DTARGET_APPLETVOS \ + $(SIMULATOR_BUILD_CFLAGS) + +TVSIMULATOR_CPPFLAGS = $(TVSIMULATOR_FLAGS) +TVSIMULATOR_CFLAGS = $(TVSIMULATOR_FLAGS) +TVSIMULATOR_CXXFLAGS = $(TVSIMULATOR_FLAGS) +TVSIMULATOR_CONFIGURE_FLAGS = \ + --host=x86_64-apple-darwin10 \ + --disable-boehm \ + --disable-executables \ + --cache-file=../tvsimulator.config.cache \ + --enable-maintainer-mode \ + --prefix=$(BUILD_DESTDIR)/tvsimulator \ + --with-glib=embedded \ + --with-cooperative-gc=no \ + --without-ikvm-native \ + --enable-minimal=com,remoting,shared_perfcounters \ + --disable-mcs-build \ + --disable-nls \ + --disable-iconv \ + --disable-shared-handles \ + --disable-visibility-hidden \ + --enable-native-types \ + $(XAMARIN_CONFIGURE_FLAGS) \ + +TVSIMULATOR_ACVARS = \ + ac_cv_func_system=no \ + ac_cv_func_pthread_kill=no \ + ac_cv_func_kill=no \ + ac_cv_func_sigaction=no \ + ac_cv_func_fork=no \ + ac_cv_func_execv=no \ + ac_cv_func_execve=no \ + ac_cv_func_execvp=no \ + ac_cv_func_signal=no + +TVSIMULATOR_ENVIRONMENT = \ + $(TVSIMULATOR_ACVARS) \ + PATH="$(TVSIMULATOR_BIN_PATH):$(PATH)" \ + CC="$(TVSIMULATOR_CC)" \ + CXX="$(TVSIMULATOR_CC)" \ + CPPFLAGS="$(TVSIMULATOR_CPPFLAGS)" \ + CFLAGS="$(TVSIMULATOR_CFLAGS)" \ + CXXFLAGS="$(TVSIMULATOR_CXXFLAGS)" \ + DEVELOPER_DIR=$(XCODE_DEVELOPER_ROOT) \ + +ifdef INCLUDE_TVOS +setup:: setup-tvsimulator +build:: build-tvsimulator +clean-local:: clean-tvsimulator +install-local:: install-tvsimulator + +tvsimulator: build-tvsimulator install-tvsimulator + +.PHONY: tvsimulator +endif + +setup-tvsimulator: .stamp-configure-tvsimulator + +# for now we re-use the watch mono +.stamp-configure-tvsimulator: $(MONO_PATH)/configure + $(Q) $(TVSIMULATOR_ENVIRONMENT) ./wrap-configure.sh tvsimulator $(abspath $(MONO_PATH)/configure) $(TVSIMULATOR_CONFIGURE_FLAGS) + +build-tvsimulator: export DEVELOPER_DIR=$(XCODE_DEVELOPER_ROOT) +build-tvsimulator: export PATH:="$(TVSIMULATOR_BIN_PATH):$(PATH)" +build-tvsimulator: .stamp-configure-tvsimulator + $(Q) $(MAKE) -C tvsimulator/eglib all + $(Q) $(MAKE) -C tvsimulator/mono all + $(Q) $(MAKE) -C tvsimulator/support all + $(Q) $(MAKE) -C tvsimulator/eglib install + $(Q) $(MAKE) -C tvsimulator/mono install + +clean-tvsimulator: + $(Q) rm -rf tvsimulator .stamp-configure-tvsimulator tvsimulator.config.cache + +TVSIMULATOR_LIBMONOSGEN = $(BUILD_DESTDIR)/tvsimulator/lib/libmonosgen-2.0.a +TVSIMULATOR_SHAREDMONOSGEN = $(BUILD_DESTDIR)/tvsimulator/lib/libmonosgen-2.0.dylib +TVSIMULATOR_LIBLOGPROFILER = $(BUILD_DESTDIR)/tvsimulator/lib/libmono-profiler-log.a +TVSIMULATOR_SHAREDLIBLOGPROFILER = $(BUILD_DESTDIR)/tvsimulator/lib/libmono-profiler-log.0.dylib + +TVSIMULATOR_TARGETS = \ + $(IOS_DESTDIR)$(XAMARIN_TVSIMULATOR_SDK)/usr/lib/libmonosgen-2.0.a \ + $(IOS_DESTDIR)$(XAMARIN_TVSIMULATOR_SDK)/usr/lib/libmonosgen-2.0.dylib \ + $(IOS_DESTDIR)$(XAMARIN_TVSIMULATOR_SDK)/usr/lib/libmono-profiler-log.a \ + $(IOS_DESTDIR)$(XAMARIN_TVSIMULATOR_SDK)/usr/lib/libmono-profiler-log.dylib \ + $(IOS_DESTDIR)$(XAMARIN_TVSIMULATOR_SDK)/Frameworks/Mono.framework/Mono \ + $(IOS_DESTDIR)$(XAMARIN_TVSIMULATOR_SDK)/Frameworks/Mono.framework/Info.plist \ + +TVSIMULATOR_DIRECTORIES = \ + $(IOS_DESTDIR)$(XAMARIN_TVSIMULATOR_SDK)/Frameworks/Mono.framework \ + $(IOS_DESTDIR)$(XAMARIN_TVSIMULATOR_SDK)/usr/lib \ + +$(IOS_DESTDIR)$(XAMARIN_TVSIMULATOR_SDK)/usr/lib/libmonosgen-2.0.a: $(TVSIMULATOR_LIBMONOSGEN) | $(IOS_DESTDIR)$(XAMARIN_TVSIMULATOR_SDK)/usr/lib + $(Q) $(TVOS_BIN_PATH)/lipo $(TVSIMULATOR_LIBMONOSGEN) -create -output $@ + +$(IOS_DESTDIR)$(XAMARIN_TVSIMULATOR_SDK)/usr/lib/libmonosgen-2.0.dylib: $(TVSIMULATOR_SHAREDMONOSGEN) | $(IOS_DESTDIR)$(XAMARIN_TVSIMULATOR_SDK)/usr/lib + $(Q) $(TVOS_BIN_PATH)/lipo $(TVSIMULATOR_SHAREDMONOSGEN) -create -output $@ + $(Q) $(TVOS_BIN_PATH)/install_name_tool -id @executable_path/libmonosgen-2.0.dylib $@ + +$(IOS_DESTDIR)$(XAMARIN_TVSIMULATOR_SDK)/usr/lib/libmono-profiler-log.a: $(TVSIMULATOR_LIBLOGPROFILER) | $(IOS_DESTDIR)$(XAMARIN_TVSIMULATOR_SDK)/usr/lib + $(Q) $(TVOS_BIN_PATH)/lipo $(TVSIMULATOR_LIBLOGPROFILER) -create -output $@ + +$(IOS_DESTDIR)$(XAMARIN_TVSIMULATOR_SDK)/usr/lib/libmono-profiler-log.dylib: $(TVSIMULATOR_SHAREDLIBLOGPROFILER) | $(IOS_DESTDIR)$(XAMARIN_TVSIMULATOR_SDK)/usr/lib + $(Q) $(TVOS_BIN_PATH)/lipo $(TVSIMULATOR_SHAREDLIBLOGPROFILER) -create -output $@ + $(Q) $(TVOS_BIN_PATH)/install_name_tool -id @executable_path/libmono-profiler-log.dylib -change $(BUILD_DESTDIR)/tvsimulator/lib/libmonosgen-2.0.1.dylib @executable_path/libmonosgen-2.0.dylib $@ + +$(TVSIMULATOR_DIRECTORIES): + $(Q) mkdir -p $@ + +$(IOS_DESTDIR)$(XAMARIN_TVSIMULATOR_SDK)/Frameworks/Mono.framework/Mono: $(IOS_DESTDIR)$(XAMARIN_TVSIMULATOR_SDK)/usr/lib/libmonosgen-2.0.dylib | $(IOS_DESTDIR)$(XAMARIN_TVSIMULATOR_SDK)/Frameworks/Mono.framework + $(Q) cp $< $@ + $(Q) $(TVOS_BIN_PATH)/install_name_tool -id @rpath/Mono.framework/Mono $@ + +$(IOS_DESTDIR)$(XAMARIN_TVSIMULATOR_SDK)/Frameworks/Mono.framework/Info.plist: Mono.framework-tvos.Info.plist | $(IOS_DESTDIR)$(XAMARIN_TVSIMULATOR_SDK)/Frameworks/Mono.framework + $(Q) cp $< $@ + +install-tvsimulator: $(TVSIMULATOR_TARGETS) + +# +# Device builds +# + +# +# We use --build=i386-apple-darwin10 explicitly here so that even though osx defaults to 64 bit, +# we end up with a sizeof-compatible built (since all current arms are 32b) +# + +PLATFORM_ROOT=$(XCODE_DEVELOPER_ROOT)/Platforms/iPhoneOS.platform +PLATFORM_BIN=$(XCODE_DEVELOPER_ROOT)/Toolchains/XcodeDefault.xctoolchain/usr/bin +PLATFORM_SDK=$(PLATFORM_ROOT)/Developer/SDKs/iPhoneOS${IOS_SDK_VERSION}.sdk/ + +# usage $(call PlatformBuildTemplate (armv7,target7,,,)) + +define PlatformBuildTemplate + +# $(4) contains the architecture specific configure flags +# $(5) is unused +# $(6) contains min ios version + +# Avoid passing the -arch flag twice in CFLAGS since it disables ccache +$(eval $(2)_BASE_CPPFLAGS=-DSMALL_CONFIG -DDISABLE_POLICY_EVIDENCE=1 -DDISABLE_PROCESS_HANDLING=1 -D_XOPEN_SOURCE -DMONOTOUCH=1 -DHOST_IOS -DHAVE_LARGE_FILE_SUPPORT=1 -Wl,-application_extension -miphoneos-version-min=$(6) -isysroot $(PLATFORM_SDK)) +$(eval $(2)_CPPFLAGS=$($(2)_BASE_CPPFLAGS) -arch $(1)) +$(eval $(2)_CFLAGS=-O2 -gdwarf-2 $($(2)_BASE_CPPFLAGS) $(DEVICE_BUILD_CFLAGS) $(IOS_BITCODE_CFLAGS)) +$(eval $(2)_CXXFLAGS=$($(2)_CPPFLAGS) $(IOS_BITCODE_CXXFLAGS)) +$(eval $(2)_LDFLAGS=-arch $(1) $(IOS_BITCODE_LDFLAGS)) +$(eval $(2)_CONFIGURE_FLAGS=--build=i386-apple-darwin10 \ + $(4) \ + --enable-maintainer-mode \ + --cache-file=../$(2).config.cache \ + --prefix=$(BUILD_DESTDIR)/$(2) \ + --with-monotouch \ + --with-lazy-gc-thread-creation=yes \ + --disable-mcs-build \ + --enable-minimal=ssa,com,jit,reflection_emit_save,reflection_emit,portability,assembly_remapping,attach,verifier,full_messages,appdomains,security,sgen_remset,sgen_marksweep_par,sgen_marksweep_fixed,sgen_marksweep_fixed_par,sgen_copying,logging,remoting,shared_perfcounters \ + --without-ikvm-native \ + --with-tls=pthread \ + --without-sigaltstack \ + --with-lazy-gc-thread-creation=yes \ + --enable-icall-export \ + --disable-icall-tables \ + --disable-executables \ + --disable-nls \ + --disable-iconv \ + --disable-shared-handles \ + --disable-visibility-hidden \ + --disable-boehm \ + --enable-native-types \ + --enable-gsharedvt \ + --enable-dtrace=no \ + $(IOS_BITCODE_CONFIGURE_FLAGS) \ + $(XAMARIN_CONFIGURE_FLAGS) \ + ) + +$(eval $(2)_ACVARS= mono_cv_uscore=yes \ + mono_cv_sizeof_sunpath=104 \ + ac_cv_func_posix_getpwuid_r=yes \ + ac_cv_func_finite=no \ + ac_cv_c_bigendian=no \ + ac_cv_header_sys_user_h=no \ + ac_cv_header_curses_h=no \ + ac_cv_header_localcharset_h=no \ + ac_cv_func_getpwuid_r=no) + +$(eval $(2)_CONFIGURE_ENVIRONMENT = \ + PATH="$(PLATFORM$(3)_BIN):$(PATH)" \ + CPPFLAGS="$($(2)_CPPFLAGS)" \ + CFLAGS="$($(2)_CFLAGS)" \ + CXXFLAGS="$($(2)_CXXFLAGS)" \ + LDFLAGS="$($(2)_LDFLAGS)" \ + CC="$(DEVICE_CC)" \ + CXX="$(DEVICE_CXX)") + +.PHONY: $(2) + +$(2): build-$(2) + +setup:: setup-$(2) +build:: build-$(2) +clean-local:: clean-$(2) + +setup-$(2): .stamp-configure-$(2) + +.stamp-configure-$(2): $(MONO_PATH)/configure + $(Q) $($(2)_ACVARS) $($(2)_CONFIGURE_ENVIRONMENT) ./wrap-configure.sh $(2) $(abspath $(MONO_PATH)/configure) $($(2)_CONFIGURE_FLAGS) + +build-$(2): .stamp-configure-$(2) + PATH="$(PLATFORM_BIN):$(PATH)" $(MAKE) -C $(2)/eglib + PATH="$(PLATFORM_BIN):$(PATH)" $(MAKE) -C $(2)/mono + PATH="$(PLATFORM_BIN):$(PATH)" $(MAKE) -C $(2)/eglib install + PATH="$(PLATFORM_BIN):$(PATH)" $(MAKE) -C $(2)/mono install + +clean-$(2): + -rm -rf $(2) .stamp-configure-$(2) $(2).config.cache + +setup-iphoneos:: setup-$(2) +build-iphoneos:: build-$(2) +clean-iphoneos:: clean-$(2) + +build-ios: build-iphoneos +clean-ios: clean-iphoneos +setup-ios: setup-iphoneos +install-ios: install-iphoneos + +$(eval TARGET_LIBMONOSGEN:=$(TARGET_LIBMONOSGEN) $(BUILD_DESTDIR)/$(2)/lib/libmonosgen-2.0.a) +$(eval TARGET_SHAREDMONOSGEN:=$(TARGET_SHAREDMONOSGEN) $(BUILD_DESTDIR)/$(2)/tmp-lib/libmonosgen-2.0.dylib) +$(eval TARGET_LIBLOGPROFILER:=$(TARGET_LIBLOGPROFILER) $(BUILD_DESTDIR)/$(2)/lib/libmono-profiler-log-static.a) +$(eval TARGET_SHAREDLIBLOGPROFILER:=$(TARGET_SHAREDLIBLOGPROFILER) $(BUILD_DESTDIR)/$(2)/tmp-lib/libmono-profiler-log.0.dylib) +$(eval TARGET_MONOFRAMEWORK:=$(TARGET_MONOFRAMEWORK) $(BUILD_DESTDIR)/$(2)/tmp-lib/Mono) + +$(BUILD_DESTDIR)/$(2)/tmp-lib: + $$(Q) mkdir -p $$@ + +# We have the following requirements: +# +# * libmonos*.a: must have miphone-version-min=5.1.1 (the earliest iOS version we support) - although it's 7.0 for the ARM64 slice. +# * libmonosgen-2.0.dylib: must have miphone-version-min=7.0 (otherwise iOS 9 won't load it; see bug #34267). +# * libmono-profiler-log.dylib: same as libmonosgen-2.0.dylib +# * Mono.framework/Mono: must have miphone-version-min=8.0, otherwise the native linker won't add a LC_ENCRYPTION_INFO load command, +# which the App Store requires (see bug #32820). This is not a problem for libmonosgen-2.0.dylib, because that library is only +# used for incremental builds, which are not published). +# +# And we don't want to build Mono 3 times for each architecture... +# +# So what we do is to take the static library (libmonosgen-2.0.a), extract all the object files, and re-link +# them the required times according to how many versions we need. +# +$(BUILD_DESTDIR)/$(2)/tmp-lib/Mono: $(BUILD_DESTDIR)/$(2)/lib/libmonosgen-2.0.a | $(BUILD_DESTDIR)/$(2)/tmp-lib + $$(Q) rm -Rf $$@.tmpdir + $$(Q) mkdir -p $$@.tmpdir + $$(Q) cd $$@.tmpdir && ar -x $$< + $$(Q) $$(IOS_CC) -arch $(1) -dynamiclib -o $$@ $$@.tmpdir/*.o -liconv -O2 -Wl,-application_extension -miphoneos-version-min=8.0 -isysroot $(PLATFORM_SDK) -install_name @rpath/Mono.framework/Mono -compatibility_version 2 -current_version 2.0 -framework CoreFoundation -lobjc $(IOS_BITCODE_LDFLAGS) -Wl,-single_module + $$(Q) rm -Rf $$@.tmpdir + +$(BUILD_DESTDIR)/$(2)/tmp-lib/libmonosgen-2.0.dylib: $(BUILD_DESTDIR)/$(2)/lib/libmonosgen-2.0.a | $(BUILD_DESTDIR)/$(2)/tmp-lib + $$(Q) rm -Rf $$@.tmpdir + $$(Q) mkdir -p $$@.tmpdir + $$(Q) cd $$@.tmpdir && ar -x $$< + $$(Q) $$(IOS_CC) -arch $(1) -dynamiclib -o $$@ $$@.tmpdir/*.o -liconv -O2 -Wl,-application_extension -miphoneos-version-min=7.0 -isysroot $(PLATFORM_SDK) -install_name @executable_path/libmonosgen-2.0.dylib -compatibility_version 2 -current_version 2.0 -framework CoreFoundation -lobjc $(IOS_BITCODE_LDFLAGS) -Wl,-single_module + $$(Q) rm -Rf $$@.tmpdir + +$(BUILD_DESTDIR)/$(2)/tmp-lib/libmono-profiler-log.0.dylib: $(BUILD_DESTDIR)/$(2)/lib/libmono-profiler-log.a $(BUILD_DESTDIR)/$(2)/tmp-lib/libmonosgen-2.0.dylib | $(BUILD_DESTDIR)/$(2)/tmp-lib + $$(Q) rm -Rf $$@.tmpdir + $$(Q) mkdir -p $$@.tmpdir + $$(Q) cd $$@.tmpdir && ar -x $$< + $$(Q) $$(IOS_CC) -arch $(1) -dynamiclib -o $$@ $$@.tmpdir/*.o -liconv -O2 -Wl,-application_extension -miphoneos-version-min=7.0 -isysroot $(PLATFORM_SDK) -install_name @executable_path/libmono-profiler-log.dylib -compatibility_version 2 -current_version 2.0 -framework CoreFoundation -lobjc -Wl,-single_module -L$(BUILD_DESTDIR)/$(2)/tmp-lib -lmonosgen-2.0 -lz + $$(Q) rm -Rf $$@.tmpdir + +endef + +ARM_ARCH_CONFIGURE_FLAGS=--host=arm-apple-darwin10 --disable-boehm +ARM64_ARCH_CONFIGURE_FLAGS=--host=aarch64-apple-darwin10 --disable-boehm + +ifdef INCLUDE_IOS +ifndef DEVICE_RUNTIMES +DEVICE_RUNTIMES="armv7 armv7s arm64 " +endif +endif + +# Note the spaces in findstring arguments, this is needed to distinguish between armv7 and armv7s for example +ifneq ($(findstring armv7 , $(DEVICE_RUNTIMES) ),) +$(eval $(call PlatformBuildTemplate,armv7,target7,,$(ARM_ARCH_CONFIGURE_FLAGS),,$(MIN_IOS_SDK_VERSION))) +endif + +ifneq ($(findstring armv7s , $(DEVICE_RUNTIMES) ),) +$(eval $(call PlatformBuildTemplate,armv7s,target7s,,$(ARM_ARCH_CONFIGURE_FLAGS),,$(MIN_IOS_SDK_VERSION))) +endif + +ifneq ($(findstring arm64 , $(DEVICE_RUNTIMES) ),) +$(eval $(call PlatformBuildTemplate,arm64,target64,,$(ARM64_ARCH_CONFIGURE_FLAGS),,7.0)) +endif + +iphoneos:: setup-iphoneos build-iphoneos install-iphoneos +device:: iphoneos +clean-device: clean-iphoneos + +# this needs to be here because the normal usage of this makefile is "make all install", but nothing actually lists the -iphoneos targets as dependencies. +ifdef INCLUDE_IOS +install-local:: install-iphoneos +endif + +IPHONEOS_TARGETS = \ + $(IOS_DESTDIR)$(IPHONEOS_PREFIX)/lib/libmonosgen-2.0.a \ + $(IOS_DESTDIR)$(IPHONEOS_PREFIX)/lib/libmonosgen-2.0.dylib \ + $(IOS_DESTDIR)$(IPHONEOS_PREFIX)/lib/libmono-profiler-log.a \ + $(IOS_DESTDIR)$(IPHONEOS_PREFIX)/lib/libmono-profiler-log.dylib \ + $(IOS_DESTDIR)$(IPHONEOS_SDK)/Frameworks/Mono.framework/Mono \ + $(IOS_DESTDIR)$(IPHONEOS_SDK)/Frameworks/Mono.framework/Info.plist \ + +IPHONEOS_DIRECTORIES = \ + $(IOS_DESTDIR)$(IPHONEOS_SDK)/Frameworks/Mono.framework \ + $(IOS_DESTDIR)$(IPHONEOS_PREFIX)/lib \ + +$(IOS_DESTDIR)$(IPHONEOS_PREFIX)/lib/libmonosgen-2.0.a: $(TARGET_LIBMONOSGEN) | $(IOS_DESTDIR)$(IPHONEOS_PREFIX)/lib + $(Q) lipo $(TARGET_LIBMONOSGEN) -create -output $@ + +$(IOS_DESTDIR)$(IPHONEOS_PREFIX)/lib/libmonosgen-2.0.dylib: $(TARGET_SHAREDMONOSGEN) | $(IOS_DESTDIR)$(IPHONEOS_PREFIX)/lib + $(Q) lipo $(TARGET_SHAREDMONOSGEN) -create -output $@ + $(Q) install_name_tool -id @executable_path/libmonosgen-2.0.dylib $@ + +$(IOS_DESTDIR)$(IPHONEOS_PREFIX)/lib/libmono-profiler-log.a: $(TARGET_LIBLOGPROFILER) | $(IOS_DESTDIR)$(IPHONEOS_PREFIX)/lib + $(Q) lipo $(TARGET_LIBLOGPROFILER) -create -output $@ + +$(IOS_DESTDIR)$(IPHONEOS_PREFIX)/lib/libmono-profiler-log.dylib: $(TARGET_SHAREDLIBLOGPROFILER) | $(IOS_DESTDIR)$(IPHONEOS_PREFIX)/lib + $(Q) lipo $(TARGET_SHAREDLIBLOGPROFILER) -create -output $@ + +$(IPHONEOS_DIRECTORIES): + $(Q) mkdir -p $@ + +$(IOS_DESTDIR)$(IPHONEOS_SDK)/Frameworks/Mono.framework/Mono: $(TARGET_MONOFRAMEWORK) | $(IOS_DESTDIR)$(IPHONEOS_SDK)/Frameworks/Mono.framework + $(Q) lipo $(TARGET_MONOFRAMEWORK) -create -output $@ + +$(IOS_DESTDIR)$(IPHONEOS_SDK)/Frameworks/Mono.framework/Info.plist: Mono.framework-Info.plist | $(IOS_DESTDIR)$(IPHONEOS_SDK)/Frameworks/Mono.framework + $(Q) cp $< $@ + +install-iphoneos:: $(IPHONEOS_TARGETS) + +# +# Watch device build +# + +WATCHOS_SDK = $(XCODE_DEVELOPER_ROOT)/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk +WATCHOS_BIN_PATH = $(XCODE_DEVELOPER_ROOT)/Toolchains/XcodeDefault.xctoolchain/usr/bin +WATCHOS_CC = $(IOS_CC) + +WATCHOS_FLAGS = \ + -isysroot $(WATCHOS_SDK) \ + -mwatchos-version-min=$(MIN_WATCHOS_SDK_VERSION) \ + -arch armv7k \ + -O2 \ + -gdwarf-2 \ + -Wl,-application_extension \ + -fembed-bitcode \ + -fno-gnu-inline-asm \ + -DMONOTOUCH=1 \ + -DHOST_IOS \ + -DHOST_WATCHOS \ + -DSMALL_CONFIG \ + -DDISABLE_POLICY_EVIDENCE=1 \ + -DDISABLE_PROCESS_HANDLING=1 \ + -D_XOPEN_SOURCE \ + -DHAVE_LARGE_FILE_SUPPORT=1 \ + $(DEVICE_BUILD_CFLAGS) \ + +WATCHOS_CPPFLAGS = $(WATCHOS_FLAGS) +WATCHOS_CFLAGS = $(WATCHOS_FLAGS) +WATCHOS_CXXFLAGS = $(WATCHOS_FLAGS) +WATCHOS_LDFLAGS = -arch armv7k -Wl,-bitcode_bundle -framework CoreFoundation -lobjc +WATCHOS_CONFIGURE_FLAGS = \ + --build=i386-apple-darwin10 \ + --host=armv7k-apple-darwin10 \ + --enable-maintainer-mode \ + --cache-file=../targetwatch.config.cache \ + --prefix=$(BUILD_DESTDIR)/targetwatch \ + --with-cooperative-gc=yes \ + --with-monotouch \ + --with-lazy-gc-thread-creation=yes \ + --disable-mcs-build \ + --disable-boehm \ + --enable-minimal=ssa,com,jit,reflection_emit_save,reflection_emit,portability,assembly_remapping,attach,verifier,full_messages,appdomains,security,sgen_remset,sgen_marksweep_par,sgen_marksweep_fixed,sgen_marksweep_fixed_par,sgen_copying,logging,remoting,shared_perfcounters \ + --without-ikvm-native \ + --with-tls=pthread \ + --without-sigaltstack \ + --with-lazy-gc-thread-creation=yes \ + --enable-icall-export \ + --disable-icall-tables \ + --disable-executables \ + --disable-nls \ + --disable-iconv \ + --disable-shared-handles \ + --disable-visibility-hidden \ + --enable-native-types \ + --enable-gsharedvt \ + $(XAMARIN_CONFIGURE_FLAGS) \ + --with-bitcode=yes \ + +WATCHOS_ACVARS = \ + mono_cv_uscore=yes \ + mono_cv_sizeof_sunpath=104 \ + ac_cv_func_posix_getpwuid_r=yes \ + ac_cv_func_finite=no \ + ac_cv_c_bigendian=no \ + ac_cv_header_sys_user_h=no \ + ac_cv_header_curses_h=no \ + ac_cv_header_localcharset_h=no \ + ac_cv_func_getpwuid_r=no \ + ac_cv_func_system=no \ + ac_cv_func_pthread_kill=no \ + ac_cv_func_kill=no \ + ac_cv_func_sigaction=no \ + ac_cv_func_fork=no \ + ac_cv_func_execv=no \ + ac_cv_func_execve=no \ + ac_cv_func_execvp=no \ + ac_cv_func_signal=no + +WATCHOS_ENVIRONMENT = \ + $(WATCHOS_ACVARS) \ + PATH="$(WATCHOS_BIN_PATH):$(PATH)" \ + CFLAGS="$(WATCHOS_CFLAGS)" \ + CPPFLAGS="$(WATCHOS_CPPFLAGS)" \ + CXXFLAGS="$(WATCHOS_CXXFLAGS)" \ + LDFLAGS="$(WATCHOS_LDFLAGS)" \ + CC="$(WATCHOS_CC)" \ + CXX="$(WATCHOS_CC)" \ + DEVELOPER_DIR=$(XCODE_DEVELOPER_ROOT) \ + +ifdef INCLUDE_WATCH +setup:: setup-targetwatch +build:: build-targetwatch +clean-local:: clean-targetwatch +install-local:: install-watchos + +targetwatch: build-targetwatch install-watchos +watchos:: targetwatch + +.PHONY: targetwatch +endif + +setup-targetwatch: .stamp-configure-targetwatch + +.stamp-configure-targetwatch: $(MONO_PATH)/configure + $(Q) $(WATCHOS_ENVIRONMENT) ./wrap-configure.sh targetwatch $(abspath $(MONO_PATH)/configure) $(WATCHOS_CONFIGURE_FLAGS) + +build-targetwatch: export DEVELOPER_DIR=$(XCODE_DEVELOPER_ROOT) +build-targetwatch: export PATH:="$(WATCHOS_BIN_PATH):$(PATH)" +build-targetwatch: .stamp-configure-targetwatch + $(Q) $(MAKE) -C targetwatch/eglib + $(Q) $(MAKE) -C targetwatch/mono + $(Q) $(MAKE) -C targetwatch/eglib install + $(Q) $(MAKE) -C targetwatch/mono install + +clean-targetwatch: + $(Q) rm -rf targetwatch .stamp-configure-targetwatch targetwatch.config.cache + +setup-watchos: setup-targetwatch +build-watchos: build-targetwatch +clean-watchos: clean-targetwatch + +WATCHOS_TARGET_LIBMONOSGEN = $(BUILD_DESTDIR)/targetwatch/lib/libmonosgen-2.0.a +WATCHOS_TARGET_SHAREDMONOSGEN = $(BUILD_DESTDIR)/targetwatch/lib/libmonosgen-2.0.dylib +WATCHOS_TARGET_LIBLOGPROFILER = $(BUILD_DESTDIR)/targetwatch/lib/libmono-profiler-log.a +WATCHOS_TARGET_SHAREDLIBLOGPROFILER = $(BUILD_DESTDIR)/targetwatch/lib/libmono-profiler-log.0.dylib + +device:: watchos + +WATCHOS_TARGETS = \ + $(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/usr/lib/libmonosgen-2.0.a \ + $(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/usr/lib/libmonosgen-2.0.dylib \ + $(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/usr/lib/libmono-profiler-log.a \ + $(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/usr/lib/libmono-profiler-log.dylib \ + $(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/Frameworks/Mono.framework/Mono \ + $(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/Frameworks/Mono.framework/Info.plist \ + +WATCHOS_DIRECTORIES = \ + $(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/Frameworks/Mono.framework \ + $(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/usr/lib \ + +$(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/usr/lib/libmonosgen-2.0.a: $(WATCHOS_TARGET_LIBMONOSGEN) | $(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/usr/lib + $(Q) $(WATCHOS_BIN_PATH)/lipo $(WATCHOS_TARGET_LIBMONOSGEN) -create -output $@ + +$(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/usr/lib/libmonosgen-2.0.dylib: $(WATCHOS_TARGET_SHAREDMONOSGEN) | $(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/usr/lib + $(Q) $(WATCHOS_BIN_PATH)/lipo $(WATCHOS_TARGET_SHAREDMONOSGEN) -create -output $@ + $(Q) $(WATCHOS_BIN_PATH)/install_name_tool -id @executable_path/libmonosgen-2.0.dylib $@ + +$(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/usr/lib/libmono-profiler-log.a: $(WATCHOS_TARGET_LIBLOGPROFILER) | $(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/usr/lib + $(Q) $(WATCHOS_BIN_PATH)/lipo $(WATCHOS_TARGET_LIBLOGPROFILER) -create -output $@ + +$(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/usr/lib/libmono-profiler-log.dylib: $(WATCHOS_TARGET_SHAREDLIBLOGPROFILER) | $(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/usr/lib + $(Q) lipo $(WATCHOS_TARGET_SHAREDLIBLOGPROFILER) -create -output $@ + $(Q) $(WATCHOS_BIN_PATH)/install_name_tool -id @executable_path/libmono-profiler-log.dylib -change $(BUILD_DESTDIR)/targetwatch/lib/libmonosgen-2.0.1.dylib @executable_path/libmonosgen-2.0.dylib $@ + +$(WATCHOS_DIRECTORIES): + $(Q) mkdir -p $@ + +$(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/Frameworks/Mono.framework/Mono: $(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/usr/lib/libmonosgen-2.0.dylib | $(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/Frameworks/Mono.framework + $(Q) cp $< $@ + $(Q) $(WATCHOS_BIN_PATH)/install_name_tool -id @rpath/Mono.framework/Mono $@ + +$(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/Frameworks/Mono.framework/Info.plist: Mono.framework-watchos.Info.plist | $(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/Frameworks/Mono.framework + $(Q) cp $< $@ + +install-watchos: $(WATCHOS_TARGETS) + +# +# TV device build +# + +TVOS_SDK = $(XCODE_DEVELOPER_ROOT)/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk +TVOS_BIN_PATH = $(XCODE_DEVELOPER_ROOT)/Toolchains/XcodeDefault.xctoolchain/usr/bin +TVOS_CC = $(IOS_CC) + +TVOS_FLAGS = \ + -isysroot $(TVOS_SDK) \ + -mtvos-version-min=$(MIN_TVOS_SDK_VERSION) \ + -arch arm64 \ + -O2 \ + -gdwarf-2 \ + -Wl,-application_extension \ + -fembed-bitcode \ + -fno-gnu-inline-asm \ + -DMONOTOUCH=1 \ + -DHOST_APPLETVOS \ + -DTARGET_APPLETVOS \ + -DSMALL_CONFIG \ + -DDISABLE_PROCESS_HANDLING=1 \ + -DDISABLE_POLICY_EVIDENCE=1 \ + -D_XOPEN_SOURCE \ + -DHAVE_LARGE_FILE_SUPPORT=1 \ + $(BITCODE_CFLAGS) \ + $(DEVICE_BUILD_CFLAGS) \ + +TVOS_CPPFLAGS = $(TVOS_FLAGS) +TVOS_CFLAGS = $(TVOS_FLAGS) $(DEVICE_BUILD_CFLAGS) +TVOS_CXXFLAGS = $(TVOS_FLAGS) +TVOS_LDFLAGS = -arch arm64 -Wl,-bitcode_bundle -framework CoreFoundation -lobjc $(BITCODE_LDFLAGS) +TVOS_CONFIGURE_FLAGS = \ + --build=x86_64-apple-darwin10 \ + --host=aarch64-apple-darwin10 \ + --enable-maintainer-mode \ + --cache-file=../targettv.config.cache \ + --prefix=$(BUILD_DESTDIR)/targettv \ + --with-cooperative-gc=no \ + --with-monotouch \ + --with-lazy-gc-thread-creation=yes \ + --disable-mcs-build \ + --disable-boehm \ + --enable-minimal=ssa,com,jit,reflection_emit_save,reflection_emit,portability,assembly_remapping,attach,verifier,full_messages,appdomains,security,sgen_remset,sgen_marksweep_par,sgen_marksweep_fixed,sgen_marksweep_fixed_par,sgen_copying,logging,remoting,shared_perfcounters \ + --without-ikvm-native \ + --with-tls=pthread \ + --without-sigaltstack \ + --with-lazy-gc-thread-creation=yes \ + --enable-icall-export \ + --disable-icall-tables \ + --disable-executables \ + --disable-nls \ + --disable-iconv \ + --disable-shared-handles \ + --disable-visibility-hidden \ + --enable-native-types \ + --enable-gsharedvt \ + --enable-extension-module \ + --enable-dtrace=no \ + $(BITCODE_CONFIGURE_FLAGS) \ + +# explicitly disable dtrace, since it requires inline assembly, which is disabled on AppleTV (and mono's configure.ac doesn't know that (yet at least)) + +TVOS_ACVARS = \ + mono_cv_uscore=yes \ + mono_cv_sizeof_sunpath=104 \ + ac_cv_func_posix_getpwuid_r=yes \ + ac_cv_func_finite=no \ + ac_cv_c_bigendian=no \ + ac_cv_header_sys_user_h=no \ + ac_cv_header_curses_h=no \ + ac_cv_header_localcharset_h=no \ + ac_cv_func_getpwuid_r=no \ + ac_cv_func_system=no \ + ac_cv_func_pthread_kill=no \ + ac_cv_func_kill=no \ + ac_cv_func_sigaction=no \ + ac_cv_func_fork=no \ + ac_cv_func_execv=no \ + ac_cv_func_execve=no \ + ac_cv_func_execvp=no \ + ac_cv_func_signal=no + +TVOS_ENVIRONMENT = \ + $(TVOS_ACVARS) \ + PATH="$(TVOS_BIN_PATH):$(PATH)" \ + CFLAGS="$(TVOS_CFLAGS)" \ + CPPFLAGS="$(TVOS_CPPFLAGS)" \ + CXXFLAGS="$(TVOS_CXXFLAGS)" \ + LDFLAGS="$(TVOS_LDFLAGS)" \ + CC="$(TVOS_CC)" \ + CXX="$(TVOS_CC)" \ + DEVELOPER_DIR=$(XCODE_DEVELOPER_ROOT) \ + +ifdef INCLUDE_TVOS +setup:: setup-targettv +build:: build-targettv +clean-local:: clean-targettv +install-local:: install-tvos + +targettv: build-targettv install-tvos +tvos:: targettv + +.PHONY: targettv +endif + +setup-targettv: .stamp-configure-targettv + +.stamp-configure-targettv: $(MONO_PATH)/configure + $(Q) $(TVOS_ENVIRONMENT) ./wrap-configure.sh targettv $(abspath $(MONO_PATH)/configure) $(TVOS_CONFIGURE_FLAGS) + +build-targettv: export DEVELOPER_DIR=$(XCODE_DEVELOPER_ROOT) +build-targettv: export PATH:="$(TVOS_BIN_PATH):$(PATH)" +build-targettv: .stamp-configure-targettv + $(Q) $(MAKE) -C targettv/eglib + $(Q) $(MAKE) -C targettv/mono + $(Q) $(MAKE) -C targettv/eglib install + $(Q) $(MAKE) -C targettv/mono install + +clean-targettv: + $(Q) rm -rf targettv .stamp-configure-targettv targettv.config.cache + +setup-tvos: setup-targettv +build-tvos: build-targettv +clean-tvos: clean-targettv + +TVOS_TARGET_LIBMONOSGEN = $(BUILD_DESTDIR)/targettv/lib/libmonosgen-2.0.a +TVOS_TARGET_SHAREDMONOSGEN = $(BUILD_DESTDIR)/targettv/lib/libmonosgen-2.0.dylib +TVOS_TARGET_LIBLOGPROFILER = $(BUILD_DESTDIR)/targettv/lib/libmono-profiler-log.a +TVOS_TARGET_SHAREDLIBLOGPROFILER = $(BUILD_DESTDIR)/targettv/lib/libmono-profiler-log.0.dylib + +device:: tvos + +TVOS_TARGETS = \ + $(IOS_DESTDIR)$(XAMARIN_TVOS_SDK)/usr/lib/libmonosgen-2.0.a \ + $(IOS_DESTDIR)$(XAMARIN_TVOS_SDK)/usr/lib/libmonosgen-2.0.dylib \ + $(IOS_DESTDIR)$(XAMARIN_TVOS_SDK)/usr/lib/libmono-profiler-log.a \ + $(IOS_DESTDIR)$(XAMARIN_TVOS_SDK)/usr/lib/libmono-profiler-log.dylib \ + $(IOS_DESTDIR)$(XAMARIN_TVOS_SDK)/Frameworks/Mono.framework/Mono \ + $(IOS_DESTDIR)$(XAMARIN_TVOS_SDK)/Frameworks/Mono.framework/Info.plist \ + +TVOS_DIRECTORIES = \ + $(IOS_DESTDIR)$(XAMARIN_TVOS_SDK)/Frameworks/Mono.framework \ + $(IOS_DESTDIR)$(XAMARIN_TVOS_SDK)/usr/lib \ + +$(IOS_DESTDIR)$(XAMARIN_TVOS_SDK)/usr/lib/libmonosgen-2.0.a: $(TVOS_TARGET_LIBMONOSGEN) | $(IOS_DESTDIR)$(XAMARIN_TVOS_SDK)/usr/lib + $(Q) $(TVOS_BIN_PATH)/lipo $(TVOS_TARGET_LIBMONOSGEN) -create -output $@ + +$(IOS_DESTDIR)$(XAMARIN_TVOS_SDK)/usr/lib/libmonosgen-2.0.dylib: $(TVOS_TARGET_SHAREDMONOSGEN) | $(IOS_DESTDIR)$(XAMARIN_TVOS_SDK)/usr/lib + $(Q) $(TVOS_BIN_PATH)/lipo $(TVOS_TARGET_SHAREDMONOSGEN) -create -output $@ + $(Q) $(TVOS_BIN_PATH)/install_name_tool -id @executable_path/libmonosgen-2.0.dylib $@ + +$(IOS_DESTDIR)$(XAMARIN_TVOS_SDK)/usr/lib/libmono-profiler-log.a: $(TVOS_TARGET_LIBLOGPROFILER) | $(IOS_DESTDIR)$(XAMARIN_TVOS_SDK)/usr/lib + $(Q) $(TVOS_BIN_PATH)/lipo $(TVOS_TARGET_LIBLOGPROFILER) -create -output $@ + +$(IOS_DESTDIR)$(XAMARIN_TVOS_SDK)/usr/lib/libmono-profiler-log.dylib: $(TVOS_TARGET_SHAREDLIBLOGPROFILER) | $(IOS_DESTDIR)$(XAMARIN_TVOS_SDK)/usr/lib + $(Q) lipo $(TVOS_TARGET_SHAREDLIBLOGPROFILER) -create -output $@ + $(Q) $(TVOS_BIN_PATH)/install_name_tool -id @executable_path/libmono-profiler-log.dylib -change $(BUILD_DESTDIR)/targettv/lib/libmonosgen-2.0.1.dylib @executable_path/libmonosgen-2.0.dylib $@ + +$(TVOS_DIRECTORIES): + $(Q) mkdir -p $@ + +$(IOS_DESTDIR)$(XAMARIN_TVOS_SDK)/Frameworks/Mono.framework/Mono: $(IOS_DESTDIR)$(XAMARIN_TVOS_SDK)/usr/lib/libmonosgen-2.0.dylib | $(IOS_DESTDIR)$(XAMARIN_TVOS_SDK)/Frameworks/Mono.framework + $(Q) cp $< $@ + $(Q) $(TVOS_BIN_PATH)/install_name_tool -id @rpath/Mono.framework/Mono $@ + +$(IOS_DESTDIR)$(XAMARIN_TVOS_SDK)/Frameworks/Mono.framework/Info.plist: Mono.framework-tvos.Info.plist | $(IOS_DESTDIR)$(XAMARIN_TVOS_SDK)/Frameworks/Mono.framework + $(Q) cp $< $@ + +install-tvos: $(TVOS_TARGETS) + + +# +# this is the cross aot version of mono. runs on x86 but the jit/aot spits out arm. +# +# There are two versions of the cross compiler, a 32 bit version targeting arm, and a 64 +# bit version targeting arm64. +# + +# +# we need to compile the cross build against llvm so we need to configure/build that first +# +cross:: build-llvm +cross64:: build-llvm64 + +setup:: setup-llvm setup-llvm64 +clean-local:: clean-llvm clean-llvm64 + +setup-llvm: .stamp-configure-llvm +setup-llvm64: .stamp-configure-llvm64 + +LLVM_BASE_CONFIGURE_FLAGS=--enable-libcpp --enable-optimized --enable-assertions=no --disable-jit --disable-docs --disable-doxygen +LLVM_CXXFLAGS=$(CCACHE_CXXFLAGS) + +# This is used just for linking with the 32 bit cross compiler +# FIXME: Avoid building the libs not needed by mono +.stamp-configure-llvm: $(LLVM_PATH)/configure + @mkdir -p llvm/ + @echo "Configuring llvm" + @cd llvm && \ + $(abspath $(LLVM_PATH)/configure) --prefix=$$PWD/usr --build=i386-apple-darwin10.7 --enable-targets="arm" $(LLVM_BASE_CONFIGURE_FLAGS) --cache-file=../llvm.config.cache CC="$(CCACHE)clang" CXX="$(CCACHE)clang++" CXXFLAGS="$(LLVM_CXXFLAGS)" > $@.log 2>&1 || (echo "Configuring llvm failed:" && cat $@.log | sed "s/^/ /" && exit 1) + $(Q) @touch $@ + @echo Configured llvm + +.stamp-configure-llvm64: $(LLVM_PATH)/configure + @mkdir -p llvm64/ + @echo "Configuring llvm64" + @cd llvm64 && \ + $(abspath $(LLVM_PATH)/configure) --prefix=$$PWD/usr --enable-targets="arm arm64" $(LLVM_BASE_CONFIGURE_FLAGS) --cache-file=../llvm64.config.cache CC="$(CCACHE)clang" CXX="$(CCACHE)clang++" CXXFLAGS="-Qunused-arguments" > $@.log 2>&1 || (echo "Configuring llvm64 failed:" && cat $@.log | sed "s/^/ /" && exit 1) + $(Q) @touch $@ + @echo "Configured llvm64" + +build-llvm: .stamp-build-llvm +build-llvm64: .stamp-build-llvm64 + +.stamp-build-llvm: .stamp-configure-llvm + $(MAKE) -C llvm all install + $(Q) touch $@ + +.stamp-build-llvm64: .stamp-configure-llvm64 + $(MAKE) -C llvm64 all install + $(Q) touch $@ + +really-build-llvm64: + $(MAKE) -C llvm64 all install + $(Q) touch .stamp-configure-llvm64 + +clean-llvm: + -rm -rf llvm .stamp-configure-llvm .stamp-build-llvm llvm.config.cache +clean-llvm64: + -rm -rf llvm64 .stamp-configure-llvm64 .stamp-build-llvm64 llvm64.config.cache + +.PHONY: install-llvm64 llvm llvm64 + +install-llvm: .stamp-build-llvm install-directories + +LLVM_TARGETS = \ + $(PREFIX)/LLVM/bin/opt \ + $(PREFIX)/LLVM/bin/llc \ + +$(PREFIX)/LLVM/bin/%: llvm64/usr/bin/% | $(PREFIX)/LLVM/bin + $(call Q_2,INSTALL ,[LLVM64]) install -c -m 0755 $(INSTALL_STRIP_FLAG) $^ $@ + +$(PREFIX)/LLVM/bin: + $(Q) mkdir -p $@ + +install-llvm64: .stamp-build-llvm64 $(LLVM_TARGETS) + +llvm: setup-llvm build-llvm install-llvm +llvm64: install-llvm64 + +OFFSETS_TOOLPATH=$(MONO_PATH)/tools/offsets-tool +$(OFFSETS_TOOLPATH)/.stamp-clone: + $(Q) $(MAKE) -C $(dir $@) .stamp-clone + +$(OFFSETS_TOOLPATH)/MonoAotOffsetsDumper.exe: $(OFFSETS_TOOLPATH)/.stamp-clone $(wildcard $(OFFSETS_TOOLPATH)/*.cs) + $(Q) $(MAKE) -C $(dir $@) MonoAotOffsetsDumper.exe + +target7/mono/arch/arm/arm_dpimacros.h: setup-target7 + $(Q) $(MAKE) -C $(dir $@) $(notdir $@) + +targetwatch/mono/arch/arm/arm_dpimacros.h: setup-targetwatch + $(Q) $(MAKE) -C $(dir $@) $(notdir $@) + +# template definition for generating AOT cross offsets for an ABI +# parameters are: +# $(1): target ABI +# $(2): output directory +# $(3): build +define GenerateCrossOffsets +$(3)/$(1).h: .stamp-configure-$(3) target7/mono/arch/arm/arm_dpimacros.h targetwatch/mono/arch/arm/arm_dpimacros.h $(OFFSETS_TOOLPATH)/.stamp-clone $(OFFSETS_TOOLPATH)/MonoAotOffsetsDumper.exe + $(Q) MONO_PATH=$(OFFSETS_TOOLPATH)/CppSharp \ + $(SYSTEM_MONO) $(OFFSETS_TOOLPATH)/MonoAotOffsetsDumper.exe --abi $(1) --out $(2) --mono $(abspath $(MONO_PATH)) --maccore $(abspath $(TOP)) +endef + +CROSS_BASE_CFLAGS=-DMONOTOUCH $(CROSS_BUILD_CFLAGS) $(CCACHE_CFLAGS) +CROSS_BASE_CXXFLAGS=-DMONOTOUCH $(CCACHE_CXXFLAGS) + +CROSS_BASE_CONFIGURE_FLAGS= \ + --with-glib=embedded \ + --enable-minimal=com,remoting \ + --disable-mcs-build \ + --enable-llvm \ + --enable-icall-symbol-map \ + --disable-nls \ + --disable-iconv \ + --disable-libraries \ + --enable-extension-module \ + --enable-gsharedvt \ + --disable-boehm \ + --enable-native-types + +# +# 32 bit cross compiler +# + +# mono's configure already adds an -arch i386 flag, and cache doesn't like duplicate -arch flags +CROSS_CFLAGS=$(CROSS_BASE_CFLAGS) -mmacosx-version-min=$(MIN_OSX_SDK_VERSION) +CROSS_CXXFLAGS=$(CROSS_BASE_CXXFLAGS) -mmacosx-version-min=$(MIN_OSX_SDK_VERSION) -stdlib=libc++ +CROSS_LDFLAGS=-stdlib=libc++ + +CROSS_CONFIGURE_FLAGS=$(CROSS_BASE_CONFIGURE_FLAGS) \ + --prefix=$(BUILD_DESTDIR)/cross \ + --build=i386-apple-darwin10 \ + --cache-file=../cross.config.cache \ + --target=arm-darwin \ + --with-cross-offsets=arm-apple-darwin10.h + +CROSS_CONFIGURE_ENVIRONMENT = \ + PATH="../llvm/usr/bin:$(PATH)" \ + CFLAGS="$(CROSS_CFLAGS)" \ + CXXFLAGS="$(CROSS_CXXFLAGS)" \ + LDFLAGS=$(CROSS_LDFLAGS) \ + CC="$(MAC_CC)" \ + CXX="$(MAC_CXX)" \ + +ifdef INCLUDE_IOS +cross:: build-cross install-cross + +.PHONY: setup-cross build-cross install-cross + +setup:: setup-cross +build:: build-cross +install-local:: install-cross +clean-local:: clean-cross +endif + +setup-cross: .stamp-configure-cross + +.stamp-configure-cross: $(MONO_PATH)/configure .stamp-build-llvm + $(Q) $(CROSS_CONFIGURE_ENVIRONMENT) ./wrap-configure.sh cross $(abspath $(MONO_PATH)/configure) $(CROSS_CONFIGURE_FLAGS) + +$(eval $(call GenerateCrossOffsets,arm-apple-darwin10,$(TOP)/builds/cross/,cross)) + +build-cross: setup-cross cross/arm-apple-darwin10.h + $(MAKE) -C cross/eglib + $(MAKE) -C cross/mono + $(MAKE) -C cross/mono install + +CROSS_TARGETS = \ + $(PREFIX)/bin/arm-darwin-mono-sgen \ + +$(PREFIX)/bin/arm-darwin-mono-%: $(BUILD_DESTDIR)/cross/bin/arm-darwin-mono-% | $(PREFIX)/bin + $(call Q_2,INSTALL ,[CROSS]) install -c -m 0755 $(INSTALL_STRIP_FLAG) $< $@ + +$(PREFIX)/bin: + $(Q) mkdir -p $@ + +install-cross: install-llvm64 $(CROSS_TARGETS) + +clean-cross: + -rm -rf cross .stamp-configure-cross cross.config.cache + +# +# 64 bit cross compiler +# + +CROSS64_CFLAGS=$(CROSS_BASE_CFLAGS) -mmacosx-version-min=10.8 +CROSS64_CXXFLAGS=$(CROSS_BASE_CXXFLAGS) -mmacosx-version-min=10.8 -stdlib=libc++ +CROSS64_LDFLAGS=-stdlib=libc++ + +CROSS64_CONFIGURE_FLAGS=$(CROSS_BASE_CONFIGURE_FLAGS) \ + --prefix=$(BUILD_DESTDIR)/cross64 \ + --cache-file=../cross64.config.cache \ + --target=aarch64-darwin \ + --with-cross-offsets=aarch64-apple-darwin10.h + +CROSS64_CONFIGURE_ENVIRONMENT = \ + PATH="../llvm64/usr/bin:$(PATH)" \ + CFLAGS="$(CROSS64_CFLAGS)" \ + CXXFLAGS="$(CROSS64_CXXFLAGS)" \ + LDFLAGS="$(CROSS64_LDFLAGS)" \ + CC="$(MAC_CC)" \ + CXX="$(MAC_CXX)" \ + +cross64:: build-cross64 install-cross64 + +ifdef INCLUDE_IOS +setup:: setup-cross64 +build:: build-cross64 +install-local:: install-cross64 +clean-local:: clean-cross64 +endif + +setup-cross64: .stamp-configure-cross64 + +install-directories: + install -d $(PREFIX)/bin + install -d $(PREFIX)/share/mono + install -d $(PREFIX)/lib/mono/2.1/Facades + install -d $(PREFIX)/lib/mono/Xamarin.iOS + install -d $(IOS_DESTDIR)/$(IPHONESIMULATOR_PREFIX)/include + install -d $(IOS_DESTDIR)/$(IPHONESIMULATOR_PREFIX)/lib + install -d $(IOS_DESTDIR)/$(IPHONEOS_PREFIX)/include + install -d $(IOS_DESTDIR)/$(IPHONEOS_PREFIX)/lib + install -d $(PREFIX)/LLVM/bin + +.stamp-configure-cross64: $(MONO_PATH)/configure .stamp-build-llvm64 + $(Q) $(CROSS64_CONFIGURE_ENVIRONMENT) ./wrap-configure.sh cross64 $(abspath $(MONO_PATH)/configure) $(CROSS64_CONFIGURE_FLAGS) + +$(eval $(call GenerateCrossOffsets,aarch64-apple-darwin10,$(TOP)/builds/cross64/,cross64)) + +build-cross64: setup-cross64 cross64/aarch64-apple-darwin10.h + $(MAKE) -C cross64/eglib + $(MAKE) -C cross64/mono + @$(MAKE) -C cross64/mono install + +CROSS64_TARGETS = \ + $(PREFIX)/bin/arm64-darwin-mono-sgen \ + +$(PREFIX)/bin/arm64-darwin-mono-sgen: $(BUILD_DESTDIR)/cross64/bin/aarch64-darwin-mono-sgen | $(PREFIX)/bin + $(call Q_2,INSTALL ,[CROSS64]) install -c -m 0755 $(INSTALL_STRIP_FLAG) $< $@ + +install-cross64: install-llvm64 $(CROSS64_TARGETS) + +clean-cross64: + -rm -rf cross64 .stamp-configure-cross64 cross64.config.cache + + +# +# 32 bit watch cross compiler +# + +WATCH_CROSS_CONFIGURE_FLAGS=$(CROSS_BASE_CONFIGURE_FLAGS) \ + --prefix=$(BUILD_DESTDIR)/cross-watch \ + --build=i386-apple-darwin10 \ + --cache-file=../cross-watch.config.cache \ + --target=armv7k-unknown-darwin \ + --enable-gsharedvt \ + +WATCH_CONFIGURE_ENVIRONMENT = \ + PATH="../llvm/usr/bin:$(PATH)" \ + CFLAGS="$(CROSS_CFLAGS)" \ + CXXFLAGS="$(CROSS_CXXFLAGS)" \ + LDFLAGS=$(CROSS_LDFLAGS) \ + CC="$(MAC_CC)" \ + CXX="$(MAC_CXX)" \ + +ifdef INCLUDE_WATCH +cross:: build-cross-watch install-cross-watch + +.PHONY: setup-cross-watch build-cross-watch install-cross-watch + +setup:: setup-cross-watch +build:: build-cross-watch +install-local:: install-cross-watch +clean-local:: clean-cross-watch +endif + +.PHONY: cross-watch +cross-watch: build-cross-watch install-cross-watch + +setup-cross-watch: .stamp-configure-cross-watch + +.stamp-configure-cross-watch: $(MONO_PATH)/configure .stamp-build-llvm + $(Q) $(WATCH_CONFIGURE_ENVIRONMENT) ./wrap-configure.sh cross-watch $(abspath $(MONO_PATH)/configure) $(WATCH_CROSS_CONFIGURE_FLAGS) + +build-cross: setup-cross + +$(eval $(call GenerateCrossOffsets,armv7k-apple-darwin,$(TOP)/builds/cross-watch/,cross-watch)) + +build-cross-watch: setup-cross-watch cross-watch/armv7k-apple-darwin.h + $(MAKE) -C cross-watch/eglib + $(MAKE) -C cross-watch/mono + $(MAKE) -C cross-watch/mono install + +CROSS_WATCH_TARGETS = \ + $(PREFIX)/bin/armv7k-unknown-darwin-mono-sgen \ + +$(PREFIX)/bin/armv7k-unknown-darwin-mono-%: $(BUILD_DESTDIR)/cross-watch/bin/armv7k-unknown-darwin-mono-% | $(PREFIX)/bin + $(call Q_2,INSTALL ,[CROSS]) install -c -m 0755 $(INSTALL_STRIP_FLAG) $< $@ + +install-cross-watch: install-llvm $(CROSS_WATCH_TARGETS) + +clean-cross-watch: + -rm -rf cross-watch .stamp-configure-cross-watch cross-watch.config.cache + + +# +# 64 bit tv cross compiler +# + +TV_CROSS_CFLAGS=$(CROSS_BASE_CFLAGS) -mmacosx-version-min=10.8 +TV_CROSS_CXXFLAGS=$(CROSS_BASE_CXXFLAGS) -mmacosx-version-min=10.8 -stdlib=libc++ +TV_CROSS_LDFLAGS=-stdlib=libc++ + +TV_CROSS_CONFIGURE_FLAGS=$(CROSS_BASE_CONFIGURE_FLAGS) \ + --prefix=$(BUILD_DESTDIR)/crosstv \ + --cache-file=../crosstv.config.cache \ + --target=aarch64-unknown-darwin \ + --enable-gsharedvt \ + +TV_CROSS_CONFIGURE_ENVIRONMENT = \ + $(Q) PATH="../llvm64/usr/bin:$(PATH)" \ + CFLAGS="$(TV_CROSS_CFLAGS)" \ + CXXFLAGS="$(TV_CROSS_CXXFLAGS)" \ + LDFLAGS=$(TV_CROSS_LDFLAGS) \ + CC="$(MAC_CC)" \ + CXX="$(MAC_CXX)" \ + + +ifdef INCLUDE_TVOS +cross:: build-crosstv install-crosstv + +.PHONY: setup-crosstv build-crosstv install-crosstv + +setup:: setup-crosstv +build:: build-crosstv +install-local:: install-crosstv +clean-local:: clean-crosstv +endif + +setup-crosstv: .stamp-configure-crosstv + +.stamp-configure-crosstv: $(MONO_PATH)/configure .stamp-build-llvm64 + $(Q) $(TV_CROSS_CONFIGURE_ENVIRONMENT) ./wrap-configure.sh crosstv $(abspath $(MONO_PATH)/configure) $(TV_CROSS_CONFIGURE_FLAGS) + +$(eval $(call GenerateCrossOffsets,aarch64-apple-darwin10,$(TOP)/builds/crosstv/,crosstv)) + +build-crosstv: setup-crosstv crosstv/aarch64-apple-darwin10.h + $(MAKE) -C crosstv/eglib + $(MAKE) -C crosstv/mono + $(MAKE) -C crosstv/mono install + +TV_WATCH_TARGETS = \ + $(PREFIX)/bin/aarch64-unknown-darwin-mono-sgen \ + +$(PREFIX)/bin/aarch64-unknown-darwin-mono-%: $(BUILD_DESTDIR)/crosstv/bin/aarch64-unknown-darwin-mono-% | $(PREFIX)/bin + $(call Q_2,INSTALL ,[CROSSTV]) install -c -m 0755 $(INSTALL_STRIP_FLAG) $< $@ + +install-crosstv: install-llvm $(TV_WATCH_TARGETS) + +clean-crosstv: + -rm -rf crosstv .stamp-configure-crosstv crosstv.config.cache + +crosstv: build-crosstv install-crosstv diff --git a/builds/Mono.framework-Info.plist b/builds/Mono.framework-Info.plist new file mode 100644 index 0000000000..cab8a3b380 --- /dev/null +++ b/builds/Mono.framework-Info.plist @@ -0,0 +1,58 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleIdentifier + xamarin.ios.mono-framework + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + Mono + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 3.12 + NSPrincipalClass + + CFBundleExecutable + Mono + + BuildMachineOSBuild + 13F34 + CFBundleDevelopmentRegion + en + CFBundleSupportedPlatforms + + iPhoneOS + + DTCompiler + com.apple.compilers.llvm.clang.1_0 + DTPlatformBuild + 12D508 + DTPlatformName + iphoneos + DTPlatformVersion + 8.2 + DTSDKBuild + 12D508 + DTSDKName + iphoneos8.2 + DTXcode + 0620 + DTXcodeBuild + 6C131e + MinimumOSVersion + 8.0 + UIDeviceFamily + + 1 + 2 + + + diff --git a/builds/Mono.framework-tvos.Info.plist b/builds/Mono.framework-tvos.Info.plist new file mode 100644 index 0000000000..ecf5445ff9 --- /dev/null +++ b/builds/Mono.framework-tvos.Info.plist @@ -0,0 +1,56 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleIdentifier + xamarin.ios.mono-framework + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + Mono + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 3.12 + NSPrincipalClass + + CFBundleExecutable + Mono + BuildMachineOSBuild + 13F34 + CFBundleDevelopmentRegion + en + CFBundleSupportedPlatforms + + AppleTVOS + + DTCompiler + com.apple.compilers.llvm.clang.1_0 + DTPlatformBuild + 12D508 + DTPlatformName + appletvos + DTPlatformVersion + 9.0 + DTSDKBuild + 12D508 + DTSDKName + appletvos9.0 + DTXcode + 0620 + DTXcodeBuild + 6C131e + MinimumOSVersion + 9.0 + UIDeviceFamily + + 3 + + + diff --git a/builds/Mono.framework-watchos.Info.plist b/builds/Mono.framework-watchos.Info.plist new file mode 100644 index 0000000000..82ca4e5dd3 --- /dev/null +++ b/builds/Mono.framework-watchos.Info.plist @@ -0,0 +1,56 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleIdentifier + xamarin.ios.mono-framework + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + Mono + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 3.12 + NSPrincipalClass + + CFBundleExecutable + Mono + BuildMachineOSBuild + 13F34 + CFBundleDevelopmentRegion + en + CFBundleSupportedPlatforms + + WatchOS + + DTCompiler + com.apple.compilers.llvm.clang.1_0 + DTPlatformBuild + 12D508 + DTPlatformName + watchos + DTPlatformVersion + 2.0 + DTSDKBuild + 12D508 + DTSDKName + watchos2.2 + DTXcode + 0620 + DTXcodeBuild + 6C131e + MinimumOSVersion + 2.0 + UIDeviceFamily + + 4 + + + diff --git a/builds/mac-System.config b/builds/mac-System.config new file mode 100644 index 0000000000..ebb9b2987f --- /dev/null +++ b/builds/mac-System.config @@ -0,0 +1,3 @@ + + + diff --git a/builds/mono-wrapper.in b/builds/mono-wrapper.in new file mode 100644 index 0000000000..d57106b82c --- /dev/null +++ b/builds/mono-wrapper.in @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +export PATH="@FRAMEWORK_ROOT@/bin:$PATH" +export MONO_CFG_DIR="@FRAMEWORK_ROOT@/etc" +export MONO_PATH="@FRAMEWORK_ROOT@/lib/@ARCH@:@FRAMEWORK_ROOT@/lib/mono/Xamarin.Mac" + +"@MONO@" "$@" diff --git a/builds/wrap-autogen.sh b/builds/wrap-autogen.sh new file mode 100755 index 0000000000..ac13bea10e --- /dev/null +++ b/builds/wrap-autogen.sh @@ -0,0 +1,33 @@ +#!/bin/bash -e + +START=$(date -u +"%s") + +# first argument is directory +D=$1 +shift + +# second argument is a name +NAME=$1 +shift + +echo Running autogen for $D +ORIGINAL_CWD=$(pwd) +LOG_FILE=$ORIGINAL_CWD/.stamp-autogen-$NAME.log +cd $D + +if ! git submodule update -r > $LOG_FILE 2>&1; then + echo "Autogen (git submodule update) for $D failed:" + cat $LOG_FILE | sed "s/^/ /" + exit 1 +fi + +if ! NOCONFIGURE=1 ./autogen.sh "$@" > $LOG_FILE 2>&1; then + echo Autogen for $D failed: + cat $LOG_FILE | sed "s/^/ /" + exit 1 +fi + +END=$(date -u +"%s") +DIFF=$(($END-$START)) + +echo Ran autogen for $D in $(($DIFF/60))m $(($DIFF%60))s diff --git a/builds/wrap-configure.sh b/builds/wrap-configure.sh new file mode 100755 index 0000000000..bb845ef705 --- /dev/null +++ b/builds/wrap-configure.sh @@ -0,0 +1,45 @@ +#!/bin/bash -e + +START=$(date -u +"%s") + +# first argument is directory +D=$1 +shift + +if test -f $D.config.cache; then + HAS_CACHE=1 +fi + +mkdir -p $D +echo Configuring $D +cd $D + +if ! "$@" > .stamp-configure-$D.log 2>&1; then + FAILED=1 + if [[ x"$HAS_CACHE" == "x1" ]]; then + echo Configuring $D failed, but a cache was used. Will try to configure without the cache. + rm ../$D.config.cache + if ! "$@" > .stamp-configure-$D.log 2>&1; then + echo Configuring $D failed without cache as well. + else + FAILED= + fi + fi + + if [[ x"$FAILED" == "x1" ]]; then + echo Configuring $D failed: + cat .stamp-configure-$D.log | sed "s/^/ /" + echo + echo " *** config.log *** " + echo + cat config.log | sed "s/^/ /" + exit 1 + fi +fi +cd .. +touch .stamp-configure-$D + +END=$(date -u +"%s") +DIFF=$(($END-$START)) + +echo Configured $D in $(($DIFF/60))m $(($DIFF%60))s diff --git a/external/llvm b/external/llvm new file mode 160000 index 0000000000..9f79399f87 --- /dev/null +++ b/external/llvm @@ -0,0 +1 @@ +Subproject commit 9f79399f87282524fee099b328bd8cbf07929daf diff --git a/external/mono b/external/mono new file mode 160000 index 0000000000..87d50fbdb5 --- /dev/null +++ b/external/mono @@ -0,0 +1 @@ +Subproject commit 87d50fbdb500c197c21e553fcfe3a0a003cd0ec1 diff --git a/mk/versions.mk b/mk/versions.mk index 3169ceebe0..03334f2388 100644 --- a/mk/versions.mk +++ b/mk/versions.mk @@ -55,6 +55,19 @@ check-versions:: check-$(1) print-versions:: print-$(1) endef + +$(shell rm -f .check-versions-failure) +$(eval $(call CheckSubmoduleTemplate,llvm,LLVM)) +$(eval $(call CheckSubmoduleTemplate,mono,MONO)) + +# some hackish reset-* targets to deal with what needs to happen in various parts of the build tree when you reset a module + +reset-mono:: + $(Q) rm -f $(TOP)/.stamp-build* $(MONO_PATH)/configure + +reset-llvm:: + $(Q) $(MAKE) -C $(TOP)/builds clean-llvm + check-versions:: @if test -e .check-versions-failure; then \ rm .check-versions-failure; \ diff --git a/mono/4.5/machine.config b/mono/4.5/machine.config new file mode 100644 index 0000000000..b5448818bd --- /dev/null +++ b/mono/4.5/machine.config @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/product.snk b/product.snk new file mode 100644 index 0000000000000000000000000000000000000000..8c04e53be9de10b0b93a858762a6ccde7dd1ca75 GIT binary patch literal 596 zcmV-a0;~N80ssI2Bme+XQ$aES1ONaL0000(io&I=`|)hOD=SB)Ct~t*-<+~}TTPF;b1{7hv6%mFR)5O_04Fitw-g>%N%Si&>{ zSRwtWdJE{F)db&GPArqMxOkFZLQp=PRNwEPm4?~o^NKK6X;^z5;2&%R5HgD_mowWH zMegva_k_~F+ptW3+aeX%(;%V0RKO-_AT*Xf+mET>`|XD5-PrCIW8%vbixYKqk}OM% z+&Yj$#9?yOJI>?x7e&Q(-V zj+t=o2V%=|T&Fia5DhX}Y06y!%W zJlB#>Aipg}OZEQMgqb=}Oq8Z$hvHz90}Mx}obUvcD6L53gpqN8K@*~L>|VSP*k}WC z5atuLdt0s#;|OACYKz^;jFE!EQf(>@>Ke zQg8oCN$DFQqP<^XPrUgvtZtCALBAjnC{g&EC6F_++=)Uo{56ouZv~$$M&=3gocLg1 ziBf^E>~2capQt02#+x<@96{-@XP0eB)+OEr_!lnYQOI_3liA{$Zkg-_A1Uoh5>|tQ ipO_W%UW4{Ol(<6x7pyuYYn@jSz!JD1zG&IMEAfC3aUh2P literal 0 HcmV?d00001