# Maintainer: J. Peter Mugaas <jpmugaas@suddenlink.net>

_realname=tslib
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=1.22
pkgrel=1
pkgdesc="Touchscreen Access Library (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
url="https://github.com/kergoth/tslib"
license=('GPL')
source=("https://github.com/kergoth/tslib/releases/download/${pkgver}/${_realname}-${pkgver}.tar.xz")
sha256sums=('aaf0aed410a268d7b51385d07fe4d9d64312038e87c447ec8a24c8db0a15617a')

build() {
  cd "${srcdir}"/${_realname}-${pkgver}
  [[ -d "${srcdir}"/build-${CARCH} ]] && rm -rf "${srcdir}"/build-${CARCH}
  mkdir -p "${srcdir}"/build-${CARCH} && cd "${srcdir}"/build-${CARCH}
  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --sysconfdir=${MINGW_PREFIX}/etc \
    --enable-static \
    --enable-shared \
    --disable-input \
    --disable-touchkit \
    --disable-waveshare
    
  make
}

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