diff --git a/hyprlock.sh b/hyprlock.sh index bfdf422..7a08306 100644 --- a/hyprlock.sh +++ b/hyprlock.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +cores="$(nproc 2>/dev/null || getconf _NPROCESSORS_CONF)" + # ─< Check if the given command exists silently >───────────────────────────────────────── command_exists() { command -v "$@" >/dev/null 2>&1 @@ -109,7 +111,7 @@ getDependencies() { buildGraphics() { echo_info "Building hyprgraphics" 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) + run cmake --build ./build --config Release --target all -j"$cores" } cloneAndBuildGraphics() { @@ -120,10 +122,10 @@ cloneAndBuildGraphics() { cd hyprgraphics if buildGraphics; then - echo_info "Installing package.." + echo_info "Installing hyprgraphics.." $_sudo cmake --install build else - echo_error "Build has failed for $distro compiling $PACKAGE" + echo_error "Build has failed for $distro compiling hyprgraphics" return 69 fi } @@ -131,7 +133,7 @@ cloneAndBuildGraphics() { buildUtils() { echo_info "Building hyprutils" 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) + run cmake --build ./build --config Release --target all -j"$cores" } cloneAndBuildUtils() { @@ -154,7 +156,6 @@ cloneAndBuildUtils() { } build() { - local cores="$(nproc 2>/dev/null || getconf _NPROCESSORS_CONF)" echo_info "Building hyprlock" run cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -S . -B ./build run cmake --build ./build --config Release --target hyprlock -j"$cores"