community/dotnet6-build: enable s390x, eliminate runtime portable build

This commit is contained in:
Antoine Martin 2022-10-21 14:22:35 -04:00 committed by alice
parent d8187eeba0
commit eba8bdd3f8
32 changed files with 2250 additions and 489 deletions

View File

@ -13,27 +13,37 @@
pkgname=dotnet6-build
pkgver=6.0.110
pkgrel=1
pkgrel=2
_gittag=v$pkgver
_giturl="https://github.com/dotnet/installer"
_testtag=4832cef147bac35fdd5c57275a795e683bba0bb8
_bunnytag=71880bd94711519f7b786248a88a827a401207a2
_patches="
aspnetcore_musl-build-fix.patch
build_arm-build.patch
build_musl-build-fix.patch
command-line-api_fix-musl-build.patch
aspnetcore_43937-support-building-with-nonportable-runtime.patch
build_13378-arm-build.patch
build_14549-non-portable-build.patch
build_disable-apphost.diff
check_rid-alpine-generation.diff
installer_arm-build.patch
installer_forgotten-MicrosoftAspNetCoreAppRuntimePac.patch
installer_musl-build-fix.patch
installer_portable-runtime-id.patch
installer_reprodicible-tarball.patch
runtime_clang-15.patch
installer_13378-arm-build.patch
installer_14549-crossgen2-rid.patch
installer_14549-rename-MicrosoftAspNetCoreAppRuntimePackageVersion.patch
installer_2780-reprodicible-tarball.patch
msbuild_optional-systemconfiguration.patch
msbuild_optional-systemsecurity.patch
roslyn_57003-mono-namedmutex.patch
runtime_60315-momo-remove-ilstrip.patch
runtime_60675-mono-sterror.patch
runtime_66594-keep-native-symbols.patch
runtime_73065-define-cpuidex-only-when-no-builtin.patch
runtime_74504-pass-targetrid-to-native-scripts.patch
runtime_75597-support-building-runtime-with-non-portable-runtime.patch
runtime_76068-use-generated-runtimejson-when-building-sharedframework.patch
runtime_76500-mono-musl-support.patch
runtime_enable-system-libunwind.diff
runtime_lld-fix.patch
runtime_non-portable-distrorid-fix-alpine.patch
sdk_add-zsh-compdef-completion-script.patch
sdk_portable-runtime-id.patch
sdk_14239-add-zsh-compdef-completion-script.patch
sdk_22373-portable-runtime-id.patch
sdk_28380-map-nonportable-rids-when-targetos-is-determined.patch
sdk_telemetry-optout.patch
"
@ -41,7 +51,7 @@ _pkgver_macro=${pkgver%.*}
_pkgver_prior=${pkgver%.*.*}
_pkgver_name=${_pkgver_macro//[.0]}
pkgdesc="The .NET $_pkgver_macro bootstrap"
arch="x86_64 aarch64 armv7"
arch="x86_64 aarch64 armv7 s390x"
url=https://dotnet.microsoft.com
license="MIT"
# hack for dotnetx-build to be able to pull itself for bootstrapping
@ -82,7 +92,6 @@ makedepends="
libxml2-dev
libxml2-utils
linux-headers
lld-dev
lldb-dev
llvm-dev
lttng-ust-dev
@ -91,10 +100,16 @@ makedepends="
pigz
rsync
tar
xz
zlib-dev
"
case $CARCH in
s390x|x86) makedepends="$makedepends libucontext-dev";;
*) makedepends="$makedepends lld-dev";;
esac
subpackages="
dotnet$_pkgver_name-artifacts
dotnet$_pkgver_name-artifacts:artifacts:noarch
dotnet$_pkgver_name-sdk
dotnet$_pkgver_name-templates:templates:noarch
dotnet-zsh-completion:zshcomp:noarch
@ -103,7 +118,7 @@ subpackages="
netstandard21-targeting-pack:netstandard_targeting_pack:noarch
"
source="
dotnet-v$pkgver.tar.gz::https://repo.gpg.nz/apk/archives/dotnet-v$pkgver.tar.gz
https://repo.gpg.nz/apk/archives/dotnet-v$pkgver.tar.xz
dotnet-testsuite-$_testtag.tar.gz::https://github.com/redhat-developer/dotnet-regular-tests/archive/$_testtag.tar.gz
dotnet-bunny-$_bunnytag.tar.gz::https://github.com/redhat-developer/dotnet-bunny/archive/$_bunnytag.tar.gz
$_patches
@ -152,18 +167,29 @@ _fix_executable() {
# generates tarball containing all components built by dotnet
snapshot() {
local _pkg=$SRCDEST/${builddir##*/}.tar.gz
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
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|/src/installer||g' "$startdir"/installer_reprodicible-tarball.patch | patch -Np1 || true
sed 's|/src/installer||g' "$startdir"/installer_2780-reprodicible-tarball.patch | patch -Np1 || true
_InitializeDotNetCli="$_libdir/dotnet" DOTNET_INSTALL_DIR="$_libdir/dotnet" 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
}
@ -175,24 +201,29 @@ prepare() {
msg "check_rid-alpine-generation.diff"
patch -p1 -d "$_testdir" -i "$srcdir"/check_rid-alpine-generation.diff
# Official crossgen package is broken on arm, x86, s390x
# see https://github.com/dotnet/runtime/issues/73908
if [ "$CARCH" = "armhf" ] || [ "$CARCH" = "armv7" ] || [ "$CARCH" = "x86" ] || [ "$CARCH" = "s390x" ]; then
msg "Disabling use of crossgen"
sed -i 's|<BuildCommandArgs>$(BuildCommandArgs) /p:EnablePackageValidation=false|<BuildCommandArgs>$(BuildCommandArgs) /p:CrossgenOutput=false /p:EnablePackageValidation=false|' repos/aspnetcore.proj
sed -i 's|<BuildCommandArgs>$(BuildCommandArgs) /p:UsePortableLinuxSharedFramework=false|<BuildCommandArgs>$(BuildCommandArgs) /p:DISABLE_CROSSGEN=True /p:UsePortableLinuxSharedFramework=false|' repos/installer.proj
fi
# Using system libunwind is broken on aarch64
# Using system libunwind is broken on aarch64 and mono-based builds
# see https://github.com/dotnet/source-build/issues/2408,
if [ "$CARCH" != "aarch64" ] && [ "$CARCH" != "armv7" ] && [ "$CARCH" != "armhf" ]; then
msg "Using system libunwind"
sed -i 's|<InnerBuildArgs>$(InnerBuildArgs) /p:BuildDebPackage=false</InnerBuildArgs>|<InnerBuildArgs>$(InnerBuildArgs) /p:BuildDebPackage=false --cmakeargs -DCLR_CMAKE_USE_SYSTEM_LIBUNWIND=TRUE</InnerBuildArgs>|' src/runtime/eng/SourceBuild.props
fi
case $CARCH in
x86_64)
msg "Using system libunwind"
patch -p1 -i "$srcdir"/runtime_enable-system-libunwind.diff
;;
esac
# For some reason, new s390x apphost isn't pulled, this disable it's use on s390x
case $CARCH in
s390x)
msg "Disabing use of apphost"
patch -p1 -i "$srcdir"/build_disable-apphost.diff
;;
esac
# dotnet requires its bootstrap to be in a writable dir
msg "Setting up bootstrap"
local _bootstrapdir=$(find $_libdir/dotnet/bootstrap/$_pkgver_macro* -maxdepth 0 | sort -r | head -n 1)
if [ ! -d "$_cli_root" ]; then cp -r "$_bootstrapdir" "$_cli_root"; fi
if [ ! -d "$_cli_root" ]; then
cp -r "$_bootstrapdir" "$_cli_root"
fi
# ensure that dotnet does not download artifacts provided by dotnet-artifacts
rm -rf "$builddir"/packages/archive
# Adjusts OfficialBuildId to current date on tarball
@ -206,7 +237,9 @@ build() {
# 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
if [ -f "/usr/lib/liblttng-ust.so.1 " ]; then
export DOTNET_LTTng=0
fi
# looks for most recent recent version of _artifactsdir
local _artifactsdir=$(find $_libdir/dotnet/artifacts/$_pkgver_macro* -maxdepth 0 | sort -r | head -n 1)
@ -218,14 +251,23 @@ build() {
/p:LogVerbosity=minimal
/p:MinimalConsoleLogOutput=true
/p:CleanWhileBuilding=true
/p:OSName=linux-musl
/p:HostOSName=linux-musl
"
# disable use of crossgen on arches platforms where its unsupported (mono)
# or broken (armv7, aarch64)
case $CARCH in
x86|aarch64|armv7|armhf|s390x) local args="$args /p:CrossgenOutput=false /p:DISABLE_CROSSGEN=True";;
esac
# between releases, /etc/os-release sometimes has a VERSION_ID that is
# unsupported by dotnet's Rid format. As mitigation, TargetRid is set
# manually, rather than letting source-build compute it itself
# shellcheck disable=SC2034
. /etc/os-release
if [ -n "${VERSION_ID//[^_]}" ]; then local args="$args /p:TargetRid=alpine.${VERSION_ID%_*}-$_dotnet_arch"; fi
if [ -n "${VERSION_ID//[^_]}" ]; then
local args="$args /p:TargetRid=alpine.${VERSION_ID%_*}-$_dotnet_arch"
fi
./build.sh \
--with-sdk "$_cli_root" \
@ -238,9 +280,9 @@ check() {
local _tests_timeout=600
# Test suite disable flags
# following tests can only work after packaging step
local _disabled_tests="man-pages distribution-package bash-completion"
# we don't care if not latest release and not installed location
local _disabled_tests="$_disabled_tests release-version-sane install-location"
local _disabled_tests="man-pages distribution-package bash-completion install-local release-version-sane"
# Test fails due to bug with https://github.com/dotnet/installer/pull/14549
local _disabled_tests="$_disabled_tests use-current-runtime"
# test broken on all but x86_64 and aarch64: no musl release for omnisharp
if [ "$CARCH" != "x86_64" ] && [ "$CARCH" != "aarch64" ]; then
local _disabled_tests="$_disabled_tests omnisharp"
@ -252,16 +294,15 @@ check() {
local _disabled_tests="$_disabled_tests liblttng-ust_sys-sdt.h lttng"
# {bundled,system}-libunwind: use system version on all but aarch64/armv7, as broken
# see https://github.com/redhat-developer/dotnet-regular-tests/issues/113
if [ "$CARCH" != "aarch64" ] && [ "$CARCH" != "armv7" ] && [ "$CARCH" != "armhf" ]; then
local _disabled_tests="$_disabled_tests bundled-libunwind"
else
local _disabled_tests="$_disabled_tests system-libunwind"
fi
case $CARCH in
x86_64) local _disabled_tests="$_disabled_tests bundled-libunwind";;
*) local _disabled_tests="$_disabled_tests system-libunwind";;
esac
# publish-ready-to-run: broken due to crossgen2 nupkg on musl-arm64 / musl-arm platform being broken
# should be fixed with https://github.com/dotnet/runtime/pull/66814
if [ "$CARCH" = "aarch64" ] || [ "$CARCH" = "armv7" ] || [ "$CARCH" = "armhf" ]; then
local _disabled_tests="$_disabled_tests publish-ready-to-run publish-ready-to-run-linux"
fi
case $CARCH in
aarch64|armv7) local _disabled_tests="$_disabled_tests publish-ready-to-run publish-ready-to-run-linux";;
esac
msg "Unpacking produced dotnet"
export DOTNET_ROOT="$_checkdir/release"
@ -278,14 +319,17 @@ check() {
_fix_executable "$DOTNET_ROOT"
msg "Building turkey test suite"
if [ ! -d "$_checkdir"/turkey ]; then cd "$_checkdir"/Turkey
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
fi
msg "Running test suite"
cd "$_testdir"
for i in $_disabled_tests; do
if [ -d "$i" ]; then sed -i 's|"enabled": true|"enabled": false|' $i/test.json; fi
if [ -d "$i" ]; then
sed -i 's|"enabled": true|"enabled": false|' $i/test.json
fi
done
dotnet "$_checkdir"/turkey/Turkey.dll -t $_tests_timeout || local ERROR=true
if [ $ERROR ]; then
@ -301,14 +345,23 @@ package() {
# directory creation
install -dm 755 \
"$pkgdir"/$_libdir/dotnet/bootstrap/$pkgver \
"$pkgdir"/usr/share/man/man1/dotnet
"$pkgdir"/usr/share/man/man1/dotnet \
"$pkgdir"/$_libdir/dotnet/artifacts/$pkgver
# unpack build artifacts to bootstrap
# unpack sdk to bootstrap
tar --use-compress-program="pigz" \
-xf "$builddir"/artifacts/$_dotnet_arch/Release/dotnet-sdk-$_pkgver_macro*.tar.gz \
-C "$pkgdir"/$_libdir/dotnet/bootstrap/$pkgver/ \
--no-same-owner
# extract arch-specific artifacts to artifacts dir for use by future dotnet builds
tar --use-compress-program="pigz" \
-xf "$builddir"/artifacts/$_dotnet_arch/Release/Private.SourceBuilt.Artifacts.*.tar.gz \
-C "$pkgdir"/$_libdir/dotnet/artifacts/$pkgver/ \
--no-same-owner \
--wildcards \
'*alpine*'
# assemble docs
find "$builddir" -iname 'dotnet*.1' -type f -exec cp '{}' "$pkgdir"/usr/share/man/man1/dotnet/. \;
@ -397,12 +450,13 @@ artifacts() {
"$subpkgdir"/$_libdir/dotnet/artifacts/$pkgver \
"$subpkgdir"/usr/share/licenses
# extract artifacts to artifacts dir for use by future dotnet builds
# extract arch-agnostic artifacts to artifacts dir for use by future dotnet builds
tar --use-compress-program="pigz" \
-xf "$builddir"/artifacts/$_dotnet_arch/Release/Private.SourceBuilt.Artifacts.*.tar.gz \
-C "$subpkgdir"/$_libdir/dotnet/artifacts/$pkgver/ \
--no-same-owner \
--exclude '*Intermediate*'
--exclude '*Intermediate*' \
--exclude '*alpine*'
}
zshcomp() {
@ -443,23 +497,33 @@ doc() {
}
sha512sums="
b6e11caf180f1e8db4daa384d00a029a717c9b94379ad8a80252196a3900c18b627885e152ded7e7fd3bf33212d1b512593215439dc27e4cd19e71f74b3d1f85 dotnet-v6.0.110.tar.gz
db3f1dd0480bf2db9bbe17df9b53f80bc02a8edb78e61e39a10928ab77205afb8f66f61d375a7c8137ec4519a43a446c578baf0b35fec07af68eeec214378f09 dotnet-v6.0.110.tar.xz
994e5145653698551408a87e34d19368e85a2531af9e2bfe61b903af0f016bfd5e4a7691795bdf09ba74bf6f41fc666973ee8cfde9088738f9a2f83f4bafa5e4 dotnet-testsuite-4832cef147bac35fdd5c57275a795e683bba0bb8.tar.gz
fc281df5fcf0d31dc9ff7f5b0e870960cfbe3c4fa0f6a6bb50b22c4ee18d2c608c827205bc79bd7f686d77ac917582fc26f68432cdd86c4a33b910c0c7416d09 dotnet-bunny-71880bd94711519f7b786248a88a827a401207a2.tar.gz
4394debb3cfec7bec7f223029c8283fd57b28ad765d47f354c7ca667756cbfc1ae4a51b216a0f81452400f60b58f08347bac327cd717a1947dad737b37cbe3ef aspnetcore_musl-build-fix.patch
6e9663f466007fc5fa7010e6859f054b6a4e59affa7aae7fd4d9ab4ba8410d4855b680f58f938ad21d0b3d2a7c7b097c7e9494a4dde2c43478ddddbf37539545 build_arm-build.patch
d25690181c9a19d78d1bd757f4add966cf07457c955546b2f1eafcc37a0a5856f04f87e5997f2300f40013237675d2bf4605caab01ad04a90a526cb38d8fc55a build_musl-build-fix.patch
a0b3044998bdcecb33862e08e3c04c4afbeee1551d35ac46f66ae5d87cd679739fcda1651787a8698b1362eb9ce79e3b04980bf9e33f4d64bfa1247a59c4bdfc command-line-api_fix-musl-build.patch
4e20561da7ea4a7d32bf98c16db1d6848e217a528482ec0e4b9951849af24d6ff86ec49220a693ac0256d23be436818593bd1c435cdd65c44bbd849f5d8608b2 aspnetcore_43937-support-building-with-nonportable-runtime.patch
6e9663f466007fc5fa7010e6859f054b6a4e59affa7aae7fd4d9ab4ba8410d4855b680f58f938ad21d0b3d2a7c7b097c7e9494a4dde2c43478ddddbf37539545 build_13378-arm-build.patch
b795ebf414f61d2412636805c6c8d5f798862919129c36851f4929c36b33210e88d6fcf49498adb47e6897832a4279ddffc8113f9e948f738b7bfe7ef4157a76 build_14549-non-portable-build.patch
a5a359af816595fbf19482e5dccf874c78d2fc4b59f38223118aac603b33e00c9fed22580eee3112519477205c2c8ed16177d100f09f45275e3da3c20b0ed7f7 build_disable-apphost.diff
941b430b55e323f723bbc5160447f060f40d18ce32e5803ab7dda16bfc60a0f5ec1dccd246e68475d7115ee265a9433824d8a5d997c302531311194a90deeca9 check_rid-alpine-generation.diff
23b712d7a088e780cd0994c5577b4c015cc1478e3a6bbca9b6e97ff2f2711562ef3a01ed483582a6861b31989b949972e2159caa4a34e0b18b6e8c062bb82c9e installer_arm-build.patch
c8ab4e5beb2a169376f67fd467b16ed5e0762fbff3955dd99315b8b0fe514c8f6b2f9f75b92ee5faa466f2596608fe6c756bbd2b3a6cf6898c1ebcfc88fe5ce0 installer_forgotten-MicrosoftAspNetCoreAppRuntimePac.patch
8855d9090f473d61c975a2d08a2cfc1c1e9a868ce13a99b1932640973842ca9465e84f0d26216fd6313f0b83bc8e8436fc6336650ff1602e0d9037f7fc946c8b installer_musl-build-fix.patch
1fee07d86a390aa676a34c16d489905c3add7c1c1fb88a97e0f5680e1046ac7d4ebb4d2f057188e90301d012d24ecbd432309994ddcad8aaf71170e2c1970392 installer_portable-runtime-id.patch
d95082cedd1a7e57744d9f5435b95f1031f6433256451e3469cfa5ec6da7110ef6231e8256e19e2c6366e18f819b2ec90d8c5afe63c8d2a385c897abf0c65d61 installer_reprodicible-tarball.patch
56f689d578d8066471c3cd1c997224a2629f11e1eef5d750901bbd0dc355a121d65b875c51bb25cb4982304c5f23b0eef40101e1337dfb7a6cc44e858afa00c8 runtime_clang-15.patch
23b712d7a088e780cd0994c5577b4c015cc1478e3a6bbca9b6e97ff2f2711562ef3a01ed483582a6861b31989b949972e2159caa4a34e0b18b6e8c062bb82c9e installer_13378-arm-build.patch
202d927a67f5d7c11f55e19df2de05ed63d2c5cedbbf47ba08d268f43202c3f20fd50cdc3247bb58d1a2d97168f6a64ad06ef37989caa161cc183d90ecb482d6 installer_14549-crossgen2-rid.patch
48f26149bdc20cb5b3dcf8f0194db01d5bfa1c388c6c631841df6186e8cabd01c9902d0deac210770b39784074bb37adc21a252db840b8ce9c4108cc8ffe7b98 installer_14549-rename-MicrosoftAspNetCoreAppRuntimePackageVersion.patch
c2451ab9c3bf5c25998105869aabc36f741964040775b53eb78ba41ac5f5d0e25f2514664080393e621011487501bc1f1d18b34dfdf8f99649f407792891779f installer_2780-reprodicible-tarball.patch
86e14ecc0269c8b2c2a2a679790de4fa4e15ac06b2a831e1129c4a7de1499d60583fcdc79b3705652c3c4ced73afac2e0ee3edce2cfa3b00fddf94180fb26e10 msbuild_optional-systemconfiguration.patch
f4d27624f735ce77e0030fa791594fc12fb325a3ce8620791a7856bd5c0067a042df2196ec97ed4d0309db64bd51e6a48cafaad316d9ea45e34134214a7f3ca4 msbuild_optional-systemsecurity.patch
42779a7bf1004fe0f7054cfa4f09f49d7f2a57c0543ec994ffbd54fb349abb508295476098ed35d60e9676be8bcc15aa8a9ec5c814cd1e058357530b5cdfb2b6 roslyn_57003-mono-namedmutex.patch
e0ff5e45b2e51571e6f332a07176290a9de1bf883350e9b8421c68de705a23a5ef8364276a35723677f30b6caa447ece0f75a50ff1b4568283486fb22c39de93 runtime_60315-momo-remove-ilstrip.patch
f28c3fa0fcff8fbf4d29b31e44532dcba43c4d90587a4e2da21f5e112ee231eb2e9c081d4c1c4893ec7e8f8afd8624b7b9284d5577e57c070a18f5846b9cbf2c runtime_60675-mono-sterror.patch
48ddb86969fb0df916cb0d1581ca57cb24def3adc746fbb8ade96c8b5f0f08e5e184c15d7bcc4e5ca87acf38c5a3430baea99f01ed2d826131dffbd0eba230a4 runtime_66594-keep-native-symbols.patch
f198795f24e328cb707c49fbf7365d8068db53c0818ef2d3a5e62e7a4a4fd403868856fba168cc0b6f61f81c94fda54b0d64f60ecbc5aeb3bd8d598d7850a06a runtime_73065-define-cpuidex-only-when-no-builtin.patch
7609bcb8978d01165a36e45db678eba91dbeed815ccb3e103c0dc1055d664ebbd22506be736f44c1c9d93d3a82341a4140b6269fe791ab79bef79c8210ec3af7 runtime_74504-pass-targetrid-to-native-scripts.patch
635794e36da525c628b7a166eef2b705159ce9d7dcb0df7f0e22d946751175b706588085e7407cb9a1b4d20c015de7c3fd6ecf790140d134f6da69f48f852d24 runtime_75597-support-building-runtime-with-non-portable-runtime.patch
4381b4ccb2e7c8f01fd097f9e551524779e19fb340203b3ed198bda1ba1b52f0884f5d8b2ed0a36708a867fb5c8aeb57eeb8e63f76830a6ff2fb7e3c94b4808c runtime_76068-use-generated-runtimejson-when-building-sharedframework.patch
4328383925067d69ea1a0c6ef3bc2579c5fd3b83118069372ab1caee9a55f44c3f958e2dbccd81a1293eb52c8bd5c220fe1ae1fd643ed59a0ce582e90b733b1a runtime_76500-mono-musl-support.patch
a0dbf7c0809ad7ef25ad1dbaeeeafa30bb10a035c055d66baf24a1efaff962d7e8041196bd7833ce20fc4236695a09b0e4a92a49d9ed0cef817cb6f6e6822352 runtime_enable-system-libunwind.diff
5f465f6e3bfbff66551a5690eb41be46735f8e0b1e6e6503038521a8cc60cd66b7839426319ec304f785c9f074ef588b1f189ad6dbb6ced53257af28b09388f2 runtime_lld-fix.patch
8be4b028fb15d4bc0ba34711f7491c49b4908e017a9c46fcd3817c59aa1459c0217dca405f46cfaf5e115ad0fbcd60d2593c05c6e1da2632612bf6179867cd10 runtime_non-portable-distrorid-fix-alpine.patch
d1b4ebcbb1a6815fc0ce4c471485c232618e60968a879309fb8336821a9351d2e0028d9f7726c0c041c750b497a0baa47400c78c9ceff550b91b4a6c2816fc41 sdk_add-zsh-compdef-completion-script.patch
06490a00df6e52cf54dd757189381dbd98b4d36cdf5c6280e8c80d0074b38935160bf31613519816bccb593d417f04757c8fe7da3b175450c7fb5b337111251e sdk_portable-runtime-id.patch
d1b4ebcbb1a6815fc0ce4c471485c232618e60968a879309fb8336821a9351d2e0028d9f7726c0c041c750b497a0baa47400c78c9ceff550b91b4a6c2816fc41 sdk_14239-add-zsh-compdef-completion-script.patch
9c2a22aba71357069ff77b739d3e8180a70812290a7e49dcd638b517f4fc3046e3055fd21a574c1758583cdb92bbf2269966f3c5e0f2db53aef4948387489832 sdk_22373-portable-runtime-id.patch
be95fdbb00aa4a38d8270dd74891143dd090018630526c0c9a270afa3c95022fca6c91b4f70158169b9767e9d37f0b1d4ebaacdab78d82f09473ec5cf8b93880 sdk_28380-map-nonportable-rids-when-targetos-is-determined.patch
815de1dad37412579b16d763debe2ecceffb44f5c46bd3f4ac00b3e431b20c677db435794eac41cea5601030b4e0f03f19e2d53c7a1ead896de2ffbca787eb84 sdk_telemetry-optout.patch
"

View File

@ -1,4 +1,4 @@
# dotnet6.0
# dotnet6-build
This is the .NET 6.0 package for Alpine Linux.

View File

@ -0,0 +1,143 @@
From 4e92a776a0bb0b8a4ab02ad4e436352594b7eab2 Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/aspnetcore/pull/43937
From: Tom Deseyn <tom.deseyn@gmail.com>
Date: Tue, 13 Sep 2022 10:51:19 +0200
Subject: [PATCH 1/3] source-build: support building aspnetcore using
non-portable runtime packages.
Currently source-build performs 'runtime-portable' build that produces 'linux-{arch}'
packages that are used when building ASP.NET Core.
With this change, we can use the non-portable packages that are produced by the
source-build 'runtime' build, and eliminate the 'runtime-portable' build.
---
src/aspnetcore/Directory.Build.props | 2 ++
src/aspnetcore/eng/Common.props | 2 ++
src/aspnetcore/eng/Dependencies.props | 2 ++
.../eng/tools/GenerateFiles/Directory.Build.targets.in | 7 +++++++
.../Wasm.Performance/Driver/Wasm.Performance.Driver.csproj | 2 +-
.../src/Microsoft.AspNetCore.App.Runtime.csproj | 5 +++--
src/aspnetcore/src/Tools/Directory.Build.targets | 2 +-
7 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/src/aspnetcore/Directory.Build.props b/src/aspnetcore/Directory.Build.props
index 721f099a7..9979b084f 100644
--- a/src/aspnetcore/Directory.Build.props
+++ b/src/aspnetcore/Directory.Build.props
@@ -173,6 +173,8 @@
freebsd-x64
</SupportedRuntimeIdentifiers>
+ <SupportedRuntimeIdentifiers Condition=" '$(PortableBuild)' == 'false' ">$(SupportedRuntimeIdentifiers);$(TargetRuntimeIdentifier)</SupportedRuntimeIdentifiers>
+
<!-- Make error messages clickable in VS Code's console -->
<GenerateFullPaths Condition="'$(VSCODE_CWD)' != '' OR '$(TERM_PROGRAM)' == 'vscode'">true</GenerateFullPaths>
diff --git a/src/aspnetcore/eng/Common.props b/src/aspnetcore/eng/Common.props
index a9a69bde9..3dcca1c6b 100644
--- a/src/aspnetcore/eng/Common.props
+++ b/src/aspnetcore/eng/Common.props
@@ -6,6 +6,8 @@
<TargetOsName Condition=" '$(TargetOsName)' == '' AND $([MSBuild]::IsOSPlatform('FreeBSD'))">freebsd</TargetOsName>
<TargetArchitecture Condition="'$(TargetArchitecture)' == ''">x64</TargetArchitecture>
<TargetRuntimeIdentifier Condition="'$(TargetRuntimeIdentifier)' == ''">$(TargetOsName)-$(TargetArchitecture)</TargetRuntimeIdentifier>
+ <PortableBuild Condition="'$(PortableBuild)' == ''">true</PortableBuild>
+ <DefaultAppHostRuntimeIdentifier Condition=" '$(PortableBuild)' == 'false' ">$(TargetRuntimeIdentifier)</DefaultAppHostRuntimeIdentifier>
</PropertyGroup>
<PropertyGroup Condition=" '$(BuildAllProjects)' == 'true' ">
diff --git a/src/aspnetcore/eng/Dependencies.props b/src/aspnetcore/eng/Dependencies.props
index 75c41177f..d39473508 100644
--- a/src/aspnetcore/eng/Dependencies.props
+++ b/src/aspnetcore/eng/Dependencies.props
@@ -95,6 +95,7 @@ and are generated based on the last package release.
<LatestPackageReference Include="Microsoft.NETCore.App.Runtime.linux-musl-x64" />
<LatestPackageReference Include="Microsoft.NETCore.App.Runtime.linux-musl-arm" />
<LatestPackageReference Include="Microsoft.NETCore.App.Runtime.linux-musl-arm64" />
+ <LatestPackageReference Include="Microsoft.NETCore.App.Runtime.$(TargetRuntimeIdentifier)" Condition=" '$(PortableBuild)' == 'false' " />
<!-- Crossgen2 compiler -->
<LatestPackageReference Include="Microsoft.NETCore.App.Crossgen2.osx-x64" />
@@ -109,6 +110,7 @@ and are generated based on the last package release.
<LatestPackageReference Include="Microsoft.NETCore.App.Crossgen2.win-x86" />
<LatestPackageReference Include="Microsoft.NETCore.App.Crossgen2.win-arm" />
<LatestPackageReference Include="Microsoft.NETCore.App.Crossgen2.win-arm64" />
+ <LatestPackageReference Include="Microsoft.NETCore.App.Crossgen2.$(TargetRuntimeIdentifier)" Condition=" '$(PortableBuild)' == 'false' " />
</ItemGroup>
<ItemGroup Label=".NET team dependencies (Non-source-build)" Condition="'$(DotNetBuildFromSource)' != 'true'">
diff --git a/src/aspnetcore/eng/tools/GenerateFiles/Directory.Build.targets.in b/src/aspnetcore/eng/tools/GenerateFiles/Directory.Build.targets.in
index c5206ec8c..5e693b6d7 100644
--- a/src/aspnetcore/eng/tools/GenerateFiles/Directory.Build.targets.in
+++ b/src/aspnetcore/eng/tools/GenerateFiles/Directory.Build.targets.in
@@ -39,8 +39,15 @@
<DefaultRuntimeFrameworkVersion Condition=" '$(IsServicingBuild)' != 'true' AND
'%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' AND
'$(TargetLatestDotNetRuntime)' != 'false' ">${MicrosoftNETCoreAppRuntimeVersion}</DefaultRuntimeFrameworkVersion>
+ <RuntimePackRuntimeIdentifiers Condition=" '$(PortableBuild)' == 'false' ">$(TargetRuntimeIdentifier)</RuntimePackRuntimeIdentifiers>
</KnownFrameworkReference>
+ <KnownCrossgen2Pack Update="Microsoft.NETCore.App.Crossgen2" Condition=" '$(PortableBuild)' == 'false' ">
+ <Crossgen2PackVersion
+ Condition=" '%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' ">${MicrosoftNETCoreAppRuntimeVersion}</Crossgen2PackVersion>
+ <Crossgen2RuntimeIdentifiers>$(TargetRuntimeIdentifier)</Crossgen2RuntimeIdentifiers>
+ </KnownCrossgen2Pack>
+
<!-- Use the just-built ASP.NET Core shared framework if available except when building product code in servicing. -->
<KnownFrameworkReference Update="Microsoft.AspNetCore.App" Condition=" $(UpdateAspNetCoreKnownFramework) ">
<LatestRuntimeFrameworkVersion
diff --git a/src/aspnetcore/src/Components/benchmarkapps/Wasm.Performance/Driver/Wasm.Performance.Driver.csproj b/src/aspnetcore/src/Components/benchmarkapps/Wasm.Performance/Driver/Wasm.Performance.Driver.csproj
index 346ddc48f..9e35e9b1e 100644
--- a/src/aspnetcore/src/Components/benchmarkapps/Wasm.Performance/Driver/Wasm.Performance.Driver.csproj
+++ b/src/aspnetcore/src/Components/benchmarkapps/Wasm.Performance/Driver/Wasm.Performance.Driver.csproj
@@ -8,7 +8,7 @@
<!-- WebDriver is not strong-named, so this test project cannot be strong named either. -->
<SignAssembly>false</SignAssembly>
<IsTestAssetProject>true</IsTestAssetProject>
- <RuntimeIdentifier>linux-x64</RuntimeIdentifier>
+ <RuntimeIdentifier Condition=" '$(DotNetBuildFromSource)' != 'true' ">linux-x64</RuntimeIdentifier>
</PropertyGroup>
<ItemGroup>
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 aeb3c08f1..a23f607e4 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
@@ -96,7 +96,7 @@ This package is an internal implementation of the .NET Core SDK and is not meant
<Crossgen2ToolFileName Condition=" '$(TargetOsName)' == 'win' ">$(Crossgen2ToolFileName).exe</Crossgen2ToolFileName>
<!-- E.g. "PkgMicrosoft_NETCore_App_Runtime_win-x64" (set in obj/Microsoft.AspNetCore.App.Runtime.csproj.nuget.g.props). -->
- <RuntimePackageRootVariableName>PkgMicrosoft_NETCore_App_Runtime_$(RuntimeIdentifier)</RuntimePackageRootVariableName>
+ <RuntimePackageRootVariableName>PkgMicrosoft_NETCore_App_Runtime_$(RuntimeIdentifier.Replace('.', '_'))</RuntimePackageRootVariableName>
<!--
Determine the crossgen2 package path property name. Special case linux-musl-arm and linux-musl-arm64 because they
@@ -105,9 +105,10 @@ This package is an internal implementation of the .NET Core SDK and is not meant
-->
<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)-$(Crossgen2BuildArchitecture)</Crossgen2PackageRootVariableName>
+ <Crossgen2PackageRootVariableName>PkgMicrosoft_NETCore_App_Crossgen2_$(BuildOsName.Replace('.', '_'))-$(Crossgen2BuildArchitecture)</Crossgen2PackageRootVariableName>
<AssetTargetFallback>$(AssetTargetFallback);native,Version=0.0</AssetTargetFallback>
diff --git a/src/aspnetcore/src/Tools/Directory.Build.targets b/src/aspnetcore/src/Tools/Directory.Build.targets
index 854f90ab5..438ea3da0 100644
--- a/src/aspnetcore/src/Tools/Directory.Build.targets
+++ b/src/aspnetcore/src/Tools/Directory.Build.targets
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup Condition=" '$(PackAsTool)' == 'true' ">
<!-- Microsoft tool packages are required to target both x64 and x86. -->
- <PackAsToolShimRuntimeIdentifiers Condition=" '$(IsShippingPackage)' == 'true' ">win-x64;win-x86</PackAsToolShimRuntimeIdentifiers>
+ <PackAsToolShimRuntimeIdentifiers Condition=" '$(IsShippingPackage)' == 'true' AND '$(DotNetBuildFromSource)' != 'true' ">win-x64;win-x86</PackAsToolShimRuntimeIdentifiers>
<!-- None of the tool projects are project reference providers. -->
<IsProjectReferenceProvider>false</IsProjectReferenceProvider>
<!--
--
2.38.0

View File

@ -1,28 +0,0 @@
From 451aa3e9544b0214d0e8e844c27af3847f5bf391 Mon Sep 17 00:00:00 2001
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
---
.../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 aeb3c08f13..380fc5fbac 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
@@ -104,7 +104,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>
<Crossgen2BuildArchitecture Condition=" '$(BuildOsName)' == 'win' ">x64</Crossgen2BuildArchitecture>
<Crossgen2BuildArchitecture Condition=" '$(Crossgen2BuildArchitecture)' == '' ">$(BuildArchitecture)</Crossgen2BuildArchitecture>
<Crossgen2PackageRootVariableName>PkgMicrosoft_NETCore_App_Crossgen2_$(BuildOsName)-$(Crossgen2BuildArchitecture)</Crossgen2PackageRootVariableName>
--
2.34.1

View File

@ -0,0 +1,204 @@
From 9ce6a457e126f934725568279e3e6c91d9b336d1 Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/installer/pull/14549
From: Tom Deseyn <tom.deseyn@gmail.com>
Date: Tue, 18 Oct 2022 09:03:17 +0200
Subject: [PATCH] Remove runtime-portable build.
---
Directory.Build.props | 8 --
repos/aspnetcore.proj | 1 +
repos/installer.proj | 2 +-
repos/known-good.proj | 1 -
repos/runtime.proj | 86 +++++++++++++++++++++-
repos/source-build-reference-packages.proj | 4 +-
6 files changed, 88 insertions(+), 14 deletions(-)
diff --git a/Directory.Build.props b/Directory.Build.props
index d921eda..406de2d 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -22,14 +22,6 @@
<Platform Condition="'$(Platform)' == ''">x64</Platform>
<UseStableVersions Condition="'$(UseStableVersions)' == ''">false</UseStableVersions>
-
- <!-- new supported portable/nonportable options. These control whether to build portable runtime
- or portable SDK. The PortableBuild flag is only set in runtime-portable.proj and should
- no longer be passed in. -->
- <BuildPortableRuntime Condition="'$(BuildPortableRuntime)' == ''">false</BuildPortableRuntime>
- <BuildPortableSdk Condition="'$(BuildPortableSdk)' == ''">false</BuildPortableSdk>
- <UseSystemLibraries Condition="'$(UseSystemLibraries)' == '' AND '$(PortableRuntime)' != 'true'">true</UseSystemLibraries>
- <UseSystemLibraries Condition="'$(UseSystemLibraries)' == ''">false</UseSystemLibraries>
</PropertyGroup>
<!-- This repo's projects are entirely infrastructure and do not ship. -->
diff --git a/repos/aspnetcore.proj b/repos/aspnetcore.proj
index 480f3c7..5224302 100644
--- a/repos/aspnetcore.proj
+++ b/repos/aspnetcore.proj
@@ -9,6 +9,7 @@
<BuildCommandArgs>$(BuildCommandArgs) --no-build-repo-tasks</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:BuildNodeJs=false</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:PublishCompressedFilesPathPrefix=$(SourceBuiltAspNetCoreRuntime)</BuildCommandArgs>
+ <BuildCommandArgs>$(BuildCommandArgs) /p:PortableBuild=false /p:TargetRuntimeIdentifier=$(TargetRid)</BuildCommandArgs>
<!-- Update to 1.0.0 version of reference assemblies which are built in SBRP instead of the preview.2 version
included by Arcade -->
<BuildCommandArgs>$(BuildCommandArgs) /p:MicrosoftNetFrameworkReferenceAssembliesVersion=1.0.0</BuildCommandArgs>
diff --git a/repos/installer.proj b/repos/installer.proj
index e34337b..6c08a1f 100644
--- a/repos/installer.proj
+++ b/repos/installer.proj
@@ -25,7 +25,7 @@
<BuildCommandArgs Condition="'$(TargetOS)' == 'Linux'">$(BuildCommandArgs) /p:Rid=$(TargetRid)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:DOTNET_INSTALL_DIR=$(DotNetCliToolDir)</BuildCommandArgs>
- <BuildCommandArgs Condition="'$(TargetOS)' == 'Linux'">$(BuildCommandArgs) /p:AspNetCoreInstallerRid=linux-$(Platform)</BuildCommandArgs>
+ <BuildCommandArgs Condition="'$(TargetOS)' == 'Linux'">$(BuildCommandArgs) /p:AspNetCoreInstallerRid=$(TargetRid)</BuildCommandArgs>
<!-- core-sdk always wants to build portable on OSX and FreeBSD -->
<BuildCommandArgs Condition="'$(TargetOS)' == 'FreeBSD'">$(BuildCommandArgs) /p:CoreSetupRid=freebsd-x64 /p:PortableBuild=true</BuildCommandArgs>
<BuildCommandArgs Condition="'$(TargetOS)' == 'OSX'">$(BuildCommandArgs) /p:CoreSetupRid=osx-x64</BuildCommandArgs>
diff --git a/repos/known-good.proj b/repos/known-good.proj
index c04cdac..7a84ecd 100644
--- a/repos/known-good.proj
+++ b/repos/known-good.proj
@@ -44,7 +44,6 @@
<!-- Tier 2 -->
<RepositoryReference Include="linker" />
<RepositoryReference Include="msbuild" />
- <RepositoryReference Include="runtime-portable" />
<RepositoryReference Include="runtime" />
<RepositoryReference Include="templating" />
diff --git a/repos/runtime.proj b/repos/runtime.proj
index f3ed143..073cd8b 100644
--- a/repos/runtime.proj
+++ b/repos/runtime.proj
@@ -1,18 +1,57 @@
<Project>
- <Import Project="runtime.common.props"/>
+ <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
+ <!-- Build arguments -->
<PropertyGroup>
+ <LogVerbosityOptOut>true</LogVerbosityOptOut>
+
+ <CleanCommand>$(ProjectDirectory)/clean$(ShellExtension)</CleanCommand>
+
<OverrideTargetRid>$(TargetRid)</OverrideTargetRid>
<OverrideTargetRid Condition="'$(TargetOS)' == 'OSX'">osx-x64</OverrideTargetRid>
<OverrideTargetRid Condition="'$(TargetOS)' == 'FreeBSD'">freebsd-x64</OverrideTargetRid>
<OverrideTargetRid Condition="'$(TargetOS)' == 'Windows_NT'">win-x64</OverrideTargetRid>
+ <_platformIndex>$(NETCoreSdkRuntimeIdentifier.LastIndexOf('-'))</_platformIndex>
+ <RuntimeOS>$(NETCoreSdkRuntimeIdentifier.Substring(0, $(_platformIndex)))</RuntimeOS>
+
+ <_platformIndex>$(NETCoreSdkPortableRuntimeIdentifier.LastIndexOf('-'))</_platformIndex>
+ <BaseOS>$(NETCoreSdkPortableRuntimeIdentifier.Substring(0, $(_platformIndex)))</BaseOS>
+
<BuildCommandArgs>$(StandardSourceBuildArgs)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:TargetRid=$(OverrideTargetRid)</BuildCommandArgs>
+ <BuildCommandArgs>$(BuildCommandArgs) /p:RuntimeOS=$(RuntimeOS)</BuildCommandArgs>
+ <BuildCommandArgs>$(BuildCommandArgs) /p:BaseOS=$(BaseOS)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:SourceBuildNonPortable=true</BuildCommandArgs>
<BuildCommand>$(StandardSourceBuildCommand) $(BuildCommandArgs)</BuildCommand>
</PropertyGroup>
+ <!-- Output / source-build flags -->
+ <PropertyGroup>
+ <GlobalJsonFile>$(ProjectDirectory)global.json</GlobalJsonFile>
+ <NuGetConfigFile>$(ProjectDirectory)NuGet.config</NuGetConfigFile>
+ <OutputPlacementRepoApiImplemented>false</OutputPlacementRepoApiImplemented>
+ <DependencyVersionInputRepoApiImplemented>true</DependencyVersionInputRepoApiImplemented>
+ </PropertyGroup>
+
+ <!-- SDK Overrides -->
+ <ItemGroup>
+ <UseSourceBuiltSdkOverride Include="@(ArcadeSdkOverride)" />
+ <UseSourceBuiltSdkOverride Include="@(ArcadeCoreFxTestingOverride)" />
+ <UseSourceBuiltSdkOverride Include="@(ArcadePackagingOverride)" />
+ <UseSourceBuiltSdkOverride Include="@(ArcadeTargetFrameworkOverride)" />
+ <UseSourceBuiltSdkOverride Include="@(ArcadeSharedFrameworkSdkOverride)" />
+ </ItemGroup>
+
+ <!-- Environment Variables -->
+ <ItemGroup>
+ <EnvironmentVariables Include="BuildInParallel=false" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <ExtraPackageVersionPropsPackageInfo Include="MicrosoftCodeAnalysisVersion_4_X" Version="%24(MicrosoftCodeAnalysisVersion)" />
+ </ItemGroup>
+
<!-- Repository References -->
<ItemGroup>
<RepositoryReference Include="arcade" />
@@ -20,8 +59,49 @@
<RepositoryReference Include="linker" />
<RepositoryReference Include="source-build" />
<RepositoryReference Include="roslyn" />
- <RepositoryReference Include="runtime-portable" />
</ItemGroup>
- <Import Project="runtime.common.targets" />
+ <UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="AddRidToRuntimeJson" />
+ <UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="PublishCoreSetupBinaries" />
+
+ <Target Name="SetOutputList" AfterTargets="Package" BeforeTargets="GatherBuiltPackages">
+ <ItemGroup>
+ <PackagesOutputList Include="$(ShippingPackagesOutput)" />
+ <PackagesOutputList Include="$(NonShippingPackagesOutput)" />
+ </ItemGroup>
+ </Target>
+
+ <Target Name="UpdateRuntimeGraph"
+ BeforeTargets="Build"
+ Condition="'$(_IsBootstrapping)' == 'true'">
+ <PropertyGroup>
+ <RuntimeJsonFile>$(ProjectDirectory)pkg/Microsoft.NETCore.Platforms/runtime.json</RuntimeJsonFile>
+ </PropertyGroup>
+
+ <Message Importance="High" Text="Adding rid, $(TargetRid), to $(RuntimeJsonFile)" />
+ <AddRidToRuntimeJson RuntimeJson="$(RuntimeJsonFile)"
+ Rid="$(TargetRid)-$(Platform)" />
+ </Target>
+
+ <Target Name="CopyBinariesToBinFolder"
+ AfterTargets="ExtractIntermediatePackages"
+ Inputs="$(MSBuildProjectFullPath)"
+ Outputs="$(RepoCompletedSemaphorePath)CopyBinariesToBinFolder.complete">
+ <ItemGroup>
+ <_builtRuntimePackages Include="$(SourceBuiltAssetsDir)*.symbols.nupkg" />
+ <_builtRuntimePackages>
+ <TransformedFileName>$([System.String]::Copy('%(FileName)').Replace('symbols', 'nupkg'))</TransformedFileName>
+ </_builtRuntimePackages>
+ <BinariesToCopy Include="$(SourceBuiltAssetsDir)*.*" Exclude="$(SourceBuiltAssetsDir)*.nupkg;$(SourceBuiltAssetsDir)*.requires_nupkg_signing" />
+ <BinariesToCopy Include="@(_builtRuntimePackages->'$(SourceBuiltPackagesPath)%(TransformedFileName)')" />
+ </ItemGroup>
+
+ <Copy SourceFiles="@(BinariesToCopy)"
+ DestinationFolder="$(OutputPath)runtime"
+ Condition="'@(BinariesToCopy)'!=''" />
+
+ <WriteLinesToFile File="$(RepoCompletedSemaphorePath)CopyBinariesToBinFolder.complete" Overwrite="true" />
+ </Target>
+
+ <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>
diff --git a/repos/source-build-reference-packages.proj b/repos/source-build-reference-packages.proj
index 69ab564..9545b50 100644
--- a/repos/source-build-reference-packages.proj
+++ b/repos/source-build-reference-packages.proj
@@ -2,7 +2,9 @@
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
- <BuildCommand>$(StandardSourceBuildCommand) $(StandardSourceBuildArgs)</BuildCommand>
+ <BuildCommandArgs>$(StandardSourceBuildArgs)</BuildCommandArgs>
+ <BuildCommandArgs>$(BuildCommandArgs) /p:MicrosoftNetCoreIlasmPackageRuntimeId=$(NETCoreSdkRuntimeIdentifier)</BuildCommandArgs>
+ <BuildCommand>$(StandardSourceBuildCommand) $(BuildCommandArgs)</BuildCommand>
<NuGetConfigFile>$(ProjectDirectory)NuGet.config</NuGetConfigFile>
<GlobalJsonFile>$(ProjectDirectory)global.json</GlobalJsonFile>
--
2.38.0

View File

@ -0,0 +1,79 @@
From 75c3e74ea35219f257c80daf9a236e0f518a7875 Mon Sep 17 00:00:00 2001
From: Antoine Martin <dev@ayakael.net>
Date: Wed, 9 Mar 2022 20:16:03 +0000
Subject: [PATCH 1/1] Disable apphost
Disables use of apphost
---
--- a/src/fsharp/tests/benchmarks/MicroPerf/MicroPerf.fsproj
+++ b/src/fsharp/tests/benchmarks/MicroPerf/MicroPerf.fsproj
@@ -9,6 +9,7 @@
<OtherFlags>$(OtherFlags) --nowarn:57</OtherFlags>
<OtherFlags>$(OtherFlags) --langversion:preview</OtherFlags>
<OtherFlags>$(OtherFlags) --define:PREVIEW</OtherFlags>
+ <UseAppHost>false</UseAppHost>
<!-- By default this project will compile with the proto compiler -->
<!-- Uncommenting this will build with a previous installed compiler -->
<!--
--- a/src/fsharp/tests/benchmarks/TaskPerf/TaskPerf.fsproj
+++ b/src/fsharp/tests/benchmarks/TaskPerf/TaskPerf.fsproj
@@ -4,6 +4,7 @@
<TargetFramework>net5.0</TargetFramework>
<OutputType>Exe</OutputType>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
+ <UseAppHost>false</UseAppHost>
<!-- Turn off "This function is for use by compiled F# code and should not be used directly" -->
<OtherFlags>$(OtherFlags) --nowarn:1204</OtherFlags>
<!-- Turn off "Experimental" -->
--- a/src/arcade/src/Microsoft.DotNet.GitSync.CommitManager/Microsoft.DotNet.GitSync.CommitManager.csproj
+++ b/src/arcade/src/Microsoft.DotNet.GitSync.CommitManager/Microsoft.DotNet.GitSync.CommitManager.csproj
@@ -5,6 +5,7 @@
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>latest</LangVersion>
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
+ <UseAppHost>false</UseAppHost>
</PropertyGroup>
<ItemGroup>
--- a/src/arcade/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CmdLine/Microsoft.DotNet.SwaggerGenerator.CmdLine.csproj
+++ b/src/arcade/src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CmdLine/Microsoft.DotNet.SwaggerGenerator.CmdLine.csproj
@@ -9,6 +9,7 @@
<ToolCommandName>dotnet-swaggergen</ToolCommandName>
<SignAssembly>false</SignAssembly>
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
+ <UseAppHost>false</UseAppHost>
</PropertyGroup>
<ItemGroup>
--- a/src/arcade/src/Microsoft.DotNet.XUnitConsoleRunner/src/Microsoft.DotNet.XUnitConsoleRunner.csproj
+++ b/src/arcade/src/Microsoft.DotNet.XUnitConsoleRunner/src/Microsoft.DotNet.XUnitConsoleRunner.csproj
@@ -11,6 +11,7 @@
<VersionPrefix>2.5.1</VersionPrefix>
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
<RollForward>Major</RollForward>
+ <UseAppHost>false</UseAppHost>
</PropertyGroup>
<ItemGroup>
--- a/src/roslyn-analyzers/src/Tools/ReleaseNotesUtil/ReleaseNotesUtil.csproj
+++ b/src/roslyn-analyzers/src/Tools/ReleaseNotesUtil/ReleaseNotesUtil.csproj
@@ -4,6 +4,7 @@
<TargetFramework>netcoreapp3.1</TargetFramework>
<NonShipping>true</NonShipping>
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
+ <UseAppHost>false</UseAppHost>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis" Version="$(MicrosoftCodeAnalysisVersion)" />
--- a/src/roslyn/src/Workspaces/Remote/ServiceHub.CoreComponents/Microsoft.CodeAnalysis.Remote.ServiceHub.CoreComponents.csproj
+++ b/src/roslyn/src/Workspaces/Remote/ServiceHub.CoreComponents/Microsoft.CodeAnalysis.Remote.ServiceHub.CoreComponents.csproj
@@ -5,6 +5,7 @@
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<!-- The purpose of this project is to include all dependecies of Microsoft.CodeAnalysis.Remote.ServiceHub targeting .Net Core -->
+ <UseAppHost>false</UseAppHost>
<IsShipping>false</IsShipping>
</PropertyGroup>
<ItemGroup>

View File

@ -1,87 +0,0 @@
From b0facb8cac110413508a9499fc8a7c9b57f18618 Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/installer/pull/13410
From: Antoine Martin <dev@ayakael.net>
Date: Sun, 13 Mar 2022 23:28:21 +0000
Subject: [PATCH 1/1] musl-build-fix
Musl support for dotnet build
---
.../tarball/content/Directory.Build.props | 4 +
.../tarball/content/Directory.Build.targets | 7 +
.../tarball/content/repos/aspnetcore.proj | 2 +
.../tarball/content/repos/installer.proj | 3 +-
6 files changed, 382 insertions(+), 1 deletion(-)
create mode 100644 Directory.Build.props.orig
create mode 100644 repos/installer.proj.orig
diff --git a/Directory.Build.props b/Directory.Build.props
index d921eda93..1770fe785 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -171,6 +171,9 @@
</PropertyGroup>
<PropertyGroup>
+ <OSPlatformIsMusl Condition="$(OSPlatformIsMuslCheck) == '0'">true</OSPlatformIsMusl>
+ <OSPlatformIsMusl Condition="$(OSPlatformIsMusl) == ''">true</OSPlatformIsMusl>
+
<TargetRid Condition="'$(TargetRid)' == ''">$([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier)</TargetRid>
<TargetOS Condition="'$(TargetOS)' == '' AND $([MSBuild]::IsOSPlatform('WINDOWS'))">Windows_NT</TargetOS>
@@ -181,6 +184,7 @@
<PortableRid Condition="'$(TargetOS)' == 'FreeBSD'">freebsd-$(Platform)</PortableRid>
<PortableRid Condition="'$(TargetOS)' == 'OSX'">osx-$(Platform)</PortableRid>
<PortableRid Condition="'$(TargetOS)' == 'Linux'">linux-$(Platform)</PortableRid>
+ <PortableRid Condition="'$(TargetOS)' == 'Linux' AND '$(OSPlatformIsMusl)' == 'true'">linux-musl-$(Platform)</PortableRid>
<PortableRid Condition="'$(TargetOS)' == 'Windows_NT'">win-$(Platform)</PortableRid>
<TargetRid Condition="'$(PortableBuild)' == 'true' AND '$(PortableRid)' != ''">$(PortableRid)</TargetRid>
</PropertyGroup>
diff --git a/Directory.Build.targets b/Directory.Build.targets
index 02ff624bc..c7e3bd141 100644
--- a/Directory.Build.targets
+++ b/Directory.Build.targets
@@ -10,6 +10,13 @@
</ItemGroup>
</Target>
+ <Target Name="GetOSPlatformIsMuslCheck"
+ BeforeTargets="CollectPackageReferences">
+ <Exec IgnoreExitCode="true" Command="ldd --version 2&gt;&amp;1 | grep -q musl">
+ <Output TaskParameter="ExitCode" PropertyName="OSPlatformIsMuslCheck" />
+ </Exec>
+ </Target>
+
<Import Condition="'$(SkipArcadeSdkImport)' != 'true'" Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" />
</Project>
diff --git a/repos/aspnetcore.proj b/repos/aspnetcore.proj
index 480f3c713..04694770d 100644
--- a/repos/aspnetcore.proj
+++ b/repos/aspnetcore.proj
@@ -15,6 +15,8 @@
<!-- https://github.com/dotnet/sdk/pull/20136 has not flowed into our bootstrap SDK yet, which causes file-in-use issues in ASP.NET
due to an interaction with the RemoveSharedFrameworkDependencies task. disable package validation until this is fixed. -->
<BuildCommandArgs>$(BuildCommandArgs) /p:EnablePackageValidation=false</BuildCommandArgs>
+ <!-- below is temporary fix till https://github.com/dotnet/aspnetcore/issues/39822 is addressed -->
+ <BuildCommandArgs Condition="'$(OSPlatformIsMusl)' == 'true'">$(BuildCommandArgs) --os-name linux-musl</BuildCommandArgs>
<BuildCommand>$(ProjectDirectory)\eng\build$(ShellExtension) $(BuildCommandArgs)</BuildCommand>
<LogVerbosityOptOut>true</LogVerbosityOptOut>
diff --git a/repos/installer.proj b/repos/installer.proj
index e34337b85..587384128 100644
--- a/repos/installer.proj
+++ b/repos/installer.proj
@@ -25,7 +25,8 @@
<BuildCommandArgs Condition="'$(TargetOS)' == 'Linux'">$(BuildCommandArgs) /p:Rid=$(TargetRid)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:DOTNET_INSTALL_DIR=$(DotNetCliToolDir)</BuildCommandArgs>
- <BuildCommandArgs Condition="'$(TargetOS)' == 'Linux'">$(BuildCommandArgs) /p:AspNetCoreInstallerRid=linux-$(Platform)</BuildCommandArgs>
+ <BuildCommandArgs Condition="'$(TargetOS)' == 'Linux' AND '$(OSPlatformIsMusl)' == 'false'">$(BuildCommandArgs) /p:AspNetCoreInstallerRid=linux-$(Platform)</BuildCommandArgs>
+ <BuildCommandArgs Condition="'$(TargetOS)' == 'Linux' AND '$(OSPlatformIsMusl)' == 'true'">$(BuildCommandArgs) /p:AspNetCoreInstallerRid=linux-musl-$(Platform)</BuildCommandArgs>
<!-- core-sdk always wants to build portable on OSX and FreeBSD -->
<BuildCommandArgs Condition="'$(TargetOS)' == 'FreeBSD'">$(BuildCommandArgs) /p:CoreSetupRid=freebsd-x64 /p:PortableBuild=true</BuildCommandArgs>
<BuildCommandArgs Condition="'$(TargetOS)' == 'OSX'">$(BuildCommandArgs) /p:CoreSetupRid=osx-x64</BuildCommandArgs>
--
2.35.1

View File

@ -1,59 +0,0 @@
From 36ef9ae23fdf5425138b1c5725405833f06919cf Mon Sep 17 00:00:00 2001
From: Antoine Martin <dev@ayakael.net
Date: Sat, 12 Feb 2022 20:15:50 +0000
Subject: [PATCH 1/1] musl-build
Various change for build on musl
---
.../dotnet-suggest.Tests.csproj | 13 +++++++++++++
.../dotnet-suggest.csproj | 2 +-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/src/command-line-api/src/System.CommandLine.Suggest.Tests/dotnet-suggest.Tests.csproj b/src/command-line-api/src/System.CommandLine.Suggest.Tests/dotnet-suggest.Tests.csproj
index da6abedf..3d738ac9 100644
--- a/src/command-line-api/src/System.CommandLine.Suggest.Tests/dotnet-suggest.Tests.csproj
+++ b/src/command-line-api/src/System.CommandLine.Suggest.Tests/dotnet-suggest.Tests.csproj
@@ -38,6 +38,15 @@
<Target Name="DotnetSuggestIntegrationTestAssets" BeforeTargets="Build" Condition="'$(Configuration)' == 'Release'">
+ <Exec IgnoreExitCode="true" Command="ldd --version 2&gt;&amp;1 | grep -q musl">
+ <Output TaskParameter="ExitCode" PropertyName="OSPlatformIsMuslCheck" />
+ </Exec>
+
+ <PropertyGroup>
+ <OSPlatformIsMusl Condition="$(OSPlatformIsMuslCheck) == '0'">true</OSPlatformIsMusl>
+ <OSPlatformIsMusl Condition="$(OSPlatformIsMusl) == ''">false</OSPlatformIsMusl>
+ </PropertyGroup>
+
<PropertyGroup>
<TestAssetsPath>
$([System.IO.Path]::GetFullPath('$(OutputPath)'))/TestAssets
@@ -56,6 +65,10 @@
<Rid>linux-x64</Rid>
</PropertyGroup>
+ <PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true' AND '$(OSPlatformIsMusl)' == 'true'">
+ <Rid>linux-musl-x64</Rid>
+ </PropertyGroup>
+
<MSBuild BuildInParallel="False" Projects="../System.CommandLine.Suggest/dotnet-suggest.csproj" Targets="Restore" Properties="UseAppHost=true;SelfContained=false;RuntimeIdentifier=$(Rid);ForceRestoreToEvaluateSeparately=1;Configuration=Release">
</MSBuild>
diff --git a/src/command-line-api/src/System.CommandLine.Suggest/dotnet-suggest.csproj b/src/command-line-api/src/System.CommandLine.Suggest/dotnet-suggest.csproj
index fd825008..b18096e2 100644
--- a/src/command-line-api/src/System.CommandLine.Suggest/dotnet-suggest.csproj
+++ b/src/command-line-api/src/System.CommandLine.Suggest/dotnet-suggest.csproj
@@ -6,7 +6,7 @@
<PackAsTool>true</PackAsTool>
<PackageId>dotnet-suggest</PackageId>
<ToolCommandName>dotnet-suggest</ToolCommandName>
- <PackAsToolShimRuntimeIdentifiers>win-x64;win-x86;osx-x64;linux-x64</PackAsToolShimRuntimeIdentifiers>
+ <PackAsToolShimRuntimeIdentifiers>win-x64;win-x86;osx-x64;linux-x64;linux-musl-x64</PackAsToolShimRuntimeIdentifiers>
<PackagedShimOutputRootDirectory>$(OutputPath)</PackagedShimOutputRootDirectory>
<DotnetSuggestBuildNumber>.1</DotnetSuggestBuildNumber>
--
2.31.1

View File

@ -0,0 +1,25 @@
From dddc65b2e2616b847099625600b26c1d3330c1af Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/installer/pull/14549
From: Tom Deseyn <tom.deseyn@gmail.com>
Date: Mon, 19 Sep 2022 08:54:14 +0200
Subject: [PATCH] crossgen2 rid
---
src/redist/targets/Crossgen.targets | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/installer/src/redist/targets/Crossgen.targets b/src/installer/src/redist/targets/Crossgen.targets
index c7a7642e4..41fa3861a 100644
--- a/src/installer/src/redist/targets/Crossgen.targets
+++ b/src/installer/src/redist/targets/Crossgen.targets
@@ -6,7 +6,7 @@
<PropertyGroup>
<RuntimeNETCoreAppPackageName>microsoft.netcore.app.runtime.$(SharedFrameworkRid)</RuntimeNETCoreAppPackageName>
- <RuntimeNETCrossgenPackageName>microsoft.netcore.app.crossgen2.$(HostOSName)-$(BuildArchitecture)</RuntimeNETCrossgenPackageName>
+ <RuntimeNETCrossgenPackageName>microsoft.netcore.app.crossgen2.$(SharedFrameworkRid)</RuntimeNETCrossgenPackageName>
<CrossgenPath>$(NuGetPackageRoot)/$(RuntimeNETCrossgenPackageName)/$(MicrosoftNETCoreAppRuntimePackageVersion)/tools/crossgen2$(ExeExtension)</CrossgenPath>
<!-- When ingesting stable pgo instrumented binaries, the shared framework will be a non-stable version,
as will the archive file names themselves. -->
--
2.37.3

View File

@ -0,0 +1,163 @@
From f54977e2fc84527fe58024ed5537cb63244168e2 Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/installer/pull/14549
From: Tom Deseyn <tom.deseyn@gmail.com>
Date: Tue, 13 Sep 2022 14:17:35 +0200
Subject: [PATCH 1/1]
installer_14549-rename-MicrosoftAspNetCoreAppRuntimePackageVersion.patch
Wrong version of aspnetcore-runtime-internal is pulled by installer when
building source-build on Alpine Linux. This is due to a workaround on
osx and windows that breaks on Alpine, patch renames variable to go
around workaround.
---
src/installer/eng/Versions.props | 4 ++--
.../redist/targets/GenerateBundledVersions.targets | 4 ++--
.../src/redist/targets/GenerateDebs.targets | 2 +-
.../src/redist/targets/GenerateLayout.targets | 13 +++++++------
.../src/redist/targets/GenerateMSIs.targets | 2 +-
.../src/redist/targets/GeneratePKG.targets | 2 +-
.../LinuxNativeInstallerDependencyVersions.targets | 2 +-
7 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/src/installer/eng/Versions.props b/src/installer/eng/Versions.props
index a52e53cca..fd69843ca 100644
--- a/src/installer/eng/Versions.props
+++ b/src/installer/eng/Versions.props
@@ -88,7 +88,7 @@
<!-- version above and create aliases without the winx64 here for clarity elsewhere. -->
<MicrosoftNETCoreAppHostPackageVersion>$(MicrosoftNETCoreAppHostwinx64PackageVersion)</MicrosoftNETCoreAppHostPackageVersion>
<MicrosoftNETCoreAppRuntimePackageVersion>$(MicrosoftNETCoreAppRuntimewinx64PackageVersion)</MicrosoftNETCoreAppRuntimePackageVersion>
- <MicrosoftAspNetCoreAppRuntimePackageVersion>$(MicrosoftAspNetCoreAppRuntimewinx64PackageVersion)</MicrosoftAspNetCoreAppRuntimePackageVersion>
+ <MicrosoftAspNetCoreAppRuntimePackageVersionBuilt>$(MicrosoftAspNetCoreAppRuntimewinx64PackageVersion)</MicrosoftAspNetCoreAppRuntimePackageVersionBuilt>
<MicrosoftWindowsDesktopAppRuntimePackageVersion>$(MicrosoftWindowsDesktopAppRuntimewinx64PackageVersion)</MicrosoftWindowsDesktopAppRuntimePackageVersion>
</PropertyGroup>
<PropertyGroup>
@@ -116,7 +116,7 @@
<NUnit3Templates60PackageVersion>$(NUnit3DotNetNewTemplatePackageVersion)</NUnit3Templates60PackageVersion>
<MicrosoftDotNetCommonItemTemplates60PackageVersion>$(MicrosoftDotNetCommonItemTemplatesPackageVersion)</MicrosoftDotNetCommonItemTemplates60PackageVersion>
<MicrosoftDotNetCommonProjectTemplates60PackageVersion>6.0.110</MicrosoftDotNetCommonProjectTemplates60PackageVersion>
- <AspNetCorePackageVersionFor60Templates>$(MicrosoftAspNetCoreAppRuntimePackageVersion)</AspNetCorePackageVersionFor60Templates>
+ <AspNetCorePackageVersionFor60Templates>$(MicrosoftAspNetCoreAppRuntimePackageVersionBuilt)</AspNetCorePackageVersionFor60Templates>
<!-- 5.0 Template versions -->
<MicrosoftDotnetWinFormsProjectTemplates50PackageVersion>$(MicrosoftWinFormsProjectTemplates50PackageVersion)</MicrosoftDotnetWinFormsProjectTemplates50PackageVersion>
<MicrosoftDotNetWpfProjectTemplates50PackageVersion>$(MicrosoftWPFProjectTemplates50PackageVersion)</MicrosoftDotNetWpfProjectTemplates50PackageVersion>
diff --git a/src/installer/src/redist/targets/GenerateBundledVersions.targets b/src/installer/src/redist/targets/GenerateBundledVersions.targets
index f98379cb9..aa0603e5e 100644
--- a/src/installer/src/redist/targets/GenerateBundledVersions.targets
+++ b/src/installer/src/redist/targets/GenerateBundledVersions.targets
@@ -204,7 +204,7 @@
<GenerateDefaultRuntimeFrameworkVersion RuntimePackVersion="$(MicrosoftWindowsDesktopAppRuntimePackageVersion)">
<Output TaskParameter="DefaultRuntimeFrameworkVersion" PropertyName="MicrosoftWindowsDesktopAppDefaultRuntimeFrameworkVersion" />
</GenerateDefaultRuntimeFrameworkVersion>
- <GenerateDefaultRuntimeFrameworkVersion RuntimePackVersion="$(MicrosoftAspNetCoreAppRuntimePackageVersion)">
+ <GenerateDefaultRuntimeFrameworkVersion RuntimePackVersion="$(MicrosoftAspNetCoreAppRuntimePackageVersionBuilt)">
<Output TaskParameter="DefaultRuntimeFrameworkVersion" PropertyName="MicrosoftAspNetCoreAppDefaultRuntimeFrameworkVersion" />
</GenerateDefaultRuntimeFrameworkVersion>
@@ -365,7 +365,7 @@ Copyright (c) .NET Foundation. All rights reserved.
TargetFramework="net6.0"
RuntimeFrameworkName="Microsoft.AspNetCore.App"
DefaultRuntimeFrameworkVersion="$(MicrosoftAspNetCoreAppDefaultRuntimeFrameworkVersion)"
- LatestRuntimeFrameworkVersion="$(MicrosoftAspNetCoreAppRuntimePackageVersion)"
+ LatestRuntimeFrameworkVersion="$(MicrosoftAspNetCoreAppRuntimePackageVersionBuilt)"
TargetingPackName="Microsoft.AspNetCore.App.Ref"
TargetingPackVersion="$(MicrosoftAspNetCoreAppRefPackageVersion)"
RuntimePackNamePatterns="Microsoft.AspNetCore.App.Runtime.**RID**"
diff --git a/src/installer/src/redist/targets/GenerateDebs.targets b/src/installer/src/redist/targets/GenerateDebs.targets
index f0e7e5d14..610b43182 100644
--- a/src/installer/src/redist/targets/GenerateDebs.targets
+++ b/src/installer/src/redist/targets/GenerateDebs.targets
@@ -61,7 +61,7 @@
<DownloadedHostFxrInstallerFile>$(DownloadsFolder)$(DownloadedHostFxrInstallerFileName)</DownloadedHostFxrInstallerFile>
<SharedHostDebianPackageName>dotnet-host</SharedHostDebianPackageName>
<DownloadedSharedHostInstallerFile>$(DownloadsFolder)$(DownloadedSharedHostInstallerFileName)</DownloadedSharedHostInstallerFile>
- <AspNetCoreSharedFxDebianPackageFileName>aspnetcore-runtime-$(MicrosoftAspNetCoreAppRuntimePackageVersion)</AspNetCoreSharedFxDebianPackageFileName>
+ <AspNetCoreSharedFxDebianPackageFileName>aspnetcore-runtime-$(MicrosoftAspNetCoreAppRuntimePackageVersionBuilt)</AspNetCoreSharedFxDebianPackageFileName>
<AspNetCoreSharedFxDebianPackageFileName>$(AspNetCoreSharedFxDebianPackageFileName.ToLower())</AspNetCoreSharedFxDebianPackageFileName>
<AspNetCoreSharedFxDebianPackageName>aspnetcore-runtime-$(AspNetCoreMajorMinorVersion)</AspNetCoreSharedFxDebianPackageName>
<AspNetCoreSharedFxDebianPackageName>$(AspNetCoreSharedFxDebianPackageName.ToLower())</AspNetCoreSharedFxDebianPackageName>
diff --git a/src/installer/src/redist/targets/GenerateLayout.targets b/src/installer/src/redist/targets/GenerateLayout.targets
index 88a053b61..819142a12 100644
--- a/src/installer/src/redist/targets/GenerateLayout.targets
+++ b/src/installer/src/redist/targets/GenerateLayout.targets
@@ -9,7 +9,7 @@
<!-- Blob storage directories are not stabilized, so these must refer to a package that does not stabilize -->
<!-- In source build, the layout does match, so use the runtime package versions rather than the VS redist versions -->
<AspNetCoreBlobVersion>$(VSRedistCommonAspNetCoreSharedFrameworkx6460PackageVersion)</AspNetCoreBlobVersion>
- <AspNetCoreBlobVersion Condition=" '$(DotNetBuildFromSource)' == 'true' and '$(DotNetBuildOffline)' == 'true' ">$(MicrosoftAspNetCoreAppRuntimePackageVersion)</AspNetCoreBlobVersion>
+ <AspNetCoreBlobVersion Condition=" '$(DotNetBuildFromSource)' == 'true' and '$(DotNetBuildOffline)' == 'true' ">$(MicrosoftAspNetCoreAppRuntimePackageVersionBuilt)</AspNetCoreBlobVersion>
<CoreSetupBlobVersion>$(VSRedistCommonNetCoreSharedFrameworkx6460PackageVersion)</CoreSetupBlobVersion>
<CoreSetupBlobVersion Condition=" '$(DotNetBuildFromSource)' == 'true' and '$(DotNetBuildOffline)' == 'true' ">$(MicrosoftNETCoreAppRuntimePackageVersion)</CoreSetupBlobVersion>
@@ -90,15 +90,15 @@
<AspNetCoreInstallerRid Condition="('$(InstallerExtension)' == '.deb' OR '$(InstallerExtension)' == '.rpm') AND '$(Architecture)' != 'arm64'">x64</AspNetCoreInstallerRid>
<AspNetCoreInstallerRid Condition="'$(InstallerExtension)' == '.rpm' AND '$(Architecture)' == 'arm64'">aarch64</AspNetCoreInstallerRid>
- <DownloadedAspNetCoreSharedFxInstallerFileName Condition=" '$(InstallerExtension)' != '' AND !$([MSBuild]::IsOSPlatform('OSX')) ">aspnetcore-runtime-$(MicrosoftAspNetCoreAppRuntimePackageVersion)-$(AspNetCoreInstallerRid)$(InstallerExtension)</DownloadedAspNetCoreSharedFxInstallerFileName>
+ <DownloadedAspNetCoreSharedFxInstallerFileName Condition=" '$(InstallerExtension)' != '' AND !$([MSBuild]::IsOSPlatform('OSX')) ">aspnetcore-runtime-$(MicrosoftAspNetCoreAppRuntimePackageVersionBuilt)-$(AspNetCoreInstallerRid)$(InstallerExtension)</DownloadedAspNetCoreSharedFxInstallerFileName>
<DownloadedAspNetCoreSharedFxInstallerFileName Condition=" '$(InstallerExtension)' == '.msi' ">aspnetcore-runtime-$(VSRedistCommonAspNetCoreSharedFrameworkx6460PackageVersion)-$(AspNetCoreInstallerRid)$(InstallerExtension)</DownloadedAspNetCoreSharedFxInstallerFileName>
<!-- Note: we use the "-internal" archives and installers that contain only the aspnetcore shared framework, and shouldn't overlap with Microsoft.NETCore.App. -->
- <DownloadedAspNetCoreSharedFxWixLibFileName Condition=" '$(InstallerExtension)' == '.msi' ">aspnetcore-runtime-internal-$(MicrosoftAspNetCoreAppRuntimePackageVersion)-$(AspNetCoreInstallerRid).wixlib</DownloadedAspNetCoreSharedFxWixLibFileName>
+ <DownloadedAspNetCoreSharedFxWixLibFileName Condition=" '$(InstallerExtension)' == '.msi' ">aspnetcore-runtime-internal-$(MicrosoftAspNetCoreAppRuntimePackageVersionBuilt)-$(AspNetCoreInstallerRid).wixlib</DownloadedAspNetCoreSharedFxWixLibFileName>
<DownloadedAspNetTargetingPackInstallerFileName Condition=" '$(InstallerExtension)' != '' ">aspnetcore-targeting-pack-$(MicrosoftAspNetCoreAppRefPackageVersion)-$(AspNetCoreInstallerRid)$(InstallerExtension)</DownloadedAspNetTargetingPackInstallerFileName>
<DownloadedAspNetTargetingPackInstallerFileName Condition=" '$(InstallerExtension)' == '.msi' ">aspnetcore-targeting-pack-$(MicrosoftAspNetCoreAppRefInternalPackageVersion)-$(AspNetCoreInstallerRid)$(InstallerExtension)</DownloadedAspNetTargetingPackInstallerFileName>
- <DownloadedAspNetCoreV2ModuleInstallerFileName Condition=" '$(InstallerExtension)' == '.msi' ">aspnetcoremodule_$(Architecture)_en_v2_$(MicrosoftAspNetCoreAppRuntimePackageVersion)$(InstallerExtension)</DownloadedAspNetCoreV2ModuleInstallerFileName>
+ <DownloadedAspNetCoreV2ModuleInstallerFileName Condition=" '$(InstallerExtension)' == '.msi' ">aspnetcoremodule_$(Architecture)_en_v2_$(MicrosoftAspNetCoreAppRuntimePackageVersionBuilt)$(InstallerExtension)</DownloadedAspNetCoreV2ModuleInstallerFileName>
<AspNetTargetingPackArchiveFileName>aspnetcore-targeting-pack-$(MicrosoftAspNetCoreAppRefPackageVersion)-$(AspNetCoreArchiveRid)$(ArchiveExtension)</AspNetTargetingPackArchiveFileName>
- <AspNetCoreSharedFxArchiveFileName>aspnetcore-runtime-internal-$(MicrosoftAspNetCoreAppRuntimePackageVersion)-$(AspNetCoreArchiveRid)$(ArchiveExtension)</AspNetCoreSharedFxArchiveFileName>
+ <AspNetCoreSharedFxArchiveFileName>aspnetcore-runtime-internal-$(MicrosoftAspNetCoreAppRuntimePackageVersionBuilt)-$(AspNetCoreArchiveRid)$(ArchiveExtension)</AspNetCoreSharedFxArchiveFileName>
<!-- Used to detect if ASP.NET Core is built against the same version of Microsoft.NETCore.App. -->
<AspNetCoreSharedFxBaseRuntimeVersionFileName>aspnetcore_base_runtime.version</AspNetCoreSharedFxBaseRuntimeVersionFileName>
@@ -450,7 +450,7 @@
<UpdateRuntimeConfig
RuntimeConfigPaths="@(ToolRuntimeConfigPath)"
MicrosoftNetCoreAppVersion="$(MicrosoftNETCoreAppRuntimePackageVersion)"
- MicrosoftAspNetCoreAppVersion="$(MicrosoftAspNetCoreAppRuntimePackageVersion)" />
+ MicrosoftAspNetCoreAppVersion="$(MicrosoftAspNetCoreAppRuntimePackageVersionBuilt)" />
</Target>
<Target Name="GenerateVersionFile"
diff --git a/src/installer/src/redist/targets/GenerateMSIs.targets b/src/installer/src/redist/targets/GenerateMSIs.targets
index 483730f3a..cae4a3202 100644
--- a/src/installer/src/redist/targets/GenerateMSIs.targets
+++ b/src/installer/src/redist/targets/GenerateMSIs.targets
@@ -356,7 +356,7 @@
'$(SdkDependencyKeyName)' ^
'$(Architecture)' ^
'$(MicrosoftNETCoreAppRuntimePackageVersion)' ^
- '$(MicrosoftAspNetCoreAppRuntimePackageVersion)' ^
+ '$(MicrosoftAspNetCoreAppRuntimePackageVersionBuilt)' ^
'$(CliProductBandVersion)' ^
-InformationAction Continue " />
<ItemGroup>
diff --git a/src/installer/src/redist/targets/GeneratePKG.targets b/src/installer/src/redist/targets/GeneratePKG.targets
index 39a79152d..322b9831c 100644
--- a/src/installer/src/redist/targets/GeneratePKG.targets
+++ b/src/installer/src/redist/targets/GeneratePKG.targets
@@ -113,7 +113,7 @@
<ReplacementString>$(MicrosoftNETCoreAppRuntimePackageVersion)</ReplacementString>
</ResourcesReplacement>
<ResourcesReplacement Include="{ASPNETCOREVERSION}">
- <ReplacementString>$(MicrosoftAspNetCoreAppRuntimePackageVersion)</ReplacementString>
+ <ReplacementString>$(MicrosoftAspNetCoreAppRuntimePackageVersionBuilt)</ReplacementString>
</ResourcesReplacement>
</ItemGroup>
diff --git a/src/installer/src/redist/targets/LinuxNativeInstallerDependencyVersions.targets b/src/installer/src/redist/targets/LinuxNativeInstallerDependencyVersions.targets
index 82482b22a..e3ac13427 100644
--- a/src/installer/src/redist/targets/LinuxNativeInstallerDependencyVersions.targets
+++ b/src/installer/src/redist/targets/LinuxNativeInstallerDependencyVersions.targets
@@ -11,7 +11,7 @@
<Output TaskParameter="VersionWithTilde" PropertyName="MicrosoftNETCoreAppRefPackageVersionWithTilde" />
</GetLinuxNativeInstallerDependencyVersions>
- <GetLinuxNativeInstallerDependencyVersions PackageVersion="$(MicrosoftAspNetCoreAppRuntimePackageVersion)">
+ <GetLinuxNativeInstallerDependencyVersions PackageVersion="$(MicrosoftAspNetCoreAppRuntimePackageVersionBuilt)">
<Output TaskParameter="VersionWithTilde" PropertyName="AspNetCoreRuntimeVersionWithTilde" />
<Output TaskParameter="MajorMinorVersion" PropertyName="AspNetCoreMajorMinorVersion" />
<Output TaskParameter="MajorMinorVersion" PropertyName="AspNetCoreMajorMinorPatchVersion" />
--
2.38.0

View File

@ -1,4 +1,5 @@
From 3669424e83ce393e2e0ee3f23b5a255c3a11a192 Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/source-build/issues/2780
From: Antoine Martin <dev@ayakael.net>
Date: Wed, 16 Feb 2022 15:59:42 +0000
Subject: [PATCH 1/1] reproducible tarball
@ -11,10 +12,10 @@ sources OfficialBuildId with generic date to be modified later for
build.
---
.../src/Tarball_WriteSourceRepoProperties.cs | 6 ++---
.../tools/SourceBuildArcadeTarball.targets | 9 +++----
.../SourceBuildArcadeTarball_strip-git.sh | 24 +++++++++++++++++++
3 files changed, 32 insertions(+), 7 deletions(-)
.../src/Tarball_WriteSourceRepoProperties.cs | 6 +--
.../tools/SourceBuildArcadeTarball.targets | 9 +++--
.../SourceBuildArcadeTarball_strip-git.sh | 38 +++++++++++++++++++
3 files changed, 46 insertions(+), 7 deletions(-)
create mode 100755 src/SourceBuild/Arcade/tools/SourceBuildArcadeTarball_strip-git.sh
diff --git a/src/installer/src/SourceBuild/Arcade/src/Tarball_WriteSourceRepoProperties.cs b/src/installer/src/SourceBuild/Arcade/src/Tarball_WriteSourceRepoProperties.cs
@ -46,7 +47,7 @@ index b6b2793f3..55d680971 100644
throw new FormatException($"Can't derive a build ID from version {version} (commit count {commitCount}, release {string.Join(";", nugetVersion.Release.Split('-', '.'))})");
diff --git a/src/installer/src/SourceBuild/Arcade/tools/SourceBuildArcadeTarball.targets b/src/installer/src/SourceBuild/Arcade/tools/SourceBuildArcadeTarball.targets
index 76297fd3b..0480b495a 100644
index a516a86cf..eb5858ba3 100644
--- a/src/installer/src/SourceBuild/Arcade/tools/SourceBuildArcadeTarball.targets
+++ b/src/installer/src/SourceBuild/Arcade/tools/SourceBuildArcadeTarball.targets
@@ -15,6 +15,7 @@
@ -62,11 +63,11 @@ index 76297fd3b..0480b495a 100644
<MakeDir Directories="$(TarballFileDir)" Condition=" '$(TarballFileDir)' != '' " />
- <Exec Command="tar --numeric-owner -zcf $(TarballFilePath) -C $(TarballDir) ." />
+ <Exec Command="tar --format=gnu --sort=name --owner=0 --group=0 --numeric-owner --mtime='1990-01-01Z' -zcf $(TarballFilePath) -C $(TarballDir)/.. $(TarballNameDir)" />
+ <Exec Command="tar --format=gnu --sort=name --owner=0 --group=0 --numeric-owner --mtime='1990-01-01Z' -cf $(TarballFilePath) -C $(TarballDir)/.. $(TarballNameDir)" />
<Message Text="Tarball '$(TarballFilePath)' was successfully created from '$(TarballDir)'" Importance="High" />
</Target>
@@ -184,10 +185,10 @@
@@ -189,10 +190,10 @@
Command="git config --file $(TarballRepoSourceDir)/.git/config --add remote.origin.url $(OriginalRepoUri)"
WorkingDirectory="$(RepoRoot)"/>
@ -82,33 +83,45 @@ index 76297fd3b..0480b495a 100644
<Message Text="--> Done Cloning Repo $(SourceBuildRepoName)" Importance="High" />
diff --git a/src/installer/src/SourceBuild/Arcade/tools/SourceBuildArcadeTarball_strip-git.sh b/src/installer/src/SourceBuild/Arcade/tools/SourceBuildArcadeTarball_strip-git.sh
new file mode 100755
index 000000000..4cfcea227
index 000000000..63858732f
--- /dev/null
+++ b/src/installer/src/SourceBuild/Arcade/tools/SourceBuildArcadeTarball_strip-git.sh
@@ -0,0 +1,23 @@
@@ -0,0 +1,38 @@
+#!/bin/bash
+repodir="$1"
+for i in $(find $repodir -name '.git' | sort -r); do
+ if [ -f "$i" ]; then
+ gitdir="${i/\/.git}/$(sed 's/gitdir: //' $i)"
+ commit=$(cat "$gitdir"/HEAD)
+ else
+ gitdir=$i
+ commit=$(git -C "$gitdir/.." rev-parse HEAD)
+ fi
+
+ url="$(grep -m 1 url "$gitdir"/config)"
+ url=${url#*= }
+gitdir="$repodir"/.git
+stripdir="$repodir"/.strip
+mkdir "$stripdir"
+
+ rm -rf "$i"
+ mkdir -p "$i"
+commit=$(git -C "$repodir" rev-parse HEAD)
+url="$(grep -m 1 url "$gitdir"/config)"
+url=${url#*= }
+
+ echo $commit > "$i"/HEAD
+ {
+echo $commit > "$stripdir"/HEAD
+{
+echo "[remote \"origin\"]"
+echo " url = \"$url\""
+} > "$stripdir"/config
+
+if [ -f "$repodir"/.gitmodules ]; then
+ cat "$repodir"/.gitmodules >> "$stripdir"/config
+
+ for subdir in $(find "$gitdir"/modules -type f -name 'config'); do
+ subdir=${subdir/\/config}
+ substripdir="${subdir/.git/.strip}"
+ commit=$(git -C "$subdir" rev-parse HEAD)
+ url="$(grep -m 1 url "$subdir"/config)"
+ url=${url#*= }
+
+ mkdir -p "$substripdir"
+ echo $commit > "$substripdir"/HEAD
+ {
+ echo "[remote \"origin\"]"
+ echo -n "url = \"$url\""
+ } > "$i"/config
+done
--
2.35.1
+ echo " url = \"$url\""
+ } > "$substripdir"/config
+ done
+fi
+
+rm -fR "$gitdir"
+mv "$stripdir" "$gitdir"

View File

@ -1,30 +0,0 @@
From db54f968bc5f0bcb327ca1e5362b314b3d952860 Mon Sep 17 00:00:00 2001
From: Antoine Martin <dev@ayakael.net
Date: Sun, 13 Feb 2022 21:59:46 +0000
Subject: [PATCH 2/2]
installer_forgotten-MicrosoftAspNetCoreAppRuntimePackageVersion-fix
Somewhere along the way, installer forgets MicrosoftAspNetCoreApp-
RuntimePackageVersion, thus expects version 6.0.0 when building 6.0.x.
This reminds installer what version AspNetCoreappRuntime is by
re-setting it as what it is usually set.
---
src/redist/targets/GenerateLayout.targets | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/installer/src/redist/targets/GenerateLayout.targets b/src/installer/src/redist/targets/GenerateLayout.targets
index e05004e17..d3573f401 100644
--- a/src/installer/src/redist/targets/GenerateLayout.targets
+++ b/src/installer/src/redist/targets/GenerateLayout.targets
@@ -96,6 +96,7 @@
<DownloadedAspNetTargetingPackInstallerFileName Condition=" '$(InstallerExtension)' == '.msi' ">aspnetcore-targeting-pack-$(MicrosoftAspNetCoreAppRefInternalPackageVersion)-$(AspNetCoreInstallerRid)$(InstallerExtension)</DownloadedAspNetTargetingPackInstallerFileName>
<DownloadedAspNetCoreV2ModuleInstallerFileName Condition=" '$(InstallerExtension)' == '.msi' ">aspnetcoremodule_$(Architecture)_en_v2_$(MicrosoftAspNetCoreAppRuntimePackageVersion)$(InstallerExtension)</DownloadedAspNetCoreV2ModuleInstallerFileName>
<AspNetTargetingPackArchiveFileName>aspnetcore-targeting-pack-$(MicrosoftAspNetCoreAppRefPackageVersion)-$(AspNetCoreArchiveRid)$(ArchiveExtension)</AspNetTargetingPackArchiveFileName>
+ <MicrosoftAspNetCoreAppRuntimePackageVersion>$(MicrosoftAspNetCoreAppRuntimewinx64PackageVersion)</MicrosoftAspNetCoreAppRuntimePackageVersion>
<AspNetCoreSharedFxArchiveFileName>aspnetcore-runtime-internal-$(MicrosoftAspNetCoreAppRuntimePackageVersion)-$(AspNetCoreArchiveRid)$(ArchiveExtension)</AspNetCoreSharedFxArchiveFileName>
<!-- Used to detect if ASP.NET Core is built against the same version of Microsoft.NETCore.App. -->
--
2.35.1

View File

@ -1,113 +0,0 @@
From a845f840a9d0f770c9851504bbf18bdc16dd58a6 Mon Sep 17 00:00:00 2001
PatchSource: https://github.com/dotnet/installer/pull/13410
From: Antoine Martin <dev@ayakael.net>
Date: Sun, 13 Mar 2022 23:28:21 +0000
Subject: [PATCH 1/1] musl-build-fiox
Musl build fix for installer
---
src/SourceBuild/tarball/content/Directory.Build.props | 4 ++++
src/SourceBuild/tarball/content/Directory.Build.targets | 7 +++++++
src/SourceBuild/tarball/content/repos/aspnetcore.proj | 2 ++
src/SourceBuild/tarball/content/repos/installer.proj | 3 ++-
src/redist/targets/GetRuntimeInformation.targets | 9 +++++++++
5 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/src/installer/src/SourceBuild/tarball/content/Directory.Build.props b/src/installer/src/SourceBuild/tarball/content/Directory.Build.props
index 61cc6ff67..40be008d0 100644
--- a/src/installer/src/SourceBuild/tarball/content/Directory.Build.props
+++ b/src/installer/src/SourceBuild/tarball/content/Directory.Build.props
@@ -171,6 +171,9 @@
</PropertyGroup>
<PropertyGroup>
+ <OSPlatformIsMusl Condition="$(OSPlatformIsMuslCheck) == '0'">true</OSPlatformIsMusl>
+ <OSPlatformIsMusl Condition="$(OSPlatformIsMusl) == ''">true</OSPlatformIsMusl>
+
<TargetRid Condition="'$(TargetRid)' == ''">$([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier)</TargetRid>
<TargetOS Condition="'$(TargetOS)' == '' AND $([MSBuild]::IsOSPlatform('WINDOWS'))">Windows_NT</TargetOS>
@@ -181,6 +184,7 @@
<PortableRid Condition="'$(TargetOS)' == 'FreeBSD'">freebsd-$(Platform)</PortableRid>
<PortableRid Condition="'$(TargetOS)' == 'OSX'">osx-$(Platform)</PortableRid>
<PortableRid Condition="'$(TargetOS)' == 'Linux'">linux-$(Platform)</PortableRid>
+ <PortableRid Condition="'$(TargetOS)' == 'Linux' AND '$(OSPlatformIsMusl)' == 'true'">linux-musl-$(Platform)</PortableRid>
<PortableRid Condition="'$(TargetOS)' == 'Windows_NT'">win-$(Platform)</PortableRid>
<TargetRid Condition="'$(PortableBuild)' == 'true' AND '$(PortableRid)' != ''">$(PortableRid)</TargetRid>
</PropertyGroup>
diff --git a/src/installer/src/SourceBuild/tarball/content/Directory.Build.targets b/src/installer/src/SourceBuild/tarball/content/Directory.Build.targets
index 02ff624bc..c7e3bd141 100644
--- a/src/installer/src/SourceBuild/tarball/content/Directory.Build.targets
+++ b/src/installer/src/SourceBuild/tarball/content/Directory.Build.targets
@@ -10,6 +10,13 @@
</ItemGroup>
</Target>
+ <Target Name="GetOSPlatformIsMuslCheck"
+ BeforeTargets="CollectPackageReferences">
+ <Exec IgnoreExitCode="true" Command="ldd --version 2&gt;&amp;1 | grep -q musl">
+ <Output TaskParameter="ExitCode" PropertyName="OSPlatformIsMuslCheck" />
+ </Exec>
+ </Target>
+
<Import Condition="'$(SkipArcadeSdkImport)' != 'true'" Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" />
</Project>
diff --git a/src/installer/src/SourceBuild/tarball/content/repos/aspnetcore.proj b/src/installer/src/SourceBuild/tarball/content/repos/aspnetcore.proj
index 480f3c713..04694770d 100644
--- a/src/installer/src/SourceBuild/tarball/content/repos/aspnetcore.proj
+++ b/src/installer/src/SourceBuild/tarball/content/repos/aspnetcore.proj
@@ -15,6 +15,8 @@
<!-- https://github.com/dotnet/sdk/pull/20136 has not flowed into our bootstrap SDK yet, which causes file-in-use issues in ASP.NET
due to an interaction with the RemoveSharedFrameworkDependencies task. disable package validation until this is fixed. -->
<BuildCommandArgs>$(BuildCommandArgs) /p:EnablePackageValidation=false</BuildCommandArgs>
+ <!-- below is temporary fix till https://github.com/dotnet/aspnetcore/issues/39822 is addressed -->
+ <BuildCommandArgs Condition="'$(OSPlatformIsMusl)' == 'true'">$(BuildCommandArgs) --os-name linux-musl</BuildCommandArgs>
<BuildCommand>$(ProjectDirectory)\eng\build$(ShellExtension) $(BuildCommandArgs)</BuildCommand>
<LogVerbosityOptOut>true</LogVerbosityOptOut>
diff --git a/src/installer/src/SourceBuild/tarball/content/repos/installer.proj b/src/installer/src/SourceBuild/tarball/content/repos/installer.proj
index e34337b85..587384128 100644
--- a/src/installer/src/SourceBuild/tarball/content/repos/installer.proj
+++ b/src/installer/src/SourceBuild/tarball/content/repos/installer.proj
@@ -25,7 +25,8 @@
<BuildCommandArgs Condition="'$(TargetOS)' == 'Linux'">$(BuildCommandArgs) /p:Rid=$(TargetRid)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:DOTNET_INSTALL_DIR=$(DotNetCliToolDir)</BuildCommandArgs>
- <BuildCommandArgs Condition="'$(TargetOS)' == 'Linux'">$(BuildCommandArgs) /p:AspNetCoreInstallerRid=linux-$(Platform)</BuildCommandArgs>
+ <BuildCommandArgs Condition="'$(TargetOS)' == 'Linux' AND '$(OSPlatformIsMusl)' == 'false'">$(BuildCommandArgs) /p:AspNetCoreInstallerRid=linux-$(Platform)</BuildCommandArgs>
+ <BuildCommandArgs Condition="'$(TargetOS)' == 'Linux' AND '$(OSPlatformIsMusl)' == 'true'">$(BuildCommandArgs) /p:AspNetCoreInstallerRid=linux-musl-$(Platform)</BuildCommandArgs>
<!-- core-sdk always wants to build portable on OSX and FreeBSD -->
<BuildCommandArgs Condition="'$(TargetOS)' == 'FreeBSD'">$(BuildCommandArgs) /p:CoreSetupRid=freebsd-x64 /p:PortableBuild=true</BuildCommandArgs>
<BuildCommandArgs Condition="'$(TargetOS)' == 'OSX'">$(BuildCommandArgs) /p:CoreSetupRid=osx-x64</BuildCommandArgs>
diff --git a/src/installer/src/redist/targets/GetRuntimeInformation.targets b/src/installer/src/redist/targets/GetRuntimeInformation.targets
index 5133c3a38..01ac03776 100644
--- a/src/installer/src/redist/targets/GetRuntimeInformation.targets
+++ b/src/installer/src/redist/targets/GetRuntimeInformation.targets
@@ -1,6 +1,13 @@
<Project>
<Target Name="GetCurrentRuntimeInformation">
+ <Exec IgnoreExitCode="true" Command="ldd --version 2&gt;&amp;1 | grep -q musl">
+ <Output TaskParameter="ExitCode" PropertyName="OSPlatformIsMuslCheck" />
+ </Exec>
+
<PropertyGroup>
+ <OSPlatformIsMusl Condition="$(OSPlatformIsMuslCheck) == '0'">true</OSPlatformIsMusl>
+ <OSPlatformIsMusl Condition="$(OSPlatformIsMusl) == ''">false</OSPlatformIsMusl>
+
<HostRid Condition="'$(HostRid)' == '' and '$(MSBuildRuntimeType)' == 'core'">$([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier)</HostRid>
<HostRid Condition="'$(HostRid)' == '' and '$(MSBuildRuntimeType)' != 'core'">win-$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString().ToLowerInvariant)</HostRid>
@@ -9,6 +16,8 @@
<HostOSName Condition=" '$(HostOSName)' == '' AND $([MSBuild]::IsOSPlatform('OSX')) ">osx</HostOSName>
<HostOSName Condition=" '$(HostOSName)' == '' AND $([MSBuild]::IsOSPlatform('FREEBSD')) ">freebsd</HostOSName>
<HostOSName Condition=" '$(HostOSName)' == '' AND '$(IsLinux)' == 'True' ">linux</HostOSName>
+ <!-- If platform is musl based, adds information to HostOSName -->
+ <HostOSName Condition="$(OSPlatformIsMusl) == 'true'">$(HostOSName)-musl</HostOSName>
<OSName Condition=" '$(OSName)' == '' ">$(HostOSName)</OSName>
--
2.35.1

View File

@ -1,27 +0,0 @@
From c95158d8af9763036f08b6b9550b2f2c16e6858f Mon Sep 17 00:00:00 2001
PatchSource: https://github.com/dotnet/installer/pull/12516
From: Tom Deseyn <tom.deseyn@gmail.com>
Date: Wed, 3 Nov 2021 15:12:59 +0100
Subject: [PATCH] GetRuntimeInformation.targets: determine
PortableProductMonikerRid based on HostOSName and Architecture.
---
.../targets/GetRuntimeInformation.targets | 2 +
1 files changed, 2 insertions(+)
diff --git a/src/installer/src/redist/targets/GetRuntimeInformation.targets b/src/installer/src/redist/targets/GetRuntimeInformation.targets
index 01ac03776..9f6d4d18c 100644
--- a/src/installer/src/redist/targets/GetRuntimeInformation.targets
+++ b/src/installer/src/redist/targets/GetRuntimeInformation.targets
@@ -37,6 +37,8 @@
'$(Rid)' == 'linux-musl-x64' ">$(Rid)</ProductMonikerRid>
<ProductMonikerRid Condition=" '$(ProductMonikerRid)' == '' ">$(OSName)-$(Architecture)</ProductMonikerRid>
+ <PortableProductMonikerRid Condition=" '$(PortableProductMonikerRid)' == '' ">$(HostOSName)-$(Architecture)</PortableProductMonikerRid>
+
<ArtifactNameSdk>dotnet-sdk-internal$(PgoTerm)</ArtifactNameSdk>
<ArtifactNameCombinedHostHostFxrFrameworkSdk>dotnet-sdk$(PgoTerm)</ArtifactNameCombinedHostHostFxrFrameworkSdk>
--
2.35.1

View File

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

View File

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

View File

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

View File

@ -0,0 +1,43 @@
From 5dd8cb4053546eaa1508cf24f96e7c4996a4a189 Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/runtime/pull/60315
From: Eric Erhardt <eric.erhardt@microsoft.com>
Date: Tue, 12 Oct 2021 19:40:56 +0000
Subject: Eliminate usages of pre-built packages during source-build
Mono still has a dependency on (now unbuildable) ILStrip which was removed from CoreCLR
---
diff --git a/src/runtime/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Microsoft.NET.Runtime.MonoTargets.Sdk.pkgproj b/src/runtime/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Microsoft.NET.Runtime.MonoTargets.Sdk.pkgproj
index 724b704f864..3dabdc81dae 100644
--- a/src/runtime/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Microsoft.NET.Runtime.MonoTargets.Sdk.pkgproj
+++ b/src/runtime/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Microsoft.NET.Runtime.MonoTargets.Sdk.pkgproj
@@ -6,7 +6,7 @@
</PropertyGroup>
<ItemGroup>
- <ProjectReference Include="$(RepoTasksDir)ILStripTask\ILStrip.csproj" />
+ <ProjectReference Include="$(RepoTasksDir)ILStripTask\ILStrip.csproj" Condition="'$(DotNetBuildFromSource)' != 'true'" />
<ProjectReference Include="$(RepoTasksDir)RuntimeConfigParser\RuntimeConfigParser.csproj" />
<ProjectReference Include="$(RepoTasksDir)JsonToItemsTaskFactory\JsonToItemsTaskFactory.csproj" />
</ItemGroup>
@@ -15,7 +15,7 @@
<PackageFile Include="Sdk\Sdk.props" TargetPath="Sdk" />
<PackageFile Include="Sdk\Sdk.targets" TargetPath="Sdk" />
<PackageFile Include="build\$(MSBuildProjectName).props" TargetPath="build" />
- <PackageFile Include="Sdk\ILStripTask.props" TargetPath="Sdk" />
+ <PackageFile Include="Sdk\ILStripTask.props" TargetPath="Sdk" Condition="'$(DotNetBuildFromSource)' != 'true'" />
<PackageFile Include="Sdk\RuntimeConfigParserTask.props" TargetPath="Sdk" />
<PackageFile Include="Sdk\RuntimeComponentManifest.props" TargetPath="Sdk" />
<PackageFile Include="Sdk\RuntimeComponentManifest.targets" TargetPath="Sdk" />
diff --git a/src/runtime/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/Sdk.props b/src/runtime/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/Sdk.props
index 8a7ede79242..cfd515eeca9 100644
--- a/src/runtime/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/Sdk.props
+++ b/src/runtime/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/Sdk.props
@@ -1,5 +1,5 @@
<Project>
- <Import Project="$(MSBuildThisFileDirectory)\ILStripTask.props" />
+ <Import Project="$(MSBuildThisFileDirectory)\ILStripTask.props" Condition="'$(DotNetBuildFromSource)' != 'true'" />
<Import Project="$(MSBuildThisFileDirectory)\RuntimeConfigParserTask.props" />
<Import Project="$(MSBuildThisFileDirectory)\RuntimeComponentManifest.props" />
</Project>

View File

@ -0,0 +1,173 @@
From 577a70afa472a2b7aa8e05947e185d920f42b23d Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/runtime/pull/60675
From: Adeel Mujahid <3840695+am11@users.noreply.github.com>
Date: Tue, 2 Nov 2021 17:47:37 +0200
Subject: [PATCH] Fix gcc warnings during mono linux-x64 build (#60675)
* Fix gcc warnings during mono linux-x64 build
main with Debug configuration: 822 warnings - http://sprunge.us/2GzrDE
PR with Debug configuration: 3 warnings related to deprecated sys/sysctl.h includes - http://sprunge.us/JuyA3K
after fixing Debug warnings, there were 13 additional warnings in Release configuration:
http://sprunge.us/PJCivP
PR with Release configuration: (same) 3 warnings - http://sprunge.us/NwKHNE
* Address CR feedback
---
src/mono/cmake/config.h.in | 7 +--
src/mono/cmake/configure.cmake | 40 +++++++++++---
src/mono/cmake/defines-todo.cmake | 1 -
src/mono/mono/eglib/src/runtime/gstr.c | 14 ++---
src/mono/mono/utils/mono-proclib.c | 28 +++++-----
5 files changed, 173 insertions(+), 192 deletions(-)
diff --git a/src/runtime/src/mono/cmake/config.h.in b/src/runtime/src/mono/cmake/config.h.in
index 48a82ec6db8c4..648ad60dd0494 100644
--- a/src/runtime/src/mono/cmake/config.h.in
+++ b/src/runtime/src/mono/cmake/config.h.in
@@ -510,14 +510,11 @@
/* Define to 1 if you have the `strerror_r' function. */
#cmakedefine HAVE_STRERROR_R 1
-/* Define to 1 if strerror_r returns char *. */
-#cmakedefine STRERROR_R_CHAR_P 1
-
/* Have GLIBC_BEFORE_2_3_4_SCHED_SETAFFINITY */
#cmakedefine GLIBC_BEFORE_2_3_4_SCHED_SETAFFINITY 1
/* GLIBC has CPU_COUNT macro in sched.h */
-#cmakedefine GLIBC_HAS_CPU_COUNT 1
+#cmakedefine HAVE_GNU_CPU_COUNT
/* Have large file support */
#cmakedefine HAVE_LARGE_FILE_SUPPORT 1
@@ -712,6 +709,8 @@
/* The size of `size_t', as computed by sizeof. */
#define SIZEOF_SIZE_T @SIZEOF_SIZE_T@
+#cmakedefine01 HAVE_GNU_STRERROR_R
+
/* Define to 1 if the system has the type `struct sockaddr'. */
#cmakedefine HAVE_STRUCT_SOCKADDR 1
diff --git a/src/runtime/src/mono/cmake/configure.cmake b/src/runtime/src/mono/cmake/configure.cmake
index 7bee1c6b98553..e8e9fb9e67d79 100644
--- a/src/runtime/src/mono/cmake/configure.cmake
+++ b/src/runtime/src/mono/cmake/configure.cmake
@@ -135,6 +135,37 @@
check_type_size("long long" SIZEOF_LONG_LONG)
check_type_size("size_t" SIZEOF_SIZE_T)
+if (HOST_LINUX OR HOST_ANDROID)
+ set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
+endif()
+
+check_c_source_compiles(
+ "
+ #include <string.h>
+ int main(void)
+ {
+ char buffer[1];
+ char c = *strerror_r(0, buffer, 0);
+ return 0;
+ }
+ "
+ HAVE_GNU_STRERROR_R)
+
+check_c_source_compiles(
+ "
+ #include <sched.h>
+ int main(void)
+ {
+ CPU_COUNT((void *) 0);
+ return 0;
+ }
+ "
+ HAVE_GNU_CPU_COUNT)
+
+if (HOST_LINUX OR HOST_ANDROID)
+ set(CMAKE_REQUIRED_DEFINITIONS)
+endif()
+
# ICONV
set(ICONV_LIB)
find_library(LIBICONV_FOUND iconv)
@@ -142,14 +173,6 @@
set(ICONV_LIB "iconv")
endif()
-file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test.c
- "#include <sched.h>\n"
- "void main () { CPU_COUNT((void *) 0); }\n"
-)
-try_compile(GLIBC_HAS_CPU_COUNT ${CMAKE_BINARY_DIR}/CMakeTmp SOURCES "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test.c"
- COMPILE_DEFINITIONS "-D_GNU_SOURCE")
-
-
if(HOST_WIN32)
# checking for this doesn't work for some reason, hardcode result
set(HAVE_WINTERNL_H 1)
diff --git a/src/runtime/src/mono/cmake/defines-todo.cmake b/src/runtime/src/mono/cmake/defines-todo.cmake
index d45098d4eea4f..8d2828d53e9ba 100644
--- a/src/runtime/src/mono/cmake/defines-todo.cmake
+++ b/src/runtime/src/mono/cmake/defines-todo.cmake
@@ -4,7 +4,6 @@
#option (MAJOR_IN_MKDEV "Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>.")
#option (MAJOR_IN_SYSMACROS "Define to 1 if `major', `minor', and `makedev' are declared in <sysmacros.h>.")
-#option (STRERROR_R_CHAR_P "Define to 1 if strerror_r returns char *.")
#option (HAVE_LIBICONV "Define to 1 if you have the `iconv' library (-liconv).")
#option (ANDROID_UNIFIED_HEADERS "Whether Android NDK unified headers are used")
#option (MONO_DL_NEED_USCORE "Does dlsym require leading underscore.")
diff --git a/src/runtime/src/mono/mono/eglib/src/runtime/gstr.c b/src/mono/mono/eglib/gstr.c
index c549b241894f1..cbf63d8f02b97 100644
--- a/src/runtime/src/mono/mono/eglib/src/runtime/gstr.c
+++ b/src/runtime/src/mono/mono/eglib/gstr.c
@@ -249,7 +249,11 @@ g_strerror (gint errnum)
size_t buff_len = sizeof (tmp_buff);
buff [0] = 0;
-#ifndef STRERROR_R_CHAR_P
+#if HAVE_GNU_STRERROR_R
+ buff = strerror_r (errnum, buff, buff_len);
+ if (!error_messages [errnum])
+ error_messages [errnum] = g_strdup (buff);
+#else /* HAVE_GNU_STRERROR_R */
int r;
while ((r = strerror_r (errnum, buff, buff_len - 1))) {
if (r != ERANGE) {
@@ -261,17 +265,13 @@ g_strerror (gint errnum)
else
buff = g_realloc (buff, buff_len * 2);
buff_len *= 2;
- //Spec is not clean on whether size argument includes space for null terminator or not
+ //Spec is not clean on whether size argument includes space for null terminator or not
}
if (!error_messages [errnum])
error_messages [errnum] = g_strdup (buff);
if (buff != tmp_buff)
g_free (buff);
-#else /* STRERROR_R_CHAR_P */
- buff = strerror_r (errnum, buff, buff_len);
- if (!error_messages [errnum])
- error_messages [errnum] = g_strdup (buff);
-#endif /* STRERROR_R_CHAR_P */
+#endif /* HAVE_GNU_STRERROR_R */
#else /* HAVE_STRERROR_R */
if (!error_messages [errnum])
diff --git a/src/runtime/src/mono/mono/utils/mono-proclib.c b/src/runtime/src/mono/mono/utils/mono-proclib.c
index 1fe731d9fe0f5..9a33fc2924e6b 100644
--- a/src/runtime/src/mono/mono/utils/mono-proclib.c
+++ b/src/runtime/src/mono/mono/utils/mono-proclib.c
@@ -81,7 +81,7 @@
#endif
#ifdef HAVE_SCHED_GETAFFINITY
-# ifndef GLIBC_HAS_CPU_COUNT
+# ifndef HAVE_GNU_CPU_COUNT
static int
CPU_COUNT(cpu_set_t *set)
{

View File

@ -0,0 +1,45 @@
From 229c9d2c4371f68fad3bfe7ba50f6db87d493e71 Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/runtime/pull/66594
From: Omair Majid <omajid@redhat.com>
Date: Mon, 14 Mar 2022 12:09:04 -0400
Subject: [PATCH] Fix KeepNativeSymbols to work on mono as well
When packaging .NET on s390x through source-build, we want to keep debug
symbols enabled in the build. The package manager (debbuild, rpmbuild,
etc) generally strips the binaries to create distro-standard
-debug/-debuginfo packages. This was supported in coreclr via
--keepnativesymbols flag, but wasn't supported in mono (ie, s390x). Fix
that.
---
src/mono/mono.proj | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/runtime/src/mono/mono.proj b/src/runtime/src/mono/mono.proj
index fb98ffc1896..d6a0c9a8ec2 100644
--- a/src/runtime/src/mono/mono.proj
+++ b/src/runtime/src/mono/mono.proj
@@ -519,17 +519,17 @@
<!-- if all else fails in finding a valid objcopy, fall back to no-prefix from $PATH (used for x64 on CentOS) -->
<_Objcopy Condition="'$(_ObjcopyFound)' != '0'">objcopy</_Objcopy>
</PropertyGroup>
- <ItemGroup>
+ <ItemGroup Condition="'$(KeepNativeSymbols)' != 'true'">
<FilesToStrip Include="$(_MonoRuntimeFilePath)" />
<FilesToStrip Include="$([System.IO.Directory]::GetParent($(_MonoRuntimeFilePath)))\libmono-component-*$(SharedLibExt)" />
<FilesToStrip Include="$([System.IO.Directory]::GetParent($(_MonoRuntimeFilePath)))\Mono*framework\**\Mono*" Exclude="$([System.IO.Directory]::GetParent($(_MonoRuntimeFilePath)))\Mono*framework\**\*.dwarf" />
</ItemGroup>
- <Message Condition="'$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ($([MSBuild]::IsOSPlatform('OSX')) or $([MSBuild]::IsOSPlatform('Linux')))" Text="Stripping debug symbols from %(FilesToStrip.Identity)" Importance="High"/>
- <Exec Condition="!$([System.String]::Copy(%(FilesToStrip.Identity)).EndsWith('.a')) and '$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ('$(TargetsOSX)' == 'true' or '$(TargetsMacCatalyst)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true')" Command="dsymutil --flat --minimize %(FilesToStrip.Identity)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)"/>
- <Exec Condition="!$([System.String]::Copy(%(FilesToStrip.Identity)).EndsWith('.a')) and '$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ('$(TargetsOSX)' == 'true' or '$(TargetsMacCatalyst)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true')" Command="strip -no_code_signature_warning -S %(FilesToStrip.Identity)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)"/>
- <Exec Condition="!$([System.String]::Copy(%(FilesToStrip.Identity)).EndsWith('.a')) and '$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ('$(TargetsLinux)' == 'true' or '$(TargetsAndroid)' == 'true')" Command="$(_Objcopy) --only-keep-debug %(FilesToStrip.Identity) %(FilesToStrip.Identity).dbg" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)"/>
- <Exec Condition="!$([System.String]::Copy(%(FilesToStrip.Identity)).EndsWith('.a')) and '$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ('$(TargetsLinux)' == 'true' or '$(TargetsAndroid)' == 'true')" Command="$(_Objcopy) --strip-unneeded %(FilesToStrip.Identity)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)"/>
- <Exec Condition="!$([System.String]::Copy(%(FilesToStrip.Identity)).EndsWith('.a')) and '$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ('$(TargetsLinux)' == 'true' or '$(TargetsAndroid)' == 'true')" Command="$(_Objcopy) --add-gnu-debuglink=%(FilesToStrip.Identity).dbg %(FilesToStrip.Identity)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)"/>
+ <Message Condition="'@(FilesToStrip)' != '' and '$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ($([MSBuild]::IsOSPlatform('OSX')) or $([MSBuild]::IsOSPlatform('Linux')))" Text="Stripping debug symbols from %(FilesToStrip.Identity)" Importance="High"/>
+ <Exec Condition="'@(FilesToStrip)' != '' and !$([System.String]::Copy(%(FilesToStrip.Identity)).EndsWith('.a')) and '$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ('$(TargetsOSX)' == 'true' or '$(TargetsMacCatalyst)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true')" Command="dsymutil --flat --minimize %(FilesToStrip.Identity)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)"/>
+ <Exec Condition="'@(FilesToStrip)' != '' and !$([System.String]::Copy(%(FilesToStrip.Identity)).EndsWith('.a')) and '$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ('$(TargetsOSX)' == 'true' or '$(TargetsMacCatalyst)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true')" Command="strip -no_code_signature_warning -S %(FilesToStrip.Identity)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)"/>
+ <Exec Condition="'@(FilesToStrip)' != '' and !$([System.String]::Copy(%(FilesToStrip.Identity)).EndsWith('.a')) and '$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ('$(TargetsLinux)' == 'true' or '$(TargetsAndroid)' == 'true')" Command="$(_Objcopy) --only-keep-debug %(FilesToStrip.Identity) %(FilesToStrip.Identity).dbg" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)"/>
+ <Exec Condition="'@(FilesToStrip)' != '' and !$([System.String]::Copy(%(FilesToStrip.Identity)).EndsWith('.a')) and '$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ('$(TargetsLinux)' == 'true' or '$(TargetsAndroid)' == 'true')" Command="$(_Objcopy) --strip-unneeded %(FilesToStrip.Identity)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)"/>
+ <Exec Condition="'@(FilesToStrip)' != '' and !$([System.String]::Copy(%(FilesToStrip.Identity)).EndsWith('.a')) and '$(BuildMonoAOTCrossCompilerOnly)' != 'true' and ('$(TargetsLinux)' == 'true' or '$(TargetsAndroid)' == 'true')" Command="$(_Objcopy) --add-gnu-debuglink=%(FilesToStrip.Identity).dbg %(FilesToStrip.Identity)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoObjDir)"/>
</Target>
<!-- Build AOT cross compiler (if available) -->

View File

@ -1,4 +1,5 @@
From 992cf8c97cc71d4ca9a0a11e6604a6716ed4cefc Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/runtime/pull/73065/files
From: Adeel Mujahid <3840695+am11@users.noreply.github.com>
Date: Fri, 29 Jul 2022 19:34:00 +0300
Subject: [PATCH] Define __cpuid{ex} only when there's no builtin one (#73065)

View File

@ -0,0 +1,217 @@
From 45a8ea8332796816e943ce652d2d00f75705266c Mon Sep 17 00:00:00 2001
From: Tom Deseyn <tom.deseyn@gmail.com>
Date: Fri, 26 Aug 2022 13:09:17 +0200
Subject: [PATCH 01/20] Pass SourceBuild TargetRid and SourceBuildPortable args
through the native script.
---
src/runtime/eng/SourceBuild.props | 21 ++++++++++++-------
src/runtime/eng/build.sh | 10 +++++++++
.../common/templates/steps/source-build.yml | 6 ++++++
src/runtime/eng/native/build-commons.sh | 15 +++++++++++++
.../eng/pipelines/common/global-build-job.yml | 2 ++
src/runtime/src/native/corehost/build.sh | 7 +++----
src/runtime/src/native/corehost/corehost.proj | 1 +
7 files changed, 51 insertions(+), 11 deletions(-)
diff --git a/src/runtime/eng/SourceBuild.props b/src/runtime/eng/SourceBuild.props
index b70f668a1..9e9396585 100644
--- a/src/runtime/eng/SourceBuild.props
+++ b/src/runtime/eng/SourceBuild.props
@@ -11,14 +11,20 @@
<SourceBuildPortable>true</SourceBuildPortable>
<SourceBuildPortable Condition="'$(SourceBuildNonPortable)' == 'true'">false</SourceBuildPortable>
- <!-- If TargetRid not specified, detect RID based on portability. -->
+ <!-- TargetRid names what gets built. -->
<TargetRid Condition="'$(TargetRid)' == '' and '$(SourceBuildNonPortable)' == 'true'">$([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier)</TargetRid>
<TargetRid Condition="'$(TargetRid)' == ''">$(__DistroRid)</TargetRid>
<!-- Split e.g. 'fedora.33-x64' into 'fedora.33' and 'x64'. -->
<_targetRidPlatformIndex>$(TargetRid.LastIndexOfAny("-"))</_targetRidPlatformIndex>
- <TargetRidWithoutPlatform>$(TargetRid.Substring(0, $(_targetRidPlatformIndex)))</TargetRidWithoutPlatform>
- <TargetRidPlatform>$(TargetRid.Substring($(_targetRidPlatformIndex)).TrimStart('-'))</TargetRidPlatform>
+ <TargetArch>$(TargetRid.Substring($(_targetRidPlatformIndex)).TrimStart('-'))</TargetArch>
+
+ <!-- RuntimeOS is the build host rid OS. -->
+ <RuntimeOS>$(TargetRid.Substring(0, $(_targetRidPlatformIndex)))</RuntimeOS>
+
+ <!-- BaseOS is an expected known rid in the graph that TargetRid is compatible with.
+ It's used to add TargetRid in the graph if the parent can't be detected. -->
+ <BaseOS>$(RuntimeOS)</BaseOS>
<LogVerbosity Condition="'$(LogVerbosity)' == ''">minimal</LogVerbosity>
</PropertyGroup>
@@ -26,19 +32,20 @@
<Target Name="GetRuntimeSourceBuildCommandConfiguration"
BeforeTargets="GetSourceBuildCommandConfiguration">
<PropertyGroup>
- <InnerBuildArgs>$(InnerBuildArgs) --arch $(TargetRidPlatform)</InnerBuildArgs>
+ <InnerBuildArgs>$(InnerBuildArgs) --arch $(TargetArch)</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) --configuration $(Configuration)</InnerBuildArgs>
<InnerBuildArgs Condition="'$(SourceBuildNonPortable)' == 'true'">$(InnerBuildArgs) --allconfigurations</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) --verbosity $(LogVerbosity)</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) --nodereuse false</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) --warnAsError false</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) /p:MicrosoftNetFrameworkReferenceAssembliesVersion=1.0.2</InnerBuildArgs>
- <InnerBuildArgs>$(InnerBuildArgs) /p:PackageRid=$(TargetRid)</InnerBuildArgs>
+ <InnerBuildArgs>$(InnerBuildArgs) --outputrid $(TargetRid)</InnerBuildArgs>
+ <InnerBuildArgs>$(InnerBuildArgs) --portablebuild $(SourceBuildPortable)</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) /p:NoPgoOptimize=true</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) /p:KeepNativeSymbols=true</InnerBuildArgs>
- <InnerBuildArgs>$(InnerBuildArgs) /p:RuntimeOS=$(TargetRidWithoutPlatform)</InnerBuildArgs>
- <InnerBuildArgs>$(InnerBuildArgs) /p:PortableBuild=$(SourceBuildPortable)</InnerBuildArgs>
+ <InnerBuildArgs>$(InnerBuildArgs) /p:RuntimeOS=$(RuntimeOS)</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) /p:BuildDebPackage=false</InnerBuildArgs>
+ <InnerBuildArgs>$(InnerBuildArgs) /p:RuntimeOS=$(RuntimeOS)</InnerBuildArgs>
</PropertyGroup>
</Target>
diff --git a/src/runtime/eng/build.sh b/src/runtime/eng/build.sh
index 8836bde10..ea6be90af 100755
--- a/src/runtime/eng/build.sh
+++ b/src/runtime/eng/build.sh
@@ -31,6 +31,7 @@ usage()
echo " --os Target operating system: windows, Linux, FreeBSD, OSX, MacCatalyst, tvOS,"
echo " tvOSSimulator, iOS, iOSSimulator, Android, Browser, NetBSD, illumos or Solaris."
echo " [Default: Your machine's OS.]"
+ echo " --outputrid <rid> Optional argument that overrides the target rid name."
echo " --projects <value> Project or solution file(s) to build."
echo " --runtimeConfiguration (-rc) Runtime build configuration: Debug, Release or Checked."
echo " Checked is exclusive to the CLR runtime. It is the same as Debug, except code is"
@@ -400,6 +401,15 @@ while [[ $# > 0 ]]; do
shift 1
;;
+ -outputrid)
+ if [ -z ${2+x} ]; then
+ echo "No value for outputrid is supplied. See help (--help) for supported values." 1>&2
+ exit 1
+ fi
+ arguments="$arguments /p:OutputRid=$(echo "$2" | tr "[:upper:]" "[:lower:]")"
+ shift 2
+ ;;
+
-portablebuild)
if [ -z ${2+x} ]; then
echo "No value for portablebuild is supplied. See help (--help) for supported values." 1>&2
diff --git a/src/runtime/eng/common/templates/steps/source-build.yml b/src/runtime/eng/common/templates/steps/source-build.yml
index abb1b2bcd..b5b3e5aeb 100644
--- a/src/runtime/eng/common/templates/steps/source-build.yml
+++ b/src/runtime/eng/common/templates/steps/source-build.yml
@@ -63,6 +63,11 @@ steps:
targetRidArgs='/p:TargetRid=${{ parameters.platform.targetRID }}'
fi
+ runtimeOsArgs=
+ if [ '${{ parameters.platform.runtimeOS }}' != '' ]; then
+ runtimeOsArgs='/p:RuntimeOS=${{ parameters.platform.runtimeOS }}'
+ fi
+
publishArgs=
if [ '${{ parameters.platform.skipPublishValidation }}' != 'true' ]; then
publishArgs='--publish'
@@ -75,6 +80,7 @@ steps:
$internalRuntimeDownloadArgs \
$internalRestoreArgs \
$targetRidArgs \
+ $runtimeOsArgs \
/p:SourceBuildNonPortable=${{ parameters.platform.nonPortable }} \
/p:ArcadeBuildFromSource=true
displayName: Build
diff --git a/src/runtime/eng/native/build-commons.sh b/src/runtime/eng/native/build-commons.sh
index 9600e346b..85a6f50ec 100755
--- a/src/runtime/eng/native/build-commons.sh
+++ b/src/runtime/eng/native/build-commons.sh
@@ -246,6 +246,7 @@ usage()
echo "-msbuildonunsupportedplatform: build managed binaries even if distro is not officially supported."
echo "-ninja: target ninja instead of GNU make"
echo "-numproc: set the number of build processes."
+ echo "-outputrid: optional argument that overrides the target rid name."
echo "-portablebuild: pass -portablebuild=false to force a non-portable build."
echo "-skipconfigure: skip build configuration."
echo "-skipgenerateversion: disable version generation even if MSBuild is supported."
@@ -268,6 +269,7 @@ __HostArch=$arch
__TargetOS=$os
__HostOS=$os
__BuildOS=$os
+__OutputRid=''
__msbuildonunsupportedplatform=0
@@ -443,6 +445,16 @@ while :; do
__BuildArch=wasm
;;
+ outputrid|-outputrid)
+ if [[ -n "$2" ]]; then
+ __OutputRid="$2"
+ shift
+ else
+ echo "ERROR: 'outputrid' requires a non-empty option argument"
+ exit 1
+ fi
+ ;;
+
os|-os)
if [[ -n "$2" ]]; then
__TargetOS="$2"
@@ -508,5 +520,8 @@ fi
# init the target distro name
initTargetDistroRid
+if [ -z "$__OutputRid" ]; then
+ __OutputRid="$(echo $__DistroRid | tr '[:upper:]' '[:lower:]')"
+fi
# Init if MSBuild for .NET Core is supported for this platform
isMSBuildOnNETCoreSupported
diff --git a/src/runtime/eng/pipelines/common/global-build-job.yml b/src/runtime/eng/pipelines/common/global-build-job.yml
index c5d913a46..1dcd4aa5a 100644
--- a/src/runtime/eng/pipelines/common/global-build-job.yml
+++ b/src/runtime/eng/pipelines/common/global-build-job.yml
@@ -129,6 +129,8 @@ jobs:
platform:
buildScript: $(_sclEnableCommand) $(Build.SourcesDirectory)$(dir)build$(scriptExt)
nonPortable: true
+ targetRID: banana.24-x64
+ runtimeOS: linux
- ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS', 'MacCatalyst') }}:
- script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }} ${{ parameters.archType }} azDO
diff --git a/src/runtime/src/native/corehost/build.sh b/src/runtime/src/native/corehost/build.sh
index 3aa6820e7..4d7828a00 100755
--- a/src/runtime/src/native/corehost/build.sh
+++ b/src/runtime/src/native/corehost/build.sh
@@ -83,14 +83,13 @@ __LogsDir="$__RootBinDir/log"
__MsbuildDebugLogsDir="$__LogsDir/MsbuildDebugLogs"
# Set the remaining variables based upon the determined build configuration
-__DistroRidLower="$(echo $__DistroRid | tr '[:upper:]' '[:lower:]')"
-__BinDir="$__RootBinDir/bin/$__DistroRidLower.$__BuildType"
-__IntermediatesDir="$__RootBinDir/obj/$__DistroRidLower.$__BuildType"
+__BinDir="$__RootBinDir/bin/$__OutputRid.$__BuildType"
+__IntermediatesDir="$__RootBinDir/obj/$__OutputRid.$__BuildType"
export __BinDir __IntermediatesDir __CoreClrArtifacts __RuntimeFlavor
__CMakeArgs="-DCLI_CMAKE_HOST_VER=\"$__host_ver\" -DCLI_CMAKE_COMMON_HOST_VER=\"$__apphost_ver\" -DCLI_CMAKE_HOST_FXR_VER=\"$__fxr_ver\" $__CMakeArgs"
-__CMakeArgs="-DCLI_CMAKE_HOST_POLICY_VER=\"$__policy_ver\" -DCLI_CMAKE_PKG_RID=\"$__DistroRid\" -DCLI_CMAKE_COMMIT_HASH=\"$__commit_hash\" $__CMakeArgs"
+__CMakeArgs="-DCLI_CMAKE_HOST_POLICY_VER=\"$__policy_ver\" -DCLI_CMAKE_PKG_RID=\"$__OutputRid\" -DCLI_CMAKE_COMMIT_HASH=\"$__commit_hash\" $__CMakeArgs"
__CMakeArgs="-DRUNTIME_FLAVOR=\"$__RuntimeFlavor\" $__CMakeArgs"
__CMakeArgs="-DFEATURE_DISTRO_AGNOSTIC_SSL=$__PortableBuild $__CMakeArgs"
diff --git a/src/runtime/src/native/corehost/corehost.proj b/src/runtime/src/native/corehost/corehost.proj
index ba630e8d2..004358388 100644
--- a/src/runtime/src/native/corehost/corehost.proj
+++ b/src/runtime/src/native/corehost/corehost.proj
@@ -33,6 +33,7 @@
<BuildArgs Condition="'$(Ninja)' == 'true'">$(BuildArgs) -ninja</BuildArgs>
<BuildArgs>$(BuildArgs) -runtimeflavor $(RuntimeFlavor)</BuildArgs>
<BuildArgs Condition="'$(OfficialBuildId)' != ''">$(BuildArgs) /p:OfficialBuildId="$(OfficialBuildId)"</BuildArgs>
+ <BuildArgs>$(BuildArgs) -outputrid $(OutputRid)</BuildArgs>
</PropertyGroup>
<!--
--
2.38.0

