chore: standardize build procedure

This commit is contained in:
2026-01-15 01:32:06 +01:00
parent 1cadf6a873
commit b3d2bec75a
4 changed files with 72 additions and 12 deletions
+14 -9
View File
@@ -1,18 +1,23 @@
#!/bin/env bash
set -euo pipefail
prefix=${PREFIX:-/usr/local}
path="$(dirname "$(readlink -f "$0")")"
cmake -S "$path/.." -B "$path/../build" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$HOME"/.local || exit 1
-DCMAKE_INSTALL_PREFIX="$prefix"
cmake --build "$path/../build" --target install || exit 1
cmake --build "$path/../build"
cp "$path/wallpaper-carousel.desktop" "$HOME"/.local/share/applications/wallpaper-carousel.desktop
echo "Exec=$HOME/.local/bin/wallpaper-carousel" >>"$HOME"/.local/share/applications/wallpaper-carousel.desktop
if command -v update-desktop-database &>/dev/null; then
update-desktop-database "$HOME"/.local/share/applications/
if [ ! -w "$prefix" ] && [ "$(id -u)" -ne 0 ]; then
sudo cmake --install "$path/../build"
else
cmake --install "$path/../build"
fi
if command -v update-desktop-database &>/dev/null; then
echo "Updating desktop database..."
update-desktop-database "$prefix"/share/applications/ || true
fi