File PKGBUILD of Package kwayland-git

# Maintainer: neycrol <your@email.com>
pkgname=kwayland-git
_pkgname=kwayland
pkgver=6.5.90
pkgrel=1
pkgdesc='Qt-style Client and Server library wrapper for the Wayland libraries (Git)'
arch=(x86_64)
url='https://invent.kde.org/plasma/kwayland'
license=(LGPL-2.0-or-later)
depends=(
  gcc-libs
  glibc
  qt6-base
  wayland
)
makedepends=(
  extra-cmake-modules
  plasma-wayland-protocols-git
  wayland-protocols
  cmake
  ninja
)
provides=(kwayland)
conflicts=(kwayland)
source=("${_pkgname}.tar.gz")
sha256sums=('SKIP')

pkgver() {
  local _ver _ts
  if [[ -f "${srcdir}/kwayland.obsinfo" ]]; then
    _ver=$(sed -n 's/^version: //p' "${srcdir}/kwayland.obsinfo" | head -n1)
  fi
  if [[ -z "$_ver" && -f "${srcdir}/._servicedata" ]]; then
    _ver=$(sed -n 's/.*<param name="version">\(.*\)<\/param>.*/\1/p' "${srcdir}/._servicedata" | head -n1)
  fi
  if [[ -z "$_ver" && -d "${srcdir}/kwayland" ]]; then
    _ts=$(find "${srcdir}/kwayland" -type f -printf '%T@\n' 2>/dev/null | sort -n | tail -n1 | cut -d. -f1)
    if [[ -n "$_ts" ]]; then
      _ver=$(date -u -d "@${_ts}" +%Y%m%d.%H%M%S 2>/dev/null)
    fi
  fi
  if [[ -z "$_ver" ]]; then
    _ver="${pkgver}"
  fi
  echo "${_ver//-/_}"
}


build() {
  cmake -B build -S "${_pkgname}" \
    -DCMAKE_INSTALL_LIBEXECDIR=lib \
    -DBUILD_TESTING=OFF \
    -DCMAKE_INSTALL_PREFIX=/usr
  cmake --build build
}

package() {
  DESTDIR="${pkgdir}" cmake --install build
}
openSUSE Build Service is sponsored by