# Maintainer: David Macek <david.macek.0@gmail.com>

_realname=ntldd
pkgbase=mingw-w64-${_realname}-git
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}-git"
pkgver=r19.7fb9365
pkgrel=1
pkgdesc="Tracks dependencides in Windows PE binaries (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
url="https://github.com/LRN/ntldd"
license=("GPL3")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
             "git")
provides=("${MINGW_PACKAGE_PREFIX}-${_realname}")
conflicts=("${MINGW_PACKAGE_PREFIX}-${_realname}")
source=("git+https://github.com/LRN/ntldd.git")
sha256sums=('SKIP')

pkgver() {
  cd "${srcdir}/${_realname}"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
  cd "${srcdir}/${_realname}"
  ./makeldd.sh
}

package() {
  cd "${srcdir}/${_realname}"
  install -Dm755 ntldd.exe "${pkgdir}${MINGW_PREFIX}/bin/ntldd.exe"
  install -Dm644 libntldd.h "${pkgdir}${MINGW_PREFIX}/include/libntldd.h"
  install -Dm644 libntldd.a "${pkgdir}${MINGW_PREFIX}/lib/libntldd.a"
  install -Dm644 README "${pkgdir}${MINGW_PREFIX}/share/doc/${_realname}/README"
}
