Skip to content

Commit dbbdd39

Browse files
committed
linux-rust: add just file to build appimage
1 parent 0236311 commit dbbdd39

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

linux-rust/Justfile

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
APP_NAME := "librepods-rust"
2+
DESKTOP_FILE := "assets/me.kavishdevar.librepods.desktop"
3+
ICON_FILE := "assets/icon.png"
4+
5+
default: build-appimage
6+
7+
build:
8+
cargo build --release
9+
10+
prepare:
11+
#!/usr/bin/env bash
12+
set -euo pipefail
13+
14+
tmpdir="$(mktemp -d)"
15+
echo "Building AppDir in: $tmpdir"
16+
17+
mkdir -p "$tmpdir/usr/bin"
18+
mkdir -p "$tmpdir/usr/share/applications"
19+
mkdir -p "$tmpdir/usr/share/icons/hicolor/256x256/apps"
20+
21+
cp target/release/{{APP_NAME}} "$tmpdir/usr/bin/"
22+
cp assets/icon.png "$tmpdir/usr/share/icons/hicolor/256x256/apps/librepods-icon.png"
23+
cp {{DESKTOP_FILE}} "$tmpdir/{{APP_NAME}}.desktop"
24+
25+
printf '%s\n' \
26+
'#!/bin/bash' \
27+
'HERE="$(dirname "$(readlink -f "$0")")"' \
28+
'exec "$HERE/usr/bin/librepods-rust" "$@"' \
29+
> "$tmpdir/AppRun"
30+
31+
chmod +x "$tmpdir/AppRun"
32+
echo "$tmpdir" > .appdir_path
33+
34+
bundle:
35+
#!/usr/bin/env bash
36+
set -euo pipefail
37+
tmpdir="$(cat .appdir_path)"
38+
39+
linuxdeploy \
40+
--appdir "$tmpdir" \
41+
--executable "$tmpdir/usr/bin/{{APP_NAME}}" \
42+
--desktop-file "$tmpdir/{{APP_NAME}}.desktop" \
43+
--icon-file "$tmpdir/usr/share/icons/hicolor/256x256/apps/librepods-icon.png"
44+
45+
build-appimage: build prepare bundle
46+
#!/usr/bin/env bash
47+
set -euo pipefail
48+
tmpdir="$(cat .appdir_path)"
49+
mkdir -p dist
50+
appimagetool "$tmpdir" "dist/LibrePods-x86_64.AppImage"
51+
rm -rf "$tmpdir" .appdir_path
52+
echo "Done!"

0 commit comments

Comments
 (0)