View File

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

View File

@ -0,0 +1,83 @@
From c9f12d2718f68b94e63bbdece29bee61c643e497 Mon Sep 17 00:00:00 2001
From: Tom Deseyn <tom.deseyn@gmail.com>
Date: Fri, 23 Sep 2022 14:49:55 +0200
Subject: [PATCH 1/6] Use generated runtime.json when building shared framework
packages.
---
src/runtime/Directory.Build.props | 1 -
src/runtime/eng/liveBuilds.targets | 4 +++-
.../src/Microsoft.NETCore.Platforms.csproj | 6 +++---
src/runtime/src/libraries/pretest.proj | 2 +-
4 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/runtime/Directory.Build.props b/src/runtime/Directory.Build.props
index c815af204..790ee76a3 100644
--- a/src/runtime/Directory.Build.props
+++ b/src/runtime/Directory.Build.props
@@ -253,7 +253,6 @@
<PackageProjectUrl>https://dot.net</PackageProjectUrl>
<Owners>microsoft,dotnetframework</Owners>
<IncludeSymbols>true</IncludeSymbols>
- <RuntimeIdGraphDefinitionFile>$([MSBuild]::NormalizePath('$(LibrariesProjectRoot)', 'Microsoft.NETCore.Platforms', 'src', 'runtime.json'))</RuntimeIdGraphDefinitionFile>
<LicenseFile>$(MSBuildThisFileDirectory)LICENSE.TXT</LicenseFile>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
diff --git a/src/runtime/eng/liveBuilds.targets b/src/runtime/eng/liveBuilds.targets
index d62f4bcd4..0834d63b1 100644
--- a/src/runtime/eng/liveBuilds.targets
+++ b/src/runtime/eng/liveBuilds.targets
@@ -193,6 +193,8 @@
</Target>
<PropertyGroup>
- <BundledRuntimeIdentifierGraphFile>$(RuntimeIdGraphDefinitionFile)</BundledRuntimeIdentifierGraphFile>
+ <!-- Keep in sync with outputs defined in Microsoft.NETCore.Platforms.csproj. -->
+ <BundledRuntimeIdentifierGraphFile>$([MSBuild]::NormalizePath('$(ArtifactsBinDir)', 'Microsoft.NETCore.Platforms', 'runtime.json'))</BundledRuntimeIdentifierGraphFile>
+ <BundledRuntimeIdentifierGraphFile Condition="!Exists('$(BundledRuntimeIdentifierGraphFile)')">$([MSBuild]::NormalizePath('$(LibrariesProjectRoot)', 'Microsoft.NETCore.Platforms', 'src', 'runtime.json'))</BundledRuntimeIdentifierGraphFile>
</PropertyGroup>
</Project>
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 262b0aae1..637bc8261 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
@@ -41,7 +41,7 @@
<ItemGroup>
<Content Condition="'$(AdditionalRuntimeIdentifiers)' == ''" Include="runtime.json" PackagePath="/" />
- <Content Condition="'$(AdditionalRuntimeIdentifiers)' != ''" Include="$(IntermediateOutputPath)runtime.json" PackagePath="/" />
+ <Content Condition="'$(AdditionalRuntimeIdentifiers)' != ''" Include="$(BaseOutputPath)runtime.json" PackagePath="/" />
<Content Include="$(PlaceholderFile)" PackagePath="lib/netstandard1.0" />
</ItemGroup>
@@ -50,12 +50,12 @@
<PackageReference Include="NuGet.ProjectModel" Version="$(NugetProjectModelVersion)" />
</ItemGroup>
- <Target Name="GenerateRuntimeJson" Condition="'$(AdditionalRuntimeIdentifiers)' != ''" BeforeTargets="GenerateNuspec">
+ <Target Name="GenerateRuntimeJson" AfterTargets="Build" Condition="'$(AdditionalRuntimeIdentifiers)' != ''">
<MakeDir Directories="$(IntermediateOutputPath)" />
<GenerateRuntimeGraph RuntimeGroups="@(RuntimeGroupWithQualifiers)"
AdditionalRuntimeIdentifiers="$(AdditionalRuntimeIdentifiers)"
AdditionalRuntimeIdentifierParent="$(AdditionalRuntimeIdentifierParent)"
- RuntimeJson="$(IntermediateOutputPath)runtime.json"
+ RuntimeJson="$(BaseOutputPath)runtime.json"
UpdateRuntimeFiles="True" />
</Target>
diff --git a/src/runtime/src/libraries/pretest.proj b/src/runtime/src/libraries/pretest.proj
index fc2fee13d..ee9473523 100644
--- a/src/runtime/src/libraries/pretest.proj
+++ b/src/runtime/src/libraries/pretest.proj
@@ -92,7 +92,7 @@
Condition="'$(BuildTargetFramework)' == '$(NetCoreAppCurrent)' or '$(BuildTargetFramework)' == ''">
<!-- Shared framework deps file generation. Produces a test shared-framework deps file. -->
<GenerateTestSharedFrameworkDepsFile SharedFrameworkDirectory="$(NetCoreAppCurrentTestHostSharedFrameworkPath)"
- RuntimeGraphFiles="$(RuntimeIdGraphDefinitionFile)"
+ RuntimeGraphFiles="$(BundledRuntimeIdentifierGraphFile)"
TargetRuntimeIdentifier="$(PackageRID)" />
</Target>
--
2.38.0

