Valac and meson: overriding a built-in .vapi when linking with native library?

Is there a way to use meson and valac for overriding a built-in .vapi but still linking with the required shared library? I’m trying to vendor gnutls.vapi to add a couple functions (which could maybe get added upstream eventually) but it won’t compile because there are obviously multiple definitions of the same symbols because the built-in gnutls.vapi is found via the standard pkg-config mechanism.

In meson, I have the following:

deps = [
    dependency('glib-2.0'),
    dependency('gio-2.0'),
    dependency('gobject-2.0'),
    meson.get_compiler('vala').find_library('gnutls', dirs: meson.current_source_dir() / 'vendor' / 'vapi'),
    dependency('gnutls').partial_dependency(compile_args: false, link_args: false, links: false, sources: false) #partial_dependency doesn't do anything.
]

sources = [
    'main.vala'
]

lib = shared_library(
    'orgselfsignedgen',
    sources: sources,
    dependencies: deps,
    install: true,
    vala_gir: 'OrgSelfSignedGen-0.1.gir',
    install_dir: [true, true, true, true]
)

Meson generates some args --pkg gnutls /run/build/orgselfsignedgen/vendor/vapi/gnutls.vapi. I think what I need is for meson to not generate --pkg gnutls but still link with the gnutls.so at the linking stage. I can drop the dependency(‘gnutls’) but then the linking will fail.

I also tried dependency(‘gnutls’, language: ‘c’) but get ERROR: gnutls dependency does not accept “language” keyword argument.

Solved my own issue. Just had to use the standard meson mechanism of creating the gnutls dependency using the specific compiler object:

meson.get_compiler('c').find_library('gnutls')