pkgname=wayland
pkgver=1.24.0
pkgdesc='A computer display server protocol'
arch=('x86_64')
homepage='https://wayland.freedesktop.org/'
license=('MIT')
depends=('glibc' 'libffi' 'expat')
makedepends=('meson')
sources=("wayland-${pkgver}.tar.xz")
urls=("https://gitlab.freedesktop.org/wayland/wayland/-/releases/$pkgver/downloads/${sources[0]}")
md5sums=("fda0b2a73ea2716f61d75767e02008e1")

src_prepare() {
  tar -xf ${distdir}/${sources[0]} --strip-components=1
}

src_build() {
  local mesonargs=(
    --prefix=/usr
    -Ddocumentation=false
    -Ddtd_validation=true
    -Dlibraries=true
    -Dscanner=false
  )

  meson setup build "${mesonargs[@]}"
  meson compile -C build
}

src_check() {
  # We set it on purpose to only a short subdir name, as socket paths are
  # created in there, which are 108 byte limited. With this it hopefully
  # barely fits to the limit with ${TMPDIR}/x
  export XDG_RUNTIME_DIR="${TMPDIR}"/x
  mkdir "${XDG_RUNTIME_DIR}" || leaf_error "cannot mkdir ${XDG_RUNTIME_DIR}."
  chmod 0700 "${XDG_RUNTIME_DIR}" || leaf_error "cannot chmod ${XDG_RUNTIME_DIR}."

  meson test -C build --print-errorlogs
}

src_install() {
  meson install -C build --destdir "$pkgdir"
  install -Dm644 README.md "${pkgdir}"/usr/share/doc/${pkgname}-${pkgver}/README.md
}



# vim:ft=sh syn=sh et sw=2:
