. "${GRIMOIRE}/FUNCTIONS"                                        &&

depends  autoconf-2.13                                           &&
depends  -sub "CLANG" llvm                                       &&
depends  perl                                                    &&
depends  python3                                                 &&

#depends  icu     "--with-system-icu"                             &&

depends  glib2                                                   &&
depends  gtk+3   "--enable-default-toolkit=cairo-gtk3"           &&
depends  gtk+2                                                   &&
depends  atk                                                     &&
depends  libx11                                                  &&
depends  libxext                                                 &&
depends  libxrender                                              &&
depends  libxt                                                   &&
depends  libxcomposite                                           &&

depends  pango                                                   &&
depends  fontconfig                                              &&
depends  freetype2                                               &&
depends  libxft                                                  &&

depends  tar   &&
depends  unzip &&
depends  zip   &&

#depends  -sub TEE cairo  "--enable-system-cairo"                 &&
depends  gdk-pixbuf2                                             &&

depends  libjpeg-turbo "--with-system-jpeg"                      &&
depends -sub APNG libpng "--with-system-png"                     &&
depends  librsvg2                                                &&
depends  libwebp       "--with-system-webp"                      &&

depends  nspr               "--with-system-nspr"                 &&

local NSS_BRANCH="3.57"                                          &&
if spell_ok nss                                                  &&
   is_version_less "$(installed_version nss)" "${NSS_BRANCH}"; then
  depends  -sub "${NSS_BRANCH}" nss  "--with-system-nss"
else
  depends  nss  "--with-system-nss"
fi                                                               &&

#depends -sub "TSAFE SECURE_DELETE ENABLE_UNLOCK_NOTIFY ENABLE_DBSTAT_VTAB
#SQLITE_ENABLE_FTS3" sqlite "--enable-system-sqlite"              &&

depends  libidl                                                  &&

depends  zip                                                     &&
depends  zlib               "--with-system-zlib"                 &&

depends libevent            "--with-system-libevent"             &&
depends libvpx              "--with-system-libvpx"               &&
depends libffi              "--enable-system-ffi"                &&
depends libnotify                                                &&
depends pixman              "--enable-system-pixman"             &&

depends rust                                                     &&
depends cbindgen                                                 &&

depends nodejs                                                   &&

depends startup-notification                                     &&
depends gconf2                                                   &&

optional_depends  wireless_tools \
                  "--enable-necko-wifi" \
                  "--disable-necko-wifi" \
                  "for Necko WiFi scanning" &&

optional_depends  pulseaudio \
                  "--enable-pulseaudio" \
                  "--disable-pulseaudio" \
                  "use pulseaudio for audio support" &&

# Firefox is currently borked and does not compile without alsa-lib headers,
# this should have been fixed when Firefox started using Mozilla core 23, but it
# wasn't see https://bugzilla.mozilla.org/show_bug.cgi?id=875268
depends alsa-lib "--enable-alsa" &&
#optional_depends  alsa-lib \
#                  '--enable-wave' \
#                  '--disable-wave --disable-ogg --disable-webm --disable-dash' \
#                  'for audio/video support' &&

optional_depends JACK-DRIVER \
	"--enable-jack" \
	"--disable-jack" \
	"use JACK for audio support" &&

if is_depends_enabled $SPELL alsa-lib; then
  # Firefox tries to use ogg/ogg.h even with --disable-ogg given
  #optional_depends  libogg \
  #                  '--enable-ogg' \
  #                  '--disable-ogg' \
  #                  'for sound support' &&
  depends libogg &&

  # configure script checks for yasm even when --disable-webm and --disable-dash are given
  #optional_depends  yasm \
  #                  '--enable-webm --enable-dash' \
  #                  '--disable-webm --disable-dash' \
  #                  'for WebM video support'
  depends yasm
fi &&

depends dbus-glib "--enable-dbus" &&

# Firefox is currently borked and does not compile without OpenGL headers
#optional_depends  OPENGL \
#                  '--enable-webgl' \
#                  '--disable-webgl --without-gl-provider' \
#                  'for WebGL support' &&
depends OPENGL &&

optional_depends  LIBAVCODEC \
                  "--enable-ffmpeg" \
                  "--disable-ffmpeg" \
                  "for fragmented H264/AAC decoding" &&

suggest_depends_2 firefox-smglwiki "" "" \
  "to enable searching the SMGL Wiki from the Search Bar"

#optional_depends  graphite2 \
#                  "--with-system-graphite2" \
#                  "--without-system-graphite2" \
#                  "for system graphite2" &&
#
#optional_depends  harfbuzz \
#                  "--with-system-harfbuzz" \
#                  "--without-system-harfbuzz" \
#                  "for system harfbuzz" &&
#
optional_depends  dav1d \
                  "--enable-av1" \
                  "--disable-av1" \
                  "for AV1 video support" &&
if is_depends_enabled $SPELL dav1d; then
  depends nasm
fi
