Skip to content

Pattern Binary

m-wells edited this page Jan 30, 2026 · 2 revisions

Binary Packages

Example: virtctl

Pre-compiled binaries from GitHub releases or other sources.

Template

arch=('x86_64')
depends=('glibc')

source=("${pkgname}-${pkgver}::https://github.com/org/repo/releases/download/v${pkgver}/${pkgname}-linux-amd64")

package() {
    install -Dm755 "${pkgname}-${pkgver}" "$pkgdir/usr/bin/$pkgname"
}

Characteristics

  • arch=('x86_64') - binaries are architecture-specific
  • Minimal deps (usually just glibc)
  • No build step, just installation
  • Consider adding shell completions if provided upstream

Shell Completions

If the binary supports generating completions:

package() {
    install -Dm755 "${pkgname}-${pkgver}" "$pkgdir/usr/bin/$pkgname"

    # Generate completions
    "$pkgdir/usr/bin/$pkgname" completion bash > bash.completion
    "$pkgdir/usr/bin/$pkgname" completion zsh > zsh.completion
    "$pkgdir/usr/bin/$pkgname" completion fish > fish.completion

    install -Dm644 bash.completion "$pkgdir/usr/share/bash-completion/completions/$pkgname"
    install -Dm644 zsh.completion "$pkgdir/usr/share/zsh/site-functions/_$pkgname"
    install -Dm644 fish.completion "$pkgdir/usr/share/fish/vendor_completions.d/$pkgname.fish"
}

Version Checking

check_example() {
    local latest=$(curl -s "https://api.github.com/repos/org/repo/releases/latest" \
        | jq -r '.tag_name | ltrimstr("v")')
    perform_update "example" "$latest"
}

Clone this wiki locally