. "${GRIMOIRE}/FUNCTIONS" &&
. "${GRIMOIRE}/VDEPENDS" &&
. "${GRIMOIRE}/MESON_DEPENDS" &&

depends glib2 &&
depends libepoxy &&
depends libxkbcommon &&
optional_depends gobject-introspection  \
                  "introspection=true"  \
                  "introspection=false" \
                  "to enable introspection support" &&

vdepends << ! &&
	gdk-pixbuf2 >= 2.30
	pango >= 1.41
	at-spi2-core >= 2.45.0
!

optional_depends gtk-doc \
                 "gtk_doc=true" \
                 "gtk_doc=false" \
                 "Build documentation with gtk-doc" &&

# FIXME add print backends
# - cloudprint, depends on oauth
# - papi?
# - lpr
optional_depends cups \
                 "print_backends=cups,file" \
                 "print_backends=file" \
                 "Enable CUPS print backend support?" &&

if is_depends_enabled "${SPELL}" "cups"; then
  optional_depends colord \
                   colord={yes,no} \
                  "Build colord support for CUPS print backend"
fi &&

optional_depends libx11 \
                 "x11_backend=true" \
                 "x11_backend=false" \
                 "to enable X11 backend" &&

if is_depends_enabled "${SPELL}" "libx11"; then
  local XLIB_SUB="X" &&
  depends fontconfig &&
  depends libxcursor &&
  depends libxext &&
  depends libxrender &&
  depends libsm &&

  optional_depends libxcomposite \
                   "" \
                   "" \
                   "for X11 Compositing support" &&

  optional_depends libxdamage \
                   "" \
                   "" \
                   "for X11 Damaged region extension support" &&

  optional_depends libxfixes \
                   "" \
                   "" \
                   "for X11 workarounds for various limitations" &&

  optional_depends libxinerama \
                   "xinerama=yes" \
                   "xinerama=no" \
                   "for X11 Xinerama extension support" &&

  optional_depends libxrandr \
                   "" \
                   "" \
                   "for X11 Resize and Rotate support"
fi &&

depends -sub "PDF PS SVG GOBJ ${XLIB_SUB}" cairo &&

optional_depends wayland \
                 "wayland_backend=true" \
                 "wayland_backend=false" \
                 "to enable Wayland backend" &&

if is_depends_enabled "${SPELL}" "wayland"; then
  depends wayland-protocols
fi
