ayaports/apk/v3.15/main/dotnet-3.1/APKBUILD
2021-12-05 18:27:45 +00:00

321 lines
9.8 KiB
Text

# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
# Based on Archlinux PKGBUILD by:
# Maxime Gauduin <alucryd@archlinux.org>
# Kristian Mosegaard <kristian@mosen.me>
# Max Liebkies <mail@maxliebkies.de>
# Krzysztof Bogacki <krzysztof.bogacki@leancode.pl>
# Build vars
_bootstrap=false
_bootstrap_sdk=3.1.20-r2
_bootstrap_runtime=3.1.20-r2
_llvmver=12
pkgname=dotnet-3.1
pkgdesc='The .NET Core SDK'
pkgver=3.1.20
pkgrel=2
arch='x86_64'
url=https://www.microsoft.com/net/core
license='MIT'
makedepends="
bash
clang
cmake
git
icu-dev
inetutils-syslogd
krb5-dev
libgit2-dev
libunwind-dev
libxml2-dev
libxml2-utils
lldb-dev
llvm$_llvmver-dev
lttng-ust-dev
linux-headers
nodejs
openssl-dev
zlib-dev
"
if [ $_bootstrap != 'true' ]; then
makedepends="
$makedepends
dotnet-bootstrap-sdk-3.1
dotnet-bootstrap-runtime-3.1
"
fi
subpackages="
dotnet-sdk-3.1:sdk
dotnet-runtime-3.1:runtime
aspnet-runtime-3.1:aspnet_runtime:noarch
dotnet-targeting-pack-3.1:targeting_pack
aspnet-targeting-pack-3.1:aspnet_targeting_pack:noarch
"
if [ $_bootstrap == 'true' ]; then
subpackages="
$subpackages
dotnet-host:host
netstandard-targeting-pack:netstandard_tagering_pack:noarch
"
fi
_gittag=v$pkgver-runtime
_giturl=https://github.com/dotnet/source-build
options="!check"
source="
$pkgname-$pkgver.git.zip
dotnet.sh
applications-insights_fix-net40-location.patch
coreclr_fix-build-on-Alpine-edge-45352.patch
coreclr_non-portable-distrorid-fix-alpine.patch
core-setup_rid-plat-generation-on-alpine-fix.patch
installer_generate-layout-core-setup-blob-path-fix.patch
corefx_fix-build-clang10.patch
corefx_added-alpine-315-rid.patch
build_coreclr-tools-path.patch
build_darc-fix-alpine.patch
sdk_telemetry-optout.patch
"
builddir="$srcdir/$pkgname"
snapshot() {
mkdir -p "$srcdir"
cd "$srcdir"
if ! [ -d $pkgname.git ]; then
git clone $_giturl $pkgname.git
cd $pkgname.git
else
cd $pkgname.git
git fetch
fi
echo "Repo archive"
mkfifo $pkgname-$_gittag.git
git bundle create - $_gittag > $pkgname-$_gittag.git &
zip --fifo "$SRCDEST"/$pkgname-$_gittag.git.zip $pkgname-$_gittag.git
rm $pkgname-$_gittag.git
ln -s "$SRCDEST"/$pkgname-$_gittag.git.zip "$startdir"/$pkgname-$_gittag.git.zip
}
unpack() {
default_unpack
cd "$srcdir"
git clone $pkgname-$_gittag.git $pkgname --branch $_gittag 1>/dev/null 2>&1
}
default_prepare() {
local i failed=
[ -n "$builddir" -a -d "$builddir" ] && cd "$builddir"
if ! have_patches; then
return 0
fi
[ -d "$builddir" ] || { error "Is \$builddir set correctly?"; return 1; }
msg "Deploying patches"
for i in $source; do
case ${i%::*} in
build_*.patch)
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 "cp $_patch -> $_package"
[ -d patches/$_package ] || mkdir patches/$_package
cp "$srcdir"/"$i" patches/$_package/$_patch
;;
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
return 1
}
prepare() {
default_prepare
msg "Settings up bootstrap SDK"
if [ "$_bootstrap" == 'true' ]; then
chmod +x "$srcdir"/dotnet-install.sh
"$srcdir"/dotnet-install.sh --install-dir ./
"$srcdir"/dotnet-install.sh --install-dir ./ --runtime dotnet
else
cp -r /usr/share/dotnet/* ./
fi
# disable warnings
sed -i 's|skiptests|skiptests ignorewarnings|' repos/runtime.common.props
}
pkgver() {
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 _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##*.}"
}
build() {
export SOURCE_BUILD_SKIP_SUBMODULE_CHECK=1
./build.sh \
--with-sdk ../$pkgname \
/p:ArchiveDownloadedPackages=true \
/p:ContinueOnPrebuiltBaselineError=true \
/p:SkipPortableRuntimeBuild=true \
/p:SkipPrebuiltEnforcement=true \
/p:UseSystemLibraries=true \
/p:UseSystemLibunwind=true
}
package() {
depends='
dotnet-sdk-3.1
dotnet-host
dotnet-runtime-3.1
dotnet-targetting-pack-3.1
aspnet-runtime-3.1
aspnet-targeting-pack-3.1
netstandard-targeting-pack
'
mkdir -p "$pkgdir"
}
sdk() {
depends='
dotnet-runtime-3.1
dotnet-targeting-pack-3.1
musl
libgcc
netstandard-targeting-pack
aspnet-targeting-pack-3.1
'
provides="dotnet-bootstrap-sdk-3.1=$pkgver-r$pkgrel"
cd "$builddir"/artifacts/x64/Release
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
ln -s dotnet-host "$subpkgdir"/usr/share/licenses/dotnet-sdk-3.1
}
host() {
pkgdesc='A generic driver for the .NET Core Command Line Interface'
depends='
gcc
musl
'
cd $builddir/artifacts/x64/Release
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/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/host/fxr/$pkgver/libhostfxr.so "$subpkgdir"/usr/lib/libhostfxr.so
install -Dm 644 "$srcdir"/dotnet.sh -t "$subpkgdir"/etc/profile.d/
}
runtime() {
pkgdesc='The .NET Core runtime'
makedepends='
icu-dev
krb5-dev
libunwind-dev
zlib-dev
openssl-dev
'
depends='
dotnet-host
libgcc
musl
icu
krb5-libs
libunwind
zlib
openssl
'
provides="dotnet-bootstrap-runtime-3.1=$pkgver-r$pkgrel"
cd "$builddir"/artifacts/x64/Release
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
ln -s dotnet-host "$subpkgdir"/usr/share/licenses/dotnet-runtime-3.1
}
aspnet_runtime() {
pkgdesc='The ASP.NET Core runtime'
depends='
dotnet-runtime-3.1
'
cd "$builddir"/artifacts/x64/Release
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
ln -s dotnet-host "$subpkgdir"/usr/share/licenses/aspnet-runtime-3.1
}
targeting_pack() {
pkgdesc='The .NET Core targeting pack'
depends='netstandard-targeting-pack'
cd "$builddir"/artifacts/x64/Release
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.* packs/Microsoft.NETCore.App.Ref
ln -s dotnet-host "$subpkgdir"/usr/share/licenses/dotnet-targeting-pack-3.1
}
netstandard_targeting_pack() {
pkgdesc='The .NET Standard targeting pack'
cd "$builddir"/artifacts/x64/Release
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
ln -s dotnet-host "$subpkgdir"/usr/share/licenses/netstandard-targeting-pack-3.1
}
aspnet_targeting_pack() {
pkgdesc='The ASP.NET Core targeting pack'
depends='
dotnet-targeting-pack-3.1
'
cd "$builddir"/artifacts/x64/Release
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
ln -s dotnet-host "$subpkgdir"/usr/share/licenses/aspnet-targeting-pack-3.1
}
sha512sums="
9e5e2bccb4338a18996e53e80c45525b3ba332d11cd896d1ba72bd8406735281aae7b98f614212a99475621000ca3fa5daf2d639953b163196aa2884c8773f2e dotnet-3.1-3.1.20.git.zip
e61b9e3e5a2305646a616d598378230c9755c5dd5363692cc363f8f4add3807563c324dd86f3a7ae9d358c82d730608e7b293935a2b6c81c0c0f62d752a0a1cf dotnet.sh
0469d571d0f7634d3794761f04e1cbff9d27d642d134a11a13560574280e5cab6f366eb8820e61a449eca99470fdea8d9f6a7d97b633059b2fe25257ed1579e6 applications-insights_fix-net40-location.patch
b3475c0b727c5258c7bc6f4c53305f9ced991e57f9f46a2ad323bed40627662eb8bf57286bf6a22d9a22bfdea9282da4630dd094166f0805c783aece5df5dff3 coreclr_fix-build-on-Alpine-edge-45352.patch
6ac9bdbc47b24cafbb3386e21756c540313680fed6994791ff5a3c75b422742ecf102d7736ac79de6d7f1a0892464f83cbab181ed505e4d827dc7f113e3a4017 coreclr_non-portable-distrorid-fix-alpine.patch
720fefc20ef4985917cfd243bbef427862af9ea0156cc6c78502daf8da5f6293bba0a1a5180c88dc145921592d533a8508b30eab2f388be1be7d6d10b6ab91d0 core-setup_rid-plat-generation-on-alpine-fix.patch
e67f4f92659892aa65de7192dfbbf2cafab17e1a4ef60e4981507c7309da61b866864a18b0452e47cee2ce9253032c3f4c39e4426b7b2216ffa73236239c9669 installer_generate-layout-core-setup-blob-path-fix.patch
eb107ae9765d9eebe2f2ab4cebda4d3f76d683e21d88f806bb008e29051ad196ea637d410075b7ed61f4997a22085e4c36021860b82c4c0822c23ba9ded9656a corefx_fix-build-clang10.patch
72092a7323bb91e8d011ad09cefcc3fd0e4ebfc7c258895d454cc1d015eda36c7de97b09af76a492fa689f39b9216435faace77edd0ca75d8e39a34ed6641840 corefx_added-alpine-315-rid.patch
2334e36d5bb24b9b834800407c6110c09262af20a4353e92ef1897855f27eab117270dda0637071010a7a5ac8c4a5d4032240a7b659d8576801b503b66b14ab7 build_coreclr-tools-path.patch
74767c34f15e0eaee3682516e093296621efaeeb6d84e62d826587db9b559fb7c00c42aafbf4fdfd34460d1cf16edad3fd5f720f2b37f8bf52b26d7f73f79d5e build_darc-fix-alpine.patch
c96700138ea919c169c3a394f1bf9548c7f86b1ba42b193d6e7bb0a1e2bd6f7f202befbc61246a8720181cd40e1f7fa36a6c208eb19b03a23e21994136fb2507 sdk_telemetry-optout.patch
"