-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsnapcraft.yaml
299 lines (271 loc) · 8.86 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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
# snapcraft.yaml - builds a Snap package of OpenJDK
# Copyright (C) 2020-2025 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: openjdk
title: OpenJDK
summary: Current JDK release and early-access builds
description: |
OpenJDK is the official reference implementation of the Java
Platform, Standard Edition, a cross-platform computing environment
that lets you develop and deploy Java applications on desktops,
servers, and embedded systems.
This package provides everything you need to develop a Java
application on Linux, including all of the latest development tools,
class libraries, API documentation, and source code of the Java
Development Kit (JDK).
Installing this package does not replace the JDK 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/openjdk
Java and OpenJDK are trademarks or registered trademarks of Oracle
and/or its affiliates.
adopt-info: jdk
license: GPL-2.0-with-classpath-exception
base: core18
grade: stable
confinement: strict
architectures:
- build-on: amd64
- build-on: arm64
- build-on: armhf
- build-on: i386
- build-on: ppc64el
- build-on: s390x
slots:
jdk-23-1804:
interface: content
read: [$SNAP/jdk]
jdk-24-1804:
interface: content
read: [$SNAP/jdk]
plugs:
home: null
jfx-24-1804:
interface: content
target: $SNAP/jfx
apps:
openjdk:
command: bin/openjdk.sh
environment:
LC_ALL: C.UTF-8
java:
command: jdk/bin/java
plugs:
# Adds the interfaces of the GNOME Snapcraft Extensions plus 'network'
- desktop
- desktop-legacy
- gsettings
- network
- opengl
- wayland
- x11
environment:
LC_ALL: C.UTF-8
LD_LIBRARY_PATH: $SNAP/jfx/lib/$SNAPCRAFT_ARCH_TRIPLET
GTK_PATH: $SNAP/jfx/lib/$SNAPCRAFT_ARCH_TRIPLET/gtk-3.0
javac:
command: jdk/bin/javac
environment:
LC_ALL: C.UTF-8
javadoc:
command: jdk/bin/javadoc
environment:
LC_ALL: C.UTF-8
jar:
command: jdk/bin/jar
environment:
LC_ALL: C.UTF-8
jarsigner:
command: jdk/bin/jarsigner
environment:
LC_ALL: C.UTF-8
jlink:
command: jdk/bin/jlink
environment:
LC_ALL: C.UTF-8
jpackage:
command: jdk/bin/jpackage
environment:
LC_ALL: C.UTF-8
jwebserver:
command: jdk/bin/jwebserver
plugs:
- network-bind
environment:
LC_ALL: C.UTF-8
parts:
bin:
plugin: dump
source: .
source-type: local
stage: [bin]
jdk:
plugin: autotools
source: https://github.com/openjdk/jdk24u.git
source-type: git
source-tag: jdk-$SNAPCRAFT_PROJECT_VERSION
source-depth: 1
build-snaps:
- openjdk/latest/stable
build-packages:
- curl
- libasound2-dev
- libcups2-dev
- libfontconfig1-dev
- libfreetype6-dev
- libx11-dev
- libxext-dev
- libxrandr-dev
- libxrender-dev
- libxt-dev
- libxtst-dev
- unzip
- zip
override-pull: |
release=24
giturl=https://github.com/openjdk/jdk24u.git
tagurl=https://github.com/openjdk/jdk24u/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>jdk-${feature}[.0-9]*+[^0]" \
| sed -E -e '1!d' -e 's| *<title>jdk-(.*)</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 "jdk-$version" --depth 1 \
$giturl "$SNAPCRAFT_PART_SRC"
else
snapcraftctl pull
fi
build-environment:
- JAVA_HOME: /snap/openjdk/current/jdk
override-build: |
# Loads the version environment variable if not defined
if [ -z "$SNAPCRAFT_PROJECT_VERSION" ]; then
. /tmp/snapcraft-project-version
fi
# Sets the environment variable for reproducible builds
SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
export SOURCE_DATE_EPOCH
# Builds the JDK
# '--enable-deprecated-ports=yes' for i386
# '--enable-warnings-as-errors=no' for armhf
bash configure \
--enable-deprecated-ports=yes \
--enable-warnings-as-errors=no \
--enable-javac-server=no \
--with-vendor-name="Snap Build" \
--with-vendor-url="https://snapcraft.io/openjdk" \
--with-vendor-bug-url="https://github.com/jgneff/openjdk/issues" \
--with-version-pre=no \
--with-version-opt=snap \
--with-version-build="${SNAPCRAFT_PROJECT_VERSION#*+}" \
--with-extra-cflags="$CFLAGS" \
--with-extra-cxxflags="$CXXFLAGS" \
--with-extra-ldflags="$LDFLAGS" \
--with-native-debug-symbols=none
make images docs
# Installs the build output
cd build/linux-*-server-release/images || exit
mv jdk docs "$SNAPCRAFT_PART_INSTALL"
organize:
docs: jdk/docs
stage-packages:
# Adds all DejaVu fonts and the 'jlink' and 'jpackage' dependencies
- binutils
- dpkg
- fakeroot
- fonts-dejavu-extra
# Adds library packages suggested by Snapcraft plus 'libfontconfig1'
- libasound2
- libfontconfig1
- libfreetype6
- libpng16-16
- libx11-6
- libxau6
- libxcb1
- libxdmcp6
- libxext6
- libxi6
- libxrender1
- libxtst6
del:
after: [jdk]
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; 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
layout:
# For Java Swing apps
# Fontconfig error: Cannot load config file from /etc/fonts/fonts.conf
/etc/fonts:
bind: $SNAP/etc/fonts
# Exception in thread "AWT-EventQueue-0" java.lang.InternalError:
# java.lang.reflect.InvocationTargetException
# Caused by: java.lang.NullPointerException: Cannot load from short array
# because "sun.awt.FontConfiguration.head" is null
/usr/share/fonts/truetype/dejavu:
bind: $SNAP/usr/share/fonts/truetype/dejavu
# For the JDK 'jpackage' tool
# dpkg: error: error opening configuration directory '/etc/dpkg/dpkg.cfg.d':
# Permission denied
/etc/dpkg:
bind: $SNAP/etc/dpkg
# Can not find fakeroot. Reason: Cannot run program "fakeroot": error=2,
# No such file or directory
/usr/bin/fakeroot:
symlink: $SNAP/usr/bin/fakeroot-sysv
# fakeroot: preload library `libfakeroot-sysv.so' not found, aborting.
/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libfakeroot/libfakeroot-sysv.so:
symlink: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libfakeroot/libfakeroot-sysv.so
# /usr/bin/fakeroot: 1: eval: /usr/bin/faked-sysv: not found
/usr/bin/faked-sysv:
symlink: $SNAP/usr/bin/faked-sysv
# For JavaFX apps
# libGL error: MESA-LOADER: failed to open i965 (search paths
# /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri)
# libGL error: failed to load driver: i965
/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/dri:
symlink: $SNAP/jfx/lib/$SNAPCRAFT_ARCH_TRIPLET/dri
# GdkPixbuf-WARNING **: 16:04:55.707: 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
/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/gdk-pixbuf-2.0:
symlink: $SNAP/jfx/lib/$SNAPCRAFT_ARCH_TRIPLET/gdk-pixbuf-2.0
# For Raspberry Pi OS
# ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so'
# from /etc/ld.so.preload cannot be preloaded (cannot open shared object
# file): ignored.
/etc/ld.so.preload:
bind-file: $SNAP/etc/ld.so.preload