Auto sync2gitlab import of dotnet6.0-6.0.0-0.6.28be3e9a006d90d8c6e87d4353b77882829df718.el8.src.rpm

This commit is contained in:
James Antill 2022-05-26 06:43:44 -04:00
parent 1064b487cd
commit 6936c52062
27 changed files with 2429 additions and 1 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/dotnet-28be3e9a006d90d8c6e87d4353b77882829df718-x64-bootstrap.tar.xz
/dotnet-arm64-prebuilts-2021-10-04.tar.gz
/dotnet-s390x-prebuilts-2021-10-01.tar.gz

1
EMPTY
View File

@ -1 +0,0 @@

36
arcade-no-apphost.patch Normal file
View File

@ -0,0 +1,36 @@
Index: a/src/Microsoft.DotNet.GitSync.CommitManager/Microsoft.DotNet.GitSync.CommitManager.csproj
===================================================================
--- a/src/Microsoft.DotNet.GitSync.CommitManager/Microsoft.DotNet.GitSync.CommitManager.csproj
+++ b/src/Microsoft.DotNet.GitSync.CommitManager/Microsoft.DotNet.GitSync.CommitManager.csproj
@@ -5,6 +5,7 @@
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>latest</LangVersion>
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
+ <UseAppHost>false</UseAppHost>
</PropertyGroup>
<ItemGroup>
Index: a/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CmdLine/Microsoft.DotNet.SwaggerGenerator.CmdLine.csproj
===================================================================
--- a/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CmdLine/Microsoft.DotNet.SwaggerGenerator.CmdLine.csproj
+++ b/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CmdLine/Microsoft.DotNet.SwaggerGenerator.CmdLine.csproj
@@ -9,6 +9,7 @@
<ToolCommandName>dotnet-swaggergen</ToolCommandName>
<SignAssembly>false</SignAssembly>
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
+ <UseAppHost>false</UseAppHost>
</PropertyGroup>
<ItemGroup>
Index: a/src/Microsoft.DotNet.XUnitConsoleRunner/src/Microsoft.DotNet.XUnitConsoleRunner.csproj
===================================================================
--- a/src/Microsoft.DotNet.XUnitConsoleRunner/src/Microsoft.DotNet.XUnitConsoleRunner.csproj
+++ b/src/Microsoft.DotNet.XUnitConsoleRunner/src/Microsoft.DotNet.XUnitConsoleRunner.csproj
@@ -11,6 +11,7 @@
<VersionPrefix>2.5.1</VersionPrefix>
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
<RollForward>Major</RollForward>
+ <UseAppHost>false</UseAppHost>
</PropertyGroup>
<ItemGroup>

View File

@ -0,0 +1,12 @@
diff --git a/eng/Dependencies.props b/eng/Dependencies.props
index 8a50fb9f21..a13b74fb51 100644
--- a/eng/Dependencies.props
+++ b/eng/Dependencies.props
@@ -99,6 +99,7 @@ and are generated based on the last package release.
<LatestPackageReference Include="Microsoft.NETCore.App.Crossgen2.osx-arm64" />
<LatestPackageReference Include="Microsoft.NETCore.App.Crossgen2.linux-musl-x64" />
<LatestPackageReference Include="Microsoft.NETCore.App.Crossgen2.linux-x64" />
+ <LatestPackageReference Include="Microsoft.NETCore.App.Crossgen2.linux-arm64" />
<LatestPackageReference Include="Microsoft.NETCore.App.Crossgen2.win-x64" />
<LatestPackageReference Include="Microsoft.NETCore.App.Crossgen2.win-arm64" />
</ItemGroup>

View File

@ -0,0 +1,11 @@
--- a/eng/SourceBuild.props
+++ b/eng/SourceBuild.props
@@ -69,6 +69,8 @@
<PropertyGroup>
<InnerBuildArgs>$(InnerBuildArgs) /p:SourceBuildRuntimeIdentifier=$(TargetRuntimeIdentifier)</InnerBuildArgs>
+ <InnerBuildArgs>$(InnerBuildArgs) /p:CheckEolTargetFramework=false</InnerBuildArgs>
+ <InnerBuildArgs>$(InnerBuildArgs) /p:EnablePreviewFeatures=true</InnerBuildArgs>
</PropertyGroup>
</Target>

View File

@ -0,0 +1,13 @@
Index: source-build-tarball/src/aspnetcore.4ab0cf33ecb1c25a38422f5b11810e4c8a91d8eb/Directory.Build.props
===================================================================
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -48,6 +48,8 @@
<!-- Workaround issue with ComponentsAnalyzer throwing for interfaces -->
<DisableImplicitComponentsAnalyzers>true</DisableImplicitComponentsAnalyzers>
+
+ <UseSharedCompilation>false</UseSharedCompilation>
</PropertyGroup>
<!-- Disable logging of some task parameters or metadata to reduce binlog size.

136
check-debug-symbols.py Executable file
View File

@ -0,0 +1,136 @@
#!/usr/bin/python3
"""
Check debug symbols are present in shared object and can identify
code.
It starts scanning from a directory and recursively scans all ELF
files found in it for various symbols to ensure all debuginfo is
present and nothing has been stripped.
Usage:
./check-debug-symbols /path/of/dir/to/scan/
Example:
./check-debug-symbols /usr/lib64
"""
# This technique was explained to me by Mark Wielaard (mjw).
import collections
import os
import re
import subprocess
import sys
ScanResult = collections.namedtuple('ScanResult',
'file_name debug_info debug_abbrev file_symbols gnu_debuglink')
def scan_file(file):
"Scan the provided file and return a ScanResult containing results of the scan."
# Test for .debug_* sections in the shared object. This is the main test.
# Stripped objects will not contain these.
readelf_S_result = subprocess.run(['eu-readelf', '-S', file],
stdout=subprocess.PIPE, encoding='utf-8', check=True)
has_debug_info = any(line for line in readelf_S_result.stdout.split('\n') if '] .debug_info' in line)
has_debug_abbrev = any(line for line in readelf_S_result.stdout.split('\n') if '] .debug_abbrev' in line)
# Test FILE symbols. These will most likely be removed by anyting that
# manipulates symbol tables because it's generally useless. So a nice test
# that nothing has messed with symbols.
def contains_file_symbols(line):
parts = line.split()
if len(parts) < 8:
return False
return \
parts[2] == '0' and parts[3] == 'FILE' and parts[4] == 'LOCAL' and parts[5] == 'DEFAULT' and \
parts[6] == 'ABS' and re.match(r'((.*/)?[-_a-zA-Z0-9]+\.(c|cc|cpp|cxx))?', parts[7])
readelf_s_result = subprocess.run(["eu-readelf", '-s', file],
stdout=subprocess.PIPE, encoding='utf-8', check=True)
has_file_symbols = any(line for line in readelf_s_result.stdout.split('\n') if contains_file_symbols(line))
# Test that there are no .gnu_debuglink sections pointing to another
# debuginfo file. There shouldn't be any debuginfo files, so the link makes
# no sense either.
has_gnu_debuglink = any(line for line in readelf_s_result.stdout.split('\n') if '] .gnu_debuglink' in line)
return ScanResult(file, has_debug_info, has_debug_abbrev, has_file_symbols, has_gnu_debuglink)
def is_elf(file):
result = subprocess.run(['file', file], stdout=subprocess.PIPE, encoding='utf-8', check=True)
return re.search('ELF 64-bit LSB (?:executable|shared object)', result.stdout)
def scan_file_if_sensible(file):
if is_elf(file):
# print(file)
return scan_file(file)
return None
def scan_dir(dir):
results = []
for root, _, files in os.walk(dir):
for name in files:
result = scan_file_if_sensible(os.path.join(root, name))
if result:
results.append(result)
return results
def scan(file):
file = os.path.abspath(file)
if os.path.isdir(file):
return scan_dir(file)
elif os.path.isfile(file):
return [scan_file_if_sensible(file)]
def is_bad_result(result):
return not result.debug_info or not result.debug_abbrev or not result.file_symbols or result.gnu_debuglink
def print_scan_results(results, verbose):
# print(results)
for result in results:
file_name = result.file_name
found_issue = False
if not result.debug_info:
found_issue = True
print('error: missing .debug_info section in', file_name)
if not result.debug_abbrev:
found_issue = True
print('error: missing .debug_abbrev section in', file_name)
if not result.file_symbols:
found_issue = True
print('error: missing FILE symbols in', file_name)
if result.gnu_debuglink:
found_issue = True
print('error: unexpected .gnu_debuglink section in', file_name)
if verbose and not found_issue:
print('OK: ', file_name)
def main(args):
verbose = False
files = []
for arg in args:
if arg == '--verbose' or arg == '-v':
verbose = True
else:
files.append(arg)
results = []
for file in files:
results.extend(scan(file))
print_scan_results(results, verbose)
if any(is_bad_result(result) for result in results):
return 1
return 0
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))

View File

@ -0,0 +1,27 @@
From 7a752928ed3588246c4b296feb6cf4946f1b29b7 Mon Sep 17 00:00:00 2001
From: Omair Majid <omajid@redhat.com>
Date: Thu, 9 Sep 2021 12:11:39 -0400
Subject: [PATCH] [ArPow] Use --work-tree with git apply
This makes things work better in a source-tarball build, where there may
be a .git directory but it's for a different repo than command-line-api.
---
eng/SourceBuild.props | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/eng/SourceBuild.props b/eng/SourceBuild.props
index 6cc85018..5e223747 100644
--- a/eng/SourceBuild.props
+++ b/eng/SourceBuild.props
@@ -15,7 +15,7 @@
</ItemGroup>
<Exec
- Command="git apply --ignore-whitespace --whitespace=nowarn &quot;%(SourceBuildPatchFile.FullPath)&quot;"
+ Command="git --work-tree=&quot;$(RepoRoot)&quot; apply --ignore-whitespace --whitespace=nowarn &quot;%(SourceBuildPatchFile.FullPath)&quot;"
WorkingDirectory="$(RepoRoot)"
Condition="'@(SourceBuildPatchFile)' != ''" />
</Target>
--
2.31.1

14
dotnet.sh.in Normal file
View File

@ -0,0 +1,14 @@
# Set location for AppHost lookup
[ -z "$DOTNET_ROOT" ] && export DOTNET_ROOT=@LIBDIR@/dotnet
# Add dotnet tools directory to PATH
DOTNET_TOOLS_PATH="$HOME/.dotnet/tools"
case "$PATH" in
*"$DOTNET_TOOLS_PATH"* ) true ;;
* ) PATH="$PATH:$DOTNET_TOOLS_PATH" ;;
esac
# Extract self-contained executables under HOME
# to avoid multi-user issues from using the default '/var/tmp'.
[ -z "$DOTNET_BUNDLE_EXTRACT_BASE_DIR" ] && export DOTNET_BUNDLE_EXTRACT_BASE_DIR="${XDG_CACHE_HOME:-"$HOME"/.cache}/dotnet_bundle_extract"

943
dotnet6.0.spec Normal file
View File

