# Maintainer: Developer <dev@opalos.org>
# Maintainer: Developer <dev@opalos.org>

pkgname=libdovi
pkgver=%version%
pkgrel=%release%
pkgdesc='Library to read and write Dolby Vision metadata'
arch=(x86_64)
url=https://github.com/quietvoid/dovi_tool/tree/main/dolby_vision
license=(MIT)
depends=(
  gcc-libs
  glibc
)
makedepends=(
  cargo-c
  git
  rust
)
provides=(libdovi.so)
_tag=108f7892fa9c5c5b24caec29f2289cf805e52119
source=(git+https://github.com/quietvoid/dovi_tool.git#tag=${_tag})
b2sums=(SKIP)

prepare() {
  cargo fetch \
    --manifest-path dovi_tool/dolby_vision/Cargo.toml
}

#pkgver() {
#  cd dovi_tool
#  git describe --tags | sed 's/^libdovi-//'
#}

build() {
  cargo cbuild \
    --release \
    --frozen \
    --prefix=/usr \
    --manifest-path dovi_tool/dolby_vision/Cargo.toml
}

check() {
  cargo test \
    --release \
    --frozen \
    --all-features \
    --manifest-path dovi_tool/dolby_vision/Cargo.toml
}

package() {
  cd dovi_tool/dolby_vision
  cargo cinstall \
    --release \
    --frozen \
    --prefix /usr \
    --destdir "${pkgdir}"
  install -Dm 644 LICENSE -t "${pkgdir}"/usr/share/licenses/libdovi/
}

# vim: ts=2 sw=2 et:
