-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy pathsnapcraft.yaml
97 lines (89 loc) · 2.77 KB
/
snapcraft.yaml
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
name: edumips64
version: '1.3.0'
summary: A free visual and cross-platform MIPS64 CPU simulator.
description: EduMIPS64 is a free MIPS64 visual simulator and debugger, used as a teaching tool in Computer Architecture courses.
grade: stable
base: core22
confinement: strict
parts:
edumips64:
plugin: nil
override-build: |
# Gets the host and port from a proxy URL
# $1 = the proxy URL, such as "http://10.10.10.1:8222/"
# stolen from https://github.com/jgneff/openjfx/blob/30aadb4f29638171a259c47cc2b9cddc6b4aea6c/snap/snapcraft.yaml#L131
getproxy () {
# Parses the URL using shell parameter expansion
tail=${1#http*://}
head=${tail%%/*}
host=${head%:*}
port=${head##*:}
}
# Adds Java system properties using shell positional parameters
set --
if [ -n "${http_proxy:-}" ]; then
getproxy "$http_proxy"
set -- "$@" "-Dhttp.proxyHost=$host" "-Dhttp.proxyPort=$port"
fi
if [ -n "${https_proxy:-}" ]; then
getproxy "$https_proxy"
set -- "$@" "-Dhttps.proxyHost=$host" "-Dhttps.proxyPort=$port"
fi
craftctl default
mkdir -p "$CRAFT_PART_INSTALL"/jar
bash gradlew --no-daemon "$@" jar && \
ls -ld build/libs/* && \
mv build/libs/edumips64-*.jar "$CRAFT_PART_INSTALL"/jar/edumips64.jar && \
ls $CRAFT_PART_INSTALL/jar/*.jar -ld
source: .
# Install Python 3.10 and make it the default Python3 before the build stage,
# so that the build can use it and satisfy the Python >= 3.8 dependency from
# Sphinx >= 6.
override-pull: |
snapcraftctl pull
apt install -y python3.10
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
build-packages:
- git
- pkg-config
- openjdk-17-jdk
- ca-certificates-java
- ca-certificates
- python3-pip
# Needed to build pillow, a rst2pdf dependency.
- python3.10-dev
- python3.10-venv
- zlib1g-dev
- libjpeg-dev
- libtiff-dev
- libfreetype6-dev
- liblcms2-dev
- libwebp-dev
- libopenjp2-7-dev
- libraqm-dev
- libxcb-xfixes0-dev
# pycairo dependencies
- libcairo2-dev
stage-packages:
- openjdk-17-jre
scripts:
plugin: dump
source: scripts
apps:
edumips64:
desktop: edumips64.desktop
command: edumips64-snap-wrapper.sh
environment:
JAVA_HOME: $SNAP/usr/lib/jvm/java-17-openjdk-amd64
PATH: $JAVA_HOME/jre/bin:$PATH
plugs:
- home
- x11
- desktop
edumips64-cli:
command: edumips64-snap-wrapper.sh --headless
environment:
JAVA_HOME: $SNAP/usr/lib/jvm/java-17-openjdk-amd64
PATH: $JAVA_HOME/jre/bin:$PATH
plugs:
- home