Skip to content

Commit dfbfe5e

Browse files
monojenkinspraeclarumakoeplinger
authored
[2020-02] Build makefile to support Mac Catalyst (#20566)
Backport of #20537. Co-authored-by: Frank A. Krueger <fak@praeclarum.org> Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
1 parent ac59637 commit dfbfe5e

File tree

8 files changed

+179
-2
lines changed

8 files changed

+179
-2
lines changed

mono/utils/mono-log-darwin.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
#include <config.h>
77

8-
#if defined(HOST_WATCHOS) && (__WATCH_OS_VERSION_MIN_REQUIRED >= __WATCHOS_3_0)
8+
#if (defined(HOST_WATCHOS) && (__WATCH_OS_VERSION_MIN_REQUIRED >= __WATCHOS_3_0)) || defined(HOST_MACCAT)
99
/* emitted by clang:
1010
* > /Users/lewurm/work/mono-watch4/mono/utils/mono-log-darwin.c:35:2: error: 'asl_log' is \
1111
* > deprecated: first deprecated in watchOS 3.0 - os_log(3) has replaced \

scripts/ci/pipeline/sdks-archive.groovy

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ parallel (
6464
}
6565
}
6666
},
67+
"Mac Catalyst (Xcode 11.3)": {
68+
throttle(['provisions-mac-toolchain']) {
69+
node ("xcode113") {
70+
archive ("maccat", "release", "Darwin", "", "", "", "xcode113")
71+
}
72+
}
73+
},
6774
"WASM Linux": {
6875
if (monoBranch != 'master') {
6976
echo "Skipping WASM build on non-master branch."

scripts/ci/run-jenkins.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,39 @@ if [[ ${CI_TAGS} == *'sdks-ios'* ]];
236236
exit 0
237237
fi
238238

239+
240+
if [[ ${CI_TAGS} == *'sdks-maccat'* ]];
241+
then
242+
# configuration on our bots
243+
if [[ ${CI_TAGS} == *'xcode113'* ]]; then
244+
export XCODE_DIR=/Applications/Xcode113.app/Contents/Developer
245+
export MACOS_VERSION=10.15
246+
else
247+
export XCODE_DIR=/Applications/Xcode101.app/Contents/Developer
248+
export MACOS_VERSION=10.14
249+
fi
250+
251+
# retrieve selected Xcode version
252+
/usr/libexec/PlistBuddy -c 'Print :ProductBuildVersion' ${XCODE_DIR}/../version.plist > xcode_version.txt
253+
254+
# make sure we embed the correct path into the PDBs
255+
export MONOTOUCH_MCS_FLAGS=-pathmap:${MONO_REPO_ROOT}/=/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/
256+
257+
echo "ENABLE_MACCAT=1" > sdks/Make.config
258+
if [[ ${CI_TAGS} == *'cxx'* ]]; then
259+
echo "ENABLE_CXX=1" >> sdks/Make.config
260+
fi
261+
if [[ ${CI_TAGS} == *'debug'* ]]; then
262+
echo "CONFIGURATION=debug" >> sdks/Make.config
263+
fi
264+
265+
${TESTCMD} --label=configure --timeout=180m --fatal $gnumake -j ${CI_CPU_COUNT} --output-sync=recurse --trace -C sdks/builds configure-maccat NINJA=
266+
${TESTCMD} --label=build --timeout=180m --fatal $gnumake -j ${CI_CPU_COUNT} --output-sync=recurse --trace -C sdks/builds build-maccat NINJA=
267+
${TESTCMD} --label=archive --timeout=180m --fatal $gnumake -j ${CI_CPU_COUNT} --output-sync=recurse --trace -C sdks/builds archive-maccat NINJA=
268+
269+
exit 0
270+
fi
271+
239272
if [[ ${CI_TAGS} == *'sdks-mac'* ]];
240273
then
241274
# configuration on our bots

sdks/builds/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ ios-netcore_simtv-*/
5555
ios-netcore_simwatch-*/
5656
ios-netcore_simwatch64-*/
5757
mac-mac64-*/
58+
maccat-mac64-*/
5859
wasm-runtime-*/
5960
wasm-cross-*/
6061
wasm-cross-win-*/

sdks/builds/Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,14 @@ ifneq ($(UNAME),Darwin)
3939
# iOS and Mac requires Xcode to be available, and Xcode is only available on macOS
4040
ENABLE_IOS=
4141
ENABLE_MAC=
42+
ENABLE_MACCAT=
4243
endif
4344

4445
# On Windows, we will just trigger LLVM and Android builds using this Makefile.
4546
ifeq ($(UNAME),Windows)
4647
ENABLE_IOS=
4748
ENABLE_MAC=
49+
ENABLE_MACCAT=
4850
ENABLE_WASM=
4951
ENABLE_WASM_CROSS=
5052
ENABLE_DESKTOP=
@@ -105,6 +107,10 @@ ifdef ENABLE_MAC
105107
mac_ARCHIVE=
106108
endif
107109

110+
ifdef ENABLE_MACCAT
111+
maccat_ARCHIVE=
112+
endif
113+
108114
ifdef ENABLE_WASM
109115
wasm_ARCHIVE=
110116
endif
@@ -138,6 +144,10 @@ ifdef ENABLE_MAC
138144
$(eval $(call ArchiveTemplate,mac,7z))
139145
endif
140146

147+
ifdef ENABLE_MACCAT
148+
$(eval $(call ArchiveTemplate,maccat,7z))
149+
endif
150+
141151
ifdef ENABLE_WASM
142152
$(eval $(call ArchiveTemplate,wasm,zip))
143153
endif
@@ -223,6 +233,11 @@ ifdef ENABLE_MAC
223233
include mac.mk
224234
endif
225235

236+
## Mac Catalyst targets
237+
ifdef ENABLE_MACCAT
238+
include maccat.mk
239+
endif
240+
226241
## Desktop targets
227242
## To run host-side tests
228243
ifdef ENABLE_DESKTOP

sdks/builds/maccat.mk

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
2+
maccat_PKG_CONFIG_DIR = $(TOP)/sdks/out/maccat-pkgconfig
3+
maccat_LIBS_DIR = $(TOP)/sdks/out/maccat-libs
4+
maccat_TPN_DIR = $(TOP)/sdks/out/maccat-tpn
5+
maccat_MONO_VERSION = $(TOP)/sdks/out/maccat-mono-version.txt
6+
7+
maccat_ARCHIVE += maccat-pkgconfig maccat-libs maccat-tpn maccat-mono-version.txt
8+
ADDITIONAL_PACKAGE_DEPS += $(maccat_PKG_CONFIG_DIR) $(maccat_LIBS_DIR) $(maccat_TPN_DIR) $(maccat_MONO_VERSION)
9+
10+
##
11+
# Parameters
12+
# $(1): target
13+
# $(2): host arch
14+
# $(3): xcode dir
15+
define MacCatTemplate
16+
17+
maccat_$(1)_PLATFORM_BIN=$(3)/Toolchains/XcodeDefault.xctoolchain/usr/bin
18+
19+
#
20+
# HACK: fak: The -target is placed in the CC define per the recommendation of
21+
# libtool who acknowledge that some parameters are just not passed through
22+
# to the compiler. You can use -Wc, flags, but I failed to get the working appropriately.
23+
#
24+
_maccat-$(1)_CC=$$(CCACHE) $$(maccat_$(1)_PLATFORM_BIN)/clang -target $(2)-apple-ios$(MACCAT_IOS_VERSION_MIN)-macabi
25+
_maccat-$(1)_CXX=$$(CCACHE) $$(maccat_$(1)_PLATFORM_BIN)/clang++ -target $(2)-apple-ios$(MACCAT_IOS_VERSION_MIN)-macabi
26+
27+
_maccat-$(1)_AC_VARS= \
28+
ac_cv_func_system=no \
29+
ac_cv_c_bigendian=no \
30+
ac_cv_func_fstatat=no \
31+
ac_cv_func_readlinkat=no \
32+
ac_cv_func_getpwuid_r=no \
33+
ac_cv_func_posix_getpwuid_r=yes \
34+
ac_cv_header_curses_h=no \
35+
ac_cv_header_localcharset_h=no \
36+
ac_cv_header_sys_user_h=no \
37+
ac_cv_func_getentropy=no \
38+
ac_cv_func_futimens=no \
39+
ac_cv_func_utimensat=no \
40+
ac_cv_func_shm_open_working_with_mmap=no \
41+
mono_cv_sizeof_sunpath=104
42+
43+
_maccat-$(1)_CFLAGS= \
44+
$$(maccat-$(1)_SYSROOT) \
45+
-fexceptions
46+
47+
_maccat-$(1)_CXXFLAGS= \
48+
$$(maccat-$(1)_SYSROOT)
49+
50+
_maccat-$(1)_CPPFLAGS= \
51+
-DSMALL_CONFIG -D_XOPEN_SOURCE -DHOST_IOS -DHOST_MACCAT -DHAVE_LARGE_FILE_SUPPORT=1
52+
53+
_maccat-$(1)_LDFLAGS= \
54+
-iframework $(XCODE_DIR)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$(MACOS_VERSION).sdk/System/iOSSupport/System/Library/Frameworks \
55+
-framework CoreFoundation \
56+
-lobjc -lc++
57+
58+
_maccat-$(1)_CONFIGURE_FLAGS= \
59+
--disable-boehm \
60+
--disable-btls \
61+
--disable-executables \
62+
--disable-iconv \
63+
--disable-mcs-build \
64+
--disable-nls \
65+
--disable-visibility-hidden \
66+
--enable-dtrace=no \
67+
--enable-maintainer-mode \
68+
--enable-minimal=ssa,com,interpreter,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,gac \
69+
--enable-monotouch \
70+
--with-lazy-gc-thread-creation=yes \
71+
--with-tls=pthread \
72+
--without-ikvm-native \
73+
--without-sigaltstack \
74+
--disable-cooperative-suspend \
75+
--disable-hybrid-suspend \
76+
--disable-crash-reporting
77+
78+
.stamp-maccat-$(1)-toolchain:
79+
touch $$@
80+
81+
$$(eval $$(call RuntimeTemplate,maccat,$(1),$(2)-apple-darwin10,yes))
82+
83+
endef
84+
85+
maccat-mac64_SYSROOT=-isysroot $(XCODE_DIR)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$(MACOS_VERSION).sdk
86+
87+
$(eval $(call MacCatTemplate,mac64,x86_64,$(XCODE_DIR)))
88+
89+
$(eval $(call BclTemplate,maccat,monotouch,monotouch))
90+
91+
$(maccat_PKG_CONFIG_DIR): package-maccat-mac64
92+
rm -rf $(maccat_PKG_CONFIG_DIR)
93+
mkdir -p $(maccat_PKG_CONFIG_DIR)
94+
95+
cp $(TOP)/sdks/builds/maccat-mac64-$(CONFIGURATION)/data/mono-2.pc $(maccat_PKG_CONFIG_DIR)
96+
97+
$(maccat_LIBS_DIR): package-maccat-mac64
98+
rm -rf $(maccat_LIBS_DIR)
99+
mkdir -p $(maccat_LIBS_DIR)
100+
101+
cp $(TOP)/sdks/out/maccat-mac64-$(CONFIGURATION)/lib/libmonosgen-2.0.dylib $(maccat_LIBS_DIR)/libmonosgen-2.0.dylib
102+
cp $(TOP)/sdks/out/maccat-mac64-$(CONFIGURATION)/lib/libmono-native.dylib $(maccat_LIBS_DIR)/libmono-native.dylib
103+
cp $(TOP)/sdks/out/maccat-mac64-$(CONFIGURATION)/lib/libMonoPosixHelper.dylib $(maccat_LIBS_DIR)/libMonoPosixHelper.dylib
104+
cp $(TOP)/sdks/out/maccat-mac64-$(CONFIGURATION)/lib/libmonosgen-2.0.a $(maccat_LIBS_DIR)/libmonosgen-2.0.a
105+
cp $(TOP)/sdks/out/maccat-mac64-$(CONFIGURATION)/lib/libmono-native.a $(maccat_LIBS_DIR)/libmono-native.a
106+
cp $(TOP)/sdks/out/maccat-mac64-$(CONFIGURATION)/lib/libmono-profiler-log.a $(maccat_LIBS_DIR)/libmono-profiler-log.a
107+
108+
$(maccat_mac64_PLATFORM_BIN)/install_name_tool -id @rpath/libmonosgen-2.0.dylib $(maccat_LIBS_DIR)/libmonosgen-2.0.dylib
109+
$(maccat_mac64_PLATFORM_BIN)/install_name_tool -id @rpath/libmono-native.dylib $(maccat_LIBS_DIR)/libmono-native.dylib
110+
$(maccat_mac64_PLATFORM_BIN)/install_name_tool -id @rpath/libMonoPosixHelper.dylib $(maccat_LIBS_DIR)/libMonoPosixHelper.dylib
111+
112+
$(maccat_MONO_VERSION): $(TOP)/configure.ac
113+
mkdir -p $(dir $(maccat_MONO_VERSION))
114+
grep AC_INIT $(TOP)/configure.ac | sed -e 's/.*\[//' -e 's/\].*//' > $@
115+
116+
$(maccat_TPN_DIR)/LICENSE:
117+
mkdir -p $(maccat_TPN_DIR)
118+
cd $(TOP) && rsync -r --include='THIRD-PARTY-NOTICES.TXT' --include='license.txt' --include='License.txt' --include='LICENSE' --include='LICENSE.txt' --include='LICENSE.TXT' --include='COPYRIGHT.regex' --include='*/' --exclude="*" --prune-empty-dirs . $(maccat_TPN_DIR)
119+
120+
$(maccat_TPN_DIR): $(maccat_TPN_DIR)/LICENSE

sdks/paths.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
ifneq ($(or $(ENABLE_IOS),$(ENABLE_MAC)),)
2+
ifneq ($(or $(ENABLE_IOS),$(ENABLE_MAC),$(ENABLE_MACCAT)),)
33

44
CheckXcodeDir=$(or $(and $(wildcard $(1))),$(warning Could not find Xcode in "$(1)"))
55

sdks/versions.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ XCODE_DIR?=/Applications/Xcode.app/Contents/Developer
2323

2424
# min versions of the targets
2525
MACOS_VERSION_MIN?=10.9
26+
MACCAT_IOS_VERSION_MIN?=13.0
2627
IOS_VERSION_MIN?=7.0
2728
TVOS_VERSION_MIN?=9.0
2829
WATCHOS_VERSION_MIN?=2.0

0 commit comments

Comments
 (0)