diff options
author | Martin Baulig <mabaul@microsoft.com> | 2018-10-15 18:38:45 +0300 |
---|---|---|
committer | Alexander Köplinger <alex.koeplinger@outlook.com> | 2018-10-15 18:38:45 +0300 |
commit | 51548b4d379a5a98db4cf81ea46e83567bd38cd9 (patch) | |
tree | 369900fab5e1834de1b6eb6f3214145a3692c78f /runtime | |
parent | 2ebb5efed57f6c7e1ce172a70611d2786e32751b (diff) |
Initial Mono.Native Support. (#10596)
`Mono.Native` is the new name for both `System.Native` and `System.Security.Cryptography.Apple`.
It is built as a stand-alone shared library and not bundled with the runtime because we
may need to build two different versions of it.
Starting with macOS 10.12+ and iOS 10+, Apple introduced a new Unified API for some of the
crypto primitives that we're using as part of System.Security.Cryptography.Apple.
On Desktop, we can check at runtime whether the OS version is recent enough and switch
implementation accordingly. We build a single `libmono_native` shared library.
However, on Mobile we cannot have any undefined symbols as this would break Bitcode.
During the mobile build, we are called with `CC` containing an explicit minium version flag,
which is either `-mmacosx-version-min=`, `-mios-simulator-version-min=` or `-miphoneos-version-min=`
depending on platform.
We build two versions of the shared library:
- `libmono_native_compat` is built with whichever minimum version is passed to us via `CC`.
- `libmono_native_unifed` is built with the minimum version set to macOS 10.12+ / iOS 10+.
For testing purposes, there is a function called `mono_native_get_platform_type ()`
(see mono/native/mono-native-platform.c), which returns a `MonoNativePlatformType` enum value.
There is also `Mono.MonoNativePlatform.GetPlatformType ()` (see mcs/class/corlib/Mono/MonoNativePlatform.cs).
This can be called by automated tests both to ensure that the library has been correctly installed and also
to verify that it's the correct version of it.
* `configure.ac`: add new configure checks for Mono.Native.
* `mono/native/`: new directory - this replaces the `System.Native` code that was previously in `mono/metadata`.
* `mcs/class/corlib/Mono`: New internal `MonoNativePlatformType` and `MonoNativePlatform` classes.
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/Makefile.am | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/runtime/Makefile.am b/runtime/Makefile.am index eab8ed3118a..1503a844925 100644 --- a/runtime/Makefile.am +++ b/runtime/Makefile.am @@ -216,19 +216,12 @@ etc/mono/config: ../data/config Makefile $(symlinks) else \ echo "Unknown directory '$(abs_top_builddir)/support'" && false; \ fi - if test -d "$(abs_top_builddir)/mono/metadata"; then \ - sed 's,target="$$mono_libdir/libmono-system-native$(libsuffix)",target="$(abs_top_builddir)/mono/metadata/libmono-system-native.la",' $@ > $@.tmp \ + if test -d "$(abs_top_builddir)/mono/native"; then \ + sed 's,target="$$mono_libdir/$(MONO_NATIVE_LIBRARY_NAME)$(libsuffix)",target="$(abs_top_builddir)/mono/native/$(MONO_NATIVE_LIBRARY_NAME).la",' $@ > $@.tmp \ && mv $@.tmp $@ \ ; \ else \ - echo "Unknown directory '$(abs_top_builddir)/mono/metadata'" && false; \ - fi - if test -d "$(abs_top_builddir)/mono/metadata"; then \ - sed 's,target="$$mono_libdir/libmono-system-net-security-native$(libsuffix)",target="$(abs_top_builddir)/mono/metadata/libmono-system-net-security-native.la",' $@ > $@.tmp \ - && mv $@.tmp $@ \ - ; \ - else \ - echo "Unknown directory '$(abs_top_builddir)/mono/metadata'" && false; \ + echo "Unknown directory '$(abs_top_builddir)/mono/native'" && false; \ fi if test -d "$(abs_top_builddir)/mono/btls/build-shared"; then \ sed 's,target="$$mono_libdir/libmono-btls-shared$(libsuffix)",target="$(abs_top_builddir)/mono/btls/build-shared/libmono-btls-shared$(libsuffix)",' $@ > $@.tmp \ |