# Maintainer: Peter Jackson <pete@peteonrails.com>
#
# voxtype-bin-rc tracks the latest GitHub pre-release of voxtype (e.g.,
# v0.7.3-rc1, v0.8.0-rc2). Stable users should stay on `voxtype-bin`.
# This package conflicts with `voxtype-bin` and `voxtype` so users do not
# accidentally have two daemons fighting over /usr/bin/voxtype.
#
# Updating for a new RC tag:
#   1. Set `pkgver` to the upstream tag with the hyphen before "rc" replaced
#      by a dot. AUR forbids hyphens in pkgver (they delimit pkgrel), so
#      "v0.7.3-rc1" becomes pkgver=0.7.3.rc1. The `_upstream_ver` line below
#      reverses the substitution for the GitHub download URLs.
#   2. Reset `pkgrel=1`. Per CLAUDE.md, new binaries always need a fresh
#      pkgver so AUR helpers re-download instead of trusting their cache.
#   3. Fill in `sha256sums` from the uploaded release artifacts.
#   4. Run `makepkg --printsrcinfo > .SRCINFO`.

pkgname=voxtype-bin-rc
pkgver=1.0.0.rc4
pkgrel=1
pkgdesc="Push-to-talk voice-to-text for Linux (pre-built binaries, release candidate channel)"
arch=('x86_64')
url="https://voxtype.io"
license=('MIT')
depends=(
    'alsa-lib'
    'curl'
    'gcc-libs'
    'glibc'
)
optdepends=(
    'wtype: keyboard simulation for Wayland (recommended, best CJK support)'
    'dotool: keyboard simulation with layout support (KDE/GNOME compatible)'
    'ydotool: keyboard simulation fallback (X11/TTY support)'
    'wl-clipboard: clipboard support'
    'libnotify: desktop notifications'
    'pipewire: audio server (recommended)'
    'pipewire-alsa: ALSA compatibility for PipeWire (required if using PipeWire)'
    'pulseaudio: audio server (alternative to PipeWire)'
    'vulkan-icd-loader: GPU acceleration via Vulkan for Whisper (enable with: voxtype setup gpu --enable)'
    'cuda: GPU acceleration via CUDA 13 for ONNX engines (NVIDIA GPUs, requires driver 580+)'
    'cuda12.6: GPU acceleration via CUDA 12 for ONNX engines (older NVIDIA setups)'
    'rocm-hip-runtime: GPU acceleration via MIGraphX for ONNX engines (AMD GPUs)'
    'migraphx: required alongside rocm-hip-runtime for the MIGraphX provider (#444)'
    'ollama: local AI summarization for meeting mode'
    'gtk4-layer-shell: runtime for the GTK4 on-screen mic visualizer (voxtype-osd-gtk4)'
    'quickshell: Quickshell-based on-screen display frontend (opt in via [osd] frontend = "quickshell")'
)
provides=('voxtype')
conflicts=('voxtype' 'voxtype-bin')
backup=('etc/voxtype/config.toml')
install=voxtype-bin-rc.install
validpgpkeys=(
    # Peter Jackson's offline maintainer primary. Signed binary .asc files
    # through v0.7.4 and cross-signed the CI primary below.
    'E79F5BAF8CD51A806AA27DBB7DA2709247D75BC6'
    # Voxtype CI release signing primary (cross-signed by E79F5BAF...).
    # Signs every release asset from v0.7.5 on, including this RC, so it
    # has to be listed or makepkg rejects the sources on any machine that
    # does not already trust it. Auto-fetchable by fingerprint.
    '9CCF7915B750CAE8B095ED1AA3FC9F33FD209279'
)

# Reverse the rc-pkgver mangling so GitHub URLs use the real tag name.
# pkgver=0.7.3.rc1 -> _upstream_ver=0.7.3-rc1 -> tag v0.7.3-rc1.
_upstream_ver="${pkgver/.rc/-rc}"
_github="https://github.com/peteonrails/voxtype/releases/download/v${_upstream_ver}"
_raw="https://raw.githubusercontent.com/peteonrails/voxtype/v${_upstream_ver}"

