# Maintainer: PktSurf <smlinux@pktsurf.in>
app=heimdall
version=1.4.2
build=1sml
homepage="https://www.glassechidna.com.au/products/heimdall/"
download="https://github.com/Benjamin-Dobell/Heimdall/archive/refs/tags/v$version.tar.gz"
desc="Cross-platform open-source tool suite to flash ROMs onto Samsung mobile devices"
requires="gcc-libs libusb eudev"

prepbuilddir() {
  mkandenterbuilddir
  rm -rf Heimdall-$version

  tar xf $srcdir/Heimdall-$version.tar.?z*
  cd Heimdall-$version
  fixbuilddirpermissions
}

build() {
  mkdir -p smbuild && cd smbuild 
  cmake .. \
    -DCMAKE_INSTALL_PREFIX="/" \
    -DDISABLE_FRONTEND=ON \

  make

  install -Dm 0755 bin/heimdall $pkg/bin/heimdall
  install -Dm 0644 ../heimdall/60-heimdall.rules $pkg/lib/udev/rules.d/60-heimdall.rules
  cp ../LICENSE $pkgdocs/

  mkfinalpkg
}

sha512sums="
fc461d5281a3e8a6188ec5ba845d6e719285c91e2874fbbc62b6c54a8494c84fa1b93c15c2684ed936061c861b9a892aaca0a69efe692534e4f09da13077472d  Heimdall-1.4.2.tar.lz
"
