# Maintainer: Zach Bacon <zachbacon@vba-m.com

_realname=gnome-text-editor
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=48.3
pkgrel=1
pkgdesc="A simple text editor for the GNOME desktop (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url='https://apps.gnome.org/TextEditor/'
msys2_repository_url='https://gitlab.gnome.org/GNOME/gnome-text-editor'
msys2_references=(
  'archlinux: gnome-text-editor'
)
license=('spdx:GPL-3.0-or-later')
depends=("${MINGW_PACKAGE_PREFIX}-cairo"
         "${MINGW_PACKAGE_PREFIX}-editorconfig-core-c"
         "${MINGW_PACKAGE_PREFIX}-gettext-runtime"
         "${MINGW_PACKAGE_PREFIX}-glib2"
         "${MINGW_PACKAGE_PREFIX}-gtk4"
         "${MINGW_PACKAGE_PREFIX}-gtksourceview5"
         "${MINGW_PACKAGE_PREFIX}-libspelling"
         "${MINGW_PACKAGE_PREFIX}-libadwaita"
         "${MINGW_PACKAGE_PREFIX}-pango")
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-meson"
             "${MINGW_PACKAGE_PREFIX}-pkgconf"
             "${MINGW_PACKAGE_PREFIX}-gobject-introspection"
             "${MINGW_PACKAGE_PREFIX}-gtk-doc"
             "${MINGW_PACKAGE_PREFIX}-gettext-tools"
             "${MINGW_PACKAGE_PREFIX}-itstool")
source=(https://download.gnome.org/sources/${_realname}/${pkgver%.*}/${_realname}-${pkgver}.tar.xz)
sha256sums=('3f9e9722394edb4d2145c06d69210b3d3fca5cd2b90d632643be750843d556ba')

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

  MSYS2_ARG_CONV_EXCL="--prefix=" \
  ${MINGW_PREFIX}/bin/meson.exe setup \
    --prefix=${MINGW_PREFIX} \
    --wrap-mode=nodownload \
    --default-library=both \
    --buildtype=plain \
    -Dbugreport_url=https://github.com/msys2/MINGW-packages/issues \
    "../${_realname}-${pkgver}"

  ${MINGW_PREFIX}/bin/meson.exe compile
}

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

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