# Maintainer: Adrian Jaekel <adrian at arteco dot de>

_realname=libosmscout
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.0.1
pkgrel=1
pkgdesc="A Library for offline map rendering, routing and location lookup based on OpenStreetMap data"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64')
url="https://github.com/Framstag/libosmscout"
license=('custom:LGPL')
depends=("${MINGW_PACKAGE_PREFIX}-protobuf"
         "${MINGW_PACKAGE_PREFIX}-qt5")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-cmake")
source=(${_realname}-${pkgver}.tar.gz::https://github.com/Framstag/libosmscout/archive/${pkgver}.tar.gz)
sha256sums=('5168739d08fed70b7a968cd5dbe919e07a07e7d1ef8ee722819553eb1162b1f4')

build() {

  mkdir -p "${srcdir}/build-${CARCH}"
  cd "${srcdir}/build-${CARCH}"

  MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
  ${MINGW_PREFIX}/bin/cmake \
    -G"MSYS Makefiles" \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
    "../${_realname}-${pkgver}"

  make
}

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