-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
snapcraft.yaml
254 lines (233 loc) · 7.6 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
# snapcraft.yaml - builds a Snap package of OpenJFX
# Copyright (C) 2020-2024 John Neffenger
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
name: openjfx
title: OpenJFX
summary: Current JavaFX release and early-access builds
description: |
OpenJFX is the official open-source project that develops JavaFX,
a cross-platform application framework for developing and deploying
rich client applications that operate consistently across a diverse
set of platforms.
This package, together with OpenJDK 21 or later, provides everything
you need to develop a JavaFX application on Linux, including all
of the latest modular JAR files, native libraries, JMOD archives,
API documentation, and source code of JavaFX.
Installing this package does not replace the JavaFX provided by your
Linux distribution but instead allows you to use both of them side by
side. To get started, see the README file for this package on GitHub:
https://github.com/jgneff/openjfx
Java and OpenJDK are trademarks or registered trademarks of Oracle
and/or its affiliates.
adopt-info: jfx
license: GPL-2.0-with-classpath-exception
base: core18
grade: devel
confinement: strict
architectures:
- build-on: amd64
- build-on: arm64
- build-on: armhf
- build-on: i386
- build-on: ppc64el
- build-on: s390x
slots:
jfx-22-1804:
interface: content
source:
read: [$SNAP/sdk, $SNAP/usr/lib]
jfx-23-1804:
interface: content
source:
read: [$SNAP/sdk, $SNAP/usr/lib]
apps:
openjfx:
command: bin/openjfx.sh
environment:
LC_ALL: C.UTF-8
parts:
bin:
plugin: dump
source: .
source-type: local
stage: [bin]
jfx:
plugin: nil
source: https://github.com/openjdk/jfx.git
source-type: git
source-tag: $SNAPCRAFT_PROJECT_VERSION
source-depth: 1
build-snaps:
- bootjdk/latest/edge
- openjdk/latest/stable
build-packages:
- curl
- pkg-config
- libgtk2.0-dev
- libxtst-dev
- libgtk-3-dev
- libxxf86vm-dev
override-pull: |
release=23
giturl=https://github.com/openjdk/jfx.git
tagurl=https://github.com/openjdk/jfx/tags.atom
# Gets the version from the latest release tag on GitHub
# $1 = feature release number (formerly "major" version)
# $2 = URL of Atom web feed providing recent tags
getversion() {
local feature=$1
local webfeed=$2
curl -s "$webfeed" | grep "<title>${feature}[.0-9]*+[^0]" \
| sed -E -e '1!d' -e 's| *<title>(.*)</title>|\1|'
}
# Sets the version and saves its environment variable
# $1 = the version string
setversion() {
snapcraftctl set-version "$1"
printf "export SNAPCRAFT_PROJECT_VERSION=%s\n" "$1" \
> /tmp/snapcraft-project-version
}
# See https://forum.snapcraft.io/t/17597
if [ -z "$SNAPCRAFT_PROJECT_VERSION" ]; then
version=$(getversion $release $tagurl)
setversion "$version"
git clone --branch "$version" --depth 1 \
$giturl "$SNAPCRAFT_PART_SRC"
else
snapcraftctl pull
fi
build-environment:
- JAVA_HOME: /snap/bootjdk/current/jdk
- JDK_DOCS: file:///snap/openjdk/current/jdk/docs/api
override-build: |
# Gets the host and port from a proxy URL
# $1 = the proxy URL, such as "http://10.10.10.1:8222/"
getproxy () {
# Parses the URL using shell parameter expansion
tail=${1#http*://}
head=${tail%%/*}
host=${head%:*}
port=${head##*:}
}
# Loads the version environment variable if not defined
if [ -z "$SNAPCRAFT_PROJECT_VERSION" ]; then
. /tmp/snapcraft-project-version
fi
# 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
# Sets the environment variable for reproducible builds
SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
export SOURCE_DATE_EPOCH
# Builds JavaFX
bash gradlew --no-daemon "$@" \
-PPROMOTED_BUILD_NUMBER="${SNAPCRAFT_PROJECT_VERSION#*+}" \
-PRELEASE_SUFFIX="-ea" \
-PJDK_DOCS="$JDK_DOCS" \
sdk jmods javadoc
# Installs the build output and extracts the Java source files
cd build || exit
mv sdk jmods javadoc "$SNAPCRAFT_PART_INSTALL"
cd "$SNAPCRAFT_PART_INSTALL" || exit
mkdir -p sdk/src
cd sdk/src || exit
"$JAVA_HOME/bin/jar" -xf ../src.zip
organize:
jmods: sdk/jmods
javadoc: sdk/api
stage-packages:
# Adds library packages suggested by Snapcraft plus some GTK modules
- libatk1.0-0
- libatk-bridge2.0-0
- libatspi2.0-0
- libcairo2
- libcairo-gobject2
- libdatrie1
- libepoxy0
- libfontconfig1
- libfreetype6
- libgdk-pixbuf2.0-0
- libgl1
- libglvnd0
- libglx0
- libgraphite2-3
- libgtk2.0-0
- libgtk-3-0
- libharfbuzz0b
- libpango-1.0-0
- libpangocairo-1.0-0
- libpangoft2-1.0-0
- libpixman-1-0
- libpng16-16
- libthai0
- libwayland-client0
- libwayland-cursor0
- libwayland-egl1
- libx11-6
- libxau6
- libxcb1
- libxcb-render0
- libxcb-shm0
- libxcomposite1
- libxcursor1
- libxdamage1
- libxdmcp6
- libxext6
- libxfixes3
- libxi6
- libxinerama1
- libxkbcommon0
- libxrandr2
- libxrender1
- libxtst6
# Gtk-Message: 16:12:52.145: Failed to load module "canberra-gtk-module"
- libcanberra-gtk3-module
# Gtk-Message: 10:57:54.572: Failed to load module "pk-gtk-module"
- packagekit-gtk3-module
override-prime: |
# The following code fixes the error:
# GdkPixbuf-WARNING **: 16:12:52.106: Cannot open pixbuf loader module
# file '/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders.cache':
# No such file or directory
#
# This likely means that your installation is broken.
# Try running the command
# gdk-pixbuf-query-loaders > \
# /usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders.cache
# to make things work again for the time being.
snapcraftctl prime
libdir=usr/lib/$SNAPCRAFT_ARCH_TRIPLET/gdk-pixbuf-2.0
libver=2.10.0
cd "$SNAPCRAFT_PRIME" || exit
"$libdir/gdk-pixbuf-query-loaders" > "$libdir/$libver/loaders.cache"
del:
after: [jfx]
plugin: nil
# Deletes files and links already available in the base snap
override-prime: |
cd "$SNAPCRAFT_PRIME" || exit
base=/snap/core18/current
for d in etc lib usr/lib usr/share var; do
find "$d" -type f -exec test -f "$base/{}" \; -delete
find "$d" -type l -exec test -L "$base/{}" \; -delete
done
find ./* -type d -empty -exec test -d "$base/{}" \; -delete