# Maintainer: Antoine Martin (ayakael) # Contributor: Antoine Martin (ayakael) pkgname=dotnet8-build pkgver=8.0.100_pre2 pkgrel=0 _gittag=v8.0.100-preview.2 _giturl="https://github.com/dotnet/dotnet" _testtag=16c3c04f3ae6620a474fa0474e8b298190e506c1 _bunnytag=v12 _stage0ver=8.0.100_pre2-r0 _patches=" build_enable-timestamps.patch check_rid-alpine-generation.diff roslyn-analyzer_disable-apphost.patch runtime_79856-save-errno-when-using-posix-semaphores.patch runtime_82676-make-pal-console-c-use-int.patch runtime_82678-add-stub-for-mini-is-gsharedvt-inst.patch runtime_enable-system-libunwind.diff runtime_mono-thread-coop-undefine-fortify-source.patch sdk_14239-add-zsh-compdef-completion-script.patch sdk_dotnet-watch-nowarn-ad0001.patch " _pkgver_macro=${pkgver%.*} _pkgver_prior=${pkgver%.*.*} _pkgver_name=${_pkgver_macro//[.0]} pkgdesc="The .NET $_pkgver_macro bootstrap" # x86: blocked by https://github.com/dotnet/runtime/issues/77667 # armhf: blocked by https://github.com/dotnet/runtime/issues/77663 # riscv64: port WIP https://github.com/dotnet/runtime/issues/36748 arch="all !x86 !armhf !riscv64" url=https://dotnet.microsoft.com license="MIT" # hack for dotnetx-build to be able to pull itself for bootstrapping provides="dotnet$_pkgver_name-bootstrap" provider_priority=$_pkgver_prior checkdepends=" babeltrace binutils coreutils file gawk jq lttng-tools npm procps sed strace util-linux-misc which " # For now package is not tested to build on itself # To test: replace 'dotnet-stage0-bootstrap' with 'dotnet-bootstrap' # and 'dotnet-stage0-artifacts' with 'dotnet-bootstrap-artifacts' makedepends=" bash clang cmake dotnet$_pkgver_name-stage0-bootstrap=$_stage0ver dotnet$_pkgver_name-stage0-artifacts=$_stage0ver dotnet$_pkgver_name-stage0=$_stage0ver findutils git grep icu-data-full icu-dev inetutils-syslogd krb5-dev libgit2-dev libintl libucontext-dev libunwind-dev libxml2-dev libxml2-utils linux-headers lldb-dev llvm-dev lttng-ust-dev nodejs numactl-dev openssl-dev pigz rsync samurai tar xz zlib-dev " case $CARCH in s390x|x86) ;; *) makedepends="$makedepends lld-dev";; esac subpackages=" dotnet$_pkgver_name-artifacts:artifacts:noarch dotnet$_pkgver_name-sdk dotnet$_pkgver_name-templates:templates:noarch dotnet-zsh-completion:zshcomp:noarch dotnet-bash-completion:bashcomp:noarch dotnet-doc netstandard21-targeting-pack:netstandard_targeting_pack:noarch " source=" https://lab.ilot.io/dotnet/dotnet/-/releases/$_gittag/downloads/tarball/dotnet-$_gittag.tar.xz dotnet-testsuite-$_testtag.tar.gz::https://github.com/redhat-developer/dotnet-regular-tests/archive/$_testtag.tar.gz dotnet-bunny-$_bunnytag.tar.gz::https://github.com/redhat-developer/dotnet-bunny/archive/$_bunnytag.tar.gz $_patches " builddir="$srcdir"/dotnet-$_gittag _checkdir="$srcdir"/dotnet-bunny-${_bunnytag/v} _testdir="$srcdir"/dotnet-regular-tests-$_testtag _cli_root="$srcdir"/bootstrap _libdir="/usr/lib" # if true, then within pipeline environment, in which case send logs there # to be scooped if [ -d "$APORTSDIR/logs" ]; then _logdir="$APORTSDIR"/logs/$pkgname else _logdir="$srcdir"/logs fi case $CARCH in x86_64) _dotnet_arch="x64";; aarch64) _dotnet_arch="arm64";; armv7) _dotnet_arch="arm";; armhf) _dotnet_arch="armv6";; *) _dotnet_arch="$CARCH";; esac # Build doesn't set all the right executable bits for the right file types _fix_executable() { # add executable bit find "$1" -type f \( \ -name 'apphost' -o \ -name 'singlefilehost' -o \ -name 'lib*so' \ \) \ -exec chmod +x '{}' \; # remove executable bit find "$1" -type f \( \ -name '*.a' -o \ -name '*.dll' -o \ -name '*.h' -o \ -name '*.json' -o \ -name '*.pdb' -o \ -name '*.props' -o \ -name '*.pubxml' -o \ -name '*.targets' -o \ -name '*.txt' -o \ -name '*.xml' \ \) \ -exec chmod -x '{}' \; } # generates tarball containing all components built by dotnet snapshot() { local _pkg="$srcdir"/${builddir##*/}.tar ulimit -n 4096 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||' -i src/SourceBuild/Arcade/tools/SourceBuildArcadeTarball.targets if [ -d "$_libdir/dotnet/bootstrap" ]; then local _cli_root="$(find $_libdir/dotnet/bootstrap/${_pkgver_macro}* -maxdepth 0 -type d | sort -r | head -n 1)" else local _cli_root="" fi _InitializeDotNetCli="$_cli_root" DOTNET_INSTALL_DIR="$_cli_root" DotNetBuildFromSource=true ./build.sh \ /p:ArcadeBuildTarball=true \ /p:TarballDir=$builddir \ /p:TarballFilePath=$_pkg msg "Compressing ${builddir##*/}.tar to $SRCDEST" xz -T0 -9 -vv -e -c > "$SRCDEST"/${builddir##*/}.tar.xz < "$_pkg" cd "$startdir" abuild checksum } prepare() { default_prepare # check patches msg "check_rid-alpine-generation.diff" patch -p1 -d "$_testdir" -i "$srcdir"/check_rid-alpine-generation.diff # Using system libunwind is broken on aarch64|armv7, and unused on mono-based builds # see https://github.com/dotnet/source-build/issues/2408, case $CARCH in aarch64|armv7) msg "Using bundled libunwind";; armhf|s390x|ppc64le) msg "No libunwind used";; *) msg "Using system libunwind" patch -p1 -i "$srcdir"/runtime_enable-system-libunwind.diff ;; esac # ensure that dotnet does not download artifacts provided by dotnet-artifacts rm -rf "$builddir"/packages/archive # links logfiles to pipeline logs for easy pickup in pipelines mkdir -p "$_logdir" "$builddir"/artifacts ln -s "$_logdir" "$builddir"/artifacts/logs ln -s "$_logdir" "$builddir"/artifacts/log for i in "$builddir"/src/*; do if [ -f "$i" ]; then continue fi mkdir -p "$_logdir"/${i##*\/} "$builddir"/src/${i##*\/}/artifacts ln -s "$_logdir"/${i##*\/} "$builddir"/src/${i##*\/}/artifacts/log done # dotnet requires its bootstrap to be in a writable dir msg "Setting up bootstrap" local _bootstrapdir=$(find $_libdir/dotnet/bootstrap/$_pkgver_macro* -maxdepth 0 | sort -r | head -n 1) if [ ! -d "$_cli_root" ]; then cp -r "$_bootstrapdir" "$_cli_root" fi } build() { msg "Building $pkgname-$pkgver" ulimit -n 4096 # Disable use of LTTng as tracing on lttng <=2,13,0 is broken # See https://github.com/dotnet/runtime/issues/57784. if [ -f "/usr/lib/liblttng-ust.so.1 " ]; then export DOTNET_LTTng=0 fi # looks for most recent recent version of _artifactsdir local _artifactsdir=$(find $_libdir/dotnet/artifacts/$_pkgver_macro* -maxdepth 0 | sort -r | head -n 1) # ci args, else the output is forwarded to log files which isn't ideal in a # pipeline environment, and build by defaults uses lots of space local args=" /v:minimal /p:LogVerbosity=minimal /p:MinimalConsoleLogOutput=true /p:CleanWhileBuilding=true " # part of https://github.com/dotnet/installer/pull/14792 that sets this flag # was not integrated in 7.0.1xx yet case $CARCH in s390x|ppc64le) local args="$args /p:SourceBuildUseMonoRuntime=true";; esac # Sets TargetRid manually as dotnet cannot be trusted to reliably compute # the machine's runtime ID between releases. # shellcheck disable=SC2034 . /etc/os-release local VERSION_ID_DOT="${VERSION_ID//[^.]}" while [ ${#VERSION_ID_DOT} -gt 1 ]; do local VERSION_ID="${VERSION_ID%.*}" local VERSION_ID_DOT="${VERSION_ID//[^.]}" done local VERSION_ID_DASH="${VERSION_ID//[^_]}" while [ ${#VERSION_ID_DASH} -ge 1 ]; do local VERSION_ID="${VERSION_ID%_*}" local VERSION_ID_DASH="${VERSION_ID//[^_]}" done local args="$args /p:TargetRid=$ID.$VERSION_ID-$_dotnet_arch" ./build.sh \ --with-sdk "$_cli_root" \ --with-packages "$_artifactsdir" \ -- $args } check() { ulimit -n 4096 # Tests timeout (in seconds) local _tests_timeout=1000 # Test suite disable flags # following tests can only work after packaging step local _disabled_tests="man-pages distribution-package bash-completion install-location release-version-sane" # test broken: permission issue on lxc / pipelines local _disabled_tests="$_disabled_tests createdump-aspnet workload" # liblttng-ust_sys-sdt.h: no 'NT_STAPSDT' on Alpine's lttng-ust package # lttng: known issue, see https://github.com/dotnet/runtime/issues/57784 local _disabled_tests="$_disabled_tests liblttng-ust_sys-sdt.h lttng" # {bundled,system}-libunwind: use system version on all but aarch64/armv7, as broken # see https://github.com/redhat-developer/dotnet-regular-tests/issues/113 # disable on mono-flavored runtime as mono does not use libunwind case $CARCH in armv7|aarch64) local _disabled_tests="$_disabled_tests system-libunwind";; s390x|ppc64le|armhf) local _disabled_tests="$_disabled_tests bundled-libunwind system-libunwind";; *) local _disabled_tests="$_disabled_tests bundled-libunwind";; esac # test unit broken currently _disabled_tests="$_disabled_tests system-libunwind" # nativeaot is not supported on armv7 case $CARCH in armv7) local _disabled_tests="$_disabled_tests nativeaot" esac msg "Unpacking produced dotnet" export DOTNET_ROOT="$_checkdir/release" if [ ! -d "$DOTNET_ROOT" ]; then mkdir -p "$DOTNET_ROOT" tar --use-compress-program="pigz" \ -xf "$builddir"/artifacts/$_dotnet_arch/Release/dotnet-sdk-$_pkgver_macro*.tar.gz \ -C "$DOTNET_ROOT" \ --no-same-owner fi export PATH="$DOTNET_ROOT:$PATH" # some files either should or should not have executable bits # (done again during packaging - this is for tests) _fix_executable "$DOTNET_ROOT" msg "Building turkey test suite" if [ ! -d "$_logdir/check" ]; then mkdir -p "$_logdir"/check fi if [ ! -d "$_checkdir"/turkey ]; then cd "$_checkdir"/Turkey dotnet publish -bl:"$_logdir"/check/turkey.binlog -f netcoreapp3.1 -c Release -p:VersionPrefix=1 -p:VersionSuffix="$(git rev-parse --short HEAD)" -o "$_checkdir"/turkey fi msg "Running test suite" cd "$_testdir" for i in $_disabled_tests; do if [ -d "$i" ]; then sed -i 's|"enabled": true|"enabled": false|' $i/test.json fi done dotnet "$_checkdir"/turkey/Turkey.dll -t $_tests_timeout -l "$_logdir"/check || local ERROR=true if [ $ERROR ]; then msg "Check error reported, please check logs" fi } package() { # directory creation install -dm 755 \ "$pkgdir"/$_libdir/dotnet/bootstrap/$pkgver \ "$pkgdir"/usr/share/man/man1 \ "$pkgdir"/$_libdir/dotnet/artifacts/$pkgver # unpack sdk to bootstrap tar --use-compress-program="pigz" \ -xf "$builddir"/artifacts/$_dotnet_arch/Release/dotnet-sdk-$_pkgver_macro*.tar.gz \ -C "$pkgdir"/$_libdir/dotnet/bootstrap/$pkgver/ \ --no-same-owner # extract arch-specific artifacts to artifacts dir for use by future dotnet builds tar --use-compress-program="pigz" \ -xf "$builddir"/artifacts/$_dotnet_arch/Release/Private.SourceBuilt.Artifacts.*.tar.gz \ -C "$pkgdir"/$_libdir/dotnet/artifacts/$pkgver/ \ --no-same-owner \ --wildcards \ '*alpine*' # assemble docs find "$builddir" -iname 'dotnet*.1' -type f -exec cp '{}' "$pkgdir"/usr/share/man/man1/. \; # some files either should or should not have executable bits _fix_executable "$pkgdir" # Disable use of LTTng as tracing on lttng <=2,13,0 is broken # See https://github.com/dotnet/runtime/issues/57784. if [ -f "/usr/lib/liblttng-ust.so.1 " ]; then rm "$pkgdir"/$_libdir/dotnet/bootstrap/*/shared/Microsoft.NETCore.App/*/libcoreclrtraceptprovider.so fi } sdk() { pkgdesc="The .NET $_pkgver_macro SDK" # libucontext isn't automatically detected on all platforms depends=" aspnetcore$_pkgver_name-runtime aspnetcore$_pkgver_name-targeting-pack dotnet$_pkgver_name-apphost-pack dotnet$_pkgver_name-targeting-pack dotnet$_pkgver_name-templates netstandard21-targeting-pack libucontext " provides=" dotnet-sdk-$_pkgver_macro=$pkgver-r$pkgrel dotnet$_pkgver_name-dev=$pkgver-r$pkgrel " install -dm 755 "$subpkgdir"/$_libdir/dotnet # sdk tar --use-compress-program="pigz" \ -xf "$builddir"/artifacts/$_dotnet_arch/Release/dotnet-sdk-$_pkgver_macro*.tar.gz \ -C "$subpkgdir"/$_libdir/dotnet/ \ --no-same-owner \ ./sdk ./sdk-manifests # some files either should or should not have executable bits _fix_executable "$subpkgdir" # See https://github.com/dotnet/source-build/issues/2579 find "$subpkgdir" -type f -name 'testhost.x86' -delete find "$subpkgdir" -type f -name 'vstest.console' -delete } netstandard_targeting_pack() { pkgdesc="The .NET 2.1 Standard targeting pack" depends="dotnet-host" provides="netstandard-targeting-pack-2.1=$pkgver-r$pkgrel" install -dm 755 "$subpkgdir"/$_libdir/dotnet/packs tar --use-compress-program="pigz" \ -xf "$builddir"/artifacts/$_dotnet_arch/Release/dotnet-sdk-$_pkgver_macro*.tar.gz \ -C "$subpkgdir"/$_libdir/dotnet/ \ --no-same-owner \ ./packs/NETStandard.Library.Ref # some files either should or should not have executable bits _fix_executable "$subpkgdir" } templates() { pkgdesc="The .NET $_pkgver_macro templates" depends="dotnet-host" provides="dotnet-templates-$_pkgver_macro=$pkgver-r$pkgrel" install -dm 755 "$subpkgdir"/$_libdir/dotnet tar --use-compress-program="pigz" \ -xf "$builddir"/artifacts/$_dotnet_arch/Release/dotnet-sdk-$_pkgver_macro*.tar.gz \ -C "$subpkgdir"/$_libdir/dotnet/ \ --no-same-owner \ ./templates # some files either should or should not have executable bits _fix_executable "$subpkgdir" } artifacts() { pkgdesc="Internal package for building .NET $_pkgver_macro Software Development Kit" # hack to allow artifacts to pull itself provides="dotnet$_pkgver_name-bootstrap-artifacts" provider_priority=$_pkgver_prior # directory creation install -dm 755 \ "$subpkgdir"/$_libdir/dotnet/artifacts/$pkgver \ "$subpkgdir"/usr/share/licenses # extract arch-agnostic artifacts to artifacts dir for use by future dotnet builds tar --use-compress-program="pigz" \ -xf "$builddir"/artifacts/$_dotnet_arch/Release/Private.SourceBuilt.Artifacts.*.tar.gz \ -C "$subpkgdir"/$_libdir/dotnet/artifacts/$pkgver/ \ --no-same-owner \ --exclude '*Intermediate*' \ --exclude '*alpine*' } zshcomp() { depends="" pkgdesc="zsh completion for .NET" # netstandard21-targeting-pack will always be pulled by any dotnetx-sdk # thus pulling this with it for sdk install_if="netstandard21-targeting-pack zsh" depends="dotnet-host" install -dm 755 "$subpkgdir"/usr/share/zsh/site-functions install -m 755 "$builddir"/src/sdk/scripts/register-completions.zsh "$subpkgdir"/usr/share/zsh/site-functions/_dotnet } bashcomp() { depends="" pkgdesc="bash completion for .NET" # netstandard21-targeting-pack will always be pulled by any dotnetx-sdk # thus pulling this with it for sdk install_if="netstandard21-targeting-pack bash-completion" depends="dotnet-host" install -dm 755 "$subpkgdir"/usr/share/bash-completion/completions install -m 755 "$builddir"/src/sdk/scripts/register-completions.bash "$subpkgdir"/usr/share/bash-completion/completions/_dotnet } doc() { default_doc pkgdesc="Docs for .NET" # licenses install -dm 755 "$subpkgdir"/usr/share/licenses/dotnet tar --use-compress-program="pigz" \ -xf "$builddir"/artifacts/$_dotnet_arch/Release/dotnet-sdk-$_pkgver_macro*.tar.gz \ -C "$subpkgdir"/usr/share/licenses/dotnet/ \ --no-same-owner \ ./LICENSE.txt ./ThirdPartyNotices.txt } sha512sums=" ea01bedda56bd7f2a3a856672ee75a444ad97988631d6dd9b52e513cb333248fff00cdd7f0da5635cf6c7012629bdb8cc44fc5b49a0e8bea4e1421cc1dec4244 dotnet-v8.0.100-preview.2.tar.xz 81428356e4b9691c54cacd242368a42d3939732918a608c2a5ae3f23fff45af2d9e981ead70a977f34f4e498c422f708e523bfbbf590cfdafb5c16ef1f0fed8a dotnet-testsuite-16c3c04f3ae6620a474fa0474e8b298190e506c1.tar.gz 0028d5d97b814b122d73137b4e0d64ca5d788aa0ae5fde500de722e23522827f2538f06e75acb17cc39b8917961ee78d1f0bbc84b2b624ae0e9bf88adca2ba6f dotnet-bunny-v12.tar.gz eed7a7481a967f6938de956a6df485efa6dd61bf36ae4a768493cb1f7da0296dc91e0f2f89f7c302083ba9cf0c778e28228ec1b52e902077a00072d7d9957ef3 build_enable-timestamps.patch 941b430b55e323f723bbc5160447f060f40d18ce32e5803ab7dda16bfc60a0f5ec1dccd246e68475d7115ee265a9433824d8a5d997c302531311194a90deeca9 check_rid-alpine-generation.diff 4ac92d2d9190a55ee20d3e145a28a6953c98d3eb838c8acfb808b8839316443cb64da4a2c5787df0171fce7ef96ff6381043085ed90c23ec09ce9ac81571e675 roslyn-analyzer_disable-apphost.patch 77fa6d9987a7c43725582c9c493e9d4d5965a611a1d795dad4e3d46cd730caced095f994d93f91a131df7fa4b6a7277bcd3d915bae2dcd869559f22076fbc575 runtime_79856-save-errno-when-using-posix-semaphores.patch 18f2be488e4d6c667b90f6b6faed12a84f8c5748c6da91a291542e0a9e8b43effc3bba92a6b38da1b2a904466e3e9bd66b01ad0d3f521bd27a067eb362e2add6 runtime_82676-make-pal-console-c-use-int.patch 5452b7c5037210fd273476c58fb8bf30ec9f0e6824489808c6d2af82057c5401bbd244a5aa8aa20a0c6ae122dd55a76cda40ccfd7838530fd23b5ad7bbd5550f runtime_82678-add-stub-for-mini-is-gsharedvt-inst.patch 293742ab307bef459a21deadcc4ad7c7996cc4b490910a36c2763b8ad25cc8a91c4e03b6290567cd1030f69638d0156c5b6970887858fb091f8482b67356065d runtime_enable-system-libunwind.diff d732df247c721c9f677baabdd7f36dbf4b564814ff64164361065bb1c196b767494a1d39f634eadf01a23032c7b3e64102614b7213065c81096bbf3f8022e6a0 runtime_mono-thread-coop-undefine-fortify-source.patch d1b4ebcbb1a6815fc0ce4c471485c232618e60968a879309fb8336821a9351d2e0028d9f7726c0c041c750b497a0baa47400c78c9ceff550b91b4a6c2816fc41 sdk_14239-add-zsh-compdef-completion-script.patch 89d008944bf0ba16250ff078e650619b2087654d98b4f7dd614b8197774236e946d92ea17d81d037251ab16880e7bb8f74dbd8a244ca713ecd3efbea17e09318 sdk_dotnet-watch-nowarn-ad0001.patch "