# Maintainer: yumetodo <yume-wikijp@live.jp>

_realname=hexyl
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.8.0
pkgrel=1
pkgdesc="A command-line hex viewer"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64')
url="https://github.com/sharkdp/hexyl"
license=('APACHE' 'MIT')
depends=()
makedepends=("${MINGW_PACKAGE_PREFIX}-rust")
source=(
  "${url}/archive/v${pkgver}/${_realname}-${pkgver}.tar.gz"
)
sha512sums=(
  '9695b57d11b58da3987475982622a19e5a576f2b05df141dc133e0cddf2cf37e37c995ed4b32c8020a7ec08a0c101e7ea3aa6a19a3a21510cffaa033401a8c34'
)
b2sums=(
  'f06101d27956e746e2ac794fc94b5ae7dd98b970b9a4060b6af375365838228a4580c464a7d5edf37ccb2326c1242f43aabee277d3fdfdbe274b73b55f2185ff'
)

build() {
  cd "${srcdir}/${_realname}-${pkgver}"
  cargo build --release --locked
}

check() {
  cd "${srcdir}/${_realname}-${pkgver}"
  cargo test --release --locked
}

package() {
  cd "${srcdir}/${_realname}-${pkgver}"
  install -Dm 755 "target/release/${_realname}" "${pkgdir}${MINGW_PREFIX}/bin/${_realname}"
  install -Dm 644 LICENSE* -t "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}"
}
