. "$GRIMOIRE/FUNCTIONS" &&
. "${GRIMOIRE}/MESON_DEPENDS" &&
list_remove CAIRO_OPTS "xml=enabled" &&
list_remove CAIRO_OPTS "xml=disabled" &&

case "$HOST" in
  (*-musl) depends libexecinfo ;;
esac &&

if [[ "${CAIRO_BRANCH}" == "scm" ]]; then
  depends git
fi &&

depends pixman &&

if spell_ok pixman && is_version_less $(installed_version pixman) 0.30.0; then
  force_depends pixman
fi &&

optional_depends zlib \
                 "zlib=enabled" \
                 "zlib=disabled" \
                 "for script, ps, pdf and XML surfaces" &&

# uses libbfd-*.so
optional_depends -sub LIBERTY binutils \
                 "symbol-lookup=enabled" \
                 "symbol-lookup=disabled" \
                 "for symbol-lookup feature" &&

optional_depends freetype2 \
                 "freetype=enabled" \
                 "freetype=disabled" \
                 "for Freetype font backend" &&
if is_depends_enabled ${SPELL} freetype2; then
  optional_depends fontconfig \
                   "fontconfig=enabled" \
                   "fontconfig=disabled" \
                   "for Fontconfig backend"
fi &&

optional_depends libxcb \
                 "xcb=enabled" \
                 "xcb=disabled" \
                 "for XCB surface backend feature" &&

optional_depends glib2 \
                 "glib=enabled" \
                 "glib=disabled" \
                 "for gobject functions feature" &&

optional_depends libx11 \
                 "xlib=enabled" \
                 "xlib=disabled" \
                 "for Xlib surface backend feature" &&

if is_depends_enabled $SPELL libx11; then
  depends xorgproto &&
  depends libxext &&
  depends libxrender &&

  if is_depends_enabled ${SPELL} libxcb; then
    config_query_option CAIRO_OPTS "Enable Xlib/XCB functions feature?" n \
                                   "xlib-xcb=enabled" \
                                   "xlib-xcb=disabled"
  fi
fi &&

optional_depends libpng \
                 "png=enabled" \
                 "png=disabled" \
                 "for PNG support" &&

optional_depends lzo "" "" "for LZO compression support" &&

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