# Maintainer: Alberto Fanjul <albertofanjul@gmail.com>

_realname=odt2txt
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.5
pkgrel=4
pkgdesc="extracts the text out of OpenDocument Texts (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://github.com/dstosberg/odt2txt/"
license=("spdx:GPL-2.0-or-later")
depends=("${MINGW_PACKAGE_PREFIX}-libiconv"
         "${MINGW_PACKAGE_PREFIX}-libzip"
         "${MINGW_PACKAGE_PREFIX}-pcre2")
makedepends=("${MINGW_PACKAGE_PREFIX}-cc")
source=("https://github.com/dstosberg/odt2txt/archive/v${pkgver}/${_realname}-${pkgver}.tar.gz"
        "0001-Compile-for-Msys2.patch")
sha256sums=('23a889109ca9087a719c638758f14cc3b867a5dcf30a6c90bf6a0985073556dd'
            '6a18ecb0f4ddded9020f02ad04eaf54eba1d9c6eba3249048ede6c8868993410')

prepare() {
  cd "${srcdir}/${_realname}-${pkgver}"
  patch -p1 -i "$srcdir/0001-Compile-for-Msys2.patch"
}

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

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