user/dotne8-stage0: new aport

This commit is contained in:
Antoine Martin 2023-02-21 21:14:39 -05:00
parent 1ab405f3e9
commit 062098717b
Signed by: forge
GPG key ID: D62A472A4AA7D541
13 changed files with 1109 additions and 0 deletions

View file

@ -0,0 +1,527 @@
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=dotnet8-stage0
pkgver=8.0.100_pre1
pkgrel=0
[ "$CBUILD" != "$CHOST" ] && _cross="-$CARCH" || _cross=""
# Tag of tarball generator.
_gittag=v8.0.100-preview.1
# Versions of prebuilt artifacts and bootstrap tar
_artifactsver=0.1.0-8.0.100-5.centos.8-x64
_prebuiltsver=0.1.0-8.0.100-4.centos.8-x64
_bootstrapver="8.0.100-preview.1.23115.2"
_installerver=$_bootstrapver
# Version of packages that aren't defined in git-info or badly defined
_iltoolsver=8.0.0-alpha.1.23076.9
# 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="
aspnetcore_use-linux-musl-crossgen-on-non-x64.patch
build_set-local-repo.patch
installer_runtimepacks.patch
roslyn_allow-extra-params.patch
runtime_76500-properly-set-toolchain-for-alpine.patch
runtime_make-lld-use-depend-on-existing-on-target.patch
runtime_mono-thread-coop-undefine-fortify-source.patch
runtime_no-additional-runtime-id.patch
sdk_dotnet-watch-nowarn-ad0001.patch
sdk_dummyshim-fix.patch
sdk_fix-sdk-download.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%.*}
_pkgver_prior=1
_pkgver_name="${_pkgver_macro//[.0]}"
pkgdesc="The .NET Core stage0 bits for dotnet build"
# 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 bootstrap crossbuilt yet
arch="all !x86 !armhf !riscv64 !s390x !ppc64le"
url=https://dotnet.microsoft.com
license="MIT"
options="!check" # Testsuite in main -build aport
subpackages="
dotnet$_pkgver_name-stage0-artifacts:artifacts:noarch
dotnet$_pkgver_name-stage0-bootstrap
"
source="
https://lab.ilot.io/dotnet/dotnet/-/releases/$_gittag/downloads/tarball/dotnet-$_gittag.tar.xz
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
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
"
makedepends_host="
alpine-release
autoconf
automake
bash
binutils
clang
cmake
findutils
g++
gcc
grep
icu-dev
krb5-dev
libintl
libstdc++
libucontext-dev
libunwind-dev
libxml2-dev
libxml2-utils
linux-headers
lttng-ust-dev
musl-dev
musl-utils
openssl-dev
pigz
unzip
zip
zlib-dev
"
case $CARCH in
s390x|x86) ;;
*) makedepends_host="$makedepends_host lld-dev";;
esac
makedepends_build="
$makedepends_host
binutils$_cross
git
gcc$_cross
jq
llvm
llvm-dev
python3
sed
xz
"
case $CBUILD_ARCH in
x86_64) _dotnet_arch="x64";;
aarch64) _dotnet_arch="arm64";;
armv7|armhf) _dotnet_arch="arm";;
i586) _dotnet_arch="x86";;
*) _dotnet_arch=$CBUILD_ARCH;;
esac
case $CTARGET_ARCH in
x86_64) _dotnet_target="x64";;
aarch64) _dotnet_target="arm64";;
armv7|armhf) _dotnet_target="arm";;
i586) _dotnet_target="x86";;
*) _dotnet_target=$CTARGET_ARCH;;
esac
builddir="$srcdir"/dotnet-${_gittag/release\/}
_packagesdir="$srcdir"/local-packages
_libdir="/usr/lib"
_nugetdir="$srcdir"/nuget
_downloaddir="$srcdir"/local-downloads
_cli_root="$srcdir"/bootstrap
_nuget="$_cli_root/dotnet nuget"
_outputdir="$srcdir"/artifacts
# if true, then within pipeline environment, in which case send logs there
# to be scooped
if [ -d "$APORTSDIR/logs" ]; then
_logdir="$APORTSDIR"/logs/$pkgname
else
_logdir="$srcdir"/logs
fi
# 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 https://github.com/dotnet/installer && cd "$srcdir"/installer
fi
git checkout $_gittag
sed 's|/src/installer||' "$startdir"/installer_2780-reprodicible-tarball.patch | patch -Np1 || true
sed 's|/src/installer||' "$startdir"/installer_fix-version.patch | patch -Np1 || true
if [ ! -d "$_cli_root" ]; then
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
# adjusts sdk version and packagedir to expected
for i in runtime sdk installer aspnetcore roslyn; do
sed "s|@@PACKAGESDIR@@|$_packagesdir|" -i "$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
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
ln -s "$_logdir" "$builddir"/artifacts/log
for i in "$builddir"/src/*; do
if [ -f "$i" ]; then
continue
fi
mkdir -p "$_logdir"/${i##*\/} "$builddir"/src/${i##*\/}/artifacts
ln -s "$_logdir"/${i##*\/} "$builddir"/src/${i##*\/}/artifacts/log
done
tar --use-compress-program="pigz" -xf "$srcdir"/dotnet-sdk-$_pkgver_macro*$_dotnet_arch.noextract -C "$_cli_root" --no-same-owner
for i in $_extra_nupkgs; do
$_nuget push "$srcdir"/${i##*/} --source="$_packagesdir"
done
}
_runtime() {
"$_cli_root"/dotnet build-server shutdown
if [ -z "${_runtimever+x}" ]; then
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}')
msg "[$(date)] Building runtime version $_runtimever"
cd "$builddir"/src/runtime
local args="
-c Release
-bl
-clang
-arch $_dotnet_target
/consoleLoggerParameters:ShowTimestamp
/p:NoPgoOptimize=true
/p:EnableNgenOptimization=false
/p:ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch=none
/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"
fi
if [ "$_runtimever" != "${_runtimever##*-}" ]; then
local args="$args /p:VersionSuffix=${_runtimever##*-}"
fi
ROOTFS_DIR="$CBUILDROOT" ./build.sh $args
for i in artifacts/packages/*/*/*.nupkg; do
$_nuget push $i --source="$_packagesdir"
done
mkdir -p "$_downloaddir"/Runtime/$_runtimever_ns
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
/consoleLoggerParameters:ShowTimestamp
/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
if [ -z "${_sdkver+x}" ]; then
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}')
msg "[$(date)] Building sdk version $_sdkver"
cd "$builddir"/src/sdk
local args="
-c Release
-bl
/consoleLoggerParameters:ShowTimestamp
/p:GitCommitHash=$(grep GitCommitHash "$builddir"/prereqs/git-info/sdk.props | sed -E 's|</?GitCommitHash>||g' | tr -d ' ')
/p:Architecture=$_dotnet_target
"
if [ "$_sdkver" != "${_sdkver##*-}" ]; then
local args="$args /p:VersionSuffix=${_sdkver##*-}"
fi
# ArgumentsReflector doesn't build correctly when built from source
DotNetBuildFromSource=false dotnet build src/Tests/ArgumentsReflector/ArgumentsReflector.csproj $args
./build.sh --pack $args
for i in artifacts/packages/*/*/*.nupkg; do
$_nuget push $i --source="$_packagesdir"
done
mkdir -p "$_downloaddir"/Sdk/$_sdkver_ns
cp artifacts/packages/*/*/dotnet-toolset-internal-*.zip "$_downloaddir"/Sdk/$_sdkver_ns
}
_aspnetcore() {
"$_cli_root"/dotnet build-server shutdown
if [ -z "${_aspnetver+x}" ]; then
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}')
msg "[$(date)] Build aspnetcore version $_aspnetver"
cd "$builddir"/src/aspnetcore
local args="
-c Release
-bl
--os-name linux-musl
-arch $_dotnet_target
-no-build-nodejs
/consoleLoggerParameters:ShowTimestamp
/p:BuildNodeJs=false
/p:GitCommitHash=$(grep GitCommitHash "$builddir"/prereqs/git-info/aspnetcore.props | sed -E 's|</?GitCommitHash>||g' | tr -d ' ')
/p:DotNetAssetRootUrl=file://$_downloaddir/
/p:EnablePackageValidation=false
"
if [ "$_dotnet_target" = "x86" ] || [ "$_dotnet_target" = "ppc64le" ]; then
local args="$args /p:CrossgenOutput=false"
fi
if [ "$_aspnetver" != "${_aspnetver##*-}" ]; then
local args="$args /p:VersionSuffix=${_aspnetver##*-}"
fi
./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-*-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
msg "[$(date)] Building installer version $_installerver"
cd "$builddir"/src/installer
local args="
-c Release
-bl
/consoleLoggerParameters:ShowTimestamp
/p:OSName=linux-musl
/p:HostOSName=linux-musl
/p:Architecture=$_dotnet_target
/p:CoreSetupBlobRootUrl=file://$_downloaddir/
/p:DotnetToolsetBlobRootUrl=file://$_downloaddir/
/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
if [ "$_dotnet_target" = "x86" ]; then
local args="$args /p:DISABLE_CROSSGEN=True"
fi
./build.sh $args
mkdir -p "$_downloaddir"/installer/$_installerver
cp artifacts/packages/*/*/dotnet-sdk-$_pkgver_macro*.tar.gz "$_downloaddir"/installer/$_installerver
}
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
}
package() {
# lua-aports / buildrepo doesn't know to always build stage0 first when dealing
# with virtual packages. Thus, we need to depend on an empty stage0 pkg that
# dotnetx-build will pull, thus forcing build of stage0 first
mkdir -p "$pkgdir"
}
bootstrap() {
# allows stage0 to be pulled by dotnetx-build if first build of dotnetx
provides="dotnet$_pkgver_name-bootstrap"
provider_priority=$_pkgver_prior
install -dm 755 \
"$subpkgdir"/$_libdir/dotnet/bootstrap/$pkgver/docs \
"$subpkgdir"/$_libdir/dotnet/bootstrap/$pkgver/comp \
"$subpkgdir"/$_libdir/dotnet/artifacts/$pkgver
# unpack build artifacts to bootstrap subdir for use by future builds
tar --use-compress-program="pigz" \
-xf "$_downloaddir"/installer/$_installerver/dotnet-sdk-$_pkgver_macro*.tar.gz \
-C "$subpkgdir"/$_libdir/dotnet/bootstrap/$pkgver/ \
--no-same-owner
local _iltoolsArray="
runtime.*.Microsoft.NETCore.TestHost.*.nupkg
runtime.*.Microsoft.NETCore.ILAsm.*.nupkg
runtime.*.Microsoft.NETCore.ILDAsm.*.nupkg
"
local _nupkgsArray="
$_iltoolsArray
Microsoft.NETCore.App.Host.*.*.nupkg
Microsoft.NETCore.App.Runtime.*.*.nupkg
Microsoft.NETCore.App.Crossgen2.*.*.nupkg
runtime.*.Microsoft.NETCore.DotNetHost.*.nupkg
runtime.*.Microsoft.NETCore.DotNetHostPolicy.*.nupkg
runtime.*.Microsoft.NETCore.DotNetHostResolver.*.nupkg
runtime.*.Microsoft.NETCore.DotNetAppHost.*.nupkg
Microsoft.AspNetCore.App.Runtime.linux-musl-*.*.nupkg
"
# 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 install -Dm644 "$srcdir"/${i##*/} "$subpkgdir"/$_libdir/dotnet/artifacts/$pkgver/; done
msg "Changing iltools version to $_iltoolsver"
# source-build expects a certain version of ilasm, ildasm and testhost
# following adjusts version
for i in $_iltoolsArray; do
local nupath="$subpkgdir"$_libdir/dotnet/artifacts/$pkgver/$i
local nupath=$(find $nupath || true)
local nupkg="${nupath##*/}"
local nuname="${nupkg/.nupkg}"
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
# shellcheck disable=SC2094
unzip -p "$nupath" $nuspec | sed "s|$nuver|$_iltoolsver|" > "$srcdir"/$nuspec
cd "$srcdir"
zip -u "$nupath" $nuspec
mv "$nupath" "${nupath/$nuver/$_iltoolsver}"
done
}
# build relies on a plethora of nupkgs which are provided by this Artifacts file.
# stage0 sources these from Microsoft, which then allows bootstrap to build
# locally hosted versions. The following unpacks built tarball into directory
# for use by future builds.
artifacts() {
pkgdesc="Internal package for building .NET $_pkgver_macro Software Development Kit"
# hack to allow artifacts to pull itself
provides="dotnet$_pkgver_name-bootstrap-artifacts"
provider_priority=$_pkgver_prior
# directory creation
install -dm 755 \
"$subpkgdir"/$_libdir/dotnet/artifacts/$pkgver \
"$subpkgdir"/usr/share/licenses
# extract artifacts to artifacts dir for use by future dotnet builds
tar --use-compress-program="pigz" \
-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="
f48d4168f526aade888bbd17f2da87f721dabc8ae004707ef9195b6359b79b871115a686678c87542ba74e1d86e5485df13d77ef4d3f4001c0804426aebaf92c dotnet-v8.0.100-preview.1.tar.xz
120048fce7c455cb2f98cbdda6b7f789f210d9e7e0b48304f8fdc8b4838c705c6af18b2b4c375b57aa48e0e5084e60ecefad0edc09c19aca166855b3dd3fb539 dotnet-sdk-8.0.100-preview.1.23115.2-linux.musl.x64.noextract
bf985c3b9c1f6f09f46f88527c54445c502e7c75dcbc004dccfb5339d0b5766290ff183abe3808919137ebc5a50c91cbd58a56ec31ad50a5e39a26671e990c61 dotnet-sdk-8.0.100-preview.1.23115.2-linux.musl.arm64.noextract
461094d1f53067c2b496ec25b1bf7686aee3a75f0de5a139bb29a3ac989cdb824367165c8385b78185414430f0579bbba8c94be6d511d793a16746dc018f232f dotnet-sdk-8.0.100-preview.1.23115.2-linux.musl.arm.noextract
bb40f2fcd6f51e908e68fce740400345f2b3ee9c66c1cc69116b4188a19bb0f510e96c8ddcf99e03ee35d16f95ac0b918f940317cb7a5dd858682c4483d3c93b Private.SourceBuilt.Artifacts.0.1.0-8.0.100-5.centos.8-x64.noextract
f20d22a4d069c3647433def852dba50e803a494f4a9f455c24baff8e259896ec709ebcd2a80a1716a9b582ad0d36cd4be98ee4918b0349cca46cea0643a1a9d8 Private.SourceBuilt.Prebuilts.0.1.0-8.0.100-4.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
9c2f5410c2983ae1d073a5efb78afa56b212165a18252400a42696e10d8cb6016fde5941d1f453eb5332a77f5e209bcb5d40b8ee142609232be95b0cdca1e060 aspnetcore_use-linux-musl-crossgen-on-non-x64.patch
ead38430e54530819ecdb7ab5b087707eee97c4e77b5011a42758352e8265417c65f07b4eec2488708d932de240877695b474e07b8984d34086ef539d5022830 build_set-local-repo.patch
9fe4494b291128469874147e5f28f8fbd023b014114f0aa151fa5cf57821318fa88b834a131eeb77478c8c87adca8c1c0ff3e8c59264c7394fd0621a520eb014 installer_runtimepacks.patch
d1811c1364d9ce4d180d61adf8a9074cf71cf854776959a6db98740f17ed75beec8536602cfb335f534a703d3917e43c3cd91f0f6aed68b5d40c1c80396f5908 roslyn_allow-extra-params.patch
ba9c66b5bb8b8d2de87922717b8a7a6f880eed2a38b5208a554ebd64841c6053658692463471a26442c85cb9adb94043a9d91190786d46c0f45ff4e7cc9c707e runtime_76500-properly-set-toolchain-for-alpine.patch
946f7ddc979bced4e2991f0fe768476b537c97d864362d105fcaec9e6f9f312a798e5e19312966f29fdd80593aa88870be5747b74172d9a70bb1b173c3c75a43 runtime_make-lld-use-depend-on-existing-on-target.patch
d732df247c721c9f677baabdd7f36dbf4b564814ff64164361065bb1c196b767494a1d39f634eadf01a23032c7b3e64102614b7213065c81096bbf3f8022e6a0 runtime_mono-thread-coop-undefine-fortify-source.patch
1de4459522525e1d570e219c9ef067fbbf8745ad369602a006ea62cbafa0f64d2b01b63e00147cf8fed0ea9764373fb4c66aae2323b43a34447990a24f9f29c3 runtime_no-additional-runtime-id.patch
89d008944bf0ba16250ff078e650619b2087654d98b4f7dd614b8197774236e946d92ea17d81d037251ab16880e7bb8f74dbd8a244ca713ecd3efbea17e09318 sdk_dotnet-watch-nowarn-ad0001.patch
f8cdeb30e4b9d4ebf40ded00614813c1afb5d560c0969edc9be2bd594238152a8a932121a4c88c3deca813cc4a62bac96c12c0d7a0c57191911c15eef728c96b sdk_dummyshim-fix.patch
b456f28045ac7c71b3f8ceb0d1836a0290c6527375cd84116c8f259de59434340e259695d7d728d2e0ab6eb4758d7ef14328c50529fad3fe38a5f15262b2a366 sdk_fix-sdk-download.patch
"

View file

@ -0,0 +1,140 @@
# dotnet7-stage0
This is the .NET 7.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)
## How to build dotnet7 on Alpine
As dotnet is a self-hosting compiler (thus it compiles using itself), it
requires a bootstrap for the initial build. To solve this problem, this package
follows the `stage0` proposal outlined [here](https://lists.alpinelinux.org/~alpine/devel/%3C33KG0XO61I4IL.2Z7RTAZ5J3SY6%408pit.net%3E)
The goal of `stage0` is to bootstrap dotnet with as little intervention as
possible, thus allowing seamless Alpine upgrades. Unfortunately, upstream only
builds bootstraps for Alpine on `x86_64`, `aarch64`, and `armv7`. Thus, `stage0`
has also been designed to be crossbuild aware, allowing bootstrapping to other
platforms.
In summary, dotnet7 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`
As abuild does not allow different versions for subpackages, a different aport
is required to package runtime bits from dotnet7-build.
## Crossbuilding with `stage0`
Crossbuilding `stage0` is a three step process:
1. Build sysroot for target platform by using `scripts/bootstrap.sh` in aports repo:
```
./bootstrap.sh $CTARGET_ARCH
```
2. Although not necessary, it is recommended to add Alpine repositories to
`$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:
```
CHOST=$CTARGET_ARCH abuild -r
```
# Specification
This package follows [package naming and contents suggested by upstream](https://docs.microsoft.com/en-us/dotnet/core/build/distribution-packaging),
with two exceptions. It installs dotnet to `/usr/lib/dotnet` (aka `$_libdir`).
In addition, the package is named `dotnet7` as opposed to `dotnet-7.0`
to match Alpine Linux naming conventions for packages with many installable versions
# Contributing
The steps below are for the final package. Please only contribute to a
pre-release version if you know what you are doing. Original instructions
follow.
## General Changes
1. Fork the main aports repo.
2. Checkout the forked repository.
- `git clone ssh://git@gitlab.alpinelinux.org/$USER/aports`
- `cd community/dotnet7-build`
3. Make your changes. Don't forget to add a changelog.
4. Do local builds.
- `abuild -r`
5. Fix any errors that come up and rebuild until it works locally.
6. Commit the changes to the git repo in a git branch
- `git checkout -b dotnet7/<name>`
- `git add` any new patches
- `git remove` any now-unnecessary patches
- `git commit -m 'community/dotnet7-build: descriptive description'`
- `git push`
7. Create a merge request with your changes, tagging @ayakael for review.
8. Once the tests in the pull-request pass, and reviewers are happy, your changes
will be merged.
## Updating to an new upstream release
1. Fork the main aports repo.
2. Checkout the forked repository.
- `git clone ssh://git@gitlab.alpinelinux.org/$USER/aports`
- `cd community/dotnet7-build`
3. Build the new upstream source tarball. Update the versions in the
APKBUILD file, and then create a snapshot. After build, update checksum.
- `abuild snapshot`
- `abuild checksum`
4. Do local builds.
- `abuild -r`
5. Fix any errors that come up and rebuild until it works locally. Any
patches that are needed at this point should be added to the APKBUILD file
in `_patches` variable.
6. Upload the source archive to a remote location, and update `source` variable.
7. Commit the changes to the git repo in a git branch.
- `git checkout -b dotnet7/<name>`
- `git add` any new patches
- `git remove` any now-unnecessary patches
- `git commit -m 'community/dotnet7-build: upgrade to <new-version>`
- `git push`
8. Create a merge request with your changes, tagging @ayakael for review.
9. Once the tests in the pull-request pass, and reviewers are happy, your changes
will be merged.
# Testing
This package uses CI tests as defined in `check()` function. Creating a
merge-request or running a build will fire off tests and flag any issues.
The tests themselves are contained in this external repository:
https://github.com/redhat-developer/dotnet-regular-tests/

View file

@ -0,0 +1,26 @@
From 65613dc9cf76432dcbde3db3db1005c2aa902fee Mon Sep 17 00:00:00 2001
From: Antoine Martin <dev@ayakael.net>
Date: Tue, 21 Feb 2023 15:51:31 -0500
Subject: [PATCH 09/15] aspnetcore_use-linux-musl-crossgen
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
---
.../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 b/src/aspnetcore/src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.csproj
index 326968018..fa1f72e62 100644
--- a/src/aspnetcore/src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.csproj
+++ b/src/aspnetcore/src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.csproj
@@ -103,7 +103,6 @@ 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>
--
2.38.2

View file

@ -0,0 +1,80 @@
From b5b7fda232e513a04879d82e4035ce548cb8bb34 Mon Sep 17 00:00:00 2001
From: Antoine Martin <dev@ayakael.net>
Date: Tue, 21 Feb 2023 15:50:19 -0500
Subject: [PATCH 08/15] build_set-local-repo
Patch necessary for stage0, as each component requires the artifacts
from previously built component. This patch (along with a prepare step
in aport) adds a "local" nupkg repository that artifacts are pushed to
at end of component build
---
src/aspnetcore/NuGet.config | 1 +
src/installer/NuGet.config | 1 +
src/roslyn/NuGet.config | 1 +
src/runtime/NuGet.config | 1 +
src/sdk/NuGet.config | 1 +
5 files changed, 5 insertions(+)
diff --git a/src/aspnetcore/NuGet.config b/src/aspnetcore/NuGet.config
index 50e58d647..b30b2cdbc 100644
--- a/src/aspnetcore/NuGet.config
+++ b/src/aspnetcore/NuGet.config
@@ -2,6 +2,7 @@
<configuration>
<packageSources>
<clear />
+ <add key="local" value="@@PACKAGESDIR@@" />
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
<add key="dotnet-tools" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />
<add key="dotnet8" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json" />
diff --git a/src/installer/NuGet.config b/src/installer/NuGet.config
index 77050d5f1..6ee3c6ecb 100644
--- a/src/installer/NuGet.config
+++ b/src/installer/NuGet.config
@@ -5,6 +5,7 @@
</solution>
<packageSources>
<clear />
+ <add key="local" value="@@PACKAGESDIR@@" />
<!--Begin: Package sources managed by Dependency Flow automation. Do not edit the sources below.-->
<!-- Begin: Package sources from dotnet-sdk -->
<!-- End: Package sources from dotnet-sdk -->
diff --git a/src/roslyn/NuGet.config b/src/roslyn/NuGet.config
index 1aafa4f96..87d12ccde 100644
--- a/src/roslyn/NuGet.config
+++ b/src/roslyn/NuGet.config
@@ -3,6 +3,7 @@
<configuration>
<packageSources>
<clear />
+ <add key="local" value="@@PACKAGESDIR@@" />
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
<add key="dotnet-tools" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />
<add key="dotnet6" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" />
diff --git a/src/runtime/NuGet.config b/src/runtime/NuGet.config
index 33b098b12..85a58caeb 100644
--- a/src/runtime/NuGet.config
+++ b/src/runtime/NuGet.config
@@ -7,6 +7,7 @@
</fallbackPackageFolders>
<packageSources>
<clear />
+ <add key="local" value="@@PACKAGESDIR@@" />
<!--
'src/test/PrepareTestAssets/PrepareTestAssets.proj' generates a NuGet.config file using this
one as a template. The following line is a marker to insert the test restore sources.
diff --git a/src/sdk/NuGet.config b/src/sdk/NuGet.config
index e42468650..13503ca3b 100644
--- a/src/sdk/NuGet.config
+++ b/src/sdk/NuGet.config
@@ -2,6 +2,7 @@
<configuration>
<packageSources>
<clear />
+ <add key="local" value="@@PACKAGESDIR@@" />
<!--Begin: Package sources managed by Dependency Flow automation. Do not edit the sources below.-->
<!-- Begin: Package sources from dotnet-aspnetcore -->
<!-- End: Package sources from dotnet-aspnetcore -->
--
2.38.2

View file

@ -0,0 +1,45 @@
From 96cdd52ef27bff89ae167e6b13fcb8d82da14a69 Mon Sep 17 00:00:00 2001
From: Antoine Martin <dev@ayakael.net>
Date: Tue, 21 Feb 2023 15:53:24 -0500
Subject: [PATCH 10/15] installer_runtimepacks
Necessary for stage0, as installer doesn't pull runtime packs.
---
.../src/redist/targets/GenerateLayout.targets | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/installer/src/redist/targets/GenerateLayout.targets b/src/installer/src/redist/targets/GenerateLayout.targets
index a27834f85..ca86967df 100644
--- a/src/installer/src/redist/targets/GenerateLayout.targets
+++ b/src/installer/src/redist/targets/GenerateLayout.targets
@@ -143,6 +143,13 @@
<RelativeLayoutPath>packs/%(PackageName)/%(PackageVersion)</RelativeLayoutPath>
</BundledLayoutPackage>
+ <BundledLayoutPackage Include="MicrosoftNetCoreAppRuntimePackNupkg">
+ <PackageName>Microsoft.NETCore.App.Runtime.$(SharedFrameworkRid)</PackageName>
+ <PackageVersion>$(MicrosoftNETCoreAppRefPackageVersion)</PackageVersion>
+ <TargetFramework>$(TargetFramework)</TargetFramework>
+ <RelativeLayoutPath>packs/%(PackageName)/%(PackageVersion)</RelativeLayoutPath>
+ </BundledLayoutPackage>
+
<BundledLayoutPackage Include="MicrosoftNetStandardTargetingPackNupkg">
<PackageName>NETStandard.Library.Ref</PackageName>
<PackageVersion>$(NETStandardLibraryRefPackageVersion)</PackageVersion>
@@ -157,6 +164,13 @@
<RelativeLayoutPath>packs/%(PackageName)/%(PackageVersion)</RelativeLayoutPath>
</BundledLayoutPackage>
+ <BundledLayoutPackage Include="MicrosoftAspNetCoreAppRuntimePackNupkg">
+ <PackageName>Microsoft.AspNetCore.App.Runtime.$(SharedFrameworkRid)</PackageName>
+ <PackageVersion>$(MicrosoftAspNetCoreAppRefPackageVersion)</PackageVersion>
+ <TargetFramework>$(TargetFramework)</TargetFramework>
+ <RelativeLayoutPath>packs/%(PackageName)/%(PackageVersion)</RelativeLayoutPath>
+ </BundledLayoutPackage>
+
<BundledLayoutPackage Include="MicrosoftNetCoreAppHostPackNupkg">
<PackageName>Microsoft.NETCore.App.Host.$(SharedFrameworkRid)</PackageName>
<PackageVersion>$(MicrosoftNETCoreAppHostPackageVersion)</PackageVersion>
--
2.38.2

View file

@ -0,0 +1,26 @@
From 84191e5b729198f92152b6ca27129cbcd5b7cd88 Mon Sep 17 00:00:00 2001
From: Antoine Martin <dev@ayakael.net>
Date: Tue, 21 Feb 2023 15:54:08 -0500
Subject: [PATCH 11/15] roslyn_allow-extra-params
Necessary as to allow manually setting binlog location
---
src/roslyn/eng/build.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/roslyn/eng/build.sh b/src/roslyn/eng/build.sh
index d49ebf7de..bd9564244 100755
--- a/src/roslyn/eng/build.sh
+++ b/src/roslyn/eng/build.sh
@@ -167,7 +167,7 @@ while [[ $# > 0 ]]; do
args="$args $1"
shift
;;
- /p:*)
+ /*)
properties="$properties $1"
;;
*)
--
2.38.2

View file

@ -0,0 +1,86 @@
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,25 @@
From fed0cbcfd1db11cc913d4dbb0e577172471eec50 Mon Sep 17 00:00:00 2001
From: Antoine Martin <dev@ayakael.net>
Date: Tue, 21 Feb 2023 15:57:02 -0500
Subject: [PATCH 13/15] runtime_make-lld-us-depend-on-existing-on-target
---
src/runtime/eng/common/native/init-compiler.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/runtime/eng/common/native/init-compiler.sh b/src/runtime/eng/common/native/init-compiler.sh
index c670cb796..a7bfef593 100644
--- a/src/runtime/eng/common/native/init-compiler.sh
+++ b/src/runtime/eng/common/native/init-compiler.sh
@@ -128,7 +128,7 @@ fi
# Only lld version >= 9 can be considered stable. lld doesn't support s390x.
if [ "$compiler" = "clang" ] && [ -n "$majorVersion" ] && [ "$majorVersion" -ge 9 ] && [ "$build_arch" != "s390x" ]; then
if "$CC" -fuse-ld=lld -Wl,--version >/dev/null 2>&1; then
- LDFLAGS="-fuse-ld=lld"
+ [ -f "$ROOTFS_DIR/usr/bin/lld" ] && LDFLAGS="-fuse-ld=lld"
fi
fi
--
2.38.2

View file

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

View file

@ -0,0 +1,27 @@
From b5bd27a369f9e4786c9c540a7fd96c766b4dca0a Mon Sep 17 00:00:00 2001
From: Antoine Martin <dev@ayakael.net>
Date: Tue, 21 Feb 2023 17:06:45 -0500
Subject: [PATCH 1/1] runtime_no-additional-runtime-id
For some reason, AdditionalRuntimeIdentifiers gets set as '$arch' rather than 'linux-musl-$arch'
Since we know our portable RID exists, just skip ensuring RID existence
---
.../src/Microsoft.NETCore.Platforms.csproj | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj b/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj
index 742f17881..81877a5e6 100644
--- a/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj
+++ b/src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/Microsoft.NETCore.Platforms.csproj
@@ -21,8 +21,6 @@
<_generateRuntimeGraphTargetFramework Condition="'$(MSBuildRuntimeType)' == 'core'">$(NetCoreAppToolCurrent)</_generateRuntimeGraphTargetFramework>
<_generateRuntimeGraphTargetFramework Condition="'$(MSBuildRuntimeType)' != 'core'">net472</_generateRuntimeGraphTargetFramework>
<_generateRuntimeGraphTask>$([MSBuild]::NormalizePath('$(BaseOutputPath)', $(Configuration), '$(_generateRuntimeGraphTargetFramework)', '$(AssemblyName).dll'))</_generateRuntimeGraphTask>
- <!-- When building from source, ensure the RID we're building for is part of the RID graph -->
- <AdditionalRuntimeIdentifiers Condition="'$(DotNetBuildFromSource)' == 'true'">$(AdditionalRuntimeIdentifiers);$(OutputRID)</AdditionalRuntimeIdentifiers>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
--
2.38.2

View file

@ -0,0 +1,24 @@
From 8f8fa898b907192462834cced1bc39bca8ade9f7 Mon Sep 17 00:00:00 2001
From: Antoine Martin <dev@ayakael.net>
Date: Tue, 21 Feb 2023 19:14:55 -0500
Subject: [PATCH 1/1] sdk_dotnet-watch-nowarn-ad0001
---
src/sdk/src/BuiltInTools/dotnet-watch/dotnet-watch.csproj | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/sdk/src/BuiltInTools/dotnet-watch/dotnet-watch.csproj b/src/sdk/src/BuiltInTools/dotnet-watch/dotnet-watch.csproj
index 0e8811a7b..a359ae5e8 100644
--- a/src/sdk/src/BuiltInTools/dotnet-watch/dotnet-watch.csproj
+++ b/src/sdk/src/BuiltInTools/dotnet-watch/dotnet-watch.csproj
@@ -9,6 +9,7 @@
<StrongNameKeyId>MicrosoftAspNetCore</StrongNameKeyId>
<UseAppHost>false</UseAppHost>
<RuntimeIdentifier />
+ <NoWarn>AD0001</NoWarn>
</PropertyGroup>
<ItemGroup>
--
2.38.2

View file

@ -0,0 +1,53 @@
From 16119e8a420ad8972693530de11697079f8bec51 Mon Sep 17 00:00:00 2001
From: Antoine Martin <dev@ayakael.net>
Date: Tue, 21 Feb 2023 15:59:54 -0500
Subject: [PATCH 15/15] sdk_dummy-shim-fix
Hack for building sdk within stage0, which expects to be built using the
whole stack.
---
src/sdk/build/GenerateResxSource.targets | 1 -
.../Microsoft.DotNet.PackageInstall.Tests.csproj | 1 -
.../SampleGlobalToolWithShim/includepublish.nuspec | 2 --
3 files changed, 4 deletions(-)
diff --git a/src/sdk/build/GenerateResxSource.targets b/src/sdk/build/GenerateResxSource.targets
index 239665655..b47510d90 100644
--- a/src/sdk/build/GenerateResxSource.targets
+++ b/src/sdk/build/GenerateResxSource.targets
@@ -1,7 +1,6 @@
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="_CustomizeXlfSourceNames"
- DependsOnTargets="_CustomizeResourceNames"
BeforeTargets="PrepareResourceNames;GatherXlf"
>
<ItemGroup>
diff --git a/src/sdk/src/Tests/Microsoft.DotNet.PackageInstall.Tests/Microsoft.DotNet.PackageInstall.Tests.csproj b/src/sdk/src/Tests/Microsoft.DotNet.PackageInstall.Tests/Microsoft.DotNet.PackageInstall.Tests.csproj
index c75bf86d3..a295df546 100644
--- a/src/sdk/src/Tests/Microsoft.DotNet.PackageInstall.Tests/Microsoft.DotNet.PackageInstall.Tests.csproj
+++ b/src/sdk/src/Tests/Microsoft.DotNet.PackageInstall.Tests/Microsoft.DotNet.PackageInstall.Tests.csproj
@@ -104,7 +104,6 @@
</PropertyGroup>
<Copy SourceFiles="SampleGlobalToolWithShim/DotnetToolSettings.xml" DestinationFolder="$(testAssetSourceRoot)" />
<Copy SourceFiles="SampleGlobalToolWithShim/dummyshim" DestinationFolder="$(testAssetSourceRoot)" />
- <Copy SourceFiles="SampleGlobalToolWithShim/dummyshim.exe" DestinationFolder="$(testAssetSourceRoot)" />
<MSBuild BuildInParallel="False" Projects="SampleGlobalToolWithShim/consoledemo.csproj" Targets="Restore" Properties="Configuration=Release;BaseOutputPath=$(testAssetSourceRoot)/bin/;BaseIntermediateOutputPath=$(testAssetSourceRoot)/obj/;ImportDirectoryBuildProps=false;ImportDirectoryBuildTargets=false;ForceRestoreToEvaluateSeparately=1" RemoveProperties="TargetFramework">
</MSBuild>
<MSBuild BuildInParallel="False" Projects="SampleGlobalToolWithShim/consoledemo.csproj" Targets="Build;Publish" Properties="Configuration=Release;BaseOutputPath=$(testAssetSourceRoot)/bin/;BaseIntermediateOutputPath=$(testAssetSourceRoot)/obj/;ImportDirectoryBuildProps=false;ImportDirectoryBuildTargets=false" RemoveProperties="TargetFramework">
diff --git a/src/sdk/src/Tests/Microsoft.DotNet.PackageInstall.Tests/SampleGlobalToolWithShim/includepublish.nuspec b/src/sdk/src/Tests/Microsoft.DotNet.PackageInstall.Tests/SampleGlobalToolWithShim/includepublish.nuspec
index b2ed9d349..a93fb1f0d 100644
--- a/src/sdk/src/Tests/Microsoft.DotNet.PackageInstall.Tests/SampleGlobalToolWithShim/includepublish.nuspec
+++ b/src/sdk/src/Tests/Microsoft.DotNet.PackageInstall.Tests/SampleGlobalToolWithShim/includepublish.nuspec
@@ -12,8 +12,6 @@
<files>
<file src="bin\Release\netcoreapp2.1\publish\*.*" target="tools\netcoreapp2.1\any\" />
<file src="DotnetToolSettings.xml" target="tools\netcoreapp2.1\any\DotnetToolSettings.xml" />
- <file src="dummyshim.exe" target="tools\netcoreapp2.1\any\shims\win-x64\demo.exe" />
- <file src="dummyshim.exe" target="tools\netcoreapp2.1\any\shims\win-x86\demo.exe" />
<file src="dummyshim" target="tools\netcoreapp2.1\any\shims\osx-x64\demo" />
<file src="dummyshim" target="tools\netcoreapp2.1\any\shims\linux\demo" />
</files>
--
2.38.2

View file

@ -0,0 +1,25 @@
From 1c330142683d6d398e38762f7f04f0918426d79d Mon Sep 17 00:00:00 2001
From: Antoine Martin <dev@ayakael.net>
Date: Tue, 21 Feb 2023 15:58:42 -0500
Subject: [PATCH 14/15] sdk_fix-sdk-download
---
src/sdk/eng/restore-toolset.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/sdk/eng/restore-toolset.sh b/src/sdk/eng/restore-toolset.sh
index da38088d5..d5dd0956d 100644
--- a/src/sdk/eng/restore-toolset.sh
+++ b/src/sdk/eng/restore-toolset.sh
@@ -7,7 +7,7 @@ function InitializeCustomSDKToolset {
# The following frameworks and tools are used only for testing.
# Do not attempt to install them in source build.
- if [[ $properties == *"ArcadeBuildFromSource=true"* ]]; then
+ if [[ "${DotNetBuildFromSource:-}" == "true" ]]; then
return
fi
--
2.38.2