# Maintainer: Mike Ruprecht <cmaiku@gmail.com>

_realname='gumbo-parser'
pkgbase="mingw-w64-${_realname}"
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.13.1
pkgrel=1
pkgdesc='HTML5 parsing library in pure C99 (mingw-w64)'
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64')
url='https://codeberg.org/gumbo-parser/gumbo-parser/'
license=('spdx:Apache-2.0')
checkdepends=("${MINGW_PACKAGE_PREFIX}-gtest")
makedepends=("${MINGW_PACKAGE_PREFIX}-autotools" "${MINGW_PACKAGE_PREFIX}-cc")
source=("${url}archive/${pkgver}.tar.gz")
sha256sums=('1a054d1e53d556641a6666537247411a77b0c18ef6ad5df23e30d2131676ef81')

prepare() {
  cd "${_realname}"
  ./autogen.sh
}

build() {
  cd "${_realname}"

  ./configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST}

  make
}

check() {
  cd "${_realname}"
  make -k check
}

package() {
  cd "${_realname}"
  make install DESTDIR="${pkgdir}"

  install -Dm644 "${srcdir}/${_realname}/doc/COPYING" \
    "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING"
}
