pkgname=quickshell
pkgver=0.3.2
pkgrel=2
pkgdesc='Flexible toolkit for making desktop shells with QtQuick'
arch=(x86_64 aarch64)
url='https://github.com/quickshell-mirror/quickshell'
license=(LGPL-3.0-only)
depends=(
  cpptrace
  glibc
  hicolor-icon-theme
  jemalloc
  libdrm
  libgcc
  libglvnd
  libpipewire
  libstdc++
  libxcb
  mesa
  pam
  polkit
  qt6-base
  qt6-declarative
  qt6-svg
  qt6-wayland
  wayland
)
makedepends=(
  cli11
  cmake
  ninja
  qt6-shadertools
  spirv-tools
  vulkan-headers
  wayland-protocols
)
provides=("$pkgname")
conflicts=(quickshell-git)
_archive="$pkgname-$pkgver"
source=("$_archive.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz"
        quickshell-check.hook)
sha256sums=('946a27e2a276917a03c1079e5c60971af84ece73088c3661dee455d92eb420f7'
            '8543e21aeaaa5441b73a679160e7601a957f16c433e8d6bd9257e80bd0e94083')

build() {
  cd "$_archive"
  cmake -G Ninja -B build -W no-dev \
    -D CMAKE_BUILD_TYPE=RelWithDebInfo \
    -D DISTRIBUTOR='Omarchy' \
    -D CRASH_REPORTER=Off \
    -D CMAKE_INSTALL_PREFIX=/usr \
    -D INSTALL_QML_PREFIX=lib/qt6/qml
  cmake --build build
}

package() {
  install -Dm644 quickshell-check.hook -t "$pkgdir/usr/share/libalpm/hooks"
  cd "$_archive"
  DESTDIR="$pkgdir" cmake --install build
  install -Dm644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname"
}