@ -0,0 +1,943 @@
%bcond_without bootstrap
# Avoid provides/requires from private libraries
%global privlibs libhostfxr
%global privlibs %{privlibs}|libclrjit
%global privlibs %{privlibs}|libcoreclr
%global privlibs %{privlibs}|libcoreclrtraceptprovider
%global privlibs %{privlibs}|libdbgshim
%global privlibs %{privlibs}|libhostpolicy
%global privlibs %{privlibs}|libmscordaccore
%global privlibs %{privlibs}|libmscordbi
%global privlibs %{privlibs}|libsos
%global privlibs %{privlibs}|libsosplugin
%global __provides_exclude ^(%{privlibs})\\.so
%global __requires_exclude ^(%{privlibs})\\.so
# LTO triggers a compilation error for a source level issue. Given that LTO should not
# change the validity of any given source and the nature of the error (undefined enum), I
# suspect a generator program is mis-behaving in some way. This needs further debugging,
# until that's done, disable LTO. This has to happen before setting the flags below.
%define _lto_cflags %{nil}
%global host_version 6.0.0-rc.2.21470.23
%global runtime_version 6.0.0-rc.2.21470.23
%global aspnetcore_runtime_version 6.0.0-rc.2.21470.37
%global sdk_version 6.0.100-rc.2.21503.1
%global templates_version 6.0.0-rc.2.21470.37
#%%global templates_version %%(echo %%{runtime_version} | awk 'BEGIN { FS="."; OFS="." } {print $1, $2, $3+1 }')
%global host_rpm_version 6.0.0
%global runtime_rpm_version 6.0.0
%global aspnetcore_runtime_rpm_version %{runtime_rpm_version}
%global sdk_rpm_version 6.0.0
# upstream can update releases without revving the SDK version so these don't always match
#%%global upstream_tag v%%{sdk_version}-SDK
%global upstream_tag 28be3e9a006d90d8c6e87d4353b77882829df718
%if 0%{?fedora} || 0%{?rhel} < 8
%global use_bundled_libunwind 0
%else
%global use_bundled_libunwind 1
%endif
%ifarch aarch64 s390x
%global use_bundled_libunwind 1
%endif
%ifarch x86_64
%global runtime_arch x64
%endif
%ifarch aarch64
%global runtime_arch arm64
%endif
%ifarch s390x
%global runtime_arch s390x
%endif
%{!?runtime_id:%global runtime_id %(. /etc/os-release ; echo "${ID}.${VERSION_ID%%.*}")-%{runtime_arch}}
Name: dotnet6.0
Version: %{sdk_rpm_version}
Release: 0.6.%{upstream_tag}%{?dist}
Summary: .NET Runtime and SDK
License: MIT and ASL 2.0 and BSD and LGPLv2+ and CC-BY and CC0 and MS-PL and EPL-1.0 and GPL+ and GPLv2 and ISC and OFL and zlib
URL: https://github.com/dotnet/
# The source is generated on a Fedora box via:
# ./build-dotnet-tarball --bootstrap %%{upstream_tag}
Source0: dotnet-%{upstream_tag}-x64-bootstrap.tar.xz
Source1: dotnet-arm64-prebuilts-2021-10-04.tar.gz
Source2: dotnet-s390x-prebuilts-2021-10-01.tar.gz
Source10: check-debug-symbols.py
Source11: dotnet.sh.in
# Implement cgroup support in mono
Patch100: runtime-mono-memfunc-cgroup.patch
# https://github.com/dotnet/runtime/pull/59422
Patch101: runtime-bigendian-ilasm-pdb.patch
# Workaround bug on s390x
Patch102: runtime-no-shared-compilation.patch
# Fix using lld on RHEL
Patch103: runtime-arm64-lld-fix.patch
# https://github.com/NuGet/NuGet.Client/pull/4254
Patch200: nuget-client-use-work-tree-with-git-apply.patch
# https://github.com/dotnet/command-line-api/pull/1401
Patch300: command-line-api-use-work-tree-with-git-apply.patch
# https://github.com/microsoft/vstest/pull/3046
Patch400: vstest-use-work-tree-with-git-apply.patch
# This is the suggestion from https://github.com/dotnet/source-build/pull/2450, applied
Patch500: fsharp-use-work-tree-with-git-apply.patch
# Disable apphost, needed for s390x
Patch501: fsharp-no-apphost.patch
Patch502: fsharp-no-shared-compilation.patch
# This is the suggestion from https://github.com/dotnet/source-build/pull/2450, applied
Patch600: xliff-tasks-use-work-tree-with-git-apply.patch
# Disable apphost, needed for s390x
Patch700: arcade-no-apphost.patch
# Disable apphost, needed for s390x
Patch800: roslyn-no-apphost.patch
Patch801: roslyn-no-shared-compilation.patch
# Disable apphost, needed for s390x
Patch900: roslyn-analyzers-no-apphost.patch
# Don't fail on netcoreapp2.1 TFMS
Patch1000: aspnetcore-dont-check-eol-targets.patch
Patch1001: aspnetcore-no-shared-compilation.patch
Patch1002: aspnetcore-add-arm64-crossgen-dependencies.patch
Patch1100: source-build-reference-packages-no-shared-compilation.patch
# Disable telemetry by default; make it opt-in
Patch1500: sdk-telemetry-optout.patch
# Work around roslyn bug: https://github.com/dotnet/source-build/issues/2483
Patch1501: sdk-enable-preview.patch
%if 0%{?fedora} || 0%{?rhel} >= 8
ExclusiveArch: aarch64 x86_64 s390x
%else
ExclusiveArch: x86_64
%endif
BuildRequires: clang
BuildRequires: cmake
BuildRequires: coreutils
%if %{without bootstrap}
BuildRequires: dotnet-sdk-6.0-build-reference-packages
BuildRequires: dotnet-sdk-6.0
BuildRequires: dotnet-sdk-6.0-source-built-artifacts
%endif
BuildRequires: findutils
BuildRequires: git
%if 0%{?fedora} || 0%{?rhel} > 7
BuildRequires: glibc-langpack-en
%endif
BuildRequires: hostname
BuildRequires: krb5-devel
BuildRequires: libicu-devel
%if ! %{use_bundled_libunwind}
BuildRequires: libunwind-devel
%endif
%ifarch aarch64
BuildRequires: lld
%endif
BuildRequires: llvm
BuildRequires: lttng-ust-devel
BuildRequires: make
BuildRequires: openssl-devel
BuildRequires: python3
BuildRequires: tar
BuildRequires: util-linux
BuildRequires: zlib-devel
%description
.NET is a fast, lightweight and modular platform for creating
cross platform applications that work on Linux, macOS and Windows.
It particularly focuses on creating console applications, web
applications and micro-services.
.NET contains a runtime conforming to .NET Standards a set of
framework libraries, an SDK containing compilers and a 'dotnet'
application to drive everything.
%package -n dotnet
Version: %{sdk_rpm_version}
Summary: .NET CLI tools and runtime
Requires: dotnet-sdk-6.0%{?_isa} >= %{sdk_rpm_version}-%{release}
%description -n dotnet
.NET is a fast, lightweight and modular platform for creating
cross platform applications that work on Linux, macOS and Windows.
It particularly focuses on creating console applications, web
applications and micro-services.
.NET contains a runtime conforming to .NET Standards a set of
framework libraries, an SDK containing compilers and a 'dotnet'
application to drive everything.
%package -n dotnet-host
Version: %{host_rpm_version}
Summary: .NET command line launcher
%description -n dotnet-host
The .NET host is a command line program that runs a standalone
.NET application or launches the SDK.
.NET is a fast, lightweight and modular platform for creating
cross platform applications that work on Linux, Mac and Windows.
It particularly focuses on creating console applications, web
applications and micro-services.
%package -n dotnet-hostfxr-6.0
Version: %{host_rpm_version}
Summary: .NET command line host resolver
# Theoretically any version of the host should work. But lets aim for the one
# provided by this package, or from a newer version of .NET
Requires: dotnet-host%{?_isa} >= %{host_rpm_version}-%{release}
%description -n dotnet-hostfxr-6.0
The .NET host resolver contains the logic to resolve and select
the right version of the .NET SDK or runtime to use.
.NET is a fast, lightweight and modular platform for creating
cross platform applications that work on Linux, Mac and Windows.
It particularly focuses on creating console applications, web
applications and micro-services.
%package -n dotnet-runtime-6.0
Version: %{runtime_rpm_version}
Summary: NET 6.0 runtime
Requires: dotnet-hostfxr-6.0%{?_isa} >= %{host_rpm_version}-%{release}
# libicu is dlopen()ed
Requires: libicu%{?_isa}
%if %{use_bundled_libunwind}
# See runtime.*/src/coreclr/pal/src/libunwind/libunwind-version.txt
Provides: bundled(libunwind) = 1.5.rc1.28.g9165d2a1
%endif
%description -n dotnet-runtime-6.0
The .NET runtime contains everything needed to run .NET applications.
It includes a high performance Virtual Machine as well as the framework
libraries used by .NET applications.
.NET is a fast, lightweight and modular platform for creating
cross platform applications that work on Linux, Mac and Windows.
It particularly focuses on creating console applications, web
applications and micro-services.
%package -n aspnetcore-runtime-6.0
Version: %{aspnetcore_runtime_rpm_version}
Summary: ASP.NET Core 6.0 runtime
Requires: dotnet-runtime-6.0%{?_isa} >= %{runtime_rpm_version}-%{release}
%description -n aspnetcore-runtime-6.0
The ASP.NET Core runtime contains everything needed to run .NET
web applications. It includes a high performance Virtual Machine as
well as the framework libraries used by .NET applications.
ASP.NET Core is a fast, lightweight and modular platform for creating
cross platform web applications that work on Linux, Mac and Windows.
It particularly focuses on creating console applications, web
applications and micro-services.
%package -n dotnet-templates-6.0
Version: %{sdk_rpm_version}
Summary: .NET 6.0 templates
# Theoretically any version of the host should work. But lets aim for the one
# provided by this package, or from a newer version of .NET
Requires: dotnet-host%{?_isa} >= %{host_rpm_version}-%{release}
%description -n dotnet-templates-6.0
This package contains templates used by the .NET SDK.
.NET is a fast, lightweight and modular platform for creating
cross platform applications that work on Linux, Mac and Windows.
It particularly focuses on creating console applications, web
applications and micro-services.
%package -n dotnet-sdk-6.0
Version: %{sdk_rpm_version}
Summary: .NET 6.0 Software Development Kit
Provides: bundled(js-jquery)
Requires: dotnet-runtime-6.0%{?_isa} >= %{runtime_rpm_version}-%{release}
Requires: aspnetcore-runtime-6.0%{?_isa} >= %{aspnetcore_runtime_rpm_version}-%{release}
Requires: dotnet-apphost-pack-6.0%{?_isa} >= %{runtime_rpm_version}-%{release}
Requires: dotnet-targeting-pack-6.0%{?_isa} >= %{runtime_rpm_version}-%{release}
Requires: aspnetcore-targeting-pack-6.0%{?_isa} >= %{aspnetcore_runtime_rpm_version}-%{release}
Requires: netstandard-targeting-pack-2.1%{?_isa} >= %{sdk_rpm_version}-%{release}
Requires: dotnet-templates-6.0%{?_isa} >= %{sdk_rpm_version}-%{release}
%description -n dotnet-sdk-6.0
The .NET SDK is a collection of command line applications to
create, build, publish and run .NET applications.
.NET is a fast, lightweight and modular platform for creating
cross platform applications that work on Linux, Mac and Windows.
It particularly focuses on creating console applications, web
applications and micro-services.
%global dotnet_targeting_pack() %{expand:
%package -n %{1}
Version: %{2}
Summary: Targeting Pack for %{3} %{4}
Requires: dotnet-host%{?_isa}
%description -n %{1}
This package provides a targeting pack for %{3} %{4}
that allows developers to compile against and target %{3} %{4}
applications using the .NET SDK.
%files -n %{1}
%dir %{_libdir}/dotnet/packs
%{_libdir}/dotnet/packs/%{5}
}
%dotnet_targeting_pack dotnet-apphost-pack-6.0 %{runtime_rpm_version} Microsoft.NETCore.App 6.0 Microsoft.NETCore.App.Host.%{runtime_id}
%dotnet_targeting_pack dotnet-targeting-pack-6.0 %{runtime_rpm_version} Microsoft.NETCore.App 6.0 Microsoft.NETCore.App.Ref
%dotnet_targeting_pack aspnetcore-targeting-pack-6.0 %{aspnetcore_runtime_rpm_version} Microsoft.AspNetCore.App 6.0 Microsoft.AspNetCore.App.Ref
%dotnet_targeting_pack netstandard-targeting-pack-2.1 %{sdk_rpm_version} NETStandard.Library 2.1 NETStandard.Library.Ref
%package -n dotnet-sdk-6.0-source-built-artifacts
Version: %{sdk_rpm_version}
Summary: Internal package for building .NET 6.0 Software Development Kit
%description -n dotnet-sdk-6.0-source-built-artifacts
The .NET source-built archive is a collection of packages needed
to build the .NET SDK itself.
These are not meant for general use.
%prep
%if %{without bootstrap}
%setup -q -n dotnet-%{upstream_tag}
%else
%setup -q -T -b 0 -n dotnet-%{upstream_tag}-x64-bootstrap
%ifnarch x86_64
rm -rf .dotnet
%ifarch aarch64
tar -x --strip-components=1 -f %{SOURCE1} -C packages/prebuilt
%endif
%ifarch s390x
tar -x --strip-components=1 -f %{SOURCE2} -C packages/prebuilt
%endif
mkdir -p .dotnet
tar xf packages/prebuilt/dotnet-sdk*.tar.gz -C .dotnet/
rm packages/prebuilt/dotnet-sdk*.tar.gz
boot_sdk_version=$(ls -1 .dotnet/sdk/)
sed -i -E 's|"dotnet": "[^"]+"|"dotnet" : "'$boot_sdk_version'"|' global.json
%endif
%endif
%if %{without bootstrap}
# Remove all prebuilts
find -iname '*.dll' -type f -delete
find -iname '*.so' -type f -delete
find -iname '*.tar.gz' -type f -delete
find -iname '*.nupkg' -type f -delete
find -iname '*.zip' -type f -delete
rm -rf .dotnet/
rm -rf packages/source-built
mkdir -p packages/archive
ln -s %{_libdir}/dotnet/source-built-artifacts/Private.SourceBuilt.Artifacts.*.tar.gz packages/archive/
ln -s %{_libdir}/dotnet/reference-packages/Private.SourceBuild.ReferencePackages*.tar.gz packages/archive/
%endif
# Fix bad hardcoded path in build
sed -i 's|/usr/share/dotnet|%{_libdir}/dotnet|' src/runtime.*/src/native/corehost/hostmisc/pal.unix.cpp
# Disable warnings
# sed -i 's|skiptests|skiptests ignorewarnings|' repos/runtime.common.props
pushd src/runtime.*
%patch100 -p1
%patch101 -p1
%patch102 -p1
%patch103 -p1
popd
pushd src/nuget-client.*
%patch200 -p1
popd
pushd src/command-line-api.*
%patch300 -p1
popd
pushd src/vstest.*
%patch400 -p1
popd
pushd src/fsharp.*
%patch500 -p1
%patch501 -p1
%patch502 -p1
popd
pushd src/xliff-tasks.*
%patch600 -p1
popd
pushd src/arcade.*
%patch700 -p1
popd
pushd src/roslyn.*
%patch800 -p1
%patch801 -p1
popd
pushd src/roslyn-analyzers.*
%patch900 -p1
popd
pushd src/aspnetcore.*
%patch1000 -p1
%patch1001 -p1
%patch1002 -p1
popd
pushd src/source-build-reference-packages.*
%patch1100 -p1
popd
pushd src/sdk.*
%patch1500 -p1
%patch1501 -p1
popd
%if %{without bootstrap}
%ifnarch x86_64
mkdir -p artifacts/obj/%{runtime_arch}/Release
cp artifacts/obj/x64/Release/PackageVersions.props artifacts/obj/%{runtime_arch}/Release/PackageVersions.props
%endif
%endif
# Disable package validation which breaks our build, even though we
# are injecting "blessed" nuget packages produced by Microsoft.
# There's no need to run validation in RPM packages anyway.
sed -i -E 's|( /p:BuildDebPackage=false)|\1 /p:EnablePackageValidation=false|' src/runtime.*/eng/SourceBuild.props
sed -i -E 's|( /p:BuildDebPackage=false)|\1 /p:EnablePackageValidation=false|' src/runtime.*/eng/SourceBuild.props
%if ! %{use_bundled_libunwind}
sed -i -E 's|( /p:BuildDebPackage=false)|\1 --cmakeargs -DCLR_CMAKE_USE_SYSTEM_LIBUNWIND=TRUE|' src/runtime.*/eng/SourceBuild.props
%endif
%build
cat /etc/os-release
%if %{without bootstrap}
# We need to create a copy because we will mutate this
cp -a %{_libdir}/dotnet previously-built-dotnet
%endif
%if 0%{?fedora} > 32 || 0%{?rhel} > 8
# Setting this macro ensures that only clang supported options will be
# added to ldflags and cflags.
%global toolchain clang
%set_build_flags
%else
# Filter flags not supported by clang
%global dotnet_cflags %(echo %optflags | sed -re 's/-specs=[^ ]*//g')
%global dotnet_ldflags %(echo %{__global_ldflags} | sed -re 's/-specs=[^ ]*//g')
export CFLAGS="%{dotnet_cflags}"
export CXXFLAGS="%{dotnet_cflags}"
export LDFLAGS="%{dotnet_ldflags}"
%endif
%ifarch aarch64
# -mbranch-protection=standard breaks unwinding in CoreCLR through libunwind
CFLAGS=$(echo $CFLAGS | sed -e 's/-mbranch-protection=standard //')
CXXFLAGS=$(echo $CXXFLAGS | sed -e 's/-mbranch-protection=standard //')
%endif
# -fstack-clash-protection breaks CoreCLR
CFLAGS=$(echo $CFLAGS | sed -e 's/-fstack-clash-protection//' )
CXXFLAGS=$(echo $CXXFLAGS | sed -e 's/-fstack-clash-protection//' )
export EXTRA_CFLAGS="$CFLAGS"
export EXTRA_CXXFLAGS="$CXXFLAGS"
export EXTRA_LDFLAGS="$LDFLAGS"
unset CFLAGS
unset CXXFLAGS
unset LDFLAGS
VERBOSE=1 ./build.sh \
%if %{without bootstrap}
--with-sdk previously-built-dotnet \
%endif
-- \
echo \
/v:n \
/p:SkipPortableRuntimeBuild=true \
/p:LogVerbosity=n \
/p:MinimalConsoleLogOutput=false \
/p:ContinueOnPrebuiltBaselineError=true \
sed -e 's|[@]LIBDIR[@]|%{_libdir}|g' %{SOURCE11} > dotnet.sh
%install
install -dm 0755 %{buildroot}%{_libdir}/dotnet
ls artifacts/%{runtime_arch}/Release
tar xf artifacts/%{runtime_arch}/Release/dotnet-sdk-%{sdk_version}-%{runtime_id}.tar.gz -C %{buildroot}%{_libdir}/dotnet/
# FIXME: no managed symbols in 6.0?
# Install managed symbols
#tar xf artifacts/%%{runtime_arch}/Release/runtime/dotnet-runtime-symbols-%%{runtime_version}-%%{runtime_id}.tar.gz \
# -C %%{buildroot}/%%{_libdir}/dotnet/shared/Microsoft.NETCore.App/%%{runtime_version}/
# Fix executable permissions on files
find %{buildroot}%{_libdir}/dotnet/ -type f -name 'apphost' -exec chmod +x {} \;
find %{buildroot}%{_libdir}/dotnet/ -type f -name 'singlefilehost' -exec chmod +x {} \;
find %{buildroot}%{_libdir}/dotnet/ -type f -name 'lib*so' -exec chmod +x {} \;
find %{buildroot}%{_libdir}/dotnet/ -type f -name '*.a' -exec chmod -x {} \;
find %{buildroot}%{_libdir}/dotnet/ -type f -name '*.dll' -exec chmod -x {} \;
find %{buildroot}%{_libdir}/dotnet/ -type f -name '*.h' -exec chmod 0644 {} \;
find %{buildroot}%{_libdir}/dotnet/ -type f -name '*.json' -exec chmod -x {} \;
find %{buildroot}%{_libdir}/dotnet/ -type f -name '*.pdb' -exec chmod -x {} \;
find %{buildroot}%{_libdir}/dotnet/ -type f -name '*.props' -exec chmod -x {} \;
find %{buildroot}%{_libdir}/dotnet/ -type f -name '*.pubxml' -exec chmod -x {} \;
find %{buildroot}%{_libdir}/dotnet/ -type f -name '*.targets' -exec chmod -x {} \;
find %{buildroot}%{_libdir}/dotnet/ -type f -name '*.txt' -exec chmod -x {} \;
find %{buildroot}%{_libdir}/dotnet/ -type f -name '*.xml' -exec chmod -x {} \;
install -dm 0755 %{buildroot}%{_sysconfdir}/profile.d/
install dotnet.sh %{buildroot}%{_sysconfdir}/profile.d/
install -dm 0755 %{buildroot}/%{_datadir}/bash-completion/completions
# dynamic completion needs the file to be named the same as the base command
install src/sdk.*/scripts/register-completions.bash %{buildroot}/%{_datadir}/bash-completion/completions/dotnet
# TODO: the zsh completion script needs to be ported to use #compdef
#install -dm 755 %%{buildroot}/%%{_datadir}/zsh/site-functions
#install src/cli/scripts/register-completions.zsh %%{buildroot}/%%{_datadir}/zsh/site-functions/_dotnet
install -dm 0755 %{buildroot}%{_bindir}
ln -s ../../%{_libdir}/dotnet/dotnet %{buildroot}%{_bindir}/
install -dm 0755 %{buildroot}%{_mandir}/man1/
find -iname 'dotnet*.1' -type f -exec cp {} %{buildroot}%{_mandir}/man1/ \;
install -dm 0755 %{buildroot}%{_sysconfdir}/dotnet
echo "%{_libdir}/dotnet" >> install_location
install install_location %{buildroot}%{_sysconfdir}/dotnet/
echo "%{_libdir}/dotnet" >> install_location_%{runtime_arch}
install install_location_%{runtime_arch} %{buildroot}%{_sysconfdir}/dotnet/
install -dm 0755 %{buildroot}%{_libdir}/dotnet/source-built-artifacts
install -m 0644 artifacts/%{runtime_arch}/Release/Private.SourceBuilt.Artifacts.*.tar.gz %{buildroot}/%{_libdir}/dotnet/source-built-artifacts/
# Check debug symbols in all elf objects. This is not in %%check
# because native binaries are stripped by rpm-build after %%install.
# So we need to do this check earlier.
# FIXME
#echo "Testing build results for debug symbols..."
#%%{SOURCE10} -v %%{buildroot}%%{_libdir}/dotnet/
%check
%{buildroot}%{_libdir}/dotnet/dotnet --info
%files -n dotnet
# empty package useful for dependencies
%files -n dotnet-host
%dir %{_libdir}/dotnet
%{_libdir}/dotnet/dotnet
%dir %{_libdir}/dotnet/host
%dir %{_libdir}/dotnet/host/fxr
%{_bindir}/dotnet
%license %{_libdir}/dotnet/LICENSE.txt
%license %{_libdir}/dotnet/ThirdPartyNotices.txt
%doc %{_mandir}/man1/dotnet*.1.gz
%config(noreplace) %{_sysconfdir}/profile.d/dotnet.sh
%config(noreplace) %{_sysconfdir}/dotnet
%dir %{_datadir}/bash-completion
%dir %{_datadir}/bash-completion/completions
%{_datadir}/bash-completion/completions/dotnet
%files -n dotnet-hostfxr-6.0
%dir %{_libdir}/dotnet/host/fxr
%{_libdir}/dotnet/host/fxr/%{host_version}
%files -n dotnet-runtime-6.0
%dir %{_libdir}/dotnet/shared
%dir %{_libdir}/dotnet/shared/Microsoft.NETCore.App
%{_libdir}/dotnet/shared/Microsoft.NETCore.App/%{runtime_version}
%files -n aspnetcore-runtime-6.0
%dir %{_libdir}/dotnet/shared
%dir %{_libdir}/dotnet/shared/Microsoft.AspNetCore.App
%{_libdir}/dotnet/shared/Microsoft.AspNetCore.App/%{aspnetcore_runtime_version}
%files -n dotnet-templates-6.0
%dir %{_libdir}/dotnet/templates
%{_libdir}/dotnet/templates/%{templates_version}
%files -n dotnet-sdk-6.0
%dir %{_libdir}/dotnet/sdk
%{_libdir}/dotnet/sdk/%{sdk_version}
%dir %{_libdir}/dotnet/sdk-manifests
# FIXME hardcoded version?
%{_libdir}/dotnet/sdk-manifests/6.0.100
%{_libdir}/dotnet/metadata
%dir %{_libdir}/dotnet/packs
%files -n dotnet-sdk-6.0-source-built-artifacts
%dir %{_libdir}/dotnet
%{_libdir}/dotnet/source-built-artifacts
%changelog
* Fri Oct 08 2021 Omair Majid <omajid@redhat.com> - 6.0.0-0.6.28be3e9a006d90d8c6e87d4353b77882829df718
- Enable building on arm64
- Related: RHBZ#1986017
* Sun Oct 03 2021 Omair Majid <omajid@redhat.com> - 6.0.0-0.5.28be3e9a006d90d8c6e87d4353b77882829df718
- Enable building on s390x
- Related: RHBZ#1986017
* Sun Oct 03 2021 Omair Majid <omajid@redhat.com> - 6.0.0-0.4.28be3e9a006d90d8c6e87d4353b77882829df718
- Clean up tarball and add initial support for s390x
- Related: RHBZ#1986017
* Sun Sep 26 2021 Omair Majid <omajid@redhat.com> - 6.0.0-0.3.28be3e9a006d90d8c6e87d4353b77882829df718
- Update to work-in-progress RC2 release
* Wed Aug 25 2021 Omair Majid <omajid@redhat.com> - 6.0.0-0.2.preview6
- Updated to build the latest source-build preview
* Fri Jul 23 2021 Omair Majid <omajid@redhat.com> - 6.0.0-0.1.preview6
- Initial package for .NET 6
* Thu Jun 10 2021 Omair Majid <omajid@redhat.com> - 5.0.204-1
- Update to .NET SDK 5.0.204 and Runtime 5.0.7
* Wed May 12 2021 Omair Majid <omajid@redhat.com> - 5.0.203-1
- Update to .NET SDK 5.0.203 and Runtime 5.0.6
* Wed Apr 14 2021 Omair Majid <omajid@redhat.com> - 5.0.202-1
- Update to .NET SDK 5.0.202 and Runtime 5.0.5
* Tue Apr 06 2021 Omair Majid <omajid@redhat.com> - 5.0.104-2
- Mark files under /etc/ as config(noreplace)
- Add an rpm-inspect configuration file
- Add an rpmlintrc file
- Enable gating for release branches and ELN too
* Tue Mar 16 2021 Omair Majid <omajid@redhat.com> - 5.0.104-1
- Update to .NET SDK 5.0.104 and Runtime 5.0.4
- Drop unneeded/upstreamed patches
* Wed Feb 17 2021 Omair Majid <omajid@redhat.com> - 5.0.103-2
- Add Fedora 35 RIDs
* Thu Feb 11 2021 Omair Majid <omajid@redhat.com> - 5.0.103-1
- Update to .NET SDK 5.0.103 and Runtime 5.0.3
* Fri Jan 29 2021 Omair Majid <omajid@redhat.com> - 5.0.102-2
- Disable bootstrap
* Fri Dec 18 2020 Omair Majid <omajid@redhat.com> - 5.0.100-2
- Update to .NET Core Runtime 5.0.0 and SDK 5.0.100 commit 9c4e5de
* Fri Dec 04 2020 Omair Majid <omajid@redhat.com> - 5.0.100-1
- Update to .NET Core Runtime 5.0.0 and SDK 5.0.100
* Thu Dec 03 2020 Omair Majid <omajid@redhat.com> - 5.0.100-0.4.20201202git337413b
- Update to latest 5.0 pre-GA commit
* Tue Nov 24 2020 Omair Majid <omajid@redhat.com> - 5.0.100-0.4.20201123gitdee899c
- Update to 5.0 pre-GA commit
* Mon Sep 14 2020 Omair Majid <omajid@redhat.com> - 5.0.100-0.3.preview8
- Update to Preview 8
* Fri Jul 10 2020 Omair Majid <omajid@redhat.com> - 5.0.100-0.2.preview4
- Fix building with custom CFLAGS/CXXFLAGS/LDFLAGS
- Clean up patches
* Mon Jul 06 2020 Omair Majid <omajid@redhat.com> - 5.0.100-0.1.preview4
- Initial build
* Sat Jun 27 2020 Omair Majid <omajid@redhat.com> - 3.1.105-4
- Disable bootstrap
* Fri Jun 26 2020 Omair Majid <omajid@redhat.com> - 3.1.105-3
- Re-bootstrap aarch64
* Fri Jun 19 2020 Omair Majid <omajid@redhat.com> - 3.1.105-3
- Disable bootstrap
* Thu Jun 18 2020 Omair Majid <omajid@redhat.com> - 3.1.105-1
- Bootstrap aarch64
* Tue Jun 16 2020 Chris Rummel <crummel@microsoft.com> - 3.1.105-1
- Update to .NET Core Runtime 3.1.5 and SDK 3.1.105
* Fri Jun 05 2020 Chris Rummel <crummel@microsoft.com> - 3.1.104-1
- Update to .NET Core Runtime 3.1.4 and SDK 3.1.104
* Thu Apr 09 2020 Chris Rummel <crummel@microsoft.com> - 3.1.103-1
- Update to .NET Core Runtime 3.1.3 and SDK 3.1.103
* Mon Mar 16 2020 Omair Majid <omajid@redhat.com> - 3.1.102-1
- Update to .NET Core Runtime 3.1.2 and SDK 3.1.102
* Fri Feb 28 2020 Omair Majid <omajid@redhat.com> - 3.1.101-4
- Disable bootstrap
* Fri Feb 28 2020 Omair Majid <omajid@redhat.com> - 3.1.101-3
- Enable bootstrap
- Add Fedora 33 runtime ids
* Thu Feb 27 2020 Omair Majid <omajid@redhat.com> - 3.1.101-2
- Disable bootstrap
* Tue Jan 21 2020 Omair Majid <omajid@redhat.com> - 3.1.101-1
- Update to .NET Core Runtime 3.1.1 and SDK 3.1.101
* Thu Dec 05 2019 Omair Majid <omajid@redhat.com> - 3.1.100-1
- Update to .NET Core Runtime 3.1.0 and SDK 3.1.100
* Mon Nov 18 2019 Omair Majid <omajid@redhat.com> - 3.1.100-0.4.preview3
- Fix apphost permissions
* Fri Nov 15 2019 Omair Majid <omajid@redhat.com> - 3.1.100-0.3.preview3
- Update to .NET Core Runtime 3.1.0-preview3.19553.2 and SDK
3.1.100-preview3-014645
* Wed Nov 06 2019 Omair Majid <omajid@redhat.com> - 3.1.100-0.2
- Update to .NET Core 3.1 Preview 2
* Wed Oct 30 2019 Omair Majid <omajid@redhat.com> - 3.1.100-0.1
- Update to .NET Core 3.1 Preview 1
* Thu Oct 24 2019 Omair Majid <omajid@redhat.com> - 3.0.100-5
- Add cgroupv2 support to .NET Core
* Wed Oct 16 2019 Omair Majid <omajid@redhat.com> - 3.0.100-4
- Include fix from coreclr for building on Fedora 32
* Wed Oct 16 2019 Omair Majid <omajid@redhat.com> - 3.0.100-3
- Harden built binaries to pass annocheck
* Fri Oct 11 2019 Omair Majid <omajid@redhat.com> - 3.0.100-2
- Export DOTNET_ROOT in profile to make apphost lookup work
* Fri Sep 27 2019 Omair Majid <omajid@redhat.com> - 3.0.100-1
- Update to .NET Core Runtime 3.0.0 and SDK 3.0.100
* Wed Sep 25 2019 Omair Majid <omajid@redhat.com> - 3.0.100-0.18.rc1
- Update to .NET Core Runtime 3.0.0-rc1-19456-20 and SDK 3.0.100-rc1-014190
* Tue Sep 17 2019 Omair Majid <omajid@redhat.com> - 3.0.100-0.16.preview9
- Fix files duplicated between dotnet-apphost-pack-3.0 and dotnet-targeting-pack-3.0
- Fix dependencies between .NET SDK and the targeting packs
* Mon Sep 16 2019 Omair Majid <omajid@redhat.com> - 3.0.100-0.15.preview9
- Update to .NET Core Runtime 3.0.0-preview 9 and SDK 3.0.100-preview9
* Mon Aug 19 2019 Omair Majid <omajid@redhat.com> - 3.0.100-0.11.preview8
- Update to .NET Core Runtime 3.0.0-preview8-28405-07 and SDK
3.0.100-preview8-013656
* Tue Jul 30 2019 Omair Majid <omajid@redhat.com> - 3.0.100-0.9.preview7
- Update to .NET Core Runtime 3.0.0-preview7-27912-14 and SDK
3.0.100-preview7-012821
* Fri Jul 26 2019 Omair Majid <omajid@redhat.com> - 3.0.100-0.8.preview7
- Update to .NET Core Runtime 3.0.0-preview7-27902-19 and SDK
3.0.100-preview7-012802
* Wed Jun 26 2019 Omair Majid <omajid@redhat.com> - 3.0.0-0.7.preview6
- Obsolete dotnet-sdk-3.0.1xx
- Add supackages for targeting packs
- Add -fcf-protection to CFLAGS
* Wed Jun 26 2019 Omair Majid <omajid@redhat.com> - 3.0.0-0.6.preview6
- Update to .NET Core Runtime 3.0.0-preview6-27804-01 and SDK 3.0.100-preview6-012264
- Set dotnet installation location in /etc/dotnet/install_location
- Update targeting packs
- Install managed symbols
- Completely conditionalize libunwind bundling
* Tue May 07 2019 Omair Majid <omajid@redhat.com> - 3.0.0-0.3.preview4
- Update to .NET Core 3.0 preview 4
* Tue Dec 18 2018 Omair Majid <omajid@redhat.com> - 3.0.0-0.1.preview1
- Update to .NET Core 3.0 preview 1
* Fri Dec 07 2018 Omair Majid <omajid@redhat.com> - 2.2.100
- Update to .NET Core 2.2.0
* Wed Nov 07 2018 Omair Majid <omajid@redhat.com> - 2.2.100-0.2.preview3
- Update to .NET Core 2.2.0-preview3
* Fri Nov 02 2018 Omair Majid <omajid@redhat.com> - 2.1.403-3
- Add host-fxr-2.1 subpackage
* Mon Oct 15 2018 Omair Majid <omajid@redhat.com> - 2.1.403-2
- Disable telemetry by default
- Users have to manually export DOTNET_CLI_TELEMETRY_OPTOUT=0 to enable
* Tue Oct 02 2018 Omair Majid <omajid@redhat.com> - 2.1.403-1
- Update to .NET Core Runtime 2.1.5 and SDK 2.1.403
* Wed Sep 26 2018 Omair Majid <omajid@redhat.com> - 2.1.402-2
- Add ~/.dotnet/tools to $PATH to make it easier to use dotnet tools
* Thu Sep 13 2018 Omair Majid <omajid@redhat.com> - 2.1.402-1
- Update to .NET Core Runtime 2.1.4 and SDK 2.1.402
* Wed Sep 05 2018 Omair Majid <omajid@redhat.com> - 2.1.401-2
- Use distro-standard flags when building .NET Core
* Tue Aug 21 2018 Omair Majid <omajid@redhat.com> - 2.1.401-1
- Update to .NET Core Runtime 2.1.3 and SDK 2.1.401
* Mon Aug 20 2018 Omair Majid <omajid@redhat.com> - 2.1.302-1
- Update to .NET Core Runtime 2.1.2 and SDK 2.1.302
* Fri Jul 20 2018 Omair Majid <omajid@redhat.com> - 2.1.301-1
- Update to .NET Core 2.1
* Thu May 03 2018 Omair Majid <omajid@redhat.com> - 2.0.7-1
- Update to .NET Core 2.0.7
* Wed Mar 28 2018 Omair Majid <omajid@redhat.com> - 2.0.6-2
- Enable bash completion for dotnet
- Remove redundant buildrequires and requires
* Wed Mar 14 2018 Omair Majid <omajid@redhat.com> - 2.0.6-1
- Update to .NET Core 2.0.6
* Fri Feb 23 2018 Omair Majid <omajid@redhat.com> - 2.0.5-1
- Update to .NET Core 2.0.5
* Wed Jan 24 2018 Omair Majid <omajid@redhat.com> - 2.0.3-5
- Don't apply corefx clang warnings fix on clang < 5
* Fri Jan 19 2018 Omair Majid <omajid@redhat.com> - 2.0.3-4
- Add a test script to sanity check debug and symbol info.
- Build with clang 5.0
- Make main package real instead of using a virtual provides (see RHBZ 1519325)
* Wed Nov 29 2017 Omair Majid <omajid@redhat.com> - 2.0.3-3
- Add a Provides for 'dotnet'
- Fix conditional macro
* Tue Nov 28 2017 Omair Majid <omajid@redhat.com> - 2.0.3-2
- Fix build on Fedora 27
* Fri Nov 17 2017 Omair Majid <omajid@redhat.com> - 2.0.3-1
- Update to .NET Core 2.0.3
* Thu Oct 19 2017 Omair Majid <omajid@redhat.com> - 2.0.0-4
- Add a hack to let omnisharp work
* Wed Aug 30 2017 Omair Majid <omajid@redhat.com> - 2.0.0-3
- Add a patch for building coreclr and core-setup correctly on Fedora >= 27
* Fri Aug 25 2017 Omair Majid <omajid@redhat.com> - 2.0.0-2
- Move libicu/libcurl/libunwind requires to runtime package
- Make sdk depend on the exact version of the runtime package
* Thu Aug 24 2017 Omair Majid <omajid@redhat.com> - 2.0.0-1
- Update to 2.0.0 final release
* Wed Jul 26 2017 Omair Majid <omajid@redhat.com> - 2.0.0-0.3.preview2
- Add man pages
* Tue Jul 25 2017 Omair Majid <omajid@redhat.com> - 2.0.0-0.2.preview2
- Add Requires on libicu
- Split into multiple packages
- Do not repeat first-run message
* Fri Jul 21 2017 Omair Majid <omajid@redhat.com> - 2.0.0-0.1.preview2
- Update to .NET Core 2.0 Preview 2
* Thu Mar 16 2017 Nemanja Milošević <nmilosevnm@gmail.com> - 1.1.0-7
- rebuilt with latest libldb
* Wed Feb 22 2017 Nemanja Milosevic <nmilosev@fedoraproject.org> - 1.1.0-6
- compat-openssl 1.0 for F26 for now
* Sun Feb 19 2017 Nemanja Milosevic <nmilosev@fedoraproject.org> - 1.1.0-5
- Fix wrong commit id's
* Sat Feb 18 2017 Nemanja Milosevic <nmilosev@fedoraproject.org> - 1.1.0-4
- Use commit id's instead of branch names
* Sat Feb 18 2017 Nemanja Milosevic <nmilosev@fedoraproject.org> - 1.1.0-3
- Improper patch5 fix
* Sat Feb 18 2017 Nemanja Milosevic <nmilosev@fedoraproject.org> - 1.1.0-2
- SPEC cleanup
- git removal (using all tarballs for reproducible builds)
- more reasonable versioning
* Thu Feb 09 2017 Nemanja Milosevic <nmilosev@fedoraproject.org> - 1.1.0-1
- Fixed debuginfo going to separate package (Patch1)
- Added F25/F26 RIL and fixed the version info (Patch2)
- Added F25/F26 RIL in Microsoft.NETCore.App suported runtime graph (Patch3)
- SPEC file cleanup
* Wed Jan 11 2017 Nemanja Milosevic <nmilosev@fedoraproject.org> - 1.1.0-0
- Initial RPM for Fedora 25/26.

