Compare commits

...

3 commits

36 changed files with 993 additions and 5480 deletions

View file

@ -1,88 +1,44 @@
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
# secfixes:
# 7.0.103-r0:
# - CVE-2023-21808
# 7.0.105-r0:
# - CVE-2023-28260
# 7.0.107-r0:
# - CVE-2023-24895
# - CVE-2023-24897
# - CVE-2023-24936
# - CVE-2023-29331
# - CVE-2023-29337
# - CVE-2023-32032
# - CVE-2023-33126
# - CVE-2023-33128
# - CVE-2023-33135
# 7.0.109-r0:
# - CVE-2023-33127
# - CVE-2023-33170
# 7.0.110-r0:
# - CVE-2023-38178
# - CVE-2023-35390
# - CVE-2023-38180
# - CVE-2023-35391
# 7.0.111-r0:
# - CVE-2023-36792
# - CVE-2023-36793
# - CVE-2023-36794
# - CVE-2023-36796
# - CVE-2023-36799
# 7.0.112-r0:
# - CVE-2023-36435
# - CVE-2023-38171
# - CVE-2023-44487
# 7.0.113-r0:
# - CVE-2023-36792
# - CVE-2023-36793
# - CVE-2023-36794
# - CVE-2023-36796
# - CVE-2023-36799
# - CVE-2023-44487
# - CVE-2023-38171
# - CVE-2023-36435
# 7.0.114-r0:
# - CVE-2023-36049
# - CVE-2023-36558
pkgname=dotnet7-build
pkgver=7.0.114
pkgname=dotnet8-runtime
pkgver=8.0.0
pkgrel=0
_gittag=v$pkgver
_giturl="https://github.com/dotnet/installer"
_testtag=e1cc0f181ffd4d755756d30d985513897d592ba4
_bunnytag=v12
_llvmver=16
_gittag=v8.0.0
_giturl="https://github.com/dotnet/dotnet"
_testtag=d3d39e7c404c6e45c3e7ab6621c5f6cabf1540b0
_bunnytag=v15
_patches="
build_disable-package-validation.patch
build_disable-source-link.patch
aspnetcore_portable-build-workaround.patch
aspire_fix-gitinfo-target.patch
build_enable-timestamps.patch
installer_hard-dereference-tar-gz.patch
roslyn-analyzer_disable-apphost.patch
runtime_76500-mono-musl-support.patch
runtime_82269-mono-thread-coop-undefine-fortify-source.patch
runtime_enable-runtime-marshalling.diff
runtime_90251-rename-mono-cmake-host-var.patch
runtime_enable-system-libunwind.diff
runtime_more-clang-16-suppression.patch
runtime_remove-usage-of-off64-t.patch
sdk_14239-add-zsh-compdef-completion-script.patch
vstest_intent-net8.0.patch
"
_pkgver_macro=${pkgver%.*}
_pkgver_prior=${pkgver%.*.*}
_pkgver_name=${_pkgver_macro//[.0]}
pkgdesc="The .NET $_pkgver_macro bootstrap"
_pkgver_sdk=${pkgver/0./0.10}
pkgdesc="The .NET $_pkgver_macro Core runtime"
# x86: blocked by https://github.com/dotnet/runtime/issues/77667
# armhf: blocked by https://github.com/dotnet/runtime/issues/77663
# riscv64: port WIP https://github.com/dotnet/runtime/issues/36748
# s390x | ppc64le: no diskspace / lack maintainer resources
arch="x86_64 armv7 aarch64"
# riscv64: blocked by https://github.com/dotnet/runtime/issues/84834
arch="all !x86 !armhf !riscv64"
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
provides="dotnet$_pkgver_name=$pkgver-r$pkgrel"
depends="
dotnet$_pkgver_name-hostfxr
icu-data-full
icu-libs
"
checkdepends="
babeltrace
binutils
@ -99,9 +55,8 @@ checkdepends="
which
"
makedepends="
alpine-release
bash
clang$_llvmver
clang
cmake
dotnet$_pkgver_name-bootstrap
dotnet$_pkgver_name-bootstrap-artifacts
@ -121,7 +76,7 @@ makedepends="
libxml2-utils
linux-headers
lldb-dev
llvm$_llvmver-dev
llvm-dev
lttng-ust-dev
nodejs
numactl-dev
@ -139,21 +94,26 @@ case $CARCH in
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
aspnetcore$_pkgver_name-runtime:aspnetcore_runtime:noarch
aspnetcore$_pkgver_name-runtime-dbg:aspnetcore_dbg:noarch
aspnetcore$_pkgver_name-targeting-pack:aspnetcore_targeting_pack:noarch
dotnet$_pkgver_name-runtime-artifacts::noarch
dotnet$_pkgver_name-runtime-bootstrap
dotnet$_pkgver_name-runtime-dbg:runtime_dbg:noarch
dotnet$_pkgver_name-apphost-pack:apphost_pack
dotnet$_pkgver_name-hostfxr
dotnet$_pkgver_name-targeting-pack:targeting_pack:noarch
dotnet-host:host
"
source="
https://lab.ilot.io/dotnet/installer/-/releases/$_gittag/downloads/tarball/dotnet-$_gittag.tar.xz
dotnet-tarball-$_gittag.tar.gz::https://github.com/dotnet/dotnet/archive/refs/tags/$_gittag.tar.gz
dotnet-release-$_gittag.json::https://github.com/dotnet/dotnet/releases/download/$_gittag/release.json
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
dotnet.sh.in
$_patches
"
builddir="$srcdir"/dotnet-$_gittag
builddir="$srcdir"/dotnet-${_gittag/v}
_checkdir="$srcdir"/dotnet-bunny-${_bunnytag/v}
_testdir="$srcdir"/dotnet-regular-tests-$_testtag
_cli_root="$srcdir"/bootstrap
@ -200,54 +160,9 @@ _fix_executable() {
-exec chmod -x '{}' \;
}
# generates tarball containing all components built by dotnet
snapshot() {
local _pkg="$srcdir"/${builddir##*/}.tar
ulimit -n 4096
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 $_libdir/dotnet/bootstrap/${_pkgver_macro}* -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
# Parallel restore is broken on mono-based builds since dotnet7
# see https://github.com/dotnet/runtime/issues/77364
# A workaround via runtime_enable-runtime-marshalling.diff
case $CARCH in
s390x|ppc64le)
msg "runtime_enable-runtime-marshalling.diff"
patch -p1 -i "$srcdir"/runtime_enable-runtime-marshalling.diff
;;
esac
# Using system libunwind is broken on aarch64|armv7, and unused on mono-based builds
# see https://github.com/dotnet/source-build/issues/2408,
case $CARCH in
@ -287,20 +202,18 @@ build() {
ulimit -n 4096
export PATH="$PATH:/usr/lib/llvm$_llvmver/bin"
# Disable use of LTTng as tracing on lttng <=2,13,0 is broken
# 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
case "$CARCH" in
x86*) ;;
*)
# clang doesn't implement this outside of x86, and it causes a later configure to fail
export CFLAGS="${CFLAGS/-fstack-clash-protection}"
export CXXFLAGS="${CXXFLAGS/-fstack-clash-protection}"
x86*) ;;
*)
# clang doesn't implement this outside of x86, and it causes a later configure to fail
export CFLAGS="${CFLAGS/-fstack-clash-protection}"
export CXXFLAGS="${CXXFLAGS/-fstack-clash-protection}"
;;
esac
@ -318,8 +231,9 @@ build() {
# part of https://github.com/dotnet/installer/pull/14792 that sets this flag
# was not integrated in 7.0.1xx yet
# UseSharedCompilation=false also reduces chances of hangups on mono-based builds
case $CARCH in
s390x|ppc64le) local args="$args /p:SourceBuildUseMonoRuntime=true";;
riscv64|s390x|ppc64le) local args="$args /p:SourceBuildUseMonoRuntime=true /p:UseSharedCompilation=false";;
esac
# Sets TargetRid manually as dotnet cannot be trusted to reliably compute
@ -341,6 +255,7 @@ build() {
./build.sh \
--with-sdk "$_cli_root" \
--with-packages "$_artifactsdir" \
--release-manifest "$srcdir"/dotnet-release-$_gittag.json \
-- $args
}
@ -350,12 +265,13 @@ check() {
local _tests_timeout=1000
# Test suite disable flags
# following tests can only work after packaging step
local _disabled_tests="man-pages distribution-package bash-completion install-location release-version-sane"
local _disabled_tests="man-pages distribution-package bash-completion install-location release-version-sane managed-symbols-available tools-in-path"
# 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"
local _disabled_tests="$_disabled_tests createdump-aspnet"
# test broken: cannot pg_ctl can't create postgresql server
local _disabled_tests="$_disabled_tests system-data-odbc"
# test broken: no such file or directory bug
local _disabled_tests="$_disabled_tests limits"
# {bundled,system}-libunwind: use system version on all but aarch64/armv7, as broken
# see https://github.com/redhat-developer/dotnet-regular-tests/issues/113
# disable on mono-flavored runtime as mono does not use libunwind
@ -364,14 +280,10 @@ check() {
s390x|ppc64le|armhf) local _disabled_tests="$_disabled_tests bundled-libunwind system-libunwind";;
*) local _disabled_tests="$_disabled_tests bundled-libunwind";;
esac
# test unit broken currently
local _disabled_tests="$_disabled_tests system-libunwind"
# nativeaot is not supported on armv7
case $CARCH in
armv7) local _disabled_tests="$_disabled_tests nativeaot"
esac
# test unit hangs
local _disabled_tests="$_disabled_tests debugging-via-dotnet-dump"
msg "Unpacking produced dotnet"
export DOTNET_ROOT="$_checkdir/release"
@ -388,9 +300,12 @@ check() {
_fix_executable "$DOTNET_ROOT"
msg "Building turkey test suite"
if [ ! -d "$_logdir/check" ]; then
mkdir -p "$_logdir"/check
fi
if [ ! -d "$_checkdir"/turkey ]; then
cd "$_checkdir"/Turkey
dotnet publish -f netcoreapp3.1 -c Release -p:VersionPrefix=1 -p:VersionSuffix="$(git rev-parse --short HEAD)" -o "$_checkdir"/turkey
dotnet publish -bl:"$_logdir"/check/turkey.binlog -f net6.0 -c Release -p:VersionPrefix=1 -p:VersionSuffix="$(git rev-parse --short HEAD)" -o "$_checkdir"/turkey
fi
msg "Running test suite"
@ -400,39 +315,20 @@ check() {
sed -i 's|"enabled": true|"enabled": false|' $i/test.json
fi
done
dotnet "$_checkdir"/turkey/Turkey.dll -t $_tests_timeout || local ERROR=true
dotnet "$_checkdir"/turkey/Turkey.dll -t $_tests_timeout -l "$_logdir"/check || local ERROR=true
if [ $ERROR ]; then
msg "Check error reported, dumping logs"
for i in *.log; do
msg "Dumping $i"
cat "$i"
done
msg "Check error reported, please check logs"
fi
}
package() {
# directory creation
install -dm 755 \
"$pkgdir"/$_libdir/dotnet/bootstrap/$pkgver \
"$pkgdir"/usr/share/man/man1 \
"$pkgdir"/$_libdir/dotnet/artifacts/$pkgver
install -dm 755 "$pkgdir"/$_libdir/dotnet/shared
# 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/ \
-C "$pkgdir"/$_libdir/dotnet/ \
--no-same-owner \
--wildcards \
'*alpine*'
# assemble docs
find "$builddir" -iname 'dotnet*.1' -type f -exec cp '{}' "$pkgdir"/usr/share/man/man1/. \;
./shared/Microsoft.NETCore.App
# some files either should or should not have executable bits
_fix_executable "$pkgdir"
@ -440,74 +336,23 @@ package() {
# 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
rm "$pkgdir"/$_libdir/dotnet/shared/Microsoft.NETCore.App/*/libcoreclrtraceptprovider.so
fi
}
sdk() {
pkgdesc="The .NET $_pkgver_macro SDK"
# libucontext isn't automatically detected on all platforms
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
libucontext
"
provides="
dotnet-sdk-$_pkgver_macro=$pkgver-r$pkgrel
dotnet$_pkgver_name-dev=$pkgver-r$pkgrel
"
runtime_dbg() {
pkgdesc="The .NET $_pkgver_macro Core runtime - pdb debug files"
depends="dotnet$_pkgver_name-runtime"
provides="dotnet-runtime-dbg-$_pkgver_macro=$pkgver-r$pkgrel"
install -dm 755 "$subpkgdir"/$_libdir/dotnet
install -dm 755 "$subpkgdir"/$_libdir/dotnet/shared
# sdk
tar --use-compress-program="pigz" \
-xf "$builddir"/artifacts/$_dotnet_arch/Release/dotnet-sdk-$_pkgver_macro*.tar.gz \
-xf "$builddir"/artifacts/$_dotnet_arch/Release/dotnet-symbols-sdk-$_pkgver_macro*.tar.gz \
-C "$subpkgdir"/$_libdir/dotnet/ \
--no-same-owner \
./sdk ./sdk-manifests
shared/Microsoft.NETCore.App
# 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() {
@ -518,67 +363,202 @@ artifacts() {
# directory creation
install -dm 755 \
"$subpkgdir"/$_libdir/dotnet/artifacts/$pkgver \
"$subpkgdir"/$_libdir/dotnet/artifacts/$_pkgver_sdk \
"$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/ \
-C "$subpkgdir"/$_libdir/dotnet/artifacts/$_pkgver_sdk/ \
--no-same-owner \
--exclude '*Intermediate*' \
--exclude '*alpine*'
}
zshcomp() {
bootstrap() {
pkgdesc="The .NET $_pkgver_macro Core bootstrap"
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
}
# hack for dotnetx-runtime to be able to pull itself for bootstrapping
provides="dotnet$_pkgver_name-bootstrap"
provider_priority=$_pkgver_prior
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"
# directory creation
install -dm 755 \
"$subpkgdir"/$_libdir/dotnet/bootstrap/$_pkgver_sdk/docs \
"$subpkgdir"/$_libdir/dotnet/artifacts/$_pkgver_sdk
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
# unpack sdk to bootstrap
tar --use-compress-program="pigz" \
-xf "$builddir"/artifacts/$_dotnet_arch/Release/dotnet-sdk-$_pkgver_macro*.tar.gz \
-C "$subpkgdir"/usr/share/licenses/dotnet/ \
-C "$subpkgdir"/$_libdir/dotnet/bootstrap/$_pkgver_sdk/ \
--no-same-owner
# unpack sdk symbols to bootstrap
tar --use-compress-program="pigz" \
-xf "$builddir"/artifacts/$_dotnet_arch/Release/dotnet-symbols-sdk-$_pkgver_macro*.tar.gz \
-C "$subpkgdir"/$_libdir/dotnet/bootstrap/$_pkgver_sdk/ \
--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 "$subpkgdir"/$_libdir/dotnet/artifacts/$_pkgver_sdk/ \
--no-same-owner \
./LICENSE.txt ./ThirdPartyNotices.txt
--wildcards \
'*alpine*'
# assemble docs
find "$builddir" -iname 'dotnet*.1' -type f -exec cp '{}' "$subpkgdir"/$_libdir/dotnet/bootstrap/$_pkgver_sdk/docs/. \;
# completions
install -m 755 "$builddir"/src/sdk/scripts/register-completions.bash "$subpkgdir"/$_libdir/dotnet/bootstrap/$_pkgver_sdk/.
install -m 755 "$builddir"/src/sdk/scripts/register-completions.zsh "$subpkgdir"/$_libdir/dotnet/bootstrap/$_pkgver_sdk/.
# some files either should or should not have executable bits
_fix_executable "$subpkgdir"
# 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 "$subpkgdir"/$_libdir/dotnet/bootstrap/*/shared/Microsoft.NETCore.App/*/libcoreclrtraceptprovider.so
fi
}
host() {
pkgdesc="A generic driver for the .NET Core Command Line Interface"
depends=""
install -dm 755 \
"$subpkgdir"/etc/profile.d \
"$subpkgdir"/etc/dotnet \
"$subpkgdir"/usr/bin \
"$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 \
./dotnet
ln -s $_libdir/dotnet/dotnet "$subpkgdir"/usr/bin/dotnet
echo "$_libdir/dotnet" > "$subpkgdir"/etc/dotnet/install_location
echo "$_libdir/dotnet" > "$subpkgdir"/etc/dotnet/install_location_$_dotnet_arch
sed "s|%LIBDIR%|$_libdir/dotnet|" "$srcdir"/dotnet.sh.in > "$subpkgdir"/etc/profile.d/dotnet.sh
}
hostfxr() {
pkgdesc="The .NET host resolver contains the logic to resolve and select the right version of the .NET SDK or runtime to use."
depends="dotnet-host"
provides="dotnet-hostfxr-$_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 \
./host
# some files either should or should not have executable bits
_fix_executable "$subpkgdir"
}
aspnetcore_runtime() {
pkgdesc="The ASP.NET $_pkgver_macro Core runtime"
depends="dotnet$_pkgver_name-runtime"
provides="aspnetcore-runtime-$_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 \
./shared/Microsoft.AspNetCore.App
# some files either should or should not have executable bits
_fix_executable "$subpkgdir"
}
aspnetcore_dbg() {
pkgdesc="The ASP.NET $_pkgver_macro Core runtime - pdb debug files"
depends="aspnetcore$_pkgver_name-runtime"
provides="aspnetcore-runtime-dbg-$_pkgver_macro=$pkgver-r$pkgrel"
install -dm 755 "$subpkgdir"/$_libdir/dotnet
tar --use-compress-program="pigz" \
-xf "$builddir"/artifacts/$_dotnet_arch/Release/dotnet-symbols-sdk-$_pkgver_macro*.tar.gz \
-C "$subpkgdir"/$_libdir/dotnet/ \
--no-same-owner \
shared/Microsoft.AspNetCore.App
}
apphost_pack() {
pkgdesc="The .NET $_pkgver_macro Core apphost pack"
provides="dotnet-apphost-pack-$_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 \
--wildcards \
'./packs/Microsoft.NETCore.App.Host.*'
# some files either should or should not have executable bits
_fix_executable "$subpkgdir"
}
targeting_pack() {
pkgdesc="The .NET $_pkgver_macro Core targeting pack"
provides="dotnet-targeting-pack-$_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 \
./packs/Microsoft.NETCore.App.Ref
# some files either should or should not have executable bits
_fix_executable "$subpkgdir"
}
aspnetcore_targeting_pack() {
pkgdesc="The ASP.NET $_pkgver_macro Core targeting pack"
provides="aspnetcore-targeting-pack-$_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 \
./packs/Microsoft.AspNetCore.App.Ref
# some files either should or should not have executable bits
_fix_executable "$subpkgdir"
}
sha512sums="
ff554ad65e09b5dbce2bc617a6ed548081a2078b23f04ef7812309fe98e21303d0a090118a283cf5123c4a28690e63e3f151b364c56f8ee1e56ae6e63a4f50bc dotnet-v7.0.114.tar.xz
e9f3df13d093fac214778c1137857e065f58d4e0d2a48d540d8ed7bb41e2fd73b2b3f62a0aa5b0e80fa80a5b58ba77ff19b9d10a492802f8539e3a6ed79d299d dotnet-testsuite-e1cc0f181ffd4d755756d30d985513897d592ba4.tar.gz
0028d5d97b814b122d73137b4e0d64ca5d788aa0ae5fde500de722e23522827f2538f06e75acb17cc39b8917961ee78d1f0bbc84b2b624ae0e9bf88adca2ba6f dotnet-bunny-v12.tar.gz
429033f5f6a8e33eb849c29c1d6628faca13751e1b1e536179b491041034dcdee107cbff12f7e9f1ef68a178a0818c534113f63bc8bbc37de67ec900c23cacf4 build_disable-package-validation.patch
ebab0364deab5d99131e2724b7fbac668bc27ddf74958623af1913e49850df98b2d077d27324b2bbabbbcdf77ea48bf7a7ca83d0ced6f48bdb66cc1e8bbce4a4 build_disable-source-link.patch
86fbaa058f78bba100f534f4c4bd6d7254181909f70d264c0390d3dd89c878a14ba9b5d2de05271b2c07b73ead70e029488c926221f676d59e27e387e3e579e9 build_enable-timestamps.patch
4ac92d2d9190a55ee20d3e145a28a6953c98d3eb838c8acfb808b8839316443cb64da4a2c5787df0171fce7ef96ff6381043085ed90c23ec09ce9ac81571e675 roslyn-analyzer_disable-apphost.patch
b56d5053831c43b8fed48894735b9910020abbae62b2b57bc9a423cd5ef09f412025e56dd9ce1994f551b87155d682796203fd351ca7fb8a29658078a6d4b029 runtime_76500-mono-musl-support.patch
094265462d66d97b51ebfbe5fb06d4a679b97881f1f5a07a87a282a96eeaabfe97ca42061d59aac71dd8861c07f07dda16a72e29ae03167407e51d3fd2767562 dotnet-tarball-v8.0.0.tar.gz
55f2c56f7fbed4137ebe5e81c7b86d199d7ff91c6e19fbc9a4af8cd5d0f0195273356ead8b80aedfff56a3d704a541a7c2a7395bec3fa5d6585f3afd056b1220 dotnet-release-v8.0.0.json
8fe41ddd03c1b98dc9eec5e337ca0dcc8fbeff65b67ac1a383bd7d1e5fd3c21b820dacd498d1c2268445bb634cfb9dba3e8924e71a98f2ccd8221b17fb079044 dotnet-testsuite-d3d39e7c404c6e45c3e7ab6621c5f6cabf1540b0.tar.gz
7f59b10878aa90a6953ee4d88d08fa932910a24018dace92b173ee87c847d14734f93dc5fc031982a3d0a5cb4ac223b83d0e548531c23c4e3326dc83510989a9 dotnet-bunny-v15.tar.gz
c3f31956976b77198e72a3fef3427338b6b2961f8c121416040c1105de0ce8073e46f4c2e9ef22a001aee69cbe39621c2ddac988522693110071dfae42f2e2b7 dotnet.sh.in
ad7373a112acc07a6a7bbc522d417b26d90b3e3ae9c1e66a6cc70af16af7e7111d9764e7758062d0a5e67f026cc44f2b111051c3d484bd56917f2144db88588b aspnetcore_portable-build-workaround.patch
e5b9b947226456844f705e66f3f19d4519ce88f360e3f3413999c2867c31d9008db78f5806bfee7185d7548c6279ef6492a40ff24c20ed9d58b6ef66b167d7a8 aspire_fix-gitinfo-target.patch
eed7a7481a967f6938de956a6df485efa6dd61bf36ae4a768493cb1f7da0296dc91e0f2f89f7c302083ba9cf0c778e28228ec1b52e902077a00072d7d9957ef3 build_enable-timestamps.patch
ab362bdbbea8d8116b6bf7bf58e330ce6d7d171b42613ac03514f76afa2574b75d6566148d1b72047fbfe61b40ac67b3f2d8af87a7074c790bf882a5b7e73960 installer_hard-dereference-tar-gz.patch
097db705c787501782a1b203e8c453453075dfcadc4f5282849c6ffdda4d7832f75c56089bced4542cc83704fe33842cc725084dac2ba261cacdaf54ae468b3c roslyn-analyzer_disable-apphost.patch
d732df247c721c9f677baabdd7f36dbf4b564814ff64164361065bb1c196b767494a1d39f634eadf01a23032c7b3e64102614b7213065c81096bbf3f8022e6a0 runtime_82269-mono-thread-coop-undefine-fortify-source.patch
1f7be536c4826638853f110ee88bbd554be015cc88c6491c1066830789be18ad324f8ed2b1b75ed7aad74457dcafc812730059cb25d36d6344bfae8a517c00c4 runtime_enable-runtime-marshalling.diff
293742ab307bef459a21deadcc4ad7c7996cc4b490910a36c2763b8ad25cc8a91c4e03b6290567cd1030f69638d0156c5b6970887858fb091f8482b67356065d runtime_enable-system-libunwind.diff
d972e77df27748a80c9b23eca12f9fbd78be97f9034b79cc5703ba58eb6750171d9a115314300f883620ccbca89c65a99ca7a45d54a421b028b590190b4bed80 runtime_remove-usage-of-off64-t.patch
d1b4ebcbb1a6815fc0ce4c471485c232618e60968a879309fb8336821a9351d2e0028d9f7726c0c041c750b497a0baa47400c78c9ceff550b91b4a6c2816fc41 sdk_14239-add-zsh-compdef-completion-script.patch
3354fa721809f1b94c579408ee78004ff3ca2ba79212c1a0ecc424a9955bb5d5a80c115d4c30dd257526f356ea76f0562db6f83d8dd0b6135f8c689886b3348d runtime_90251-rename-mono-cmake-host-var.patch
39e1b848d1ae81e4b81758522de7d3e36b11d2ab626565efb8e4cceae8da29018277709f0af8fcfa75be8da79f8d6432eb6aac49a5e82510c3aca34632df4d8e runtime_enable-system-libunwind.diff
887112eb2b103eadd6887529ebae7f9a75df2c2cb168e84fd40cc09f9bcd20917d428bbba06968b07b0a463890da82b1b2b1d033a3dd016e6494067464ae6f74 runtime_more-clang-16-suppression.patch
0c25319125ef5b0ad490b37a643c0c5257c796d5ed24f9ac404f698710b07de790bcbb0b6336d4a50025b94c3bff99b214951bd8f0a79a8d6f543ebaa300740f runtime_remove-usage-of-off64-t.patch
5c74abbd7ea71ba6164f71b866c9da564db9ccd95f1a9a8b82f5b0b599fab6d59d64ba1157ec13d7ac36d23145f3d9de2189ed6c40f56e46555ab378c161948b vstest_intent-net8.0.patch
"

View file

@ -1,22 +1,23 @@
# dotnet7-build
# dotnet8-runtime
This is the .NET 7.0 package for Alpine Linux.
This is the .NET 8.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
* `dotnet7-build` (aimed for internal use as bootstrap)
* `dotnet7-build-artifacts` (aimed for internal use as bootstrap)
* `dotnet7-sdk`
* `dotnet7-templates` (required by sdk)
* `dotnet-zsh-completion`
* `dotnet-bash-completion`
* `dotnet-doc`
* `netstandard21-targeting-pack`
* `aspnetcore8-runtime`
* `aspnetcore8-targeting-pack`
* `dotnet8-apphost-pack` (used by dotnet8-runtime)
* `dotnet8-hostfxr` (used by dotnet-host)
* `dotnet8-runtime`
* `dotnet8-runtime-artifacts` (aimed for internal use as bootstrap)
* `dotnet8-runtime-bootstrap` (aimed for internal use as bootstrap)
* `dotnet8-targeting-pack`
* `dotnet-host`
## How to build dotnet7 on Alpine
## How to build dotnet8 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)
@ -27,17 +28,20 @@ builds bootstraps for Alpine on `x86_64`, `aarch64`, and `armv7`. Thus, `stage0`
has also been designed to be crossbuild aware, allowing bootstrapping to other
platforms.
In summary, dotnet7 is built using three different aports.
In summary, dotnet8 is built using three different aports.
* `community/dotnet7-stage0`
Builds minimum components for full build of dotnet7, and packages these in an initial
`dotnet7-stage0-bootstrap` package that `dotnet7-build` pulls.
* `community/dotnet7-build`
Builds full and packages dotnet7 fully using either stage0 or previoulsy built
dotnet7 build.
* `community/dotnet7-runtime`
* `community/dotnet8-stage0`
Builds minimum components for full build of dotnet8, and packages these in an initial
`dotnet8-stage0-bootstrap` package that `dotnet8-runtime` pulls.
* `community/dotnet8-runtime`
Builds full and packages dotnet8 fully using either stage0 or previoulsy built
dotnet8 build.
* `community/dotnet8-sdk`
As abuild does not allow different versions for subpackages, a different aport
is required to package runtime bits from dotnet7-build.
is required to package sdk bits from dotnet8-runtime. dotnet8-runtime only
builds 8.0.1xx feature branch of SDK. Thus, when a new feature branch of sdk is
released, the updated components are to be built on dotnet8-sdk rather than
simply repackaging dotnet8-runtime artifacts.
## Crossbuilding with `stage0`
Crossbuilding `stage0` is a three step process:
@ -49,7 +53,7 @@ Crossbuilding `stage0` is a three step process:
`$HOME/sysroot-$CTARGET_ARCH/etc/apk/repositories`, making sure to add required
keys. This makes it so that whatever package is not built in step 1 will
be pulled from package repos
3. Crossbuild `dotnet7-stage0` via:
3. Crossbuild `dotnet8-stage0` via:
```
CHOST=$CTARGET_ARCH abuild -r
```
@ -58,7 +62,7 @@ CHOST=$CTARGET_ARCH abuild -r
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 `dotnet7` as opposed to `dotnet-7.0`
In addition, the package is named `dotnet8` as opposed to `dotnet-8.0`
to match Alpine Linux naming conventions for packages with many installable versions
# Contributing
@ -74,7 +78,7 @@ follow.
2. Checkout the forked repository.
- `git clone ssh://git@gitlab.alpinelinux.org/$USER/aports`
- `cd community/dotnet7-build`
- `cd community/dotnet8-runtime`
3. Make your changes. Don't forget to add a changelog.
@ -86,15 +90,15 @@ follow.
6. Commit the changes to the git repo in a git branch
- `git checkout -b dotnet7/<name>`
- `git checkout -b dotnet8/<name>`
- `git add` any new patches
- `git remove` any now-unnecessary patches
- `git commit -m 'community/dotnet7-build: descriptive description'`
- `git commit -m 'community/dotnet8-runtime: descriptive description'`
- `git push`
7. Create a merge request with your changes, tagging @ayakael for review.
8. Once the tests in the merge-request pass, and reviewers are happy, your changes
8. Once the tests in the pull-request pass, and reviewers are happy, your changes
will be merged.
## Updating to an new upstream release
@ -104,7 +108,7 @@ follow.
2. Checkout the forked repository.
- `git clone ssh://git@gitlab.alpinelinux.org/$USER/aports`
- `cd community/dotnet7-build`
- `cd community/dotnet8-runtime`
3. Build the new upstream source tarball. Update the versions in the
@ -125,15 +129,15 @@ follow.
7. Commit the changes to the git repo in a git branch.
- `git checkout -b dotnet7/<name>`
- `git checkout -b dotnet8/<name>`
- `git add` any new patches
- `git remove` any now-unnecessary patches
- `git commit -m 'community/dotnet7-build: upgrade to <new-version>`
- `git commit -m 'community/dotnet8-runtime: upgrade to <new-version>`
- `git push`
8. Create a merge request with your changes, tagging @ayakael for review.
9. Once the tests in the merge-request pass, and reviewers are happy, your changes
9. Once the tests in the pull-request pass, and reviewers are happy, your changes
will be merged.
# Testing

View file

@ -0,0 +1,20 @@
diff --git a/src/aspire/Directory.Build.targets.orig b/src/aspire/Directory.Build.targets
index 511adb03a5d..d62a050caab 100644
--- a/src/aspire/Directory.Build.targets.orig
+++ b/src/aspire/Directory.Build.targets
@@ -6,13 +6,12 @@
<PackageReadmeFile Condition="'$(PackageReadmeFile)' == '' And '$(ReadMeExists)' == 'true'">README.md</PackageReadmeFile>
</PropertyGroup>
- <Import Condition="'$(SampleProject)' == 'true' or '$(CI)' != 'true' " Project="eng\Versions.dev.targets" />
- <Import Condition="'$(SampleProject)' != 'true' and '$(CI)' == 'true' " Project="eng\Versions.targets" />
+ <Import Project="eng\Versions.dev.targets" />
<Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" />
<ItemGroup Condition="'$(ReadMeExists)' == 'true'">
<None Include="$(ReadMePath)" Pack="true" PackagePath="\" />
</ItemGroup>
-
+
</Project>

View file

@ -0,0 +1,43 @@
From 451aa3e9544b0214d0e8e844c27af3847f5bf391 Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/installer/pull/13410
From: Antoine Martin <dev@ayakael.net>
Date: Fri, 18 Feb 2022 05:14:39 +0000
Subject: [PATCH 1/1] musl build fix
Line causes build of aspnetcore on arm to look for linux version of
CrossGen2 rather than linux-musl. This removes the line so that
BuildOsName is pulled from TargetOsName as expected
This is now only necessary for portable
builds, as https://github.com/dotnet/installer/pull/14549 has fixed
issues relating to musl build on full source-build
---
.../App.Runtime/src/Microsoft.AspNetCore.App.Runtime.csproj | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/aspnetcore/src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.csproj.orig b/src/aspnetcore/src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.csproj
index 77dce00..b31b36d 100644
--- a/src/aspnetcore/src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.csproj.orig
+++ b/src/aspnetcore/src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.csproj
@@ -103,8 +103,7 @@ This package is an internal implementation of the .NET Core SDK and is not meant
Special case the crossgen2 package reference on Windows to avoid the x86 package when building in Visual Studio.
-->
<BuildOsName>$(TargetOsName)</BuildOsName>
- <BuildOsName Condition="'$(TargetOsName)' == 'linux-musl' and '$(TargetArchitecture)' != 'x64'">linux</BuildOsName>
<BuildOsName Condition=" '$(PortableBuild)' == 'false' ">$(TargetRuntimeIdentifier.Substring(0,$(TargetRuntimeIdentifier.IndexOf('-'))))</BuildOsName>
<Crossgen2BuildArchitecture Condition=" '$(BuildOsName)' == 'win' ">x64</Crossgen2BuildArchitecture>
<Crossgen2BuildArchitecture Condition=" '$(Crossgen2BuildArchitecture)' == '' ">$(BuildArchitecture)</Crossgen2BuildArchitecture>
<Crossgen2PackageRootVariableName>PkgMicrosoft_NETCore_App_Crossgen2_$(BuildOsName.Replace('.', '_'))-$(Crossgen2BuildArchitecture)</Crossgen2PackageRootVariableName>
diff --git a/repo-projects/aspnetcore.proj.orig b/repo-projects/aspnetcore.proj
index 289b506..fadcc0d 100644
--- a/repo-projects/aspnetcore.proj.orig
+++ b/repo-projects/aspnetcore.proj
@@ -13,6 +13,7 @@
<BuildCommandArgs>$(StandardSourceBuildArgs.Replace('--publish', ''))</BuildCommandArgs>
<!-- The arch flag (defaults to x64) overrides any value of TargetArchitecture that we might set -->
<BuildCommandArgs>$(BuildCommandArgs) --arch $(Platform)</BuildCommandArgs>
+ <BuildCommandArgs>$(BuildCommandArgs) --os-name linux-musl</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) --no-build-repo-tasks</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) --no-build-nodejs</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:PublishCompressedFilesPathPrefix=$(SourceBuiltAspNetCoreRuntime)</BuildCommandArgs>

View file

@ -1,12 +0,0 @@
diff --git a/repos/aspnetcore.proj.orig b/repos/aspnetcore.proj
index cea712c1bfa..cf5099da788 100644
--- a/repos/aspnetcore.proj.orig
+++ b/repos/aspnetcore.proj
@@ -10,6 +10,7 @@
<BuildCommandArgs>$(BuildCommandArgs) --no-build-nodejs</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:PublishCompressedFilesPathPrefix=$(SourceBuiltAspNetCoreRuntime)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:PortableBuild=false /p:TargetRuntimeIdentifier=$(TargetRid)</BuildCommandArgs>
+ <BuildCommandArgs>$(BuildCommandArgs) /p:EnablePackageValidation=false </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>

View file

@ -1,20 +0,0 @@
From 98054ea87ce70247bb09ceafd2ad1a0b36d2fef4 Mon Sep 17 00:00:00 2001
From: Antoine Martin <dev@ayakael.net>
Date: Sat, 1 Oct 2022 09:21:58 -0400
Subject: [PATCH] Disable source link
Addresses undiagnosed "Source control information is not available" error
---
diff --git a/repos/installer.proj b/repos/installer.proj
index 3a9756a27b7..4968184b14e 100644
--- a/repos/installer.proj
+++ b/repos/installer.proj
@@ -26,6 +26,7 @@
-->
<BuildCommandArgs>$(BuildCommandArgs) /p:NETCoreAppMaximumVersion=99.9</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:OSName=$(OSNameOverride)</BuildCommandArgs>
+ <BuildCommandArgs>$(BuildCommandArgs) /p:EnableSourceLink=false</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:PortableOSName=$(PortableOS)</BuildCommandArgs>
<BuildCommandArgs Condition="'$(TargetOS)' == 'Linux'">$(BuildCommandArgs) /p:Rid=$(TargetRid)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:DOTNET_INSTALL_DIR=$(DotNetCliToolDir)</BuildCommandArgs>

View file

@ -1,7 +1,7 @@
diff --git a/repos/Directory.Build.props b/repos/Directory.Build.props
diff --git a/repo-projects/Directory.Build.props b/repo-projects/Directory.Build.props
index b70a3161fef..d57f9393299 100644
--- a/repos/Directory.Build.props
+++ b/repos/Directory.Build.props
--- a/repo-projects/Directory.Build.props
+++ b/repo-projects/Directory.Build.props
@@ -134,6 +134,7 @@
<StandardSourceBuildArgs>$(StandardSourceBuildArgs) $(FlagParameterPrefix)pack</StandardSourceBuildArgs>
<StandardSourceBuildArgs>$(StandardSourceBuildArgs) $(FlagParameterPrefix)publish</StandardSourceBuildArgs>

View file

@ -0,0 +1,13 @@
diff --git a/src/installer/src/core-sdk-tasks/TarGzFileCreateFromDirectory.cs.orig b/src/installer/src/core-sdk-tasks/TarGzFileCreateFromDirectory.cs
index 06b9857..066d595 100644
--- a/src/installer/src/core-sdk-tasks/TarGzFileCreateFromDirectory.cs.orig
+++ b/src/installer/src/core-sdk-tasks/TarGzFileCreateFromDirectory.cs
@@ -131,7 +131,7 @@ private string GetSourceSpecification()
private string GetDestinationArchive()
{
- return $"-czf {DestinationArchive}";
+ return $"--hard-dereference -czf {DestinationArchive}";
}
private string GetExcludes()

View file

@ -0,0 +1,13 @@
diff --git a/src/installer/src/redist/targets/GenerateLayout.targets.orig b/src/installer/src/redist/targets/GenerateLayout.targets
index a27834f..0c899d4 100644
--- a/src/installer/src/redist/targets/GenerateLayout.targets.orig
+++ b/src/installer/src/redist/targets/GenerateLayout.targets
@@ -85,7 +85,7 @@
<WinFormsAndWpfSharedFxArchiveFileName>windowsdesktop-runtime-$(MicrosoftWindowsDesktopAppRuntimePackageVersion)-$(SharedFrameworkRid)$(ArchiveExtension)</WinFormsAndWpfSharedFxArchiveFileName>
<Crossgen2Rid>$(HostOSName)-$(BuildArchitecture)</Crossgen2Rid>
- <Crossgen2Rid Condition="'$(DotNetBuildFromSource)' == 'true'">$(SharedFrameworkRid)</Crossgen2Rid>
+ <Crossgen2Rid Condition="'$(DotNetBuildFromSource)' == 'true'">$(SharedFrameworkRid.SubString(0, $(SharedFrameworkRid.LastIndexOf('-'))))-$(BuildArchitecture)</Crossgen2Rid>
<AspNetCoreInstallerRid Condition="'$(AspNetCoreInstallerRid)' == ''">$(SharedFrameworkRid)</AspNetCoreInstallerRid>
<AspNetCoreInstallerRid Condition="'$(SharedFrameworkRid)' == 'rhel.6-x64'">linux-x64</AspNetCoreInstallerRid>

View file

@ -7,19 +7,19 @@ Roslyn-analyzer can't seem to find apphost produced by runtime build on ppc64le
This disables its use as it isn't necessary
---
diff --git a/src/roslyn-analyzers/src/PerformanceTests/Tests/PerformanceTests.csproj b/src/roslyn-analyzers/src/PerformanceTests/Tests/PerformanceTests.csproj
index 044a2aba46..3d37e147b3 100644
--- a/src/roslyn-analyzers/src/PerformanceTests/Tests/PerformanceTests.csproj
diff --git a/src/roslyn-analyzers/src/PerformanceTests/Tests/PerformanceTests.csproj.orig b/src/roslyn-analyzers/src/PerformanceTests/Tests/PerformanceTests.csproj
index 7b454a4..bbe18ae 100644
--- a/src/roslyn-analyzers/src/PerformanceTests/Tests/PerformanceTests.csproj.orig
+++ b/src/roslyn-analyzers/src/PerformanceTests/Tests/PerformanceTests.csproj
@@ -15,6 +15,7 @@
<Configuration>Release</Configuration>
@@ -16,6 +16,7 @@
<IsPackable>false</IsPackable>
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
<MicrosoftCodeAnalysisVersion>$(MicrosoftCodeAnalysisVersionForTests)</MicrosoftCodeAnalysisVersion>
+ <UseAppHost>false</UseAppHost>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="$(BenchmarkDotNetVersion)" />
@@ -27,4 +28,4 @@
@@ -28,4 +29,4 @@
<ProjectReference Include="..\Utilities\CSharp\CSharpPerfUtilities.csproj" />
<ProjectReference Include="..\Utilities\VisualBasic\VisualBasicPerfUtilities.csproj" />
</ItemGroup>

View file

@ -1,325 +0,0 @@
From 98054ea87ce70247bb09ceafd2ad1a0b36d2fef4 Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/runtime/pull/76500
From: Antoine Martin <dev@ayakael.net>
Date: Sat, 1 Oct 2022 09:21:58 -0400
Subject: [PATCH] Mono musl support
---
Directory.Build.props | 1 +
eng/common/cross/toolchain.cmake | 38 +++++++++++++++++++-----
eng/native/configurecompiler.cmake | 7 +++++
eng/native/tryrun.cmake | 6 +++-
src/coreclr/pal/src/CMakeLists.txt | 5 ++++
src/coreclr/pal/src/misc/perfjitdump.cpp | 2 +-
src/coreclr/vm/i386/cgenx86.cpp | 4 +++
src/mono/CMakeLists.txt | 33 ++++++++++++++++++++
src/mono/mono.proj | 32 +++++++++++++-------
src/mono/mono/mini/mini-runtime.c | 29 ++++++++++++++++++
src/mono/mono/utils/mono-context.h | 8 +++++
11 files changed, 146 insertions(+), 19 deletions(-)
diff --git a/src/runtime/Directory.Build.props b/src/runtime/Directory.Build.props
index 6f9b97c0a9c..4298a6df1d3 100644
--- a/src/runtime/Directory.Build.props
+++ b/src/runtime/Directory.Build.props
@@ -22,7 +22,6 @@
<TargetOS Condition="'$(TargetOS)' == ''">$(_hostOS)</TargetOS>
<TargetsMobile Condition="'$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'iOSSimulator' or '$(TargetOS)' == 'MacCatalyst' or '$(TargetOS)' == 'tvOS' or '$(TargetOS)' == 'tvOSSimulator' or '$(TargetOS)' == 'Android' or '$(TargetOS)' == 'Browser'">true</TargetsMobile>
<TargetsAppleMobile Condition="'$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'iOSSimulator' or '$(TargetOS)' == 'MacCatalyst' or '$(TargetOS)' == 'tvOS' or '$(TargetOS)' == 'tvOSSimulator'">true</TargetsAppleMobile>
- <TargetsLinuxBionic Condition="$(OutputRid.StartsWith('linux-bionic'))">true</TargetsLinuxBionic>
</PropertyGroup>
<!-- Platform property is required by RepoLayout.props in Arcade SDK. -->
@@ -154,7 +154,7 @@
<_runtimeOS Condition="'$(TargetsMobile)' == 'true'">$(TargetOS.ToLowerInvariant())</_runtimeOS>
<_portableOS>linux</_portableOS>
- <_portableOS Condition="'$(_runtimeOS)' == 'linux-musl'">linux-musl</_portableOS>
+ <_portableOS Condition="'$(_runtimeOS)' == 'linux-musl' or $(_runtimeOS.StartsWith('alpine'))">linux-musl</_portableOS>
<_portableOS Condition="'$(_runtimeOS)' == 'linux-bionic'">linux-bionic</_portableOS>
<_portableOS Condition="'$(_hostOS)' == 'OSX'">osx</_portableOS>
<_portableOS Condition="'$(_runtimeOS)' == 'win' or '$(TargetOS)' == 'windows'">win</_portableOS>
@@ -200,6 +199,9 @@
<OutputRid Condition="'$(OutputRid)' == ''">$(PackageRID)</OutputRid>
<OutputRid Condition="'$(PortableBuild)' == 'true'">$(_portableOS)-$(TargetArchitecture)</OutputRid>
+
+ <TargetsLinuxBionic Condition="$(OutputRid.StartsWith('linux-bionic'))">true</TargetsLinuxBionic>
+ <TargetsLinuxMusl Condition="'$(_portableOS)' == 'linux-musl'">true</TargetsLinuxMusl>
</PropertyGroup>
<PropertyGroup Label="CalculateTargetOSName" Condition="'$(SkipInferTargetOSName)' != 'true'">
diff --git a/src/runtime/eng/native/tryrun.cmake b/src/runtime/eng/native/tryrun.cmake
index 6355b0988f7..056c6606b17 100644
--- a/src/runtime/eng/native/tryrun.cmake
+++ b/src/runtime/eng/native/tryrun.cmake
@@ -8,7 +8,11 @@ endmacro()
if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/armv7-alpine-linux-musleabihf OR
EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/armv6-alpine-linux-musleabihf OR
- EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/aarch64-alpine-linux-musl)
+ EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/aarch64-alpine-linux-musl OR
+ EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/s390x-alpine-linux-musl OR
+ EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/ppc64le-alpine-linux-musl OR
+ EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/i586-alpine-linux-musl OR
+ EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/riscv64-alpine-linux-musl)
set(ALPINE_LINUX 1)
elseif(EXISTS ${CROSS_ROOTFS}/bin/freebsd-version)
diff --git a/src/runtime/src/coreclr/pal/src/CMakeLists.txt b/src/runtime/src/coreclr/pal/src/CMakeLists.txt
index d9726460ccf..c28563f8619 100644
--- a/src/runtime/src/coreclr/pal/src/CMakeLists.txt
+++ b/src/runtime/src/coreclr/pal/src/CMakeLists.txt
@@ -315,6 +315,11 @@ if(CLR_CMAKE_TARGET_LINUX)
target_link_libraries(coreclrpal ${UNWIND_LIBS})
endif(CLR_CMAKE_USE_SYSTEM_LIBUNWIND)
+ # bundled libunwind requires using libucontext on alpine and x86 and ppc64le
+ if(CLR_CMAKE_TARGET_ALPINE_LINUX AND (CLR_CMAKE_TARGET_ARCH_I386 OR CLR_CMAKE_TARGET_ARCH_POWERPC64))
+ target_link_libraries(coreclrpal ucontext)
+ endif(CLR_CMAKE_TARGET_ALPINE_LINUX AND (CLR_CMAKE_TARGET_ARCH_I386 OR CLR_CMAKE_TARGET_ARCH_POWERPC64))
+
endif(CLR_CMAKE_TARGET_LINUX)
if(CLR_CMAKE_TARGET_NETBSD)
diff --git a/src/runtime/src/coreclr/pal/src/misc/perfjitdump.cpp b/src/runtime/src/coreclr/pal/src/misc/perfjitdump.cpp
index 8d7f79ed3f0..043939ad2da 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/coreclr/vm/i386/cgenx86.cpp b/src/runtime/src/coreclr/vm/i386/cgenx86.cpp
index 811c84a140d..4e958a44b30 100644
--- a/src/runtime/src/coreclr/vm/i386/cgenx86.cpp
+++ b/src/runtime/src/coreclr/vm/i386/cgenx86.cpp
@@ -1133,6 +1133,7 @@ extern "C" DWORD __stdcall avx512StateSupport()
#else // !TARGET_UNIX
+#if !__has_builtin(__cpuid)
void __cpuid(int cpuInfo[4], int function_id)
{
// Based on the Clang implementation provided in cpuid.h:
@@ -1143,7 +1144,9 @@ void __cpuid(int cpuInfo[4], int function_id)
: "0"(function_id)
);
}
+#endif
+#if !__has_builtin(__cpuidex)
void __cpuidex(int cpuInfo[4], int function_id, int subFunction_id)
{
// Based on the Clang implementation provided in cpuid.h:
@@ -1154,6 +1157,7 @@ void __cpuidex(int cpuInfo[4], int function_id, int subFunction_id)
: "0"(function_id), "2"(subFunction_id)
);
}
+#endif
extern "C" DWORD __stdcall xmmYmmStateSupport()
{
diff --git a/src/runtime/src/mono/CMakeLists.txt b/src/runtime/src/mono/CMakeLists.txt
index cdff32677c0..08a82cd7e83 100644
--- a/src/runtime/src/mono/CMakeLists.txt
+++ b/src/runtime/src/mono/CMakeLists.txt
@@ -216,6 +216,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)
@@ -900,6 +929,11 @@ else()
set(DISABLE_DLLMAP 1)
endif()
+if(CLR_CMAKE_HOST_ALPINE_LINUX)
+ # On Alpine Linux, we need to ensure that the reported stack range for the primary thread is
+ # larger than the initial committed stack size.
+ add_definitions(-DENSURE_PRIMARY_STACK_SIZE)
+endif()
if(TARGET_DARWIN)
check_c_compiler_flag(-fno-objc-msgsend-selector-stubs COMPILER_SUPPORTS_FNO_OBJC_MSGSEND_SELECTOR_STUBS)
if(COMPILER_SUPPORTS_FNO_OBJC_MSGSEND_SELECTOR_STUBS)
diff --git a/src/runtime/src/mono/mono.proj b/src/runtime/src/mono/mono.proj
index 59fea4a2f72..5bac7fdf1c6 100644
--- a/src/runtime/src/mono/mono.proj
+++ b/src/runtime/src/mono/mono.proj
@@ -554,19 +560,21 @@
<MonoToolchainPrebuiltOS Condition="$([MSBuild]::IsOSPlatform('OSX'))">darwin-x86_64</MonoToolchainPrebuiltOS>
<MonoToolchainPrebuiltOS Condition="'$(HostOS)' == 'windows'">windows-x86_64</MonoToolchainPrebuiltOS>
<_MonoRuntimeFilePath>$(MonoObjDir)out\lib\$(MonoFileName)</_MonoRuntimeFilePath>
- <_LinuxAbi Condition="'$(TargetsAndroid)' != 'true' and '$(TargetsLinuxBionic)' != 'true'">gnu</_LinuxAbi>
- <_LinuxAbi Condition="'$(TargetsAndroid)' == 'true' or '$(TargetsLinuxBionic)' == 'true'">android</_LinuxAbi>
+ <_LinuxAbi Condition="'$(TargetsAndroid)' != 'true' and '$(TargetsLinuxBionic)' != 'true' and '$(TargetsLinuxMusl)' != 'true'">linux-gnu</_LinuxAbi>
+ <_LinuxAbi Condition="'$(TargetsAndroid)' != 'true' and '$(TargetsLinuxBionic)' != 'true' and '$(TargetsLinuxMusl)' == 'true'">alpine-linux-musl</_LinuxAbi>
+ <_LinuxAbi Condition="'$(TargetsAndroid)' == 'true' or '$(TargetsLinuxBionic)' == 'true'">linux-android</_LinuxAbi>
<_LinuxFloatAbi Condition="'$(TargetsAndroid)' != 'true' and '$(TargetsLinuxBionic)' != 'true'">hf</_LinuxFloatAbi>
<_Objcopy>objcopy</_Objcopy>
- <_Objcopy Condition="'$(Platform)' == 'arm'">arm-linux-$(_LinuxAbi)eabi$(_LinuxFloatAbi)-$(_Objcopy)</_Objcopy>
- <_Objcopy Condition="'$(Platform)' == 'armv6'">arm-linux-$(_LinuxAbi)eabi$(_LinuxFloatAbi)-$(_Objcopy)</_Objcopy>
- <_Objcopy Condition="'$(Platform)' == 'arm64'">aarch64-linux-$(_LinuxAbi)-$(_Objcopy)</_Objcopy>
- <_Objcopy Condition="'$(Platform)' == 'riscv64'">riscv64-linux-$(_LinuxAbi)-$(_Objcopy)</_Objcopy>
- <_Objcopy Condition="'$(Platform)' == 's390x'">s390x-linux-$(_LinuxAbi)-$(_Objcopy)</_Objcopy>
- <_Objcopy Condition="'$(Platform)' == 'ppc64le'">powerpc64le-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'">arm-$(_LinuxAbi)eabi$(_LinuxFloatAbi)-$(_Objcopy)</_Objcopy>
+ <_Objcopy Condition="'$(Platform)' == 'armv6'">arm-$(_LinuxAbi)eabi$(_LinuxFloatAbi)-$(_Objcopy)</_Objcopy>
+ <_Objcopy Condition="'$(Platform)' == 'arm64'">aarch64-$(_LinuxAbi)-$(_Objcopy)</_Objcopy>
+ <_Objcopy Condition="'$(Platform)' == 'riscv64'">riscv64-$(_LinuxAbi)-$(_Objcopy)</_Objcopy>
+ <_Objcopy Condition="'$(Platform)' == 's390x'">s390x-$(_LinuxAbi)-$(_Objcopy)</_Objcopy>
+ <_Objcopy Condition="'$(Platform)' == 'ppc64le'">powerpc64le-$(_LinuxAbi)-$(_Objcopy)</_Objcopy>
+ <_Objcopy Condition="'$(Platform)' == 'x64'">x86_64-$(_LinuxAbi)-$(_Objcopy)</_Objcopy>
+ <_Objcopy Condition="'$(Platform)' == 'x86'">i686-$(_LinuxAbi)-$(_Objcopy)</_Objcopy>
<_Objcopy Condition="'$(TargetsAndroid)' == 'true' or '$(TargetsLinuxBionic)' == 'true'">$(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/$(MonoToolchainPrebuiltOS)/bin/llvm-objcopy</_Objcopy>
+ <_Objcopy Condition="'$(TargetsLinuxMusl)' == 'true' and '$(CrossBuild)' != 'true'">objcopy</_Objcopy>
<_ObjcopyPrefix Condition="'$(MonoCrossDir)' != '' and '$(Platform)' == 'riscv64'">llvm-objcopy-</_ObjcopyPrefix>
</PropertyGroup>
diff --git a/src/runtime/src/mono/mono/mini/CMakeLists.txt b/src/runtime/src/mono/mono/mini/CMakeLists.txt
index 30df4bac1f7..8698fd81206 100644
--- a/src/runtime/src/mono/mono/mini/CMakeLists.txt
+++ b/src/runtime/src/mono/mono/mini/CMakeLists.txt
@@ -368,6 +368,11 @@ if(NOT DISABLE_SHARED_LIBS)
target_sources(monosgen-shared PRIVATE $<TARGET_OBJECTS:eglib_objects>)
set_target_properties(monosgen-shared PROPERTIES OUTPUT_NAME ${MONO_SHARED_LIB_NAME})
target_link_libraries (monosgen-shared PRIVATE monoapi)
+ # 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)
+
target_include_directories (monosgen-shared PRIVATE monoapi)
if(TARGET_WIN32)
# on Windows the import library for the shared mono library will have the same name as the static library,
@@ -527,6 +532,10 @@ if(NOT DISABLE_EXECUTABLES)
set_target_properties(mono-sgen PROPERTIES OUTPUT_NAME mono-aot-cross)
endif()
target_link_libraries(mono-sgen PRIVATE monoapi monosgen-static ${OS_LIBS} ${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/mini/mini-runtime.c b/src/runtime/src/mono/mono/mini/mini-runtime.c
index c481f69adc8..4db6c9a0ae7 100644
--- a/src/runtime/src/mono/mono/mini/mini-runtime.c
+++ b/src/runtime/src/mono/mono/mini/mini-runtime.c
@@ -4383,6 +4383,30 @@ mini_llvm_init (void)
#endif
}
+#ifdef ENSURE_PRIMARY_STACK_SIZE
+/*++
+ Function:
+ EnsureStackSize
+
+ Abstract:
+ This fixes a problem on MUSL where the initial stack size reported by the
+ pthread_attr_getstack is about 128kB, but this limit is not fixed and
+ the stack can grow dynamically. The problem is that it makes the
+ functions ReflectionInvocation::[Try]EnsureSufficientExecutionStack
+ to fail for real life scenarios like e.g. compilation of corefx.
+ Since there is no real fixed limit for the stack, the code below
+ ensures moving the stack limit to a value that makes reasonable
+ real life scenarios work.
+
+ --*/
+static MONO_NO_OPTIMIZATION MONO_NEVER_INLINE void
+ensure_stack_size (size_t size)
+{
+ volatile uint8_t *s = (uint8_t *)g_alloca(size);
+ *s = 0;
+}
+#endif // ENSURE_PRIMARY_STACK_SIZE
+
void
mini_add_profiler_argument (const char *desc)
{
@@ -4544,6 +4568,11 @@ mini_init (const char *filename)
mono_w32handle_init ();
#endif
+#ifdef ENSURE_PRIMARY_STACK_SIZE
+ // TODO: https://github.com/dotnet/runtime/issues/72920
+ ensure_stack_size (5 * 1024 * 1024);
+#endif // ENSURE_PRIMARY_STACK_SIZE
+
mono_thread_info_runtime_init (&ticallbacks);
if (g_hasenv ("MONO_DEBUG")) {
diff --git a/src/runtime/src/mono/mono/utils/mono-context.h b/src/runtime/src/mono/mono/utils/mono-context.h
index a1f0fe6f68e..a9db2d336ca 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"
diff --git a/src/runtime/src/native/libs/System.Native/pal_io.c b/src/runtime/src/native/libs/System.Native/pal_io.c
index 0929a0b49ec..86311e19507 100644
--- a/src/runtime/src/native/libs/System.Native/pal_io.c
+++ b/src/runtime/src/native/libs/System.Native/pal_io.c
@@ -1267,7 +1267,7 @@ int32_t SystemNative_CopyFile(intptr_t sourceFd, intptr_t destinationFd, int64_t
// Try copying data using a copy-on-write clone. This shares storage between the files.
if (sourceLength != 0)
{
- while ((ret = ioctl(outFd, FICLONE, inFd)) < 0 && errno == EINTR);
+ while ((ret = ioctl(outFd, (int)FICLONE, inFd)) < 0 && errno == EINTR);
copied = ret == 0;
}
#endif
--
2.36.3

View file

@ -7,18 +7,18 @@ Subject: [PATCH] Specify -z notext on linux-musl-x86
src/coreclr/CMakeLists.txt | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/runtime/src/coreclr/CMakeLists.txt.orig b/src/runtime/src/coreclr/CMakeLists.txt
index 7d1ce8d..5cacc78 100644
--- a/src/runtime/src/coreclr/CMakeLists.txt.orig
diff --git a/src/runtime/src/coreclr/CMakeLists.txt b/src/runtime/src/coreclr/CMakeLists.txt
index 67b773bf78787..87d862a541ae6 100644
--- a/src/runtime/src/coreclr/CMakeLists.txt
+++ b/src/runtime/src/coreclr/CMakeLists.txt
@@ -105,6 +105,10 @@ if(CLR_CMAKE_HOST_UNIX)
@@ -109,6 +109,10 @@ if(CLR_CMAKE_HOST_UNIX)
endif()
endif()
+ if(CLR_CMAKE_TARGET_ALPINE_LINUX AND CLR_CMAKE_TARGET_ARCH_I386)
+ add_linker_flag(-Wl,-z,notext)
+ add_linker_flag(-Wl,-z,notext)
+ endif()
+
add_subdirectory(pal)
add_subdirectory(hosts)
else()
if(NOT CLR_CMAKE_HOST_MACCATALYST AND NOT CLR_CMAKE_HOST_IOS AND NOT CLR_CMAKE_HOST_TVOS)
add_subdirectory(pal)
add_subdirectory(hosts)

View file

@ -0,0 +1,80 @@
From 828269b7e68039f8bc0bdac66e2fd5c58b6d3471 Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/runtime/pull/90251
From: Antoine Martin <dev@ayakael.net>
Date: Wed, 9 Aug 2023 11:36:39 -0400
Subject: [PATCH 1/1] Rename CMAKE var for mono on libc-musl
---
src/mono/CMakeLists.txt | 6 +++---
src/mono/mono/mini/CMakeLists.txt | 12 ++++++------
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/runtime/src/coreclr/pgosupport.cmake b/src/runtime/src/coreclr/pgosupport.cmake
index 719ac14ad99..34a42781ab2 100644
--- a/src/runtime/src/coreclr/pgosupport.cmake
+++ b/src/runtime/src/coreclr/pgosupport.cmake
@@ -25,13 +25,13 @@ function(add_pgo TargetName)
target_compile_options(${TargetName} PRIVATE -flto -fprofile-instr-generate)
set_property(TARGET ${TargetName} APPEND_STRING PROPERTY LINK_FLAGS " -flto -fprofile-instr-generate")
if(CMAKE_CROSSCOMPILING AND CMAKE_C_COMPILER_ID MATCHES "Clang")
- if (CLR_CMAKE_HOST_ALPINE_LINUX)
+ if (CLR_CMAKE_TARGET_LINUX_MUSL)
set_property(TARGET ${TargetName} APPEND_STRING PROPERTY LINK_FLAGS " -resource-dir ${CMAKE_SYSROOT}/usr/lib/clang/${CMAKE_C_COMPILER_VERSION}")
- else(CLR_CMAKE_HOST_ALPINE_LINUX)
+ else(CLR_CMAKE_TARGET_LINUX_MUSL)
string(REPLACE "." ";" CLANG_VERSION "${CMAKE_C_COMPILER_VERSION}")
list(POP_FRONT CLANG_VERSION CLANG_VERSION_MAJOR)
set_property(TARGET ${TargetName} APPEND_STRING PROPERTY LINK_FLAGS " -resource-dir ${CMAKE_SYSROOT}/usr/lib/llvm-${CLANG_VERSION_MAJOR}/lib/clang/${CMAKE_C_COMPILER_VERSION}")
- endif(CLR_CMAKE_HOST_ALPINE_LINUX)
+ endif(CLR_CMAKE_TARGET_LINUX_MUSL)
endif(CMAKE_CROSSCOMPILING AND CMAKE_C_COMPILER_ID MATCHES "Clang")
if(NOT LD_LLVM)
set_property(TARGET ${TargetName} APPEND_STRING PROPERTY LINK_FLAGS " -fuse-ld=gold")
diff --git a/src/runtime/src/mono/CMakeLists.txt b/src/runtime/src/mono/CMakeLists.txt
index e04d9e9d364..00e54a25d69 100644
--- a/src/runtime/src/mono/CMakeLists.txt
+++ b/src/runtime/src/mono/CMakeLists.txt
@@ -943,10 +943,10 @@ else()
set(DISABLE_DLLMAP 1)
endif()
-if(CLR_CMAKE_HOST_ALPINE_LINUX)
- # Setting RLIMIT_NOFILE breaks debugging of coreclr on Alpine Linux for some reason
+if(CLR_CMAKE_TARGET_LINUX_MUSL)
+ # Setting RLIMIT_NOFILE breaks debugging of coreclr on musl-libc for some reason
add_definitions(-DDONT_SET_RLIMIT_NOFILE)
- # On Alpine Linux, we need to ensure that the reported stack range for the primary thread is
+ # On musl-libc, we need to ensure that the reported stack range for the primary thread is
# larger than the initial committed stack size.
add_definitions(-DENSURE_PRIMARY_STACK_SIZE)
endif()
diff --git a/src/runtime/src/mono/mono/mini/CMakeLists.txt.orig b/src/runtime/src/mono/mono/mini/CMakeLists.txt
index 5d6ef3d..c3e5414 100644
--- a/src/runtime/src/mono/mono/mini/CMakeLists.txt.orig
+++ b/src/runtime/src/mono/mono/mini/CMakeLists.txt
@@ -400,9 +400,9 @@ if(NOT DISABLE_SHARED_LIBS)
endif()
target_compile_definitions(monosgen-shared PRIVATE -DMONO_DLL_EXPORT)
# Alpine Linux implements ucontext in a different library
- if(CLR_CMAKE_HOST_ALPINE_LINUX AND TARGET_S390X)
+ if(CLR_CMAKE_TARGET_LINUX_MUSL AND TARGET_S390X)
target_link_libraries(monosgen-shared PRIVATE ucontext)
- endif(CLR_CMAKE_HOST_ALPINE_LINUX AND TARGET_S390X)
+ endif(CLR_CMAKE_TARGET_LINUX_MUSL AND TARGET_S390X)
set_target_properties(monosgen-shared PROPERTIES OUTPUT_NAME ${MONO_SHARED_LIB_NAME})
if(MONO_SET_RPATH_ORIGIN)
set_target_properties(monosgen-shared PROPERTIES INSTALL_RPATH "$ORIGIN")
@@ -601,10 +601,10 @@ if(NOT DISABLE_EXECUTABLES)
target_link_libraries(mono-sgen PRIVATE icu_shim_objects)
endif()
target_link_libraries(mono-sgen PRIVATE ${OS_LIBS} ${LLVM_LIBS} ${ICU_LIBS} ${Z_LIBS})
- # Alpine Linux implements ucontext in a different library
- if(CLR_CMAKE_HOST_ALPINE_LINUX AND TARGET_S390X)
+ # musl-libc implements ucontext in a different library
+ if(CLR_CMAKE_TARGET_LINUX_MUSL AND TARGET_S390X)
target_link_libraries(mono-sgen PRIVATE ucontext)
- endif(CLR_CMAKE_HOST_ALPINE_LINUX AND TARGET_S390X)
+ endif(CLR_CMAKE_TARGET_LINUX_MUSL 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}")

File diff suppressed because it is too large Load diff

View file

@ -1,11 +1,11 @@
diff --git a/src/runtime/eng/SourceBuild.props b/src/runtime/eng/SourceBuild.props
index 32e6d9c0ba..8e2a7f9931 100644
--- a/src/runtime/eng/SourceBuild.props
diff --git a/src/runtime/eng/SourceBuild.props.orig b/src/runtime/eng/SourceBuild.props
index 1e9d5cf..c40e4fa 100644
--- a/src/runtime/eng/SourceBuild.props.orig
+++ b/src/runtime/eng/SourceBuild.props
@@ -51,6 +51,7 @@
<InnerBuildArgs>$(InnerBuildArgs) /p:DisableSourceLink=false</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) /p:AdditionalRuntimeIdentifierParent=$(BaseOS)</InnerBuildArgs>
<InnerBuildArgs Condition="'$(SourceBuildUseMonoRuntime)' == 'true'">$(InnerBuildArgs) /p:PrimaryRuntimeFlavor=Mono /p:RuntimeFlavor=Mono</InnerBuildArgs>
@@ -48,6 +48,7 @@
<InnerBuildArgs Condition="'$(OfficialBuildId)' != ''">$(InnerBuildArgs) /p:OfficialBuildId=$(OfficialBuildId)</InnerBuildArgs>
<InnerBuildArgs Condition="'$(ContinuousIntegrationBuild)' != ''">$(InnerBuildArgs) /p:ContinuousIntegrationBuild=$(ContinuousIntegrationBuild)</InnerBuildArgs>
<InnerBuildArgs Condition="'$(SourceBuildUseMonoRuntime)' == 'true'">$(InnerBuildArgs) --usemonoruntime</InnerBuildArgs>
+ <InnerBuildArgs>$(InnerBuildArgs) --cmakeargs -DCLR_CMAKE_USE_SYSTEM_LIBUNWIND=TRUE</InnerBuildArgs>
</PropertyGroup>
</Target>

View file

@ -0,0 +1,13 @@
diff --git a/src/runtime/eng/native/configurecompiler.cmake b/src/runtime/eng/native/configurecompiler.cmake
index c9a54547c0a..931da2cae5b 100644
--- a/src/runtime/eng/native/configurecompiler.cmake
+++ b/src/runtime/eng/native/configurecompiler.cmake
@@ -488,6 +488,8 @@ if (CLR_CMAKE_HOST_UNIX)
# other clang 16.0 suppressions
add_compile_options(-Wno-single-bit-bitfield-constant-conversion)
add_compile_options(-Wno-cast-function-type-strict)
+ add_compile_options(-Wno-incompatible-function-pointer-types-strict)
+ add_compile_options(-Wno-ignored-attributes)
else()
add_compile_options(-Wno-uninitialized)
add_compile_options(-Wno-strict-aliasing)

View file

@ -1,15 +1,26 @@
diff --git a/src/runtime/src/coreclr/debug/createdump/crashinfounix.cpp b/src/runtime/src/coreclr/debug/createdump/crashinfounix.cpp
index 03712c3b684..99d8a457957 100644
--- a/src/runtimr/src/coreclr/debug/createdump/crashinfounix.cpp
diff --git a/src/runtime/src/coreclr/debug/createdump/crashinfounix.cpp.orig b/src/runtime/src/coreclr/debug/createdump/crashinfounix.cpp
index 20b2494..165b190 100644
--- a/src/runtime/src/coreclr/debug/createdump/crashinfounix.cpp.orig
+++ b/src/runtime/src/coreclr/debug/createdump/crashinfounix.cpp
@@ -395,7 +395,7 @@ CrashInfo::ReadProcessMemory(void* address, void* buffer, size_t size, size_t* r
@@ -469,7 +469,7 @@ CrashInfo::ReadProcessMemory(void* address, void* buffer, size_t size, size_t* r
// performance optimization.
m_canUseProcVmReadSyscall = false;
assert(m_fd != -1);
- *read = pread64(m_fd, buffer, size, (off64_t)address);
+ *read = pread(m_fd, buffer, size, (off_t)address);
assert(m_fdMem != -1);
- *read = pread64(m_fdMem, buffer, size, (off64_t)address);
+ *read = pread(m_fdMem, buffer, size, (off_t)address);
}
if (*read == (size_t)-1)
diff --git a/src/runtime/src/coreclr/debug/createdump/crashinfo.cpp.orig b/src/runtime/src/coreclr/debug/createdump/crashinfo.cpp
index 5addb79..79655d1 100644
--- a/src/runtime/src/coreclr/debug/createdump/crashinfo.cpp.orig
+++ b/src/runtime/src/coreclr/debug/createdump/crashinfo.cpp
@@ -760,7 +760,7 @@ CrashInfo::PageMappedToPhysicalMemory(uint64_t start)
}
uint64_t pagemapOffset = (start / PAGE_SIZE) * sizeof(uint64_t);
- uint64_t seekResult = lseek64(m_fdPagemap, (off64_t) pagemapOffset, SEEK_SET);
+ uint64_t seekResult = lseek(m_fdPagemap, (off_t) pagemapOffset, SEEK_SET);
if (seekResult != pagemapOffset)
{
int seekErrno = errno;

View file

@ -1,35 +0,0 @@
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,13 @@
diff --git a/src/vstest/test/Intent/Intent.csproj b/src/vstest/test/Intent/Intent.csproj
index bb711c9256..6d0b199a9b 100644
--- a/src/vstest/test/Intent/Intent.csproj
+++ b/src/vstest/test/Intent/Intent.csproj
@@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
- <TargetFramework>net6.0</TargetFramework>
+ <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

View file

@ -1,87 +1,34 @@
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
# secfixes:
# 7.0.3-r0:
# - CVE-2023-21808
# 7.0.5-r0:
# - CVE-2023-28260
# 7.0.7-r0:
# - CVE-2023-24895
# - CVE-2023-24897
# - CVE-2023-24936
# - CVE-2023-29331
# - CVE-2023-29337
# - CVE-2023-32032
# - CVE-2023-33126
# - CVE-2023-33128
# - CVE-2023-33135
# 7.0.9-r0:
# - CVE-2023-33127
# - CVE-2023-33170
# 7.0.10-r0:
# - CVE-2023-38178
# - CVE-2023-35390
# - CVE-2023-38180
# - CVE-2023-35391
# 7.0.11-r0:
# - CVE-2023-36792
# - CVE-2023-36793
# - CVE-2023-36794
# - CVE-2023-36796
# - CVE-2023-36799
# 7.0.12-r0:
# - CVE-2023-36435
# - CVE-2023-38171
# - CVE-2023-44487
# 7.0.13-r0:
# - CVE-2023-36792
# - CVE-2023-36793
# - CVE-2023-36794
# - CVE-2023-36796
# - CVE-2023-36799
# - CVE-2023-44487
# - CVE-2023-38171
# - CVE-2023-36435
# 7.0.14-r0:
# - CVE-2023-36049
# - CVE-2023-36558
pkgname=dotnet7-runtime
pkgver=7.0.14
_bldver=7.0.114-r0
pkgname=dotnet8-sdk
pkgver=8.0.100
_bldver=8.0.0-r0
pkgrel=0
# Following for dotnet build version 6.0 and up
_pkgver_macro=${pkgver%.*}
_pkgver_name=${_pkgver_macro//[.0]}
_bldver_ver=${_bldver%%-*}
pkgdesc="The .NET $_pkgver_macro Core runtime"
_bldver_ver=${_bldver_ver/0./0.10}
pkgdesc="The .NET $_pkgver_macro SDK"
# x86: blocked by https://github.com/dotnet/runtime/issues/77667
# armhf: blocked by https://github.com/dotnet/runtime/issues/77663
# riscv64: port WIP https://github.com/dotnet/runtime/issues/36748
# s390x: no diskspace
arch="x86_64 armv7 aarch64"
# riscv64: blocked by https://github.com/dotnet/runtime/issues/84834
arch="all !x86 !armhf !riscv64"
url=https://dotnet.microsoft.com
license="MIT"
depends="
dotnet$_pkgver_name-hostfxr
icu-data-full
icu-libs
"
makedepends="dotnet$_pkgver_name-build=$_bldver"
makedepends="dotnet$_pkgver_name-runtime-bootstrap=$_bldver"
subpackages="
aspnetcore$_pkgver_name-runtime:aspnetcore_runtime:noarch
aspnetcore$_pkgver_name-targeting-pack:aspnetcore_targeting_pack:noarch
dotnet$_pkgver_name-apphost-pack:apphost_pack
dotnet$_pkgver_name-hostfxr
dotnet$_pkgver_name-targeting-pack:targeting_pack:noarch
dotnet-host:host
dotnet$_pkgver_name-templates:templates:noarch
dotnet$_pkgver_name-sdk-dbg:dbg:noarch
dotnet-zsh-completion:zshcomp:noarch
dotnet-bash-completion:bashcomp:noarch
dotnet-doc
netstandard21-targeting-pack:netstandard_targeting_pack:noarch
"
provides="dotnet$_pkgver_name=$pkgver-r$pkgrel"
options="!check" # No test suite
source="dotnet.sh.in"
builddir="$srcdir"
_libdir="/usr/lib"
@ -93,80 +40,113 @@ case $CARCH in
*) _dotnet_arch="$CARCH";;
esac
build() {
sed "s|%LIBDIR%|$_libdir/dotnet|" "$srcdir"/dotnet.sh.in > "$srcdir"/dotnet.sh
}
package() {
install -dm 755 "$pkgdir"/$_libdir/dotnet/shared
# libucontext isn't automatically detected on all platforms
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
libucontext
"
provides="
dotnet-sdk-$_pkgver_macro=$pkgver-r$pkgrel
dotnet$_pkgver_name-dev=$pkgver-r$pkgrel
"
cp -r $_libdir/dotnet/bootstrap/$_bldver_ver/shared/Microsoft.NETCore.App "$pkgdir"/$_libdir/dotnet/shared/.
install -dm 755 "$pkgdir"/$_libdir/dotnet
cp -r $_libdir/dotnet/bootstrap/$_bldver_ver/sdk "$pkgdir"/$_libdir/dotnet/.
cp -r $_libdir/dotnet/bootstrap/$_bldver_ver/sdk-manifests "$pkgdir"/$_libdir/dotnet/.
# See https://github.com/dotnet/source-build/issues/2579
find "$pkgdir" -type f -name 'vstest.console' -delete
find "$pkgdir" -type f -name 'testhost.x86' -delete
# docs
install -dm 755 "$pkgdir"/usr/share/man/man1
cp -r $_libdir/dotnet/bootstrap/$_bldver_ver/docs/* "$pkgdir"/usr/share/man/man1/.
}
host() {
pkgdesc="A generic driver for the .NET Core Command Line Interface"
depends=""
install -dm 755 \
"$subpkgdir"/etc/profile.d \
"$subpkgdir"/etc/dotnet \
"$subpkgdir"/usr/bin \
"$subpkgdir"/$_libdir/dotnet
cp -r $_libdir/dotnet/bootstrap/$_bldver_ver/dotnet "$subpkgdir"/$_libdir/dotnet/.
ln -s $_libdir/dotnet/dotnet "$subpkgdir"/usr/bin/dotnet
echo "$_libdir/dotnet" > "$subpkgdir"/etc/dotnet/install_location
echo "$_libdir/dotnet" > "$subpkgdir"/etc/dotnet/install_location_$_dotnet_arch
install -Dm 644 "$srcdir"/dotnet.sh -t "$subpkgdir"/etc/profile.d/
}
hostfxr() {
pkgdesc="The .NET host resolver contains the logic to resolve and select the right version of the .NET SDK or runtime to use."
depends="dotnet-host"
provides="dotnet-hostfxr-$_pkgver_macro=$pkgver-r$pkgrel"
dbg() {
pkgdesc="The .NET $_pkgver_macro SDK - debug pdb files"
depends="dotnet$_pkgver_name-sdk"
provides="dotnet-sdk-pdb-$_pkgver_macro=$pkgver-r$pkgrel"
install -dm 755 "$subpkgdir"/$_libdir/dotnet
cp -r $_libdir/dotnet/bootstrap/$_bldver_ver/host "$subpkgdir"/$_libdir/dotnet/.
# move pdb files
cd "$pkgdir" || return 0
find . -type f ! -name "$(printf "*\n*")" -name '*.pdb' > tmp
while IFS= read -r i; do
d="$subpkgdir/${i%/*}" # dirname $i
mkdir -p "$d"
mv "$pkgdir/$i" "$d"
rmdir "$pkgdir/${i%/*}" 2>/dev/null || :
done < tmp
rm tmp
}
aspnetcore_runtime() {
pkgdesc="The ASP.NET $_pkgver_macro Core runtime"
depends="dotnet$_pkgver_name-runtime"
provides="aspnetcore-runtime-$_pkgver_macro=$pkgver-r$pkgrel"
install -dm 755 "$subpkgdir"/$_libdir/dotnet/shared
cp -r $_libdir/dotnet/bootstrap/$_bldver_ver/shared/Microsoft.AspNetCore.App "$subpkgdir"/$_libdir/dotnet/shared/.
}
apphost_pack() {
pkgdesc="The .NET $_pkgver_macro Core apphost pack"
provides="dotnet-apphost-pack-$_pkgver_macro=$pkgver-r$pkgrel"
install -dm 755 "$subpkgdir"/$_libdir/dotnet/packs
cp -r $_libdir/dotnet/bootstrap/$_bldver_ver/packs/Microsoft.NETCore.App.Host.* "$subpkgdir"/$_libdir/dotnet/packs/.
}
targeting_pack() {
pkgdesc="The .NET $_pkgver_macro Core targeting pack"
provides="dotnet-targeting-pack-$_pkgver_macro=$pkgver-r$pkgrel"
install -dm 755 "$subpkgdir"/$_libdir/dotnet/packs
cp -r $_libdir/dotnet/bootstrap/$_bldver_ver/packs/Microsoft.NETCore.App.Ref "$subpkgdir"/$_libdir/dotnet/packs/.
}
aspnetcore_targeting_pack() {
pkgdesc="The ASP.NET $_pkgver_macro Core targeting pack"
provides="aspnetcore-targeting-pack-$_pkgver_macro=$pkgver-r$pkgrel"
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
cp -r $_libdir/dotnet/bootstrap/$_bldver_ver/packs/Microsoft.AspNetCore.App.Ref "$subpkgdir"/$_libdir/dotnet/packs/.
cp -r $_libdir/dotnet/bootstrap/$_bldver_ver/packs/NETStandard.Library.Ref "$subpkgdir"/$_libdir/dotnet/packs/
# remove pdb files
find "$subpkgdir" -type f -name '*.pdb' -delete
}
sha512sums="
c3f31956976b77198e72a3fef3427338b6b2961f8c121416040c1105de0ce8073e46f4c2e9ef22a001aee69cbe39621c2ddac988522693110071dfae42f2e2b7 dotnet.sh.in
"
templates() {
pkgdesc="The .NET $_pkgver_macro templates"
depends="dotnet-host"
provides="dotnet-templates-$_pkgver_macro=$pkgver-r$pkgrel"
install -dm 755 "$subpkgdir"/$_libdir/dotnet
cp -r $_libdir/dotnet/bootstrap/$_bldver_ver/templates "$subpkgdir"/$_libdir/dotnet/.
# remove pdb files
find "$subpkgdir" -type f -name '*.pdb' -delete
}
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 "$_libdir"/dotnet/bootstrap/$_bldver_ver/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 "$_libdir"/dotnet/bootstrap/$_bldver_ver/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
cp -r $_libdir/dotnet/bootstrap/$_bldver_ver/LICENSE.txt "$subpkgdir"/usr/share/licenses/dotnet/.
cp -r $_libdir/dotnet/bootstrap/$_bldver_ver/ThirdPartyNotices.txt "$subpkgdir"/usr/share/licenses/dotnet/.
}

View file

@ -1,21 +1,20 @@
# dotnet7-runtime
# dotnet8-sdk
This is the .NET 7.0 package for Alpine Linux.
This is the .NET 8.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
* `aspnetcore7-runtime`
* `aspnetcore7-targeting-pack`
* `dotnet7-apphost-pack` (used by dotnet7-runtime)
* `dotnet7-hostfxr` (used by dotnet-host)
* `dotnet7-runtime`
* `dotnet7-targeting-pack`
* `dotnet-host`
* `dotnet8-sdk`
* `dotnet8-templates` (required by sdk)
* `dotnet-zsh-completion`
* `dotnet-bash-completion`
* `dotnet-doc`
* `netstandard21-targeting-pack`
## How to build dotnet7 on Alpine
## How to build dotnet8 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)
@ -26,17 +25,22 @@ builds bootstraps for Alpine on `x86_64`, `aarch64`, and `armv7`. Thus, `stage0`
has also been designed to be crossbuild aware, allowing bootstrapping to other
platforms.
In summary, dotnet7 is built using three different aports.
In summary, dotnet8 is built using three different aports.
* `community/dotnet7-stage0`
Builds minimum components for full build of dotnet7, and packages these in an initial
`dotnet7-stage0-bootstrap` package that `dotnet7-build` pulls.
* `community/dotnet7-build`
Builds full and packages dotnet7 fully using either stage0 or previoulsy built
dotnet7 build.
* `community/dotnet7-runtime`
* `community/dotnet8-stage0`
Builds minimum components for full build of dotnet8, and packages these in an initial
`dotnet8-stage0-bootstrap` package that `dotnet8-runtime` pulls.
* `community/dotnet8-runtime
Builds full and packages dotnet8 fully using either stage0 or previoulsy built
dotnet8 build.
* `community/dotnet8-sdk`
As abuild does not allow different versions for subpackages, a different aport
is required to package runtime bits from dotnet7-build.
is required to package runtime bits from dotnet8-runtime. dotnet8-runtime only
builds 8.0.1xx feature branch of SDK. Thus, when a new feature branch of sdk is
released, the updated components are to be built on dotnet8-sdk rather than
simply repackaging dotnet8-runtime artifacts.
## Crossbuilding with `stage0`
Crossbuilding `stage0` is a three step process:
@ -48,7 +52,7 @@ Crossbuilding `stage0` is a three step process:
`$HOME/sysroot-$CTARGET_ARCH/etc/apk/repositories`, making sure to add required
keys. This makes it so that whatever package is not built in step 1 will
be pulled from package repos
3. Crossbuild `dotnet7-stage0` via:
3. Crossbuild `dotnet8-stage0` via:
```
CHOST=$CTARGET_ARCH abuild -r
```
@ -57,7 +61,7 @@ CHOST=$CTARGET_ARCH abuild -r
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 `dotnet7` as opposed to `dotnet-7.0`
In addition, the package is named `dotnet8` as opposed to `dotnet-8.0`
to match Alpine Linux naming conventions for packages with many installable versions
# Contributing
@ -73,7 +77,7 @@ follow.
2. Checkout the forked repository.
- `git clone ssh://git@gitlab.alpinelinux.org/$USER/aports`
- `cd community/dotnet7-build`
- `cd community/dotnet8-sdk`
3. Make your changes. Don't forget to add a changelog.
@ -85,15 +89,15 @@ follow.
6. Commit the changes to the git repo in a git branch
- `git checkout -b dotnet7/<name>`
- `git checkout -b dotnet8/<name>`
- `git add` any new patches
- `git remove` any now-unnecessary patches
- `git commit -m 'community/dotnet7-build: descriptive description'`
- `git commit -m 'community/dotnet8-sdk: 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
8. Once the tests in the merge-request pass, and reviewers are happy, your changes
will be merged.
## Updating to an new upstream release
@ -103,7 +107,7 @@ follow.
2. Checkout the forked repository.
- `git clone ssh://git@gitlab.alpinelinux.org/$USER/aports`
- `cd community/dotnet7-build`
- `cd community/dotnet8-sdk`
3. Build the new upstream source tarball. Update the versions in the
@ -124,15 +128,15 @@ follow.
7. Commit the changes to the git repo in a git branch.
- `git checkout -b dotnet7/<name>`
- `git checkout -b dotnet8/<name>`
- `git add` any new patches
- `git remove` any now-unnecessary patches
- `git commit -m 'community/dotnet7-build: upgrade to <new-version>`
- `git commit -m 'community/dotnet8-sdk: 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
9. Once the tests in the merge-request pass, and reviewers are happy, your changes
will be merged.
# Testing

View file

@ -1,65 +1,60 @@
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=dotnet7-stage0
pkgver=7.0.105
pkgrel=4
pkgname=dotnet8-stage0
pkgver=8.0.100
pkgrel=0
[ "$CBUILD" != "$CHOST" ] && _cross="-$CARCH" || _cross=""
# Tag of tarball generator.
_gittag=v$pkgver
_gittag=v8.0.0
# Versions of prebuilt artifacts and bootstrap tar
_artifactsver=7.0.102
_bootstrapver="7.0.105"
_artifactsver="8.0.100-rtm.23551.1.centos.8-x64"
_bootstrapver="8.0.100"
_bootstraprel=0
_installerver=${_gittag/v}
# Version of packages that aren't defined in git-info or badly defined
_iltoolsver=7.0.2-servicing.22607.1
_aspnetver=7.0.4
_installerver=8.0.100
# Patches to be used. String before '_' refers to repo to patch
# Look for patch notes within each patch for what they fix / where they come from
# build_* patches applies directly to $builddir
_patches="
build_fix-ga-versions.patch
installer_aspire-manifest-version-fix.patch
installer_set-crossgen2rid-using-buildarchitecture.patch
runtime_76500-mono-musl-support.patch
runtime_76500-properly-set-toolchain-for-alpine.patch
runtime_82269-mono-thread-coop-undefine-fortify-source.patch
runtime_83682-specify-notext-on-linux-musl-x86.patch
runtime_84413-support-adding-rids-with-dash-in-base-part.patch
runtime_84444-suppress-clang-16-warnings.patch
runtime_enable-runtime-marshalling.diff
runtime_90251-rename-mono-cmake-host-var.patch
runtime_more-clang-16-suppression.patch
runtime_remove-usage-of-off64-t.patch
"
_extra_nupkgs="https://globalcdn.nuget.org/packages/stylecop.analyzers.1.2.0-beta.435.nupkg"
_pkgver_macro=${pkgver%.*}
_pkgver_prior=1
_pkgver_name="${_pkgver_macro//[.0]}"
pkgdesc="The .NET Core stage0 bits for dotnet build"
# armhf: blocked by https://github.com/dotnet/runtime/issues/77663
# x86: blocked by https://github.com/dotnet/runtime/issues/83509
# riscv64: port WIP https://github.com/dotnet/runtime/issues/36748
# s390x: no diskspace | lack maintainer resources
arch="x86_64 armv7 aarch64"
# armhf: blocked by https://github.com/dotnet/runtime/issues/77663
# riscv64: port WIP https://github.com/dotnet/runtime/issues/84834
arch="all !x86 !armhf !riscv64"
_giturl=https://github.com/dotnet/dotnet
url=https://dotnet.microsoft.com
_giturl=https://github.com/dotnet/installer
license="MIT"
options="!check" # Testsuite in main -build aport
options="!check net" # Testsuite in main -build aport
subpackages="
dotnet$_pkgver_name-stage0-artifacts:artifacts:noarch
dotnet$_pkgver_name-stage0-bootstrap
"
source="
https://lab.ilot.io/dotnet/installer/-/releases/$_gittag/downloads/tarball/dotnet-$_gittag.tar.xz
dotnet-tarball-$_gittag.tar.gz::https://github.com/dotnet/dotnet/archive/refs/tags/$_gittag.tar.gz
dotnet-release-$_gittag.json::https://github.com/dotnet/dotnet/releases/download/$_gittag/release.json
dotnet-sdk-$_bootstrapver-linux-musl-x64.noextract::https://dotnetcli.azureedge.net/dotnet/Sdk/$_bootstrapver/dotnet-sdk-$_bootstrapver-linux-musl-x64.tar.gz
dotnet-sdk-$_bootstrapver-linux-musl-arm64.noextract::https://dotnetcli.azureedge.net/dotnet/Sdk/$_bootstrapver/dotnet-sdk-$_bootstrapver-linux-musl-arm64.tar.gz
dotnet-sdk-$_bootstrapver-linux-musl-arm.noextract::https://dotnetcli.azureedge.net/dotnet/Sdk/$_bootstrapver/dotnet-sdk-$_bootstrapver-linux-musl-arm.tar.gz
dotnet-sdk-$_bootstrapver-r$_bootstraprel-linux-musl-s390x.noextract::https://lab.ilot.io/ayakael/dotnet-stage0/-/releases/$_bootstrapver-r$_bootstraprel/downloads/sdk/dotnet-sdk-$_bootstrapver-r$_bootstraprel-linux-musl-s390x.tar.xz
dotnet-sdk-$_bootstrapver-r$_bootstraprel-linux-musl-ppc64le.noextract::https://lab.ilot.io/ayakael/dotnet-stage0/-/releases/$_bootstrapver-r$_bootstraprel/downloads/sdk/dotnet-sdk-$_bootstrapver-r$_bootstraprel-linux-musl-ppc64le.tar.xz
Private.SourceBuilt.Artifacts.$_artifactsver.noextract::https://dotnetcli.azureedge.net/source-built-artifacts/assets/Private.SourceBuilt.Artifacts.$_artifactsver.tar.gz
$_extra_nupkgs
$_patches
"
@ -124,7 +119,7 @@ case $CTARGET_ARCH in
*) _dotnet_target=$CTARGET_ARCH;;
esac
builddir="$srcdir"/dotnet-${_gittag/release\/}
builddir="$srcdir"/dotnet-${_gittag/v}
_packagesdir="$srcdir"/local-packages
_libdir="/usr/lib"
_nugetdir="$srcdir"/nuget
@ -140,62 +135,16 @@ else
_logdir="$srcdir"/logs
fi
# generates tarball containing all components built by dotnet
snapshot() {
local _pkg="$srcdir"/${builddir##*/}.tar
ulimit -n 4096
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 $_libdir/dotnet/bootstrap/${_pkgver_macro}* -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
# Parallel restore is broken on mono-based builds since dotnet7
# see https://github.com/dotnet/runtime/issues/77364
# fixed by https://github.com/dotnet/runtime/pull/79856 on dotnet8
# A workaround via runtime_enable-runtime-marshalling.diff
case $CARCH in
s390x|ppc64le)
msg "runtime_enable-runtime-marshalling.diff"
patch -p1 -i "$srcdir"/runtime_enable-runtime-marshalling.diff
;;
esac
mkdir -p "$_cli_root"
mkdir -p $_packagesdir $_downloaddir $_outputdir $_nugetdir $_logdir
# sdk insists on downloading its own dotnet unless ArcadeBuildFromSource
# is true, which opens up a can of worms
sed 's|ArcadeBuildFromSource=true|Architecture|' -i src/sdk/eng/restore-toolset.sh
mkdir -p "$_cli_root"
mkdir -p $_packagesdir $_downloaddir $_outputdir $_nugetdir $_logdir
# links logfiles to pipeline logs for easy pickup in pipelines
mkdir -p "$_logdir" "$builddir"/artifacts
ln -s "$_logdir" "$builddir"/artifacts/logs
@ -210,24 +159,43 @@ prepare() {
tar -xf "$srcdir"/dotnet-sdk-$_pkgver_macro*$_dotnet_arch.noextract -C "$_cli_root" --no-same-owner
for i in $_extra_nupkgs; do
local filename=${i/::*}
local filename=${filename##*/}
$_nuget push "$srcdir"/$filename --source="$_packagesdir"
done
# adjusts sdk version and packagedir to expected
for i in runtime sdk installer aspnetcore roslyn; do
$_nuget add source $_packagesdir --name local --configfile "$builddir"/src/$i/NuGet.config
tmp=$(mktemp)
jq ".sdk.version = \"$_bootstrapver\"" "$builddir"/src/$i/global.json > $tmp && mv $tmp "$builddir"/src/$i/global.json
done
# extracting PackageVersions.props as some version information is there
tar -xzf "$srcdir"/Private.SourceBuilt.Artifacts.*.noextract PackageVersions.props
# sdk looks for TestCli at wrong place
sed '/<TestCliNuGetDirectoryTargetFramework/d' -i "$builddir"/src/sdk/src/Layout/redist/targets/GenerateLayout.targets
}
_init() {
export _InitializeDotNetCli=$_cli_root
export DOTNET_INSTALL_DIR=$_cli_root
export PATH="$_cli_root:$PATH"
export NUGET_PACKAGES=$_nugetdir
export DotNetBuildFromSource=true
export DOTNET_CLI_TELEMETRY_OPTOUT=true
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true
export SHELL=/bin/bash
export EXTRA_CPPFLAGS="${CPPFLAGS/--sysroot=$CBUILDROOT}"
export EXTRA_CXXFLAGS="${CXXFLAGS/--sysroot=$CBUILDROOT}"
export EXTRA_CFLAGS="${CFLAGS/--sysroot=$CBUILDROOT}"
export EXTRA_LDFLAGS="$LDFLAGS"
unset CXXFLAGS CFLAGS LDFLAGS CPPFLAGS
ulimit -n 4096
"$_cli_root"/dotnet build-server shutdown
}
_runtime() {
"$_cli_root"/dotnet build-server shutdown
_init
if [ -z "${_runtimever+x}" ]; then
local _runtimever=$(grep OutputPackageVersion "$builddir"/git-info/runtime.props | sed -E 's|</?OutputPackageVersion>||g' | tr -d ' ')
local _runtimever=$(grep OutputPackageVersion "$builddir"/prereqs/git-info/runtime.props | sed -E 's|</?OutputPackageVersion>||g' | tr -d ' ')
fi
local _runtimever_ns=$(awk '{if($2 ~ "Name=\"VS.Redist.Common.NetCore.SharedFramework.x64.*\""){print $3}}' "$builddir"/src/installer/eng/Version.Details.xml | awk -F '"' '{print $2}')
@ -243,11 +211,13 @@ _runtime() {
/p:NoPgoOptimize=true
/p:EnableNgenOptimization=false
/p:ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch=none
/p:RunApiCompat=false
/p:GitCommitHash=$(grep GitCommitHash "$builddir"/git-info/runtime.props | sed -E 's|</?GitCommitHash>||g' | tr -d ' ')
/p:_toolsRID=linux-musl-$_dotnet_arch
/p:OutputRid=linux-musl-$_dotnet_target
/p:GitCommitHash=$(grep GitCommitHash "$builddir"/prereqs/git-info/runtime.props | sed -E 's|</?GitCommitHash>||g' | tr -d ' ')
"
if [ "$CBUILD" != "$CHOST" ]; then
local args="$args -cross"
# https://github.com/dotnet/runtime/pull/75597 broke crossbuilding when true
local DotNetBuildFromSource=false
# x86 build of mono broken, thus do not build mono
case $_dotnet_target in
@ -266,35 +236,10 @@ _runtime() {
cp artifacts/packages/*/*/dotnet-runtime-*-*.tar.gz $_downloaddir/Runtime/$_runtimever_ns
}
_roslyn() {
"$_cli_root"/dotnet build-server shutdown
if [ -z "${_roslynver+x}" ]; then
local _roslynver=$(grep OutputPackageVersion "$builddir"/git-info/roslyn.props | sed -E 's|</?OutputPackageVersion>||g' | tr -d ' ')
fi
local _roslynver_ns=$(awk '{if($2 == "Name=\"Microsoft.Net.Compilers.Toolset\""){print $3}}' "$builddir"/src/installer/eng/Version.Details.xml | awk -F '"' '{print $2}')
msg "[$(date)] Building roslyn version $_roslynver"
cd "$builddir"/src/roslyn
local args="
-c Release
-bl
/p:GitCommitHash=$(grep GitCommitHash "$builddir"/git-info/roslyn.props | sed -E 's|</?GitCommitHash>||g' | tr -d ' ')
"
if [ "$_roslynver" != "${_roslynver##*-}" ]; then
local args="$args /p:VersionSuffix=${_roslynver##*-}"
fi
DotNetBuildFromSource=false ./eng/build.sh --restore $args /p:UseAppHost=false
./eng/build.sh --restore --build --pack $args
for i in artifacts/packages/*/*/*.nupkg; do
$_nuget push $i --source="$_packagesdir"
done
}
_sdk() {
"$_cli_root"/dotnet build-server shutdown
_init
if [ -z "${_sdkver+x}" ]; then
local _sdkver=$(grep OutputPackageVersion "$builddir"/git-info/sdk.props | sed -E 's|</?OutputPackageVersion>||g' | tr -d ' ')
local _sdkver=$(grep OutputPackageVersion "$builddir"/prereqs/git-info/sdk.props | sed -E 's|</?OutputPackageVersion>||g' | tr -d ' ')
fi
local _sdkver_ns=$(awk '{if($2 == "Name=\"Microsoft.NET.Sdk\""){print $3}}' "$builddir"/src/installer/eng/Version.Details.xml | awk -F '"' '{print $2}')
@ -305,13 +250,13 @@ _sdk() {
-c Release
-bl
/consoleLoggerParameters:ShowTimestamp
/p:GitCommitHash=$(grep GitCommitHash "$builddir"/git-info/sdk.props | sed -E 's|</?GitCommitHash>||g' | tr -d ' ')
/p:GitCommitHash=$(grep GitCommitHash "$builddir"/prereqs/git-info/sdk.props | sed -E 's|</?GitCommitHash>||g' | tr -d ' ')
/p:Architecture=$_dotnet_target
/p:TestCliNuGetDirectoryTargetFramework=netcoreapp3.1
"
if [ "$_sdkver" != "${_sdkver##*-}" ]; then
local args="$args /p:VersionSuffix=${_sdkver##*-}"
fi
./build.sh --pack /p:Projects=$builddir/src/sdk/source-build.slnf $args
for i in artifacts/packages/*/*/*.nupkg; do
@ -322,9 +267,9 @@ _sdk() {
}
_aspnetcore() {
"$_cli_root"/dotnet build-server shutdown
_init
if [ -z "${_aspnetver+x}" ]; then
local _aspnetver=$(grep OutputPackageVersion "$builddir"/git-info/aspnetcore.props | sed -E 's|</?OutputPackageVersion>||g' | tr -d ' ')
local _aspnetver=$(grep OutputPackageVersion "$builddir"/prereqs/git-info/aspnetcore.props | sed -E 's|</?OutputPackageVersion>||g' | tr -d ' ')
fi
local _aspnetver_ns=$(awk '{if($2 == "Name=\"Microsoft.AspNetCore.App.Ref.Internal\""){print $3}}' "$builddir"/src/installer/eng/Version.Details.xml | awk -F '"' '{print $2}')
@ -337,31 +282,34 @@ _aspnetcore() {
-arch $_dotnet_target
-no-build-nodejs
/consoleLoggerParameters:ShowTimestamp
/p:BuildOSName=linux-musl
/p:BuildNodeJs=false
/p:GitCommitHash=$(grep GitCommitHash "$builddir"/git-info/aspnetcore.props | sed -E 's|</?GitCommitHash>||g' | tr -d ' ')
/p:BuildOSName=linux-musl
/p:GitCommitHash=$(grep GitCommitHash "$builddir"/prereqs/git-info/aspnetcore.props | sed -E 's|</?GitCommitHash>||g' | tr -d ' ')
/p:DotNetAssetRootUrl=file://$_downloaddir/
/p:EnablePackageValidation=false
"
# x86 crossgen broken; ppc64le insists on using crossgen
case $_dotnet_target in
x86|ppc64le) local args="$args /p:DISABLE_CROSSGEN=True";;
esac
if [ "$_aspnetver" != "${_aspnetver##*-}" ]; then
local args="$args /p:VersionSuffix=${_aspnetver##*-}"
fi
# aspnetcore can't find newly created Microsoft.NETCore.App.Runtime.linux-musl-x86 for some reason
case $_dotnet_target in
riscv64|x86) local args="$args /p:CrossgenOutput=false";;
esac
./eng/build.sh --pack $args
for i in artifacts/packages/*/*/*.nupkg; do
$_nuget push $i --source="$_packagesdir"
done
mkdir -p "$_downloaddir"/aspnetcore/Runtime/$_aspnetver_ns
cp artifacts/installers/*/aspnetcore-runtime-internal-*-linux-musl-$_dotnet_target.tar.gz "$_downloaddir"/aspnetcore/Runtime/$_aspnetver_ns
cp artifacts/installers/*/aspnetcore-runtime-*-linux-musl-$_dotnet_target.tar.gz "$_downloaddir"/aspnetcore/Runtime/$_aspnetver_ns
cp artifacts/installers/*/aspnetcore_base_runtime.version "$_downloaddir"/aspnetcore/Runtime/$_aspnetver_ns
}
_installer() {
"$_cli_root"/dotnet build-server shutdown
_init
msg "[$(date)] Building installer version $_installerver"
cd "$builddir"/src/installer
@ -369,23 +317,22 @@ _installer() {
-c Release
-bl
/consoleLoggerParameters:ShowTimestamp
/p:EnableSourceLink=false
/p:OSName=linux-musl
/p:HostOSName=linux-musl
/p:Architecture=$_dotnet_target
/p:CoreSetupBlobRootUrl=file://$_downloaddir/
/p:DotnetToolsetBlobRootUrl=file://$_downloaddir/
/p:EnableSourceLink=false
/p:GitCommitHash=$(grep GitCommitHash "$builddir"/git-info/installer.props | sed -E 's|</?GitCommitHash>||g' | tr -d ' ')
/p:GitCommitCount=$(grep GitCommitCount "$builddir"/git-info/installer.props | sed -E 's|</?GitCommitCount>||g' | tr -d ' ')
/p:GitCommitHash=$(grep GitCommitHash "$builddir"/prereqs/git-info/installer.props | sed -E 's|</?GitCommitHash>||g' | tr -d ' ')
/p:GitCommitCount=1
/p:PublicBaseURL=file://$_downloaddir/
"
if [ "$_installerver" != "${_installerver##*-}" ]; then
local args="$args /p:VersionSuffix=${_installerver##*-}"
fi
# x86 crossgen broken
# crossgen broken on x86
case $_dotnet_target in
x86) local args="$args /p:DISABLE_CROSSGEN=True";;
riscv64|x86) local args="$args /p:DISABLE_CROSSGEN=True";;
esac
./build.sh $args
@ -395,24 +342,7 @@ _installer() {
}
build() {
export _InitializeDotNetCli=$_cli_root
export DOTNET_INSTALL_DIR=$_cli_root
export PATH="$_cli_root:$PATH"
export NUGET_PACKAGES=$_nugetdir
export DotNetBuildFromSource=true
export DOTNET_CLI_TELEMETRY_OPTOUT=true
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true
export SHELL=/bin/bash
export EXTRA_CPPFLAGS="${CPPFLAGS/--sysroot=$CBUILDROOT}"
export EXTRA_CXXFLAGS="${CXXFLAGS/--sysroot=$CBUILDROOT}"
export EXTRA_CFLAGS="${CFLAGS/--sysroot=$CBUILDROOT}"
export EXTRA_LDFLAGS="$LDFLAGS"
unset CXXFLAGS CFLAGS LDFLAGS CPPFLAGS
ulimit -n 4096
_runtime
_roslyn
_sdk
_aspnetcore
_installer
@ -430,6 +360,8 @@ bootstrap() {
provides="dotnet$_pkgver_name-bootstrap"
provider_priority=$_pkgver_prior
local _iltoolsver=$(grep \<MicrosoftNETCoreILAsmVersion "$builddir"/PackageVersions.props | sed -E 's|</?MicrosoftNETCoreILAsmVersion>||g' | tr -d ' ')
install -dm 755 \
"$subpkgdir"/$_libdir/dotnet/bootstrap/$pkgver/docs \
"$subpkgdir"/$_libdir/dotnet/bootstrap/$pkgver/comp \
@ -461,11 +393,6 @@ bootstrap() {
# copies artifacts to artifacts dir for use by future dotnet builds
for i in $_nupkgsArray; do install -Dm644 "$_packagesdir"/$i "$subpkgdir"/$_libdir/dotnet/artifacts/$pkgver/ || true; done
for i in $_extra_nupkgs; do
local filename=${i/::*}
local filename=${filename##*/}
install -Dm644 "$srcdir"/$filename "$subpkgdir"/$_libdir/dotnet/artifacts/$pkgver/
done
msg "Changing iltools version to $_iltoolsver"
# source-build expects a certain version of ilasm, ildasm and testhost
@ -475,13 +402,14 @@ bootstrap() {
local nupath=$(find $nupath || true)
local nupkg="${nupath##*/}"
local nuname="${nupkg/.nupkg}"
if [ -z "${nuname/*rtm*}" ] || [ -z "${nuname/*servicing*}" ]; then
if [ -z "${nuname/*rtm*}" ] || [ -z "${nuname/*servicing*}" ] || [ -z "${nuname/*preview*}" ]; then
nuname=${nuname%-*}
fi
local nuname="${nuname%.*.*.*}"
local nuver="${nupkg/$nuname.}"
local nuver="${nuver/.nupkg}"
local nuspec="$nuname.nuspec"
if [ ! "$nupath" ] || [ "$nupath" = "${nupath/$nuver/$_iltoolsver}" ]; then
continue
fi
@ -512,24 +440,24 @@ artifacts() {
tar --use-compress-program="pigz" \
-xf "$srcdir"/Private.SourceBuilt.Artifacts.*.noextract \
-C "$subpkgdir"/$_libdir/dotnet/artifacts/$pkgver/ \
--no-same-owner \
--exclude '*x64*'
--no-same-owner
}
sha512sums="
bfc122f316673fe4014e891eb101ecf40efc2ed4ecaff0cbd4bb5c17f547ccaa867ae8af22f41813565630cdb68e2972633703a88478fadde39584f91588589d dotnet-v7.0.105.tar.xz
8fb7d1754359e3fda35b7a07e13d2a5e9e723196b980dd922b30919aedaddbedd4d82e28b37471437b69cb93e4b1d136ac701e221924e44d0be6b6ba94dc3654 dotnet-sdk-7.0.105-linux-musl-x64.noextract
c8120c20939232b53a3cdc607d812d93fadd6dea9466f9454df559f8b7eb334c69fdfd31bc60e4c70b6cf4fc519a25a0439902b04cf5c5bd0c29de020024fbe2 dotnet-sdk-7.0.105-linux-musl-arm64.noextract
9ffa724ccc02dc3e40afe22f0546a9bdf68b6314cf6da03d9387fb010fe3e5935154a5c06c4a2d588ff4ac77f34120a4ae9bc0237fb24452d78e6698435acf72 dotnet-sdk-7.0.105-linux-musl-arm.noextract
e5d8f11d5da842309c1e7cf9936eb0cf3cfb56aaa17aeee64fe264b3e6771ee56dd6c405a4c16950b4e4607dab21bc0ec40783f69b0865a6112d7d03b1b57487 Private.SourceBuilt.Artifacts.7.0.102.noextract
2ede8d9352a51861a5b2550010ff55da8241381a6fa6cc49e025f1c289b230b8c0177e93850de4ea8b6f702c1f2d50d81a9f4d890ca9441c257b614f2a5e05dd stylecop.analyzers.1.2.0-beta.435.nupkg
094265462d66d97b51ebfbe5fb06d4a679b97881f1f5a07a87a282a96eeaabfe97ca42061d59aac71dd8861c07f07dda16a72e29ae03167407e51d3fd2767562 dotnet-tarball-v8.0.0.tar.gz
55f2c56f7fbed4137ebe5e81c7b86d199d7ff91c6e19fbc9a4af8cd5d0f0195273356ead8b80aedfff56a3d704a541a7c2a7395bec3fa5d6585f3afd056b1220 dotnet-release-v8.0.0.json
a904491cf1fe27603cfc21aa234b2f4da7517929fa9dad0eaa2233d010ef1e890339ca4b8e3c4c0d463f3015d7020a0c37ece97319b061cd92a5fc51cd8a7f4c dotnet-sdk-8.0.100-linux-musl-x64.noextract
1d8e54ab8d2b7b83972c1ecd7a23073bf83d39c258e993e54ab91a383ad2aa44276dfc28938f7b162cf79010187005e42a665933dff021ffa5e5d9cfadb5e2b6 dotnet-sdk-8.0.100-linux-musl-arm64.noextract
a8c08c4eaaa1ade3a1521750c62af92ab8fe91bfdd0f4767f8c0469ebfef091f3a68a443d4566bbfe53c49866d72a104c7aea309cabb36148f9aef9cb950ea64 dotnet-sdk-8.0.100-linux-musl-arm.noextract
d0bebb6179e679dea5704ca59acb2260a3dde2d22727b8116b57fbcfc3cba7b31581ed785279eec2836e3916608f39fa45a8e26dfa27063928355ccda83b3d09 dotnet-sdk-8.0.100-r0-linux-musl-s390x.noextract
14fdc6c8225010a6028609ed2b7c942abc770a50167429116ab9d5f0cabfe8038aedb89b7cc984d89c3366351302a86e10c2d5cfccd57399cc42b3c838bc37a0 dotnet-sdk-8.0.100-r0-linux-musl-ppc64le.noextract
a9933d8de614e914d42cf4953ac60a0a6e83e4276328b838fb369fb3036073fd08d2bcbcee07386f65f802f2f2374e45b44b8f8410396a7d93d20e53646d72f0 Private.SourceBuilt.Artifacts.8.0.100-rtm.23551.1.centos.8-x64.noextract
48d155f11c4594eeb72b2d80a6e110ab2b093fd2379e9ddcca755072f4a3e64990ef2620709e0b10ea4b979d8909de56d89f970c349c6fee58621a8f6b415a1c build_fix-ga-versions.patch
6f23b53b1408dc676434d3ee417b735af033f2717057589e93d26021ca2513d13f40ba7ea3312413f2ed79cda2991538f64b4c835e75f40f5a5e5a0e469c4ec0 installer_aspire-manifest-version-fix.patch
b6a2dfeccac329546f87f1019c1f2cf07e2f294dd33914449ad08d92269c8713b6fa1e330ef257c24e189023fd0b824df97688b0ba6e578a6d0292b07a72b4c1 installer_set-crossgen2rid-using-buildarchitecture.patch
43355fdb9531a08a9a141b016c049cc61d779e797f182456f56e5dc3af76fd31643d84d7ad7982080921681d2bbfc7bbaaa64f50c3899b023222eb0d841fbb2a runtime_76500-mono-musl-support.patch
24f3fed752922d2ca3c151f21fedf6a257c7c74a155105a1aa09cdc847ba24e496212cb2d8548b134a8901c7da8d78c27fa93579211f7bdeadc598f808fed4a8 runtime_76500-properly-set-toolchain-for-alpine.patch
d732df247c721c9f677baabdd7f36dbf4b564814ff64164361065bb1c196b767494a1d39f634eadf01a23032c7b3e64102614b7213065c81096bbf3f8022e6a0 runtime_82269-mono-thread-coop-undefine-fortify-source.patch
2dd195d5275245fe85bea2f75019fd3cbadcef7f5691b44c08db470265c6e7fcb2a50b3276a96df7547af76953623fdc92bd1ad51ccef6738813b78d22327fa3 runtime_83682-specify-notext-on-linux-musl-x86.patch
2ed962096eb9d8ae61831d224ceb05b8f77f5692f38a3457048d1b4abef705e8e4f676b81bb1a833e338e75ac8dc80b0631b1a45ad9a15c5597740b7320bfbb5 runtime_84413-support-adding-rids-with-dash-in-base-part.patch
929d5be2e4a213ad726652c24478e45abe1bf1d444c01a8975da007f246cb056916ad4681e541436faa89447e35c5e0a6101ae4ecaecc8083155b04e7138beb8 runtime_84444-suppress-clang-16-warnings.patch
1f7be536c4826638853f110ee88bbd554be015cc88c6491c1066830789be18ad324f8ed2b1b75ed7aad74457dcafc812730059cb25d36d6344bfae8a517c00c4 runtime_enable-runtime-marshalling.diff
d972e77df27748a80c9b23eca12f9fbd78be97f9034b79cc5703ba58eb6750171d9a115314300f883620ccbca89c65a99ca7a45d54a421b028b590190b4bed80 runtime_remove-usage-of-off64-t.patch
c983a1ab7f06ac86691e0fa7a61fcad69a074d984ef4a4116bee43f20be918215963c7ec8ddd7edd70432b29b160ff78288183acc89fda15ce4a75bfdbf99ee3 runtime_83682-specify-notext-on-linux-musl-x86.patch
3354fa721809f1b94c579408ee78004ff3ca2ba79212c1a0ecc424a9955bb5d5a80c115d4c30dd257526f356ea76f0562db6f83d8dd0b6135f8c689886b3348d runtime_90251-rename-mono-cmake-host-var.patch
887112eb2b103eadd6887529ebae7f9a75df2c2cb168e84fd40cc09f9bcd20917d428bbba06968b07b0a463890da82b1b2b1d033a3dd016e6494067464ae6f74 runtime_more-clang-16-suppression.patch
0c25319125ef5b0ad490b37a643c0c5257c796d5ed24f9ac404f698710b07de790bcbb0b6336d4a50025b94c3bff99b214951bd8f0a79a8d6f543ebaa300740f runtime_remove-usage-of-off64-t.patch
"

View file

@ -1,17 +1,17 @@
# dotnet7-stage0
# dotnet8-stage0
This is the .NET 7.0 package for Alpine Linux.
This is the .NET 8.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
* `dotnet7` (empty package to go around `buildrepo` build ordering bug)
* `dotnet7-stage0-bootstrap` (packages binary bootstrap artifacts)
* `dotnet7-stage0-artifacts` (packages non-binary bootstrap artifacts)
* `dotnet8` (empty package to go around `buildrepo` build ordering bug)
* `dotnet8-stage0-bootstrap` (packages binary bootstrap artifacts)
* `dotnet8-stage0-artifacts` (packages non-binary bootstrap artifacts)
## How to build dotnet7 on Alpine
## How to build dotnet8 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)
@ -22,17 +22,20 @@ builds bootstraps for Alpine on `x86_64`, `aarch64`, and `armv7`. Thus, `stage0`
has also been designed to be crossbuild aware, allowing bootstrapping to other
platforms.
In summary, dotnet7 is built using three different aports.
In summary, dotnet8 is built using three different aports.
* `community/dotnet7-stage0`
Builds minimum components for full build of dotnet7, and packages these in an initial
`dotnet7-stage0-bootstrap` package that `dotnet7-build` pulls.
* `community/dotnet7-build`
Builds full and packages dotnet7 fully using either stage0 or previoulsy built
dotnet7 build.
* `community/dotnet7-runtime`
* `community/dotnet8-stage0`
Builds minimum components for full build of dotnet8, and packages these in an initial
`dotnet8-stage0-bootstrap` package that `dotnet8-runtime` pulls.
* `community/dotnet8-runtime`
Builds full and packages dotnet8 fully using either stage0 or previoulsy built
dotnet8 build.
* `community/dotnet8-sdk`
As abuild does not allow different versions for subpackages, a different aport
is required to package runtime bits from dotnet7-build.
is required to package runtime bits from dotnet8-runtime. dotnet8-runtime only
builds 8.0.1xx feature branch of SDK. Thus, when a new feature branch of sdk is
released, the updated components are to be built on dotnet8-sdk rather than
simply repackaging dotnet8-runtime artifacts.
## Crossbuilding with `stage0`
Crossbuilding `stage0` is a three step process:
@ -44,7 +47,7 @@ Crossbuilding `stage0` is a three step process:
`$HOME/sysroot-$CTARGET_ARCH/etc/apk/repositories`, making sure to add required
keys. This makes it so that whatever package is not built in step 1 will
be pulled from package repos
3. Crossbuild `dotnet7-stage0` via:
3. Crossbuild `dotnet8-stage0` via:
```
CHOST=$CTARGET_ARCH abuild -r
```
@ -53,7 +56,7 @@ CHOST=$CTARGET_ARCH abuild -r
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 `dotnet7` as opposed to `dotnet-7.0`
In addition, the package is named `dotnet8` as opposed to `dotnet-8.0`
to match Alpine Linux naming conventions for packages with many installable versions
# Contributing
@ -69,7 +72,7 @@ follow.
2. Checkout the forked repository.
- `git clone ssh://git@gitlab.alpinelinux.org/$USER/aports`
- `cd community/dotnet7-build`
- `cd community/dotnet8-runtime`
3. Make your changes. Don't forget to add a changelog.
@ -81,10 +84,10 @@ follow.
6. Commit the changes to the git repo in a git branch
- `git checkout -b dotnet7/<name>`
- `git checkout -b dotnet8/<name>`
- `git add` any new patches
- `git remove` any now-unnecessary patches
- `git commit -m 'community/dotnet7-build: descriptive description'`
- `git commit -m 'community/dotnet8-runtime: descriptive description'`
- `git push`
7. Create a merge request with your changes, tagging @ayakael for review.
@ -99,7 +102,7 @@ follow.
2. Checkout the forked repository.
- `git clone ssh://git@gitlab.alpinelinux.org/$USER/aports`
- `cd community/dotnet7-build`
- `cd community/dotnet8-runtime`
3. Build the new upstream source tarball. Update the versions in the
@ -120,10 +123,10 @@ follow.
7. Commit the changes to the git repo in a git branch.
- `git checkout -b dotnet7/<name>`
- `git checkout -b dotnet8/<name>`
- `git add` any new patches
- `git remove` any now-unnecessary patches
- `git commit -m 'community/dotnet7-build: upgrade to <new-version>`
- `git commit -m 'community/dotnet8-runtime: upgrade to <new-version>`
- `git push`
8. Create a merge request with your changes, tagging @ayakael for review.

View file

@ -0,0 +1,32 @@
diff --git a/prereqs/git-info/runtime.props.orig b/prereqs/git-info/runtime.props
index f9dc4d6..093bd00 100644
--- a/prereqs/git-info/runtime.props.orig
+++ b/prereqs/git-info/runtime.props
@@ -3,8 +3,8 @@
<PropertyGroup>
<GitCommitHash>5535e31a712343a63f5d7d796cd874e563e5ac14</GitCommitHash>
<OfficialBuildId>20231031.3</OfficialBuildId>
- <OutputPackageVersion>8.0.0-rtm.23531.3</OutputPackageVersion>
+ <OutputPackageVersion>8.0.0</OutputPackageVersion>
<PreReleaseVersionLabel>rtm</PreReleaseVersionLabel>
<IsStable>false</IsStable>
</PropertyGroup>
-</Project>
\ No newline at end of file
+</Project>
diff --git a/prereqs/git-info/aspnetcore.props.orig b/prereqs/git-info/aspnetcore.props
index d1494e8..b83649d 100644
--- a/prereqs/git-info/aspnetcore.props.orig
+++ b/prereqs/git-info/aspnetcore.props
@@ -3,8 +3,8 @@
<PropertyGroup>
<GitCommitHash>3f1acb59718cadf111a0a796681e3d3509bb3381</GitCommitHash>
<OfficialBuildId>20231031.12</OfficialBuildId>
- <OutputPackageVersion>8.0.0-rtm.23531.12</OutputPackageVersion>
+ <OutputPackageVersion>8.0.0</OutputPackageVersion>
<PreReleaseVersionLabel>rtm</PreReleaseVersionLabel>
<IsStable>false</IsStable>
</PropertyGroup>
-</Project>
\ No newline at end of file
+</Project>

View file

@ -0,0 +1,26 @@
diff --git a/./src/installer/eng/Version.Details.xml.orig b/./src/installer/eng/Version.Details.xml
index a1cebfe..3f47a7f 100644
--- a/./src/installer/eng/Version.Details.xml.orig
+++ b/./src/installer/eng/Version.Details.xml
@@ -172,7 +172,7 @@
<Uri>https://github.com/dotnet/emsdk</Uri>
<Sha>2406616d0e3a31d80b326e27c156955bfa41c791</Sha>
</Dependency>
- <Dependency Name="Microsoft.NET.Sdk.Aspire.Manifest-8.0.100" Version="8.0.0-preview.1.23551.7">
+ <Dependency Name="Microsoft.NET.Sdk.Aspire.Manifest-8.0.100" Version="8.0.0-preview.1.23557.2">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-aspire</Uri>
<Sha>4b00c57d7ccf9a4c7e2aef211ab6bd8af3ee2324</Sha>
<SourceBuild RepoName="aspire" ManagedOnly="true" />
diff --git a/./src/installer/eng/Versions.props.orig b/./src/installer/eng/Versions.props
index 329ab4e..897263d 100644
--- a/./src/installer/eng/Versions.props.orig
+++ b/./src/installer/eng/Versions.props
@@ -238,7 +238,7 @@
<!-- Workload manifest package versions -->
<PropertyGroup>
<AspireFeatureBand>8.0.100</AspireFeatureBand>
- <AspireWorkloadManifestVersion>8.0.0-preview.1.23551.7</AspireWorkloadManifestVersion>
+ <AspireWorkloadManifestVersion>8.0.0-preview.1.23557.2</AspireWorkloadManifestVersion>
<MauiFeatureBand>8.0.100-rc.2</MauiFeatureBand>
<MauiWorkloadManifestVersion>8.0.0-rc.2.9373</MauiWorkloadManifestVersion>
<XamarinAndroidWorkloadManifestVersion>34.0.0-rc.2.468</XamarinAndroidWorkloadManifestVersion>

View file

@ -1,325 +0,0 @@
From 98054ea87ce70247bb09ceafd2ad1a0b36d2fef4 Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/runtime/pull/76500
From: Antoine Martin <dev@ayakael.net>
Date: Sat, 1 Oct 2022 09:21:58 -0400
Subject: [PATCH] Mono musl support
---
Directory.Build.props | 1 +
eng/common/cross/toolchain.cmake | 38 +++++++++++++++++++-----
eng/native/configurecompiler.cmake | 7 +++++
eng/native/tryrun.cmake | 6 +++-
src/coreclr/pal/src/CMakeLists.txt | 5 ++++
src/coreclr/pal/src/misc/perfjitdump.cpp | 2 +-
src/coreclr/vm/i386/cgenx86.cpp | 4 +++
src/mono/CMakeLists.txt | 33 ++++++++++++++++++++
src/mono/mono.proj | 32 +++++++++++++-------
src/mono/mono/mini/mini-runtime.c | 29 ++++++++++++++++++
src/mono/mono/utils/mono-context.h | 8 +++++
11 files changed, 146 insertions(+), 19 deletions(-)
diff --git a/src/runtime/Directory.Build.props b/src/runtime/Directory.Build.props
index 6f9b97c0a9c..4298a6df1d3 100644
--- a/src/runtime/Directory.Build.props
+++ b/src/runtime/Directory.Build.props
@@ -22,7 +22,6 @@
<TargetOS Condition="'$(TargetOS)' == ''">$(_hostOS)</TargetOS>
<TargetsMobile Condition="'$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'iOSSimulator' or '$(TargetOS)' == 'MacCatalyst' or '$(TargetOS)' == 'tvOS' or '$(TargetOS)' == 'tvOSSimulator' or '$(TargetOS)' == 'Android' or '$(TargetOS)' == 'Browser'">true</TargetsMobile>
<TargetsAppleMobile Condition="'$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'iOSSimulator' or '$(TargetOS)' == 'MacCatalyst' or '$(TargetOS)' == 'tvOS' or '$(TargetOS)' == 'tvOSSimulator'">true</TargetsAppleMobile>
- <TargetsLinuxBionic Condition="$(OutputRid.StartsWith('linux-bionic'))">true</TargetsLinuxBionic>
</PropertyGroup>
<!-- Platform property is required by RepoLayout.props in Arcade SDK. -->
@@ -154,7 +154,7 @@
<_runtimeOS Condition="'$(TargetsMobile)' == 'true'">$(TargetOS.ToLowerInvariant())</_runtimeOS>
<_portableOS>linux</_portableOS>
- <_portableOS Condition="'$(_runtimeOS)' == 'linux-musl'">linux-musl</_portableOS>
+ <_portableOS Condition="'$(_runtimeOS)' == 'linux-musl' or $(_runtimeOS.StartsWith('alpine'))">linux-musl</_portableOS>
<_portableOS Condition="'$(_runtimeOS)' == 'linux-bionic'">linux-bionic</_portableOS>
<_portableOS Condition="'$(_hostOS)' == 'OSX'">osx</_portableOS>
<_portableOS Condition="'$(_runtimeOS)' == 'win' or '$(TargetOS)' == 'windows'">win</_portableOS>
@@ -200,6 +199,9 @@
<OutputRid Condition="'$(OutputRid)' == ''">$(PackageRID)</OutputRid>
<OutputRid Condition="'$(PortableBuild)' == 'true'">$(_portableOS)-$(TargetArchitecture)</OutputRid>
+
+ <TargetsLinuxBionic Condition="$(OutputRid.StartsWith('linux-bionic'))">true</TargetsLinuxBionic>
+ <TargetsLinuxMusl Condition="'$(_portableOS)' == 'linux-musl'">true</TargetsLinuxMusl>
</PropertyGroup>
<PropertyGroup Label="CalculateTargetOSName" Condition="'$(SkipInferTargetOSName)' != 'true'">
diff --git a/src/runtime/eng/native/tryrun.cmake b/src/runtime/eng/native/tryrun.cmake
index 6355b0988f7..056c6606b17 100644
--- a/src/runtime/eng/native/tryrun.cmake
+++ b/src/runtime/eng/native/tryrun.cmake
@@ -8,7 +8,11 @@ endmacro()
if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/armv7-alpine-linux-musleabihf OR
EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/armv6-alpine-linux-musleabihf OR
- EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/aarch64-alpine-linux-musl)
+ EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/aarch64-alpine-linux-musl OR
+ EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/s390x-alpine-linux-musl OR
+ EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/ppc64le-alpine-linux-musl OR
+ EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/i586-alpine-linux-musl OR
+ EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/riscv64-alpine-linux-musl)
set(ALPINE_LINUX 1)
elseif(EXISTS ${CROSS_ROOTFS}/bin/freebsd-version)
diff --git a/src/runtime/src/coreclr/pal/src/CMakeLists.txt b/src/runtime/src/coreclr/pal/src/CMakeLists.txt
index d9726460ccf..c28563f8619 100644
--- a/src/runtime/src/coreclr/pal/src/CMakeLists.txt
+++ b/src/runtime/src/coreclr/pal/src/CMakeLists.txt
@@ -315,6 +315,11 @@ if(CLR_CMAKE_TARGET_LINUX)
target_link_libraries(coreclrpal ${UNWIND_LIBS})
endif(CLR_CMAKE_USE_SYSTEM_LIBUNWIND)
+ # bundled libunwind requires using libucontext on alpine and x86 and ppc64le
+ if(CLR_CMAKE_TARGET_ALPINE_LINUX AND (CLR_CMAKE_TARGET_ARCH_I386 OR CLR_CMAKE_TARGET_ARCH_POWERPC64))
+ target_link_libraries(coreclrpal ucontext)
+ endif(CLR_CMAKE_TARGET_ALPINE_LINUX AND (CLR_CMAKE_TARGET_ARCH_I386 OR CLR_CMAKE_TARGET_ARCH_POWERPC64))
+
endif(CLR_CMAKE_TARGET_LINUX)
if(CLR_CMAKE_TARGET_NETBSD)
diff --git a/src/runtime/src/coreclr/pal/src/misc/perfjitdump.cpp b/src/runtime/src/coreclr/pal/src/misc/perfjitdump.cpp
index 8d7f79ed3f0..043939ad2da 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/coreclr/vm/i386/cgenx86.cpp b/src/runtime/src/coreclr/vm/i386/cgenx86.cpp
index 811c84a140d..4e958a44b30 100644
--- a/src/runtime/src/coreclr/vm/i386/cgenx86.cpp
+++ b/src/runtime/src/coreclr/vm/i386/cgenx86.cpp
@@ -1133,6 +1133,7 @@ extern "C" DWORD __stdcall avx512StateSupport()
#else // !TARGET_UNIX
+#if !__has_builtin(__cpuid)
void __cpuid(int cpuInfo[4], int function_id)
{
// Based on the Clang implementation provided in cpuid.h:
@@ -1143,7 +1144,9 @@ void __cpuid(int cpuInfo[4], int function_id)
: "0"(function_id)
);
}
+#endif
+#if !__has_builtin(__cpuidex)
void __cpuidex(int cpuInfo[4], int function_id, int subFunction_id)
{
// Based on the Clang implementation provided in cpuid.h:
@@ -1154,6 +1157,7 @@ void __cpuidex(int cpuInfo[4], int function_id, int subFunction_id)
: "0"(function_id), "2"(subFunction_id)
);
}
+#endif
extern "C" DWORD __stdcall xmmYmmStateSupport()
{
diff --git a/src/runtime/src/mono/CMakeLists.txt b/src/runtime/src/mono/CMakeLists.txt
index cdff32677c0..08a82cd7e83 100644
--- a/src/runtime/src/mono/CMakeLists.txt
+++ b/src/runtime/src/mono/CMakeLists.txt
@@ -216,6 +216,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)
@@ -893,6 +922,12 @@ if(HOST_IOS OR HOST_ANDROID OR HOST_MACCAT)
else()
set(DISABLE_DLLMAP 1)
endif()
+
+if(CLR_CMAKE_HOST_ALPINE_LINUX)
+ # On Alpine Linux, we need to ensure that the reported stack range for the primary thread is
+ # larger than the initial committed stack size.
+ add_definitions(-DENSURE_PRIMARY_STACK_SIZE)
+endif()
### End of OS specific checks
include_directories("${CLR_SRC_NATIVE_DIR}")
diff --git a/src/runtime/src/mono/mono.proj b/src/runtime/src/mono/mono.proj
index 59fea4a2f72..5bac7fdf1c6 100644
--- a/src/runtime/src/mono/mono.proj
+++ b/src/runtime/src/mono/mono.proj
@@ -554,19 +560,21 @@
<MonoToolchainPrebuiltOS Condition="$([MSBuild]::IsOSPlatform('OSX'))">darwin-x86_64</MonoToolchainPrebuiltOS>
<MonoToolchainPrebuiltOS Condition="'$(HostOS)' == 'windows'">windows-x86_64</MonoToolchainPrebuiltOS>
<_MonoRuntimeFilePath>$(MonoObjDir)out\lib\$(MonoFileName)</_MonoRuntimeFilePath>
- <_LinuxAbi Condition="'$(TargetsAndroid)' != 'true' and '$(TargetsLinuxBionic)' != 'true'">gnu</_LinuxAbi>
- <_LinuxAbi Condition="'$(TargetsAndroid)' == 'true' or '$(TargetsLinuxBionic)' == 'true'">android</_LinuxAbi>
+ <_LinuxAbi Condition="'$(TargetsAndroid)' != 'true' and '$(TargetsLinuxBionic)' != 'true' and '$(TargetsLinuxMusl)' != 'true'">linux-gnu</_LinuxAbi>
+ <_LinuxAbi Condition="'$(TargetsAndroid)' != 'true' and '$(TargetsLinuxBionic)' != 'true' and '$(TargetsLinuxMusl)' == 'true'">alpine-linux-musl</_LinuxAbi>
+ <_LinuxAbi Condition="'$(TargetsAndroid)' == 'true' or '$(TargetsLinuxBionic)' == 'true'">linux-android</_LinuxAbi>
<_LinuxFloatAbi Condition="'$(TargetsAndroid)' != 'true' and '$(TargetsLinuxBionic)' != 'true'">hf</_LinuxFloatAbi>
<_Objcopy>objcopy</_Objcopy>
- <_Objcopy Condition="'$(Platform)' == 'arm'">arm-linux-$(_LinuxAbi)eabi$(_LinuxFloatAbi)-$(_Objcopy)</_Objcopy>
- <_Objcopy Condition="'$(Platform)' == 'armv6'">arm-linux-$(_LinuxAbi)eabi$(_LinuxFloatAbi)-$(_Objcopy)</_Objcopy>
- <_Objcopy Condition="'$(Platform)' == 'arm64'">aarch64-linux-$(_LinuxAbi)-$(_Objcopy)</_Objcopy>
- <_Objcopy Condition="'$(Platform)' == 'riscv64'">riscv64-linux-$(_LinuxAbi)-$(_Objcopy)</_Objcopy>
- <_Objcopy Condition="'$(Platform)' == 's390x'">s390x-linux-$(_LinuxAbi)-$(_Objcopy)</_Objcopy>
- <_Objcopy Condition="'$(Platform)' == 'ppc64le'">powerpc64le-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'">arm-$(_LinuxAbi)eabi$(_LinuxFloatAbi)-$(_Objcopy)</_Objcopy>
+ <_Objcopy Condition="'$(Platform)' == 'armv6'">arm-$(_LinuxAbi)eabi$(_LinuxFloatAbi)-$(_Objcopy)</_Objcopy>
+ <_Objcopy Condition="'$(Platform)' == 'arm64'">aarch64-$(_LinuxAbi)-$(_Objcopy)</_Objcopy>
+ <_Objcopy Condition="'$(Platform)' == 'riscv64'">riscv64-$(_LinuxAbi)-$(_Objcopy)</_Objcopy>
+ <_Objcopy Condition="'$(Platform)' == 's390x'">s390x-$(_LinuxAbi)-$(_Objcopy)</_Objcopy>
+ <_Objcopy Condition="'$(Platform)' == 'ppc64le'">powerpc64le-$(_LinuxAbi)-$(_Objcopy)</_Objcopy>
+ <_Objcopy Condition="'$(Platform)' == 'x64'">x86_64-$(_LinuxAbi)-$(_Objcopy)</_Objcopy>
+ <_Objcopy Condition="'$(Platform)' == 'x86'">i686-$(_LinuxAbi)-$(_Objcopy)</_Objcopy>
<_Objcopy Condition="'$(TargetsAndroid)' == 'true' or '$(TargetsLinuxBionic)' == 'true'">$(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/$(MonoToolchainPrebuiltOS)/bin/llvm-objcopy</_Objcopy>
+ <_Objcopy Condition="'$(TargetsLinuxMusl)' == 'true' and '$(CrossBuild)' != 'true'">objcopy</_Objcopy>
<_ObjcopyPrefix Condition="'$(MonoCrossDir)' != '' and '$(Platform)' == 'riscv64'">llvm-objcopy-</_ObjcopyPrefix>
</PropertyGroup>
diff --git a/src/runtime/src/mono/mono/mini/CMakeLists.txt b/src/runtime/src/mono/mono/mini/CMakeLists.txt
index 30df4bac1f7..8698fd81206 100644
--- a/src/runtime/src/mono/mono/mini/CMakeLists.txt
+++ b/src/runtime/src/mono/mono/mini/CMakeLists.txt
@@ -368,6 +368,11 @@ if(NOT DISABLE_SHARED_LIBS)
target_sources(monosgen-shared PRIVATE $<TARGET_OBJECTS:eglib_objects>)
set_target_properties(monosgen-shared PROPERTIES OUTPUT_NAME ${MONO_SHARED_LIB_NAME})
target_link_libraries (monosgen-shared PRIVATE monoapi)
+ # 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)
+
target_include_directories (monosgen-shared PRIVATE monoapi)
if(TARGET_WIN32)
# on Windows the import library for the shared mono library will have the same name as the static library,
@@ -527,6 +532,10 @@ if(NOT DISABLE_EXECUTABLES)
set_target_properties(mono-sgen PROPERTIES OUTPUT_NAME mono-aot-cross)
endif()
target_link_libraries(mono-sgen PRIVATE monoapi monosgen-static ${OS_LIBS} ${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/mini/mini-runtime.c b/src/runtime/src/mono/mono/mini/mini-runtime.c
index c481f69adc8..4db6c9a0ae7 100644
--- a/src/runtime/src/mono/mono/mini/mini-runtime.c
+++ b/src/runtime/src/mono/mono/mini/mini-runtime.c
@@ -4383,6 +4383,30 @@ mini_llvm_init (void)
#endif
}
+#ifdef ENSURE_PRIMARY_STACK_SIZE
+/*++
+ Function:
+ EnsureStackSize
+
+ Abstract:
+ This fixes a problem on MUSL where the initial stack size reported by the
+ pthread_attr_getstack is about 128kB, but this limit is not fixed and
+ the stack can grow dynamically. The problem is that it makes the
+ functions ReflectionInvocation::[Try]EnsureSufficientExecutionStack
+ to fail for real life scenarios like e.g. compilation of corefx.
+ Since there is no real fixed limit for the stack, the code below
+ ensures moving the stack limit to a value that makes reasonable
+ real life scenarios work.
+
+ --*/
+static MONO_NO_OPTIMIZATION MONO_NEVER_INLINE void
+ensure_stack_size (size_t size)
+{
+ volatile uint8_t *s = (uint8_t *)g_alloca(size);
+ *s = 0;
+}
+#endif // ENSURE_PRIMARY_STACK_SIZE
+
void
mini_add_profiler_argument (const char *desc)
{
@@ -4544,6 +4568,11 @@ mini_init (const char *filename)
mono_w32handle_init ();
#endif
+#ifdef ENSURE_PRIMARY_STACK_SIZE
+ // TODO: https://github.com/dotnet/runtime/issues/72920
+ ensure_stack_size (5 * 1024 * 1024);
+#endif // ENSURE_PRIMARY_STACK_SIZE
+
mono_thread_info_runtime_init (&ticallbacks);
if (g_hasenv ("MONO_DEBUG")) {
diff --git a/src/runtime/src/mono/mono/utils/mono-context.h b/src/runtime/src/mono/mono/utils/mono-context.h
index a1f0fe6f68e..a9db2d336ca 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"
diff --git a/src/runtime/src/native/libs/System.Native/pal_io.c b/src/runtime/src/native/libs/System.Native/pal_io.c
index 0929a0b49ec..86311e19507 100644
--- a/src/runtime/src/native/libs/System.Native/pal_io.c
+++ b/src/runtime/src/native/libs/System.Native/pal_io.c
@@ -1267,7 +1267,7 @@ int32_t SystemNative_CopyFile(intptr_t sourceFd, intptr_t destinationFd, int64_t
// Try copying data using a copy-on-write clone. This shares storage between the files.
if (sourceLength != 0)
{
- while ((ret = ioctl(outFd, FICLONE, inFd)) < 0 && errno == EINTR);
+ while ((ret = ioctl(outFd, (int)FICLONE, inFd)) < 0 && errno == EINTR);
copied = ret == 0;
}
#endif
--
2.36.3

View file

@ -1,97 +0,0 @@
From 98054ea87ce70247bb09ceafd2ad1a0b36d2fef4 Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/arcade/pull/11608
From: Antoine Martin <dev@ayakael.net>
Date: Sat, 1 Oct 2022 09:21:58 -0400
Subject: [PATCH] Mono musl support
---
Directory.Build.props | 1 +
eng/common/cross/toolchain.cmake | 38 +++++++++++++++++++-----
eng/native/configurecompiler.cmake | 7 +++++
eng/native/tryrun.cmake | 6 +++-
src/coreclr/pal/src/CMakeLists.txt | 5 ++++
src/coreclr/pal/src/misc/perfjitdump.cpp | 2 +-
src/coreclr/vm/i386/cgenx86.cpp | 4 +++
src/mono/CMakeLists.txt | 33 ++++++++++++++++++++
src/mono/mono.proj | 32 +++++++++++++-------
src/mono/mono/mini/mini-runtime.c | 29 ++++++++++++++++++
src/mono/mono/utils/mono-context.h | 8 +++++
11 files changed, 146 insertions(+), 19 deletions(-)
diff --git a/src/runtime/eng/common/cross/toolchain.cmake b/src/runtime/eng/common/cross/toolchain.cmake
index 561576be97c..a9db659f869 100644
--- a/src/runtime/eng/common/cross/toolchain.cmake
+++ b/src/runtime/eng/common/cross/toolchain.cmake
@@ -60,13 +60,25 @@ elseif(TARGET_ARCH_NAME STREQUAL "armv6")
endif()
elseif(TARGET_ARCH_NAME STREQUAL "ppc64le")
set(CMAKE_SYSTEM_PROCESSOR ppc64le)
- set(TOOLCHAIN "powerpc64le-linux-gnu")
+ if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/powerpc64le-alpine-linux-musl)
+ set(TOOLCHAIN "powerpc64le-alpine-linux-musl")
+ else()
+ set(TOOLCHAIN "powerpc64le-linux-gnu")
+ endif()
elseif(TARGET_ARCH_NAME STREQUAL "riscv64")
set(CMAKE_SYSTEM_PROCESSOR riscv64)
- set(TOOLCHAIN "riscv64-linux-gnu")
+ if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/riscv64-alpine-linux-musl)
+ set(TOOLCHAIN "riscv64-alpine-linux-musl")
+ else()
+ set(TOOLCHAIN "riscv64-linux-gnu")
+ endif()
elseif(TARGET_ARCH_NAME STREQUAL "s390x")
set(CMAKE_SYSTEM_PROCESSOR s390x)
- set(TOOLCHAIN "s390x-linux-gnu")
+ if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/s390x-alpine-linux-musl)
+ set(TOOLCHAIN "s390x-alpine-linux-musl")
+ else()
+ set(TOOLCHAIN "s390x-linux-gnu")
+ endif()
elseif(TARGET_ARCH_NAME STREQUAL "x64")
set(CMAKE_SYSTEM_PROCESSOR x86_64)
if(LINUX)
@@ -83,7 +95,11 @@ elseif(TARGET_ARCH_NAME STREQUAL "x64")
endif()
elseif(TARGET_ARCH_NAME STREQUAL "x86")
set(CMAKE_SYSTEM_PROCESSOR i686)
- set(TOOLCHAIN "i686-linux-gnu")
+ if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/i586-alpine-linux-musl)
+ set(TOOLCHAIN "i586-alpine-linux-musl")
+ else()
+ set(TOOLCHAIN "i686-linux-gnu")
+ endif()
if(TIZEN)
set(TIZEN_TOOLCHAIN "i586-tizen-linux-gnu/9.2.0")
endif()
@@ -253,8 +269,12 @@ elseif(TARGET_ARCH_NAME STREQUAL "arm64")
add_toolchain_linker_flag("-Wl,--rpath-link=${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}")
endif()
elseif(TARGET_ARCH_NAME STREQUAL "x86")
- add_toolchain_linker_flag(-m32)
-
+ if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/i586-alpine-linux-musl)
+ add_toolchain_linker_flag("--target=${TOOLCHAIN}")
+ add_toolchain_linker_flag("-Wl,--rpath-link=${CROSS_ROOTFS}/usr/lib/gcc/${TOOLCHAIN}")
+ else()
+ add_toolchain_linker_flag(-m32)
+ endif()
if(TIZEN)
add_toolchain_linker_flag("-B${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}")
add_toolchain_linker_flag("-L${CROSS_ROOTFS}/lib")
@@ -291,7 +311,11 @@ if(TARGET_ARCH_NAME MATCHES "^(arm|armel)$")
add_compile_options(-mfloat-abi=softfp)
endif()
elseif(TARGET_ARCH_NAME STREQUAL "x86")
- add_compile_options(-m32)
+ if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/i586-alpine-linux-musl)
+ add_compile_options(--target=${TOOLCHAIN})
+ else()
+ add_compile_options(-m32)
+ endif()
add_compile_options(-Wno-error=unused-command-line-argument)
endif()
--
2.36.3

View file

@ -7,18 +7,18 @@ Subject: [PATCH] Specify -z notext on linux-musl-x86
src/coreclr/CMakeLists.txt | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/runtime/src/coreclr/CMakeLists.txt.orig b/src/runtime/src/coreclr/CMakeLists.txt
index 7d1ce8d..5cacc78 100644
--- a/src/runtime/src/coreclr/CMakeLists.txt.orig
diff --git a/src/runtime/src/coreclr/CMakeLists.txt b/src/runtime/src/coreclr/CMakeLists.txt
index 67b773bf78787..87d862a541ae6 100644
--- a/src/runtime/src/coreclr/CMakeLists.txt
+++ b/src/runtime/src/coreclr/CMakeLists.txt
@@ -105,6 +105,10 @@ if(CLR_CMAKE_HOST_UNIX)
@@ -109,6 +109,10 @@ if(CLR_CMAKE_HOST_UNIX)
endif()
endif()
+ if(CLR_CMAKE_TARGET_ALPINE_LINUX AND CLR_CMAKE_TARGET_ARCH_I386)
+ add_linker_flag(-Wl,-z,notext)
+ add_linker_flag(-Wl,-z,notext)
+ endif()
+
add_subdirectory(pal)
add_subdirectory(hosts)
else()
if(NOT CLR_CMAKE_HOST_MACCATALYST AND NOT CLR_CMAKE_HOST_IOS AND NOT CLR_CMAKE_HOST_TVOS)
add_subdirectory(pal)
add_subdirectory(hosts)

View file

@ -1,164 +0,0 @@
From abc761c2c5694e4029fea1a60dc1934951c66e26 Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/runtime/pull/84413
From: Tom Deseyn <tom.deseyn@gmail.com>
Date: Thu, 6 Apr 2023 13:18:11 +0200
Subject: [PATCH 1/2] Microsoft.NETCore.Platforms: support adding rids with '-'
in the base part.
Currently when trying to add a rid like 'linux-musl-x64'
the rid is not understood to be base = 'linux-musl', arch = 'x64'.
Instead the parser considers a potential optional qualifier.
This causes the rid to be parsed as base = 'linux', arch = 'musl',
and qualifier = 'x64'.
We know the rids being added won't have a qualifier. If we take
this into account while parsing, we can parse the rid correctly.
---
.../Microsoft.NETCore.Platforms/src/RID.cs | 11 +++-
.../src/RuntimeGroupCollection.cs | 2 +-
.../tests/RidTests.cs | 50 +++++++++++++------
3 files changed, 47 insertions(+), 16 deletions(-)
diff --git a/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/RID.cs b/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/RID.cs
index 6457fd29cadf0..b464d5f0f54e3 100644
--- a/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/RID.cs
+++ b/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/RID.cs
@@ -56,7 +56,7 @@ private enum RIDPart : int
Max = Qualifier
}
- public static RID Parse(string runtimeIdentifier)
+ public static RID Parse(string runtimeIdentifier, bool noQualifier)
{
string[] parts = new string[(int)RIDPart.Max + 1];
bool omitVersionDelimiter = true;
@@ -90,6 +90,15 @@ public static RID Parse(string runtimeIdentifier)
// version might be omitted
else if (current == ArchitectureDelimiter)
{
+ // The qualifier delimiter and architecture delimiter are the same.
+ // When there is no qualifier, there will be one delimiter past the base part
+ // for the architecture.
+ // So if we see another delimiter later in the string (for the architecture),
+ // extend the base part instead of starting the architecture part.
+ if (noQualifier && runtimeIdentifier.IndexOf(ArchitectureDelimiter, i + 1) != -1)
+ {
+ break;
+ }
// ensure there's no version later in the string
if (runtimeIdentifier.IndexOf(VersionDelimiter, i) != -1)
{
diff --git a/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/RuntimeGroupCollection.cs b/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/RuntimeGroupCollection.cs
index e069508053105..31009a8d28e5e 100644
--- a/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/RuntimeGroupCollection.cs
+++ b/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/RuntimeGroupCollection.cs
@@ -34,7 +34,7 @@ public RuntimeGroupCollection(ICollection<RuntimeGroup> runtimeGroups)
/// <param name="parent"></param>
public void AddRuntimeIdentifier(string runtimeIdentifier, string parent)
{
- RID rid = RID.Parse(runtimeIdentifier);
+ RID rid = RID.Parse(runtimeIdentifier, noQualifier: true);
AddRuntimeIdentifier(rid, parent);
}
diff --git a/src/runtime/src/libraries/Microsoft.NETCore.Platforms/tests/RidTests.cs b/src/runtime/src/libraries/Microsoft.NETCore.Platforms/tests/RidTests.cs
index 227bcbdd10d4d..8dee0ebeda17a 100644
--- a/src/runtime/src/libraries/Microsoft.NETCore.Platforms/tests/RidTests.cs
+++ b/src/runtime/src/libraries/Microsoft.NETCore.Platforms/tests/RidTests.cs
@@ -10,35 +10,57 @@ public class RidTests
{
public static IEnumerable<object[]> ValidRIDData()
{
- yield return new object[] { "win10-x64", new RID() { BaseRID = "win", OmitVersionDelimiter = true, Version = new RuntimeVersion("10"), Architecture = "x64" } };
- yield return new object[] { "win10", new RID() { BaseRID = "win", OmitVersionDelimiter = true, Version = new RuntimeVersion("10")} };
- yield return new object[] { "linux", new RID() { BaseRID = "linux" } };
- yield return new object[] { "linux-x64", new RID() { BaseRID = "linux", Architecture = "x64" } };
- yield return new object[] { "linux-x64", new RID() { BaseRID = "linux", Architecture = "x64" } };
- yield return new object[] { "debian.10-x64", new RID() { BaseRID = "debian", Version = new RuntimeVersion("10"), Architecture = "x64" } };
- yield return new object[] { "linuxmint.19.2-x64", new RID() { BaseRID = "linuxmint", Version = new RuntimeVersion("19.2"), Architecture = "x64" } };
- yield return new object[] { "ubuntu.14.04-x64", new RID() { BaseRID = "ubuntu", Version = new RuntimeVersion("14.04"), Architecture = "x64" } };
- yield return new object[] { "foo-bar.42-arm", new RID() { BaseRID = "foo-bar", Version = new RuntimeVersion("42"), Architecture = "arm" } };
- yield return new object[] { "foo-bar-arm", new RID() { BaseRID = "foo", Architecture = "bar", Qualifier = "arm" } }; // demonstrates ambiguity, avoid using `-` in base
- yield return new object[] { "linux-musl-x64", new RID() { BaseRID = "linux", Architecture = "musl", Qualifier = "x64" } }; // yes, we already have ambiguous RIDs
+ yield return new object[] { "win10-x64", new RID() { BaseRID = "win", OmitVersionDelimiter = true, Version = new RuntimeVersion("10"), Architecture = "x64" }, null };
+ yield return new object[] { "win10", new RID() { BaseRID = "win", OmitVersionDelimiter = true, Version = new RuntimeVersion("10")}, null };
+ yield return new object[] { "linux", new RID() { BaseRID = "linux" }, null };
+ yield return new object[] { "linux-x64", new RID() { BaseRID = "linux", Architecture = "x64" }, null };
+ yield return new object[] { "linux-x64", new RID() { BaseRID = "linux", Architecture = "x64" }, null };
+ yield return new object[] { "debian.10-x64", new RID() { BaseRID = "debian", Version = new RuntimeVersion("10"), Architecture = "x64" }, null };
+ yield return new object[] { "linuxmint.19.2-x64", new RID() { BaseRID = "linuxmint", Version = new RuntimeVersion("19.2"), Architecture = "x64" }, null };
+ yield return new object[] { "ubuntu.14.04-x64", new RID() { BaseRID = "ubuntu", Version = new RuntimeVersion("14.04"), Architecture = "x64" }, null };
+ yield return new object[] { "foo-bar.42-arm", new RID() { BaseRID = "foo-bar", Version = new RuntimeVersion("42"), Architecture = "arm" }, null };
+ yield return new object[] { "foo-bar-arm", new RID() { BaseRID = "foo", Architecture = "bar", Qualifier = "arm" }, // demonstrates ambiguity, avoid using `-` in base
+ new RID() { BaseRID = "foo-bar", Architecture = "arm" } };
+ yield return new object[] { "linux-musl-x64", new RID() { BaseRID = "linux", Architecture = "musl", Qualifier = "x64" }, // yes, we already have ambiguous RIDs
+ new RID() { BaseRID = "linux-musl", Architecture = "x64" } };
}
[Theory]
[MemberData(nameof(ValidRIDData))]
- internal void ParseCorrectly(string input, RID expected)
+ internal void ParseCorrectly(string input, RID expected, RID? expectedNoQualifier)
{
- RID actual = RID.Parse(input);
+ _ = expectedNoQualifier; // unused
+
+ RID actual = RID.Parse(input, noQualifier: false);
Assert.Equal(expected, actual);
}
[Theory]
[MemberData(nameof(ValidRIDData))]
- internal void ToStringAsExpected(string expected, RID rid)
+ internal void ParseCorrectlyNoQualifier(string input, RID expected, RID? expectedNoQualifier)
+ {
+ expectedNoQualifier ??= expected;
+
+ RID actual = RID.Parse(input, noQualifier: true);
+
+ Assert.Equal(expectedNoQualifier, actual);
+ }
+
+ [Theory]
+ [MemberData(nameof(ValidRIDData))]
+ internal void ToStringAsExpected(string expected, RID rid, RID? expectedNoQualifierRid)
{
string actual = rid.ToString();
Assert.Equal(expected, actual);
+
+ if (expectedNoQualifierRid is not null)
+ {
+ actual = expectedNoQualifierRid.ToString();
+
+ Assert.Equal(expected, actual);
+ }
}
}
}
From f70da467ca94291039e0ea5b0723cb9db5e090e7 Mon Sep 17 00:00:00 2001
From: Tom Deseyn <tom.deseyn@gmail.com>
Date: Thu, 6 Apr 2023 18:14:31 +0200
Subject: [PATCH 2/2] Update
src/libraries/Microsoft.NETCore.Platforms/src/RuntimeGroupCollection.cs
Co-authored-by: Eric StJohn <ericstj@microsoft.com>
---
.../Microsoft.NETCore.Platforms/src/RuntimeGroupCollection.cs | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/RuntimeGroupCollection.cs b/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/RuntimeGroupCollection.cs
index 31009a8d28e5e..ec4762d71424c 100644
--- a/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/RuntimeGroupCollection.cs
+++ b/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/RuntimeGroupCollection.cs
@@ -34,6 +34,7 @@ public RuntimeGroupCollection(ICollection<RuntimeGroup> runtimeGroups)
/// <param name="parent"></param>
public void AddRuntimeIdentifier(string runtimeIdentifier, string parent)
{
+ // don't parse qualifier since we don't use them and they are ambiguous with `-` in base RID
RID rid = RID.Parse(runtimeIdentifier, noQualifier: true);
AddRuntimeIdentifier(rid, parent);

View file

@ -1,192 +0,0 @@
From 4b82b0b1173981ea5f2c7baf003a66fad31208c9 Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/runtime/pull/84443
From: Antoine Martin <dev@ayakael.net>
Date: Thu, 6 Apr 2023 16:01:47 -0400
Subject: [PATCH 1/2] Suppress clang-16 warnings (#81573)
---
eng/common/native/init-compiler.sh | 2 +-
eng/native/configurecompiler.cmake | 9 +++++++++
src/coreclr/dlls/mscordbi/CMakeLists.txt | 5 +----
src/coreclr/dlls/mscordbi/mscordbi.cpp | 15 +++++++++++++++
src/native/corehost/apphost/static/CMakeLists.txt | 4 ++--
...orts.src => singlefilehost_freebsdexports.src} | 4 ++++
.../apphost/static/singlefilehost_unixexports.src | 4 ----
7 files changed, 32 insertions(+), 11 deletions(-)
rename src/native/corehost/apphost/static/{singlefilehost_OSXexports.src => singlefilehost_freebsdexports.src} (81%)
diff --git a/src/runtime/eng/common/native/init-compiler.sh b/src/runtime/eng/common/native/init-compiler.sh
index 41a26d802a93f..f13b74080edf9 100644
--- a/src/runtime/eng/common/native/init-compiler.sh
+++ b/src/runtime/eng/common/native/init-compiler.sh
@@ -71,7 +71,7 @@ if [[ -z "$CLR_CC" ]]; then
# Set default versions
if [[ -z "$majorVersion" ]]; then
# note: gcc (all versions) and clang versions higher than 6 do not have minor version in file name, if it is zero.
- if [[ "$compiler" == "clang" ]]; then versions=( 15 14 13 12 11 10 9 8 7 6.0 5.0 4.0 3.9 3.8 3.7 3.6 3.5 )
+ if [[ "$compiler" == "clang" ]]; then versions=( 16 15 14 13 12 11 10 9 8 7 6.0 5.0 4.0 3.9 3.8 3.7 3.6 3.5 )
elif [[ "$compiler" == "gcc" ]]; then versions=( 12 11 10 9 8 7 6 5 4.9 ); fi
for version in "${versions[@]}"; do
diff --git a/src/runtime/eng/native/configurecompiler.cmake b/src/runtime/eng/native/configurecompiler.cmake
index 9090289f50e34..eaf5a867c5f6d 100644
--- a/src/runtime/eng/native/configurecompiler.cmake
+++ b/src/runtime/eng/native/configurecompiler.cmake
@@ -447,6 +447,15 @@ if (CLR_CMAKE_HOST_UNIX)
add_compile_options(-Wno-incompatible-ms-struct)
add_compile_options(-Wno-reserved-identifier)
+
+ # clang 16.0 introduced buffer hardening https://discourse.llvm.org/t/rfc-c-buffer-hardening/65734
+ # which we are not conforming to yet.
+ add_compile_options(-Wno-unsafe-buffer-usage)
+
+ # other clang 16.0 suppressions
+ add_compile_options(-Wno-single-bit-bitfield-constant-conversion)
+ add_compile_options(-Wno-cast-function-type-strict)
+ add_compile_options(-Wno-incompatible-function-pointer-types-strict)
else()
add_compile_options(-Wno-uninitialized)
add_compile_options(-Wno-strict-aliasing)
diff --git a/src/runtime/src/coreclr/dlls/mscordbi/CMakeLists.txt b/src/runtime/src/coreclr/dlls/mscordbi/CMakeLists.txt
index c24a90cf70409..95e92034e238f 100644
--- a/src/runtime/src/coreclr/dlls/mscordbi/CMakeLists.txt
+++ b/src/runtime/src/coreclr/dlls/mscordbi/CMakeLists.txt
@@ -100,10 +100,7 @@ elseif(CLR_CMAKE_HOST_UNIX)
mscordaccore
)
- # COREDBI_LIBRARIES is mentioned twice because ld is one pass linker and will not find symbols
- # if they are defined after they are used. Having all libs twice makes sure that ld will actually
- # find all symbols.
- target_link_libraries(mscordbi ${COREDBI_LIBRARIES} ${COREDBI_LIBRARIES})
+ target_link_libraries(mscordbi ${COREDBI_LIBRARIES})
add_dependencies(mscordbi mscordaccore)
diff --git a/src/runtime/src/coreclr/dlls/mscordbi/mscordbi.cpp b/src/runtime/src/coreclr/dlls/mscordbi/mscordbi.cpp
index 891c01e144f5c..109fe6a5b5417 100644
--- a/src/runtime/src/coreclr/dlls/mscordbi/mscordbi.cpp
+++ b/src/runtime/src/coreclr/dlls/mscordbi/mscordbi.cpp
@@ -32,3 +32,18 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
// Defer to the main debugging code.
return DbgDllMain(hInstance, dwReason, lpReserved);
}
+
+#if defined(HOST_LINUX) && defined(TARGET_LINUX)
+PALIMPORT HINSTANCE PALAPI DAC_PAL_RegisterModule(IN LPCSTR lpLibFileName);
+PALIMPORT VOID PALAPI DAC_PAL_UnregisterModule(IN HINSTANCE hInstance);
+
+HINSTANCE PALAPI PAL_RegisterModule(IN LPCSTR lpLibFileName)
+{
+ return DAC_PAL_RegisterModule(lpLibFileName);
+}
+
+VOID PALAPI PAL_UnregisterModule(IN HINSTANCE hInstance)
+{
+ DAC_PAL_UnregisterModule(hInstance);
+}
+#endif
diff --git a/src/runtime/src/native/corehost/apphost/static/CMakeLists.txt b/src/runtime/src/native/corehost/apphost/static/CMakeLists.txt
index c37885bf5691c..a632d993c0f2a 100644
--- a/src/runtime/src/native/corehost/apphost/static/CMakeLists.txt
+++ b/src/runtime/src/native/corehost/apphost/static/CMakeLists.txt
@@ -65,8 +65,8 @@ if(CLR_CMAKE_TARGET_WIN32)
add_linker_flag("/DEF:${CMAKE_CURRENT_SOURCE_DIR}/singlefilehost.def")
else()
- if(CLR_CMAKE_TARGET_OSX)
- set(DEF_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/singlefilehost_OSXexports.src)
+ if(CLR_CMAKE_TARGET_FREEBSD)
+ set(DEF_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/singlefilehost_freebsdexports.src)
else()
set(DEF_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/singlefilehost_unixexports.src)
endif()
diff --git a/src/runtime/src/native/corehost/apphost/static/singlefilehost_OSXexports.src b/src/runtime/src/native/corehost/apphost/static/singlefilehost_freebsdexports.src
similarity index 81%
rename from src/native/corehost/apphost/static/singlefilehost_OSXexports.src
rename to src/native/corehost/apphost/static/singlefilehost_freebsdexports.src
index 18d5697e84580..1f9c517821855 100644
--- a/src/runtime/src/native/corehost/apphost/static/singlefilehost_OSXexports.src
+++ b/src/runtime/src/native/corehost/apphost/static/singlefilehost_freebsdexports.src
@@ -9,3 +9,7 @@ g_dacTable
; Used by profilers
MetaDataGetDispenser
+
+; FreeBSD needs to reexport these
+__progname
+environ
diff --git a/src/runtime/src/native/corehost/apphost/static/singlefilehost_unixexports.src b/src/runtime/src/native/corehost/apphost/static/singlefilehost_unixexports.src
index 1f9c517821855..18d5697e84580 100644
--- a/src/runtime/src/native/corehost/apphost/static/singlefilehost_unixexports.src
+++ b/src/runtime/src/native/corehost/apphost/static/singlefilehost_unixexports.src
@@ -9,7 +9,3 @@ g_dacTable
; Used by profilers
MetaDataGetDispenser
-
-; FreeBSD needs to reexport these
-__progname
-environ
From b5b3114e6866ac0058b5e18da52f92a1738a915b Mon Sep 17 00:00:00 2001
From: Antoine Martin <dev@ayakael.net>
Date: Thu, 6 Apr 2023 16:35:18 -0400
Subject: [PATCH 2/2] Fix DBI loading problem on Linux (#82461)
---
src/coreclr/dlls/mscordbi/CMakeLists.txt | 16 +++++++++++++++-
src/coreclr/dlls/mscordbi/mscordbi.cpp | 15 ---------------
2 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/src/runtime/src/coreclr/dlls/mscordbi/CMakeLists.txt b/src/runtime/src/coreclr/dlls/mscordbi/CMakeLists.txt
index 95e92034e238f..c577651141e5c 100644
--- a/src/runtime/src/coreclr/dlls/mscordbi/CMakeLists.txt
+++ b/src/runtime/src/coreclr/dlls/mscordbi/CMakeLists.txt
@@ -100,7 +100,21 @@ elseif(CLR_CMAKE_HOST_UNIX)
mscordaccore
)
- target_link_libraries(mscordbi ${COREDBI_LIBRARIES})
+ # Before llvm 16, lld was setting `--undefined-version` by default. The default was
+ # flipped to `--no-undefined-version` in lld 16, so we will explicitly set it to
+ # `--undefined-version` for our use-case.
+ include(CheckLinkerFlag OPTIONAL)
+ if(COMMAND check_linker_flag)
+ check_linker_flag(CXX -Wl,--undefined-version LINKER_SUPPORTS_UNDEFINED_VERSION)
+ if (LINKER_SUPPORTS_UNDEFINED_VERSION)
+ add_linker_flag(-Wl,--undefined-version)
+ endif(LINKER_SUPPORTS_UNDEFINED_VERSION)
+ endif(COMMAND check_linker_flag)
+
+ # COREDBI_LIBRARIES is mentioned twice because ld is one pass linker and will not find symbols
+ # if they are defined after they are used. Having all libs twice makes sure that ld will actually
+ # find all symbols.
+ target_link_libraries(mscordbi ${COREDBI_LIBRARIES} ${COREDBI_LIBRARIES})
add_dependencies(mscordbi mscordaccore)
diff --git a/src/runtime/src/coreclr/dlls/mscordbi/mscordbi.cpp b/src/runtime/src/coreclr/dlls/mscordbi/mscordbi.cpp
index 109fe6a5b5417..891c01e144f5c 100644
--- a/src/runtime/src/coreclr/dlls/mscordbi/mscordbi.cpp
+++ b/src/runtime/src/coreclr/dlls/mscordbi/mscordbi.cpp
@@ -32,18 +32,3 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
// Defer to the main debugging code.
return DbgDllMain(hInstance, dwReason, lpReserved);
}
-
-#if defined(HOST_LINUX) && defined(TARGET_LINUX)
-PALIMPORT HINSTANCE PALAPI DAC_PAL_RegisterModule(IN LPCSTR lpLibFileName);
-PALIMPORT VOID PALAPI DAC_PAL_UnregisterModule(IN HINSTANCE hInstance);
-
-HINSTANCE PALAPI PAL_RegisterModule(IN LPCSTR lpLibFileName)
-{
- return DAC_PAL_RegisterModule(lpLibFileName);
-}
-
-VOID PALAPI PAL_UnregisterModule(IN HINSTANCE hInstance)
-{
- DAC_PAL_UnregisterModule(hInstance);
-}
-#endif

View file

@ -0,0 +1,80 @@
From 828269b7e68039f8bc0bdac66e2fd5c58b6d3471 Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/runtime/pull/90251
From: Antoine Martin <dev@ayakael.net>
Date: Wed, 9 Aug 2023 11:36:39 -0400
Subject: [PATCH 1/1] Rename CMAKE var for mono on libc-musl
---
src/mono/CMakeLists.txt | 6 +++---
src/mono/mono/mini/CMakeLists.txt | 12 ++++++------
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/runtime/src/coreclr/pgosupport.cmake b/src/runtime/src/coreclr/pgosupport.cmake
index 719ac14ad99..34a42781ab2 100644
--- a/src/runtime/src/coreclr/pgosupport.cmake
+++ b/src/runtime/src/coreclr/pgosupport.cmake
@@ -25,13 +25,13 @@ function(add_pgo TargetName)
target_compile_options(${TargetName} PRIVATE -flto -fprofile-instr-generate)
set_property(TARGET ${TargetName} APPEND_STRING PROPERTY LINK_FLAGS " -flto -fprofile-instr-generate")
if(CMAKE_CROSSCOMPILING AND CMAKE_C_COMPILER_ID MATCHES "Clang")
- if (CLR_CMAKE_HOST_ALPINE_LINUX)
+ if (CLR_CMAKE_TARGET_LINUX_MUSL)
set_property(TARGET ${TargetName} APPEND_STRING PROPERTY LINK_FLAGS " -resource-dir ${CMAKE_SYSROOT}/usr/lib/clang/${CMAKE_C_COMPILER_VERSION}")
- else(CLR_CMAKE_HOST_ALPINE_LINUX)
+ else(CLR_CMAKE_TARGET_LINUX_MUSL)
string(REPLACE "." ";" CLANG_VERSION "${CMAKE_C_COMPILER_VERSION}")
list(POP_FRONT CLANG_VERSION CLANG_VERSION_MAJOR)
set_property(TARGET ${TargetName} APPEND_STRING PROPERTY LINK_FLAGS " -resource-dir ${CMAKE_SYSROOT}/usr/lib/llvm-${CLANG_VERSION_MAJOR}/lib/clang/${CMAKE_C_COMPILER_VERSION}")
- endif(CLR_CMAKE_HOST_ALPINE_LINUX)
+ endif(CLR_CMAKE_TARGET_LINUX_MUSL)
endif(CMAKE_CROSSCOMPILING AND CMAKE_C_COMPILER_ID MATCHES "Clang")
if(NOT LD_LLVM)
set_property(TARGET ${TargetName} APPEND_STRING PROPERTY LINK_FLAGS " -fuse-ld=gold")
diff --git a/src/runtime/src/mono/CMakeLists.txt b/src/runtime/src/mono/CMakeLists.txt
index e04d9e9d364..00e54a25d69 100644
--- a/src/runtime/src/mono/CMakeLists.txt
+++ b/src/runtime/src/mono/CMakeLists.txt
@@ -943,10 +943,10 @@ else()
set(DISABLE_DLLMAP 1)
endif()
-if(CLR_CMAKE_HOST_ALPINE_LINUX)
- # Setting RLIMIT_NOFILE breaks debugging of coreclr on Alpine Linux for some reason
+if(CLR_CMAKE_TARGET_LINUX_MUSL)
+ # Setting RLIMIT_NOFILE breaks debugging of coreclr on musl-libc for some reason
add_definitions(-DDONT_SET_RLIMIT_NOFILE)
- # On Alpine Linux, we need to ensure that the reported stack range for the primary thread is
+ # On musl-libc, we need to ensure that the reported stack range for the primary thread is
# larger than the initial committed stack size.
add_definitions(-DENSURE_PRIMARY_STACK_SIZE)
endif()
diff --git a/src/runtime/src/mono/mono/mini/CMakeLists.txt.orig b/src/runtime/src/mono/mono/mini/CMakeLists.txt
index 5d6ef3d..c3e5414 100644
--- a/src/runtime/src/mono/mono/mini/CMakeLists.txt.orig
+++ b/src/runtime/src/mono/mono/mini/CMakeLists.txt
@@ -400,9 +400,9 @@ if(NOT DISABLE_SHARED_LIBS)
endif()
target_compile_definitions(monosgen-shared PRIVATE -DMONO_DLL_EXPORT)
# Alpine Linux implements ucontext in a different library
- if(CLR_CMAKE_HOST_ALPINE_LINUX AND TARGET_S390X)
+ if(CLR_CMAKE_TARGET_LINUX_MUSL AND TARGET_S390X)
target_link_libraries(monosgen-shared PRIVATE ucontext)
- endif(CLR_CMAKE_HOST_ALPINE_LINUX AND TARGET_S390X)
+ endif(CLR_CMAKE_TARGET_LINUX_MUSL AND TARGET_S390X)
set_target_properties(monosgen-shared PROPERTIES OUTPUT_NAME ${MONO_SHARED_LIB_NAME})
if(MONO_SET_RPATH_ORIGIN)
set_target_properties(monosgen-shared PROPERTIES INSTALL_RPATH "$ORIGIN")
@@ -601,10 +601,10 @@ if(NOT DISABLE_EXECUTABLES)
target_link_libraries(mono-sgen PRIVATE icu_shim_objects)
endif()
target_link_libraries(mono-sgen PRIVATE ${OS_LIBS} ${LLVM_LIBS} ${ICU_LIBS} ${Z_LIBS})
- # Alpine Linux implements ucontext in a different library
- if(CLR_CMAKE_HOST_ALPINE_LINUX AND TARGET_S390X)
+ # musl-libc implements ucontext in a different library
+ if(CLR_CMAKE_TARGET_LINUX_MUSL AND TARGET_S390X)
target_link_libraries(mono-sgen PRIVATE ucontext)
- endif(CLR_CMAKE_HOST_ALPINE_LINUX AND TARGET_S390X)
+ endif(CLR_CMAKE_TARGET_LINUX_MUSL 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}")

View file

@ -0,0 +1,30 @@
From a73b8bacfcc5819926bc05173ab2f7850eb00da3 Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/runtime/pull/91008
From: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Date: Wed, 23 Aug 2023 21:11:37 +0200
Subject: [PATCH] [mono] Handle enum return type when inlining CreateInstance
Use underlying base type when deciding how to inline a
CreateInstance invocation in mini_emit_inst_for_method.
Fixes https://github.com/dotnet/runtime/issues/90292
(Mono abort causing .NET 8 msbuild regression).
---
src/mono/mono/mini/intrinsics.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/runtime/src/mono/mono/mini/intrinsics.c b/src/runtime/src/mono/mono/mini/intrinsics.c
index b1e5e76723147..ef77b7dc89f2e 100644
--- a/src/runtime/src/mono/mono/mini/intrinsics.c
+++ b/src/runtime/src/mono/mono/mini/intrinsics.c
@@ -2079,7 +2079,9 @@ mini_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSign
MonoType *t = method_context->method_inst->type_argv [0];
MonoClass *arg0 = mono_class_from_mono_type_internal (t);
if (m_class_is_valuetype (arg0) && !mono_class_has_default_constructor (arg0, FALSE)) {
- if (m_class_is_primitive (arg0)) {
+ if (m_class_is_primitive (arg0) || m_class_is_enumtype (arg0)) {
+ if (m_class_is_enumtype (arg0))
+ t = mono_class_enum_basetype_internal (arg0);
int dreg = alloc_dreg (cfg, mini_type_to_stack_type (cfg, t));
mini_emit_init_rvar (cfg, dreg, t);
ins = cfg->cbb->last_ins;

View file

@ -0,0 +1,13 @@
diff --git a/src/runtime/eng/native/configurecompiler.cmake b/src/runtime/eng/native/configurecompiler.cmake
index c9a54547c0a..931da2cae5b 100644
--- a/src/runtime/eng/native/configurecompiler.cmake
+++ b/src/runtime/eng/native/configurecompiler.cmake
@@ -488,6 +488,8 @@ if (CLR_CMAKE_HOST_UNIX)
# other clang 16.0 suppressions
add_compile_options(-Wno-single-bit-bitfield-constant-conversion)
add_compile_options(-Wno-cast-function-type-strict)
+ add_compile_options(-Wno-incompatible-function-pointer-types-strict)
+ add_compile_options(-Wno-ignored-attributes)
else()
add_compile_options(-Wno-uninitialized)
add_compile_options(-Wno-strict-aliasing)

View file

@ -1,15 +1,26 @@
diff --git a/src/runtime/src/coreclr/debug/createdump/crashinfounix.cpp b/src/runtime/src/coreclr/debug/createdump/crashinfounix.cpp
index 03712c3b684..99d8a457957 100644
--- a/src/runtimr/src/coreclr/debug/createdump/crashinfounix.cpp
diff --git a/src/runtime/src/coreclr/debug/createdump/crashinfounix.cpp.orig b/src/runtime/src/coreclr/debug/createdump/crashinfounix.cpp
index 20b2494..165b190 100644
--- a/src/runtime/src/coreclr/debug/createdump/crashinfounix.cpp.orig
+++ b/src/runtime/src/coreclr/debug/createdump/crashinfounix.cpp
@@ -395,7 +395,7 @@ CrashInfo::ReadProcessMemory(void* address, void* buffer, size_t size, size_t* r
@@ -469,7 +469,7 @@ CrashInfo::ReadProcessMemory(void* address, void* buffer, size_t size, size_t* r
// performance optimization.
m_canUseProcVmReadSyscall = false;
assert(m_fd != -1);
- *read = pread64(m_fd, buffer, size, (off64_t)address);
+ *read = pread(m_fd, buffer, size, (off_t)address);
assert(m_fdMem != -1);
- *read = pread64(m_fdMem, buffer, size, (off64_t)address);
+ *read = pread(m_fdMem, buffer, size, (off_t)address);
}
if (*read == (size_t)-1)
diff --git a/src/runtime/src/coreclr/debug/createdump/crashinfo.cpp.orig b/src/runtime/src/coreclr/debug/createdump/crashinfo.cpp
index 5addb79..79655d1 100644
--- a/src/runtime/src/coreclr/debug/createdump/crashinfo.cpp.orig
+++ b/src/runtime/src/coreclr/debug/createdump/crashinfo.cpp
@@ -760,7 +760,7 @@ CrashInfo::PageMappedToPhysicalMemory(uint64_t start)
}
uint64_t pagemapOffset = (start / PAGE_SIZE) * sizeof(uint64_t);
- uint64_t seekResult = lseek64(m_fdPagemap, (off64_t) pagemapOffset, SEEK_SET);
+ uint64_t seekResult = lseek(m_fdPagemap, (off_t) pagemapOffset, SEEK_SET);
if (seekResult != pagemapOffset)
{
int seekErrno = errno;