diff --git a/hypr/hyprgraphics.sh b/hypr/hyprgraphics.sh index f81f276..eb98438 100644 --- a/hypr/hyprgraphics.sh +++ b/hypr/hyprgraphics.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash -PACKAGE=hyprgraphics +unset PACKAGE && + PACKAGE=hyprgraphics # ─< Check if the given command exists silently >───────────────────────────────────────── command_exists() { @@ -59,7 +60,7 @@ getDependencies() { # │ automagically be pulled via the $pkgArray[$distro] variable │ # ╰─────────────────────────────────────────────────────────────────────────╯ # - depsDebian=(libpixman-1-dev libcairo2-dev cmake wayland-protocols hyprutils) + depsDebian=(libpixman-1-dev libcairo2-dev cmake wayland-protocols libwebp-dev libjpeg-dev libspng-dev libmagic-dev hyprutils) depsArch=(hyprutils) # depsFedora=() # depsOpensuse=() @@ -96,29 +97,35 @@ getDependencies() { done } +build() { + echo_info "Building $PACKAGE" + run cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build + run cmake --build ./build --config Release --target all -j$(nproc 2>/dev/null || getconf NPROCESSORS_CONF) +} + +cloneAndInstall() { + local cloneDir="$(mktemp -d)" + cd $cloneDir || mkdir -p "$cloneDir" && cd "$cloneDir" + + git clone --depth=1 https://github.com/hyprwm/hyprgraphics.git && + cd hyprgraphics + + if build; then + echo_info "Installing package.." + $_sudo cmake --install build + else + echo_error "Build has failed for $distro compiling $PACKAGE" + return 69 + fi +} + main() { case "$distro" in arch) - echo "arch" + _install hyprgraphics ;; debian) - echo "debian" - ;; - ubuntu) - echo "ubuntu" - ;; - fedora) - echo "fedora" - ;; - alpine) - echo "alpine" - ;; - opensuse) - echo "opensuse" - ;; - *) - echo "$distro is not supported by this script!" - exit 1 + cloneAndInstall ;; esac } diff --git a/hypr/hyprutils.sh b/hypr/hyprutils.sh index 96d2168..f92dd76 100644 --- a/hypr/hyprutils.sh +++ b/hypr/hyprutils.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash -PACKAGE=hyprutils +unset PACAKGE && + PACKAGE=hyprutils # ─< Check if the given command exists silently >───────────────────────────────────────── command_exists() { diff --git a/hyprlock.sh b/hyprlock.sh index 4401b55..437bdc1 100644 --- a/hyprlock.sh +++ b/hyprlock.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash -PACKAGE=hyprlock +unset PACKAGE && + PACKAGE=hyprlock # ─< Check if the given command exists silently >───────────────────────────────────────── command_exists() {