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

_realname=MinHook
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.3.3
pkgrel=1
pkgdesc="The Minimalistic x86/x64 API Hooking Library for Windows (mingw-w64)"
url="https://github.com/TsudaKageyu/minhook"
license=('BSD')
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64')
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc")
options=('staticlibs' '!libtool')
source=(${_realname}-${pkgver}.tar.g::"https://github.com/TsudaKageyu/${_realname}/archive/v${pkgver}.tar.gz")
sha256sums=('5bec16358ec9086d4593124bf558635e89135abea2c76e5761ecaf09f4546b19')

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

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"
}
