# Contributor: Pavel Minaev <int19h@gmail.com>

_realname=MinHook
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.3.4
pkgrel=2
pkgdesc="The Minimalistic x86/x64 API Hooking Library for Windows (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64')
url="https://github.com/TsudaKageyu/minhook"
license=('spdx:BSD-2-Clause')
makedepends=("${MINGW_PACKAGE_PREFIX}-cc")
source=("https://github.com/TsudaKageyu/${_realname}/archive/v${pkgver}/${_realname}-${pkgver}.tar.gz")
sha256sums=('1aebeae4ca898330c507860acc2fca2eb335fe446a3a2b8444c3bf8b2660a14e')

build() {
  cd "${srcdir}/${_realname}-${pkgver}"
  make -f build/MinGW/Makefile clean
  make -f build/MinGW/Makefile CC="${CC}"
}

package() {
  cd "${srcdir}/${_realname}-${pkgver}"
  install -Dm644 include/MinHook.h "${pkgdir}${MINGW_PREFIX}/include/MinHook.h"
  install -Dm644 libMinHook.a "${pkgdir}${MINGW_PREFIX}/lib/libMinHook.a"
  install -Dm644 libMinHook.dll.a "${pkgdir}${MINGW_PREFIX}/lib/libMinHook.dll.a"
  install -Dm755 MinHook.dll "${pkgdir}${MINGW_PREFIX}/bin/MinHook.dll"
}
