diff --git a/eng/Subsets.props b/eng/Subsets.props
index 9218251bbae333..ef7ed6207ee1b8 100644
--- a/eng/Subsets.props
+++ b/eng/Subsets.props
@@ -58,7 +58,7 @@
libraries-installer-coreclr-mono
- libraries-mono
+ libraries-mono
corehost-managed-depproj-pkgproj-bundle-installers-test
all
@@ -78,7 +78,7 @@
- Mono
+ Mono
Mono
CoreCLR
diff --git a/eng/build.sh b/eng/build.sh
index 1a3c98853f2be5..48ee6d9490ff50 100755
--- a/eng/build.sh
+++ b/eng/build.sh
@@ -19,7 +19,7 @@ usage()
echo "Common settings:"
echo " --subset Build a subset, print available subsets with -subset help"
echo " --subsetCategory Build a subsetCategory, print available subsetCategories with -subset help"
- echo " --os Build operating system: Windows_NT or Unix"
+ echo " --os Build operating system: Windows_NT, Linux, FreeBSD, OSX, iOS or Android"
echo " --arch Build platform: x86, x64, arm or arm64"
echo " --configuration Build configuration: Debug, Release or [CoreCLR]Checked (short: -c)"
echo " --runtimeConfiguration Runtime build configuration: Debug, Release or [CoreCLR]Checked"
diff --git a/eng/codeOptimization.targets b/eng/codeOptimization.targets
index 24e9c761407cfb..922c21047a5937 100644
--- a/eng/codeOptimization.targets
+++ b/eng/codeOptimization.targets
@@ -9,7 +9,7 @@
IBCMerge optimizations on Mac for now to unblock the offical build.
See issue https://github.com/dotnet/runtime/issues/33303
-->
- false
+ false
arm64
wasm
x64
+ x64
x64
-
+
$(TargetOS.ToLowerInvariant())
$(TargetOS.ToLowerInvariant())
+ $(TargetOS.ToLowerInvariant())
Debug
@@ -95,6 +97,14 @@
linux
+
+
+ true
+ true
+ true
+ android
+
+
true
@@ -186,6 +196,7 @@
<_portableOS Condition="'$(_runtimeOSFamily)' == 'FreeBSD'">freebsd
<_portableOS Condition="'$(RuntimeOS)' == 'WebAssembly'">webassembly
<_portableOS Condition="'$(RuntimeOS)' == 'ios'">ios
+ <_portableOS Condition="'$(RuntimeOS)' == 'android'">android
<_runtimeOS>$(RuntimeOS)
<_runtimeOS Condition="'$(_runtimeOS)' == 'tizen.4.0.0'">linux
@@ -202,6 +213,11 @@
osx-x64
linux-x64
+
+ win-x64
+ osx-x64
+ linux-x64
+
osx-x64
diff --git a/src/libraries/Native/Unix/CMakeLists.txt b/src/libraries/Native/Unix/CMakeLists.txt
index 5f20c76877cf4e..4cf22361ee4b57 100644
--- a/src/libraries/Native/Unix/CMakeLists.txt
+++ b/src/libraries/Native/Unix/CMakeLists.txt
@@ -91,7 +91,9 @@ endif ()
if(CLR_CMAKE_TARGET_ANDROID)
add_definitions(-DTARGET_ANDROID)
- include_directories(SYSTEM "${CROSS_ROOTFS}/usr/include")
+ if(CROSS_ROOTFS)
+ include_directories(SYSTEM "${CROSS_ROOTFS}/usr/include")
+ endif()
endif()
string(TOUPPER ${CMAKE_BUILD_TYPE} UPPERCASE_CMAKE_BUILD_TYPE)
@@ -195,18 +197,22 @@ endif()
add_subdirectory(System.Native)
-if (NOT CLR_CMAKE_TARGET_ARCH_WASM)
+if(CLR_CMAKE_TARGET_ARCH_WASM)
+ # skip for now
+elseif(CLR_CMAKE_TARGET_IOS)
add_subdirectory(System.Net.Security.Native)
-
-if (NOT CLR_CMAKE_TARGET_IOS)
- # TODO: reenable for iOS
+ #add_subdirectory(System.Globalization.Native) # TODO: reenable
+ # System.Security.Cryptography.Native is intentionally disabled on iOS
+ # it is only used for interacting with OpenSSL which isn't useful there
+elseif(CLR_CMAKE_TARGET_ANDROID AND NOT CROSS_ROOTFS)
add_subdirectory(System.Globalization.Native)
-
- # disable System.Security.Cryptography.Native build on iOS,
- # only used for interacting with OpenSSL which isn't useful there
+ #add_subdirectory(System.Net.Security.Native) # TODO: reenable
+ #add_subdirectory(System.Security.Cryptography.Native) # TODO: reenable
+else()
+ add_subdirectory(System.Globalization.Native)
+ add_subdirectory(System.Net.Security.Native)
add_subdirectory(System.Security.Cryptography.Native)
endif()
-endif()
if(CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_IOS)
add_subdirectory(System.Security.Cryptography.Native.Apple)
diff --git a/src/libraries/Native/Unix/Common/pal_config.h.in b/src/libraries/Native/Unix/Common/pal_config.h.in
index e1b4a3f9625593..d177e6606767f0 100644
--- a/src/libraries/Native/Unix/Common/pal_config.h.in
+++ b/src/libraries/Native/Unix/Common/pal_config.h.in
@@ -35,6 +35,7 @@
#cmakedefine01 HAVE_TIOCGWINSZ
#cmakedefine01 HAVE_SCHED_GETAFFINITY
#cmakedefine01 HAVE_SCHED_SETAFFINITY
+#cmakedefine01 HAVE_PTHREAD_SETCANCELSTATE
#cmakedefine01 HAVE_ARC4RANDOM_BUF
#cmakedefine01 KEVENT_HAS_VOID_UDATA
#cmakedefine01 HAVE_FDS_BITS
@@ -100,7 +101,6 @@
#cmakedefine01 HAVE_TCP_H_TCP_KEEPALIVE
#cmakedefine01 HAVE_BUILTIN_MUL_OVERFLOW
#cmakedefine01 HAVE_DISCONNECTX
-#cmakedefine01 HAVE_PTHREAD_SETCANCELSTATE
// Mac OS X has stat64, but it is deprecated since plain stat now
// provides the same 64-bit aware struct when targeting OS X > 10.5
diff --git a/src/libraries/Native/Unix/System.Globalization.Native/CMakeLists.txt b/src/libraries/Native/Unix/System.Globalization.Native/CMakeLists.txt
index 86ddba4d42e5b3..4b1afefef0c910 100644
--- a/src/libraries/Native/Unix/System.Globalization.Native/CMakeLists.txt
+++ b/src/libraries/Native/Unix/System.Globalization.Native/CMakeLists.txt
@@ -13,37 +13,39 @@ if(CLR_CMAKE_TARGET_UNIX)
add_compile_options(-Wno-extra-semi-stmt)
add_compile_options(-Wno-unknown-warning-option)
- set(ICU_HOMEBREW_INC_PATH "/usr/local/opt/icu4c/include")
+ if (NOT CLR_CMAKE_TARGET_ANDROID)
+ set(ICU_HOMEBREW_INC_PATH "/usr/local/opt/icu4c/include")
- find_path(UTYPES_H "unicode/utypes.h" PATHS ${ICU_HOMEBREW_INC_PATH})
- if(UTYPES_H STREQUAL UTYPES_H-NOTFOUND)
- message(FATAL_ERROR "Cannot find utypes.h, try installing libicu-dev (or the appropriate package for your platform)")
- return()
- endif()
-
- if(CLR_CMAKE_TARGET_OSX)
- find_library(ICUCORE icucore)
- if(ICUCORE STREQUAL ICUCORE-NOTFOUND)
- message(FATAL_ERROR "Cannot find libicucore, skipping build for System.Globalization.Native. .NET globalization is not expected to function.")
- return()
- endif()
- add_definitions(-DOSX_ICU_LIBRARY_PATH=\"${ICUCORE}\")
- add_definitions(-DU_DISABLE_RENAMING)
- else()
- find_library(ICUUC icuuc)
- if(ICUUC STREQUAL ICUUC-NOTFOUND)
- message(FATAL_ERROR "Cannot find libicuuc, try installing libicu-dev (or the appropriate package for your platform)")
+ find_path(UTYPES_H "unicode/utypes.h" PATHS ${ICU_HOMEBREW_INC_PATH})
+ if(UTYPES_H STREQUAL UTYPES_H-NOTFOUND)
+ message(FATAL_ERROR "Cannot find utypes.h, try installing libicu-dev (or the appropriate package for your platform)")
return()
endif()
- find_library(ICUI18N icui18n)
- if(ICUI18N STREQUAL ICUI18N-NOTFOUND)
- message(FATAL_ERROR "Cannot find libicui18n, try installing libicu-dev (or the appropriate package for your platform)")
- return()
+ if(CLR_CMAKE_TARGET_OSX)
+ find_library(ICUCORE icucore)
+ if(ICUCORE STREQUAL ICUCORE-NOTFOUND)
+ message(FATAL_ERROR "Cannot find libicucore, skipping build for System.Globalization.Native. .NET globalization is not expected to function.")
+ return()
+ endif()
+ add_definitions(-DOSX_ICU_LIBRARY_PATH=\"${ICUCORE}\")
+ add_definitions(-DU_DISABLE_RENAMING)
+ else()
+ find_library(ICUUC icuuc)
+ if(ICUUC STREQUAL ICUUC-NOTFOUND)
+ message(FATAL_ERROR "Cannot find libicuuc, try installing libicu-dev (or the appropriate package for your platform)")
+ return()
+ endif()
+
+ find_library(ICUI18N icui18n)
+ if(ICUI18N STREQUAL ICUI18N-NOTFOUND)
+ message(FATAL_ERROR "Cannot find libicui18n, try installing libicu-dev (or the appropriate package for your platform)")
+ return()
+ endif()
endif()
- endif()
- include_directories(${UTYPES_H})
+ include_directories(${UTYPES_H})
+ endif()
endif()
include(configure.cmake)
@@ -86,7 +88,7 @@ set_target_properties(System.Globalization.Native-Static PROPERTIES OUTPUT_NAME
install (TARGETS System.Globalization.Native-Static DESTINATION .)
-if(NOT CLR_CMAKE_TARGET_OSX AND NOT CLR_CMAKE_TARGET_IOS)
+if(NOT CLR_CMAKE_TARGET_OSX AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_ANDROID)
if (GEN_SHARED_LIB)
add_custom_command(TARGET System.Globalization.Native POST_BUILD
COMMENT "Verifying System.Globalization.Native.so dependencies"
diff --git a/src/libraries/Native/Unix/System.Globalization.Native/configure.cmake b/src/libraries/Native/Unix/System.Globalization.Native/configure.cmake
index 8919b80537af16..f0042b1a59c43f 100644
--- a/src/libraries/Native/Unix/System.Globalization.Native/configure.cmake
+++ b/src/libraries/Native/Unix/System.Globalization.Native/configure.cmake
@@ -1,32 +1,32 @@
-include(CheckCSourceCompiles)
-include(CheckSymbolExists)
-
if(CLR_CMAKE_TARGET_ANDROID)
- string(REPLACE ";" ":" ANDROID_RPATHS "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}:${CMAKE_SYSTEM_LIBRARY_PATH}")
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -rpath ${ANDROID_RPATHS}")
-endif()
+ set(HAVE_SET_MAX_VARIABLE 1)
+ set(HAVE_UDAT_STANDALONE_SHORTER_WEEKDAYS 1)
+else()
+ include(CheckCSourceCompiles)
+ include(CheckSymbolExists)
-if (CLR_CMAKE_TARGET_UNIX)
- set(CMAKE_REQUIRED_INCLUDES ${UTYPES_H} ${ICU_HOMEBREW_INC_PATH})
+ if (CLR_CMAKE_TARGET_UNIX)
+ set(CMAKE_REQUIRED_INCLUDES ${UTYPES_H} ${ICU_HOMEBREW_INC_PATH})
- CHECK_C_SOURCE_COMPILES("
- #include
- int main(void) { enum UDateFormatSymbolType e = UDAT_STANDALONE_SHORTER_WEEKDAYS; }
- " HAVE_UDAT_STANDALONE_SHORTER_WEEKDAYS)
+ CHECK_C_SOURCE_COMPILES("
+ #include
+ int main(void) { enum UDateFormatSymbolType e = UDAT_STANDALONE_SHORTER_WEEKDAYS; }
+ " HAVE_UDAT_STANDALONE_SHORTER_WEEKDAYS)
- if(CLR_CMAKE_TARGET_OSX)
- set(CMAKE_REQUIRED_LIBRARIES ${ICUCORE})
- else()
- set(CMAKE_REQUIRED_LIBRARIES ${ICUUC} ${ICUI18N})
- endif()
+ if(CLR_CMAKE_TARGET_OSX)
+ set(CMAKE_REQUIRED_LIBRARIES ${ICUCORE})
+ else()
+ set(CMAKE_REQUIRED_LIBRARIES ${ICUUC} ${ICUI18N})
+ endif()
- check_symbol_exists(
- ucol_setMaxVariable
- "unicode/ucol.h"
- HAVE_SET_MAX_VARIABLE)
+ check_symbol_exists(
+ ucol_setMaxVariable
+ "unicode/ucol.h"
+ HAVE_SET_MAX_VARIABLE)
- unset(CMAKE_REQUIRED_LIBRARIES)
- unset(CMAKE_REQUIRED_INCLUDES)
+ unset(CMAKE_REQUIRED_LIBRARIES)
+ unset(CMAKE_REQUIRED_INCLUDES)
+ endif()
endif()
configure_file(
diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim.c b/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim.c
index 6d4dc1e7d477b1..b1a88499d49b2c 100644
--- a/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim.c
+++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim.c
@@ -63,7 +63,54 @@ static int FindICULibs()
return TRUE;
}
-#else // !TARGET_WINDOWS && !TARGET_OSX
+#elif defined(TARGET_ANDROID)
+
+// support ICU versions from 50-255
+#define MinICUVersion 50
+#define MaxICUVersion 255
+#define MaxICUVersionStringLength 4
+
+static int FindSymbolVersion(char* symbolName, char* symbolVersion)
+{
+ for (int i = MinICUVersion; i <= MaxICUVersion; i++)
+ {
+ sprintf(symbolVersion, "_%d", i);
+ sprintf(symbolName, "u_strlen%s", symbolVersion);
+ if (dlsym(libicuuc, symbolName) != NULL)
+ {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+static int FindICULibs(char* symbolName, char* symbolVersion)
+{
+ libicui18n = dlopen("libicui18n.so", RTLD_LAZY);
+
+ if (libicui18n == NULL)
+ {
+ return FALSE;
+ }
+
+ libicuuc = dlopen("libicuuc.so", RTLD_LAZY);
+
+ if (libicuuc == NULL)
+ {
+ return FALSE;
+ }
+
+ if (!FindSymbolVersion(symbolName, symbolVersion))
+ {
+ fprintf(stderr, "Cannot determine ICU version.");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+#else // !TARGET_WINDOWS && !TARGET_OSX && !TARGET_ANDROID
#define VERSION_PREFIX_NONE ""
#define VERSION_PREFIX_SUSE "suse"
@@ -299,6 +346,12 @@ int32_t GlobalizationNative_LoadICU()
char symbolName[128];
char symbolVersion[MaxICUVersionStringLength + 1] = "";
+#if defined(TARGET_ANDROID)
+ if (!FindICULibs(symbolName, symbolVersion))
+ {
+ return FALSE;
+ }
+#else
if (!FindICULibs(VERSION_PREFIX_NONE, symbolName, symbolVersion))
{
if (!FindICULibs(VERSION_PREFIX_SUSE, symbolName, symbolVersion))
@@ -306,6 +359,7 @@ int32_t GlobalizationNative_LoadICU()
return FALSE;
}
}
+#endif
// Get pointers to all the ICU functions that are needed
#define PER_FUNCTION_BLOCK(fn, lib) \
diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim_internal.h b/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim_internal.h
index 2ee8fab76b09b5..a13ea5f7ad9219 100644
--- a/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim_internal.h
+++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim_internal.h
@@ -12,6 +12,10 @@
#include "config.h"
+#if defined(TARGET_ANDROID)
+#include "pal_icushim_internal_android.h"
+#else
+
#define U_DISABLE_RENAMING 1
// All ICU headers need to be included here so that all function prototypes are
@@ -35,6 +39,8 @@
#include
#include
+#endif
+
#elif defined(TARGET_WINDOWS)
#include "icu.h"
diff --git a/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim_internal_android.h b/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim_internal_android.h
new file mode 100644
index 00000000000000..5a3ac55072e860
--- /dev/null
+++ b/src/libraries/Native/Unix/System.Globalization.Native/pal_icushim_internal_android.h
@@ -0,0 +1,515 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+//
+
+// definitions for ICU types and functions available in Android,
+// extracted from ICU header files
+
+#pragma once
+
+#define U_MAX_VERSION_LENGTH 4
+
+#define U_SUCCESS(x) ((x)<=U_ZERO_ERROR)
+#define U_FAILURE(x) ((x)>U_ZERO_ERROR)
+
+typedef struct UCollator UCollator;
+typedef struct UCollationElements UCollationElements;
+typedef struct UEnumeration UEnumeration;
+typedef struct UIDNA UIDNA;
+typedef struct UNormalizer2 UNormalizer2;
+typedef struct ULocaleDisplayNames ULocaleDisplayNames;
+typedef struct UResourceBundle UResourceBundle;
+typedef struct UStringSearch UStringSearch;
+typedef struct UBreakIterator UBreakIterator;
+
+typedef int8_t UBool;
+typedef uint16_t UChar;
+typedef int32_t UChar32;
+typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH];
+
+typedef void* UNumberFormat;
+typedef void* UDateFormat;
+typedef void* UDateTimePatternGenerator;
+typedef void* UCalendar;
+
+#ifndef TRUE
+# define TRUE 1
+#endif
+#ifndef FALSE
+# define FALSE 0
+#endif
+
+#define USEARCH_DONE -1
+
+#define UCOL_NULLORDER ((int32_t)0xFFFFFFFF)
+#define UCOL_BUILDER_VERSION 9
+#define UCOL_RUNTIME_VERSION 9
+
+#define ULOC_FULLNAME_CAPACITY 157
+#define ULOC_LANG_CAPACITY 12
+#define ULOC_KEYWORDS_CAPACITY 96
+#define ULOC_ENGLISH "en"
+#define ULOC_US "en_US"
+
+#define U16_IS_LEAD(c) (((c)&0xfffffc00)==0xd800)
+#define U16_IS_TRAIL(c) (((c)&0xfffffc00)==0xdc00)
+#define U16_SURROGATE_OFFSET ((0xd800<<10UL)+0xdc00-0x10000)
+
+#define U16_GET_SUPPLEMENTARY(lead, trail) \
+ (((UChar32)(lead)<<10UL)+(UChar32)(trail)-U16_SURROGATE_OFFSET)
+
+#define U16_APPEND(s, i, capacity, c, isError) { \
+ if((uint32_t)(c)<=0xffff) { \
+ (s)[(i)++]=(uint16_t)(c); \
+ } else if((uint32_t)(c)<=0x10ffff && (i)+1<(capacity)) { \
+ (s)[(i)++]=(uint16_t)(((c)>>10)+0xd7c0); \
+ (s)[(i)++]=(uint16_t)(((c)&0x3ff)|0xdc00); \
+ } else { \
+ (isError)=TRUE; \
+ } \
+}
+
+#define U16_NEXT(s, i, length, c) { \
+ (c)=(s)[(i)++]; \
+ if(U16_IS_LEAD(c)) { \
+ uint16_t __c2; \
+ if((i)!=(length) && U16_IS_TRAIL(__c2=(s)[(i)])) { \
+ ++(i); \
+ (c)=U16_GET_SUPPLEMENTARY((c), __c2); \
+ } \
+ } \
+}
+
+#define U16_FWD_1(s, i, length) { \
+ if(U16_IS_LEAD((s)[(i)++]) && (i)!=(length) && U16_IS_TRAIL((s)[i])) { \
+ ++(i); \
+ } \
+}
+
+#define UIDNA_INFO_INITIALIZER { \
+ (int16_t)sizeof(UIDNAInfo), \
+ FALSE, FALSE, \
+ 0, 0, 0 }
+
+typedef enum UErrorCode {
+ U_STRING_NOT_TERMINATED_WARNING = -124,
+ U_ZERO_ERROR = 0,
+ U_ILLEGAL_ARGUMENT_ERROR = 1,
+ U_INTERNAL_PROGRAM_ERROR = 5,
+ U_MEMORY_ALLOCATION_ERROR = 7,
+ U_BUFFER_OVERFLOW_ERROR = 15,
+ U_UNSUPPORTED_ERROR = 16,
+} UErrorCode;
+
+typedef enum UCalendarDateFields {
+ UCAL_ERA,
+ UCAL_YEAR,
+ UCAL_MONTH,
+ UCAL_WEEK_OF_YEAR,
+ UCAL_WEEK_OF_MONTH,
+ UCAL_DATE,
+ UCAL_DAY_OF_YEAR,
+ UCAL_DAY_OF_WEEK,
+ UCAL_DAY_OF_WEEK_IN_MONTH,
+ UCAL_AM_PM,
+ UCAL_HOUR,
+ UCAL_HOUR_OF_DAY,
+ UCAL_MINUTE,
+ UCAL_SECOND,
+ UCAL_MILLISECOND,
+ UCAL_ZONE_OFFSET,
+ UCAL_DST_OFFSET,
+ UCAL_YEAR_WOY,
+ UCAL_DOW_LOCAL,
+ UCAL_EXTENDED_YEAR,
+ UCAL_JULIAN_DAY,
+ UCAL_MILLISECONDS_IN_DAY,
+ UCAL_IS_LEAP_MONTH,
+ UCAL_FIELD_COUNT,
+ UCAL_DAY_OF_MONTH = UCAL_DATE
+} UCalendarDateFields;
+
+typedef enum UColAttribute {
+ UCOL_FRENCH_COLLATION,
+ UCOL_ALTERNATE_HANDLING,
+ UCOL_CASE_FIRST,
+ UCOL_CASE_LEVEL,
+ UCOL_NORMALIZATION_MODE,
+ UCOL_DECOMPOSITION_MODE = UCOL_NORMALIZATION_MODE,
+ UCOL_STRENGTH,
+ UCOL_NUMERIC_COLLATION = UCOL_STRENGTH + 2,
+ UCOL_ATTRIBUTE_COUNT
+} UColAttribute;
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wduplicate-enum"
+typedef enum UColAttributeValue {
+ UCOL_DEFAULT = -1,
+ UCOL_PRIMARY = 0,
+ UCOL_SECONDARY = 1,
+ UCOL_TERTIARY = 2,
+ UCOL_DEFAULT_STRENGTH = UCOL_TERTIARY,
+ UCOL_CE_STRENGTH_LIMIT,
+ UCOL_QUATERNARY=3,
+ UCOL_IDENTICAL=15,
+ UCOL_STRENGTH_LIMIT,
+ UCOL_OFF = 16,
+ UCOL_ON = 17,
+ UCOL_SHIFTED = 20,
+ UCOL_NON_IGNORABLE = 21,
+ UCOL_LOWER_FIRST = 24,
+ UCOL_UPPER_FIRST = 25,
+} UColAttributeValue;
+#pragma clang diagnostic pop
+
+typedef UColAttributeValue UCollationStrength;
+
+typedef enum UCalendarAttribute {
+ UCAL_LENIENT,
+ UCAL_FIRST_DAY_OF_WEEK,
+ UCAL_MINIMAL_DAYS_IN_FIRST_WEEK,
+ UCAL_REPEATED_WALL_TIME,
+ UCAL_SKIPPED_WALL_TIME
+} UCalendarAttribute;
+
+typedef enum UCalendarLimitType {
+ UCAL_MINIMUM,
+ UCAL_MAXIMUM,
+ UCAL_GREATEST_MINIMUM,
+ UCAL_LEAST_MAXIMUM,
+ UCAL_ACTUAL_MINIMUM,
+ UCAL_ACTUAL_MAXIMUM
+} UCalendarLimitType;
+
+typedef enum UCalendarDisplayNameType {
+ UCAL_STANDARD,
+ UCAL_SHORT_STANDARD,
+ UCAL_DST,
+ UCAL_SHORT_DST
+} UCalendarDisplayNameType;
+
+typedef enum ULayoutType {
+ ULOC_LAYOUT_LTR = 0,
+ ULOC_LAYOUT_RTL = 1,
+ ULOC_LAYOUT_TTB = 2,
+ ULOC_LAYOUT_BTT = 3,
+ ULOC_LAYOUT_UNKNOWN
+} ULayoutType;
+
+typedef enum UDialectHandling {
+ ULDN_STANDARD_NAMES = 0,
+ ULDN_DIALECT_NAMES
+} UDialectHandling;
+
+typedef enum UMeasurementSystem {
+ UMS_SI,
+ UMS_US,
+ UMS_UK,
+} UMeasurementSystem;
+
+typedef enum UNumberFormatSymbol {
+ UNUM_DECIMAL_SEPARATOR_SYMBOL = 0,
+ UNUM_GROUPING_SEPARATOR_SYMBOL = 1,
+ UNUM_PATTERN_SEPARATOR_SYMBOL = 2,
+ UNUM_PERCENT_SYMBOL = 3,
+ UNUM_ZERO_DIGIT_SYMBOL = 4,
+ UNUM_DIGIT_SYMBOL = 5,
+ UNUM_MINUS_SIGN_SYMBOL = 6,
+ UNUM_PLUS_SIGN_SYMBOL = 7,
+ UNUM_CURRENCY_SYMBOL = 8,
+ UNUM_INTL_CURRENCY_SYMBOL = 9,
+ UNUM_MONETARY_SEPARATOR_SYMBOL = 10,
+ UNUM_EXPONENTIAL_SYMBOL = 11,
+ UNUM_PERMILL_SYMBOL = 12,
+ UNUM_PAD_ESCAPE_SYMBOL = 13,
+ UNUM_INFINITY_SYMBOL = 14,
+ UNUM_NAN_SYMBOL = 15,
+ UNUM_SIGNIFICANT_DIGIT_SYMBOL = 16,
+ UNUM_MONETARY_GROUPING_SEPARATOR_SYMBOL = 17,
+ UNUM_ONE_DIGIT_SYMBOL = 18,
+ UNUM_TWO_DIGIT_SYMBOL = 19,
+ UNUM_THREE_DIGIT_SYMBOL = 20,
+ UNUM_FOUR_DIGIT_SYMBOL = 21,
+ UNUM_FIVE_DIGIT_SYMBOL = 22,
+ UNUM_SIX_DIGIT_SYMBOL = 23,
+ UNUM_SEVEN_DIGIT_SYMBOL = 24,
+ UNUM_EIGHT_DIGIT_SYMBOL = 25,
+ UNUM_NINE_DIGIT_SYMBOL = 26,
+ UNUM_EXPONENT_MULTIPLICATION_SYMBOL = 27,
+} UNumberFormatSymbol;
+
+typedef enum UNumberFormatAttribute {
+ UNUM_PARSE_INT_ONLY,
+ UNUM_GROUPING_USED,
+ UNUM_DECIMAL_ALWAYS_SHOWN,
+ UNUM_MAX_INTEGER_DIGITS,
+ UNUM_MIN_INTEGER_DIGITS,
+ UNUM_INTEGER_DIGITS,
+ UNUM_MAX_FRACTION_DIGITS,
+ UNUM_MIN_FRACTION_DIGITS,
+ UNUM_FRACTION_DIGITS,
+ UNUM_MULTIPLIER,
+ UNUM_GROUPING_SIZE,
+ UNUM_ROUNDING_MODE,
+ UNUM_ROUNDING_INCREMENT,
+ UNUM_FORMAT_WIDTH,
+ UNUM_PADDING_POSITION,
+ UNUM_SECONDARY_GROUPING_SIZE,
+ UNUM_SIGNIFICANT_DIGITS_USED,
+ UNUM_MIN_SIGNIFICANT_DIGITS,
+ UNUM_MAX_SIGNIFICANT_DIGITS,
+ UNUM_LENIENT_PARSE,
+ UNUM_SCALE = 21,
+ UNUM_CURRENCY_USAGE = 23,
+ UNUM_MAX_NONBOOLEAN_ATTRIBUTE = 0x0FFF,
+ UNUM_FORMAT_FAIL_IF_MORE_THAN_MAX_DIGITS = 0x1000,
+ UNUM_PARSE_NO_EXPONENT,
+ UNUM_PARSE_DECIMAL_MARK_REQUIRED = 0x1002,
+ UNUM_LIMIT_BOOLEAN_ATTRIBUTE = 0x1003
+} UNumberFormatAttribute;
+
+typedef enum UNumberFormatStyle {
+ UNUM_PATTERN_DECIMAL = 0,
+ UNUM_DECIMAL = 1,
+ UNUM_CURRENCY = 2,
+ UNUM_PERCENT = 3,
+ UNUM_SCIENTIFIC = 4,
+ UNUM_SPELLOUT = 5,
+ UNUM_ORDINAL = 6,
+ UNUM_DURATION = 7,
+ UNUM_NUMBERING_SYSTEM = 8,
+ UNUM_PATTERN_RULEBASED = 9,
+ UNUM_CURRENCY_ISO = 10,
+ UNUM_CURRENCY_PLURAL = 11,
+ UNUM_CURRENCY_ACCOUNTING = 12,
+ UNUM_CASH_CURRENCY = 13,
+ UNUM_DECIMAL_COMPACT_SHORT = 14,
+ UNUM_DECIMAL_COMPACT_LONG = 15,
+ UNUM_CURRENCY_STANDARD = 16,
+ UNUM_DEFAULT = UNUM_DECIMAL,
+ UNUM_IGNORE = UNUM_PATTERN_DECIMAL
+} UNumberFormatStyle;
+
+typedef enum UScriptCode {
+ USCRIPT_UNKNOWN = 103,
+} UScriptCode;
+
+typedef enum UColReorderCode {
+ UCOL_REORDER_CODE_DEFAULT = -1,
+ UCOL_REORDER_CODE_NONE = USCRIPT_UNKNOWN,
+ UCOL_REORDER_CODE_OTHERS = USCRIPT_UNKNOWN,
+ UCOL_REORDER_CODE_SPACE = 0x1000,
+ UCOL_REORDER_CODE_FIRST = UCOL_REORDER_CODE_SPACE,
+ UCOL_REORDER_CODE_PUNCTUATION = 0x1001,
+ UCOL_REORDER_CODE_SYMBOL = 0x1002,
+ UCOL_REORDER_CODE_CURRENCY = 0x1003,
+ UCOL_REORDER_CODE_DIGIT = 0x1004,
+} UColReorderCode;
+
+typedef enum UDateFormatStyle {
+ UDAT_FULL,
+ UDAT_LONG,
+ UDAT_MEDIUM,
+ UDAT_SHORT,
+ UDAT_DEFAULT = UDAT_MEDIUM,
+ UDAT_RELATIVE = (1 << 7),
+ UDAT_FULL_RELATIVE = UDAT_FULL | UDAT_RELATIVE,
+ UDAT_LONG_RELATIVE = UDAT_LONG | UDAT_RELATIVE,
+ UDAT_MEDIUM_RELATIVE = UDAT_MEDIUM | UDAT_RELATIVE,
+ UDAT_SHORT_RELATIVE = UDAT_SHORT | UDAT_RELATIVE,
+ UDAT_NONE = -1,
+ UDAT_PATTERN = -2,
+} UDateFormatStyle;
+
+typedef enum UDateFormatSymbolType {
+ UDAT_ERAS,
+ UDAT_MONTHS,
+ UDAT_SHORT_MONTHS,
+ UDAT_WEEKDAYS,
+ UDAT_SHORT_WEEKDAYS,
+ UDAT_AM_PMS,
+ UDAT_LOCALIZED_CHARS,
+ UDAT_ERA_NAMES,
+ UDAT_NARROW_MONTHS,
+ UDAT_NARROW_WEEKDAYS,
+ UDAT_STANDALONE_MONTHS,
+ UDAT_STANDALONE_SHORT_MONTHS,
+ UDAT_STANDALONE_NARROW_MONTHS,
+ UDAT_STANDALONE_WEEKDAYS,
+ UDAT_STANDALONE_SHORT_WEEKDAYS,
+ UDAT_STANDALONE_NARROW_WEEKDAYS,
+ UDAT_QUARTERS,
+ UDAT_SHORT_QUARTERS,
+ UDAT_STANDALONE_QUARTERS,
+ UDAT_STANDALONE_SHORT_QUARTERS,
+ UDAT_SHORTER_WEEKDAYS,
+ UDAT_STANDALONE_SHORTER_WEEKDAYS,
+ UDAT_CYCLIC_YEARS_WIDE,
+ UDAT_CYCLIC_YEARS_ABBREVIATED,
+ UDAT_CYCLIC_YEARS_NARROW,
+ UDAT_ZODIAC_NAMES_WIDE,
+ UDAT_ZODIAC_NAMES_ABBREVIATED,
+ UDAT_ZODIAC_NAMES_NARROW
+} UDateFormatSymbolType;
+
+typedef enum UCurrNameStyle {
+ UCURR_SYMBOL_NAME,
+ UCURR_LONG_NAME
+} UCurrNameStyle;
+
+typedef enum UCalendarType {
+ UCAL_TRADITIONAL,
+ UCAL_DEFAULT = UCAL_TRADITIONAL,
+ UCAL_GREGORIAN
+} UCalendarType;
+
+typedef enum UCollationResult {
+ UCOL_EQUAL = 0,
+ UCOL_GREATER = 1,
+ UCOL_LESS = -1
+} UCollationResult;
+
+enum {
+ UIDNA_ERROR_EMPTY_LABEL = 1,
+ UIDNA_ERROR_LABEL_TOO_LONG = 2,
+ UIDNA_ERROR_DOMAIN_NAME_TOO_LONG = 4,
+ UIDNA_ERROR_LEADING_HYPHEN = 8,
+ UIDNA_ERROR_TRAILING_HYPHEN = 0x10,
+ UIDNA_ERROR_HYPHEN_3_4 = 0x20,
+ UIDNA_ERROR_LEADING_COMBINING_MARK = 0x40,
+ UIDNA_ERROR_DISALLOWED = 0x80,
+ UIDNA_ERROR_PUNYCODE = 0x100,
+ UIDNA_ERROR_LABEL_HAS_DOT = 0x200,
+ UIDNA_ERROR_INVALID_ACE_LABEL = 0x400,
+ UIDNA_ERROR_BIDI = 0x800,
+ UIDNA_ERROR_CONTEXTJ = 0x1000,
+ UIDNA_ERROR_CONTEXTO_PUNCTUATION = 0x2000,
+ UIDNA_ERROR_CONTEXTO_DIGITS = 0x4000
+};
+
+enum {
+ UIDNA_DEFAULT = 0,
+ UIDNA_ALLOW_UNASSIGNED = 1,
+ UIDNA_USE_STD3_RULES = 2,
+ UIDNA_CHECK_BIDI = 4,
+ UIDNA_CHECK_CONTEXTJ = 8,
+ UIDNA_NONTRANSITIONAL_TO_ASCII = 0x10,
+ UIDNA_NONTRANSITIONAL_TO_UNICODE = 0x20,
+ UIDNA_CHECK_CONTEXTO = 0x40
+};
+
+enum {
+ U_PARSE_CONTEXT_LEN = 16
+};
+
+typedef struct UParseError {
+ int32_t line;
+ int32_t offset;
+ UChar preContext[U_PARSE_CONTEXT_LEN];
+ UChar postContext[U_PARSE_CONTEXT_LEN];
+
+} UParseError;
+
+typedef struct UIDNAInfo {
+ int16_t size;
+ UBool isTransitionalDifferent;
+ UBool reservedB3;
+ uint32_t errors;
+ int32_t reservedI2;
+ int32_t reservedI3;
+} UIDNAInfo;
+
+
+
+void u_charsToUChars(const char * cs, UChar * us, int32_t length);
+void u_getVersion(UVersionInfo versionArray);
+int32_t u_strlen(const UChar * s);
+UChar * u_strncpy(UChar * dst, const UChar * src, int32_t n);
+UChar32 u_tolower(UChar32 c);
+UChar32 u_toupper(UChar32 c);
+void ucal_add(UCalendar * cal, UCalendarDateFields field, int32_t amount, UErrorCode * status);
+void ucal_close(UCalendar * cal);
+int32_t ucal_get(const UCalendar * cal, UCalendarDateFields field, UErrorCode * status);
+int32_t ucal_getAttribute(const UCalendar * cal, UCalendarAttribute attr);
+UEnumeration * ucal_getKeywordValuesForLocale(const char * key, const char * locale, UBool commonlyUsed, UErrorCode * status);
+int32_t ucal_getLimit(const UCalendar * cal, UCalendarDateFields field, UCalendarLimitType type, UErrorCode * status);
+int32_t ucal_getTimeZoneDisplayName(const UCalendar * cal, UCalendarDisplayNameType type, const char * locale, UChar * result, int32_t resultLength, UErrorCode * status);
+UCalendar * ucal_open(const UChar * zoneID, int32_t len, const char * locale, UCalendarType type, UErrorCode * status);
+void ucal_set(UCalendar * cal, UCalendarDateFields field, int32_t value);
+void ucol_close(UCollator * coll);
+void ucol_closeElements(UCollationElements * elems);
+const UChar * ucol_getRules(const UCollator * coll, int32_t * length);
+int32_t ucol_getSortKey(const UCollator * coll, const UChar * source, int32_t sourceLength, uint8_t * result, int32_t resultLength);
+UCollationStrength ucol_getStrength(const UCollator * coll);
+void ucol_getVersion(const UCollator * coll, UVersionInfo info);
+int32_t ucol_next(UCollationElements * elems, UErrorCode * status);
+int32_t ucol_previous(UCollationElements * elems, UErrorCode * status);
+UCollator * ucol_open(const char * loc, UErrorCode * status);
+UCollationElements * ucol_openElements(const UCollator * coll, const UChar * text, int32_t textLength, UErrorCode * status);
+UCollator * ucol_openRules(const UChar * rules, int32_t rulesLength, UColAttributeValue normalizationMode, UCollationStrength strength, UParseError * parseError, UErrorCode * status);
+UCollator * ucol_safeClone(const UCollator * coll, void * stackBuffer, int32_t * pBufferSize, UErrorCode * status);
+void ucol_setAttribute(UCollator * coll, UColAttribute attr, UColAttributeValue value, UErrorCode * status);
+UCollationResult ucol_strcoll(const UCollator * coll, const UChar * source, int32_t sourceLength, const UChar * target, int32_t targetLength);
+int32_t ucurr_forLocale(const char * locale, UChar * buff, int32_t buffCapacity, UErrorCode * ec);
+const UChar * ucurr_getName(const UChar * currency, const char * locale, UCurrNameStyle nameStyle, UBool * isChoiceFormat, int32_t * len, UErrorCode * ec);
+void udat_close(UDateFormat * format);
+int32_t udat_countSymbols(const UDateFormat * fmt, UDateFormatSymbolType type);
+int32_t udat_getSymbols(const UDateFormat * fmt, UDateFormatSymbolType type, int32_t symbolIndex, UChar * result, int32_t resultLength, UErrorCode * status);
+UDateFormat * udat_open(UDateFormatStyle timeStyle, UDateFormatStyle dateStyle, const char * locale, const UChar * tzID, int32_t tzIDLength, const UChar * pattern, int32_t patternLength, UErrorCode * status);
+void udat_setCalendar(UDateFormat * fmt, const UCalendar * calendarToSet);
+int32_t udat_toPattern(const UDateFormat * fmt, UBool localized, UChar * result, int32_t resultLength, UErrorCode * status);
+void udatpg_close(UDateTimePatternGenerator * dtpg);
+int32_t udatpg_getBestPattern(UDateTimePatternGenerator * dtpg, const UChar * skeleton, int32_t length, UChar * bestPattern, int32_t capacity, UErrorCode * pErrorCode);
+UDateTimePatternGenerator * udatpg_open(const char * locale, UErrorCode * pErrorCode);
+void uenum_close(UEnumeration * en);
+int32_t uenum_count(UEnumeration * en, UErrorCode * status);
+const char * uenum_next(UEnumeration * en, int32_t * resultLength, UErrorCode * status);
+void uidna_close(UIDNA * idna);
+int32_t uidna_nameToASCII(const UIDNA * idna, const UChar * name, int32_t length, UChar * dest, int32_t capacity, UIDNAInfo * pInfo, UErrorCode * pErrorCode);
+int32_t uidna_nameToUnicode(const UIDNA * idna, const UChar * name, int32_t length, UChar * dest, int32_t capacity, UIDNAInfo * pInfo, UErrorCode * pErrorCode);
+UIDNA * uidna_openUTS46(uint32_t options, UErrorCode * pErrorCode);
+void uldn_close(ULocaleDisplayNames * ldn);
+int32_t uldn_keyValueDisplayName(const ULocaleDisplayNames * ldn, const char * key, const char * value, UChar * result, int32_t maxResultSize, UErrorCode * pErrorCode);
+ULocaleDisplayNames * uldn_open(const char * locale, UDialectHandling dialectHandling, UErrorCode * pErrorCode);
+int32_t uloc_canonicalize(const char * localeID, char * name, int32_t nameCapacity, UErrorCode * err);
+int32_t uloc_countAvailable(void);
+const char * uloc_getAvailable(int32_t n);
+int32_t uloc_getBaseName(const char * localeID, char * name, int32_t nameCapacity, UErrorCode * err);
+ULayoutType uloc_getCharacterOrientation(const char * localeId, UErrorCode * status);
+int32_t uloc_getCountry(const char * localeID, char * country, int32_t countryCapacity, UErrorCode * err);
+const char * uloc_getDefault(void);
+int32_t uloc_getDisplayCountry(const char * locale, const char * displayLocale, UChar * country, int32_t countryCapacity, UErrorCode * status);
+int32_t uloc_getDisplayLanguage(const char * locale, const char * displayLocale, UChar * language, int32_t languageCapacity, UErrorCode * status);
+int32_t uloc_getDisplayName(const char * localeID, const char * inLocaleID, UChar * result, int32_t maxResultSize, UErrorCode * err);
+const char * uloc_getISO3Country(const char * localeID);
+const char * uloc_getISO3Language(const char * localeID);
+int32_t uloc_getKeywordValue(const char * localeID, const char * keywordName, char * buffer, int32_t bufferCapacity, UErrorCode * status);
+int32_t uloc_getLanguage(const char * localeID, char * language, int32_t languageCapacity, UErrorCode * err);
+uint32_t uloc_getLCID(const char * localeID);
+int32_t uloc_getName(const char * localeID, char * name, int32_t nameCapacity, UErrorCode * err);
+int32_t uloc_getParent(const char * localeID, char * parent, int32_t parentCapacity, UErrorCode * err);
+int32_t uloc_setKeywordValue(const char * keywordName, const char * keywordValue, char * buffer, int32_t bufferCapacity, UErrorCode * status);
+UMeasurementSystem ulocdata_getMeasurementSystem(const char * localeID, UErrorCode * status);
+const UNormalizer2 * unorm2_getNFCInstance(UErrorCode * pErrorCode);
+const UNormalizer2 * unorm2_getNFDInstance(UErrorCode * pErrorCode);
+const UNormalizer2 * unorm2_getNFKCInstance(UErrorCode * pErrorCode);
+const UNormalizer2 * unorm2_getNFKDInstance(UErrorCode * pErrorCode);
+UBool unorm2_isNormalized(const UNormalizer2 * norm2, const UChar * s, int32_t length, UErrorCode * pErrorCode);
+int32_t unorm2_normalize(const UNormalizer2 * norm2, const UChar * src, int32_t length, UChar * dest, int32_t capacity, UErrorCode * pErrorCode);
+void unum_close(UNumberFormat * fmt);
+int32_t unum_getAttribute(const UNumberFormat * fmt, UNumberFormatAttribute attr);
+int32_t unum_getSymbol(const UNumberFormat * fmt, UNumberFormatSymbol symbol, UChar * buffer, int32_t size, UErrorCode * status);
+UNumberFormat * unum_open(UNumberFormatStyle style, const UChar * pattern, int32_t patternLength, const char * locale, UParseError * parseErr, UErrorCode * status);
+int32_t unum_toPattern(const UNumberFormat * fmt, UBool isPatternLocalized, UChar * result, int32_t resultLength, UErrorCode * status);
+void ures_close(UResourceBundle * resourceBundle);
+UResourceBundle * ures_getByKey(const UResourceBundle * resourceBundle, const char * key, UResourceBundle * fillIn, UErrorCode * status);
+int32_t ures_getSize(const UResourceBundle * resourceBundle);
+const UChar * ures_getStringByIndex(const UResourceBundle * resourceBundle, int32_t indexS, int32_t * len, UErrorCode * status);
+UResourceBundle * ures_open(const char * packageName, const char * locale, UErrorCode * status);
+void usearch_close(UStringSearch * searchiter);
+int32_t usearch_first(UStringSearch * strsrch, UErrorCode * status);
+int32_t usearch_getMatchedLength(const UStringSearch * strsrch);
+int32_t usearch_last(UStringSearch * strsrch, UErrorCode * status);
+UStringSearch * usearch_openFromCollator(const UChar * pattern, int32_t patternlength, const UChar * text, int32_t textlength, const UCollator * collator, UBreakIterator * breakiter, UErrorCode * status);
+void ucol_setMaxVariable(UCollator * coll, UColReorderCode group, UErrorCode * pErrorCode);
diff --git a/src/libraries/Native/Unix/System.IO.Compression.Native/CMakeLists.txt b/src/libraries/Native/Unix/System.IO.Compression.Native/CMakeLists.txt
index b01e5210716898..aea162451fa939 100644
--- a/src/libraries/Native/Unix/System.IO.Compression.Native/CMakeLists.txt
+++ b/src/libraries/Native/Unix/System.IO.Compression.Native/CMakeLists.txt
@@ -2,6 +2,9 @@ project(System.IO.Compression.Native C)
if (CLR_CMAKE_TARGET_WASM)
add_definitions(-s USE_ZLIB)
+elseif (CLR_CMAKE_TARGET_ANDROID)
+ # need special case here since we want to link against libz.so but find_package() would resolve libz.a
+ set(ZLIB_LIBRARIES z)
else ()
find_package(ZLIB REQUIRED)
endif ()
diff --git a/src/libraries/Native/Unix/System.Native/pal_console.c b/src/libraries/Native/Unix/System.Native/pal_console.c
index 00ca624c1b840b..9841a1b7acf8e7 100644
--- a/src/libraries/Native/Unix/System.Native/pal_console.c
+++ b/src/libraries/Native/Unix/System.Native/pal_console.c
@@ -34,7 +34,7 @@ int32_t SystemNative_GetWindowSize(WinSize* windowSize)
return error;
#else
- (void)windowSize; // unused
+ memset(windowSize, 0, sizeof(WinSize)); // managed out param must be initialized
errno = ENOTSUP;
return -1;
#endif
diff --git a/src/libraries/Native/Unix/System.Native/pal_interfaceaddresses.c b/src/libraries/Native/Unix/System.Native/pal_interfaceaddresses.c
index 4d090d3d9686a5..a18257839cbf9a 100644
--- a/src/libraries/Native/Unix/System.Native/pal_interfaceaddresses.c
+++ b/src/libraries/Native/Unix/System.Native/pal_interfaceaddresses.c
@@ -48,6 +48,7 @@
#endif
#endif
+#if HAVE_GETIFADDRS
// Convert mask to prefix length e.g. 255.255.255.0 -> 24
// mask parameter is pointer to buffer where address starts and length is
// buffer length e.g. 4 for IPv4 and 16 for IPv6.
@@ -87,11 +88,13 @@ static inline uint8_t mask2prefix(uint8_t* mask, int length)
return len;
}
+#endif
int32_t SystemNative_EnumerateInterfaceAddresses(IPv4AddressFound onIpv4Found,
IPv6AddressFound onIpv6Found,
LinkLayerAddressFound onLinkLayerFound)
{
+#if HAVE_GETIFADDRS
struct ifaddrs* headAddr;
if (getifaddrs(&headAddr) == -1)
{
@@ -203,10 +206,19 @@ int32_t SystemNative_EnumerateInterfaceAddresses(IPv4AddressFound onIpv4Found,
freeifaddrs(headAddr);
return 0;
+#else
+ // Not supported on e.g. Android. Also, prevent a compiler error because parameters are unused
+ (void)onIpv4Found;
+ (void)onIpv6Found;
+ (void)onLinkLayerFound;
+ errno = ENOTSUP;
+ return -1;
+#endif
}
int32_t SystemNative_GetNetworkInterfaces(int32_t * interfaceCount, NetworkInterfaceInfo **interfaceList, int32_t * addressCount, IpAddressInfo **addressList )
{
+#if HAVE_GETIFADDRS
struct ifaddrs* head; // Pointer to block allocated by getifaddrs().
struct ifaddrs* ifaddrsEntry;
IpAddressInfo *ai;
@@ -408,6 +420,15 @@ int32_t SystemNative_GetNetworkInterfaces(int32_t * interfaceCount, NetworkInter
}
return 0;
+#else
+ // Not supported on e.g. Android. Also, prevent a compiler error because parameters are unused
+ (void)interfaceCount;
+ (void)interfaceList;
+ (void)addressCount;
+ (void)addressList;
+ errno = ENOTSUP;
+ return -1;
+#endif
}
#if HAVE_RT_MSGHDR
diff --git a/src/libraries/Native/Unix/System.Native/pal_networking.c b/src/libraries/Native/Unix/System.Native/pal_networking.c
index f036fe98029909..7faa21b3923ac8 100644
--- a/src/libraries/Native/Unix/System.Native/pal_networking.c
+++ b/src/libraries/Native/Unix/System.Native/pal_networking.c
@@ -531,7 +531,7 @@ int32_t SystemNative_GetDomainName(uint8_t* name, int32_t nameLength)
// On Android, there's no getdomainname but we can use uname to fetch the domain name
// of the current device
size_t namelen = (uint32_t)nameLength;
- utsname uts;
+ struct utsname uts;
// If uname returns an error, bail out.
if (uname(&uts) == -1)
@@ -547,7 +547,7 @@ int32_t SystemNative_GetDomainName(uint8_t* name, int32_t nameLength)
}
// Copy the domain name
- SafeStringCopy((char*)name, nameLength, uts.domainname);
+ SafeStringCopy((char*)name, namelen, uts.domainname);
return 0;
#else
// GetDomainName is not supported on this platform.
diff --git a/src/libraries/Native/Unix/System.Native/pal_process.c b/src/libraries/Native/Unix/System.Native/pal_process.c
index 641ac120a3269a..d05eb9335691a8 100644
--- a/src/libraries/Native/Unix/System.Native/pal_process.c
+++ b/src/libraries/Native/Unix/System.Native/pal_process.c
@@ -230,7 +230,7 @@ int32_t SystemNative_ForkAndExecProcess(const char* filename,
sigset_t signal_set;
sigset_t old_signal_set;
-#ifndef HAVE_PTHREAD_SETCANCELSTATE
+#if HAVE_PTHREAD_SETCANCELSTATE
int thread_cancel_state;
// None of this code can be canceled without leaking handles, so just don't allow it
@@ -382,7 +382,7 @@ int32_t SystemNative_ForkAndExecProcess(const char* filename,
}
if (!sigaction(sig, NULL, &sa_old))
{
- void (*oldhandler)(int) = (sa_old.sa_flags & SA_SIGINFO) ? (void (*)(int))sa_old.sa_sigaction : sa_old.sa_handler;
+ void (*oldhandler)(int) = (((unsigned int)sa_old.sa_flags) & SA_SIGINFO) ? (void (*)(int))sa_old.sa_sigaction : sa_old.sa_handler;
if (oldhandler != SIG_IGN && oldhandler != SIG_DFL)
{
// It has a custom handler, put the default handler back.
@@ -501,7 +501,7 @@ done:;
errno = priorErrno;
}
-#ifndef HAVE_PTHREAD_SETCANCELSTATE
+#if HAVE_PTHREAD_SETCANCELSTATE
// Restore thread cancel state
pthread_setcancelstate(thread_cancel_state, &thread_cancel_state);
#endif
diff --git a/src/libraries/Native/Unix/configure.cmake b/src/libraries/Native/Unix/configure.cmake
index 30b76c018913e5..bba87eba0f125b 100644
--- a/src/libraries/Native/Unix/configure.cmake
+++ b/src/libraries/Native/Unix/configure.cmake
@@ -6,9 +6,11 @@ include(CheckPrototypeDefinition)
include(CheckStructHasMember)
include(CheckSymbolExists)
include(CheckTypeSize)
-include(CheckFunctionExists)
-if (CLR_CMAKE_TARGET_LINUX)
+
+if (CLR_CMAKE_TARGET_ANDROID)
+ set(PAL_UNIX_NAME \"ANDROID\")
+elseif (CLR_CMAKE_TARGET_LINUX)
set(PAL_UNIX_NAME \"LINUX\")
elseif (CLR_CMAKE_TARGET_OSX)
set(PAL_UNIX_NAME \"OSX\")
@@ -178,6 +180,11 @@ check_symbol_exists(
"sched.h"
HAVE_SCHED_SETAFFINITY)
+check_symbol_exists(
+ pthread_setcancelstate
+ "pthread.h"
+ HAVE_PTHREAD_SETCANCELSTATE)
+
check_symbol_exists(
arc4random_buf
"stdlib.h"
@@ -450,6 +457,11 @@ if(CLR_CMAKE_TARGET_IOS)
unset(HAVE_SHM_OPEN_THAT_WORKS_WELL_ENOUGH_WITH_MMAP)
unset(HAVE_CLOCK_MONOTONIC) # only exists on iOS 10+
unset(HAVE_CLOCK_REALTIME) # only exists on iOS 10+
+elseif(CLR_CMAKE_TARGET_ANDROID)
+ # Manually set results from check_c_source_runs() since it's not possible to actually run it during CMake configure checking
+ unset(HAVE_SHM_OPEN_THAT_WORKS_WELL_ENOUGH_WITH_MMAP)
+ set(HAVE_CLOCK_MONOTONIC 1)
+ set(HAVE_CLOCK_REALTIME 1)
else()
check_c_source_runs(
"
@@ -900,8 +912,6 @@ check_c_source_compiles(
"
HAVE_BUILTIN_MUL_OVERFLOW)
-check_function_exists(pthread_setcancelstate HAVE_PTHREAD_SETCANCELSTATE)
-
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/Common/pal_config.h.in
${CMAKE_CURRENT_BINARY_DIR}/Common/pal_config.h)
diff --git a/src/libraries/Native/build-native.sh b/src/libraries/Native/build-native.sh
index 4c7d440b865b03..ec5fea05f07310 100755
--- a/src/libraries/Native/build-native.sh
+++ b/src/libraries/Native/build-native.sh
@@ -56,6 +56,9 @@ if [[ "$__BuildArch" == wasm ]]; then
elif [[ "$__TargetOS" == iOS ]]; then
# nothing to do here
true
+elif [[ "$__TargetOS" == Android && -z "$ROOTFS_DIR" ]]; then
+ # nothing to do here
+ true
else
__CMakeArgs="-DFEATURE_DISTRO_AGNOSTIC_SSL=$__PortableBuild $__CMakeArgs"
__CMakeArgs="-DCMAKE_STATIC_LIB_LINK=$__StaticLibLink $__CMakeArgs"
@@ -69,6 +72,27 @@ fi
if [[ "$__TargetOS" == OSX ]]; then
# set default OSX deployment target
__CMakeArgs="-DCMAKE_OSX_DEPLOYMENT_TARGET=10.13 $__CMakeArgs"
+elif [[ "$__TargetOS" == Android && -z "$ROOTFS_DIR" ]]; then
+ if [[ -z "$ANDROID_NDK_HOME" ]]; then
+ echo "Error: You need to set the ANDROID_NDK_HOME environment variable pointing to the Android NDK root."
+ exit 1
+ fi
+
+ # keep ANDROID_NATIVE_API_LEVEL in sync with src/mono/Directory.Build.props
+ __CMakeArgs="-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake -DANDROID_STL=none -DANDROID_NATIVE_API_LEVEL=21 $__CMakeArgs"
+
+ if [[ "$__BuildArch" == x64 ]]; then
+ __CMakeArgs="-DANDROID_ABI=x86_64 $__CMakeArgs"
+ elif [[ "$__BuildArch" == x86 ]]; then
+ __CMakeArgs="-DANDROID_ABI=x86 $__CMakeArgs"
+ elif [[ "$__BuildArch" == arm64 ]]; then
+ __CMakeArgs="-DANDROID_ABI=arm64-v8a $__CMakeArgs"
+ elif [[ "$__BuildArch" == arm ]]; then
+ __CMakeArgs="-DANDROID_ABI=armeabi-v7a $__CMakeArgs"
+ else
+ echo "Error: Unknown Android architecture $__BuildArch."
+ exit 1
+ fi
elif [[ "$__TargetOS" == iOS ]]; then
__CMakeArgs="-DCMAKE_SYSTEM_NAME=iOS $__CMakeArgs"
if [[ "$__BuildArch" == x64 ]]; then
diff --git a/src/libraries/OSGroups.json b/src/libraries/OSGroups.json
index 7d8e9fca979d29..31cccf1cfbf9bd 100644
--- a/src/libraries/OSGroups.json
+++ b/src/libraries/OSGroups.json
@@ -22,6 +22,11 @@
"Unix"
]
},
+ "Android": {
+ "#import": [
+ "Linux"
+ ]
+ },
"FreeBSD": {
"#import": [
"Unix"
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HashProviderDispenser.Android.cs b/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HashProviderDispenser.Android.cs
new file mode 100644
index 00000000000000..55e60eb0c3edc5
--- /dev/null
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HashProviderDispenser.Android.cs
@@ -0,0 +1,83 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+using System.Security.Cryptography;
+using Microsoft.Win32.SafeHandles;
+
+namespace Internal.Cryptography
+{
+ internal static partial class HashProviderDispenser
+ {
+ public static HashProvider CreateHashProvider(string hashAlgorithmId)
+ {
+ switch (hashAlgorithmId)
+ {
+ case HashAlgorithmNames.SHA1:
+ return new NotImplementedHashProvider();
+ case HashAlgorithmNames.SHA256:
+ return new NotImplementedHashProvider();
+ case HashAlgorithmNames.SHA384:
+ return new NotImplementedHashProvider();
+ case HashAlgorithmNames.SHA512:
+ return new NotImplementedHashProvider();
+ case HashAlgorithmNames.MD5:
+ return new NotImplementedHashProvider();
+ }
+ throw new CryptographicException(SR.Format(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithmId));
+ }
+
+ public static unsafe HashProvider CreateMacProvider(string hashAlgorithmId, ReadOnlySpan key)
+ {
+ switch (hashAlgorithmId)
+ {
+ case HashAlgorithmNames.SHA1:
+ return new NotImplementedHashProvider();
+ case HashAlgorithmNames.SHA256:
+ return new NotImplementedHashProvider();
+ case HashAlgorithmNames.SHA384:
+ return new NotImplementedHashProvider();
+ case HashAlgorithmNames.SHA512:
+ return new NotImplementedHashProvider();
+ case HashAlgorithmNames.MD5:
+ return new NotImplementedHashProvider();
+ }
+ throw new CryptographicException(SR.Format(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithmId));
+ }
+
+ // -----------------------------
+ // ---- PAL layer ends here ----
+ // -----------------------------
+
+ private sealed class NotImplementedHashProvider : HashProvider
+ {
+ public NotImplementedHashProvider()
+ {
+ }
+
+ public override void AppendHashData(ReadOnlySpan data)
+ {
+ throw new NotImplementedException();
+ }
+
+ public override byte[] FinalizeHashAndReset()
+ {
+ throw new NotImplementedException();
+ }
+
+ public override bool TryFinalizeHashAndReset(Span destination, out int bytesWritten)
+ {
+ throw new NotImplementedException();
+ }
+
+ public override int HashSizeInBytes => throw new NotImplementedException();
+
+ public override void Dispose(bool disposing)
+ {
+ }
+ }
+ }
+}
diff --git a/src/libraries/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj b/src/libraries/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj
index bc999132acccc1..680eedda4281da 100644
--- a/src/libraries/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj
+++ b/src/libraries/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj
@@ -3,7 +3,7 @@
true
$(DefineConstants);INTERNAL_ASYMMETRIC_IMPLEMENTATIONS
CS1573;CS3016;CA5350;CA5351;CA5379;CA5384;CA5385;$(NoWarn)
- $(NetCoreAppCurrent)-Windows_NT;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-iOS
+ $(NetCoreAppCurrent)-Windows_NT;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Android;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-iOS
enable
@@ -586,7 +586,8 @@
-
+
+
diff --git a/src/libraries/restore/runtime/runtime.depproj b/src/libraries/restore/runtime/runtime.depproj
index 88b99520ba0119..4271b7e51d8a31 100644
--- a/src/libraries/restore/runtime/runtime.depproj
+++ b/src/libraries/restore/runtime/runtime.depproj
@@ -1,8 +1,8 @@
$(PackageRID)
-
- $(ToolRuntimeRID)
+
+ $(ToolRuntimeRID)
$(NoWarn);NU1603;NU1605
true
$(TargetOS)
diff --git a/src/mono/Directory.Build.props b/src/mono/Directory.Build.props
index bfb1333563d147..ee344cc66d76ae 100644
--- a/src/mono/Directory.Build.props
+++ b/src/mono/Directory.Build.props
@@ -34,19 +34,20 @@
true
- true
+ true
true
true
true
true
+ true
true
- true
+ true
- 7.0
- 8.0
+ 7.0
+ 8.0
9.0
2.0
5.1
@@ -58,6 +59,9 @@
+
+
+ 21
diff --git a/src/mono/mono.proj b/src/mono/mono.proj
index 4736fca176e72c..bfc84a87093d6f 100644
--- a/src/mono/mono.proj
+++ b/src/mono/mono.proj
@@ -19,7 +19,9 @@
libcoreclr.dylib
libcoreclr.so
libmono.dylib
+ libmonosgen-2.0.so
libmono.a
+ libmonosgen-2.0.a
$(CoreClrFileName)
$(Configuration)
$(Configuration)
@@ -29,12 +31,14 @@
/Applications/Xcode.app/Contents/Developer
-
+
-
-
+
+
+
+
@@ -42,7 +46,7 @@
<_MonoConfigureParams Include="--enable-maintainer-mode" />
<_MonoConfigureParams Include="--enable-compile-warnings" />
<_MonoConfigureParams Include="--prefix=$(MonoObjDir)out" />
- <_MonoConfigureParams Condition="'$(MonoEnableLLVM)' == 'true'" Include="--with-llvm=$(MonoLLVMDir)" />
+ <_MonoConfigureParams Condition="'$(MonoEnableLLVM)' == 'true'" Include="--with-llvm=$(MonoLLVMDir)" />
<_MonoConfigureParams Condition="'$(MonoEnableCXX)' == 'true'" Include="--enable-cxx" />
@@ -71,7 +75,7 @@
-
+
<_MonoConfigureParams Condition="'$(Platform)' == 'arm64'" Include="--host=aarch64-apple-darwin10" />
<_MonoConfigureParams Condition="'$(Platform)' == 'arm'" Include="--host=arm-apple-darwin10" />
<_MonoConfigureParams Include="--disable-boehm" />
@@ -207,7 +211,7 @@
-
+
<_MonoConfigureParams Include="--host=x86_64-apple-darwin10" />
<_MonoConfigureParams Include="--disable-boehm" />
<_MonoConfigureParams Include="--disable-btls" />
@@ -256,8 +260,104 @@
<_MonoCPPFLAGS Include="-DHOST_IOS" />
+
+
+ <_MonoConfigureParams Condition="'$(Platform)' == 'arm64'" Include="--host=aarch64-linux-android" />
+ <_MonoConfigureParams Condition="'$(Platform)' == 'arm'" Include="--host=armv5-linux-androideabi" />
+ <_MonoConfigureParams Condition="'$(Platform)' == 'x86'" Include="--host=i686-linux-android" />
+ <_MonoConfigureParams Condition="'$(Platform)' == 'x64'" Include="--host=x86_64-linux-android" />
+ <_MonoConfigureParams Include="--disable-boehm" />
+ <_MonoConfigureParams Include="--disable-executables" />
+ <_MonoConfigureParams Include="--disable-iconv" />
+ <_MonoConfigureParams Include="--disable-mcs-build" />
+ <_MonoConfigureParams Include="--disable-nls" />
+ <_MonoConfigureParams Include="--enable-maintainer-mode" />
+ <_MonoConfigureParams Include="--enable-minimal=ssa,portability,attach,verifier,full_messages,sgen_remset,sgen_marksweep_par,sgen_marksweep_fixed,sgen_marksweep_fixed_par,sgen_copying,logging,security,shared_handles,interpreter,,gac,cfgdir_config" />
+ <_MonoConfigureParams Include="--enable-monodroid" />
+ <_MonoConfigureParams Include="--enable-dynamic-btls" />
+ <_MonoConfigureParams Include="--with-btls-android-ndk=$(ANDROID_NDK_HOME)" />
+ <_MonoConfigureParams Include="--with-btls-android-api=$(AndroidApiVersion)" />
+ <_MonoConfigureParams Include="--with-btls-android-ndk-asm-workaround" />
+ <_MonoConfigureParams Include="--with-btls-android-cmake-toolchain=$(ANDROID_NDK_HOME)/build/cmake/android.toolchain.cmake" />
+ <_MonoConfigureParams Include="--with-sigaltstack=yes" />
+ <_MonoConfigureParams Include="--with-tls=pthread" />
+ <_MonoConfigureParams Include="--without-ikvm-native" />
+ <_MonoConfigureParams Include="--disable-cooperative-suspend" />
+ <_MonoConfigureParams Include="--disable-hybrid-suspend" />
+ <_MonoConfigureParams Include="--disable-crash-reporting" />
+
+ <_MonoAC_VARS Include="ac_cv_func_shm_open_working_with_mmap=no" />
+ <_MonoAC_VARS Include="ac_cv_func_sched_getaffinity=no" />
+ <_MonoAC_VARS Include="ac_cv_func_sched_setaffinity=no" />
+ <_MonoAC_VARS Include="mono_cv_uscore=yes" />
+
+ <_MonoCFLAGS Condition="'$(Platform)' == 'arm'" Include="-march=armv7-a" />
+ <_MonoCFLAGS Condition="'$(Platform)' == 'arm'" Include="-mtune=cortex-a8" />
+ <_MonoCFLAGS Condition="'$(Platform)' == 'arm'" Include="-mfpu=vfp" />
+ <_MonoCFLAGS Condition="'$(Platform)' == 'arm'" Include="-mfloat-abi=softfp" />
+ <_MonoCFLAGS Condition="'$(Platform)' == 'arm64' or '$(Platform)' == 'arm'" Include="-fpic" />
+ <_MonoCFLAGS Include="-fstack-protector" />
+
+ <_MonoCXXFLAGS Condition="'$(Platform)' == 'arm'" Include="-march=armv7-a" />
+ <_MonoCXXFLAGS Condition="'$(Platform)' == 'arm'" Include="-mtune=cortex-a8" />
+ <_MonoCXXFLAGS Condition="'$(Platform)' == 'arm'" Include="-mfpu=vfp" />
+ <_MonoCXXFLAGS Condition="'$(Platform)' == 'arm'" Include="-mfloat-abi=softfp" />
+ <_MonoCXXFLAGS Condition="'$(Platform)' == 'arm64' or '$(Platform)' == 'arm'" Include="-fpic" />
+ <_MonoCXXFLAGS Include="-fstack-protector" />
+
+ <_MonoCPPFLAGS Condition="'$(Platform)' == 'arm64'" Include="-DANDROID64" />
+ <_MonoCPPFLAGS Condition="'$(Platform)' == 'arm64'" Include="-I$(ANDROID_NDK_HOME)/sysroot/usr/include/aarch64-linux-android" />
+ <_MonoCPPFLAGS Condition="'$(Platform)' == 'arm'" Include="-I$(ANDROID_NDK_HOME)/sysroot/usr/include/arm-linux-androideabi" />
+ <_MonoCPPFLAGS Condition="'$(Platform)' == 'x64'" Include="-I$(ANDROID_NDK_HOME)/sysroot/usr/include/x86_64-linux-android" />
+ <_MonoCPPFLAGS Condition="'$(Platform)' == 'x86'" Include="-I$(ANDROID_NDK_HOME)/sysroot/usr/include/i686-linux-android" />
+ <_MonoCPPFLAGS Condition="'$(Platform)' == 'x64'" Include="-m64" />
+ <_MonoCPPFLAGS Condition="'$(Platform)' == 'x86'" Include="-m32" />
+ <_MonoCPPFLAGS Condition="'$(Platform)' == 'arm64' or '$(Platform)' == 'x64'" Include="-DL_cuserid=9" />
+ <_MonoCPPFLAGS Condition="'$(Platform)' == 'arm64' or '$(Platform)' == 'arm'" Include="-D__POSIX_VISIBLE=201002" />
+ <_MonoCPPFLAGS Condition="'$(Platform)' == 'arm64' or '$(Platform)' == 'arm'" Include="-DSK_RELEASE" />
+ <_MonoCPPFLAGS Condition="'$(Platform)' == 'arm64' or '$(Platform)' == 'arm'" Include="-DNDEBUG" />
+ <_MonoCPPFLAGS Condition="'$(Platform)' == 'arm64' or '$(Platform)' == 'arm'" Include="-UDEBUG" />
+ <_MonoCPPFLAGS Include="-I$(ANDROID_NDK_HOME)/sysroot/usr/include" />
+ <_MonoCPPFLAGS Include="-DMONODROID=1" />
+ <_MonoCPPFLAGS Include="-D__ANDROID_API__=$(AndroidApiVersion)" />
+
+ <_MonoCXXCPPFLAGS Condition="'$(Platform)' == 'arm64'" Include="-DANDROID64" />
+ <_MonoCXXCPPFLAGS Condition="'$(Platform)' == 'arm64'" Include="-I$(ANDROID_NDK_HOME)/sysroot/usr/include/aarch64-linux-android" />
+ <_MonoCXXCPPFLAGS Condition="'$(Platform)' == 'arm'" Include="-I$(ANDROID_NDK_HOME)/sysroot/usr/include/arm-linux-androideabi" />
+ <_MonoCXXCPPFLAGS Condition="'$(Platform)' == 'x64'" Include="-I$(ANDROID_NDK_HOME)/sysroot/usr/include/x86_64-linux-android" />
+ <_MonoCXXCPPFLAGS Condition="'$(Platform)' == 'x86'" Include="-I$(ANDROID_NDK_HOME)/sysroot/usr/include/i686-linux-android" />
+ <_MonoCXXCPPFLAGS Condition="'$(Platform)' == 'x64'" Include="-m64" />
+ <_MonoCXXCPPFLAGS Condition="'$(Platform)' == 'x86'" Include="-m32" />
+ <_MonoCXXCPPFLAGS Condition="'$(Platform)' == 'arm64' or '$(Platform)' == 'x64'" Include="-DL_cuserid=9" />
+ <_MonoCXXCPPFLAGS Condition="'$(Platform)' == 'arm64' or '$(Platform)' == 'arm'" Include="-D__POSIX_VISIBLE=201002" />
+ <_MonoCXXCPPFLAGS Condition="'$(Platform)' == 'arm64' or '$(Platform)' == 'arm'" Include="-DSK_RELEASE" />
+ <_MonoCXXCPPFLAGS Condition="'$(Platform)' == 'arm64' or '$(Platform)' == 'arm'" Include="-DNDEBUG" />
+ <_MonoCXXCPPFLAGS Condition="'$(Platform)' == 'arm64' or '$(Platform)' == 'arm'" Include="-UDEBUG" />
+ <_MonoCXXCPPFLAGS Include="-I$(ANDROID_NDK_HOME)/sysroot/usr/include" />
+ <_MonoCXXCPPFLAGS Include="-DMONODROID=1" />
+ <_MonoCXXCPPFLAGS Include="-D__ANDROID_API__=$(AndroidApiVersion)" />
+
+ <_MonoLDFLAGS Condition="'$(Platform)' == 'arm64'" Include="-L$(ANDROID_NDK_HOME)/platforms/android-$(AndroidApiVersion)/arch-arm64/usr/lib" />
+ <_MonoLDFLAGS Condition="'$(Platform)' == 'arm64'" Include="-Wl,-rpath-link=$(ANDROID_NDK_HOME)/platforms/android-$(AndroidApiVersion)/arch-arm64/usr/lib,-dynamic-linker=/system/bin/linker" />
+ <_MonoLDFLAGS Condition="'$(Platform)' == 'arm'" Include="-L$(ANDROID_NDK_HOME)/platforms/android-$(AndroidApiVersion)/arch-arm/usr/lib" />
+ <_MonoLDFLAGS Condition="'$(Platform)' == 'arm'" Include="-Wl,-rpath-link=$(ANDROID_NDK_HOME)/platforms/android-$(AndroidApiVersion)/arch-arm/usr/lib,-dynamic-linker=/system/bin/linker" />
+ <_MonoLDFLAGS Condition="'$(Platform)' == 'arm'" Include="-Wl,--fix-cortex-a8" />
+ <_MonoLDFLAGS Condition="'$(Platform)' == 'x86'" Include="-L$(ANDROID_NDK_HOME)/platforms/android-$(AndroidApiVersion)/arch-x86/usr/lib" />
+ <_MonoLDFLAGS Condition="'$(Platform)' == 'x86'" Include="-Wl,-rpath-link=$(ANDROID_NDK_HOME)/platforms/android-$(AndroidApiVersion)/arch-x86/usr/lib,-dynamic-linker=/system/bin/linker" />
+ <_MonoLDFLAGS Condition="'$(Platform)' == 'x64'" Include="-L$(ANDROID_NDK_HOME)/platforms/android-$(AndroidApiVersion)/arch-x86_64/usr/lib" />
+ <_MonoLDFLAGS Condition="'$(Platform)' == 'x64'" Include="-Wl,-rpath-link=$(ANDROID_NDK_HOME)/platforms/android-$(AndroidApiVersion)/arch-x86_64/usr/lib,-dynamic-linker=/system/bin/linker" />
+ <_MonoLDFLAGS Include="-z now" />
+ <_MonoLDFLAGS Include="-z relro" />
+ <_MonoLDFLAGS Include="-z noexecstack" />
+ <_MonoLDFLAGS Include="-ldl" />
+ <_MonoLDFLAGS Include="-lm" />
+ <_MonoLDFLAGS Include="-llog" />
+ <_MonoLDFLAGS Include="-lc" />
+ <_MonoLDFLAGS Include="-lgcc" />
+
+
-
+
<_MonoCCOption>CC="$(XcodeDir)/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
<_MonoCXXOption>CXX="$(XcodeDir)/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
<_MonoAROption>AR=""
@@ -272,8 +372,36 @@
<_MonoSTRIPOption>STRIP=""
+
+
+ <_MonoAndroidTargetTuple Condition="'$(Platform)' == 'x64'" >x86_64-linux-android
+ <_MonoAndroidTargetTuple Condition="'$(Platform)' == 'x86'" >i686-linux-android
+ <_MonoAndroidTargetTuple Condition="'$(Platform)' == 'arm64'" >aarch64-linux-android
+ <_MonoAndroidTargetTuple Condition="'$(Platform)' == 'arm'" >arm-linux-androideabi
+
+ <_MonoAndroidBuildHost Condition="$([MSBuild]::IsOSPlatform('OSX'))">darwin-x86_64
+ <_MonoAndroidBuildHost Condition="$([MSBuild]::IsOSPlatform('Linux'))">linux-x86_64
+
+ <_MonoAndroidToolchainPrefix>$(ANDROID_NDK_HOME)/toolchains/llvm/prebuilt/$(_MonoAndroidBuildHost)/bin/$(_MonoAndroidTargetTuple)
+ <_MonoAndroidToolchainPrefixClang Condition="'$(Platform)' == 'arm'">$(ANDROID_NDK_HOME)/toolchains/llvm/prebuilt/$(_MonoAndroidBuildHost)/bin/armv7a-linux-androideabi$(AndroidApiVersion)
+ <_MonoAndroidToolchainPrefixClang Condition="'$(Platform)' != 'arm'">$(_MonoAndroidToolchainPrefix)$(AndroidApiVersion)
+
+ <_MonoCCOption>CC="$(_MonoAndroidToolchainPrefixClang)-clang"
+ <_MonoCXXOption>CXX="$(_MonoAndroidToolchainPrefixClang)-clang++"
+ <_MonoAROption>AR="$(_MonoAndroidToolchainPrefix)-ar"
+ <_MonoASOption>AS="$(_MonoAndroidToolchainPrefix)-as"
+ <_MonoCPPOption>CPP="$(_MonoAndroidToolchainPrefixClang)-clang -E"
+ <_MonoCXXCPPOption>CXXCPP="$(_MonoAndroidToolchainPrefixClang)-clang++ -E"
+ <_MonoDLLTOOLOption>DLLTOOL=""
+ <_MonoLDOption>LD="$(_MonoAndroidToolchainPrefix)-ld"
+ <_MonoOBJDUMPOption>OBJDUMP="$(_MonoAndroidToolchainPrefix)-objdump"
+ <_MonoRANLIBOption>RANLIB="$(_MonoAndroidToolchainPrefix)-ranlib"
+ <_MonoCMAKEOption>CMAKE=""
+ <_MonoSTRIPOption>STRIP="$(_MonoAndroidToolchainPrefix)-strip"
+
+
-
+
<_MonoTuple Condition="'$(TargetArchitecture)' == 'arm64'">aarch64-linux-gnu
<_MonoTuple Condition="'$(TargetArchitecture)' == 'arm'">arm-linux-gnueabihf
@@ -285,7 +413,7 @@
-
+
<_MonoCFLAGS Include="-Wl,--build-id" />
<_MonoCXXFLAGS Include="-Wl,--build-id" />
@@ -322,7 +450,7 @@
-
+
<_MonoAotCrossCFLAGSOption Condition="@(_MonoAotCrossCFLAGS->Count()) > 0">CFLAGS="@(_MonoAotCrossCFLAGS, ' ')"
<_MonoAotCrossCXXFLAGSOption Condition="@(_MonoAotCrossCXXFLAGS->Count()) > 0">CXXFLAGS="@(_MonoAotCrossCXXFLAGS, ' ')"
<_MonoAotCrossCPPFLAGSOption Condition="@(_MonoAotCrossCPPFLAGS->Count()) > 0">CPPFLAGS="@(_MonoAotCrossCPPFLAGS, ' ')"
@@ -354,7 +482,7 @@
-
+
@@ -365,7 +493,7 @@
-
+
<_MonoBuildParams Include="/p:MONO_BUILD_DIR_PREFIX=""$(MonoObjDir)""" />
@@ -400,8 +528,9 @@
<_MonoRuntimeFilePath Condition="'$(TargetsWindows)' == 'true' and '$(Platform)' == 'x86'">$(MonoObjDir)Win32\Bin\$(Configuration)\mono-2.0-sgen.dll
<_MonoRuntimeFilePath Condition="'$(TargetsOSX)' == 'true'">$(MonoObjDir)mono\mini\.libs\libmonosgen-2.0.dylib
<_MonoRuntimeFilePath Condition="'$(TargetsiOS)' == 'true'">$(MonoObjDir)out\lib\libmonosgen-2.0.dylib
+ <_MonoRuntimeFilePath Condition="'$(TargetsAndroid)' == 'true'">$(MonoObjDir)out\lib\libmonosgen-2.0.so
<_MonoRuntimeFilePath Condition="'$(_MonoRuntimeFilePath)' == ''">$(MonoObjDir)mono\mini\.libs\libmonosgen-2.0.so
- <_MonoRuntimeStaticFilePath Condition="'$(TargetsiOS)' == 'true'">$(MonoObjDir)out\lib\libmonosgen-2.0.a
+ <_MonoRuntimeStaticFilePath Condition="'$(TargetsiOS)' == 'true' or '$(TargetsAndroid)' == 'true'">$(MonoObjDir)out\lib\libmonosgen-2.0.a
<_MonoAotCrossFilePath Condition="'$(TargetsiOS)' == 'true' and '$(Platform)' == 'arm64'">$(MonoObjDir)cross\out\bin\aarch64-darwin-mono-sgen
<_MonoAotCrossFilePath Condition="'$(TargetsiOS)' == 'true' and '$(Platform)' == 'arm'">$(MonoObjDir)cross\out\bin\arm-darwin-mono-sgen
@@ -427,7 +556,7 @@
+ Condition="'$(TargetsiOS)' == 'true' or '$(TargetsAndroid)' == 'true'"/>
diff --git a/src/mono/netcore/nuget/Directory.Build.props b/src/mono/netcore/nuget/Directory.Build.props
index 94c047563c0a2b..82c4ae157f29ec 100644
--- a/src/mono/netcore/nuget/Directory.Build.props
+++ b/src/mono/netcore/nuget/Directory.Build.props
@@ -51,9 +51,7 @@
-
<_packageTargetOSGroup>$(_derivedPackageTargetOSGroup)
- <_packageTargetOSGroup Condition="'$(_derivedPackageTargetOSGroup)' == 'Android'">Linux
true
@@ -155,6 +153,18 @@
arm64
+
+
+
+ x86
+
+
+ arm
+
+
+ arm64
+
+
diff --git a/src/mono/netcore/nuget/Microsoft.NETCore.Runtime.Mono/runtime.Android.Microsoft.NETCore.Runtime.Mono.props b/src/mono/netcore/nuget/Microsoft.NETCore.Runtime.Mono/runtime.Android.Microsoft.NETCore.Runtime.Mono.props
new file mode 100644
index 00000000000000..fb6909aa163f38
--- /dev/null
+++ b/src/mono/netcore/nuget/Microsoft.NETCore.Runtime.Mono/runtime.Android.Microsoft.NETCore.Runtime.Mono.props
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+ true
+ tools\include\%(RecursiveDir)%(Filename)%(Extension)
+
+
+
diff --git a/src/mono/netcore/nuget/Microsoft.NETCore.Tool.MonoAOT/runtime.Android.Microsoft.NETCore.Tool.MonoAOT.props b/src/mono/netcore/nuget/Microsoft.NETCore.Tool.MonoAOT/runtime.Android.Microsoft.NETCore.Tool.MonoAOT.props
new file mode 100644
index 00000000000000..6ed7866754bef7
--- /dev/null
+++ b/src/mono/netcore/nuget/Microsoft.NETCore.Tool.MonoAOT/runtime.Android.Microsoft.NETCore.Tool.MonoAOT.props
@@ -0,0 +1,11 @@
+
+
+
+
+
+