user/dotnet6-build: new aport

This commit is contained in:
Antoine Martin 2023-02-21 23:48:17 -05:00
parent 1ab405f3e9
commit 2344a60d0e
Signed by: forge
GPG key ID: D62A472A4AA7D541
22 changed files with 2325 additions and 0 deletions

553
user/dotnet6-build/APKBUILD Normal file
View file

@ -0,0 +1,553 @@
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
# secfixes:
# 6.0.106-r0:
# - CVE-2022-30184
# 6.0.108-r0:
# - CVE-2022-34716
# 6.0.109-r0:
# - CVE-2022-38013
# 6.0.110-r0:
# - CVE-2022-41032
# 6.0.112-r0:
# - CVE-2022-41089
# 6.0.113-r0:
# - CVE-2023-21538
# 6.0.114-r0:
# - CVE-2023-21808
pkgname=dotnet6-build
pkgver=6.0.114
pkgrel=0
_gittag=v$pkgver
_giturl="https://github.com/dotnet/installer"
_testtag=4832cef147bac35fdd5c57275a795e683bba0bb8
_bunnytag=71880bd94711519f7b786248a88a827a401207a2
_patches="
aspnetcore_46735-set-known-good-runtimeid.patch
build_13378-arm-build.patch
build_14816-non-portable-build.patch
build_14816-stop-overriding-aspnetcore-version.patch
build_14816-update-portable-rid-logic.patch
build_disable-apphost.diff
check_rid-alpine-generation.diff
installer_13378-arm-build.patch
installer_14816-crossgen2-rid.patch
installer_14816-update-portable-rid-logic.patch
msbuild_optional-systemconfiguration.patch
msbuild_optional-systemsecurity.patch
roslyn_57003-mono-namedmutex.patch
runtime_76500-mono-musl-support.patch
runtime_82269-mono-thread-coop-undefine-fortify-source.patch
runtime_enable-system-libunwind.diff
runtime_lld-fix.patch
sdk_14239-add-zsh-compdef-completion-script.patch
sdk_telemetry-optout.patch
"
_pkgver_macro=${pkgver%.*}
_pkgver_prior=${pkgver%.*.*}
_pkgver_name=${_pkgver_macro//[.0]}
pkgdesc="The .NET $_pkgver_macro bootstrap"
arch="x86_64 aarch64 armv7 s390x"
url=https://dotnet.microsoft.com
license="MIT"
# hack for dotnetx-build to be able to pull itself for bootstrapping
provides="dotnet$_pkgver_name-bootstrap"
provider_priority=$_pkgver_prior
checkdepends="
babeltrace
binutils
coreutils
file
gawk
jq
lttng-tools
npm
procps
sed
strace
util-linux-misc
which
"
makedepends="
bash
clang
cmake
dotnet$_pkgver_name-bootstrap
dotnet$_pkgver_name-bootstrap-artifacts
dotnet$_pkgver_name-stage0
findutils
git
grep
icu-data-full
icu-dev
inetutils-syslogd
krb5-dev
libgit2-dev
libintl
libucontext-dev
libunwind-dev
libxml2-dev
libxml2-utils
linux-headers
lldb-dev
llvm-dev
lttng-ust-dev
nodejs
numactl-dev
openssl-dev
pigz
rsync
tar
xz
zlib-dev
"
case $CARCH in
s390x|x86) ;;
*) makedepends="$makedepends lld-dev";;
esac
subpackages="
dotnet$_pkgver_name-artifacts:artifacts:noarch
dotnet$_pkgver_name-sdk
dotnet$_pkgver_name-templates:templates:noarch
dotnet-zsh-completion:zshcomp:noarch
dotnet-bash-completion:bashcomp:noarch
dotnet-doc
netstandard21-targeting-pack:netstandard_targeting_pack:noarch
"
source="
https://lab.ilot.io/dotnet/installer/-/releases/$_gittag/downloads/tarball/dotnet-$_gittag.tar.xz
dotnet-testsuite-$_testtag.tar.gz::https://github.com/redhat-developer/dotnet-regular-tests/archive/$_testtag.tar.gz
dotnet-bunny-$_bunnytag.tar.gz::https://github.com/redhat-developer/dotnet-bunny/archive/$_bunnytag.tar.gz
$_patches
"
builddir="$srcdir"/dotnet-v$pkgver
_checkdir="$srcdir"/dotnet-bunny-${_bunnytag/v}
_testdir="$srcdir"/dotnet-regular-tests-$_testtag
_cli_root="$srcdir"/bootstrap
_nugetdir="$srcdir"/nuget-cache
_artifactsdir="$_cli_root"/artifacts
_libdir="/usr/lib"
# if true, then within pipeline environment, in which case send logs there
# to be scooped
if [ -d "$APORTSDIR/logs" ]; then
_logdir="$APORTSDIR"/logs/$pkgname
else
_logdir="$srcdir"/logs
fi
case $CARCH in
x86_64) _dotnet_arch="x64";;
aarch64) _dotnet_arch="arm64";;
armv7) _dotnet_arch="arm";;
armhf) _dotnet_arch="armv6";;
*) _dotnet_arch="$CARCH";;
esac
# Build doesn't set all the right executable bits for the right file types
_fix_executable() {
# add executable bit
find "$1" -type f \( \
-name 'apphost' -o \
-name 'singlefilehost' -o \
-name 'lib*so' \
\) \
-exec chmod +x '{}' \;
# remove executable bit
find "$1" -type f \( \
-name '*.a' -o \
-name '*.dll' -o \
-name '*.h' -o \
-name '*.json' -o \
-name '*.pdb' -o \
-name '*.props' -o \
-name '*.pubxml' -o \
-name '*.targets' -o \
-name '*.txt' -o \
-name '*.xml' \
\) \
-exec chmod -x '{}' \;
}
# generates tarball containing all components built by dotnet
snapshot() {
local _pkg="$srcdir"/${builddir##*/}.tar
ulimit -n 4096
export NUGET_PACKAGES=$_nugetdir
if [ -d "$srcdir" ]; then
cd "$srcdir"
else
mkdir -p "$srcdir" && cd "$srcdir"
fi
if [ -d "installer" ]; then
cd "$srcdir"/installer
else
git clone $_giturl --branch $_gittag && cd "$srcdir"/installer
fi
sed 's|<Exec Command="tar.*|<Exec Command="tar -cf $(TarballFilePath) -C $(TarballDir)/.. $([MSBuild]::MakeRelative($([System.IO.Path]::GetDirectoryName($(TarballDir))), $(TarballDir)))" />|' -i src/SourceBuild/Arcade/tools/SourceBuildArcadeTarball.targets
if [ -d "$_libdir/dotnet/bootstrap" ]; then
local _cli_root="$(find /usr/lib/dotnet/bootstrap/6.0* -maxdepth 0 -type d | sort -r | head -n 1)"
else
local _cli_root=""
fi
_InitializeDotNetCli="$_cli_root" DOTNET_INSTALL_DIR="$_cli_root" DotNetBuildFromSource=true ./build.sh \
/p:ArcadeBuildTarball=true \
/p:TarballDir=$builddir \
/p:TarballFilePath=$_pkg
msg "Compressing ${builddir##*/}.tar to $SRCDEST"
xz -T0 -9 -vv -e -c > "$SRCDEST"/${builddir##*/}.tar.xz < "$_pkg"
cd "$startdir"
abuild checksum
}
prepare() {
default_prepare
ulimit -n 4096
# check patches
msg "check_rid-alpine-generation.diff"
patch -p1 -d "$_testdir" -i "$srcdir"/check_rid-alpine-generation.diff
# Using system libunwind is broken on aarch64 and mono-based builds
# see https://github.com/dotnet/source-build/issues/2408,
case $CARCH in
x86_64)
msg "Using system libunwind"
patch -p1 -i "$srcdir"/runtime_enable-system-libunwind.diff
;;
esac
# For some reason, new s390x apphost isn't pulled, this disable it's use on s390x
case $CARCH in
s390x)
msg "Disabing use of apphost"
patch -p1 -i "$srcdir"/build_disable-apphost.diff
;;
esac
# links logfiles to pipeline logs for easy pickup in pipelines
mkdir -p "$_logdir" "$builddir"/artifacts
ln -s "$_logdir" "$builddir"/artifacts/logs
ln -s "$_logdir" "$builddir"/artifacts/log
for i in "$builddir"/src/*; do
if [ -f "$i" ]; then
continue
fi
mkdir -p "$_logdir"/${i##*\/} "$builddir"/src/${i##*\/}/artifacts
ln -s "$_logdir"/${i##*\/} "$builddir"/src/${i##*\/}/artifacts/log
done
# dotnet requires its bootstrap to be in a writable dir
msg "Setting up bootstrap"
local _bootstrapdir=$(find $_libdir/dotnet/bootstrap/$_pkgver_macro* -maxdepth 0 | sort -r | head -n 1)
if [ ! -d "$_cli_root" ]; then
cp -r "$_bootstrapdir" "$_cli_root"
fi
# ensure that dotnet does not download artifacts provided by dotnet-artifacts
rm -rf "$builddir"/packages/archive
}
build() {
msg "Building $pkgname-$pkgver"
ulimit -n 4096
# Disable use of LTTng as tracing on lttng <=2,13,0 is broken
# See https://github.com/dotnet/runtime/issues/57784.
if [ -f "/usr/lib/liblttng-ust.so.1 " ]; then
export DOTNET_LTTng=0
fi
# looks for most recent recent version of _artifactsdir
local _artifactsdir=$(find $_libdir/dotnet/artifacts/$_pkgver_macro* -maxdepth 0 | sort -r | head -n 1)
# ci args, else the output is forwarded to log files which isn't ideal in a
# pipeline environment, and build by defaults uses lots of space
local args="
/v:minimal
/p:LogVerbosity=minimal
/p:MinimalConsoleLogOutput=true
/p:CleanWhileBuilding=true
"
# disable use of crossgen on arches platforms where its unsupported (mono)
# or broken (armv7, aarch64)
case $CARCH in
x86|aarch64|armv7|armhf|s390x) local args="$args /p:CrossgenOutput=false /p:DISABLE_CROSSGEN=True";;
esac
# Sets TargetRid manually as dotnet cannot be trusted to reliably compute
# the machine's runtime ID between releases.
# shellcheck disable=SC2034
. /etc/os-release
local VERSION_ID_DOT="${VERSION_ID//[^.]}"
while [ ${#VERSION_ID_DOT} -gt 1 ]; do
local VERSION_ID="${VERSION_ID%.*}"
local VERSION_ID_DOT="${VERSION_ID//[^.]}"
done
local VERSION_ID_DASH="${VERSION_ID//[^_]}"
while [ ${#VERSION_ID_DASH} -ge 1 ]; do
local VERSION_ID="${VERSION_ID%_*}"
local VERSION_ID_DASH="${VERSION_ID//[^_]}"
done
local args="$args /p:TargetRid=$ID.$VERSION_ID-$_dotnet_arch"
./build.sh \
--with-sdk "$_cli_root" \
--with-packages "$_artifactsdir" \
-- $args
}
check() {
ulimit -n 4096
export NUGET_PACKAGES=$_nugetdir
# Tests timeout (in seconds)
local _tests_timeout=600
# Test suite disable flags
# following tests can only work after packaging step
local _disabled_tests="man-pages distribution-package bash-completion install-local release-version-sane"
# test broken on all but x86_64 and aarch64: no musl release for omnisharp
if [ "$CARCH" != "x86_64" ] && [ "$CARCH" != "aarch64" ]; then
local _disabled_tests="$_disabled_tests omnisharp"
fi
# test broken: permission issue on lxc / pipelines
local _disabled_tests="$_disabled_tests createdump-aspnet workload"
# liblttng-ust_sys-sdt.h: no 'NT_STAPSDT' on Alpine's lttng-ust package
# lttng: known issue, see https://github.com/dotnet/runtime/issues/57784
local _disabled_tests="$_disabled_tests liblttng-ust_sys-sdt.h lttng"
# {bundled,system}-libunwind: use system version on all but aarch64/armv7, as broken
# see https://github.com/redhat-developer/dotnet-regular-tests/issues/113
case $CARCH in
x86_64) local _disabled_tests="$_disabled_tests bundled-libunwind";;
*) local _disabled_tests="$_disabled_tests system-libunwind";;
esac
# publish-ready-to-run: broken due to crossgen2 nupkg on musl-arm64 / musl-arm platform being broken
# should be fixed with https://github.com/dotnet/runtime/pull/66814
case $CARCH in
aarch64|armv7) local _disabled_tests="$_disabled_tests publish-ready-to-run publish-ready-to-run-linux";;
esac
msg "Unpacking produced dotnet"
export DOTNET_ROOT="$_checkdir/release"
if [ ! -d "$DOTNET_ROOT" ]; then
mkdir -p "$DOTNET_ROOT"
tar --use-compress-program="pigz" \
-xf "$builddir"/artifacts/$_dotnet_arch/Release/dotnet-sdk-$_pkgver_macro*.tar.gz \
-C "$DOTNET_ROOT" \
--no-same-owner
fi
export PATH="$DOTNET_ROOT:$PATH"
# some files either should or should not have executable bits
# (done again during packaging - this is for tests)
_fix_executable "$DOTNET_ROOT"
msg "Building turkey test suite"
mkdir "$_logdir"/check
if [ ! -d "$_checkdir"/turkey ]; then
cd "$_checkdir"/Turkey
dotnet publish -bl:$_logdir/check/turkey.binlog -f netcoreapp3.1 -c Release -p:VersionPrefix=1 -p:VersionSuffix="$(git rev-parse --short HEAD)" -o "$_checkdir"/turkey
fi
msg "Running test suite"
cd "$_testdir"
for i in $_disabled_tests; do
if [ -d "$i" ]; then
sed -i 's|"enabled": true|"enabled": false|' $i/test.json
fi
done
dotnet "$_checkdir"/turkey/Turkey.dll -t $_tests_timeout -l "$_logdir"/check || local ERROR=true
if [ $ERROR ]; then
msg "Check error reported"
fi
}
package() {
# directory creation
install -dm 755 \
"$pkgdir"/$_libdir/dotnet/bootstrap/$pkgver \
"$pkgdir"/usr/share/man/man1 \
"$pkgdir"/$_libdir/dotnet/artifacts/$pkgver
# unpack sdk to bootstrap
tar --use-compress-program="pigz" \
-xf "$builddir"/artifacts/$_dotnet_arch/Release/dotnet-sdk-$_pkgver_macro*.tar.gz \
-C "$pkgdir"/$_libdir/dotnet/bootstrap/$pkgver/ \
--no-same-owner
# extract arch-specific artifacts to artifacts dir for use by future dotnet builds
tar --use-compress-program="pigz" \
-xf "$builddir"/artifacts/$_dotnet_arch/Release/Private.SourceBuilt.Artifacts.*.tar.gz \
-C "$pkgdir"/$_libdir/dotnet/artifacts/$pkgver/ \
--no-same-owner \
--wildcards \
'*alpine*'
# assemble docs
find "$builddir" -iname 'dotnet*.1' -type f -exec cp '{}' "$pkgdir"/usr/share/man/man1/. \;
# some files either should or should not have executable bits
_fix_executable "$pkgdir"
# Disable use of LTTng as tracing on lttng <=2,13,0 is broken
# See https://github.com/dotnet/runtime/issues/57784.
if [ -f "/usr/lib/liblttng-ust.so.1 " ]; then
rm "$pkgdir"/$_libdir/dotnet/bootstrap/*/shared/Microsoft.NETCore.App/*/libcoreclrtraceptprovider.so
fi
}
sdk() {
pkgdesc="The .NET $_pkgver_macro SDK"
depends="
aspnetcore$_pkgver_name-runtime
aspnetcore$_pkgver_name-targeting-pack
dotnet$_pkgver_name-apphost-pack
dotnet$_pkgver_name-targeting-pack
dotnet$_pkgver_name-templates
netstandard21-targeting-pack
"
provides="
dotnet-sdk-$_pkgver_macro=$pkgver-r$pkgrel
dotnet$_pkgver_name-dev=$pkgver-r$pkgrel
"
install -dm 755 "$subpkgdir"/$_libdir/dotnet
# sdk
tar --use-compress-program="pigz" \
-xf "$builddir"/artifacts/$_dotnet_arch/Release/dotnet-sdk-$_pkgver_macro*.tar.gz \
-C "$subpkgdir"/$_libdir/dotnet/ \
--no-same-owner \
./sdk ./sdk-manifests
# some files either should or should not have executable bits
_fix_executable "$subpkgdir"
# See https://github.com/dotnet/source-build/issues/2579
find "$subpkgdir" -type f -name 'testhost.x86' -delete
find "$subpkgdir" -type f -name 'vstest.console' -delete
}
netstandard_targeting_pack() {
pkgdesc="The .NET 2.1 Standard targeting pack"
depends="dotnet-host"
provides="netstandard-targeting-pack-2.1=$pkgver-r$pkgrel"
install -dm 755 "$subpkgdir"/$_libdir/dotnet/packs
tar --use-compress-program="pigz" \
-xf "$builddir"/artifacts/$_dotnet_arch/Release/dotnet-sdk-$_pkgver_macro*.tar.gz \
-C "$subpkgdir"/$_libdir/dotnet/ \
--no-same-owner \
./packs/NETStandard.Library.Ref
# some files either should or should not have executable bits
_fix_executable "$subpkgdir"
}
templates() {
pkgdesc="The .NET $_pkgver_macro templates"
depends="dotnet-host"
provides="dotnet-templates-$_pkgver_macro=$pkgver-r$pkgrel"
install -dm 755 "$subpkgdir"/$_libdir/dotnet
tar --use-compress-program="pigz" \
-xf "$builddir"/artifacts/$_dotnet_arch/Release/dotnet-sdk-$_pkgver_macro*.tar.gz \
-C "$subpkgdir"/$_libdir/dotnet/ \
--no-same-owner \
./templates
# some files either should or should not have executable bits
_fix_executable "$subpkgdir"
}
artifacts() {
pkgdesc="Internal package for building .NET $_pkgver_macro Software Development Kit"
# hack to allow artifacts to pull itself
provides="dotnet$_pkgver_name-bootstrap-artifacts"
provider_priority=$_pkgver_prior
# directory creation
install -dm 755 \
"$subpkgdir"/$_libdir/dotnet/artifacts/$pkgver \
"$subpkgdir"/usr/share/licenses
# extract arch-agnostic artifacts to artifacts dir for use by future dotnet builds
tar --use-compress-program="pigz" \
-xf "$builddir"/artifacts/$_dotnet_arch/Release/Private.SourceBuilt.Artifacts.*.tar.gz \
-C "$subpkgdir"/$_libdir/dotnet/artifacts/$pkgver/ \
--no-same-owner \
--exclude '*Intermediate*' \
--exclude '*alpine*'
}
zshcomp() {
depends=""
pkgdesc="zsh completion for .NET"
# netstandard21-targeting-pack will always be pulled by any dotnetx-sdk
# thus pulling this with it for sdk
install_if="netstandard21-targeting-pack zsh"
depends="dotnet-host"
install -dm 755 "$subpkgdir"/usr/share/zsh/site-functions
install -m 755 "$builddir"/src/sdk/scripts/register-completions.zsh "$subpkgdir"/usr/share/zsh/site-functions/_dotnet
}
bashcomp() {
depends=""
pkgdesc="bash completion for .NET"
# netstandard21-targeting-pack will always be pulled by any dotnetx-sdk
# thus pulling this with it for sdk
install_if="netstandard21-targeting-pack bash-completion"
depends="dotnet-host"
install -dm 755 "$subpkgdir"/usr/share/bash-completion/completions
install -m 755 "$builddir"/src/sdk/scripts/register-completions.bash "$subpkgdir"/usr/share/bash-completion/completions/_dotnet
}
doc() {
default_doc
pkgdesc="Docs for .NET"
# licenses
install -dm 755 "$subpkgdir"/usr/share/licenses/dotnet
tar --use-compress-program="pigz" \
-xf "$builddir"/artifacts/$_dotnet_arch/Release/dotnet-sdk-$_pkgver_macro*.tar.gz \
-C "$subpkgdir"/usr/share/licenses/dotnet/ \
--no-same-owner \
./LICENSE.txt ./ThirdPartyNotices.txt
}
sha512sums="
2c01c7b2de4d47d4125717e1240b4822af8b07336d48d87cbc0521fc1b7245672ded01021ad9cdba476b8aa519c4376f40ee1654254e687bef07df9872a3476d dotnet-v6.0.114.tar.xz
994e5145653698551408a87e34d19368e85a2531af9e2bfe61b903af0f016bfd5e4a7691795bdf09ba74bf6f41fc666973ee8cfde9088738f9a2f83f4bafa5e4 dotnet-testsuite-4832cef147bac35fdd5c57275a795e683bba0bb8.tar.gz
fc281df5fcf0d31dc9ff7f5b0e870960cfbe3c4fa0f6a6bb50b22c4ee18d2c608c827205bc79bd7f686d77ac917582fc26f68432cdd86c4a33b910c0c7416d09 dotnet-bunny-71880bd94711519f7b786248a88a827a401207a2.tar.gz
5a46a1ac9f70c378c7193275de399d7c7c235c5c7da7e76d0b44ff380ae1df3f3724cebc9c430157606c545bb3aa6d321d0e7d6702f9c4d8e74c901d394a6c51 aspnetcore_46735-set-known-good-runtimeid.patch
6e9663f466007fc5fa7010e6859f054b6a4e59affa7aae7fd4d9ab4ba8410d4855b680f58f938ad21d0b3d2a7c7b097c7e9494a4dde2c43478ddddbf37539545 build_13378-arm-build.patch
bdbe798add3ded0c2cf361c9f5aa18fb3540e348e68a5695cbdb797be917f06d1bda69855cae2f36950e9506119e81165927787e13b80a17a1b647ef2c221916 build_14816-non-portable-build.patch
3e04fff2d9d9b39ac4dce0b80f4b566fff8819313a5bf1df791e8f1a63a26ef882bd8aa1524344f63fbb4a3728077179b7f1d7ebefc003c236d39a48beaa0073 build_14816-stop-overriding-aspnetcore-version.patch
70d402d0bcaa98c8b09652365404238b67ed26eb9c3d510c7d6309fb61937d98c9144f1096e521c11b00e946d29585a9d474498ccc5223de32bd6471ab5a431f build_14816-update-portable-rid-logic.patch
a5a359af816595fbf19482e5dccf874c78d2fc4b59f38223118aac603b33e00c9fed22580eee3112519477205c2c8ed16177d100f09f45275e3da3c20b0ed7f7 build_disable-apphost.diff
941b430b55e323f723bbc5160447f060f40d18ce32e5803ab7dda16bfc60a0f5ec1dccd246e68475d7115ee265a9433824d8a5d997c302531311194a90deeca9 check_rid-alpine-generation.diff
23b712d7a088e780cd0994c5577b4c015cc1478e3a6bbca9b6e97ff2f2711562ef3a01ed483582a6861b31989b949972e2159caa4a34e0b18b6e8c062bb82c9e installer_13378-arm-build.patch
7ffda90d766217e7c3756ebd423b557218c24f5337668b319421514945d3f961d82037c997b7254de088b1853102d7de15e0d824cf2cc02a6c455efc2b0107a2 installer_14816-crossgen2-rid.patch
e71f91d14873755bc2f227807d909e5260bd1f166a262eda0bf05d4a3975a7bce7fde457c1eba476a83b317aebdaaba25f1893d3385182428c08bba6243f21c8 installer_14816-update-portable-rid-logic.patch
86e14ecc0269c8b2c2a2a679790de4fa4e15ac06b2a831e1129c4a7de1499d60583fcdc79b3705652c3c4ced73afac2e0ee3edce2cfa3b00fddf94180fb26e10 msbuild_optional-systemconfiguration.patch
f4d27624f735ce77e0030fa791594fc12fb325a3ce8620791a7856bd5c0067a042df2196ec97ed4d0309db64bd51e6a48cafaad316d9ea45e34134214a7f3ca4 msbuild_optional-systemsecurity.patch
42779a7bf1004fe0f7054cfa4f09f49d7f2a57c0543ec994ffbd54fb349abb508295476098ed35d60e9676be8bcc15aa8a9ec5c814cd1e058357530b5cdfb2b6 roslyn_57003-mono-namedmutex.patch
e67e0114bd324dae65eb19f6fa8c74414bee77cd30e299931b0d82b4ca1b6b6f88358a0c47ffb180f46c5cb28f61f79bb4a59d43c1ae3011bfe491e757de293a runtime_76500-mono-musl-support.patch
827e899a83103f666dc3d57c1ec695bebc659a574f4a1d754da0cafe8c18d7db79c3950267e905fa078f94612ee1101fbddd0ea62b3c08947d8bcd7d9c8de41c runtime_82269-mono-thread-coop-undefine-fortify-source.patch
91f237afe642d0170dbf0e9a2706a4145c937d9d869d22959acaf092f1fd11941144b2b1d041102abe7b70349dd5869d558896e9d13d01f176cace39b21ef1ef runtime_enable-system-libunwind.diff
5f465f6e3bfbff66551a5690eb41be46735f8e0b1e6e6503038521a8cc60cd66b7839426319ec304f785c9f074ef588b1f189ad6dbb6ced53257af28b09388f2 runtime_lld-fix.patch
d1b4ebcbb1a6815fc0ce4c471485c232618e60968a879309fb8336821a9351d2e0028d9f7726c0c041c750b497a0baa47400c78c9ceff550b91b4a6c2816fc41 sdk_14239-add-zsh-compdef-completion-script.patch
815de1dad37412579b16d763debe2ecceffb44f5c46bd3f4ac00b3e431b20c677db435794eac41cea5601030b4e0f03f19e2d53c7a1ead896de2ffbca787eb84 sdk_telemetry-optout.patch
"

View file

@ -0,0 +1,131 @@
# dotnet6-build
This is the .NET 6.0 package for Alpine Linux.
Please report any issues [using Gitlab](https://gitlab.alpinelinux.org/alpine/aports/-/issues/new) and tag @ayakael
# Building info
## Generated packages
* dotnet6-build (aimed for internal use as bootstrap)
* dotnet6-build-artifacts (aimed for internal use as bootstrap)
* dotnet6-sdk
* dotnet6-templates (required by sdk)
* dotnet-zsh-completion
* dotnet-bash-completion
* dotnet-doc
* netstandard21-targeting-pack
## How to build dotnet6 on Alpine
As dotnet is a self-hosting compiler (thus it compiles using itself), it requires a bootstrap
for the initial build. To solve this problem, this package follows the `stage0` proposal
outlined [here](https://lists.alpinelinux.org/~alpine/devel/%3C33KG0XO61I4IL.2Z7RTAZ5J3SY6%408pit.net%3E)
The goal of `stage0` is to bootstrap dotnet with as little intervention as possible, thus allowing
seamless Alpine upgrades. Unfortunately, upstream only builds bootstraps for Alpine on `x86_64`,
`aarch64`, and `armv7`. Thus, `dotnet6-cross`, a non-standard (read: never to be included in aports) aport, was created to
faciliate cross-compiling bootstraps from `x86_64` to other dotnet supported platforms.
It is [available here](https://gitlab.alpinelinux.org/ayakael/dotnet6-cross)
In summary, dotnet6 is built using four different aports, three of which are in aports proper:
* `dotnet6-cross` [available here](https://gitlab.alpinelinux.org/ayakael/dotnet6-cross)
Builds minimum components for dotnet6, and packages these in a tar.gz that `dotnet6-stage0` then uses to build full bootstrap.
* `community/dotnet6-stage0`
Builds full bootstrap for dotnet6, and packages these in an initial `dotnet6-stage0-bootstrap` package that `dotnet6-build`
pulls if `dotnet6-build` has not been built before.
* `community/dotnet6-build
Builds full and packages dotnet6 fully using either stage0 or previoulsy built dotnet6 build.
* `community/dotnet6-runtime
As abuild does not allow different versions for subpackages, a different aport is required to
package runtime bits from dotnet6-build.
# Specification
This package follows [package naming and contents suggested by upstream](https://docs.microsoft.com/en-us/dotnet/core/build/distribution-packaging),
with two exceptions. It installs dotnet to `/usr/lib/dotnet` (aka `$_libdir`).
In addition, the package is named `dotnet6` as opposed to `dotnet-6.0`
to match Alpine Linux naming conventions for packages with many installable versions
# Contributing
The steps below are for the final package. Please only contribute to a
pre-release version if you know what you are doing. Original instructions
follow.
## General Changes
1. Fork the main aports repo.
2. Checkout the forked repository.
- `git clone ssh://git@gitlab.alpinelinux.org/$USER/aports
- `cd community/dotnet6-build`
3. Make your changes. Don't forget to add a changelog.
4. Do local builds.
- `abuild -r`
5. Fix any errors that come up and rebuild until it works locally.
6. Commit the changes to the git repo in a git branch
- `git checkout -b dotnet6/<name>`
- `git add` any new patches
- `git remove` any now-unnecessary patches
- `git commit -m 'community/dotnet6-build: descriptive description'`
- `git push`
7. Create a merge request with your changes, tagging @ayakael for review.
8. Once the tests in the pull-request pass, and reviewers are happy, your changes
will be merged.
## Updating to an new upstream release
1. Fork the main aports repo.
2. Checkout the forked repository.
- `git clone ssh://git@gitlab.alpinelinux.org/$USER/aports
- `cd community/dotnet6-build`
3. Build the new upstream source tarball. Update the versions in the
APKBUILD file, and then create a snapshot. After build, update checksum.
- `abuild snapshot`
- `abuild checksum`
4. Do local builds.
- `abuild -r`
5. Fix any errors that come up and rebuild until it works locally. Any
patches that are needed at this point should be added to the APKBUILD file
in `_patches` variable.
6. Upload the source archive to a remote location, and update `source` variable.
7. Commit the changes to the git repo in a git branch.
- `git checkout -b dotnet6/<name>`
- `git add` any new patches
- `git remove` any now-unnecessary patches
- `git commit -m 'community/dotnet6-build: upgrade to <new-version>`
- `git push`
8. Create a merge request with your changes, tagging @ayakael for review.
9. Once the tests in the pull-request pass, and reviewers are happy, your changes
will be merged.
# Testing
This package uses CI tests as defined in `check()` function. Creating a
merge-request or running a build will fire off tests and flag any issues.
The tests themselves are contained in this external repository:
https://github.com/redhat-developer/dotnet-regular-tests/

View file

@ -0,0 +1,34 @@
From 4f21dd6d62c740e2cc2557bbc5d6c2f2653a5612 Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/aspnetcore/pull/46735
From: Antoine Martin <dev@ayakael.net>
Date: Wed, 9 Mar 2022 08:17:41 +0000
Subject: [PATCH 1/1] arm build
Forgotten backport from https://github.com/dotnet/aspnetcore/pull/43937.
Without this, aspnetcore does not properly ingest new RIDs generated by runtime
---
diff --git a/src/aspnetcore/eng/tools/GenerateFiles/Directory.Build.targets.in b/src/aspnetcore/eng/tools/GenerateFiles/Directory.Build.targets.in
index 5e693b6d7c..500113ea46 100644
--- a/src/aspnetcore/eng/tools/GenerateFiles/Directory.Build.targets.in
+++ b/src/aspnetcore/eng/tools/GenerateFiles/Directory.Build.targets.in
@@ -42,6 +42,18 @@
<RuntimePackRuntimeIdentifiers Condition=" '$(PortableBuild)' == 'false' ">$(TargetRuntimeIdentifier)</RuntimePackRuntimeIdentifiers>
</KnownFrameworkReference>
+ <KnownAppHostPack Update="Microsoft.NETCore.App">
+ <AppHostPackVersion
+ Condition=" '%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' ">${MicrosoftNETCoreAppRuntimeVersion}</AppHostPackVersion>
+ <AppHostRuntimeIdentifiers Condition=" '$(PortableBuild)' == 'false' ">$(TargetRuntimeIdentifier)</AppHostRuntimeIdentifiers>
+ </KnownAppHostPack>
+
+ <KnownRuntimePack Update="Microsoft.NETCore.App">
+ <LatestRuntimeFrameworkVersion
+ Condition=" '%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' ">${MicrosoftNETCoreAppRuntimeVersion}</LatestRuntimeFrameworkVersion>
+ <AppHostRuntimeIdentifiers Condition=" '$(PortableBuild)' == 'false' ">$(TargetRuntimeIdentifier)</AppHostRuntimeIdentifiers>
+ </KnownRuntimePack>
+
<KnownCrossgen2Pack Update="Microsoft.NETCore.App.Crossgen2" Condition=" '$(PortableBuild)' == 'false' ">
<Crossgen2PackVersion
Condition=" '%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' ">${MicrosoftNETCoreAppRuntimeVersion}</Crossgen2PackVersion>

View file

@ -0,0 +1,71 @@
From 75c3e74ea35219f257c80daf9a236e0f518a7875 Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/installer/pull/13378
From: Antoine Martin <dev@ayakael.net>
Date: Wed, 9 Mar 2022 20:16:03 +0000
Subject: [PATCH 1/1] arm support
By default, build does not support arm. This patch introduces all the logics
to parse platform information.
---
Directory.Build.props | 2 +-
repos/known-good.proj | 2 +-
repos/runtime.common.props | 2 +-
tools-local/init-build.proj | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/Directory.Build.props b/Directory.Build.props
index 61cc6ff67..d921eda93 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -17,7 +17,7 @@
<PropertyGroup>
<Platform Condition="'$(Platform)' == 'AnyCPU'"></Platform>
<BuildArchitecture>$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant())</BuildArchitecture>
- <Platform Condition="'$(Platform)' == '' AND '$(BuildArchitecture)' == 'arm64'">$(BuildArchitecture)</Platform>
+ <Platform Condition="'$(Platform)' == '' AND ( '$(BuildArchitecture)' == 'arm64' OR '$(BuildArchitecture)' == 'arm') ">$(BuildArchitecture)</Platform>
<Platform Condition="'$(Platform)' == '' AND '$(BuildArchitecture)' == 's390x'">$(BuildArchitecture)</Platform>
<Platform Condition="'$(Platform)' == ''">x64</Platform>
diff --git a/repos/known-good.proj b/repos/known-good.proj
index eab516290..c04cdac70 100644
--- a/repos/known-good.proj
+++ b/repos/known-good.proj
@@ -18,7 +18,7 @@
<RepositoryReference Include="runtime" />
</ItemGroup>
</When>
- <When Condition="$(Platform.Contains('arm')) AND '$(BuildArchitecture)' != 'arm64'">
+ <When Condition="$(Platform.Contains('arm')) AND '$(BuildArchitecture)' != 'arm64' AND '$(BuildArchitecture)' != 'arm'">
<ItemGroup>
<RepositoryReference Include="runtime" />
</ItemGroup>
diff --git a/repos/runtime.common.props b/repos/runtime.common.props
index b1e9e6adb..037c3d94a 100644
--- a/repos/runtime.common.props
+++ b/repos/runtime.common.props
@@ -13,7 +13,7 @@
<BuildCommandArgs>$(StandardSourceBuildArgs.Replace('-bl', '-nobl'))</BuildCommandArgs>
<BuildCommand>$(StandardSourceBuildCommand) $(BuildCommandArgs)</BuildCommand>
- <BuildCommand Condition="$(Platform.Contains('arm')) AND '$(BuildArchitecture)' != 'arm64'">$(ArmEnvironmentVariables) $(StandardSourceBuildCommand) $(BuildCommandArgs)</BuildCommand>
+ <BuildCommand Condition="$(Platform.Contains('arm')) AND '$(BuildArchitecture)' != 'arm64' AND '$(BuildArchitecture)' != 'arm'">$(ArmEnvironmentVariables) $(StandardSourceBuildCommand) $(BuildCommandArgs)</BuildCommand>
<CleanCommand>$(ProjectDirectory)/clean$(ShellExtension)</CleanCommand>
</PropertyGroup>
diff --git a/tools-local/init-build.proj b/tools-local/init-build.proj
index 701f76c0c..b2c3beed1 100644
--- a/tools-local/init-build.proj
+++ b/tools-local/init-build.proj
@@ -138,7 +138,7 @@
</Target>
<Target Name="GenerateRootFs" Condition="'$(OS)' != 'Windows_NT'">
- <Exec Condition="$(Platform.Contains('arm')) AND '$(Platform)' != 'armel' AND '$(BuildArchitecture)' != 'arm64'" Command="$(ArmEnvironmentVariables) $(ProjectDir)cross/build-rootfs.sh" />
+ <Exec Condition="$(Platform.Contains('arm')) AND '$(Platform)' != 'armel' AND '$(BuildArchitecture)' != 'arm64' AND '$(BuildArchitecture)' != 'arm'" Command="$(ArmEnvironmentVariables) $(ProjectDir)cross/build-rootfs.sh" />
<Exec Condition="'$(Platform)' == 'armel'" Command="$(ArmEnvironmentVariables) $(ProjectDir)cross/armel/tizen-build-rootfs.sh" />
</Target>
--
2.35.1

View file

@ -0,0 +1,208 @@
From 3008f7ef29e0a5593f6f0afbdc9343f573f1a375 Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/installer/pull/14816
From: Antoine Martin <dev@ayakael.net>
Date: Tue, 15 Nov 2022 01:04:07 -0500
Subject: [PATCH 1/3] Eliminate runtime portable build (backport dotnet#14549)
---
.../tarball/content/Directory.Build.props | 8 --
.../tarball/content/repos/aspnetcore.proj | 1 +
.../tarball/content/repos/installer.proj | 2 +-
.../tarball/content/repos/known-good.proj | 1 -
.../content/repos/runtime-portable.proj | 47 -----------
.../content/repos/runtime.common.props | 43 ----------
.../content/repos/runtime.common.targets | 46 -----------
.../tarball/content/repos/runtime.proj | 82 ++++++++++++++++++-
.../source-build-reference-packages.proj | 4 +-
src/redist/targets/Crossgen.targets | 2 +-
src/redist/targets/GenerateLayout.targets | 3 +
11 files changed, 88 insertions(+), 151 deletions(-)
delete mode 100644 repos/runtime-portable.proj
delete mode 100644 repos/runtime.common.props
delete mode 100644 repos/runtime.common.targets
diff --git a/Directory.Build.props b/Directory.Build.props
index 61cc6ff67..2e2d7e8bc 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -22,14 +22,6 @@
<Platform Condition="'$(Platform)' == ''">x64</Platform>
<UseStableVersions Condition="'$(UseStableVersions)' == ''">false</UseStableVersions>
-
- <!-- new supported portable/nonportable options. These control whether to build portable runtime
- or portable SDK. The PortableBuild flag is only set in runtime-portable.proj and should
- no longer be passed in. -->
- <BuildPortableRuntime Condition="'$(BuildPortableRuntime)' == ''">false</BuildPortableRuntime>
- <BuildPortableSdk Condition="'$(BuildPortableSdk)' == ''">false</BuildPortableSdk>
- <UseSystemLibraries Condition="'$(UseSystemLibraries)' == '' AND '$(PortableRuntime)' != 'true'">true</UseSystemLibraries>
- <UseSystemLibraries Condition="'$(UseSystemLibraries)' == ''">false</UseSystemLibraries>
</PropertyGroup>
<!-- This repo's projects are entirely infrastructure and do not ship. -->
diff --git a/repos/aspnetcore.proj b/repos/aspnetcore.proj
index 480f3c713..52243024a 100644
--- a/repos/aspnetcore.proj
+++ b/repos/aspnetcore.proj
@@ -9,6 +9,7 @@
<BuildCommandArgs>$(BuildCommandArgs) --no-build-repo-tasks</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:BuildNodeJs=false</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:PublishCompressedFilesPathPrefix=$(SourceBuiltAspNetCoreRuntime)</BuildCommandArgs>
+ <BuildCommandArgs>$(BuildCommandArgs) /p:PortableBuild=false /p:TargetRuntimeIdentifier=$(TargetRid)</BuildCommandArgs>
<!-- Update to 1.0.0 version of reference assemblies which are built in SBRP instead of the preview.2 version
included by Arcade -->
<BuildCommandArgs>$(BuildCommandArgs) /p:MicrosoftNetFrameworkReferenceAssembliesVersion=1.0.0</BuildCommandArgs>
diff --git a/repos/installer.proj b/repos/installer.proj
index e34337b85..6c08a1f67 100644
--- a/repos/installer.proj
+++ b/repos/installer.proj
@@ -25,7 +25,7 @@
<BuildCommandArgs Condition="'$(TargetOS)' == 'Linux'">$(BuildCommandArgs) /p:Rid=$(TargetRid)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:DOTNET_INSTALL_DIR=$(DotNetCliToolDir)</BuildCommandArgs>
- <BuildCommandArgs Condition="'$(TargetOS)' == 'Linux'">$(BuildCommandArgs) /p:AspNetCoreInstallerRid=linux-$(Platform)</BuildCommandArgs>
+ <BuildCommandArgs Condition="'$(TargetOS)' == 'Linux'">$(BuildCommandArgs) /p:AspNetCoreInstallerRid=$(TargetRid)</BuildCommandArgs>
<!-- core-sdk always wants to build portable on OSX and FreeBSD -->
<BuildCommandArgs Condition="'$(TargetOS)' == 'FreeBSD'">$(BuildCommandArgs) /p:CoreSetupRid=freebsd-x64 /p:PortableBuild=true</BuildCommandArgs>
<BuildCommandArgs Condition="'$(TargetOS)' == 'OSX'">$(BuildCommandArgs) /p:CoreSetupRid=osx-x64</BuildCommandArgs>
diff --git a/repos/known-good.proj b/repos/known-good.proj
index eab516290..12d9943da 100644
--- a/repos/known-good.proj
+++ b/repos/known-good.proj
@@ -44,7 +44,6 @@
<!-- Tier 2 -->
<RepositoryReference Include="linker" />
<RepositoryReference Include="msbuild" />
- <RepositoryReference Include="runtime-portable" />
<RepositoryReference Include="runtime" />
<RepositoryReference Include="templating" />
diff --git a/repos/runtime.proj b/repos/runtime.proj
index f3ed143f8..efd8b66fa 100644
--- a/repos/runtime.proj
+++ b/repos/runtime.proj
@@ -1,18 +1,53 @@
<Project>
- <Import Project="runtime.common.props"/>
+ <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
+ <!-- Build arguments -->
<PropertyGroup>
+ <LogVerbosityOptOut>true</LogVerbosityOptOut>
+
+ <CleanCommand>$(ProjectDirectory)/clean$(ShellExtension)</CleanCommand>
+
<OverrideTargetRid>$(TargetRid)</OverrideTargetRid>
<OverrideTargetRid Condition="'$(TargetOS)' == 'OSX'">osx-x64</OverrideTargetRid>
<OverrideTargetRid Condition="'$(TargetOS)' == 'FreeBSD'">freebsd-x64</OverrideTargetRid>
<OverrideTargetRid Condition="'$(TargetOS)' == 'Windows_NT'">win-x64</OverrideTargetRid>
+ <_platformIndex>$(NETCoreSdkRuntimeIdentifier.LastIndexOf('-'))</_platformIndex>
+ <RuntimeOS>$(NETCoreSdkRuntimeIdentifier.Substring(0, $(_platformIndex)))</RuntimeOS>
+
+ <_platformIndex>$(NETCoreSdkPortableRuntimeIdentifier.LastIndexOf('-'))</_platformIndex>
+ <BaseOS>$(NETCoreSdkPortableRuntimeIdentifier.Substring(0, $(_platformIndex)))</BaseOS>
+
<BuildCommandArgs>$(StandardSourceBuildArgs)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:TargetRid=$(OverrideTargetRid)</BuildCommandArgs>
+ <BuildCommandArgs>$(BuildCommandArgs) /p:RuntimeOS=$(RuntimeOS)</BuildCommandArgs>
+ <BuildCommandArgs>$(BuildCommandArgs) /p:BaseOS=$(BaseOS)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:SourceBuildNonPortable=true</BuildCommandArgs>
<BuildCommand>$(StandardSourceBuildCommand) $(BuildCommandArgs)</BuildCommand>
</PropertyGroup>
+ <!-- Output / source-build flags -->
+ <PropertyGroup>
+ <GlobalJsonFile>$(ProjectDirectory)global.json</GlobalJsonFile>
+ <NuGetConfigFile>$(ProjectDirectory)NuGet.config</NuGetConfigFile>
+ <OutputPlacementRepoApiImplemented>false</OutputPlacementRepoApiImplemented>
+ <DependencyVersionInputRepoApiImplemented>true</DependencyVersionInputRepoApiImplemented>
+ </PropertyGroup>
+
+ <!-- SDK Overrides -->
+ <ItemGroup>
+ <UseSourceBuiltSdkOverride Include="@(ArcadeSdkOverride)" />
+ <UseSourceBuiltSdkOverride Include="@(ArcadeCoreFxTestingOverride)" />
+ <UseSourceBuiltSdkOverride Include="@(ArcadePackagingOverride)" />
+ <UseSourceBuiltSdkOverride Include="@(ArcadeTargetFrameworkSdkOverride)" />
+ <UseSourceBuiltSdkOverride Include="@(ArcadeSharedFrameworkSdkOverride)" />
+ </ItemGroup>
+
+ <!-- Environment Variables -->
+ <ItemGroup>
+ <EnvironmentVariables Include="BuildInParallel=false" />
+ </ItemGroup>
+
<!-- Repository References -->
<ItemGroup>
<RepositoryReference Include="arcade" />
@@ -20,8 +55,49 @@
<RepositoryReference Include="linker" />
<RepositoryReference Include="source-build" />
<RepositoryReference Include="roslyn" />
- <RepositoryReference Include="runtime-portable" />
</ItemGroup>
- <Import Project="runtime.common.targets" />
+ <UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="AddRidToRuntimeJson" />
+ <UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="PublishCoreSetupBinaries" />
+
+ <Target Name="SetOutputList" AfterTargets="Package" BeforeTargets="GatherBuiltPackages">
+ <ItemGroup>
+ <PackagesOutputList Include="$(ShippingPackagesOutput)" />
+ <PackagesOutputList Include="$(NonShippingPackagesOutput)" />
+ </ItemGroup>
+ </Target>
+
+ <Target Name="UpdateRuntimeGraph"
+ BeforeTargets="Build"
+ Condition="'$(_IsBootstrapping)' == 'true'">
+ <PropertyGroup>
+ <RuntimeJsonFile>$(ProjectDirectory)pkg/Microsoft.NETCore.Platforms/runtime.json</RuntimeJsonFile>
+ </PropertyGroup>
+
+ <Message Importance="High" Text="Adding rid, $(TargetRid), to $(RuntimeJsonFile)" />
+ <AddRidToRuntimeJson RuntimeJson="$(RuntimeJsonFile)"
+ Rid="$(TargetRid)-$(Platform)" />
+ </Target>
+
+ <Target Name="CopyBinariesToBinFolder"
+ AfterTargets="ExtractIntermediatePackages"
+ Inputs="$(MSBuildProjectFullPath)"
+ Outputs="$(RepoCompletedSemaphorePath)CopyBinariesToBinFolder.complete">
+ <ItemGroup>
+ <_builtRuntimePackages Include="$(SourceBuiltAssetsDir)*.symbols.nupkg" />
+ <_builtRuntimePackages>
+ <TransformedFileName>$([System.String]::Copy('%(FileName)').Replace('symbols', 'nupkg'))</TransformedFileName>
+ </_builtRuntimePackages>
+ <BinariesToCopy Include="$(SourceBuiltAssetsDir)*.*" Exclude="$(SourceBuiltAssetsDir)*.nupkg;$(SourceBuiltAssetsDir)*.requires_nupkg_signing" />
+ <BinariesToCopy Include="@(_builtRuntimePackages->'$(SourceBuiltPackagesPath)%(TransformedFileName)')" />
+ </ItemGroup>
+
+ <Copy SourceFiles="@(BinariesToCopy)"
+ DestinationFolder="$(OutputPath)runtime"
+ Condition="'@(BinariesToCopy)'!=''" />
+
+ <WriteLinesToFile File="$(RepoCompletedSemaphorePath)CopyBinariesToBinFolder.complete" Overwrite="true" />
+ </Target>
+
+ <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>
diff --git a/repos/source-build-reference-packages.proj b/repos/source-build-reference-packages.proj
index 69ab564a2..9545b50e4 100644
--- a/repos/source-build-reference-packages.proj
+++ b/repos/source-build-reference-packages.proj
@@ -2,7 +2,9 @@
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
- <BuildCommand>$(StandardSourceBuildCommand) $(StandardSourceBuildArgs)</BuildCommand>
+ <BuildCommandArgs>$(StandardSourceBuildArgs)</BuildCommandArgs>
+ <BuildCommandArgs>$(BuildCommandArgs) /p:MicrosoftNetCoreIlasmPackageRuntimeId=$(NETCoreSdkRuntimeIdentifier)</BuildCommandArgs>
+ <BuildCommand>$(StandardSourceBuildCommand) $(BuildCommandArgs)</BuildCommand>
<NuGetConfigFile>$(ProjectDirectory)NuGet.config</NuGetConfigFile>
<GlobalJsonFile>$(ProjectDirectory)global.json</GlobalJsonFile>
--
2.38.2

View file

@ -0,0 +1,69 @@
From 94463478bd6aaec208bc5e3dd1d120e0a49aeaaa Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/installer/pull/14816
From: Antoine Martin <dev@ayakael.net>
Date: Tue, 15 Nov 2022 01:08:29 -0500
Subject: [PATCH 3/3] source-build: stop overriding aspnetcore version
(backport of #14938)
---
.../tarball/content/Directory.Build.props | 4 ----
.../tarball/content/tools-local/init-build.proj | 12 ++++++++++++
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/Directory.Build.props b/Directory.Build.props
index 2e2d7e8bc..6b08fa71b 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -222,12 +222,8 @@
<ExtraPackageVersionPropsPackageInfo Include="MicrosoftNETCoreAppRuntimePackageVersion" Version="$(runtimeOutputPackageVersion)" />
<ExtraPackageVersionPropsPackageInfo Include="MicrosoftNETCoreAppRuntimeVersion" Version="$(runtimeOutputPackageVersion)" />
<ExtraPackageVersionPropsPackageInfo Include="MicrosoftNETCoreAppHostPackageVersion" Version="$(runtimeOutputPackageVersion)" />
- <ExtraPackageVersionPropsPackageInfo Include="MicrosoftAspNetCoreAppRuntimePackageVersion" Version="%24(MicrosoftAspNetCoreAppRuntimeLinux$(Platform)PackageVersion)" />
<!-- core-sdk uses this property for ASP.NET blob directory -->
<ExtraPackageVersionPropsPackageInfo Include="VSRedistCommonAspNetCoreTargetingPackx6430PackageVersion" Version="$(aspnetcoreOutputPackageVersion)" />
- <!-- OSX needs the OSX version instead of Linux. We don't have a lot of flexibility in how we output these properties so we're relying on the previous one being blank if the Linux version of the package is missing. -->
- <ExtraPackageVersionPropsPackageInfo Include="MicrosoftAspNetCoreAppRuntimePackageVersion" Version="%24(MicrosoftAspNetCoreAppRuntimeOsxX64PackageVersion)" DoNotOverwrite="true" />
- <ExtraPackageVersionPropsPackageInfo Include="MicrosoftAspNetCoreAppRuntimePackageVersion" Version="%24(MicrosoftAspNetCoreAppRuntimewinx64PackageVersion)" DoNotOverwrite="true" />
<!-- Used by installer to determine sdk version -->
<ExtraPackageVersionPropsPackageInfo Include="MicrosoftDotnetToolsetInternalPackageVersion" Version="%24(MicrosoftNETSdkPackageVersion)" />
diff --git a/tools-local/init-build.proj b/tools-local/init-build.proj
index 701f76c0c..ac4508947 100644
--- a/tools-local/init-build.proj
+++ b/tools-local/init-build.proj
@@ -9,6 +9,7 @@
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="NuGetPack" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="ZipFileExtractToDirectory" />
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="ReplaceTextInFile" />
+ <UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="ReplaceRegexInFiles" />
<ItemGroup>
<BuildTasksTarget Include="Restore;Build;InstallResolver" />
@@ -22,6 +23,7 @@
<CallTarget Targets="
UnpackTarballs;
BuildXPlatTasks;
+ PatchPackageVersions;
BuildLeakDetection;
ExtractToolPackage;
GenerateRootFs;
@@ -38,6 +40,16 @@
<Delete Files="$(CompletedSemaphorePath)*.*" />
</Target>
+ <!-- TODO: Remove this when the .NET 8 artifacts tarball no longer includes MicrosoftAspNetCoreAppRuntimePackageVersion -->
+ <Target Name="PatchPackageVersions">
+ <!-- Rename MicrosoftAspNetCoreAppRuntimePackageVersion so it isn't used
+ Fixes https://github.com/dotnet/installer/issues/14492 -->
+ <ReplaceRegexInFiles
+ InputFiles="$(IntermediatePath)PreviouslySourceBuiltPackageVersions.props"
+ OldTextRegex="\bMicrosoftAspNetCoreAppRuntimePackageVersion\b"
+ NewText="__unused" />
+ </Target>
+
<Target Name="UnpackTarballs"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(CompletedSemaphorePath)UnpackTarballs.complete" >
--
2.38.2

View file

@ -0,0 +1,38 @@
From 5ee269eef8bd02d066151deaa4d8c0fe6b6cbce4 Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/installer/pull/14816
From: Antoine Martin <dev@ayakael.net>
Date: Tue, 15 Nov 2022 01:04:46 -0500
Subject: [PATCH 2/3] BundledVersions: update portable rid logic (backport
dotnet#14647)
---
.../tarball/content/repos/installer.proj | 5 +++++
src/redist/targets/GetRuntimeInformation.targets | 16 ++++++++++------
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/repos/installer.proj b/repos/installer.proj
index 6c08a1f67..95d47c941 100644
--- a/repos/installer.proj
+++ b/repos/installer.proj
@@ -10,6 +10,10 @@
<OverrideTargetRid Condition="'$(TargetOS)' == 'OSX'">osx-x64</OverrideTargetRid>
<OSNameOverride>$(OverrideTargetRid.Substring(0, $(OverrideTargetRid.IndexOf("-"))))</OSNameOverride>
+ <!-- Determine target portable rid based on bootstrap SDK's portable rid -->
+ <_platformIndex>$(NETCoreSdkPortableRuntimeIdentifier.LastIndexOf('-'))</_platformIndex>
+ <PortableOS Condition="'$(PortableOS)' == ''">$(NETCoreSdkPortableRuntimeIdentifier.Substring(0, $(_platformIndex)))</PortableOS>
+
<RuntimeArg>--runtime-id $(OverrideTargetRid)</RuntimeArg>
<RuntimeArg Condition="'$(TargetOS)' == 'Linux'">--runtime-id $(TargetRid)</RuntimeArg>
@@ -22,6 +26,7 @@
-->
<BuildCommandArgs>$(BuildCommandArgs) /p:NETCoreAppMaximumVersion=99.9</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:OSName=$(OSNameOverride)</BuildCommandArgs>
+ <BuildCommandArgs>$(BuildCommandArgs) /p:PortableOSName=$(PortableOS)</BuildCommandArgs>
<BuildCommandArgs Condition="'$(TargetOS)' == 'Linux'">$(BuildCommandArgs) /p:Rid=$(TargetRid)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:DOTNET_INSTALL_DIR=$(DotNetCliToolDir)</BuildCommandArgs>
--
2.38.2

View file

@ -0,0 +1,79 @@
From 75c3e74ea35219f257c80daf9a236e0f518a7875 Mon Sep 17 00:00:00 2001
From: Antoine Martin <dev@ayakael.net>
Date: Wed, 9 Mar 2022 20:16:03 +0000
Subject: [PATCH 1/1] Disable apphost
Disables use of apphost
---
--- a/src/fsharp/tests/benchmarks/MicroPerf/MicroPerf.fsproj
+++ b/src/fsharp/tests/benchmarks/MicroPerf/MicroPerf.fsproj
@@ -9,6 +9,7 @@
<OtherFlags>$(OtherFlags) --nowarn:57</OtherFlags>
<OtherFlags>$(OtherFlags) --langversion:preview</OtherFlags>
<OtherFlags>$(OtherFlags) --define:PREVIEW</OtherFlags>
+ <UseAppHost>false</UseAppHost>
<!-- By default this project will compile with the proto compiler -->
<!-- Uncommenting this will build with a previous installed compiler -->
<!--
--- a/src/fsharp/tests/benchmarks/TaskPerf/TaskPerf.fsproj
+++ b/src/fsharp/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" -->
--- a/src/arcade/src/Microsoft.DotNet.GitSync.CommitManager/Microsoft.DotNet.GitSync.CommitManager.csproj
+++ b/src/arcade/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>
--- a/src/arcade/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CmdLine/Microsoft.DotNet.SwaggerGenerator.CmdLine.csproj
+++ b/src/arcade/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>
--- a/src/arcade/src/Microsoft.DotNet.XUnitConsoleRunner/src/Microsoft.DotNet.XUnitConsoleRunner.csproj
+++ b/src/arcade/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>
--- a/src/roslyn-analyzers/src/Tools/ReleaseNotesUtil/ReleaseNotesUtil.csproj
+++ b/src/roslyn-analyzers/src/Tools/ReleaseNotesUtil/ReleaseNotesUtil.csproj
@@ -4,6 +4,7 @@
<TargetFramework>netcoreapp3.1</TargetFramework>
<NonShipping>true</NonShipping>
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
+ <UseAppHost>false</UseAppHost>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis" Version="$(MicrosoftCodeAnalysisVersion)" />
--- a/src/roslyn/src/Workspaces/Remote/ServiceHub.CoreComponents/Microsoft.CodeAnalysis.Remote.ServiceHub.CoreComponents.csproj
+++ b/src/roslyn/src/Workspaces/Remote/ServiceHub.CoreComponents/Microsoft.CodeAnalysis.Remote.ServiceHub.CoreComponents.csproj
@@ -5,6 +5,7 @@
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<!-- The purpose of this project is to include all dependecies of Microsoft.CodeAnalysis.Remote.ServiceHub targeting .Net Core -->
+ <UseAppHost>false</UseAppHost>
<IsShipping>false</IsShipping>
</PropertyGroup>
<ItemGroup>

View file

@ -0,0 +1,42 @@
From 5bbd0366f3caa6281fbafb49882a226453371b6a Mon Sep 17 00:00:00 2001
From: Antoine Martin (ayakael) <dev@ayakael.net>
Date: Wed, 10 Aug 2022 00:57:30 +0000
Subject: [PATCH 1/1] fix-runtme-id
General fix for RID normalisation in testing suite
---
runtime-id | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/runtime-id b/runtime-id
index 5673bba..7369776 100755
--- a/runtime-id
+++ b/runtime-id
@@ -44,12 +44,15 @@ if [[ ${portable_rid} == 1 ]]; then
echo "linux-${arch}"
fi
else
- case "${ID}" in
- # Remove the minor version
- alpine|ol|rhel|rocky) rid_version=${VERSION_ID%.*} ;;
-
- *) rid_version=${VERSION_ID} ;;
- esac
-
- echo "${ID}.${rid_version}-${arch}"
+ VERSION_ID_DOT="${VERSION_ID//[^.]}"
+ while [[ ${#VERSION_ID_DOT} -gt 1 ]]; do
+ VERSION_ID="${VERSION_ID%.*}"
+ VERSION_ID_DOT="${VERSION_ID//[^.]}"
+ done
+ VERSION_ID_DASH="${VERSION_ID//[^_]}"
+ while [[ ${#VERSION_ID_DASH} -ge 1 ]]; do
+ VERSION_ID="${VERSION_ID%_*}"
+ VERSION_ID_DASH="${VERSION_ID//[^_]}"
+ done
+ echo "${ID}.${VERSION_ID}-${arch}"
fi
--
2.37.1

View file

@ -0,0 +1,43 @@
From 4f21dd6d62c740e2cc2557bbc5d6c2f2653a5612 Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/installer/pull/13378
From: Antoine Martin <dev@ayakael.net>
Date: Wed, 9 Mar 2022 08:17:41 +0000
Subject: [PATCH 1/1] arm build
By default, installer does not support arm. This patch introduces all the logics
to parse platform information.
---
Directory.Build.props | 2 +-
eng/Build.props | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/installer/Directory.Build.props b/src/installer/Directory.Build.props
index c373c9beb..af0f16f88 100644
--- a/src/installer/Directory.Build.props
+++ b/src/installer/Directory.Build.props
@@ -9,7 +9,7 @@
<PropertyGroup>
<BuildArchitecture>$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant())</BuildArchitecture>
- <Architecture Condition="'$(Architecture)' == '' AND '$(BuildArchitecture)' == 'arm64'">$(BuildArchitecture)</Architecture>
+ <Architecture Condition="'$(Architecture)' == '' AND ( '$(BuildArchitecture)' == 'arm64' OR '$(BuildArchitecture)' == 'arm') ">$(BuildArchitecture)</Architecture>
<Architecture Condition="'$(Architecture)' == '' AND '$(BuildArchitecture)' == 's390x'">$(BuildArchitecture)</Architecture>
<Architecture Condition="'$(Architecture)' == ''">x64</Architecture>
</PropertyGroup>
diff --git a/src/installer/eng/Build.props b/src/installer/eng/Build.props
index 4df683bab..0aa640051 100644
--- a/src/installer/eng/Build.props
+++ b/src/installer/eng/Build.props
@@ -1,7 +1,7 @@
<Project>
<ItemGroup Condition=" '$(ArcadeBuildTarball)' != 'true' ">
<ProjectToBuild Include="$(RepoRoot)Microsoft.DotNet.Cli.sln" />
- <ProjectToBuild Condition="'$(OS)' == 'Windows_NT' And ('$(Architecture)' == 'x86' Or '$(Architecture)' == 'x64' Or '$(Architecture)' == 'arm64')"
+ <ProjectToBuild Condition="'$(OS)' == 'Windows_NT' And ('$(Architecture)' == 'x86' Or '$(Architecture)' == 'x64' Or '$(Architecture)' == 'arm64' Or '$(Architecture)' == 'arm')"
Include="$(RepoRoot)eng\version.csproj;
$(RepoRoot)eng\native.proj" />
</ItemGroup>
--
2.35.1

View file

@ -0,0 +1,53 @@
From 3008f7ef29e0a5593f6f0afbdc9343f573f1a375 Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/installer/pull/14816
From: Antoine Martin <dev@ayakael.net>
Date: Tue, 15 Nov 2022 01:04:07 -0500
Subject: [PATCH 1/3] Eliminate runtime portable build (backport dotnet#14549)
---
.../tarball/content/Directory.Build.props | 8 --
.../tarball/content/repos/aspnetcore.proj | 1 +
.../tarball/content/repos/installer.proj | 2 +-
.../tarball/content/repos/known-good.proj | 1 -
.../content/repos/runtime-portable.proj | 47 -----------
.../content/repos/runtime.common.props | 43 ----------
.../content/repos/runtime.common.targets | 46 -----------
.../tarball/content/repos/runtime.proj | 82 ++++++++++++++++++-
.../source-build-reference-packages.proj | 4 +-
src/redist/targets/Crossgen.targets | 2 +-
src/redist/targets/GenerateLayout.targets | 3 +
11 files changed, 88 insertions(+), 151 deletions(-)
delete mode 100644 src/SourceBuild/tarball/content/repos/runtime-portable.proj
delete mode 100644 src/SourceBuild/tarball/content/repos/runtime.common.props
delete mode 100644 src/SourceBuild/tarball/content/repos/runtime.common.targets
diff --git a/src/installer/src/redist/targets/Crossgen.targets b/src/installer/src/redist/targets/Crossgen.targets
index 8949af132..a59ed388f 100644
--- a/src/installer/src/redist/targets/Crossgen.targets
+++ b/src/installer/src/redist/targets/Crossgen.targets
@@ -6,7 +6,7 @@
<PropertyGroup>
<RuntimeNETCoreAppPackageName>microsoft.netcore.app.runtime.$(SharedFrameworkRid)</RuntimeNETCoreAppPackageName>
- <RuntimeNETCrossgenPackageName>microsoft.netcore.app.crossgen2.$(HostOSName)-$(BuildArchitecture)</RuntimeNETCrossgenPackageName>
+ <RuntimeNETCrossgenPackageName>microsoft.netcore.app.crossgen2.$(Crossgen2Rid)</RuntimeNETCrossgenPackageName>
<CrossgenPath>$(NuGetPackageRoot)/$(RuntimeNETCrossgenPackageName)/$(MicrosoftNETCoreAppRuntimePackageVersion)/tools/crossgen2$(ExeExtension)</CrossgenPath>
<!-- When ingesting stable pgo instrumented binaries, the shared framework will be a non-stable version,
as will the archive file names themselves. -->
diff --git a/src/installer/src/redist/targets/GenerateLayout.targets b/src/installer/src/redist/targets/GenerateLayout.targets
index 88a053b61..ce5e09b69 100644
--- a/src/installer/src/redist/targets/GenerateLayout.targets
+++ b/src/installer/src/redist/targets/GenerateLayout.targets
@@ -84,6 +84,9 @@
<CombinedFrameworkHostArchiveFileName Condition=" '$(PgoInstrument)' == 'true' ">dotnet-runtime$(PgoTerm)-$(VSRedistCommonNetCoreSharedFrameworkx6460PackageVersion)-$(SharedFrameworkRid)$(ArchiveExtension)</CombinedFrameworkHostArchiveFileName>
<WinFormsAndWpfSharedFxArchiveFileName>windowsdesktop-runtime-$(MicrosoftWindowsDesktopAppRuntimePackageVersion)-$(SharedFrameworkRid)$(ArchiveExtension)</WinFormsAndWpfSharedFxArchiveFileName>
+ <Crossgen2Rid>$(HostOSName)-$(BuildArchitecture)</Crossgen2Rid>
+ <Crossgen2Rid Condition="'$(DotNetBuildFromSource)' == 'true'">$(SharedFrameworkRid)</Crossgen2Rid>
+
<AspNetCoreInstallerRid Condition="'$(AspNetCoreInstallerRid)' == ''">$(SharedFrameworkRid)</AspNetCoreInstallerRid>
<AspNetCoreInstallerRid Condition="'$(SharedFrameworkRid)' == 'rhel.6-x64'">linux-x64</AspNetCoreInstallerRid>
<AspNetCoreArchiveRid>$(AspNetCoreInstallerRid)</AspNetCoreArchiveRid>
--
2.38.2

View file

@ -0,0 +1,51 @@
From 5ee269eef8bd02d066151deaa4d8c0fe6b6cbce4 Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/installer/pull/14816
From: Antoine Martin <dev@ayakael.net>
Date: Tue, 15 Nov 2022 01:04:46 -0500
Subject: [PATCH 2/3] BundledVersions: update portable rid logic (backport
dotnet#14647)
---
.../tarball/content/repos/installer.proj | 5 +++++
src/redist/targets/GetRuntimeInformation.targets | 16 ++++++++++------
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/src/installer/src/redist/targets/GetRuntimeInformation.targets b/src/installer/src/redist/targets/GetRuntimeInformation.targets
index a99a7e9da..89f000119 100644
--- a/src/installer/src/redist/targets/GetRuntimeInformation.targets
+++ b/src/installer/src/redist/targets/GetRuntimeInformation.targets
@@ -9,10 +9,15 @@
<HostOSName Condition=" '$(HostOSName)' == '' AND $([MSBuild]::IsOSPlatform('OSX')) ">osx</HostOSName>
<HostOSName Condition=" '$(HostOSName)' == '' AND $([MSBuild]::IsOSPlatform('FREEBSD')) ">freebsd</HostOSName>
<HostOSName Condition=" '$(HostOSName)' == '' AND '$(IsLinux)' == 'True' ">linux</HostOSName>
-
+
+ <OSName Condition=" '$(OSName)' == '' AND $(Rid) != '' ">$(Rid.Substring(0, $(Rid.LastIndexOf('-'))))</OSName>
<OSName Condition=" '$(OSName)' == '' ">$(HostOSName)</OSName>
- <Rid Condition=" '$(Rid)' == '' ">$(OSName)-$(Architecture)</Rid>
+ <PortableOSName Condition=" '$(PortableOSName)' == '' ">$(OSName)</PortableOSName>
+
+ <Rid>$(OSName)-$(Architecture)</Rid>
+
+ <PortableRid>$(PortableOSName)-$(Architecture)</PortableRid>
</PropertyGroup>
<PropertyGroup>
@@ -23,10 +28,9 @@
</PropertyGroup>
<PropertyGroup>
- <ProductMonikerRid Condition=" '$(Rid)' == 'ubuntu.16.04-x64' OR
- '$(Rid)' == 'rhel.6-x64' OR
- '$(Rid)' == 'linux-musl-x64' ">$(Rid)</ProductMonikerRid>
- <ProductMonikerRid Condition=" '$(ProductMonikerRid)' == '' ">$(OSName)-$(Architecture)</ProductMonikerRid>
+ <ProductMonikerRid Condition=" '$(ProductMonikerRid)' == '' ">$(Rid)</ProductMonikerRid>
+
+ <PortableProductMonikerRid Condition=" '$(PortableProductMonikerRid)' == '' ">$(PortableRid)</PortableProductMonikerRid>
<PortableProductMonikerRid Condition=" '$(PortableProductMonikerRid)' == '' ">$(HostOSName)-$(Architecture)</PortableProductMonikerRid>
--
2.38.2

View file

@ -0,0 +1,69 @@
From 26a12cb531161e1fc3d6ec1f2a241e1c516ca775 Mon Sep 17 00:00:00 2001
Patch-Source: https://src.fedoraproject.org/rpms/dotnet6.0/blob/src/msbuild/rawhide/f/msbuild-no-systemconfiguration.patch
From: Antoine Martin <dev@ayakael.net>
Date: Fri, 21 Oct 2022 14:13:04 -0400
Subject: [PATCH 1/2] optional-systemconfiguration
Fix mono-specific runtime crashes running msbuild. CoreCLR does not
load types that are not actually used/invoked at runtime, while mono
does. System.Configuration and System.Security are missing in
source-build builds, which breaks msbuild.
---
src/Build/Definition/ProjectCollection.cs | 4 ++++
src/Build/Definition/ToolsetReader.cs | 8 ++++++++
2 files changed, 12 insertions(+)
diff --git a/src/msbuild/src/Build/Definition/ProjectCollection.cs b/src/msbuild/src/Build/Definition/ProjectCollection.cs
index 8629bd943..6a550e32d 100644
--- a/src/msbuild/src/Build/Definition/ProjectCollection.cs
+++ b/src/msbuild/src/Build/Definition/ProjectCollection.cs
@@ -1754,7 +1754,11 @@ namespace Microsoft.Build.Evaluation
#if FEATURE_WIN32_REGISTRY
ToolsetRegistryReader registryReader = null,
#endif
+#if FEATURE_SYSTEM_CONFIGURATION
ToolsetConfigurationReader configReader = null
+#else
+ object configReader = null
+#endif
)
{
_toolsets = new Dictionary<string, Toolset>(StringComparer.OrdinalIgnoreCase);
diff --git a/src/msbuild/src/Build/Definition/ToolsetReader.cs b/src/msbuild/src/Build/Definition/ToolsetReader.cs
index 869b3318e..c6b95d3cf 100644
--- a/src/msbuild/src/Build/Definition/ToolsetReader.cs
+++ b/src/msbuild/src/Build/Definition/ToolsetReader.cs
@@ -101,7 +101,11 @@ namespace Microsoft.Build.Evaluation
#if FEATURE_WIN32_REGISTRY
ToolsetRegistryReader registryReader,
#endif
+#if FEATURE_SYSTEM_CONFIGURATION
ToolsetConfigurationReader configurationReader,
+#else
+ object _configurationReader,
+#endif
PropertyDictionary<ProjectPropertyInstance> environmentProperties,
PropertyDictionary<ProjectPropertyInstance> globalProperties,
ToolsetDefinitionLocations locations
@@ -120,6 +124,7 @@ namespace Microsoft.Build.Evaluation
if ((locations & ToolsetDefinitionLocations.ConfigurationFile) == ToolsetDefinitionLocations.ConfigurationFile)
{
+#if FEATURE_SYSTEM_CONFIGURATION
if (configurationReader == null)
{
configurationReader = new ToolsetConfigurationReader(environmentProperties, globalProperties);
@@ -129,6 +134,9 @@ namespace Microsoft.Build.Evaluation
defaultToolsVersionFromConfiguration = configurationReader.ReadToolsets(toolsets, globalProperties,
initialProperties, true /* accumulate properties */, out overrideTasksPathFromConfiguration,
out defaultOverrideToolsVersionFromConfiguration);
+#else
+ throw new InvalidOperationException("ToolsetDefinitionLocations.ConfigurationFile not supported");
+#endif
}
string defaultToolsVersionFromRegistry = null;
--
2.36.3

