forked from odysseus-dev/odysseus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-linux-app.sh
More file actions
executable file
·108 lines (94 loc) · 3.58 KB
/
Copy pathbuild-linux-app.sh
File metadata and controls
executable file
·108 lines (94 loc) · 3.58 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
99
100
101
102
103
104
105
106
107
108
#!/bin/bash
# ==============================================================================
# build-linux-app.sh
#
# Installs Odysseus as a native Linux desktop application (XDG spec).
#
# Prerequisites:
# - venv built with server dependencies (uvicorn, fastapi, etc.)
# - System PyQt6 with Wayland support installed via pacman:
# sudo pacman -S python-pyqt6 python-pyqt6-webengine
# - qt_wrapper.py present in repo root
#
# The display layer (qt_wrapper.py) runs under the SYSTEM python3 so it
# can use the system-built PyQt6/WebEngine with native Wayland support.
# The backend (uvicorn) runs under the venv python where all server deps live.
# ==============================================================================
set -e
APP_NAME="odysseus"
INSTALL_DIR="$(cd "$(dirname "$0")" && pwd)"
VENV_PATH="$INSTALL_DIR/venv"
SYSTEM_PYTHON="/usr/bin/python3"
BIN_DIR="$HOME/.local/bin"
DESKTOP_DIR="$HOME/.local/share/applications"
ICON_DIR_SCALABLE="$HOME/.local/share/icons/hicolor/scalable/apps"
WRAPPER_PATH="$INSTALL_DIR/qt_wrapper.py"
echo "Building Odysseus native Linux app from $INSTALL_DIR..."
# --- Sanity checks ---
if [ ! -f "$VENV_PATH/bin/python" ]; then
echo "ERROR: venv not found at $VENV_PATH. Run setup first." >&2
exit 1
fi
if [ ! -f "$WRAPPER_PATH" ]; then
echo "ERROR: qt_wrapper.py not found at $WRAPPER_PATH." >&2
exit 1
fi
if ! "$SYSTEM_PYTHON" -c "import PyQt6.QtWebEngineWidgets" 2>/dev/null; then
echo "ERROR: System PyQt6 with WebEngine not found." >&2
echo " Install it: sudo pacman -S python-pyqt6 python-pyqt6-webengine" >&2
exit 1
fi
echo "System PyQt6: OK"
# --- Directories ---
mkdir -p "$BIN_DIR" "$DESKTOP_DIR" "$ICON_DIR_SCALABLE"
# --- Launcher script ---
# Uses system python3 for the wrapper (native Wayland via system-built PyQt6).
# The wrapper itself spawns the backend under the venv python.
LAUNCHER_BIN="$BIN_DIR/$APP_NAME"
cat > "$LAUNCHER_BIN" <<LAUNCHER
#!/bin/bash
exec "$SYSTEM_PYTHON" "$WRAPPER_PATH"
LAUNCHER
chmod +x "$LAUNCHER_BIN"
echo "Installed launcher: $LAUNCHER_BIN"
# --- Icon (static/icons/ holds the scalable SVG and PNG sizes) ---
ICON_PATH="$ICON_DIR_SCALABLE/odysseus.svg"
if [ -f "$INSTALL_DIR/static/icons/odysseus.svg" ]; then
cp "$INSTALL_DIR/static/icons/odysseus.svg" "$ICON_PATH"
echo "Installed SVG icon: $ICON_PATH"
elif [ -f "$INSTALL_DIR/static/icons/icon-512.png" ]; then
ICON_DIR_256="$HOME/.local/share/icons/hicolor/256x256/apps"
mkdir -p "$ICON_DIR_256"
cp "$INSTALL_DIR/static/icons/icon-512.png" "$ICON_DIR_256/odysseus.png"
echo "Installed PNG icon: $ICON_DIR_256/odysseus.png"
else
echo "WARNING: No icon found in static/icons/ (odysseus.svg / icon-512.png). Skipping." >&2
fi
# --- .desktop file ---
DESKTOP_FILE="$DESKTOP_DIR/$APP_NAME.desktop"
cat > "$DESKTOP_FILE" <<DESKTOP
[Desktop Entry]
Type=Application
Name=Odysseus
Comment=Personal AI Workspace
Exec=$LAUNCHER_BIN
Icon=$APP_NAME
Terminal=false
Categories=Office;Utility;Development;
StartupWMClass=$APP_NAME
DESKTOP
echo "Installed desktop entry: $DESKTOP_FILE"
# Refresh icon and desktop caches
if command -v gtk-update-icon-cache &>/dev/null; then
gtk-update-icon-cache -f -t "$HOME/.local/share/icons/hicolor" 2>/dev/null || true
fi
if command -v update-desktop-database &>/dev/null; then
update-desktop-database "$DESKTOP_DIR" 2>/dev/null || true
fi
if command -v kbuildsycoca6 &>/dev/null; then
kbuildsycoca6 2>/dev/null || true
fi
echo ""
echo "Done. Launch with: $LAUNCHER_BIN"
echo "Or find 'Odysseus' in your application menu."
echo "Note: Log out and back in for KDE to pick up the new icon and launcher."