diff --git a/eng/Configurations.props b/eng/Configurations.props index 06ee77bbe8d17..1d6ad36e8150c 100644 --- a/eng/Configurations.props +++ b/eng/Configurations.props @@ -52,7 +52,8 @@ OSX FreeBSD NetBSD - SunOS + illumos + Solaris Linux Windows_NT $(TargetOS) @@ -70,4 +71,4 @@ true - \ No newline at end of file + diff --git a/eng/build.sh b/eng/build.sh index 442702f9df365..6fb8f90106093 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -29,7 +29,7 @@ usage() echo " --librariesConfiguration (-lc) Libraries build configuration: Debug or Release." echo " [Default: Debug]" echo " --os Target operating system: Windows_NT, Linux, FreeBSD, OSX, tvOS, iOS, Android," - echo " Browser, NetBSD or SunOS." + echo " Browser, NetBSD, illumos or Solaris." echo " [Default: Your machine's OS.]" echo " --projects Project or solution file(s) to build." echo " --runtimeConfiguration (-rc) Runtime build configuration: Debug, Release or Checked." @@ -115,7 +115,7 @@ usage() initDistroRid() { - source $scriptroot/native/init-distro-rid.sh + source "$scriptroot"/native/init-distro-rid.sh local passedRootfsDir="" local targetOs="$1" @@ -206,7 +206,7 @@ while [[ $# > 0 ]]; do ;; -configuration|-c) - if [ -z ${2+x} ]; then + if [ -z ${2+x} ]; then echo "No configuration supplied. See help (--help) for supported configurations." 1>&2 exit 1 fi @@ -258,11 +258,13 @@ while [[ $# > 0 ]]; do os="Android" ;; browser) os="Browser" ;; - sunos) - os="SunOS" ;; + illumos) + os="illumos" ;; + solaris) + os="Solaris" ;; *) echo "Unsupported target OS '$2'." - echo "The allowed values are Windows_NT, Linux, FreeBSD, OSX, tvOS, iOS, Android, Browser, and SunOS." + echo "The allowed values are Windows_NT, Linux, FreeBSD, OSX, tvOS, iOS, Android, Browser, illumos and Solaris." exit 1 ;; esac diff --git a/eng/native/configureplatform.cmake b/eng/native/configureplatform.cmake index 04fdfaed45a99..bbc7877e8f9fa 100644 --- a/eng/native/configureplatform.cmake +++ b/eng/native/configureplatform.cmake @@ -159,7 +159,17 @@ if(CLR_CMAKE_HOST_OS STREQUAL SunOS) clr_unknown_arch() endif() + EXECUTE_PROCESS( + COMMAND uname -o + OUTPUT_VARIABLE SUNOS_KERNEL_KIND + ERROR_QUIET) + set(CLR_CMAKE_HOST_SUNOS 1) + if(SUNOS_KERNEL_KIND STREQUAL illumos) + set(CLR_CMAKE_HOST_OS_ILLUMOS 1) + else(SUNOS_KERNEL_KIND STREQUAL illumos) + set(CLR_CMAKE_HOST_OS_SOLARIS 1) + endif(SUNOS_KERNEL_KIND STREQUAL illumos) endif(CLR_CMAKE_HOST_OS STREQUAL SunOS) if(CLR_CMAKE_HOST_OS STREQUAL Windows) @@ -312,6 +322,11 @@ endif(CLR_CMAKE_TARGET_OS STREQUAL NetBSD) if(CLR_CMAKE_TARGET_OS STREQUAL SunOS) set(CLR_CMAKE_TARGET_UNIX 1) + if(CLR_CMAKE_HOST_OS_ILLUMOS) + set(CLR_CMAKE_TARGET_OS_ILLUMOS 1) + else(CLR_CMAKE_HOST_OS_ILLUMOS) + set(CLR_CMAKE_TARGET_OS_SOLARIS 1) + endif(CLR_CMAKE_HOST_OS_ILLUMOS) set(CLR_CMAKE_TARGET_SUNOS 1) endif(CLR_CMAKE_TARGET_OS STREQUAL SunOS) diff --git a/eng/native/init-distro-rid.sh b/eng/native/init-distro-rid.sh index 22efd8e8b5423..b6921a903469b 100644 --- a/eng/native/init-distro-rid.sh +++ b/eng/native/init-distro-rid.sh @@ -70,6 +70,25 @@ initNonPortableDistroRid() elif getprop ro.product.system.model 2>&1 | grep -qi android; then __android_sdk_version=$(getprop ro.build.version.sdk) nonPortableBuildID="android.$__android_sdk_version-${buildArch}" + elif [ "$targetOs" = "illumos" ]; then + __uname_version=$(uname -v) + case "$__uname_version" in + omnios-*) + __omnios_major_version=$(echo "${__uname_version:8:2}") + nonPortableBuildID=omnios."$__omnios_major_version"-"$buildArch" + ;; + joyent_*) + __smartos_major_version=$(echo "${__uname_version:7:4}") + nonPortableBuildID=smartos."$__smartos_major_version"-"$buildArch" + ;; + illumos_*) + nonPortableBuildID=openindiana-"$buildArch" + ;; + esac + elif [ "$targetOs" = "Solaris" ]; then + __uname_version=$(uname -v) + __solaris_major_version=$(echo "${__uname_version%.*}") + nonPortableBuildID=solaris."$__solaris_major_version"-"$buildArch" fi if [ -n "${nonPortableBuildID}" ]; then @@ -169,8 +188,10 @@ initDistroRidGlobal() distroRid="browser-$buildArch" elif [ "$targetOs" = "FreeBSD" ]; then distroRid="freebsd-$buildArch" - elif [ "$targetOs" = "SunOS" ]; then - distroRid="sunos-$buildArch" + elif [ "$targetOs" = "illumos" ]; then + distroRid="illumos-$buildArch" + elif [ "$targetOs" = "Solaris" ]; then + distroRid="solaris-$buildArch" fi fi diff --git a/eng/native/init-os-and-arch.sh b/eng/native/init-os-and-arch.sh index 0323964cd82a0..46c128de93c9f 100644 --- a/eng/native/init-os-and-arch.sh +++ b/eng/native/init-os-and-arch.sh @@ -9,7 +9,7 @@ fi case "$OSName" in FreeBSD|Linux|NetBSD|OpenBSD|SunOS|Android) - os=$OSName ;; + os="$OSName" ;; Darwin) os=OSX ;; *) @@ -20,7 +20,12 @@ esac # On Solaris, `uname -m` is discoragued, see https://docs.oracle.com/cd/E36784_01/html/E36870/uname-1.html # and `uname -p` returns processor type (e.g. i386 on amd64). # The appropriate tool to determine CPU is isainfo(1) https://docs.oracle.com/cd/E36784_01/html/E36870/isainfo-1.html. -if [ "$OSName" = "SunOS" ]; then +if [ "$os" = "SunOS" ]; then + if uname -o 2>&1 | grep -q illumos; then + os="illumos" + else + os="Solaris" + fi CPUName=$(isainfo -n) else # For rest of the operating systems, use uname(1) to determine what the CPU is. diff --git a/eng/run-test.sh b/eng/run-test.sh index 5f14e6f6121be..b3d382a5cf098 100644 --- a/eng/run-test.sh +++ b/eng/run-test.sh @@ -15,12 +15,12 @@ wait_on_pids() usage() { - echo "Runs .NET CoreFX tests on FreeBSD, Linux, NetBSD or SunOS" + echo "Runs .NET CoreFX tests on FreeBSD, Linux, NetBSD, illumos or Solaris" echo "usage: run-test [options]" echo echo "Input sources:" echo " --runtime Location of root of the binaries directory" - echo " containing the FreeBSD, Linux, NetBSD or SunOS runtime" + echo " containing the FreeBSD, Linux, NetBSD, illumos or Solaris runtime" echo " default: /bin/testhost/netcoreapp---" echo " --corefx-tests Location of the root binaries location containing" echo " the tests to run" @@ -29,7 +29,7 @@ usage() echo "Flavor/OS/Architecture options:" echo " --configuration Configuration to run (Debug/Release)" echo " default: Debug" - echo " --os OS to run (FreeBSD, Linux, NetBSD or SunOS)" + echo " --os OS to run (FreeBSD, Linux, NetBSD, illumos or Solaris)" echo " default: detect current OS" echo " --arch Architecture to run (x64, arm, armel, x86, arm64)" echo " default: detect current architecture" @@ -254,7 +254,7 @@ then exit 1 fi -if [ "$OS" != "FreeBSD" ] && [ "$OS" != "Linux" ] && [ "$OS" != "NetBSD" ] && [ "$OS" != "SunOS" ] +if [ "$OS" != "FreeBSD" ] && [ "$OS" != "Linux" ] && [ "$OS" != "NetBSD" ] && [ "$OS" != "illumos" ] && [ "$OS" != "Solaris" ] then echo "error: OS should be FreeBSD, Linux, NetBSD or Linux" exit 1 diff --git a/eng/targetframeworksuffix.props b/eng/targetframeworksuffix.props index fdeacda5f3b53..61e1f5511d440 100644 --- a/eng/targetframeworksuffix.props +++ b/eng/targetframeworksuffix.props @@ -62,11 +62,18 @@ netbsd - + true - true - sunos + true + illumos + + + + + true + true + solaris diff --git a/src/coreclr/dir.common.props b/src/coreclr/dir.common.props index 2ff54f14de24a..f45eb84e8f277 100644 --- a/src/coreclr/dir.common.props +++ b/src/coreclr/dir.common.props @@ -55,11 +55,12 @@ true true true - true + true + true true true - true + true $(__DistroRid) diff --git a/src/coreclr/src/.nuget/Directory.Build.props b/src/coreclr/src/.nuget/Directory.Build.props index 2fd932c03b84e..1a8f5c0d7414b 100644 --- a/src/coreclr/src/.nuget/Directory.Build.props +++ b/src/coreclr/src/.nuget/Directory.Build.props @@ -28,7 +28,7 @@ $(OSRid) - Windows_NT;OSX;Android;Linux;FreeBSD;NetBSD;SunOS + Windows_NT;OSX;Android;Linux;FreeBSD;NetBSD;illumos;Solaris ;$(SupportedPackageOSGroups); - sunos-$(TargetArchitecture) + illumos-$(TargetArchitecture) + + + + + solaris-$(TargetArchitecture) + + solaris-$(TargetArchitecture) @@ -176,8 +183,11 @@ - - + + + + + diff --git a/src/coreclr/src/.nuget/Microsoft.NET.Sdk.IL/targets/Microsoft.NET.Sdk.IL.targets b/src/coreclr/src/.nuget/Microsoft.NET.Sdk.IL/targets/Microsoft.NET.Sdk.IL.targets index f2c0a3fb64973..9a4272c394798 100644 --- a/src/coreclr/src/.nuget/Microsoft.NET.Sdk.IL/targets/Microsoft.NET.Sdk.IL.targets +++ b/src/coreclr/src/.nuget/Microsoft.NET.Sdk.IL/targets/Microsoft.NET.Sdk.IL.targets @@ -25,7 +25,8 @@ Copyright (c) .NET Foundation. All rights reserved. <_OSPlatform Condition="$([MSBuild]::IsOSPlatform('osx'))">osx <_OSPlatform Condition="$([MSBuild]::IsOSPlatform('freebsd'))">freebsd <_OSPlatform Condition="$([MSBuild]::IsOSPlatform('netbsd'))">netbsd - <_OSPlatform Condition="$([MSBuild]::IsOSPlatform('sunos'))">sunos + <_OSPlatform Condition="$([MSBuild]::IsOSPlatform('illumos'))">illumos + <_OSPlatform Condition="$([MSBuild]::IsOSPlatform('solaris'))">solaris <_OSArchitecture>$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture) $(_OSPlatform)-$(_OSArchitecture.ToLower()) diff --git a/src/coreclr/tests/scripts/run-pmi-diffs.py b/src/coreclr/tests/scripts/run-pmi-diffs.py index 59fac0d22db1e..2f1024df5d9f1 100755 --- a/src/coreclr/tests/scripts/run-pmi-diffs.py +++ b/src/coreclr/tests/scripts/run-pmi-diffs.py @@ -55,6 +55,8 @@ Docker_name_arm64 = 'microsoft/dotnet-buildtools-prereqs:ubuntu-16.04-cross-arm64-a3ae44b-20180315221921' Docker_opts_arm64 = '-e ROOTFS_DIR=/crossrootfs/arm64' +Is_illumos = ('illumos' in subprocess.Popen(["uname", "-o"], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0].decode('utf-8')) + # This should be factored out of build.sh Unix_name_map = { 'Linux': 'Linux', @@ -62,7 +64,7 @@ 'FreeBSD': 'FreeBSD', 'OpenBSD': 'OpenBSD', 'NetBSD': 'NetBSD', - 'SunOS': 'SunOS' + 'SunOS': 'illumos' if Is_illumos else 'Solaris' } Is_windows = (os.name == 'nt') @@ -131,13 +133,13 @@ def validate_args(args): Returns: args (CoreclrArguments) : Args parsed Notes: - If the arguments are valid then return them all in a tuple. If not, + If the arguments are valid then return them all in a tuple. If not, raise an exception stating x argument is incorrect. """ - coreclr_setup_args = CoreclrArguments(args, - require_built_test_dir=False, - require_built_core_root=True, + coreclr_setup_args = CoreclrArguments(args, + require_built_test_dir=False, + require_built_core_root=True, require_built_product_dir=False) coreclr_setup_args.verify(args, @@ -161,7 +163,7 @@ def validate_args(args): "skip_baseline_build", lambda unused: True, "Error setting baseline build") - + coreclr_setup_args.verify(args, "skip_diffs", lambda unused: True, @@ -183,15 +185,15 @@ def validate_args(args): "Error setting ci_arch") args = ( - coreclr_setup_args.arch, - coreclr_setup_args.ci_arch, - coreclr_setup_args.build_type, - coreclr_setup_args.base_root, - coreclr_setup_args.diff_root, - coreclr_setup_args.scratch_root, - coreclr_setup_args.skip_baseline_build, - coreclr_setup_args.skip_diffs, - coreclr_setup_args.target_branch, + coreclr_setup_args.arch, + coreclr_setup_args.ci_arch, + coreclr_setup_args.build_type, + coreclr_setup_args.base_root, + coreclr_setup_args.diff_root, + coreclr_setup_args.scratch_root, + coreclr_setup_args.skip_baseline_build, + coreclr_setup_args.skip_diffs, + coreclr_setup_args.target_branch, coreclr_setup_args.commit_hash ) @@ -328,7 +330,7 @@ def baseline_build(): buildOpts = 'cross' scriptPath = baseCoreClrPath - # Build a checked baseline jit + # Build a checked baseline jit if Is_windows: command = 'set __TestIntermediateDir=int&&build.cmd %s checked skiptests skipbuildpackages' % arch diff --git a/src/coreclr/tests/setup-stress-dependencies.sh b/src/coreclr/tests/setup-stress-dependencies.sh index a81c8fff7b2a7..925c62cbb405f 100755 --- a/src/coreclr/tests/setup-stress-dependencies.sh +++ b/src/coreclr/tests/setup-stress-dependencies.sh @@ -131,8 +131,13 @@ case "$OSName" in ;; SunOS) - __TargetOS=SunOS - __HostOS=SunOS + if uname -o 2>&1 | grep -q illumos; then + __TargetOS=illumos + __HostOS=illumos + else + __TargetOS=Solaris + __HostOS=Solaris + fi ;; *) diff --git a/src/coreclr/tests/src/Directory.Build.props b/src/coreclr/tests/src/Directory.Build.props index 1b04d30da255b..73cb6257a0bb1 100644 --- a/src/coreclr/tests/src/Directory.Build.props +++ b/src/coreclr/tests/src/Directory.Build.props @@ -98,10 +98,17 @@ ubuntu.14.04-$(TargetArchitecture) - + true - true + true + ubuntu.14.04-$(TargetArchitecture) + + + + + true + true ubuntu.14.04-$(TargetArchitecture) @@ -130,7 +137,7 @@ - true + true C# IL diff --git a/src/coreclr/tests/src/JIT/Directed/StructABI/StructABI.csproj b/src/coreclr/tests/src/JIT/Directed/StructABI/StructABI.csproj index 6ea166cef9a44..6857909d56425 100644 --- a/src/coreclr/tests/src/JIT/Directed/StructABI/StructABI.csproj +++ b/src/coreclr/tests/src/JIT/Directed/StructABI/StructABI.csproj @@ -10,7 +10,7 @@ - + diff --git a/src/installer/Directory.Build.props b/src/installer/Directory.Build.props index d1edd4ec5388f..dcd3615ded3ed 100644 --- a/src/installer/Directory.Build.props +++ b/src/installer/Directory.Build.props @@ -81,7 +81,8 @@ linux-$(TargetArchitecture) freebsd-$(TargetArchitecture) netbsd-$(TargetArchitecture) - sunos-$(TargetArchitecture) + illumos-$(TargetArchitecture) + solaris-$(TargetArchitecture) ios-$(TargetArchitecture) tvos-$(TargetArchitecture) android-$(TargetArchitecture) @@ -124,8 +125,8 @@ false true - - true + + true $(AssetOutputPath)sharedfx_$(OutputRid)_$(Configuration)_version_badge.svg @@ -291,9 +292,15 @@ true - + - true + true + true + + + + + true true diff --git a/src/installer/corehost/cli/hostmisc/hostmisc.cmake b/src/installer/corehost/cli/hostmisc/hostmisc.cmake index f6813e1293cc3..eee0275874991 100644 --- a/src/installer/corehost/cli/hostmisc/hostmisc.cmake +++ b/src/installer/corehost/cli/hostmisc/hostmisc.cmake @@ -5,6 +5,10 @@ include(${CMAKE_CURRENT_LIST_DIR}/configure.cmake) include_directories(${CMAKE_CURRENT_BINARY_DIR}) +if(CLR_CMAKE_TARGET_OS_ILLUMOS) + add_definitions(-DTARGET_ILLUMOS) +endif() + # CMake does not recommend using globbing since it messes with the freshness checks list(APPEND SOURCES ${CMAKE_CURRENT_LIST_DIR}/trace.cpp diff --git a/src/installer/corehost/cli/hostmisc/pal.h b/src/installer/corehost/cli/hostmisc/pal.h index 1e1f4cf5f5c4f..dff9b5b46a766 100644 --- a/src/installer/corehost/cli/hostmisc/pal.h +++ b/src/installer/corehost/cli/hostmisc/pal.h @@ -76,8 +76,16 @@ #else #define LIB_PREFIX _X("lib") #define MAKE_LIBNAME(NAME) (LIB_PREFIX _X(NAME) _X(".so")) +#if defined(TARGET_FREEBSD) +#define FALLBACK_HOST_RID _X("freebsd") +#elif defined(TARGET_ILLUMOS) +#define FALLBACK_HOST_RID _X("illumos") +#elif defined(__sun) +#define FALLBACK_HOST_RID _X("solaris") +#else #define FALLBACK_HOST_RID _X("linux") #endif +#endif #define LIBCORECLR_FILENAME (LIB_PREFIX _X("coreclr")) #define LIBCORECLR_NAME MAKE_LIBNAME("coreclr") @@ -146,7 +154,7 @@ namespace pal inline int strncasecmp(const char_t* str1, const char_t* str2, int len) { return ::_wcsnicmp(str1, str2, len); } inline int pathcmp(const pal::string_t &path1, const pal::string_t &path2) { return strcasecmp(path1.c_str(), path2.c_str()); } inline string_t to_string(int value) { return std::to_wstring(value); } - + inline size_t strlen(const char_t* str) { return ::wcslen(str); } inline FILE * file_open(const string_t& path, const char_t* mode) { return ::_wfopen(path.c_str(), mode); } diff --git a/src/installer/corehost/cli/hostmisc/pal.unix.cpp b/src/installer/corehost/cli/hostmisc/pal.unix.cpp index a17487636d60b..4a3e408208515 100644 --- a/src/installer/corehost/cli/hostmisc/pal.unix.cpp +++ b/src/installer/corehost/cli/hostmisc/pal.unix.cpp @@ -26,6 +26,8 @@ #include #include #include +#elif defined(__sun) +#include #endif #if defined(TARGET_LINUX) @@ -583,20 +585,85 @@ pal::string_t pal::get_current_os_rid_platform() pal::string_t pal::get_current_os_rid_platform() { pal::string_t ridOS; - char str[256]; - size_t size = sizeof(str); int ret = sysctlbyname("kern.osrelease", str, &size, NULL, 0); + if (ret == 0) { - char *pos = strchr(str,'.'); + char *pos = strchr(str, '.'); if (pos) { - *pos = '\0'; + ridOS.append(_X("freebsd.")) + .append(str, pos - str); } - ridOS.append(_X("freebsd.")); - ridOS.append(str); + } + + return ridOS; +} +#elif defined(TARGET_ILLUMOS) +pal::string_t pal::get_current_os_rid_platform() +{ + // Code: + // struct utsname u; + // if (uname(&u) != -1) + // printf("sysname: %s, release: %s, version: %s, machine: %s\n", u.sysname, u.release, u.version, u.machine); + // + // Output examples: + // on OmniOS + // sysname: SunOS, release: 5.11, version: omnios-r151018-95eaa7e, machine: i86pc + // on OpenIndiana Hipster: + // sysname: SunOS, release: 5.11, version: illumos-63878f749f, machine: i86pc + // on SmartOS: + // sysname: SunOS, release: 5.11, version: joyent_20200408T231825Z, machine: i86pc + + pal::string_t ridOS; + struct utsname utsname_obj; + if (uname(&utsname_obj) < 0) + { + return ridOS; + } + + if (strncmp(utsname_obj.version, "omnios", strlen("omnios")) == 0) + { + ridOS.append(_X("omnios.")) + .append(utsname_obj.version, strlen("omnios-r"), 2); // e.g. omnios.15 + } + else if (strncmp(utsname_obj.version, "illumos-", strlen("illumos-")) == 0) + { + ridOS.append(_X("openindiana")); // version-less + } + else if (strncmp(utsname_obj.version, "joyent_", strlen("joyent_")) == 0) + { + ridOS.append(_X("smartos.")) + .append(utsname_obj.version, strlen("joyent_"), 4); // e.g. smartos.2020 + } + + return ridOS; +} +#elif defined(__sun) +pal::string_t pal::get_current_os_rid_platform() +{ + // Code: + // struct utsname u; + // if (uname(&u) != -1) + // printf("sysname: %s, release: %s, version: %s, machine: %s\n", u.sysname, u.release, u.version, u.machine); + // + // Output example on Solaris 11: + // sysname: SunOS, release: 5.11, version: 11.3, machine: i86pc + + pal::string_t ridOS; + struct utsname utsname_obj; + if (uname(&utsname_obj) < 0) + { + return ridOS; + } + + char *pos = strchr(utsname_obj.version, '.'); + if (pos) + { + ridOS.append(_X("solaris.")) + .append(utsname_obj.version, pos - utsname_obj.version); // e.g. solaris.11 } return ridOS; diff --git a/src/installer/pkg/projects/netcoreapp/Directory.Build.props b/src/installer/pkg/projects/netcoreapp/Directory.Build.props index 59ac9e4269092..63ce1c404aba0 100644 --- a/src/installer/pkg/projects/netcoreapp/Directory.Build.props +++ b/src/installer/pkg/projects/netcoreapp/Directory.Build.props @@ -15,7 +15,8 @@ Browser FreeBSD NetBSD - SunOS + illumos + Solaris $(CoreCLRTargetOS) diff --git a/src/installer/pkg/projects/netcoreappRIDs.props b/src/installer/pkg/projects/netcoreappRIDs.props index 706135723a29c..0b3024cf53838 100644 --- a/src/installer/pkg/projects/netcoreappRIDs.props +++ b/src/installer/pkg/projects/netcoreappRIDs.props @@ -12,7 +12,8 @@ - + + x86 diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs index 38fb7d598ce0a..153b3c382b07e 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs @@ -162,6 +162,39 @@ private static DistroInfo GetDistroInfo() // What we want is major release as minor releases should be compatible. result.VersionId = ToVersion(RuntimeInformation.OSDescription.Split()[1].Split('.')[0]); } + else if (IsIllumos) + { + // examples: + // on OmniOS + // SunOS 5.11 omnios-r151018-95eaa7e + // on OpenIndiana Hipster: + // SunOS 5.11 illumos-63878f749f + // on SmartOS: + // SunOS 5.11 joyent_20200408T231825Z + var versionDescription = RuntimeInformation.OSDescription.Split(' ')[2]; + switch (versionDescription) + { + case string version when version.StartsWith("omnios"): + result.Id = "OmniOS"; + result.VersionId = ToVersion(version.Substring("omnios-r".Length, 2)); // e.g. 15 + break; + case string version when version.StartsWith("joyent"): + result.Id = "SmartOS"; + result.VersionId = ToVersion(version.Substring("joyent_".Length, 4)); // e.g. 2020 + break; + case string version when version.StartsWith("illumos"): + result.Id = "OpenIndiana"; + // version-less + break; + } + } + else if (IsSolaris) + { + // example: + // SunOS 5.11 11.3 + result.Id = "Solaris"; + result.VersionId = ToVersion(RuntimeInformation.OSDescription.Split(' ')[2]); // e.g. 11.3 + } else if (File.Exists("/etc/os-release")) { foreach (string line in File.ReadAllLines("/etc/os-release")) diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs index f5d927f0614c8..5cf178f608b7b 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs @@ -27,6 +27,8 @@ public static partial class PlatformDetection public static bool IsNetBSD => RuntimeInformation.IsOSPlatform(OSPlatform.Create("NETBSD")); public static bool IsiOS => RuntimeInformation.IsOSPlatform(OSPlatform.Create("IOS")); public static bool IstvOS => RuntimeInformation.IsOSPlatform(OSPlatform.Create("TVOS")); + public static bool IsIllumos => RuntimeInformation.IsOSPlatform(OSPlatform.Create("ILLUMOS")); + public static bool IsSolaris => RuntimeInformation.IsOSPlatform(OSPlatform.Create("SOLARIS")); public static bool IsArmProcess => RuntimeInformation.ProcessArchitecture == Architecture.Arm; public static bool IsNotArmProcess => !IsArmProcess; @@ -112,7 +114,7 @@ public static bool IsNonZeroLowerBoundArraySupported // Windows - Schannel supports alpn from win8.1/2012 R2 and higher. // Linux - OpenSsl supports alpn from openssl 1.0.2 and higher. // OSX - SecureTransport doesn't expose alpn APIs. TODO https://github.com/dotnet/runtime/issues/27727 - public static bool IsOpenSslSupported => IsLinux || IsFreeBSD; + public static bool IsOpenSslSupported => IsLinux || IsFreeBSD || IsIllumos || IsSolaris; public static bool SupportsAlpn => (IsWindows && !IsWindows7) || (IsOpenSslSupported && @@ -273,7 +275,7 @@ private static bool GetTls13Support() } else if (IsOpenSslSupported) { - // Covers Linux and FreeBSD + // Covers Linux, FreeBSD, illumos and Solaris return OpenSslVersion >= new Version(1,1,1); } diff --git a/src/libraries/Directory.Build.props b/src/libraries/Directory.Build.props index 8a5a16a37f287..7dbdbba7544a1 100644 --- a/src/libraries/Directory.Build.props +++ b/src/libraries/Directory.Build.props @@ -15,12 +15,12 @@ $(RepositoryEngineeringDir)BeforeTargetFrameworkInference.targets $(RepoRoot)artifacts\toolset\Common\ $([System.Text.RegularExpressions.Regex]::IsMatch($(MSBuildProjectDirectory), 'src%24')) - true + true $(RepositoryEngineeringDir)depProj.common.targets $(LibrariesProjectRoot)OSGroups.json $(NetCoreAppCurrent) false - $(AdditionalBuildTargetFrameworks);$(NetCoreAppCurrent)-Windows_NT;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent)-NetBSD;$(NetCoreAppCurrent)-FreeBSD + $(AdditionalBuildTargetFrameworks);$(NetCoreAppCurrent)-Windows_NT;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent)-NetBSD;$(NetCoreAppCurrent)-FreeBSD;$(NetCoreAppCurrent)-illumos;$(NetCoreAppCurrent)-Solaris $(RepositoryEngineeringDir)LicenseHeader.txt @@ -30,7 +30,7 @@ - + $([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant) arm @@ -42,7 +42,7 @@ $(TargetOS.ToLowerInvariant()) - + Debug $(TargetFramework) @@ -94,6 +94,8 @@ <_portableOS Condition="'$(_runtimeOSFamily)' == 'win' or '$(TargetOS)' == 'Windows_NT'">win <_portableOS Condition="'$(_runtimeOSFamily)' == 'osx'">osx <_portableOS Condition="'$(_runtimeOSFamily)' == 'FreeBSD'">freebsd + <_portableOS Condition="'$(_runtimeOSFamily)' == 'illumos'">illumos + <_portableOS Condition="'$(_runtimeOSFamily)' == 'Solaris'">solaris <_portableOS Condition="'$(RuntimeOS)' == 'Browser'">browser <_portableOS Condition="'$(RuntimeOS)' == 'ios'">ios <_portableOS Condition="'$(RuntimeOS)' == 'tvos'">tvos @@ -124,10 +126,10 @@ $(ToolRuntimeRID) - <_portableOS Condition="'$(TargetOS)' == 'Unix' and '$(_runtimeOSFamily)' != 'osx' and '$(_runtimeOSFamily)' != 'FreeBSD' and '$(_runtimeOS)' != 'linux-musl'">linux + <_portableOS Condition="'$(TargetOS)' == 'Unix' and '$(_runtimeOSFamily)' != 'osx' and '$(_runtimeOSFamily)' != 'FreeBSD' and '$(_runtimeOS)' != 'linux-musl' and '$(_runtimeOSFamily)' != 'illumos' and '$(_runtimeOSFamily)' != 'Solaris'">linux - <_portableOS Condition="'$(TargetOS)' == 'Unix' and '$(_runtimeOSFamily)' != 'osx' and '$(_runtimeOSFamily)' != 'FreeBSD' and '$(_runtimeOS)' != 'linux-musl'">linux + <_portableOS Condition="'$(TargetOS)' == 'Unix' and '$(_runtimeOSFamily)' != 'osx' and '$(_runtimeOSFamily)' != 'FreeBSD' and '$(_runtimeOS)' != 'linux-musl' and '$(_runtimeOSFamily)' != 'illumos' and '$(_runtimeOSFamily)' != 'Solaris'">linux <_packageRID /> <_packageRID Condition="'$(PortableBuild)' == 'true'">$(_portableOS)-$(TargetArchitecture) @@ -159,14 +161,14 @@ - + $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'ref')) - $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', '$(MSBuildProjectName)')) + $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', '$(MSBuildProjectName)')) $([MSBuild]::NormalizeDirectory('$(ArtifactsObjDir)', '$(MSBuildProjectName)')) $([MSBuild]::NormalizeDirectory('$(ArtifactsObjDir)', '$(MSBuildProjectName)', 'ref')) - $([MSBuild]::NormalizeDirectory('$(AssemblyBinDirOutputPath)', 'ref')) + $([MSBuild]::NormalizeDirectory('$(AssemblyBinDirOutputPath)', 'ref')) diff --git a/src/libraries/Native/Unix/configure.cmake b/src/libraries/Native/Unix/configure.cmake index 4dc8b93c36de8..865c32da69bc4 100644 --- a/src/libraries/Native/Unix/configure.cmake +++ b/src/libraries/Native/Unix/configure.cmake @@ -30,7 +30,11 @@ elseif (CLR_CMAKE_TARGET_FREEBSD) elseif (CLR_CMAKE_TARGET_NETBSD) set(PAL_UNIX_NAME \"NETBSD\") elseif (CLR_CMAKE_TARGET_SUNOS) - set(PAL_UNIX_NAME \"SUNOS\") + if (CLR_CMAKE_TARGET_ILLUMOS) + set(PAL_UNIX_NAME \"ILLUMOS\") + else () + set(PAL_UNIX_NAME \"SOLARIS\") + endif () # requires /opt/tools when building in Global Zone (GZ) include_directories(SYSTEM /opt/local/include /opt/tools/include) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector") diff --git a/src/libraries/OSGroups.json b/src/libraries/OSGroups.json index 6b26bd7e2aecf..c63d8d977b182 100644 --- a/src/libraries/OSGroups.json +++ b/src/libraries/OSGroups.json @@ -1,6 +1,6 @@ { "runtimes": { - "Unix" : { + "Unix" : { }, "Browser" : { "#import": [ @@ -38,6 +38,16 @@ ] }, "NetBSD": { + "#import": [ + "Unix" + ] + }, + "illumos": { + "#import": [ + "Unix" + ] + }, + "Solaris": { "#import": [ "Unix" ] diff --git a/src/libraries/pkg/Microsoft.NETCore.Platforms/runtime.compatibility.json b/src/libraries/pkg/Microsoft.NETCore.Platforms/runtime.compatibility.json index ca8d8b4493f6a..41a7e17807e7c 100644 --- a/src/libraries/pkg/Microsoft.NETCore.Platforms/runtime.compatibility.json +++ b/src/libraries/pkg/Microsoft.NETCore.Platforms/runtime.compatibility.json @@ -2063,6 +2063,20 @@ "any", "base" ], + "illumos": [ + "illumos", + "unix", + "any", + "base" + ], + "illumos-x64": [ + "illumos-x64", + "illumos", + "unix-x64", + "unix", + "any", + "base" + ], "ios": [ "ios", "unix", @@ -3298,6 +3312,60 @@ "any", "base" ], + "omnios": [ + "omnios", + "illumos", + "unix", + "any", + "base" + ], + "omnios-x64": [ + "omnios-x64", + "omnios", + "illumos-x64", + "illumos", + "unix-x64", + "unix", + "any", + "base" + ], + "omnios.15": [ + "omnios.15", + "omnios", + "illumos", + "unix", + "any", + "base" + ], + "omnios.15-x64": [ + "omnios.15-x64", + "omnios.15", + "omnios-x64", + "omnios", + "illumos-x64", + "illumos", + "unix-x64", + "unix", + "any", + "base" + ], + "openindiana": [ + "openindiana", + "illumos", + "unix", + "any", + "base" + ], + "openindiana-x64": [ + "openindiana-x64", + "openindiana", + "illumos-x64", + "illumos", + "unix-x64", + "unix", + "any", + "base" + ], "opensuse": [ "opensuse", "linux", @@ -4250,6 +4318,97 @@ "any", "base" ], + "smartos": [ + "smartos", + "illumos", + "unix", + "any", + "base" + ], + "smartos-x64": [ + "smartos-x64", + "smartos", + "illumos-x64", + "illumos", + "unix-x64", + "unix", + "any", + "base" + ], + "smartos.2020": [ + "smartos.2020", + "smartos", + "illumos", + "unix", + "any", + "base" + ], + "smartos.2020-x64": [ + "smartos.2020-x64", + "smartos.2020", + "smartos-x64", + "smartos", + "illumos-x64", + "illumos", + "unix-x64", + "unix", + "any", + "base" + ], + "smartos.2021": [ + "smartos.2021", + "smartos.2020", + "smartos", + "illumos", + "unix", + "any", + "base" + ], + "smartos.2021-x64": [ + "smartos.2021-x64", + "smartos.2021", + "smartos.2020-x64", + "smartos.2020", + "smartos-x64", + "smartos", + "illumos-x64", + "illumos", + "unix-x64", + "unix", + "any", + "base" + ], + "solaris": [ + "solaris", + "unix", + "any", + "base" + ], + "solaris-x64": [ + "solaris-x64", + "solaris", + "unix-x64", + "unix", + "any", + "base" + ], + "solaris.11": [ + "solaris.11", + "solaris", + "unix", + "any", + "base" + ], + "solaris.11-x64": [ + "solaris.11-x64", + "solaris.11", + "solaris-x64", + "solaris", + "unix-x64", + "unix", + "any", + "base" + ], "tizen": [ "tizen", "linux", diff --git a/src/libraries/pkg/Microsoft.NETCore.Platforms/runtime.json b/src/libraries/pkg/Microsoft.NETCore.Platforms/runtime.json index aa9f28ca15d33..4584c45f8e267 100644 --- a/src/libraries/pkg/Microsoft.NETCore.Platforms/runtime.json +++ b/src/libraries/pkg/Microsoft.NETCore.Platforms/runtime.json @@ -898,6 +898,17 @@ "linux-x64" ] }, + "illumos": { + "#import": [ + "unix" + ] + }, + "illumos-x64": { + "#import": [ + "illumos", + "unix-x64" + ] + }, "ios": { "#import": [ "unix" @@ -1397,6 +1408,39 @@ "rhel.8.0-x64" ] }, + "omnios": { + "#import": [ + "illumos" + ] + }, + "omnios-x64": { + "#import": [ + "omnios", + "illumos-x64" + ] + }, + "omnios.15": { + "#import": [ + "omnios" + ] + }, + "omnios.15-x64": { + "#import": [ + "omnios.15", + "omnios-x64" + ] + }, + "openindiana": { + "#import": [ + "illumos" + ] + }, + "openindiana-x64": { + "#import": [ + "openindiana", + "illumos-x64" + ] + }, "opensuse": { "#import": [ "linux" @@ -1823,6 +1867,61 @@ "sles.15-x64" ] }, + "smartos": { + "#import": [ + "illumos" + ] + }, + "smartos-x64": { + "#import": [ + "smartos", + "illumos-x64" + ] + }, + "smartos.2020": { + "#import": [ + "smartos" + ] + }, + "smartos.2020-x64": { + "#import": [ + "smartos.2020", + "smartos-x64" + ] + }, + "smartos.2021": { + "#import": [ + "smartos.2020" + ] + }, + "smartos.2021-x64": { + "#import": [ + "smartos.2021", + "smartos.2020-x64" + ] + }, + "solaris": { + "#import": [ + "unix" + ] + }, + "solaris-x64": { + "#import": [ + "solaris", + "unix-x64" + ] + }, + "solaris.11": { + "#import": [ + "solaris" + ] + }, + "solaris.11-x64": { + "#import": [ + "solaris.11", + "solaris-x64" + ] + }, "tizen": { "#import": [ "linux" diff --git a/src/libraries/pkg/Microsoft.NETCore.Platforms/runtimeGroups.props b/src/libraries/pkg/Microsoft.NETCore.Platforms/runtimeGroups.props index 1cb561273e87a..49876be074df1 100644 --- a/src/libraries/pkg/Microsoft.NETCore.Platforms/runtimeGroups.props +++ b/src/libraries/pkg/Microsoft.NETCore.Platforms/runtimeGroups.props @@ -130,6 +130,34 @@ 11;12;13 + + unix + x64 + 11 + + + + unix + x64 + + + + illumos + x64 + 15 + + + + illumos + x64 + + + + illumos + x64 + 2020;2021 + + linux