diff --git a/user/dotnet8-sdk/APKBUILD b/user/dotnet8-sdk/APKBUILD new file mode 100644 index 0000000..9d62e88 --- /dev/null +++ b/user/dotnet8-sdk/APKBUILD @@ -0,0 +1,126 @@ +# Maintainer: Antoine Martin (ayakael) +# Contributor: Antoine Martin (ayakael) + +pkgname=dotnet8-sdk +pkgver=8.0.100_pre7 +_bldver=8.0.0_pre7-r2 +pkgrel=2 + +# Following for dotnet build version 6.0 and up +_pkgver_macro=${pkgver%.*} +_pkgver_name=${_pkgver_macro//[.0]} +_bldver_ver=${_bldver%%-*} +_bldver_ver=${_bldver_ver/0./0.10} +pkgdesc="The .NET $_pkgver_macro SDK" +# x86: blocked by https://github.com/dotnet/runtime/issues/77667 +# armhf: blocked by https://github.com/dotnet/runtime/issues/77663 +arch="all !x86 !armhf" +url=https://dotnet.microsoft.com +license="MIT" +makedepends="dotnet$_pkgver_name-runtime-bootstrap=$_bldver" +subpackages=" + 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 + " +provides="dotnet$_pkgver_name=$pkgver-r$pkgrel" +options="!check" # No test suite +builddir="$srcdir" +_libdir="/usr/lib" + +case $CARCH in + x86_64) _dotnet_arch="x64";; + aarch64) _dotnet_arch="arm64";; + armv7) _dotnet_arch="arm";; + armhf) _dotnet_arch="armv6";; + *) _dotnet_arch="$CARCH";; +esac + +package() { + # 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 "$pkgdir"/$_libdir/dotnet + + cp -r $_libdir/dotnet/bootstrap/$_bldver_ver/sdk "$pkgdir"/$_libdir/dotnet/. + cp -r $_libdir/dotnet/bootstrap/$_bldver_ver/sdk-manifests "$pkgdir"/$_libdir/dotnet/. + + # See https://github.com/dotnet/source-build/issues/2579 + find "$pkgdir" -type f -name 'testhost.x86' -delete + find "$pkgdir" -type f -name 'vstest.console' -delete + + # docs + install -dm 755 "$pkgdir"/usr/share/man/man1 + cp -r $_libdir/dotnet/bootstrap/$_bldver_ver/docs/* "$pkgdir"/usr/share/man/man1/. +} + +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 + + cp -r $_libdir/dotnet/bootstrap/$_bldver_ver/packs/NETStandard.Library.Ref "$subpkgdir"/$_libdir/dotnet/packs/ +} + +templates() { + pkgdesc="The .NET $_pkgver_macro templates" + depends="dotnet-host" + provides="dotnet-templates-$_pkgver_macro=$pkgver-r$pkgrel" + + install -dm 755 "$subpkgdir"/$_libdir/dotnet + + cp -r $_libdir/dotnet/bootstrap/$_bldver_ver/templates "$subpkgdir"/$_libdir/dotnet/. +} + +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 "$_libdir"/dotnet/bootstrap/$_bldver_ver/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 "$_libdir"/dotnet/bootstrap/$_bldver_ver/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 + cp -r $_libdir/dotnet/bootstrap/$_bldver_ver/LICENSE.txt "$subpkgdir"/usr/share/licenses/dotnet/. + cp -r $_libdir/dotnet/bootstrap/$_bldver_ver/ThirdPartyNotices.txt "$subpkgdir"/usr/share/licenses/dotnet/. +} diff --git a/user/dotnet8-sdk/README.md b/user/dotnet8-sdk/README.md new file mode 100644 index 0000000..1a55eda --- /dev/null +++ b/user/dotnet8-sdk/README.md @@ -0,0 +1,145 @@ +# dotnet8-sdk + +This is the .NET 8.0 package for Alpine Linux. + +Please report any issues [using Gitlab](https://gitlab.alpinelinux.org/alpine/aports/-/issues/new) and tag @ayakael + +# Building info + +## Generated packages +* `dotnet8-build` (aimed for internal use as bootstrap) +* `dotnet8-build-artifacts` (aimed for internal use as bootstrap) +* `dotnet8-sdk` +* `dotnet8-templates` (required by sdk) +* `dotnet-zsh-completion` +* `dotnet-bash-completion` +* `dotnet-doc` +* `netstandard21-targeting-pack` + +## How to build dotnet8 on Alpine +As dotnet is a self-hosting compiler (thus it compiles using itself), it +requires a bootstrap for the initial build. To solve this problem, this package +follows the `stage0` proposal outlined [here](https://lists.alpinelinux.org/~alpine/devel/%3C33KG0XO61I4IL.2Z7RTAZ5J3SY6%408pit.net%3E) + +The goal of `stage0` is to bootstrap dotnet with as little intervention as +possible, thus allowing seamless Alpine upgrades. Unfortunately, upstream only +builds bootstraps for Alpine on `x86_64`, `aarch64`, and `armv7`. Thus, `stage0` +has also been designed to be crossbuild aware, allowing bootstrapping to other +platforms. + +In summary, dotnet8 is built using three different aports. + +* `community/dotnet8-stage0` +Builds minimum components for full build of dotnet8, and packages these in an initial +`dotnet8-stage0-bootstrap` package that `dotnet8-build` pulls. +* `community/dotnet8-build` +Builds full and packages dotnet8 fully using either stage0 or previoulsy built +dotnet8 build. +* `community/dotnet8-runtime` +As abuild does not allow different versions for subpackages, a different aport +is required to package runtime bits from dotnet8-build. + +## Crossbuilding with `stage0` +Crossbuilding `stage0` is a three step process: +1. Build sysroot for target platform by using `scripts/bootstrap.sh` in aports repo: +``` +./bootstrap.sh $CTARGET_ARCH +``` +2. Although not necessary, it is recommended to add Alpine repositories to + `$HOME/sysroot-$CTARGET_ARCH/etc/apk/repositories`, making sure to add required + keys. This makes it so that whatever package is not built in step 1 will + be pulled from package repos +3. Crossbuild `dotnet8-stage0` via: +``` +CHOST=$CTARGET_ARCH abuild -r +``` + +# Specification + +This package follows [package naming and contents suggested by upstream](https://docs.microsoft.com/en-us/dotnet/core/build/distribution-packaging), +with two exceptions. It installs dotnet to `/usr/lib/dotnet` (aka `$_libdir`). +In addition, the package is named `dotnet8` as opposed to `dotnet-8.0` +to match Alpine Linux naming conventions for packages with many installable versions + +# Contributing + +The steps below are for the final package. Please only contribute to a +pre-release version if you know what you are doing. Original instructions +follow. + +## General Changes + +1. Fork the main aports repo. + +2. Checkout the forked repository. + + - `git clone ssh://git@gitlab.alpinelinux.org/$USER/aports` + - `cd community/dotnet8-build` + +3. Make your changes. Don't forget to add a changelog. + +4. Do local builds. + + - `abuild -r` + +5. Fix any errors that come up and rebuild until it works locally. + +6. Commit the changes to the git repo in a git branch + + - `git checkout -b dotnet8/` + - `git add` any new patches + - `git remove` any now-unnecessary patches + - `git commit -m 'community/dotnet8-build: descriptive description'` + - `git push` + +7. Create a merge request with your changes, tagging @ayakael for review. + +8. Once the tests in the merge-request pass, and reviewers are happy, your changes + will be merged. + +## Updating to an new upstream release + +1. Fork the main aports repo. + +2. Checkout the forked repository. + + - `git clone ssh://git@gitlab.alpinelinux.org/$USER/aports` + - `cd community/dotnet8-build` + + +3. Build the new upstream source tarball. Update the versions in the + APKBUILD file, and then create a snapshot. After build, update checksum. + + - `abuild snapshot` + - `abuild checksum` + +4. Do local builds. + + - `abuild -r` + +5. Fix any errors that come up and rebuild until it works locally. Any + patches that are needed at this point should be added to the APKBUILD file + in `_patches` variable. + +6. Upload the source archive to a remote location, and update `source` variable. + +7. Commit the changes to the git repo in a git branch. + + - `git checkout -b dotnet8/` + - `git add` any new patches + - `git remove` any now-unnecessary patches + - `git commit -m 'community/dotnet8-build: upgrade to ` + - `git push` + +8. Create a merge request with your changes, tagging @ayakael for review. + +9. Once the tests in the merge-request pass, and reviewers are happy, your changes + will be merged. + +# Testing + +This package uses CI tests as defined in `check()` function. Creating a +merge-request or running a build will fire off tests and flag any issues. + +The tests themselves are contained in this external repository: +https://github.com/redhat-developer/dotnet-regular-tests/