View file

@ -0,0 +1,32 @@
From 06707ec777769f1756230caf54391302e4378777 Mon Sep 17 00:00:00 2001
Patch-Source: https://src.fedoraproject.org/rpms/dotnet6.0/blob/src/msbuild/rawhide/f/msbuild-no-systemsecurity.patch
From: Antoine Martin <dev@ayakael.net>
Date: Fri, 21 Oct 2022 14:13:29 -0400
Subject: [PATCH 2/2] optional-systemsecurity
Fix mono-specific runtime crashes running msbuild. CoreCLR does not
load types that are not actually used/invoked at runtime, while mono
does. System.Configuration and System.Security are missing in
source-build builds, which breaks msbuild.
---
src/Shared/ExceptionHandling.cs | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/msbuild/src/Shared/ExceptionHandling.cs b/src/msbuild/src/Shared/ExceptionHandling.cs
index 16a0576b5..1c7cd5967 100644
--- a/src/msbuild/src/Shared/ExceptionHandling.cs
+++ b/src/msbuild/src/Shared/ExceptionHandling.cs
@@ -153,7 +153,9 @@ namespace Microsoft.Build.Shared
internal static bool IsXmlException(Exception e)
{
return e is XmlException
+#if FEATURE_SECURITY_PERMISSIONS
|| e is XmlSyntaxException
+#endif
|| e is XmlSchemaException
|| e is UriFormatException; // XmlTextReader for example uses this under the covers
}
--
2.36.3

