forked from elizagamedev/mkxp-oneshot
-
Notifications
You must be signed in to change notification settings - Fork 6
/
make-appimage-linux.sh
executable file
·81 lines (73 loc) · 3.02 KB
/
make-appimage-linux.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/bash -eu
LINUXDEPLOY=linuxdeploy-x86_64.AppImage
APPIMAGETOOL=appimagetool-x86_64.AppImage
GDK_LOADERS_PATH=/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0
if [ $# -lt 6 ]; then
echo "usage: make-appimage.sh SOURCE_PATH CONAN_INSTALL_PATH GAME_PATH EXTRA_UNIX_CONTENT_PATH JOURNAL_FILE APPIMAGE_FILE"
exit 1
fi
source_path="$1"
conan_install_path="$2"
game_path="$3"
unix_content_path="$4"
journal_file="$5"
appimage_file="$6"
appdir="$(mktemp -d)"
function atexit {
[ -n "$appdir" ] && rm -rf "$appdir"
}
trap atexit EXIT
$LINUXDEPLOY -e "$conan_install_path/bin/oneshot" \
-l "$conan_install_path/lib/libruby.so.2.5.3" \
-l "$GDK_LOADERS_PATH/loaders/io-wmf.so" \
-l "$GDK_LOADERS_PATH/loaders/libpixbufloader-bmp.so" \
-l "$GDK_LOADERS_PATH/loaders/libpixbufloader-icns.so" \
-l "$GDK_LOADERS_PATH/loaders/libpixbufloader-jpeg.so" \
-l "$GDK_LOADERS_PATH/loaders/libpixbufloader-pnm.so" \
-l "$GDK_LOADERS_PATH/loaders/libpixbufloader-svg.so" \
-l "$GDK_LOADERS_PATH/loaders/libpixbufloader-tiff.so" \
-l "$GDK_LOADERS_PATH/loaders/libpixbufloader-xpm.so" \
-l "$GDK_LOADERS_PATH/loaders/libpixbufloader-ani.so" \
-l "$GDK_LOADERS_PATH/loaders/libpixbufloader-gif.so" \
-l "$GDK_LOADERS_PATH/loaders/libpixbufloader-ico.so" \
-l "$GDK_LOADERS_PATH/loaders/libpixbufloader-png.so" \
-l "$GDK_LOADERS_PATH/loaders/libpixbufloader-qtif.so" \
-l "$GDK_LOADERS_PATH/loaders/libpixbufloader-tga.so" \
-l "$GDK_LOADERS_PATH/loaders/libpixbufloader-xbm.so" \
-i "$source_path/assets/oneshot.png" \
-d "$source_path/assets/oneshot.desktop" \
--custom-apprun="$source_path/assets/AppRun" \
--appdir "$appdir"
# Bundle game data
cp -af "$journal_file" "$appdir/usr/bin/_______"
cp -af "$source_path/assets/journal.png" "$appdir/usr/bin/_______.png"
for dir in Audio Data Fonts Graphics Languages Wallpaper testing_saves testing_saves_postgame; do
[ -d "$game_path/$dir/" ] && rsync -a "$game_path/$dir" "$appdir/usr/bin/"
[ -d "$unix_content_path/$dir/" ] && rsync -a "$unix_content_path/$dir/" "$appdir/usr/bin/$dir/"
done
# GDK pixbuf retarget nonsense
sed "s,$GDK_LOADERS_PATH/loaders/,%RETARGET%/," \
"$GDK_LOADERS_PATH/loaders.cache" > "$appdir/usr/lib/loaders.cache"
# Delete some files
find "$appdir/usr/bin" -type f \( \
-iname '*.bmp' -o \
-iname 'thumbs.db' -o \
-iname '*.ini' -o \
-iname '*conflicted*' \) \
-delete
# copyright :(
find "$appdir/usr/bin" -type f \( -iname '*.loc' -a \! -iname 'en.loc' \) -delete
# more copyright :(
find "$appdir/usr/bin" -type d \( \
-iname 'es' -o \
-iname 'fr' -o \
-iname 'ja' -o \
-iname 'ko' -o \
-iname 'pt_BR' -o \
-iname 'zh_CN' \) \
-exec rm -rf {} +
# International fonts are now taking up space
find "$appdir/usr/bin/Fonts" -type f \! -iname 'TerminusTTF-Bold.ttf' -delete
cp -af "$conan_install_path/bin/Data/xScripts.rxdata" "$appdir/usr/bin/Data/"
# Create AppImage
ARCH=x86_64 $APPIMAGETOOL "$appdir" "$appimage_file"