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

_realname=akira
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.0.14
pkgrel=2
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64')
pkgdesc="Akira is a native Linux Design application built in Vala and GTK. (mingw-w64)"
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}-meson"
             "${MINGW_PACKAGE_PREFIX}-ninja"
             "${MINGW_PACKAGE_PREFIX}-gcc"
             "${MINGW_PACKAGE_PREFIX}-pkg-config"
             "${MINGW_PACKAGE_PREFIX}-vala"
             "${MINGW_PACKAGE_PREFIX}-gobject-introspection"
             "${MINGW_PACKAGE_PREFIX}-itstool")
options=('strip')
license=("GPL3")
url="https://github.com/akiraux/Akira"
source=(https://github.com/akiraux/Akira/archive/refs/tags/v0.0.14.tar.gz
        Avoid-open-cmd-terminal-running-on-windows.patch)
sha256sums=('fa6c7c9db686a7c81cb3fb6b462581cec17698d32bd8e6ee6328aa70718a8a62'
            'fa8fa4787316a392649884bb621cf23f3114652a50e260470863beb5ef8f3b1d')

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

build() {
  [[ -d build-${MINGW_CHOST} ]] && rm -rf build-${MINGW_CHOST}
  mkdir -p build-${MINGW_CHOST}
  cd build-${MINGW_CHOST}

  MSYS2_ARG_CONV_EXCL="--prefix=" \
  meson \
    --prefix="${MINGW_PREFIX}" \
    --buildtype plain \
    -Dwerror=false \
    ../${_realname}-${pkgver}

  ninja
}

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

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