source=(
    # Whisper binaries
    "voxtype-${pkgname}-${pkgver}-avx2::${_github}/voxtype-${_upstream_ver}-linux-x86_64-avx2"
    "voxtype-${pkgname}-${pkgver}-avx2.asc::${_github}/voxtype-${_upstream_ver}-linux-x86_64-avx2.asc"
    "voxtype-${pkgname}-${pkgver}-avx512::${_github}/voxtype-${_upstream_ver}-linux-x86_64-avx512"
    "voxtype-${pkgname}-${pkgver}-avx512.asc::${_github}/voxtype-${_upstream_ver}-linux-x86_64-avx512.asc"
    "voxtype-${pkgname}-${pkgver}-vulkan::${_github}/voxtype-${_upstream_ver}-linux-x86_64-vulkan"
    "voxtype-${pkgname}-${pkgver}-vulkan.asc::${_github}/voxtype-${_upstream_ver}-linux-x86_64-vulkan.asc"
    # ONNX CPU binaries (all ONNX engines: Parakeet, Moonshine, SenseVoice, Paraformer, Dolphin, Omnilingual)
    "voxtype-${pkgname}-${pkgver}-onnx-avx2::${_github}/voxtype-${_upstream_ver}-linux-x86_64-onnx-avx2"
    "voxtype-${pkgname}-${pkgver}-onnx-avx2.asc::${_github}/voxtype-${_upstream_ver}-linux-x86_64-onnx-avx2.asc"
    "voxtype-${pkgname}-${pkgver}-onnx-avx512::${_github}/voxtype-${_upstream_ver}-linux-x86_64-onnx-avx512"
    "voxtype-${pkgname}-${pkgver}-onnx-avx512.asc::${_github}/voxtype-${_upstream_ver}-linux-x86_64-onnx-avx512.asc"
    # ONNX CUDA 12 binary + companion shared libs
    "voxtype-${pkgname}-${pkgver}-onnx-cuda-12::${_github}/voxtype-${_upstream_ver}-linux-x86_64-onnx-cuda-12"
    "voxtype-${pkgname}-${pkgver}-onnx-cuda-12.asc::${_github}/voxtype-${_upstream_ver}-linux-x86_64-onnx-cuda-12.asc"
    "voxtype-${pkgname}-${pkgver}-onnx-cuda-12.libonnxruntime_providers_cuda.so::${_github}/voxtype-${_upstream_ver}-linux-x86_64-onnx-cuda-12.libonnxruntime_providers_cuda.so"
    "voxtype-${pkgname}-${pkgver}-onnx-cuda-12.libonnxruntime_providers_shared.so::${_github}/voxtype-${_upstream_ver}-linux-x86_64-onnx-cuda-12.libonnxruntime_providers_shared.so"
    # ONNX CUDA 13 binary + companion shared libs
    "voxtype-${pkgname}-${pkgver}-onnx-cuda-13::${_github}/voxtype-${_upstream_ver}-linux-x86_64-onnx-cuda-13"
    "voxtype-${pkgname}-${pkgver}-onnx-cuda-13.asc::${_github}/voxtype-${_upstream_ver}-linux-x86_64-onnx-cuda-13.asc"
    "voxtype-${pkgname}-${pkgver}-onnx-cuda-13.libonnxruntime_providers_cuda.so::${_github}/voxtype-${_upstream_ver}-linux-x86_64-onnx-cuda-13.libonnxruntime_providers_cuda.so"
    "voxtype-${pkgname}-${pkgver}-onnx-cuda-13.libonnxruntime_providers_shared.so::${_github}/voxtype-${_upstream_ver}-linux-x86_64-onnx-cuda-13.libonnxruntime_providers_shared.so"
    # cuda-13 dlopens ORT at runtime (Microsoft's prebuilt is the only
    # 1.24.4 build with Blackwell sm_120 coverage, and it's distributed
    # as .so only). The runtime ships alongside the binary; the install
    # step below symlinks libonnxruntime.so → this versioned name so
    # ort/load-dynamic finds it via /proc/self/exe's directory.
    "voxtype-${pkgname}-${pkgver}-onnx-cuda-13.libonnxruntime.so.1.24.4::${_github}/voxtype-${_upstream_ver}-linux-x86_64-onnx-cuda-13.libonnxruntime.so.1.24.4"
    # ONNX MIGraphX binary + companion shared libs
    "voxtype-${pkgname}-${pkgver}-onnx-migraphx::${_github}/voxtype-${_upstream_ver}-linux-x86_64-onnx-migraphx"
    "voxtype-${pkgname}-${pkgver}-onnx-migraphx.asc::${_github}/voxtype-${_upstream_ver}-linux-x86_64-onnx-migraphx.asc"
    "voxtype-${pkgname}-${pkgver}-onnx-migraphx.libonnxruntime_providers_migraphx.so::${_github}/voxtype-${_upstream_ver}-linux-x86_64-onnx-migraphx.libonnxruntime_providers_migraphx.so"
    "voxtype-${pkgname}-${pkgver}-onnx-migraphx.libonnxruntime_providers_shared.so::${_github}/voxtype-${_upstream_ver}-linux-x86_64-onnx-migraphx.libonnxruntime_providers_shared.so"
    # OSD launcher + GTK4 frontend
    "voxtype-${pkgname}-${pkgver}-osd::${_github}/voxtype-${_upstream_ver}-linux-x86_64-osd"
    "voxtype-${pkgname}-${pkgver}-osd.asc::${_github}/voxtype-${_upstream_ver}-linux-x86_64-osd.asc"
    "voxtype-${pkgname}-${pkgver}-osd-gtk4::${_github}/voxtype-${_upstream_ver}-linux-x86_64-osd-gtk4"
    "voxtype-${pkgname}-${pkgver}-osd-gtk4.asc::${_github}/voxtype-${_upstream_ver}-linux-x86_64-osd-gtk4.asc"
    # Quickshell OSD launcher + the audio-bridge sidecar it exec's. The QML
    # tree below is useless without these two (#488).
    "voxtype-${pkgname}-${pkgver}-osd-quickshell::${_github}/voxtype-${_upstream_ver}-linux-x86_64-osd-quickshell"
    "voxtype-${pkgname}-${pkgver}-osd-quickshell.asc::${_github}/voxtype-${_upstream_ver}-linux-x86_64-osd-quickshell.asc"
    "voxtype-${pkgname}-${pkgver}-audio-bridge::${_github}/voxtype-${_upstream_ver}-linux-x86_64-audio-bridge"
    "voxtype-${pkgname}-${pkgver}-audio-bridge.asc::${_github}/voxtype-${_upstream_ver}-linux-x86_64-audio-bridge.asc"
    # Config and support files
    "config-${pkgname}-${pkgver}.toml::${_raw}/config/default.toml"
    "voxtype-${pkgname}-${pkgver}.service::${_raw}/packaging/systemd/voxtype.service"
    "voxtype-${pkgname}-${pkgver}.bash::${_raw}/packaging/completions/voxtype.bash"
    "voxtype-${pkgname}-${pkgver}.zsh::${_raw}/packaging/completions/voxtype.zsh"
    "voxtype-${pkgname}-${pkgver}.fish::${_raw}/packaging/completions/voxtype.fish"
    "LICENSE-${pkgname}-${pkgver}::${_raw}/LICENSE"
    "README-${pkgname}-${pkgver}.md::${_raw}/README.md"
    # Desktop entry + terminal launcher for `voxtype configure`
    "voxtype-configure-${pkgname}-${pkgver}.desktop::${_raw}/packaging/voxtype-configure.desktop"
    "voxtype-configure-launcher-${pkgname}-${pkgver}::${_raw}/packaging/scripts/voxtype-configure-launcher"
    # Quickshell QML tree. voxtype-osd-quickshell probes
    # /usr/share/voxtype/quickshell/ for shell.qml after user/runtime paths,
    # so shipping these files lets users opt in via [osd] frontend = "quickshell"
    # without copying anything by hand. quickshell itself is an optdepend.
    "quickshell-shell-${pkgname}-${pkgver}.qml::${_raw}/quickshell/shell.qml"
    "quickshell-OsdSurface-${pkgname}-${pkgver}.qml::${_raw}/quickshell/OsdSurface.qml"
    "quickshell-EnginePicker-${pkgname}-${pkgver}.qml::${_raw}/quickshell/EnginePicker.qml"
    "quickshell-MeetingControls-${pkgname}-${pkgver}.qml::${_raw}/quickshell/MeetingControls.qml"
    "quickshell-README-${pkgname}-${pkgver}.md::${_raw}/quickshell/README.md"
    "quickshell-voxtype-shared-Theme-${pkgname}-${pkgver}.qml::${_raw}/quickshell/voxtype-shared/Theme.qml"
    "quickshell-voxtype-shared-StateReader-${pkgname}-${pkgver}.qml::${_raw}/quickshell/voxtype-shared/StateReader.qml"
    "quickshell-voxtype-shared-AudioBridge-${pkgname}-${pkgver}.qml::${_raw}/quickshell/voxtype-shared/AudioBridge.qml"
    "quickshell-voxtype-shared-StyleLoader-${pkgname}-${pkgver}.qml::${_raw}/quickshell/voxtype-shared/StyleLoader.qml"
    "quickshell-voxtype-shared-RecipeRenderer-${pkgname}-${pkgver}.qml::${_raw}/quickshell/voxtype-shared/RecipeRenderer.qml"
    "quickshell-voxtype-shared-qmldir-${pkgname}-${pkgver}::${_raw}/quickshell/voxtype-shared/qmldir"
)

