[corlib] Import FileSystemInfo and family from CoreFX (#11342)
[mono-project.git] / sdks / builds / ios.mk
blobdd3c6490773b20e306e612ef85898027d48abe01
3 # Targets:
4 # - build-ios-<target>
5 # Build <target>
6 # - package-ios-<target>
7 # Install target into ../out/<target>
8 # - clean-ios-<target>
9 # Clean target
10 # Where <target> is: target32, target32s, target64, sim32, sim64, cross32, cross64
13 PLATFORM_BIN=$(XCODE_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/bin
16 # Device builds
18 # Parameters
19 # $(1): target (target32/target32s/target64)
20 # $(2): host arch (arm or aarch64)
21 # $(3): host arch for compiler (armv7 or arm64)
23 # Flags:
24 # ios-$(1)_AC_VARS
25 # ios-$(1)_SYSROOT
26 # ios-$(1)_CONFIGURE_FLAGS
27 # ios-$(1)_CFLAGS
28 # ios-$(1)_CPPFLAGS
29 # ios-$(1)_CXXFLAGS
30 # ios-$(1)_LDFLAGS
31 # ios-$(1)_BITCODE_MARKER
33 # This handles tvos/watchos as well.
35 define iOSDeviceTemplate
37 _ios-$(1)_CC=$$(CCACHE) $$(PLATFORM_BIN)/clang
38 _ios-$(1)_CXX=$$(CCACHE) $$(PLATFORM_BIN)/clang++
40 _ios-$(1)_AC_VARS= \
41 ac_cv_c_bigendian=no \
42 ac_cv_func_fstatat=no \
43 ac_cv_func_readlinkat=no \
44 ac_cv_func_getpwuid_r=no \
45 ac_cv_func_posix_getpwuid_r=yes \
46 ac_cv_header_curses_h=no \
47 ac_cv_header_localcharset_h=no \
48 ac_cv_header_sys_user_h=no \
49 ac_cv_func_getentropy=no \
50 ac_cv_func_futimens=no \
51 ac_cv_func_utimensat=no \
52 ac_cv_func_shm_open_working_with_mmap=no \
53 mono_cv_sizeof_sunpath=104 \
54 mono_cv_uscore=yes
56 _ios-$(1)_CFLAGS= \
57 $$(ios-$(1)_SYSROOT) \
58 -arch $(3) \
59 -Wl,-application_extension \
60 -fexceptions \
61 $$(ios-$(1)_BITCODE_MARKER)
63 _ios-$(1)_CXXFLAGS= \
64 $$(ios-$(1)_SYSROOT) \
65 -arch $(3) \
66 -Wl,-application_extension \
67 $$(ios-$(1)_BITCODE_MARKER)
69 _ios-$(1)_CPPFLAGS= \
70 -DMONOTOUCH=1 \
71 $$(ios-$(1)_SYSROOT) \
72 -arch $(3) \
73 -DSMALL_CONFIG -D_XOPEN_SOURCE -DHOST_IOS -DHAVE_LARGE_FILE_SUPPORT=1 \
75 _ios-$(1)_LDFLAGS= \
76 -Wl,-no_weak_imports \
77 -arch $(3) \
78 -framework CoreFoundation \
79 -lobjc -lc++
81 _ios-$(1)_CONFIGURE_FLAGS = \
82 --disable-boehm \
83 --disable-btls \
84 --disable-executables \
85 --disable-icall-tables \
86 --disable-iconv \
87 --disable-mcs-build \
88 --disable-nls \
89 --disable-visibility-hidden \
90 --enable-dtrace=no \
91 --enable-icall-export \
92 --enable-maintainer-mode \
93 --enable-minimal=ssa,com,interpreter,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 \
94 --enable-monotouch \
95 --with-lazy-gc-thread-creation=yes \
96 --with-monotouch \
97 --with-tls=pthread \
98 --without-ikvm-native \
99 --without-sigaltstack \
100 --disable-cooperative-suspend \
101 --disable-hybrid-suspend \
102 --disable-crash-reporting
104 .stamp-ios-$(1)-toolchain:
105 touch $$@
107 $$(eval $$(call RuntimeTemplate,ios,$(1),$(2)-apple-darwin10))
109 endef
111 ios_sysroot = -isysroot $(XCODE_DIR)/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS$(IOS_VERSION).sdk -miphoneos-version-min=$(IOS_VERSION_MIN)
112 tvos_sysroot = -isysroot $(XCODE_DIR)/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS$(TVOS_VERSION).sdk -mtvos-version-min=$(TVOS_VERSION_MIN)
113 watchos_sysroot = -isysroot $(XCODE_DIR)/Platforms/WatchOS.platform/Developer/SDKs/WatchOS$(WATCHOS_VERSION).sdk -mwatchos-version-min=$(WATCHOS_VERSION_MIN)
115 # 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))
116 ios-targettv_CONFIGURE_FLAGS = --enable-dtrace=no --enable-llvm-runtime --with-bitcode=yes --with-monotouch-tv
117 ios-targetwatch_CONFIGURE_FLAGS = --enable-cooperative-suspend --enable-llvm-runtime --with-bitcode=yes --with-monotouch-watch
119 ios-target32_SYSROOT = $(ios_sysroot)
120 ios-target32s_SYSROOT = $(ios_sysroot)
121 ios-target64_SYSROOT = $(ios_sysroot)
122 ios-targettv_SYSROOT = $(tvos_sysroot)
123 ios-targetwatch_SYSROOT = $(watchos_sysroot)
125 ios-target32_CPPFLAGS = -DHOST_IOS
126 ios-target32s_CPPFLAGS = -DHOST_IOS
127 ios-target64_CPPFLAGS = -DHOST_IOS
128 ios-targettv_CPPFLAGS = -DHOST_APPLETVOS -DTARGET_APPLETVOS
129 ios-targetwatch_CPPFLAGS = -DHOST_IOS -DHOST_WATCHOS
131 ios-targettv_CFLAGS = -fembed-bitcode -fno-gnu-inline-asm
132 ios-targettv_CXXFLAGS = -fembed-bitcode -fno-gnu-inline-asm
133 ios-targetwatch_CFLAGS = -fembed-bitcode -fno-gnu-inline-asm
134 ios-targetwatch_CXXFLAGS = -fembed-bitcode -fno-gnu-inline-asm
136 ios-targettv_LDFLAGS = -Wl,-bitcode_bundle -framework CoreFoundation -lobjc -lc++
137 ios-targetwatch_LDFLAGS = -Wl,-bitcode_bundle -framework CoreFoundation -lobjc -lc++
139 ios-targettv_AC_VARS = \
140 ac_cv_func_system=no \
141 ac_cv_func_pthread_kill=no \
142 ac_cv_func_kill=no \
143 ac_cv_func_sigaction=no \
144 ac_cv_func_fork=no \
145 ac_cv_func_execv=no \
146 ac_cv_func_execve=no \
147 ac_cv_func_execvp=no \
148 ac_cv_func_signal=no
149 ios-targetwatch_AC_VARS = $(ios-targettv_AC_VARS)
151 # ios-target32_BITCODE_MARKER=-fembed-bitcode-marker
152 $(eval $(call iOSDeviceTemplate,target32,arm,armv7))
153 $(eval $(call iOSDeviceTemplate,target32s,arm,armv7s))
154 # ios-target64_BITCODE_MARKER=-fembed-bitcode-marker
155 $(eval $(call iOSDeviceTemplate,target64,aarch64,arm64))
156 $(eval $(call iOSDeviceTemplate,targettv,aarch64,arm64))
157 $(eval $(call iOSDeviceTemplate,targetwatch,armv7k,armv7k))
160 # Simulator builds
162 # Parameters
163 # $(1): target (sim32 or sim64)
164 # $(2): host arch (i386 or x86_64)
166 # Flags:
167 # ios-$(1)_SYSROOT
168 # ios-$(1)_AC_VARS
169 # ios-$(1)_CFLAGS
170 # ios-$(1)_CPPFLAGS
171 # ios-$(1)_CXXFLAGS
172 # ios-$(1)_LDFLAGS
174 # This handles tvos/watchos as well.
176 define iOSSimulatorTemplate
178 _ios-$(1)_CC=$$(CCACHE) $$(PLATFORM_BIN)/clang
179 _ios-$(1)_CXX=$$(CCACHE) $$(PLATFORM_BIN)/clang++
181 _ios-$(1)_AC_VARS= \
182 ac_cv_func_clock_nanosleep=no \
183 ac_cv_func_fstatat=no \
184 ac_cv_func_readlinkat=no \
185 ac_cv_func_system=no \
186 ac_cv_func_getentropy=no \
187 ac_cv_func_futimens=no \
188 ac_cv_func_utimensat=no \
189 ac_cv_func_shm_open_working_with_mmap=no \
190 mono_cv_uscore=yes
192 _ios-$(1)_CFLAGS= \
193 $$(ios-$(1)_SYSROOT) \
194 -arch $(2) \
195 -Wl,-application_extension
197 _ios-$(1)_CPPFLAGS= \
198 -DMONOTOUCH=1 \
199 $$(ios-$(1)_SYSROOT) \
200 -arch $(2) \
201 -Wl,-application_extension
203 _ios-$(1)_CXXFLAGS= \
204 $$(ios-$(1)_SYSROOT) \
205 -arch $(2) \
206 -Wl,-application_extension
208 _ios-$(1)_CONFIGURE_FLAGS= \
209 --disable-boehm \
210 --disable-btls \
211 --disable-executables \
212 --disable-iconv \
213 --disable-mcs-build \
214 --disable-nls \
215 --disable-visibility-hidden \
216 --enable-maintainer-mode \
217 --enable-minimal=com,remoting,shared_perfcounters \
218 --enable-monotouch \
219 --with-tls=pthread \
220 --without-ikvm-native \
221 --disable-cooperative-suspend \
222 --disable-hybrid-suspend \
223 --disable-crash-reporting
225 # _ios-$(1)_CONFIGURE_FLAGS += --enable-extension-module=xamarin
227 .stamp-ios-$(1)-toolchain:
228 touch $$@
230 $$(eval $$(call RuntimeTemplate,ios,$(1),$(2)-apple-darwin10))
232 endef
234 ios_sim_sysroot = -isysroot $(XCODE_DIR)/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator$(IOS_VERSION).sdk -mios-simulator-version-min=$(IOS_VERSION_MIN)
235 tvos_sim_sysroot = -isysroot $(XCODE_DIR)/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator$(TVOS_VERSION).sdk -mtvos-simulator-version-min=$(TVOS_VERSION_MIN)
236 watchos_sim_sysroot = -isysroot $(XCODE_DIR)/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator$(WATCH_VERSION).sdk -mwatchos-simulator-version-min=$(WATCHOS_VERSION_MIN)
238 ios-sim32_SYSROOT = $(ios_sim_sysroot)
239 ios-sim64_SYSROOT = $(ios_sim_sysroot)
240 ios-simtv_SYSROOT = $(tvos_sim_sysroot)
241 ios-simwatch_SYSROOT = $(watchos_sim_sysroot)
243 ios-simwatch_CONFIGURE_FLAGS = --enable-cooperative-suspend
245 ios-sim32_CPPFLAGS = -DHOST_IOS
246 ios-sim64_CPPFLAGS = -DHOST_IOS
247 ios-simtv_CPPFLAGS = -DHOST_APPLETVOS -DTARGET_APPLETVOS
248 ios-simwatch_CPPFLAGS = -DHOST_IOS -DHOST_WATCHOS
250 ios-simtv_AC_VARS = \
251 ac_cv_func_pthread_kill=no \
252 ac_cv_func_kill=no \
253 ac_cv_func_sigaction=no \
254 ac_cv_func_fork=no \
255 ac_cv_func_execv=no \
256 ac_cv_func_execve=no \
257 ac_cv_func_execvp=no \
258 ac_cv_func_signal=no
259 ios-simwatch_AC_VARS = \
260 ac_cv_func_system=no \
261 ac_cv_func_pthread_kill=no \
262 ac_cv_func_kill=no \
263 ac_cv_func_sigaction=no \
264 ac_cv_func_fork=no \
265 ac_cv_func_execv=no \
266 ac_cv_func_execve=no \
267 ac_cv_func_execvp=no \
268 ac_cv_func_signal=no
270 $(eval $(call iOSSimulatorTemplate,sim32,i386))
271 $(eval $(call iOSSimulatorTemplate,sim64,x86_64))
272 $(eval $(call iOSSimulatorTemplate,simtv,x86_64))
273 $(eval $(call iOSSimulatorTemplate,simwatch,i386))
276 # Parameters:
277 # $(1): target (cross32 or cross64)
278 # $(2): host arch (i386 or x86_64)
279 # $(3): target arch (arm or aarch64)
280 # $(4): device target (target32, target64, ...)
281 # $(5): llvm (llvm32 or llvm64)
282 # $(6): offsets dumper abi
284 # Flags:
285 # ios-$(1)_AC_VARS
286 # ios-$(1)_CFLAGS
287 # ios-$(1)_CXXFLAGS
288 # ios-$(1)_LDFLAGS
289 # ios-$(1)_CONFIGURE_FLAGS
290 define iOSCrossTemplate
292 _ios-$(1)_OFFSETS_DUMPER_ARGS=--gen-ios
294 _ios-$(1)_CC=$$(CCACHE) $$(PLATFORM_BIN)/clang
295 _ios-$(1)_CXX=$$(CCACHE) $$(PLATFORM_BIN)/clang++
297 _ios-$(1)_AC_VARS= \
298 ac_cv_func_shm_open_working_with_mmap=no
300 _ios-$(1)_CFLAGS= \
301 -isysroot $$(XCODE_DIR)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$$(MACOS_VERSION).sdk -mmacosx-version-min=$$(MACOS_VERSION_MIN) \
302 -Qunused-arguments
304 _ios-$(1)_CXXFLAGS= \
305 -isysroot $$(XCODE_DIR)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$$(MACOS_VERSION).sdk -mmacosx-version-min=$$(MACOS_VERSION_MIN) \
306 -Qunused-arguments \
307 -stdlib=libc++
309 _ios-$(1)_CPPFLAGS= \
310 -DMONOTOUCH=1
312 _ios-$(1)_LDFLAGS= \
313 -stdlib=libc++
315 _ios-$(1)_CONFIGURE_FLAGS= \
316 --disable-boehm \
317 --disable-btls \
318 --disable-iconv \
319 --disable-libraries \
320 --disable-mcs-build \
321 --disable-nls \
322 --enable-dtrace=no \
323 --enable-icall-symbol-map \
324 --enable-minimal=com,remoting \
325 --disable-crash-reporting
327 $$(eval $$(call CrossRuntimeTemplate,ios,$(1),$(2)-apple-darwin10,$(3)-darwin,$(4),$(5),$(6)))
329 endef
331 $(eval $(call iOSCrossTemplate,cross32,i386,arm,target32,llvm36-llvm32,arm-apple-darwin10))
332 $(eval $(call iOSCrossTemplate,cross64,x86_64,aarch64,target64,llvm-llvm64,aarch64-apple-darwin10))
333 ios-crosswatch_CONFIGURE_FLAGS=--enable-cooperative-suspend
334 $(eval $(call iOSCrossTemplate,crosswatch,i386,armv7k-unknown,targetwatch,llvm36-llvm32,armv7k-apple-darwin))
335 # 64->arm32 cross compiler
336 $(eval $(call iOSCrossTemplate,cross32-64,x86_64,arm,target32,llvm-llvm64,arm-apple-darwin10))
338 $(eval $(call BclTemplate,ios,monotouch monotouch_runtime monotouch_tv monotouch_tv_runtime monotouch_watch monotouch_watch_runtime monotouch_tools,monotouch monotouch_tv monotouch_watch))