#!/bin/bash

. ./lib.sh

set -e

export DEBIAN_FRONTEND=noninteractive

SILENT_APT='/dev/stdout'

a_c_c_lock=''
apt_lock=''

stats_failed_compilation=''
stats_uninstallable=''
stats_dumped=''
stats_skipped=''
stats_other=''

no_clean=false
clippy_enabled=false
parallel=false

packages=''
skip_set=''

defines_nerf_static_assert="#define _Static_assert(...) ;"
defines_nerf_restrict="#define restrict"

CONTAINER_HOST_PREFIX="/container-host"

container_host_arch=''
container_host_triplet=''

container_host_triplet() {
    case "$1" in
        amd64) echo x86_64-linux-gnu ;;
        arm64) echo aarch64-linux-gnu ;;
        *)
            log_msg "Unhandled host tripled $1"
            exit 1 ;;
    esac
}

# Install perl and abi-compliance-chcker in /container-host, therefore allowing
# them to run without emulation in containers and providing a great speed-up
install_acc_for_host() {
    local deps="libc6 libcrypt1 libperl5.36 libapt-pkg6.0 libeatmydata1"

    [[ -z "${container_host_arch}" ]] && exit 1

    # Native perl in the case of binfmt-based emulation
    log_msg Add dpkg native arch
    dpkg --add-architecture "${container_host_arch}"

    # The mirrors for amd64 and armhf are not the same: ports.u.c versus a.u.c.
    # We need to create a dropin for apt for amd64 and restrict sources.list to
    # the container architecture.
    if [[ "${container_host_arch}" = "amd64" ]]; then
        sed \
            -e 's/ports\.ubuntu.com/archive.ubuntu.com/g' \
            -e 's/ubuntu-ports/ubuntu/g' \
            -e "s/^deb \[/deb [arch=${container_host_arch} /" \
            /etc/apt/sources.list \
            > "/etc/apt/sources.list.d/${container_host_arch}.list"
        sed -i \
            -e "s/^deb \[/deb [arch=${dpkg_arch} /" \
            /etc/apt/sources.list
    fi

    log_msg "apt update"
    apt-get update

    # shellcheck disable=SC2046
    eatmydata apt-get -y install --download-only --no-install-recommends $(printf "%s:${container_host_arch} " ${deps}) >"${SILENT_APT}"

    log_msg dpkg -x ${deps}
    mkdir -p "${CONTAINER_HOST_PREFIX}"
    for dep in ${deps}; do
        log_msg dpkg -i "$dep"
        eatmydata dpkg -x "/var/cache/apt/archives/${dep}"*_"${container_host_arch}".deb "${CONTAINER_HOST_PREFIX}"
    done

    rm -f "/etc/apt/sources.list.d/${container_host_arch}.list"
    dpkg --remove-architecture "${container_host_arch}"
}

init() {
    # makes things better for parallel runs
    (which abi-compliance-checker && which eatmydata && which ctags \
     && which grep-dctrl && which pkill && which lockfile \
     && which apt-file && which apt-rdepends && which sqlite3) >/dev/null\
    || apt-get -qq -y install --no-install-recommends \
      abi-compliance-checker dctrl-tools eatmydata procmail procps \
      universal-ctags apt-file apt-rdepends sqlite3 >"${SILENT_APT}"

    dpkg_arch=$(dpkg --print-architecture)

    case "$dpkg_arch" in
        i386)
            multiarch=i386-linux-gnu
            ;;
        armhf)
            multiarch=arm-linux-gnueabihf
            ;;
        *)
            log_msg "Unknown or non-32-bit architecture" >&2
            exit 2
            ;;
    esac

    gcc_major=$(gcc -dumpversion)
    include_search_paths=$(echo | cpp -v 2>&1 >/dev/null | sed -n '/^ [^ ]\+$/ s/^ // p' | grep '/usr/include')

    if [[ -n "${container_host_triplet}" ]]; then
        install_acc_for_host
    else
        # We need to apt-get update once; install_acc_for_host runs it already
        log_msg "apt update"
        apt-get update
    fi

    if ! [[ -e "${SQLITE_DB}" ]]; then
        sqlite3 "${SQLITE_DB}" < ./sql/create.sql
    fi

    APT_PREINSTALLED_PACKAGES="$(apt-mark showmanual)"
}

clean_up() {
    local from

    if [[ ${BASH_LINENO[0]} -eq 1 ]]; then
        from='a trap'
        trap - INT TERM ERR EXIT
    else
        from="line ${BASH_LINENO[0]}"
    fi
    log_msg "Clean up (called from ${from})"

    # Restore devpkg to the value that the rest of the script expects
    if [[ -n "${devpkg_no_virtual:-}" ]]; then
        devpkg=$devpkg_no_virtual
    fi
    pkill -f abi-compliance-checker || true
    rm -f workarounds.h
    # - apt_* commands takes $apt_lock; the script would deadlock if the lock is
    # already held
    # - we empty $devpkg and $devpkg_no_virtual after being done so that if
    # clean_up is called again with no package installation in between, we know
    # there's nothing to do
    if [[ -z "$apt_lock" ]] && [[ -n "${devpkg-}" ]]; then
        apt_autoremove
        unset devpkg
        unset devpkg_no_virtual
    fi
    if [[ -n "$a_c_c_lock" ]]; then
       rm -fv "$a_c_c_lock"
       a_c_c_lock=''
    fi
    if [[ -n "$apt_lock" ]]; then
        rm -fv "$apt_lock"
        apt_lock=''
    fi

    print_stats
}

# Call apt-get --purge autoremove, taking the apt lock
apt_autoremove() {
    local retval

    if $no_clean; then
        return 0
    fi

    lockfile apt-lock
    apt_lock=apt-lock
    retval=0

    log_msg apt-get autoremove --purge

    eatmydata \
        apt-get -o APT::AutoRemove::RecommendsImportant="false" \
        -y --no-install-recommends --purge autoremove >"${SILENT_APT}" \
        || retval=$?

    rm -f apt-lock
    apt_lock=''

    return "$retval"
}

# Call apt-get install "$@", taking the apt lock
# After the packages are installed, autoremove is called to remove packages
# installed previously which are not needed anymore. All installed packages are
# apt-mark'ed auto so that the aforementioned autoremove will remove them on
# the next iteration unless they have been install'ed meanwhile.
# As such the best way to understand the process is as follows:
# - install foo bar
# - autoremove # does nothing
# - mark auto foo bar
# - [...]
# - install bar
# - autoremove # removes foo
# - mark auto bar
# - [...]
# - install baz
# - autoremove # remove bar
# - mark auto baz
# - [...]
#
# Also remove .deb files in /var/cache/apt/archives to save space. Do it
# manually because:
# - "apt clean" removes all .deb files and index files which requires an apt
#   update afterwards, which takes time
# - "apt autoclean" retains the index files but removes very few .deb files,
#   saving very little space
apt_install() {
    local devpkg

    devpkg="$1"
    shift

    local apt_log="logs/${devpkg}/apt.log"

    lockfile apt-lock
    apt_lock=apt-lock

    mkdir -p "$(dirname "${apt_log}")"
    : > "${apt_log}"

    log_msg apt-get install "$@" | tee -a "${apt_log}"

    retval=0
    eatmydata \
        apt-get -o APT::AutoRemove::RecommendsImportant="false" \
        -y --no-install-recommends install "$@" \
        > >( tee -a "${apt_log}" >"${SILENT_APT}" || true ) \
        2>&1 \
        || retval=$?

    # Remove installed packages in case of install error
    if ((retval > 0)); then
        eatmydata \
            apt-get -o APT::AutoRemove::RecommendsImportant="false" \
            -y --no-install-recommends --purge autoremove "$@" \
            > >( tee -a "${apt_log}" >"${SILENT_APT}" || true ) \
            2>&1
    fi

    eatmydata \
        apt-get -o APT::AutoRemove::RecommendsImportant="false" \
        -y --no-install-recommends --purge autoremove \
        > >( tee -a "${apt_log}" >"${SILENT_APT}" || true ) \
        2>&1 \
        || retval=$?

    apt-mark auto "$@" >/dev/null
    apt-mark manual ${APT_PREINSTALLED_PACKAGES} >/dev/null

    find /var/cache/apt/archives/ -type f -name "*.deb" -delete || true
    rm -f apt-lock
    apt_lock=''

    return "$retval"
}

# recursively finds headers in a given directory matching a pattern
# while excluding specified list of subdirectories
# note: exclude list should not contain trailing slashes
find_headers(){
    dir="$1"
    shift
    pattern="$1"
    shift
    exclude=$@
    find "$dir" -maxdepth 1 -type f -name "$pattern" -print | sort -u
    find "$dir" -maxdepth 1 -not -wholename "$dir" -type d | sort -u | while read -r name; do
        for x in $exclude; do
            if [[ "$name" == "$x" ]]; then
                break 2
            fi
        done
        find_headers "$name" "$pattern" "$exclude"
    done
}

# skip
skip_header(){
    header_to_move="$1"
    shift
    header_list="$@"
    for x in $header_list
    do
        if [[ "$x" != "$header_to_move" ]]; then
            echo "$x"
        fi
    done
}

# move the header to the back of the list
move_to_back(){
    header_to_move="$1"
    shift
    header_list="$@"
    skip_header "${header_to_move}" ${header_list}
    echo "$header_to_move"
}

wrap_acc() {
    local lib=${CONTAINER_HOST_PREFIX}/lib/${container_host_triplet}
    local usr_lib=${CONTAINER_HOST_PREFIX}/usr/lib/${container_host_triplet}
    local usr_bin=${CONTAINER_HOST_PREFIX}/usr/bin

    local arch
    arch="$(echo "${container_host_triplet}" | cut -f1 -d-)"

    if [[ -n "${container_host_triplet}" ]]; then
        # shellcheck disable=SC2211
        LD_LIBRARY_PATH="${usr_lib}:${lib}" \
        PERL5LIB="${usr_lib}/perl/" \
        "${lib}/ld-linux-${arch}.so."? \
        "${usr_bin}/perl5.36-${arch}-linux-gnu" \
        /usr/bin/abi-compliance-checker \
        "$@"
    else
        /usr/bin/abi-compliance-checker \
        "$@"
    fi
}

# Run a-c-c's library ABI dump
a_c_c() {
    # uses global variables: $devpkg, $extra_args
    local v1
    local filename_stem

    v1="$1"
    filename_stem="${devpkg}_${v1}"

    log_msg "Run a-c-c ${v1}"

    wrap_acc -l "$devpkg" $extra_args --v1="${v1}" --headers-only \
        -dump "logs/${devpkg}/${filename_stem}.xml" -dump-path "logs/${devpkg}/${filename_stem}.dump"
}

a_c_c_backup() {
    local devpkg

    devpkg="$1"

    mkdir -p "dumps"

    # Save space in the dumps
    sed -i 's/ *//' "logs/${devpkg}/${devpkg}"_{base,lfs,time_t}.{xml,dump}

    tar c -C 'logs' "${devpkg}" \
        | xz -T1 --lzma2=preset=3,dict=128M \
        > "dumps/${devpkg}.dump.tar.xz"
}

a_c_c_clean() {
    local devpkg

    devpkg="$1"

    pkill -f abi-compliance-checker || true
    rm -f a-c-c-lock

    rm -f "${devpkg}"_{base,lfs,time_t}.dump
}

result_sql_quirks() {
    local devpkg

    local installed_packages
    local quirk_defines
    local quirk_exclude_types
    local quirk_installed_packages
    local quirk_preamble

    devpkg="$1"

    installed_packages="$(dpkg-query --show -f '${Package}\n' || true)"
    quirk_defines="$(echo "${defines}" | sed -e 's/"/\\"/g' -e 's/;/,/g' | tr '\n' ',')"
    quirk_includes="$(echo "${preamble}" | tr '\n' ',')"
    quirk_exclude_types="$(echo "${exclude_types}" | tr '\n' ',')"
    quirk_installed_packages="$(echo "${installed_packages}" | tr '\n' ',')"
    quirk_preamble="$(echo "${preamble}" | sed -e 's/"/\\"/g' | tr '\n' ',')"

    sqlite3 "${SQLITE_DB}" << EOF
.parameter set @extra_args         "${extra_args}"
.parameter set @extra_deps         "${extra_deps}"
.parameter set @defines            "${quirk_defines}"
.parameter set @includes           "${quirk_includes}"
.parameter set @preamble           "${quirk_preamble}"
.parameter set @exclude_types      "${quirk_exclude_types}"
.parameter set @clippy_packages    "${clippy_packages}"
.parameter set @installed_packages "${quirk_installed_packages}"
replace
into quirks
(id, extra_args, extra_deps, defines, includes, preamble, exclude_types, clippy_packages, installed_packages)
values ($(sql_select_rowid "${devpkg}"), @extra_args, @extra_deps, @defines, @includes, @preamble, @exclude_types, @clippy_packages, @installed_packages);
EOF
}

result_sql_init() {
    local devpkg
    local devpkg_no_virtual

    local virtual

    devpkg="$1"
    devpkg_no_virtual="$2"

    virtual="$(is_virtual_package "${devpkg}")"

    sqlite3 "${SQLITE_DB}" "insert or ignore into packages (devpkg,virtual) values (\"${devpkg}\",${virtual});"

    if "${virtual}"; then
        sql_change "${devpkg}" 'replace' 'virtual_packages' 'real' "\"${devpkg_no_virtual}\""
    fi
}

result_sql() {
    local devpkg
    local field

    devpkg="$1"
    field="$2"

    sql_change "${devpkg}" 'replace' 'dumps' 'status' "'${field}'"

    result_sql_quirks "${devpkg}"
}

result_sql_remove() {
    local devpkg

    devpkg="$1"

    for table in 'dumps' 'quirks'; do
        sqlite3 "${SQLITE_DB}" "delete from ${table} where rowid = ($(sql_select_rowid "${devpkg}"));"
    done
}

result_failed_compilation() {
    log_msg "Failed compiling $1"
    stats_failed_compilation="${stats_failed_compilation:+${stats_failed_compilation} }$1"
    result_sql "$1" 'failed'
}

result_uninstallable() {
    log_msg "Uninstallable $1"
    stats_uninstallable="${stats_uninstallable:+${stats_uninstallable} }$1"
    result_sql "$1" 'uninstallable'
}

result_dumped() {
    log_msg "Dumped $1"
    stats_dumped="${stats_dumped:+${stats_dumped} }$1"
    result_sql "$1" 'dumped'
}

result_skipped() {
    log_msg "Skipped $1${2+: $2}"
    stats_skipped="${stats_skipped:+${stats_skipped} }$1"
    result_sql "$1" 'skipped'
}

result_other() {
    log_msg "Other $1"
    stats_other="${stats_other:+${stats_other} }$1"
    result_sql "$1" 'other'
}

# A virtual package contains a '=' in its name
is_virtual_package() {
    case $1 in
        *=*) echo true ;;
        *) echo false ;;
    esac
}

# Output the real name of a package
# NOTE: doesn't change non-virtual package names and is safe to use on them
unvirtual_package() {
    echo "${1/=*}"
}

read_headers_list_file() {
    # args: $1: file name
    while read -r LINE; do
        if [[ "$LINE" != './'* && "$LINE" != '/usr/include'* ]]; then
            echo "/usr/include/$LINE"
        else
            echo "$LINE"
        fi
    done < "$1"
}

show_cli_help() {
    cat << EOF
Usage: check-armhf-time_t [OPTION]... [SOURCE_PACKAGE]...
    -h, --help        print this message and exit
    --mode=batch      Default to settings optimized for batch processing;
                      later command-line options can override these settings
    --mode=dev        Default to settings optimized for development
                      later command-line options can override these settings
    --no-clean        don't remove packages installed for a package after having
                      processed it; may cause errors for other future packages!
    --[no-]parallel  do the ABI dumps in parallel; uses three times as much
                      peak memory at once but speeds up the script by a factor
                      of 2x to 3x (default off except with --mode=dev)
    --[no-]clippy     enable automated discovery of missing dependencies
                      (default off except with --mode=dev)
    --[no-]container-host-hack=[amd64|arm64]
                      call abi-compliance-checker with a perl built for the
                      given architecture, avoiding emulation if running in a
                      container hosted on the given architecture (default off)
    --skip=all-known  skip all packages specified
    --skip=dumped     skip again all packages specified
    --skip=failed     skip packages that are specified and failed
    --skip=other      skip packages that are specified and had 'other' outcomes
    --skip=skipped    skip packages that are specified and were skipped
    --skip=uninstallab
                      skip packages that are specified and were uninstallable
EOF
}

container_host_hack_enable() {
    container_host_arch="$1"
    container_host_triplet="$(container_host_triplet "${container_host_arch}")"
}

container_host_hack_disable() {
    container_host_arch=''
    container_host_triplet=''
}

dev_mode() {
    parallel=true
    clippy_enabled=true
    # Bash disables set -e in subshells. You can reproduce with the following:
    #   set -e; f() { echo a && false; true; }; x="$(f)"; echo $x
    #
    # See https://www.shellcheck.net/wiki/SC2311
    shopt -s inherit_errexit
    set -u
}

batch_mode() {
    parallel=false
    clippy_enabled=false
    shopt -u inherit_errexit
    set +u
}

urcu_patch_transparent_unions()
{
    # transparent unions are not supported when compiling as C++ code.
    perl -i -pe 'BEGIN{undef $/;} s/static inline struct __cds_wfcq_head \*__cds_wfcq_head_cast\(struct __cds_wfcq_head \*head\)\n\{\n.*return head;\n\}/static inline cds_wfcq_head_ptr_t __cds_wfcq_head_cast(struct __cds_wfcq_head \*head)\{ cds_wfcq_head_ptr_t ret = \{ ._h = head \}; return  ret; \}/g' \
        "/usr/include/$multiarch/urcu/wfcqueue.h"
    perl -i -pe 'BEGIN{undef $/;} s/static inline struct cds_wfcq_head \*cds_wfcq_head_cast\(struct cds_wfcq_head \*head\)\n\{\n.*return head;\n\}/static inline cds_wfcq_head_ptr_t cds_wfcq_head_cast(struct cds_wfcq_head \*head)\{ cds_wfcq_head_ptr_t ret = \{ .h = head \}; return  ret; \}/g' \
        "/usr/include/$multiarch/urcu/wfcqueue.h"
    sed -i \
        -e 's/retnode = ___cds_wfs_pop_with_state_blocking(s, state);/retnode = ___cds_wfs_pop_with_state_blocking({}, state);/g' \
        -e 's/___cds_\(l\|w\)fs_pop\(\|_all\)(s);/___cds_\1fs_pop\2({});/g' \
        "/usr/include/$multiarch/urcu/static"/{l,w}fstack.h
}

patch_qhull()
{
    # compile errors caused by spurious define matches
    sed -i 's/#define\sqh\sqh_qh\.//g' /usr/include/libqhull/libqhull.h
    # header not included in namespace
    sed -i 's/friend void         ::qh_fprintf/friend void         qh_fprintf/g' /usr/include/libqhullcpp/QhullQh.h
    sed -i 's/friend void ::qh_fprintf_rbox/friend void qh_fprintf_rbox/g' /usr/include/libqhullcpp/RboxPoints.h
    # implicit cast (alternatively can be solved through headers reordering)
    sed -i 's/qh_pointid(qh_qh, point_coordinates);/qh_pointid(nullptr);/g' /usr/include/libqhullcpp/QhullPoint.h
}

apt_rdepends_list() {
    apt-rdepends "$1" 2>/dev/null \
        | awk -F' ' '/Depends:/ { printf("%s ", $2); }'
}

llvm_version_of_devpkg_no_virtual() {
    echo "$1" | rev | cut -f2 -d- | rev
}

clippy() {
    local log_file

    local error_line
    local missing_file
    local package_count
    local packages
    local packages
    local rdepends
    local tree_file

    log_file="$1"

    error_line="$(set -o pipefail; \
        sed -n \
        's/\(.*\):[0-9]\+:[0-9]\+: fatal error: \(.*\): No such file or directory$/\1 \2/ p' \
        "${log_file}" \
        | head -n 1 )"

    if [[ -z "${error_line}" ]]; then
        log_msg Clippy only knows how to help with missing dependencies >&2
        return 1
    fi

    read -r tree_file missing_file < <(echo "${error_line}")

    if [[ -z "${missing_file}" ]]; then
        log_msg "Clippy couldn't parse error line (${error_line})" >&2
        return 1
    fi

    log_msg "First missing file found by clippy: ${missing_file}" >&2

    case "${missing_file}" in
        ../*)
            missing_file="$(echo "${missing_file}" | sed 's,^\(\.\./\)\+,,')"
            log_msg "Trimmed leading '../' from filename" >&2
            ;;
        *)
            ;;
    esac

    case "${missing_file}" in
        basic.h|compiler.h|config.h|misc.h|windows.h)
            # Skip these immediately because there are so many matches that
            # it's nothing but noise
            log_msg "Clippy couldn't find required file ${missing_file} for ${tree_file}" >&2
            return 1
            ;;
        boost/*.hpp)
            echo libboost1.81-dev
            return
            ;;
        glib.h)
            echo libglib2.0-dev
            return
            ;;
        gtk/gtk.h|gdk/gdk.h)
            rdepends="$(apt_rdepends_list "$devpkg_no_virtual")"
            case " ${rdepends}" in
                *' 'libgtk-4-*) echo libgtk-4-dev; return ;;
                *' 'libgtk-3-*) echo libgtk-3-dev; return ;;
                *' 'libgtk2.0-*) echo libgtk2.0-dev; return ;;
                *)
                    log_msg "Don't know how to handle [${rdepends}] for ${missing_file}" >&2
                    return 1
                    ;;
            esac
            ;;
        jni.h)
            echo 'default-jdk-headless'
            return
            ;;
        libsoup/soup.h)
            rdepends="$(apt_rdepends_list "$devpkg_no_virtual")"
            case " ${rdepends}" in
                *libsoup-3.0*) echo libsoup-3.0-dev return ;;
                *)
                    log_msg "Don't know how to handle [${rdepends}] for ${missing_file}" >&2
                    return 1
                    ;;
            esac
            ;;
        llvm/*.h)
            case "${devpkg_no_virtual}" in
                *-1?-dev)
                    llvm_version="$(llvm_version_of_devpkg_no_virtual "${devpkg_no_virtual}")"
                    echo "llvm-${llvm_version}-dev"
                    return
                    ;;
                *)
                    echo 'llvm-dev'
                    return
                    ;;
            esac
            ;;
        mpi.h)
            if apt_rdepends_list "${devpkg_no_virtual}" | grep -q 'libopenmpi3'; then
                echo 'libopenmpi-dev'
                return
            fi
            ;;
        pyconfig.h|Python.h)
            echo 'libpython3-dev'
            return
            ;;
        ruby.h)
            echo 'ruby-dev'
            return
            ;;
        tk.h)
            echo tk8.6-dev
            return
            ;;
        winpr/winpr.h|winpr.h)
            log_msg "winpr.h is required but is a file for windows development" >&2
            return 1
            ;;
        X11/Xlib.h)
            echo 'libx11-dev'
            return
            ;;
        zlib.h)
            echo zlib1g-dev
            return
            ;;
        perl.h)
            echo 'libperl-dev'
            return
            ;;
        *)
            ;;
    esac

    # Only consider files under /usr/include and /usr/lib/.*/include/.*
    #
    # apt-file search knows --regexp but it's very very slow (slower than
    # building packages!) so we'll do that part by hand; the speed-up is
    # probably can be as high as 100x (from 8 minutes to 5 seconds)
    packages="$(apt-file search -a "${dpkg_arch}" "/${missing_file}" \
        | grep ".*: /usr/\(include\(/.\+\)*\|lib\(/.\+\)*/include\(/.\+\)*\)/${missing_file}\$" \
        | grep -v \
            -e 'fake_libc_include' \
        | grep -v \
            -e 'dietlibc' \
            -e 'musl' \
            -e '-mingw-w64-dev' \
            -e 'gcc-cross' \
            -e '-wasm32$' \
            -e 'qtbase5-gles-dev' \
            -e 'qtcreator-data' \
            -e 'android-libboringssl-dev' \
        | cut -f1 -d: \
        | sort \
        | uniq)"

    package_count="$(echo "${packages}" | wc -w)"

    if (( package_count == 1 )); then
        echo ${packages}
        return
    fi

    if (( package_count == 0 )); then
        log_msg "Clippy couldn't find required file ${missing_file} for ${tree_file}" >&2
        return
    fi

    if (( package_count > 1 )); then
        log_msg "Several candidates for ${missing_file}: ${packages//[$'\n']/ }" >&2

        packages="$(echo "${packages}" | sed 's/\> /\n/g' | grep -- '-dev$')"

        case "$(echo "${packages}" | xargs)" in
            'libboost1.74-dev libboost1.81-dev')
                packages="libboost1.81-dev"
                ;;
            'qt6-base-dev qtbase5-dev')
                case "${devpkg}" in
                    qt5*)
                        packages='qtbase5-dev'
                        ;;
                    qt6*)
                        packages='qt6-base-dev'
                        ;;
                    *)
                        rdepends="$(apt_rdepends_list "$devpkg_no_virtual")"
                        case " ${rdepends}" in
                            *qtbase-abi-5*|*libqt5core*)
                                packages="qtbase5-dev"
                                ;;
                            *qtbase-abi-6*|*libqt6core*)
                                packages="qt6-base-dev"
                                ;;
                            *)
                                ;;
                        esac
                        ;;
                esac
                ;;
            'qt6-declarative-dev qtdeclarative5-dev')
                case "${devpkg}" in
                    qt5*)
                        packages='qtbase5-dev'
                        ;;
                    qt6*)
                        packages='qt6-base-dev'
                        ;;
                    *)
                        rdepends="$(apt_rdepends_list "$devpkg_no_virtual")"
                        case " ${rdepends}" in
                            *qtbase-abi-5*|*libqt5core*)
                                packages="qtdeclarative5-dev"
                                ;;
                            *qtbase-abi-6*|*libqt6core*)
                                packages="qt6-declarative-dev"
                                ;;
                            *)
                                ;;
                        esac
                        ;;
                esac
                ;;
            *)
                ;;
        esac

        package_count="$(echo "${packages}" | wc -w)"
        if (( package_count != 1)); then
            for path in $include_search_paths; do
                packages="$(apt-file search -l -a ${dpkg_arch} -F "${path}/${missing_file}")"
                package_count="$(echo "${packages}" | wc -w)"
                if (( package_count == 1 )); then
                    echo ${packages}
                    return
                fi
            done

            log_msg "Clippy couldn't find required file ${missing_file} for ${tree_file}" >&2
            return 1
        fi

        echo "${packages}"
    fi
}

shall_skip_package() {
    local devpkg
    local devpkg_no_virtual

    local ret_code

    devpkg="$1"
    devpkg_no_virtual="$2"

    # Skip packages that break systems, do not matter here or cannot be
    # analyzed at all
    # Skip by default with the test below
    ret_code='0'
    case "${devpkg}" in
        # breaks the container; check later with a larger VM
        libbsd-dev) ;;
        # For building freebsd code on debian; provides a set of libc headers
        freebsd-glue) ;;
        # we know the ABI
        libc6-dev|libgcc-11-dev|libgcc-12-dev|"libgcc-${gcc_major}-dev") ;;
        # this just plain doesn't compile, no concerns
        libappstream-compose-dev) ;;
        # requires kernel module compilation; skip for now
        nvidia-384-dev) ;;
        # not a library package and uses unreasonable disk
        gosa-dev) ;;
        # for a foreign-arch ABI
        *mingw*dev) ;;
        # The set of public symbols is empty
        cups-filters|\
            iproute2|\
            libreoffice-dev|\
            nx-x11proto-composite-dev|\
            nx-x11proto-randr-dev|\
            nx-x11proto-render-dev|\
            nx-x11proto-xfixes-dev|\
            python3-dulwich|\
            sudo|\
            sudo-ldap|\
            swtpm-dev|\
            xserver-xorg-input-evdev-dev|\
            xserver-xorg-input-joystick-dev) ;;
        # No shared library; it cannot matter
        libeigen3-dev|libcgal-dev|puredata-dev|linux-libc-dev|libasio-dev|\
        gsettings-desktop-schemas-dev|mesa-common-dev|libcereal-dev|\
        libmupen64plus-dev|libwebsocketpp-dev|libseqan2-dev|libnifti2-dev|\
        modemmanager-dev|xserver-xorg-input-libinput-dev|\
        gnome-settings-daemon-dev|libspice-protocol-dev|\
        libwayland-egl-backend-dev|libtoon-dev|publib-dev|\
        ableton-link-dev|xserver-xorg-input-synaptics-dev|tao-json-dev|\
        libfast5-dev|libnbcompat-dev|\
        libcpputest-dev|libarmci-mpi-dev|libaal-dev|nlinline-dev|\
        libself-test-dev)
            ;;
        # ObjC, can't be analyzed as either C or C++
        libgnustep-*-dev|\
            adun-core|\
            cynthiune.app|\
            gnustep-dl2*|\
            gworkspace.app|\
            libaddresses-dev|\
            libaddressview-dev|\
            libbiococoa-dev|\
            libdbuskit-dev|\
            libgorm-dev|\
            libnetclasses-dev|\
            libpantomime-dev|\
            libperformance-dev|\
            libobjc-*-dev|\
            libpopplerkit-dev|\
            libpreferencepanes-dev|\
            librenaissance0-dev|\
            librsskit-dev|\
            libsope-dev|\
            libsqlclient-dev|\
            libsteptalk-dev|\
            libswiften-dev|\
            paje.app|\
            projectcenter.app|\
            sogo|\
            talksoup.app) ;;
        # Another libc (intended for static linkage only)
        dietlibc-dev|musl-dev) ;;
        # Not valid C/C++ headers
        iraf-noao-dev) ;;
        linux-headers-*-*) ;;
        *-dkms) ;;
        *mingw*) ;;
        *-cross|*-wasm32) ;;
        *arduino*) ;;
        coccinelle|camlidl|frama-c*) ;;
        *ocaml*) ;;
        # pcp requires systemd as init; fails dpkg configure step otherwise and
        # breaks the whole process
        pcp*) ;;
        # telinit -u stuck at 100% forever during libc's postinst
        # TODO: set TELINIT=no for libc6 but it's hard-coded in the postinst
        petsc-dev|postgresql-16-ip4r) ;;
        # build only fails for time_t version which trips up the script's
        # logic (I knew this kind of issues were possible and let the
        # failure path present because it's very very uncommon and not
        # worth making the code more complex)
        libevdevplus-dev) ;;
        golang*) ;;
        *rust*) ;;
        *jre*) ;;
        *arm-none-eabi*) ;;
        gcc-snapshot|lib32z1|libc6-i386|libc6-dev-x32|lib32gcc-s1|lib32stdc++6) ;;
        binutils-*|gcc-*)
            case "$devpkg" in
                *-riscv*|*-xtensa*|*-bpf*|*-h8300*|*-msp430*|*-or1k*|*-sh*|*-avr*)
                    ;;
                *)
                    ret_code='1'
                    ;;
            esac
            ;;
        avr-libc|elks-libc|wasi-libc) ;;
        *-doc) ;;
        ompl-demos) ;;
        codelite|codeblocks-common|kdevelop-data)
            # only headers are templates for use in these IDEs
            ;;
        python3-scipy)
            # No usable header: all four either reference fortran headers, or
            # non-packaged ones
            ;;
        python3-wxgtk4.0)
            # its main header includes a wx header that wants to be used with
            # values from the "wx-config" tool that isn't packaged
            ;;
        python3-cffi)
            # I don't think it can be used directly: I think you're supposed to
            # use a tool/API (but we can't infer the results)
            ;;
        pike8.0-*)
            # The Pike programming language; C-like but not C
            ;;
        libclang-common-1?-dev)
            # Only intrinsics and CPU instructions as far as I can tell
            ;;
        *)
            # No decision for now
            unset ret_code
            ;;
    esac

    if [[ -n "${ret_code-}" ]]; then
        return "${ret_code}"
    fi

    ret_code='0'
    case "${devpkg}" in
        libopenvdb-ax-dev)
            # > 57GB
            ;;
        libpcl-dev)
            # ~ 17GB (at least) and compilation errors
            ;;
        libsc-dev)
            # ~2GB but at least 18 hours
            ;;
        *quantlib*)
            # > 55GB
            ;;
        r-cran-sitmo)
            # ~ 36GB (at least) and compilation errors
            ;;
        *)
            unset ret_code
            ;;
    esac

    if [[ -n "${ret_code-}" ]]; then
        return "${ret_code}"
    fi

    if apt-cache show "${devpkg}" | grep -q '^Maintainer: GNU/kFreeBSD Maintainers <debian-bsd@lists.debian.org>$'; then
        return 0
    fi

    return 1
}

# List virtual packages for a given real package
virtual_packages() {
    local devpkg

    local virtuals

    devpkg="$1"

    case $devpkg in
        # libclang-1[45]-dev are too big to be analyzed at once (requires > 4GB
        # of memory space); however the 'clang-tidy' subset is small enough and
        # since it contains ABI that depends on time_t, it is enough to
        # conclude the whole library contains ABI that depends on time_t
        libclang-1?-dev)
            virtuals='clang-tidy-abseil-time the-rest'
            ;;
        llvm-1?-dev)
            virtuals='analytics code debug execution-engine transforms the-rest'
            ;;
        libogre-1.9-dev)
            virtuals='plugins gl gles2 the-rest'
            ;;
        libogre-1.12-dev)
            virtuals='plugins gl gles2 gl3plus the-rest'
            ;;
        libmlir-1?-dev)
            virtuals='all-dialects mlir support dialect-gpu mlir-c dialect dialect-linalg dialect-tosa dialect-spirv dialect-llvmir'
            ;;
        libmapnik-dev)
            virtuals='base svg1'
            ;;
        # freerdp2-dev has headers for client and server roles which use the
        # same symbol names
        freerdp2-dev)
            virtuals='client server'
            ;;
        liblog4cpp5-dev)
            virtuals='boostthreads dummythreads omnithreads pthreads'
            ;;
        voms-dev)
            virtuals='c cpp'
            ;;
        qtbase5-private-dev|qtbase5-private-gles-dev)
            virtuals='chunk-1 chunk-2 chunk-3'
            ;;
        qt6-base-private-dev)
            virtuals='chunk-1 chunk-2 chunk-3'
            ;;
        libboost1.74-dev)
            chunks=(chunk-{0..9})
            virtuals="${chunks[@]}"
            ;;
        libniftiio-dev)
            virtuals='nifti-1 nifti-2'
            ;;
        libmedc-dev)
            virtuals='api23 normal'
            ;;
        libscotchparmetis-dev)
            virtuals='int32 int64 long normal'
            ;;
        libmia-2.4-dev)
            chunks=(chunk-{0..3})
            virtuals="${chunks[@]}"
            ;;
        libint2-dev)
            virtuals='main lcao others'
            ;;
        libstonith1-dev)
            virtuals='plugin the-rest'
            ;;
        libquantlib0-dev)
            virtuals='experimental the-rest cashflows currencies indexes instruments legacy math methods models patterns pricingengines'
            ;;
        libscotchmetis-dev)
            virtuals='cint int32 int64 long'
            ;;
        libgclib-dev)
            virtuals='main intmap hashmap gap'
            ;;
        *)
            # $devpkg doesn't need to be processed as virtual package
            virtuals=''
            ;;
    esac

    if [[ -z "${virtuals}" ]]; then
        echo "${devpkg}"
    else
        printf "${devpkg}=%s " ${virtuals}
    fi
}

package_headers() {
    local devpkg_no_virtual

    devpkg_no_virtual="$1"

    dpkg -L "${devpkg_no_virtual}" \
        | grep -E '\.h(pp|xx|h)?$' \
        | grep -v 'usr/share/doc/' \
        | grep -v 'usr/share/.*/doc/' \
        | grep -v 'usr/share/.*/docs/' \
        | grep -v 'usr/share/.*/examples/' \
        | grep -v 'usr/share/qtcreateor/templates/' \
        | grep -v "usr/lib/${multiarch}/qt5/examples/" \
        | grep -v "usr/lib/${multiarch}/qt6/examples/" \
        || true
}

print_stats() {
    cat << EOF

------------------------------------------------------------------------

SUMMARY:

Failed compilation  $(echo "${stats_failed_compilation}" | wc -w || true)
Uninstallable       $(echo "${stats_uninstallable}"      | wc -w || true)
Dumped              $(echo "${stats_dumped}"             | wc -w || true)
Skipped             $(echo "${stats_skipped}"            | wc -w || true)
Other               $(echo "${stats_other}"              | wc -w || true)

Failed compilation  [${stats_failed_compilation}]
Uninstallable       [${stats_uninstallable}]
Dumped              [${stats_dumped}]
Skipped             [${stats_skipped}]
Other               [${stats_other}]

EOF

if [[ -n "${clippy_hints-}" ]]; then
    cat << EOF
Clippy hints:
$(echo "${clippy_hints-}" | sort -rs -k2 --ignore-leading-blanks | sort -usr -k2,2 || true)

EOF
fi

cat << EOF
------------------------------------------------------------------------

EOF
}

# Default to batch mode which the user can override on the command-line
batch_mode

trap clean_up INT TERM ERR EXIT

while [[ $# -gt 0 ]]; do
    case $1 in
        --mode=dev)
            dev_mode
            ;;
        --mode=batch)
            batch_mode
            ;;
        -h|--help)
            show_cli_help
            exit
            ;;
        --no-clean)
            no_clean=:
            ;;
        --parallel)
            parallel=true
            ;;
        --no-parallel)
            parallel=false
            ;;
        --silent-apt)
            SILENT_APT='/dev/null'
            ;;
        --no-silent-apt)
            SILENT_APT='/dev/stdout'
            ;;
        --container-host-hack=amd64)
            container_host_hack_enable 'amd64'
            ;;
        --container-host-hack=arm64)
            container_host_hack_enable 'arm64'
            ;;
        --no-container-host-hack*)
            container_host_hack_disable
            ;;
        --clippy)
            clippy_enabled=true
            ;;
        --no-clippy)
            clippy_enabled=false
            ;;
        --skip=*)
            case "${1/--skip=/}" in
                all-known)      skip_set="'dumped','failed','other','skipped','uninstallable'" ;;
                dumped)         skip_set="${skip_set:+${skip_set},}'dumped'" ;;
                failed)         skip_set="${skip_set:+${skip_set},}'failed'" ;;
                other)          skip_set="${skip_set:+${skip_set},}'other'" ;;
                skipped)        skip_set="${skip_set:+${skip_set},}'skipped'" ;;
                uninstallable)  skip_set="${skip_set:+${skip_set},}'uninstallable'" ;;
                *)
                    log_msg "Unknown select criteria"
                    exit 1
                    ;;
            esac
            ;;
        --*)
            log_msg "Unknown option \"$1\"" >&2
            exit 1
            ;;
        *)
            packages="$packages $1"
            ;;
    esac
    shift
done

init

# Insert virtual packages
log_msg "Add virtual packages"
packages_tmp=''
for devpkg in $packages; do
    packages_tmp="$packages_tmp $(virtual_packages "${devpkg}")"
done
packages="$packages_tmp"

packages=$(comm \
    -23 \
    <(printf '%s\n' ${packages} | sort || true) \
    <(sqlite3 "${SQLITE_DB}" "select devpkg from packages inner join dumps on packages.rowid = dumps.id where dumps.status in (${skip_set}) order by devpkg asc;")
)

package_count="$(echo "${packages}" | wc -w)"
log_msg "Packages to analyze: ${package_count}"

# No package list provided: the list will be determined automatically
if ((package_count == 0)); then
    log_msg "No package to analyze."
    exit 0
fi

package_i=0

float_typedefs="typedef float _Float32;
typedef long double _Float64;
typedef double _Float32x;"

for devpkg in $packages; do
    extra_args=
    extra_deps=
    defines=
    includes=
    preamble=
    exclude_types=
    exclude_namespaces=
    : $((package_i = package_i + 1))

clippy_thinks_the_package_should_be_tried=true
clippy_packages=''
clippy_previous_proposal=''

while $clippy_thinks_the_package_should_be_tried; do

    clippy_thinks_the_package_should_be_tried=false
    if [[ -n "${clippy_packages}" ]]; then
        log_msg Trying with extra deps: ${clippy_packages}
    fi

    devpkg_no_virtual="$(unvirtual_package "$devpkg")"

    log_msg '--------------------------------------------------'
    log_msg "Process $devpkg [${package_i}/${package_count}]"

    result_sql_init "${devpkg}" "${devpkg_no_virtual}"

    # shellcheck disable=SC2310
    if shall_skip_package "${devpkg}" "${devpkg_no_virtual}"; then
        result_skipped "${devpkg}"
        continue
    fi

    case $devpkg in
        bind9-dev|blt-dev|freerdp2-dev*|guile-3.0-dev|libapparmor-dev|\
        libasound2-dev|libasyncns-dev|libblockdev-nvdimm-dev|libbogl-dev|\
        libbpf-dev|libbtrfs-dev|libbtrfsutil-dev|libc-ares-dev|libcdb-dev|\
        libcephfs-dev|libclutter-1.0-dev|libdebconfclient0-dev|\
        libdebian-installer4-dev|libdmraid-dev|libdrm-dev|libelf-dev|\
        libext2fs-dev|libfdt-dev|libfprint-2-tod-dev|libfuse3-dev|\
        libgdbm-compat-dev|libgf-complete-dev|libglib2.0-dev|libglusterfs-dev|\
        libxt-dev|libkrb5-dev|libwayland-dev|libxaw7-dev|libmhash-dev|\
        libkeyutils-dev|libwebkit2gtk-4.1-dev|libneon27-gnutls-dev|\
        libmpich-dev|libmotif-dev|libatlas-base-dev|tk8.6-dev|pidgin-dev|\
        libxcb-xkb-dev|libpipewire-0.3-dev|libosmocore-dev|liballegro4-dev|\
        proftpd-dev|libpurple-dev|libminizip-dev|x11proto-dev|libsnmp-dev|\
        apache2-dev|libxfont-dev|libwlroots-dev|libvarnishapi-dev|\
        libspandsp-dev|libsvn-dev|libnfs-dev|liblirc-dev|libwmf-dev|\
        xaw3dg-dev|xserver-xorg-dev|ppp-dev|libosmo-sigtran-dev|\
        libglobus-gass-transfer-dev|libgsoap-dev|libsepol-dev|libwcstools-dev|\
        cluster-glue-dev|libplumb2-dev|libosmo-sccp-dev|libc-client2007e-dev|\
        libtingea-dev|libsylph-dev|libsmi2-dev|libpils2-dev|rhythmbox-dev|\
        xmms2-dev|vflib3-dev|libstonith1-dev|moarvm-dev|liblasso3-dev|\
        libgnunet-dev|libhe5-hdfeos-dev|libosmo-ranap-dev|libgtkextra-dev|\
        libklibc-dev|\
        liblowdown-dev|\
        libcoarrays-dev|\
        r-base-core|\
        python3-lxml|\
        python3-numba|\
        tcllib)
            extra_args="-cxx-incompatible --lang=C"
            defines="$float_typedefs"
            ;;
        *)
            ;;
    esac

    # per-package quirks for missing -dev depends
    case $devpkg in
        apertium-lex-tools-dev)
            extra_deps="libirstlm-dev libxml2-dev"
            ;;
        bind9-dev)
            extra_deps="libuv1-dev libcmocka-dev liburcu-dev"
            ;;
        binutils-dev|libzzip-dev|libmsgpack-cxx-dev|\
        libmsgpack-dev|libcapnp-dev)
            extra_deps=zlib1g-dev
            ;;
        coinor-libosi-dev)
            extra_deps=coinor-libcoinutils-dev
            ;;
        fftw-dev|libptscotch-dev|libarpack2-dev|libhypre-dev|libsuperlu-dist-dev)
            includes="/usr/include/$multiarch/mpi/"
            extra_deps=mpi-default-dev
            ;;
        libabigail-dev)
            extra_deps="libdw-dev binutils-dev libxml2-dev"
            ;;
        libabsl-dev)
            extra_deps="libgtest-dev libgmock-dev"
            ;;
        libstonith1-dev*)
            extra_deps="libglib2.0-dev libpils2-dev cluster-glue-dev"
            ;;
        libavc1394-dev)
            extra_deps=libraw1394-dev
            ;;
        libblockdev-crypto-dev|libblockdev-dev)
            extra_deps=libblockdev-utils-dev
            ;;
        libblockdev-fs-dev)
            extra_deps="libblockdev-utils-dev libglib2.0-dev"
            ;;
        librandom123-dev)
            extra_deps=libgsl-dev
            ;;
        libblockdev-part-dev|libkeybinder-3.0-dev|libfprint-2-dev|\
        libmm-glib-dev|libical-dev|libudisks2-dev|libsunpinyin-dev|\
        cluster-glue-dev|liblqr-1-0-dev|libayatana-common-dev|libxmlb-dev|\
        libwhoopsie-dev|libwhoopsie-preferences-dev|libopenhpi-dev|\
        libgmenuharness-dev|libgarcon-1-dev|libsylph-dev)
            extra_deps=libglib2.0-dev
            ;;
        libkkc-dev)
            extra_deps="libglib2.0-dev libjson-glib-dev libgee-0.8-dev"
            ;;
        libcephfs-dev|firebird-dev|libmaeparser-dev|liblog4cplus-dev)
            extra_deps=libboost-dev
            ;;
        xmms2-dev)
            extra_deps=libglib2.0-dev
            preamble=glib.h
            ;;
        libcupsfilters-dev|libppd-dev)
            extra_deps=libcups2-dev
            ;;
        libdb5.3-stl-dev)
            extra_deps=libdb5.3++-dev
            ;;
        libdebconfclient0-dev)
            extra_deps="libgtk-3-dev libdebian-installer4-dev libnewt-dev"
            ;;
        libefiboot-dev)
            extra_deps=libefivar-dev
            ;;
        libfcitx5-qt-dev)
            extra_deps="qtbase5-private-dev libfcitx5utils-dev"
            ;;
        libfcitx5-qt6-dev)
            extra_deps="qt6-base-dev"
            ;;
        libglusterfs-dev)
            extra_deps="liburcu-dev libssl-dev uuid-dev"
            ;;
        libglx-dev|libgl2ps-dev)
            extra_deps=libgl-dev
            ;;
        libqt5svg5-dev|libkf5contacteditor-dev|libqt5waylandclient5-dev|\
        libquazip5-dev|libqtdbustest1-dev|libqhull-dev|qtquickcontrols2-5-dev|\
        libkf5holidays-dev|libgsettings-qt-dev|libphonon4qt5-dev|\
        libukui-log4qt-dev|libdframeworkdbus-dev|libkf5akonadiserver-dev|\
        libqt5xdg-dev|libfcitx-qt5-dev|libkf5kexiv2-dev|libkcolorpicker-dev|\
        libdtkcore-dev|libkimageannotator-dev|libkf5kdcraw-dev|\
        kscreenlocker-dev|qtpim5-dev|qtkeychain-qt5-dev|libudisks2-qt5-dev|\
        libusermetricsinput-dev|liblxqt-globalkeys1-dev|\
        liblxqt-globalkeys-ui1-dev|libkpublictransport-dev|\
        libsingleapplication-dev|libquotient-dev|libqtermwidget5-1-dev|\
        libqt5gamepad5-dev|libqmenumodel-dev|libmpris-qt5-dev|libmolequeue-dev|\
        libkpmcore-dev|libgwengui-qt5-dev|libgio-qt-dev)
            extra_deps=qtbase5-dev
            ;;
        libkf5config-dev|kirigami2-dev|libkf5iconthemes-dev|qt3d5-dev|\
        qcoro-qt5-dev|libqt5gstreamer-dev|libkreport3-dev)
            extra_deps=qtdeclarative5-dev
            ;;
        libpq-dev)
            extra_deps="$(apt-cache show libpq-dev | sed -n -e '/^Source: / s/.*: \(postgresql\)/\1-server-dev/ p' | head -n 1) libkrb5-dev"
            ;;
        qtbase5-private-dev*|qtbase5-private-gles-dev*)
            extra_deps="libicu-dev libdouble-conversion-dev"
            extra_deps="$extra_deps default-jdk-headless"
            extra_deps="$extra_deps libharfbuzz-dev libdrm-dev libatspi2.0-dev"
            extra_deps="$extra_deps libssl-dev libcups2-dev"
            extra_deps="$extra_deps libxcb-randr0-dev libxcb-xfixes0-dev"
            extra_deps="$extra_deps libxcb-xinerama0-dev libxcb-image0-dev"
            extra_deps="$extra_deps libxcb-keysyms1-dev libxcb-xkb-dev"
            extra_deps="$extra_deps libxkbcommon-x11-dev libxcb-sync-dev"
            case ${devpkg} in
                qtbase5-private-dev*)
                    extra_deps="${extra_deps} libqt5opengl5-dev"
                    ;;
                qtbase5-private-gles-dev*)
                    ;;
            esac
            ;;
        qt6-base-private-dev*)
            extra_deps="libicu-dev libdouble-conversion-dev libegl-dev"
            extra_deps="$extra_deps default-jdk-headless libgbm-dev"
            extra_deps="$extra_deps libharfbuzz-dev libdrm-dev libatspi2.0-dev"
            extra_deps="$extra_deps libssl-dev libqt6opengl6-dev libcups2-dev"
            extra_deps="$extra_deps libxcb-randr0-dev libxcb-xfixes0-dev"
            extra_deps="$extra_deps libxcb-xinerama0-dev libxcb-image0-dev"
            extra_deps="$extra_deps libxcb-keysyms1-dev libxcb-xkb-dev"
            extra_deps="$extra_deps libxkbcommon-x11-dev libxcb-sync-dev"
            ;;
        qtdeclarative5-private-dev)
            extra_deps="qtbase5-private-dev libkf5kjs-dev"
            ;;
        qt6-quick3d-dev)
            extra_deps="qt6-declarative-dev qt6-declarative-private-dev"
            ;;
        libavcodec-dev)
            extra_deps=libvdpau-dev
            ;;
        libbullet-dev)
            extra_deps=opencl-c-headers
            ;;
        libkf5templateparser-dev)
            extra_deps="qtbase5-dev libkf5config-dev libkf5mime-dev"
            extra_deps="$extra_deps libkf5i18n-dev libkf5pimtextedit-dev"
            ;;
        yorick-dev|libm17n-dev|libxshmfence-dev|libspnav-dev|libxnvctrl-dev)
            extra_deps=libx11-dev
            ;;
        libspdlog-dev)
            extra_deps="qtbase5-dev libsystemd-dev librdkafka-dev"
            ;;
        libgstreamer-plugins-bad1.0-dev)
            extra_deps="libva-dev libvulkan-dev libnice-dev"
            ;;
        libvtk9-dev)
            extra_deps="libmpich-dev default-jdk libvtk9-qt-dev libxml2-dev"
            ;;
        libkf5webengineviewer-dev)
            extra_deps=libkf5pimcommon-dev
            ;;
        libhdf5-openmpi-dev|libflann-dev)
            extra_deps="libopenmpi-dev libhdf5-dev"
            ;;
        libhwloc-dev)
            extra_deps="opencl-c-headers libibverbs-dev"
            ;;
        libiso9660++-dev)
             extra_deps=libiso9660-dev
             ;;
        libclxclient-dev)
            extra_deps=libclthreads-dev
            ;;
        libclang-*-dev*|libllvmspirvlib-*-dev)
            llvm_version="$(llvm_version_of_devpkg_no_virtual "${devpkg_no_virtual}")"
            extra_deps="llvm-${llvm_version}-dev"
            ;;
        libqwt-qt5-dev)
            extra_deps="qtbase5-dev libqt5opengl5-dev"
            ;;
        libterralib-dev)
            extra_deps=libgeotiff-dev
            ;;
        libpoppler-private-dev)
            extra_deps="libcairo2-dev libboost-dev"
            ;;
        libkf5mimetreeparser-dev)
            extra_deps="qtbase5-dev libgpgmepp-dev libgpg-error-dev"
            extra_deps="$extra_deps libkf5mime-dev"
            ;;
        libisl-dev|libntl-dev|libgivaro-dev|libppl-dev|libiml-dev)
            extra_deps=libgmp-dev
            ;;
        libsuitesparse-dev)
            extra_deps="libgmp-dev libmpfr-dev"
            ;;
        libphonon4qt5experimental-dev)
            extra_deps="qtbase5-dev libphonon4qt5-dev"
            ;;
        libindi-dev)
            extra_deps="libnova-dev libgsl-dev"
            ;;
        pybind11-dev)
            extra_deps="libpython3-dev libeigen3-dev"
            ;;
        libkf5plasma-dev)
            extra_deps="qtdeclarative5-dev libkf5declarative-dev"
            ;;
        libva-dev)
            extra_deps="mesa-common-dev libxfixes-dev"
            ;;
        libvulkan-dev)
            extra_deps="libdirectfb-dev libxcb1-dev libx11-dev libxrandr-dev"
            ;;
        libxerces-c-dev)
            extra_deps=libcurl4-openssl-dev
            ;;
        libosmocore-dev)
            extra_deps="libmnl-dev libusb-1.0-0-dev libtalloc-dev"
            ;;
        libkf5messagecomposer-dev)
            extra_deps="libkf5messagecore-dev libkf5messageviewer-dev libkf5libkdepim-dev libkf5akonadimime-dev"
            ;;
        libkf5prison-dev)
            extra_deps='qtmultimedia5-dev'
            ;;
        libkf5textaddons-dev)
            extra_deps='qtbase5-dev libkf5config-dev libkf5syntaxhighlighting-dev'
            ;;
        libgpgmepp-dev|libksba-dev)
            extra_deps=libgpg-error-dev
            ;;
        libassimp-dev)
            extra_deps=libpugixml-dev
            ;;
        wcslib-dev)
            extra_deps=libcfitsio-dev
            ;;
        libpurple-dev)
            extra_deps=libgstreamer1.0-dev
            ;;
        libtirpc-dev|libshibsp-dev|libkrad-dev)
            extra_deps=libkrb5-dev
            ;;
        python-dbus-dev|python-gi-dev|libdlib-dev)
            extra_deps=libpython3-dev
            ;;
        gnuradio-dev)
            extra_deps="qtbase5-dev libqwt-qt5-dev libsoapysdr-dev libuhd-dev"
            extra_deps="$extra_deps libcodec2-dev"
            ;;
        libwebsockets-dev)
            extra_deps=libdbus-1-dev
            ;;
        libkf5parts-dev)
            extra_deps=qt5-qmake
            ;;
        libkf5pimcommon-dev)
            extra_deps=libkf5libkdepim-dev
            ;;
        libobs-dev)
            extra_deps="libpulse-dev libavcodec-dev libcurl4-gnutls-dev"
            ;;
        libopenmpi-dev)
            extra_deps=default-jdk-headless
            ;;
        libkf5kdelibs4support-dev)
            extra_deps=libkf5newstuff-dev
            ;;
        fcitx5-module-lua-dev)
            extra_deps="libfcitx5config-dev libfcitx5utils-dev libfcitx5core-dev"
            ;;
        fcitx5-module-pinyinhelper-dev|fcitx5-module-punctuation-dev)
            extra_deps="libfcitx5core-dev"
            ;;
        fcitx-kkc-dev)
            extra_deps="fcitx-libs-dev libkkc-dev"
            ;;
        fcitx-libs-dev)
            extra_deps="libcairo2-dev libdbus-1-dev"
            ;;
        libhiredis-dev)
            extra_deps="libivykis-dev libev-dev libevent-dev libuv1-dev"
            extra_deps="$extra_deps qtbase5-dev libglib2.0-dev"
            ;;
        libavutil-dev)
            extra_deps="opencl-c-headers libva-dev libvdpau-dev libvulkan-dev"
            ;;
        libwxgtk3.2-dev|libgtk-layer-shell-dev|libreofficekit-dev)
            extra_deps=libgtk-3-dev
            ;;
        qt6-base-dev)
            extra_deps="khronos-api libgles-dev"
            ;;
        libvarnishapi-dev)
            extra_deps=libpcre2-dev
            ;;
        libuhd-dev)
            extra_deps="libboost-dev libflatbuffers-dev pybind11-dev"
            extra_deps="$extra_deps libpython3-dev"
            ;;
        libyaz-dev|lttoolbox-dev|libgwenhywfar-core-dev)
            extra_deps=libxml2-dev
            ;;
        tao-pegtl-dev|libphonenumber-dev|libsword-dev)
            extra_deps=libicu-dev
            ;;
        libplist++-dev)
             extra_deps=libplist-dev
            ;;
        libtclcl1-dev)
            extra_deps="tcl8.6-dev libotcl1-dev"
            ;;
        libflint-dev)
            extra_deps=libntl-dev
            ;;
        fcitx5-modules-dev)
            extra_deps="libwayland-dev libxcb1-dev libxcb-ewmh-dev"
            ;;
        waylandpp-dev)
            extra_deps="libegl-dev libwayland-dev"
            ;;
        xtrans-dev)
            extra_deps=x11proto-dev
            ;;
        libkf5ldap-dev|libkf5cddb-dev)
            extra_deps=libkf5config-dev
            ;;
        libfltk1.1-dev)
            extra_deps="libgl-dev libglu1-mesa-dev"
            ;;
        libdtkgui-dev)
            extra_deps="libdtkcore-dev qtbase5-dev"
            ;;
        libsuil-dev)
            extra_deps=lv2-dev
            ;;
        libspandsp-dev|libcsound64-dev)
            extra_deps=libsndfile1-dev
            ;;
        libresid-builder-dev|libsidutils-dev)
            extra_deps=libsidplay2-dev
            ;;
        libktp-dev)
            extra_deps=libkf5kcmutils-dev
            ;;
        libpwizlite-dev)
            extra_deps="libboost-dev libpwiz-dev"
            ;;
        libsvn-dev)
            extra_deps=apache2-dev
            ;;
        libpoco-dev)
            extra_deps="unixodbc-dev libpq-dev"
            ;;
        libopenbabel-dev)
            extra_deps="libeigen3-dev libcairo2-dev libinchi-dev rapidjson-dev"
            extra_deps="$extra_deps libxml2-dev"
            ;;
        libfm-qt-dev|libqt5xdgiconloader-dev)
            extra_deps=qtbase5-private-dev
            ;;
        libfm-dev)
            extra_deps='libgtk2.0-dev'
            ;;
        libosmo-abis-dev|osmo-libasn1c-dev|libosmo-mgcp-client-dev)
            extra_deps=libosmocore-dev
            ;;
        libvlccore-dev)
            extra_deps="libgcrypt20-dev libx11-dev"
            ;;
        libkf5messageviewer-dev)
            extra_deps="libkf5mimetreeparser-dev libkf5config-dev"
            extra_deps="$extra_deps libkf5mime-dev libkf5akonadi-dev"
            extra_deps="$extra_deps libkf5akonadimime-dev libkf5pimcommon-dev"
            extra_deps="$extra_deps libkf5webengineviewer-dev libgpgmepp-dev"
            extra_deps="$extra_deps libgpg-error-dev"
            ;;
        libaudio-dev)
            extra_deps=libxt-dev
            ;;
        python3-cairo-dev)
            extra_deps="libpython3-dev libcairo2-dev"
            ;;
        libaccounts-qt5-dev)
            extra_deps="qtbase5-dev libaccounts-glib-dev"
            ;;
        qtlocation5-dev)
            extra_deps=qtpositioning5-dev
            ;;
        libqtdbusmock1-dev)
            extra_deps="libqtdbustest1-dev qtbase5-dev"
            ;;
        libticcutils-dev)
            extra_deps="libtar-dev libicu-dev libxml2-dev libbz2-dev zlib1g-dev"
            ;;
        liblog4cpp5-dev*)
            extra_deps="libboost-dev libomnithread4-dev libomniorb4-dev"
            ;;
        llvm-1?-dev*)
            extra_deps="googletest"
            ;;
        liblomiri-api-dev)
            extra_deps="qtbase5-dev qtdeclarative5-dev qtbase5-private-dev"
            defines="#define QT_NO_SIGNALS_SLOTS_KEYWORDS"
            ;;
        liblomiri-connectivity-qt1-dev)
            extra_deps="liblomiri-api-dev qtbase5-dev qtdeclarative5-dev qtbase5-private-dev"
            ;;
        liblomirigestures5-private-dev)
            extra_deps="qtbase5-dev qtdeclarative5-dev qtdeclarative5-private-dev qtbase5-private-dev qtdeclarative5-private-dev"
            ;;
        liblomirimetrics5-private-dev)
            extra_deps="qtbase5-dev qtdeclarative5-dev qtbase5-private-dev liblttng-ust-dev"
            ;;
        liblomiritoolkit5-private-dev)
            extra_deps="qtdeclarative5-private-dev qtpim5-dev qtbase5-private-dev liblomirigestures-dev"
            ;;
        liblomiri*-dev)
            extra_deps="qtbase5-dev qtdeclarative5-dev qtbase5-private-dev"
            ;;
        libnode-dev)
            extra_deps="libgtest-dev libc-ares-dev"
            ;;
        libocct-data-exchange-dev)
            extra_deps="rapidjson-dev libfl-dev"
            ;;
        libkf5messagelist-dev)
            extra_deps="libkf5akonadi-dev libkf5akonadimime-dev"
            ;;
        libkf5messagecore-dev)
            extra_deps="libkf5mime-dev libkf5coreaddons-dev libgpgmepp-dev"
            extra_deps="$extra_deps libgpg-error-dev libkf5mimetreeparser-dev"
            extra_deps="$extra_deps libkf5configwidgets-dev"
            extra_deps="$extra_deps libkf5identitymanagement-dev"
            ;;
        libkf5eventviews-dev)
            extra_deps=libkf5holidays-dev
            ;;
        libopenimageio-dev)
            extra_deps=libtiff-dev
            ;;
        libopencolorio-dev)
            extra_deps=libopenimageio-dev
            ;;
        libogre-1.12-dev*|libogre-1.9-dev*)
            extra_deps="qtbase5-dev libboost-dev libpoco-dev libimgui-dev"
            extra_deps="$extra_deps libglu1-mesa-dev libpoco-dev"
            ;;
        libocct-ocaf-dev|libocct-foundation-dev)
            extra_deps=libocct-visualization-dev
            ;;
        libocct-modeling-algorithms-dev)
            extra_deps="libocct-modeling-data-dev libocct-visualization-dev"
            ;;
        libcodec2-dev)
            extra_deps=libkissfft-dev
            ;;
        libdart-dev)
            extra_deps="libdart-external-ikfast-dev"
            ;;
        libgavl-dev)
            extra_deps="libegl-dev libva-dev"
            ;;
        libgutenprintui2-dev)
            extra_deps="libgtk2.0-dev libgutenprint-dev"
            ;;
        liblunar-calendar-dev)
            extra_deps="libglib2.0-dev libgtk-3-dev"
            ;;
        liblunar-date-dev)
            extra_deps="libglib2.0-dev"
            ;;
        libmatedict-dev)
            extra_deps="libglib2.0-dev libgtk-3-dev"
            ;;
        libmate-slab-dev)
            extra_deps="libglib2.0-dev libgtk-3-dev libmate-menu-dev libmate-desktop-dev"
            ;;
        libmate-window-settings-dev)
            extra_deps="libglib2.0-dev libmate-desktop-dev"
            ;;
        libmate-sensors-applet-plugin-dev)
            extra_deps="libsensors-applet-plugin-dev"
            ;;
        libmeep-dev|libmeep-*-dev)
            extra_deps="libctl-dev mpb-dev"
            ;;
        libmirplatform-dev)
            extra_deps="mir-renderer-gl-dev libglm-dev libegl-dev libgles-dev"
            ;;
        libmirrenderer-dev)
            extra_deps="libglm-dev"
            ;;
        libmirwayland-dev)
            extra_deps="libboost1.81-dev"
            ;;
        libmrpt-gui-dev)
            extra_deps="$extra_deps wx3.2-headers libwxgtk3.2-dev qtbase5-dev"
            ;;
        libmrpt-nanogui-dev)
            extra_deps="$extra_deps pybind11-dev libpython3.11-dev"
            ;;
        libmrpt-ros1bridge-dev)
            extra_deps="$extra_deps libnav-msgs-dev"
            ;;
        libmrpt-opengl-dev)
            extra_deps="$extra_deps libglut-dev"
            ;;
        libnetplan-dev)
            extra_deps="libglib2.0-dev"
            ;;
        liboce-foundation-dev)
            extra_deps="liboce-modeling-dev liboce-visualization-dev"
            ;;
        liboce-visualization-dev)
            extra_deps="liboce-ocaf-dev"
            ;;
        libodb-boost-dev)
            extra_deps="libboost1.81-dev"
            ;;
        libodb-mysql-dev)
            extra_deps="libmysqlclient-dev"
            ;;
        libodb-pgsql-dev)
            extra_deps="libpq-dev"
            ;;
        libodb-qt-dev)
            extra_deps="qtbase5-dev"
            ;;
        libodb-sqlite-dev)
            extra_deps="libsqlite3-dev"
            ;;
        libosmium2-dev)
            extra_deps="libgdal-dev libgeos++-dev"
            ;;
        libocct-visualization-dev)
            extra_deps=libocct-draw-dev
            ;;
        libimgui-dev)
            extra_deps="directx-headers-dev libvulkan-dev"
            ;;
        xtl-dev)
            extra_deps=nlohmann-json3-dev
            ;;
        qt6-svg-dev)
            extra_deps=qt6-base-dev
            ;;
        libplib-dev)
            extra_deps="libfltk1.3-dev libsdl1.2-dev"
            ;;
        librbd-dev)
            extra_deps=libradospp-dev
            ;;
        libpodofo-dev)
            extra_deps="libjpeg-dev libtiff-dev libfontconfig-dev"
            ;;
        libplplot-dev)
            extra_deps="qtbase5-dev libqt5svg5-dev"
            ;;
        libmlt++-dev)
            extra_deps=libmlt-dev
            ;;
        libsquashfuse-dev)
            extra_deps=libfuse3-dev
             ;;
        libmlir-1?-dev*)
            llvm_version="$(llvm_version_of_devpkg_no_virtual ${devpkg_no_virtual})"
            extra_deps="llvm-${llvm_version}-dev pybind11-dev libpython3-dev"
            ;;
        libmapnik-dev*)
            extra_deps=libpolyclipping-dev
            ;;
        libzephyr-dev)
            extra_deps=comerr-dev
            ;;
        libwpd-dev|libqxp-dev)
            extra_deps=librevenge-dev
            ;;
        libtimbl-dev)
            extra_deps="libticcutils-dev libxml2-dev"
            preamble=timbl/TimblAPI.h
            ;;
        rapmap-dev)
            extra_deps="libcereal-dev libspdlog-dev libwf-config-dev libxxhash-dev"
            ;;
        yosys-dev)
            defines="#define _YOSYS_ 1"
            ;;
        qt6-speech-dev)
            extra_deps="qt6-declarative-dev"
            ;;
        qt6-quicktimeline-dev)
            extra_deps="qt6-base-dev qt6-declarative-dev qt6-base-private-dev qt6-declarative-private-dev"
            ;;
        python3-talloc-dev)
            extra_deps="libpython3-dev libtalloc-dev"
            ;;
        python-greenlet-dev)
            extra_deps="libpython3-dev"
            ;;
        py3c-dev)
            preamble="Python.h"
            ;;
        pluma-dev)
            extra_deps="libglib2.0-dev libgtk-3-dev libgtksourceview-4-dev"
            ;;
        nordugrid-arc-dev)
            extra_deps="libdb5.3++-dev libsqlite3-dev libxmlsec1-dev"
            defines="#define XMLSEC_CRYPTO_NSS 1"
            ;;
        festival-dev)
            extra_deps="libestools-dev"
            preamble="speech_tools/siod.h"
            ;;
        ctn-dev)
            extra_deps="libmotif-dev"
            preamble="dicom.h
condition.h
ctn_os.h
lst.h
dicom_objects.h
dulprotocol.h
hisdb.h
manage.h
mut.h
tbl.h
tbl_sqlserver.h"
            defines="#define SYBASE 1
#define Widget int
#define DBINT int
#define DBPROCESS int"
            ;;
        bitlbee-dev)
            extra_deps="libglib2.0-dev libotr5-dev"
            preamble="glib.h
bitlbee.h"
            exclude_types="global"
            ;;
        libjellyfish-2.0-dev)
            extra_deps=libhts-dev
            ;;
        libimath-dev)
            extra_deps="libgl-dev libglu1-mesa-dev libpython3-dev libboost-dev"
            ;;
        libdirectfb-dev)
            extra_deps="libgbm-dev libdrm-dev"
            ;;
        libaudclient-dev)
            extra_deps=libdbus-glib-1-dev
            ;;
        libgdcm-dev|libcjose-dev)
            extra_deps=libssl-dev
            ;;
        qtwayland5-private-dev)
            extra_deps="libwayland-dev qtbase5-private-dev"
            extra_deps="$extra_deps qtdeclarative5-private-dev"
            ;;
        libtelepathy-logger-dev)
            extra_deps=libtelepathy-glib-dev
            ;;
        libkf5dav-dev)
            extra_deps="qtbase5-dev libkf5coreaddons-dev"
            ;;
        libkf5pulseaudioqt-dev)
            extra_deps="qtbase5-dev libpulse-dev"
            ;;
        libkf5baloowidgets-dev)
            extra_deps="qtbase5-dev"
            ;;
        libkf5konq-dev)
            extra_deps="qtbase5-dev qt5-qmake libkf5parts-dev"
            ;;
        libkf5kipi-dev)
            extra_deps="qtbase5-dev libkf5xmlgui-dev libkf5service-dev"
            ;;
        libimecore-dev)
            extra_deps="libfcitx5utils-dev libboost-dev"
            ;;
        libguichan-dev)
            extra_deps=liballeggl4-dev
            ;;
        libboost1.*-dev*)
            extra_deps="libssl-dev opencl-c-headers libpng-dev libeigen3-dev"
            extra_deps="$extra_deps libraw-dev libtiff-dev libopenmpi-dev"
            extra_deps="$extra_deps libicu-dev libpython3.11-dev"
            extra_deps="$extra_deps libmpfi-dev-common libtommath-dev"
            extra_deps="$extra_deps libclblas-dev libgmp-dev libmpfr-dev"
            extra_deps="$extra_deps libmpc-dev libgl-dev libfftw3-dev"
            extra_deps="$extra_deps libopencv-core-dev libopencv-highgui-dev"
            includes="/usr/include/c++/${gcc_major}/ext"
            ;;
        libniftiio-dev*)
            extra_deps=libnifti2-dev
            ;;
        libdynamic-reconfigure-config-init-mutex-dev)
            extra_deps=libroscpp-dev
            ;;
        libbotan-2-dev)
            extra_deps=libtspi-dev
            ;;
        unity-settings-daemon-dev)
            extra_deps="libgtk-3-dev gsettings-desktop-schemas-dev"
            extra_deps="$extra_deps libgnome-desktop-3-dev"
            ;;
        libgvm-dev)
            extra_deps=libpaho-mqtt-dev
            ;;
        libgenometools0-dev)
            extra_deps="libcairo2-dev libbz2-dev"
            ;;
        libceres-dev)
            extra_deps=libgmock-dev
            ;;
        libmedc-dev|libscotchparmetis-dev=*|sfftw-dev)
            extra_deps=libopenmpi-dev
            ;;
        libmediastreamer-dev)
            extra_deps="openjdk-17-jdk-headless libegl-dev libglew-dev libgles-dev"
            includes="/usr/lib/jvm/java-17-openjdk-$dpkg_arch/include/"
            ;;
        etl-dev)
            extra_deps="libglibmm-2.4-dev"
            preamble="ETL/_surface.h"
            ;;
        liboop-dev)
            extra_deps="libadns1-dev libglib2.0-dev"
            preamble="oop.h
adns.h
glib.h"
            ;;
        eglexternalplatform-dev)
            extra_deps="libegl-dev"
            ;;
        librime-dev)
            extra_deps="libboost-dev libgoogle-glog-dev darts libmarisa-dev x11proto-dev"
            ;;
        libplumb2-dev)
            extra_deps="libglib2.0-dev cluster-glue-dev libgnutls28-dev"
            ;;
        libvtkgdcm-dev)
            extra_deps=libvtk9-dev
            ;;
        libvirt-glib-1.0-dev)
            extra_deps="libglib2.0-dev libxml2-dev"
            ;;
        libvigraimpex-dev)
            extra_deps="libfftw3-dev libpython3-dev python3-numpy libboost-python-dev"
            ;;
        libzita-alsa-pcmi-dev)
            extra_deps=libasound2-dev
            ;;
        qt6-shadertools-dev)
            extra_deps="qt6-base-dev qt6-base-private-dev"
            ;;
        libotcl1-dev)
            extra_deps="tcl8.6-dev"
            ;;
        tcl-snack-dev)
            extra_deps="tcl8.6-dev"
            preamble="tcl.h"
            ;;
        svdrpservice-dev)
            extra_deps="vdr-dev"
            ;;
        tkblt-dev)
            extra_deps="tcl8.6-dev"
            preamble="tkbltVector.h"
            ;;
        libpetsc64-real3.18-*|libpetsc-real3.18-*|libpetsc64-complex3.18-*|\
        libpetsc-complex3.18-*)
            extra_deps="libhypre-dev libviennacl-dev libopenmpi-dev"
            ;;
        libvmdk-dev)
            extra_deps=libbfio-dev
            ;;
        libverto-dev)
            extra_deps="libevent-dev libglib2.0-dev libev-dev"
            ;;
        libvalapanel-dev)
            extra_deps="libglib2.0-dev libgtk-3-dev"
            ;;
        gemmi-dev)
            extra_deps="tao-pegtl-dev libstb-dev zlib1g-dev libmmdb2-dev"
            ;;
        android-libziparchive-dev)
            extra_deps=android-libbase-dev
            ;;
        eog-dev)
            extra_deps=libexif-dev
            ;;
        libpanel-dev)
            extra_deps=libadwaita-1-dev
            includes=/usr/include/libadwaita-1
            ;;
        libedataserverui1.2-dev)
            extra_deps=libedataserverui4-dev
            includes=/usr/include/evolution-data-server
            ;;
        libapache2-mod-perl2-dev)
            extra_deps="apache2-dev libperl-dev"
            ;;
        libagg2-dev)
            extra_deps="libfreetype-dev"
            ;;
        libags-dev)
            extra_deps="libglib2.0-dev libxml2-dev libsoup-3.0-dev"
            ;;
        libags-audio-dev)
            extra_deps="libglib2.0-dev libxml2-dev libsoup-3.0-dev libasound2-dev ladspa-sdk libinstpatch-dev dssi-dev lv2-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libjson-glib-dev libpulse-dev libjack-jackd2-dev libfftw3-dev"
            ;;
        libags-gui-dev)
            extra_deps="libglib2.0-dev libcairo2-dev libgtk-4-dev"
            ;;
        liballeggl4-dev)
            extra_deps="libgl-dev"
            ;;
        libapogee-dev)
            extra_deps="libcurl4-openssl-dev"
            ;;
        libopencv-core-dev)
            extra_deps="nvidia-cuda-dev"
            ;;
        libopencv-flann-dev)
            extra_deps="libflann-dev"
            ;;
        libopencv-viz-dev)
            extra_deps="libvtk9-dev"
            ;;
        libosmo-sabp-dev|libosmo-rua-dev|libosmo-hnbap-dev)
            extra_deps="osmo-libasn1c-dev libosmocore-dev"
            ;;
        libpamtest0-dev)
            extra_deps="libpam0g-dev"
            ;;
        libpcp-trace2-dev)
            extra_deps="libpcp3-dev"
            ;;
        libplacebo-dev)
            extra_deps="libdav1d-dev libavformat-dev"
            ;;
        libpappsomspp-dev)
            extra_deps="qt6-base-dev libpwizlite-dev libosmocore-dev libboost1.81-dev"
            ;;
        libpappsomspp-widget-dev)
            extra_deps="qt6-base-dev libqcustomplot-dev"
            ;;
        libtracefs-dev)
            extra_deps=libtraceevent-dev
            ;;
        libtogl-dev)
            extra_deps="tcl8.6-dev tk8.6-dev libgl-dev"
            ;;
        libt4k-common0-dev)
            extra_deps=libsdl-mixer1.2-dev
            ;;
        libtimblserver-dev)
            extra_deps="libtimbl-dev libticcutils-dev libxml2-dev"
            preamble=ticcutils/ServerBase.h
            ;;
        librttopo-dev)
            extra_deps=libgeos-dev
            ;;
        librocksdb-dev)
            extra_deps=liblua5.4-dev
            ;;
        libshrinkwrap-dev)
            extra_deps="liblzma-dev libzstd-dev zlib1g-dev"
            ;;
        libsoci-dev)
            extra_deps="default-libmysqlclient-dev libboost-dev libpq-dev"
            extra_deps="$extra_deps libsqlite3-dev firebird-dev unixodbc-dev"
            ;;
        libraft-dev)
            extra_deps=libuv1-dev
            ;;
        libpolly-1?-dev)
            llvm_version="$(llvm_version_of_devpkg_no_virtual "${devpkg_no_virtual}")"
            extra_deps="llvm-${llvm_version}-dev libgmp-dev"
            ;;
        libpils2-dev)
            extra_deps="cluster-glue-dev libglib2.0-dev"
            ;;
        libotf-dev)
            extra_deps=libfreetype-dev
            ;;
        libnids-dev)
            extra_deps=libpcap0.8-dev
            ;;
        libnodelet-topic-tools-dev)
            extra_deps="libroscpp-dev libnodeletlib-dev libmessage-filters-dev"
            ;;
        libocct-draw-dev)
            extra_deps="libocct-foundation-dev libocct-modeling-algorithms-dev"
            extra_deps="$extra_deps libocct-modeling-data-dev libocct-ocaf-dev"
            extra_deps="$extra_deps libocct-visualization-dev libocct-data-exchange-dev"
            ;;
        libmiroil-dev)
            extra_deps="libmircore-dev libmiral-dev libmirplatform-dev libmirserver-dev"
            ;;
        libmbt-dev)
            extra_deps="libticcutils-dev libtimbl-dev libxml2-dev"
            ;;
        libnauty2-dev)
            extra_deps=libcliquer-dev
            ;;
        libmathic-dev)
            extra_deps=libmemtailor-dev
            ;;
        libldacbt-abr-dev)
            extra_deps=libldacbt-enc-dev
            ;;
        libhmmer2-dev)
            extra_deps=libsquid-dev
            ;;
        libglewmx-dev)
            extra_deps=libglu1-mesa-dev
            ;;
        libm4rie-dev)
            extra_deps=libm4ri-dev
            ;;
        libhx-dev)
            extra_deps="libfcitx5utils-dev libxml2-dev"
            ;;
        libgrpc++-dev)
            extra_deps="libprotobuf-dev libgmock-dev"
            ;;
        libglvnd-core-dev)
            extra_deps="libgl-dev libegl-dev"
            ;;
        libkmfl-dev)
            extra_deps=libkmflcomp-dev
            ;;
        libtotem-dev)
            extra_deps=libpeas-dev
            includes=/usr/include/libpeas-1.0
            ;;
        rhythmbox-dev)
            extra_deps="libgstreamer-plugins-base1.0-dev libtdb-dev libpeas-dev"
            ;;
        libtext-engine-dev)
            extra_deps="libgraphene-1.0-dev libgtk-4-dev libpango1.0-dev"
            ;;
        android-libbase-dev)
            extra_deps='libfmt-dev libgmock-dev'
            ;;
        libasyncaudio-dev)
            extra_deps="libsigc++-2.0-dev libasynccore-dev"
            ;;
        libasynccore-dev)
            extra_deps="libsigc++-2.0-dev"
            ;;
        libcontent-hub-dev)
            extra_deps=qtbase5-dev
            ;;
        libcontent-hub-glib-dev)
            extra_deps=libglib2.0-dev
            ;;
        libcpdb-dev|libcpdb-frontend-dev)
            extra_deps=libglib2.0-dev
            ;;
        libdiagnostics-dev)
            extra_deps=libace-dev
            ;;
        libdiagnostic-aggregator-dev)
            extra_deps="libbondcpp-dev libace-dev"
            ;;
        libdmr-dev)
            extra_deps="qtbase5-dev libdtkwidget-dev libffmpegthumbnailer-dev"
            ;;
        libdmrconf-dev)
            extra_deps="qtbase5-dev qtpositioning5-dev libyaml-cpp-dev libqt5serialport5-dev libusb-1.0-0-dev"
            ;;
        libgwengui-fox16-dev)
            extra_deps=libfox-1.6-dev
            ;;
        libgwengui-gtk3-dev)
            extra_deps=libgtk-3-dev
            ;;
        libfungw-dev)
            extra_deps=libgenht1-dev
            ;;
        pd-flext-dev)
            extra_deps="libstk-dev libsndobj-dev"
            ;;
        libfp16-dev)
            extra_deps=libpsimd-dev
            ;;
        libfolia-dev)
            extra_deps="libticcutils-dev libicu-dev libxml2-dev"
            ;;
        libfcitx5gclient-dev)
            extra_deps=libglib2.0-dev
            ;;
        libfcitx5config-dev)
            extra_deps=libfcitx5utils-dev
            ;;
        fcitx5-module-cloudpinyin-dev)
            extra_deps="libfcitx5utils-dev libfcitx5core-dev"
            ;;
        libdrumstick-dev)
            extra_deps="qtbase5-dev libasound2-dev"
            preamble=drumstick.h
            ;;
        libdraco-dev)
            extra_deps="libeigen3-dev libtinygltf-dev"
            ;;
        libdbusextended-qt5-dev)
            extra_deps=qtbase5-dev
            ;;
        libvisp-detection-dev)
            extra_deps=libvisp-vision-dev
            ;;
        libldm-dev)
            extra_deps=libglib2.0-dev
            ;;
        libwf-config-dev)
            extra_deps="libglm-dev libxml2-dev"
            ;;
        libwf-touch-dev)
            extra_deps="libglm-dev"
            ;;
        libxbae-dev)
            extra_deps=libmotif-dev
            ;;
        libxcomp-dev)
            extra_deps=x11proto-dev
            ;;
        libxdelta2-dev)
            extra_deps=libglib2.0-dev
            ;;
        libxgboost-dev)
            extra_deps=libdmlc-dev
            ;;
        libxir-dev)
            extra_deps=libunilog-dev
            ;;
        libxmhtml-dev)
            extra_deps=libxmu-headers
            ;;
        libxmlbird-dev)
            extra_deps=libglib2.0-dev
            ;;
        libxnee-dev)
            extra_deps="x11proto-dev libx11-dev libxtst-dev"
            ;;
        libxneur-dev)
            extra_deps=libx11-dev
            ;;
        libxnnpack-dev)
            extra_deps=libpthreadpool-dev
            ;;
        libxxsds-dynamic-dev)
            extra_deps=libtsl-hopscotch-map-dev
            ;;
        libxy-dev)
            extra_deps=libboost1.81-dev
            ;;
        signon-plugin-oauth2-dev)
            extra_deps=signon-plugins-dev
            ;;
        signon-plugin-sasl-dev)
            extra_deps=libsignon-qt5-dev
            ;;
        tcl-memchan-dev)
            extra_deps=tcl8.6-dev
            ;;
        xpaint-dev)
            extra_deps=xaw3dg-dev
            ;;
        389-ds-base-dev)
            extra_deps="libnss3-dev"
            ;;
        android-libandroidfw-dev)
            extra_deps="zlib1g-dev"
            ;;
        android-libsepol-dev)
            extra_deps="libsepol-dev"
            ;;
        argagg-dev)
            extra_deps="libopencv-core-dev libopencv-calib3d-dev libopencv-dnn-dev libopencv-objdetect-dev libopencv-photo-dev libopencv-stitching-dev libopencv-video-dev"
            ;;
        asterisk-dev)
            extra_deps="uuid-dev unixodbc-dev"
            ;;
        cairo-dock-dev)
            extra_deps="libgl-dev libglu1-mesa-dev libglib2.0-dev libgtk-3-dev librsvg2-dev libxml2-dev libdbus-glib-1-dev"
            ;;
        cauchy-dev)
            extra_deps="libeigen3-dev"
            ;;
        codeblocks-dev)
            extra_deps="wx3.2-headers libwxgtk3.2-dev libtinyxml-dev"
            ;;
        coop-computing-tools-dev)
            extra_deps="libsqlite3-dev"
            ;;
        eom-dev)
            extra_deps="libglib2.0-dev libpeas-dev libexif-dev"
            ;;
        evolution-dev)
            extra_deps="libebook1.2-dev"
            ;;
        finch-dev)
            extra_deps="libncurses-dev"
            ;;
        gammaray-dev)
            extra_deps="qtbase5-dev"
            ;;
        gpsim-dev)
            extra_deps="libglib2.0-dev"
            ;;
        gss-ntlmssp-dev)
            extra_deps="libkrb5-dev"
            ;;
        gthumb-dev)
            extra_deps="libglib2.0-dev libgtk-3-dev"
            ;;
        ibus-anthy-dev)
            extra_deps="libglib2.0-dev libanthy-dev"
            ;;
        inventor-dev)
            extra_deps="libglu1-mesa-dev libxi-dev"
            ;;
        irssi-dev)
            extra_deps="libglib2.0-dev libssl-dev"
            ;;
        juff-dev)
            extra_deps="qtbase5-dev"
            ;;
        kdevelop-dev)
            extra_deps="libboost1.81-dev"
            ;;
        kea-dev)
            extra_deps="libboost1.81-dev libssl-dev"
            ;;
        kio-audiocd-dev)
            extra_deps="libkf5kio-dev"
            ;;
        lib2geom-dev)
            extra_deps="libboost1.81-dev libgsl-dev"
            ;;
        lib4ti2-dev)
            extra_deps="libgmp-dev"
            ;;
        libace-tkreactor-dev)
            includes="/usr/include/tcl8.6"
            ;;
        libadwaitaqt-dev)
            extra_deps="qtbase5-dev"
            ;;
        libagg-dev)
            extra_deps="libfreetype-dev"
            ;;
        libalpm-dev)
            extra_deps="libarchive-dev"
            ;;
        libamgcl-dev)
            extra_deps="libboost1.81-dev libeigen3-dev"
            ;;
        libaosd-dev)
            extra_deps="libx11-dev libcairo2-dev libpango1.0-dev"
            ;;
        libapophenia2-dev)
            extra_deps="libgsl-dev"
            ;;
        libapreq2-dev)
            extra_deps="libaprutil1-dev"
            ;;
        libapr-memcache-dev)
            extra_deps="libapr1-dev libaprutil1-dev"
            ;;
        libasl-dev)
            extra_deps="libarm-compute-dev libboost1.81-dev libvtk9-dev"
            ;;
        libast2-dev)
            extra_deps="libxt-dev"
            ;;
        libastrometry-dev)
            extra_deps="libcairo2-dev libgsl-dev"
            ;;
        libatrildocument-dev)
            extra_deps="libglib2.0-dev libgtk-3-dev"
            ;;
        libatrilview-dev)
            extra_deps="libglib2.0-dev libgtk-3-dev libatrildocument-dev"
            ;;
        libavkys-dev)
            extra_deps="qtbase5-dev"
            ;;
        libbde-dev)
            extra_deps="libbfio-dev"
            ;;
        libbiometric-dev)
            extra_deps="libglib2.0-dev libusb-1.0-0-dev libsqlite3-dev libfprint-2-dev"
            ;;
        libbiometry-dev)
            extra_deps="libboost1.81-dev"
            ;;
        libboinc-app-dev)
            extra_deps="libgl-dev libglu1-mesa-dev libglut-dev"
            ;;
        libbullet-extras-dev)
            extra_deps="libbullet-dev"
            ;;
        libcalcium-dev)
            extra_deps="libgmp-dev libmpfr-dev libflint-dev libantic-dev libflint-arb-dev"
            ;;
        libcamp-dev)
            extra_deps="libboost1.81-dev"
            ;;
        libcanl-c-dev)
            extra_deps="libssl-dev"
            ;;
        libcantor-dev)
            extra_deps="qtbase5-dev"
            ;;
        libcassie-dev)
            extra_deps="libboost1.81-dev"
            ;;
        libchafa-dev)
            extra_deps="libglib2.0-dev"
            ;;
        libchipcard-dev)
            extra_deps="libgwenhywfar-core-dev"
            ;;
        libchise-dev)
            extra_deps="libdb5.3-dev"
            ;;
        libcif-dev)
            extra_deps="libicu-dev"
            ;;
        libcitygml-dev)
            extra_deps="libglu1-mesa-dev"
            ;;
        libclanlib-dev)
            extra_deps="x11proto-dev libx11-dev libgl-dev libglu1-mesa-dev"
            ;;
        libclaw-tween-dev)
            extra_deps="libboost1.81-dev"
            ;;
        libcleri-dev)
            extra_deps="libpcre2-dev"
            ;;
        libclsync-dev)
            extra_deps="libglib2.0-dev libcodcif-dev libcexceptions-dev"
            ;;
        libcmor-dev)
            extra_deps="libnetcdf-dev libudunits2-dev"
            ;;
        libcneartree-dev)
            extra_deps="libcvector-dev"
            ;;
        libcoap3-dev)
            extra_deps="uthash-dev"
            ;;
        libcodcif-dev)
            extra_deps="libcexceptions-dev"
            ;;
        libcollectdclient-dev)
            extra_deps="collectd-dev"
            ;;
        libcomedi-dev)
            extra_deps="libboost1.81-dev"
            ;;
        libcommuni-dev)
            extra_deps="qtbase5-dev"
            ;;
        libcomps-dev)
            extra_deps="libxml2-dev"
            ;;
        libcorkipset-dev)
            extra_deps="libcork-dev"
            ;;
        libcotp-dev)
            extra_deps="libgcrypt20-dev"
            ;;
        libcppad-dev)
            extra_deps="libeigen3-dev libadolc-dev"
            ;;
        libcpp-hocon-dev)
            extra_deps="libboost1.81-dev libleatherman-dev"
            ;;
        libcppunit-subunit-dev)
            extra_deps="libcppunit-dev"
            ;;
        libcreg-dev)
            extra_deps="libbfio-dev"
            ;;
        libcvc4-dev)
            extra_deps="libcln-dev"
            ;;
        libcvm1-dev)
            extra_deps="libbg-dev"
            ;;
        libdbus-c++-dev)
            extra_deps="libefl-all-dev"
            ;;
        libddccontrol-dev)
            extra_deps="libxml2-dev"
            ;;
        libdde-network-utils-dev)
            extra_deps="qtbase5-dev libdframeworkdbus-dev"
            ;;
        libdd-opentracing-dev)
            extra_deps="libopentracing-dev"
            ;;
        libdislocker0-dev)
            extra_deps="libmbedtls-dev"
            ;;
        libdolfinx-mpc-dev)
            extra_deps="libdolfinx-dev"
            ;;
        libdyssol-dev)
            extra_deps="libsundials-dev"
            ;;
        libeac-dev)
            extra_deps="libssl-dev"
            ;;
        libeantic-dev)
            extra_deps="libcereal-dev"
            ;;
        libec-dev)
            extra_deps="libntl-dev"
            ;;
        libee-dev)
            extra_deps="libestr-dev"
            ;;
        libeiskaltdcpp-dev)
            extra_deps="libbz2-dev libssl-dev"
            ;;
        libesedb-dev)
            extra_deps="libbfio-dev"
            ;;
        libevhtp-dev)
            extra_deps="libevent-dev libssl-dev"
            ;;
        libevt-dev)
            extra_deps="libbfio-dev"
            ;;
        libevtx-dev)
            extra_deps="libbfio-dev"
            ;;
        libexadrums-dev)
            extra_deps="libminizip-dev zlib1g-dev"
            ;;
        libexecline-dev)
            extra_deps="skalibs-dev"
            ;;
        libeztrace-dev)
            extra_deps="libopen-trace-format2-dev"
            ;;
        libf2fs-format-dev)
            extra_deps="libf2fs-dev"
            ;;
        libfaifa-dev)
            extra_deps="libpcap0.8-dev"
            ;;
        libfastjet-dev)
            extra_deps="libfastjetplugins-dev libcgal-dev"
            ;;
        libfilezilla-dev)
            extra_deps="wx3.2-headers libwxgtk3.2-dev"
            ;;
        libfinal-dev)
            extra_deps="libgpm-dev"
            ;;
        libfishcamp-dev)
            extra_deps="libusb-1.0-0-dev"
            ;;
        libflam3-dev)
            extra_deps="libxml2-dev"
            ;;
        libflightcrew-dev)
            extra_deps="libxerces-c-dev"
            ;;
        libfoma-dev)
            extra_deps="zlib1g-dev"
            ;;
        libformsgl-dev)
            extra_deps="libglx-dev libgl-dev"
            ;;
        libframe-dev)
            extra_deps="libx11-dev"
            ;;
        libfreefem++-dev)
            extra_deps="libgl-dev libglu1-mesa-dev"
            ;;
        libfrog-dev)
            extra_deps="libxml2-dev libticcutils-dev libfolia-dev libucto-dev libtimbl-dev libmbt-dev"
            ;;
        libfsapfs-dev)
            extra_deps="libbfio-dev"
            ;;
        libfsext-dev)
            extra_deps="libbfio-dev"
            ;;
        libfshfs-dev)
            extra_deps="libbfio-dev"
            ;;
        libfsntfs-dev)
            extra_deps="libbfio-dev"
            ;;
        libfsxfs-dev)
            extra_deps="libbfio-dev"
            ;;
        libfuntools-dev)
            extra_deps="tcl8.6-dev"
            ;;
        libfvde-dev)
            extra_deps="libbfio-dev"
            ;;
        libganglia1-dev)
            extra_deps="libconfuse-dev libapr1-dev"
            ;;
        libgap-dev)
            extra_deps="libgc-dev libatomic-ops-dev"
            ;;
        libgbtools-dev)
            extra_deps="libglib2.0-dev"
            ;;
        libgdf-dev)
            extra_deps="libboost1.81-dev"
            ;;
        libgeomview-dev)
            extra_deps="libx11-dev libxt-dev libmotif-dev libgl-dev libglu1-mesa-dev libxext-dev"
            ;;
        libgetoptions-dev)
            extra_deps="libcexceptions-dev"
            ;;
        libgfsgl-dev)
            extra_deps="libgfs-dev libgl2ps-dev libgl-dev"
            ;;
        libgiac-dev)
            extra_deps="libtommath-dev"
            ;;
        libgisi-dev)
            extra_deps="libglib2.0-dev"
            ;;
        libgkarrays-dev)
            extra_deps="zlib1g-dev"
            ;;
        libglobjects-dev)
            extra_deps="libglm-dev"
            ;;
        libgmsh-private-headers-dev)
            extra_deps="libeigen3-dev libgmp-dev libpython3-dev"
            ;;
        libgmt-dev)
            extra_deps="libgdal-dev"
            ;;
        libgnt-dev)
            extra_deps="libncurses-dev"
            ;;
        libgnunetgtk-dev)
            extra_deps="libgnunet-dev libsodium-dev"
            ;;
        libgpaste-2-dev)
            extra_deps="libgtk-4-dev"
            ;;
        libgpiv3-dev)
            extra_deps="libgsl-dev libfftw3-dev"
            ;;
        libgretl1-dev)
            extra_deps="zlib1g-dev libglib2.0-dev"
            ;;
        libgridsite-dev)
            extra_deps="libssl-dev"
            ;;
        libgrok-dev)
            extra_deps="libpcre3-dev"
            ;;
        libgroup-service-dev)
            extra_deps="libglib2.0-dev"
            ;;
        libgtkhotkey-dev)
            extra_deps="libglib2.0-dev"
            ;;
        libgtp-dev)
            extra_deps="libosmocore-dev"
            ;;
        libguac-dev)
            extra_deps="libcairo2-dev libssl-dev"
            ;;
        libguestfs-gobject-dev)
            extra_deps="libglib2.0-dev"
            ;;
        libgvars3-dev)
            extra_deps="libtoon-dev libmotif-dev"
            ;;
        libgxw-dev)
            extra_deps="libgtk-3-dev"
            ;;
        libheartbeat2-dev)
            extra_deps="cluster-glue-dev libglib2.0-dev"
            ;;
        libhepmc3-search-dev)
            extra_deps="libhepmc3-dev"
            ;;
        libhistoryservice-dev)
            extra_deps="qtbase5-dev"
            ;;
        libhttrack-dev)
            extra_deps="libssl-dev"
            ;;
        libhud-client2-dev)
            extra_deps="libdee-dev"
            ;;
        libibnetdisc-dev)
            extra_deps="libibmad-dev"
            ;;
        libibtk-dev)
            extra_deps="x11proto-dev libx11-dev"
            ;;
        libicapapi-dev)
            extra_deps="libssl-dev"
            ;;
        libifcplusplus-dev)
            extra_deps="libopenscenegraph-dev libboost1.81-dev"
            ;;
        libimejyutping-dev)
            extra_deps="libimecore-dev libboost1.81-dev libfcitx5utils-dev"
            ;;
        libimepinyin-dev)
            extra_deps="libfcitx5utils-dev libimecore-dev libboost1.81-dev"
            ;;
        libindicator-transfer-dev)
            extra_deps="libproperties-cpp-dev libglib2.0-dev"
            ;;
        libinhomog-dev)
            extra_deps="libgsl-dev"
            ;;
        libinputsynth-dev)
            extra_deps="libglib2.0-dev"
            ;;
        libinsane-dev)
            extra_deps="libglib2.0-dev"
            ;;
        libip6tc-dev)
            extra_deps="libip4tc-dev"
            ;;
        libipe-dev)
            extra_deps="libgnustep-gui-dev"
            ;;
        libipmiconsole-dev)
            extra_deps="libfreeipmi-dev"
            ;;
        libirstlm-dev)
            extra_deps="zlib1g-dev"
            ;;
        libitl-gobject-dev)
            extra_deps="libitl-dev libglib2.0-dev"
            ;;
        libixion-dev)
            extra_deps="libboost1.81-dev"
            ;;
        libjaula-dev)
            extra_deps="libfl-dev"
            ;;
        libjreen-qt5-dev)
            extra_deps="qtbase5-dev"
            ;;
        libk3b-dev)
            extra_deps="qtbase5-dev libkf5kio-dev libkf5cddb-dev"
            ;;
        libkdynamicwallpaper-dev)
            extra_deps="qtbase5-dev"
            ;;
        libklatexformula4-dev)
            extra_deps="qtbase5-dev"
            ;;
        libkopeninghours-dev)
            extra_deps="qtbase5-dev"
            ;;
        libkopete-dev)
            extra_deps="libkf5iconthemes-dev"
            ;;
        libkpimimportwizard-dev)
            extra_deps="libkf5mailcommon-dev"
            ;;
        libkshark-dev)
            extra_deps="libjson-c-dev libgl-dev libglu1-mesa-dev"
            ;;
        libkubuntu-dev)
            extra_deps="qtbase5-dev"
            ;;
        liblastfm5-dev)
            extra_deps="qtbase5-dev"
            ;;
        liblfunction-dev)
            extra_deps="libpari-dev"
            ;;
        liblibrecast-dev)
            extra_deps="libsodium-dev"
            ;;
        libliftoff-dev)
            extra_deps="libdrm-dev"
            ;;
        liblinbox-dev)
            extra_deps="libntl-dev"
            ;;
        liblld-1?-dev|liblldb-1?-dev)
            llvm_version="$(llvm_version_of_devpkg_no_virtual "${devpkg_no_virtual}")"
            # not 100% sure libedit-dev is needed for liblld-* but it won't hurt
            extra_deps="libedit-dev llvm-${llvm_version}-dev"
            includes="/usr/include/llvm-${llvm_version}"
            ;;
        liblnk-dev)
            extra_deps="libbfio-dev"
            ;;
        liblouisxml-dev)
            extra_deps="libxml2-dev"
            ;;
        liblrm2-dev)
            extra_deps="libglib2.0-dev libplumb2-dev"
            ;;
        liblucene++-dev)
            extra_deps="libboost1.81-dev"
            ;;
        libluksde-dev)
            extra_deps="libbfio-dev"
            ;;
        liblutok-dev)
            extra_deps="libatf-dev"
            ;;
        libmadlib-dev)
            extra_deps="libann-dev"
            ;;
        libmaliit-glib-dev)
            extra_deps="libglib2.0-dev"
            ;;
        libmapcache1-dev)
            extra_deps="libapr1-dev libaprutil1-dev"
            ;;
        libmarco-dev)
            extra_deps="libglib2.0-dev libx11-dev libgtk-3-dev"
            ;;
        libmartchus-c++utilities-dev)
            extra_deps="libcppunit-dev"
            ;;
        libmartchus-qtforkawesome-dev)
            extra_deps="qtdeclarative5-dev"
            ;;
        libmathicgb-dev)
            extra_deps="libmemtailor-dev libmathic-dev"
            ;;
        libmbtserver-dev)
            extra_deps="libmbt-dev libtimbl-dev libticcutils-dev libxml2-dev"
            ;;
        libmgba-dev)
            extra_deps="libgl-dev libelf-dev"
            ;;
        libmialm-dev)
            extra_deps="libglib2.0-dev libxml2-dev"
            ;;
        libmmmulti-dev)
            extra_deps="libips4o-dev"
            ;;
        libmono-2.0-dev)
            extra_deps="libglib2.0-dev"
            ;;
        libmozjs-102-dev)
            extra_deps="libchardet-dev libnspr4-dev"
            ;;
        libmps-dev)
            extra_deps="libgmp-dev"
            ;;
        libmsi-dev)
            extra_deps="libglib2.0-dev"
            ;;
        libmsiecf-dev)
            extra_deps="libbfio-dev"
            ;;
        libncbi6-dev)
            extra_deps="libvibrant6-dev"
            ;;
        libnest2d-dev)
            extra_deps="libpolyclipping-dev libboost1.81-dev libnlopt-cxx-dev"
            ;;
        libnextcloudsync-dev)
            extra_deps="qtbase5-dev"
            ;;
        libngtcp2-crypto-gnutls-dev)
            extra_deps="libngtcp2-dev libgnutls28-dev"
            ;;
        libns3-dev)
            extra_deps="libsqlite3-dev"
            ;;
        libnx-x11-dev)
            extra_deps="nx-x11proto-core-dev"
            ;;
        libocct-modeling-data-dev)
            extra_deps="libocct-visualization-dev"
            ;;
        liboclgrind-dev)
            extra_deps="libarm-compute-dev llvm-dev"
            ;;
        liboctovis-dev)
            extra_deps="qtbase5-dev libglu1-mesa-dev libqglviewer-headers libqt5opengl5-dev"
            ;;
        liboggkate-dev)
            extra_deps="libogg-dev libkate-dev"
            ;;
        libola-dev)
            extra_deps="libmicrohttpd-dev"
            ;;
        libolecf-dev)
            extra_deps="libbfio-dev"
            ;;
        libomnithread4-dev)
            extra_deps="libomniorb4-dev"
            ;;
        libompl-dev)
            extra_deps="libflann-dev"
            ;;
        libopendsp-dev)
            extra_deps="libcfitsio-dev"
            ;;
        libopengv-dev)
            extra_deps="libeigen3-dev"
            ;;
        libopenrawgnome-dev)
            extra_deps="libgdk-pixbuf-2.0-dev"
            ;;
        libopenshot-dev)
            extra_deps="libopenshot-audio-dev qtbase5-dev cppzmq-dev libavcodec-dev libavformat-dev libswscale-dev libjsoncpp-dev libopencv-dnn-dev libopencv-calib3d-dev libopencv-objdetect-dev libopencv-photo-dev libopencv-stitching-dev libopencv-video-dev"
            ;;
        libopensm-dev)
            extra_deps="libibumad-dev"
            ;;
        libopenvdb-ax-dev)
            extra_deps="libopenvdb-dev libboost1.81-dev llvm-dev"
            ;;
        libopenvdb-dev)
            extra_deps='libboost1.81-dev libpython3-dev'
            ;;
        liborcus-dev)
            extra_deps="libixion-dev libboost1.81-dev"
            ;;
        libosd-dev)
            extra_deps="libgl-dev"
            ;;
        libosptk-dev)
            extra_deps="libssl-dev"
            ;;
        libosrf-testing-tools-cpp-dev)
            extra_deps="libgtest-dev"
            ;;
        libostyle-dev)
            extra_deps="libosp-dev"
            ;;
        libots-dev)
            extra_deps="libglib2.0-dev"
            ;;
        libowncloudsync-dev)
            extra_deps="qtbase5-dev"
            ;;
        libpacketdump3-dev)
            extra_deps="libtrace3-dev"
            ;;
        libpaho-mqttpp-dev)
            extra_deps="libpaho-mqtt-dev"
            ;;
        libpaq-dev)
            extra_deps="libboost1.81-dev"
            ;;
        libpff-dev)
            extra_deps="libbfio-dev"
            ;;
        libpg-query-dev)
            extra_deps="libprotobuf-c-dev postgresql-server-dev-15"
            ;;
        libpinyin-common-dev)
            extra_deps="libglib2.0-dev"
            ;;
        libpsi3-dev)
            extra_deps="libint-dev"
            ;;
        libptexenc-dev)
            extra_deps="libkpathsea-dev"
            ;;
        libpuma-dev)
            extra_deps="libboost1.81-dev"
            ;;
        libpwiz-dev)
            extra_deps="libboost1.81-dev libeigen3-dev"
            ;;
        libpyside2-dev)
            extra_deps="libshiboken2-dev qtbase5-dev qt3d5-dev"
            ;;
        libqgis-dev)
            extra_deps="libspatialindex-dev"
            ;;
        libqhttpengine-dev)
            extra_deps="qtbase5-dev"
            ;;
        libqmath3d-dev)
            extra_deps="qtbase5-dev"
            ;;
        libqofono-dev)
            extra_deps="qtbase5-dev"
            ;;
        libqsopt-ex-dev)
            extra_deps="libgmp-dev"
            ;;
        libqt5-ukui-style-dev)
            extra_deps="qtbase5-dev libgsettings-qt-dev"
            ;;
        libqt5waylandcompositor5-dev)
            extra_deps="qtbase5-dev qtdeclarative5-dev"
            ;;
        libqtmirserver-dev)
            extra_deps="qtbase5-dev qtdeclarative5-dev liblomiri-api-dev"
            ;;
        libquickfix-dev)
            extra_deps="libpugixml-dev default-libmysqlclient-dev libpqxx-dev"
            defines='#define HAVE_POSTGRESQL 1
#define HAVE_MYSQL 1'
            extra_args="-gcc-options -std=c++14"
            ;;
        libqzxing-dev)
            extra_deps="qtbase5-dev qtmultimedia5-dev qtdeclarative5-dev"
            ;;
        libr3-dev)
            extra_deps="libgraphviz-dev libjson-c-dev"
            ;;
        libradsec-dev)
            extra_deps="libevent-dev libconfuse-dev"
            ;;
        librapidcheck-dev)
            extra_deps="libboost1.81-dev catch2 libgmock-dev"
            ;;
        librasterlite2-dev)
            extra_deps="libsqlite3-dev"
            ;;
        libratpoints-dev)
            extra_deps="libgmp-dev"
            ;;
        librcsb-core-wrapper0-dev)
            extra_deps="libxerces-c-dev libboost1.81-dev libpython3-dev"
            ;;
        librdkit-dev)
            extra_deps="libboost1.81-dev libcoordgen-dev libcairo2-dev"
            ;;
        libregf-dev)
            extra_deps="libbfio-dev"
            ;;
        libregfi-dev)
            extra_deps="libtalloc-dev"
            ;;
        librestinio-dev)
            extra_deps="libasio-dev libssl-dev libboost1.81-dev libpcre2-dev libpcre3-dev"
            ;;
        librgpio-dev)
            extra_deps="liblgpio-dev"
            ;;
        librosbag-storage-dev)
            extra_deps="libssl-dev"
            ;;
        librostlab3-dev)
            extra_deps="libboost1.81-dev"
            ;;
        libs6-dev)
            extra_deps="skalibs-dev libexecline-dev"
            ;;
        libsaga-dev)
            extra_deps="wx3.2-headers libwxgtk3.2-dev"
            ;;
        libsavvy-dev)
            extra_deps="zlib1g-dev libzstd-dev"
            ;;
        libsbjson-dev)
            extra_deps="libgnustep-base-dev"
            ;;
        libsbml5-dev)
            extra_deps="libbz2-dev zlib1g-dev"
            ;;
        libscca-dev)
            extra_deps="libbfio-dev"
            ;;
        libsciplot-dev)
            extra_deps="libxt-dev"
            ;;
        libseafile-dev)
            extra_deps="libglib2.0-dev libjansson-dev"
            ;;
        libsfcgal-dev)
            extra_deps="libopenscenegraph-dev"
            ;;
        libshibresolver-dev)
            extra_deps="libshibsp-dev libkrb5-dev"
            ;;
        libsignon-glib-dev)
            extra_deps="libglib2.0-dev"
            ;;
        libsigscan-dev)
            extra_deps="libbfio-dev"
            ;;
        libsimgear-dev)
            extra_deps="libboost1.81-dev zlib1g-dev libopenal-dev"
            ;;
        libslow5-dev)
            extra_deps="zlib1g-dev"
            ;;
        libsmraw-dev)
            extra_deps="libbfio-dev"
            ;;
        libsnapper-dev)
            extra_deps="libboost1.81-dev"
            ;;
        libsofia-sip-ua-dev)
            extra_deps="libglib2.0-dev"
            ;;
        libsope-dev)
            extra_deps="libgnustep-base-dev libldap-dev"
            ;;
        libsopt-dev)
            extra_deps="libspdlog-dev libeigen3-dev"
            ;;
        libsphinx-dev)
            extra_deps="libsodium-dev"
            ;;
        libsrecord-dev)
            extra_deps="libboost1.81-dev"
            ;;
        libsrpc-dev)
            extra_deps="libprotobuf-dev libworkflow-dev libssl-dev"
            ;;
        libsscm-dev)
            extra_deps="libgcroots-dev"
            ;;
        libsss-certmap-dev)
            extra_deps="libtalloc-dev"
            ;;
        libstarpu-dev)
            extra_deps="libpapi-dev"
            ;;
        libstdc++-*-dev)
            extra_deps="libtbb-dev"
            ;;
        libstellarsolver-dev)
            extra_deps="libgsl-dev"
            ;;
        libsx-dev)
            extra_deps="libxt-dev"
            ;;
        libtag-extras-dev)
            extra_deps="libtag1-dev"
            ;;
        libtarget-factory-dev)
            extra_deps="libprotobuf-dev"
            ;;
        libtcod-dev)
            extra_deps="liblodepng-dev"
            ;;
        libtercpp-dev)
            extra_deps="libboost1.81-dev"
            ;;
        libthrift-c-glib-dev)
            extra_deps="libglib2.0-dev libssl-dev"
            ;;
        libthrift-dev)
            extra_deps="libboost1.81-dev qtbase5-dev"
            ;;
        libtiledarray-dev)
            extra_deps="libeigen3-dev libmadness-dev"
            ;;
        libtiled-dev)
            extra_deps="qtbase5-dev"
            ;;
        libtonezone-dev)
            extra_deps="dahdi-source"
            ;;
        libtoontag-dev)
            extra_deps="libtoon-dev"
            ;;
        libtracecmd-dev)
            extra_deps="libtraceevent-dev libtracefs-dev"
            ;;
        libtss2-tcti-tabrmd-dev)
            extra_deps="libtss2-dev"
            ;;
        libtumbler-1-dev)
            extra_deps="libgdk-pixbuf-2.0-dev"
            ;;
        libucto-dev)
            extra_deps="libfolia-dev libticcutils-dev libicu-dev libxml2-dev"
            ;;
        libufpidentity-dev)
            extra_deps="libssl-dev"
            ;;
        libui-gxmlcpp-dev)
            extra_deps="libui-utilcpp-dev"
            ;;
        libukui-gsettings-dev)
            extra_deps="libglib2.0-dev"
            ;;
        libuninum-dev)
            extra_deps="libgmp-dev"
            ;;
        libunity-control-center-dev)
            extra_deps="libgtk-3-dev"
            ;;
        libunuran-dev)
            extra_deps="libgsl-dev"
            ;;
        liburfkill-glib-dev)
            extra_deps="libglib2.0-dev"
            ;;
        libusermetricsoutput-dev)
            extra_deps="qtbase5-dev"
            ;;
        libuwac0-dev)
            extra_deps="libwayland-dev"
            ;;
        libvalijson-dev)
            extra_deps="libboost1.81-dev"
            ;;
        libvdeslirp-dev)
            extra_deps="libslirp-dev"
            ;;
        libverbiste-dev)
            extra_deps="libxml2-dev"
            ;;
        libvkfft-dev)
            extra_deps="libvulkan-dev glslang-dev"
            ;;
        libvmatch-dev)
            extra_deps="zlib1g-dev libbz2-dev"
            ;;
        libvshadow-dev)
            extra_deps="libbfio-dev"
            ;;
        libvsqlitepp-dev)
            extra_deps="libboost1.81-dev"
            ;;
        libvtk-dicom-dev)
            extra_deps="libvtk9-dev"
            ;;
        libvulkan-volk-dev)
            extra_deps="libvulkan-dev"
            ;;
        libwaei-dev)
            extra_deps="libglib2.0-dev libmecab-dev"
            ;;
        libwildmagic-dev)
            extra_deps="libglu1-mesa-dev"
            ;;
        libwiretap-dev)
            extra_deps="libwsutil-dev libglib2.0-dev"
            ;;
        libworkflow-dev)
            extra_deps="libssl-dev"
            ;;
        libwsman-clientpp-dev)
            extra_deps="libopenwsman-dev"
            ;;
        libwsutil-dev)
            extra_deps="libwireshark-dev libglib2.0-dev"
            ;;
        libwxsmithlib-dev)
            extra_deps="wx3.2-headers libwxgtk3.2-dev codeblocks-dev libtinyxml-dev"
            ;;
        libwxsvg-dev)
            extra_deps="wx3.2-headers libwxgtk3.2-dev"
            ;;
        libxgks-dev)
            extra_deps="gauche-dev libx11-dev"
            ;;
        libyadifa-dev)
            extra_deps="libssl-dev"
            ;;
        libyuma-dev)
            extra_deps="libssh2-1-dev libxml2-dev"
            ;;
        libzeroc-ice-dev)
            extra_deps="libssl-dev"
            ;;
        libzia-dev)
            extra_deps="libgnutls28-dev"
            ;;
        linuxcnc-uspace-dev)
            extra_deps="libboost1.81-dev"
            ;;
        moonshot-trust-router-dev)
            extra_deps="libtalloc-dev libssl-dev libkrb5-dev"
            ;;
        nsf-dev)
            extra_deps="tcl8.6-dev"
            ;;
        ocfs2-tools-dev)
            extra_deps="comerr-dev"
            ;;
        pike8.0-dev)
            extra_deps="libgmp-dev libgnustep-base-dev"
            ;;
        plplot-tcl-dev)
            extra_deps="libplplot-dev tcl8.6-dev tk8.6-dev"
            ;;
        qtbase5-private-gles-dev)
            extra_deps="libicu-dev"
            ;;
        qtquickcontrols2-5-private-dev)
            extra_deps="qtdeclarative5-dev"
            ;;
        regina-normal-dev)
            extra_deps="libtokyocabinet-dev libboost1.81-dev"
            ;;
        remmina-dev)
            extra_deps="libgtk-3-dev"
            ;;
        ruby-gnome-dev)
            extra_deps="libglib2.0-dev libgirepository1.0-dev libpango1.0-dev libgtk-3-dev"
            ;;
        slapi-dev)
            extra_deps="libldap-dev"
            ;;
        syslog-ng-dev)
            extra_deps="libssl-dev libcap-dev"
            ;;
        tclxml-dev)
            extra_deps="tcl8.6-dev libxml2-dev"
            ;;
        tdom-dev)
            extra_deps="tcl8.6-dev libexpat1-dev"
            ;;
        unagi-dev)
            extra_deps="libxcb1-dev libxcb-ewmh-dev libxcb-xfixes0-dev libxcb-randr0-dev libxcb-keysyms1-dev libxcb-damage0-dev libconfuse-dev libev-dev"
            ;;
        vspline-dev)
            extra_deps="libhwy-dev vc-dev"
            ;;
        vulkan-validationlayers-dev)
            extra_deps="libvulkan-dev"
            ;;
        wayfire-dev)
            extra_deps="libwlroots-dev libwf-config-dev libglm-dev libcairo2-dev libwf-utils-dev nlohmann-json3-dev"
            ;;
        xotcl-dev)
            extra_deps="tcl8.6-dev"
            ;;
        casacore-dev)
            extra_deps="libblas-dev libboost-filesystem-dev libboost-python-dev libboost-system-dev libboost-test-dev libcfitsio-dev libfftw3-dev libgsl-dev liblapack-dev libncurses5-dev libreadline-dev python3-dev python3-numpy-dev wcslib-dev"
            extra_args="-gcc-options -std=c++14"
            exclude_types=mallinfo2
            preamble="string.h
stdio.h
mutex
casacore/fits/FITS/fitsio.h"
            ;;
        libcpdb-backend-dev)
            extra_deps=libglib2.0-dev
            ;;
        libcollada-dom-dev)
            extra_deps="libboost-dev libminizip-dev zlib1g-dev libxml2-dev"
            ;;
        libcmark-gfm-extensions-dev)
            extra_deps=libcmark-gfm-dev
            ;;
        libbigwig-dev)
            extra_deps="libcurl4-openssl-dev zlib1g-dev"
            ;;
        libavifile-0.7-dev)
            extra_deps=libx11-dev
            ;;
        libactionlib-dev)
            extra_deps="librosconsole-dev libroscpp-dev"
            ;;
        mir-renderer-gl-dev)
            extra_deps="libmircore-dev libgles-dev"
            ;;
        libzint-dev)
            extra_deps=qtbase5-dev
            ;;
        libseqan3-dev)
            extra_deps="libbenchmark-dev libgtest-dev zlib1g-dev"
            ;;
        libosmo-ranap-dev)
            extra_deps="osmo-libasn1c-dev libosmocore-dev libosmo-sigtran-dev libtalloc-dev"
            ;;
        libhe5-hdfeos-dev)
            extra_deps=libhdf5-dev
            ;;
        libgnunet-dev)
            extra_deps="libsodium-dev libcurl4-gnutls-dev libjansson-dev libmysqlclient-dev libpq-dev libsqlite3-dev libsodium-dev"
            ;;
        libgmerlin-dev)
            extra_deps="libjson-c-dev libcairo2-dev libgtk-3-dev"
            ;;
        pinball-dev)
            extra_deps="libsdl2-dev libsdl2-mixer-dev"
            ;;
        libint2-dev*)
            extra_deps="libbtas-dev liblapack-dev"
            ;;
        python3-dolfinx-*)
            case "${devpkg}" in
                *-complex) domain='complex' ;;
                *-real)    domain='real'    ;;
                *) ;;
            esac
            extra_deps="libpetsc-${domain}3.18-dev"
            includes="/usr/lib/petscdir/petsc3.18/${multiarch}-${domain}/include"
            ;;
        python3-petsc4py-*|python3-slepc4py-*)
            case ${devpkg} in
                *-64-complex3.18) sixty_four='64'; domain='complex' ;;
                *-64-real3.18)    sixty_four='64'; domain='real'    ;;
                *-complex3.18)    sixty_four='';   domain='complex' ;;
                *-real3.18)       sixty_four='';   domain='real'    ;;
                *) ;;
            esac
            includes="/usr/lib/slepcdir/slepc${sixty_four:+${sixty_four}-}3.18/${multiarch}-${domain}/include"
            extra_deps="libopenmpi-dev libpetsc${sixty_four}-${domain}3.18-dev libslepc${sixty_four}-${domain}3.18-dev"
            defines="$defines
${defines_nerf_static_assert}"
            ;;
        libmuparserx-dev)
            extra_deps="dos2unix"
            ;;
        libxdmf-dev)
            extra_deps="libboost-dev libxml2-dev libopenmpi-dev libhdf5-openmpi-dev"
            ;;
        libxorg-gtest-dev)
            extra_deps="libevemu-dev x11proto-dev libx11-dev"
            ;;
        libsoil-dev)
            extra_deps="libstb-dev"
            ;;
        mirtest-dev)
            extra_deps="libgtest-dev python3-pycparser libgmock-dev"
            ;;
        libpython3.11-dev)
            extra_deps="libncurses-dev libexpat1-dev"
            ;;
        libimetable-dev)
            extra_deps="libfcitx5utils-dev libimecore-dev libboost1.81-dev"
            ;;
        libgtkextra-dev)
            extra_deps="libgtk2.0-dev"
            ;;
        aircrack-ng)
            extra_deps='libssl-dev libgcrypt20-dev'
            defines="${defines}
${defines_nerf_restrict}"
            ;;
        android-libnativehelper-dev)
            extra_deps='android-liblog-dev'
            ;;
        android-platform-system-core-headers)
            extra_deps='android-libcutils-dev'
            ;;
        atheme-services)
            extra_deps='libssl-dev'
            ;;
        cairo-dock-dbus-plug-in)
            extra_deps='libglib2.0-dev'
            ;;
        caja-sendto)
            extra_deps='libglib2.0-dev libgtk-3-dev'
            ;;
        calamares)
            extra_deps='qtbase5-dev libboost1.81-dev libpython3-dev libkpmcore-dev libkf5coreaddons-dev libyaml-cpp-dev'
            ;;
        ccze)
            extra_deps='libpcre3-dev libncurses-dev'
            ;;
        choqok)
            extra_deps='qtbase5-dev'
            ;;
        clisp)
            preamble='clisp.h'
            # I don't know where it should come from
            defines='#define MODULE(x)'
            ;;
        collectd-dev)
            extra_deps='libpython3-dev libprotobuf-c-dev'
            ;;
        crash)
            extra_deps='zlib1g-dev'
            ;;
        cython3)
            defines="${defines}
#define CYTHON_INLINE
#define __Pyx_SET_SIZE(...)"
            ;;
        deepin-deb-installer)
            extra_deps='qtbase5-dev'
            ;;
        deepin-terminal)
            extra_deps='qtbase5-dev'
            ;;
        dleyna-renderer)
            extra_deps='libdleyna-core-1.0-dev'
            ;;
        dovecot-dev)
            extra_deps='libldap-dev liblua5.4-dev'
            ;;
        dpf-source)
            extra_deps='libgl-dev libvulkan-dev'
            ;;
        dvbstreamer)
            extra_deps='libev-dev'
            ;;
        emboss-lib)
            extra_deps='zlib1g-dev'
            ;;
        faust-common)
            extra_deps='libasound2-dev android-liblog-dev'
            ;;
        fcitx-module-autoeng-ng)
            extra_deps='fcitx-libs-dev'
            ;;
        freebsd-glue)
            extra_deps='libgdbm-compat-dev freebsd-glue'
            ;;
        ftools-pow)
            extra_deps='tcl8.6-dev tk8.6-dev'
            ;;
        gauche-gl)
            extra_deps='gauche-dev'
            ;;
        gawk)
            preamble="string.h
sys/stat.h"
            ;;
        geany-common)
            extra_deps='libglib2.0-dev libgtk-3-dev'
            ;;
        gerbv)
            extra_deps='libglib2.0-dev libgtk2.0-dev'
            ;;
        ggobi)
            extra_deps='libgtk2.0-dev libxml2-dev'
            ;;
        gnome-boxes)
            extra_deps='libglib2.0-dev'
            ;;
        gnome-connections)
            extra_deps='libgtk-3-dev'
            ;;
        gnucash-common)
            extra_deps='libglib2.0-dev libgtk-3-dev'
            ;;
        gnumeric)
            extra_deps='libglib2.0-dev libgoffice-0.10-dev'
            ;;
        gnuradio)
            extra_deps='gnuradio-dev'
            ;;
        go-for-it)
            extra_deps='libglib2.0-dev libgtk-3-dev libpeas-dev'
            ;;
        gobject-introspection)
            extra_deps='libglib2.0-dev libcairo2-dev'
            ;;
        gr-*)
            extra_deps='gnuradio-dev'
            ;;
        grass-dev)
            extra_deps='libx11-dev libglx-dev libgl-dev'
            ;;
        hdf5-filter-plugin-blosc-serial)
            extra_deps='libblosc-dev'
            ;;
        htcondor-dev)
            extra_deps='libclassad-dev'
            ;;
        htslib-test)
            extra_deps='libhts-dev'
            ;;
        httest)
            extra_deps='libapr1-dev'
            ;;
        ibacm)
            extra_deps='libibverbs-dev libibumad-dev'
            ;;
        iptux)
            extra_deps='libsigc++-2.0-dev libjsoncpp-dev'
            ;;
        lepton-eda)
            extra_deps='libcairo2-dev libpango1.0-dev'
            ;;
        libace-dev)
            extra_deps='libgdbm-compat-dev'
            ;;
        libappmenu-gtk-parser-dev-common)
            # I think it could be GTK 2 or 3; I'm going for the oldest one
            extra_deps='libglib2.0-dev libgtk2.0-dev'
            ;;
        libasynccpp-dev)
            extra_deps='libsigc++-2.0-dev libasynccore-dev'
            ;;
        libasyncqt-dev)
            extra_deps='libsigc++-2.0-dev libasynccore-dev qtbase5-dev'
            ;;
        libavogadro-dev)
            extra_deps='libcppnumericalsolvers-dev qtbase5-dev libmolequeue-dev'
            ;;
        libb-hooks-op-check-entersubforcv-perl)
            extra_deps='libb-hooks-op-check-perl'
            includes="/usr/lib/${multiarch}/perl5/5.36/B/Hooks/OP/Check/Install/"
            ;;
        libbellesip-dev)
            extra_deps='default-jdk-headless'
            ;;
        libbiblesync-dev)
            extra_deps='uuid-dev'
            ;;
        libbmusb-dev)
            extra_deps='libusb-1.0-0-dev'
            ;;
        libbroker-dev)
            extra_deps='libcaf-dev'
            ;;
        libcairo-perl)
            extra_deps="${extra_deps} libcairo2-dev"
            ;;
        libcamera-calibration-parsers-dev)
            extra_deps='libpython3-dev'
            ;;
        libcanberra-gtk-common-dev)
            extra_deps='libcanberra-dev'
            ;;
        libclhep-dev)
            extra_deps='libgsl-dev'
            ;;
        libclaws-mail-dev)
            extra_deps='libgtk-3-dev libgnutls28-dev libetpan-dev libldap-dev libgpgme-dev'
            ;;
        libcmis-dev)
            extra_deps='libboost1.81-dev'
            ;;
        libcolord-gtk-headers)
            # I think it could be GTK 3 or 4; I'm going for the oldest one
            extra_deps='libgtk-3-dev'
            ;;
        libconsolekit-dev)
            extra_deps='libglib2.0-dev'
            ;;
        libcpdb-libs-backend-dev)
            extra_deps='libglib2.0-dev'
            ;;
        libcpdb-libs-frontend-dev)
            extra_deps='libglib2.0-dev libcups2-dev'
            ;;
        libcutl-dev)
            extra_deps='libexpat1-dev'
            ;;
        libdbi-perl)
            extra_deps='libdbi-dev'
            preamble='dbi/dbi.h'
            ;;
        libdolfin-dev*)
            extra_deps='libboost1.81-dev libeigen3-dev'
            # from .pc file
            defines="${defines}
#define DHAS_HDF5
#define D_FILE_OFFSET_BITS 64
#define DHAS_SLEPC
#define DHAS_PETSC
#define DHAS_UMFPACK
#define DHAS_CHOLMOD
#define DHAS_SCOTCH
#define DHAS_ZLIB
#define DHAS_MPI"
            ;;
        libdrogon-dev)
            extra_deps='libjsoncpp-dev'
            ;;
        # lib*-freebsd-dev)
        #     extra_deps='libklibc-dev'
        #     ;;
        libecholib-dev)
            extra_deps='libsigc++-2.0-dev libasynccore-dev libgsm1-dev libasyncaudio-dev'
            ;;
        libecm1-dev-common)
            extra_deps='libgmp-dev'
            ;;
        libfftw3-mpi-dev)
            extra_deps='libfftw3-dev'
            ;;
        libefisec-dev)
            extra_deps='libefivar-dev'
            ;;
        libflatbuffers-dev)
            extra_deps='libgrpc-dev libgrpc++-dev'
            ;;
        libfltk1.3-compat-headers)
            extra_deps='libgl-dev'
            ;;
        libfltk1.3-dev)
            extra_deps='libgl-dev libglu1-mesa-dev'
            ;;
        libformfactor-dev)
            extra_deps='libheinz-dev'
            ;;
        libg2o-dev)
            extra_deps='libgl-dev'
            ;;
        libghemical-dev)
            extra_deps='libgl-dev libsc-dev'
            ;;
        libgiftiio-dev)
            extra_deps='zlib1g-dev libexpat1-dev'
            ;;
        libgl-image-display-dev)
            extra_deps='libfltk1.3-dev'
            ;;
        libglib-perl)
            extra_deps='libglib2.0-dev'
            ;;
        libguac-dev)
            defines="${defines}
${defines_nerf_restrict}"
            ;;
        libgtg-dev)
            extra_deps='zlib1g-dev'
            ;;
        libgzstream-dev)
            extra_deps='zlib1g-dev'
            ;;
        libjodycode-dev)
            defines="${defines}
${defines_nerf_restrict}"
            ;;
        libharfbuzz-dev)
            extra_deps='libcairo2-dev'
            ;;
        libhinoko-dev)
            extra_deps='libhinawa-dev'
            ;;
        libhtp-dev)
            extra_deps='zlib1g-dev'
            ;;
        libhwy-dev)
            extra_deps='libgtest-dev'
            ;;
        libignition-common-core-dev)
            extra_deps='libignition-math-dev libignition-utils-dev libignition-common-graphics-dev libignition-common-av-dev libignition-common-dev'
            ;;
        libignition-math-dev)
            extra_deps='libeigen3-dev'
            ;;
        libimaevm-dev)
            extra_deps='libssl-dev'
            ;;
        libitpp-dev)
            extra_deps='octave-dev'
            ;;
        libjpeg62-turbo-dev)
            preamble='stddef.h
stdio.h
jpeglib.h'
            ;;
        libkompareinterface-dev)
            extra_deps='qtbase5-dev'
            ;;
        libkpimaddressbookimportexport-dev)
            extra_deps='libkf5contacts-dev libkf5pimcommon-dev'
            ;;
        libkpipewire-dev)
            extra_deps='libepoxy-dev qtdeclarative5-dev'
            ;;
        liblibleidenalg-dev)
            extra_deps='libigraph-dev'
            ;;
        liblouisutdml-dev)
            extra_deps='default-jdk-headless'
            ;;
        libmagick++-6-headers)
            extra_deps='libmagickcore-6-arch-config'
            ;;
        libmagickcore-6-headers)
            extra_deps='libmagickcore-6-arch-config'
            ;;
        libmagickwand-6-headers)
            extra_deps='libmagickcore-6-arch-config'
            ;;
        libmgl-dev)
            extra_deps='libfltk1.3-dev libltdl-dev qtbase5-dev wx3.2-headers libwxgtk3.2-dev'
            ;;
        libminizip-dev)
            extra_deps=zlib1g-dev
            preamble="zconf.h" # needed for z_crc_t
            ;;
        libmlpack-dev)
            extra_deps='libensmallen-dev'
            ;;
        libmmb-dev)
            extra_deps='libsimbody-dev libsimtkmolmodel-dev gemmi-dev tao-pegtl-dev libopenmm-dev libseqan2-dev'
            ;;
        libmongoclient-dev)
            extra_deps='libboost1.81-dev'
            preamble="atomic"
            defines="${defines}
#define uassert(...)"
            ;;
        libmozjs-115-dev)
            extra_deps='libchardet-dev libnspr4-dev'
            ;;
        libmpfi-dev-common)
            extra_deps='libgmp-dev libmpfr-dev'
            ;;
        libmrgingham-dev)
            extra_deps='libopencv-core-dev'
            ;;
        libmshr-dev-common)
            extra_deps='libdolfin-dev-common libboost1.81-dev'
            ;;
        libnginx-mod-http-ndk-dev)
            extra_deps='libssl-dev'
            ;;
        libnma-headers)
            extra_deps='libglib2.0-dev libcairo2-dev libgtk-3-dev libnm-dev'
            ;;
        libnormaliz-dev-common)
            extra_deps='libgmp-dev libeantic-dev'
            ;;
        libntirpc-dev)
            extra_deps='libbsd-dev'
            ;;
        libogmrip-dev)
            extra_deps='libglib2.0-dev'
            ;;
        libopaque-dev)
            extra_deps='libsodium-dev'
            ;;
        libopencamlib-dev)
            extra_deps='libboost1.81-dev libpython3-dev'
            ;;
        libopenturns-dev)
            extra_deps='libpython3-dev'
            ;;
        liboprf-dev)
            extra_deps='libsodium-dev'
            ;;
        libpano13-dev)
            extra_deps='default-jdk-headless'
            ;;
        libphonon4qt6experimental-dev)
            extra_deps='qt6-base-dev'
            ;;
        libpillowfight-dev)
            extra_deps='libpython3-dev'
            ;;
        libpocl2-common)
            extra_deps='libarm-compute-dev'
            ;;
        libpolymake-dev-common)
            extra_deps='libboost1.81-dev libsingular4-dev-common libsingular4-dev libcdd-dev libppl-dev'
            ;;
        libpqmarble-dev)
            extra_deps='libglib2.0-dev libgtk-4-dev'
            ;;
        libpython3.10-dev|libpython3.12-dev)
            extra_deps='libncurses-dev'
            ;;
        libqhttpengine-examples)
            extra_deps='qtbase5-dev libqhttpengine-dev'
            ;;
        libqt5qxlsx-dev)
            extra_deps='qtbase5-dev'
            ;;
        libradosstriper-dev)
            extra_deps='librados-dev libradospp-dev'
            ;;
        libreiserfscore-dev)
            extra_deps='comerr-dev'
            ;;
        libreoffice-dev-common)
            extra_deps='libreoffice-dev'
            ;;
        libresvg-dev)
            extra_deps='qtbase5-dev'
            ;;
        libseriousproton-dev)
            extra_deps='libsfml-dev'
            ;;
        libsimtkmolmodel-dev)
            extra_deps='libsimbody-dev gemmi-dev tao-pegtl-dev'
            ;;
        libsingular4-dev-common)
            extra_deps='libgmp-dev libsingular4-dev'
            ;;
        libstlink-dev)
            extra_deps='libusb-1.0-0-dev'
            ;;
        libswiften-dev)
            extra_deps='zlib-dev libgnustep-base-dev'
            ;;
        libtk-img-dev)
            extra_deps='libjpeg-dev'
            ;;
        libtntnet-dev)
            extra_deps='zlib1g-dev'
            ;;
        libtopcom-dev)
            extra_deps='libcdd-dev'
            ;;
        libuev-dev)
            # taken from .pc file
            defines="${defines}
#define _TIME_BITS 64"
            ;;
        libukui-appwidget-manager-dev)
            extra_deps='qtbase5-dev'
            ;;
        libusbredirhost-dev)
            extra_deps='libusb-1.0-0-dev'
            ;;
        libutil-freebsd-dev)
            extra_deps='libnewlib-dev'
            ;;
        libvkd3d-headers)
            extra_deps='libvulkan-dev'
            ;;
        libwings-dev)
            extra_deps='libpango1.0-dev'
            ;;
        libwireshark-dev)
            extra_deps='libglib2.0-dev'
            ;;
        libwreport-dev)
            extra_deps='libpython3-dev'
            ;;
        libwvstreams-dev)
            extra_deps='libssl-dev'
            ;;
        libxlsxwriter-dev)
            extra_deps='zlib1g-dev'
            ;;
        libxmu-headers)
            extra_deps='libxt-dev'
            ;;
        libxrootd-server-dev)
            extra_deps='libssl-dev'
            ;;
        libzlcore-dev)
            extra_deps='zlib1g-dev'
            ;;
        lua-socket-dev)
            extra_deps='libregfi-dev'
            ;;
        lxqt-panel)
            extra_deps='qtbase5-dev'
            ;;
        mailfront)
            extra_deps='libbg-dev'
            ;;
        maliit-framework-dev)
            extra_deps='qtbase5-dev'
            ;;
        mcabber)
            extra_deps='libglib2.0-dev libloudmouth1-dev libgpgme-dev libotr5-dev libncurses-dev'
            ;;
        minisat)
            extra_deps='zlib1g-dev'
            ;;
        moonshot-gss-eap)
            extra_deps='libkrb5-dev'
            ;;
        ogmrip-plugins)
            extra_deps='libogmrip-dev libglib2.0-dev'
            ;;
        openjdk-*-jdk)
            extra_deps='libx11-dev'
            ;;
        openvpn)
            extra_deps='libssl-dev'
            ;;
        perl-tk)
            extra_deps='libx11-dev tcl-dev'
            preamble='X11/Xlib.h
X11/Xutil.h
tclInt.h'
            ;;
        php8.2-http)
            extra_deps='php8.2-raphf zlib1g-dev'
            ;;
        pinot)
            extra_deps='libsqlite3-dev'
            ;;
        plasma-dialer)
            extra_deps='qtbase5-dev'
            ;;
        postgresql-16-jsquery)
            extra_deps='libpg-query-dev postgresql-server-dev-16'
            ;;
        postgresql-16-pllua)
            extra_deps='libpg-query-dev liblua5.4-dev'
            ;;
        pragha)
            extra_deps='libpeas-dev'
            ;;
        prelude-lml)
            extra_deps='libprelude-dev'
            ;;
        psychtoolbox-3-common)
            extra_deps='libgl-dev libegl-dev libglu1-mesa-dev octave-dev'
            ;;
        pypy3)
            extra_deps='pypy3-dev'
            ;;
        pypy3-lib)
            extra_deps='pypy3-dev'
            ;;
        python-apt*)
            extra_deps='libpython3-dev'
            ;;
        python3-apbslib)
            extra_deps='pybind11-dev'
            ;;
        python3-astropy)
            extra_deps='wcslib-dev'
            ;;
        python3-bsddb3)
            extra_deps='libdb5.3-dev'
            ;;
        python3-cmarkgfm)
            extra_deps='libcmark-gfm-dev libcmark-gfm-extensions-dev'
            ;;
        python3-cyvcf2)
            extra_deps='libhts-dev'
            ;;
        python3-pygame)
            extra_deps='libsdl2-dev'
            ;;
        python3-gmpy2)
            extra_deps='libgmp-dev libmpfr-dev libmpc-dev'
            ;;
        python3-kivy)
            extra_deps='libgl-dev'
            ;;
        python3-libzim)
            extra_deps='libzim-dev'
            ;;
        python3-lxml)
            extra_deps='libxslt1-dev'
            preamble="tree.h"
            ;;
        python3-mpy)
            preamble="libopenmpi-dev"
            ;;
        python3-numba)
            extra_deps='python3-numpy'
            preamble='compile.h
frameobject.h
traceback.h
internal/pycore_frame.h
npy_common.h
cext.h
numba/_helperlib.h'
            ;;
        python3-numpy)
            preamble="ndarraytypes.h"
            ;;
        python3-ppl)
            extra_deps='libppl-dev libgmp-dev'
            ;;
        python3-pybedtools)
            extra_deps='zlib1g-dev'
            ;;
        python3-pynauty)
            extra_deps='libnauty2-dev'
            ;;
        python3-pyopencolorio)
            extra_deps='pybind11-dev libopencolorio-dev libarm-compute-dev python3-astropy'
            ;;
        python3-pysam)
            extra_deps='libhts-dev'
            ;;
        python3-yt)
            preamble="libopenmpi-dev"
            ;;
        qbs-dev)
            extra_deps='qt6-base-dev'
            ;;
        qcoro-qt6-dev)
            extra_deps='qt6-declaration-dev'
            ;;
        qmake6)
            extra_deps='qt6-based-dev'
            ;;
        qmmp)
            extra_deps='qtbase5-dev'
            ;;
        qt5serialport-examples)
            extra_deps='qtbase5-dev'
            ;;
        qtbase5-examples)
            extra_deps='qtbase5-dev'
            ;;
        qtcharts5-examples)
            extra_deps='qtbase5-dev'
            ;;
        qtdeclarative5-examples)
            extra_deps='qtdeclarative5-dev'
            ;;
        qtgamepad5-examples)
            extra_deps='qtbase5-dev'
            ;;
        qtlocation5-examples)
            extra_deps='qtbase5-dev'
            ;;
        qtnetworkauth5-examples)
            extra_deps='qtbase5-dev'
            ;;
        qtpdf5-examples)
            extra_deps='qtbase5-dev'
            ;;
        qtpim5-examples)
            extra_deps='qtbase5-dev qtpim5-dev'
            ;;
        qtquickcontrols2-5-examples)
            extra_deps='qtbase5-dev'
            ;;
        qtquickcontrols5-examples)
            extra_deps='qtbase5-dev qtdeclarative5-dev'
            ;;
        qtremoteobjects5-examples)
            extra_deps='qtbase5-dev'
            ;;
        qtscript5-examples)
            extra_deps='qtbase5-dev qtscript5-dev'
            ;;
        qtscxml5-examples)
            extra_deps='qtbase5-dev'
            ;;
        qtserialbus5-examples)
            extra_deps='qtbase5-dev'
            ;;
        qtspeech5-examples)
            extra_deps='qtbase5-dev'
            ;;
        qtsvg5-examples)
            extra_deps='qtbase5-dev'
            ;;
        qtsystems5-examples)
            extra_deps='qtbase5-dev qtsystems5-dev'
            ;;
        qtwayland5-examples)
            extra_deps='libwayland-dev'
            ;;
        qtwebchannel5-examples)
            extra_deps='qtbase5-dev'
            ;;
        qtwebengine5-examples)
            extra_deps='qtbase5-dev'
            ;;
        qtwebsockets5-examples)
            extra_deps='qtbase5-dev'
            ;;
        qtxmlpatterns5-examples)
            extra_deps='qtbase5-dev libqt5xmlpatterns5-dev'
            ;;
        quickplot)
            extra_deps='libgtk-3-dev'
            ;;
        r-cran-cppeigen)
            preamble="Macros.h"
            ;;
        r-cran-dqrng)
            extra_deps='libpcg-cpp-dev'
            ;;
        r-cran-rcpp)
            preamble="Rcpp.h"
            ;;
        r-cran-rcppmlpack)
            extra_deps='libmlpack-dev relacy-dev'
            ;;
        r-cran-rquantlib)
            extra_deps='libquantlib0-dev'
            ;;
        r-cran-rstanarm)
            extra_deps='libeigen3-dev'
            preamble='Eigen/Eigen'
            ;;
        r-cran-systemfonts)
            extra_deps='libfreetype-dev'
            ;;
        r-cran-tmb)
            extra_deps='libadolc-dev coinor-libipopt-dev'
            ;;
        r-cran-wk)
            extra_deps='r-cran-cpp11'
            ;;
        r-cran-xml2)
            extra_deps='libxml2-dev'
            ;;
        rdkit-data)
            extra_deps='librdkit-dev libboost1.81-dev'
            ;;
        rep-gtk)
            extra_deps='librep-dev libgtk2.0-dev'
            ;;
        ros-compressed-depth-image-transport-dev)
            extra_deps='libdynamic-reconfigure-config-init-mutex-dev libroscpp-dev libopencv-core-dev libsensor-msgs-dev libimage-transport-dev'
            ;;
        ros-compressed-image-transport-dev)
            extra_deps='libdynamic-reconfigure-config-init-mutex-dev libroscpp-dev libimage-transport-dev libturbojpeg0-dev'
            ;;
        ros-theora-image-transport-dev)
            extra_deps='libroscpp-core-dev libstd-msgs-dev libdynamic-reconfigure-config-init-mutex-dev libroscpp-dev libimage-transport-dev libcv-bridge-dev libtheora-dev'
            ;;
        rssguard)
            extra_deps='qtbase5-dev libtensorpipe-dev'
            ;;
        ruby-cairo)
            extra_deps='libcairo2-dev'
            ;;
        ruby-grpc)
            extra_deps='libabsl-dev'
            ;;
        ruby-nokogiri)
            extra_deps='libxml2-dev libxslt1-dev'
            ;;
        sawfish-data)
            extra_deps='librep-dev libx11-dev libgdk-pixbuf-xlib-2.0-dev'
            ;;
        sudo|sudo-*)
            defines="${defines}
${defines_nerf_restrict}"
            ;;
        skycat)
            extra_deps='libcfitsio-dev'
            ;;
        snort-common-libraries)
            extra_deps='libdaq-dev'
            ;;
        swi-prolog-core)
            extra_deps='libgmp-dev'
            ;;
        tcl-tclreadline)
            extra_deps='tcl8.6-dev'
            ;;
        tcllib)
            extra_deps='tcl8.6-dev'
            ;;
        tntnet-demos)
            extra_deps='libcxxtools-dev libtntnet-dev'
            ;;
        tcl8.6-tdbc)
            extra_deps='tcl8.6-dev'
            ;;
        ukui-panel)
            extra_deps='qtbase5-dev libgsettings-qt-dev libqt5xdg-dev'
            ;;
        weston)
            extra_deps='libweston-12-dev'
            ;;
        wx3.2-headers)
            extra_deps='libwxgtk3.2-dev'
            ;;
        xpaint)
            extra_deps='libxt-dev'
            ;;
        xserver-xorg-input-wacom)
            extra_deps='x11proto-dev'
            ;;
        xtide)
            extra_deps='libpng-dev'
            ;;
        yap)
            extra_deps='libgmp-dev'
            ;;
        yorick-gyoto)
            extra_deps='libgyoto8-dev'
            ;;
        *)
            ;;
    esac

    # Add commonly-missing base dependencies for lua, perl, python3, R packages
    # and others.
    # For instance, libpython3-dev will never hurt python3-* but it's
    # commonly missing.
    # Logic would have put that before the huge case/in/esac construct above
    # but shell script means the variables would have often be overwritten
    # unless we sprinkled thousands of X="${X} foo" everywhere.
    case "${devpkg}" in
        libmrpt-*-dev)
            extra_deps="${extra_deps} libmrpt-apps-dev libmrpt-containers-dev libmrpt-graphslam-dev libmrpt-gui-dev libmrpt-hwdrivers-dev libmrpt-img-dev libmrpt-io-dev libmrpt-maps-dev libmrpt-math-dev libmrpt-nanogui-dev libmrpt-opengl-dev libmrpt-poses-dev libmrpt-ros1bridge-dev libmrpt-serialization-dev libmrpt-slam-dev"
            ;;
        lua-*-dev)
            extra_deps="${extra_deps} liblua5.4-dev"
            # I don't know if the header isn't included at all or it it's
            # because a-c-c builds as C++ and extern "C" would be required in
            # the header; in any case, setting $preamble works well and is
            # simple (and simpler than adding extern "C" to the header)
            preamble="lua.h
${preamble}"
            # lua-cqueues-dev might require lua-compat53-dev but at the moment
            # it does not work: the paths seem wrong
            ;;
        nx-x11proto-*)
            extra_deps="${extra_deps} x11proto-dev nx-x11proto-core-dev libnx-x11-dev nx-x11proto-xfixes-dev nx-x11proto-xext-dev nx-x11proto-render-dev libx11-dev"
            preamble="X11/X.h
X11/Xlib.h
${preamble}"
            ;;
        *-perl|perl-*)
            extra_deps="${extra_deps} libperl-dev"
            preamble="EXTERN.h
perl.h
${preamble}"
            includes="${includes} /usr/lib/${multiarch}/perl/5.36.0/CORE/"
            ;;
        php8.2-*)
            extra_deps="${extra_deps} php8.2-dev"
            ;;
        python3-*|cython3*)
            extra_deps="${extra_deps} libpython3-dev"
            preamble="Python.h
${preamble}"
            ;;
        qt6-*)
            extra_deps="${extra_deps} qt6-base-dev"
            ;;
        r-*)
            extra_deps="${extra_deps} r-base-core"
            includes="${includes} /usr/share/R/include"
            defines="$defines
#define _Noreturn __attribute__ ((__noreturn__))"
            preamble="R.h
Rinternals.h
${preamble}
"
            ;;
        ruby-*)
            extra_deps="${extra_deps} ruby-dev"
            includes="${includes} /usr/include/ruby-3.1.0/"
            preamble="
ruby.h
${preamble}"
            ;;
        *)
            ;;
    esac

    # Shellcheck warns that set -e isn't propagated to apt_install and I
    # can't find a way to do it while still being able to record the
    # failure.
    # Luckily, the core of wrap_apt doesn't depend on set -e and we can
    # disable this shellcheck warning here
    # shellcheck disable=SC2310
    if ! apt_install "${devpkg}" "$devpkg_no_virtual" $extra_deps ${clippy_packages} \
                          abi-compliance-checker
    then
        result_uninstallable "$devpkg"
        # uninstallable package in unstable? skip
        continue
    fi

    headers="$(package_headers "${devpkg_no_virtual}")"
    if [[ -z "$headers" ]]; then
        result_skipped "${devpkg}" 'no header in package'
        continue
    fi

    libs=$(dpkg -L "$devpkg_no_virtual" | grep '\.so$' || true)

    if dpkg -l | grep -q 'libopenmpi-dev'; then
        includes="${includes}
/usr/lib/${multiarch}/openmpi/include/"
    fi

    case $devpkg in
        apertium-lex-tools-dev)
            includes=/usr/include/libxml2/
            ;;
        bind9-dev)
            # crazy workaround for C vs C++
            headers="/usr/lib/gcc/$multiarch/$gcc_major/include/stdatomic.h
$headers"
            ;;
        coinor-libclp-dev)
            preamble="/usr/include/coin/CoinHelperFunctions.hpp
/usr/include/coin/ClpSimplex.hpp
/usr/include/coin/OsiSolverInterface.hpp
/usr/include/coin/OsiClpSolverInterface.hpp
"
            ;;
        coinor-libipopt-dev)
            defines="#define HAVE_CSTDDEF"
            ;;
        cluster-glue-dev|libsmf-dev|libwhoopsie-dev)
            preamble=glib.h
            ;;
        kwin-dev|qcoro-qt5-dev|libluabind-dev)
            extra_args="-gcc-options -std=c++20"
            ;;
        liblog4cpp5-dev*)
            # Include _one_ of these headers in each virtual package
            case $devpkg in
                *=boostthreads)
                    preamble=/usr/include/log4cpp/threading/BoostThreads.hh ;;
                *=dummythreads)
                    preamble=/usr/include/log4cpp/threading/DummyThreads.hh ;;
                *=omnithreads)
                    preamble=/usr/include/log4cpp/threading/OmniThreads.hh ;;
                *=pthreads)
                    preamble=/usr/include/log4cpp/threading/PThreads.hh ;;
                *)
                    ;;
            esac
            # This file is referenced by other headers and defaults to PThreads
            # which prevents analyzing other headers above
            : > /usr/include/log4cpp/threading/Threading.hh
            ;;
        freerdp2-dev*)
            defines="$defines
#define _Noreturn __attribute__ ((__noreturn__))"
            preamble="string.h
freerdp2/freerdp/freerdp.h"
            ;;
        libatspi2.0-dev)
            headers="/usr/include/glib-2.0/glib-object.h
$headers"
            ;;
        libcdio-dev)
            preamble=cdio/cdio.h
            ;;
        libcephfs-dev|libgpgme-dev|libupnp-dev|libgvm-dev)
            # only compatible with LFS mode but doesn't set this itself
            defines="$defines
#define _FILE_OFFSET_BITS 64"
            ;;
        xmms2-dev)
            sed -i 's/#include "xmms_configuration\.h"//' /usr/include/xmms2/xmms/xmms_plugin.h
            ;;
        libglm-dev)
            # the upstream got confused by the vector types
            sed -i 's|vget_high_f32|vget_high_u32|g' /usr/include/glm/detail/type_vec4_simd.inl
            sed -i 's|vget_low_f32|vget_low_u32|g' /usr/include/glm/detail/type_vec4_simd.inl
            defines="$defines
#define GLM_FORCE_NEON
#define GLM_ENABLE_EXPERIMENTAL
#define GLM_CONFIG_ALIGNED_GENTYPES 1"
            extra_args="-gcc-options -march=armv7-a+neon+simd"
            ;;
        libchewing3-dev)
            preamble=chewing/global.h
            ;;
        libclucene-dev)
            preamble="tr1/functional
tr1/unordered_set
CLucene/SharedHeader.h
CLucene/debug/error.h
CLucene/analysis/standard/StandardFilter.h
CLucene/analysis/de/GermanStemmer.h"
            defines="namespace lucene { namespace util { class StringBuffer{}; } }"
            # Duplicate name
            sed -i 's/struct stemmer_encoding/struct stemmer_encoding_struct/g' /usr/include/CLucene/snowball/libstemmer/modules.h
            ;;
        libdebconfclient0-dev)
            preamble=newt.h
            # -cxx-incompatible is supposed to figure this out
            sed -i 's|struct template\b|struct permaplate|g' \
                   /usr/include/cdebconf/template.h
            ;;
        libdlmcontrol-dev)
            preamble=linux/dlm.h
            ;;
        libdmx-dev|libxv-dev|libxvmc-dev)
            preamble=X11/Xlib.h
            ;;
        libm17n-dev)
            preamble="X11/Xlib.h
m17n.h"
            ;;
        libespeak-ng-dev)
            preamble=espeak-ng/espeak_ng.h
            ;;
        libext2fs-dev)
            preamble=et/com_err.h
            ;;
        libquantlib0-dev*)
            case $devpkg in
                *=cashflows)
                    headers="$(find_headers /usr/include/ql/cashflows '*.hpp')"
                    ;;
                *=currencies)
                    headers="$(find_headers /usr/include/ql/currencies '*.hpp')"
                    ;;
                *=experimental)
                    headers="$(find_headers /usr/include/ql/experimental '*.hpp')"
                    ;;
                *=indexes)
                    headers="$(find_headers /usr/include/ql/indexes '*.hpp')"
                    ;;
                *=instruments)
                    headers="$(find_headers /usr/include/ql/instruments '*.hpp')"
                    ;;
                *=legacy)
                    headers="$(find_headers /usr/include/ql/legacy '*.hpp')"
                    ;;
                *=math)
                    headers="$(find_headers /usr/include/ql/math '*.hpp')"
                    ;;
                *=methods)
                    headers="$(find_headers /usr/include/ql/methods '*.hpp')"
                    ;;
                *=models)
                    headers="$(find_headers /usr/include/ql/models '*.hpp')"
                    ;;
                *=patterns)
                    headers="$(find_headers /usr/include/ql/patterns '*.hpp')"
                    ;;
                *=pricingengines)
                    headers="$(find_headers /usr/include/ql/pricingengines '*.hpp')"
                    ;;
                *=the-rest)
                    headers="$(find_headers /usr/include/ql/ '*.hpp' \
/usr/include/ql/cashflows \
/usr/include/ql/currencies \
/usr/include/ql/experimental \
/usr/include/ql/indexes \
/usr/include/ql/instruments \
/usr/include/ql/legacy \
/usr/include/ql/math \
/usr/include/ql/methods \
/usr/include/ql/models \
/usr/include/ql/pricingengines \
)"
                    ;;
                *)
                    echo "($devpkg) is not a known split for ${devpkg_no_virtual}"
                    exit 1
                    ;;
            esac
            ;;
        libfdt-dev)
            preamble=libfdt_env.h
            ;;
        libfontconfig-dev)
            preamble=fontconfig/fontconfig.h
            ;;
        libfuse3-dev)
            defines="#define FUSE_USE_VERSION 30
#define _Static_assert(expr, diagnostic) ;
#define _FILE_OFFSET_BITS=64"
            ;;
        libgck-1-dev|libgck-2-dev)
            defines="#define GCK_API_SUBJECT_TO_CHANGE"
            ;;
        libgcr-3-dev|libgcr-4-dev)
            defines="#define GCR_API_SUBJECT_TO_CHANGE"
            ;;
        libglib2.0-dev)
            defines="#define G_SETTINGS_ENABLE_BACKEND
$defines"
            ;;
        libglusterfs-dev)
#             # taken from glusterfs-*api*.pc
#             defines="#define _FILE_OFFSET_BITS 64
# __USE_FILE_OFFSET64
# __USE_LARGEFILE64
# $defines
# "
            defines="#define GF_LINUX_HOST_OS
            #define this __this
            #define SIZEOF_LONG 4
$defines"
urcu_patch_transparent_unions
# patch compile errors that can not be resolved otherwise
# variable-sized array in the middle of the structure
sed -i 's/char d_name\[\]/char* d_name/g' /usr/include/glusterfs/gf-dirent.h
sed -i 's/if (caa_unlikely(!cds_wfcq_enqueue(&gf_async_ctrl.queue.head/if (caa_unlikely(!cds_wfcq_enqueue({}/g' \
    /usr/include/glusterfs/async.h
# patch tirpc typedef followed by a struct
sed -i 's/typedef rp__list rpcblist;//g' \
    /usr/include/tirpc/rpc/rpcb_prot.h
sed -i 's/typedef struct rp__list rpcblist;//g' \
    /usr/include/tirpc/rpc/rpcb_prot.h
            ;;
        libgnome-bg-4-dev|libgnome-desktop-3-dev|libgnome-desktop-4-dev|libgnome-rr-4-dev)
            defines="#define GNOME_DESKTOP_USE_UNSTABLE_API"
            ;;
        libgnome-menu-3-dev|libcinnamon-menu-3-dev)
            defines="#define GMENU_I_KNOW_THIS_IS_UNSTABLE"
            ;;
        libgnomekbd-dev)
            sed -i '/^#define GKBD_TYPE_CONFIGURATION/ i G_BEGIN_DECLS' /usr/include/libgnomekbd/gkbd-configuration.h
            ;;
        libboost1.74-dev*)
            # boost is a C++-only library, defining __STDC_VERSION__ breaks stuff
            # -- common settings
            defines="#define BOOST_ENDIAN_DEPRECATED_NAMES
#define BOOST_MP_USE_QUAD
#define BOOST_CHRONO_VERSION 2
#define BOOST_SERIALIZATION_VECTOR_VERSION 4
#undef __STDC_VERSION__"
            includes="/usr/include/eigen3/
/usr/include/$multiarch/mpi/"
            preamble='iostream
/usr/include/boost/config/platform/linux.hpp
/usr/include/boost/config/compiler/gcc.hpp
/usr/include/boost/config/stdlib/libstdcpp3.hpp'
            # HACK: avoid namespace collisions
            sed -i 's|namespace mpl$|namespace mpl_09112011_1842|g' /usr/include/boost/fusion/adapted/std_tuple/tag_of.hpp
            # Fix API changes introduced in CPython v3.11
            sed -i 's|Py_TYPE(&unspecified) = &PyType_Type|Py_SET_TYPE(\&unspecified, \&PyType_Type)|g' \
                /usr/include/boost/parameter/python.hpp
            # -- per-chunk settings
            case "$devpkg" in
                *=chunk-*)
                    chunk="${devpkg##*=}"
                    headers="$(read_headers_list_file lists/boost-"${chunk}".list)"
                    # requires some weird header pre-compilation tuning
                    extra_args="-gcc-options -xc++-header"
                    ;;
                *)
                    echo "($devpkg) is not a known split for libboost1.74-dev"
                    exit 1
                    ;;
            esac
            ;;
        libxt-dev)
            preamble="X11/Xmd.h
X11/extensions/XResproto.h
X11/Xfuncproto.h
X11/Intrinsic.h
X11/IntrinsicP.h
X11/CoreP.h
X11/ConvertI.h
X11/IntrinsicI.h"
            sed -i /usr/include/X11/Intrinsic.h -e'/X11\/Xfuncproto.h/a\
#undef _X_RESTRICT_KYWD\
#define _X_RESTRICT_KYWD'
            ;;
        libkf5kio-dev|libkf5parts-dev|libkf5khtml-dev|libkf5pimcommon-dev|\
        libkf5baloowidgets-dev|libkf5mailcommon-dev|libkf5konq-dev|\
        libktorrent-dev)
            includes="/usr/lib/$multiarch/qt5/mkspecs/linux-g++-32/"
            ;;
        libkrb5-dev)
            preamble=gssrpc/types.h
            ;;
        qtbase5-private-dev*|qtbase5-private-gles-dev*)
            includes="/usr/lib/$multiarch/qt5/mkspecs/linux-g++-32/
/usr/lib/jvm/default-java/include/"
            defines="#define QT_GUI_LIB
#define QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
#define QT_NO_URL_CAST_FROM_STRING
#define QT_STRICT_ITERATORS
#define QT_USE_QSTRINGBUILDER
#define _GNU_SOURCE
#define _LARGEFILE64_SOURCE
#undef __STDC_VERSION__"
            exclude_types="_ns_flagdata"
            # strictly speaking, only required for chunk-2:
            echo "#undef ifr_name" > workaround.h
            # -- per-chunk settings
            header_list_file="$(echo "${devpkg}" | sed -e 's/-private//' -e 's/-dev=/-/' -e 's/$/.list/')"
            headers="$(read_headers_list_file "lists/${header_list_file}")"
            ;;
        qt6-base-private-dev*)
            includes="/usr/lib/$multiarch/qt6/mkspecs/linux-g++-32/"
            exclude_types="_ns_flagdata"
            defines="#define QT_GUI_LIB
#define QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
#define QT_NO_URL_CAST_FROM_STRING
#define QT_STRICT_ITERATORS
#define QT_IMPLICIT_QCHAR_CONSTRUCTION
#define _GNU_SOURCE
#define _LARGEFILE64_SOURCE
#undef QT_USE_QSTRINGBUILDER
#undef __STDC_VERSION__"
            # -- per-chunk settings
            case "$devpkg" in
                *=chunk-1)
                    echo "#undef ifr_name" > workaround.h
                    headers="$(read_headers_list_file lists/qt6-base-chunk-1.list)"
                ;;
                *=chunk-2)
                    echo "#undef ifr_name" > workaround.h
                    headers="$(read_headers_list_file lists/qt6-base-chunk-2.list)"
                ;;
                *=chunk-3)
                    headers="$(read_headers_list_file lists/qt6-base-chunk-3.list)"
                ;;
                *)
                    echo "($devpkg) is not a known split for qt6-base-private-dev"
                    exit 1
                ;;
            esac
            ;;
        libpcre2-dev)
            defines="#define PCRE2_CODE_UNIT_WIDTH 0"
            ;;
        libgstreamer-plugins-base1.0-dev)
            preamble=gstreamer-1.0/gst/gl/gstglfuncs.h
            ;;
        libxaw7-dev|libmotif-dev)
            preamble="X11/Xfuncproto.h
X11/IntrinsicP.h
X11/CoreP.h"
            sed -i /usr/include/X11/Intrinsic.h -e'/X11\/Xfuncproto.h/a\
#undef _X_RESTRICT_KYWD\
#define _X_RESTRICT_KYWD'
            ;;
        libkf5notifications-dev)
            preamble=qt5/QtWidgets/qframe.h
            ;;
        librsvg2-dev)
            preamble="glib-2.0/glib.h
librsvg/rsvg.h"
            ;;
        libhdf5-dev|libhdf5-openmpi-dev)
            preamble="hdf5/serial/H5Classes.h
hdf5/serial/H5api_adpt.h
hdf5/serial/H5version.h
hdf5/serial/H5Epublic.h
hdf5/serial/H5Include.h
hdf5/serial/H5Exception.h
hdf5/serial/H5Tpublic.h
hdf5/serial/H5IdComponent.h
hdf5/serial/H5PropList.h
hdf5/serial/H5LaccProp.h
hdf5/serial/H5DaccProp.h
hdf5/serial/H5LcreatProp.h
hdf5/serial/H5OcreatProp.h
hdf5/serial/H5DcreatProp.h
hdf5/serial/H5Location.h
hdf5/serial/H5Object.h
hdf5/serial/H5DataType.h"
            case $devpkg in
                libhdf5-openmpi-dev)
                    includes="/usr/lib/$multiarch/openmpi/include"
                    ;;
                *)
                    ;;
            esac
            ;;
        libpolkit-agent-1-dev)
            defines="#define POLKIT_AGENT_I_KNOW_API_IS_SUBJECT_TO_CHANGE"
            ;;
        yorick-dev)
            preamble=/usr/share/yorick/include/pstdio.h
            ;;
        libspdlog-dev)
            # workaround for absolutely insane a-c-c behavior (bug #1035369)
            rm -f /usr/include/spdlog/details/*-windows.h
            preamble="spdlog/details/file_helper.h
spdlog/sinks/base_sink.h
spdlog/sinks/basic_file_sink.h
spdlog/sinks/rotating_file_sink.h
spdlog/sinks/stdout_color_sinks.h
spdlog/sinks/stdout_sinks.h"
            ;;
        libgstreamer-plugins-bad1.0-dev)
            preamble=/usr/include/xcb/xcb.h
            ;;
        libvtk9-dev)
            includes="/usr/lib/jvm/default-java/include/linux/
/usr/lib/jvm/default-java/include/
/usr/include/$multiarch/mpich/
/usr/include/libxml2/"
            preamble="vector
GL/glew.h
GL/gl.h
vtk-9.1/octree/octree_node.h
vtk-9.1/octree/octree_path.h
vtk-9.1/octree/octree_iterator.h
vtk-9.1/octree/octree_cursor.h
vtk-9.1/vtkJavaUtil.h
vtk-9.1/vtksys/Configure.h
vtk-9.1/vtkfmt/core.h
"
            sed -i -e'/vtkParseAttributes/d' \
                /usr/include/vtk-9.1/vtkParseData.h
            ;;
        libtelepathy-qt5-dev)
            headers=$(find /usr/include/telepathy-qt5/ -type f '!' -name '*.h')
            ;;
        libmodplug-dev)
            preamble="stdint.h
libmodplug/stdafx.h"
            ;;
        libgoa-1.0-dev)
            defines="#define GOA_API_IS_SUBJECT_TO_CHANGE"
            ;;
        libclang-14-dev*)
            touch /usr/include/clang-tidy-config.h
            includes=/usr/include/llvm-14/
            ;;
        libclang-15-dev*)
            touch /usr/include/clang-tidy-config.h
            includes=/usr/include/llvm-15/
            ;;
        libwebkit2gtk-4.1-dev|libdevhelp-dev|libyelp-dev)
            preamble=gtk/gtk.h
            includes=/usr/include/gtk-3.0
            ;;
        libnet1-dev)
            preamble=/usr/include/libnet.h
            exclude_types=libnet_stats
            ;;
        libopus-dev)
            defines="#define restrict"
            ;;
        liborc-0.4-dev)
            defines="#define ORC_RESTRICT"
            ;;
        nlohmann-json3-dev)
            preamble="nlohmann/detail/macro_unscope.hpp
nlohmann/thirdparty/hedley/hedley.hpp"
            ;;
        libxklavier-dev)
            preamble=glib-2.0/glib-object.h
            ;;
        libcddb2-dev)
            headers=/usr/include/cddb/cddb.h
            ;;
        libgtop2-dev)
            defines="#define glibtop_debug(...)"
            ;;
        libbfio-dev)
            preamble=/usr/include/features.h
            ;;
        libforms-dev)
            preamble=forms.h
            ;;
        libfox-1.6-dev)
            headers=$(find /usr/include/fox-1.6/ -type f -name 'fx*' | sort)
            defines="#define FLOAT_MATH_FUNCTIONS"
            ;;
        libgoa-backend-1.0-dev)
            defines="#define GOA_BACKEND_API_IS_SUBJECT_TO_CHANGE
#define GOA_API_IS_SUBJECT_TO_CHANGE"
            ;;
        libgsasl-dev)
            preamble=gsasl.h
            ;;
        libgtkglext1-dev)
            preamble="gtkglext-1.0/gdk/x11/gdkglx.h
gtkglext-1.0/gdk/x11/gdkglglxext.h"
            ;;
        libgtkspell-dev)
            preamble=gtk/gtk.h
            includes=/usr/include/gtk-2.0
            ;;
        libical-dev)
            defines="#define LIBICAL_GLIB_UNSTABLE_API 1"
            preamble="glib-2.0/glib-object.h
libical/icalgauge.h"
            ;;
        erlang-dev)
            defines="#define ETHR_PTHREADS 1
#define ETHR_SIZEOF_AO_T 4"
            headers="/usr/lib/erlang/erts-13.1.5/include/internal/ethread_header_config.h
/usr/lib/erlang/erts-13.1.5/include/erl_driver.h
/usr/lib/erlang/erts-13.1.5/include/erl_drv_nif.h
/usr/lib/erlang/erts-13.1.5/include/erl_fixed_size_int_types.h
/usr/lib/erlang/erts-13.1.5/include/erl_int_sizes_config.h
/usr/lib/erlang/erts-13.1.5/include/erl_nif.h
/usr/lib/erlang/erts-13.1.5/include/internal/erl_errno.h
/usr/lib/erlang/erts-13.1.5/include/internal/erl_misc_utils.h
/usr/lib/erlang/erts-13.1.5/include/internal/erl_printf.h
/usr/lib/erlang/erts-13.1.5/include/internal/erl_printf_format.h
/usr/lib/erlang/erts-13.1.5/include/internal/ethr_mutex.h
/usr/lib/erlang/erts-13.1.5/include/internal/ethr_optimized_fallbacks.h
/usr/lib/erlang/erts-13.1.5/include/internal/ethread.h
/usr/lib/erlang/erts-13.1.5/include/internal/ethread_inline.h
/usr/lib/erlang/erts-13.1.5/include/internal/gcc/ethr_atomic.h
/usr/lib/erlang/erts-13.1.5/include/internal/gcc/ethr_dw_atomic.h
/usr/lib/erlang/erts-13.1.5/include/internal/gcc/ethr_membar.h
/usr/lib/erlang/erts-13.1.5/include/internal/gcc/ethread.h
/usr/lib/erlang/lib/erl_interface-5.3/include/ei.h
/usr/lib/erlang/lib/erl_interface-5.3/include/ei_connect.h
/usr/lib/erlang/lib/erl_interface-5.3/include/eicode.h
/usr/include/ei.h
/usr/include/ei_connect.h
/usr/include/eicode.h
/usr/include/erl_driver.h
/usr/include/erl_drv_nif.h
/usr/include/erl_fixed_size_int_types.h
/usr/include/erl_int_sizes_config.h
/usr/include/erl_nif.h"
            ;;
        libisl-dev)
            preamble=isl/arg.h
            exclude_types="isl_arg_choice
isl_arg_flags"
            ;;
        libxslt1-dev)
            preamble=xsltInternals.h
            ;;
        libsasl2-dev)
            # For some reason MD5_H is checked for by other headers in the package, but never defined in md5.h...
            defines="#define MD5_H 1"
            preamble="md5global.h
md5.h"
            ;;
        libxxf86vm-dev)
            preamble="X11/Xdefs.h
X11/Xlib.h"
            ;;
        libwrap0-dev)
            exclude_types=tcpd_context
            ;;
        libcfitsio-dev)
            preamble=fitsio.h
            ;;
        libvulkan-dev)
            preamble="directfb/directfb.h
xcb/xcb.h
X11/Xlib.h
X11/extensions/Xrandr.h"
            sed -i '2699 { /endif/ d }' '/usr/include/vulkan/vulkan_video.hpp'
            ;;
        libpolkit-gobject-1-dev)
            defines="#define _POLKIT_COMPILATION
#define _POLKIT_INSIDE_POLKIT_H"
            ;;
        libatlas-base-dev)
            preamble="clapack.h
atlas/atlas_cr2.h"
            defines="$defines
#define TYPE float
#define ATL_rone 1.0f
#define ATL_rnone -1.0f
#define ATL_rzero 0.0f
#define ATL_Cachelen 32
"
            ;;
        libbullet-dev)
            defines="#define __kernel
#define __global
#define CL_TARGET_OPENCL_VERSION 300
#define float4 b3Float4
$defines
"
preamble="
/usr/include/bullet/Bullet3Common/shared/b3PlatformDefinitions.h
/usr/include/bullet/Bullet3Common/shared/b3Float4.h
/usr/include/bullet/Bullet3Common/shared/b3Int2.h
/usr/include/bullet/Bullet3Common/shared/b3Int4.h
/usr/include/bullet/Bullet3Common/shared/b3Mat3x3.h
/usr/include/bullet/Bullet3Common/shared/b3Quat.h
/usr/include/bullet/Bullet3Common/b3AlignedAllocator.h
/usr/include/bullet/Bullet3Common/b3AlignedObjectArray.h
/usr/include/bullet/Bullet3Common/b3CommandLineArgs.h
/usr/include/bullet/Bullet3Common/b3FileUtils.h
/usr/include/bullet/Bullet3Common/b3HashMap.h
/usr/include/bullet/Bullet3Common/b3Logging.h
/usr/include/bullet/Bullet3Common/b3Matrix3x3.h
/usr/include/bullet/Bullet3Common/b3MinMax.h
/usr/include/bullet/Bullet3Common/b3PoolAllocator.h
/usr/include/bullet/Bullet3Common/b3QuadWord.h
/usr/include/bullet/Bullet3Common/b3Quaternion.h
/usr/include/bullet/Bullet3Common/b3Random.h
/usr/include/bullet/Bullet3Common/b3ResizablePool.h
/usr/include/bullet/Bullet3Common/b3StackAlloc.h
/usr/include/bullet/Bullet3Common/b3Transform.h
/usr/include/bullet/Bullet3Common/b3TransformUtil.h
/usr/include/bullet/Bullet3Common/b3Vector3.h
/usr/include/bullet/Bullet3OpenCL/NarrowphaseCollision/b3BvhInfo.h
/usr/include/bullet/Bullet3OpenCL/NarrowphaseCollision/b3QuantizedBvh.h
/usr/include/bullet/Bullet3Collision/NarrowPhaseCollision/b3Config.h
/usr/include/bullet/Bullet3Collision/NarrowPhaseCollision/shared/b3BvhSubtreeInfoData.h
/usr/include/bullet/Bullet3Collision/NarrowPhaseCollision/shared/b3BvhTraversal.h
/usr/include/bullet/Bullet3Collision/NarrowPhaseCollision/shared/b3Collidable.h
/usr/include/bullet/Bullet3Collision/NarrowPhaseCollision/shared/b3Contact4Data.h
/usr/include/bullet/Bullet3Collision/NarrowPhaseCollision/shared/b3ConvexPolyhedronData.h
/usr/include/bullet/Bullet3Collision/NarrowPhaseCollision/shared/b3FindSeparatingAxis.h
/usr/include/bullet/Bullet3Collision/NarrowPhaseCollision/shared/b3MprPenetration.h
/usr/include/bullet/Bullet3Collision/NarrowPhaseCollision/shared/b3QuantizedBvhNodeData.h
/usr/include/bullet/Bullet3Collision/NarrowPhaseCollision/shared/b3ReduceContacts.h
/usr/include/bullet/Bullet3Collision/NarrowPhaseCollision/shared/b3RigidBodyData.h
/usr/include/bullet/Bullet3Collision/NarrowPhaseCollision/shared/b3UpdateAabbs.h
/usr/include/bullet/Bullet3Collision/NarrowPhaseCollision/shared/b3ContactConvexConvexSAT.h
"
# bullet contains a lot of headers without guards
# add pragma once to avoid tweaking guard names
find /usr/include/bullet/ -type f -name '*.h' -exec sed -i '1i#pragma once' {} \;
# comment out enum that is defined in /usr/include/bullet/Bullet3OpenCL/NarrowphaseCollision/b3StridingMeshInterface.h
sed -i 's/typedef enum PHY_ScalarType/\/\*/g' /usr/include/bullet/BulletCollision/CollisionShapes/btConcaveShape.h
sed -i 's/\} PHY_ScalarType;/\*\//g' /usr/include/bullet/BulletCollision/CollisionShapes/btConcaveShape.h
# rename duplicate types
sed -i 's/NodeArray/NodeArray1/g' /usr/include/bullet/BulletCollision/BroadphaseCollision/btQuantizedBvh.h
sed -i 's/QuantizedNodeArray/QuantizedNodeArray1/g' /usr/include/bullet/BulletCollision/BroadphaseCollision/btQuantizedBvh.h
sed -i 's/BvhSubtreeInfoArray/BvhSubtreeInfoArray1/g' /usr/include/bullet/BulletCollision/BroadphaseCollision/btQuantizedBvh.h
sed -i 's/IndexedMeshArray/IndexedMeshArray1/g' /usr/include/bullet/BulletCollision/CollisionShapes/btTriangleIndexVertexArray.h
            ;;
        libavfilter-dev)
            defines="#define __STDC_CONSTANT_MACROS"
            ;;
        libunwind-dev)
            preamble=sys/types.h
            ;;
        libzip-dev)
            exclude_types=zip_stat
            ;;
        libapt-pkg-dev)
            exclude_types="_ns_flagdata
SubstVar"
            ;;
        coinor-libcoinutils-dev)
            preamble=/usr/include/coin/CoinPresolveMatrix.hpp
            ;;
        libflatpak-dev)
            preamble=/usr/include/flatpak/flatpak.h
            ;;
        libfluidsynth-dev)
            preamble=/usr/include/fluidsynth.h
            ;;
        libxxf86dga-dev|libxres-dev)
            preamble="X11/X.h
X11/Xdefs.h
X11/Xlib.h"
            ;;
        libvlc-dev)
            preamble="vlc/libvlc.h
vlc/libvlc_media.h
vlc/libvlc_events.h
vlc/libvlc_media_player.h
vlc/libvlc_media_discoverer.h"
            ;;
        libgtkmm-2.4-dev)
            preamble="/usr/include/gtkmm-2.4/gtkmm/progressbar.h
/usr/include/gtkmm-2.4/gtkmm/toggleaction.h
/usr/include/gtkmm-2.4/gtkmm/toggletoolbutton.h
/usr/include/gtkmm-2.4/gtkmm/range.h
/usr/include/gtkmm-2.4/gtkmm/recentaction.h
/usr/include/gtkmm-2.4/gtkmm/recentchooser.h
/usr/include/gtkmm-2.4/gtkmm/recentchoosermenu.h
/usr/include/gtkmm-2.4/gtkmm/recentchooserwidget.h
/usr/include/gtkmm-2.4/gtkmm/recentfilter.h
/usr/include/gtkmm-2.4/gtkmm/ruler.h
/usr/include/gtkmm-2.4/gtkmm/recentchooserdialog.h
/usr/include/gtkmm-2.4/gtkmm/recentmanager.h
/usr/include/gtkmm-2.4/gtkmm/scale.h
/usr/include/gtkmm-2.4/gtkmm/scalebutton.h
/usr/include/gtkmm-2.4/gtkmm/scrollbar.h
/usr/include/gtkmm-2.4/gtkmm/separator.h
/usr/include/gtkmm-2.4/gtkmm/separatortoolitem.h
/usr/include/gtkmm-2.4/gtkmm/socket.h
/usr/include/gtkmm-2.4/gtkmm/spinbutton.h
/usr/include/gtkmm-2.4/gtkmm/spinner.h
/usr/include/gtkmm-2.4/gtkmm/statusbar.h
/usr/include/gtkmm-2.4/gtkmm/statusicon.h
/usr/include/gtkmm-2.4/gtkmm/textchildanchor.h
/usr/include/gtkmm-2.4/gtkmm/textmark.h
/usr/include/gtkmm-2.4/gtkmm/texttag.h
/usr/include/gtkmm-2.4/gtkmm/texttagtable.h
/usr/include/gtkmm-2.4/gtkmm/textview.h
/usr/include/gtkmm-2.4/gtkmm/toolbar.h
/usr/include/gtkmm-2.4/gtkmm/toolbutton.h
/usr/include/gtkmm-2.4/gtkmm/toolitemgroup.h
/usr/include/gtkmm-2.4/gtkmm/toolpalette.h
/usr/include/gtkmm-2.4/gtkmm/toolshell.h
/usr/include/gtkmm-2.4/gtkmm/treemodelfilter.h
/usr/include/gtkmm-2.4/gtkmm/treestore.h
/usr/include/gtkmm-2.4/gtkmm/uimanager.h
/usr/include/gtkmm-2.4/gtkmm/viewport.h
/usr/include/gtkmm-2.4/gtkmm/volumebutton.h"
            ;;
        libtelepathy-glib-dev)
            preamble="glib.h
telepathy-glib/tls-certificate.h
telepathy-glib/_gen/tp-cli-tls-cert.h"
            ;;
        libosmocore-dev)
            includes=/usr/include/libusb-1.0
            preamble="stdint.h
/usr/include/talloc.h
core/linuxlist.h
gsm/protocol/gsm_08_08.h"
            ;;
        libmate-panel-applet-dev)
            preamble=glib-object.h
            ;;
        libmate-desktop-dev)
            defines="#define MATE_DESKTOP_USE_UNSTABLE_API"
            ;;
        libcdio++-dev)
            headers="/usr/include/cdio++/cdio.hpp
/usr/include/cdio++/devices.hpp"
            ;;
        libassimp-dev)
            preamble=/usr/include/assimp/Compiler/pushpack1.h
            ;;
        proftpd-dev)
            preamble="stdlib.h
proftpd/pool.h
proftpd/configdb.h
proftpd/mod_sftp/keys.h"
            defines="$defines
#define _Noreturn __attribute__ ((__noreturn__))"
            ;;
        libpurple-dev)
            preamble=libpurple/dbus-server.h
            defines="$defines
#define _Static_assert(expr, diagnostic, ...) ;"
            ;;
        libpipewire-0.3-dev|libdlib-dev|rhythmbox-dev)
            defines="$defines
#define _Static_assert(expr, diagnostic, ...) ;"
            ;;
        libgoogle-perftools-dev|libtorrent-rasterbar-dev|libradospp-dev|\
        libmeschach-dev)
            exclude_types=mallinfo2
            ;;
        libegl1-mesa-dev)
            preamble="EGL/egl.h
EGL/eglext.h"
            defines="#define EGL_EGLEXT_PROTOTYPES"
            ;;
        libstartup-notification0-dev)
            defines="#define SN_API_NOT_YET_FROZEN"
            ;;
        libgimp2.0-dev)
            defines="#define GIMP_ENABLE_CONTROLLER_UNDER_CONSTRUCTION"
            ;;
        libwebsockets-dev)
            headers="/usr/include/libwebsockets.h
/usr/include/libwebsockets/lws-dbus.h"
            exclude_types="lws_tokenize
lws_dll2_owner"
            ;;
        libwnck-3-dev)
            defines="#define WNCK_I_KNOW_THIS_IS_UNSTABLE"
            ;;
        libxkbfile-dev)
           preamble="X11/Xfuncproto.h
X11/Xlib.h
X11/extensions/XKBstr.h"
           ;;
        x11proto-dev)
           defines="$float_typedefs
#define _X_RESTRICT_KYWD"
           preamble=X11/fonts/fontstruct.h
           ;;
        libnss3-dev)
            preamble="nss/nssckmdt.h
nss/jar.h"
            ;;
        libscim-dev)
            preamble="scim-1.0/scim.h
scim-1.0/scim_config_base.h
scim-1.0/scim_module.h
scim-1.0/scim_config_module.h
scim-1.0/scim_event.h
scim-1.0/scim_attribute.h
scim-1.0/scim_lookup_table.h
scim-1.0/scim_property.h
scim-1.0/scim_socket.h
scim-1.0/scim_transaction.h
scim-1.0/scim_imengine.h"
            ;;
        libiberty-dev)
            preamble=stdint.h
            ;;
        libxcb-image0-dev)
            preamble=xcb_image.h
            ;;
        libobs-dev)
            preamble=obs/obs.h
            ;;
        liblttng-ust-dev)
            exclude_types="lttng_ust_sigbus_state
lttng_ust_tracepoint_destructors_syms
lttng_ust_tracepoint_dlopen
lttng_ust_type_array
lttng_ust_type_enum
lttng_ust_type_float
lttng_ust_type_integer
lttng_ust_type_sequence
lttng_ust_type_string
lttng_ust_type_struct
lttng_ust_urcu_gp
lttng_ust_urcu_reader"
            ;;
        libdbustest1-dev)
            preamble=libdbustest/dbus-test.h
            ;;
        libarpack2-dev)
            includes="/usr/include/$multiarch/mpi/"
            ;;
        libtbb-dev)
            defines="#define TBB_PREVIEW_BLOCKED_RANGE_ND 1
#define TBB_PREVIEW_CONCURRENT_LRU_CACHE 1
#define TBB_PREVIEW_MEMORY_POOL 1"
            preamble="oneapi/tbb/detail/_pipeline_filters.h
oneapi/tbb/detail/_waitable_atomic.h
oneapi/tbb/flow_graph.h"
            ;;
        libopenmpi-dev)
            includes="/usr/lib/$multiarch/openmpi/include
$(ls -1d /usr/lib/jvm/*openjdk*/include/ | head -1)"
            preamble="workarounds.h
mpi.h
openmpi/ompi_config.h
openmpi/opal_config.h
openmpi/ompi/mpi/cxx/mpicxx.h
/usr/lib/$multiarch/openmpi/include/openmpi/opal/mca/event/event.h
/usr/lib/$multiarch/openmpi/include/openmpi/opal/mca/event/external/external.h
event2/event_struct.h"
            defines="#define DO_DEBUG(INST)"
            ;;
        libgdal-dev)
            preamble=/usr/include/zlib.h
            ;;
        fcitx-libs-dev)
            preamble=/usr/include/dbus-1.0/dbus/dbus.h
            includes=/usr/include/cairo
            ;;
        libhiredis-dev)
            preamble=glib-2.0/glib.h
            # taken from hiredis.pc
            defines="$defines
#define _FILE_OFFSET_BITS=64"
            ;;
        libsnmp-dev)
            preamble="
net-snmp/net-snmp-config.h
net-snmp/library/container.h
net-snmp/agent/snmp_agent.h
net-snmp/agent/agent_handler.h
net-snmp/agent/snmp_vars.h
net-snmp/agent/var_struct.h"
            defines="$defines
#define _Noreturn
#define UCD_COMPATIBLE"
            ;;
        libkf5akonadisearch-dev|libxapian-dev)
            preamble=xapian.h
            ;;
        libkf5kdelibs4support-dev)
            includes="/usr/lib/$multiarch/qt5/mkspecs/linux-g++-32/
/usr/include/KF5/KNewStuff3/"
            preamble=/usr/include/KF5/KParts/kparts/readwritepart.h
            ;;
        libmatio-dev)
            defines="$defines
#define _Noreturn"
            ;;
        libmpg123-dev)
            defines="#define MPG123_RESTRICT"
            exclude_types="mpg123_fmt"
            ;;
        libsmbclient-dev|libfuse-dev)
            defines="#define _FILE_OFFSET_BITS 64"
            exclude_types="statfs
statfs64
statvfs
statvfs64"
            ;;
        libosmium2-dev|libsquashfuse-dev)
            exclude_types="statvfs
statvfs64"
             ;;
        firebird-dev)
            preamble="cstdint
firebird/Interface.h"
            ;;
        apache2-dev)
            preamble=apr-1.0/apr_dbd.h
            ;;
        libwxgtk3.2-dev)
            headers="$(package_headers 'wx3.2-headers')"
            defines="#define _FILE_OFFSET_BITS 64
#define WXUSINGDLL
#define __WXGTK__"
            preamble="wx/setup.h
wx/fontmap.h
wx/headerctrl.h
wx/hyperlink.h
wx/infobar.h
wx/msgdlg.h
wx/notifmsg.h
wx/progdlg.h
wx/richmsgdlg.h
wx/spinctrl.h
wx/srchctrl.h
wx/timectrl.h
wx/wizard.h
gtk/gtk.h
wx/popupwin.h
wx/radiobox.h
wx/radiobut.h
wx/scrolbar.h
wx/slider.h
wx/statbox.h
wx/statline.h
wx/taskbar.h
wx/tglbtn.h
wx/richtext/richtextbuffer.h
wx/taskbar.h"
            ;;
        libselinux1-dev)
            exclude_types=avc_cache_stats
            ;;
        qt6-base-dev)
            preamble="
GLES2/gl2.h
khronos-api/GLES2/gl2ext.h"
            ;;
        libxfont-dev)
            preamble=X11/fonts/fontstruct.h
            ;;
        libyaz-dev)
            defines="#define YAZ_HAVE_XML2 1
$defines"
            ;;
        libwlroots-dev)
            defines="$defines
#define WLR_USE_UNSTABLE"
            preamble=pixman-1/pixman.h
            exclude_types="wl_buffer_interface
wl_compositor_interface
wl_data_device_interface
wl_data_device_manager_interface
wl_data_offer_interface
wl_data_source_interface
wl_display_interface
wl_keyboard_interface
wl_output_interface
wl_pointer_interface
wl_region_interface
wl_registry_interface
wl_seat_interface
wl_shell_interface
wl_shell_surface_interface
wl_shm_interface
wl_shm_pool_interface
wl_subcompositor_interface
wl_subsurface_interface
wl_surface_interface
wl_touch_interface"
            sed -i -e's/static \([0-9]\+\)/\1/g' \
                   /usr/include/wlr/render/wlr_renderer.h \
                   /usr/include/wlr/render/interface.h \
                   /usr/include/wlr/types/wlr_matrix.h \
                   /usr/include/wlr/types/wlr_scene.h
            ;;
        libvarnishapi-dev)
            preamble="sys/socket.h
varnish/cache/cache.h"
            sed -i -e'/^#.*error.*included/d' \
                /usr/include/varnish/cache/cache.h /usr/include/varnish/vrt.h
            ;;
        liburcu-dev)
            preamble="/usr/include/$multiarch/urcu.h"
            exclude_types="urcu_bp_gp
urcu_bp_reader
urcu_qsbr_reader"
            urcu_patch_transparent_unions
            ;;
        libsensor-msgs-dev)
            preamble=/usr/include/sensor_msgs/point_cloud2_iterator.h
            ;;
        libomxil-bellagio-dev)
            preamble=pthread.h
            ;;
        libopenipmi-dev)
            preamble=/usr/include/OpenIPMI/ipmiif.h
            exclude_types="_ns_flagdata"
            ;;
        libflint-dev|libflint-arb-dev)
            # The headers try to use "_Thread_local" which doesn't exist/isn't
            # found (because maybe it's for C rather than C++ ?) but rather
            # than making _Thread_local available, we can simply skip it since
            # it has no impact on the library's ABI
            sed -i 's/\<FLINT_USES_TLS\>/0/' /usr/include/flint/flint.h
            sed -i '/#include "fmpz_mod_poly.h"/ a #include "fmpz_mod_polyxx.h"' /usr/include/flint/fmpz_mod_poly_factorxx.h
            ;;
        libscotch-dev)
            preamble=scotch/scotch.h
            ;;
        libgeotiff-dev)
            preamble="geotiff/geotiffio.h
geotiff/geo_tiffp.h"
            ;;
        libenet-dev)
            preamble=enet/enet.h
            ;;
        librdkafka-dev)
            exclude_types=rd_kafka_metadata
            ;;
        libspandsp-dev)
            preamble="inttypes.h
spandsp/telephony.h
spandsp/complex.h
spandsp/test_utils.h"
            ;;
        libsoxr-dev)
            exclude_types="soxr_io_spec
soxr_quality_spec
soxr_runtime_spec"
            ;;
        libotr5-dev)
            preamble="cstddef
libotr/tlv.h
libotr/proto.h"
            ;;
        libpoco-dev)
            defines="$defines
#define POCO_NO_WINDOWS_H"
            preamble="Poco/Net/PollSet.h
Poco/Net/UDPHandler.h
Poco/Net/UDPServerParams.h
Poco/Net/UDPSocketReader.h"
            ;;
        libplymouth-dev)
            exclude_types=ply_keymap_metadata
            ;;
        libnfs-dev)
            preamble=nfsc/libnfs.h
            ;;
        libzbar-dev)
            preamble=zbar.h
            ;;
        libspatialite-dev)
            preamble="sqlite3.h
spatialite.h"
            ;;
        libproc2-dev)
            sed -i 's/"C "/"C"/' \
                /usr/include/libproc2/slabinfo.h
            ;;
        libpangomm-1.4-dev)
            preamble=pangomm-1.4/pangomm/renderer.h
            ;;
        libosmo-netif-dev)
            preamble="stdint.h
sys/socket.h
linux/sctp.h"
            ;;
        libvlccore-dev)
            defines="#define N_(str) str
#define restrict"
            preamble="vlc/plugins/vlc_common.h
gcrypt.h"
            ;;
        xserver-xorg-dev)
           defines="$float_typedefs
#define _X_RESTRICT_KYWD"
            preamble="X11/Xfuncproto.h
X11/extensions/XIproto.h
X11/fonts/font.h
xorg/dix.h
xorg/xf86str.h
xorg/xorg-server.h
xorg/sarea.h"
            sed -i -e's/\b\(xor\|and\)\b/\1dior/g' /usr/include/xorg/fb.h
            ;;
        libhdf4-alt-dev)
            preamble="hdf/hdfi.h
hdf/hfile.h"
            ;;
        libaudio-dev)
            preamble="X11/Intrinsic.h
audio/audiolib.h"
            ;;
        glslang-dev)
            preamble=workarounds.h
            defines="#ifdef PACKED
#undef PACKED
#endif"
            ;;
        ppp-dev)
            # fsm.h needs to be included before ccp.h and ecp.h
            preamble="pppd/pppd.h
pppd/fsm.h"
            defines="$defines
#define INET6
#define _Noreturn __attribute__ ((__noreturn__))"
            ;;
        libqtdbusmock1-dev)
            # Declare type to work around error: macro "Q_DECLARE_METATYPE" passed 2 arguments, but takes just 1
            sed -i 's/Q_DECLARE_METATYPE(QMap<QString,QVariantMap>)/typedef QMap<QString,QVariantMap> QMapQStringQVariantMap;\nQ_DECLARE_METATYPE(QMapQStringQVariantMap)/' \
                /usr/include/libqtdbusmock-1/libqtdbusmock/DeclareMetatypes.h
            ;;
        libticcutils-dev)
            printf "#define VERSION \"0.24\"\n#define PACKAGE_NAME \"ticcutils\"\n" > /usr/include/ticcutils/config.h
            ;;
        xaw3dg-dev)
            defines="$float_typedefs
#define _X_RESTRICT_KYWD"
            preamble=X11/Xmu/WidgetNode.h
            ;;
        libax25-dev)
            preamble=netax25/ax25.h
            # Fix typo
            sed -i "s/ _cplusplus/ __cplusplus/g" /usr/include/netax25/procutils.h
            ;;
        libxmlsec1-dev)
            defines="#define IN_XMLSEC"
            includes=/usr/include/xmlsec1
            ;;
        libzzip-dev)
            echo '#define ZZIP_GNUC_CONST __attribute__((__const__))
#define ZZIP_GNUC_DEPRECATED __attribute__((deprecated))
#define ZZIP_GNUC_PACKED __attribute__((packed))
' > /usr/include/zzip/__hints.h
            # Fix closing extern C bracket
            sed -zi "s@extern \"C\" {\n}@}@" /usr/include/zzip/fseeko.h
            ;;
        libtspi-dev)
            preamble="tss/platform.h
tss/tss_structs.h"
            ;;
        libopencc-dev)
            sed -i '1i #pragma once' /usr/include/opencc/UTF8StringSlice.hpp
            ;;
        nordugrid-arc-dev)
            sed -i '1i #pragma once' /usr/include/arc/security/ArcPDP/Result.h
            ;;
        libopenbabel-dev)
            preamble="LBFGS/Param.h
openbabel/stereo/squareplanar.h
openbabel/stereo/cistrans.h
openbabel/stereo/tetrahedral.h"
            ;;
        octave-dev)
            defines="#ifndef HAVE_ZLIB
#define HAVE_ZLIB 1
#endif"
            preamble="memory
zlib.h
octave/mxarray.h"
            ;;
        libhfst-dev)
            preamble=hfst/HfstTransducer.h
            ;;
        libpari-dev)
            exclude_types=pari_mainstack
            ;;
        libnode-dev)
            preamble=nodejs/src/util.h
            defines="#define V8_TARGET_ARCH_ARM
#define NODE_WANT_INTERNALS 1
#define HAVE_INSPECTOR 1
#define __POSIX__ 1"
            exclude_types=_ns_flagdata
            ;;
        libneon27-dev)
            exclude_types=ne_lock
            ;;
        liboctomap-dev)
            sed -i '1i #pragma once' /usr/include/octomap/MapNode.hxx \
                /usr/include/octomap/OcTreeBaseImpl.hxx \
                /usr/include/octomap/MapCollection.hxx \
                /usr/include/octomap/OcTreeDataNode.hxx \
                /usr/include/octomap/OccupancyOcTreeBase.hxx
            ;;
        tk-itk4-dev)
            sed -i '1i #pragma once' \
                /usr/include/itcl/itk-private/generic/itk.h \
                /usr/include/itcl/itk-private/generic/itkDecls.h \
                /usr/include/itcl/itk-private/generic/itkInt.h \
                /usr/include/itcl/itk-private/generic/itkIntDecls.h \
                /usr/include/itcl/itk.h \
                /usr/include/itcl/itkInt.h
            ;;
        tkblt-dev)
            sed -i '1i #pragma once' \
                /usr/include/tkbltDecls.h
            ;;
        libhdf4-dev)
            preamble="hdf/hdfi.h
hdf/hfile.h"
            ;;
        libgda-5.0-dev)
            preamble="libgda-5.0/libgda/gda-transaction-status.h
libgda-report/gda-report-engine.h"
            ;;
        libfstrm-dev)
            preamble=fstrm.h
            ;;
        libfeedback-dev)
            defines="#define LIBFEEDBACK_USE_UNSTABLE_API"
            ;;
        libcdd-dev)
            preamble=cddlib/setoper.h
            sed -i '1i#pragma once' /usr/include/cddlib/*.h
            ;;
        libbulletml-dev)
            preamble=bulletml/bulletmlparser.h
            ;;
        libgavl-dev)
            preamble="inttypes.h
gavl/gavl.h
GL/gl.h
va/va.h"
            ;;
        libibmad-dev)
            exclude_types=ib_vendor_call
            ;;
        libodb-dev)
            preamble=odb/tr1/memory.hxx
            ;;
        iraf-dev)
            defines="#define XINT            int
#define XLONG           int
#define XCHAR           short
#define XSHORT          short"
            preamble='/usr/include/stdlib.h'
            sed -i 's|handle_t new|handle_t new_|' /usr/lib/iraf/include/votParse.h
            # sed -i 's|char \*template|char *template_|' /usr/lib/iraf/unix/hlib/libc/libc.h
            ;;
        libargtable2-dev)
            preamble='/usr/include/argtable2.h
workarounds.h'
            ;;
        libplib-dev)
            preamble=plib/pw.h
            ;;
        librtmp-dev)
            preamble=stddef.h
            ;;
        librbd-dev)
            exclude_types=mallinfo2
            preamble=/usr/include/features.h
            ;;
        libquicktime-dev)
            preamble=quicktime.h
            ;;
        libprelude-dev)
            defines="#define PRELUDE_ALIGNED_ACCESS"
            ;;
        libpqxx-dev)
            preamble="pqxx/pipeline.hxx
pqxx/stream_from.hxx
pqxx/stream_to.hxx
pqxx/tablewriter.hxx
pqxx/subtransaction.hxx"
            ;;
        libpodofo-dev)
            defines="#define BUILDING_PODOFO"
            preamble=fontconfig/fontconfig.h
            ;;
        libplplot-dev)
            preamble="plplot/plplotP.h
plplot/qt.h"
            ;;
        libsphinxbase-dev)
            sed -i 's/^extern "C"$/& {/' \
                "/usr/include/$multiarch/sphinxbase/yin.h"
            ;;
        libmate-menu-dev)
            defines="#define MATEMENU_I_KNOW_THIS_IS_UNSTABLE"
            ;;
        lua-lpeg-dev)
            headers=/usr/include/lua5.1/lua-lpeg.h
            defines="class lua_State;
$defines"
            ;;
        libzim-dev)
            defines="#undef unix
$defines"
            ;;
        libxsimd-dev)
            headers=/usr/include/xsimd/xsimd.hpp
            ;;
        libstaden-read-dev)
            preamble=io_lib/ztr.h
            ;;
        libsundials-dev)
            includes="/usr/lib/$multiarch/openmpi/include"
            ;;
        liblpsolve55-dev)
            defines="#define LPSOLVEAPIFROMLIBDEF"
            preamble=lpsolve/lp_types.h
            ;;
        libflann-dev)
            includes="/usr/include/hdf5/openmpi
/usr/lib/$multiarch/openmpi/include"
            preamble=workarounds.h
            ;;
        libfm-qt-dev)
            defines="#define QT_NO_SIGNALS_SLOTS_KEYWORDS"
            ;;
        libwebrtc-audio-processing-dev)
            defines="#define WEBRTC_POSIX
#define WEBRTC_AUDIO_PROCESSING_ONLY_BUILD"
            ;;
        libwbclient-dev)
            exclude_types="wbcDomainInfo
wbcInterfaceDetails
wbcLibraryDetails"
            ;;
        libstk-dev)
            defines="#define __OS_LINUX__"
            ;;
        libticonv-dev|libtifiles-dev)
            defines="#define restrict"
            ;;
        libjellyfish-2.0-dev)
            preamble=ostream
            ;;
        libdirectfb-dev)
            preamble="++dfb.h
workarounds.h"
            ;;
        libcinnamon-desktop-dev)
            defines="#define GNOME_DESKTOP_USE_UNSTABLE_API
/* The enum header only works in C but we can't force C, the request is ignore, so hack around it*/
#define __CDesktop_enums_h__
typedef int CDesktopBackgroundStyle;
typedef int CDesktopBackgroundShading;
typedef CDesktopBackgroundStyle;
typedef int CDesktopBackgroundShading;
#"
            ;;
        libcifpp-dev)
            preamble=cif++/exports.hpp
            ;;
        libbg-dev)
            preamble=workarounds.h
            exclude_types=dns_mx
            ;;
        libantlr3c-dev)
            exclude_types="mallinfo2
_ns_flagdata"
            ;;
        gauche-dev)
            preamble=gauche.h
            ;;
        libdumbnet-dev)
            preamble=dumbnet.h
            ;;
        xfslibs-dev)
            headers=/usr/include/xfs/handle.h
            ;;
        libarmadillo-dev)
            sed -i '1i#pragma once' /usr/include/armadillo_bits/*.hpp
            preamble=armadillo
            ;;
        qtwayland5-private-dev)
            preamble="qt5/QtWaylandCompositor/qwaylandtextinput.h
qt5/QtWaylandCompositor/5.15.10/QtWaylandCompositor/private/qwaylandtextinput_p.h
qt5/QtWaylandCompositor/5.15.10/QtWaylandCompositor/private/qwaylandinputmethodcontrol_p.h
qt5/QtWaylandCompositor/qwaylandshellsurface.h"
            ;;
        libwnck-dev)
            defines="#define WNCK_I_KNOW_THIS_IS_UNSTABLE"
            ;;
        libwolfssl-dev)
            preamble=wolfssl/options.h
            ;;
        libkmflcomp-dev|libcmocka-dev)
            preamble=setjmp.h
            ;;
        libhackrf-dev)
            exclude_types=hackrf_device_list
            ;;
        libqhull-dev)
            patch_qhull
            preamble="/usr/include/libqhull/libqhull.h"
            ;;
        libguestfs-dev)
            exclude_types="guestfs_add_domain_argv
guestfs_add_drive_opts_argv
guestfs_add_drive_scratch_argv
guestfs_add_libvirt_dom_argv
guestfs_aug_transform_argv
guestfs_btrfs_filesystem_defragment_argv
guestfs_btrfs_filesystem_resize_argv
guestfs_btrfs_fsck_argv
guestfs_btrfs_image_argv
guestfs_btrfs_subvolume_create_opts_argv
guestfs_btrfs_subvolume_snapshot_opts_argv
guestfs_compress_device_out_argv
guestfs_compress_out_argv
guestfs_copy_attributes_argv
guestfs_copy_device_to_device_argv
guestfs_copy_device_to_file_argv
guestfs_copy_file_to_device_argv
guestfs_copy_file_to_file_argv
guestfs_cpio_out_argv
guestfs_cryptsetup_open_argv
guestfs_disk_create_argv
guestfs_download_blocks_argv
guestfs_e2fsck_argv
guestfs_fstrim_argv
guestfs_glob_expand_opts_argv
guestfs_grep_opts_argv
guestfs_hivex_open_argv
guestfs_inspect_get_icon_argv
guestfs_is_blockdev_opts_argv
guestfs_is_chardev_opts_argv
guestfs_is_dir_opts_argv
guestfs_is_fifo_opts_argv
guestfs_is_file_opts_argv
guestfs_is_socket_opts_argv
guestfs_isoinfo
guestfs_md_create_argv
guestfs_mke2fs_argv
guestfs_mkfs_btrfs_argv
guestfs_mkfs_opts_argv
guestfs_mksquashfs_argv
guestfs_mkswap_opts_argv
guestfs_mktemp_argv
guestfs_mount_9p_argv
guestfs_mount_local_argv
guestfs_ntfsclone_out_argv
guestfs_ntfsfix_argv
guestfs_ntfsresize_opts_argv
guestfs_remount_argv
guestfs_rsync_argv
guestfs_rsync_in_argv
guestfs_rsync_out_argv
guestfs_selinux_relabel_argv
guestfs_set_e2attrs_argv
guestfs_stat
guestfs_statns
guestfs_statvfs
guestfs_syslinux_argv
guestfs_tar_in_opts_argv
guestfs_tar_out_opts_argv
guestfs_tune2fs_argv
guestfs_umount_local_argv
guestfs_umount_opts_argv
guestfs_utsname
guestfs_version
guestfs_xfs_admin_argv
guestfs_xfs_growfs_argv
guestfs_xfs_repair_argv"
        ;;
        ntfs-3g-dev)
            preamble="/usr/include/ntfs-3g/layout.h"
            defines="#define __timespec_defined
#define HAVE_DAEMON"
            ;;
        libido3-0.1-dev)
            # unmatched curly brace. Probably those headers are supposed
            # to be compiled as C-only code
            sed -i 's/G_END_DECLS//g' /usr/include/libido3-0.1/libido/idomessagedialog.h
            preamble="/usr/include/libido3-0.1/libido/libido.h"
            ;;
        libniftiio-dev*)
            case "$devpkg" in
                *=nifti-1)
                    headers="/usr/include/nifti/nifti1_io.h"
                    ;;
                *=nifti-2)
                    headers="/usr/include/nifti/nifti2_io.h"
                    ;;
                *)
                    echo "($devpkg) is not a known split for libniftiio-dev"
                    exit 1
                ;;
            esac
            ;;
        llvm-1?-dev*)
            defines="#define DEBUG_TYPE \"test\"
$defines"
            includes="/usr/src/googletest"
            llvm_version="$(llvm_version_of_devpkg_no_virtual "${devpkg_no_virtual}")"
            case "$devpkg" in
                *=code)
                    headers="$(find_headers /usr/include/llvm-${llvm_version}/llvm/CodeGen/ '*.h')"
                    ;;
                *=debug)
                    headers="$(find_headers /usr/include/llvm-${llvm_version}/llvm/DebugInfo/ '*.h')"
                    headers="$(move_to_back /usr/include/llvm-${llvm_version}/llvm/DebugInfo/GSYM/DwarfTransformer.h $headers)"
                    ;;
                *=analytics)
                    headers="$(find_headers /usr/include/llvm-${llvm_version}/llvm/Analysis/ '*.h')"
                    ;;
                *=transforms)
                    headers="/usr/include/llvm-${llvm_version}/llvm/LinkAllPasses.h"
                    headers="$headers $(find_headers /usr/include/llvm-${llvm_version}/llvm/Transforms/ '*')"
                    headers="$(move_to_back /usr/include/llvm-${llvm_version}/llvm/Transforms/Utils/InstructionWorklist.h $headers)"
                    ;;
                *=execution-engine)
                    headers="$(find_headers /usr/include/llvm-${llvm_version}/llvm/ExecutionEngine/ '*.h')"
                    ;;
                *=the-rest)
                    headers="$(find_headers /usr/include/llvm-${llvm_version}/ '*.h' \
/usr/include/llvm-${llvm_version}/llvm/CodeGen \
/usr/include/llvm-${llvm_version}/llvm/Analysis \
/usr/include/llvm-${llvm_version}/llvm/DebugInfo \
/usr/include/llvm-${llvm_version}/llvm/Transforms \
/usr/include/llvm-${llvm_version}/llvm/ExecutionEngine)"
                    headers="$(move_to_back /usr/include/llvm-${llvm_version}/llvm/Analysis/InstructionSimplify.h $headers)"
                    headers="$(skip_header /usr/include/llvm-${llvm_version}/llvm/LinkAllPasses.h $headers)"
                    ;;
                *)
                    echo "($devpkg) is not a known split for llvm-${llvm_version}-dev"
                    exit 1
                    ;;
            esac
            ;;
        libmlir-1?-dev*)
            defines="#define _Static_assert(...); \
$defines"
            llvm_version="$(llvm_version_of_devpkg_no_virtual "${devpkg_no_virtual}")"
            mlir_include_dir="/usr/lib/llvm-${llvm_version}/include/mlir"
            case $devpkg in
                *=dialect)
                    headers="$(find_headers ${mlir_include_dir}/Dialect/ '*.h' \
${mlir_include_dir}/Dialect/GPU \
${mlir_include_dir}/Dialect/LLVMIR \
${mlir_include_dir}/Dialect/Tosa \
${mlir_include_dir}/Dialect/SPIRV \
${mlir_include_dir}/Dialect/Linalg)"
                    ;;
                *=dialect-linalg)
                    headers="$(find_headers ${mlir_include_dir}/Dialect/Linalg '*.h')"
                    ;;
                *=dialect-gpu)
                    headers="$(find_headers ${mlir_include_dir}/Dialect/GPU '*.h')"
                    ;;
                *=dialect-llvmir)
                    headers="$(find_headers ${mlir_include_dir}/Dialect/LLVMIR '*.h')"
                    ;;
                *=dialect-tosa)
                    headers="$(find_headers ${mlir_include_dir}/Dialect/Tosa '*.h')"
                    ;;
                *=dialect-spirv)
                    headers="$(find_headers ${mlir_include_dir}/Dialect/SPIRV '*.h')"
                    ;;
                *=support)
                    headers="${mlir_include_dir}/InitAllTranslations.h"
                    headers="$headers
                        $(find_headers ${mlir_include_dir}/Support/ '*.h')"
                    headers="$headers
                        $(find_headers ${mlir_include_dir}/Tools/ '*.h')"
                    ;;
                *=all-dialects)
                    headers="${mlir_include_dir}/InitAllDialects.h"
                    ;;
                *=mlir)
                    headers="$(find_headers ${mlir_include_dir}/ '*.h' \
${mlir_include_dir}/Dialect \
${mlir_include_dir}/Support \
${mlir_include_dir}/Tools)"
                    headers="$(move_to_back ${mlir_include_dir}/Bindings/Python/PybindAdaptors.h $headers)"
                    headers="$(skip_header ${mlir_include_dir}/InitAllDialects.h $headers)"
                    headers="$(skip_header ${mlir_include_dir}/InitAllTranslations.h $headers)"
                    ;;
                *=mlir-c)
                    headers="$(find_headers ${mlir_include_dir}-c/ '*.h')"
                    ;;
                *)
                    echo "($devpkg) is not a known split for ${devpkg_no_virtual}"
                    exit 1
                    ;;
            esac
            ;;
        libmapnik-dev*)
            case $devpkg in
                *=base)
                    headers="$(find_headers /usr/include/mapnik/ '*')"
                    headers="$(skip_header /usr/include/mapnik/svg/geometry_svg_generator.hpp $headers)"
                    # mapnik/geometry_container.hpp is missing from the package. This header is unusable
                    headers="$(skip_header /usr/include/mapnik/util/geometry_to_svg.hpp $headers)"
                    ;;
                *=svg1)
                    headers="/usr/include/mapnik/svg/geometry_svg_generator.hpp"
                    ;;
                *)
                    echo "($devpkg) is not a known split for libmapnik-dev"
                    exit 1
                    ;;
            esac
            ;;
        libogre-1.12-dev*|libogre-1.9-dev*)
            case $devpkg in
                *=plugins)
                    headers="$(find_headers /usr/include/OGRE/Plugins/ '*.h')"
                    ;;
                *=gl)
                    preamble="/usr/include/OGRE/RenderSystems/GL/ts1.0_inst.h
/usr/include/OGRE/RenderSystems/GL/ts1.0_inst_list.h
/usr/include/OGRE/RenderSystems/GL/vs1.0_inst.h
/usr/include/OGRE/RenderSystems/GL/vs1.0_inst_list.h"
                    headers="$(find_headers /usr/include/OGRE/RenderSystems/GL/ '*.h')"
                    ;;
                *=gles2)
                    preamble="/usr/include/OGRE/OgrePixelFormat.h"
                    headers="$(find_headers /usr/include/OGRE/RenderSystems/GLES2/ '*.h')"
                    # does not compile, see https://github.com/OGRECave/ogre/issues/1712
                    headers="$(skip_header /usr/include/OGRE/RenderSystems/GLES2/GLSLES/OgreGLSLESCgProgramFactory.h $headers)"
                    ;;
                *=gl3plus)
                    headers="$(find_headers /usr/include/OGRE/RenderSystems/GL3Plus/ '*.h')"
                    ;;
                *=the-rest)
                    headers="$(find_headers /usr/include/OGRE/Plugins/ '*.h' \
/usr/include/OGRE/Plugins \
/usr/include/OGRE/RenderSystems)"
                    ;;
                *)
                    echo "($devpkg) is not a known split for ${devpkg_no_virtual}"
                    exit 1
                    ;;
            esac
            ;;
        libhypre-dev)
            # define types from the missing headers
            defines="typedef void *HYPRE_DistributedMatrix;
typedef void *HYPRE_DistributedMatrixPilutSolver;
typedef void *hypre_ParMultiVector;
$defines"
            # windows development artifact
            sed -i 's/seq_Multivector\.h/seq_multivector\.h/g' /usr/include/hypre/par_multivector.h
            # missing headers
            sed -i 's/HYPRE_distributed_matrix_mv\.h/stdint\.h/g'  /usr/include/hypre/distributed_matrix.h
            sed -i 's/internal_protos\.h/stdint\.h/g'  /usr/include/hypre/distributed_matrix.h
            # alternative to virtual package, rename duplicate function
            sed -i 's/hypre_ParMultiVectorCreate/hypre_ParMultiVectorCreate2/g' /usr/include/hypre/_hypre_parcsr_mv.h
            preamble="/usr/include/hypre/HYPRE_utilities.h
/usr/include/hypre/distributed_matrix.h
/usr/include/hypre/par_multivector.h
"
            ;;
        libctl-dev)
            preamble=ctlgeom.h
            ;;
        libcryptui-dev)
            defines="#define LIBCRYPTUI_API_SUBJECT_TO_CHANGE"
            ;;
        libbson-dev)
            defines="#define BSON_INSIDE
#define BSON_COMPILATION"
            ;;
        libcpp-httplib-dev)
            exclude_types=_ns_flagdata
            ;;
        libefl-all-dev)
            defines="#define ELM_INTERNAL_API_ARGESFSDFEFC
#define EFL_BETA_API_SUPPORT"
            exclude_types="wl_buffer_interface
wl_compositor_interface
wl_data_device_interface
wl_data_device_manager_interface
wl_data_offer_interface
wl_data_source_interface
wl_display_interface
wl_keyboard_interface
wl_output_interface
wl_pointer_interface
wl_region_interface
wl_registry_interface
wl_seat_interface
wl_shell_interface
wl_shell_surface_interface
wl_shm_interface
wl_shm_pool_interface
wl_subcompositor_interface
wl_subsurface_interface
wl_surface_interface
wl_touch_interface"
            preamble="eo-1/Eo.h
eina-1/eina/eina_list.h
ecore-wl2-1/Ecore_Wl2.h
elementary-1/Elementary.h
elementary-1/elm_code_common.h
elementary-1/elm_code_line.h
elementary-1/elm_code_file.h
elementary-1/elm_widget.h
elementary-1/elm_gen_common.h
elementary-1/efl_ui_textpath.eo.h
edje-1/Edje.h
edje-1/efl_canvas_layout_part_invalid.eo.h
"
            # Dozens of headers lack the guard
            sed -i '1i#pragma once' /usr/include/edje-1/*.h /usr/include/eio-1/*.h \
                /usr/include/evas-1/canvas/*.h /usr/include/evas-1/*.h /usr/include/elementary-1/*.h
            # Only legacy headers are available
            sed -i 's/\(elm_widget_item_container_eo\)\.h/\1.legacy.h/g' /usr/include/elementary-1/elm_widget.h
            sed -i 's/\(elm_widget_item_eo\)\.h/\1.legacy.h/g' /usr/include/elementary-1/elm_widget.h
            sed -i 's/\(elm_multibuttonentry_item_eo\)\.h/\1.legacy.h/g' /usr/include/elementary-1/elc_multibuttonentry_eo.h
            sed -i 's/\(elm_multibuttonentry_eo\)\.h/\1.legacy.h/g' /usr/include/elementary-1/elc_multibuttonentry_eo.h
            sed -i 's/\(elm_color_item_eo\)\.h/\1.legacy.h/g' /usr/include/elementary-1/elm_widget_colorselector.h
            sed -i 's/\(elm_colorselector_eo\)\.h/\1.legacy.h/g' /usr/include/elementary-1/elm_widget_colorselector.h
            sed -i 's/\(elm_dayselector_item_eo\)\.h/\1.legacy.h/g' /usr/include/elementary-1/elm_widget_dayselector.h
            sed -i 's/\(elm_dayselector_eo\)\.h/\1.legacy.h/g' /usr/include/elementary-1/elm_widget_dayselector.h
            sed -i 's/\(elm_glview_eo\)\.h/\1.legacy.h/g' /usr/include/elementary-1/elm_widget_glview.h
            sed -i 's/\(elm_hover_eo\)\.h/\1.legacy.h/g' /usr/include/elementary-1/elm_widget_hover.h /usr/include/elementary-1/elm_widget_menu.h
            sed -i 's/\(elm_index_item_eo\)\.h/\1.legacy.h/g' /usr/include/elementary-1/elm_widget_index.h
            sed -i 's/\(elm_index_eo\)\.h/\1.legacy.h/g' /usr/include/elementary-1/elm_widget_index.h
            sed -i 's/\(elm_label_eo\)\.h/\1.legacy.h/g' /usr/include/elementary-1/elm_widget_label.h
            sed -i 's/\(elm_list_eo\)\.h/\1.legacy.h/g' /usr/include/elementary-1/elm_widget_list.h
            sed -i 's/\(elm_list_item_eo\)\.h/\1.legacy.h/g' /usr/include/elementary-1/elm_widget_list.h
            sed -i 's/\(elm_menu_eo\)\.h/\1.legacy.h/g' /usr/include/elementary-1/elm_widget_menu.h
            sed -i 's/\(elm_menu_item_eo\)\.h/\1.legacy.h/g' /usr/include/elementary-1/elm_widget_menu.h
            sed -i 's/\(elm_notify_eo\)\.h/\1.legacy.h/g' /usr/include/elementary-1/elm_widget_notify.h /usr/include/elementary-1/elm_widget_popup.h
            sed -i 's/\(elm_panel_eo\)\.h/\1.legacy.h/g' /usr/include/elementary-1/elm_widget_panel.h
            sed -i 's/\(elm_player_eo\)\.h/\1.legacy.h/g' /usr/include/elementary-1/elm_widget_player.h
            sed -i 's/\(elm_plug_eo\)\.h/\1.legacy.h/g' /usr/include/elementary-1/elm_widget_plug.h
            sed -i 's/\(elm_popup_item_eo\)\.h/\1.legacy.h/g' /usr/include/elementary-1/elm_widget_popup.h
            sed -i 's/\(elm_popup_eo\)\.h/\1.legacy.h/g' /usr/include/elementary-1/elm_widget_popup.h
            sed -i 's/\(elm_route_eo\)\.h/\1.legacy.h/g' /usr/include/elementary-1/elm_widget_route.h
            # Wrong typedef order
            sed -i 's/^typedef enum _Ecore_Wl2_Buffer_Type Ecore_Wl2_Buffer_Type;$//' /usr/include/ecore-wl2-1/Ecore_Wl2.h
            sed -i 's/^typedef enum _Conformant_Part_Type Conformant_Part_Type;$//' /usr/include/elementary-1/elm_widget_conform.h
            # Duplicate definitions
            sed -i '/EAPI extern Eina_Error EFL_UI_THEME_APPLY_ERROR_NONE;/d' /usr/include/elementary-1/elm_widget.h
            sed -i 's/struct Elm_Gen_Item_Type/struct Elm_Gen_Item_Type_two/g' /usr/include/elementary-1/elm_widget_genlist.h
            sed -i '/typedef struct _Item_Cache Item_Cache;/d;s/struct _Item_Cache/struct _Item_Cache_two/g' /usr/include/elementary-1/elm_widget_genlist.h
            ;;
        libzfslinux-dev)
            preamble=cstring
            exclude_types="utsname
uu_avl_walk
uu_dprintf
uu_list_walk
zfs_deleg_perm_tab"
            ;;
        libvips-dev)
            sed -i '99d; $a\
#endif' /usr/include/vips/dbuf.h
            sed -i '78d; $a\
#endif' /usr/include/vips/gate.h
            preamble="vips/vips8
vips/vips7compat.h"
            ;;
        libgraphicsmagick1-dev)
            preamble="cstddef
cstdio
magick/common.h
magick/image.h
magick/magick.h
wand/wand_api.h"
        ;;
        libgit2-glib-1.0-dev|libdframeworkdbus-dev)
            preamble=workarounds.h
            ;;
        libfann-dev)
            exclude_types=fann_error
            ;;
        libgivaro-dev)
            sed -i -e'/givaro\/givconfig.h/a\
using namespace std;' /usr/include/givaro/givarithmetics.h
            preamble=givaro/givmatrix.h
            ;;
        libdazzle-1.0-dev)
            preamble=dazzle.h
            ;;
        libdap-dev)
            extra_args="-gcc-options -std=c++14"
            preamble="string
signal.h
libdap/Error.h"
            defines="using namespace std;"
            ;;
        libcsound64-dev)
            preamble="csound/csdl.h
csound/csound.h"
            ;;
        libcork-dev)
            sed -i -e's/struct cork_uid/struct _cork_uid/' \
                   /usr/include/libcork/core/id.h
            ;;
        libck-dev)
            sed -i -e'/_ck_ring_enqueue_reserve_mp/,/^}/ { s/false/NULL/ }' \
                   /usr/include/ck_ring.h
            exclude_types="ck_barrier_centralized
ck_barrier_combining
ck_barrier_dissemination
ck_barrier_mcs
ck_barrier_tournament
ck_hs_stat
ck_ht_hash
ck_ht_stat
ck_rhs_stat"
            ;;
        libmd4c-dev)
            exclude_types=MD_SPAN_WIKILINK
            ;;
        libmedc-dev*)
            defines="#define MED_API_23 1
#define MESGERR 1"
            includes="/usr/include/$multiarch/mpi/"
            ;;
        liblqr-1-0-dev)
            preamble="glib.h
lqr_base.h
lqr_vmap_pub.h
lqr_cursor_pub.h
lqr_gradient_pub.h
lqr_rwindow_pub.h
lqr_energy_pub.h
lqr_cursor_pub.h
lqr_progress_pub.h
lqr_vmap_list_pub.h"
            ;;
        libmariadb-dev)
            preamble=mariadb/mysql.h
            defines="#define LIBMARIADB 1"
            ;;
        libnitrokey-dev)
            exclude_types=NK_status
            ;;
        libmpd-dev)
            preamble=libmpd-1.0/libmpd/libmpd.h
            ;;
        libmuscle-dev)
            preamble=muscle.h
            ;;
        libminc-dev)
            preamble="minc.h
volume_io.h"
            ;;
        libtranscript-dev)
            preamble=transcript/transcript.h
            ;;
        libticalcs-dev)
            preamble=ticalcs.h
            defines="#define restrict"
            ;;
        libsquid-dev)
            preamble=squid.h
            ;;
        libspatialindex-dev)
            preamble="SpatialIndex.h
capi/sidx_config.h"
            ;;
        libscotchparmetis-dev=*)
            includes="/usr/include/$multiarch/mpi/"
            ;;
        libplumb2-dev)
            preamble="gnutls.h"
            sed -i '/typedef enum _replytrack_completion_type/ienum _replytrack_completion_type: short;' /usr/include/clplumbing/replytrack.h
            sed -i 's/enum _replytrack_completion_type {/enum _replytrack_completion_type: short {/' /usr/include/clplumbing/replytrack.h
            sed -i '/typedef enum _nodetrack_change/ienum _nodetrack_change: short;' /usr/include/clplumbing/replytrack.h
            sed -i 's/enum _nodetrack_change {/enum _nodetrack_change: short {/' /usr/include/clplumbing/replytrack.h
            ;;
        libxine2-dev)
            defines="typedef struct demux_plugin_s demux_plugin_t;"
            ;;
        libwinpr2-dev) # windows stuff
            preamble=string.h
            ;;
        libwings-dev)
            defines="#define _Noreturn"
            ;;
        libxdp-dev)
            # defines taken from /usr/include/bpf/bpf_helpers.h
            defines="#define __uint(name, val) int (*name)[val]
#define __type(name, val) typeof(val) *name
#define SEC(name) __attribute__((section(name), used))
enum libbpf_pin_type {
        LIBBPF_PIN_NONE,
        LIBBPF_PIN_BY_NAME,
};
static void *(*bpf_map_lookup_elem)(void *map, const void *key) = (void *) 1;"
            preamble="linux/types.h
xdp/xdp_stats_kern_user.h"
            sed -i '1i#pragma once' /usr/include/bpf/*.h
            exclude_types="bpf_obj_get_opts
bpf_prog_attach_opts
bpf_prog_query_opts"
            # Drop mismatching bpf_map_lookup_elem definition
            sed -i '/bpf_map_lookup_elem(/d' /usr/include/bpf/bpf.h
            ;;
        libxen-dev)
            sed -i 's@public/xen.h@../xen.h@' /usr/include/xen/arch-arm/smccc.h
            sed -i '1i#pragma once' /usr/include/xen/io/libxenvchan.h
            preamble="xenctrl.h
libxl.h"
            # These struct names are also used as function name.
            sed -i 's/\(struct xc_get_cpufreq_para\)/\1_s/g' /usr/include/xenctrl.h
            sed -i 's/\(struct xc_resource_op\)/\1_s/g' /usr/include/xenctrl.h
            sed -i 's/\(struct xsd_errors\)/\1_s/g' /usr/include/xen/io/xs_wire.h
            ;;
        libvigraimpex-dev)
            sed -i '1i#pragma once' /usr/include/vigra/delegate/detail/delegate_list.hxx \
                /usr/include/vigra/random_forest/rf_online_prediction_set.hxx \
                /usr/include/vigra/transform_iterator.hxx
            # boost is a C++-only library, defining __STDC_VERSION__ breaks stuff
            defines="#undef __STDC_VERSION__"
            preamble="vigra/random_forest.hxx"
            ;;
        libvisp-*-dev)
            sed -i "s,/build/reproducible-path/.*/obj-${multiarch}/,/usr/," "/usr/include/${multiarch}/visp3/visp_core.h"
            ;;
        libcapnp-dev)
            rm /usr/include/kj/async-win32.h
            ;;
        libvcdinfo-dev)
            preamble=cdio/iso9660.h
            ;;
        libuvc-dev)
            exclude_types=uvc_stream_ctrl
            ;;
        libusermetricsinput-dev)
            preamble=libusermetrics-1/libusermetricsinput/usermetricsinput.h
            ;;
        libvolk2-dev)
            defines="#define LV_HAVE_GENERIC 1"
            ;;
        libvcflib-dev)
            defines='#define VCFLIB_VERSION "some version"'
            ;;
         coinor-libcbc-dev)
            preamble=coin/CbcModel.hpp
            ;;
        libportal-dev)
            preamble=libportal/portal.h
            ;;
        libvala-*-dev|libvaladoc-*-dev)
            # replace a non-C++-compatible name
            sed -i -e 's/\(ValaAssignmentOperator operator\)\b/\1_/g' /usr/include/vala-*/vala.h
            ;;
        libebackend1.2-dev)
            preamble=libebackend/libebackend.h
            ;;
        libgoocanvasmm-2.0-dev)
            includes=/usr/include/goocanvasmm-2.0
            preamble=goocanvasmm.h
            ;;
        libjsonrpc-glib-1.0-dev)
            includes=/usr/include/jsonrpc-glib-1.0
            preamble=jsonrpc-glib.h
            ;;
        libdex-dev)
            includes=/usr/include/libdex-1
            preamble=libdex.h
            ;;
        libretro-gtk-1-dev)
            defines="#define RETRO_GTK_USE_UNSTABLE_API"
            ;;
        libshumate-dev)
            includes=/usr/include/shumate-1.0
            preamble=shumate/shumate.h
            ;;
        libsysprof-4-dev)
            includes="/usr/include/sysprof-4
/usr/include/sysprof-ui-5"
            preamble="sysprof.h
sysprof-ui.h"
            ;;
        libtepl-6-dev)
            includes=/usr/include/tepl-6
            preamble=tepl/tepl.h
            ;;
        libgepub-0.7-dev)
            : > /usr/include/libgepub-0.7/config.h
            ;;
        libgovirt-dev)
            # missing G_END_DECLS
            sed -i -e '/#endif/ i G_END_DECLS' \
                /usr/include/govirt-1.0/govirt/ovirt-error.h \
                /usr/include/govirt-1.0/govirt/ovirt-proxy.h
            ;;
        libgdamm5.0-dev)
            preamble=libgdamm.h
            ;;
        pd-flext-dev)
            # Defines taken from pd.pc and pd-flext.pc
            defines="#define PD
#define FLEXT_SYS 2
#define FLEXT_SHARED
#define FLEXT_USE_CMEM
#define FLEXT_THREADS 1
"
            preamble="flprefix.h
fldefs_hdr.h
fldefs.h
pthread.h"
            ;;
        nim-hts-dev)
            defines="
#define int64 int64_t
#define hts_pos_t size_t
#define samFile htsFile
"
        # replace C forward declaration with typedef
        sed -i 's/typedef htsFile samFile;//g' /usr/share/nimble/hts/hts/private/hts_concat.h
            ;;
        libseqan3-dev)
            defines="#define SEQAN3_HAS_BZIP2
#define SEQAN3_HAS_ZLIB
"
            # work around abi-compliance-checker adding all directories as include directories
            mv /usr/include/seqan3/std/new /usr/include/seqan3/std/new_1 || true
            sed -i 's,seqan3/std/new,seqan3/std/new_1,g' /usr/include/seqan3/contrib/parallel/buffer_queue.hpp
            sed -i 's,seqan3/std/new,seqan3/std/new_1,g' /usr/include/seqan3/utility/parallel/detail/*.hpp

            # disable static assert caused by the includes order
            sed -i 's,static_assert,//static_assert,g' /usr/include/seqan3/alphabet/alphabet_base.hpp
            sed -i  's,__attribute__((mode(TI))),,g' /usr/include/seqan3/submodules/sdsl-lite/include/sdsl/uint128_t.hpp
            sed -i 's|if constexpr (alphabet_size < 1024u)|if constexpr (alphabet_size > 1024u)|g' /usr/include/seqan3/alphabet/composite/alphabet_tuple_base.hpp;
            extra_args="-gcc-options -std=c++20"
            headers="$(find_headers /usr/include/seqan3 '*.hpp')"
            ;;
        moarvm-dev)
            preamble="stdint.h
cstdint
atomic
moar.h"
            find /usr/include/moar/ -type f -name '*.h' -exec sed -i '1i#pragma once' {} \;
            # the header shadows time.h from stdlib
            mv /usr/include/moar/platform/time.h /usr/include/moar/platform/time_1.h || true

            sed -i 's/jmp_buf interp_jump//g' /usr/include/moar/core/threadcontext.h
            sed -i 's/_Thread_local//g' /usr/include/moar/gen/config.h
            sed -i 's/\"PRId64\"/PRId64/g' /usr/include/moar/core/nativecall.h
            sed -i 's/\"PRId32\"/PRId32/g' /usr/include/moar/strings/normalize.h

            sed -i 's/new/new_1/g' /usr/include/moar/moar.h
            sed -i 's/operator/operator_1/g' /usr/include/moar/jit/expr.h
            sed -i  's/template/template_1/g' /usr/include/moar/jit/expr.h
            sed -i  's/template/template_1/g' /usr/include/moar/jit/tile.h

            headers="$(find_headers /usr/include/moar '*')"
            headers="$(skip_header /usr/include/moar/core/oplabels.h $headers)"
            headers="$(skip_header /usr/include/moar/jit/internal.h $headers)"
            headers="$(skip_header /usr/include/moar/disp/labels.h $headers)"
            headers="$(skip_header /usr/include/moar/core/nativecall_dyncall.h $headers)"

            defines="
#define HAVE_LIBFFI
using namespace std;"
            ;;
        libterralib-dev)
            defines="#define STL_map
#define TL_DLL"
            sed -i '1i#pragma once' /usr/include/terralib/kernel/TeStdFile.h
            ;;
        libtclcl1-dev)
            preamble="tclcl/tclcl.h"
            sed -i 's/tcl_->result\s=//g' /usr/include/tclcl/tclcl.h
            ;;
        libstonith1-dev*)
            defines="#define Debug 0
$defines"
            # Remove duplicate comma
            sed -i 's/maxline,$/maxline/' /usr/include/stonith/expect.h
            sed -i 's/new/new_1/g' /usr/include/stonith/stonith_plugin.h
            case $devpkg in
                *=plugin)
                    defines="#include <stonith/stonith_plugin.h>
StonithImports_s* OurImports;
PILPluginImports* PluginImports;
$defines"
                    preamble="
stonith/stonith.h
stonith/stonith_plugin_common.h
stonith/stonith_signal.h"
                    headers="$(find_headers /usr/include/stonith/ '*')"
                    headers="$(skip_header /usr/include/stonith/expect.h $headers)"
                    ;;
                *=the-rest)
                    headers=/usr/include/stonith/expect.h
                    ;;
                *)
                    echo "($devpkg) is not a known split for ${devpkg_no_virtual}"
                    exit 1
                    ;;
            esac
            ;;
        libcec-dev)
            preamble=iostream
            ;;
        libafflib-dev)
            preamble=ctime
            ;;
        libagg2-dev)
            preamble=agg2/agg_renderer_base.h
            ;;
        libapache2-mod-perl2-dev)
            includes=/usr/lib/arm-linux-gnueabihf/perl/5.36/CORE/
            sed -i 's|*new)|*new_)|' /usr/include/apache2/modperl_options.h
            ;;
        guile-2.2-dev)
            sed -i 's|*new,|*new_,|' /usr/include/guile/2.2/libguile/debug-malloc.h
            includes=/usr/include/guile/2.2/
            headers="/usr/include/guile/2.2/libguile.h
/usr/include/guile/2.2/libguile/bdw-gc.h
/usr/include/guile/2.2/libguile/control.h
/usr/include/guile/2.2/libguile/debug-malloc.h
/usr/include/guile/2.2/libguile/deprecation.h
/usr/include/guile/2.2/libguile/dynstack.h
/usr/include/guile/2.2/libguile/expand.h
/usr/include/guile/2.2/libguile/frames.h
/usr/include/guile/2.2/libguile/gc-inline.h
/usr/include/guile/2.2/libguile/gettext.h
/usr/include/guile/2.2/libguile/hooks.h
/usr/include/guile/2.2/libguile/iselect.h
/usr/include/guile/2.2/libguile/loader.h
/usr/include/guile/2.2/libguile/memoize.h
/usr/include/guile/2.2/libguile/poll.h
/usr/include/guile/2.2/libguile/programs.h
/usr/include/guile/2.2/libguile/pthread-threads.h
/usr/include/guile/2.2/libguile/regex-posix.h
/usr/include/guile/2.2/libguile/scmconfig.h
/usr/include/guile/2.2/libguile/srfi-1.h
/usr/include/guile/2.2/libguile/srfi-60.h
/usr/include/guile/2.2/libguile/unicode.h
/usr/include/guile/2.2/libguile/vm-builtins.h
/usr/include/guile/2.2/libguile/vm-expand.h
/usr/include/guile/2.2/libguile/vm.h
/usr/include/guile/2.2/readline.h"
            ;;
        libadplug-dev)
            defines="#define strcasecmp(a,b) stricmp(a,b)"
            ;;
        libccp4-dev)
            sed -i 's|^#include <math.h>|//#include <cmath>|g' /usr/include/ccp4/ccp4_unitcell.h
            preamble="/usr/include/ccp4/cmaplib.h
workaround.h"
            echo "using namespace CMap_io;" > workaround.h
            ;;
        libc-client2007e-dev)
            sed -i '1i#pragma once' /usr/include/c-client/env_unix.h
            defines="#define SSLBUFLEN 8192
typedef float _Float32;
typedef double _Float64;
typedef float _Float32x;
typedef long double _Float64x;
typedef void SSLSTREAM;"
            headers="/usr/include/c-client/c-client.h
/usr/include/c-client/env.h
/usr/include/c-client/fdstring.h
/usr/include/c-client/flocksim.h
/usr/include/c-client/flstring.h
/usr/include/c-client/imap4r1.h
/usr/include/c-client/netmsg.h
/usr/include/c-client/newsrc.h
/usr/include/c-client/os_lnx.h
/usr/include/c-client/pseudo.h
/usr/include/c-client/sslio.h
/usr/include/c-client/tcp_unix.h
/usr/include/c-client/unix.h"
            ;;
        libplacebo-dev)
            defines="#define __cplusplus 201103L"
            ;;
        libosp-dev)
            preamble="config.h
macros.h"
            defines="#define SP_ANSI_LIB
#define SP_API
#define SP_HAVE_BOOL
$defines"
            ;;
        libt4k-common0-dev)
            preamble="stdbool.h
t4k_common.h"
            sed -i 's/#ifndef bool/#ifndef __bool_true_false_are_defined/' \
                /usr/include/t4k_common.h
            ;;
        ofono-dev)
            defines="#define OFONO_API_SUBJECT_TO_CHANGE"
            exclude_types=ofono_error
            ;;
        libspf2-dev)
            exclude_types="_ns_flagdata"
            preamble=netinet/in.h
            ;;
        libsearpc-dev)
            sed -i '1i#pragma once' /usr/include/searpc-utils.h
            ;;
        libsingleapplication-dev)
            includes="/usr/include/$multiarch/qt5/QtCore"
            ;;
        libsimbody-dev)
            extra_args="-gcc-options -std=c++11"
            preamble=simbody/SimTKcommon/internal/DecorativeGeometry.h
            ;;
        libraft-dev)
            exclude_types="raft_apply
raft_barrier
raft_transfer"
            ;;
        libre-dev)
            exclude_types="mod_export
re_printf
rtcp_stats
stun_conf"
            preamble=cstring
            sed -i '1i#pragma once' /usr/include/re/re_*.h
            ;;
        libquvi-0.9-dev)
            preamble="quvi/qoption.h
quvi/qinfo.h
quvi/qscript.h
quvi/qmediaprop.h
quvi/qplaylistprop.h
quvi/qmediaprop.h
quvi/qhttpmiprop.h
quvi/qsubtprop.h
quvi/qsupp.h
quvi/qversion.h"
            ;;
        libpolly-14-dev)
            exclude_types="isl_arg_choice
isl_arg_flags"
            ;;
        libp8-platform-dev)
            sed -i 's/OA//' /usr/include/p8-platform/util/atomic.h
            ;;
        libopenmpt-modplug-dev)
            defines="#define HAVE_STDINT_H"
            preamble=libmodplug/stdafx.h
            ;;
        libopenhpi-dev)
            preamble="openhpi/SaHpi.h
openhpi/sahpi_struct_utils.h"
            ;;
        libnfft3-dev)
            defines="#define NFFT_PRECISION_SINGLE"
            ;;
        libopendht-dev)
            defines="#define OPENDHT_JSONCPP"
            ;;
        libmupdf-dev)
            sed -i '1i#pragma once' /usr/include/mupdf/pdf/name-table.h \
                /usr/include/mupdf/memento.h
            ;;
        libnewmat10-dev)
            extra_args="-gcc-options -std=gnu++98"
            defines="#define WANT_MATH
#define WANT_STREAM"
            preamble="newmat/config.h
newmat/myexcept.h"
            ;;
        libnauty2-dev)
            # nauty is built with `--disable-tls` on armhf
            sed -i '/#define USE_TLS/d' /usr/include/arm-linux-gnueabihf/nauty/nauty.h
            sed -i 's/new\([;,=]\)/new_\1/g' /usr/include/cliquer/set.h
            ;;
        libmateweather-dev)
            defines="#define MATEWEATHER_I_KNOW_THIS_IS_UNSTABLE"
            ;;
        liblognorm-dev)
            preamble=liblognorm.h
            ;;
        libleatherman-dev)
            defines="#define LEATHERMAN_LOGGING_NAMESPACE \"leatherman\""
            ;;
        libhbaapi-dev)
            preamble=ctime
            ;;
        libhandy-0.0-dev)
            defines="#define HANDY_USE_UNSTABLE_API"
            ;;
        libgloox-dev)
            touch /usr/include/gloox/config.h
            ;;
        libhdhomerun-dev)
            sed -i '1i#pragma once' /usr/include/libhdhomerun/hdhomerun*.h
            ;;
        libkmfl-dev)
            preamble=kmfl/kmfl.h
            ;;
        libiml-dev)
            preamble=gmp.h
            ;;
        libchamplain-0.12-dev)
            preamble="gtk/gtk.h
champlain/champlain.h"
            includes=/usr/include/gtk-3.0
            ;;
        libtext-engine-dev)
            sed -i '1i#pragma once' /usr/include/text-engine/layout/types.h
            ;;
        eog-dev)
            preamble=gtk/gtk.h
            ;;
        libsword-dev)
            preamble=sword/zverse4.h
            exclude_types=ftpparse
            ;;
        sfftw-dev)
            includes="/usr/lib/$multiarch/openmpi/include/"
            ;;
        libgdome2-dev)
            preamble=libxml/parser.h
            ;;
        libgadu-dev)
            exclude_types="gg_dcc7_accept
gg_dcc7_reject
gg_login
gg_notify
gg_search
gg_token
gg_userlist_request"
            ;;
        libfabric-dev)
            exclude_types="fi_alias
fi_mr_map_raw
fi_mr_raw_attr"
            ;;
        libetpan-dev)
            exclude_types="mailimap_capability
mailpop3_capa"
            ;;
        libxaw3dxft8-dev)
            sed -i 's/template/template_foo/g' /usr/include/X11/Xaw3dxft/TemplateP.h
            ;;
        libcliquer-dev)
            sed -i 's/new\([;,=]\)/new_\1/g' /usr/include/cliquer/set.h
            ;;
        libcdaudio-dev)
            exclude_types=cddb_query
            ;;
        libbladerf-dev)
            preamble=libbladeRF.h
            exclude_types=bladerf_version
            ;;
        pinball-dev)
            preamble=pinball/Private.h
            includes="/usr/include/SDL2/"
            defines="#define EM_USE_SDL 1"
            touch /usr/include/pinball/config-rzr.h
            ;;
        nim-hts-dev)
            preamble="stddef.h
stdint.h
inttypes.h"
            # definitions under C2NIM
            defines="#define hts_pos_t int64_t
#define int64 int64_t"
            ;;
        moarvm-dev)
            defines="#define HAVE_LIBFFI
#define _Thread_local thread_local"
            # unable to use atomic builtin due to A-C-C can't
            # translate this C11 construct
            sed -i "s|#define MVM_USE_C11_ATOMICS|#undef MVM_USE_C11_ATOMICS|" /usr/include/moar/gen/config.h
            headers="/usr/include/moar/moar.h
/usr/include/moar/bithacks.h
/usr/include/moar/config.h
/usr/include/moar/gcc_diag.h
/usr/include/moar/jit/expr_ops.h
/usr/include/moar/memdebug.h
/usr/include/moar/platform/fork.h
/usr/include/moar/platform/io.h
/usr/include/moar/platform/malloc_trim.h
/usr/include/moar/platform/memmem.h
/usr/include/moar/platform/memmem32.h
/usr/include/moar/platform/mmap.h
/usr/include/moar/platform/random.h
/usr/include/moar/platform/setjmp.h
/usr/include/moar/platform/socket.h
/usr/include/moar/platform/stdint.h
/usr/include/moar/platform/sys.h
/usr/include/moar/platform/threads.h
/usr/include/moar/platform/time.h
/usr/include/moar/strings/gb18030_codeindex.h
/usr/include/moar/strings/gb2312_codeindex.h
/usr/include/moar/strings/shiftjis_codeindex.h
/usr/include/moar/strings/unicode_prop_macros.h"
            ;;
        libseqan3-dev)
            extra_args="-gcc-options -std=gnu++20"
            # additionally ignores psABI warnings (not suppressed by -w)
            defines="#pragma GCC diagnostic ignored \"-Wno-psabi\"
#define SEQAN3_HAS_BZIP2
#define SEQAN3_HAS_ZLIB"
            includes="/usr/include/seqan3
/usr/include/seqan3/submodules/sdsl-lite/include"
            # not working on 32-bit platforms
            sed -i 's|defined(__GNUC__)|0|' /usr/include/seqan3/submodules/sdsl-lite/include/sdsl/uint128_t.hpp
            sed -i 's|std::numeric_limits<int_t>::lowest() + 1;|std::numeric_limits<int_t>::lowest() + 0;|' \
                /usr/include/seqan3/utility/detail/integer_traits.hpp
            ;;
        libstonith1-dev)
            defines="#define Debug 0
#define __EXPECT_H
$defines"
            # add a fake plugin so that the headers could be checked properly
cat << EOF > workaround.h
struct StonithImports_s *OurImports;
PILPluginImports *PluginImports;
EOF
            # the headers need to be included in a very specific order
            headers="/usr/include/pils/plugin.h
/usr/include/stonith/expect.h
/usr/include/stonith/st_ttylock.h
/usr/include/stonith/stonith_config_xml.h
/usr/include/stonith/stonith_signal.h
/usr/include/stonith/stonith_plugin_common.h
workaround.h
/usr/include/stonith/stonith_expect_helpers.h"
            ;;
        libpwizlite-dev)
            preamble="/usr/include/boost/aligned_storage.hpp
pwizlite/boost/enum/iterator.hpp"
            sed -i '1i#pragma once' /usr/include/pwizlite/pwiz/utility/misc/Environment.hpp
            ;;
        libint2-dev*)
            extra_args="-gcc-options -xc++-header"
            case "$devpkg" in
                *=main)
                    headers="/usr/include/libint2.hpp"
                ;;
                *=lcao)
                    patch -Np1 -d / -i "$PWD"/patches/libint2-dev.patch
                    defines="#define LIBINT2_HAVE_BTAS 1
#define CblasRowMajor blas::Layout::RowMajor"
                    headers="/usr/include/eigen3/Eigen/Eigenvalues
/usr/include/libint2/atom.h
/usr/include/libint2/lcao/molden.h
/usr/include/libint2/lcao/1body.h"
                ;;
                *)
                    headers="/usr/include/libint2/config.h
/usr/include/libint2/deriv_iter.h
/usr/include/libint2/libint2_params.h
/usr/include/libint2/libint2_types.h
/usr/include/libint2/libint2_iface.h
/usr/include/libint2/util/intrinsic_types.h
/usr/include/libint2/util/memory.h"
                ;;
            esac
            ;;
        libgenome-dev)
            preamble="iostream
libGenome/gnDefs.h"
            # fix some typos in the headers...
            defines="using namespace std;"
            # fix even more issues in the headers...
            patch -Np1 -d / -i "$PWD"/patches/libgenome-dev.patch
            ;;
        libgmerlin-dev)
            preamble="gtk/gtk.h
/usr/include/gmerlin/player.h
/usr/include/gmerlin/playermsg.h
/usr/include/gmerlin/httpserver.h
/usr/include/gmerlin/remote.h"
            defines="struct bg_mdb_t;
struct bg_remote_server_t;"
            touch /usr/include/gmerlin/config.h
            touch /usr/include/gmerlin/backend.h
            ;;
        librandom123-dev)
            preamble="/usr/include/Random123/features/compilerfeatures.h"
            ;;
        libgnunet-dev)
            preamble="/usr/include/gnunet/gnunet_mysql_compat.h"
            # very crude conflict resolution
            sed -i 's|GNUNET_ATS_Properties|GNUNET_ATS_Properties_|g' /usr/include/gnunet/gnunet_ats_transport_service.h
            sed -i 's|GNUNET_TRANSPORT_core_connect |GNUNET_TRANSPORT_core_connect2 |g' /usr/include/gnunet/gnunet_transport_core_service.h
            ;;
        libhe5-hdfeos-dev)
            sed -i 's|long isinusfor|int isinusfor|g' /usr/include/hdf-eos5/isin.h
            sed -i 's|long isinusinv|int isinusinv|g' /usr/include/hdf-eos5/isin.h
            sed -i 's|long isinusforinit|int isinusforinit|g' /usr/include/hdf-eos5/isin.h /usr/include/hdf-eos5/HE5_GctpFunc.h
            sed -i 's|long isinusinvinit|int isinusinvinit|g' /usr/include/hdf-eos5/HE5_GctpFunc.h
            ;;
        libitpp-dev)
            defines="using namespace std;"
            ;;
        libmartchus-qtutilities-dev)
            preamble="/usr/include/martchus-qtutilities/qtutilities/misc/xmlparsermacros.h
/usr/include/martchus-qtutilities/qtutilities/misc/undefxmlparsermacros.h"
            ;;
        libmia-2.4-dev*)
            # what kind of mistake is this?
            sed -i 's|b ? | x ? |' /usr/include/mia-2.4/mia/template/normalize.hh
            # -- per-chunk settings
            case "$devpkg" in
                *=chunk-*)
                    chunk="${devpkg##*=}"
                    headers="$(read_headers_list_file lists/mia-"${chunk}".list)"
                    # requires some weird header pre-compilation tuning
                    extra_args="-gcc-options -xc++-header"
                ;;
                *)
                    echo 'This does not make sense. Please check if libmia-2.4-dev has the correct splits.'
                    exit 1
                ;;
            esac
        ;;
        libosmo-ranap-dev)
            # match syntax for ast-grep: A_SEQUENCE_OF(struct $M { $$$BODY })
            # rewrite syntax: struct $M { $$$BODY }; A_SEQUENCE_OF(struct $M)
            patch -Np1 -d /usr -i "$PWD"/patches/libosmo-ranap-dev-cpp-compat.patch
            ;;
        libpcl-dev)
            includes="/usr/include/pcl-1.13/"
            ln -sfn ../modeler ../in_hand_scanner /usr/include/pcl-1.13/pcl/apps/
            ;;
        libmuparserx-dev)
            # our patch is using Unix LF line-ending
            dos2unix "/usr/include/muparserx/suStringTokens.h"
            patch -Np1 -d / -i "$PWD"/patches/libmuparserx-dev.patch
            ;;
        libxdmf-dev)
            includes="/usr/include/$multiarch/mpi/"
            defines="#define _H5public_H"
            preamble="/usr/include/hdf5/openmpi/H5Ipublic.h
/usr/include/hdf5/openmpi/H5FDmpi.h
/usr/include/XdmfArray.hpp"
            ;;
        libsuma-dev)
            defines="#define fastaSeqCountPtr fastaSeqCount*
#define fastaSeqPtr fastaSeqs*"
            sed -i 's|,\*fastaSeqPtr||' /usr/include/libfasta/sequence.h
            sed -i 's|, \*fastaSeqCountPtr||' /usr/include/libfasta/sequence.h
            ;;
        libsoil-dev)
            defines="#define HEADER_STB_IMAGE_AUGMENTED
#define STB_IMAGE_IMPLEMENTATION
#define get8 stbi__get8
#define get32le stbi__get32le
#define convert_format stbi__convert_format
#define skip stbi__skip
#define getn stbi__getn
#define stbi stbi__context
#define start_file stbi__start_file
#define start_mem stbi__start_mem"
            preamble="/usr/include/stb/stb_image.h"
            sed -i 's|DDS_header|DDS_header_|' /usr/include/SOIL/stbi_DDS_aug_c.h
            ;;
        libscotchmetis-dev*)
            case "$devpkg" in
                *=cint)
                    headers="/usr/include/scotch/scotch.h
/usr/include/metis/metis.h"
                    ;;
                *)
                    headers="/usr/include/scotch-${devpkg##*=}/scotch.h
/usr/include/metis-${devpkg##*=}/metis.h"
                    ;;
            esac
            ;;
        mirtest-dev)
            includes="/usr/share/python3-pycparser/fake_libc_include/"
            defines="#define _GNU_SOURCE"
            preamble="/usr/include/features.h"
            ;;
        libpython3.11-dev)
            preamble="/usr/include/expat.h"
            ;;
        libmaa-dev)
            # naming conflict resolution
            sed -f - -i /usr/include/maa.h << EOF
s|set_Stats;|set_Stats_;|
s|hsh_Stats;|hsh_Stats_;|
s|mem_StringStats;|mem_StringStats_;|
s|mem_ObjectStats;|mem_ObjectStats_;|
s|str_Stats;|str_Stats_;|
s|src_Stats;|src_Stats_;|
EOF
            ;;
        libges-1.0-dev)
            preamble="/usr/include/gstreamer-1.0/ges/ges-operation-clip.h
/usr/include/gstreamer-1.0/ges/ges-operation.h"
            ;;
        libhnswlib-dev)
            preamble="/usr/include/hnswlib/hnswlib.h"
            ;;
        libgtkextra-dev)
            preamble="gdk/gdk.h"
            ;;
        libgenht1-dev)
            preamble="/usr/include/genht/htip.h"
            ;;
        libdbus-cpp-dev)
            patch -Np1 -d / -i "$PWD"/patches/libdbus-cpp-dev.patch
            preamble="/usr/include/signal.h
/usr/include/dbus-1.0/dbus/dbus.h"
            includes="/usr/lib/$multiarch/dbus-1.0/include/"
            ;;
        libdolfinx-dev)
            extra_args='-gcc-options -std=c++20'
            includes="/usr/include/$multiarch/mpi"
            exclude_namespaces='MPI'
            ;;
        libell-dev)
            preamble="/usr/include/ell/ell.h"
            sed -i "s|static |/*static*/|g" /usr/include/ell/icmp6.h /usr/include/ell/rtnl.h
            ;;
        libgclib-dev*)
            defines="#define restrict __restrict__"
            case "$devpkg" in
                *=intmap)
                    headers="/usr/include/gclib/GIntHash.hh"
                    ;;
                *=hashmap)
                    headers="/usr/include/gclib/GHashMap.hh"
                    ;;
                *=gap)
                    headers="/usr/include/gclib/GapAssem.h"
                    ;;
                *)
                    ;;
            esac
            ;;
        libklibc-dev)
            arch_name="${multiarch%%-*}"
            defines="#define __KLIBC__"
            includes="/usr/lib/klibc/include/arch/${arch_name}/
/usr/lib/klibc/include/bits32/"
            preamble="/usr/lib/klibc/include/bits32/bitsize.h
/usr/lib/klibc/include/stdio.h"
            ;;
        python3-numba)
            sed \
                -e 's/goto error;//' \
                < '/usr/lib/python3/dist-packages/numba/_helperlib.c' \
                > '/usr/lib/python3/dist-packages/numba/_helperlib.h'
            ;;
        libace-dev)
            grep -r '#endif ACE_IOSTREAM_T_H' /usr/include/ace/IOStream_T.h || \
                echo '#endif ACE_IOSTREAM_T_H' >> /usr/include/ace/IOStream_T.h 
            ;;
        liblowdown-dev)
            preamble="sys/queue.h"
            ;;
        *)
            ;;
    esac

    lockfile a-c-c-lock
    a_c_c_lock=a-c-c-lock
    mkdir -p "logs/${devpkg}"
    cat > "logs/${devpkg}/${devpkg}_base.xml" <<EOF
<version>v1</version>
<headers>
EOF
    OLD_IFS="$IFS"
    IFS="
"

    rm -f workarounds.h
    for header in $headers; do
        case $devpkg,$header in

            # For the clang-tidy virtual package, include the headers under
            # clang-tidy/
            libclang-1?-dev=*,*/clang-tidy/abseil/Time*)
                # This can be simplified but I'm leaving it as an example of
                # how to have more than two sub-packages without duplicating
                # ad-nauseum the same glob for $header in the 'case' above.
                #
                # The first branch below does nothing if we're processing the
                # 'clang-tidy' virtual sub-package while the second one skips
                # the files matched through the glob above for all others.
                case $devpkg in
                    *=clang-tidy-abseil-time)
                        ;;
                    *)
                        continue
                        ;;
                esac
                ;;
            # For the clang-tidy virtual package, skip all headers not already
            # included
            libclang-1?-dev=clang-tidy-abseil-time,*)
                continue
                ;;

            # For freerdp2-dev, skip the server headers for the client
            # sub-package and the client ones for the server sub-package
            freerdp2-dev=client,*/freerdp2/freerdp/server/*)
                continue
                ;;
            freerdp2-dev=server,*/freerdp2/freerdp/client/*)
                continue
                ;;

            voms-dev=c,*/voms/voms_api.h)
                continue
                ;;
            voms-dev=cpp,*/voms/voms_apic.h)
                continue
                ;;

            libmedc-dev=api23,*/include/med*)
                continue
                ;;
            libmedc-dev=normal,*/2.3.6/*)
                continue
                ;;

            libscotchparmetis-dev=*,*/parmetis-int32*)
                case $devpkg in
                    *=int32)
                        ;;
                    *)
                        continue
                        ;;
                esac
                ;;
            libscotchparmetis-dev=*,*/parmetis-int64*)
                case $devpkg in
                    *=int64)
                        ;;
                    *)
                        continue
                        ;;
                esac
                ;;
            libscotchparmetis-dev=*,*/parmetis-long*)
                case $devpkg in
                    *=long)
                        ;;
                    *)
                        continue
                        ;;
                esac
                ;;
            libscotchparmetis-dev=*,*/parmetis/*)
                case $devpkg in
                    *=normal)
                        ;;
                    *)
                        continue
                        ;;
                esac
                ;;
            libgclib-dev=main,*/gclib/GHash*.hh|\
            libgclib-dev=main,*/gclib/GIntHash.hh|\
            libgclib-dev=main,*/gclib/GapAssem.h)
                continue
                ;;
            libklibc-dev,*/klibc/include/arch/*)
                # klibc special filtering logic
                arch_name="${multiarch%%-*}"
                if [[ "$header" != */klibc/include/arch/"${arch_name}"/*.h ]]; then
                    continue;
                fi
                ;;

            # Don't filter headers further than the above
            *)
                ;;
        esac

        # exclude some broken non-public headers
        case $header in
            */flint/flintxx/expression.h|\
            */flint/flintxx/flint_classes.h|\
            */urcu/*/arm.h)
                # These files will NOT be skipped:
                # - flint headers need to be included in a fairly specific order
                # - liburcu-dev has headers for 12+1 archs; we want to exclude
                # all of them below _except_ arm.
                ;;
            */coin/IpReturnCodes_inc.h|\
            */flann/algorithms/*cuda*.h|*/flann/util/cuda/*.h|\
            */flint/fmpz_mod_poly*xx.h|*/flint/arith*xx.h|*/flint/flintxx/*|\
            */urcu/arch/*.h|*/urcu/uatomic/*.h|*/gdalpansharpen.h|\
            */gdal/cpl_minizip_*zip.h|*/cholmod_gpu_kernels.h|\
            */suitesparse/spqr.hpp|*/QtQml/private/*|*/QtQuick/private/*|\
            */QtQmlDom/private/*|*/QtQuickTemplates2/private/*|\
            */QtQmlDebug/private/*|*/QtQuickControlsTestUtils/private/*|\
            */system/darwin.h|*/system/kfreebsd.h|*/system/mingw32.h|\
            */system/mingw32msvc.h|*/net-snmp/library/winservice.h|\
            */mib_module_includes.h|*/ucd-snmp/snmp_vars.h|\
            */net-snmp/agent/set_helper.h|*stdint-msvc2008.h|*sunos.h|\
            */uv/win.h|*/apt-pkg/cachefilter-patterns.h|\
            */apt-pkg/debsrcrecords.h|*/apt-pkg/header-is-private.h|*/odbcss.h|\
            */libadwaita-1/adw-spring-params.h|\
            */atkmm-1.6/atkmm/private/streamablecontent_p.h|\
            */guile/3.0/libguile/instructions.h|*/bpf/bpf_helper*.h|\
            */bpf/bpf_tracing.h|*/bpf/skel_internal.h|*/bpf/usdt.bpf.h|\
            */brltty/brldefs-bn.h|*/cdio/audio.h|*/CLucene/LuceneThreads.h|\
            */CLucene/util/Reader.h|*/CLucene/util/arrayinputstream.h|\
            */CLucene/util/byteinputstream.h|*/CLucene/search/FilterResultCache.h|\
            */CLucene/highlighter/Encoder.h|*/CLucene/highlighter/SimpleHTMLEncoder.h|\
            */clutter-1.0/clutter/evdev/clutter-evdev.h|*/isc/stdatomic.h|\
            */guile/3.0/libguile/null-threads.h|*/cogl/cogl/cogl-*.h|\
            */cogl/gl-prototypes/*|*/alsa/sound/*asoc.h|\
            */cephfs/metrics/Types.h|\
            */clutter-gst-3.0/clutter-gst/clutter-gst-*.h|*/colord/cd-*.h|\
            */cups/i18n.h|*/cupsfilters/pdfutils.h|*/db_185.h|\
            */dbstl_base_iterator.h|*/dee-1.0/dee-*.h|*/absl/*/internal/*.h|\
            */libdrm/via_drm.h|*/libdrm/r600_pci_ids.h|*/efivar/efiboot-*.h|\
            */efivar/efivar-*.h|*/evince/3.0/libdocument/ev-portal.h|\
            */ext2fs/bitops.h|*/fontembed/embed.h|\
            */freetype2/config/ftmodule.h|*/freetype2/freetype/ftmac.h|\
            */freetype2/freetype/fterrdef.h|\
            */freetype2/freetype/config/ftmodule.h|\
            */gdbm-ndbm.h|*/gdm/gdm-pam-extensions.h|*/glib/gi18n-lib.h|\
            */glibmm/i18n-lib.h|*/giomm/private/*|*/glusterfs/byte-order.h|\
            */glusterfs/parse-utils.h|\
            */glusterfs/template-component-messages.h|*/boost/accumulators/*|\
            */qt?/*/qt_windows.h|*/qt?/*/qdbusmacros.h|\
            */qt5/*/qwglnativecontext.h|*/qt?/*/qcocoanativecontext.h|\
            */qt?/*/qatomic_bootstrap.h|*/qt5/*/qatomic_msvc.h|\
            */qt?/*/qobject*_impl.h|*/qt?/*/qsharedpointer_impl.h|\
            */qt5/*/qopenglext.h|*/qt5/*/qeglnativecontext.h|\
            */qt5/*/qabstractprintdialog.h|*/qt5/*/qprintdialog.h|\
            */qt5/*/qprinter.h|*/qt5/*/qprintengine.h|*/qt5/*/qprinterinfo.h|\
            */qt5/*/qtestkeyboard.h|*/qt5/qtest_gui.h|*/qt5/*/qstyleoption.h|\
            */qt5/*/qglxnativecontext.h|*/qt6/QtCore/qfuture_impl.h|\
            */X11/ImUtil.h|*/openssl/asn1_mac.h|*/gtktextlayout.h|\
            */gtktextdisplay.h|*/extensions/MITMisc.h|*/extensions/XEVI.h|\
            */extensions/extutil.h|*/X11/CallbackI.h|*/X11/TranslateI.h|\
            */nc_tparm.h|*/tic.h|*/_sd-common.h|*/tirpc/rpc/xdr.h|\
            */private/qcfsocketnotifier_p.h|*/private/qcore_mac_p.h|\
            */private/qeventdispatcher_cf_p.h|*/private/q*_win*_p.h|\
            */private/qfilesystemwatcher_fsevents_p.h|\
            */private/qppsobjectprivate_p.h|*/private/qwindowspipe*_p.h|\
            */private/qwineventnotifier_p.h|*/private/qwinregistry_p.h|\
            */private/qwindowsguieventdispatcher_p.h|\
            */private/qcoretextfontdatabase_p.h|\
            */private/qfontengine_coretext_p.h|*/private/qmacmime_p.h|\
            */private/qwindowsfontdatabase*_p.h|*/private/qapplekeymapper_p.h|\
            */private/qwindowsfontengine_p.h|*/private/qwindowsnativeimage_p.h|\
            */private/qcoregraphics_p.h|*/private/qrhid3d11_p_p.h|\
            */private/qt_gui_pch.h|*/private/qt_mips_asm_dsp_p.h|\
            */private/qhttp2protocolhandler_p.h|*/private/qsslsocket_mac_p.h|\
            */private/qsslsocket_schannel_p.h|*/private/qcupsjobwidget_p.h|\
            */private/qpagesetupdialog_unix_p.h|*/private/qappletestlogger_p.h|\
            */private/qxctestlogger_p.h|*/private/qt_widgets_pch.h|\
            */private/qstdweb_p.h|*/private/qnetworkreplywasmimpl_p.h|\
            */private/qcborcommon_p.h|*/private/qfunctions_fake_env_p.h|\
            */private/qiconvcodec_p.h|*/private/q*calendar_data_p.h|\
            */private/qauthenticator_p.h|*/private/qfcursor_p.h|\
            */private/qdrawhelper_p.h|\
            */private/qblendfunctions_p.h|/usr/share/libtool/*|*/d3d11va.h|\
            */dxva2.h|*/qsv.h|*/videotoolbox.h|\
            */gstreamer-1.0/gst/gl/glprototypes/*.h|\
            */kpimtextedit/emoticonunicodetab.h|*/spdlog/*win*|\
            */sinks/mongo_sink.h|*/cuda-gst.h|*/gstcuda*.h|*/gsttranscoder*|\
            */DWidget/dinputdialog.h|*/vtk_pegtl.h|*/vtk_verdict.h|\
            */vtksys/SharedForward.h|*/vtkLineWidget.h|\
            */vtkLoopBooleanPolyDataFilter.h|*/vtkMPI.h|\
            */vtk*Representation*.h|*/vtkdiy2/*|*/vtk_diy2.h|\
            */vtkTemporalFractal.h|*/vtkDIY*Utilities.h|*/vtkJavaAwt.h|\
            */libvirt-common.h|*/hwloc/cuda*.h|*/hwloc/levelzero.h|\
            */hwloc/nvml.h|*/hwloc/rsmi.h|*/llvm/DebugInfo/PDB/DIA/*.h|\
            */llvm/Support/Solaris/*|*/llvm/Support/Windows/*|\
            */llvm/WindowsResource/ResourceScriptTokenList.h|\
            */webkit/Web*.h|*/webkitdom/Web*.h|*/webkitdom/webkitdom[ad]*.h|\
            */webkit2/webkit-web-extension.h|\
            */unity/lttng-component-provider.h|\
            */libtracker-sparql/tracker-[eruv]*.h|\
            */libtracker-sparql/tracker-sparql-enum-types.h|\
            */poppler/JPEG2000Stream.h|*/poppler/UnicodeC*Tables.h|\
            */cpp/poppler-font-private.h|*/orc/orcbytecodes.h|\
            */neon/ne_acl3744.h|*/mpich/mpicxx.h|*/mpich/mpi*f.h|\
            */geos/geom/DefaultCoordinateSequenceFactory.h|\
            */dcmtk/oflog/internal/*.h|*/dcmtk/oflog/thread/impl/*.h|\
            */dcmtk/ofstd/variadic/tuple*.h|*/dcmtk/ofstd/variadic/variant.h|\
            */glext/wglext*.h|*/isl/hmap.h|*/isl/maybe_templ.h|\
            */tcl-private/generic/regerrs.h|*/tcl-private/compat/*|\
            */QtCore/private/qntdll_p.h|*/private/qwindows*_p.h|\
            */private/uia*interfaces_p.h|*/private/qcocoa*|\
            */private/q*_mac_p.h|*/private/q*_macos_p.h|*/private/qsimd_x86*|\
            */private/qevdevtouchfilter_p.h|*/private/qandroidextras_p.h|\
            */private/jqnihelpers_p.h|*/Xm/Print*.h|*/atlas_cher2*.h|\
            */atlas_*_L*.h|*/atlas_*syr*.h|*/atlas_[dsz]mv[nt].h|\
            */atlas_dmv[nt]_*.h|*/atlas_dr[12].h|*/atlas_dr[12]_*.h|\
            */atlas_[sz]r[12].h|*/atlas_zher2.h|*/vulkan/vulkan_win32.h|\
            */vulkan/vulkan_fuchsia.h|*/vulkan/vulkan_ggp.h|*/gdpp.h|\
            */libunwind-common.h|*/libunwind-dynamic.h|*/tk-private/generic/*|\
            */utf8cpp/utf8/cpp11.h|*/telepathy-glib/_gen/*.h|\
            */telepathy-glib/dbus-daemon.h|*/protobuf/compiler/cpp/file.h|\
            */protobuf/compiler/cpp/helpers.h|*/osmocom/gsm/gan.h|\
            */kpathsea/mingw32.h|*/kpathsea/win32lib.h|\
            */KF5/KRunner/krunner/abstractrunnertest.h|\
            */qgpgme/hierarchicalkeylistjob.h|*/libedataserver/e-source-*.h|\
            */allegro/platform/aintbeos.h|*/allegro/platform/aintqnx.h|\
            */allegro/platform/al*.h|*/allegro/3d*.h|*/allegro/al*.h|\
            */proftpd/acconfig.h|*/proftpd/mod_wrap2.h|\
            */proftpd/mod_sftp/channel.h|*/std_msgs/header_deprecated_def.h|\
            */libpurple/dbus-define-api.h|*/KF5/*/akonadi/*/protocol_gen.h|\
            */lzo/minilzo/*|*/g[dt]kmm/private/*_p.h|\
            */gnuradio/rpcserver_booter_thrift.h|\
            */gnuradio/thrift_server_template.h|*/gnuradio/pycallback_object.h|\
            */exiv2/asfvideo.hpp|*/pixman-1/pixman-version.h|\
            */rapidjson/msinttypes/*.h|*/netcdf_filter_build.h|\
            */apertium/deserialiser.h|*/apertium/serialiser.h|\
            */apertium/tagger.h|*/apertium/getopt_long.h|*/nss/key.h|\
            */nss/keyt.h|*/nss/pkcs11f.h|*/obs/obs-internal.h|*/obs/obs-nix.h|\
            */obs/obs-nix-wayland.h|*/obs/obs-nix-x11.h|*/obs/obs-hotkeys.h|\
            */msgpack/*_template.h|*/msgpack/gcc_atomic.h|\
            */lttng/ust-tracepoint-event.h|*/lttng/tp/lttng-ust-trace*.h|\
            /usr/include/tag_enum.h|*/libdbustest/dbus-mock.h|\
            */atomic_ops/ao_version.h|*/atomic_ops/generalize.h|\
            */atomic_ops/sysdeps/*|*/arpack/debug.h|*/arpack/stat.h|\
            */arpack/*.hpp|*/arpack++/ar[bdlu]*.h|\
            */oneapi/tbb/detail/_string_resource.h|\
            */openmpi/orte/mca/iof/base/base.h|\
            */openmpi/orte/mca/iof/base/iof_base_setup.h|\
            */openmpi/orte/mca/odls/base/odls_private.h|\
            */openmpi/ompi/mca/fcoll/base/fcoll_base_coll_array.h|\
            */openmpi/opal/sys/atomic_impl.h|*/openmpi/ompi/mpi/cxx/*.h|\
            */openmpi/ompi/mpi/tool/mpit-internal.h|\
            */openmpi/ompi/mca/vprotocol/base/vprotocol_base_request.h|\
            */openmpi/ompi/mca/vprotocol/base/base.h|\
            */openmpi/ompi/mca/vprotocol/vprotocol.h|\
            */openmpi/ompi/mca/pml/base/pml_base_recvreq.h|\
            */openmpi/ompi/mca/pml/base/pml_base_sendreq.h|\
            */openmpi/ompi/peruse/peruse-internal.h|\
            */openmpi/ompi/mca/coll/base/coll_base_util.h|\
            */openmpi/ompi/mca/osc/base/osc_base_obj_convert.h|\
            */openmpi/ompi/mpi/fortran/mpif-h/prototypes_mpi.h|\
            */openmpi/ompi/mpi/fortran/mpif-h/bindings.h|\
            */openmpi/ompi/op/op.h|*/openmpi/include/mpif*.h|\
            */openmpi/mpiext/mpiext_pcollreq_mpifh.h|\
            */openmpi/opal/datatype/opal_datatype_copy.h|\
            */openmpi/opal/util/qsort.h|*/openmpi/mpiext/mpiext_affinity_c.h|\
            */openmpi/opal/sys/*/timer.h|*/openmpi/opal/sys/timer.h|\
            "/usr/lib/$multiarch/fortran"/*|\
            */KF5/KDELibs4Support/solid/networking.h|\
            */hiredis/adapters/macosx.h|*/hiredis/adapters/ae.h|\
            */firebird/UdrCppEngine.h|/usr/include/perf.h|\
            */apache2/mod_xml2enc.h|*/gsk/broadway/gskbroadwayrenderer.h|\
            */gsk/gl/gskglrenderer.h|*/gtk/deprecated/gtklockbutton.h|\
            */libavutil/hwcontext_cuda.h|*/libavutil/hwcontext_d3d11va.h|\
            */libavutil/hwcontext_dxva2.h|*/libavutil/hwcontext_qsv.h|\
            */libavutil/hwcontext_videotoolbox.h|*/wx/dde.h|\
            */wx/generic/bmpcbox.h|*/wx/generic/dataview.h|\
            */wx/generic/dvrenderer*.h|*/wx/generic/notebook.h|\
            */wx/generic/scrolwin.h|*/wx/generic/spinctlg.h|\
            */wx/generic/srchctlg.h|*/wx/unix/app.h|*/wx/unix/fontutil.h|\
            */wx/unix/glegl.h|*/wx/unix/taskbarx11.h|*/mpf2mpfr.h|*/GL/wglew.h|\
            */xmlrpcpp/base64.h|*/wlr/types/wlr_fullscreen_shell_v1.h|\
            */wlr/types/wlr_layer_shell_v1.h|*/wlr/types/wlr_tablet_v2.h|\
            */wlr/types/wlr_output_power_management_v1.h|\
            */wlr/types/wlr_pointer_constraints_v1.h|\
            */wlr/types/wlr_xdg_decoration_v1.h|*/wlr/types/wlr_xdg_shell.h|\
            */varnish/cache/cache.h|*/varnish/common/common_param.h|\
            */varnish/vdef.h|*/varnish/cache/cache_varnishd.h|*/varnish/vrt.h|\
            */varnish/tbl/*.h|*/varnish/vapi/vsl.h|*/varnish/vut.h|\
            */uhd/features/trig_io_mode_iface.hpp|\
            */uhd/rfnoc/traffic_counter.hpp|*/uhd/cal/*_generated.h|\
            */uhd/utils/pybind_adaptors.hpp|\
            */tao/pegtl/internal/file_mapper_win32.hpp|\
            */tao/pegtl/contrib/internal/endian_win.hpp|\
            */yaz/stemmer.h|*/upnp/TemplateSource.h|*/upnp/TemplateInclude.h|\
            */scotch*/*scotchf.h|*/enet/win32.h|*/Poco/*_WIN*.h|\
            */Poco/*_VX.h|*/Poco/FPEnvironment_*.h|*/Poco/*HPUX.h|\
            */Poco/Data/ODBC/Unicode_UNIXODBC.h|*/Poco/*_Android.h|\
            */Poco/EventLogChannel.h|*/Poco/Util/WinService.h|\
            */Poco/WindowsConsoleChannel.h|*/Poco/PipeImpl_DUMMY.h|\
            */Poco/Util/WinRegistry*.h|*/ply/ply-array.h|*/netpbm/ppmcmap.h|\
            */lirc/line_buffer.h|*/vlc/plugins/vlc_objects.h|\
            */vlc/plugins/vlc_main.h|*/xxh3.h|*/audio/mutex.h|\
            */audio/Alibint.h|*/ksysguard/sensors/SensorInfo_p.h|\
            */octave/defun-dld.h|*/octave/defun.h|*/octave/mex.h|\
            */octave/ov-intx.h|*/hfst/implementations/XfsmTransducer.h|\
            */hfst/parsers/Alphabet.h|*/hfst/parsers/OtherSymbolTransducer.h|\
            */hfst/parsers/Rule.h|*/hfst/parsers/*ArrowRule.h|\
            */hfst/parsers/*RuleContainer.h|*/hfst/parsers/TwolCGrammar.h|\
            */hfst/HfstTransition*.h|*/hfst/hfst_apply_schemas.h|\
            */hfst/implementations/HfstTransition*.h|\
            */hfst/HfstStrings2FstTokenizer.h|*/log4cpp/IdsaAppender.hh|\
            */log4cpp/NTEventLogAppender.hh|*/log4cpp/Win32DebugAppender.hh|\
            */config-win32.h|*/config-win.h|*/winver.h|\
            */phonenumbers/base/memory/singleton_*.h|\
            */phonenumbers/base/synchronization/lock_*.h|*/pari/mpinl.h|\
            */pari/paricom.h|*/pari/paridecl.h|*/pari/parierr.h|\
            */pari/parigen.h|*/pari/pariinl.h|*/pari/parinf.h|\
            */pari/paristio.h|*/nodejs/*/v8-inspector-protocol.h|\
            */nodejs/*/v8-wasm-trap-handler-win.h|*/nodejs/src/base64-inl.h|\
            */nodejs/src/histogram*.h|*/nodejs/src/node_perf.h|\
            */nodejs/src/node_http2.h|*/nodejs/src/node_wasi.h|\
            */nodejs/*win32*.h|*/nodejs/src/crypto/crypto_cipher.h|\
            */nodejs/src/crypto/crypto_keys.h|*/nodejs/src/node_crypto.h|\
            */nodejs/src/crypto/crypto_[abdehkpr]*.h|\
            */nodejs/src/crypto/crypto_common.h|\
            */nodejs/src/crypto/crypto_scrypt.h|\
            */nodejs/src/crypto/crypto_sig.h|*/nodejs/src/node_root_certs.h|\
            */NTL/PD.h|*/NTL/REPORT_ALL_FEATURES.h|\
            */mysql/mysqlx_ername.h|*/mongoc/mongoc-*.h|\
            */kdl/utilities/rallNd.h|*/OGRE/*OgreThreadHeadersTBB.h|\
            */OGRE/RenderSystems/GL/OgreGLSL*Program.h|\
            */OGRE/RenderSystems/GL/OgreGLSLLinkProgramManager.h|\
            */OGRE/RenderSystems/GL3Plus/OgreSPIRVShaderFactory.h|\
            */OGRE/RenderSystems/GLES2/GLSLES/OgreGLSLES*Program.h|\
            */OGRE/RenderSystems/GLES2/GLSLES/OgreGLSLESProgram[CMP]*.h|\
            */OGRE/RenderSystems/GLES2/OgreGLES2HardwareBufferManager.h|\
            */OGRE/RenderSystems/GLES2/OgreGLES2RenderSystem.h|\
            */OGRE/RenderSystems/GLES2/OgreGLES2Texture*.h|\
            */OGRE/*OgreDefaultWorkQueueTBB.h|\
            */msgpack/preprocessor/slot/detail/shared.hpp|\
            */msgpack/preprocessor/slot/detail/slot*.hpp|\
            */msgpack/preprocessor/iteration/detail/*.hpp|\
            */msgpack/predef/detail/test_def.h|\
            */msgpack/v[123]/*detail/cpp03_*.hpp|\
            */libgda-5.0/libgda/gda-server-provider-private.h|\
            */bulletml/bulletmlparser-ygg.h|*/osmium/geom/projection.hpp|\
            */opencascade/NCollection_Haft.h|*/opencascade/OSD_WNT.hxx|\
            */opencascade/ExprIntrp.tab.h|\
            */opencascade/AIS_DataMapIteratorOfDataMapOfSelStat.hxx|\
            */opencascade/AIS_DataMapOfSelStat.hxx|*/opencascade/WNT_Dword.hxx|\
            */opencascade/OpenGl_GLESExtensions.hxx|\
            */MediaInfoDLL/MediaInfoDLL_Static.h|*/log4shib/IdsaAppender.hh|\
            */log4shib/NTEventLogAppender.hh|*/log4shib/Win32DebugAppender.hh|\
            */log4shib/threading/*Threads.hh|\
            */imgui/backends/imgui_impl_metal.h|\
            */imgui/backends/imgui_impl_osx.h|\
            */imgui/backends/imgui_impl_wgpu.h|*/rpcsvc/yp.h|*/plib/pcx.h|\
            */plib/ssgaFire.h|*/plib/ssgaLensFlare.h|\
            */plib/ssgaParticleSystem.h|\
            */plib/ssgaWaveSystem.h|*/SFML/System/NativeActivity.hpp|\
            */recode.h|*/libprelude/idmef-tree-data.h|\
            */podofo/base/util/PdfMutexImpl_win32.h|\
            */podofo/base/util/PdfMutexImpl_noop.h|*/plplot/csa.h|\
            */plplot/nn.h|*/plplot/wxPLplotwindow.h|*/xmlrpc-c/abyss_winsock.h|\
            */xmlrpc-c/server_w32httpsys.h|*/xmlrpc_server_w32httpsys.h|\
            */xmlrpc-c/abyss_unixsock.h|*/mapnik/agg/agg_conv_gpc.h|\
            */mapnik/grid_vertex_converter.hpp|\
            */mapnik/cairo/render_polygon_pattern.hpp|\
            */mapnik/markers_placements/interior.hpp|*/mapnik/sse.hpp|\
            */mapnik/markers_placement.hpp|*/mapnik/marker_helpers.hpp|\
            */mapnik/*_impl.hpp|*/sunpinyin-2.0/pinyin/datrie_impl.h|\
            */core/posix/linux/proc/process/*.h|*/kinsol/kinsol_impl.h|\
            */kinsol/kinsol_ls_impl.h|*/m4ri/*_template.h|\
            */lpsolve/lp_solveDLL.h|*/lpsolve/lp_rlp.h|\
            */log4cxx/helpers/aprinitializer.h|*/log4cxx/helpers/tchar.h|\
            */log4cxx/private/*|*/log4cxx/filter/expressionfilter.h|\
            */log4cxx/rolling/*|*/KF5/kjs/grammar.h|*/z3_v1.h|\
            */xapp/libxapp/xapp-icon-chooser-button.h|*/jellyfish/int128.hpp|\
            */directfb-internal/media/idirectfbimageprovider_client.h|\
            */directfb-internal/dummy/dummy.h|\
            */directfb-internal/core/*_includes.h|\
            */directfb-internal/core/wm_module.h|\
            */directfb/direct/interface_implementation.h|\
            */Inventor/elements/SoGLNormalizeElement.h|\
            */Inventor/elements/SoGLShadeModelElement.h|\
            */Inventor/elements/SoGLTexture3EnabledElement.h|\
            */Inventor/elements/SoLongElement.h|\
            */Inventor/elements/SoTexture3EnabledElement.h|\
            */Inventor/oivwin32.h|*/Inventor/fields/SoMFLong.h|\
            */Inventor/fields/SoMFULong.h|*/Inventor/fields/SoSFLong.h|\
            */Inventor/fields/SoSFULong.h|*/gauche/win-compat.h|\
            */gauche/wthread.h|*/gauche/uthread.h|\
            */gauche-*/*/package-templates/extension.h|\
            */gap/src/boehm_gc.h|*/gap/src/baltree.h|*/gap/src/dynarray.h|\
            */gap/src/sortbase.h|\
            */gdcm-3.0/gdcmCAPICryptographicMessageSyntax.h|\
            */gdcm-3.0/gdcmConstCharWrapper.h|*/gdcm-3.0/gdcmDeflateStream.h|\
            */gdcm-3.0/zipstreamimpl.h|*/gdcm-3.0/gdcmBaseCompositeMessage.h|\
            */gdcm-3.0/gdcmCEchoMessages.h|*/gdcm-3.0/gdcm_j2k.h|\
            */gdcm-3.0/gdcm_jp2.h|*/gdcm-3.0/gdcmjpeg/*|*/kj/async-win32.h|\
            */private/qwaylandinputcontext_p.h|\
            */private/qwayland-server-xdg-shell-unstable-v5_p.h|\
            */private/wayland-xdg-shell-unstable-v5-server-protocol_p.h|\
            */webkit/webkit-web-process-extension.h|*/tomcrypt_*.h|\
            */libtorrent/aux_/route.h|*/libtorrent/aux_/windows.hpp|\
            */libtorrent/aux_/torrent_impl.hpp|*/libtorrent/aux_/win_util.hpp|\
            */libtorrent/storage.hpp|*/cyassl/*|*/wolfssl/wolfcrypt/wc_kyber.h|\
            */wolfssl/wolfcrypt/tfm.h|*/libirc_[eo]*.h|*/guichan/glut.hpp|\
            */glm/detail/*.hpp|*/glm/ext/*.hpp|*/glm/gtc/*.hpp|*/glm/gtx/*.hpp|\
            */iraf/lib/*|*/iraf/include/votParse_spp.h|\
            */iraf/unix/hlib/iraf*.h|*/iraf/unix/hlib/swap*.h|\
            */iraf/unix/hlib/mach*.h|*/iraf/unix/hlib/config.h|\
            */iraf/unix/hlib/knet.h|*/iraf/unix/hlib/math.h|\
            */fpvm3*.h|*/yara/parser.h|*/xmms2/xmmsclient/xmmsclient-cf.h|\
            */xmms2/xmmsclient/xmmsclient-qt.h|\
            */xmltooling/impl/ManagedResource.h|\
            */hypre/HYPRE_matrix_matrix_protos.h|*/hypre/HYPREf.h|\
            /usr/include/hypre/HYPRE*_f.h|\
            */Bpp/Phyl/Likelihood/SitePartitionTreeLikelihood.h|\
            */elementary-1/*_private.h|*/elementary-1/elm_part_helper.h|\
            */elementary-1/elm_widget_menu.h|\
            */libzfs/libzfs_impl.h|*/libzfs/sys/*.h|*/libspl/assert.h|\
            */libspl/rpc/xdr.h|*/libspl/umem.h|*/libspl/sys/*.h|\
            */gtksourceviewmm-3.0/gtksourceviewmm/private/styleschememanager_p.h|\
            */givaro/gfqkronecker.h|*/givaro/givarrayallocator.h|\
            */givaro/givmatdenseops.inl|*/givaro/givarrayfixed.h|\
            */givaro/givgenarith.h|*/recint/reclonglong.h|\
            */fplll/pruner/pruner_simplex.h|*/fixedfann.h|*/floatfann.h|\
            */dlib/bits/c++config.h|*/dlib/cuda/cuda_utils.h|*/dlib/gui*|\
            */dlib/matrix/mkl_fft.h|*/dlib/image_keypoint/draw_surf_points.h|\
            */dlib/image_processing/render_face_detections.h|\
            */dlib/*_kernel_1.h|*/dlib/java/*|*/dlib/python/numpy_image.h|\
            */dlib/python.h|*/dlib/test/*|*/libdap/D4FilterClause.h|\
            */libdap/PipeResponse.h|*/courier-unicode-script-tab.h|\
            */libcork/config/*|*/gcc/*|*/cgns*_f*.h|\
            */mariadb/mysql/client_plugin.h|*/ndctl/ndctl.h|\
            */mjpegtools/frequencies.h|*/ni/Linux-*/*.h|*/ni/XnCyclicQueueT.h|\
            */ni/XnDerivedCast.h|*/ni/XnQueueT.h|*/oop-www.h|\
            */libMUSCLE/dpregionlist.h|*/libMUSCLE/gapscoredimer.h|\
            */libMUSCLE/enums.h|*/minc_io_4d_volume.h|*/mimetic/os/directory.h|\
            */rime/gear/contextual_translation.h|\
            */rime/gear/key_binding_processor_impl.h|\
            */pmix2/include/pmix/src/*|*/xdp/*.bpf.h|*/xen/dom0_ops.h|\
            */libxl_json.h|*/_libxl_types_json.h|*/xen/arch-x86/*.h|\
            */xen/arch-x86_*.h|*/vigra/matlab.hxx|*/vigra/*fftw.hxx|\
            */vigra/delegate/detail/delegate_template.hxx|\
            */vigra/multi_opencl.hxx|*/vigra/random_forest/features.hxx|\
            */vigra/polytope.hxx|*/petscdmmoab.h|*/petscdmplexceed.h|\
            */petscviewersaws.h|*/openni2/Win32/*|*/vid.stab/transformfloat.h|\
            */vala-panel/panel-layout.h|*/volk/volk_avx*_intrinsics.h|\
            */volk/volk_sse*_intrinsics.h|*/vcflib/vec128int.h|\
            */vcflib/veclib_types.h|*/vcflib/BedReader.h|\
            */android/cutils/properties.h|*/android/cutils/sched_policy.h|\
            */libplacebo/utils/*_internal.h|*/libplacebo/utils/dav1d.h|\
            */libplacebo/utils/libav.h|*/libplacebo/d3d11.h|\
            */tsk/auto/tsk_is_image_supported.h|\
            */tsk/fs/tsk_exfatfs.h|*/tsk/fs/tsk_fatfs.h|*/tsk/fs/tsk_fatxxfs.h|\
            */tsk/util/detect_encryption.h|\
            */rocksdb/utilities/customizable_util.h|*/plotcompat.h|\
            */opencollada/COLLADASaxFrameworkLoader/COLLADASaxFWLCOLLADACsymbol.h|\
            */opencollada/COLLADASaxFrameworkLoader/COLLADASaxFWLPolygons.h|\
            */opencollada/COLLADAFramework/COLLADAFWShaderConstantFX.h|\
            */opencollada/COLLADAFramework/COLLADAFWShaderBlinn.h|\
            */opencollada/COLLADAFramework/COLLADAFWShaderLambert.h|\
            */opencollada/COLLADAFramework/COLLADAFWShaderPhong.h|\
            */opencollada/COLLADAStreamWriter/COLLADASWBuffer.h|\
            */rcutils/rcutils/stdatomic_helper/win32/stdatomic.h|\
            */rcutils/rcutils/stdatomic_helper.h|*/Qt5GStreamer/QGlib/*impl.h|\
            */polly/Support/LinkGPURuntime.h|*/pgm-*/pgm/in.h|*/pgm-*/pgm/winint.h|\
            */openhpi/oh_clients.h|*/netcdf/mpi/include/netcdf_par.h|\
            */mutter-12/clutter/clutter/clutter-mutter.h|\
            */mutter-12/clutter/clutter/deprecated/clutter-timeline.h|\
            */newmat/boolean.h|*/inotifytools/inotify-nosys.h|\
            */libhdhomerun/hdhomerun_os_windows.h|\
            */gstreamermm-1.0/gstreamermm/private/*.h|*/rapmap/Boo???.hpp|\
            */rapmap/FrugalBooMap.hpp|*/rapmap/HitManager.hpp|\
            */rapmap/PairAlignmentFormatter.hpp|*/rapmap/RapMapSAIndex.hpp|\
            */rapmap/RapMapUtils.hpp|*/rapmap/SACollector.hpp|\
            */rapmap/SASearcher.hpp|*/rapmap/SingleAlignmentFormatter.hpp|\
            */SuperCollider/common/wintime.h|\
            */SuperCollider/plugin_interface/SC_BelaScope.h|*/ctn/UxXt.h|\
            */libfungw/scconfig_hooks.h|*/vacall.h|\
            */libetpan/imapdriver_tools_private.h|*/libetpan/namespace_parser.h|\
            */libetpan/namespace_sender.h|*/libetpan/quota_parser.h|\
            */libetpan/quota_sender.h|\
            */speech_tools/EST_model_types.h|*/speech_tools/EST_lattice_io.h|\
            */speech_tools/EST_dynamic_model.h|*/speech_tools/EST_TTimeIndex.h|\
            */ept/test.h|*/gribex/*.h|*/interpolation/*.h|*/pbio/*.h|\
            */libEMF/wine/poppack.h|\
            */draco/compression/attributes/prediction_schemes/prediction_scheme_decoder_factory.h|\
            */draco/compression/attributes/sequential_normal_attribute_decoder.h|\
            */docopt/docopt_private.h|*/cxxtools/json/responder.h|\
            */casacore/casa/OS/HostInfoHpux.h|\
            */casacore/casa/OS/HostInfoIrix.h|\
            */casacore/casa/OS/HostInfoOsf1.h|\
            */casacore/casa/OS/Mutex.h|\
            */casacore/casa/Utilities/Template.h|\
            */casacore/mirlib/hio.h|\
            */casacore/mirlib/io.h|\
            */casacore/python/Converters.h|\
            */casacore/python/Converters/*.h|\
            */casacore/scimath/Functionals/EclecticFunctionFactory.h|\
            */casacore/scimath/Mathematics/DFTServer.h|\
            */casacore/scimath/Mathematics/NumericTraits2.h|\
            */casacore/scimath/Mathematics/SparseDiffX.h|\
            */utilspp/*.hpp|*/pplx/pplxconv.h|*/pplx/pplxwin.h|\
            */COS/CosCompoundLifeCycle.hh|*/COS/CosContainment.hh|\
            */COS/CosExternalization.hh|*/COS/CosExternalizationContainment.hh|\
            */COS/CosExternalizationReference.hh|*/COS/CosGraphs.hh|\
            */COS/CosLifeCycleContainment.hh|*/COS/CosLifeCycleReference.hh|\
            */COS/CosQuery.hh|*/COS/CosReference.hh|*/COS/CosRelationships.hh|\
            */COS/CosStream.hh|*/clipper/clipper-cctbx.h|\
            */coin/CbcParam.hpp|*/signond/signontrace.h|*/moar/jit/internal.h|\
            */terralib/functions/TeImportExport.h|*/terralib/kernel/gra_util.h|\
            */terralib/kernel/TeCoverage.h|\
            */terralib/kernel/TeCoverageDecoder.h|\
            */terralib/kernel/TeCoverageImport.h|\
            *terralib/kernel/TeCoverageInterpolatorNN.h|\
            */terralib/kernel/TePieBar.h|\
            */terralib/kernel/TeGeneralizedProxMatrix.h|\
            */terralib/kernel/TeCoverageDecoderCacheLRU.h|\
            */terralib/kernel/TeCoverageDecoderDatabase.h|\
            */terralib/kernel/TeCoverageInterpolator.h|\
            */terralib/kernel/TeSparseMatrix.h|\
            */tclcl/tclcl-internal.h|*/tclcl/rate-variable.h|\
            */Random123/features/clangfeatures.h/|\
            */Random123/features/iccfeatures.h|\
            */Random123/features/metalfeatures.h|\
            */Random123/features/msvcfeatures.h|\
            */Random123/features/nvccfeatures.h|\
            */Random123/features/open64features.h|\
            */Random123/features/openclfeatures.h|*/Random123/features/sse.h|\
            */Random123/features/sunprofeatures.h|\
            */pwizlite/pwiz/data/msdata/*_mz5.hpp|\
            */pwizlite/pwiz/data/msdata/RAMPAdapter.hpp|\
            */pwizlite/pwiz/utility/misc/cpp_cli_utilities.hpp|\
            */pwizlite/boost/nowide/windows.hpp|\
            */mia-2.4/mia/3d/multireg.hh|*/mia-2.4/mia/core/scaler1d.hh|\
            */lasso/keyprivate.h|*/luabind/detail/object_call.hpp|\
            */martchus-qtutilities/qtutilities/resources/importplugin.h|\
            */itpp/itmex.h|\
            */log4cplus/internal/*|*/log4cplus/thread/impl/*|\
            */luabind/detail/*|*/osmocom/ranap/RANAP_*.h|\
            */pcl/*/impl/*|*/pcl/modeler/main_window.h|\
            */pcl/io/fotonic_grabber.h|*/sprng/sprng_f.h|\
            */metis*/metisf.h|*/python3.11/cpython/*|*/python3.11/internal/*|\
            */python3.11/pydtrace.h|*/gfal2/common/gfal_plugin.h|\
            */gtkextra/gtkfileicons.h|*/libktorrent/util/win32.h|\
            */libktorrent/dht/findnodersp.h|*/libktorrent/dht/getpeersrsp.h|\
            */genht/ht_inlines.h|*/genht/ht.h|*/core/dbus/impl/*|\
            */core/dbus/interfaces/*)
                continue ;;
            */openmpi/ompi/frameworks.h|*/openmpi/opal/frameworks.h|\
            */openmpi/orte/frameworks.h|*/openmpi/opal/mca/base/mca_base_var.h|\
            */Bullet3Collision/NarrowPhaseCollision/shared/b3ClipFaces.h|\
            */Bullet3Collision/NarrowPhaseCollision/shared/b3ContactSphereSphere.h)
                # These are missing extern 'C'.
                echo 'extern "C" {' >> workarounds.h
                echo "#include \"$header\"" >> workarounds.h
                echo '}' >> workarounds.h
                continue
                ;;
            */bglibs/sysdeps.h)
                # Redeclares system functions without (wrong in C++) arguments
                grep -v '^extern' "$header" >> workarounds.h
                continue
                ;;
            */netpbm/runlength.h|*/libgit2-glib-1.0/libgit2-glib/ggit-branch-enumerator.h)
                # and this is missing the closing of the extern C
                echo "#include \"$header\"" >> workarounds.h
                echo '}' >> workarounds.h
                continue
                ;;
            */libdframeworkdbus-2.0/com_deepin_appstore_metadata.h)
                #  Both __Metadata and __AppStore are typedefed to AppStore
                echo "#define AppStore Metadata" >> workarounds.h
                echo "#include \"$header\"" >> workarounds.h
                echo "#undef AppStore" >> workarounds.h
                continue
                ;;
            */libdframeworkdbus-2.0/types/defenderprocesslist.h)
                # Both DefenderProcessList and ArrayInt are QList<int> typedefs and
                # hence the metatypes are declared twice
                grep -v 'Q_DECLARE_METATYPE' "$header" >> workarounds.h
                continue
                ;;
            */openmpi/ompi/mca/common/ompio/common_ompio_print_queue.h)
                # So this header has a END_C_DECLS but no BEGIN_C_DECLS so we have to hack that into it.
                # embedding it into our workarounds.h such that we pick it up first in the preamble.
                sed "s/#define MCA_COMMON_OMPIO_QUEUESIZE.*/\0\nBEGIN_C_DECLS/" "$header" >> workarounds.h
                ;;
            */glslang/SPIRV/GLSL.ext.NV.h)
                echo '#include "glslang/SPIRV/spirv.hpp"' >> workarounds.h
                echo 'namespace spv {' >> workarounds.h
                echo "#include \"$header\"" >> workarounds.h
                echo '}' >> workarounds.h
                continue
                ;;
            */directfb/fusion/object.h)
                # See it starts with } and then gets an extern "C" later which then again misses the }
                sed 's/FusionObjectID;$/FusionObjectID; extern "C" {/' "$header" >> workarounds.h
                echo '}' >> workarounds.h
                continue
                ;;
            */directfb-internal/core/*_driver.h)
                # All the headers declare the same variable I guess it's an entry point
                sed "s/driver_funcs =/driver_funcs_$RANDOM =/" "$header" >> workarounds.h
                continue
                ;;
            */orthanc-framework/Pkcs11.h|\
            */orthanc-framework/DicomParsing/DicomModification_*.impl.h)
                # - PKCS#11 is disabled in the build and the header is unusable
                # - DicomModification_*.impl.h are not public headers and can't
                #   be used directly
                continue
                ;;
            */include/argtable2.h)
                cat << EOF > workarounds.h
typedef struct arg_end arg_end_t;
typedef struct arg_rem arg_rem_t;

#define arg_end arg_end_t
#define arg_rem arg_rem_t
EOF
                ;;
            */flann/mpi/index.h)
                sed 's|flann::mpi::load_from_file|flann::load_from_file|g' "$header" > workarounds.h
                ;;
            */log4cpp/threading/*)
                # These files cannot be included all at the same time; instead
                # we use virtual packages to include each implementation header
                # at a time
                continue
                ;;
            */liblangtag/lt-messages.h|*/liblangtag/lt-utils.h|*/liblangtag/lt-xml.h)
                continue
                ;;
            */mariadb/ma_tls.h|*/mariadb/mariadb_com.h|*/mariadb/mariadb_ctype.h|\
            */mariadb/mariadb_stmt.h|mariadb/mariadb_version.h)
                continue
                ;;
            */KPropertyWidgets3/linestyleedit.h)
                continue
                ;;
            */iraf/noao/lib/*)
                continue
                ;;
            */adplug/fmopl.h|*/adplug/adlibemu.h|*/adplug/woodyopl.h)
                continue
                ;;
            */libapogee/AspenFx2.h)
                continue
                ;;
            */allegro*/*)
                case $header in
                    *aliphone*|*bcc32*|*direct3d*|*android*|*msvc*|*mngw32*|\
                    *osx*|*raspberrypi*|*watcom*|*alwin*|*/wgl_*)
                        continue
                        ;;
                    *)
                        ;;
                esac
                ;;
            */opencv4/opencv2/*/cap_ios.h|\
            */opencv4/opencv2/*/ios.h|\
            */opencv4/opencv2/*/macosx.h)
                continue
                ;;
            */opencv4/opencv2/imgcodecs/imgcodecs_c.h)
                # #error "This header with legacy C API declarations has been removed from OpenCV.
                continue
                ;;
            */omnithread/nt.h|*/omnithread/pthread_nt.h)
                continue
                ;;
            */zookeeper/win*.h)
                continue
                ;;
            */oce/*WNT_*|*/oce/NCollection_Haft.h)
                continue
                ;;
            /usr/include/ipecanvas_cocoa.h)
                continue
                ;;
            */boost/asio/experimental/*co_composed.hpp|\
            */boost/asio/experimental/*coro.hpp|\
            */boost/asio/experimental/*co_spawn.hpp|\
            */boost/asio/experimental/detail/coro_completion_handler.hpp|\
            */boost/asio/experimental/detail/partial_promise.hpp|\
            */boost/atomic/detail/wait_*_umtx.hpp|\
            */boost/asio/ssl/impl/src.hpp|\
            */boost/asio/impl/src.hpp|\
            */boost/chrono/detail/inlined/win/*|\
            */boost/chrono/detail/inlined/mac/*|\
            */boost/compute/interop/opencv/ocl.hpp)
                # - require experimental/coroutine which only exists lib libc++-1?-dev
                # - umtx is freebsd/dragonfly
                # - {,ssl}/impl/src.hpp refuse to build with
                #    BOOST_ASIO_HEADER_ONLY=1 which is the default
                # - chrono/detail/inlined/{mac,win}/ is for mac/windows
                # - opencv/ocl.hpp needs opencv2/ocl/ocl.hpp which isn't anywhere
                continue
                ;;
            */llvm-1?/include/lld/Common/Version.h)
                # includes lld/Common/Version.inc which doesn't exist anywhere
                continue
                ;;
            */llvm-1?/include/c++/v1/__support/*)
                # paths under this are android, fuchsia, ibm, musl, newlib,
                # solaris, win32 and xlocale
                # I also don't think any of the files under xlocale are meant
                # to be included directly
                continue;;
            */llvm-1?/include/lldb/Host/common/*|\
                */llvm-1?/include/lldb/Host/linux/*|\
                */llvm-1?/include/lldb/Host/posix/*)
                # Don't skip these: the pattern is here so that we can skip
                # everything else below the next match (*llvm-?/includes/lldb/Host/*)
                ;;
            */llvm-1?/include/lldb/Host/*/*)
                # everything not protected by the pattern above
                continue
                ;;
            */llvm-1?/include/lldb/Target/AppleArm64ExceptionClass.h)
                # Apple Arm64
                continue
                ;;
            */llvm-1?/lib/clang/1?*/include/arm64intr.h)
                # #include_next <arm64intr.h> but there is no other arm64intr.h
                continue
                ;;
            */smpi/mpif.h|*/smpi/smpi_extended_traces_fortran.h)
                # fortran
                continue
                ;;
            */c++/1?/experimental/bits/simd_ppc.h|*/c++/1?/experimental/bits/simd_x86*.h)
                # SIMD for PPC or x86
                continue
                ;;
            # */${multiarch}/visp3/visp_core.h)
            #     # #include "/build/reproducible-path/visp-3.6.0/obj-arm-linux-gnueabihf/include/arm-linux-gnueabihf/visp3/core/vpConfig.h" which doesn't exist
            #     continue
            #     ;;
            */postgresql/1?/server/server/port/cygwin.h|\
                */postgresql/1?/server/server/port/darwin.h|\
                */postgresql/1?/server/server/port/freebsd.h|\
                */postgresql/1?/server/server/port/hpux.h|\
                */postgresql/1?/server/server/port/netbsd.h|\
                */postgresql/1?/server/server/port/openbsd.h|\
                */postgresql/1?/server/server/port/solaris.h|\
                */postgresql/1?/server/server/port/win32.h)
                continue
                ;;
            */hwy/ops/arm_sve*|*/hwy/ops/ppc*|*/hwy/ops/rvv*|*/hwy/ops/wasm*|*/hwy/ops/x86*)
                # For other arches; note that ARM SVE was introduced in 2018
                continue
                ;;
            */codeblocks/templates/wizard/*)
                # Several things for other platforms below this location and
                # more importantly: it's probably not used for shared libraries
                continue
                ;;
            */share/xmake/templates/*)
                continue
                ;;
            */claw/*_traits_win32.hpp)
                continue
                ;;
            */include/FL/mac.?|*/include/FL/win32.?)
                continue
                ;;
            */include/openigtlink/igtl_win32header.h|\
                */include/openigtlink/igtlWin32Header.h|\
                */include/openigtlink/igtlWindows.h)
                continue
                ;;
            */include/quickfix/dirent_windows.h|*/include/quickfix/stdafx.h|*/include/quickfix/stdint_msvc.h|\
                */include/quickfix/Odbc*.h)
                continue
                ;;
            */include/Swiften/*/Windows*.h|*/include/Swiften/StringCodecs/SHA1_Windows.h)
                continue
                ;;
            */include/wvstreams/wvwin*.h|*/include/wvstreams/unipstoregen.h|*/include/wvstreams/uniregistrygen.h)
                continue
                ;;
            */include/php/*/TSRM/tsrm_win32.h)
                continue
                ;;
            */python3/dist-packages/greenlet/platform/switch_arm32_gcc.h)
                # Don't skip; it's the only one to keep in this directory
                ;;
            */python3/dist-packages/greenlet/platform/switch_*.h)
                continue
                ;;
            */include/mongo/platform/windows_basic.h|\
                */include/mongo/platform/atomic_intrinsics_win32.h|\
                */include/mongo/platform/atomic_intrinsics_gcc.h|\
                */include/mongo/platform/atomic_intrinsics_gcc_sync.h|\
                */include/mongo/platform/atomic_intrinsics_gcc_intel.h|\
                */include/mongo/platform/atomic_word_cxx11.h|\
                */include/mongo/*/*-inl.h)
                # *-inl seems to stand for "internal"
                # atomic_intrinsics_gcc{,_sync}.h are excluded because they
                # cause a small build issue and I don't think they affect the
                # ABI
                continue
                ;;
            */share/R/include/R_ext/GraphicsDevice.h)
                # - GraphicsDevice.h: not supposed to be included directly
                continue
                ;;
            */numpy/*/npy_*_deprecated_api.h|\
                */numpy/core/include/numpy/__*.h|\
                */numpy/f2py/src/fortranobject.h)
                continue
                ;;
            */R/site-library/Rcpp/examples/*)
                continue
                ;;
            */perl5/*/DBI/Driver_xst.h)
                # Broken header (uses a that is itself broken)
                continue
                ;;
            */perl5/*/Tk/pTk/compat/*.h|\
                */perl5/*/Tk/pTk/ks_names.h)
                # - compat/*.h: for other libcs I think
                # - ks_names.h: pure data and not-directly valid C
                continue
                ;;
            */include/ace/config-linux.h)
                # Protect this header: all other in the directory will be
                # excluded by another rule below
                ;;
            */include/ace/config-*.h)
                continue
                ;;
            */include/*/pygame/camera.h)
                continue
                ;;
            */include/ace/os_include/os_local.h|\
                */include/ace/os_include/os_trace.h)
                # search for "local.h" and "trace.h" which I guess exists on
                # some systems but not linux
                continue
                ;;
            */lib/llvm-16/lib/clang/16/include/arm64.h)
                continue
                ;;
            */lib/llvm-16/lib/clang/16/include/arm*.h)
                # Protect these headers from being dropped
                ;;
            */lib/llvm-16/lib/clang/16/include/__*.h|\
                */lib/llvm-16/lib/clang/16/include/*.h)
                # - __*.h: most likely internal headers and only intrinsics anyway
                #
                continue
                ;;
            */valgrind/vki/vki-darwin.h)
                continue
                ;;
            */include/libretro-common/defines/cocoa_defines.h)
                continue
                ;;
            */include/postgresql/16/server/extension/pllua/pllua_luajit.h)
                continue
                ;;
            *)
                ;;
        esac

        echo "$header" >> "logs/${devpkg}/${devpkg}_base.xml"
    done
    IFS="$OLD_IFS"
    cat >> "logs/${devpkg}/${devpkg}_base.xml" <<EOF
</headers>
<include_preamble>
$preamble
</include_preamble>
<add_include_paths>
$includes
</add_include_paths>
<skip_include_paths>
/usr/include/isc
/usr/include/$multiarch/sys
/usr/include/$multiarch/bits
/usr/include/absl/base/internal
/usr/include/postgresql/15/server/port/win32
/usr/include/postgresql/16/server/port/win32
/usr/include/postgresql/15/server/port/win32_msvc
/usr/include/postgresql/16/server/port/win32_msvc
/usr/include/tcl8.6/tcl-private/compat
/usr/include/google/protobuf
/usr/include/xmlsec1/xmlsec
/usr/include/wx-3.2/wx
/usr/include/boost/compatibility/cpp_c_headers
/usr/include/boost/hana/ext
/usr/include/libewf
/usr/include/dlib
/usr/include/dlib/string
/usr/include/gcc
/usr/include/gcc/x86_64
/usr/include/commoncpp
/usr/include/ucommon
/usr/include/xen
/usr/include/libvmdk
/usr/include/libvhdi
/usr/include/nop/utility
/usr/include/android/android-base
/usr/include/moar/platform
/usr/include/seqan3/std
/usr/lib/${multiarch}/fortran/
/usr/lib/gauche-0.97/0.9.10/include/gauche
/usr/lib/klibc/include/bits64
</skip_include_paths>
<skip_types>
$exclude_types
</skip_types>
<skip_namespaces>
$exclude_namespaces
</skip_namespaces>
<skip_symbols>
pselect
select
fgetpos
fopen
freopen
fseeko
fsetpos
ftello
tmpfile
sigtimedwait
getsockopt
recvmmsg
recvmsg
sendmmsg
sendmsg
setsockopt
adjtime
futimes
futimesat
getitimer
gettimeofday
lutimes
setitimer
settimeofday
utimes
clock_adjtime
clock_getres
clock_gettime
clock_nanosleep
clock_settime
ctime
ctime_r
difftime
gmtime
gmtime_r
localtime
localtime_r
mktime
nanosleep
time
timegm
timelocal
timer_gettime
timer_settime
timespec_get
timespec_getres
ftruncate
lockf
lseek
pread
pwrite
truncate
mkostemp
mkostemps
mkstemp
mkstemps
pthread_clockjoin_np
pthread_cond_clockwait
pthread_cond_timedwait
pthread_mutex_clocklock
pthread_mutex_timedlock
pthread_rwlock_clockrdlock
pthread_rwlock_clockwrlock
pthread_rwlock_timedrdlock
pthread_rwlock_timedwrlock
pthread_timedjoin_np
sched_rr_get_interval
fstat64
fstatat64
futimens
lstat64
stat64
utimensat
fstat
fstatat
lstat
stat
gai_suspend
fcntl64
ppoll
fallocate
creat
fcntl
open
openat
posix_fadvise
posix_fallocate
</skip_symbols>
<defines>
#define __STDC_VERSION__ 201710L
#define _GXX_NULLPTR_T
#define CLUTTER_ENABLE_COMPOSITOR_API 1
#define _REGEX_NELTS(n)
#define _Atomic
#define PACKED
#ifdef __cplusplus
// C17 compat layer
#define _Alignof(type) alignof(type)
#endif
#define getaddrinfo_a(a,b,c,d) /* */
$defines
</defines>
<libs>
EOF

    for lib in $libs; do
        echo "$lib" >> "logs/${devpkg}/${devpkg}_base.xml"
    done
    echo '</libs>' >> "logs/${devpkg}/${devpkg}_base.xml"
    sed -e's/>v1</>v1_lfs</; /STDC/a\
#define _FILE_OFFSET_BITS 64
' "logs/${devpkg}/${devpkg}_base.xml" > "logs/${devpkg}/${devpkg}_lfs.xml"
    sed -e's/v1_lfs/v1_time_t/; /STDC/a\
#define _TIME_BITS 64' "logs/${devpkg}/${devpkg}_lfs.xml" \
    > "logs/${devpkg}/${devpkg}_time_t.xml"
    rm -f "${devpkg}_base.dump" "${devpkg}_lfs.dump" "${devpkg}_time_t.dump"

    log_msg "Build $devpkg"

    # Run the ABI dump in background. All jobs will be started in the
    # background but if not in parallel mode, jobs will be waited for
    # immediately, effectively serializing them.
    a_c_c "base"&
    job_acc_base=$!

    # If ! $parallel, wait for this job immediately
    if ! $parallel; then
        if wait "$job_acc_base"; then
            job_acc_base_ret=true
        else
            job_acc_base_ret=false
        fi
        unset job_acc_base
    fi

    # Run other jobs, either after the first a-c-c call has succeeded, or in
    # parallel with it.
    # We don't do the same dance before starting the second a-c-c call because
    # we assume that if the first one succeeds, the other two will also
    # succeed. There's no guarantee about that but in the worst case, the
    # script will error out someone will take a look at the package.
    #
    # NOTE: if $parallel, there's no good default value for job_acc_base_ret
    # but bash and zsh don't care about the syntax below even though you'd get
    # a syntax error if you were substituting $job_acc_base_ret for nothing
    # manually while keeping the '&&'
    if { ! $parallel && $job_acc_base_ret ; } || $parallel; then
        # If running jobs in parallel, sleep a bit in order to stagger jobs
        # and make logs a bit more readable
        $parallel && sleep 0.5
        a_c_c "lfs"&
        job_acc_lfs=$!
        if ! $parallel; then wait "$job_acc_lfs"; unset job_acc_lfs; fi

        $parallel && sleep 0.5
        a_c_c "time_t"&
        job_acc_time_t=$!
        if ! $parallel; then wait "$job_acc_time_t"; unset job_acc_time_t; fi
    fi

    # If the a-c-c run for "base" fails, mark the package as failed-compilation
    # and continue
    if { ! $parallel && ! $job_acc_base_ret ; } \
       || { $parallel && ! wait "${job_acc_base}"; }
    then
        log_msg "Compilation of $devpkg failed"

        if $parallel; then
            wait "${job_acc_lfs}" "${job_acc_time_t}" || true
        fi

        log_file="logs/${devpkg}/base/log.txt"
        if ${clippy_enabled} && [[ -e "${log_file}" ]]; then
            log_msg Clippy will have a look

            # Clippy is allowed to fail
            clippy_ret=0
            # Store whatever clippy might have already proposed in order to
            # ensure clippy is not stuck
            clippy_previous_proposal="${clippy_proposal-}"
            clippy_proposal="$(clippy "${log_file}")" || clippy_ret=$?
            if [[ ${clippy_ret} -eq 0 ]] && [[ -n "${clippy_proposal}" ]] && [[ "${clippy_proposal}" != "${clippy_previous_proposal}" ]]; then
                clippy_packages="${clippy_packages:+${clippy_packages} }${clippy_proposal}"
                clippy_thinks_the_package_should_be_tried=true
            else
                log_msg "Clippy either failed or had nothing new to propose."
            fi

            if [[ -n "${clippy_packages}" ]]; then
                clippy_hints="${clippy_hints:+${clippy_hints}$'\n'}- $devpkg_no_virtual: ${clippy_packages}"
                echo "${clippy_packages}" > "logs/${devpkg_no_virtual}/clippy_hints.txt"
            fi
        fi

        # Don't store the result as failed if clippy will try something
        # in order to avoid duplicates in the stats display (sometimes
        # there are more than 10 clippy iterations due to missing
        # dependency and that inflates the final output to the point of
        # being difficult to read).
        if ! "${clippy_thinks_the_package_should_be_tried}"; then
            result_failed_compilation "$devpkg"
        fi

        a_c_c_clean "$devpkg"

        continue
    fi

    if $parallel; then
        # We need two separate calls to 'wait' in order to reflect the
        # corresponding return codes: "wait $job1 $job2" returns the same code
        # as $job2 and ignores the one from $job1.
        wait "${job_acc_lfs}"
        wait "${job_acc_time_t}"
    fi

    result_dumped "${devpkg}"

    a_c_c_backup "$devpkg"
    a_c_c_clean "$devpkg"
done

    if [[ -e 'exit-after-current' ]]; then
        rm -f 'exit-after-current'
        break 2
    fi

done