86
fsharp-no-apphost.patch Normal file
View File

@ -0,0 +1,86 @@
Index: a/src/buildtools/AssemblyCheck/AssemblyCheck.fsproj
===================================================================
--- a/src/buildtools/AssemblyCheck/AssemblyCheck.fsproj
+++ b/src/buildtools/AssemblyCheck/AssemblyCheck.fsproj
@@ -4,6 +4,7 @@
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
+ <UseAppHost>false</UseAppHost>
</PropertyGroup>
<ItemGroup>
Index: src/buildtools/fslex/fslex.fsproj
===================================================================
--- a/src/buildtools/fslex/fslex.fsproj
+++ b/src/buildtools/fslex/fslex.fsproj
@@ -5,6 +5,7 @@
<TargetFramework>net5.0</TargetFramework>
<DefineConstants>INTERNALIZED_FSLEXYACC_RUNTIME;$(DefineConstants)</DefineConstants>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
+ <UseAppHost>false</UseAppHost>
</PropertyGroup>
<ItemGroup>
Index: src/buildtools/fsyacc/fsyacc.fsproj
===================================================================
--- a/src/buildtools/fsyacc/fsyacc.fsproj
+++ b/src/buildtools/fsyacc/fsyacc.fsproj
@@ -5,6 +5,7 @@
<TargetFramework>net5.0</TargetFramework>
<DefineConstants>INTERNALIZED_FSLEXYACC_RUNTIME;$(DefineConstants)</DefineConstants>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
+ <UseAppHost>false</UseAppHost>
</PropertyGroup>
<ItemGroup>
Index: src/fsharp/fsc/fsc.fsproj
===================================================================
--- a/src/fsharp/fsc/fsc.fsproj
+++ b/src/fsharp/fsc/fsc.fsproj
@@ -11,7 +11,7 @@
<AllowCrossTargeting>true</AllowCrossTargeting>
<OtherFlags>$(OtherFlags) --maxerrors:20 --extraoptimizationloops:1</OtherFlags>
<NGenBinary>true</NGenBinary>
- <UseAppHost>true</UseAppHost>
+ <UseAppHost>false</UseAppHost>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net472'">
Index: src/fsharp/fsi/fsi.fsproj
===================================================================
--- a/src/fsharp/fsi/fsi.fsproj
+++ b/src/fsharp/fsi/fsi.fsproj
@@ -12,7 +12,7 @@
<OtherFlags>$(OtherFlags) --warnon:1182 --maxerrors:20 --extraoptimizationloops:1</OtherFlags>
<Win32Resource>fsi.res</Win32Resource>
<NGenBinary>true</NGenBinary>
- <UseAppHost>true</UseAppHost>
+ <UseAppHost>false</UseAppHost>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net472'">
Index: tests/benchmarks/MicroPerf/MicroPerf.fsproj
===================================================================
--- a/tests/benchmarks/MicroPerf/MicroPerf.fsproj
+++ b/tests/benchmarks/MicroPerf/MicroPerf.fsproj
@@ -3,6 +3,7 @@
<TargetFramework>net5.0</TargetFramework>
<OutputType>Exe</OutputType>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
+ <UseAppHost>false</UseAppHost>
<!-- Turn off "This function is for use by compiled F# code and should not be used directly" -->
<OtherFlags>$(OtherFlags) --nowarn:1204</OtherFlags>
<!-- Turn off "Experimental" -->
Index: tests/benchmarks/TaskPerf/TaskPerf.fsproj
===================================================================
--- a/tests/benchmarks/TaskPerf/TaskPerf.fsproj
+++ b/tests/benchmarks/TaskPerf/TaskPerf.fsproj
@@ -4,6 +4,7 @@
<TargetFramework>net5.0</TargetFramework>
<OutputType>Exe</OutputType>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
+ <UseAppHost>false</UseAppHost>
<!-- Turn off "This function is for use by compiled F# code and should not be used directly" -->
<OtherFlags>$(OtherFlags) --nowarn:1204</OtherFlags>
<!-- Turn off "Experimental" -->

View File

@ -0,0 +1,12 @@
Index: a/FSharpBuild.Directory.Build.props
===================================================================
--- a/FSharpBuild.Directory.Build.props
+++ b/FSharpBuild.Directory.Build.props
@@ -21,6 +21,7 @@
<ValueTupleImplicitPackageVersion>4.4.0</ValueTupleImplicitPackageVersion>
<WarningsAsErrors>1182;0025;$(WarningsAsErrors)</WarningsAsErrors>
<OtherFlags>$(OtherFlags) --nowarn:3384</OtherFlags>
+ <UseSharedCompilation>false</UseSharedCompilation>
</PropertyGroup>
<!-- nuget -->

View File

@ -0,0 +1,11 @@
--- a/eng/SourceBuild.props
+++ b/eng/SourceBuild.props
@@ -15,7 +15,7 @@
</ItemGroup>
<Exec
- Command="git apply --ignore-whitespace --whitespace=nowarn &quot;%(SourceBuildPatchFile.FullPath)&quot;"
+ Command="git --work-tree=&quot;$(RepoRoot)&quot; apply --ignore-whitespace --whitespace=nowarn &quot;%(SourceBuildPatchFile.FullPath)&quot;"
WorkingDirectory="$(RepoRoot)"
Condition="'@(SourceBuildPatchFile)' != ''" />
</Target>

