#!/bin/bash
# Copyright © 2019-2026 Collabora Ltd.
# SPDX-License-Identifier: BSD-3-Clause

set -eu -o pipefail

DEB_HOST_GNU_TYPE="$(dpkg-architecture -qDEB_HOST_GNU_TYPE)"
failed=
n=0

for pkg in \
    alsa \
    cairo \
    dbus-1 \
    egl \
    expat \
    flac \
    fontconfig \
    freetype2 \
    gbm \
    gdk-pixbuf-2.0 \
    gl \
    glx \
    gio-2.0 \
    glib-2.0 \
    gmodule-2.0 \
    gmodule-export-2.0 \
    gmodule-no-export-2.0 \
    gobject-2.0 \
    gthread-2.0 \
    harfbuzz \
    harfbuzz-gobject \
    json-glib-1.0 \
    libdrm \
    libelf \
    libffi \
    libidn2 \
    libjpeg \
    libdecor-0 \
    libpipewire-0.3 \
    libpng \
    libpng16 \
    libpulse \
    libpulse-mainloop-glib \
    libpulse-simple \
    libselinux \
    libspa-0.2 \
    libsystemd \
    libudev \
    libusb-1.0 \
    libva \
    libva-drm \
    libva-glx \
    libva-wayland \
    libva-x11 \
    libwebp \
    libwebpdemux \
    libwebpmux \
    ogg \
    openal \
    openssl \
    pango \
    pangocairo \
    pangoft2 \
    pangoxft \
    pixman-1 \
    samplerate \
    sdl2 \
    sdl3 \
    sm \
    sndfile \
    steam-runtime-tools-0 \
    uuid \
    vulkan \
    waffle-1 \
    wayland-client \
    wayland-cursor \
    wayland-egl \
    wayland-server \
    x11 \
    x11-xcb \
    xau \
    xcb \
    xcb-dri2 \
    xcb-dri3 \
    xcb-glx \
    xcb-present \
    xcb-render \
    xcb-res \
    xcb-shm \
    xcb-sync \
    xcb-xfixes \
    xcb-xinerama \
    xcb-xkb \
    xcomposite \
    xcursor \
    xdamage \
    xdmcp \
    xext \
    xfixes \
    xi \
    xinerama \
    xkbcommon \
    xkbcommon-x11 \
    xproto \
    xrandr \
    xrender \
    xscrnsaver \
    xt \
    xtrans \
    xtst \
    xxf86vm \
    zlib \
; do
    n=$(( n + 1 ))

    if v="$("${DEB_HOST_GNU_TYPE}-pkg-config" --modversion "$pkg")"; then
        echo "ok $n - $pkg version $v"
    else
        echo "not ok $n - $pkg"
        failed=1
    fi
done

for pkg in \
    atk \
    gnutls \
    libnotify \
    p11-kit-1 \
    sqlite3 \
    libtasn1 \
; do
    n=$(( n + 1 ))

    if [ "$(dpkg --print-architecture)" = i386 ]; then
        echo "ok $n # SKIP $pkg not supported on i386"
    elif v="$("${DEB_HOST_GNU_TYPE}-pkg-config" --modversion "$pkg")"; then
        echo "ok $n - $pkg version $v"
    else
        echo "not ok $n - $pkg"
        failed=1
    fi
done

echo "1..$n"

if [ -n "$failed" ]; then
    exit 1
fi

# vim:set sw=4 sts=4 et ft=sh:
