# Contributor: Jevgeny Krasovsky <jkrasovsky@gmail.com>

_realname=aztecgen
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.0.1
pkgrel=2
pkgdesc="A simple library for encoding \"Aztec Code\" barcodes (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://aztecgen.sourceforge.io/"
license=("BSD")
makedepends=("${MINGW_PACKAGE_PREFIX}-cc")
source=(https://downloads.sourceforge.net/sourceforge/${_realname}/${_realname}-${pkgver}.zip
        aztecgen-unix_slashes.patch
        aztecgen-typename_fix.patch
        aztecgen-noexcept.patch)
sha256sums=('d2a36022bde4234c90f6dd68c4708169df475675c4f8b83ae267f162a5437acb'
            '3558ddcbcd5d34134ce787027138e9a62be30558803015a96b43898d5d5fe0bb'
            '50bcd4be5ee159efa3772b4ba095b9d65de5e369c96fa556038cbb29693ac3ba'
            'e58ef63be35c991244df1e0e86407035e4c7f7e46f809e49152eb0044083e2b0')

build() {
  cd "${srcdir}/$_realname-$pkgver"
  patch -p1 -i "${srcdir}"/aztecgen-unix_slashes.patch
  patch -p1 -i "${srcdir}"/aztecgen-typename_fix.patch
  patch -p1 -i "${srcdir}"/aztecgen-noexcept.patch

  ${CXX} -c src/*.cpp -Iinclude/c ${CXXFLAGS} -std=c++11
  ar qcs libaztec.a *.o
}

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

  install -D -m644 -t "${pkgdir}${MINGW_PREFIX}/lib/" libaztec.a
  install -D -m644 -t "${pkgdir}${MINGW_PREFIX}/include/" include/c/aztecgen.h
}
