# Description: an AV1 video encoder
# URL: https://github.com/xiph/rav1e/
# Maintainer: Tim Biermann, tbier at posteo dot de
# Depends on: cargo-c nasm

name=rav1e
version=0.6.6
release=1
source=(https://github.com/xiph/rav1e/archive/v$version/$name-$version.tar.gz
  https://github.com/xiph/rav1e/releases/download/v$version/Cargo.lock)
renames=(SKIP $name-$version-Cargo.lock)

build() {
  prt-get isinst sccache && export RUSTC_WRAPPER=/usr/bin/sccache
  [[ ! -e $PKGMK_SOURCE_DIR/rust ]] && mkdir $PKGMK_SOURCE_DIR/rust

  cd $name-$version
  cp $SRC/$name-$version-Cargo.lock Cargo.lock
  export LDFLAGS+=' -lgit2'

  cargo build --release
  cargo cbuild --release --prefix=/usr

  cargo install --offline --no-track --path . --root $PKG/usr
  cargo cinstall --release --prefix /usr --destdir $PKG
}
