# Contributor: Mehdi Chinoune <mehdi.chinoune@hotmail.com>

_realname=libieee1284
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=0.2.11
_tag=${pkgver//\./_}
pkgrel=1
pkgdesc="The libieee1284 library is for communicating with parallel port devices. (mingw-w64)"
arch=('any')
mingw_arch=('ucrt64' 'clang64' 'clangarm64')
url='https://github.com/twaugh/libieee1284'
msys2_references=(
  'archlinux: libieee1284'
)
license=('spdx:GPL-2.0-or-later')
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-autotools")
source=("https://github.com/twaugh/libieee1284/archive/V${_tag}/${_realname}-${pkgver}.tar.gz"
        "001-fix-build-on-mingw.patch")
sha256sums=('eb6a4305f5d44f74b548c8dd41ec1103175cabb57f9661bec4af49e11f8a0238'
            '881240020e9d25bfb16735b3a7b17464a5c333b1b69181568c0fcb49e76fc7f8')

prepare() {
  cd "${_realname}-${_tag}"
  patch -p1 -i "${srcdir}"/001-fix-build-on-mingw.patch

  autoreconf -fiv
}

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

  ../"${_realname}-${_tag}"/configure \
    --prefix="${MINGW_PREFIX}" \
    --disable-static \
    --without-python

  make
}

check() {
  cd "${srcdir}/build-${MSYSTEM}"

  make check
}

package() {
  cd "${srcdir}/build-${MSYSTEM}"

  make install DESTDIR="${pkgdir}"
}
