name='vintner'
version=0.5.0
release=1
summary='Cross compile with MSVC on Linux via Wine'
summary_ru='Кросс-компиляция с MSVC на Linux через Wine'
group='Development/Tools'
desc='vintner is a single-binary tool for cross compiling with the real MSVC toolchain on Linux via Wine. Once you run its download/install subcommands, cl, link, lib, rc, midl, mc, mt, dumpbin, msbuild, nmake, ml, ml64, armasm, armasm64, cmd and findstr all work as drop-in commands, exactly like on Windows, or can be invoked directly as "vintner cl", "vintner msbuild", etc. without touching PATH. Supports building real KMDF/UMDF drivers via the Windows Driver Kit (--with-wdk), legacy D3DX9 code via the DirectX SDK (--with-dxsdk), old PlatformToolset-pinned .vcxproj files against the one installed compiler, resumes interrupted downloads, and "vintner doctor" diagnoses a broken wine/toolchain setup. Its own CLI is available in English and Russian.'
desc_ru='vintner — однобинарный инструмент для кросс-компиляции с реальным MSVC на Linux через Wine. После выполнения его подкоманд download/install команды cl, link, lib, rc, midl, mc, mt, dumpbin, msbuild, nmake, ml, ml64, armasm, armasm64, cmd и findstr работают как обычные команды, точно как в Windows, либо вызываются напрямую как «vintner cl», «vintner msbuild» и т.д., не трогая PATH. Поддерживает сборку настоящих KMDF/UMDF-драйверов через Windows Driver Kit (--with-wdk), устаревший код D3DX9 через DirectX SDK (--with-dxsdk), старые .vcxproj с закреплённым PlatformToolset против единственного установленного компилятора, докачивает прерванные загрузки, а «vintner doctor» диагностирует неисправную настройку wine/toolchain. Сам CLI доступен на английском и русском.'
homepage='https://github.com/Cheviiot/vintner'
maintainer='Cheviiot <https://github.com/Cheviiot>'

architectures=('amd64' 'arm64')

license=('MIT')

provides=()
replaces=('vintner')
conflicts=()

auto_reqprov_method="dirty"
auto_req=0
auto_prov=0

# wine/msitools/git/cabextract are needed at runtime by `vintner
# download`/`install` and by the tool wrappers themselves, not just at
# build time. cabextract is only exercised by --with-dxsdk, but kept a
# hard dep for the same reason msitools is: small, no heavy transitive
# deps, and simpler than making package deps conditional on a flag.
deps=()
deps_debian=('wine' 'msitools' 'git' 'cabextract')
deps_ubuntu=("${deps_debian[@]}")
deps_fedora=('wine' 'msitools' 'git' 'cabextract')
deps_arch=('wine' 'msitools' 'git' 'cabextract')
deps_opensuse=('wine' 'msitools' 'git' 'cabextract')
deps_altlinux=('wine' 'msitools' 'git' 'cabextract')

build_deps=('binutils')

# Prebuilt by vintner's own CI (.github/workflows/release.yml) and
# published to its GitHub Releases; renamed to a common local name so
# package() doesn't need to branch on architecture.
sources=(
	"https://github.com/Cheviiot/vintner/releases/download/v${version}/vintner-linux-amd64?~archive=false&~name=vintner"
	'local:///LICENSE'
)

sources_arm64=(
	"https://github.com/Cheviiot/vintner/releases/download/v${version}/vintner-linux-arm64?~archive=false&~name=vintner"
	'local:///LICENSE'
)

checksums=(
	'sha256:c06edc2c6469f3a6bac63bd2a1e811f6fe03cc05c49871413a8f58d5e382732a'
	'sha256:e377b84adc5315cf372c3d80ecbd3008402d8b07f248e711c7553784e0c33168'
)

checksums_arm64=(
	'sha256:4ddb97ad6c193058589564f99781b3ef5e5725d243d3c1cbb895b81c35799144'
	'sha256:e377b84adc5315cf372c3d80ecbd3008402d8b07f248e711c7553784e0c33168'
)

package() {
	cd "${srcdir}"
	chmod +x "${srcdir}/vintner"
	install-binary "${srcdir}/vintner"
	install-license "${srcdir}/LICENSE" "vintner/LICENSE"
	"${srcdir}/vintner" completion bash | install-completion bash vintner
	"${srcdir}/vintner" completion zsh | install-completion zsh vintner
}

files() {
	files-find-binary
	files-find-license
	files-find "/usr/share/bash-completion/completions/vintner"
	files-find "/usr/share/zsh/site-functions/_vintner"
}
