# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=gtksourceview
pkgbase=mingw-w64-${_realname}2
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}2"
pkgver=2.10.5
pkgrel=3
pkgdesc="A text widget adding syntax highlighting and more to GNOME (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64')
url="https://www.gnome.org"
license=("GPL")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-pkg-config" "intltool")
depends=("${MINGW_PACKAGE_PREFIX}-gtk2>=2.22.0"
         "${MINGW_PACKAGE_PREFIX}-libxml2>=2.7.7")
options=(!libtool strip staticlibs)
source=("https://download.gnome.org/sources/gtksourceview/${pkgver%.*}/gtksourceview-${pkgver}.tar.bz2")
sha256sums=('c585773743b1df8a04b1be7f7d90eecdf22681490d6810be54c81a7ae152191e')

prepare() {
  cd ${_realname}-${pkgver}
  sed -i 's#python#python2#' gtksourceview/language-specs/convert.py
}

build() {
  mkdir -p "${srcdir}/build-${MINGW_CHOST}"
  cd "${srcdir}/build-${MINGW_CHOST}"
  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --enable-shared \
    --disable-static \
    --enable-compile-warnings=maximum

  make
}

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