-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsnapcraft.yaml
More file actions
107 lines (94 loc) · 3.6 KB
/
Copy pathsnapcraft.yaml
File metadata and controls
107 lines (94 loc) · 3.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: dotnet
base: core22
adopt-info: dotnet-installer
summary: .NET CLI tools, SDK, and Runtime
description: |
.NET is the free, open-source, cross-platform framework for building modern
apps and powerful cloud services that work on Android, iOS, GNU/Linux, macOS
and Windows.
.
This Snap also includes a powerful installer tool that allows you to manage
your .NET installation and gives you the possibility to install as many
multiple versions of .NET side-by-side as you want, as well as receive
monthly security and feature updates whenever they become available.
confinement: classic
package-repositories:
- type: apt
ppa: dotnet/snaps
priority: always
architectures:
- build-on: [amd64]
build-for: [amd64]
- build-on: [arm64]
build-for: [arm64]
parts:
dotnet-installer:
plugin: dump
source: .
build-packages:
- dotnet-sdk-11.0
- patchelf
stage-packages:
- jq
- libicu70
build-attributes:
- enable-patchelf
override-build: |
/usr/bin/dotnet --info
include_prerelease=false
git_branch=$(git rev-parse --abbrev-ref HEAD)
if [ "$git_branch" != "release/stable" ]; then
echo "On a non-stable branch, enabling prerelease versions"
include_prerelease=true
craftctl set grade=devel
else
echo "On stable branch, building stable release"
craftctl set grade=stable
fi
SNAP_VERSION=$(/usr/bin/dotnet --list-runtimes | grep NETCore.App | awk '{print $2}' | sort -r | head -n 1)
craftctl set version="$SNAP_VERSION"
if [ "${CRAFT_ARCH_BUILD_FOR}" = "amd64" ]; then
RUNTIME_RID="linux-x64"
elif [ "${CRAFT_ARCH_BUILD_FOR}" = "arm64" ]; then
RUNTIME_RID="linux-arm64"
else
echo "Unsupported architecture (${CRAFT_ARCH_BUILD_FOR})"
exit 1
fi
/usr/bin/dotnet publish src/Dotnet.Installer.Console --output "${CRAFT_PART_INSTALL}" \
--configuration Release --self-contained true -r "${RUNTIME_RID}" \
-p:DebugSymbols=false -p:DebugType=none -p:PublishSingleFile=true -p:IncludePrerelease=${include_prerelease}
chmod 555 "${CRAFT_PART_INSTALL}/Dotnet.Installer.Console"
patchelf --force-rpath --set-rpath \
\$ORIGIN/netcoredeps:\$ORIGIN/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:/snap/core22/current/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR} \
${CRAFT_PART_INSTALL}/Dotnet.Installer.Console
dotnet-host:
plugin: nil
after: [dotnet-installer]
build-packages:
- patchelf
stage-packages:
- dotnet-hostfxr-11.0
override-build: |
DOTNET_VERSION=$(craftctl get version)
INTERPRETER=$(find /usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR} -type f -name ld-linux** | head -n 1)
patchelf --set-interpreter /snap/core22/current${INTERPRETER} ${CRAFT_PART_INSTALL}/usr/lib/dotnet/dotnet
patchelf --force-rpath --set-rpath \
/snap/dotnet/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:/snap/core22/current/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR} \
${CRAFT_PART_INSTALL}/usr/lib/dotnet/dotnet
patchelf --force-rpath --set-rpath \
/snap/dotnet/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:/snap/core22/current/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR} \
${CRAFT_PART_INSTALL}/usr/lib/dotnet/host/fxr/${DOTNET_VERSION}/libhostfxr.so
apps:
dotnet:
command: Scripts/dotnet-launcher.sh
environment:
DOTNET_INSTALL_DIR: $SNAP_COMMON/dotnet
dotnet-installer:
command: Scripts/dotnet-installer-launcher.sh
environment:
DOTNET_INSTALL_DIR: $SNAP_COMMON/dotnet
lint:
ignore:
- library:
- usr/lib/**/libicu*