user/dotnet8-stage0: upgrade to 8.0.0_pre7

This commit is contained in:
Antoine Martin 2023-08-10 16:10:53 -04:00
parent 5fa5e73919
commit 441d79f325
4 changed files with 184 additions and 191 deletions

View file

@ -2,37 +2,33 @@
# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=dotnet8-stage0
pkgver=8.0.100_pre4
pkgver=8.0.100_pre7
pkgrel=0
[ "$CBUILD" != "$CHOST" ] && _cross="-$CARCH" || _cross=""
# Tag of tarball generator.
_gittag=v8.0.0-preview.4.23259.5
_gittag=v8.0.0-preview.7.23375.6
# Versions of prebuilt artifacts and bootstrap tar
_artifactsver=8.0.100-preview.3.23178.7.centos.8-x64
_prebuiltsver=0.1.0-8.0.100-25.centos.8-x64
_bootstrapver="8.0.100-preview.4.23260.5"
_bootstraprel=0
_installerver=$_bootstrapver
_artifactsver="8.0.100-preview.7.23376.1.centos.8-x64"
_bootstrapver="8.0.100-preview.7.23376.3"
_bootstraprel=2
_installerver=${_gittag/v}
# 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="
installer_set-crossgen2rid-using-buildarchitecture.patch
runtime_76500-properly-set-toolchain-for-alpine.patch
runtime_79856-save-errno-when-using-posix-semaphores.patch
runtime_82269-mono-thread-coop-undefine-fortify-source.patch
runtime_83682-specify-notext-on-linux-musl-x86.patch
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/microsoft.netcore.app.host.linux-musl-x64.7.0.2.nupkg
https://globalcdn.nuget.org/packages/microsoft.netcore.app.host.linux-musl-arm64.7.0.2.nupkg
https://globalcdn.nuget.org/packages/microsoft.netcore.app.host.linux-musl-arm.7.0.2.nupkg
"
_pkgver_macro=${pkgver%.*}
@ -42,7 +38,7 @@ pkgdesc="The .NET Core stage0 bits for dotnet build"
# x86: blocked by https://github.com/dotnet/runtime/issues/83509
# armhf: blocked by https://github.com/dotnet/runtime/issues/77663
# riscv64: port WIP https://github.com/dotnet/runtime/issues/36748
arch="all !x86 !armhf !riscv64 !armv7"
arch="all !x86 !armhf !armv7"
_giturl=https://github.com/dotnet/dotnet
url=https://dotnet.microsoft.com
license="MIT"
@ -57,8 +53,10 @@ source="
dotnet-sdk-$_bootstrapver-linux-musl-x64.noextract::https://dotnetbuilds.azureedge.net/public/Sdk/$_bootstrapver/dotnet-sdk-$_bootstrapver-linux-musl-x64.tar.gz
dotnet-sdk-$_bootstrapver-linux-musl-arm64.noextract::https://dotnetbuilds.azureedge.net/public/Sdk/$_bootstrapver/dotnet-sdk-$_bootstrapver-linux-musl-arm64.tar.gz
dotnet-sdk-$_bootstrapver-linux-musl-arm.noextract::https://dotnetbuilds.azureedge.net/public/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
dotnet-sdk-$_bootstrapver-r$_bootstraprel-linux-musl-riscv64.noextract::https://lab.ilot.io/ayakael/dotnet-stage0/-/releases/$_bootstrapver-r$_bootstraprel/downloads/sdk/dotnet-sdk-$_bootstrapver-r$_bootstraprel-linux-musl-riscv64.tar.xz
Private.SourceBuilt.Artifacts.$_artifactsver.noextract::https://dotnetcli.azureedge.net/source-built-artifacts/assets/Private.SourceBuilt.Artifacts.$_artifactsver.tar.gz
Private.SourceBuilt.Prebuilts.$_prebuiltsver.noextract::https://dotnetcli.azureedge.net/source-built-artifacts/assets/Private.SourceBuilt.Prebuilts.$_prebuiltsver.tar.gz
$_extra_nupkgs
$_patches
"
@ -140,30 +138,6 @@ else
_logdir="$srcdir"/logs
fi
# generates tarball containing all components built by dotnet
snapshot() {
if [ -d "$srcdir" ]; then
cd "$srcdir"
else
mkdir -p "$srcdir" && cd "$srcdir"
fi
if [ -d "dotnet" ]; then
cd "$srcdir"/dotnet
else
git clone $_giturl && cd "$srcdir"/dotnet
fi
git checkout $_gittag
sed 's|^filename.*|filename=dotnet-$(git -C "$GIT_ROOT" describe --tags --always)|' -i eng/pack-sources.sh
eng/pack-sources.sh -o artifacts/packages/dotnet-$_gittag.tar.gz
msg "Compressing dotnet-$_gittag.tar.gz to $SRCDEST"
gzip -cd artifacts/packages/dotnet-*.tar.gz | xz -T0 -9 -vv -e -c > dotnet-$_gittag.tar.xz
cd "$startdir"
abuild checksum
}
prepare() {
default_prepare
@ -186,7 +160,7 @@ prepare() {
ln -s "$_logdir"/${i##*\/} "$builddir"/src/${i##*\/}/artifacts/log
done
tar -xf "$srcdir"/dotnet-sdk-$_pkgver_macro*$_dotnet_arch*noextract -C "$_cli_root" --no-same-owner
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/::*}
@ -203,10 +177,32 @@ prepare() {
# 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"/prereqs/git-info/runtime.props | sed -E 's|</?OutputPackageVersion>||g' | tr -d ' ')
fi
@ -221,11 +217,11 @@ _runtime() {
-clang
-arch $_dotnet_target
/consoleLoggerParameters:ShowTimestamp
/p:_toolsRID=linux-musl-$_dotnet_arch
/p:OutputRid=linux-musl-$_dotnet_target
/p:NoPgoOptimize=true
/p:EnableNgenOptimization=false
/p:ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch=none
/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
@ -249,34 +245,8 @@ _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"/prereqs/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:NoWarn=NU1605
/p:GitCommitHash=$(grep GitCommitHash "$builddir"/prereqs/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"/prereqs/git-info/sdk.props | sed -E 's|</?OutputPackageVersion>||g' | tr -d ' ')
fi
@ -291,6 +261,7 @@ _sdk() {
/consoleLoggerParameters:ShowTimestamp
/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##*-}"
@ -305,7 +276,7 @@ _sdk() {
}
_aspnetcore() {
"$_cli_root"/dotnet build-server shutdown
_init
if [ -z "${_aspnetver+x}" ]; then
local _aspnetver=$(grep OutputPackageVersion "$builddir"/prereqs/git-info/aspnetcore.props | sed -E 's|</?OutputPackageVersion>||g' | tr -d ' ')
fi
@ -332,7 +303,7 @@ _aspnetcore() {
# aspnetcore can't find newly created Microsoft.NETCore.App.Runtime.linux-musl-x86 for some reason
case $_dotnet_target in
x86) local args="$args /p:CrossgenOutput=false";;
riscv64|x86) local args="$args /p:CrossgenOutput=false";;
esac
./eng/build.sh --pack $args
@ -347,7 +318,7 @@ _aspnetcore() {
}
_installer() {
"$_cli_root"/dotnet build-server shutdown
_init
msg "[$(date)] Building installer version $_installerver"
cd "$builddir"/src/installer
@ -355,6 +326,7 @@ _installer() {
-c Release
-bl
/consoleLoggerParameters:ShowTimestamp
/p:EnableSourceLink=false
/p:OSName=linux-musl
/p:HostOSName=linux-musl
/p:Architecture=$_dotnet_target
@ -369,7 +341,7 @@ _installer() {
fi
# 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
@ -379,24 +351,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
_runtime
_sdk
_aspnetcore
_installer
@ -500,28 +455,23 @@ artifacts() {
-xf "$srcdir"/Private.SourceBuilt.Artifacts.*.noextract \
-C "$subpkgdir"/$_libdir/dotnet/artifacts/$pkgver/ \
--no-same-owner
tar --use-compress-program="pigz" \
-xf "$srcdir"/Private.SourceBuilt.Prebuilts.*.noextract \
-C "$subpkgdir"/$_libdir/dotnet/artifacts/$pkgver/ \
--no-same-owner
}
sha512sums="
54aa23b5ea2c9ef5565f57bfbc2882ee904c4d4a4af551b63d47b7a5f648325ceaa28f6673f0f9dc4e21508a0ec79446e6edcb7c4768094e11df363df0075ea3 dotnet-tarball-v8.0.0-preview.4.23259.5.tar.gz
360978837353828032e562b72f07d3fd4d08a772c9c1a0e20f2a41cd0dfa390a7d3972384bf22fb67e1dfa49fbdb216c2fc09827430cc7c95ad9ddf85eaa9ed0 dotnet-release-v8.0.0-preview.4.23259.5.json
bac2e657b22a79c0182f9b5b627b1da73495a0f80013d54b5f8fe34882411ecf72a13bda3397a2917d505dd9f1035aa6e441d5a0aa83205e7a47916c37f34fc3 dotnet-sdk-8.0.100-preview.4.23260.5-linux-musl-x64.noextract
89f83b097fcaaeffb246c71a08252a2e13bfff8a09f336fb8f994a6b7e3dcae3e69b8b516a2bc4b6e8a73a25d0dab4f283c1bab1cfdf070f5adda3186907d407 dotnet-sdk-8.0.100-preview.4.23260.5-linux-musl-arm64.noextract
78baacf48697910adff90fe1d9227926daaeb71365dbb6170f0a5d716ad474b3cf56bad08d8c78f5ffb8538e54171855eafc0a92cb2c8b9b7d30ee25c012866f dotnet-sdk-8.0.100-preview.4.23260.5-linux-musl-arm.noextract
48ea4da46b6dd1608468f6d29da9ff7ab9ec01e84880ed2c76e323997d2bf24faa1eb0e83aea97a4a2ae447d7910a23192c4a650686fe7aa88c86d6717d227ee Private.SourceBuilt.Artifacts.8.0.100-preview.3.23178.7.centos.8-x64.noextract
2685f18de3b88dbd89059cef8de25c4e00f740ac92ea8a276d2cfda45c1b74e5efd90a5b5a4aad44a78cf6e30f76da01d4205a04da3e6601a6b184861e1bb102 Private.SourceBuilt.Prebuilts.0.1.0-8.0.100-25.centos.8-x64.noextract
06cb81a5667153a7d6ae190d169dcafea88954d1d42f9f1ae0fffe7cb4787599d7cad5428f66a6ce10af24898bd4ffbe1b9e95f1d3b698641437298055ebd10f dotnet-tarball-v8.0.0-preview.7.23375.6.tar.gz
5598ae0b9044dd2d2b5eba10ce420cd14266bd25412b37e9766bbaf1b1ce79438a5c7db559431aa59c0b49f14187ca3f78a57065b7802df304910b00b6694bfa dotnet-release-v8.0.0-preview.7.23375.6.json
6b7bf38224573496eae08e3000792296de81e16a1bd5a253236427137de4a6a9d7950c99f08ad764e337aa33140db5160218f9ecea0bfbd60c6e6f301e6dd042 dotnet-sdk-8.0.100-preview.7.23376.3-linux-musl-x64.noextract
8e5bfb89b287f6ab478e6bd9f4ce1ec482ba4d00b2241f6b4d6081c5885ac0399233bfaf983994b485ea6541a4a2ab9b362cbd582012edb09a6785a7cd7fb292 dotnet-sdk-8.0.100-preview.7.23376.3-linux-musl-arm64.noextract
14a3c0aaedc787f9a05258138fb70effedb627cb46206bfdbb912936472b78cc3e24878b10b03e95339d3b7382b46a13a87783cb6a77a49243b75b31ecd94cb7 dotnet-sdk-8.0.100-preview.7.23376.3-linux-musl-arm.noextract
08b520d3e671e4e1d90ddf8e965dd50124f8216d03005bdc08497f0264f7a2767a99c67e6cf45464b8a9f206028cfe513433c5a585d188617523feae5eedf10e dotnet-sdk-8.0.100-preview.7.23376.3-r2-linux-musl-s390x.noextract
ad46d02742c4c605e30bfbee18eba0e491984e6986bd93fb78c9d9c95d2cdf5bfe17584b90582f783b1cb1b6b32bb7ef317ff63396fbcff9399800ecd5d09a94 dotnet-sdk-8.0.100-preview.7.23376.3-r2-linux-musl-ppc64le.noextract
cd2c4e1f3697f3679d37f76f7692389ce29d0fca92e0130a9f1241674150e78542ec1898568cf0b30d8599b954edcf5211823bf05f46b907aa58b79c677a0575 dotnet-sdk-8.0.100-preview.7.23376.3-r2-linux-musl-riscv64.noextract
554d02d10072b8ec9122a0877e86753ebf9875f69508fd18bae43fc9d6eed8655e7923af771d593f3c59ad49c0858cf88816934618d9e0b65bb614ebcdb360a2 Private.SourceBuilt.Artifacts.8.0.100-preview.7.23376.1.centos.8-x64.noextract
5c1fd9e250e7f08d996b7b335134973624a8d1afc331f7fda3a81eee7d2170e39905be20b8786e99078892b21d1582092aeee45d49c5feae3b2bd5374c306fec microsoft.netcore.app.host.linux-musl-x64.7.0.2.nupkg
c5bb986179b4789a24cc4552fa33bee2015acba1c9775ff8fe2295797dd7114f244df2c133e8cee8a3de392c5c47530ba9ef87939cc55660f8c937146b98e1fb microsoft.netcore.app.host.linux-musl-arm64.7.0.2.nupkg
2f35742d74255dd6e7a39e48f29e01cead2b410dabd9e4192d724186a8bd2e04f970b5015229045c732e6c7bcd89a8e9787d19fc50f09fcaab8cd94516f5a0ce microsoft.netcore.app.host.linux-musl-arm.7.0.2.nupkg
b6a2dfeccac329546f87f1019c1f2cf07e2f294dd33914449ad08d92269c8713b6fa1e330ef257c24e189023fd0b824df97688b0ba6e578a6d0292b07a72b4c1 installer_set-crossgen2rid-using-buildarchitecture.patch
ba9c66b5bb8b8d2de87922717b8a7a6f880eed2a38b5208a554ebd64841c6053658692463471a26442c85cb9adb94043a9d91190786d46c0f45ff4e7cc9c707e runtime_76500-properly-set-toolchain-for-alpine.patch
77fa6d9987a7c43725582c9c493e9d4d5965a611a1d795dad4e3d46cd730caced095f994d93f91a131df7fa4b6a7277bcd3d915bae2dcd869559f22076fbc575 runtime_79856-save-errno-when-using-posix-semaphores.patch
d732df247c721c9f677baabdd7f36dbf4b564814ff64164361065bb1c196b767494a1d39f634eadf01a23032c7b3e64102614b7213065c81096bbf3f8022e6a0 runtime_82269-mono-thread-coop-undefine-fortify-source.patch
c983a1ab7f06ac86691e0fa7a61fcad69a074d984ef4a4116bee43f20be918215963c7ec8ddd7edd70432b29b160ff78288183acc89fda15ce4a75bfdbf99ee3 runtime_83682-specify-notext-on-linux-musl-x86.patch
c1e8a51bca47f13e60cb28fa3c58c4bdc0fd8fa19177855b6cc9a767016fc239064aced57530e227c772e302671fc91e86c718a39aecb05eb7f601c8d931de81 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,86 +0,0 @@
From bf9063bfad5856a2541fbab692197bafc5a4412a Mon Sep 17 00:00:00 2001
From: Antoine Martin <dev@ayakael.net>
Date: Tue, 21 Feb 2023 15:55:33 -0500
Subject: [PATCH 12/15] runtime_76500-properly-set-toolchain-for-alpine
---
src/runtime/eng/common/cross/toolchain.cmake | 38 ++++++++++++++++----
1 file changed, 31 insertions(+), 7 deletions(-)
diff --git a/src/runtime/eng/common/cross/toolchain.cmake b/src/runtime/eng/common/cross/toolchain.cmake
index ccfb9951a..2bb1e0845 100644
--- a/src/runtime/eng/common/cross/toolchain.cmake
+++ b/src/runtime/eng/common/cross/toolchain.cmake
@@ -67,13 +67,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)
@@ -90,7 +102,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()
@@ -264,8 +280,12 @@ elseif(TARGET_ARCH_NAME MATCHES "^(arm64|x64)$")
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")
@@ -302,7 +322,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.38.2

View file

@ -0,0 +1,87 @@
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 b/src/runtime/src/mono/mono/mini/CMakeLists.txt
index d23b7985802..b5f63fc638c 100644
--- a/src/runtime/src/mono/mono/mini/CMakeLists.txt
+++ b/src/runtime/src/mono/mono/mini/CMakeLists.txt
@@ -378,10 +378,10 @@ if(NOT DISABLE_SHARED_LIBS)
add_library(monosgen-shared SHARED $<TARGET_OBJECTS:monosgen-objects>)
target_compile_definitions(monosgen-objects PRIVATE -DMONO_DLL_EXPORT)
endif()
- # 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(monosgen-shared PRIVATE ucontext)
- endif(CLR_CMAKE_HOST_ALPINE_LINUX AND TARGET_S390X)
+ endif(CLR_CMAKE_TARGET_LINUX_MUSL 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")
@@ -560,10 +560,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}")
diff --git a/src/runtime/src/coreclr/pgosupport.cmake.orig b/src/runtime/src/coreclr/pgosupport.cmake
index 719ac14..34a4278 100644
--- a/src/runtime/src/coreclr/pgosupport.cmake.orig
+++ b/src/runtime/src/coreclr/pgosupport.cmake

View file

@ -0,0 +1,42 @@
diff --git a/src/runtime/src/mono/CMakeLists.txt b/src/runtime/src/mono/CMakeLists.txt
index fad619577bf..91a4a545c42 100644
--- a/src/runtime/src/mono/CMakeLists.txt
+++ b/src/runtime/src/mono/CMakeLists.txt
@@ -943,7 +943,7 @@ else()
set(DISABLE_DLLMAP 1)
endif()
-if(CLR_CMAKE_HOST_ALPINE_LINUX)
+if(CLR_CMAKE_TARGET_LINUX_MUSL)
# Setting RLIMIT_NOFILE breaks debugging of coreclr on Alpine Linux 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
diff --git a/src/runtime/src/mono/mono/mini/CMakeLists.txt b/src/runtime/src/mono/mono/mini/CMakeLists.txt
index d23b7985802..da7563ac4d3 100644
--- a/src/runtime/src/mono/mono/mini/CMakeLists.txt
+++ b/src/runtime/src/mono/mono/mini/CMakeLists.txt
@@ -379,9 +379,9 @@ if(NOT DISABLE_SHARED_LIBS)
target_compile_definitions(monosgen-objects PRIVATE -DMONO_DLL_EXPORT)
endif()
# 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")
@@ -561,9 +561,9 @@ if(NOT DISABLE_EXECUTABLES)
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)
+ 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}")