# Maintainer: Tao Zuhong <taozuhong@hotmail.com>

_realname=sqlite3mc
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=2.1.3
pkgrel=1
pkgdesc="SQLite3 encryption extension with support for multiple ciphers (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://github.com/utelle/SQLite3MultipleCiphers"
license=('spdx:MIT')
depends=("${MINGW_PACKAGE_PREFIX}-zlib")
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-autotools"
             "${MINGW_PACKAGE_PREFIX}-pkgconf")
source=("https://github.com/utelle/SQLite3MultipleCiphers/archive/v${pkgver}/${_realname}-$pkgver.tar.gz")
sha256sums=('57304f1cf870723a2157306a0a4f0eded99f10df9ca5896c9143ccf21d779eed')

prepare() {
  cd "${srcdir}/SQLite3MultipleCiphers-${pkgver}"

  autoreconf -fiv
}

build() {
  cd "${srcdir}/SQLite3MultipleCiphers-${pkgver}"

  mkdir -p "${srcdir}"/build-${MSYSTEM} && cd "${srcdir}"/build-${MSYSTEM}

  ../"SQLite3MultipleCiphers-${pkgver}"/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target="${MINGW_CHOST}" \
    --enable-static \
    --enable-shared

  make
}


package() {
  cd "${srcdir}/build-${MSYSTEM}"

  make -j1 DESTDIR="${pkgdir}" install

  install -Dm644 "${srcdir}/SQLite3MultipleCiphers-${pkgver}/LICENSE" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
}
