
# Maintainer: Konstantin Podsvirov <konstantin@podsvirov.su>

_realname=pikchr
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=1.0
_pkgsha=ac94035c32
pkgrel=5
pkgdesc="A PIC-like markup language for diagrams in technical documentation (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://pikchr.org/"
msys2_repository_url="https://github.com/drhsqlite/pikchr"
license=('spdx:0BSD')
makedepends=("${MINGW_PACKAGE_PREFIX}-cc")
options=('!strip' '!buildflags')
source=("${url}/home/tarball/${_pkgsha}/${_realname}-${_pkgsha}.tar.gz"
        'LICENSE')
sha256sums=('138fcd51ac42010b1fe9f8f7aa9721644bd7ef9a02e71c933bb9a415ff510b54'
            'bb87a8beb7b525149c69a23029a6957d6d7a72751214fac7a1e4a628ac5cd555')

build() {
  [[ -d "${srcdir}/build-${MSYSTEM}" ]] && rm -rf "${srcdir}/build-${MSYSTEM}"
  cp -r "${srcdir}/${_realname}-${_pkgsha}" "${srcdir}/build-${MSYSTEM}"

  cd "${srcdir}/build-${MSYSTEM}"

  make CC="${MINGW_PREFIX}/bin/cc.exe"
}

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

  mkdir -p "${pkgdir}${MINGW_PREFIX}/bin"
  cp pikchr.exe "${pkgdir}${MINGW_PREFIX}/bin/"

  install -Dm644 "${srcdir}/LICENSE" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
}

# vim:set ts=2 sw=2 et:
