# Description: open source video transcoder
# URL: https://handbrake.fr/
# Maintainer: Tim Biermann, tbier at posteo dot de
# Depends on: faad2 jansson lame libass libdvdcss libjpeg-turbo libsamplerate libtheora libva libvpx libxml2 numactl speex x264

name=handbrake
version=1.6.1
release=1
_HASH=04413a27e6d616cddd98c2c6468aca2bf91b87b5
_HASHDATE="2023-01-23 18:02:17 +0000"
source=(https://github.com/HandBrake/HandBrake/releases/download/$version/$name-$version-source.tar.bz2)

build() {
  prt-get isinst gtk3 || PKGMK_HANDBRAKE+='--disable-gtk --disable-gtk-update-checks'

  ## from inside a git checkout..
  #./HandBrake-$version/scripts/repo-info.sh HandBrake-$version > HandBrake-$version/version.txt
  echo "URL=https://github.com/HandBrake/HandBrake.git" >> HandBrake-$version/version.txt
  echo "HASH=$_HASH" >> HandBrake-$version/version.txt
  echo "SHORTHASH=${_HASH:0:9}" >> HandBrake-$version/version.txt
  echo "TAG=$version" >> HandBrake-$version/version.txt
  echo "TAG_HASH=${_HASH:0:9}" >> HandBrake-$version/version.txt
  echo "REV=0" >> HandBrake-$version/version.txt
  echo "BRANCH=" >> HandBrake-$version/version.txt
  echo "REMOTE=https://github.com/HandBrake/HandBrake.git" >> HandBrake-$version/version.txt
  echo "DATE=$_HASHDATE" >> HandBrake-$version/version.txt

  ./HandBrake-$version/configure $PKGMK_HANDBRAKE \
    --prefix=/usr \
    --launch \
    --launch-jobs=$(nproc) \
    --build=build \
    --lto \
    --enable-fdk-aac

  mkdir -p $SRC/build/build_tmp

  make -C build TMPDIR=$SRC/build/build_tmp
  make -C build DESTDIR=$PKG install

  rm -rf $PKG/usr/share/locale/
}