View file

@ -0,0 +1,470 @@
From 210c17ea60f525837a7525df73e7332598ad4089 Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/roslyn/pull/57003
From: Antoine Martin <dev@ayakael.net>
Date: Sat, 27 Aug 2022 21:26:01 -0800
Subject: [PATCH 1/1] mono-named-mutex
---
.../InternalUtilities/PlatformInformation.cs | 19 ++
.../VBCSCompilerTests/BuildClientTests.cs | 2 +-
.../CompilerServerApiTest.cs | 4 +-
.../VBCSCompilerTests/CompilerServerTests.cs | 4 +-
.../VBCSCompilerServerTests.cs | 7 +-
src/Compilers/Shared/BuildServerConnection.cs | 251 +++++++++++-------
6 files changed, 182 insertions(+), 105 deletions(-)
diff --git a/src/roslyn/src/Compilers/Core/Portable/InternalUtilities/PlatformInformation.cs b/src/roslyn/src/Compilers/Core/Portable/InternalUtilities/PlatformInformation.cs
index 033e66cd2f2..d4fa56413fb 100644
--- a/src/roslyn/src/Compilers/Core/Portable/InternalUtilities/PlatformInformation.cs
+++ b/src/roslyn/src/Compilers/Core/Portable/InternalUtilities/PlatformInformation.cs
@@ -31,5 +31,24 @@ public static bool IsRunningOnMono
}
}
}
+ /// <summary>
+ /// Are we running on .NET 5 or later using the Mono runtime?
+ /// Will also return true when running on Mono itself; if necessary
+ /// we can use IsRunningOnMono to distinguish.
+ /// </summary>
+ public static bool IsUsingMonoRuntime
+ {
+ get
+ {
+ try
+ {
+ return !(Type.GetType("Mono.RuntimeStructs", throwOnError: false) is null);
+ }
+ catch
+ {
+ return false;
+ }
+ }
+ }
}
}
diff --git a/src/roslyn/src/Compilers/Server/VBCSCompilerTests/BuildClientTests.cs b/src/roslyn/src/Compilers/Server/VBCSCompilerTests/BuildClientTests.cs
index 669d1bfb676..7f1d0468823 100644
--- a/src/roslyn/src/Compilers/Server/VBCSCompilerTests/BuildClientTests.cs
+++ b/src/roslyn/src/Compilers/Server/VBCSCompilerTests/BuildClientTests.cs
@@ -79,7 +79,7 @@ public void ConnectToServerFails()
// to connect. When it fails it should fall back to in-proc
// compilation.
bool holdsMutex;
- using (var serverMutex = new Mutex(initiallyOwned: true,
+ using (var serverMutex = BuildServerConnection.OpenOrCreateMutex(
name: BuildServerConnection.GetServerMutexName(_pipeName),
createdNew: out holdsMutex))
{
diff --git a/src/roslyn/src/Compilers/Server/VBCSCompilerTests/CompilerServerApiTest.cs b/src/roslyn/src/Compilers/Server/VBCSCompilerTests/CompilerServerApiTest.cs
index 0dbd1b2e143..c00b72e8434 100644
--- a/src/roslyn/src/Compilers/Server/VBCSCompilerTests/CompilerServerApiTest.cs
+++ b/src/roslyn/src/Compilers/Server/VBCSCompilerTests/CompilerServerApiTest.cs
@@ -103,7 +103,7 @@ public void MutexStopsServerStarting()
var mutexName = BuildServerConnection.GetServerMutexName(pipeName);
bool holdsMutex;
- using (var mutex = new Mutex(initiallyOwned: true,
+ using (var mutex = BuildServerConnection.OpenOrCreateMutex(
name: mutexName,
createdNew: out holdsMutex))
{
@@ -119,7 +119,7 @@ public void MutexStopsServerStarting()
}
finally
{
- mutex.ReleaseMutex();
+ mutex.Dispose();
}
}
}
diff --git a/src/roslyn/src/Compilers/Server/VBCSCompilerTests/CompilerServerTests.cs b/src/roslyn/src/Compilers/Server/VBCSCompilerTests/CompilerServerTests.cs
index 3b6f4f291ff..e97a6bf923f 100644
--- a/src/roslyn/src/Compilers/Server/VBCSCompilerTests/CompilerServerTests.cs
+++ b/src/roslyn/src/Compilers/Server/VBCSCompilerTests/CompilerServerTests.cs
@@ -304,7 +304,7 @@ public async Task ServerFailsWithLongTempPathUnix()
var newTempDir = _tempDirectory.CreateDirectory(new string('a', 100 - _tempDirectory.Path.Length));
await ApplyEnvironmentVariables(
new[] { new KeyValuePair<string, string>("TMPDIR", newTempDir.Path) },
- async () =>
+ async () => await Task.Run(async () =>
{
using var serverData = await ServerUtil.CreateServer(_logger);
var result = RunCommandLineCompiler(
@@ -317,7 +317,7 @@ public async Task ServerFailsWithLongTempPathUnix()
var listener = await serverData.Complete();
Assert.Equal(CompletionData.RequestCompleted, listener.CompletionDataList.Single());
- });
+ }));
}
[Fact]
diff --git a/src/roslyn/src/Compilers/Server/VBCSCompilerTests/VBCSCompilerServerTests.cs b/src/roslyn/src/Compilers/Server/VBCSCompilerTests/VBCSCompilerServerTests.cs
index d5f493fed8a..73941972e48 100644
--- a/src/roslyn/src/Compilers/Server/VBCSCompilerTests/VBCSCompilerServerTests.cs
+++ b/src/roslyn/src/Compilers/Server/VBCSCompilerTests/VBCSCompilerServerTests.cs
@@ -101,7 +101,7 @@ public async Task NoServerConnection()
var thread = new Thread(() =>
{
- using (var mutex = new Mutex(initiallyOwned: true, name: mutexName, createdNew: out created))
+ using (var mutex = BuildServerConnection.OpenOrCreateMutex(name: mutexName, createdNew: out created))
using (var stream = NamedPipeUtil.CreateServer(pipeName))
{
readyMre.Set();
@@ -112,7 +112,7 @@ public async Task NoServerConnection()
stream.Close();
doneMre.WaitOne();
- mutex.ReleaseMutex();
+ mutex.Dispose();
}
});
@@ -153,7 +153,7 @@ public async Task ServerShutdownsDuringProcessing()
{
using (var stream = NamedPipeUtil.CreateServer(pipeName))
{
- var mutex = new Mutex(initiallyOwned: true, name: mutexName, createdNew: out created);
+ var mutex = BuildServerConnection.OpenOrCreateMutex(name: mutexName, createdNew: out created);
readyMre.Set();
stream.WaitForConnection();
@@ -161,7 +161,6 @@ public async Task ServerShutdownsDuringProcessing()
// Client is waiting for a response. Close the mutex now. Then close the connection
// so the client gets an error.
- mutex.ReleaseMutex();
mutex.Dispose();
stream.Close();
diff --git a/src/roslyn/src/Compilers/Shared/BuildServerConnection.cs b/src/roslyn/src/Compilers/Shared/BuildServerConnection.cs
index f67c2d83957..1fe609061ee 100644
--- a/src/roslyn/src/Compilers/Shared/BuildServerConnection.cs
+++ b/src/roslyn/src/Compilers/Shared/BuildServerConnection.cs
@@ -543,19 +543,10 @@ internal static bool WasServerMutexOpen(string mutexName)
{
try
{
- if (PlatformInformation.IsRunningOnMono)
+ if (PlatformInformation.IsUsingMonoRuntime)
{
- IServerMutex? mutex = null;
- bool createdNew = false;
- try
- {
- mutex = new ServerFileMutexPair(mutexName, false, out createdNew);
- return !createdNew;
- }
- finally
- {
- mutex?.Dispose();
- }
+ using var mutex = new ServerFileMutex(mutexName);
+ return !mutex.CouldLock();
}
else
{
@@ -572,9 +563,11 @@ internal static bool WasServerMutexOpen(string mutexName)
internal static IServerMutex OpenOrCreateMutex(string name, out bool createdNew)
{
- if (PlatformInformation.IsRunningOnMono)
+ if (PlatformInformation.IsUsingMonoRuntime)
{
- return new ServerFileMutexPair(name, initiallyOwned: true, out createdNew);
+ var mutex = new ServerFileMutex(name);
+ createdNew = mutex.TryLock(0);
+ return mutex;
}
else
{
@@ -648,19 +641,22 @@ internal interface IServerMutex : IDisposable
}
/// <summary>
- /// An interprocess mutex abstraction based on OS advisory locking (FileStream.Lock/Unlock).
+ /// An interprocess mutex abstraction based on file sharing permission (FileShare.None).
/// If multiple processes running as the same user create FileMutex instances with the same name,
/// those instances will all point to the same file somewhere in a selected temporary directory.
- /// The TryLock method can be used to attempt to acquire the mutex, with Unlock or Dispose used to release.
+ /// The TryLock method can be used to attempt to acquire the mutex, with Dispose used to release.
+ /// The CouldLock method can be used to check whether an attempt to acquire the mutex would have
+ /// succeeded at the current time, without actually acquiring it.
/// Unlike Win32 named mutexes, there is no mechanism for detecting an abandoned mutex. The file
/// will simply revert to being unlocked but remain where it is.
/// </summary>
- internal sealed class FileMutex : IDisposable
+ internal sealed class ServerFileMutex : IServerMutex
{
- public readonly FileStream Stream;
+ public FileStream? Stream;
public readonly string FilePath;
+ public readonly string GuardPath;
- public bool IsLocked { get; private set; }
+ public bool IsDisposed { get; private set; }
internal static string GetMutexDirectory()
{
@@ -670,61 +666,176 @@ internal static string GetMutexDirectory()
return result;
}
- public FileMutex(string name)
+ public ServerFileMutex(string name)
{
- FilePath = Path.Combine(GetMutexDirectory(), name);
- Stream = new FileStream(FilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None);
+ var mutexDirectory = GetMutexDirectory();
+ FilePath = Path.Combine(mutexDirectory, name);
+ GuardPath = Path.Combine(mutexDirectory, ".guard");
}
- public bool TryLock(int timeoutMs)
+ /// <summary>
+ /// Acquire the guard by opening the guard file with FileShare.None. The guard must only ever
+ /// be held for very brief amounts of time, so we can simply spin until it is acquired. The
+ /// guard must be released by disposing the FileStream returned from this routine. Note the
+ /// guard file is never deleted; this is a leak, but only of a single file.
+ /// </summary>
+ internal FileStream LockGuard()
{
- if (IsLocked)
- throw new InvalidOperationException("Lock already held");
-
- var sw = Stopwatch.StartNew();
- do
+ // We should be able to acquire the guard quickly. Limit the number of retries anyway
+ // by some arbitrary bound to avoid getting hung up in a possibly infinite loop.
+ for (var i = 0; i < 100; i++)
{
try
{
- Stream.Lock(0, 0);
- IsLocked = true;
- return true;
+ return new FileStream(GuardPath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None);
}
catch (IOException)
{
- // Lock currently held by someone else.
+ // Guard currently held by someone else.
// We want to sleep for a short period of time to ensure that other processes
// have an opportunity to finish their work and relinquish the lock.
// Spinning here (via Yield) would work but risks creating a priority
// inversion if the lock is held by a lower-priority process.
Thread.Sleep(1);
}
+ }
+ // Handle unexpected failure to acquire guard as error.
+ throw new InvalidOperationException("Unable to acquire guard");
+ }
+
+ /// <summary>
+ /// Attempt to acquire the lock by opening the lock file with FileShare.None. Sets "Stream"
+ /// and returns true if successful, returns false if the lock is already held by another
+ /// thread or process. Guard must be held when calling this routine.
+ /// </summary>
+ internal bool TryLockFile()
+ {
+ Debug.Assert(Stream is null);
+ FileStream? stream = null;
+ try
+ {
+ stream = new FileStream(FilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None);
+ // On some targets, the file locking used to implement FileShare.None may not be
+ // atomic with opening/creating the file. This creates a race window when another
+ // thread holds the lock and is just about to unlock: we may be able to open the
+ // file here, then the other thread unlocks and deletes the file, and then we
+ // acquire the lock on our file handle - but the actual file is already deleted.
+ // To close this race, we verify that the file does in fact still exist now that
+ // we have successfull acquired the locked FileStream. (Note that this check is
+ // safe because we cannot race with an other attempt to create the file since we
+ // hold the guard, and after the FileStream constructor returned we can no race
+ // with file deletion because we hold the lock.)
+ if (!File.Exists(FilePath))
+ {
+ // To simplify the logic, we treat this case as "unable to acquire the lock"
+ // because it we caught another process while it owned the lock and was just
+ // giving it up. If the caller retries, we'll likely acquire the lock then.
+ stream.Dispose();
+ return false;
+ }
+ }
+ catch (Exception)
+ {
+ stream?.Dispose();
+ return false;
+ }
+ Stream = stream;
+ return true;
+ }
+
+ /// <summary>
+ /// Release the lock by deleting the lock file and disposing "Stream".
+ /// </summary>
+ internal void UnlockFile()
+ {
+ Debug.Assert(Stream is not null);
+ try
+ {
+ // Delete the lock file while the stream is not yet disposed
+ // and we therefore still hold the FileShare.None exclusion.
+ // There may still be a race with another thread attempting a
+ // TryLockFile in parallel, but that is safely handled there.
+ File.Delete(FilePath);
+ }
+ finally
+ {
+ Stream.Dispose();
+ Stream = null;
+ }
+ }
+
+ public bool TryLock(int timeoutMs)
+ {
+ if (IsDisposed)
+ throw new ObjectDisposedException("Mutex");
+ if (Stream is not null)
+ throw new InvalidOperationException("Lock already held");
+
+ var sw = Stopwatch.StartNew();
+ do
+ {
+ try
+ {
+ // Attempt to acquire lock while holding guard.
+ using var guard = LockGuard();
+ if (TryLockFile())
+ return true;
+ }
catch (Exception)
{
- // Something else went wrong.
return false;
}
+
+ // See comment in LockGuard.
+ Thread.Sleep(1);
} while (sw.ElapsedMilliseconds < timeoutMs);
return false;
}
- public void Unlock()
+ public bool CouldLock()
{
- if (!IsLocked)
- return;
- Stream.Unlock(0, 0);
- IsLocked = false;
+ if (IsDisposed)
+ return false;
+ if (Stream is not null)
+ return false;
+
+ try
+ {
+ // Attempt to acquire lock while holding guard, and if successful
+ // immediately unlock again while still holding guard. This ensures
+ // no other thread will spuriously observe the lock as held due to
+ // the lock attempt here.
+ using var guard = LockGuard();
+ if (TryLockFile())
+ {
+ UnlockFile();
+ return true;
+ }
+ }
+ catch (Exception)
+ {
+ return false;
+ }
+
+ return false;
}
public void Dispose()
{
- var wasLocked = IsLocked;
- if (wasLocked)
- Unlock();
- Stream.Dispose();
- // We do not delete the lock file here because there is no reliable way to perform a
- // 'delete if no one has the file open' operation atomically on *nix. This is a leak.
+ if (IsDisposed)
+ return;
+ IsDisposed = true;
+ if (Stream is not null)
+ {
+ try
+ {
+ UnlockFile();
+ }
+ catch (Exception)
+ {
+ }
+ }
}
}
@@ -792,56 +903,4 @@ public void Dispose()
}
}
}
-
- /// <summary>
- /// Approximates a named mutex with 'locked', 'unlocked' and 'abandoned' states.
- /// There is no reliable way to detect whether a mutex has been abandoned on some target platforms,
- /// so we use the AliveMutex to manually track whether the creator of a mutex is still running,
- /// while the HeldMutex represents the actual lock state of the mutex.
- /// </summary>
- internal sealed class ServerFileMutexPair : IServerMutex
- {
- public readonly FileMutex AliveMutex;
- public readonly FileMutex HeldMutex;
-
- public bool IsDisposed { get; private set; }
-
- public ServerFileMutexPair(string mutexName, bool initiallyOwned, out bool createdNew)
- {
- AliveMutex = new FileMutex(mutexName + "-alive");
- HeldMutex = new FileMutex(mutexName + "-held");
- createdNew = AliveMutex.TryLock(0);
- if (initiallyOwned && createdNew)
- {
- if (!TryLock(0))
- throw new Exception("Failed to lock mutex after creating it");
- }
- }
-
- public bool TryLock(int timeoutMs)
- {
- if (IsDisposed)
- throw new ObjectDisposedException("Mutex");
- return HeldMutex.TryLock(timeoutMs);
- }
-
- public void Dispose()
- {
- if (IsDisposed)
- return;
- IsDisposed = true;
-
- try
- {
- HeldMutex.Unlock();
- AliveMutex.Unlock();
- }
- finally
- {
- AliveMutex.Dispose();
- HeldMutex.Dispose();
- }
- }
- }
-
}
--
2.36.2

View file

@ -0,0 +1,48 @@
From 9a05b184f74fc299ddd33bccb74d153e0692d8c8 Mon Sep 17 00:00:00 2001
From: Tom Deseyn <tom.deseyn@gmail.com>
Date: Wed, 14 Sep 2022 11:06:42 +0200
Subject: [PATCH 1/8] source-build: support building runtime using non-portable
runtime packages.
Currently source-build performs a 'runtime-portable' build that produces
'linux-{arch}' packages that are used when building target runtime (non-portable).
With this change, we can use the non-portable packages that are produced by
a previous (non-portable) 'runtime' build. This helps eliminate the
'runtime-portable' build.
---
src/runtime/Directory.Build.targets | 15 ++++
src/runtime/Directory.Build.targets.orig | 96 ++++++++++++++++++++++++
2 files changed, 111 insertions(+)
create mode 100644 src/runtime/Directory.Build.targets.orig
diff --git a/src/runtime/Directory.Build.targets b/src/runtime/Directory.Build.targets
index d0c698797..4337207a4 100644
--- a/src/runtime/Directory.Build.targets
+++ b/src/runtime/Directory.Build.targets
@@ -11,6 +11,21 @@
<Import Project="$(RepositoryEngineeringDir)liveBuilds.targets" />
<Import Project="$(RepositoryEngineeringDir)python.targets" />
+ <!--
+ When .NET gets built from source, make the SDK aware there are bootstrap packages
+ for Microsoft.NETCore.App.Runtime.<rid> and Microsoft.NETCore.App.Crossgen2.<rid>.
+ -->
+ <ItemGroup Condition=" '$(DotNetBuildFromSource)' == 'true' " >
+ <KnownFrameworkReference Update="@(KnownFrameworkReference->WithMetadataValue('Identity', 'Microsoft.NETCore.App')->WithMetadataValue('TargetFramework', '$(NetCoreAppCurrent)'))">
+ <RuntimePackRuntimeIdentifiers>$(PackageRID)</RuntimePackRuntimeIdentifiers>
+ </KnownFrameworkReference>
+ <KnownCrossgen2Pack Update="@(KnownCrossgen2Pack->WithMetadataValue('Identity', 'Microsoft.NETCore.App.Crossgen2')->WithMetadataValue('TargetFramework', '$(NetCoreAppCurrent)'))">
+ <Crossgen2RuntimeIdentifiers>$(PackageRID)</Crossgen2RuntimeIdentifiers>
+ </KnownCrossgen2Pack>
+ <!-- Avoid references to Microsoft.AspNetCore.App.Runtime.<rid> -->
+ <KnownFrameworkReference Remove="Microsoft.AspNetCore.App" />
+ </ItemGroup>
+
<PropertyGroup>
<!--
Define this here (not just in Versions.props) because the SDK resets it
--
2.38.0

View file

@ -0,0 +1,189 @@
From f54977e2fc84527fe58024ed5537cb63244168e2 Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/runtime/pull/76500
From: Antoine Martin <dev@ayakael.net>
Date: Tue, 13 Sep 2022 14:17:35 +0200
Subject: [PATCH 1/1] Mono musl support
---
src/coreclr/pal/src/misc/perfjitdump.cpp | 2 +-
src/mono/CMakeLists.txt | 29 ++++++++++++++++++++++++
src/mono/mono.proj | 18 +++++++++------
src/mono/mono/metadata/domain.c | 10 ++++++++
src/mono/mono/mini/CMakeLists.txt | 10 ++++++++
src/mono/mono/utils/mono-context.h | 8 +++++++
6 files changed, 69 insertions(+), 8 deletions(-)
diff --git a/src/runtime/src/coreclr/pal/src/misc/perfjitdump.cpp b/src/runtime/src/coreclr/pal/src/misc/perfjitdump.cpp
index d80bd58038c..3488397b0da 100644
--- a/src/runtime/src/coreclr/pal/src/misc/perfjitdump.cpp
+++ b/src/runtime/src/coreclr/pal/src/misc/perfjitdump.cpp
@@ -25,7 +25,7 @@
#include <sys/uio.h>
#include <time.h>
#include <unistd.h>
-#include <linux/limits.h>
+#include <limits.h>
#include "../inc/llvm/ELF.h"
diff --git a/src/runtime/src/mono/CMakeLists.txt b/src/runtime/src/mono/CMakeLists.txt
index 49a73b1b709..7e596d69d35 100644
--- a/src/runtime/src/mono/CMakeLists.txt
+++ b/src/runtime/src/mono/CMakeLists.txt
@@ -208,6 +208,35 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
# Enable the "full RELRO" options (RELRO & BIND_NOW) at link time
add_link_options(-Wl,-z,relro)
add_link_options(-Wl,-z,now)
+ # Detect Linux ID
+ # TODO: Eventually merge with eng/native/configureplatform.cmake
+ set(LINUX_ID_FILE "/etc/os-release")
+ if(CMAKE_CROSSCOMPILING)
+ set(LINUX_ID_FILE "${CMAKE_SYSROOT}${LINUX_ID_FILE}")
+ endif()
+
+ if(EXISTS ${LINUX_ID_FILE})
+ execute_process(
+ COMMAND bash -c "source ${LINUX_ID_FILE} && echo \$ID"
+ OUTPUT_VARIABLE CLR_CMAKE_LINUX_ID
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ execute_process(
+ COMMAND bash -c "if strings \"${CMAKE_SYSROOT}/usr/bin/ldd\" 2>&1 | grep -q musl; then echo musl; fi"
+ OUTPUT_VARIABLE CLR_CMAKE_LINUX_MUSL
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ endif()
+
+ if(DEFINED CLR_CMAKE_LINUX_ID)
+ if(CLR_CMAKE_LINUX_ID STREQUAL alpine)
+ set(CLR_CMAKE_HOST_ALPINE_LINUX 1)
+ set(CLR_CMAKE_HOST_OS ${CLR_CMAKE_LINUX_ID})
+ endif()
+
+ if(CLR_CMAKE_LINUX_MUSL STREQUAL musl)
+ set(CLR_CMAKE_HOST_LINUX_MUSL 1)
+ endif()
+ endif(DEFINED CLR_CMAKE_LINUX_ID)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
set(HOST_LINUX 1)
add_definitions(-D_GNU_SOURCE -D_REENTRANT)
diff --git a/src/runtime/src/mono/mono.proj b/src/runtime/src/mono/mono.proj
index d6a0c9a8ec2..933ed60cea7 100644
--- a/src/runtime/src/mono/mono.proj
+++ b/src/runtime/src/mono/mono.proj
@@ -417,11 +417,15 @@
<!-- Linux options -->
<ItemGroup Condition="'$(TargetsLinux)' == true">
<_MonoCFLAGS Include="-Wl,--build-id=sha1" />
+ <_MonoCFLAGS Include="-Wno-strict-prototypes" />
<_MonoCXXFLAGS Include="-Wl,--build-id=sha1" />
+ <_MonoCXXFLAGS Include="-Wno-strict-prototypes" />
</ItemGroup>
<ItemGroup Condition="'$(RealTargetOS)' == 'Linux'">
<_MonoAOTCFLAGS Include="-Wl,--build-id=sha1" />
+ <_MonoAOTCFLAGS Include="-Wno-strict-prototypes" />
<_MonoAOTCXXFLAGS Include="-Wl,--build-id=sha1" />
+ <_MonoAOTCXXFLAGS Include="-Wno-strict-prototypes" />
</ItemGroup>
<!-- Devloop features -->
@@ -500,15 +504,15 @@
<MonoToolchainPrebuiltOS Condition="$([MSBuild]::IsOSPlatform('OSX'))">darwin-x86_64</MonoToolchainPrebuiltOS>
<MonoToolchainPrebuiltOS Condition="'$(OS)' == 'Windows_NT'">windows-x86_64</MonoToolchainPrebuiltOS>
<_MonoRuntimeFilePath>$(MonoObjDir)out\lib\$(MonoFileName)</_MonoRuntimeFilePath>
- <_LinuxAbi Condition="'$(TargetsAndroid)' != 'true'">gnu</_LinuxAbi>
- <_LinuxAbi Condition="'$(TargetsAndroid)' == 'true'">android</_LinuxAbi>
+ <_LinuxAbi Condition="'$(TargetsAndroid)' != 'true'">alpine-linux-musl</_LinuxAbi>
+ <_LinuxAbi Condition="'$(TargetsAndroid)' == 'true'">linux-android</_LinuxAbi>
<_LinuxFloatAbi Condition="'$(TargetsAndroid)' != 'true'">hf</_LinuxFloatAbi>
<_Objcopy>objcopy</_Objcopy>
- <_Objcopy Condition="'$(Platform)' == 'arm'">arm-linux-$(_LinuxAbi)eabi$(_LinuxFloatAbi)-$(_Objcopy)</_Objcopy>
- <_Objcopy Condition="'$(Platform)' == 'arm64'">aarch64-linux-$(_LinuxAbi)-$(_Objcopy)</_Objcopy>
- <_Objcopy Condition="'$(Platform)' == 's390x'">s390x-linux-$(_LinuxAbi)-$(_Objcopy)</_Objcopy>
- <_Objcopy Condition="'$(Platform)' == 'x64'">x86_64-linux-$(_LinuxAbi)-$(_Objcopy)</_Objcopy>
- <_Objcopy Condition="'$(Platform)' == 'x86'">i686-linux-$(_LinuxAbi)-$(_Objcopy)</_Objcopy>
+ <_Objcopy Condition="'$(Platform)' == 'arm' and '$(CrossBuild)' == 'true'">arm-$(_LinuxAbi)eabi$(_LinuxFloatAbi)-$(_Objcopy)</_Objcopy>
+ <_Objcopy Condition="'$(Platform)' == 'arm64' and '$(CrossBuild)' == 'true'">aarch64-$(_LinuxAbi)-$(_Objcopy)</_Objcopy>
+ <_Objcopy Condition="'$(Platform)' == 's390x' and '$(CrossBuild)' == 'true'">s390x-$(_LinuxAbi)-$(_Objcopy)</_Objcopy>
+ <_Objcopy Condition="'$(Platform)' == 'x64' and '$(CrossBuild)' == 'true'">x86_64-$(_LinuxAbi)-$(_Objcopy)</_Objcopy>
+ <_Objcopy Condition="'$(Platform)' == 'x86' and '$(CrossBuild)' == 'true'">i686-$(_LinuxAbi)-$(_Objcopy)</_Objcopy>
<_Objcopy Condition="'$(TargetsAndroid)' == 'true'">$(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/$(MonoToolchainPrebuiltOS)/bin/$(_Objcopy)</_Objcopy>
</PropertyGroup>
<!-- test viability of objcopy command -->
diff --git a/src/runtime/src/mono/mono/metadata/domain.c b/src/runtime/src/mono/mono/metadata/domain.c
index 4a8e06d28ae..e9868bd1b2c 100644
--- a/src/runtime/src/mono/mono/metadata/domain.c
+++ b/src/runtime/src/mono/mono/metadata/domain.c
@@ -138,6 +138,14 @@ create_root_domain (void)
return domain;
}
+static MONO_NO_OPTIMIZATION MONO_NEVER_INLINE void
+ensure_stack_size (void)
+{
+ const int default_size = 5 * 1024 * 1024;
+ volatile uint8_t *s = (uint8_t *)g_alloca(default_size);
+ *s = 0;
+}
+
/**
* mono_init_internal:
*
@@ -181,6 +189,8 @@ mono_init_internal (const char *filename, const char *exe_filename, const char *
mono_counters_register ("Max HashTable Chain Length", MONO_COUNTER_INT|MONO_COUNTER_METADATA, &mono_g_hash_table_max_chain_length);
+ ensure_stack_size ();
+
mono_gc_base_init ();
mono_thread_info_attach ();
diff --git a/src/runtime/src/mono/mono/mini/CMakeLists.txt b/src/runtime/src/mono/mono/mini/CMakeLists.txt
index 128ed08f45b..17cbe696c4b 100644
--- a/src/runtime/src/mono/mono/mini/CMakeLists.txt
+++ b/src/runtime/src/mono/mono/mini/CMakeLists.txt
@@ -364,6 +364,11 @@ if(NOT DISABLE_SHARED_LIBS)
set_target_properties(monosgen-shared PROPERTIES IMPORT_SUFFIX ".import.lib")
endif()
target_link_libraries(monosgen-shared PRIVATE ${OS_LIBS} ${ICONV_LIB} ${LLVM_LIBS} ${ICU_LIBS} ${Z_LIBS})
+ # Alpine Linux implements ucontext in a different library
+ if(CLR_CMAKE_HOST_ALPINE_LINUX AND TARGET_S390X)
+ target_link_libraries(monosgen-shared PRIVATE ucontext)
+ endif(CLR_CMAKE_HOST_ALPINE_LINUX AND TARGET_S390X)
+
if(ICU_LDFLAGS)
set_property(TARGET monosgen-shared APPEND_STRING PROPERTY LINK_FLAGS " ${ICU_LDFLAGS}")
endif()
@@ -488,6 +493,11 @@ if(NOT DISABLE_EXECUTABLES)
set_target_properties(mono-sgen PROPERTIES OUTPUT_NAME mono-aot-cross)
endif()
target_link_libraries(mono-sgen PRIVATE monosgen-static ${OS_LIBS} ${ICONV_LIB} ${LLVM_LIBS} ${ICU_LIBS} ${Z_LIBS})
+ # Alpine Linux implements ucontext in a different library
+ if(CLR_CMAKE_HOST_ALPINE_LINUX AND TARGET_S390X)
+ target_link_libraries(mono-sgen PRIVATE ucontext)
+ endif(CLR_CMAKE_HOST_ALPINE_LINUX AND TARGET_S390X)
+
if(NOT DISABLE_COMPONENTS AND STATIC_COMPONENTS AND NOT DISABLE_LINK_STATIC_COMPONENTS)
# if components are built statically, link them into runtime.
target_sources(mono-sgen PRIVATE "${mono-components-objects}")
diff --git a/src/runtime/src/mono/mono/utils/mono-context.h b/src/runtime/src/mono/mono/utils/mono-context.h
index bd1a3cd0104..db4ba452bcb 100644
--- a/src/runtime/src/mono/mono/utils/mono-context.h
+++ b/src/runtime/src/mono/mono/utils/mono-context.h
@@ -11,6 +11,14 @@
#ifndef __MONO_MONO_CONTEXT_H__
#define __MONO_MONO_CONTEXT_H__
+/*
+ * Handle non-gnu libc versions with nothing in features.h
+ * We have no idea what they're compatible with, so always fail.
+ */
+#ifndef __GLIBC_PREREQ
+# define __GLIBC_PREREQ(x,y) 0
+#endif
+
#include "mono-compiler.h"
#include "mono-sigcontext.h"
#include "mono-machine.h"
--
2.36.3

View file

@ -0,0 +1,25 @@
From 98054ea87ce70247bb09ceafd2ad1a0b36d2fef4 Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/runtime/issues/82269
From: Antoine Martin <dev@ayakael.net>
Date: Sat, 1 Oct 2022 09:21:58 -0400
Subject: [PATCH] Undefine fortify-source on mono-thread-coop
When _FORTIFY_SOURCE=2, there is a bug relating to memcpy that expresses itself.
which makes mono-flavored runtime dump its core. This patch offers a workaround
by undefining _FORTIFY_SOURCE in the problematic file.
See: https://github.com/dotnet/runtime/issues/82269
---
diff --git a/src/runtime/src/mono/mono/utils/mono-threads-coop.c b/src/runtime/src/mono/mono/utils/mono-threads-coop.c
index 4ed659d6605..34bb5785fba 100644
--- a/src/runtime/src/mono/mono/utils/mono-threads-coop.c
+++ b/src/runtime/src/mono/mono/utils/mono-threads-coop.c
@@ -15,6 +15,7 @@
#ifdef TARGET_MACH
#define _DARWIN_C_SOURCE
#endif
+#undef _FORTIFY_SOURCE
#include <mono/utils/mono-compiler.h>
#include <mono/utils/mono-threads.h>

View file

@ -0,0 +1,22 @@
From 75c3e74ea35219f257c80daf9a236e0f518a7875 Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/installer/pull/13378
From: Antoine Martin <dev@ayakael.net>
Date: Wed, 9 Mar 2022 20:16:03 +0000
Subject: [PATCH 1/1] Enable system libunwind
Forces use of system's libunwind
---
diff --git a/src/runtime/eng/SourceBuild.props b/src/runtime/eng/SourceBuild.props
index f595e9b7d1..d90fd47dbd 100644
--- a/src/runtime/eng/SourceBuild.props
+++ b/src/runtime/eng/SourceBuild.props
@@ -47,6 +47,7 @@
<InnerBuildArgs>$(InnerBuildArgs) /p:BuildDebPackage=false</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) /p:RuntimeOS=$(RuntimeOS)</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) /p:AdditionalRuntimeIdentifierParent=$(BaseOS)</InnerBuildArgs>
+ <InnerBuildArgs>$(InnerBuildArgs) --cmakeargs -DCLR_CMAKE_USE_SYSTEM_LIBUNWIND=TRUE</InnerBuildArgs>
</PropertyGroup>
</Target>

View file

@ -0,0 +1,31 @@
From 91988b0241a77f1f6524c19e2ce55dda06de7242 Mon Sep 17 00:00:00 2001
Patch-Source: https://src.fedoraproject.org/rpms/dotnet6.0/blob/src/runtime/rawhide/f/runtime-arm64-lld-fix.patch
From: Omair Majid <omajid@redhat.com>
Date: Wed, 16 Feb 2022 18:08:22 +0000
Subject: [PATCH 1/1] arm64 lld fix
---
eng/native/init-compiler.sh | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/src/runtime/eng/native/init-compiler.sh b/src/runtime/eng/native/init-compiler.sh
index 567d18da474..05245c7b9f8 100755
--- a/src/runtime/eng/native/init-compiler.sh
+++ b/src/runtime/eng/native/init-compiler.sh
@@ -108,11 +108,8 @@ if [[ -z "$CC" ]]; then
fi
if [[ "$compiler" == "clang" ]]; then
- if 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"
- fi
+ if "$CC" -fuse-ld=lld -Wl,--version >/dev/null 2>&1; then
+ LDFLAGS="-fuse-ld=lld"
fi
fi
--
2.34.1

View file

@ -0,0 +1,35 @@
From 4c74721e1f5da9642adab03075dda2f55719ac7b Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/sdk/pull/14239
From: Esgariot <esgariot@icloud.com>
Date: Mon, 19 Oct 2020 23:42:37 +0200
Subject: [PATCH 1/1] Add zsh compdef completion script.
Continuing off of PR 13384 in upstream.
This commit is ready to be rebased to include appropriate co-authors
before merging PR.
---
scripts/register-completions.zsh | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/src/sdk/scripts/register-completions.zsh b/src/sdk/scripts/register-completions.zsh
index 8eebe9a867..faa32fef71 100644
--- a/src/sdk/scripts/register-completions.zsh
+++ b/src/sdk/scripts/register-completions.zsh
@@ -1,10 +1,3 @@
-# zsh parameter completion for the dotnet CLI
-
-_dotnet_zsh_complete()
-{
- local completions=("$(dotnet complete "$words")")
-
- reply=( "${(ps:\n:)completions}" )
-}
-
-compctl -K _dotnet_zsh_complete dotnet
+#compdef dotnet
+local completions=("$(dotnet complete "$words")")
+[[ -n "$completions" ]] && compadd -- "${(ps:\n:)completions}"
--
2.34.1

View file

@ -0,0 +1,32 @@
From eb7141ec561b9a2551d16ee661343b87c5e5f1b1 Mon Sep 17 00:00:00 2001
From: Antoine Martin <dev@ayakael.net>
Date: Sun, 23 Jan 2022 15:47:27 +0000
Subject: [PATCH 1/1] SDK telemetry optout
Disables telemetry by default.
---
src/Cli/dotnet/Program.cs | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/sdk/src/Cli/dotnet/Program.cs b/src/sdk/src/Cli/dotnet/Program.cs
index c3be733b4a..2a157a75d5 100644
--- a/src/sdk/src/Cli/dotnet/Program.cs
+++ b/src/sdk/src/Cli/dotnet/Program.cs
@@ -27,6 +27,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.
--
2.35.1