# Maintainer: Integral <integral@member.fsf.org>
# Contributor: FabioLolix
# Contributor: éclairevoyant
# Contributor: ThatOneCalculator <kainoa at t1c dot dev>

pkgname=hyprland-git
_pkgname=${pkgname%-git}
pkgver=0.56.0.r90.5b1c0fda7
pkgrel=1
pkgdesc="A dynamic tiling Wayland compositor based on wlroots that doesn't sacrifice on its looks."
arch=(x86_64 aarch64)
url="https://github.com/hyprwm/Hyprland"
license=('BSD-3-Clause')
depends=(cairo
	glib2
	glslang
	libcanberra
	libdisplay-info
	libdrm
	libglvnd
	libinput
	libliftoff
	libx11
	libxcb
	libxcomposite
	libxfixes
	libxkbcommon
	libxrender
	lua
	opengl-driver
	pango
	pixman
	polkit
	sdbus-cpp
	seatd
	systemd-libs
	vulkan-icd-loader
	wayland
	wayland-protocols
	xcb-proto
	xcb-util
	xcb-util-errors
	xcb-util-keysyms
	xcb-util-renderutil
	xcb-util-wm
	xorg-xwayland
	tomlplusplus
	hyprlang-git
	hyprcursor-git
	hyprutils-git
	xcb-util-image
	aquamarine-git
	libxcursor
	hyprgraphics-git
	re2
	muparser
	hyprland-guiutils-git
	hyprwire-git
)
makedepends=(
	git
	cmake
	ninja
	meson
	xorgproto
	hyprwayland-scanner-git
	glaze
)
provides=("${_pkgname}=${pkgver%%.r*}")
conflicts=("${_pkgname}")
replaces=("${_pkgname}-nvidia-git")
source=("git+https://github.com/hyprwm/Hyprland.git"
	"git+https://github.com/hyprwm/hyprland-protocols.git"
	"git+https://github.com/canihavesomecoffee/udis86.git"
	"git+https://github.com/wolfpld/tracy.git")
sha256sums=('SKIP'
            'SKIP'
            'SKIP'
            'SKIP')

prepare() {
	cd Hyprland

	git submodule init
	git config submodule.subprojects/hyprland-protocols.url "${srcdir}/hyprland-protocols"
	git config submodule.subprojects/udis86.url "${srcdir}/udis86"
	git config submodule.subprojects/tracy.url "${srcdir}/tracy"
	git -c protocol.file.allow=always submodule update
}

pkgver() {
	git -C Hyprland describe --long --tags | sed 's/^v//;s/\([^-]*-\)g/r\1/;s/-/./g'
}

build() {
	make -C Hyprland PREFIX=/usr all
}

package() {
	cd Hyprland
	make DESTDIR="${pkgdir}" install

	# Avoid conflict with xdg-desktop-portal-hyprland
	rm -rfv "${pkgdir}/usr/share/xdg-desktop-portal"

	install -Dm644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
}
