Skip to content

Commit 8271d53

Browse files
authored
Add configurations for SunOS CoreCLR managed build (#36266)
1 parent 210a82a commit 8271d53

File tree

23 files changed

+123
-60
lines changed

23 files changed

+123
-60
lines changed

eng/Configurations.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
<TargetOS Condition="'$(TargetOS)' == '' and $([MSBuild]::IsOSPlatform('OSX'))">OSX</TargetOS>
4444
<TargetOS Condition="'$(TargetOS)' == '' and $([MSBuild]::IsOSPlatform('FREEBSD'))">FreeBSD</TargetOS>
4545
<TargetOS Condition="'$(TargetOS)' == '' and $([MSBuild]::IsOSPlatform('NETBSD'))">NetBSD</TargetOS>
46+
<TargetOS Condition="'$(TargetOS)' == '' and $([MSBuild]::IsOSPlatform('SUNOS'))">SunOS</TargetOS>
4647
<TargetOS Condition="'$(TargetOS)' == '' and $([MSBuild]::IsOSUnixLike())">Linux</TargetOS>
4748
<TargetOS Condition="'$(TargetOS)' == '' and $([MSBuild]::IsOSPlatform('WINDOWS'))">Windows_NT</TargetOS>
4849
<CoreCLRTargetOS Condition="'$(CoreCLRTargetOS)' == ''">$(TargetOS)</CoreCLRTargetOS>

eng/build.sh

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ usage()
1818
{
1919
echo "Common settings:"
2020
echo " --subset Build a subset, print available subsets with -subset help (short: -s)"
21-
echo " --os Build operating system: Windows_NT, Linux, FreeBSD, OSX, tvOS, iOS, Android or Browser"
21+
echo " --os Build operating system: Windows_NT, Linux, FreeBSD, OSX, tvOS, iOS, Android, Browser, NetBSD or SunOS"
2222
echo " --arch Build platform: x86, x64, arm, armel, arm64 or wasm"
2323
echo " --configuration Build configuration: Debug, Release or [CoreCLR]Checked (short: -c)"
2424
echo " --runtimeConfiguration Runtime build configuration: Debug, Release or [CoreCLR]Checked (short: -rc)"
@@ -108,24 +108,24 @@ while [[ $# > 0 ]]; do
108108
exit 0
109109
;;
110110
-subset|-s)
111-
if [ -z ${2+x} ]; then
111+
if [ -z ${2+x} ]; then
112112
arguments="$arguments /p:Subset=help"
113113
shift 1
114-
else
114+
else
115115
arguments="$arguments /p:Subset=$2"
116116
shift 2
117117
fi
118118
;;
119119
-arch)
120-
if [ -z ${2+x} ]; then
120+
if [ -z ${2+x} ]; then
121121
echo "No architecture supplied. See help (--help) for supported architectures." 1>&2
122122
exit 1
123123
fi
124124
arch=$2
125125
shift 2
126126
;;
127127
-configuration|-c)
128-
if [ -z ${2+x} ]; then
128+
if [ -z ${2+x} ]; then
129129
echo "No configuration supplied. See help (--help) for supported configurations." 1>&2
130130
exit 1
131131
fi
@@ -134,7 +134,7 @@ while [[ $# > 0 ]]; do
134134
shift 2
135135
;;
136136
-framework|-f)
137-
if [ -z ${2+x} ]; then
137+
if [ -z ${2+x} ]; then
138138
echo "No framework supplied. See help (--help) for supported frameworks." 1>&2
139139
exit 1
140140
fi
@@ -143,7 +143,7 @@ while [[ $# > 0 ]]; do
143143
shift 2
144144
;;
145145
-os)
146-
if [ -z ${2+x} ]; then
146+
if [ -z ${2+x} ]; then
147147
echo "No target operating system supplied. See help (--help) for supported target operating systems." 1>&2
148148
exit 1
149149
fi
@@ -156,7 +156,7 @@ while [[ $# > 0 ]]; do
156156
shift 1
157157
;;
158158
-testscope)
159-
if [ -z ${2+x} ]; then
159+
if [ -z ${2+x} ]; then
160160
echo "No test scope supplied. See help (--help) for supported test scope values." 1>&2
161161
exit 1
162162
fi
@@ -172,7 +172,7 @@ while [[ $# > 0 ]]; do
172172
shift 1
173173
;;
174174
-runtimeconfiguration|-rc)
175-
if [ -z ${2+x} ]; then
175+
if [ -z ${2+x} ]; then
176176
echo "No runtime configuration supplied. See help (--help) for supported runtime configurations." 1>&2
177177
exit 1
178178
fi
@@ -181,7 +181,7 @@ while [[ $# > 0 ]]; do
181181
shift 2
182182
;;
183183
-librariesconfiguration|-lc)
184-
if [ -z ${2+x} ]; then
184+
if [ -z ${2+x} ]; then
185185
echo "No libraries configuration supplied. See help (--help) for supported libraries configurations." 1>&2
186186
exit 1
187187
fi
@@ -198,7 +198,7 @@ while [[ $# > 0 ]]; do
198198
shift 1
199199
;;
200200
-cmakeargs)
201-
if [ -z ${2+x} ]; then
201+
if [ -z ${2+x} ]; then
202202
echo "No cmake args supplied." 1>&2
203203
exit 1
204204
fi

eng/native/build-commons.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ done
409409
# Get the number of processors available to the scheduler
410410
# Other techniques such as `nproc` only get the number of
411411
# processors available to a single process.
412-
platform=$(uname)
412+
platform="$(uname)"
413413
if [[ "$platform" == "FreeBSD" ]]; then
414414
__NumProc=$(sysctl hw.ncpu | awk '{ print $2+1 }')
415415
elif [[ "$platform" == "NetBSD" || "$platform" == "SunOS" ]]; then

eng/native/configurecompiler.cmake

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -227,15 +227,13 @@ if (CLR_CMAKE_HOST_UNIX)
227227

228228
if(CLR_CMAKE_HOST_OSX)
229229
message("Detected OSX x86_64")
230-
endif(CLR_CMAKE_HOST_OSX)
231-
232-
if(CLR_CMAKE_HOST_FREEBSD)
230+
elseif(CLR_CMAKE_HOST_FREEBSD)
233231
message("Detected FreeBSD amd64")
234-
endif(CLR_CMAKE_HOST_FREEBSD)
235-
236-
if(CLR_CMAKE_HOST_NETBSD)
232+
elseif(CLR_CMAKE_HOST_NETBSD)
237233
message("Detected NetBSD amd64")
238-
endif(CLR_CMAKE_HOST_NETBSD)
234+
elseif(CLR_CMAKE_HOST_SUNOS)
235+
message("Detected SunOS amd64")
236+
endif(CLR_CMAKE_HOST_SUNOS)
239237
endif(CLR_CMAKE_HOST_UNIX)
240238

241239
if (CLR_CMAKE_HOST_WIN32)
@@ -373,6 +371,8 @@ if(CLR_CMAKE_TARGET_UNIX)
373371
add_definitions(-DTARGET_LINUX)
374372
elseif(CLR_CMAKE_TARGET_NETBSD)
375373
add_definitions(-DTARGET_NETBSD)
374+
elseif(CLR_CMAKE_TARGET_SUNOS)
375+
add_definitions(-DTARGET_SUNOS)
376376
elseif(CLR_CMAKE_TARGET_ANDROID)
377377
add_definitions(-DTARGET_ANDROID)
378378
endif()

eng/run-test.sh

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ wait_on_pids()
1515

1616
usage()
1717
{
18-
echo "Runs .NET CoreFX tests on FreeBSD, NetBSD or Linux"
18+
echo "Runs .NET CoreFX tests on FreeBSD, Linux, NetBSD or SunOS"
1919
echo "usage: run-test [options]"
2020
echo
2121
echo "Input sources:"
2222
echo " --runtime <location> Location of root of the binaries directory"
23-
echo " containing the FreeBSD, NetBSD or Linux runtime"
23+
echo " containing the FreeBSD, Linux, NetBSD or SunOS runtime"
2424
echo " default: <repo_root>/bin/testhost/netcoreapp-<OS>-<Configuration>-<Arch>"
2525
echo " --corefx-tests <location> Location of the root binaries location containing"
2626
echo " the tests to run"
@@ -29,7 +29,7 @@ usage()
2929
echo "Flavor/OS/Architecture options:"
3030
echo " --configuration <config> Configuration to run (Debug/Release)"
3131
echo " default: Debug"
32-
echo " --os <os> OS to run (FreeBSD, NetBSD or Linux)"
32+
echo " --os <os> OS to run (FreeBSD, Linux, NetBSD or SunOS)"
3333
echo " default: detect current OS"
3434
echo " --arch <Architecture> Architecture to run (x64, arm, armel, x86, arm64)"
3535
echo " default: detect current architecture"
@@ -236,34 +236,34 @@ done
236236

237237
# Compute paths to the binaries if they haven't already been computed
238238

239-
if [ "$Runtime" == "" ]
239+
if [ -z "$Runtime" ]
240240
then
241241
Runtime="$ProjectRoot/artifacts/bin/testhost/netcoreapp-$OS-$Configuration-$__Arch"
242242
fi
243243

244-
if [ "$CoreFxTests" == "" ]
244+
if [ -z "$CoreFxTests" ]
245245
then
246246
CoreFxTests="$ProjectRoot/artifacts/bin"
247247
fi
248248

249249
# Check parameters up front for valid values:
250250

251-
if [ ! "$Configuration" == "Debug" ] && [ ! "$Configuration" == "Release" ]
251+
if [ "$Configuration" != "Debug" ] && [ "$Configuration" != "Release" ]
252252
then
253253
echo "error: Configuration should be Debug or Release"
254254
exit 1
255255
fi
256256

257-
if [ ! "$OS" == "FreeBSD" ] && [ ! "$OS" == "NetBSD" ] && [ ! "$OS" == "Linux" ]
257+
if [ "$OS" != "FreeBSD" ] && [ "$OS" != "Linux" ] && [ "$OS" != "NetBSD" ] && [ "$OS" != "SunOS" ]
258258
then
259-
echo "error: OS should be FreeBSD, NetBSD or Linux"
259+
echo "error: OS should be FreeBSD, Linux, NetBSD or Linux"
260260
exit 1
261261
fi
262262

263263
export CORECLR_SERVER_GC="$serverGC"
264264
export PAL_OUTPUTDEBUGSTRING="1"
265265

266-
if [ "$LANG" == "" ]
266+
if [ -z "$LANG" ]
267267
then
268268
export LANG="en_US.UTF-8"
269269
fi
@@ -285,7 +285,10 @@ if [ $RunTestSequential -eq 1 ]
285285
then
286286
maxProcesses=1;
287287
else
288-
if [ `uname` = "NetBSD" ] || [ `uname` = "FreeBSD" ]; then
288+
platform="$(uname)"
289+
if [ "$platform" = "FreeBSD" ]; then
290+
maxProcesses=$(sysctl hw.ncpu | awk '{ print $2+1 }')
291+
if [ "$platform" = "NetBSD" ] || [ "$platform" = "SunOS" ] ; then
289292
maxProcesses=$(($(getconf NPROCESSORS_ONLN)+1))
290293
else
291294
maxProcesses=$(($(getconf _NPROCESSORS_ONLN)+1))

eng/targetframeworksuffix.props

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@
6262
<PackageTargetRuntime>netbsd</PackageTargetRuntime>
6363
</PropertyGroup>
6464
</When>
65+
<When Condition="'$(TargetFrameworkSuffix)' == 'SunOS'">
66+
<PropertyGroup>
67+
<TargetsUnix>true</TargetsUnix>
68+
<TargetsSunOS>true</TargetsSunOS>
69+
<PackageTargetRuntime>sunos</PackageTargetRuntime>
70+
</PropertyGroup>
71+
</When>
6572
<When Condition="'$(TargetFrameworkSuffix)' == 'Browser'">
6673
<PropertyGroup>
6774
<TargetsLinux>true</TargetsLinux>

src/coreclr/dir.common.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,11 @@
5555
<TargetsFreeBSD Condition="'$(TargetOS)' == 'FreeBSD'">true</TargetsFreeBSD>
5656
<TargetsLinux Condition="'$(TargetOS)' == 'Linux'">true</TargetsLinux>
5757
<TargetsNetBSD Condition="'$(TargetOS)' == 'NetBSD'">true</TargetsNetBSD>
58+
<TargetsSunOS Condition="'$(TargetOS)' == 'SunOS'">true</TargetsSunOS>
5859
<TargetsOSX Condition="'$(TargetOS)' == 'OSX'">true</TargetsOSX>
5960
<TargetsWindows Condition="'$(TargetOS)' == 'Windows_NT'">true</TargetsWindows>
6061

61-
<TargetsUnix Condition="'$(TargetsFreeBSD)' == 'true' or '$(TargetsLinux)' == 'true' or '$(TargetsNetBSD)' == 'true' or '$(TargetsOSX)' == 'true'">true</TargetsUnix>
62+
<TargetsUnix Condition="'$(TargetsFreeBSD)' == 'true' or '$(TargetsLinux)' == 'true' or '$(TargetsNetBSD)' == 'true' or '$(TargetsOSX)' == 'true' or '$(TargetsSunOS)' == 'true'">true</TargetsUnix>
6263

6364
<!-- We are only tracking Linux Distributions for Nuget RID mapping -->
6465
<DistroRid Condition="'$(TargetsLinux)' == 'true'">$(__DistroRid)</DistroRid>

src/coreclr/run-cppcheck.sh

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ usage()
1717
check_dependencies()
1818
{
1919
# Check presence of cppcheck on the path
20-
if [ "$RunCppCheck" == true ]
20+
if [ "$RunCppCheck" = "true" ]
2121
then
2222
hash cppcheck 2>/dev/null || { echo >&2 "Please install cppcheck before running this script"; exit 1; }
2323
fi
24-
24+
2525
# Check presence of sloccount on the path
26-
if [ "$RunSlocCount" == true ]
26+
if [ "$RunSlocCount" = "true" ]
2727
then
2828
hash sloccount 2>/dev/null || { echo >&2 "Please install sloccount before running this script"; exit 1; }
2929
fi
@@ -39,9 +39,10 @@ SloccountOutput="sloccount.sc"
3939
# Get the number of processors available to the scheduler
4040
# Other techniques such as `nproc` only get the number of
4141
# processors available to a single process.
42-
if [ `uname` = "FreeBSD" ]; then
43-
NumProc=`sysctl hw.ncpu | awk '{ print $2+1 }'`
44-
elif [ `uname` = "NetBSD" ]; then
42+
platform="$(uname)"
43+
if [ "$platform" = "FreeBSD" ]; then
44+
NumProc=$(sysctl hw.ncpu | awk '{ print $2+1 }')
45+
elif [ "$platform" = "NetBSD" || "$platform" = "SunOS" ]; then
4546
NumProc=$(($(getconf NPROCESSORS_ONLN)+1))
4647
else
4748
NumProc=$(($(getconf _NPROCESSORS_ONLN)+1))
@@ -80,19 +81,19 @@ do
8081
esac
8182
done
8283

83-
if [ "$FilesFromArgs" != "" ];
84+
if [ -n "$FilesFromArgs" ];
8485
then
8586
Files=$FilesFromArgs
8687
fi
8788

88-
if [ "$CppCheckOutput" == "" ];
89+
if [ -z "$CppCheckOutput" ];
8990
then
9091
echo "Expected: file for cppcheck output"
9192
usage
9293
exit 1
9394
fi
9495

95-
if [ "$SloccountOutput" == "" ];
96+
if [ -z "$SloccountOutput" ];
9697
then
9798
echo "Expected: file for sloccount output"
9899
usage
@@ -101,14 +102,14 @@ fi
101102

102103
check_dependencies
103104

104-
if [ "$RunCppCheck" == true ]
105+
if [ "$RunCppCheck" = "true" ]
105106
then
106107
echo "Running cppcheck for files: $Files"
107108
cppcheck --enable=all -j $NumProc --xml --xml-version=2 --force $Files 2> $CppCheckOutput
108109
CppCheckOutputs="$CppCheckOutput (cppcheck)"
109110
fi
110111

111-
if [ "$RunSlocCount" == true ]
112+
if [ "$RunSlocCount" = "true" ]
112113
then
113114
echo "Running sloccount for files: $Files"
114115
sloccount --wide --details $Files > $SloccountOutput

src/coreclr/src/.nuget/Directory.Build.props

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
<RuntimeOS Condition="'$(RuntimeOS)' == ''">$(OSRid)</RuntimeOS>
3030

31-
<SupportedPackageOSGroups Condition="'$(SupportedPackageOSGroups)' == ''">Windows_NT;OSX;Android;Linux;FreeBSD</SupportedPackageOSGroups>
31+
<SupportedPackageOSGroups Condition="'$(SupportedPackageOSGroups)' == ''">Windows_NT;OSX;Android;Linux;FreeBSD;NetBSD;SunOS</SupportedPackageOSGroups>
3232
<SupportedPackageOSGroups>;$(SupportedPackageOSGroups);</SupportedPackageOSGroups>
3333

3434
<!-- Identify OS family based upon the RuntimeOS, which could be distro specific (e.g. osx.10.12) or
@@ -96,6 +96,20 @@
9696
<PackageRID Condition="'$(PortableBuild)' == 'true'">freebsd-$(TargetArchitecture)</PackageRID>
9797
</PropertyGroup>
9898
</When>
99+
<When Condition="'$(_runtimeOSFamily)' == 'netbsd'">
100+
<PropertyGroup>
101+
<PackageRID>netbsd-$(TargetArchitecture)</PackageRID>
102+
<!-- Set the platform part of the RID if we are doing a portable build -->
103+
<PackageRID Condition="'$(PortableBuild)' == 'true'">netbsd-$(TargetArchitecture)</PackageRID>
104+
</PropertyGroup>
105+
</When>
106+
<When Condition="'$(_runtimeOSFamily)' == 'sunos'">
107+
<PropertyGroup>
108+
<PackageRID>sunos-$(TargetArchitecture)</PackageRID>
109+
<!-- Set the platform part of the RID if we are doing a portable build -->
110+
<PackageRID Condition="'$(PortableBuild)' == 'true'">sunos-$(TargetArchitecture)</PackageRID>
111+
</PropertyGroup>
112+
</When>
99113
<When Condition="'$(_runtimeOSFamily)' == 'android'">
100114
<PropertyGroup>
101115
<PackageRID>android.21-$(TargetArchitecture)</PackageRID>
@@ -159,6 +173,12 @@
159173
<ItemGroup Condition="$(SupportedPackageOSGroups.Contains(';FreeBSD;'))">
160174
<OfficialBuildRID Include="freebsd-x64" />
161175
</ItemGroup>
176+
<ItemGroup Condition="$(SupportedPackageOSGroups.Contains(';NetBSD;'))">
177+
<OfficialBuildRID Include="netbsd-x64" />
178+
</ItemGroup>
179+
<ItemGroup Condition="$(SupportedPackageOSGroups.Contains(';SunOS;'))">
180+
<OfficialBuildRID Include="sunos-x64" />
181+
</ItemGroup>
162182
<ItemGroup Condition="$(SupportedPackageOSGroups.Contains(';Windows_NT;'))">
163183
<OfficialBuildRID Include="win-x86">
164184
<Platform>x86</Platform>

0 commit comments

Comments
 (0)