# Maintainer: taozuhong <taozuhong@gmail.com>

_realname=hiredis
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.0.0
pkgrel=1
pkgdesc="Minimalistic C client for Redis"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
url="https://github.com/redis/hiredis"
license=("BSD-3-Clause License")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
            "${MINGW_PACKAGE_PREFIX}-pkg-config"
            "${MINGW_PACKAGE_PREFIX}-cmake"
            "${MINGW_PACKAGE_PREFIX}-openssl")
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs"
         "${MINGW_PACKAGE_PREFIX}-crt"
         "${MINGW_PACKAGE_PREFIX}-openssl")
source=("https://github.com/redis/hiredis/archive/v${pkgver}.tar.gz")
sha256sums=('2a0b5fe5119ec973a0c1966bfc4bd7ed39dbce1cb6d749064af9121fe971936f')
            
prepare() {
  cd ${srcdir}/${_realname}-${pkgver}
}

build() {
  cd ${srcdir}/${_realname}-${pkgver}
  
  MSYS2_ARG_CONV_EXCL=- cmake . -G"MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=$MINGW_PREFIX -DENABLE_SSL=ON
}

package() {
  cd ${srcdir}/${_realname}-${pkgver}
  
  make install DESTDIR="${pkgdir}"
}
