[main/dotnet-5.0] APKBUILD cleanup + README

This commit is contained in:
build@apk-groulx 2021-12-05 00:01:22 +00:00
parent dd8e78465e
commit f6455c7d52
2 changed files with 232 additions and 241 deletions

View file

@ -9,14 +9,13 @@
# #
# Build vars # Build vars
# #
# Sets whether we use pre-built bootstraps from microsoft or repo-provided bootstraps for building # Sets whether we use pre-built bootstraps from microsoft or repo-provided
# bootstraps for building
_bootstrap=false _bootstrap=false
_bootstrap_sdk=5.0.8-r1 _bootstrap_sdk=5.0.8-r1
_bootstrap_runtime=3.1.17-r2 _bootstrap_runtime=3.1.17-r2
# LLVM version # LLVM version
_llvmver=12 _llvmver=12
# One packaging step that needs this set. Needs some work, but I'm sure there's a way to remove this.
_targetrid=alpine.3.15-x64
pkgname=dotnet-5.0 pkgname=dotnet-5.0
pkgdesc='The .NET Core SDK' pkgdesc='The .NET Core SDK'
@ -46,75 +45,58 @@ makedepends="
linux-headers linux-headers
zlib-dev zlib-dev
" "
if [ ${_bootstrap} != 'true' ]; then if [ $_bootstrap != 'true' ]; then
makedepends=" makedepends="
${makedepends} $makedepends
dotnet-bootstrap-runtime-3.1=$_bootstrap_runtime dotnet-bootstrap-runtime-3.1=$_bootstrap_runtime
dotnet-bootstrap-sdk-5.0=$_bootstrap_sdk dotnet-bootstrap-sdk-5.0=$_bootstrap_sdk
" "
fi fi
subpackages="dotnet-sdk-5.0:sdk dotnet-host:host dotnet-runtime-5.0:runtime aspnet-runtime-5.0:aspnet_runtime:noarch netstandard-targeting-pack:netstandard_targeting_pack:noarch dotnet-targeting-pack-5.0:targeting_pack aspnet-targeting-pack-5.0:aspnet_targeting_pack:noarch" subpackages="
_gittag=v${pkgver}-runtime dotnet-sdk-5.0:sdk
dotnet-host:host
dotnet-runtime-5.0:runtime
aspnet-runtime-5.0:aspnet_runtime:noarch
netstandard-targeting-pack:netstandard_targeting_pack:noarch
dotnet-targeting-pack-5.0:targeting_pack
aspnet-targeting-pack-5.0:aspnet_targeting_pack:noarch"
_gittag=v$pkgver-runtime
_giturl=https://github.com/dotnet/source-build _giturl=https://github.com/dotnet/source-build
options="!check !archcheck" options="!check"
source=" source="
$pkgname-$pkgver.git.zip $pkgname-$pkgver.git.zip
dotnet.sh dotnet.sh
https://dot.net/v1/dotnet-install.sh https://dot.net/v1/dotnet-install.sh
"
#
# Patches description
#
# runtime_add-rid-for-alpine-315.patch/_
# As of version 5.0.12, runtime does not have the RIDs for Alpine Linux 3.15. This patch adds them. See dotnet/core issue #6985
#
# runtime_link-order.patch
# For some reason, runtime does not link in the right order. This fixes that.
#
# runtime_non-portable-distrorid-fix-alpine.patch
# Runtime adds the extra subversion in its calculation of Alpine's DistroRID when a non-portable build, but does so inconsistently. This creates an error when it generates its nuget package
# Might be fixed by just making making package a portable build, which would make runtime_add-rid defunct, and make the targetRID linux-musl-x64 like for the dotnet-3.1 package
#
# build_darc-fix-alpine.patch
# Darc has a segmentation fault on Alpine due to not chosing the correct binary architecture. This patch deletes all the wrong ones so that it is forced to chose the correct one.
# See dotnet/source-build issue #1868, and dotnet/source-build issue #297 (which would also fix all the other RID issues.
#
# sdk_telemetry-optout.patch
# Optouts of telemetry gathering
#
source="
${source}
runtime_add-rid-for-alpine-315.patch runtime_add-rid-for-alpine-315.patch
runtime_link-order.patch runtime_link-order.patch
runtime_non-portable-distrorid-fix-alpine.patch runtime_non-portable-distrorid-fix-alpine.patch
build_darc-fix-alpine.patch build_darc-fix-alpine.patch
sdk_telemetry-optout.patch sdk_telemetry-optout.patch
" "
builddir="$srcdir/$pkgname" builddir="$srcdir/$pkgname"
# #
# A custom version of snapshot is used because Darc expects the build directory to be a git repo, thus the auto-generated tar.gz on github is not sufficient. # A custom version of snapshot is used because Darc expects the build directory
# There's a way to trick Darc into thinking its in a git repo but it's hardly elegant. Thus make sure to 'abuild snapshot' before 'abuild -r' # to be a git repo, thus the auto-generated tar.gz on github is not sufficient.
# There's a way to trick Darc into thinking its in a git repo but it's hardly
# elegant. Thus make sure to 'abuild snapshot' before 'abuild -r'
# #
snapshot() { snapshot() {
mkdir -p "$srcdir" mkdir -p "$srcdir"
cd "${srcdir}" cd "$srcdir"
if ! [ -d $pkgname.git ]; then if ! [ -d $pkgname.git ]; then
git clone $_giturl $pkgname.git || return 1 git clone $_giturl $pkgname.git
cd $pkgname.git cd $pkgname.git
else else
cd $pkgname.git cd $pkgname.git
git fetch || return 1 git fetch
fi fi
echo "Repo archive" echo "Repo archive"
mkfifo $pkgname-$pkgver.git mkfifo $pkgname-$pkgver.git
git bundle create - $_gittag > $pkgname-$pkgver.git & git bundle create - $_gittag > $pkgname-$pkgver.git &
zip --fifo "${SRCDEST}"/$pkgname-$pkgver.git.zip $pkgname-$pkgver.git zip --fifo "$SRCDEST"/$pkgname-$pkgver.git.zip $pkgname-$pkgver.git
rm $pkgname-$pkgver.git rm $pkgname-$pkgver.git
ln -s "$SRCDEST"/$pkgname-$pkgver.git.zip "$startdir"/$pkgname-$pkgver.git.zip ln -s "$SRCDEST"/$pkgname-$pkgver.git.zip "$startdir"/$pkgname-$pkgver.git.zip
@ -122,32 +104,17 @@ snapshot() {
unpack() { unpack() {
default_unpack default_unpack
cd "${srcdir}" cd "$srcdir"
git clone $pkgname-$pkgver.git $pkgname --branch $_gittag 1>/dev/null 2>&1 git clone $pkgname-$pkgver.git $pkgname --branch $_gittag 1>/dev/null 2>&1
} }
default_prepare() {
prepare() {
local i failed= local i failed=
[ -n "$builddir" -a -d "$builddir" ] && cd "$builddir" [ -n "$builddir" -a -d "$builddir" ] && cd "$builddir"
msg "Settings up bootstrap SDK"
if [ "${_bootstrap}" == 'true' ]; then
chmod +x "${srcdir}"/dotnet-install.sh
"$srcdir"/dotnet-install.sh --version ${_bootstrap_sdk} --install-dir ./
"$srcdir"/dotnet-install.sh --version ${_bootstrap_runtime} --install-dir ./ --runtime dotnet
else
cp -r /usr/share/dotnet/* ./
fi
# disable warnings
sed -i 's|skiptests|skiptests ignorewarnings|' repos/runtime.common.props
if ! have_patches; then if ! have_patches; then
return 0 return 0
fi fi
[ -d "$builddir" ] || { error "Is \$builddir set correctly?"; return 1; } [ -d "$builddir" ] || { error "Is \$builddir set correctly?"; return 1; }
msg "Deploying patches" msg "Deploying patches"
for i in $source; do for i in $source; do
case ${i%::*} in case ${i%::*} in
@ -155,14 +122,15 @@ prepare() {
patch ${patch_args:--p1} -i "$srcdir/$(filename_from_uri $i)" || failed="$failed $i" patch ${patch_args:--p1} -i "$srcdir/$(filename_from_uri $i)" || failed="$failed $i"
;; ;;
*.patch) *.patch)
local _package=$(echo ${i} | sed 's|_.*||') local _package=$(echo $i | sed 's|_.*||')
local _patch=$(echo ${i} | sed "s|${_package}_||") local _patch=$(echo $i | sed "s|"$_package"_||")
echo "cp $_patch -> $_package" echo "cp $_patch -> $_package"
[ -d patches/$_package ] || mkdir patches/$_package [ -d patches/$_package ] || mkdir patches/$_package
cp "$srcdir"/"$i" patches/${_package}/${_patch} cp "$srcdir"/"$i" patches/$_package/$_patch
;; ;;
esac esac
done done
if [ -z "$failed" ]; then if [ -z "$failed" ]; then
return 0 return 0
fi fi
@ -173,29 +141,35 @@ prepare() {
return 1 return 1
} }
prepare() {
default_prepare
msg "Settings up bootstrap SDK"
if [ "$_bootstrap" == 'true' ]; then
chmod +x "$srcdir"/dotnet-install.sh
"$srcdir"/dotnet-install.sh --version $_bootstrap_sdk --install-dir ./
"$srcdir"/dotnet-install.sh --version $_bootstrap_runtime --install-dir ./ --runtime dotnet
else
cp -r /usr/share/dotnet/* ./
fi
# disable warnings
sed -i 's|skiptests|skiptests ignorewarnings|' repos/runtime.common.props
}
pkgver() { pkgver() {
cd "$builddir" cd "$builddir"
local _runtimever=$(xmllint --xpath "//Dependency[@Name='Microsoft.NETCore.App.Runtime.win-x64']/@Version" eng/Version.Details.xml | cut -d '=' -f 2 | sed 's/^"//; s/"$//') local _runtimever=$(xmllint --xpath "//Dependency[@Name='Microsoft.NETCore.App.Runtime.win-x64']/@Version" eng/Version.Details.xml | cut -d '=' -f 2 | sed 's/^"//; s/"$//')
local _sdkver=$(xmllint --xpath "//Dependency[@Name='Microsoft.NET.Sdk']/@Version" eng/Version.Details.xml | cut -d '=' -f 2 | sed 's/^"//; s/"$//; s/-rtm.*//; s/-servicing.*//') local _sdkver=$(xmllint --xpath "//Dependency[@Name='Microsoft.NET.Sdk']/@Version" eng/Version.Details.xml | cut -d '=' -f 2 | sed 's/^"//; s/"$//; s/-rtm.*//; s/-servicing.*//')
echo "${_runtimever}.sdk${_sdkver##*.}" echo "$_runtimever.sdk${_sdkver##*.}"
} }
build() { build() {
cd "${builddir}"
msg "Building $pkgname-$pkgver" msg "Building $pkgname-$pkgver"
export SOURCE_BUILD_SKIP_SUBMODULE_CHECK=1 export SOURCE_BUILD_SKIP_SUBMODULE_CHECK=1
#
# Notes
#
# Ideally would like some parity between dotnet-3.1 and dotnet-5.0 on the question of the TargetRid. Builds on 3.1 work only if TargetRid is set to linux-musl-* while builds
# on 5.0 work well when we let the build system generate its own (barring above patches, of course). It would probably be best to let the system do its thing and fix 3.1's
# RID generator functions.
#
./build.sh \ ./build.sh \
--with-sdk ../$pkgname \ --with-sdk ../$pkgname \
/p:ArchiveDownloadedPackages=true \ /p:ArchiveDownloadedPackages=true \
@ -216,7 +190,7 @@ package() {
aspnet-targeting-pack-5.0 aspnet-targeting-pack-5.0
netstandard-targeting-pack netstandard-targeting-pack
' '
mkdir -p "${pkgdir}" mkdir -p "$pkgdir"
} }
sdk() { sdk() {
@ -228,17 +202,13 @@ sdk() {
netstandard-targeting-pack netstandard-targeting-pack
aspnet-targeting-pack-5.0 aspnet-targeting-pack-5.0
' '
# XXX: This is a hack to allow this abuild to depend on itself. Adding "dotnet"
# to makedepends would not work, because abuild implicitly removes $pkgname
# and $subpackages from the abuild's dependencies.
provides="dotnet-bootstrap-sdk-5.0=$pkgver-r$pkgrel" provides="dotnet-bootstrap-sdk-5.0=$pkgver-r$pkgrel"
cd "$builddir"/artifacts/x64/Release cd "$builddir"/artifacts/x64/Release
install -dm 755 "$subpkgdir"/usr/share/dotnet "$subpkgdir"/usr/share/licenses install -dm 755 "$subpkgdir"/usr/share/dotnet "$subpkgdir"/usr/share/licenses
bsdtar -xf dotnet-sdk-*.tar.gz -C "${subpkgdir}"/usr/share/dotnet/ --no-same-owner sdk templates bsdtar -xf dotnet-sdk-*.tar.gz -C "$subpkgdir"/usr/share/dotnet/ --no-same-owner sdk templates
ln -s dotnet-host "${subpkgdir}"/usr/share/licenses/dotnet-sdk-5.0 ln -s dotnet-host "$subpkgdir"/usr/share/licenses/dotnet-sdk-5.0
} }
@ -253,11 +223,11 @@ host() {
install -dm 755 "$subpkgdir"/etc/profile.d "$subpkgdir"/usr/bin "$subpkgdir"/usr/lib "$subpkgdir"/usr/share/dotnet "$subpkgdir"/usr/share/licenses/dotnet-host install -dm 755 "$subpkgdir"/etc/profile.d "$subpkgdir"/usr/bin "$subpkgdir"/usr/lib "$subpkgdir"/usr/share/dotnet "$subpkgdir"/usr/share/licenses/dotnet-host
bsdtar -xf dotnet-sdk-*.tar.gz -C "${subpkgdir}"/usr/share/dotnet/ --no-same-owner dotnet host bsdtar -xf dotnet-sdk-*.tar.gz -C "$subpkgdir"/usr/share/dotnet/ --no-same-owner dotnet host
bsdtar -xf dotnet-sdk-*.tar.gz -C "${subpkgdir}"/usr/share/licenses/dotnet-host/ --no-same-owner LICENSE.txt ThirdPartyNotices.txt bsdtar -xf dotnet-sdk-*.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 ln -s /usr/share/dotnet/dotnet "$subpkgdir"/usr/bin/dotnet
ln -s /usr/share/dotnet/host/fxr/${pkgver}/libhostfxr.so "${subpkgdir}"/usr/lib/libhostfxr.so ln -s /usr/share/dotnet/host/fxr/$pkgver/libhostfxr.so "$subpkgdir"/usr/lib/libhostfxr.so
install -Dm 644 "${srcdir}"/dotnet.sh -t "${subpkgdir}"/etc/profile.d/ install -Dm 644 "$srcdir"/dotnet.sh -t "$subpkgdir"/etc/profile.d/
} }
runtime() { runtime() {
@ -279,17 +249,13 @@ runtime() {
zlib zlib
openssl openssl
' '
# XXX: This is a hack to allow this abuild to depend on itself. Adding "dotnet"
# # to makedepends would not work, because abuild implicitly removes $pkgname
# # and $subpackages from the abuild's dependencies.
#
provides="dotnet-bootstrap-runtime-5.0=$pkgver-r$pkgrel" provides="dotnet-bootstrap-runtime-5.0=$pkgver-r$pkgrel"
cd "$builddir"/artifacts/x64/Release cd "$builddir"/artifacts/x64/Release
install -dm 755 "$subpkgdir"/usr/share/dotnet "$subpkgdir"/usr/share/licenses install -dm 755 "$subpkgdir"/usr/share/dotnet "$subpkgdir"/usr/share/licenses
bsdtar -xf dotnet-sdk-*.tar.gz -C "${subpkgdir}"/usr/share/dotnet/ --no-same-owner shared/Microsoft.NETCore.App bsdtar -xf dotnet-sdk-*.tar.gz -C "$subpkgdir"/usr/share/dotnet/ --no-same-owner shared/Microsoft.NETCore.App
ln -s dotnet-host "${subpkgdir}"/usr/share/licenses/dotnet-runtime-5.0 ln -s dotnet-host "$subpkgdir"/usr/share/licenses/dotnet-runtime-5.0
} }
aspnet_runtime() { aspnet_runtime() {
@ -299,8 +265,8 @@ aspnet_runtime() {
cd "$builddir"/artifacts/x64/Release cd "$builddir"/artifacts/x64/Release
install -dm 755 "$subpkgdir"/usr/share/dotnet "$subpkgdir"/usr/share/licenses install -dm 755 "$subpkgdir"/usr/share/dotnet "$subpkgdir"/usr/share/licenses
bsdtar -xf dotnet-sdk-*.tar.gz -C "${subpkgdir}"/usr/share/dotnet/ --no-same-owner shared/Microsoft.AspNetCore.App bsdtar -xf dotnet-sdk-*.tar.gz -C "$subpkgdir"/usr/share/dotnet/ --no-same-owner shared/Microsoft.AspNetCore.App
ln -s dotnet-host "${subpkgdir}"/usr/share/licenses/aspnet-runtime-5.0 ln -s dotnet-host "$subpkgdir"/usr/share/licenses/aspnet-runtime-5.0
} }
netstandard_targeting_pack() { netstandard_targeting_pack() {
@ -309,8 +275,8 @@ netstandard_targeting_pack() {
cd "$builddir"/artifacts/x64/Release cd "$builddir"/artifacts/x64/Release
install -dm 755 "$subpkgdir"/usr/share/dotnet "$subpkgdir"/usr/share/licenses install -dm 755 "$subpkgdir"/usr/share/dotnet "$subpkgdir"/usr/share/licenses
bsdtar -xf dotnet-sdk-*.tar.gz -C "${subpkgdir}"/usr/share/dotnet/ --no-same-owner packs/NETStandard.Library.Ref bsdtar -xf dotnet-sdk-*.tar.gz -C "$subpkgdir"/usr/share/dotnet/ --no-same-owner packs/NETStandard.Library.Ref
ln -s dotnet-host "${subpkgdir}"/usr/share/licenses/netstandard-targeting-pack-5.0 ln -s dotnet-host "$subpkgdir"/usr/share/licenses/netstandard-targeting-pack-5.0
} }
targeting_pack() { targeting_pack() {
@ -320,8 +286,8 @@ targeting_pack() {
cd "$builddir"/artifacts/x64/Release cd "$builddir"/artifacts/x64/Release
install -dm 755 "$subpkgdir"/usr/share/dotnet "$subpkgdir"/usr/share/licenses install -dm 755 "$subpkgdir"/usr/share/dotnet "$subpkgdir"/usr/share/licenses
bsdtar -xf dotnet-sdk-*.tar.gz -C "${subpkgdir}"/usr/share/dotnet/ --no-same-owner packs/Microsoft.NETCore.App.Host.$_targetrid packs/Microsoft.NETCore.App.Ref bsdtar -xf dotnet-sdk-*.tar.gz -C "$subpkgdir"/usr/share/dotnet/ --no-same-owner packs/Microsoft.NETCore.App.Host.* packs/Microsoft.NETCore.App.Ref
ln -s dotnet-host "${subpkgdir}"/usr/share/licenses/dotnet-targeting-pack-5.0 ln -s dotnet-host "$subpkgdir"/usr/share/licenses/dotnet-targeting-pack-5.0
} }
aspnet_targeting_pack() { aspnet_targeting_pack() {
@ -331,11 +297,10 @@ aspnet_targeting_pack() {
cd "$builddir"/artifacts/x64/Release cd "$builddir"/artifacts/x64/Release
install -dm 755 "$subpkgdir"/usr/share/dotnet "$subpkgdir"/usr/share/licenses install -dm 755 "$subpkgdir"/usr/share/dotnet "$subpkgdir"/usr/share/licenses
bsdtar -xf dotnet-sdk-*.tar.gz -C "${subpkgdir}"/usr/share/dotnet/ --no-same-owner packs/Microsoft.AspNetCore.App.Ref bsdtar -xf dotnet-sdk-*.tar.gz -C "$subpkgdir"/usr/share/dotnet/ --no-same-owner packs/Microsoft.AspNetCore.App.Ref
ln -s dotnet-host "${subpkgdir}"/usr/share/licenses/aspnet-targeting-pack-5.0 ln -s dotnet-host "$subpkgdir"/usr/share/licenses/aspnet-targeting-pack-5.0
} }
# vim: ts=2 sw=2 et:
sha512sums=" sha512sums="
8ad768f65bd0358282ed80a1e60cfccbe003b9fdd087918d56839701a02a2fe9ebf00bde0213293743fbb7602db5064de10251419b7b53df0fdd708e761a0d15 dotnet-5.0-5.0.12.git.zip 8ad768f65bd0358282ed80a1e60cfccbe003b9fdd087918d56839701a02a2fe9ebf00bde0213293743fbb7602db5064de10251419b7b53df0fdd708e761a0d15 dotnet-5.0-5.0.12.git.zip
f58bd83b709dcb4b0b67830756069c34258a167b33cb290cbf30f21d69d75402d38e013fd7bbf00640fe19e397f78df6ff787cf8484ee8967d5b8809f033eafb dotnet.sh f58bd83b709dcb4b0b67830756069c34258a167b33cb290cbf30f21d69d75402d38e013fd7bbf00640fe19e397f78df6ff787cf8484ee8967d5b8809f033eafb dotnet.sh

View file

@ -0,0 +1,26 @@
# Description
APKBUILD for dotnet 5.0.
# Known issues
The build itself has some odd kinks here and there that various patches
addresses. Please feel free to share any notes from your build environment.
# Patch notes
* runtime_add-rid-for-alpine-315.patch/_
As of version 5.0.12, runtime does not have the RIDs for Alpine Linux 3.15.
This patch adds them. See dotnet/core issue #6985
* runtime_link-order.patch
For some reason, runtime does not link in the right order. This fixes that.
* runtime_non-portable-distrorid-fix-alpine.patch
Runtime adds the extra subversion in its calculation of Alpine's DistroRID
when a non-portable build, but does so inconsistently. This creates an error
when it generates its nuget package.
* build_darc-fix-alpine.patch
Darc has a segmentation fault on Alpine due to not chosing the correct
binary architecture. This patch deletes all the wrong ones so that it
is forced to chose the correct one. See dotnet/source-build issue #1868.
* sdk_telemetry-optout.patch
Optouts of telemetry gathering