View File

@ -0,0 +1,28 @@
From 691babb1c8316e2f829fbcf9f2aa14f4b7711960 Mon Sep 17 00:00:00 2001
From: Omair Majid <omajid@redhat.com>
Date: Thu, 9 Sep 2021 10:03:36 -0400
Subject: [PATCH] [ArPow] Use --work-tree with git apply
This makes things work bettern in a source-tarball build (where there
may not be a .git directory), or there might be a .git directory but
it's for a different repo than the one we are building.
---
eng/source-build/source-build.proj | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/eng/source-build/source-build.proj b/eng/source-build/source-build.proj
index 6f90f9793..72058ac88 100644
--- a/eng/source-build/source-build.proj
+++ b/eng/source-build/source-build.proj
@@ -55,7 +55,7 @@
</ItemGroup>
<Exec
- Command="git apply --ignore-whitespace --whitespace=nowarn &quot;%(SourceBuildPatchFile.FullPath)&quot;"
+ Command="git --work-tree=&quot;$(ProjectRoot)&quot; apply --ignore-whitespace --whitespace=nowarn &quot;%(SourceBuildPatchFile.FullPath)&quot;"
WorkingDirectory="$(ProjectRoot)"
Condition="'@(SourceBuildPatchFile)' != ''" />
</Target>
--
2.31.1

View File

@ -0,0 +1,12 @@
Index: roslyn-analyzers.e71e518713d6d578569bba6c5d401e405eee6058/src/Tools/ReleaseNotesUtil/ReleaseNotesUtil.csproj
===================================================================
--- a/src/Tools/ReleaseNotesUtil/ReleaseNotesUtil.csproj
+++ b/src/Tools/ReleaseNotesUtil/ReleaseNotesUtil.csproj
@@ -3,6 +3,7 @@
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<NonShipping>true</NonShipping>
+ <UseAppHost>false</UseAppHost>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis" Version="$(MicrosoftCodeAnalysisVersion)" />

125
roslyn-no-apphost.patch Normal file
View File

@ -0,0 +1,125 @@
Index: a/src/Interactive/csi/csi.csproj
===================================================================
--- a/src/Interactive/csi/csi.csproj
+++ b/src/Interactive/csi/csi.csproj
@@ -6,6 +6,7 @@
<OutputType>Exe</OutputType>
<RootNamespace>CSharpInteractive</RootNamespace>
<TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks>
+ <UseAppHost>false</UseAppHost>
</PropertyGroup>
<ItemGroup Label="Project References">
<ProjectReference Include="..\..\Compilers\Core\Portable\Microsoft.CodeAnalysis.csproj" />
Index: roslyn.dae39045cd460ba44053ff2af2217da126c25dbf/src/Interactive/vbi/vbi.vbproj
===================================================================
--- a/src/Interactive/vbi/vbi.vbproj
+++ b/src/Interactive/vbi/vbi.vbproj
@@ -7,6 +7,7 @@
<StartupObject>Sub Main</StartupObject>
<TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks>
<RootNamespace></RootNamespace>
+ <UseAppHost>false</UseAppHost>
</PropertyGroup>
<ItemGroup Label="Project References">
<ProjectReference Include="..\..\Compilers\Core\Portable\Microsoft.CodeAnalysis.csproj" />
Index: roslyn.dae39045cd460ba44053ff2af2217da126c25dbf/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/CSharpSyntaxGenerator.csproj
===================================================================
--- a/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/CSharpSyntaxGenerator.csproj
+++ b/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/CSharpSyntaxGenerator.csproj
@@ -14,6 +14,7 @@
<RuntimeIdentifiers>$(RoslynPortableRuntimeIdentifiers)</RuntimeIdentifiers>
<IsShipping>false</IsShipping>
<ExcludeFromSourceBuild>false</ExcludeFromSourceBuild>
+ <UseAppHost>false</UseAppHost>
</PropertyGroup>
<ItemGroup>
<!-- Make sure to reference the same version of Microsoft.CodeAnalysis.Analyzers as the rest of the build -->
Index: roslyn.dae39045cd460ba44053ff2af2217da126c25dbf/src/Tools/PrepareTests/PrepareTests.csproj
===================================================================
--- a/src/Tools/PrepareTests/PrepareTests.csproj
+++ b/src/Tools/PrepareTests/PrepareTests.csproj
@@ -7,6 +7,7 @@
<SignAssembly>false</SignAssembly>
<UseVSHostingProcess>false</UseVSHostingProcess>
<IsShipping>false</IsShipping>
+ <UseAppHost>false</UseAppHost>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Mono.Options" Version="$(MonoOptionsVersion)" />
Index: roslyn.dae39045cd460ba44053ff2af2217da126c25dbf/src/Tools/Source/CompilerGeneratorTools/Source/BoundTreeGenerator/CompilersBoundTreeGenerator.csproj
===================================================================
--- a/src/Tools/Source/CompilerGeneratorTools/Source/BoundTreeGenerator/CompilersBoundTreeGenerator.csproj
+++ b/src/Tools/Source/CompilerGeneratorTools/Source/BoundTreeGenerator/CompilersBoundTreeGenerator.csproj
@@ -11,8 +11,9 @@
<AutoGenerateBindingRedirects>True</AutoGenerateBindingRedirects>
<TargetFramework>netcoreapp3.1</TargetFramework>
<IsShipping>false</IsShipping>
+ <UseAppHost>false</UseAppHost>
</PropertyGroup>
<ItemGroup>
<None Include="app.config" />
</ItemGroup>
-</Project>
\ No newline at end of file
+</Project>
Index: roslyn.dae39045cd460ba44053ff2af2217da126c25dbf/src/Tools/Source/CompilerGeneratorTools/Source/CSharpErrorFactsGenerator/CSharpErrorFactsGenerator.csproj
===================================================================
--- a/src/Tools/Source/CompilerGeneratorTools/Source/CSharpErrorFactsGenerator/CSharpErrorFactsGenerator.csproj
+++ b/src/Tools/Source/CompilerGeneratorTools/Source/CSharpErrorFactsGenerator/CSharpErrorFactsGenerator.csproj
@@ -10,5 +10,6 @@
<AutoGenerateBindingRedirects>True</AutoGenerateBindingRedirects>
<TargetFramework>netcoreapp3.1</TargetFramework>
<IsShipping>false</IsShipping>
+ <UseAppHost>false</UseAppHost>
</PropertyGroup>
-</Project>
\ No newline at end of file
+</Project>
Index: roslyn.dae39045cd460ba44053ff2af2217da126c25dbf/src/Tools/Source/CompilerGeneratorTools/Source/IOperationGenerator/CompilersIOperationGenerator.csproj
===================================================================
--- a/src/Tools/Source/CompilerGeneratorTools/Source/IOperationGenerator/CompilersIOperationGenerator.csproj
+++ b/src/Tools/Source/CompilerGeneratorTools/Source/IOperationGenerator/CompilersIOperationGenerator.csproj
@@ -8,5 +8,6 @@
<AutoGenerateBindingRedirects>True</AutoGenerateBindingRedirects>
<TargetFramework>net5.0</TargetFramework>
<IsShipping>false</IsShipping>
+ <UseAppHost>false</UseAppHost>
</PropertyGroup>
</Project>
Index: roslyn.dae39045cd460ba44053ff2af2217da126c25dbf/src/Tools/Source/CompilerGeneratorTools/Source/VisualBasicErrorFactsGenerator/VisualBasicErrorFactsGenerator.vbproj
===================================================================
--- a/src/Tools/Source/CompilerGeneratorTools/Source/VisualBasicErrorFactsGenerator/VisualBasicErrorFactsGenerator.vbproj
+++ b/src/Tools/Source/CompilerGeneratorTools/Source/VisualBasicErrorFactsGenerator/VisualBasicErrorFactsGenerator.vbproj
@@ -12,5 +12,6 @@
<AutoGenerateBindingRedirects>True</AutoGenerateBindingRedirects>
<TargetFramework>netcoreapp3.1</TargetFramework>
<IsShipping>false</IsShipping>
+ <UseAppHost>false</UseAppHost>
</PropertyGroup>
-</Project>
\ No newline at end of file
+</Project>
Index: roslyn.dae39045cd460ba44053ff2af2217da126c25dbf/src/Tools/Source/CompilerGeneratorTools/Source/VisualBasicSyntaxGenerator/VisualBasicSyntaxGenerator.vbproj
===================================================================
--- a/src/Tools/Source/CompilerGeneratorTools/Source/VisualBasicSyntaxGenerator/VisualBasicSyntaxGenerator.vbproj
+++ b/src/Tools/Source/CompilerGeneratorTools/Source/VisualBasicSyntaxGenerator/VisualBasicSyntaxGenerator.vbproj
@@ -13,6 +13,7 @@
<AutoGenerateBindingRedirects>True</AutoGenerateBindingRedirects>
<TargetFramework>netcoreapp3.1</TargetFramework>
<IsShipping>false</IsShipping>
+ <UseAppHost>false</UseAppHost>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\..\..\..\Compilers\VisualBasic\Portable\Declarations\DeclarationModifiers.vb" Link="Grammar\DeclarationModifiers.vb" />
Index: roslyn.dae39045cd460ba44053ff2af2217da126c25dbf/src/Tools/Source/RunTests/RunTests.csproj
===================================================================
--- a/src/Tools/Source/RunTests/RunTests.csproj
+++ b/src/Tools/Source/RunTests/RunTests.csproj
@@ -7,6 +7,7 @@
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<SignAssembly>false</SignAssembly>
<IsShipping>false</IsShipping>
+ <UseAppHost>false</UseAppHost>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Collections.Immutable" Version="$(SystemCollectionsImmutableVersion)" />

