xamarin-macios/Makefile

259 строки
12 KiB
Makefile
Исходник Обычный вид История

2016-04-21 11:59:27 +03:00
TOP=.
SUBDIRS=builds runtime fsharp src msbuild tools
2016-04-21 11:59:27 +03:00
include $(TOP)/Make.config
include $(TOP)/mk/versions.mk
MONO_VERSION="`grep AC_INIT $(MONO_PATH)/configure.ac | sed -e 's/.*\[//' -e 's/\].*//'`"
#
# Xamarin.iOS
#
IOS_DIRECTORIES += \
$(IOS_DESTDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions \
$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX) \
$(IOS_DESTDIR)/Developer/MonoTouch \
$(IOS_DESTDIR)/Developer/MonoTouch/usr \
$(IOS_DESTDIR)/Developer/MonoTouch/usr/lib/mono \
IOS_TARGETS += \
$(IOS_INSTALL_DIRECTORIES) \
$(IOS_DESTDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current \
$(IOS_DESTDIR)/Developer/MonoTouch/usr/bin \
$(IOS_DESTDIR)/Developer/MonoTouch/usr/lib/mono/2.1 \
$(IOS_DESTDIR)/Developer/MonoTouch/usr/lib/mono/Xamarin.iOS \
$(IOS_DESTDIR)/Developer/MonoTouch/updateinfo \
$(IOS_DESTDIR)/Developer/MonoTouch/Version \
$(IOS_DESTDIR)/Developer/MonoTouch/usr/share \
$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/buildinfo \
$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/Version \
$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/updateinfo \
$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/Versions.plist \
$(IOS_DESTDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current: | $(IOS_DESTDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions
$(Q_LN) ln -hfs $(IOS_INSTALL_VERSION) $@
$(IOS_DESTDIR)/Developer/MonoTouch/usr/bin: | $(IOS_DESTDIR)/Developer/MonoTouch/usr
$(Q_LN) ln -Fs $(abspath $(IOS_TARGETDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin) $@
$(IOS_DESTDIR)/Developer/MonoTouch/usr/lib/mono/2.1: | $(IOS_DESTDIR)/Developer/MonoTouch/usr/lib/mono
$(Q_LN) ln -Fs $(abspath $(IOS_TARGETDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/2.1) $@
$(IOS_DESTDIR)/Developer/MonoTouch/usr/lib/mono/Xamarin.iOS: | $(IOS_DESTDIR)/Developer/MonoTouch/usr/lib/mono
$(Q_LN) ln -Fs $(abspath $(IOS_TARGETDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS) $@
$(IOS_DESTDIR)/Developer/MonoTouch/updateinfo: | $(IOS_DESTDIR)/Developer/MonoTouch
$(Q_LN) ln -fs $(abspath $(IOS_TARGETDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/updateinfo) $@
$(IOS_DESTDIR)/Developer/MonoTouch/Version: | $(IOS_DESTDIR)/Developer/MonoTouch
$(Q_LN) ln -fs $(abspath $(IOS_TARGETDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/Version) $@
$(IOS_DESTDIR)/Developer/MonoTouch/usr/share: | $(IOS_DESTDIR)/Developer/MonoTouch/usr
$(Q_LN) ln -Fs $(abspath $(IOS_TARGETDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/share) $@
$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/buildinfo: Make.config.inc .git/index | $(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)
$(Q_GEN) echo "Version: $(IOS_PACKAGE_VERSION)" > $@
$(Q) echo "Hash: $(shell git log --oneline -1 --pretty=%h)" >> $@
$(Q) echo "Branch: $(CURRENT_BRANCH)" >> $@
$(Q) echo "Build date: $(shell date '+%Y-%m-%d %H:%M:%S%z')" >> $@
$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/Version: Make.config.inc | $(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)
$(Q) echo $(IOS_PACKAGE_VERSION) > $@
$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/updateinfo: Make.config.inc
$(Q) echo "4569c276-1397-4adb-9485-82a7696df22e $(IOS_PACKAGE_UPDATE_ID)" > $@
$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/Versions.plist: Versions-ios.plist.in Makefile $(TOP)/Make.config versions-check.csharp
$(Q) ./versions-check.csharp $< "$(MIN_IOS_SDK_VERSION)" "$(IOS_SDK_VERSION)" "$(MIN_TVOS_SDK_VERSION)" "$(TVOS_SDK_VERSION)" "$(MIN_WATCH_OS_VERSION)" "$(WATCH_SDK_VERSION)" "$(MIN_OSX_SDK_VERSION)" "$(OSX_SDK_VERSION)"
$(Q_GEN) sed -e 's/@XCODE_VERSION@/$(XCODE_VERSION)/g' -e "s/@MONO_VERSION@/$(MONO_VERSION)/g" $< > $@
ifdef INCLUDE_IOS
TARGETS += $(IOS_TARGETS)
DIRECTORIES += $(IOS_DIRECTORIES)
endif
#
# Xamarin.Mac
#
MAC_DIRECTORIES += \
$(MAC_DESTDIR)$(MAC_FRAMEWORK_DIR)/Versions \
$(MAC_DESTDIR)/$(MAC_FRAMEWORK_CURRENT_DIR) \
MAC_TARGETS += \
$(MAC_DESTDIR)$(MAC_FRAMEWORK_DIR)/Versions/Current \
$(MAC_DESTDIR)$(MAC_FRAMEWORK_DIR)/Commands \
$(MAC_DESTDIR)/$(MAC_FRAMEWORK_CURRENT_DIR)/buildinfo \
$(MAC_DESTDIR)/$(MAC_FRAMEWORK_CURRENT_DIR)/Version \
$(MAC_DESTDIR)/$(MAC_FRAMEWORK_CURRENT_DIR)/updateinfo \
$(MAC_DESTDIR)/$(MAC_FRAMEWORK_CURRENT_DIR)/Versions.plist \
$(MAC_DESTDIR)$(MAC_FRAMEWORK_DIR)/Versions/Current: | $(MAC_DESTDIR)$(MAC_FRAMEWORK_DIR)/Versions
$(Q_LN) ln -hfs $(MAC_INSTALL_VERSION) $@
$(MAC_DESTDIR)$(MAC_FRAMEWORK_DIR)/Commands:
$(Q_LN) ln -hfs $(MAC_TARGETDIR)/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/bin $@
$(MAC_DESTDIR)/$(MAC_FRAMEWORK_CURRENT_DIR)/buildinfo: Make.config.inc .git/index | $(MAC_DESTDIR)/$(MAC_FRAMEWORK_CURRENT_DIR)
$(Q_GEN) echo "Version: $(MAC_PACKAGE_VERSION)" > $@
$(Q) echo "Hash: $(shell git log --oneline -1 --pretty=%h)" >> $@
$(Q) echo "Branch: $(CURRENT_BRANCH)" >> $@
$(Q) echo "Build date: $(shell date '+%Y-%m-%d %H:%M:%S%z')" >> $@
$(MAC_DESTDIR)/$(MAC_FRAMEWORK_CURRENT_DIR)/updateinfo: Make.config.inc
$(Q) echo "0ab364ff-c0e9-43a8-8747-3afb02dc7731 $(MAC_PACKAGE_UPDATE_ID)" > $@
$(MAC_DESTDIR)/$(MAC_FRAMEWORK_CURRENT_DIR)/Version: Make.config.inc
$(Q) echo $(MAC_PACKAGE_VERSION) > $@
$(MAC_DESTDIR)/$(MAC_FRAMEWORK_CURRENT_DIR)/Versions.plist: Versions-mac.plist.in Makefile $(TOP)/Make.config versions-check.csharp
$(Q) ./versions-check.csharp $< "$(MIN_IOS_SDK_VERSION)" "$(IOS_SDK_VERSION)" "$(MIN_TVOS_SDK_VERSION)" "$(TVOS_SDK_VERSION)" "$(MIN_WATCH_OS_VERSION)" "$(WATCH_SDK_VERSION)" "$(MIN_OSX_SDK_VERSION)" "$(OSX_SDK_VERSION)"
$(Q_GEN) sed -e 's/@XCODE_VERSION@/$(XCODE_VERSION)/g' -e "s/@MONO_VERSION@/$(MONO_VERSION)/g" -e "s/@MIN_XM_MONO_VERSION@/$(MIN_XM_MONO_VERSION)/g" $< > $@
ifdef INCLUDE_MAC
TARGETS += $(MAC_TARGETS)
DIRECTORIES += $(MAC_DIRECTORIES)
endif
#
# Common
#
.PHONY: world
world: check-system
@$(MAKE) reset-versions
@$(MAKE) all -j8
@$(MAKE) install -j8
.PHONY: check-system
check-system:
@if [[ "x$(IOS_COMMIT_DISTANCE)" != "x$(MAC_COMMIT_DISTANCE)" ]]; then \
echo "$(COLOR_RED)*** The commit distance for Xamarin.iOS ($(IOS_COMMIT_DISTANCE)) and Xamarin.Mac ($(MAC_COMMIT_DISTANCE)) are different.$(COLOR_CLEAR)"; \
echo "$(COLOR_RED)*** To fix this problem, bump the revision (the third number) for both $(COLOR_GRAY)IOS_PACKAGE_NUMBER$(COLOR_RED) and $(COLOR_GRAY)MAC_PACKAGE_NUMBER$(COLOR_RED) in Make.versions.$(COLOR_CLEAR)"; \
echo "$(COLOR_RED)*** Once fixed, you need to commit the changes for them to pass this check.$(COLOR_CLEAR)"; \
exit 1; \
elif (( $(IOS_COMMIT_DISTANCE) > 999 || $(MAC_COMMIT_DISTANCE) > 999 )); then \
echo "$(COLOR_RED)*** The commit distance for Xamarin.iOS ($(IOS_COMMIT_DISTANCE)) and/or Xamarin.Mac ($(MAC_COMMIT_DISTANCE)) are > 999.$(COLOR_CLEAR)"; \
echo "$(COLOR_RED)*** To fix this problem, bump the revision (the third number) for both $(COLOR_GRAY)IOS_PACKAGE_NUMBER$(COLOR_RED) and $(COLOR_GRAY)MAC_PACKAGE_NUMBER$(COLOR_RED) in Make.versions.$(COLOR_CLEAR)"; \
echo "$(COLOR_RED)*** Once fixed, you need to commit the changes for them to pass this check.$(COLOR_CLEAR)"; \
exit 1; \
fi
@./system-dependencies.sh
@echo "Building Xamarin.iOS $(IOS_PACKAGE_VERSION) and Xamarin.Mac $(MAC_PACKAGE_VERSION)"
$(DIRECTORIES):
$(Q) mkdir -p $@
$(TARGETS): | check-system
all-local:: $(TARGETS)
install-local:: $(TARGETS)
check-permissions:
ifdef INCLUDE_MAC
@UNREADABLE=`find $(MAC_DESTDIR) ! -perm -0644`; if ! test -z "$$UNREADABLE"; then echo "There are files with invalid permissions (all installed files at least be readable by everybody, and writable by owner: 0644): "; find $(MAC_DESTDIR) ! -perm -0644 | xargs ls -la; exit 1; fi
@echo Validated file permissions for Xamarin.Mac.
endif
ifdef INCLUDE_IOS
@UNREADABLE=`find $(IOS_DESTDIR) ! -perm -0644`; if ! test -z "$$UNREADABLE"; then echo "There are files with invalid permissions (all installed files at least be readable by everybody, and writable by owner: 0644): "; find $(IOS_DESTDIR) ! -perm -0644 | xargs ls -la; exit 1; fi
@echo Validated file permissions for Xamarin.iOS.
endif
install-hook::
@$(MAKE) check-permissions
ifdef INCLUDE_IOS
ifneq ($(findstring $(IOS_DESTDIR)$(MONOTOUCH_PREFIX),$(shell ls -l /Library/Frameworks/Xamarin.iOS.framework/Versions/Current 2>&1)),)
@echo
@echo " This build of Xamarin.iOS is the now default version on your system. "
@echo
else
@echo
@echo " Xamarin.iOS has not been installed into your system by 'make install'"
@echo " In order to set the currently built Xamarin.iOS as your system version,"
@echo " execute 'make install-system'".
@echo
endif
endif
ifdef INCLUDE_MAC
ifndef INCLUDE_IOS
@echo
endif
ifneq ($(findstring $(abspath $(MAC_DESTDIR)$(MAC_FRAMEWORK_DIR)/Versions),$(shell ls -l $(MAC_FRAMEWORK_DIR)/Versions/Current 2>&1)),)
@echo " This build of Xamarin.Mac is the now default version on your system. "
@echo
else
@echo " Xamarin.Mac has not been installed into your system by 'make install'"
@echo " In order to set the currently built Xamarin.Mac as your system version,"
@echo " execute 'make install-system'".
@echo
endif
endif
package:
mkdir -p ../package
Add support for building on Jenkins. (#4159) Add support for building on internal Jenkins. Jenkins has been configured to build every branch on xamarin/xamarin-macios that contains a `jenkins/Jenkinsfile`, which means it will start working as soon as this PR is merged. Results will be posted as statuses on each commit, which can be viewed using the url `https://github.com/xamarin/xamarin-macios/commits/<branch>`: ![screenshot 2018-06-01 11 12 57](https://user-images.githubusercontent.com/249268/40832932-c3b05eb0-658c-11e8-9670-8de5fcc23407.png) * The `continuous-integration/jenkins/branch` status links to the jenkins job. * The other two are XI and XM packages (the `Jenkins-` prefix will be removed once we officially switch from Wrench to Jenkins). More detailed information will be added as a comment to each commit, which can be seen by clicking on the commit and scrolling to the bottom (url of the format `https://github.com/xamarin/xamarin-macios/commit/<sha1>`) ![screenshot 2018-06-01 11 14 33](https://user-images.githubusercontent.com/249268/40833014-fd8772f4-658c-11e8-8a35-5df46bfb16c7.png) Unfortunately GitHub does not display the commit statuses when viewing a single commit, so to view those statuses you'll have to view the list of commits (the `/commits/` url). Tip: it's possible to use `<sha1>` instead of `<branch>` (and vice versa for that matter) if you're interested in the statuses of a particular commit. Pull requests will also be built (only from contributors with write access), but by default nothing will be done (the job will exit immediately, although a green check mark will still show up). Jenkins will **not** add a comment in the pull request in this case. However, if the label `build-package` [1] is set for a pull request, the internal jenkins job will run (it will do everything except the local xharness test run: this includes creating and publishing packages, creating various diffs, run tests on older macOS versions, test docs, etc). A detailed comment will also be added to the pull request (see below for multiple examples), which means that there will be two Jenkins comments: one for the public Jenkins which builds every PR, and one for the internal Jenkins [2]. [1] I don't quite like the name of the label, because it doesn't get even close to explain all that will actually happen, but `run-on-internal-jenkins-and-create-package` is a bit too long IMHO... Also it's non-obvious that this is the label to apply if the reason for executing on the internal jenkins is some other reason (for instance to test a maccore bump). Other ideas: * `run-internal-jenkins`: doesn't make it obvious that a package will be created (which is probably the most common reason to want to run on internal jenkins) * We could have multiple labels that mean the same thing: `build-package`, `internal-build`, `run-internal-jenkins`, etc, but it's redundant and I don't quite like it either. * Any other ideas? [2] I'm noticing now that these two look quite similar and this might end up confusing (the main difference is that the comment from the public jenkins will say **Build success/failure** and **Build comment file:** at the top. If something goes wrong the failure will also show up differently). Should this be made clearer?
2018-06-05 02:40:16 +03:00
$(MAKE) -C $(MACCORE_PATH) package
# copy .pkg, .zip and *updateinfo to the packages directory to be uploaded to storage
$(CP) $(MACCORE_PATH)/release/*.pkg ../package
$(CP) $(MACCORE_PATH)/release/*.zip ../package
$(CP) $(MACCORE_PATH)/release/*updateinfo ../package
install-system: install-system-ios install-system-mac
@# Clean up some old files
$(Q) rm -Rf /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS
$(Q) rm -Rf /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Xamarin.ObjcBinding.CSharp.targets
$(Q) rm -Rf /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Xamarin.Common.CSharp.targets
$(Q) rm -Rf /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Xamarin.ObjcBinding.Tasks.dll
$(Q) rm -Rf /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Mac
$(Q) $(MAKE) install-symlinks MAC_DESTDIR=/ MAC_INSTALL_VERSION=Current IOS_DESTDIR=/ IOS_INSTALL_VERSION=Current -C msbuild V=$(V)
ifdef ENABLE_XAMARIN
$(Q) $(MAKE) install-symlinks MAC_DESTDIR=/ MAC_INSTALL_VERSION=Current IOS_DESTDIR=/ IOS_INSTALL_VERSION=Current -C $(MACCORE_PATH) V=$(V)
endif
install-system-ios:
ifdef INCLUDE_IOS
@if ! test -s "$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/buildinfo"; then echo "The Xamarin.iOS build seems incomplete. Did you run \"make install\"?"; exit 1; fi
$(Q) rm -f /Library/Frameworks/Xamarin.iOS.framework/Versions/Current
$(Q) mkdir -p /Library/Frameworks/Xamarin.iOS.framework/Versions
$(Q) ln -s $(IOS_DESTDIR)$(MONOTOUCH_PREFIX) /Library/Frameworks/Xamarin.iOS.framework/Versions/Current
$(Q) echo Installed Xamarin.iOS into /Library/Frameworks/Xamarin.iOS.framework/Versions/Current
endif
install-system-mac:
ifdef INCLUDE_MAC
@if ! test -s "$(MAC_DESTDIR)/$(MAC_FRAMEWORK_CURRENT_DIR)/buildinfo" ; then echo "The Xamarin.Mac build seems incomplete. Did you run \"make install\"?"; exit 1; fi
$(Q) rm -f $(MAC_FRAMEWORK_DIR)/Versions/Current
$(Q) mkdir -p $(MAC_FRAMEWORK_DIR)/Versions
$(Q) ln -s $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR) $(MAC_FRAMEWORK_DIR)/Versions/Current
$(Q) echo Installed Xamarin.Mac into $(MAC_FRAMEWORK_DIR)/Versions/Current
endif
fix-install-permissions:
sudo mkdir -p /Library/Frameworks/Mono.framework/External/
sudo mkdir -p /Library/Frameworks/Xamarin.iOS.framework
sudo mkdir -p /Library/Frameworks/Xamarin.Mac.framework
sudo chown -R $(USER) /Library/Frameworks/Mono.framework/External/
sudo chown -R $(USER) /Library/Frameworks/Xamarin.iOS.framework
sudo chown -R $(USER) /Library/Frameworks/Xamarin.Mac.framework
git-clean-all:
@echo "Cleaning and resetting all dependencies. This is a destructive operation."
@echo "You have 5 seconds to cancel (Ctrl-C) if you wish."
@sleep 5
@echo "Cleaning xamarin-macios..."
@git clean -xffdq
@git submodule foreach -q --recursive 'git clean -xffdq'
@for dir in $(DEPENDENCY_DIRECTORIES); do if test -d $(CURDIR)/$$dir; then echo "Cleaning $$dir" && cd $(CURDIR)/$$dir && git clean -xffdq && git reset --hard -q && git submodule foreach -q --recursive 'git clean -xffdq'; else echo "Skipped $$dir (does not exist)"; fi; done
ifdef ENABLE_XAMARIN
@./configure --enable-xamarin
$(MAKE) reset
@echo "Done (Xamarin-specific build has been re-enabled)"
else
@echo "Done"
endif
ifdef ENABLE_XAMARIN
SUBDIRS += $(MACCORE_PATH)
endif
SUBDIRS += tests