# Maintainer: Eduard Braun <eduard.braun2@gmx.de>

_realname=libvisio
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.1.10
pkgrel=3
pkgdesc="libvisio is a library and a set of tools for reading and converting MS Visio diagram (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://wiki.documentfoundation.org/DLP/Libraries/libvisio"
license=('spdx:MPL-2.0')
depends=("${MINGW_PACKAGE_PREFIX}-icu"
         "${MINGW_PACKAGE_PREFIX}-libxml2"
         "${MINGW_PACKAGE_PREFIX}-librevenge")
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-autotools"
             "${MINGW_PACKAGE_PREFIX}-boost"
             "${MINGW_PACKAGE_PREFIX}-doxygen"
             "${MINGW_PACKAGE_PREFIX}-cppunit"
             "${MINGW_PACKAGE_PREFIX}-gperf"
             "perl")
source=(https://dev-www.libreoffice.org/src/${_realname}/${_realname}-${pkgver}.tar.xz)
sha256sums=('9e9eff75112d4d92d92262ad7fc2599c21e26f8fc5ba54900efdc83c0501e472')

prepare() {
  cd ${_realname}-${pkgver}
  # autoreconf to get updated libtool files with clang support
  autoreconf -fiv
}

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

  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --enable-shared \
    --enable-static \
    --disable-silent-rules

  make
}

check() {
  cd build-${MSYSTEM}
  make -k check
}

package() {
  cd build-${MSYSTEM}
  make DESTDIR="${pkgdir}" install
}
