# Description: A modular Wayland compositor library.
# URL: https://gitlab.freedesktop.org/wlroots/wlroots/
# Maintainer: Tim Biermann, tbier at posteo dot de
# Depends on: hwdata libcap libinput libxkbcommon mesa seatd wayland-protocols xorg-libpixman xorg-xcb-util-image xorg-xcb-util-wm
# Optional: xorg-libxcomposite xorg-server xorg-xcb-util-error xorg-xcb-util-renderutil xorg-xinput

name=wlroots
version=0.16.2
release=2
source=(https://gitlab.freedesktop.org/wlroots/wlroots/-/archive/$version/wlroots-$version.tar.bz2)

build() {
  prt-get isinst xorg-xwayland && PKGMK_WLROOTS+=' -D xwayland=enabled' || PKGMK_WLROOTS+=' -D xwayland=disabled'
  prt-get isinst xorg-server xorg-xcb-util-renderutil && WLROOTS_BACKENDS+=',x11'
  prt-get isinst libinput && WLROOTS_BACKENDS+=',libinput'

  meson setup $name-$version build $PKGMK_WLROOTS \
    --prefix=/usr \
    --buildtype=plain \
    --wrap-mode nodownload \
    -D b_lto=true \
    -D b_pie=true \
    -D backends=drm$WLROOTS_BACKENDS \
    -D examples=false

  meson compile -C build
  DESTDIR=$PKG meson install -C build
}