# TODO: Update SHA256 sums from the GitHub pre-release artifacts before
# pushing to AUR. Use the same workflow as voxtype-bin:
#   cd releases/${_upstream_ver} && sha256sum voxtype-${_upstream_ver}-linux-x86_64-* | sort
# Initial sums are SKIP placeholders so makepkg --printsrcinfo runs cleanly
# on a freshly-tagged RC where the artifacts may not be uploaded yet.
sha256sums=('1a87224d07601821792f96ba9751a8e46af9830ef74e802c35620acc02522d0e'
            'SKIP'
            '64df9b8c48569b831515535e2629d8fb734b22eafa51ddbd0bcecdb58b318cc5'
            'SKIP'
            'fc593e45313e941d5095cbb197f31035d1858904de1bcfe503df920f6f7cbea5'
            'SKIP'
            '87378d5935f56d1a3d38110cf2fd650eba22a72cf736ba080f7053611e3054e8'
            'SKIP'
            '0c45134c651217a31f3c6e7e1a237b53f5df95e21fe87b0bf1713c762ba573bb'
            'SKIP'
            '424771315a062adc69408c47ad5dcce1f2dbd743537d44db896df6ff7b64bac0'
            'SKIP'
            'a8584727d51ba646ac63fc991c2f36ad6cd5b8cc8b1141896e46938700b888d0'
            '1b028afc079628d76a28d7eb09700a4baead4a27f9634ba82c35398486134114'
            'eb48938ccc752dc5f81aeacd0322a6d216b4bd9fca064816f26569e8e1a46a59'
            'SKIP'
            'b6cb7744d0efd2faced5c83ead374c13e7f2630b5a249ffaf393cdb1e092c92b'
            'c6a12593396095f5670160e284c35d1700b7708cf3037b7042e2a5200ccae772'
            '1aacefdf0b4afa145d410b2381bbc3db3d978c485fb182c42a2b0b09f91f5310'
            'addde7270458cc9e0b7676d80da60e4cf3d7b5259039d288c08c50d2671b2308'
            'SKIP'
            'ddd67e6193ade819ee21f1706d1b03b9151f1d2d2843701e2d19d8b183631707'
            '17f7cf47ad0d7b5ac895ae588fd62c7f85a13842588161b6a24c7d480f062be4'
            '0c8ffe335ea69bf8f17dd3de97cac84851dbd631e2eeccec543608cc04de2127'
            'SKIP'
            '0ef991cff4aa382fdd24257cfea35a2137de9886a236ce369389814bd50999ee'
            'SKIP'
            '92e5016c8f7f7d81ccd8fbc1feba5b478c1933722ab02f76ed449e6f67c2ada6'
            'SKIP'
            '99626fe327b8f8ae24c044b86665c870cdc502af812eb5d29bc961ff90bb3d28'
            'SKIP'
            '0b91367d2088e8850a37b47a0cba0bd9107695fc81a00ab1933465ada2a16a2f'
            '531c3658e229619e56bb01659fb81f401767b85e1d6e2acd1ac67ee3414a168c'
            '65c95805d9b03ccc2fadb9d63a03ab79974b00091df8457ee8ef290ec6bd5b12'
            'e5e63b3c7f48238cf719e4f2ef90c1f9c5c7e8cd25eaebc9f78bdd34b24b6605'
            'f720ddd24ee97c105b448323899c36bca7c63d00c2d42c4a3da70c3d157dccbb'
            '31123c45b4ff9cb5fd9e01083350fea6ccaf14969013fd48e4c95fdf89e6eb4b'
            '11bf83d8cb2bfab0e978707fa80475d97be79723a6dc71adc3c357829ba9f347'
            '32144a4a5210092b0aa909f6de7a43ebe8bbf82fa3dfb1f3519787512fdf8e4b'
            '044b1f7b52cc610ce57ba624111d882029b0ce4bc3e2c2c360f96d07f69e0e85'
            '3f711c7cfca80773960e98a47361611497e584e56657052d675241daae84947e'
            '6e8b8aae6b64809ed5ca504a3171a4ddeadc91b1ed96eacbf67bbf056b2ffbdd'
            '4d6eef505ec161080ca92ae6a355ca00dcc7bb05d5b190534a1851fcbb726e55'
            '54271a8f0e4b52f40505f32801f4c78399ac356ed1e80906ca8a068ecb7ee734'
            'ac6d08fe9c7f92a6935a05c23f7c55ab717f2d06593808aa2077c25c5d313122'
            'aaa011682b92d8e25863a9ea34a469b897bac15ad939292d8144b012fa05b209'
            'd7d2fb11df25c3f30127a0d7c72693cdfb649b357888f4abd5b3fbbb2e7ce655'
            '2ad530f92f13fc7f1100e6f6c9910878c35d911e91dc60feb902c2542b619230'
            '45180488129f16a0568c217c743ce7e45831acb0cb287346d6da5b2fc097717b'
            'd5e9a86946dc8dc2afabdcd00d79d973181e51b2e5e8aea2772960aaf1ff2283'
            '41b894baa1487e47db5f9ec4baeea9c02b6a76d3c8198b4700a88e2cb7ec0b62')

package() {
    local src="$srcdir/voxtype-${pkgname}-${pkgver}"

    # Install Whisper CPU binaries to /usr/lib/voxtype/
    install -Dm755 "${src}-avx2" "$pkgdir/usr/lib/voxtype/voxtype-avx2"
    install -Dm755 "${src}-avx512" "$pkgdir/usr/lib/voxtype/voxtype-avx512"

    # Install Whisper Vulkan GPU binary
    install -Dm755 "${src}-vulkan" "$pkgdir/usr/lib/voxtype/voxtype-vulkan"

    # Install ONNX CPU binaries (no GPU EP, no companion .so files)
    install -Dm755 "${src}-onnx-avx2" "$pkgdir/usr/lib/voxtype/voxtype-onnx-avx2"
    install -Dm755 "${src}-onnx-avx512" "$pkgdir/usr/lib/voxtype/voxtype-onnx-avx512"

    # GPU-using ONNX binaries each live in their own subdirectory alongside
    # the EP companion shared libs they dlopen at runtime. ort 2.0.0-rc.12's
    # CUDA/MIGraphX EPs resolve their .so files via /proc/self/exe; if they
    # aren't co-located, EP registration fails and ort silently falls back
    # to CPU. /proc/self/exe follows symlinks, so the user-facing names at
    # /usr/lib/voxtype/voxtype-onnx-* are symlinks into these subdirs.

    # ONNX CUDA 12 (locked to libcudart.so.12 ABI)
    install -Dm755 "${src}-onnx-cuda-12" \
        "$pkgdir/usr/lib/voxtype/cuda-12/voxtype-onnx-cuda-12"
    install -Dm644 "${src}-onnx-cuda-12.libonnxruntime_providers_cuda.so" \
        "$pkgdir/usr/lib/voxtype/cuda-12/libonnxruntime_providers_cuda.so"
    install -Dm644 "${src}-onnx-cuda-12.libonnxruntime_providers_shared.so" \
        "$pkgdir/usr/lib/voxtype/cuda-12/libonnxruntime_providers_shared.so"
    ln -sf "cuda-12/voxtype-onnx-cuda-12" \
        "$pkgdir/usr/lib/voxtype/voxtype-onnx-cuda-12"

    # ONNX CUDA 13 (locked to libcudart.so.13 ABI, requires driver 580+)
    install -Dm755 "${src}-onnx-cuda-13" \
        "$pkgdir/usr/lib/voxtype/cuda-13/voxtype-onnx-cuda-13"
    install -Dm644 "${src}-onnx-cuda-13.libonnxruntime_providers_cuda.so" \
        "$pkgdir/usr/lib/voxtype/cuda-13/libonnxruntime_providers_cuda.so"
    install -Dm644 "${src}-onnx-cuda-13.libonnxruntime_providers_shared.so" \
        "$pkgdir/usr/lib/voxtype/cuda-13/libonnxruntime_providers_shared.so"
    # cuda-13 dlopens ORT at runtime. Install Microsoft's libonnxruntime
    # under its SONAME (libonnxruntime.so.1.24.4) and symlink the bare
    # name ort/load-dynamic expects (libonnxruntime.so).
    install -Dm644 "${src}-onnx-cuda-13.libonnxruntime.so.1.24.4" \
        "$pkgdir/usr/lib/voxtype/cuda-13/libonnxruntime.so.1.24.4"
    ln -sf "libonnxruntime.so.1.24.4" \
        "$pkgdir/usr/lib/voxtype/cuda-13/libonnxruntime.so"
    ln -sf "cuda-13/voxtype-onnx-cuda-13" \
        "$pkgdir/usr/lib/voxtype/voxtype-onnx-cuda-13"

    # ONNX MIGraphX (AMD GPU EP)
    install -Dm755 "${src}-onnx-migraphx" \
        "$pkgdir/usr/lib/voxtype/migraphx/voxtype-onnx-migraphx"
    install -Dm644 "${src}-onnx-migraphx.libonnxruntime_providers_migraphx.so" \
        "$pkgdir/usr/lib/voxtype/migraphx/libonnxruntime_providers_migraphx.so"
    install -Dm644 "${src}-onnx-migraphx.libonnxruntime_providers_shared.so" \
        "$pkgdir/usr/lib/voxtype/migraphx/libonnxruntime_providers_shared.so"
    ln -sf "migraphx/voxtype-onnx-migraphx" \
        "$pkgdir/usr/lib/voxtype/voxtype-onnx-migraphx"

    # Compatibility symlink for users with scripts referencing the old
    # voxtype-onnx-rocm name. Drop in v0.8.0.
    ln -sf "voxtype-onnx-migraphx" "$pkgdir/usr/lib/voxtype/voxtype-onnx-rocm"

    # OSD launcher + GTK4 frontend.
    install -Dm755 "${src}-osd" "$pkgdir/usr/lib/voxtype/voxtype-osd"
    install -Dm755 "${src}-osd-gtk4" "$pkgdir/usr/lib/voxtype/voxtype-osd-gtk4"
    install -Dm755 "${src}-osd-quickshell" "$pkgdir/usr/lib/voxtype/voxtype-osd-quickshell"
    install -d "$pkgdir/usr/bin"
    ln -sf /usr/lib/voxtype/voxtype-osd "$pkgdir/usr/bin/voxtype-osd"

    # voxtype-audio-bridge: NDJSON sidecar that streams audio levels over a
    # UNIX socket to the Quickshell OSD. Lives in /usr/bin because the
    # quickshell launcher exec's it directly by basename.
    install -Dm755 "${src}-audio-bridge" "$pkgdir/usr/bin/voxtype-audio-bridge"

    # Desktop entry for the TUI configure command.
    install -Dm755 "$srcdir/voxtype-configure-launcher-${pkgname}-${pkgver}" \
        "$pkgdir/usr/bin/voxtype-configure-launcher"
    install -Dm644 "$srcdir/voxtype-configure-${pkgname}-${pkgver}.desktop" \
        "$pkgdir/usr/share/applications/voxtype-configure.desktop"

    # Install default configuration
    install -Dm644 "$srcdir/config-${pkgname}-${pkgver}.toml" "$pkgdir/etc/voxtype/config.toml"

    # Install systemd user service
    install -Dm644 "$srcdir/voxtype-${pkgname}-${pkgver}.service" "$pkgdir/usr/lib/systemd/user/voxtype.service"

    # Install documentation
    install -Dm644 "$srcdir/README-${pkgname}-${pkgver}.md" "$pkgdir/usr/share/doc/$pkgname/README.md"

    # Install license
    install -Dm644 "$srcdir/LICENSE-${pkgname}-${pkgver}" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

    # Install shell completions
    install -Dm644 "$srcdir/voxtype-${pkgname}-${pkgver}.bash" "$pkgdir/usr/share/bash-completion/completions/voxtype"
    install -Dm644 "$srcdir/voxtype-${pkgname}-${pkgver}.zsh" "$pkgdir/usr/share/zsh/site-functions/_voxtype"
    install -Dm644 "$srcdir/voxtype-${pkgname}-${pkgver}.fish" "$pkgdir/usr/share/fish/vendor_completions.d/voxtype.fish"

    # Install the Quickshell QML tree into /usr/share/voxtype/quickshell/.
    # voxtype-osd-quickshell finds shell.qml here after the user/runtime paths.
    # The voxtype-shared module lives under its own subdirectory so the qmldir
    # is discovered alongside Theme.qml / StateReader.qml / AudioBridge.qml.
    install -Dm644 "$srcdir/quickshell-shell-${pkgname}-${pkgver}.qml" \
        "$pkgdir/usr/share/voxtype/quickshell/shell.qml"
    install -Dm644 "$srcdir/quickshell-OsdSurface-${pkgname}-${pkgver}.qml" \
        "$pkgdir/usr/share/voxtype/quickshell/OsdSurface.qml"
    install -Dm644 "$srcdir/quickshell-EnginePicker-${pkgname}-${pkgver}.qml" \
        "$pkgdir/usr/share/voxtype/quickshell/EnginePicker.qml"
    install -Dm644 "$srcdir/quickshell-MeetingControls-${pkgname}-${pkgver}.qml" \
        "$pkgdir/usr/share/voxtype/quickshell/MeetingControls.qml"
    install -Dm644 "$srcdir/quickshell-README-${pkgname}-${pkgver}.md" \
        "$pkgdir/usr/share/voxtype/quickshell/README.md"
    install -Dm644 "$srcdir/quickshell-voxtype-shared-Theme-${pkgname}-${pkgver}.qml" \
        "$pkgdir/usr/share/voxtype/quickshell/voxtype-shared/Theme.qml"
    install -Dm644 "$srcdir/quickshell-voxtype-shared-StateReader-${pkgname}-${pkgver}.qml" \
        "$pkgdir/usr/share/voxtype/quickshell/voxtype-shared/StateReader.qml"
    install -Dm644 "$srcdir/quickshell-voxtype-shared-AudioBridge-${pkgname}-${pkgver}.qml" \
        "$pkgdir/usr/share/voxtype/quickshell/voxtype-shared/AudioBridge.qml"
    install -Dm644 "$srcdir/quickshell-voxtype-shared-StyleLoader-${pkgname}-${pkgver}.qml" \
        "$pkgdir/usr/share/voxtype/quickshell/voxtype-shared/StyleLoader.qml"
    install -Dm644 "$srcdir/quickshell-voxtype-shared-RecipeRenderer-${pkgname}-${pkgver}.qml" \
        "$pkgdir/usr/share/voxtype/quickshell/voxtype-shared/RecipeRenderer.qml"
    install -Dm644 "$srcdir/quickshell-voxtype-shared-qmldir-${pkgname}-${pkgver}" \
        "$pkgdir/usr/share/voxtype/quickshell/voxtype-shared/qmldir"
}