View File

@ -0,0 +1,13 @@
Index: source-build-tarball/src/roslyn.2cb3d482e3c09760d1b204c597be93f49dba3349/eng/targets/Settings.props
===================================================================
--- a/eng/targets/Settings.props
+++ b/eng/targets/Settings.props
@@ -39,6 +39,8 @@
Microsoft.Common.CurrentVersion.targets to see how it is consumed -->
<WindowsAppContainer>false</WindowsAppContainer>
+ <UseSharedCompilation>false</UseSharedCompilation>
+
<EnableDefaultNoneItems>false</EnableDefaultNoneItems>
<Nullable>enable</Nullable>
</PropertyGroup>

View File

@ -0,0 +1,13 @@
diff --git a/eng/native/init-compiler.sh b/eng/native/init-compiler.sh
index 567d18da474..927b3071e92 100755
--- a/eng/native/init-compiler.sh
+++ b/eng/native/init-compiler.sh
@@ -108,7 +108,7 @@ if [[ -z "$CC" ]]; then
fi
if [[ "$compiler" == "clang" ]]; then
- if command -v "lld$desired_version" > /dev/null; then
+ if command -v lld || command -v "lld$desired_version" > /dev/null; then
# Only lld version >= 9 can be considered stable
if [[ "$majorVersion" -ge 9 ]]; then
LDFLAGS="-fuse-ld=lld"

View File

