# Maintainer: Alberto Fanjul Alonso <albfan@gnome.org>

_realname=akira
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.0.16
pkgrel=2
pkgdesc="Akira is a native Linux Design application built in Vala and GTK. (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://github.com/akiraux/Akira"
license=("spdx:GPL-3.0-or-later")
depends=( "${MINGW_PACKAGE_PREFIX}-granite"
          "${MINGW_PACKAGE_PREFIX}-elementary-icon-theme"
          "${MINGW_PACKAGE_PREFIX}-gtk-elementary-theme"
          "${MINGW_PACKAGE_PREFIX}-libarchive"
          "${MINGW_PACKAGE_PREFIX}-goocanvas")
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-meson"
             "${MINGW_PACKAGE_PREFIX}-pkgconf"
             "${MINGW_PACKAGE_PREFIX}-vala"
             "${MINGW_PACKAGE_PREFIX}-gobject-introspection"
             "${MINGW_PACKAGE_PREFIX}-itstool")
source=("https://github.com/akiraux/Akira/archive/v${pkgver}/${_realname}-${pkgver}.tar.gz"
        Avoid-open-cmd-terminal-running-on-windows.patch)
sha256sums=('7740358ac2cd5de2a1d7a4c7cbd25a852c2dcb6b71f442a0280b160f6f4c6ada'
            '257ace23a5e69cf4a724473073e8933b0f01ca65f4a06845f71ffaf3d511aada')

prepare() {
  cd "${srcdir}/${_realname}-${pkgver}"
  patch -N -p1 -i "${srcdir}/Avoid-open-cmd-terminal-running-on-windows.patch"
}

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

  MSYS2_ARG_CONV_EXCL="--prefix=" \
  meson \
    --prefix="${MINGW_PREFIX}" \
    --buildtype plain \
    -Dwerror=false \
    -Dc_args=-Wno-incompatible-function-pointer-types \
    ../${_realname}-${pkgver}

  meson compile
}

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

  install -Dm644 "${srcdir}"/${_realname}-${pkgver}/COPYING \
    "${pkgdir}"${MINGW_PREFIX}/share/licenses/${_realname}/COPYING
}