View File

@ -0,0 +1,130 @@
From f54977e2fc84527fe58024ed5537cb63244168e2 Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/installer/pull/14549
From: Tom Deseyn <tom.deseyn@gmail.com>
Date: Tue, 13 Sep 2022 14:17:35 +0200
Subject: [PATCH 1/1]
installer_14549-rename-MicrosoftAspNetCoreAppRuntimePackageVersion.patch
Wrong version of aspnetcore-runtime-internal is pulled by installer when
building source-build on Alpine Linux. This is due to a workaround on
osx and windows that breaks on Alpine, patch renames variable to go
around workaround.
---
.../src/coreclr/pal/src/misc/perfjitdump.cpp | 2 +-
src/runtime/src/mono/mono.proj | 20 +++++++++----------
.../src/mono/mono/mini/exceptions-s390x.c | 1 -
.../src/mono/mono/utils/mono-context.h | 8 ++++++++
6 files changed, 26 insertions(+), 14 deletions(-)
diff --git a/src/runtime/src/coreclr/pal/src/misc/perfjitdump.cpp b/src/runtime/src/coreclr/pal/src/misc/perfjitdump.cpp
index cc8d46ef1..f7d43b5ce 100644
--- a/src/runtime/src/coreclr/pal/src/misc/perfjitdump.cpp
+++ b/src/runtime/src/coreclr/pal/src/misc/perfjitdump.cpp
@@ -25,7 +25,7 @@
#include <sys/uio.h>
#include <time.h>
#include <unistd.h>
-#include <linux/limits.h>
+#include <limits.h>
#include "../inc/llvm/ELF.h"
diff --git a/src/runtime/src/mono/mono/utils/mono-context.h b/src/runtime/src/mono/mono/utils/mono-context.h
index a1f0fe6f6..a9db2d336 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/mono/mono.proj b/src/runtime/src/mono/mono.proj
index fb98ffc1896..6c40dd8d8dd 100644
--- a/src/runtime/src/mono/mono.proj
+++ b/src/runtme/src/mono/mono.proj
@@ -417,11 +417,19 @@
<!-- Linux options -->
<ItemGroup Condition="'$(TargetsLinux)' == true">
<_MonoCFLAGS Include="-Wl,--build-id=sha1" />
+ <_MonoCFLAGS Include="-Wno-strict-prototypes" />
+ <_MonoCFLAGS Include="-lucontext" />
<_MonoCXXFLAGS Include="-Wl,--build-id=sha1" />
+ <_MonoCXXFLAGS Include="-Wno-strict-prototypes" />
+ <_MonoCXXFLAGS Include="-lucontext" />
</ItemGroup>
<ItemGroup Condition="'$(RealTargetOS)' == 'Linux'">
<_MonoAOTCFLAGS Include="-Wl,--build-id=sha1" />
+ <_MonoAOTCFLAGS Include="-Wno-strict-prototypes" />
+ <_MonoAOTCFLAGS Include="-lucontext" />
<_MonoAOTCXXFLAGS Include="-Wl,--build-id=sha1" />
+ <_MonoAOTCXXFLAGS Include="-Wno-strict-prototypes" />
+ <_MonoAOTCXXFLAGS Include="-lucontext" />
</ItemGroup>
<!-- Devloop features -->
@@ -500,15 +504,15 @@
<MonoToolchainPrebuiltOS Condition="$([MSBuild]::IsOSPlatform('OSX'))">darwin-x86_64</MonoToolchainPrebuiltOS>
<MonoToolchainPrebuiltOS Condition="'$(OS)' == 'Windows_NT'">windows-x86_64</MonoToolchainPrebuiltOS>
<_MonoRuntimeFilePath>$(MonoObjDir)out\lib\$(MonoFileName)</_MonoRuntimeFilePath>
- <_LinuxAbi Condition="'$(TargetsAndroid)' != 'true'">gnu</_LinuxAbi>
- <_LinuxAbi Condition="'$(TargetsAndroid)' == 'true'">android</_LinuxAbi>
+ <_LinuxAbi Condition="'$(TargetsAndroid)' != 'true'">alpine-linux-musl</_LinuxAbi>
+ <_LinuxAbi Condition="'$(TargetsAndroid)' == 'true'">linux-android</_LinuxAbi>
<_LinuxFloatAbi Condition="'$(TargetsAndroid)' != 'true'">hf</_LinuxFloatAbi>
<_Objcopy>objcopy</_Objcopy>
- <_Objcopy Condition="'$(Platform)' == 'arm'">arm-linux-$(_LinuxAbi)eabi$(_LinuxFloatAbi)-$(_Objcopy)</_Objcopy>
- <_Objcopy Condition="'$(Platform)' == 'arm64'">aarch64-linux-$(_LinuxAbi)-$(_Objcopy)</_Objcopy>
- <_Objcopy Condition="'$(Platform)' == 's390x'">s390x-linux-$(_LinuxAbi)-$(_Objcopy)</_Objcopy>
- <_Objcopy Condition="'$(Platform)' == 'x64'">x86_64-linux-$(_LinuxAbi)-$(_Objcopy)</_Objcopy>
- <_Objcopy Condition="'$(Platform)' == 'x86'">i686-linux-$(_LinuxAbi)-$(_Objcopy)</_Objcopy>
+ <_Objcopy Condition="'$(Platform)' == 'arm' and '$(CrossBuild)' == 'true'">arm-$(_LinuxAbi)eabi$(_LinuxFloatAbi)-$(_Objcopy)</_Objcopy>
+ <_Objcopy Condition="'$(Platform)' == 'arm64' and '$(CrossBuild)' == 'true'">aarch64-$(_LinuxAbi)-$(_Objcopy)</_Objcopy>
+ <_Objcopy Condition="'$(Platform)' == 's390x' and '$(CrossBuild)' == 'true'">s390x-$(_LinuxAbi)-$(_Objcopy)</_Objcopy>
+ <_Objcopy Condition="'$(Platform)' == 'x64' and '$(CrossBuild)' == 'true'">x86_64-$(_LinuxAbi)-$(_Objcopy)</_Objcopy>
+ <_Objcopy Condition="'$(Platform)' == 'x86' and '$(CrossBuild)' == 'true'">i686-$(_LinuxAbi)-$(_Objcopy)</_Objcopy>
<_Objcopy Condition="'$(TargetsAndroid)' == 'true'">$(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/$(MonoToolchainPrebuiltOS)/bin/$(_Objcopy)</_Objcopy>
</PropertyGroup>
<!-- test viability of objcopy command -->
diff --git a/src/runtime/src/mono/mono/metadata/domain.c b/src/runtime/src/mono/mono/metadata/domain.c
index 4a8e06d28a..920fdb34dd 100644
--- a/src/runtime/src/mono/mono/metadata/domain.c
+++ b/src/runtime/src/mono/mono/metadata/domain.c
@@ -138,6 +138,14 @@ create_root_domain (void)
return domain;
}
+static MONO_NO_OPTIMIZATION MONO_NEVER_INLINE void
+ensure_stack_size (void)
+{
+ const int default_size = 5 * 1024 * 1024;
+ volatile uint8_t *s = (uint8_t *)g_alloca(default_size);
+ *s = 0;
+}
+
/**
* mono_init_internal:
*
@@ -181,6 +189,8 @@ mono_init_internal (const char *filename, const char *exe_filename, const char *
mono_counters_register ("Max HashTable Chain Length", MONO_COUNTER_INT|MONO_COUNTER_METADATA, &mono_g_hash_table_max_chain_length);
+ ensure_stack_size ();
+
mono_gc_base_init ();
mono_thread_info_attach ();
--
2.37.1

View File

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

View File

@ -1,46 +0,0 @@
From 389814c78216f8f969f99bd87d58d7f386e0301a Mon Sep 17 00:00:00 2001
From: Antoine Martin (ayakael) <dev@ayakael.net>
Date: Fri, 5 Aug 2022 15:05:30 +0000
Subject: [PATCH 1/1] improved VERSION_ID parsing
Runtime doesn't generate a proper distro-rid for Alpine, leaving the
last version digit. Patch fixes this by adding new VERSION_ID parsing
logics.
---
eng/native/init-distro-rid.sh | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/runtime/eng/native/init-distro-rid.sh b/src/runtime/eng/native/init-distro-rid.sh
index f71aa8640b1..fce4092a43d 100644
--- a/src/runtime/eng/native/init-distro-rid.sh
+++ b/src/runtime/eng/native/init-distro-rid.sh
@@ -41,16 +41,21 @@ initNonPortableDistroRid()
# We have forced __PortableBuild=0. This is because -portablebuld
# has been passed as false.
if (( isPortable == 0 )); then
- if [[ "${ID}" == "rhel" || "${ID}" == "rocky" || "${ID}" == "alpine" ]]; then
- # remove the last version digit
- VERSION_ID="${VERSION_ID%.*}"
- fi
-
if [ -z "${VERSION_ID+x}" ]; then
# Rolling release distros do not set VERSION_ID, so omit
# it here to be consistent with everything else.
nonPortableBuildID="${ID}-${buildArch}"
else
+ local VERSION_ID_DOT="${VERSION_ID//[^.]}"
+ while [[ ${#VERSION_ID_DOT} -gt 1 ]]; do
+ VERSION_ID="${VERSION_ID%.*}"
+ local VERSION_ID_DOT="${VERSION_ID//[^.]}"
+ done
+ local VERSION_ID_DASH="${VERSION_ID//[^_]}"
+ while [[ ${#VERSION_ID_DASH} -ge 1 ]]; do
+ VERSION_ID="${VERSION_ID%_*}"
+ local VERSION_ID_DASH="${VERSION_ID//[^_]}"
+ done
nonPortableBuildID="${ID}.${VERSION_ID}-${buildArch}"
fi
fi
--
2.37.1

View File

@ -1,5 +1,5 @@
From 499fcf6e3b0e4b01a9c340a06f00cfc3e1fcc5d2 Mon Sep 17 00:00:00 2001
PatchSource: https://github.com/dotnet/sdk/pull/22373
Patch-Source: https://github.com/dotnet/sdk/pull/22373
From: Tom Deseyn <tom.deseyn@gmail.com>
Date: Tue, 5 Oct 2021 09:04:14 +0200
Subject: [PATCH] Use the portable rid for --use-current-runtime.

View File

@ -0,0 +1,127 @@
From aea2bba5bdf86ac45cdaabaffb307c03c4d71c37 Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/dotnet/sdk/pull/28380
From: Tom Deseyn <tom.deseyn@gmail.com>
Date: Fri, 7 Oct 2022 08:31:58 +0200
Subject: [PATCH 1/2] ResolveReadyToRunCompilers: map non-portable rids when
targetOS is determined.
---
.../ResolveReadyToRunCompilers.cs | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/sdk/src/Tasks/Microsoft.NET.Build.Tasks/ResolveReadyToRunCompilers.cs b/src/sdk/src/Tasks/Microsoft.NET.Build.Tasks/ResolveReadyToRunCompilers.cs
index 716a7f37c3c..6967822aca1 100644
--- a/src/sdk/src/Tasks/Microsoft.NET.Build.Tasks/ResolveReadyToRunCompilers.cs
+++ b/src/sdk/src/Tasks/Microsoft.NET.Build.Tasks/ResolveReadyToRunCompilers.cs
@@ -143,7 +143,15 @@ private bool ValidateCrossgen2Support()
bool version5 = crossgen2PackVersion.Major < 6;
bool isSupportedTarget = ExtractTargetPlatformAndArchitecture(_targetRuntimeIdentifier, out _targetPlatform, out _targetArchitecture);
- string targetOS = _targetPlatform switch
+
+ var runtimeGraph = new RuntimeGraphCache(this).GetRuntimeGraph(RuntimeGraphPath);
+ string portablePlatform = NuGetUtils.GetBestMatchingRid(
+ runtimeGraph,
+ _targetPlatform,
+ new[] { "linux", "linux-musl", "osx", "win" },
+ out _);
+
+ string targetOS = portablePlatform switch
{
"linux" => "linux",
"linux-musl" => "linux",
From 389ad51a7ed0998be6f4a9baa2746882e249451b Mon Sep 17 00:00:00 2001
From: Tom Deseyn <tom.deseyn@gmail.com>
Date: Fri, 7 Oct 2022 13:39:54 +0200
Subject: [PATCH 2/2] For source-build, allow using a rid that is not in the
graph if it matches the host rid.
---
.../ResolveReadyToRunCompilers.cs | 61 +++++++++++++------
1 file changed, 44 insertions(+), 17 deletions(-)
diff --git a/src/sdk/src/Tasks/Microsoft.NET.Build.Tasks/ResolveReadyToRunCompilers.cs b/src/sdk/src/Tasks/Microsoft.NET.Build.Tasks/ResolveReadyToRunCompilers.cs
index 6967822aca1..5d21bc96e84 100644
--- a/src/sdk/src/Tasks/Microsoft.NET.Build.Tasks/ResolveReadyToRunCompilers.cs
+++ b/src/sdk/src/Tasks/Microsoft.NET.Build.Tasks/ResolveReadyToRunCompilers.cs
@@ -144,28 +144,13 @@ private bool ValidateCrossgen2Support()
bool version5 = crossgen2PackVersion.Major < 6;
bool isSupportedTarget = ExtractTargetPlatformAndArchitecture(_targetRuntimeIdentifier, out _targetPlatform, out _targetArchitecture);
- var runtimeGraph = new RuntimeGraphCache(this).GetRuntimeGraph(RuntimeGraphPath);
- string portablePlatform = NuGetUtils.GetBestMatchingRid(
- runtimeGraph,
- _targetPlatform,
- new[] { "linux", "linux-musl", "osx", "win" },
- out _);
-
- string targetOS = portablePlatform switch
- {
- "linux" => "linux",
- "linux-musl" => "linux",
- "osx" => "osx",
- "win" => "windows",
- _ => null
- };
-
// In .NET 5 Crossgen2 supported only the following host->target compilation scenarios:
// win-x64 -> win-x64
// linux-x64 -> linux-x64
// linux-musl-x64 -> linux-musl-x64
+ string targetOS = null;
isSupportedTarget = isSupportedTarget &&
- targetOS != null &&
+ GetCrossgen2TargetOS(out targetOS) &&
(!version5 || _targetRuntimeIdentifier == _hostRuntimeIdentifier) &&
GetCrossgen2ComponentsPaths(version5);
@@ -196,6 +181,48 @@ private bool ValidateCrossgen2Support()
return true;
}
+ private bool GetCrossgen2TargetOS(out string targetOS)
+ {
+ targetOS = null;
+
+ // Determine targetOS based on target rid.
+ // Use the runtime graph to support non-portable target rids.
+ var runtimeGraph = new RuntimeGraphCache(this).GetRuntimeGraph(RuntimeGraphPath);
+ string portablePlatform = NuGetUtils.GetBestMatchingRid(
+ runtimeGraph,
+ _targetPlatform,
+ new[] { "linux", "linux-musl", "osx", "win" },
+ out _);
+
+ // For source-build, allow the bootstrap SDK rid to be unknown to the runtime repo graph.
+ if (portablePlatform == null && _targetRuntimeIdentifier == _hostRuntimeIdentifier)
+ {
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ {
+ portablePlatform = "linux";
+ }
+ else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+ {
+ portablePlatform = "win";
+ }
+ else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
+ {
+ portablePlatform = "osx";
+ }
+ }
+
+ targetOS = portablePlatform switch
+ {
+ "linux" => "linux",
+ "linux-musl" => "linux",
+ "osx" => "osx",
+ "win" => "windows",
+ _ => null
+ };
+
+ return targetOS != null;
+ }
+
private ITaskItem GetNETCoreAppRuntimePack()
{
return GetNETCoreAppPack(RuntimePacks, MetadataKeys.FrameworkName);