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

name=wlroots
version=0.20.1
release=1
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
}