@ -0,0 +1,80 @@
Index: a/src/coreclr/ilasm/writer.cpp
===================================================================
--- a/src/coreclr/ilasm/writer.cpp
+++ b/src/coreclr/ilasm/writer.cpp
@@ -212,26 +212,28 @@ HRESULT Assembler::CreateDebugDirectory(
param.debugDirData = NULL;
// get module ID
- DWORD rsds = 0x53445352;
- DWORD pdbAge = 0x1;
+ DWORD rsds = VAL32(0x53445352);
+ DWORD pdbAge = VAL32(0x1);
+ GUID pdbGuid = *m_pPortablePdbWriter->GetGuid();
+ SwapGuid(&pdbGuid);
DWORD len = sizeof(rsds) + sizeof(GUID) + sizeof(pdbAge) + (DWORD)strlen(m_szPdbFileName) + 1;
BYTE* dbgDirData = new BYTE[len];
DWORD offset = 0;
memcpy_s(dbgDirData + offset, len, &rsds, sizeof(rsds)); // RSDS
offset += sizeof(rsds);
- memcpy_s(dbgDirData + offset, len, m_pPortablePdbWriter->GetGuid(), sizeof(GUID)); // PDB GUID
+ memcpy_s(dbgDirData + offset, len, &pdbGuid, sizeof(GUID)); // PDB GUID
offset += sizeof(GUID);
memcpy_s(dbgDirData + offset, len, &pdbAge, sizeof(pdbAge)); // PDB AGE
offset += sizeof(pdbAge);
memcpy_s(dbgDirData + offset, len, m_szPdbFileName, strlen(m_szPdbFileName) + 1); // PDB PATH
debugDirIDD.Characteristics = 0;
- debugDirIDD.TimeDateStamp = m_pPortablePdbWriter->GetTimestamp();
- debugDirIDD.MajorVersion = 0x100;
- debugDirIDD.MinorVersion = 0x504d;
- debugDirIDD.Type = IMAGE_DEBUG_TYPE_CODEVIEW;
- debugDirIDD.SizeOfData = len;
+ debugDirIDD.TimeDateStamp = VAL32(m_pPortablePdbWriter->GetTimestamp());
+ debugDirIDD.MajorVersion = VAL16(0x100);
+ debugDirIDD.MinorVersion = VAL16(0x504d);
+ debugDirIDD.Type = VAL32(IMAGE_DEBUG_TYPE_CODEVIEW);
+ debugDirIDD.SizeOfData = VAL32(len);
debugDirIDD.AddressOfRawData = 0; // will be updated bellow
debugDirIDD.PointerToRawData = 0; // will be updated bellow
Index: a/src/coreclr/md/enc/pdbheap.cpp
===================================================================
--- a/src/coreclr/md/enc/pdbheap.cpp
+++ b/src/coreclr/md/enc/pdbheap.cpp
@@ -26,6 +26,16 @@ HRESULT PdbHeap::SetData(PORT_PDB_STREAM
(sizeof(ULONG) * data->typeSystemTableRowsSize);
m_data = new BYTE[m_size];
+#if BIGENDIAN
+ PORT_PDB_STREAM swappedData = *data;
+ SwapGuid(&swappedData.id.pdbGuid);
+ swappedData.id.pdbTimeStamp = VAL32(swappedData.id.pdbTimeStamp);
+ swappedData.entryPoint = VAL32(swappedData.entryPoint);
+ swappedData.referencedTypeSystemTables = VAL64(swappedData.referencedTypeSystemTables);
+ // typeSystemTableRows and typeSystemTableRowsSize handled below
+ data = &swappedData;
+#endif
+
ULONG offset = 0;
if (memcpy_s(m_data + offset, m_size, &data->id, sizeof(data->id)))
return E_FAIL;
@@ -39,9 +49,17 @@ HRESULT PdbHeap::SetData(PORT_PDB_STREAM
return E_FAIL;
offset += sizeof(data->referencedTypeSystemTables);
+#if !BIGENDIAN
if (memcpy_s(m_data + offset, m_size, data->typeSystemTableRows, sizeof(ULONG) * data->typeSystemTableRowsSize))
return E_FAIL;
offset += sizeof(ULONG) * data->typeSystemTableRowsSize;
+#else
+ for (int i = 0; i < data->typeSystemTableRowsSize; i++)
+ {
+ SET_UNALIGNED_VAL32(m_data + offset, data->typeSystemTableRows[i]);
+ offset += sizeof(ULONG);
+ }
+#endif
_ASSERTE(offset == m_size);

View File

@ -0,0 +1,755 @@
Index: a/src/mono/mono/utils/memfuncs.c
===================================================================
--- a/src/mono/mono/utils/memfuncs.c
+++ b/src/mono/mono/utils/memfuncs.c
@@ -343,6 +343,9 @@ mono_determine_physical_ram_available_si
host_page_size (host, &page_size);
return (guint64) vmstat.free_count * page_size;
+#elif defined (__FreeBSD__) || defined (__linux__) || defined (__APPLE__)
+ return (getPhysicalMemoryAvail());
+
#elif defined (HAVE_SYSCONF)
gint64 page_size = -1, num_pages = -1;
Index: a/src/mono/mono/utils/memfuncs.h
===================================================================
--- a/src/mono/mono/utils/memfuncs.h
+++ b/src/mono/mono/utils/memfuncs.h
@@ -24,5 +24,10 @@ MONO_COMPONENT_API void mono_gc_memmove_
void mono_gc_memmove_aligned (void *dest, const void *src, size_t size);
guint64 mono_determine_physical_ram_size (void);
guint64 mono_determine_physical_ram_available_size (void);
+#if defined (__FreeBSD__) || defined (__linux__) || defined (__APPLE__)
+size_t getRestrictedPhysicalMemoryLimit(void);
+gboolean getPhysicalMemoryUsed(size_t *);
+size_t getPhysicalMemoryAvail(void);
+#endif
#endif
Index: a/src/mono/mono/utils/mono-cgroup.c
===================================================================
--- /dev/null
+++ b/src/mono/mono/utils/mono-cgroup.c
@@ -0,0 +1,709 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+/*++
+
+Module Name:
+
+ mono-cgroup.cpp
+
+Abstract:
+ Read the memory limit for the current process
+--*/
+#ifdef __FreeBSD__
+#define _WITH_GETLINE
+#endif
+
+#include <config.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <glib.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/resource.h>
+#if defined(__APPLE__) || defined(__FreeBSD__)
+#include <sys/param.h>
+#include <sys/mount.h>
+#else
+#include <sys/vfs.h>
+#endif
+#include <errno.h>
+#include <limits.h>
+
+#ifndef SIZE_T_MAX
+# define SIZE_T_MAX (~(size_t)0)
+#endif
+
+#define CGROUP2_SUPER_MAGIC 0x63677270
+#define TMPFS_MAGIC 0x01021994
+
+#define PROC_MOUNTINFO_FILENAME "/proc/self/mountinfo"
+#define PROC_CGROUP_FILENAME "/proc/self/cgroup"
+#define PROC_STATM_FILENAME "/proc/self/statm"
+#define CGROUP1_MEMORY_LIMIT_FILENAME "/memory.limit_in_bytes"
+#define CGROUP2_MEMORY_LIMIT_FILENAME "/memory.max"
+#define CGROUP_MEMORY_STAT_FILENAME "/memory.stat"
+
+static void initialize(void);
+static gboolean readMemoryValueFromFile(const char *, guint64 *);
+static gboolean getPhysicalMemoryLimit(guint64 *);
+static gboolean getPhysicalMemoryUsage(size_t *);
+static int findCGroupVersion(void);
+static gboolean isCGroup1MemorySubsystem(const char *);
+static char *findCGroupPath(gboolean (*is_subsystem)(const char *));
+static void findHierarchyMount(gboolean (*is_subsystem)(const char *), char **, char **);
+static char *findCGroupPathForSubsystem(gboolean (*is_subsystem)(const char *));
+static gboolean getCGroupMemoryLimit(guint64 *, const char *);
+static gboolean getCGroupMemoryUsage(size_t *);
+static size_t getPhysicalMemoryTotal(guint64);
+
+size_t getRestrictedPhysicalMemoryLimit(void);
+gboolean getPhysicalMemoryUsed(size_t *);
+size_t getPhysicalMemoryAvail(void);
+
+// the cgroup version number or 0 to indicate cgroups are not found or not enabled
+static int s_cgroup_version;
+
+static char *s_memory_cgroup_path = NULL;
+
+static const char *s_mem_stat_key_names[4];
+static size_t s_mem_stat_key_lengths[4];
+static size_t s_mem_stat_n_keys = 0;
+static long pageSize;
+
+/**
+ * @initialize
+ *
+ * Initialize variables used by the calculation routines.
+ */
+static void
+initialize()
+{
+ s_cgroup_version = findCGroupVersion();
+ s_memory_cgroup_path = findCGroupPath(s_cgroup_version == 1 ? &isCGroup1MemorySubsystem : NULL);
+
+ if (s_cgroup_version == 1) {
+ s_mem_stat_n_keys = 4;
+ s_mem_stat_key_names[0] = "total_inactive_anon ";
+ s_mem_stat_key_names[1] = "total_active_anon ";
+ s_mem_stat_key_names[2] = "total_dirty ";
+ s_mem_stat_key_names[3] = "total_unevictable ";
+ } else {
+ s_mem_stat_n_keys = 3;
+ s_mem_stat_key_names[0] = "anon ";
+ s_mem_stat_key_names[1] = "file_dirty ";
+ s_mem_stat_key_names[2] = "unevictable ";
+ }
+
+ for (size_t i = 0; i < s_mem_stat_n_keys; i++)
+ s_mem_stat_key_lengths[i] = strlen(s_mem_stat_key_names[i]);
+
+ pageSize = sysconf(_SC_PAGE_SIZE);
+}
+
+/**
+ * @readMemoryValueFromFile
+ *
+ * @param[in] filename - name of file containing value
+ * @param[out] val - pointer to the result area
+ * @returns True or False depending if value was found
+ *
+ * Read a value from a specified /sys/fs/cgroup/memory file
+ */
+static gboolean
+readMemoryValueFromFile(const char* filename, guint64* val)
+{
+ gboolean result = FALSE;
+ char *line = NULL;
+ size_t lineLen = 0;
+ char *endptr = NULL;
+ guint64 num = 0, multiplier;
+ FILE *file = NULL;
+
+ if (val == NULL) {
+ file = fopen(filename, "r");
+ if (file != NULL) {
+ if (getline(&line, &lineLen, file) != -1) {
+ errno = 0;
+ num = strtoull(line, &endptr, 0);
+ if (line != endptr && errno == 0) {
+ multiplier = 1;
+
+ switch (*endptr)
+ {
+ case 'g':
+ case 'G':
+ multiplier = 1024;
+ case 'm':
+ case 'M':
+ multiplier = multiplier * 1024;
+ case 'k':
+ case 'K':
+ multiplier = multiplier * 1024;
+ }
+
+ *val = num * multiplier;
+ result = TRUE;
+ if (*val / multiplier != num)
+ result = FALSE;
+ }
+ }
+ }
+ }
+
+ if (file)
+ fclose(file);
+ free(line);
+ return result;
+}
+
+/**
+ * @getPhysicalMemoryLimit
+ *
+ * @param[out] val - pointer to the result area
+ * @returns True or False depending if a limit was found
+ *
+ * Interrogate the cgroup memory values to determine if there's
+ * a limit on physical memory.
+ */
+static gboolean
+getPhysicalMemoryLimit(guint64 *val)
+{
+ if (s_mem_stat_n_keys == 0)
+ initialize();
+
+ if (s_cgroup_version == 0)
+ return FALSE;
+ else if (s_cgroup_version == 1)
+ return getCGroupMemoryLimit(val, CGROUP1_MEMORY_LIMIT_FILENAME);
+ else if (s_cgroup_version == 2)
+ return getCGroupMemoryLimit(val, CGROUP2_MEMORY_LIMIT_FILENAME);
+ else {
+ g_assert(!"Unknown cgroup version.");
+ return FALSE;
+ }
+}
+
+/**
+ * @getPhysicalMemoryUsage
+ *
+ * @param[out] val - pointer to the result area
+ * @returns True or False depending if a usage value was found
+ *
+ * Interrogate the cgroup memory values to determine how much
+ * memory is in use.
+ */
+static gboolean
+getPhysicalMemoryUsage(size_t *val)
+{
+ if (s_cgroup_version == 0)
+ return FALSE;
+ else if (s_cgroup_version == 1)
+ return getCGroupMemoryUsage(val);
+ else if (s_cgroup_version == 2)
+ return getCGroupMemoryUsage(val);
+ else {
+ g_assert(!"Unknown cgroup version.");
+ return FALSE;
+ }
+}
+
+/**
+ * @findGroupVersion
+ *
+ * @returns cgroup version
+ *
+ * Inspect the /sys/fs/cgroup hierachy to determine what version of
+ * group we are using
+ */
+static int
+findCGroupVersion()
+{
+ // It is possible to have both cgroup v1 and v2 enabled on a system.
+ // Most non-bleeding-edge Linux distributions fall in this group. We
+ // look at the file system type of /sys/fs/cgroup to determine which
+ // one is the default. For more details, see:
+ // https://systemd.io/CGROUP_DELEGATION/#three-different-tree-setups-
+ // We dont care about the difference between the "legacy" and "hybrid"
+ // modes because both of those involve cgroup v1 controllers managing
+ // resources.
+
+
+ struct statfs stats;
+ int result = statfs("/sys/fs/cgroup", &stats);
+ if (result != 0)
+ return 0;
+
+ switch (stats.f_type) {
+ case TMPFS_MAGIC: return 1;
+ case CGROUP2_SUPER_MAGIC: return 2;
+ default:
+ g_assert(!"Unexpected file system type for /sys/fs/cgroup");
+ return 0;
+ }
+}
+
+/**
+ * @isCGroup1MemorySubsystem
+ *
+ * @param[in] strTok - Token for comparison
+ * @returns True if token matches "memory"
+ *
+ * Check if we've found the memory component of /sys/fs/cgroup
+ */
+static gboolean
+isCGroup1MemorySubsystem(const char *strTok)
+{
+ return strcmp("memory", strTok) == 0;
+}
+
+/**
+ * @findCGroupPath
+ *
+ * @param[in] is_subsystem - Function used to compare tokens
+ * @returns Path to cgroup
+ *
+ * Navigate the /sys/fs/cgroup to try and find the correct cgroup path
+ */
+static char *
+findCGroupPath(gboolean (*is_subsystem)(const char *))
+{
+ char *cgroup_path = NULL;
+ char *hierarchy_mount = NULL;
+ char *hierarchy_root = NULL;
+ char *cgroup_path_relative_to_mount = NULL;
+ size_t common_path_prefix_len;
+
+ findHierarchyMount(is_subsystem, &hierarchy_mount, &hierarchy_root);
+ if (hierarchy_mount != NULL && hierarchy_root != NULL) {
+
+ cgroup_path_relative_to_mount = findCGroupPathForSubsystem(is_subsystem);
+ if (cgroup_path_relative_to_mount != NULL) {
+
+ cgroup_path = (char*)malloc(strlen(hierarchy_mount) + strlen(cgroup_path_relative_to_mount) + 1);
+ if (cgroup_path != NULL) {
+
+ strcpy(cgroup_path, hierarchy_mount);
+ // For a host cgroup, we need to append the relative path.
+ // The root and cgroup path can share a common prefix of the path that should not be appended.
+ // Example 1 (docker):
+ // hierarchy_mount: /sys/fs/cgroup/cpu
+ // hierarchy_root: /docker/87ee2de57e51bc75175a4d2e81b71d162811b179d549d6601ed70b58cad83578
+ // cgroup_path_relative_to_mount: /docker/87ee2de57e51bc75175a4d2e81b71d162811b179d549d6601ed70b58cad83578/my_named_cgroup
+ // append do the cgroup_path: /my_named_cgroup
+ // final cgroup_path: /sys/fs/cgroup/cpu/my_named_cgroup
+ //
+ // Example 2 (out of docker)
+ // hierarchy_mount: /sys/fs/cgroup/cpu
+ // hierarchy_root: /
+ // cgroup_path_relative_to_mount: /my_named_cgroup
+ // append do the cgroup_path: /my_named_cgroup
+ // final cgroup_path: /sys/fs/cgroup/cpu/my_named_cgroup
+ common_path_prefix_len = strlen(hierarchy_root);
+ if ((common_path_prefix_len == 1) ||
+ (strncmp(hierarchy_root, cgroup_path_relative_to_mount, common_path_prefix_len) != 0))
+ common_path_prefix_len = 0;
+
+ g_assert((cgroup_path_relative_to_mount[common_path_prefix_len] == '/') ||
+ (cgroup_path_relative_to_mount[common_path_prefix_len] == '\0'));
+
+ strcat(cgroup_path, cgroup_path_relative_to_mount + common_path_prefix_len);
+ }
+ }
+ }
+
+ free(hierarchy_mount);
+ free(hierarchy_root);
+ free(cgroup_path_relative_to_mount);
+ return cgroup_path;
+}
+
+/**
+ * @findHierarchyMount
+ *
+ * @param[in] is_subsystem - Comparison function
+ * @param[out] pmountpath -
+ * @param[out] pmountroot -
+ *
+ * Check the /proc filesystem to determine the root and mount path of /sys/fs/cgroup data
+ */
+static void
+findHierarchyMount(gboolean (*is_subsystem)(const char *), char** pmountpath, char** pmountroot)
+{
+ char *line = NULL;
+ size_t lineLen = 0, maxLineLen = 0;
+ char *filesystemType = NULL;
+ char *options = NULL;
+ char *mountpath = NULL;
+ char *mountroot = NULL;
+
+ FILE *mountinfofile = fopen(PROC_MOUNTINFO_FILENAME, "r");
+ if (mountinfofile == NULL)
+ goto done;
+
+ while (getline(&line, &lineLen, mountinfofile) != -1) {
+ if (filesystemType == NULL || lineLen > maxLineLen) {
+ free(filesystemType);
+ filesystemType = NULL;
+ free(options);
+ options = NULL;
+ filesystemType = (char*)malloc(lineLen+1);
+ if (filesystemType == NULL)
+ goto done;
+ options = (char*)malloc(lineLen+1);
+ if (options == NULL)
+ goto done;
+ maxLineLen = lineLen;
+ }
+
+ char *separatorChar = strstr(line, " - ");
+
+ // See man page of proc to get format for /proc/self/mountinfo file
+ int sscanfRet = sscanf(separatorChar,
+ " - %s %*s %s",
+ filesystemType,
+ options);
+ if (sscanfRet != 2) {
+ g_assert(!"Failed to parse mount info file contents with sscanf.");
+ goto done;
+ }
+
+ if (strncmp(filesystemType, "cgroup", 6) == 0) {
+ gboolean isSubsystemMatch = is_subsystem == NULL;
+ if (!isSubsystemMatch) {
+ char *context = NULL;
+ char *strTok = strtok_r(options, ",", &context);
+ while (!isSubsystemMatch && strTok != NULL)
+ {
+ isSubsystemMatch = is_subsystem(strTok);
+ strTok = strtok_r(NULL, ",", &context);
+ }
+ }
+ if (isSubsystemMatch) {
+ mountpath = (char*)malloc(lineLen+1);
+ if (mountpath == NULL)
+ goto done;
+ mountroot = (char*)malloc(lineLen+1);
+ if (mountroot == NULL)
+ goto done;
+
+ sscanfRet = sscanf(line,
+ "%*s %*s %*s %s %s ",
+ mountroot,
+ mountpath);
+ if (sscanfRet != 2)
+ g_assert(!"Failed to parse mount info file contents with sscanf.");
+
+ // assign the output arguments and clear the locals so we don't free them.
+ *pmountpath = mountpath;
+ *pmountroot = mountroot;
+ mountpath = mountroot = NULL;
+ }
+ }
+ }
+done:
+ free(mountpath);
+ free(mountroot);
+ free(filesystemType);
+ free(options);
+ free(line);
+ if (mountinfofile)
+ fclose(mountinfofile);
+}
+
+/**
+ * @findCGroupPathForSubsystem
+ *
+ * @param[in] is_subsystem - Comparison function
+ * @returns cgroup path for the memory subsystem
+ *
+ * Check the /proc filesystem to determine the root and mount path of /sys/fs/cgroup data
+ */
+static char *
+findCGroupPathForSubsystem(gboolean (*is_subsystem)(const char *))
+{
+ char *line = NULL;
+ size_t lineLen = 0;
+ size_t maxLineLen = 0;
+ char *subsystem_list = NULL;
+ char *cgroup_path = NULL;
+ gboolean result = FALSE;
+
+ FILE *cgroupfile = fopen(PROC_CGROUP_FILENAME, "r");
+ if (cgroupfile == NULL)
+ goto done;
+
+ while (!result && getline(&line, &lineLen, cgroupfile) != -1) {
+ if (subsystem_list == NULL || lineLen > maxLineLen) {
+ free(subsystem_list);
+ subsystem_list = NULL;
+ free(cgroup_path);
+ cgroup_path = NULL;
+ subsystem_list = (char*)malloc(lineLen+1);
+ if (subsystem_list == NULL)
+ goto done;
+ cgroup_path = (char*)malloc(lineLen+1);
+ if (cgroup_path == NULL)
+ goto done;
+ maxLineLen = lineLen;
+ }
+
+ if (s_cgroup_version == 1) {
+ // See man page of proc to get format for /proc/self/cgroup file
+ int sscanfRet = sscanf(line,
+ "%*[^:]:%[^:]:%s",
+ subsystem_list,
+ cgroup_path);
+ if (sscanfRet != 2) {
+ g_assert(!"Failed to parse cgroup info file contents with sscanf.");
+ goto done;
+ }
+
+ char* context = NULL;
+ char* strTok = strtok_r(subsystem_list, ",", &context);
+ while (strTok != NULL) {
+ if (is_subsystem(strTok)) {
+ result = TRUE;
+ break;
+ }
+ strTok = strtok_r(NULL, ",", &context);
+ }
+ } else if (s_cgroup_version == 2) {
+ // See https://www.kernel.org/doc/Documentation/cgroup-v2.txt
+ // Look for a "0::/some/path"
+ int sscanfRet = sscanf(line,
+ "0::%s",
+ cgroup_path);
+ if (sscanfRet == 1)
+ {
+ result = TRUE;
+ }
+ } else {
+ g_assert(!"Unknown cgroup version in mountinfo.");
+ goto done;
+ }
+ }
+done:
+ free(subsystem_list);
+ if (!result) {
+ free(cgroup_path);
+ cgroup_path = NULL;
+ }
+ free(line);
+ if (cgroupfile)
+ fclose(cgroupfile);
+ return cgroup_path;
+}
+
+/**
+ * @getCGroupMemoryLimit
+ *
+ * @param[out] val - Memory limit
+ * @param[in] filename - name of file from which to extract limit
+ * @returns True if value found
+ *
+ * Extract memory limit from specified /sys/fs/cgroup/memory file
+ */
+static gboolean
+getCGroupMemoryLimit(guint64 *val, const char *filename)
+{
+ if (s_memory_cgroup_path == NULL)
+ return FALSE;
+
+ char* mem_limit_filename = NULL;
+ if (asprintf(&mem_limit_filename, "%s%s", s_memory_cgroup_path, filename) < 0)
+ return FALSE;
+
+ gboolean result = readMemoryValueFromFile(mem_limit_filename, val);
+ free(mem_limit_filename);
+ return result;
+}
+
+/**
+ * @getCGroupMemoryUsage
+ *
+ * @param[out] val - Memory limit
+ * @returns True if value found
+ *
+ * Extract memory usage from /sys/fs/cgroup/memory.stat file
+ */
+static gboolean
+getCGroupMemoryUsage(size_t *val)
+{
+ if (s_memory_cgroup_path == NULL)
+ return FALSE;
+
+ char *stat_filename = NULL;
+ if (asprintf(&stat_filename, "%s%s", s_memory_cgroup_path, CGROUP_MEMORY_STAT_FILENAME) < 0)
+ return FALSE;
+
+ FILE *stat_file = fopen(stat_filename, "r");
+ free(stat_filename);
+ if (stat_file == NULL)
+ return FALSE;
+
+ char *line = NULL;
+ size_t lineLen = 0;
+ size_t readValues = 0;
+ char *endptr;
+
+ *val = 0;
+ while (getline(&line, &lineLen, stat_file) != -1 && readValues < s_mem_stat_n_keys) {
+ for (size_t i = 0; i < s_mem_stat_n_keys; i++) {
+ if (strncmp(line, s_mem_stat_key_names[i], s_mem_stat_key_lengths[i]) == 0) {
+ errno = 0;
+ const char *startptr = line + s_mem_stat_key_lengths[i];
+ *val += strtoll(startptr, &endptr, 10);
+ if (endptr != startptr && errno == 0)
+ readValues++;
+
+ break;
+ }
+ }
+ }
+
+ fclose(stat_file);
+ free(line);
+
+ if (readValues == s_mem_stat_n_keys)
+ return TRUE;
+
+ return FALSE;
+}
+
+/**
+ * @getRestrictedPhysicalMemoryLimit
+ *
+ * @returns Physical memory limit
+ *
+ * Determine if there are any limits on memory and return the value
+ * if so. Zero represents no limit.
+ */
+size_t
+getRestrictedPhysicalMemoryLimit()
+{
+ guint64 physical_memory_limit = 0;
+
+ if (s_mem_stat_n_keys == 0)
+ initialize();
+
+ if (!getPhysicalMemoryLimit(&physical_memory_limit))
+ return 0;
+
+ // If there's no memory limit specified on the container this
+ // actually returns 0x7FFFFFFFFFFFF000 (2^63-1 rounded down to
+ // 4k which is a common page size). So we know we are not
+ // running in a memory restricted environment.
+ if (physical_memory_limit > 0x7FFFFFFF00000000)
+ return 0;
+
+ return (getPhysicalMemoryTotal(physical_memory_limit));
+}
+
+/**
+ * @getPhysicalMemoryTotal
+ *
+ * @param[in] physical_memory_limit - The max memory on the system
+ * @returns Physical memory total
+ *
+ * Check the input limit against any system limits or actual memory on system
+ */
+static size_t
+getPhysicalMemoryTotal(size_t physical_memory_limit)
+{
+ struct rlimit curr_rlimit;
+ size_t rlimit_soft_limit = (size_t)RLIM_INFINITY;
+ if (getrlimit(RLIMIT_AS, &curr_rlimit) == 0)
+ rlimit_soft_limit = curr_rlimit.rlim_cur;
+ physical_memory_limit = (physical_memory_limit < rlimit_soft_limit) ?
+ physical_memory_limit : rlimit_soft_limit;
+
+ // Ensure that limit is not greater than real memory size
+ long pages = sysconf(_SC_PHYS_PAGES);
+ if (pages != -1) {
+ if (pageSize != -1) {
+ physical_memory_limit = (physical_memory_limit < (size_t)pages * pageSize) ?
+ physical_memory_limit : (size_t)pages * pageSize;
+ }
+ }
+
+ if (physical_memory_limit > ULONG_MAX) {
+ // It is observed in practice when the memory is unrestricted, Linux control
+ // group returns a physical limit that is bigger than the address space
+ return ULONG_MAX;
+ } else
+ return (size_t)physical_memory_limit;
+}
+
+/**
+ * @getPhysicalMemoryUsed
+ *
+ * @param[out] val - pointer to the memory usage value
+ * @returns True if we are able to determine usage
+ *
+ * Determine the amount of memory in use
+ */
+gboolean
+getPhysicalMemoryUsed(size_t *val)
+{
+ gboolean result = FALSE;
+ size_t linelen;
+ char *line = NULL;
+
+ if (val == NULL)
+ return FALSE;
+
+ // Linux uses cgroup usage to trigger oom kills.
+ if (getPhysicalMemoryUsage(val))
+ return TRUE;
+
+ // process resident set size.
+ FILE* file = fopen(PROC_STATM_FILENAME, "r");
+ if (file != NULL && getline(&line, &linelen, file) != -1) {
+ char* context = NULL;
+ char* strTok = strtok_r(line, " ", &context);
+ strTok = strtok_r(NULL, " ", &context);
+
+ errno = 0;
+ *val = strtoull(strTok, NULL, 0);
+ if (errno == 0) {
+ if (pageSize != -1) {
+ *val = *val * pageSize;
+ result = TRUE;
+ }
+ }
+ }
+
+ if (file)
+ fclose(file);
+ free(line);
+ return result;
+}
+
+/**
+ * @getPhysicalMemoryAvail
+ *
+ * @returns Amount of memory available
+ *
+ * Determine the amount of memory available by examininig any limits and
+ * checking what memory is in use.
+ */
+size_t
+getPhysicalMemoryAvail()
+{
+ size_t max, used, avail, sysAvail;
+
+ max = getRestrictedPhysicalMemoryLimit();
+
+ if (max == 0)
+ max = getPhysicalMemoryTotal(ULONG_MAX);
+
+ if (getPhysicalMemoryUsed(&used))
+ avail = max - used;
+ else
+ avail = max;
+
+ sysAvail = sysconf(_SC_AVPHYS_PAGES) * pageSize;
+ return (avail < sysAvail ? avail : sysAvail);
+}
Index: a/src/mono/mono/utils/CMakeLists.txt
===================================================================
--- a/src/mono/mono/utils/CMakeLists.txt
+++ b/src/mono/mono/utils/CMakeLists.txt
@@ -32,6 +32,7 @@ set(utils_common_sources
mono-sha1.c
mono-logger.c
mono-logger-internals.h
+ mono-cgroup.c
mono-codeman.c
mono-counters.c
mono-compiler.h

View File

@ -0,0 +1,12 @@
Index: source-build-tarball/src/runtime.826f81a11ad17f415668fe1cb934bdaf00d36ea2/Directory.Build.props
===================================================================
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -7,6 +7,7 @@
For offline builds we still set OfficialBuildId but we need to build all the packages for a single
leg only, so we also take DotNetBuildFromSource into account. -->
<BuildingAnOfficialBuildLeg Condition="'$(BuildingAnOfficialBuildLeg)' == '' and '$(OfficialBuildId)' != '' and '$(DotNetBuildFromSource)' != 'true'">true</BuildingAnOfficialBuildLeg>
+ <UseSharedCompilation>false</UseSharedCompilation>
</PropertyGroup>
<PropertyGroup Label="CalculateTargetOS">

10
sdk-enable-preview.patch Normal file
View File

@ -0,0 +1,10 @@
--- a/eng/SourceBuild.props
+++ b/eng/SourceBuild.props
@@ -8,6 +8,7 @@
<Target Name="ConfigureInnerBuildArg" BeforeTargets="GetSourceBuildCommandConfiguration">
<PropertyGroup>
<InnerBuildArgs>$(InnerBuildArgs) /p:Projects="$(InnerSourceBuildRepoRoot)\source-build.slnf"</InnerBuildArgs>
+ <InnerBuildArgs>$(InnerBuildArgs) /p:EnablePreviewFeatures=true</InnerBuildArgs>
</PropertyGroup>
</Target>

View File

@ -0,0 +1,18 @@
diff --git a/src/Cli/dotnet/Program.cs b/src/Cli/dotnet/Program.cs
index de1ebb9e6..6bbf479de 100644
--- a/src/Cli/dotnet/Program.cs
+++ b/src/Cli/dotnet/Program.cs
@@ -28,6 +28,13 @@ public class Program
public static int Main(string[] args)
{
+ // opt out of telemetry by default if the env var is unset
+ string telemetryValue = Environment.GetEnvironmentVariable("DOTNET_CLI_TELEMETRY_OPTOUT");
+ if (String.IsNullOrEmpty(telemetryValue))
+ {
+ Environment.SetEnvironmentVariable("DOTNET_CLI_TELEMETRY_OPTOUT", "1");
+ }
+
DebugHelper.HandleDebugSwitch(ref args);
// Capture the current timestamp to calculate the host overhead.

View File

@ -0,0 +1,12 @@
Index: a/src/Directory.Build.props
===================================================================
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -9,6 +9,7 @@
<PropertyGroup>
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
<IsPackable>true</IsPackable>
+ <UseSharedCompilation>false</UseSharedCompilation>
<!--
Arcade defaults Serviceable to 'true'. Reset it, to use the value in the nuspec. Improves
equality with real packages.

3
sources Normal file
View File

@ -0,0 +1,3 @@
SHA512 (dotnet-28be3e9a006d90d8c6e87d4353b77882829df718-x64-bootstrap.tar.xz) = 04c40a671c4a55a2b3802df6773850ac586ab712181554ec99d4af607692a8546361f029f055c0662ff59bf05d0eaee5f521b7ba9b7d3477bd69339f1a5fdbf7
SHA512 (dotnet-arm64-prebuilts-2021-10-04.tar.gz) = e48a953e72ebd3591d26fdda5079c95638cd3611fe1c06fa2259dc20b81d7b8dc8890416f167e56292d7e6054ce9751ac3ce396c8a6e384ee748af4e30144d9c
SHA512 (dotnet-s390x-prebuilts-2021-10-01.tar.gz) = 780d6e769e026e798ec2006331eaa667aa480cce25eb8b827237e4ccdfc94e5a71f6b21b919ee947ef3b6456b351a7b05eedc15cf71fc40dab8fae8d5048d0c4

View File

@ -0,0 +1,33 @@
From b2c4b2427d8c1a2410c4210789caccf1ec87e64a Mon Sep 17 00:00:00 2001
From: Omair Majid <omajid@redhat.com>
Date: Thu, 9 Sep 2021 13:21:51 -0400
Subject: [PATCH] [ArPow] Use --work-tree with git apply
This makes things work better in a source-tarball build, where there may
be a .git directory somewhere in our parent directories but it's for a
different repo than vstest. In a situation like that a plain `git apply`
will (silently!) ignore patches because they wont apply to the unrelated
repository. That will (eventually) make the source-build fail.
`--work-tree` makes git directly use the directory that we care about.
See https://github.com/dotnet/source-build/issues/2445 for more details.
---
eng/SourceBuild.props | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/eng/SourceBuild.props b/eng/SourceBuild.props
index b365645c..68f82592 100644
--- a/eng/SourceBuild.props
+++ b/eng/SourceBuild.props
@@ -24,7 +24,7 @@
</ItemGroup>
<Exec
- Command="git apply --ignore-whitespace --whitespace=nowarn &quot;%(SourceBuildPatchFile.FullPath)&quot;"
+ Command="git --work-tree=&quot;$(InnerSourceBuildRepoRoot)&quot; apply --ignore-whitespace --whitespace=nowarn &quot;%(SourceBuildPatchFile.FullPath)&quot;"
WorkingDirectory="$(InnerSourceBuildRepoRoot)"
Condition="'@(SourceBuildPatchFile)' != ''" />
</Target>
--
2.31.1

View File

@ -0,0 +1,11 @@
--- a/eng/SourceBuild.props
+++ b/eng/SourceBuild.props
@@ -15,7 +15,7 @@
</ItemGroup>
<Exec
- Command="git apply --ignore-whitespace --whitespace=nowarn &quot;%(SourceBuildPatchFile.FullPath)&quot;"
+ Command="git --work-tree=&quot;$(RepoRoot)&quot; apply --ignore-whitespace --whitespace=nowarn &quot;%(SourceBuildPatchFile.FullPath)&quot;"
WorkingDirectory="$(RepoRoot)"
Condition="'@(SourceBuildPatchFile)' != ''" />
</Target>