-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-appimage.sh
executable file
·67 lines (57 loc) · 1.96 KB
/
build-appimage.sh
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
#!/bin/bash
# builds an AppImage of strongbox with a custom JRE
set -eu
# strongbox is required
path_to_strongbox="$1"
test -d "$path_to_strongbox"
custom_jre_dir="$(realpath custom-jre)" # "/path/to/strongbox-appimage/custom-jre"
rm -rf "$custom_jre_dir"
echo "--- building custom JRE ---"
# compress=1 'constant string sharing' compresses better with AppImage than compress=2 'zip', 52MB -> 45MB
# - https://docs.oracle.com/en/java/javase/19/docs/specs/man/jlink.html#plugin-compress
jlink \
--add-modules "java.sql,java.naming,java.desktop,jdk.unsupported,jdk.crypto.ec" \
--output "$custom_jre_dir" \
--strip-debug \
--no-man-pages \
--no-header-files \
--compress=1
# needed when built using Ubuntu as libjvm.so is *huge*
# doesn't seem to hurt to strip the other .so files.
find "$custom_jre_dir" -name "*.so" -print0 | xargs -0 strip --preserve-dates --strip-unneeded
du -sh "$custom_jre_dir"
echo
echo "--- building app ---"
(
cd "$path_to_strongbox"
lein clean
rm -f resources/full-catalogue.json
wget https://raw.githubusercontent.com/ogri-la/strongbox-catalogue/master/full-catalogue.json \
--quiet \
--directory-prefix resources
lein uberjar
cp ./target/*-standalone.jar "$custom_jre_dir/app.jar"
)
echo
echo "--- building AppImage ---"
if [ ! -e appimagetool ]; then
wget \
-c "https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-x86_64.AppImage" \
-o appimagetool
mv appimagetool-x86_64.AppImage appimagetool
chmod +x appimagetool
fi
rm -rf ./AppDir
mkdir AppDir
mv "$custom_jre_dir" AppDir/usr
cp ./AppImage/strongbox.desktop ./AppImage/AppRun AppDir/
cp "$path_to_strongbox/resources/strongbox.svg" "$path_to_strongbox/resources/strongbox.png" AppDir/
du -sh AppDir/
rm -f strongbox.appimage # safer than 'rm -f strongbox'
ARCH=x86_64 ./appimagetool AppDir/ strongbox.appimage
du -sh strongbox.appimage
echo
echo "--- cleaning up ---"
rm -rf AppDir
echo
echo "done."