-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·98 lines (80 loc) · 2.52 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·98 lines (80 loc) · 2.52 KB
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
#!/bin/bash
set -eo pipefail
VARIANT=${1:-"glibc-x86_64"}
echo "=== Building PicoForge AppImage for variant: ${VARIANT} ==="
# Locate PicoForge source directory
if [ -f "/workspace/Cargo.toml" ]; then
SRC_DIR="/workspace"
elif [ -f "/workspace/picoforge/Cargo.toml" ]; then
SRC_DIR="/workspace/picoforge"
else
echo "Error: Cargo.toml not found in /workspace or /workspace/picoforge"
exit 1
fi
cd "$SRC_DIR"
# Extract version from Cargo.toml
VERSION=$(grep -m 1 '^version' Cargo.toml | sed -E 's/.*"([0-9]+\.[0-9]+\.[0-9]+)".*/\1/')
if [ -z "$VERSION" ]; then
VERSION="0.0.0"
fi
echo "PicoForge Version: ${VERSION}"
# Determine architecture and target naming
ARCH=$(uname -m)
if [ "$ARCH" == "x86_64" ]; then
ARCH_NAME="x86-64"
elif [ "$ARCH" == "aarch64" ]; then
ARCH_NAME="aarch64"
else
ARCH_NAME="$ARCH"
fi
# Define output filename based on variant
case "$VARIANT" in
glibc-x86_64|glibc-aarch64)
OUTPUT_NAME="picoforge_${VERSION}_glibc-2.28_${ARCH_NAME}.AppImage"
;;
musl-x86_64|musl-aarch64)
OUTPUT_NAME="picoforge_${VERSION}_musl_${ARCH_NAME}.AppImage"
;;
*)
OUTPUT_NAME="picoforge_${VERSION}_${VARIANT}_${ARCH_NAME}.AppImage"
;;
esac
echo "Building release binary with Cargo..."
cargo build --release
BINARY_PATH="target/release/picoforge"
DESKTOP_FILE="data/in.suyogtandel.picoforge.desktop"
ICON_FILE="static/appIcons/in.suyogtandel.picoforge.svg"
if [ ! -f "$BINARY_PATH" ]; then
echo "Error: Binary not found at $BINARY_PATH"
exit 1
fi
if [ ! -f "$DESKTOP_FILE" ]; then
echo "Error: Desktop file not found at $DESKTOP_FILE"
exit 1
fi
if [ ! -f "$ICON_FILE" ]; then
echo "Error: Icon file not found at $ICON_FILE"
exit 1
fi
echo "Packaging AppImage using linuxdeploy..."
export APPIMAGE_EXTRACT_AND_RUN=1
# Run linuxdeploy to bundle executable, desktop entry, icon, excluding host daemon libpcsclite
rm -rf AppDir
linuxdeploy \
--appdir AppDir \
--executable "$BINARY_PATH" \
--desktop-file "$DESKTOP_FILE" \
--icon-file "$ICON_FILE" \
--exclude-library libpcsclite.so.1 \
--output appimage
# Find generated AppImage file and rename to standard naming
GENERATED_APPIMAGE=$(ls -t *.AppImage 2>/dev/null | head -n 1)
if [ -z "$GENERATED_APPIMAGE" ]; then
echo "Error: AppImage generation failed"
exit 1
fi
mkdir -p /workspace/dist
mv "$GENERATED_APPIMAGE" "/workspace/dist/${OUTPUT_NAME}"
rm -rf AppDir
echo "=== Build Complete! Output: /workspace/dist/${OUTPUT_NAME} ==="
ls -lh "/workspace/dist/${OUTPUT_NAME}"