wip
This commit is contained in:
parent
c594535bf5
commit
9c879b5f3f
1 changed files with 70 additions and 9 deletions
77
hyprlock.sh
77
hyprlock.sh
|
@ -62,18 +62,18 @@ getDependencies() {
|
|||
# │ You can define dependencies for various linux distros here. It will │
|
||||
# │ automagically be pulled via the $pkgArray[$distro] variable │
|
||||
# ╰─────────────────────────────────────────────────────────────────────────╯
|
||||
depsDebian=(libcairo2-dev mesa-common-dev cmake libgbm-dev libdrm-dev libopengl-dev wayland-protocols wayland-utils libsdbus-c++-dev libhyprlang-dev hyprgraphics)
|
||||
depsDebian=(libpixman-1-dev libcairo2-dev cmake wayland-protocols libwebp-dev libjpeg-dev libspng-dev libmagic-dev libcairo2-dev mesa-common-dev cmake libgbm-dev libdrm-dev libopengl-dev wayland-protocols wayland-utils libsdbus-c++-dev libhyprlang-dev hyprgraphics)
|
||||
depsArch=(hyprutils hyprgraphics)
|
||||
# depsUbuntu=()
|
||||
# depsFedora=()
|
||||
# depsOpensuse=()
|
||||
# depsArch=()
|
||||
# depsAlpine=()
|
||||
|
||||
declare -A deps=(
|
||||
[debian]="depsDebian"
|
||||
[arch]="depsArch"
|
||||
# [ubuntu]="depsUbuntu"
|
||||
# [fedora]="depsFedora"
|
||||
# [arch]="depsArch"
|
||||
# [alpine]="depsAlpine"
|
||||
# [opensuse]="depsOpensuse"
|
||||
)
|
||||
|
@ -87,10 +87,16 @@ getDependencies() {
|
|||
for pkg in "${pkgArray[@]}"; do
|
||||
case "$pkg" in
|
||||
hyprgraphics)
|
||||
if checkComp; then
|
||||
eval "$(curl -fsSL https://git.k4li.de/scripts/installs/raw/branch/main/hypr/hyprgraphics.sh)"
|
||||
case "$distro" in
|
||||
arch) checkAndInstall hyprgraphics ;;
|
||||
debian)
|
||||
if ! command_exists hyprutils; then
|
||||
cloneAndBuildUtils &&
|
||||
cloneAndBuildGraphics
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
if checkComp; then
|
||||
checkAndInstall "$pkg"
|
||||
|
@ -100,13 +106,60 @@ getDependencies() {
|
|||
done
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
cloneAndBuildGraphics() {
|
||||
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
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
cloneAndBuildUtils() {
|
||||
local cloneDir="$(mktemp -d)"
|
||||
# local cloneDir="$HOME/.builds"
|
||||
|
||||
cd $cloneDir || mkdir -p $cloneDir && cd $cloneDir
|
||||
|
||||
echo_info "Cloning sources for $PACKAGE into $cloneDir/$PACKAGE"
|
||||
git clone --depth=1 https://github.com/hyprwm/hyprutils.git &&
|
||||
cd hyprutils
|
||||
|
||||
if build; then
|
||||
echo_info "Installing package.."
|
||||
$_sudo cmake --install build
|
||||
else
|
||||
echo_error "Build has failed for $distro compiling $package"
|
||||
return 69
|
||||
fi
|
||||
}
|
||||
|
||||
build() {
|
||||
echo_info "Building $package"
|
||||
run cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -S . -B ./build
|
||||
run cmake --build ./build --config Release --target hyprlock -j$(nproc 2>/dev/null || getconf _NPROCESSORS_CONF)
|
||||
}
|
||||
|
||||
cloneAndBuild() {
|
||||
cloneAndBuildLock() {
|
||||
local cloneDir="$(mktemp -d)"
|
||||
|
||||
cd $cloneDir || mkdir -p $cloneDir && cd $cloneDir
|
||||
|
@ -126,10 +179,18 @@ cloneAndBuild() {
|
|||
main() {
|
||||
case "$distro" in
|
||||
arch)
|
||||
_install hyprlock
|
||||
_install hyprlock hyprgraphics hyprutils
|
||||
;;
|
||||
debian)
|
||||
cloneAndBuild
|
||||
if ! command_exists hyprutils; then
|
||||
cloneAndBuildUtils
|
||||
fi
|
||||
|
||||
if ! command_exists hyprgraphics; then
|
||||
cloneAndBuildGraphics
|
||||
fi
|
||||
|
||||
cloneAndBuildLock
|
||||
;;
|
||||
*)
|
||||
echo "$distro is not supported by this script!"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue