# Maintainer: Anton Batenev <antonbatenev@yandex.ru>

pkgname=medit
pkgver=1.3.3
pkgrel=1
pkgdesc="Useful programming and around-programming text editor"
arch=(x86_64)
url="https://github.com/abbat/medit"
license=(LGPL-2.1-only)
depends=(glib2 gtk3 hicolor-icon-theme libice libsm libx11 libxml2 vte3)
makedepends=(cmake gdk-pixbuf2 gettext glib2-devel intltool)
optdepends=('ctags: list the functions of the open document')
source=("$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz")
sha256sums=('60621eeb0d0ff1a9be7049c40729fbd2ca41d08f97f701a6071ee628a8adcaec')

build() {
    # CMAKE_BUILD_TYPE=None keeps the flags makepkg exports; the install hook
    # is off because pacman updates the icon cache itself
    cmake -S "$pkgname-$pkgver" -B build -Wno-dev \
        -DCMAKE_BUILD_TYPE=None \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DENABLE_INSTALL_HOOKS=OFF \
        -DENABLE_TERMINAL=ON \
        -DGTK_VERSION=3
    cmake --build build
}

package() {
    DESTDIR="$pkgdir" cmake --install build
    install -Dm644 "$pkgname-$pkgver/COPYING" -t "$pkgdir/usr/share/licenses/$pkgname"
}
