Donald Williams 2a01d9b65f
Development to main : Update Hyprland version to 0.53.3 to fix hyprpm (#236)
* Testing build from debian packages

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	new file:   BUILD_METHOD_OPTIONS.md
	new file:   CHANGES_SUMMARY.md
	new file:   GIT_STATUS.md
	new file:   INSTALL_METHOD_GUIDE.md
	new file:   QUICK_START.txt
	modified:   install.sh

* Fix package installation: skip plugins and debug symbols by default, improve dependency handling

* Add comprehensive troubleshooting guide for package installation issues

* Fix package installation path handling: use full paths instead of cd to preserve working directory

* Removed files related to debian pacakge building

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	deleted:    BUILD_METHOD_OPTIONS.md
	deleted:    GIT_STATUS.md
	deleted:    INSTALL_METHOD_GUIDE.md
	deleted:    PACKAGE_INSTALL_TROUBLESHOOTING.md
	deleted:    QUICK_START.txt

* Ported ubuntu quickshell install script to debian

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	new file:   install-scripts/quickshell.sh

* Forgot to add quickshell as install option

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   install.sh

* Added missing depdendencies to debian quickshell

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   install-scripts/quickshell.sh

* Fixing QML import pathing

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   install-scripts/quickshell.sh

* Adding shim for missing QML properies

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   install-scripts/quickshell.sh

* Added check for debian trixie in quickshell install

 Trixe doesn't support overview seems like the QT libs are too old

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   install-scripts/quickshell.sh

* Fixed typo in script

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   refresh-hypr-tags.sh

* libmuparser-dev is now needed

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   install-scripts/00-dependencies.sh
	modified:   install-scripts/hyprland.sh

* Adding hyprwire depdency

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   hypr-tags.env
	new file:   install-scripts/hyprwire.sh
	modified:   install.sh
	modified:   refresh-hypr-tags.sh
	modified:   update-hyprland.sh

* Updating hyprwire build order

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   install-scripts/hyprland.sh

* Fixing script permissions

* fixing hyprwire build error

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   hyprwire.sh

* Still fixing hyprwire build errors

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   hyprwire.sh

* Fixing SED error.  (I Hate sed)

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   hyprwire.sh

* Still getting append errors trying another fix

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   hyprwire.sh

* Updated tags for 0.53.0

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   ../hypr-tags.env
	modified:   hyprland.sh

* Fixing build error on hyprland

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   hyprland.sh

* Still getting build errors with hyprland

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   install-scripts/hyprland.sh

* More build errors to fix

 On branch development
 Your branch is ahead of 'origin/development' by 1 commit.
   (use "git push" to publish your local commits)

 Changes to be committed:
	modified:   install-scripts/hyprland.sh

* Fixind SED error

* Hyprland tag set to 52.2

* Scripts has hardcoded versions vs. pulling hypr-env

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   install-scripts/aquamarine.sh
	modified:   install-scripts/hyprcursor.sh
	modified:   install-scripts/hyprgraphics.sh
	modified:   install-scripts/hyprland-guiutils.sh
	modified:   install-scripts/hyprland-protocols.sh
	modified:   install-scripts/hyprland-qt-support.sh
	modified:   install-scripts/hyprland.sh
	modified:   install-scripts/hyprlang.sh
	modified:   install-scripts/hyprtoolkit.sh
	modified:   install-scripts/hyprutils.sh
	modified:   install-scripts/hyprwayland-scanner.sh
	modified:   install-scripts/hyprwire.sh
	modified:   install-scripts/wayland-protocols-src.sh

* Fixing update-hyprland to support tags

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   install-scripts/hyprutils.sh
	modified:   update-hyprland.sh

* Fixing update-hyprland (again) to use env-tags

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   update-hyprland.sh

* Fixing update-hyprland

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   update-hyprland.sh

* Trying to get trixie to build

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   install-scripts/hyprland.sh

* Updated README re: NVIDIA drivers & HL 0.52.2+ on Trixie

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   README.md

* UPD: Before ubunmtu was out-of-date, now can run HL dots

previsously ubuntu was older HL. Now it's up to date and can
also run current dotfiles. Removed old statement saying ubuntu could not
run current dotfiles.

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   README.md

* Pinned version to 52.2 for debian stable support

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   CHANGELOGS.md
	deleted:    CHANGES_SUMMARY.md
	modified:   Debian-Hyprland-Install-Upgrade.es.md
	modified:   Debian-Hyprland-Install-Upgrade.md
	modified:   hypr-tags.env
	new file:   hypr-tags.env-v.053
	modified:   update-hyprland.sh

* Fixed update-hyprland refresh-hypr-tags --force-override

It now assumes --fetch-latest
Small formatting fixes
Now shows version to upgrade too and pause to allow review

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   CHANGELOGS.md
	modified:   Debian-Hyprland-Install-Upgrade.es.md
    modified:   Debian-Hyprland-Install-Upgrade.md
	modified:   dry-run-build.sh
	modified:   refresh-hypr-tags.sh
	modified:   update-hyprland.sh

* Fixing build scrpt to work onm debian stable

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   install-scripts/hyprland-guiutils.sh

* Added selectable shim for hyprwire to allow building on trixie

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   hyprwire.sh

* Fixed hyprland 0.53 build for trixie found bug in xdph script

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   hyprland.sh
	modified:   xdph.sh
	modified:   ../install.sh
	modified:   ../update-hyprland.sh

* Major Update Debian trixie 0.53.1 support new build flags

 Trixie needs small patches to build vs. testing+
 Script now detects that. But some debian based distros might mask name
 There is a flag `--force-trixie` to include the fixes

 Updated the Install-Upgrade documents with the specifics

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   CHANGELOGS.md
	modified:   Debian-Hyprland-Install-Upgrade.es.md
	modified:   Debian-Hyprland-Install-Upgrade.md
	modified:   README.md
	modified:   hypr-tags.env
	deleted:    hypr-tags.env-v.053
	modified:   install.sh
	modified:   refresh-hypr-tags.sh
	modified:   update-hyprland.sh

* Updated CHANGELOG with note about debian stable support

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	renamed:    CHANGELOGS.md -> CHANGELOG.md

* Sync README/CHANGELOG with main

* Updated CHANGELOG and README re: debian trixie upgrades to Forky+

You must recompile Hyprland
`update-hyprland --install --with-deps`
Otherwise hyprland won't start
You will be returned to the login manager

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   CHANGELOG.md
	modified:   README.md

* Fixed install script to pull current headers for versioning

Fastfetch was showing wrong version duo to header files from 52.2

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   install-scripts/hyprland.sh

* Improved syncing versioning

  Gets commit hash, tag, date, commit count, dirty state from hyprland --version.
  Pulls library versions from hyprland --version first, and falls back to hypr-tags.env if missing.
  Writes those values into /usr/include/hyprland/src/version.h.

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   install-scripts/hyprland.sh

* Fixed ver mismatch in FF  Pinned stable to 53.2 create build dir

Now the code will compile in build directory vs. base directory
Easier to clean up

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   CHANGELOG.md
	modified:   Debian-Hyprland-Install-Upgrade.es.md
	modified:   Debian-Hyprland-Install-Upgrade.md
	modified:   README.md
	modified:   hypr-tags.env
	modified:   install-scripts/Global_functions.sh
	modified:   install-scripts/ags.sh
	modified:   install-scripts/aquamarine.sh
	modified:   install-scripts/hyprcursor.sh
	modified:   install-scripts/hyprgraphics.sh
	modified:   install-scripts/hypridle.sh
	modified:   install-scripts/hyprland-guiutils.sh
	modified:   install-scripts/hyprland-protocols.sh
	modified:   install-scripts/hyprland-qt-support.sh
	modified:   install-scripts/hyprland.sh
	modified:   install-scripts/hyprlang.sh
	modified:   install-scripts/hyprlock.sh
	modified:   install-scripts/hyprpolkitagent.sh
	modified:   install-scripts/hyprtoolkit.sh
	modified:   install-scripts/hyprutils.sh
	modified:   install-scripts/hyprwayland-scanner.sh
	modified:   install-scripts/hyprwire.sh
	modified:   install-scripts/quickshell.sh
	modified:   install-scripts/rofi-wayland.sh
	modified:   install-scripts/wayland-protocols-src.sh
	modified:   install-scripts/xdph.sh
	modified:   install-scripts/xkbcommon.sh
	modified:   refresh-hypr-tags.sh
	modified:   update-hyprland.sh

* Moved source and builds to build dir

Cleanup is now just removing the build directory and install-logs

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   install-scripts/Global_functions.sh
	modified:   install-scripts/ags.sh
	modified:   install-scripts/aquamarine.sh
	modified:   install-scripts/dotfiles-branch.sh
	modified:   install-scripts/gtk_themes.sh
	modified:   install-scripts/hyprcursor.sh
	modified:   install-scripts/hyprgraphics.sh
	modified:   install-scripts/hypridle.sh
	modified:   install-scripts/hyprland-guiutils.sh
	modified:   install-scripts/hyprland-protocols.sh
	modified:   install-scripts/hyprland-qt-support.sh
	modified:   install-scripts/hyprland.sh
	modified:   install-scripts/hyprlang.sh
	modified:   install-scripts/hyprlock.sh
	modified:   install-scripts/hyprpolkitagent.sh
	modified:   install-scripts/hyprtoolkit.sh
	modified:   install-scripts/hyprutils.sh
	modified:   install-scripts/hyprwayland-scanner.sh
	modified:   install-scripts/hyprwire.sh
	modified:   install-scripts/quickshell.sh
	modified:   install-scripts/rofi-wayland.sh
	modified:   install-scripts/rog.sh
	modified:   install-scripts/sddm_theme.sh
	modified:   install-scripts/swww.sh
	modified:   install-scripts/wayland-protocols-src.sh
	modified:   install-scripts/xdph.sh
	modified:   install-scripts/xkbcommon.sh
	modified:   install-scripts/zsh_pokemon.sh

* Fixed build error with hyprtoolkit

* Updated docs for new build dir layout and how to clean up after

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   Debian-Hyprland-Install-Upgrade.es.md
	modified:   Debian-Hyprland-Install-Upgrade.md

* Updated CHANGELOG with build dir change and fixes

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   CHANGELOG.md

* Updated env-tag to Hyprland v0.53.3 fixed hyprpm

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   CHANGELOG.md
	modified:   hypr-tags.env

* Updated pinned version to 0.53.3

 On branch development
 Your branch is up to date with 'origin/development'.

 Changes to be committed:
	modified:   install-scripts/hyprland.sh
	modified:   refresh-hypr-tags.sh
	modified:   update-hyprland.sh

* Updated CHANGELOG text
2026-01-24 17:19:24 -05:00

306 lines
14 KiB
Bash
Executable File

#!/bin/bash
# 💫 https://github.com/JaKooLit 💫 #
# Main Hyprland Package#
#specific branch or release
tag="v0.53.3"
# Auto-source centralized tags if env is unset
if [ -z "${HYPRLAND_TAG:-}" ]; then
TAGS_FILE="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/hypr-tags.env"
[ -f "$TAGS_FILE" ] && source "$TAGS_FILE"
fi
# Allow environment override
if [ -n "${HYPRLAND_TAG:-}" ]; then tag="$HYPRLAND_TAG"; fi
# Dry-run support
DO_INSTALL=1
if [ "$1" = "--dry-run" ] || [ "${DRY_RUN}" = "1" ] || [ "${DRY_RUN}" = "true" ]; then
DO_INSTALL=0
echo "${NOTE} DRY RUN: install step will be skipped."
fi
hyprland=(
clang
llvm
libxcb-errors-dev
libre2-dev
libglaze-dev
libudis86-dev
libinotify-ocaml-dev
libmuparser-dev
)
## WARNING: DO NOT EDIT BEYOND THIS LINE IF YOU DON'T KNOW WHAT YOU ARE DOING! ##
# Determine the directory where the script is located
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Change the working directory to the parent directory of the script
PARENT_DIR="$SCRIPT_DIR/.."
cd "$PARENT_DIR" || exit 1
source "$(dirname "$(readlink -f "$0")")/Global_functions.sh"
# Set the name of the log file to include the current date and time
LOG="Install-Logs/install-$(date +%d-%H%M%S)_hyprland.log"
MLOG="install-$(date +%d-%H%M%S)_hyprland2.log"
# Installation of dependencies
printf "\n%s - Installing hyprland additional dependencies.... \n" "${NOTE}"
for PKG1 in "${hyprland[@]}"; do
install_package "$PKG1" 2>&1 | tee -a "$LOG"
if [ $? -ne 0 ]; then
echo -e "\e[1A\e[K${ERROR} - $PKG1 Package installation failed, Please check the installation logs"
exit 1
fi
done
printf "\n%.0s" {1..1}
# Installation of dependencies (glaze)
printf "\n%s - Installing Hyprland additional dependencies (glaze).... \n" "${NOTE}"
# Check if /usr/include/glaze exists
if [ ! -d /usr/include/glaze ]; then
echo "${INFO} ${YELLOW}Glaze${RESET} is not installed. Installing ${YELLOW}glaze from assets${RESET} ..."
sudo dpkg -i assets/libglaze-dev_4.4.3-1_all.deb 2>&1 | tee -a "$LOG"
sudo apt-get install -f -y 2>&1 | tee -a "$LOG"
echo "${INFO} ${YELLOW}libglaze-dev from assets${RESET} installed."
fi
printf "\n%.0s" {1..1}
# Clone, build, and install Hyprland using Cmake
printf "${NOTE} Cloning and Installing ${YELLOW}Hyprland $tag${RESET} ...\n"
# Check if Hyprland folder exists and remove it (under build/src)
SRC_DIR="$SRC_ROOT/Hyprland"
if [ -d "$SRC_DIR" ]; then
printf "${NOTE} Removing existing Hyprland folder...\n"
rm -rf "$SRC_DIR" 2>&1 | tee -a "$LOG"
fi
if git clone --recursive -b $tag "https://github.com/hyprwm/Hyprland" "$SRC_DIR"; then
cd "$SRC_DIR" || exit 1
BUILD_DIR="$BUILD_ROOT/hyprland"
mkdir -p "$BUILD_DIR"
# Compatibility shim for toolchains without std::vector::{insert_range,append_range}
RANGE_HDR="$(pwd)/hypr_range_compat.hpp"
cat >"$RANGE_HDR" <<'EOF'
#pragma once
#include <iterator>
#include <ranges>
// insert at end using a range
#define INSERT_RANGE(vec, ...) (vec).insert((vec).end(), std::ranges::begin(__VA_ARGS__), std::ranges::end(__VA_ARGS__))
// insert at explicit position using a range
#define INSERT_RANGE_AT(vec, pos, ...) (vec).insert((vec).end() == (pos) ? (vec).end() : (pos), std::ranges::begin(__VA_ARGS__), std::ranges::end(__VA_ARGS__))
// append_range compatibility for containers expecting begin/end
#define APPEND_RANGE(vec, ...) (vec).insert((vec).end(), std::begin(__VA_ARGS__), std::end(__VA_ARGS__))
EOF
# Rewrite calls:
# x.insert_range(pos, rng) -> INSERT_RANGE_AT(x, pos, rng)
# x.insert_range(rng) -> INSERT_RANGE(x, rng)
# x.append_range(rng) -> APPEND_RANGE(x, rng)
PATCH_FILES=$(grep -REIl --exclude-dir=.git '\.\s*(insert_range|append_range)\s*\(' . || true)
if [ -n "$PATCH_FILES" ]; then
# Two-arg form first (pos, rng)
perl -0777 -pi -e 's/([A-Za-z_][[:alnum:]_:.>\-]*?)\s*\.\s*insert_range\s*\(\s*([^,]+?)\s*,\s*/INSERT_RANGE_AT($1, $2, /gs' $PATCH_FILES
# One-arg form (rng only)
perl -0777 -pi -e 's/([A-Za-z_][[:alnum:]_:.>\-]*?)\s*\.\s*insert_range\s*\(/INSERT_RANGE($1, /gs' $PATCH_FILES
# append_range
perl -0777 -pi -e 's/([A-Za-z_][[:alnum:]_:.>\-]*?)\s*\.\s*append_range\s*\(/APPEND_RANGE($1, /gs' $PATCH_FILES
fi
# Replace #embed with an autogenerated bytes include for toolchains lacking it
EX_CONF="$(pwd)/example/hyprland.conf"
EMBED_INC="$(pwd)/src/config/defaultConfig.bytes.inc"
if [ -f "$EX_CONF" ]; then
xxd -i -g 1 -c 16 "$EX_CONF" | sed -n '/^{/{flag=1;next} /};/{flag=0} flag p' >"$EMBED_INC" || true
# Swap the directive in the header to include the generated bytes
sed -ri 's|^\s*#embed\s+"\.{0,2}/\.{0,2}/example/hyprland\.conf"\s*$|#include "defaultConfig.bytes.inc"|g' src/config/defaultConfig.hpp || true
fi
# Compatibility: some toolchains/libstdc++ do not support std::string operator+ with std::string_view.
# Hyprland hyprctl uses a std::string_view filename; ensure it is converted explicitly.
HYPRCTL_MAIN="$(pwd)/hyprctl/src/main.cpp"
if [ -f "$HYPRCTL_MAIN" ] && grep -q "std::string socketPath" "$HYPRCTL_MAIN"; then
# Only patch if we see a "+ filename" concatenation.
if grep -qE '\+\s*filename\s*;' "$HYPRCTL_MAIN"; then
sed -ri 's/\+\s*filename\s*;/+ std::string(filename);/g' "$HYPRCTL_MAIN" || true
fi
fi
# Apply patch only if it applies cleanly; otherwise skip
if [ -f "$PARENT_DIR/assets/0001-fix-hyprland-compile-issue.patch" ]; then
if patch -p1 --dry-run <"$PARENT_DIR/assets/0001-fix-hyprland-compile-issue.patch" >/dev/null 2>&1; then
patch -p1 <"$PARENT_DIR/assets/0001-fix-hyprland-compile-issue.patch"
else
echo "${NOTE} Hyprland compile patch does not apply on $tag; skipping."
fi
fi
# By default, build Hyprland with bundled hyprutils/hyprlang to avoid version mismatches
# You can force system libs by exporting USE_SYSTEM_HYPRLIBS=1 before running this script.
USE_SYSTEM=${USE_SYSTEM_HYPRLIBS:-1}
if [ "$USE_SYSTEM" = "1" ]; then
export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:${PKG_CONFIG_PATH:-}"
export CMAKE_PREFIX_PATH="/usr/local:${CMAKE_PREFIX_PATH:-}"
SYSTEM_FLAGS=(
"-DUSE_SYSTEM_HYPRUTILS=ON"
"-DUSE_SYSTEM_HYPRLANG=ON"
"-DUSE_SYSTEM_HYPRWIRE=ON"
)
# Optional preflight: verify hyprwire is discoverable by CMake/pkg-config
if [ ! -e "/usr/local/lib/cmake/Hyprwire/HyprwireConfig.cmake" ] && ! pkg-config --exists hyprwire 2>/dev/null; then
echo "${NOTE} hyprwire not detected in /usr/local yet. Ensure install-scripts/hyprwire.sh ran successfully or set USE_SYSTEM_HYPRLIBS=0 to use subprojects."
fi
else
# Ensure we do not accidentally pick up mismatched system headers
unset PKG_CONFIG_PATH || true
SYSTEM_FLAGS=(
"-DUSE_SYSTEM_HYPRUTILS=OFF"
"-DUSE_SYSTEM_HYPRLANG=OFF"
"-DUSE_SYSTEM_HYPRWIRE=OFF"
"-DBUILD_HYPRCTL=OFF"
"-DINSTALL_HYPRCTL=OFF"
)
fi
# Make sure submodules are present when building bundled deps
git submodule update --init --recursive || true
# Force Clang toolchain to support required language features and flags
export CC="${CC:-clang}"
export CXX="${CXX:-clang++}"
CONFIG_FLAGS=(
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_C_COMPILER="${CC}"
-DCMAKE_CXX_COMPILER="${CXX}"
-DCMAKE_CXX_STANDARD=23
-DCMAKE_CXX_STANDARD_REQUIRED=ON
-DCMAKE_CXX_EXTENSIONS=ON
-DCMAKE_CXX_FLAGS="-Wno-unknown-warning-option -include ${RANGE_HDR}"
"${SYSTEM_FLAGS[@]}"
)
cmake -S . -B "$BUILD_DIR" "${CONFIG_FLAGS[@]}"
cmake --build "$BUILD_DIR" -j "$(nproc 2>/dev/null || getconf _NPROCESSORS_CONF)"
if [ $DO_INSTALL -eq 1 ]; then
if sudo cmake --install "$BUILD_DIR" 2>&1 | tee -a "$MLOG"; then
printf "${OK} ${MAGENTA}Hyprland tag${RESET} installed successfully.\n" 2>&1 | tee -a "$MLOG"
# Update version header file for tools like fastfetch that read it at runtime
printf "${NOTE} Updating system version header for Hyprland...\n"
VER_OUTPUT=""
if [ -x "$BUILD_DIR/Hyprland" ]; then
VER_OUTPUT=$("$BUILD_DIR/Hyprland" --version)
elif [ -x "$BUILD_DIR/hyprland" ]; then
VER_OUTPUT=$("$BUILD_DIR/hyprland" --version)
elif command -v Hyprland >/dev/null 2>&1; then
VER_OUTPUT=$(Hyprland --version)
elif command -v hyprctl >/dev/null 2>&1; then
VER_OUTPUT=$(hyprctl version)
fi
if [ -n "$VER_OUTPUT" ]; then
VERSION=$(printf '%s' "$VER_OUTPUT" | head -n1 | awk '{print $2}')
COMMIT=$(printf '%s' "$VER_OUTPUT" | grep -oP 'commit \K[a-f0-9]+' | head -1)
TAG=$(printf '%s' "$VER_OUTPUT" | grep -oP 'Tag: \K[^,]+' | head -1)
COMMIT_DATE=$(printf '%s' "$VER_OUTPUT" | grep -oP '^Date:\s+\K.*' | head -1)
COMMITS=$(printf '%s' "$VER_OUTPUT" | grep -oP 'commits:\s*\K[0-9]+' | head -1)
DIRTY=$(printf '%s' "$VER_OUTPUT" | grep -qi 'dirty' && echo "dirty" || echo "clean")
COMMIT_MSG=$(printf '%s' "$VER_OUTPUT" | head -n1 | sed -n 's/.*(version: \(.*\))\..*/\1/p')
[ -z "$COMMIT" ] && COMMIT="unknown"
[ -z "$TAG" ] && TAG="v$VERSION"
[ -z "$COMMIT_DATE" ] && COMMIT_DATE="$(date)"
[ -z "$COMMITS" ] && COMMITS="0"
[ -z "$COMMIT_MSG" ] && COMMIT_MSG="version: bump"
# Prefer versions from hyprland --version; fall back to hypr-tags.env values
parse_ver() { printf '%s' "$VER_OUTPUT" | grep -m1 "$1:" | grep -oP '\d+\.\d+\.\d+' | head -1; }
AQUA_VER=$(parse_ver "Aquamarine")
HYPRLANG_VER=$(parse_ver "Hyprlang")
HYPRUTILS_VER=$(parse_ver "Hyprutils")
HYPRCURSOR_VER=$(parse_ver "Hyprcursor")
HYPRGRAPHICS_VER=$(parse_ver "Hyprgraphics")
[ -z "$AQUA_VER" ] && AQUA_VER="${AQUAMARINE_TAG#v}"
[ -z "$HYPRLANG_VER" ] && HYPRLANG_VER="${HYPRLANG_TAG#v}"
[ -z "$HYPRUTILS_VER" ] && HYPRUTILS_VER="${HYPRUTILS_TAG#v}"
[ -z "$HYPRGRAPHICS_VER" ] && HYPRGRAPHICS_VER="${HYPRGRAPHICS_TAG#v}"
[ -z "$HYPRCURSOR_VER" ] && HYPRCURSOR_VER="0.1.13"
[ -z "$AQUA_VER" ] && AQUA_VER="0.0.0"
[ -z "$HYPRLANG_VER" ] && HYPRLANG_VER="0.0.0"
[ -z "$HYPRUTILS_VER" ] && HYPRUTILS_VER="0.0.0"
[ -z "$HYPRGRAPHICS_VER" ] && HYPRGRAPHICS_VER="0.0.0"
# AQUAMARINE_VERSION components
AQUA_MAJOR=$(echo "$AQUA_VER" | cut -d. -f1)
AQUA_MINOR=$(echo "$AQUA_VER" | cut -d. -f2)
AQUA_PATCH=$(echo "$AQUA_VER" | cut -d. -f3)
# Use printf to safely write the file
printf '%s\n' "#pragma once" > /tmp/version_header.h.tmp
printf '%s\n' "#define GIT_COMMIT_HASH \"$COMMIT\"" >> /tmp/version_header.h.tmp
printf '%s\n' "#define GIT_BRANCH \"\"" >> /tmp/version_header.h.tmp
printf '%s\n' "#define GIT_COMMIT_MESSAGE \"$COMMIT_MSG\"" >> /tmp/version_header.h.tmp
printf '%s\n' "#define GIT_COMMIT_DATE \"$COMMIT_DATE\"" >> /tmp/version_header.h.tmp
printf '%s\n' "#define GIT_DIRTY \"$DIRTY\"" >> /tmp/version_header.h.tmp
printf '%s\n' "#define GIT_TAG \"$TAG\"" >> /tmp/version_header.h.tmp
printf '%s\n' "#define GIT_COMMITS \"$COMMITS\"" >> /tmp/version_header.h.tmp
printf '%s\n' "" >> /tmp/version_header.h.tmp
printf '%s\n' "#define AQUAMARINE_VERSION \"$AQUA_VER\"" >> /tmp/version_header.h.tmp
printf '%s\n' "// clang-format off" >> /tmp/version_header.h.tmp
printf '%s\n' "#define AQUAMARINE_VERSION_MAJOR $AQUA_MAJOR" >> /tmp/version_header.h.tmp
printf '%s\n' "#define AQUAMARINE_VERSION_MINOR $AQUA_MINOR" >> /tmp/version_header.h.tmp
printf '%s\n' "#define AQUAMARINE_VERSION_PATCH $AQUA_PATCH" >> /tmp/version_header.h.tmp
printf '%s\n' "// clang-format on" >> /tmp/version_header.h.tmp
printf '%s\n' "#define HYPRLANG_VERSION \"$HYPRLANG_VER\"" >> /tmp/version_header.h.tmp
printf '%s\n' "#define HYPRUTILS_VERSION \"$HYPRUTILS_VER\"" >> /tmp/version_header.h.tmp
printf '%s\n' "#define HYPRCURSOR_VERSION \"$HYPRCURSOR_VER\"" >> /tmp/version_header.h.tmp
printf '%s\n' "#define HYPRGRAPHICS_VERSION \"$HYPRGRAPHICS_VER\"" >> /tmp/version_header.h.tmp
TARGETS=()
if [ -f /usr/local/include/hyprland/src/version.h ]; then
TARGETS+=(/usr/local/include/hyprland/src/version.h)
fi
if [ -f /usr/include/hyprland/src/version.h ]; then
# If both exist, keep /usr/include in sync to avoid fastfetch mismatch.
TARGETS+=(/usr/include/hyprland/src/version.h)
fi
if [ ${#TARGETS[@]} -eq 0 ]; then
# Default to /usr/local if neither header exists yet.
TARGETS+=(/usr/local/include/hyprland/src/version.h)
fi
UPDATED=0
for tgt in "${TARGETS[@]}"; do
if sudo install -d "$(dirname "$tgt")" && sudo cp /tmp/version_header.h.tmp "$tgt" 2>&1 | tee -a "$MLOG"; then
UPDATED=1
fi
done
if [ $UPDATED -eq 1 ]; then
printf "${OK} System version header updated to $VERSION\n" 2>&1 | tee -a "$MLOG"
else
printf "${NOTE} Could not update system version header (non-critical)\n" 2>&1 | tee -a "$MLOG"
fi
rm -f /tmp/version_header.h.tmp
else
printf "${NOTE} Could not determine Hyprland version output for header update (non-critical)\n" 2>&1 | tee -a "$MLOG"
fi
else
echo -e "${ERROR} Installation failed for ${YELLOW}Hyprland $tag${RESET}" 2>&1 | tee -a "$MLOG"
fi
else
echo "${NOTE} DRY RUN: Skipping installation of Hyprland $tag."
fi
[ -f "$MLOG" ] && mv "$MLOG" "$PARENT_DIR/Install-Logs/"
cd ..
else
echo -e "${ERROR} Download failed for ${YELLOW}Hyprland $tag${RESET}" 2>&1 | tee -a "$LOG"
fi
printf "\n%.0s" {1..2}