# Maintainer: Antoine Martin (ayakael) # Contributor: Antoine Martin (ayakael) # # Variables for dotnet build version 6.0 # This APKBUILD is designed to be the same for version 6.0 and up # except for the variables in this first section # pkgname=dotnet6 pkgver=6.0.101 pkgrel=0 _runtimever=6.0.1 _sdkver=$pkgver _aspnetver=$_runtimever _llvmver=12 _patches=" aspnetcore_always-build-App.Ref-and-the-targeting-packs.patch build_copy-sbrp-from-artifacts-instead-of-move.patch build_fix-musl-build.patch command-line-api_fix-musl.build.patch command-line-api_use-work-tree-with-git.patch fsharp_use-work-tree-with-git.patch installer_include-musl-bits-in-source-build-bootstrap-tarball.patch installer_internal-repo-fix.patch installer_musl-build-fix.patch runtime_add-rid-for-alpine-315.patch runtime_disable-package-validation.patch runtime_force-microsoftnetcoreilasmpackageruntimeid-as-musl.patch runtime_non-portable-distrorid-fix-alpine.patch runtime_release-6.0-Build-all-packages-when-in-source-build.patch sdk_telemetry-optout.patch source-build-reference-packages_musl-check.patch vstest_use-work-tree-with-git.patch xliff-tasks_use-work-tree-with.git.patch " # Custom prepare default_prepare() { return } # Following for dotnet build version 6.0 and up _pkgver_macro=${pkgver%.*} _pkgver_prior=${pkgver%.*.*} _pkgver_name=${_pkgver_macro//[.0]} pkgdesc="The .NET $_pkgver_macro SDK" pkgrel=0 arch="x86_64" url=https://www.microsoft.com/net/core license="MIT" _bootstrap_pkg="bootstrap" makedepends=" bash clang cmake dotnet$_pkgver_name-$_bootstrap_pkg-artifacts dotnet$_pkgver_name-$_bootstrap_pkg-runtime dotnet$_pkgver_name-$_bootstrap_pkg-sdk dotnet$_pkgver_name-stage1 findutils git icu-dev inetutils-syslogd krb5-dev libgit2-dev libintl libunwind-dev libxml2-dev libxml2-utils linux-headers lldb-dev llvm$_llvmver-dev lttng-ust-dev nodejs openssl-dev zlib-dev " subpackages=" aspnetcore$_pkgver_name-runtime:aspnetcore_runtime:noarch:$_aspnetver aspnetcore$_pkgver_name-targeting-pack:aspnetcore_targeting_pack:noarch:$_aspnetver dotnet$_pkgver_name-apphost-pack:apphost_pack:$_runtimever dotnet$_pkgver_name-artifacts:artifacts:noarch:$_sdkver dotnet$_pkgver_name-host:host:$_runtimever dotnet$_pkgver_name-host-zsh-completion:zshcomp:$_runtimever dotnet$_pkgver_name-host-bash-completion:bashcomp:$_runtimever dotnet$_pkgver_name-host-doc:doc:$_runtimever dotnet$_pkgver_name-hostfxr:hostfxr:$_runtimever dotnet$_pkgver_name-runtime:runtime:$_runtimever dotnet$_pkgver_name-sdk:sdk:$_sdkver dotnet$_pkgver_name-targeting-pack:targeting_pack:noarch:$_runtimever dotnet$_pkgver_name-templates:templates:noarch:$_sdkver netstandard$_pkgver_name-targeting-pack:netstandard_targeting_pack:noarch:$_sdkver " options="!check" # No test suite source=" installer-v$pkgver.tar.gz::https://github.com/dotnet/installer/archive/refs/tags/v$pkgver.tar.gz completions.zsh::https://raw.githubusercontent.com/dotnet/sdk/7cec6d9fe5cb326a88091ae44204f52e1f00e69c/scripts/_dotnet dotnet.sh $_patches " builddir="$srcdir/sources" _installerdir=$srcdir/installer-$pkgver # custom function that converts Alpine arch syntax to dotnet arch syntax _get_arch() { case $1 in x86_64) local arch=x64;; aarch64) local arch=arm64;; armv7) local arch=arm;; esac echo $arch } # Custom patch logics for dotnet version 6.0 and up _patch() { cd "$builddir" local i failed= if ! have_patches; then return 0 fi msg "Deploying patches" for i in $source; do case ${i%::*} in build_*.patch) cd "$builddir" patch ${patch_args:--p1} -i "$srcdir/$(filename_from_uri $i)" || failed="$failed $i" ;; *.patch) local _package=$(echo $i | sed 's|_.*||') local _patch=$(echo $i | sed "s|${_package}_||") echo "Applying $_patch -> $_package" cd src/$_package.* || { echo "$_package does not exist for patch"; continue; } patch -Np1 -i "$srcdir"/$i cd "$builddir" ;; esac done if [ -z "$failed" ]; then return 0 fi error "The following patches failed to apply:" for i in $failed; do printf " %s\n" "$i" done } # custom function that updates stage1 for all dotnet versions # # buildrepo doesn't know to rebuild dotnet after first build with stage1 # this creates another package that forces the a first build of dotnet # so that the final build of dotnet is guaranteed to be built with # Alpine binaries. _update_stage1() { msg "Updating stage1 APKBUILD" # Copy patches rm ../dotnet$_pkgver_name-stage1/*.patch ../dotnet$_pkgver_name-stage1/dotnet.sh for i in ../dotnet"$_pkgver_name"/*.patch ../dotnet"$_pkgver_name"/dotnet.sh; do cp $i ${i/$_pkgver_name/$_pkgver_name-stage1} done # Generate stage1 { echo -n "# " echo "Maintainer: Antoine Martin (ayakael) " echo "# Contributor: Antoine Martin (ayakael) " echo echo "#" echo "# This is generated from dotnet$_pkgver_name's APKBUILD." echo "# Any modifications to be done in main APKBUILD and propagated by" echo -n "# executing 'abuild _update_stage1'" sed \ -e "s/pkgname=dotnet$_pkgver_name/pkgname=dotnet$_pkgver_name-stage1/" \ -e "s/_bootstrap_pkg=\"bootstrap\"/_bootstrap_pkg=\"stage0\"/" \ -e "1,2d" \ ../dotnet$_pkgver_name/APKBUILD } > ../dotnet$_pkgver_name-stage1/APKBUILD } prepare() { default_prepare cd "$_installerdir" msg "Initializing" # installer expects to be in a git repo git init > /dev/null 2>&1 git add ./* > /dev/null 1>&1 git commit -m 'initial commit' > /dev/null 2>&1 git remote add origin https://github.com/dotnet/installer.git > /dev/null 2>&1 # Disabling use of sudo in build.sh sed -i 's/sudo -E//g' build.sh # Disabling internal repos patch -p1 -i "$srcdir"/installer_internal-repo-fix.patch msg "Settings up bootstrap" cp -r /usr/share/dotnet/* "$_installerdir"/. msg "Setting up source directory" export _InitializeDotNetCli=$(pwd) export DOTNET_INSTALL_DIR=$(pwd) export DotNetBuildFromSource=true # disable tracing, which is incompatible with certain versions of # lttng see https://github.com/dotnet/runtime/issues/57784. the # suggested compile-time change doesn't work, unfrotunately. export complus_lttng=0 ./build.sh \ /p:ArcadeBuildTarball=true \ /p:TarballDir="$builddir" \ /p:DotNetBuildFromSource=true _patch rm -r "$builddir"/packages/archive } build() { msg "Building $pkgname-$pkgver" export _InitializeDotNetCli="$_installerdir" export DotNetBuildFromSource=true local _artifactsver=$(find /usr/share/dotnet/artifacts/$_pkgver_macro* -maxdepth 0 -type d | tail -n1 | sed 's|..*\/||') # disable tracing, which is incompatible with certain versions of # lttng see https://github.com/dotnet/runtime/issues/57784. the # suggested compile-time change doesn't work, unfrotunately. export complus_lttng=0 ./build.sh \ --with-sdk "$_installerdir" \ --with-packages /usr/share/dotnet/artifacts/$_artifactsver } package() { depends="dotnet$_pkgver_name-sdk" provides=dotnet-$_pkgver_macro install -dm 755 "$pkgdir"/usr/share/zsh/site-functions "$pkgdir"/usr/share/bash-completion/completions "$pkgdir"/usr/share/man/man1 find "$builddir" -iname 'dotnet*.1' -type f -exec cp '{}' "$pkgdir"/usr/share/man/man1/ \; install -m 755 "$srcdir"/completions.zsh "$pkgdir"/usr/share/zsh/site-functions/_dotnet install -m 755 "$builddir"/src/sdk.*/scripts/register-completions.bash "$pkgdir"/usr/share/bash-completion/completions/_dotnet } sdk() { 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 " provider_priority=$_pkgver_prior provides="dotnet$_pkgver_name-bootstrap-sdk dotnet-sdk-$_pkgver_macro" cd "$builddir"/artifacts/x64/Release install -dm 755 "$subpkgdir"/usr/share/dotnet "$subpkgdir"/usr/share/licenses tar -xzf dotnet-sdk-$_pkgver_macro*.tar.gz -C "$subpkgdir"/usr/share/dotnet/ --no-same-owner ./sdk ./sdk-manifests ln -s dotnet-host "$subpkgdir"/usr/share/licenses/dotnet$_pkgver_name-sdk } host() { pkgdesc="A generic driver for the .NET Core Command Line Interface" provides="dotnet-host" provider_priority=$_pkgver_prior cd $builddir/artifacts/x64/Release install -dm 755 "$subpkgdir"/etc/profile.d "$subpkgdir"/usr/bin "$subpkgdir"/usr/share/dotnet "$subpkgdir"/usr/share/licenses/dotnet-host tar -xzf dotnet-sdk-$_pkgver_macro*.tar.gz -C "$subpkgdir"/usr/share/dotnet/ --no-same-owner ./dotnet tar -xzf dotnet-sdk-$_pkgver_macro*.tar.gz -C "$subpkgdir"/usr/share/licenses/dotnet-host/ --no-same-owner ./LICENSE.txt ./ThirdPartyNotices.txt ln -s /usr/share/dotnet/dotnet "$subpkgdir"/usr/bin/dotnet install -Dm 644 "$srcdir"/dotnet.sh -t "$subpkgdir"/etc/profile.d/ } hostfxr() { pkgdesc="The .NET host resolver contains the logic to resolve and select the right version of the .NET SDK or runtime to use." depends="dotnet-host" provides="dotnet-hostfxr-$_pkgver_macro" provider_priority=$_pkgver_prior cd $builddir/artifacts/x64/Release install -dm 755 "$subpkgdir"/usr/share/dotnet "$subpkgdir"/usr/share/licenses tar -xzf dotnet-sdk-$_pkgver_macro*.tar.gz -C "$subpkgdir"/usr/share/dotnet/ --no-same-owner ./host ln -s dotnet-host "$subpkgdir"/usr/share/licenses/dotnet$_pkgver_name-hostfxr } runtime() { pkgdesc="The .NET $_pkgver_macro Core runtime" depends="dotnet$_pkgver_name-hostfxr" provides=" dotnet$_pkgver_name-bootstrap-runtime dotnet-runtime-$_pkgver_macro " provider_priority=$_pkgver_prior cd "$builddir"/artifacts/x64/Release install -dm 755 "$subpkgdir"/usr/share/dotnet "$subpkgdir"/usr/share/licenses tar -xzf dotnet-sdk-$_pkgver_macro*.tar.gz -C "$subpkgdir"/usr/share/dotnet/ --no-same-owner ./shared/Microsoft.NETCore.App ln -s dotnet-host "$subpkgdir"/usr/share/licenses/dotnet$_pkgver_name-runtime } aspnetcore_runtime() { pkgdesc="The ASP.NET $_pkgver_macro Core runtime" depends="dotnet$_pkgver_name-runtime" provides="aspnetcore-runtime-$_pkgver_macro" cd "$builddir"/artifacts/x64/Release install -dm 755 "$subpkgdir"/usr/share/dotnet "$subpkgdir"/usr/share/licenses tar -xzf dotnet-sdk-$_pkgver_macro*.tar.gz -C "$subpkgdir"/usr/share/dotnet/ --no-same-owner ./shared/Microsoft.AspNetCore.App ln -s dotnet-host "$subpkgdir"/usr/share/licenses/aspnetcore$_pkgver_name-runtime } apphost_pack() { pkgdesc="The .NET $_pkgver_macro Core apphost pack" provides="dotnet-apphost-pack-$_pkgver_macro" cd "$builddir"/artifacts/x64/Release install -dm 755 "$subpkgdir"/usr/share/dotnet "$subpkgdir"/usr/share/licenses tar -xzf dotnet-sdk-$_pkgver_macro*.tar.gz -C "$subpkgdir"/usr/share/dotnet/ --no-same-owner --wildcards ./packs/Microsoft.NETCore.App.Host.* ln -s dotnet-host "$subpkgdir"/usr/share/licenses/dotnet$_pkgver_name-apphost-pack } targeting_pack() { pkgdesc="The .NET $_pkgver_macro Core targeting pack" provides="dotnet-targeting-pack-$_pkgver_macro" cd "$builddir"/artifacts/x64/Release install -dm 755 "$subpkgdir"/usr/share/dotnet "$subpkgdir"/usr/share/licenses tar -xzf dotnet-sdk-$_pkgver_macro*.tar.gz -C "$subpkgdir"/usr/share/dotnet/ --no-same-owner ./packs/Microsoft.NETCore.App.Ref ln -s dotnet-host "$subpkgdir"/usr/share/licenses/dotnet$_pkgver_name-targeting-pack } netstandard_targeting_pack() { pkgdesc="The .NET $_pkgver_macro Standard targeting pack" depends="dotnet-host" provides=" netstandard21-targeting-pack netstandard-targeting-pack-2.1 " provider_priority=$_pkgver_prior cd "$builddir"/artifacts/x64/Release install -dm 755 "$subpkgdir"/usr/share/dotnet "$subpkgdir"/usr/share/licenses tar -xzf dotnet-sdk-$_pkgver_macro*.tar.gz -C "$subpkgdir"/usr/share/dotnet/ --no-same-owner ./packs/NETStandard.Library.Ref ln -s dotnet-host "$subpkgdir"/usr/share/licenses/netstandard21-targeting-pack } aspnetcore_targeting_pack() { pkgdesc="The ASP.NET $_pkgver_macro Core targeting pack" provides="aspnetcore-targeting-pack-$_pkgver_macro" cd "$builddir"/artifacts/x64/Release install -dm 755 "$subpkgdir"/usr/share/dotnet "$subpkgdir"/usr/share/licenses tar -xzf dotnet-sdk-$_pkgver_macro*.tar.gz -C "$subpkgdir"/usr/share/dotnet/ --no-same-owner ./packs/Microsoft.AspNetCore.App.Ref ln -s dotnet-host "$subpkgdir"/usr/share/licenses/aspnetcore$_pkgver_name-targeting-pack } templates() { pkgdesc="The .NET $_pkgver_macro templates" depends="dotnet-host" provider_priority=$_pkgver_prior provides="dotnet-templates-$_pkgver_macro" cd "$builddir"/artifacts/x64/Release install -dm 755 "$subpkgdir"/usr/share/dotnet "$subpkgdir"/usr/share/licenses tar -xzf dotnet-sdk-$_pkgver_macro*.tar.gz -C "$subpkgdir"/usr/share/dotnet/ --no-same-owner ./templates ln -s dotnet-host "$subpkgdir"/usr/share/licenses/dotnet$_pkgver_name-templates } artifacts() { pkgdesc="Internal package for building .NET $_pkgver_macro Software Development Kit" depends="dotnet-host" provides="dotnet$_pkgver_name-bootstrap-artifacts" provider_priority=$_pkgver_prior cd "$builddir"/artifacts/x64/Release install -dm 755 "$subpkgdir"/usr/share/dotnet/artifacts/$pkgver "$subpkgdir"/usr/share/licenses tar -xf Private.SourceBuilt.Artifacts.*.tar.gz -C "$subpkgdir"/usr/share/dotnet/artifacts/$pkgver/ --no-same-owner ln -s dotnet-host "$subpkgdir"/usr/share/licenses/dotnet$_pkgver_name-artifacts } zshcomp() { default_zshcomp pkgdesc="zsh completion for .NET $_pkgver_macro" depends="dotnet-host" provides="dotnet-host-zsh-completion" provider_priority=$_pkgver_prior } bashcomp() { default_bashcomp pkgdesc="bash completion for .NET $_pkgver_macro" depends="dotnet-host" provides="dotnet-host-bash-completion" provider_priority=$_pkgver_prior } doc() { default_doc pkgdesc="Docs for .NET $_pkgver_macro" provides="dotnet-host-doc" provider_priority=$_pkgver_prior } sha512sums=" 26ad152ce2d8de003dd43033633c73cb1d2607163e6bd7856e568d77b3d7312fad3705d4619804ec5806e6a61a8a3fae6d3ef6cab27da34bba8095fbf8cba1a9 installer-v6.0.101.tar.gz d0aecbf13e6781ef867021085e0d4a55e5f24dddfd175e4d0ce651fdb9c8e330636b2c69e3c4491442e5dd32c6859f38388006b3fe36fac2226837e1bc4107c9 completions.zsh e61b9e3e5a2305646a616d598378230c9755c5dd5363692cc363f8f4add3807563c324dd86f3a7ae9d358c82d730608e7b293935a2b6c81c0c0f62d752a0a1cf dotnet.sh 3807556b5d0e1bba93c6d4822562ed4958fdbc4acea0f5c02c668ae2e7ca37f81575e72314bfd0ae461201ccb04d09c96a0d3d213fa42edaebd9b343f7cabbfc aspnetcore_always-build-App.Ref-and-the-targeting-packs.patch 0c7d590f7803adea003ea58df1881134ac61bfdf7738d40e902e3de3bc5f02557e21ac31c3edd0c11c25b563f974030218c9d49dc4a1fe9dedbcaffeff70201c build_copy-sbrp-from-artifacts-instead-of-move.patch 31302c5feb5d80e4754f6fe886084f439566e4874e459e50a7d4073d7c57c2c0edba32f9fa9aadbc39c4b722bc8649498ad72485e798fbcd5aeb9489b218887b build_fix-musl-build.patch 5ae47767dc61b589a26bb93a27735cc865925854dc03716232283b15bc6109a1d59f3426542b4818c29fb30825914683c9971f48d12a193f5343b6efc54d5e64 command-line-api_fix-musl.build.patch 71612ac1d9933335583cf722dc5ecfb37739f662a165cd2afb62bf342e83946955269370da57d3295fa4f781683a2fb6027068584b996efcb33d71e18f7191e2 command-line-api_use-work-tree-with-git.patch 06ed5091e461c160930746768a1f296bdf7f876b0578cdeb93077e623212c0c535b24e406f9408c402e83eac361a33dba2d7dda7ce7140dd23061ebd8a4a466d fsharp_use-work-tree-with-git.patch c94f2ddf2d8997c506790ca0c323da837117b05b23be61d98d62ae3951797e0c550e2cb7b95b7caafdf68214297ba5598bc5ef50ee41d4403ea20aa437ec83c4 installer_include-musl-bits-in-source-build-bootstrap-tarball.patch 1a0254e70c29c367cae45257289a31bd45ffd769c4437c11031f0b90604095fd94a5695d1c0e4acf1ffb7e30eaa7f452e520f860a9b1ef52bcda8a41f0a424c4 installer_internal-repo-fix.patch c8a9464e7de2894ac3a7b75496befd3af3e829815bac86036cf3ab65f31a3398e92705eae468e50e136374a296a3ee8279f11e2d6ae77400c13d90f8b80f2f2e installer_musl-build-fix.patch c52ee082d61e05098422d3e826023e620c42db02c9a043864968651e7846dc818ce6bb76396812a358690e8d07cda2ca7cfdcbd559c51866c931d4e5e52f384a runtime_add-rid-for-alpine-315.patch 79dacbaeb9af252e515028f800efc5c1628be9290007418bf4a219f49d4264b2abab2a89af6cd9ff3c74451fe40d6811f7d3c13b9237da187c419295f4ba1280 runtime_disable-package-validation.patch aef6a7257f6582f45f30486ec54d80e65c8514804499fef189c99ca0331e80bffdd946550cab2e5a7f7b5cf086c2d6fcaf75caf3ad797b070c473fd8c495b148 runtime_force-microsoftnetcoreilasmpackageruntimeid-as-musl.patch bc48541a19c934d1d7a5ecc7d4bbb7adcd2dd2917ddeda7a1c5a6b28bfbbd4056fe431feca749b854d6b40badd464cd7f8aacd28ea9ca59839d556c5f90193f3 runtime_non-portable-distrorid-fix-alpine.patch c61abb40560de035f1224c962adb91241d11e0eeba31833278ad9e6cba728a81da3be38cce277cfe25c203d0fbf2dee8bb31ac68b77bbb0a43988a7bb36600cf runtime_release-6.0-Build-all-packages-when-in-source-build.patch 0f49a9e7e9cec6faf515b4bb399be7965e32ff163c11ff162b735f20c5fd9cffc8711dd2acef4490943be67f247bdc942df7fe63c1b9152af0ba271b3230b90a sdk_telemetry-optout.patch c73050acb63fab466dffa30468d83a6274436f1fa8ab1669081b5a0e42d2b6fd8690a8f748df6565206e9f99451eded7ec29119fe0b704ec3a726938e6d863e9 source-build-reference-packages_musl-check.patch d41ed2c7f4b81be2770d1c6b4bba17cea0772131bee994ebce9ca7acc302b2c15cc1adac6a814b866af04728cd4beb0ca411d218d113922fe32001c485b89c67 vstest_use-work-tree-with-git.patch 4d85a411c4add10072c8b411e05b9ece4696c9409c9a363a0f5ecf2adc6ccb815d868c96941da31a6c4e9d981cede144222155eadac1fbed851989086835d101 xliff-tasks_use-work-tree-with.git.patch "